Example #1
0
        private async Task <HttpResponseMessage> GetResponseAsync(string uriExtension)
        {
            var client = await GetHttpClient();

            var formattetUriExtension = UriFormatter.FormatUriAsExtension(uriExtension);
            var response = await client.GetAsync(formattetUriExtension);

            return(response);
        }
Example #2
0
        public async Task <Response <TReturn> > PostAsync <TReturn, TMessage>(string uriExtension, TMessage message) //TODO MHT : 04-10-2016 - rename to search
        {
            var formattetUriExtension = UriFormatter.FormatUriAsExtension(uriExtension);

            var client = await GetHttpClient();

            var response = await client.PostAsJsonAsync(formattetUriExtension, message);

            return(await ResponseFactory.GenerateResponse <TReturn>(response));
        }
Example #3
0
        public async Task <ResponseSimple> PutAsync <T>(string uriExtension, T message)
        {
            var formattetUriExtension = UriFormatter.FormatUriAsExtension(uriExtension);
            var content = SerializeAsJson(message);

            var client = await GetHttpClient();

            var response = await client.PutAsync(formattetUriExtension, content);

            return(await ResponseFactory.GenerateResponseSimple(response));
        }
Example #4
0
        public async Task <Response <TReturn> > PostAsyncWithResponse <TReturn, TMessage>(string uriExtension, TMessage message)
        {
            var formattetUriExtension = UriFormatter.FormatUriAsExtension(uriExtension);
            var content = SerializeAsJson(message);

            var client = await GetHttpClient();

            var response = await client.PostAsync(formattetUriExtension, content);

            return(await ResponseFactory.GenerateResponse <TReturn>(response));
        }
Example #5
0
 private async Task <HttpResponseMessage> PostAsyncStringContent(
     string uriExtension, StringContent stringContent,
     SupportedServices serviceToCall)
 {
     uriExtension = UriFormatter.FormatUriAsExtension(uriExtension);
     using (var client = new HttpClient())
     {
         client.BaseAddress = _baseAddressResolver.ResolveBaseAddress(serviceToCall);
         return(await client.PostAsync(uriExtension, stringContent));
     }
 }