UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

48 lines • 1.76 kB
// 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 BaseScripts = /* @__PURE__ */ (() => { class BaseScripts extends APIResource { /** * Lists scripts detected on webpages in the zone, with filtering and pagination. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const scriptListResponse of client.pageShield.scripts.list( * { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * )) { * // ... * } * ``` */ list(params, options) { const { zone_id, ...query } = params; return this._client.getAPIList(path `/zones/${zone_id}/page_shield/scripts`, (SinglePage), { query, ...options }); } /** * Returns a script detected on the zone by script ID. * * @example * ```ts * const script = await client.pageShield.scripts.get( * '023e105f4ecef8ad9ca31a8372d0c353', * { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ get(scriptID, params, options) { const { zone_id } = params; return this._client.get(path `/zones/${zone_id}/page_shield/scripts/${scriptID}`, options)._thenUnwrap((obj) => obj.result); } } BaseScripts._key = Object.freeze([ 'pageShield', 'scripts', ]); return BaseScripts; })(); export class Scripts extends BaseScripts { } //# sourceMappingURL=scripts.mjs.map