export type GetApiCollectionsIdAggregationsDownloadFormatArgs = {'x-apikey': string, id: string, format: string}; export type GetApiCollectionsIdAggregationsDownloadFormatOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * 🔒 Export aggregations from a collection * * GET /collections/{id}/aggregations/download/{format} */ export const getApiCollectionsIdAggregationsDownloadFormat = async (args: GetApiCollectionsIdAggregationsDownloadFormatArgs, options?: GetApiCollectionsIdAggregationsDownloadFormatOptions) => { const {baseUrl = "https://www.virustotal.com/api/v3", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/json") if (args['x-apikey'] != null) headers.set("x-apikey", String(args['x-apikey'])) const url = `${baseUrl.replace(/\/+$/, '')}/collections/${encodeURIComponent(String(args.id))}/aggregations/download/${encodeURIComponent(String(args.format))}${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 (await res.json()) as unknown };