UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

91 lines • 3.94 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../../core/resource.mjs"; import { CursorLimitPagination, } from "../../../core/pagination.mjs"; import { buildHeaders } from "../../../internal/headers.mjs"; import { path } from "../../../internal/utils/path.mjs"; export var BaseScans = /* @__PURE__ */ (() => { class BaseScans extends APIResource { /** * Submits repository intent for operator review. This endpoint does not * immediately start execution. Worker-imported repositories must be ready; * explicit `repo_hosts` must be authorized before the request is persisted. * * @example * ```ts * const scan = * await client.managedDefense.vulnerabilityDiscovery.scans.create( * { * account_id: '023e105f4ecef8ad9ca31a8372d0c353', * repos: ['182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'], * }, * ); * ``` */ create(params, options) { const { account_id, 'Idempotency-Key': idempotencyKey, ...body } = params; return this._client.post(path `/accounts/${account_id}/managed-defense/vulnerability-discovery/scans`, { body, ...options, headers: buildHeaders([ { ...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined) }, options?.headers, ]), })._thenUnwrap((obj) => obj.result); } /** * Lists customer-requested scans across review and execution lifecycle states. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const scanListResponse of client.managedDefense.vulnerabilityDiscovery.scans.list( * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * )) { * // ... * } * ``` */ list(params, options) { const { account_id, ...query } = params; return this._client.getAPIList(path `/accounts/${account_id}/managed-defense/vulnerability-discovery/scans`, (CursorLimitPagination), { query, ...options }); } /** * Gets one customer-requested scan across its review and execution lifecycle. * * @example * ```ts * const scan = * await client.managedDefense.vulnerabilityDiscovery.scans.get( * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ get(scanID, params, options) { const { account_id } = params; return this._client.get(path `/accounts/${account_id}/managed-defense/vulnerability-discovery/scans/${scanID}`, options)._thenUnwrap((obj) => obj.result); } /** * Gets the active operator-reviewed scan report. Repository metadata records * report readiness even when no publication is available. * * @example * ```ts * const response = * await client.managedDefense.vulnerabilityDiscovery.scans.getReport( * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ getReport(scanID, params, options) { const { account_id } = params; return this._client.get(path `/accounts/${account_id}/managed-defense/vulnerability-discovery/scans/${scanID}/report`, options)._thenUnwrap((obj) => obj.result); } } BaseScans._key = Object.freeze(['managedDefense', 'vulnerabilityDiscovery', 'scans']); return BaseScans; })(); export class Scans extends BaseScans { } //# sourceMappingURL=scans.mjs.map