cloudflare
Version:
The official TypeScript library for the Cloudflare API
71 lines • 2.44 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Topup = exports.BaseTopup = void 0;
const tslib_1 = require("../../../../internal/tslib.js");
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
const resource_1 = require("../../../../core/resource.js");
const ConfigAPI = tslib_1.__importStar(require("./config.js"));
const config_1 = require("./config.js");
const path_1 = require("../../../../internal/utils/path.js");
var BaseTopup = /* @__PURE__ */ (() => {
class BaseTopup extends resource_1.APIResource {
/**
* Create a credit top-up for the given account, charged to the account's default
* payment method.
*
* @example
* ```ts
* const topup = await client.aiGateway.billing.topup.create({
* account_id: 'account_id',
* amount: 5000,
* });
* ```
*/
create(params, options) {
const { account_id, ...body } = params;
return this._client.post((0, path_1.path) `/accounts/${account_id}/ai-gateway/billing/topup`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Get the payment processing status of a top-up by its invoice ID.
*
* @example
* ```ts
* const response =
* await client.aiGateway.billing.topup.status({
* account_id: 'account_id',
* payment_intent_id: 'in_1abc',
* });
* ```
*/
status(params, options) {
const { account_id, ...body } = params;
return this._client.post((0, path_1.path) `/accounts/${account_id}/ai-gateway/billing/topup/status`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
}
BaseTopup._key = Object.freeze([
'aiGateway',
'billing',
'topup',
]);
return BaseTopup;
})();
exports.BaseTopup = BaseTopup;
var Topup = /* @__PURE__ */ (() => {
class Topup extends BaseTopup {
constructor() {
super(...arguments);
this.config = new ConfigAPI.Config(this._client);
}
}
Topup.Config = config_1.Config;
Topup.BaseConfig = config_1.BaseConfig;
return Topup;
})();
exports.Topup = Topup;
//# sourceMappingURL=topup.js.map