cloudflare
Version:
The official TypeScript library for the Cloudflare API
61 lines • 2.34 kB
JavaScript
// 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 BaseSpendingLimit = /* @__PURE__ */ (() => {
class BaseSpendingLimit extends APIResource {
/**
* Deprecated: spending limits can no longer be created, enabled, or modified and
* this endpoint always responds 403. Use the new AI Gateway spend limits instead:
* https://developers.cloudflare.com/ai-gateway/features/spend-limits/. Existing
* limits can be removed via DELETE /spending-limit.
*
* @deprecated
*/
create(params, options) {
const { account_id, ...body } = params;
return this._client.post(path `/accounts/${account_id}/ai-gateway/billing/spending-limit`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Remove the spending limit for the account.
*
* @example
* ```ts
* const spendingLimit =
* await client.aiGateway.billing.spendingLimit.delete({
* account_id: 'account_id',
* });
* ```
*/
delete(params, options) {
const { account_id } = params;
return this._client.delete(path `/accounts/${account_id}/ai-gateway/billing/spending-limit`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Retrieve the current spending limit configuration for the account.
*
* @example
* ```ts
* const spendingLimit =
* await client.aiGateway.billing.spendingLimit.get({
* account_id: 'account_id',
* });
* ```
*/
get(params, options) {
const { account_id } = params;
return this._client.get(path `/accounts/${account_id}/ai-gateway/billing/spending-limit`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseSpendingLimit._key = Object.freeze([
'aiGateway',
'billing',
'spendingLimit',
]);
return BaseSpendingLimit;
})();
export class SpendingLimit extends BaseSpendingLimit {
}
//# sourceMappingURL=spending-limit.mjs.map