Created
October 9, 2013 09:25
-
-
Save JakeGinnivan/6898623 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public interface IHttpCall | |
| { | |
| Task<HttpResponseMessage> Execute(HttpClient httpClient); | |
| } | |
| public interface IHttpWithResult<T> : IHttpCall | |
| { | |
| } | |
| public interface IHttpCallExecutor | |
| { | |
| Task Execute(IHttpCall httpCall); | |
| Task<T> Execute<T>(IHttpWithResult<T> httpCallWithResult) where T : class; | |
| } | |
| public class SampleCall : IHttpCall | |
| { | |
| public Task<HttpResponseMessage> Execute(HttpClient httpClient) | |
| { | |
| var requestUri = "/some/relative/path"; | |
| return httpClient.PostAsync(requestUri, new StringContent(string.Empty)); | |
| } | |
| } | |
| public class SampleCallWithResult : IHttpCallWithResult<string> | |
| { | |
| public Task<HttpResponseMessage> Execute(HttpClient httpClient) | |
| { | |
| var requestUri = "/some/relative/path"; | |
| return httpClient.PostAsync(requestUri, new StringContent(string.Empty)); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment