export type Location = {Latitude: number, Longitude: number, Speed?: number | undefined, Heading?: number | undefined, Accuracy?: number | undefined}; export type DeliveryDriverLocation = {EtaAtDeliveryAddress?: string | undefined, EtaAtRestaurant?: string | undefined, Location?: Location | undefined, TimeStampWithUtcOffset?: string | undefined}; export type UpdateApiOrdersOrderIdDeliverystateDriverlocationArgs = {orderId: string, body: DeliveryDriverLocation}; export type UpdateApiOrdersOrderIdDeliverystateDriverlocationOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update the driver's current location * * PUT /orders/{orderId}/deliverystate/driverlocation */ export const updateApiOrdersOrderIdDeliverystateDriverlocation = async (args: UpdateApiOrdersOrderIdDeliverystateDriverlocationArgs, options?: UpdateApiOrdersOrderIdDeliverystateDriverlocationOptions) => { 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))}/deliverystate/driverlocation${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 };