Esempio n. 1
0
        public ApiClient(IOptions <ApiClientConfiguration> configuration, TokenContainer token, HttpClient http, CommandMapper commandMapper, QueryMapper queryMapper, IExceptionHandler exceptionHandler, IEventDispatcher eventDispatcher, Interop interop, ILogFactory logFactory, Json json)
        {
            Ensure.NotNull(configuration, "configuration");
            Ensure.NotNull(token, "token");
            Ensure.NotNull(http, "http");
            Ensure.NotNull(commandMapper, "commandMapper");
            Ensure.NotNull(queryMapper, "queryMapper");
            Ensure.NotNull(exceptionHandler, "exceptionHandler");
            Ensure.NotNull(eventDispatcher, "eventDispatcher");
            Ensure.NotNull(interop, "interop");
            Ensure.NotNull(logFactory, "logFactory");
            Ensure.NotNull(json, "json");
            this.configuration    = configuration.Value;
            this.token            = token;
            this.http             = http;
            this.commandMapper    = commandMapper;
            this.queryMapper      = queryMapper;
            this.exceptionHandler = exceptionHandler;
            this.eventDispatcher  = eventDispatcher;
            this.interop          = interop;
            this.log  = logFactory.Scope("ApiClient");
            this.json = json;

            http.BaseAddress = this.configuration.ApiUrl;
            EnsureAuthorization();
        }
Esempio n. 2
0
 public ApiHubService(BrowserEventDispatcher events, BrowserExceptionHandler exceptions, IOptions <ApiConfiguration> apiConfiguration, TokenContainer token, ILogFactory logFactory)
 {
     Ensure.NotNull(events, "events");
     Ensure.NotNull(exceptions, "exceptions");
     Ensure.NotNull(apiConfiguration, "apiConfiguration");
     Ensure.NotNull(token, "token");
     Ensure.NotNull(logFactory, "logFactory");
     this.events           = events;
     this.exceptions       = exceptions;
     this.apiConfiguration = apiConfiguration.Value;
     this.token            = token;
     this.log          = logFactory.Scope("ApiHub");
     this.eventLog     = log.Factory.Scope("Events");
     this.exceptionLog = log.Factory.Scope("Exceptions");
 }
Esempio n. 3
0
 public ApiAuthenticationStateProvider(IEventDispatcher events, HttpClient http, TokenContainer token, Interop interop, ILogFactory logFactory, IEnumerable <ITokenValidator> validators)
 {
     Ensure.NotNull(events, "eventDispatcher");
     Ensure.NotNull(http, "http");
     Ensure.NotNull(token, "token");
     Ensure.NotNull(interop, "interop");
     Ensure.NotNull(logFactory, "logFactory");
     Ensure.NotNull(validators, "validators");
     this.events  = events;
     this.http    = http;
     this.token   = token;
     this.interop = interop;
     this.log     = logFactory.Scope("ApiAuthenticationState");
     this.validators.AddRange(validators);
 }
Esempio n. 4
0
        public ApiClient(TokenContainer token, HttpClient http, CommandMapper commandMapper, QueryMapper queryMapper, IExceptionHandler exceptionHandler, IEventDispatcher eventDispatcher)
        {
            Ensure.NotNull(token, "token");
            Ensure.NotNull(http, "http");
            Ensure.NotNull(commandMapper, "commandMapper");
            Ensure.NotNull(queryMapper, "queryMapper");
            Ensure.NotNull(exceptionHandler, "exceptionHandler");
            Ensure.NotNull(eventDispatcher, "eventDispatcher");
            this.token            = token;
            this.http             = http;
            this.commandMapper    = commandMapper;
            this.queryMapper      = queryMapper;
            this.exceptionHandler = exceptionHandler;
            this.eventDispatcher  = eventDispatcher;
            http.BaseAddress      = new Uri(rootUrl);

            EnsureAuthorization();
        }