export type GetApiStatsVulnerabilityMostCommentedArgs = {date_from?: string | undefined, date_to?: string | undefined, limit?: number | undefined, output?: ('json' | 'markdown') | undefined}; export type GetApiStatsVulnerabilityMostCommentedOptions = {baseUrl: string, apikey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Returns the most commented vulnerabilities. * * GET /stats/vulnerability/most_commented */ export const getApiStatsVulnerabilityMostCommented = async (args: GetApiStatsVulnerabilityMostCommentedArgs, options: GetApiStatsVulnerabilityMostCommentedOptions) => { 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.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_commented${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 };