export type GetApiThreatProfilesProfileIdDownloadUrlFormatArgs = {format: 'csv' | 'stix' | 'json', profile_id: string, 'x-apikey': string}; export type GetApiThreatProfilesProfileIdDownloadUrlFormatOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Export URL for Large IoC Packages * * GET /threat_profiles/{profile_id}/download_url/{format} */ export const getApiThreatProfilesProfileIdDownloadUrlFormat = async (args: GetApiThreatProfilesProfileIdDownloadUrlFormatArgs, options?: GetApiThreatProfilesProfileIdDownloadUrlFormatOptions) => { const {baseUrl = "https://www.virustotal.com/api/v3", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['x-apikey'] != null) headers.set("x-apikey", String(args['x-apikey'])) const url = `${baseUrl.replace(/\/+$/, '')}/threat_profiles/${encodeURIComponent(String(args.profile_id))}/download_url/${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 undefined };