UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

80 lines • 4.2 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Organizations = exports.BaseOrganizations = 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 OrganizationProfileAPI = tslib_1.__importStar(require("./organization-profile.js")); const organization_profile_1 = require("./organization-profile.js"); const BillingAPI = tslib_1.__importStar(require("./billing/billing.js")); const billing_1 = require("./billing/billing.js"); const LogsAPI = tslib_1.__importStar(require("./logs/logs.js")); const logs_1 = require("./logs/logs.js"); const pagination_1 = require("../../core/pagination.js"); const path_1 = require("../../internal/utils/path.js"); var BaseOrganizations = /* @__PURE__ */ (() => { class BaseOrganizations extends resource_1.APIResource { /** * Create a new organization for a user. Sub-organization creation availability * depends on the organization's capabilities. (Currently in Public Beta - see * https://developers.cloudflare.com/fundamentals/organizations/) */ create(body, options) { return this._client.post('/organizations', { body, ...options })._thenUnwrap((obj) => obj.result); } /** * Update an organization's name. (Currently in Public Beta - see * https://developers.cloudflare.com/fundamentals/organizations/) */ update(organizationID, body, options) { return this._client.put((0, path_1.path) `/organizations/${organizationID}`, { body, ...options })._thenUnwrap((obj) => obj.result); } /** * Retrieve a list of organizations a particular user has access to. (Currently in * Public Beta - see https://developers.cloudflare.com/fundamentals/organizations/) */ list(query = {}, options) { return this._client.getAPIList('/organizations', (pagination_1.SinglePage), { query, ...options }); } /** * Delete an organization. The organization MUST be empty before deleting. It must * not contain any sub-organizations, accounts, members or users. Sub-organization * deletion availability depends on the organization's capabilities. (Currently in * Public Beta - see https://developers.cloudflare.com/fundamentals/organizations/) * * **Access Control:** Restricted to enterprise organizations. */ delete(organizationID, options) { return this._client.delete((0, path_1.path) `/organizations/${organizationID}`, options)._thenUnwrap((obj) => obj.result); } /** * Retrieve the details of a certain organization. (Currently in Public Beta - see * https://developers.cloudflare.com/fundamentals/organizations/) */ get(organizationID, options) { return this._client.get((0, path_1.path) `/organizations/${organizationID}`, options)._thenUnwrap((obj) => obj.result); } } BaseOrganizations._key = Object.freeze(['organizations']); return BaseOrganizations; })(); exports.BaseOrganizations = BaseOrganizations; var Organizations = /* @__PURE__ */ (() => { class Organizations extends BaseOrganizations { constructor() { super(...arguments); this.organizationProfile = new OrganizationProfileAPI.OrganizationProfileResource(this._client); this.logs = new LogsAPI.Logs(this._client); this.billing = new BillingAPI.Billing(this._client); } } Organizations.OrganizationProfileResource = organization_profile_1.OrganizationProfileResource; Organizations.BaseOrganizationProfileResource = organization_profile_1.BaseOrganizationProfileResource; Organizations.Logs = logs_1.Logs; Organizations.BaseLogs = logs_1.BaseLogs; Organizations.Billing = billing_1.Billing; Organizations.BaseBilling = billing_1.BaseBilling; return Organizations; })(); exports.Organizations = Organizations; //# sourceMappingURL=organizations.js.map