export type GetApiReportingGetArchivedMealItemReportArgs = {user_id: number, date_since: string, date_until: string}; export type GetApiReportingGetArchivedMealItemReportOptions = {baseUrl: string, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get current archived email report * * GET /reporting/get_archived_meal_item_report */ export const getApiReportingGetArchivedMealItemReport = async (args: GetApiReportingGetArchivedMealItemReportArgs, options: GetApiReportingGetArchivedMealItemReportOptions) => { const {baseUrl, fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.user_id != null) query.append("user_id", String(args.user_id)) if (args.date_since != null) query.append("date_since", String(args.date_since)) if (args.date_until != null) query.append("date_until", String(args.date_until)) if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/reporting/get_archived_meal_item_report${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 };