/// <summary> /// Get delivery and convert report about single notification. /// </summary> /// <param name="options"> /// Options used for getting delivery and convert report about single notification. /// </param> /// <returns></returns> public async Task <NotificationViewResult> ViewAsync(NotificationViewOptions options) { var baseRequestPath = "notifications/{0}?app_id={1}"; var restRequest = new RestRequest(string.Format(baseRequestPath, options.Id, options.AppId), Method.GET); restRequest.AddHeader("Authorization", string.Format("Basic {0}", ApiKey)); restRequest.RequestFormat = DataFormat.Json; restRequest.JsonSerializer = new NewtonsoftJsonSerializer(); var restResponse = await RestClient.ExecuteAsync <NotificationViewResult>(restRequest).ConfigureAwait(true); if (!(restResponse.StatusCode != HttpStatusCode.Created || restResponse.StatusCode != HttpStatusCode.OK)) { if (restResponse.ErrorException != null) { throw restResponse.ErrorException; } else if (restResponse.StatusCode != HttpStatusCode.OK && restResponse.Content != null) { throw new Exception(restResponse.Content); } } return(restResponse.Data); }
/// <inheritdoc /> /// <summary> /// Get delivery and convert report about single notification. /// </summary> /// <param name="options"> /// Options used for getting delivery and convert report about single notification. /// </param> /// <returns></returns> public async Task <NotificationViewResult> ViewAsync(NotificationViewOptions options) { var result = await ApiUri.AppendPathSegment($"notifications/{options.Id}?app_id={options.AppId}") .WithHeader("Authorization", $"Basic {ApiKey}") .GetAsync() .ReceiveJson <NotificationViewResult>() .ConfigureAwait(true); return(result); }