cloudflare
Version:
The official TypeScript library for the Cloudflare API
78 lines • 3.1 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 Spectrum application from a configuration using a name for the
* origin.
*
* @example
* ```ts
* const app = await client.spectrum.apps.create({
* zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
* dns: {},
* protocol: 'tcp/22',
* traffic_type: 'direct',
* });
* ```
*/
create(params, options) {
const { zone_id, ...body } = params;
return this._client.post((0, path_1.path) `/zones/${zone_id}/spectrum/apps`, { body, ...options })._thenUnwrap((obj) => obj.result);
}
/**
* Updates a previously existing application's configuration that uses a name for
* the origin.
*
* @example
* ```ts
* const app = await client.spectrum.apps.update(
* '023e105f4ecef8ad9ca31a8372d0c353',
* {
* zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
* dns: {},
* protocol: 'tcp/22',
* traffic_type: 'direct',
* },
* );
* ```
*/
update(appID, params, options) {
const { zone_id, ...body } = params;
return this._client.put((0, path_1.path) `/zones/${zone_id}/spectrum/apps/${appID}`, { body, ...options })._thenUnwrap((obj) => obj.result);
}
/**
* Retrieves a list of currently existing Spectrum applications inside a zone.
*/
list(params, options) {
const { zone_id, ...query } = params;
return this._client.getAPIList((0, path_1.path) `/zones/${zone_id}/spectrum/apps`, (pagination_1.V4PagePaginationArray), { query, ...options });
}
/**
* Deletes a previously existing application.
*/
delete(appID, params, options) {
const { zone_id } = params;
return this._client.delete((0, path_1.path) `/zones/${zone_id}/spectrum/apps/${appID}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Gets the application configuration of a specific application inside a zone.
*/
get(appID, params, options) {
const { zone_id } = params;
return this._client.get((0, path_1.path) `/zones/${zone_id}/spectrum/apps/${appID}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseApps._key = Object.freeze(['spectrum', 'apps']);
return BaseApps;
})();
exports.BaseApps = BaseApps;
class Apps extends BaseApps {
}
exports.Apps = Apps;
//# sourceMappingURL=apps.js.map