export type AttorneyRepresentation = {contactInfo?: ({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 CreateApiDebtsDebtIdRepresentationAttorneyRepresentationArgs = {body: AttorneyRepresentation}; export type CreateApiDebtsDebtIdRepresentationAttorneyRepresentationOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Add attorney representation * * POST /debts/{debtId}/representation/attorneyRepresentation */ export const createApiDebtsDebtIdRepresentationAttorneyRepresentation = async (args: CreateApiDebtsDebtIdRepresentationAttorneyRepresentationArgs, options?: CreateApiDebtsDebtIdRepresentationAttorneyRepresentationOptions) => { 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/attorneyRepresentation${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 };