encompassconnect
Version:
An Unofficial, (mostly) typed Node SDK that wraps around Ellie Mae's Encompass RESTful API.
96 lines (95 loc) • 4.03 kB
TypeScript
import EncompassService from './service';
import { LoanUpdateOptions, UpdateLoanWithGenerateContract, FieldReaderResult } from '../types';
declare class LoansService extends EncompassService {
/**
* Takes in a loan number (`Loan.LoanNumber`) and returns the matching loan's GUID. If no matching loan is found, returns `null`.
*/
getGuidByLoanNumber(loanNumber: string): Promise<string>;
/**
* Retrieves the loan data of the provided loan GUID. Can optionally be filtered by providing an array of entities.
*/
get(guid: string, entities?: string[]): Promise<any>;
/**
* Updates a loan object. Expects the data to already be formatted into the correct contract shape.
*
* ```typescript
* const updateData: any = {
* applications: [
* borrower: {
* lastName: 'new borrower last name',
* },
* ],
* contacts: [
* {
* contactType: 'LOAN_OFFICER',
* name: 'new loan officer name',
* },
* ],
* customFields: [
* {
* fieldName: 'CX.SOME.CUSTOM.FIELD',
* stringValue: 'new value',
* },
* ],
* };
*
* // using the default options:
* await encompass.loans.update('some-loan-guid', updateData);
*
* // providing options:
* const options: LoanUpdateOptions = {
* appendData: true,
* persistent: 'transient',
* view: 'entity',
* };
*
* await encompass.loans.update('some-loan-guid', updateData, options);
* ```
*/
update(guid: string, loanData: any, options?: LoanUpdateOptions): Promise<void>;
/**
* If the contract is not known, one can be generated before updating. The update data is expected as key value pairs (the key being the field ID), and all standard Encompass values are placed in the `standardFields` key, while all custom fields are placed in the `customFields` key.
*
* ```typescript
* const updateData: UpdateLoanWithGenerateContract = {
* standardFields: {
* '4000': 'new borrower last name',
* '317': 'new loan officer name',
* },
* customFields: {
* 'CX.SOME.CUSTOM.FIELD': 'new value',
* },
* };
*
* await encompass.loans.updateWithGeneratedContract('some-loan-guild', updateData);
* ```
*
* The `updateWithGeneratedContract()` method can also take the third `LoanUpdateOptions` as well.
* Keep in mind this method requires an extra call to generate the contract, and `loans.update()` should be used instead when possible.
*/
updateWithGeneratedContract(guid: string, loanData: UpdateLoanWithGenerateContract, options?: LoanUpdateOptions): Promise<void>;
/**
* Deletes the loan that matches the provided GUID.
*/
delete(guid: string): Promise<void>;
/**
* Takes in a loan guid and an array of field names, and returns the result of the 'Loan: Field Reader' result. The third argument is an optional object that
* contains two configuration options:
* 1. `includeMetadata` - setting this to `true` will include the metadata keys on each fieldReader object in the response
* 2. `mapResponse` - setting this to `true` will reduce the return value to a single object with each key being the field ID, and its value the field's value (as a string).
*
* ```typescript
* const fieldValues = await encompass.loans.fieldReader('some-loan-guid', ['4000', '4002'], {
* includeMetadata: true,
* mapResponse: false,
* });
* ```
*/
fieldReader(guid: string, fields: string[], { mapResponse, includeMetadata }?: {
mapResponse?: boolean;
includeMetadata?: boolean;
}): Promise<FieldReaderResult[] | {
[key: string]: string;
}>;
}
export default LoansService;