export type GetApiV1NotificationsArgs = {page?: number | undefined}; export type GetApiV1NotificationsOptions = {baseUrl?: string | undefined, BearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * List notifications * * GET /v1/notifications */ export const getApiV1Notifications = async (args: GetApiV1NotificationsArgs, options?: GetApiV1NotificationsOptions) => { const {baseUrl = "http://localhost:3000", fetch: fetchFn = fetch, BearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.page != null) query.append("page", String(args.page)) if (BearerAuth !== undefined) headers.set('authorization', `Bearer ${BearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/notifications${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 undefined };