export type LateOrderCompensationRestaurantResolution = {orderId?: string | undefined, isAccepted?: boolean | undefined, acceptedAmount?: number | undefined, rejectedReasonCode?: ('BadTraffic' | 'BadWeather' | 'BusierThanExpected' | 'CompensatedWithItem' | 'NoReason') | undefined}; export type CreateApiOrdersTenantOrderIdConsumerqueriesLateordercompensationRestaurantresponseArgs = {tenant: string, orderId: string, Authorization: string, body: LateOrderCompensationRestaurantResolution}; export type CreateApiOrdersTenantOrderIdConsumerqueriesLateordercompensationRestaurantresponseOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update late order compensation request with Restaurant response * * POST /orders/{tenant}/{orderId}/consumerqueries/lateordercompensation/restaurantresponse */ export const createApiOrdersTenantOrderIdConsumerqueriesLateordercompensationRestaurantresponse = async (args: CreateApiOrdersTenantOrderIdConsumerqueriesLateordercompensationRestaurantresponseArgs, options?: CreateApiOrdersTenantOrderIdConsumerqueriesLateordercompensationRestaurantresponseOptions) => { 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))}/consumerqueries/lateordercompensation/restaurantresponse${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 };