UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

101 lines • 3.72 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../../core/resource.mjs"; import * as PaymentMethodAPI from "./payment-method.mjs"; import { BasePaymentMethod, PaymentMethod, } from "./payment-method.mjs"; import { buildHeaders } from "../../../internal/headers.mjs"; import { path } from "../../../internal/utils/path.mjs"; export var BaseProfiles = /* @__PURE__ */ (() => { class BaseProfiles extends APIResource { /** * Creates a billing profile for an account. * * @example * ```ts * const profile = await client.billing.profiles.create({ * account_id: '023e105f4ecef8ad9ca31a8372d0c353', * }); * ``` */ create(params, options) { const { account_id, ...body } = params; return this._client.post(path `/accounts/${account_id}/billing/profile`, { body, ...options })._thenUnwrap((obj) => obj.result); } /** * Updates the billing profile for an account. * * @example * ```ts * const profile = await client.billing.profiles.update({ * account_id: '023e105f4ecef8ad9ca31a8372d0c353', * }); * ``` */ update(params, options) { const { account_id, ...body } = params; return this._client.put(path `/accounts/${account_id}/billing/profile`, { body, ...options })._thenUnwrap((obj) => obj.result); } /** * Deletes the billing profile for an account. * * @example * ```ts * await client.billing.profiles.delete({ * account_id: '023e105f4ecef8ad9ca31a8372d0c353', * }); * ``` */ delete(params, options) { const { account_id } = params; return this._client.delete(path `/accounts/${account_id}/billing/profile`, { ...options, headers: buildHeaders([{ Accept: '*/*' }, options?.headers]), }); } /** * Gets the current billing profile for the account. * * @example * ```ts * const profile = await client.billing.profiles.get({ * account_id: '023e105f4ecef8ad9ca31a8372d0c353', * }); * ``` */ get(params, options) { const { account_id } = params; return this._client.get(path `/accounts/${account_id}/billing/profile`, options)._thenUnwrap((obj) => obj.result); } /** * Updates the billing email addresses and preferred locale for an account. * * @example * ```ts * const response = * await client.billing.profiles.updateBillingEmail({ * account_id: '023e105f4ecef8ad9ca31a8372d0c353', * }); * ``` */ updateBillingEmail(params, options) { const { account_id, ...body } = params; return this._client.patch(path `/accounts/${account_id}/billing/profile`, { body, ...options })._thenUnwrap((obj) => obj.result); } } BaseProfiles._key = Object.freeze([ 'billing', 'profiles', ]); return BaseProfiles; })(); export var Profiles = /* @__PURE__ */ (() => { class Profiles extends BaseProfiles { constructor() { super(...arguments); this.paymentMethod = new PaymentMethodAPI.PaymentMethod(this._client); } } Profiles.PaymentMethod = PaymentMethod; Profiles.BasePaymentMethod = BasePaymentMethod; return Profiles; })(); //# sourceMappingURL=profiles.mjs.map