public Models.NotificationPreferenceResponse CreateNotificationPreference(Models.NotificationPreferenceRequest body) { Task <Models.NotificationPreferenceResponse> t = CreateNotificationPreferenceAsync(body); APIHelper.RunTaskSynchronously(t); return(t.Result); }
public async Task <Models.NotificationPreferenceResponse> CreateNotificationPreferenceAsync(Models.NotificationPreferenceRequest body) { string _baseUri = Configuration.GetBaseURI(); StringBuilder _queryBuilder = new StringBuilder(_baseUri); _queryBuilder.Append("/preferences/notifications"); string _queryUrl = APIHelper.CleanUrl(_queryBuilder); var _headers = Utilities.APIHelper.GetHeader(); var _body = APIHelper.JsonSerialize(body); HttpRequest _request = ClientInstance.PostBody(_queryUrl, _headers, _body); HttpStringResponse _response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(_request).ConfigureAwait(false); HttpContext _context = new HttpContext(_request, _response); base.ValidateResponse(_response, _context); try { return(APIHelper.JsonDeserialize <Models.NotificationPreferenceResponse>(_response.Body)); } catch (Exception _ex) { throw new APIException("Failed to parse the response: " + _ex.Message, _context); } }