Exemple #1
0
 public Anchor(IHttpClient httpClient, HttpRequestFactory httpRequestBuilder, HttpResponseHandlersList httpResponseParser, bool shouldDisposeHttpClient)
 {
     _shouldDisposeHttpClient = shouldDisposeHttpClient;
     HttpClient         = httpClient;
     HttpRequestBuilder = httpRequestBuilder;
     HttpResponseParser = httpResponseParser;
 }
Exemple #2
0
        public T Create <T>(IHttpClient httpClient, bool shouldDisposeHttpClient, IApiSettings settings) where T : class
        {
            var requestFactory = new HttpRequestFactory(settings);

            requestFactory.ValidateApi(typeof(T));
            var responseHandlersList = new HttpResponseHandlersList(settings);

            responseHandlersList.ValidateApi(typeof(T));
            var anchor = new Anchor(httpClient, requestFactory, responseHandlersList, shouldDisposeHttpClient);
            var api    = ProxyGenerator.CreateInterfaceProxyWithoutTarget <T>(anchor);

            return(api);
        }