export type UpdateApiApiNotificationsReadArgs = {deliveryMethod?: ('WEB' | 'MOBILE_APP') | undefined}; export type UpdateApiApiNotificationsReadOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Mark all notifications as read (markAllNotificationsAsRead) * * PUT /api/notifications/read */ export const updateApiApiNotificationsRead = async (args: UpdateApiApiNotificationsReadArgs, options?: UpdateApiApiNotificationsReadOptions) => { const {baseUrl = "https://demo.thingsboard.io", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.deliveryMethod != null) query.append("deliveryMethod", String(args.deliveryMethod)) const url = `${baseUrl.replace(/\/+$/, '')}/api/notifications/read${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };