export type DebtConsolidatorRepresentation = {contactInfo?: ({debtConsolidatorType?: ('CREDIT_SOLUTIONS' | 'FREEDOM_FINANCIAL' | 'AMERICAN_FREEDOM_FINANCIAL' | 'DEBT_SETTLEMENT_USA' | 'US_DEBT_RELIEF' | 'ACCELERATE_DEBT_MANAGEMENT_GROUP' | 'PACIFIC_DEBT' | 'NATIONAL_DEBT_RELIEF' | 'CHRISTIAN_DEBT_REMOVERS' | 'LIBERTY_SETTLEMENT_GROUP' | 'CORPORATE_TURNAROUND' | 'LAW_OFFICES_OF_MATTHEW_GUTHRIE' | 'SEIDELMAN_PALMER' | 'JASON_HASS_GROUP' | 'ROLL_LAW_OFFICE' | 'OTHER') | undefined, name?: string | undefined, phoneNumber?: ({phoneNumber?: string | undefined, dataSource?: ({type?: string | undefined}) | undefined, consent?: number | undefined, types?: (Array<'WORK' | 'CELL' | 'HOME' | 'BUSINESS'>) | undefined}) | undefined, address?: ({name?: ({firstName?: string | undefined, middleName?: string | undefined, lastName?: string | undefined}) | undefined, streetLine1?: string | undefined, streetLine2?: string | undefined, streetLine3?: string | undefined, city?: string | undefined, state?: string | undefined, zipcode?: string | undefined, countryCode?: string | undefined}) | undefined}) | undefined, email?: string | undefined, requestedBy?: string | undefined, communicationType?: string | undefined, receivedPowerOfAttorneyDocumentation?: boolean | undefined, offerPercentOfBalance?: number | undefined, offerDurationInMonths?: number | undefined}; export type CreateApiDebtsDebtIdRepresentationDebtConsolidatorRepresentationArgs = {body: DebtConsolidatorRepresentation}; export type CreateApiDebtsDebtIdRepresentationDebtConsolidatorRepresentationOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Add debt consolidator representation * * POST /debts/{debtId}/representation/debtConsolidatorRepresentation */ export const createApiDebtsDebtIdRepresentationDebtConsolidatorRepresentation = async (args: CreateApiDebtsDebtIdRepresentationDebtConsolidatorRepresentationArgs, options?: CreateApiDebtsDebtIdRepresentationDebtConsolidatorRepresentationOptions) => { const {baseUrl = "https://api.trueaccord.com/api/v1", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/debts/${encodeURIComponent(String(args.debtId))}/representation/debtConsolidatorRepresentation${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 };