cloudflare/cloudflare-typescript

Public

mirrored from https://github.com/cloudflare/cloudflare-typescriptAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v3.2.0

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

src/resources/ai-gateway/ai-gateway.ts

343lines · modecode

1// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
3import * as Core from 'cloudflare/core';
4import { APIResource } from 'cloudflare/resource';
5import * as LogsAPI from 'cloudflare/resources/ai-gateway/logs';
6import { V4PagePaginationArray, type V4PagePaginationArrayParams } from 'cloudflare/pagination';
7
8export class AIGateway extends APIResource {
9 logs: LogsAPI.Logs = new LogsAPI.Logs(this._client);
10
11 /**
12 * Create a new Gateway
13 */
14 create(
15 params: AIGatewayCreateParams,
16 options?: Core.RequestOptions,
17 ): Core.APIPromise<AIGatewayCreateResponse> {
18 const { account_id, ...body } = params;
19 return (
20 this._client.post(`/accounts/${account_id}/ai-gateway/gateways`, {
21 body,
22 ...options,
23 }) as Core.APIPromise<{ result: AIGatewayCreateResponse }>
24 )._thenUnwrap((obj) => obj.result);
25 }
26
27 /**
28 * Update a Gateway
29 */
30 update(
31 id: string,
32 params: AIGatewayUpdateParams,
33 options?: Core.RequestOptions,
34 ): Core.APIPromise<AIGatewayUpdateResponse> {
35 const { account_id, ...body } = params;
36 return (
37 this._client.put(`/accounts/${account_id}/ai-gateway/gateways/${id}`, {
38 body,
39 ...options,
40 }) as Core.APIPromise<{ result: AIGatewayUpdateResponse }>
41 )._thenUnwrap((obj) => obj.result);
42 }
43
44 /**
45 * List Gateway's
46 */
47 list(
48 params: AIGatewayListParams,
49 options?: Core.RequestOptions,
50 ): Core.PagePromise<AIGatewayListResponsesV4PagePaginationArray, AIGatewayListResponse> {
51 const { account_id, ...query } = params;
52 return this._client.getAPIList(
53 `/accounts/${account_id}/ai-gateway/gateways`,
54 AIGatewayListResponsesV4PagePaginationArray,
55 { query, ...options },
56 );
57 }
58
59 /**
60 * Delete a Gateway
61 */
62 delete(
63 id: string,
64 params: AIGatewayDeleteParams,
65 options?: Core.RequestOptions,
66 ): Core.APIPromise<AIGatewayDeleteResponse> {
67 const { account_id } = params;
68 return (
69 this._client.delete(`/accounts/${account_id}/ai-gateway/gateways/${id}`, options) as Core.APIPromise<{
70 result: AIGatewayDeleteResponse;
71 }>
72 )._thenUnwrap((obj) => obj.result);
73 }
74
75 /**
76 * Fetch a Gateway
77 */
78 get(
79 id: string,
80 params: AIGatewayGetParams,
81 options?: Core.RequestOptions,
82 ): Core.APIPromise<AIGatewayGetResponse> {
83 const { account_id } = params;
84 return (
85 this._client.get(`/accounts/${account_id}/ai-gateway/gateways/${id}`, options) as Core.APIPromise<{
86 result: AIGatewayGetResponse;
87 }>
88 )._thenUnwrap((obj) => obj.result);
89 }
90}
91
92export class AIGatewayListResponsesV4PagePaginationArray extends V4PagePaginationArray<AIGatewayListResponse> {}
93
94export interface AIGatewayCreateResponse {
95 task: AIGatewayCreateResponse.Task;
96}
97
98export namespace AIGatewayCreateResponse {
99 export interface Task {
100 id: string;
101
102 cache_invalidate_on_update: boolean;
103
104 cache_ttl: number;
105
106 collect_logs: boolean;
107
108 created_at: string;
109
110 modified_at: string;
111
112 name: string;
113
114 slug: string;
115
116 rate_limiting_interval?: number;
117
118 rate_limiting_limit?: number;
119
120 rate_limiting_technique?: string;
121 }
122}
123
124export interface AIGatewayUpdateResponse {
125 id: string;
126
127 cache_invalidate_on_update: boolean;
128
129 cache_ttl: number;
130
131 collect_logs: boolean;
132
133 created_at: string;
134
135 modified_at: string;
136
137 name: string;
138
139 slug: string;
140
141 rate_limiting_interval?: number;
142
143 rate_limiting_limit?: number;
144
145 rate_limiting_technique?: string;
146}
147
148export interface AIGatewayListResponse {
149 id: string;
150
151 cache_invalidate_on_update: boolean;
152
153 cache_ttl: number;
154
155 collect_logs: boolean;
156
157 created_at: string;
158
159 modified_at: string;
160
161 name: string;
162
163 slug: string;
164
165 rate_limiting_interval?: number;
166
167 rate_limiting_limit?: number;
168
169 rate_limiting_technique?: string;
170}
171
172export interface AIGatewayDeleteResponse {
173 id: string;
174
175 cache_invalidate_on_update: boolean;
176
177 cache_ttl: number;
178
179 collect_logs: boolean;
180
181 created_at: string;
182
183 modified_at: string;
184
185 name: string;
186
187 slug: string;
188
189 rate_limiting_interval?: number;
190
191 rate_limiting_limit?: number;
192
193 rate_limiting_technique?: string;
194}
195
196export interface AIGatewayGetResponse {
197 id: string;
198
199 cache_invalidate_on_update: boolean;
200
201 cache_ttl: number;
202
203 collect_logs: boolean;
204
205 created_at: string;
206
207 modified_at: string;
208
209 name: string;
210
211 slug: string;
212
213 rate_limiting_interval?: number;
214
215 rate_limiting_limit?: number;
216
217 rate_limiting_technique?: string;
218}
219
220export interface AIGatewayCreateParams {
221 /**
222 * Path param:
223 */
224 account_id: string;
225
226 /**
227 * Body param:
228 */
229 cache_invalidate_on_update: boolean;
230
231 /**
232 * Body param:
233 */
234 cache_ttl: number;
235
236 /**
237 * Body param:
238 */
239 collect_logs: boolean;
240
241 /**
242 * Body param:
243 */
244 name: string;
245
246 /**
247 * Body param:
248 */
249 slug: string;
250
251 /**
252 * Body param:
253 */
254 rate_limiting_interval?: number;
255
256 /**
257 * Body param:
258 */
259 rate_limiting_limit?: number;
260
261 /**
262 * Body param:
263 */
264 rate_limiting_technique?: string;
265}
266
267export interface AIGatewayUpdateParams {
268 /**
269 * Path param:
270 */
271 account_id: string;
272
273 /**
274 * Body param:
275 */
276 cache_invalidate_on_update: boolean;
277
278 /**
279 * Body param:
280 */
281 cache_ttl: number;
282
283 /**
284 * Body param:
285 */
286 collect_logs: boolean;
287
288 /**
289 * Body param:
290 */
291 name: string;
292
293 /**
294 * Body param:
295 */
296 slug: string;
297
298 /**
299 * Body param:
300 */
301 rate_limiting_interval?: number;
302
303 /**
304 * Body param:
305 */
306 rate_limiting_limit?: number;
307
308 /**
309 * Body param:
310 */
311 rate_limiting_technique?: string;
312}
313
314export interface AIGatewayListParams extends V4PagePaginationArrayParams {
315 /**
316 * Path param:
317 */
318 account_id: string;
319
320 /**
321 * Query param:
322 */
323 id?: string;
324
325 /**
326 * Query param: Order By Column Name
327 */
328 order_by?: string;
329}
330
331export interface AIGatewayDeleteParams {
332 account_id: string;
333}
334
335export interface AIGatewayGetParams {
336 account_id: string;
337}
338
339export namespace AIGateway {
340 export import Logs = LogsAPI.Logs;
341 export import LogGetResponse = LogsAPI.LogGetResponse;
342 export import LogGetParams = LogsAPI.LogGetParams;
343}
344