export type SellerId = string; export type ChannelOrderId = string; export type OrderItemId = unknown; export type Channel = string; export type OrderShipping = {orderList?: (Array<{sellerId: SellerId, orderId: ChannelOrderId, shippingComplete: boolean, shippingItems: Array<{carrier: string, trackingNumber?: string | undefined, trackingUrl?: string | undefined, returnTracking?: ({carrier: string, trackingNumber: string, trackingUrl?: string | undefined} | null) | undefined, shippedAt?: string | undefined, orderItemIdList?: (Array<{orderItemId: OrderItemId, quantity: number | number}> | null) | undefined, shippedFrom?: ({city: string, country: string, postcode: string} | null) | undefined}>, channel: Channel}>) | undefined}; export type UpdateApiV1SellerOrderShippingArgs = {body: OrderShipping}; export type UpdateApiV1SellerOrderShippingOptions = {baseUrl?: string | undefined, SellerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Shipping * * * PUT /v1/seller/order/shipping */ export const updateApiV1SellerOrderShipping = async (args: UpdateApiV1SellerOrderShippingArgs, options?: UpdateApiV1SellerOrderShippingOptions) => { const {baseUrl = "https://scx-sbx.api.jtl-software.com", fetch: fetchFn = fetch, SellerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (SellerAuth !== undefined) headers.set('authorization', `Bearer ${SellerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/seller/order/shipping${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 };