UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

65 lines • 2.16 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../../../core/resource.mjs"; import * as ConfigAPI from "./config.mjs"; import { BaseConfig, Config, } from "./config.mjs"; import { path } from "../../../../internal/utils/path.mjs"; export var BaseTopup = /* @__PURE__ */ (() => { class BaseTopup extends 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(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(path `/accounts/${account_id}/ai-gateway/billing/topup/status`, { body, ...options, })._thenUnwrap((obj) => obj.result); } } BaseTopup._key = Object.freeze([ 'aiGateway', 'billing', 'topup', ]); return BaseTopup; })(); export var Topup = /* @__PURE__ */ (() => { class Topup extends BaseTopup { constructor() { super(...arguments); this.config = new ConfigAPI.Config(this._client); } } Topup.Config = Config; Topup.BaseConfig = BaseConfig; return Topup; })(); //# sourceMappingURL=topup.mjs.map