コード例 #1
0
        public async Task <T> GetAsync <T>(string query)
        {
            throwIfInvalidRequest();

            if (hasTokenExpired())
            {
                await SendTokenRequest();
            }

            string       urlRequest = parsePath(query);
            IApiResponse response   = await _webClient.MakeApiRequestAsync(Configuration.GetApiUrl() + urlRequest);

            limiters.NotifyAll(this, response);

            if (response.IsSuccessful())
            {
                string json = await response.ReadContentAsync();

                return(JsonConvert.DeserializeObject <T>(json));
            }
            else
            {
                throw new BadResponseException("Response is not successful", response);
            }
        }