cloudflare
Version:
The official TypeScript library for the Cloudflare API
48 lines • 1.82 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../core/resource.mjs";
import { SinglePage } from "../../core/pagination.mjs";
import { path } from "../../internal/utils/path.mjs";
export var BaseConnections = /* @__PURE__ */ (() => {
class BaseConnections extends 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(path `/zones/${zone_id}/page_shield/connections`, (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(path `/zones/${zone_id}/page_shield/connections/${connectionID}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseConnections._key = Object.freeze([
'pageShield',
'connections',
]);
return BaseConnections;
})();
export class Connections extends BaseConnections {
}
//# sourceMappingURL=connections.mjs.map