export type Location = {Latitude: number, Longitude: number, Speed?: number | undefined, Heading?: number | undefined, Accuracy?: number | undefined}; export type ItemV2 = {Reference?: string | undefined, Name?: string | undefined, Quantity?: number | undefined, UnitPrice?: number | undefined, Items?: Array | undefined}; export type OrderReadyForPreparation = {OrderId?: string | undefined, Currency?: string | undefined, TotalPrice?: number | undefined, Fulfilment?: ({Method?: ('Delivery' | 'Collection') | undefined, CustomerDueDate?: string | undefined, CustomerDueAsap?: boolean | undefined, PrepareFor?: string | undefined, PreparationTime?: unknown | undefined, Address?: ({Lines?: Array | undefined, City?: string | undefined, PostalCode?: string | undefined, Geolocation?: Location | undefined}) | undefined, PhoneNumber?: string | undefined}) | undefined, Payment?: ({Lines?: (Array<{Type?: ('card' | 'cash' | 'credit' | 'other') | undefined, Value?: number | undefined, Paid?: boolean | undefined}>) | undefined}) | undefined, Customer?: ({Id?: string | undefined, Name?: string | undefined}) | undefined, Items?: Array | undefined, PriceBreakdown?: ({Discount?: number | undefined, Tips?: number | undefined, Taxes?: number | undefined, Items?: number | undefined, Fees?: ({Delivery?: number | undefined, ServiceCharge?: number | undefined, Other?: number | undefined}) | undefined}) | undefined, CustomerNotes?: {[key: string]: string} | undefined, PlacedDate?: string | undefined, Restaurant?: ({Id?: string | undefined, Reference?: string | undefined, Name?: string | undefined, Address?: ({Lines?: Array | undefined, City?: string | undefined, PostalCode?: string | undefined, Geolocation?: Location | undefined}) | undefined, PhoneNumber?: string | undefined}) | undefined, IsTest?: boolean | undefined}; export type CreateApiOrderReadyForPreparationAsyncArgs = {body: OrderReadyForPreparation}; export type CreateApiOrderReadyForPreparationAsyncOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Order ready for preparation (async) * * POST /order-ready-for-preparation-async */ export const createApiOrderReadyForPreparationAsync = async (args: CreateApiOrderReadyForPreparationAsyncArgs, options?: CreateApiOrderReadyForPreparationAsyncOptions) => { 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(/\/+$/, '')}/order-ready-for-preparation-async${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 };