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