export type GetApiV1ScansScanIdAssetExportArgs = {search?: string | undefined, format?: string | undefined}; export type GetApiV1ScansScanIdAssetExportOptions = {baseUrl?: string | undefined, XAPIKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Export list of unique assets for a scan * * GET /v1/scans/{scan_id}/asset/export */ export const getApiV1ScansScanIdAssetExport = async (args: GetApiV1ScansScanIdAssetExportArgs, options?: GetApiV1ScansScanIdAssetExportOptions) => { 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.search != null) query.append("search", String(args.search)) if (args.format != null) query.append("format", String(args.format)) if (XAPIKey !== undefined) headers.set("X-API-Key", XAPIKey) const url = `${baseUrl.replace(/\/+$/, '')}/v1/scans/${encodeURIComponent(String(args.scan_id))}/asset/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() };