Esempio n. 1
0
        private async Task <TType> Get <TType>(string endpoint) where TType : class
        {
            await Bucket.Acquire();

            Client = await TatsuRequestHelper.SetHeaders(Client, APIKey);

            using HttpResponseMessage response = await Client.GetAsync(endpoint);

            await Bucket.ParseHeaders(response.Headers);

            //if (response.StatusCode != HttpStatusCode.OK)
            //    throw new Exception(response.StatusCode.ToString());

            return(await Task.FromResult(JsonSerializer.Deserialize <TType>(await response.Content.ReadAsStringAsync())));
        }