UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

61 lines • 2.46 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../core/resource.mjs"; import { V4PagePaginationArray } from "../../core/pagination.mjs"; import { path } from "../../internal/utils/path.mjs"; export var BaseProviderConfigs = /* @__PURE__ */ (() => { class BaseProviderConfigs extends APIResource { /** * Stores an upstream AI provider API key for an AI Gateway in the Secrets Store * configured on the gateway, with an optional rate limit. Pass `secret` to store a * new key, or omit it to use an existing Secrets Store secret. * * @example * ```ts * const providerConfig = * await client.aiGateway.providerConfigs.create( * 'my-gateway', * { * account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0', * alias: 'alias', * default_config: true, * provider_slug: 'provider_slug', * }, * ); * ``` */ create(gatewayID, params, options) { const { account_id, ...body } = params; return this._client.post(path `/accounts/${account_id}/ai-gateway/gateways/${gatewayID}/provider_configs`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Lists the provider keys stored for an AI Gateway. Responses show a masked * preview of each key, never the key itself. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const providerConfigListResponse of client.aiGateway.providerConfigs.list( * 'my-gateway', * { account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0' }, * )) { * // ... * } * ``` */ list(gatewayID, params, options) { const { account_id, ...query } = params; return this._client.getAPIList(path `/accounts/${account_id}/ai-gateway/gateways/${gatewayID}/provider_configs`, (V4PagePaginationArray), { query, ...options }); } } BaseProviderConfigs._key = Object.freeze([ 'aiGateway', 'providerConfigs', ]); return BaseProviderConfigs; })(); export class ProviderConfigs extends BaseProviderConfigs { } //# sourceMappingURL=provider-configs.mjs.map