/// <summary> /// Lets you configure a recurring credit allocation to a subaccount /// </summary> /// <param name="body">Required parameter: Update recurring credit account</param> /// <return>Returns the object response from the API call</return> public object CreateSetrecurringcreditddetailsPOST(Models.UpdateRecurringCredisOfSubaccount body) { Task <object> t = CreateSetrecurringcreditddetailsPOSTAsync(body); APIHelper.RunTaskSynchronously(t); return(t.Result); }
/// <summary> /// Lets you configure a recurring credit allocation to a subaccount /// </summary> /// <param name="body">Required parameter: Update recurring credit account</param> /// <return>Returns the object response from the API call</return> public async Task <object> CreateSetrecurringcreditddetailsPOSTAsync(Models.UpdateRecurringCredisOfSubaccount body) { //the base uri for api requests string _baseUri = Configuration.BaseUri; //prepare query string for API call StringBuilder _queryBuilder = new StringBuilder(_baseUri); _queryBuilder.Append("/setrecurringcreditddetails"); //validate and preprocess url string _queryUrl = APIHelper.CleanUrl(_queryBuilder); //append request with appropriate headers and parameters var _headers = new Dictionary <string, string>() { { "user-agent", "APIMATIC 2.0" }, { "content-type", "application/json; charset=utf-8" } }; _headers.Add("api_key", Configuration.ApiKey); //append body params var _body = APIHelper.JsonSerialize(body); //prepare the API call request to fetch the response HttpRequest _request = ClientInstance.PostBody(_queryUrl, _headers, _body); //invoke request and get response HttpStringResponse _response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(_request).ConfigureAwait(false); HttpContext _context = new HttpContext(_request, _response); //Error handling using HTTP status codes if (_response.StatusCode == 400) { throw new APIException(@"API Response", _context); } if (_response.StatusCode == 401) { throw new APIException(@"API Response", _context); } if (_response.StatusCode == 403) { throw new APIException(@"API Response", _context); } if (_response.StatusCode == 405) { throw new APIException(@"Invalid input", _context); } //handle errors defined at the API level base.ValidateResponse(_response, _context); try { return(_response.Body); } catch (Exception _ex) { throw new APIException("Failed to parse the response: " + _ex.Message, _context); } }