Exemplo n.º 1
0
        public async Task <FeefoClientResponse> GetFeedbackAsync(FeedbackRequest feedbackRequest, CancellationToken cancellationToken = default(CancellationToken))
        {
            var httpClient  = CreateHttpClient();
            var queryString = _queryStringFactory.Create(_feefoSettings.Logon, feedbackRequest);

            var response = await httpClient.GetAsync(queryString, cancellationToken)
                           .ConfigureAwait(false);

            response.EnsureSuccessStatusCode();

            var content = await response.Content.ReadAsAsync <Rootobject>(cancellationToken)
                          .ConfigureAwait(false);

            return(new FeefoClientResponse(content?.FeedbackList));
        }
Exemplo n.º 2
0
        public async Task <FeefoClientResponse> GetFeedbackAsync(FeedbackRequest feedbackRequest, CancellationToken cancellationToken = default(CancellationToken))
        {
            var httpClient  = CreateHttpClient();
            var queryString = _queryStringFactory.Create(_feefoSettings.Logon, feedbackRequest);

            var response = await httpClient.GetAsync(queryString);

            response.EnsureSuccessStatusCode();

            var jsonContent = await response.Content.ReadAsStringAsync();

            var parsedContent = JObject.Parse(jsonContent);

            var content = parsedContent.ToObject <Rootobject>();

            return(new FeefoClientResponse(content?.FeedbackList));
        }