export type GetApiV3PublicOrdersTokenPdfArgs = {token: string}; export type GetApiV3PublicOrdersTokenPdfOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * The order confirmation PDF, by its private token * * GET /v3/public/orders/{token}.pdf */ export const getApiV3PublicOrdersTokenPdf = async (args: GetApiV3PublicOrdersTokenPdfArgs, options?: GetApiV3PublicOrdersTokenPdfOptions) => { const {baseUrl = "https://api.rhinoartisan.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() const url = `${baseUrl.replace(/\/+$/, '')}/v3/public/orders/${encodeURIComponent(String(args.token))}.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 };