export type ByCarrierManifestDownloadRequestV2 = {carrierAccountId?: string | undefined, manifestJobId: string, shipiumManifestId: string, carrierId: string, countryCode?: string | undefined, fulfillmentContextId?: string | undefined, injectionSiteId?: string | undefined, postalCode?: string | undefined, tenantId?: string | undefined, testMode?: boolean | undefined}; export type CreateApiApiV2ManifestDownloadArgs = {body: ByCarrierManifestDownloadRequestV2}; export type CreateApiApiV2ManifestDownloadOptions = {baseUrl?: string | undefined, oauth2Scheme?: string | undefined, fetch?: typeof fetch | undefined}; /** * Download manifest report from carrier * * POST /api/v2/manifest/download */ export const createApiApiV2ManifestDownload = async (args: CreateApiApiV2ManifestDownloadArgs, options?: CreateApiApiV2ManifestDownloadOptions) => { const {baseUrl = "https://api.shipium.com", fetch: fetchFn = fetch, oauth2Scheme} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "*/*") if (oauth2Scheme !== undefined) headers.set('authorization', `Bearer ${oauth2Scheme}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v2/manifest/download${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };