export type V2StatusChangeScope = 0 | 1 | 2; export type V2ChangeAlertStatusFilterInfo = {maxDate?: (string | null) | undefined, minDate?: (string | null) | undefined, categoryIds?: (Array | null) | undefined, scope?: V2StatusChangeScope | undefined, teamIds?: (Array | null) | undefined}; export type CreateApiAlertsCloseAllArgs = {userId?: string | undefined, body: V2ChangeAlertStatusFilterInfo}; export type CreateApiAlertsCloseAllOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Close all acknowledged alerts. * * POST /alerts/closeAll */ export const createApiAlertsCloseAll = async (args: CreateApiAlertsCloseAllArgs, options?: CreateApiAlertsCloseAllOptions) => { const {baseUrl = "https://connect.signl4.com/api", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args.userId != null) query.append("userId", String(args.userId)) const url = `${baseUrl.replace(/\/+$/, '')}/alerts/closeAll${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };