export type GetApiStatsVulnerabilityMostSightedArgs = {date_from?: string | undefined, date_to?: string | undefined, sighting_type?: ('seen' | 'exploited' | 'not-exploited' | 'confirmed' | 'not-confirmed' | 'patched' | 'not-patched') | undefined, limit?: number | undefined, output?: ('json' | 'markdown') | undefined}; export type GetApiStatsVulnerabilityMostSightedOptions = {baseUrl: string, apikey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Returns the most sighted vulnerabilities. * * GET /stats/vulnerability/most_sighted */ export const getApiStatsVulnerabilityMostSighted = async (args: GetApiStatsVulnerabilityMostSightedArgs, options: GetApiStatsVulnerabilityMostSightedOptions) => { const {baseUrl, fetch: fetchFn = fetch, apikey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.date_from != null) query.append("date_from", String(args.date_from)) if (args.date_to != null) query.append("date_to", String(args.date_to)) if (args.sighting_type != null) query.append("sighting_type", String(args.sighting_type)) if (args.limit != null) query.append("limit", String(args.limit)) if (args.output != null) query.append("output", String(args.output)) if (apikey !== undefined) headers.set("X-API-KEY", apikey) const url = `${baseUrl.replace(/\/+$/, '')}/stats/vulnerability/most_sighted${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 };