export type CreateRestaurantCompensationQuery = {ReasonCode?: ('NotSet' | 'BeingPrepared' | 'OnItsWay' | 'Delivered' | 'Unknown') | undefined, Comments?: string | undefined}; export type CreateApiOrdersTenantOrderIdRestaurantqueriesCompensationArgs = {tenant: string, orderId: string, Authorization: string, body: CreateRestaurantCompensationQuery}; export type CreateApiOrdersTenantOrderIdRestaurantqueriesCompensationOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create Compensation requests * * POST /orders/{tenant}/{orderId}/restaurantqueries/compensation */ export const createApiOrdersTenantOrderIdRestaurantqueriesCompensation = async (args: CreateApiOrdersTenantOrderIdRestaurantqueriesCompensationArgs, options?: CreateApiOrdersTenantOrderIdRestaurantqueriesCompensationOptions) => { const {baseUrl = "https://uk.api.just-eat.io", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args.Authorization != null) headers.set("Authorization", String(args.Authorization)) const url = `${baseUrl.replace(/\/+$/, '')}/orders/${encodeURIComponent(String(args.tenant))}/${encodeURIComponent(String(args.orderId))}/restaurantqueries/compensation${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };