export type GetApiApiV1DeliveryexperienceShipmentCarrierSelectionLabelShipiumLabelIdZplArgs = {shipiumLabelId: string}; export type GetApiApiV1DeliveryexperienceShipmentCarrierSelectionLabelShipiumLabelIdZplOptions = {baseUrl?: string | undefined, oauth2Scheme?: string | undefined, fetch?: typeof fetch | undefined}; /** * Streams zpl formatted version of a previously requested carrier label. * * GET /api/v1/deliveryexperience/shipment/carrierSelection/label/{shipiumLabelId}/zpl */ export const getApiApiV1DeliveryexperienceShipmentCarrierSelectionLabelShipiumLabelIdZpl = async (args: GetApiApiV1DeliveryexperienceShipmentCarrierSelectionLabelShipiumLabelIdZplArgs, options?: GetApiApiV1DeliveryexperienceShipmentCarrierSelectionLabelShipiumLabelIdZplOptions) => { const {baseUrl = "https://api.shipium.com", fetch: fetchFn = fetch, oauth2Scheme} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/octet-stream") if (oauth2Scheme !== undefined) headers.set('authorization', `Bearer ${oauth2Scheme}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/deliveryexperience/shipment/carrierSelection/label/${encodeURIComponent(String(args.shipiumLabelId))}/zpl${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 res.blob() };