UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

140 lines • 5.22 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../../core/resource.mjs"; import * as InterruptsAPI from "./interrupts.mjs"; import { BaseInterrupts, Interrupts, } from "./interrupts.mjs"; import * as EventsAPI from "./events/events.mjs"; import { BaseEvents, Events, } from "./events/events.mjs"; import * as SnapshotsAPI from "./snapshots/snapshots.mjs"; import { BaseSnapshots, Snapshots, } from "./snapshots/snapshots.mjs"; import { SinglePage } from "../../../core/pagination.mjs"; import { path } from "../../../internal/utils/path.mjs"; export var BaseConnectors = /* @__PURE__ */ (() => { class BaseConnectors extends APIResource { /** * Creates a Magic WAN Connector. * * @example * ```ts * const connector = * await client.magicTransit.connectors.create({ * account_id: '023e105f4ecef8ad9ca31a8372d0c353', * device: {}, * }); * ``` */ create(params, options) { const { account_id, ...body } = params; return this._client.post(path `/accounts/${account_id}/magic/connectors`, { body, ...options })._thenUnwrap((obj) => obj.result); } /** * Updates properties of a Magic WAN Connector. May be used to re-provision a * license key. * * @example * ```ts * const connector = * await client.magicTransit.connectors.update( * 'connector_id', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ update(connectorID, params, options) { const { account_id, ...body } = params; return this._client.put(path `/accounts/${account_id}/magic/connectors/${connectorID}`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Lists Magic WAN Connectors. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const connectorListResponse of client.magicTransit.connectors.list( * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * )) { * // ... * } * ``` */ list(params, options) { const { account_id, ...query } = params; return this._client.getAPIList(path `/accounts/${account_id}/magic/connectors`, (SinglePage), { query, ...options }); } /** * Deletes a Magic WAN Connector. * * @example * ```ts * const connector = * await client.magicTransit.connectors.delete( * 'connector_id', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ delete(connectorID, params, options) { const { account_id } = params; return this._client.delete(path `/accounts/${account_id}/magic/connectors/${connectorID}`, options)._thenUnwrap((obj) => obj.result); } /** * Edits properties of a Magic WAN Connector. May be used to re-provision a license * key. * * @example * ```ts * const response = await client.magicTransit.connectors.edit( * 'connector_id', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ edit(connectorID, params, options) { const { account_id, ...body } = params; return this._client.patch(path `/accounts/${account_id}/magic/connectors/${connectorID}`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Gets a Magic WAN Connector. * * @example * ```ts * const connector = await client.magicTransit.connectors.get( * 'connector_id', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ get(connectorID, params, options) { const { account_id } = params; return this._client.get(path `/accounts/${account_id}/magic/connectors/${connectorID}`, options)._thenUnwrap((obj) => obj.result); } } BaseConnectors._key = Object.freeze([ 'magicTransit', 'connectors', ]); return BaseConnectors; })(); export var Connectors = /* @__PURE__ */ (() => { class Connectors extends BaseConnectors { constructor() { super(...arguments); this.interrupts = new InterruptsAPI.Interrupts(this._client); this.events = new EventsAPI.Events(this._client); this.snapshots = new SnapshotsAPI.Snapshots(this._client); } } Connectors.Interrupts = Interrupts; Connectors.BaseInterrupts = BaseInterrupts; Connectors.Events = Events; Connectors.BaseEvents = BaseEvents; Connectors.Snapshots = Snapshots; Connectors.BaseSnapshots = BaseSnapshots; return Connectors; })(); //# sourceMappingURL=connectors.mjs.map