cloudflare
Version:
The official TypeScript library for the Cloudflare API
66 lines • 2.6 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SpendingLimit = exports.BaseSpendingLimit = void 0;
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
const resource_1 = require("../../../core/resource.js");
const path_1 = require("../../../internal/utils/path.js");
var BaseSpendingLimit = /* @__PURE__ */ (() => {
class BaseSpendingLimit extends resource_1.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((0, path_1.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((0, path_1.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((0, path_1.path) `/accounts/${account_id}/ai-gateway/billing/spending-limit`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseSpendingLimit._key = Object.freeze([
'aiGateway',
'billing',
'spendingLimit',
]);
return BaseSpendingLimit;
})();
exports.BaseSpendingLimit = BaseSpendingLimit;
class SpendingLimit extends BaseSpendingLimit {
}
exports.SpendingLimit = SpendingLimit;
//# sourceMappingURL=spending-limit.js.map