export type GetApiV1ScansScanIdExportArgs = {type?: ('json' | 'csv' | 'pdf') | undefined, 'X-Team-Id'?: string | undefined}; export type GetApiV1ScansScanIdExportOptions = {baseUrl?: string | undefined, XAPIKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Export Scan * * GET /v1/scans/{scan_id}/export */ export const getApiV1ScansScanIdExport = async (args: GetApiV1ScansScanIdExportArgs, options?: GetApiV1ScansScanIdExportOptions) => { const {baseUrl = "https://api.projectdiscovery.io", fetch: fetchFn = fetch, XAPIKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() 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/${encodeURIComponent(String(args.scan_id))}/export${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };