export type GetApiApiOrgIdAnomalyDetectionHistoryArgs = {org_id: string, limit?: number | undefined, start_time?: number | undefined, end_time?: number | undefined}; export type GetApiApiOrgIdAnomalyDetectionHistoryOptions = {baseUrl: string, Authorization?: string | undefined, fetch?: typeof fetch | undefined}; /** * Bulk anomaly detection history * * GET /api/{org_id}/anomaly_detection/history */ export const getApiApiOrgIdAnomalyDetectionHistory = async (args: GetApiApiOrgIdAnomalyDetectionHistoryArgs, options: GetApiApiOrgIdAnomalyDetectionHistoryOptions) => { const {baseUrl, fetch: fetchFn = fetch, Authorization} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/json") if (args.limit != null) query.append("limit", String(args.limit)) if (args.start_time != null) query.append("start_time", String(args.start_time)) if (args.end_time != null) query.append("end_time", String(args.end_time)) if (Authorization !== undefined) headers.set("Authorization", Authorization) const url = `${baseUrl.replace(/\/+$/, '')}/api/${encodeURIComponent(String(args.org_id))}/anomaly_detection/history${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 (await res.json()) as unknown };