Exemplo n.º 1
0
        protected async Task <HttpResponseMessage> SendRequestToApi(ApiMessage apiMessage)
        {
            var urlToSendRequestTo = new Uri(this.uri + apiMessage.UrlFragmentToSendTo);

            var client = new HttpClient();

            if (apiMessage.HttpVerb == HttpVerb.Put)
            {
                return(await client.PutAsync(urlToSendRequestTo, apiMessage.BodyAsStringContent()));
            }

            return(await client.PostAsync(urlToSendRequestTo, apiMessage.BodyAsStringContent()));
        }
Exemplo n.º 2
0
 public async Task <HttpResponseMessage> SendCommand(ApiMessage argumentsToSend)
 {
     return(await this.SendRequestToApi(argumentsToSend));
 }