cloudflare
Version:
The official TypeScript library for the Cloudflare API
105 lines • 3.73 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Apps = exports.BaseApps = void 0;
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
const resource_1 = require("../../core/resource.js");
const pagination_1 = require("../../core/pagination.js");
const path_1 = require("../../internal/utils/path.js");
var BaseApps = /* @__PURE__ */ (() => {
class BaseApps extends resource_1.APIResource {
/**
* Creates a new App for an account
*
* @example
* ```ts
* const app = await client.magicTransit.apps.create({
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* name: 'Cloudflare Dashboard',
* type: 'Development',
* });
* ```
*/
create(params, options) {
const { account_id, ...body } = params;
return this._client.post((0, path_1.path) `/accounts/${account_id}/magic/apps`, { body, ...options })._thenUnwrap((obj) => obj.result);
}
/**
* Updates an Account App
*
* @example
* ```ts
* const app = await client.magicTransit.apps.update(
* '023e105f4ecef8ad9ca31a8372d0c353',
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
update(accountAppID, params, options) {
const { account_id, ...body } = params;
return this._client.put((0, path_1.path) `/accounts/${account_id}/magic/apps/${accountAppID}`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Lists Apps associated with an account.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const appListResponse of client.magicTransit.apps.list(
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* )) {
* // ...
* }
* ```
*/
list(params, options) {
const { account_id } = params;
return this._client.getAPIList((0, path_1.path) `/accounts/${account_id}/magic/apps`, (pagination_1.SinglePage), options);
}
/**
* Deletes specific Account App.
*
* @example
* ```ts
* const app = await client.magicTransit.apps.delete(
* '023e105f4ecef8ad9ca31a8372d0c353',
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
delete(accountAppID, params, options) {
const { account_id } = params;
return this._client.delete((0, path_1.path) `/accounts/${account_id}/magic/apps/${accountAppID}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Updates an Account App
*
* @example
* ```ts
* const response = await client.magicTransit.apps.edit(
* '023e105f4ecef8ad9ca31a8372d0c353',
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
edit(accountAppID, params, options) {
const { account_id, ...body } = params;
return this._client.patch((0, path_1.path) `/accounts/${account_id}/magic/apps/${accountAppID}`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
}
BaseApps._key = Object.freeze([
'magicTransit',
'apps',
]);
return BaseApps;
})();
exports.BaseApps = BaseApps;
class Apps extends BaseApps {
}
exports.Apps = Apps;
//# sourceMappingURL=apps.js.map