-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathgateway-configs.ts
More file actions
374 lines (324 loc) · 9.77 KB
/
Copy pathgateway-configs.ts
File metadata and controls
374 lines (324 loc) · 9.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../resource';
import { isRequestOptions } from '../core';
import * as Core from '../core';
import { GatewayConfigsCursorIDPage, type GatewayConfigsCursorIDPageParams } from '../pagination';
export class GatewayConfigs extends APIResource {
/**
* Create a new GatewayConfig to proxy API requests through the agent gateway. The
* config specifies the target endpoint and how credentials should be applied.
*/
create(body: GatewayConfigCreateParams, options?: Core.RequestOptions): Core.APIPromise<GatewayConfigView> {
return this._client.post('/v1/gateway-configs', { body, ...options });
}
/**
* Get a specific GatewayConfig by its unique identifier.
*/
retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<GatewayConfigView> {
return this._client.get(`/v1/gateway-configs/${id}`, options);
}
/**
* Update an existing GatewayConfig. All fields are optional.
*/
update(
id: string,
body?: GatewayConfigUpdateParams,
options?: Core.RequestOptions,
): Core.APIPromise<GatewayConfigView>;
update(id: string, options?: Core.RequestOptions): Core.APIPromise<GatewayConfigView>;
update(
id: string,
body: GatewayConfigUpdateParams | Core.RequestOptions = {},
options?: Core.RequestOptions,
): Core.APIPromise<GatewayConfigView> {
if (isRequestOptions(body)) {
return this.update(id, {}, body);
}
return this._client.post(`/v1/gateway-configs/${id}`, { body, ...options });
}
/**
* List all GatewayConfigs for the authenticated account, including system-provided
* configs like 'anthropic' and 'openai'.
*/
list(
query?: GatewayConfigListParams,
options?: Core.RequestOptions,
): Core.PagePromise<GatewayConfigViewsGatewayConfigsCursorIDPage, GatewayConfigView>;
list(
options?: Core.RequestOptions,
): Core.PagePromise<GatewayConfigViewsGatewayConfigsCursorIDPage, GatewayConfigView>;
list(
query: GatewayConfigListParams | Core.RequestOptions = {},
options?: Core.RequestOptions,
): Core.PagePromise<GatewayConfigViewsGatewayConfigsCursorIDPage, GatewayConfigView> {
if (isRequestOptions(query)) {
return this.list({}, query);
}
return this._client.getAPIList('/v1/gateway-configs', GatewayConfigViewsGatewayConfigsCursorIDPage, {
query,
...options,
});
}
/**
* Delete an existing GatewayConfig. This action is irreversible.
*/
delete(
id: string,
body?: GatewayConfigDeleteParams | null | undefined,
options?: Core.RequestOptions,
): Core.APIPromise<GatewayConfigView> {
return this._client.post(`/v1/gateway-configs/${id}/delete`, { body, ...options });
}
}
export class GatewayConfigViewsGatewayConfigsCursorIDPage extends GatewayConfigsCursorIDPage<GatewayConfigView> {}
/**
* Parameters required to create a new GatewayConfig.
*/
export interface GatewayConfigCreateParameters {
/**
* How credentials should be applied to proxied requests. Specify the type
* ('header', 'bearer') and optional key field.
*/
auth_mechanism: GatewayConfigCreateParameters.AuthMechanism;
/**
* The target endpoint URL (e.g., 'https://api.anthropic.com').
*/
endpoint: string;
/**
* The human-readable name for the GatewayConfig. Must be unique within your
* account.
*/
name: string;
/**
* Optional description for this gateway configuration.
*/
description?: string | null;
}
export namespace GatewayConfigCreateParameters {
/**
* How credentials should be applied to proxied requests. Specify the type
* ('header', 'bearer') and optional key field.
*/
export interface AuthMechanism {
/**
* The type of authentication mechanism: 'header', 'bearer'.
*/
type: string;
/**
* For 'header' type: the header name (e.g., 'x-api-key').
*/
key?: string | null;
}
}
/**
* A paginated list of GatewayConfigs.
*/
export interface GatewayConfigListView {
/**
* The list of GatewayConfigs.
*/
gateway_configs: Array<GatewayConfigView>;
/**
* Whether there are more results available beyond this page.
*/
has_more: boolean;
/**
* Total count of GatewayConfigs that match the query.
*/
total_count?: number | null;
}
/**
* Parameters for updating an existing GatewayConfig. All fields are optional -
* only specified fields will be updated.
*/
export interface GatewayConfigUpdateParameters {
/**
* Defines how credentials are applied to HTTP requests when proxying through the
* gateway.
*/
auth_mechanism?: GatewayConfigUpdateParameters.AuthMechanism | null;
/**
* New description for this gateway configuration.
*/
description?: string | null;
/**
* New target endpoint URL (e.g., 'https://api.anthropic.com').
*/
endpoint?: string | null;
/**
* New name for the GatewayConfig. Must be unique within your account.
*/
name?: string | null;
}
export namespace GatewayConfigUpdateParameters {
/**
* Defines how credentials are applied to HTTP requests when proxying through the
* gateway.
*/
export interface AuthMechanism {
/**
* The type of authentication mechanism: 'header', 'bearer'.
*/
type: string;
/**
* For 'header' type: the header name (e.g., 'x-api-key').
*/
key?: string | null;
}
}
/**
* A GatewayConfig defines a configuration for proxying API requests through the
* agent gateway. It specifies the target endpoint and how credentials should be
* applied.
*/
export interface GatewayConfigView {
/**
* The unique identifier of the GatewayConfig.
*/
id: string;
/**
* How credentials should be applied to proxied requests.
*/
auth_mechanism: GatewayConfigView.AuthMechanism;
/**
* Creation time of the GatewayConfig (Unix timestamp in milliseconds).
*/
create_time_ms: number;
/**
* The target endpoint URL (e.g., 'https://api.anthropic.com').
*/
endpoint: string;
/**
* The human-readable name of the GatewayConfig. Unique per account (or globally
* for system configs).
*/
name: string;
/**
* The account ID that owns this config.
*/
account_id?: string | null;
/**
* Optional description for this gateway configuration.
*/
description?: string | null;
}
export namespace GatewayConfigView {
/**
* How credentials should be applied to proxied requests.
*/
export interface AuthMechanism {
/**
* The type of authentication mechanism: 'header', 'bearer'.
*/
type: string;
/**
* For 'header' type: the header name (e.g., 'x-api-key').
*/
key?: string | null;
}
}
export interface GatewayConfigCreateParams {
/**
* How credentials should be applied to proxied requests. Specify the type
* ('header', 'bearer') and optional key field.
*/
auth_mechanism: GatewayConfigCreateParams.AuthMechanism;
/**
* The target endpoint URL (e.g., 'https://api.anthropic.com').
*/
endpoint: string;
/**
* The human-readable name for the GatewayConfig. Must be unique within your
* account.
*/
name: string;
/**
* Optional description for this gateway configuration.
*/
description?: string | null;
}
export namespace GatewayConfigCreateParams {
/**
* How credentials should be applied to proxied requests. Specify the type
* ('header', 'bearer') and optional key field.
*/
export interface AuthMechanism {
/**
* The type of authentication mechanism: 'header', 'bearer'.
*/
type: string;
/**
* For 'header' type: the header name (e.g., 'x-api-key').
*/
key?: string | null;
}
}
export interface GatewayConfigUpdateParams {
/**
* Defines how credentials are applied to HTTP requests when proxying through the
* gateway.
*/
auth_mechanism?: GatewayConfigUpdateParams.AuthMechanism | null;
/**
* New description for this gateway configuration.
*/
description?: string | null;
/**
* New target endpoint URL (e.g., 'https://api.anthropic.com').
*/
endpoint?: string | null;
/**
* New name for the GatewayConfig. Must be unique within your account.
*/
name?: string | null;
}
export namespace GatewayConfigUpdateParams {
/**
* Defines how credentials are applied to HTTP requests when proxying through the
* gateway.
*/
export interface AuthMechanism {
/**
* The type of authentication mechanism: 'header', 'bearer'.
*/
type: string;
/**
* For 'header' type: the header name (e.g., 'x-api-key').
*/
key?: string | null;
}
}
export interface GatewayConfigListParams extends GatewayConfigsCursorIDPageParams {
/**
* Filter by ID.
*/
id?: string;
/**
* If true (default), includes total_count in the response. Set to false to skip
* the count query for better performance on large datasets.
*/
include_total_count?: boolean;
/**
* Filter by name (partial match supported).
*/
name?: string;
/**
* Search by gateway config ID or name.
*/
search?: string;
}
export interface GatewayConfigDeleteParams {}
GatewayConfigs.GatewayConfigViewsGatewayConfigsCursorIDPage = GatewayConfigViewsGatewayConfigsCursorIDPage;
export declare namespace GatewayConfigs {
export {
type GatewayConfigCreateParameters as GatewayConfigCreateParameters,
type GatewayConfigListView as GatewayConfigListView,
type GatewayConfigUpdateParameters as GatewayConfigUpdateParameters,
type GatewayConfigView as GatewayConfigView,
GatewayConfigViewsGatewayConfigsCursorIDPage as GatewayConfigViewsGatewayConfigsCursorIDPage,
type GatewayConfigCreateParams as GatewayConfigCreateParams,
type GatewayConfigUpdateParams as GatewayConfigUpdateParams,
type GatewayConfigListParams as GatewayConfigListParams,
type GatewayConfigDeleteParams as GatewayConfigDeleteParams,
};
}