cloudflare
Version:
The official TypeScript library for the Cloudflare API
66 lines • 2.71 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProviderConfigs = exports.BaseProviderConfigs = void 0;
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
const resource_1 = require("../../core/resource.js");
const pagination_1 = require("../../core/pagination.js");
const path_1 = require("../../internal/utils/path.js");
var BaseProviderConfigs = /* @__PURE__ */ (() => {
class BaseProviderConfigs extends resource_1.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((0, path_1.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((0, path_1.path) `/accounts/${account_id}/ai-gateway/gateways/${gatewayID}/provider_configs`, (pagination_1.V4PagePaginationArray), { query, ...options });
}
}
BaseProviderConfigs._key = Object.freeze([
'aiGateway',
'providerConfigs',
]);
return BaseProviderConfigs;
})();
exports.BaseProviderConfigs = BaseProviderConfigs;
class ProviderConfigs extends BaseProviderConfigs {
}
exports.ProviderConfigs = ProviderConfigs;
//# sourceMappingURL=provider-configs.js.map