UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

53 lines • 2.07 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Connections = exports.BaseConnections = 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 BaseConnections = /* @__PURE__ */ (() => { class BaseConnections extends resource_1.APIResource { /** * Lists outbound connections made by webpages in the zone. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const connectionListResponse of client.pageShield.connections.list( * { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * )) { * // ... * } * ``` */ list(params, options) { const { zone_id, ...query } = params; return this._client.getAPIList((0, path_1.path) `/zones/${zone_id}/page_shield/connections`, (pagination_1.SinglePage), { query, ...options }); } /** * Returns a webpage connection detected on the zone by connection ID. * * @example * ```ts * const connection = await client.pageShield.connections.get( * '023e105f4ecef8ad9ca31a8372d0c353', * { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ get(connectionID, params, options) { const { zone_id } = params; return this._client.get((0, path_1.path) `/zones/${zone_id}/page_shield/connections/${connectionID}`, options)._thenUnwrap((obj) => obj.result); } } BaseConnections._key = Object.freeze([ 'pageShield', 'connections', ]); return BaseConnections; })(); exports.BaseConnections = BaseConnections; class Connections extends BaseConnections { } exports.Connections = Connections; //# sourceMappingURL=connections.js.map