export type GetApiV1SellerOrderInvoiceDocumentIdArgs = {documentId: string}; export type GetApiV1SellerOrderInvoiceDocumentIdOptions = {baseUrl?: string | undefined, SellerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Invoice * * GET /v1/seller/order/invoice/{documentId} */ export const getApiV1SellerOrderInvoiceDocumentId = async (args: GetApiV1SellerOrderInvoiceDocumentIdArgs, options?: GetApiV1SellerOrderInvoiceDocumentIdOptions) => { const {baseUrl = "https://scx-sbx.api.jtl-software.com", fetch: fetchFn = fetch, SellerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/pdf") if (SellerAuth !== undefined) headers.set('authorization', `Bearer ${SellerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/seller/order/invoice/${encodeURIComponent(String(args.documentId))}${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() };