export type ExposureFilter = {overviewTiers: number, query?: (string | null) | undefined, exposedQuery?: (string | null) | undefined, riskTargetIds: Array, targetIds: Array}; export type GetApiPublicV1AlphaExposureIdGraphArgs = {id: number, filter?: ExposureFilter | undefined}; export type GetApiPublicV1AlphaExposureIdGraphOptions = {baseUrl?: string | undefined, TokenAuthentication?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get exposure graph by exposure analysis id * * GET /public/v1/alpha/exposure/{id}/graph */ export const getApiPublicV1AlphaExposureIdGraph = async (args: GetApiPublicV1AlphaExposureIdGraphArgs, options?: GetApiPublicV1AlphaExposureIdGraphOptions) => { const {baseUrl = "https://api.prewave.com", fetch: fetchFn = fetch, TokenAuthentication} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (args.filter != null) query.append("filter", JSON.stringify(args.filter)) if (TokenAuthentication !== undefined) headers.set("X-Auth-Token", TokenAuthentication) const url = `${baseUrl.replace(/\/+$/, '')}/public/v1/alpha/exposure/${encodeURIComponent(String(args.id))}/graph${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.blob() };