コード例 #1
0
ファイル: RestClientBase.cs プロジェクト: goa-csk/NordCarAPI
        private async Task <HttpResponseMessage> GetResponseAsync(string uriExtension)
        {
            var client = await GetHttpClient();

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

            return(response);
        }
コード例 #2
0
ファイル: RestClientBase.cs プロジェクト: goa-csk/NordCarAPI
        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));
        }
コード例 #3
0
ファイル: RestClientBase.cs プロジェクト: goa-csk/NordCarAPI
        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));
        }
コード例 #4
0
ファイル: RestClientBase.cs プロジェクト: goa-csk/NordCarAPI
        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));
        }
コード例 #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));
     }
 }