UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

65 lines (55 loc) • 1.7 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../../core/resource'; import { APIPromise } from '../../../core/api-promise'; import { RequestOptions } from '../../../internal/request-options'; import { path } from '../../../internal/utils/path'; export class BaseResults extends APIResource { static override readonly _key: readonly ['cloudforceOne', 'scans', 'results'] = Object.freeze([ 'cloudforceOne', 'scans', 'results', ] as const); /** * Retrieves the latest scan results for a Cloudforce One scan configuration, * including discovered open ports. * * @example * ```ts * const result = await client.cloudforceOne.scans.results.get( * 'config_id', * { account_id: 'account_id' }, * ); * ``` */ get(configID: string, params: ResultGetParams, options?: RequestOptions): APIPromise<ResultGetResponse> { const { account_id } = params; return ( this._client.get( path`/accounts/${account_id}/cloudforce-one/scans/results/${configID}`, options, ) as APIPromise<{ result: ResultGetResponse }> )._thenUnwrap((obj) => obj.result); } } export class Results extends BaseResults {} export interface ScanResult { number?: number; proto?: string; status?: string; } export interface ResultGetResponse { '1.1.1.1': Array<ScanResult>; } export interface ResultGetParams { /** * Defines the Account ID. */ account_id: string; } export declare namespace Results { export { type ScanResult as ScanResult, type ResultGetResponse as ResultGetResponse, type ResultGetParams as ResultGetParams, }; }