export type GetApiMembersNotificationsArgs = {since_id?: string | undefined, number?: string | undefined, sort?: string | undefined, types?: string | undefined, all?: string | undefined, auto_delete?: string | undefined, auto_mark?: string | undefined, locale?: string | undefined}; export type GetApiMembersNotificationsOptions = {baseUrl?: string | undefined, BetaSeriesApiKey?: string | undefined, BetaSeriesToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Displays latest notifications * * GET /members/notifications */ export const getApiMembersNotifications = async (args: GetApiMembersNotificationsArgs, options?: GetApiMembersNotificationsOptions) => { const {baseUrl = "https://api.betaseries.com", fetch: fetchFn = fetch, BetaSeriesApiKey, BetaSeriesToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.since_id != null) query.append("since_id", String(args.since_id)) if (args.number != null) query.append("number", String(args.number)) if (args.sort != null) query.append("sort", String(args.sort)) if (args.types != null) query.append("types", String(args.types)) if (args.all != null) query.append("all", String(args.all)) if (args.auto_delete != null) query.append("auto_delete", String(args.auto_delete)) if (args.auto_mark != null) query.append("auto_mark", String(args.auto_mark)) if (args.locale != null) query.append("locale", String(args.locale)) if (BetaSeriesApiKey !== undefined) headers.set("X-BetaSeries-Key", BetaSeriesApiKey) if (BetaSeriesToken !== undefined) headers.set("X-BetaSeries-Token", BetaSeriesToken) const url = `${baseUrl.replace(/\/+$/, '')}/members/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 };