export type GetApiOpenscapReportNodeIdArgs = {nodeId: unknown}; export type GetApiOpenscapReportNodeIdOptions = {baseUrl?: string | undefined, APITokens?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get an OpenSCAP report * * GET /openscap/report/{nodeId} */ export const getApiOpenscapReportNodeId = async (args: GetApiOpenscapReportNodeIdArgs, options?: GetApiOpenscapReportNodeIdOptions) => { const {baseUrl = "https://rudder.example.com/rudder/api/latest", fetch: fetchFn = fetch, APITokens} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "text/html") if (APITokens !== undefined) headers.set("X-API-Token", APITokens) const url = `${baseUrl.replace(/\/+$/, '')}/openscap/report/${encodeURIComponent(String(args.nodeId))}${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 res.text() };