export type GetApiCompaniesCompanyIdPaymentFilesArgs = {companyId: string, date: string}; export type GetApiCompaniesCompanyIdPaymentFilesOptions = {baseUrl?: string | undefined, partnerApiOauth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get payment file 🌍 * * GET /companies/{companyId}/payment-files */ export const getApiCompaniesCompanyIdPaymentFiles = async (args: GetApiCompaniesCompanyIdPaymentFilesArgs, options?: GetApiCompaniesCompanyIdPaymentFilesOptions) => { const {baseUrl = "https://partner-api.payfit.com", fetch: fetchFn = fetch, partnerApiOauth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/octet-stream") if (args.date != null) query.append("date", String(args.date)) if (partnerApiOauth !== undefined) headers.set('authorization', `Bearer ${partnerApiOauth}`) const url = `${baseUrl.replace(/\/+$/, '')}/companies/${encodeURIComponent(String(args.companyId))}/payment-files${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() };