cloudflare
Version:
The official TypeScript library for the Cloudflare API
107 lines • 4.07 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Profiles = exports.BaseProfiles = 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 PaymentMethodAPI = tslib_1.__importStar(require("./payment-method.js"));
const payment_method_1 = require("./payment-method.js");
const headers_1 = require("../../../internal/headers.js");
const path_1 = require("../../../internal/utils/path.js");
var BaseProfiles = /* @__PURE__ */ (() => {
class BaseProfiles extends resource_1.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((0, path_1.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((0, path_1.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((0, path_1.path) `/accounts/${account_id}/billing/profile`, {
...options,
headers: (0, headers_1.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((0, path_1.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((0, path_1.path) `/accounts/${account_id}/billing/profile`, { body, ...options })._thenUnwrap((obj) => obj.result);
}
}
BaseProfiles._key = Object.freeze([
'billing',
'profiles',
]);
return BaseProfiles;
})();
exports.BaseProfiles = BaseProfiles;
var Profiles = /* @__PURE__ */ (() => {
class Profiles extends BaseProfiles {
constructor() {
super(...arguments);
this.paymentMethod = new PaymentMethodAPI.PaymentMethod(this._client);
}
}
Profiles.PaymentMethod = payment_method_1.PaymentMethod;
Profiles.BasePaymentMethod = payment_method_1.BasePaymentMethod;
return Profiles;
})();
exports.Profiles = Profiles;
//# sourceMappingURL=profiles.js.map