コード例 #1
0
        public async Task <RequestValidationResponse> GetAsync(ClientId clientId)
        {
            var response =
                await _requestToDebug.GetAsync(clientId, GoogleEndpointAddresses.DebugCollect).ConfigureAwait(false);

            return(JsonConvert.DeserializeObject <RequestValidationResponse>(response));
        }
コード例 #2
0
        private async Task <ResponseData <T> > HandleGetResquest <T>(string resource, Dictionary <string, string> arguments)
        {
            var request = requestBase.PrepareRequest(resource, HttpMethod.Get, arguments);

            var response = await requestBase.GetAsync(request);

            try
            {
                return(Deserialize <T>(response));
            }
            catch (JsonSerializationException)
            {
                var errorResponse = JsonConvert.DeserializeObject <ResponseDataError>(response, new JsonSerializerSettings
                {
                    MissingMemberHandling = MissingMemberHandling.Ignore
                });

                return(new ResponseData <T>()
                {
                    Message = errorResponse.Message,
                    ErrorNo = errorResponse.ErrorNo,
                    Request = errorResponse.Request
                });
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #3
0
        /// <summary>
        /// Performs the request.
        /// </summary>
        /// <param name="url">The URL.</param>
        /// <returns>Task&lt;System.String&gt;.</returns>
        private async Task <string> PerformRequest(string url)
        {
            RequestBase req = new RequestBase(url, GetHeader());

            var response = await req.GetAsync();

            return(response.Content);
        }