Beispiel #1
0
        /// <summary>
        /// Example: Loan Cursor pagination
        /// </summary>
        private static void Paginate()
        {
            var loanPipelineApiClient = ApiClientProvider.GetApiClient <LoanPipelineApi>(_accessToken);

            //Making sure we received more than one page in the response
            if (_count > 100)
            {
                var paginationRequest = new LoanPipelineViewContract
                {
                    Fields = new List <string> {
                        "Loan.GUID", "Loan.LastModified"
                    }
                };
                var start = 0;
                var page  = 1;
                for (var i = 0; i < 10; i++)
                {
                    //We do not need headers anymore, hence, calling regular method, And will be paginating 10 loans at a time
                    var resp = loanPipelineApiClient.PipelineRequest("10", null, _cursor, start.ToString(), paginationRequest);
                    Console.WriteLine("Page {0} Loan IDs: ", page);
                    foreach (var loanInfo in resp)
                    {
                        var fieldinfo = ((JObject)loanInfo.Fields).ToDictionary <string>();
                        Console.WriteLine("Loan ID: {0}", loanInfo.LoanGuid);
                        Console.WriteLine("Loan Last Modified: {0}", fieldinfo["Loan.LastModified"]);
                    }
                    start += 10;
                    page++;
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Example: Creating a cursor to generate a pipeline view
        /// </summary>
        private static void CreateCursor()
        {
            var cursorRequest = new LoanPipelineViewContract
            {
                Filter = new LoanPipelineFilterContract
                {
                    Terms = new List <LoanPipelineFilterContractTerms>()
                    {
                        new LoanPipelineFilterContractTerms {
                            CanonicalName = "Loan.LoanFolder",
                            Value         = "(Trash)",
                            MatchType     = "exact",
                            Include       = false
                        },
                        new LoanPipelineFilterContractTerms {
                            CanonicalName = "Loan.LastModified",
                            Value         = "02/25/2011",
                            MatchType     = "greaterThanOrEquals",
                            Precision     = "day"
                        },
                        //Rate Lock # Days
                        new LoanPipelineFilterContractTerms {
                            CanonicalName = "Fields.432",
                            Value         = "2",
                            MatchType     = "greaterThanOrEquals"
                        },
                        new LoanPipelineFilterContractTerms {
                            CanonicalName = "Loan.CreditScore",
                            Value         = "0",
                            MatchType     = "notEquals"
                        }
                    },
                    _Operator = "and"
                },
                Fields = new List <string> {
                    "Loan.GUID", "Loan.LastModified"
                },
                SortOrder = new List <LoanPipelineViewContractSortOrder>
                {
                    new LoanPipelineViewContractSortOrder
                    {
                        CanonicalName = "Loan.LastModified",
                        Order         = "desc"
                    }
                }
            };


            var loanPipelineApiClient = ApiClientProvider.GetApiClient <LoanPipelineApi>(_accessToken);

            //We will need to read headers and hence calling method with http info
            var resp = loanPipelineApiClient.PipelineRequestWithHttpInfo("100", "randomAccess", null, "0", cursorRequest);

            //Reading the cursor ID from headers
            _cursor = resp.Headers["x-cursor"];
            _count  = Convert.ToInt32(resp.Headers["x-total-count"]);
        }
Beispiel #3
0
        /// <summary>
        /// Example: Creating a cursor to generate a pipeline view
        /// This example gets top 100 loans based on last modified in its descending order.
        /// </summary>
        private static void AccessPipeline()
        {
            if (_accessToken == null)
            {
                Authenticate();
            }
            var loanPipelineApiClient = ApiClientProvider.GetApiClient <LoanPipelineApi>(_accessToken);

            var cursorRequest = new LoanPipelineViewContract
            {
                Filter = new LoanPipelineFilterContract
                {
                    Terms = new List <LoanPipelineFilterContractTerms>()
                    {
                        new LoanPipelineFilterContractTerms
                        {
                            CanonicalName = "Loan.LoanFolder",
                            Value         = "My Pipeline",
                            MatchType     = "exact"
                        }
                    }
                },
                Fields = new List <string> {
                    "Loan.GUID", "Loan.LastModified"
                },
                SortOrder = new List <LoanPipelineViewContractSortOrder>
                {
                    new LoanPipelineViewContractSortOrder
                    {
                        CanonicalName = "Loan.LastModified",
                        Order         = "desc"
                    }
                }
            };

            var loans = loanPipelineApiClient.PipelineRequest("100", "randomAccess", null, "0", cursorRequest, "true");

            Console.WriteLine("Total Loans: {0}", loans.Count);
            foreach (var loanInfo in loans)
            {
                //Since swagger does not support Dictionary directly, we need to cast manually here.
                var fieldinfo = ((JObject)loanInfo.Fields).ToDictionary <string>();
                Console.WriteLine("{0} | {1}", loanInfo.LoanGuid, fieldinfo["Loan.LastModified"]);
            }
        }
Beispiel #4
0
        /// <summary>
        ///
        /// </summary>
        /// <exception cref="Elli.Api.Loans.Pipeline.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="limit"> (optional)</param>
        /// <param name="cursorType"> (optional)</param>
        /// <param name="cursor"> (optional)</param>
        /// <param name="start"> (optional)</param>
        /// <param name="contract"> (optional)</param>
        /// <returns>Task of ApiResponse (List&lt;LoanPipelineItemContract&gt;)</returns>
        public async System.Threading.Tasks.Task <ApiResponse <List <LoanPipelineItemContract> > > PipelineRequestAsyncWithHttpInfo(string limit = null, string cursorType = null, string cursor = null, string start = null, LoanPipelineViewContract contract = null)
        {
            var    localVarPath         = "/encompass/v1/loanPipeline/";
            var    localVarPathParams   = new Dictionary <String, String>();
            var    localVarQueryParams  = new Dictionary <String, String>();
            var    localVarHeaderParams = new Dictionary <String, String>(Configuration.DefaultHeader);
            var    localVarFormParams   = new Dictionary <String, String>();
            var    localVarFileParams   = new Dictionary <String, FileParameter>();
            Object localVarPostBody     = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);

            if (localVarHttpHeaderAccept != null)
            {
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
            }

            if (limit != null)
            {
                localVarQueryParams.Add("limit", Configuration.ApiClient.ParameterToString(limit));                // query parameter
            }
            if (cursorType != null)
            {
                localVarQueryParams.Add("cursorType", Configuration.ApiClient.ParameterToString(cursorType));                     // query parameter
            }
            if (cursor != null)
            {
                localVarQueryParams.Add("cursor", Configuration.ApiClient.ParameterToString(cursor));                 // query parameter
            }
            if (start != null)
            {
                localVarQueryParams.Add("start", Configuration.ApiClient.ParameterToString(start));                // query parameter
            }
            if (contract != null && contract.GetType() != typeof(byte[]))
            {
                localVarPostBody = Configuration.ApiClient.Serialize(contract); // http body (model) parameter
            }
            else
            {
                localVarPostBody = contract; // byte array
            }

            // authentication (bearerAuth) required
            // oauth required
            if (!String.IsNullOrEmpty(Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + Configuration.AccessToken;
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath,
                                                                                                       Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                                                                                                       localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int)localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("PipelineRequest", localVarResponse);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(new ApiResponse <List <LoanPipelineItemContract> >(localVarStatusCode,
                                                                      localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                                                                      (List <LoanPipelineItemContract>)Configuration.ApiClient.Deserialize(localVarResponse, typeof(List <LoanPipelineItemContract>))));
        }
Beispiel #5
0
        /// <summary>
        ///
        /// </summary>
        /// <exception cref="Elli.Api.Loans.Pipeline.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="limit"> (optional)</param>
        /// <param name="cursorType"> (optional)</param>
        /// <param name="cursor"> (optional)</param>
        /// <param name="start"> (optional)</param>
        /// <param name="contract"> (optional)</param>
        /// <returns>Task of List&lt;LoanPipelineItemContract&gt;</returns>
        public async System.Threading.Tasks.Task <List <LoanPipelineItemContract> > PipelineRequestAsync(string limit = null, string cursorType = null, string cursor = null, string start = null, LoanPipelineViewContract contract = null)
        {
            ApiResponse <List <LoanPipelineItemContract> > localVarResponse = await PipelineRequestAsyncWithHttpInfo(limit, cursorType, cursor, start, contract);

            return(localVarResponse.Data);
        }
Beispiel #6
0
        /// <summary>
        ///
        /// </summary>
        /// <exception cref="Elli.Api.Loans.Pipeline.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="limit"> (optional)</param>
        /// <param name="cursorType"> (optional)</param>
        /// <param name="cursor"> (optional)</param>
        /// <param name="start"> (optional)</param>
        /// <param name="contract"> (optional)</param>
        /// <returns>List&lt;LoanPipelineItemContract&gt;</returns>
        public List <LoanPipelineItemContract> PipelineRequest(string limit = null, string cursorType = null, string cursor = null, string start = null, LoanPipelineViewContract contract = null)
        {
            ApiResponse <List <LoanPipelineItemContract> > localVarResponse = PipelineRequestWithHttpInfo(limit, cursorType, cursor, start, contract);

            return(localVarResponse.Data);
        }
Beispiel #7
0
        static void Main(string[] args)
        {
            // Create the user credentials for the login
            var credentials = new UserCredential
            {
                IdentityType = IdentityType.Lender,
                InstanceId   = ConfigurationManager.AppSettings["InstanceID"],
                UserName     = ConfigurationManager.AppSettings["UserID"],
                Password     = ConfigurationManager.AppSettings["Password"]
            };

            // Generate the access token for the API
            var accessToken = AccessToken.GetAccessToken(credentials);

            // Now invoke the Pipeline API to query based on LoanNumber
            LoanPipelineViewContract view = new LoanPipelineViewContract()
            {
                Filter = new LoanPipelineFilterContract()
                {
                    Terms = new List <LoanPipelineFilterContractTerms>()
                    {
                        new LoanPipelineFilterContractTerms()
                        {
                            CanonicalName = "Loan.LoanNumber",
                            Value         = "1801EM000070",
                            MatchType     = "exact"
                        }
                    }
                }
            };

            // Invoke the Pipeline API to get the matching loans
            var pipelineClient = ApiClientProvider.GetApiClient <LoanPipelineApi>(accessToken);
            var items          = pipelineClient.PipelineRequest(contract: view);

            // Check the count
            if (items.Count != 1)
            {
                Console.WriteLine("Loan number did not return a unique match");
                return;
            }

            // Loop over the result set, each of which has a loanGuid attribute
            string loanGuid = items[0].LoanGuid;

            // Create the Loan contract to update the new document signing date (Loan.ClosingDocument.DocumentSigningDate)
            LoanContract loan = new LoanContract()
            {
                ClosingDocument = new LoanContractClosingDocument()
                {
                    DocumentSigningDate = DateTime.Today
                }
            };

            try
            {
                // Create the Loan API client
                var loanClient = ApiClientProvider.GetApiClient <LoansApi>(accessToken);
                loanClient.UpdateLoan(loanGuid, loanContract: loan);
                Console.WriteLine("Loan updated successfully");
            }
            catch (ApiException ex)
            {
                Console.WriteLine("Loan update failed with response "
                                  + ex.ErrorContent);
            }

            // In the debugger, don't close the window right away
            if (System.Diagnostics.Debugger.IsAttached)
            {
                Console.ReadLine();
            }
        }