UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

119 lines • 4.37 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../../core/resource.mjs"; import * as RampsAPI from "./ramps.mjs"; import { BaseRamps, Ramps, } from "./ramps.mjs"; import { SinglePage } from "../../../core/pagination.mjs"; import { path } from "../../../internal/utils/path.mjs"; export var BaseCf1Sites = /* @__PURE__ */ (() => { class BaseCf1Sites extends 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(path `/accounts/${account_id}/magic/cf1_sites`, (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(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(path `/accounts/${account_id}/magic/cf1_sites`, (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(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(path `/accounts/${account_id}/magic/cf1_sites/${cf1SiteID}`, options)._thenUnwrap((obj) => obj.result); } } BaseCf1Sites._key = Object.freeze([ 'magicTransit', 'cf1Sites', ]); return BaseCf1Sites; })(); export var Cf1Sites = /* @__PURE__ */ (() => { class Cf1Sites extends BaseCf1Sites { constructor() { super(...arguments); this.ramps = new RampsAPI.Ramps(this._client); } } Cf1Sites.Ramps = Ramps; Cf1Sites.BaseRamps = BaseRamps; return Cf1Sites; })(); //# sourceMappingURL=cf1-sites.mjs.map