export type ShipmentDeliveryAddress = {name?: string | undefined, company?: string | undefined, phone?: string | undefined, email?: string | undefined, zip?: string | undefined, city: string, state?: string | undefined, countryIso2?: string | undefined, street: string, street2?: string | undefined, latitude?: number | undefined, longitude?: number | undefined}; export type BookShopAsyncRequest = {requestUUID?: string | undefined, reference?: string | undefined, shippingServiceGroupId: number, shipFrom?: ShipmentDeliveryAddress | undefined, lengthM?: number | undefined, widthM?: number | undefined, heightM?: number | undefined, mailTo: string, shopId: number, orderIdentifiers: Array, parcelHeight?: number | undefined, parcelWidth?: number | undefined, parcelLength?: number | undefined, parcelWeight: number, contentWeight?: number | undefined, exportFulfillment?: boolean | undefined, hideEmailAddress?: boolean | undefined}; export type CreateApiShipmentsBookShopAsyncArgs = {body: BookShopAsyncRequest}; export type CreateApiShipmentsBookShopAsyncOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Book shipments for orders stored in shop * * POST /shipments/bookShopAsync */ export const createApiShipmentsBookShopAsync = async (args: CreateApiShipmentsBookShopAsyncArgs, options?: CreateApiShipmentsBookShopAsyncOptions) => { 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(/\/+$/, '')}/shipments/bookShopAsync${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 };