export type GetApiApiV1SupplierPaymentsPaymentIdWithholdingCertificatesWithholdingIdArgs = {payment_id: string, withholding_id: string}; export type GetApiApiV1SupplierPaymentsPaymentIdWithholdingCertificatesWithholdingIdOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Descargar certificado de retención de un pago a proveedor * * GET /api/v1/supplier-payments/{payment_id}/withholding-certificates/{withholding_id} */ export const getApiApiV1SupplierPaymentsPaymentIdWithholdingCertificatesWithholdingId = async (args: GetApiApiV1SupplierPaymentsPaymentIdWithholdingCertificatesWithholdingIdArgs, options?: GetApiApiV1SupplierPaymentsPaymentIdWithholdingCertificatesWithholdingIdOptions) => { const {baseUrl = "https://api.lapyme.com.ar", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/pdf") if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/supplier-payments/${encodeURIComponent(String(args.payment_id))}/withholding-certificates/${encodeURIComponent(String(args.withholding_id))}${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() };