export type OrdersAppModelsOrderItemOrderItemStatusChoices = 'open' | 'shipped' | 'cancelled' | 'returned'; export type OrderItemSchema = {return_tracking_key: string | null, shipment_tracking_key: string | null, sku: string, status: OrdersAppModelsOrderItemOrderItemStatusChoices, id?: (number | null) | undefined, vat?: number | undefined, price_without_tax: number, price_with_tax: number}; export type GetShipmentSchema = {items: Array, carrier_key: string, return_tracking_key?: (string | null) | undefined, tracking_key?: (string | null) | undefined}; export type ShipmentItemsShippedWebhookSchema = {id: number, event: 'order_items.shipped', timestamp?: string | undefined, message: GetShipmentSchema, subscription_id?: (number | null) | undefined}; export type CreateApiApiV1WebhooksOrderItemsShippedArgs = {body: ShipmentItemsShippedWebhookSchema}; export type CreateApiApiV1WebhooksOrderItemsShippedOptions = {baseUrl: string, APIKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Order Items Shipped Webhook * * POST /api/v1/webhooks/order-items-shipped */ export const createApiApiV1WebhooksOrderItemsShipped = async (args: CreateApiApiV1WebhooksOrderItemsShippedArgs, options: CreateApiApiV1WebhooksOrderItemsShippedOptions) => { const {baseUrl, fetch: fetchFn = fetch, APIKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (APIKeyAuth !== undefined) headers.set("X-API-Key", APIKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/webhooks/order-items-shipped${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 };