export type PurchaseOrderUpdateLineItem = {identifier: string, expectedShipDate?: (string | null) | undefined, expectedArrivalDate?: (string | null) | undefined, note?: (string | null) | undefined}; export type PurchaseOrderUpdate = {purchaseOrderNumber: string, expectedShipDate?: (string | null) | undefined, expectedArrivalDate?: (string | null) | undefined, note?: (string | null) | undefined, lineItems: Array, source: 'SUPPLIER_EMAIL', collectedAt: string}; export type CreateApiPURCHASEORDERUPDATEArgs = {body: PurchaseOrderUpdate}; export type CreateApiPURCHASEORDERUPDATEOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Purchase Order Update * * POST /PURCHASE_ORDER_UPDATE */ export const createApiPURCHASEORDERUPDATE = async (args: CreateApiPURCHASEORDERUPDATEArgs, options: CreateApiPURCHASEORDERUPDATEOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/PURCHASE_ORDER_UPDATE${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 };