export type CreateApiAppsVerifactuV1EntrySiloEntryIdAgreementArgs = {body: {data: string, signature: 'digital' | 'hand'}}; export type CreateApiAppsVerifactuV1EntrySiloEntryIdAgreementOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Upload a signed copy of the PDF agreement. * * POST /apps/verifactu/v1/entry/{silo_entry_id}/agreement */ export const createApiAppsVerifactuV1EntrySiloEntryIdAgreement = async (args: CreateApiAppsVerifactuV1EntrySiloEntryIdAgreementArgs, options?: CreateApiAppsVerifactuV1EntrySiloEntryIdAgreementOptions) => { const {baseUrl = "https://api.invopop.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") 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: "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 undefined };