export type AmlMonitoringPdfRequest = {password?: string | undefined}; export type CreateApiAmlMonitoringsIdPdfArgs = {id: string, body: AmlMonitoringPdfRequest}; export type CreateApiAmlMonitoringsIdPdfOptions = {baseUrl?: string | undefined, apiKeyPair?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Generate AML Monitoring PDF * * POST /aml/monitorings/{id}/pdf/ */ export const createApiAmlMonitoringsIdPdf = async (args: CreateApiAmlMonitoringsIdPdfArgs, options?: CreateApiAmlMonitoringsIdPdfOptions) => { const {baseUrl = "https://ivs.idenfy.com", fetch: fetchFn = fetch, apiKeyPair} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/pdf") if (apiKeyPair !== undefined) headers.set('authorization', `Basic ${btoa(`${apiKeyPair.username}:${apiKeyPair.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/aml/monitorings/${encodeURIComponent(String(args.id))}/pdf/${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() };