public DeleteRepresentationAction(
     IRepresentationStore representationStore,
     IApiResponseFactory apiResponseFactory)
 {
     _representationStore = representationStore;
     _apiResponseFactory  = apiResponseFactory;
 }
Ejemplo n.º 2
0
        public ErrorHandler(IApiResponseFactory responseFactory, IGogoKitConfiguration configuration, IJsonSerializer jsonSerializer)
        {
            Requires.ArgumentNotNull(responseFactory, nameof(responseFactory));
            Requires.ArgumentNotNull(configuration, nameof(configuration));

            _responseFactory = responseFactory;
            _configuration   = configuration;
            _jsonSerializer  = jsonSerializer;
        }
 public GetRepresentationAction(
     IRepresentationStore representationStore,
     IRepresentationResponseParser responseParser,
     IApiResponseFactory apiResponseFactory,
     IParametersValidator parametersValidator)
 {
     _representationStore = representationStore;
     _responseParser      = responseParser;
     _apiResponseFactory  = apiResponseFactory;
     _parametersValidator = parametersValidator;
 }
Ejemplo n.º 4
0
 public BatchClient(
     IHttpConnection connection,
     IApiResponseFactory responseFactory,
     IJsonSerializer jsonSerializer,
     ILinkResolver linkResolver)
 {
     _responseFactory = responseFactory;
     _httpConnection  = connection;
     _configuration   = connection.Configuration;
     _jsonSerializer  = jsonSerializer;
     _linkResolver    = linkResolver;
 }
Ejemplo n.º 5
0
 private static ErrorHandler CreateErrorHandler(
     IApiResponseFactory respFact   = null,
     IGogoKitConfiguration config   = null,
     IJsonSerializer jsonSerializer = null,
     HttpResponseMessage resp       = null)
 {
     return(new ErrorHandler(
                respFact ?? new FakeApiResponseFactory(),
                config ?? new GogoKitConfiguration("c", "s"),
                jsonSerializer ?? new DefaultJsonSerializer())
     {
         InnerHandler = new FakeDelegatingHandler(resp: resp)
     });
 }
Ejemplo n.º 6
0
        public HttpConnection(IEnumerable <DelegatingHandler> handlers,
                              IHalKitConfiguration configuration,
                              IHttpClientFactory httpClientFactory,
                              IJsonSerializer jsonSerializer,
                              IApiResponseFactory responseFactory)
        {
            Requires.ArgumentNotNull(handlers, nameof(handlers));
            Requires.ArgumentNotNull(configuration, nameof(configuration));
            Requires.ArgumentNotNull(httpClientFactory, nameof(httpClientFactory));
            Requires.ArgumentNotNull(jsonSerializer, nameof(jsonSerializer));
            Requires.ArgumentNotNull(responseFactory, nameof(responseFactory));

            _httpClient      = httpClientFactory.CreateClient(handlers);
            _configuration   = configuration;
            _jsonSerializer  = jsonSerializer;
            _responseFactory = responseFactory;
        }
 public UpdateRepresentationAction(
     IRepresentationRequestParser requestParser,
     IRepresentationStore representationStore,
     IApiResponseFactory apiResponseFactory,
     IRepresentationResponseParser responseParser,
     IParametersValidator parametersValidator,
     IErrorResponseFactory errorResponseFactory,
     IFilterParser filterParser)
 {
     _requestParser        = requestParser;
     _representationStore  = representationStore;
     _apiResponseFactory   = apiResponseFactory;
     _responseParser       = responseParser;
     _parametersValidator  = parametersValidator;
     _errorResponseFactory = errorResponseFactory;
     _filterParser         = filterParser;
 }
Ejemplo n.º 8
0
 public BulkAction(
     IBulkRequestParser bulkRequestParser,
     IApiResponseFactory apiResponseFactory,
     IAddRepresentationAction addRepresentationAction,
     IDeleteRepresentationAction deleteRepresentationAction,
     IUpdateRepresentationAction updateRepresentationAction,
     IPatchRepresentationAction patchRepresentationAction,
     IErrorResponseFactory errorResponseFactory)
 {
     _bulkRequestParser          = bulkRequestParser;
     _apiResponseFactory         = apiResponseFactory;
     _addRepresentationAction    = addRepresentationAction;
     _errorResponseFactory       = errorResponseFactory;
     _deleteRepresentationAction = deleteRepresentationAction;
     _updateRepresentationAction = updateRepresentationAction;
     _patchRepresentationAction  = patchRepresentationAction;
 }
Ejemplo n.º 9
0
        private static HttpConnection CreateConnection(
            IEnumerable <DelegatingHandler> handlers = null,
            IJsonSerializer serializer          = null,
            IHttpClientFactory httpFact         = null,
            IHalKitConfiguration config         = null,
            IApiResponseFactory responseFactory = null)
        {
            var mockSerializer = new Mock <IJsonSerializer>(MockBehavior.Loose);

            mockSerializer.Setup(json => json.Serialize(It.IsAny <object>())).Returns("{}");

            return(new HttpConnection(
                       handlers ?? new DelegatingHandler[] {},
                       config ?? new HalKitConfiguration(new Uri("http://foo.api.com")),
                       httpFact ?? new FakeHttpClientFactory(),
                       serializer ?? mockSerializer.Object,
                       responseFactory ?? new FakeApiResponseFactory()));
        }
 public ApiResponseWrapperMiddleware(RequestDelegate next, IApiResponseFactory apiResponseFactory)
 {
     this.next = next;
     this.apiResponseFactory = apiResponseFactory;
 }
 public ProducesResponseTypeMapper(IApiResponseFactory responseFactory)
 {
     _responseFactory = responseFactory;
 }
 public SwaggerResponseTypeMapper(IApiResponseFactory responseFactory)
 {
     _responseFactory = responseFactory;
 }