cloudflare
Version:
The official TypeScript library for the Cloudflare API
125 lines • 4.73 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Cf1Sites = exports.BaseCf1Sites = 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 RampsAPI = tslib_1.__importStar(require("./ramps.js"));
const ramps_1 = require("./ramps.js");
const pagination_1 = require("../../../core/pagination.js");
const path_1 = require("../../../internal/utils/path.js");
var BaseCf1Sites = /* @__PURE__ */ (() => {
class BaseCf1Sites extends resource_1.APIResource {
/**
* Creates new CF1 Sites for an account. Each site must have a unique name within
* the account.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const cf1Site of client.magicTransit.cf1Sites.create(
* {
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* body: [{ name: 'Pad 34' }],
* },
* )) {
* // ...
* }
* ```
*/
create(params, options) {
const { account_id, body } = params;
return this._client.getAPIList((0, path_1.path) `/accounts/${account_id}/magic/cf1_sites`, (pagination_1.SinglePage), {
body: body,
method: 'post',
...options,
});
}
/**
* Partially updates a specific CF1 Site for an account. Only the fields included
* in the request body are modified; omitted fields retain their existing values.
*
* @example
* ```ts
* const cf1Site = await client.magicTransit.cf1Sites.update(
* '023e105f4ecef8ad9ca31a8372d0c353',
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
update(cf1SiteID, params, options) {
const { account_id, ...body } = params;
return this._client.patch((0, path_1.path) `/accounts/${account_id}/magic/cf1_sites/${cf1SiteID}`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Lists CF1 Sites associated with an account. A CF1 Site represents a physical
* customer network location with optional geographic coordinates.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const cf1Site of client.magicTransit.cf1Sites.list(
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* )) {
* // ...
* }
* ```
*/
list(params, options) {
const { account_id } = params;
return this._client.getAPIList((0, path_1.path) `/accounts/${account_id}/magic/cf1_sites`, (pagination_1.SinglePage), options);
}
/**
* Deletes a specific CF1 Site for an account.
*
* @example
* ```ts
* const cf1Site = await client.magicTransit.cf1Sites.delete(
* '023e105f4ecef8ad9ca31a8372d0c353',
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
delete(cf1SiteID, params, options) {
const { account_id } = params;
return this._client.delete((0, path_1.path) `/accounts/${account_id}/magic/cf1_sites/${cf1SiteID}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Gets a specific CF1 Site for an account.
*
* @example
* ```ts
* const cf1Site = await client.magicTransit.cf1Sites.get(
* '023e105f4ecef8ad9ca31a8372d0c353',
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
get(cf1SiteID, params, options) {
const { account_id } = params;
return this._client.get((0, path_1.path) `/accounts/${account_id}/magic/cf1_sites/${cf1SiteID}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseCf1Sites._key = Object.freeze([
'magicTransit',
'cf1Sites',
]);
return BaseCf1Sites;
})();
exports.BaseCf1Sites = BaseCf1Sites;
var Cf1Sites = /* @__PURE__ */ (() => {
class Cf1Sites extends BaseCf1Sites {
constructor() {
super(...arguments);
this.ramps = new RampsAPI.Ramps(this._client);
}
}
Cf1Sites.Ramps = ramps_1.Ramps;
Cf1Sites.BaseRamps = ramps_1.BaseRamps;
return Cf1Sites;
})();
exports.Cf1Sites = Cf1Sites;
//# sourceMappingURL=cf1-sites.js.map