export type OrderRejectRequest = {Message?: string | undefined}; export type UpdateApiOrdersOrderIdRejectArgs = {orderId: string, body: OrderRejectRequest}; export type UpdateApiOrdersOrderIdRejectOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Reject order * * PUT /orders/{orderId}/reject */ export const updateApiOrdersOrderIdReject = async (args: UpdateApiOrdersOrderIdRejectArgs, options?: UpdateApiOrdersOrderIdRejectOptions) => { 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") const url = `${baseUrl.replace(/\/+$/, '')}/orders/${encodeURIComponent(String(args.orderId))}/reject${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };