export type CVEStatus = 'reported' | 'active' | 'mitigated' | 'cleared' | 'disputed' | 'unknown'; export type GetApiChannelsChannelNameCvesWsArgs = {channel_name: string, status?: Array | undefined, min_score?: number | undefined, q?: string | undefined, max_score?: number | undefined, architectures?: Array | undefined, cve_name?: string | undefined, version?: string | undefined, artifact?: string | undefined}; export type GetApiChannelsChannelNameCvesWsOptions = {baseUrl?: string | undefined, jwt?: string | undefined, fetch?: typeof fetch | undefined}; /** * GET /channels/{channel_name}/cves/ws */ export const getApiChannelsChannelNameCvesWs = async (args: GetApiChannelsChannelNameCvesWsArgs, options?: GetApiChannelsChannelNameCvesWsOptions) => { const {baseUrl = "https://api.anaconda.cloud/api", fetch: fetchFn = fetch, jwt} = options ?? {} const query = new URLSearchParams() const headers = new Headers() for (const item of args.status ?? []) query.append("status", String(item)) if (args.min_score != null) query.append("min_score", String(args.min_score)) if (args.q != null) query.append("q", String(args.q)) if (args.max_score != null) query.append("max_score", String(args.max_score)) for (const item of args.architectures ?? []) query.append("architectures", String(item)) if (args.cve_name != null) query.append("cve_name", String(args.cve_name)) if (args.version != null) query.append("version", String(args.version)) if (args.artifact != null) query.append("artifact", String(args.artifact)) if (jwt !== undefined) headers.set('authorization', `Bearer ${jwt}`) const url = `${baseUrl.replace(/\/+$/, '')}/channels/${encodeURIComponent(String(args.channel_name))}/cves/ws${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 };