Exemplo n.º 1
0
        public async Task <TResponse> Post <TRequest, TResponse>(string url, TRequest request)
            where TRequest : Request where TResponse : Response
        {
            const string jsonMediaType = "application/json";
            var          data          = new StringContent(_jsonParser.ToJson(request), Encoding.UTF8, jsonMediaType);
            var          response      = await _client.PostAsync(url, data);

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

            return(_jsonParser.FromJson <TResponse>(contents));
        }