/// <summary> /// Withdraw money from a savings goal /// </summary> /// <param name="accountUid">Required parameter: Account uid</param> /// <param name="savingsGoalUid">Required parameter: Savings goal uid</param> /// <param name="transferUid">Required parameter: Transfer uid, generated by the caller</param> /// <param name="body">Required parameter: Withdrawal request</param> /// <return>Returns the Models.SavingsGoalTransferResponseV2 response from the API call</return> public async Task <SavingsGoalTransferResponseV2> UpdateWithdrawMoneyAsync( Guid accountUid, Guid savingsGoalUid, Guid transferUid, WithdrawalRequestV2 body) { //validating required parameters if (null == body) { throw new ArgumentNullException(nameof(body), "The parameter \"body\" is a required parameter and cannot be null."); } //the base uri for api requests var baseUri = Configuration.GetBaseURI(); //prepare query string for API call var queryBuilder = new StringBuilder(baseUri); queryBuilder.Append("/api/v2/account/{accountUid}/savings-goals/{savingsGoalUid}/withdraw-money/{transferUid}"); //process optional template parameters APIHelper.AppendUrlWithTemplateParameters(queryBuilder, new Dictionary <string, object> { { "accountUid", accountUid }, { "savingsGoalUid", savingsGoalUid }, { "transferUid", transferUid } }); //validate and preprocess url var queryUrl = APIHelper.CleanUrl(queryBuilder); //append request with appropriate headers and parameters var headers = APIHelper.GetContentRequestHeaders(true, true); //append body params var serializedBody = APIHelper.JsonSerialize(body); //prepare the API call request to fetch the response var request = ClientInstance.PutBody(queryUrl, headers, serializedBody); //invoke request and get response var response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(request).ConfigureAwait(false); var context = new HTTPContext(request, response); //handle errors ValidateResponse(response, context); try { return(APIHelper.JsonDeserialize <SavingsGoalTransferResponseV2>(response.Body)); } catch (Exception ex) { throw new APIException("Failed to parse the response: " + ex.Message, context); } }
/// <summary> /// Withdraw money from a savings goal /// </summary> /// <param name="accountUid">Required parameter: Account uid</param> /// <param name="savingsGoalUid">Required parameter: Savings goal uid</param> /// <param name="transferUid">Required parameter: Transfer uid, generated by the caller</param> /// <param name="body">Required parameter: Withdrawal request</param> /// <return>Returns the Models.SavingsGoalTransferResponseV2 response from the API call</return> public SavingsGoalTransferResponseV2 UpdateWithdrawMoney( Guid accountUid, Guid savingsGoalUid, Guid transferUid, WithdrawalRequestV2 body) { var t = UpdateWithdrawMoneyAsync(accountUid, savingsGoalUid, transferUid, body); APIHelper.RunTaskSynchronously(t); return(t.GetAwaiter().GetResult()); }