Exemple #1
0
        public void Configure(string name, HttpClientFactoryOptions options)
        {
            var token = "";

            if (name is nameof(SearchClient))
            {
                token = _humanOptions.Value.OauthToken;
            }

            if (name is nameof(SearchClient) && string.IsNullOrEmpty(token))
            {
                throw new Exception("Missing token. Check configuration!");
            }

            if (name is nameof(SearchClient))
            {
                options.HttpClientActions.Add(c => CommonHttpClientConfiguration.ConfigureHttpClient(c, token));
            }
        }
Exemple #2
0
        public void Configure(string name, HttpClientFactoryOptions options)
        {
            var token = "";

            if (name is nameof(SlackClient))
                token = _botOptions.Value.BotToken;

            if (name is nameof(SlackClient) && string.IsNullOrEmpty(token))
                throw new Exception("Missing token. Check configuration!");
            
            if (name is nameof(SlackClient))
            {
                options.HttpClientActions.Add(c => CommonHttpClientConfiguration.ConfigureHttpClient(c, token));
            }
            
            if (name is nameof(SlackOAuthAccessClient))
            {
                options.HttpClientActions.Add(c => CommonHttpClientConfiguration.ConfigureHttpClient(c));
            }
        }