export type GetApiAppsVerifactuV1EntrySiloEntryIdAgreementOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Generate a PDF agreement of a previously prepared org.Party silo entry. * * GET /apps/verifactu/v1/entry/{silo_entry_id}/agreement */ export const getApiAppsVerifactuV1EntrySiloEntryIdAgreement = async (options?: GetApiAppsVerifactuV1EntrySiloEntryIdAgreementOptions) => { const {baseUrl = "https://api.invopop.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/pdf") const url = `${baseUrl.replace(/\/+$/, '')}/apps/verifactu/v1/entry/${encodeURIComponent(String(args.silo_entry_id))}/agreement${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() };