export type TimeRangeQueryParameter = 'last_day' | 'last_week' | 'last_month' | 'last_3_months' | 'last_6_months' | 'last_12_months' | 'all_time'; export type CreateApiV1ScansResultsExportArgs = {type?: ('json' | 'csv' | 'pdf') | undefined, 'X-Team-Id'?: string | undefined, body: {ids?: Array | undefined, vuln_status?: string | undefined, severity?: Array | undefined, host?: Array | undefined, domain?: Array | undefined, port?: Array | undefined, template?: Array | undefined, search?: string | undefined, category?: Array | undefined, is_internal?: boolean | undefined, scan_ids?: Array | undefined, time?: TimeRangeQueryParameter | undefined, start_date?: string | undefined, end_date?: string | undefined}}; export type CreateApiV1ScansResultsExportOptions = {baseUrl?: string | undefined, XAPIKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Export filtered Scan results * * POST /v1/scans/results/export */ export const createApiV1ScansResultsExport = async (args: CreateApiV1ScansResultsExportArgs, options?: CreateApiV1ScansResultsExportOptions) => { const {baseUrl = "https://api.projectdiscovery.io", fetch: fetchFn = fetch, XAPIKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/octet-stream") if (args.type != null) query.append("type", String(args.type)) if (args['X-Team-Id'] != null) headers.set("X-Team-Id", String(args['X-Team-Id'])) if (XAPIKey !== undefined) headers.set("X-API-Key", XAPIKey) const url = `${baseUrl.replace(/\/+$/, '')}/v1/scans/results/export${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };