UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

74 lines • 3.79 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../core/resource.mjs"; import * as OrganizationProfileAPI from "./organization-profile.mjs"; import { BaseOrganizationProfileResource, OrganizationProfileResource, } from "./organization-profile.mjs"; import * as BillingAPI from "./billing/billing.mjs"; import { BaseBilling, Billing } from "./billing/billing.mjs"; import * as LogsAPI from "./logs/logs.mjs"; import { BaseLogs, Logs } from "./logs/logs.mjs"; import { SinglePage } from "../../core/pagination.mjs"; import { path } from "../../internal/utils/path.mjs"; export var BaseOrganizations = /* @__PURE__ */ (() => { class BaseOrganizations extends 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(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', (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(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(path `/organizations/${organizationID}`, options)._thenUnwrap((obj) => obj.result); } } BaseOrganizations._key = Object.freeze(['organizations']); return BaseOrganizations; })(); export 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 = OrganizationProfileResource; Organizations.BaseOrganizationProfileResource = BaseOrganizationProfileResource; Organizations.Logs = Logs; Organizations.BaseLogs = BaseLogs; Organizations.Billing = Billing; Organizations.BaseBilling = BaseBilling; return Organizations; })(); //# sourceMappingURL=organizations.mjs.map