UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

69 lines • 2.49 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../../../core/resource.mjs"; import { path } from "../../../../internal/utils/path.mjs"; export var BaseConfig = /* @__PURE__ */ (() => { class BaseConfig extends APIResource { /** * Configure auto top-up with a balance threshold and top-up amount. Dashboard * sessions only: API token, OAuth, and service credentials are rejected with 403. * * @example * ```ts * const config = * await client.aiGateway.billing.topup.config.create({ * account_id: 'account_id', * amount: 5000, * threshold: 500, * }); * ``` */ create(params, options) { const { account_id, ...body } = params; return this._client.post(path `/accounts/${account_id}/ai-gateway/billing/topup/config`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Remove the auto top-up configuration for the account. Dashboard sessions only: * API token, OAuth, and service credentials are rejected with 403. * * @example * ```ts * const config = * await client.aiGateway.billing.topup.config.delete({ * account_id: 'account_id', * }); * ``` */ delete(params, options) { const { account_id } = params; return this._client.delete(path `/accounts/${account_id}/ai-gateway/billing/topup/config`, options)._thenUnwrap((obj) => obj.result); } /** * Retrieve the current auto top-up threshold, amount, and any error state. * * @example * ```ts * const config = * await client.aiGateway.billing.topup.config.get({ * account_id: 'account_id', * }); * ``` */ get(params, options) { const { account_id } = params; return this._client.get(path `/accounts/${account_id}/ai-gateway/billing/topup/config`, options)._thenUnwrap((obj) => obj.result); } } BaseConfig._key = Object.freeze([ 'aiGateway', 'billing', 'topup', 'config', ]); return BaseConfig; })(); export class Config extends BaseConfig { } //# sourceMappingURL=config.mjs.map