Exemplo n.º 1
0
 public ApiClient(ApiVersionChecker versionChecker, HttpClient http, CommandMapper commandMapper, QueryMapper queryMapper, IExceptionHandler exceptionHandler, ApiAuthenticationStateProvider authenticationState, ILogFactory logFactory, Json json, FormatterContainer formatters)
 {
     Ensure.NotNull(versionChecker, "versionChecker");
     Ensure.NotNull(http, "http");
     Ensure.NotNull(commandMapper, "commandMapper");
     Ensure.NotNull(queryMapper, "queryMapper");
     Ensure.NotNull(exceptionHandler, "exceptionHandler");
     Ensure.NotNull(authenticationState, "authenticationState");
     Ensure.NotNull(logFactory, "logFactory");
     Ensure.NotNull(json, "json");
     Ensure.NotNull(formatters, "formatters");
     this.versionChecker      = versionChecker;
     this.http                = http;
     this.commandMapper       = commandMapper;
     this.queryMapper         = queryMapper;
     this.exceptionHandler    = exceptionHandler;
     this.authenticationState = authenticationState;
     this.log        = logFactory.Scope("ApiClient");
     this.json       = json;
     this.formatters = formatters;
 }
Exemplo n.º 2
0
        public ApiClient(IOptions <ApiClientConfiguration> configuration, ApiVersionChecker versionChecker, HttpClient http, CommandMapper commandMapper, QueryMapper queryMapper, IExceptionHandler exceptionHandler, ApiAuthenticationStateProvider authenticationState, ILogFactory logFactory, Json json)
        {
            Ensure.NotNull(configuration, "configuration");
            Ensure.NotNull(versionChecker, "versionChecker");
            Ensure.NotNull(http, "http");
            Ensure.NotNull(commandMapper, "commandMapper");
            Ensure.NotNull(queryMapper, "queryMapper");
            Ensure.NotNull(exceptionHandler, "exceptionHandler");
            Ensure.NotNull(authenticationState, "authenticationState");
            Ensure.NotNull(logFactory, "logFactory");
            Ensure.NotNull(json, "json");
            this.versionChecker      = versionChecker;
            this.http                = http;
            this.commandMapper       = commandMapper;
            this.queryMapper         = queryMapper;
            this.exceptionHandler    = exceptionHandler;
            this.authenticationState = authenticationState;
            this.log  = logFactory.Scope("ApiClient");
            this.json = json;

            this.http.BaseAddress = configuration.Value.ApiUrl;
        }