export type GetApiV40OrdersOrderIdShipmentsShipmentIdMaptojsonArgs = {orderId: number, shipmentId: number, includeNulls?: boolean | undefined}; export type GetApiV40OrdersOrderIdShipmentsShipmentIdMaptojsonOptions = {baseUrl: string, ApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Maps a lab order into a json object * * GET /v4.0/orders/{orderId}/shipments/{shipmentId}/maptojson */ export const getApiV40OrdersOrderIdShipmentsShipmentIdMaptojson = async (args: GetApiV40OrdersOrderIdShipmentsShipmentIdMaptojsonArgs, options: GetApiV40OrdersOrderIdShipmentsShipmentIdMaptojsonOptions) => { const {baseUrl, fetch: fetchFn = fetch, ApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.includeNulls != null) query.append("includeNulls", String(args.includeNulls)) if (ApiKey !== undefined) headers.set("X-API-Key", ApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/v4.0/orders/${encodeURIComponent(String(args.orderId))}/shipments/${encodeURIComponent(String(args.shipmentId))}/maptojson${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };