export type GetApiStorageNotificationsArgs = {search?: string | undefined, enabled?: ('-1' | '0' | '1') | undefined, storagedirquotanotificationtypeid?: number | undefined, storagedirid?: number | undefined, userid?: number | undefined, timeperiodid?: number | undefined, limit?: number | undefined, page?: number | undefined, order?: ('id' | 'storagedirid' | 'userid' | 'datetimecreated' | 'datetimeremoved' | 'enabled' | 'notice') | undefined, order_dir?: ('asc' | 'desc') | undefined}; export type GetApiStorageNotificationsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Display a listing of notifications. * * GET /storage/notifications */ export const getApiStorageNotifications = async (args: GetApiStorageNotificationsArgs, options?: GetApiStorageNotificationsOptions) => { const {baseUrl = "https://www.rcac.purdue.edu/api", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.search != null) query.append("search", String(args.search)) if (args.enabled != null) query.append("enabled", String(args.enabled)) if (args.storagedirquotanotificationtypeid != null) query.append("storagedirquotanotificationtypeid", String(args.storagedirquotanotificationtypeid)) if (args.storagedirid != null) query.append("storagedirid", String(args.storagedirid)) if (args.userid != null) query.append("userid", String(args.userid)) if (args.timeperiodid != null) query.append("timeperiodid", String(args.timeperiodid)) if (args.limit != null) query.append("limit", String(args.limit)) if (args.page != null) query.append("page", String(args.page)) if (args.order != null) query.append("order", String(args.order)) if (args.order_dir != null) query.append("order_dir", String(args.order_dir)) const url = `${baseUrl.replace(/\/+$/, '')}/storage/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 };