export type GetApiCveVulnerabilityIdArgs = {with_meta?: boolean | undefined}; export type GetApiCveVulnerabilityIdOptions = {baseUrl: string, apikey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Alias for /api/vulnerability/ { const {baseUrl, fetch: fetchFn = fetch, apikey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.with_meta != null) query.append("with_meta", String(args.with_meta)) if (apikey !== undefined) headers.set("X-API-KEY", apikey) const url = `${baseUrl.replace(/\/+$/, '')}/cve/${encodeURIComponent(String(args.vulnerability_id))}${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 };