コード例 #1
0
        /// <summary>
        /// Get the repayment information associated with a given loan&#39;s Loan ID Sample request:                    GET /Loans/71abf3e6-d6a8-45d2-8394-55cc32260bee/repayments
        /// </summary>
        /// <exception cref="YL.Web.Api.ThirdParty.Loan.Client.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="loanId">Loan ID (a string)</param>
        /// <param name="apiVersion"> (optional)</param>
        /// <returns>Task of ApiResponse (LoanRepaymentModel)</returns>
        public async System.Threading.Tasks.Task <YL.Web.Api.ThirdParty.Loan.Client.Client.ApiResponse <LoanRepaymentModel> > GetRepaymentsAsyncWithHttpInfo(string loanId, string apiVersion = default(string))
        {
            // verify the required parameter 'loanId' is set
            if (loanId == null)
            {
                throw new YL.Web.Api.ThirdParty.Loan.Client.Client.ApiException(400, "Missing required parameter 'loanId' when calling LoansApi->GetRepayments");
            }


            YL.Web.Api.ThirdParty.Loan.Client.Client.RequestOptions localVarRequestOptions = new YL.Web.Api.ThirdParty.Loan.Client.Client.RequestOptions();

            String[] _contentTypes = new String[] {
            };

            // to determine the Accept header
            String[] _accepts = new String[] {
                "text/plain",
                "application/json",
                "text/json"
            };

            foreach (var _contentType in _contentTypes)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", _contentType);
            }

            foreach (var _accept in _accepts)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", _accept);
            }

            if (loanId != null)
            {
                localVarRequestOptions.PathParameters.Add("loanId", YL.Web.Api.ThirdParty.Loan.Client.Client.ClientUtils.ParameterToString(loanId)); // path parameter
            }
            if (apiVersion != null)
            {
                localVarRequestOptions.HeaderParameters.Add("api-version", YL.Web.Api.ThirdParty.Loan.Client.Client.ClientUtils.ParameterToString(apiVersion)); // header parameter
            }
            // authentication (oauth2) required
            // oauth required
            if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
            {
                localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
            }

            // make the HTTP request

            var localVarResponse = await this.AsynchronousClient.GetAsync <LoanRepaymentModel>("/Loans/{loanId}/repayments", localVarRequestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("GetRepayments", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return(localVarResponse);
        }
コード例 #2
0
        /// <summary>
        /// Get a specific loan by its Loan ID Sample request:                    GET Loans/71abf3e6-d6a8-45d2-8394-55cc32260bee
        /// </summary>
        /// <exception cref="YL.Web.Api.ThirdParty.Loan.Client.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="loanId">Loan ID (a string)</param>
        /// <param name="apiVersion"> (optional)</param>
        /// <returns>ApiResponse of List&lt;LoanModel&gt;</returns>
        public YL.Web.Api.ThirdParty.Loan.Client.Client.ApiResponse <List <LoanModel> > GetLoanWithHttpInfo(string loanId, string apiVersion = default(string))
        {
            // verify the required parameter 'loanId' is set
            if (loanId == null)
            {
                throw new YL.Web.Api.ThirdParty.Loan.Client.Client.ApiException(400, "Missing required parameter 'loanId' when calling LoansApi->GetLoan");
            }

            YL.Web.Api.ThirdParty.Loan.Client.Client.RequestOptions localVarRequestOptions = new YL.Web.Api.ThirdParty.Loan.Client.Client.RequestOptions();

            String[] _contentTypes = new String[] {
            };

            // to determine the Accept header
            String[] _accepts = new String[] {
                "text/plain",
                "application/json",
                "text/json"
            };

            var localVarContentType = YL.Web.Api.ThirdParty.Loan.Client.Client.ClientUtils.SelectHeaderContentType(_contentTypes);

            if (localVarContentType != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
            }

            var localVarAccept = YL.Web.Api.ThirdParty.Loan.Client.Client.ClientUtils.SelectHeaderAccept(_accepts);

            if (localVarAccept != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
            }

            if (loanId != null)
            {
                localVarRequestOptions.PathParameters.Add("loanId", YL.Web.Api.ThirdParty.Loan.Client.Client.ClientUtils.ParameterToString(loanId)); // path parameter
            }
            if (apiVersion != null)
            {
                localVarRequestOptions.HeaderParameters.Add("api-version", YL.Web.Api.ThirdParty.Loan.Client.Client.ClientUtils.ParameterToString(apiVersion)); // header parameter
            }
            // authentication (oauth2) required
            // oauth required
            if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
            {
                localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
            }

            // make the HTTP request
            var localVarResponse = this.Client.Get <List <LoanModel> >("/Loans/{loanId}", localVarRequestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("GetLoan", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return(localVarResponse);
        }