export type CompanyPdfContentEnum = 'SUBMITTED_COMPANY_INFO' | 'COMPANY_META' | 'RELATED_SUBJECTS' | 'OWNERSHIP_STRUCTURE' | 'QUESTIONNAIRE_ANSWERS' | 'COMPANY_NAME_AUDIT' | 'BANK_VERIFICATION' | 'WEBSITE_AUDIT' | 'ADDRESS_AUDIT' | 'GOV_CHECKS' | 'KYB_DATA_MATCHING' | 'KYB_DOCUMENTS' | 'AUDIT_LOGS' | 'VAT_VERIFICATION' | 'TAGS' | 'SHAREHOLDERS_CHECK' | 'AML_MONITORING_USERS' | 'LINKED_COMPANIES' | 'COMMENTS' | 'COMPANY_AML_CHECK' | 'COMPANY_ADVERSE_MEDIA_CHECK' | 'BENEFICIARY_AML_CHECKS' | 'BENEFICIARY_ADVERSE_MEDIA_CHECKS'; export type KybPdfRequest = {password?: string | undefined, content?: Array | undefined}; export type CreateApiKybCompaniesIdPdfArgs = {id: string, body: KybPdfRequest}; export type CreateApiKybCompaniesIdPdfOptions = {baseUrl?: string | undefined, apiKeyPair?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Generate company PDF * * POST /kyb/companies/{id}/pdf/ */ export const createApiKybCompaniesIdPdf = async (args: CreateApiKybCompaniesIdPdfArgs, options?: CreateApiKybCompaniesIdPdfOptions) => { 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(/\/+$/, '')}/kyb/companies/${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() };