export type ItemDecision = {id?: string | undefined, decision?: ('Accepted' | 'Rejected') | undefined}; export type Justification = {reason?: ('AlreadyRefunded' | 'ItemReplaced' | 'PartialRefundRequired' | 'WasNotMissing' | 'WillRedeliver' | 'OrderWasHot' | 'OrderWasOnTime' | 'OrderWasPacked' | 'FoodWasIntact' | 'AddExtraItem' | 'Other') | undefined, comments?: (string | null) | undefined} | null; export type OrderClaimRestaurantResponse = {decision?: ('Accepted' | 'Rejected' | 'PartiallyAccepted') | undefined, items?: (Array | null) | undefined, justification?: Justification | undefined} | null; export type CreateApiRestaurantsTenantRestaurantIdCustomerclaimsIdRestaurantresponseArgs = {tenant: string, restaurantId: string, id: string, 'Content-Type': string, body: OrderClaimRestaurantResponse}; export type CreateApiRestaurantsTenantRestaurantIdCustomerclaimsIdRestaurantresponseOptions = {baseUrl?: string | undefined, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Submit a restaurant response for the claim * * POST /restaurants/{tenant}/{restaurantId}/customerclaims/{id}/restaurantresponse */ export const createApiRestaurantsTenantRestaurantIdCustomerclaimsIdRestaurantresponse = async (args: CreateApiRestaurantsTenantRestaurantIdCustomerclaimsIdRestaurantresponseArgs, options?: CreateApiRestaurantsTenantRestaurantIdCustomerclaimsIdRestaurantresponseOptions) => { const {baseUrl = "https://uk.api.just-eat.io", fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['Content-Type'] != null) headers.set("Content-Type", String(args['Content-Type'])) if (Bearer !== undefined) headers.set('authorization', `Bearer ${Bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/restaurants/${encodeURIComponent(String(args.tenant))}/${encodeURIComponent(String(args.restaurantId))}/customerclaims/${encodeURIComponent(String(args.id))}/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 };