export type GetApiOrdersOrderIdPackingSlipPdfArgs = {order_id: string, timezone?: string | undefined}; export type GetApiOrdersOrderIdPackingSlipPdfOptions = {baseUrl?: string | undefined, OAuth?: string | undefined, AppCredentials?: string | undefined, fetch?: typeof fetch | undefined}; /** * GET /orders/{order_id}/packing-slip-pdf * * GET /orders/{order_id}/packing-slip-pdf */ export const getApiOrdersOrderIdPackingSlipPdf = async (args: GetApiOrdersOrderIdPackingSlipPdfArgs, options?: GetApiOrdersOrderIdPackingSlipPdfOptions) => { const {baseUrl = "https://www.faire.com/external-api/v2", fetch: fetchFn = fetch, OAuth, AppCredentials} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.timezone != null) query.append("timezone", String(args.timezone)) if (OAuth !== undefined) headers.set("X-FAIRE-OAUTH-ACCESS-TOKEN", OAuth) if (AppCredentials !== undefined) headers.set("X-FAIRE-APP-CREDENTIALS", AppCredentials) const url = `${baseUrl.replace(/\/+$/, '')}/orders/${encodeURIComponent(String(args.order_id))}/packing-slip-pdf${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 };