Exemplo n.º 1
0
        public async Task <ICrateResponse> SubmitRequest(CrateRequest request)
        {
            using (var client = new HttpClient())
            {
                var content      = this.ObjectToHttpContent(request);
                var httpResponse = await client.PostAsync(this.GetRequestAddress(), content);

                var response = await this.HttpResponseToResponse(httpResponse);

                return(response);
            }
        }
Exemplo n.º 2
0
        public async Task <ICrateResponse <T> > SubmitQuery <T>(string query)
        {
            using (var client = new HttpClient())
            {
                var request   = new CrateRequest(query);
                var content   = this.ObjectToHttpContent(request);
                var stopWatch = new Stopwatch();
                stopWatch.Start();
                var httpResponse = await client.PostAsync(this.GetRequestAddress(), content);

                stopWatch.Stop();
                var response = await this.HttpResponseToResponse <T>(httpResponse, stopWatch.Elapsed);

                return(response);
            }
        }