export type OrderPutDeliveryAddress = {name?: string | undefined, company?: string | undefined, phone?: string | undefined, email?: string | undefined, street: string, street2?: string | undefined, zip?: string | undefined, city: string, state?: string | undefined, countryIso2: string, latitude?: number | undefined, longitude?: number | undefined}; export type OrderPut = {address?: OrderPutDeliveryAddress | undefined, comment?: string | undefined, trackingEnabled?: boolean | undefined, customAttributes?: {[key: string]: string} | undefined}; export type PatchApiOrdersOrderIdArgs = {orderId: number, body: OrderPut}; export type PatchApiOrdersOrderIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update a processing order * * PATCH /orders/{orderId} */ export const patchApiOrdersOrderId = async (args: PatchApiOrdersOrderIdArgs, options?: PatchApiOrdersOrderIdOptions) => { const {baseUrl = "https://api.quivo.co", 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))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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 };