export type GetApiRestaurantsTenantRestaurantIdMenuArgs = {tenant: string, restaurantId: string, Authorization: string}; export type GetApiRestaurantsTenantRestaurantIdMenuOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get the latest version of the restaurant's full menu * * GET /restaurants/{tenant}/{restaurantId}/menu */ export const getApiRestaurantsTenantRestaurantIdMenu = async (args: GetApiRestaurantsTenantRestaurantIdMenuArgs, options?: GetApiRestaurantsTenantRestaurantIdMenuOptions) => { const {baseUrl = "https://uk.api.just-eat.io", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.Authorization != null) headers.set("Authorization", String(args.Authorization)) const url = `${baseUrl.replace(/\/+$/, '')}/restaurants/${encodeURIComponent(String(args.tenant))}/${encodeURIComponent(String(args.restaurantId))}/menu${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 };