Beispiel #1
0
 public SlackRtmClient(ISlackApiClient client, IWebSocketFactory webSocketFactory, SlackJsonSettings jsonSettings, IScheduler scheduler, ILogger logger)
 {
     _client       = client;
     _jsonSettings = jsonSettings;
     _webSocket    = new ReconnectingWebSocket(webSocketFactory, scheduler, logger, 0);
     _rawEvents    = DeserializeEvents(_webSocket, _jsonSettings);
 }
Beispiel #2
0
 public SlackApiClient(IHttp http, ISlackUrlBuilder urlBuilder, SlackJsonSettings jsonSettings, string token)
 {
     _http         = http;
     _urlBuilder   = urlBuilder;
     _jsonSettings = jsonSettings;
     _token        = token;
 }
Beispiel #3
0
 public SlackRtmClient(string token)
 {
     _jsonSettings = Default.JsonSettings(Default.SlackTypeResolver(Default.AssembliesContainingSlackTypes));
     _client       = new SlackApiClient(Default.Http(_jsonSettings), Default.UrlBuilder(_jsonSettings), _jsonSettings, token);
     _webSocket    = new ReconnectingWebSocket(Default.WebSocketFactory, Scheduler.Default, Default.Logger, 0);
     _rawEvents    = DeserializeEvents(_webSocket, _jsonSettings);
 }
Beispiel #4
0
 public SlackApiClient(string token)
 {
     _jsonSettings = Default.JsonSettings(Default.SlackTypeResolver(Default.AssembliesContainingSlackTypes));
     _http         = Default.Http(_jsonSettings);
     _urlBuilder   = Default.UrlBuilder(_jsonSettings);
     _token        = token;
 }
Beispiel #5
0
 public SlackRtmClient(string token)
 {
     _rawEvents        = Subject.Synchronize(_eventSubject);
     _webSocketFactory = Default.WebSocketFactory;
     _jsonSettings     = Default.JsonSettings(Default.SlackTypeResolver(Default.AssembliesContainingSlackTypes));
     _scheduler        = Scheduler.Default;
     _client           = new SlackApiClient(Default.Http(_jsonSettings), Default.UrlBuilder(_jsonSettings), _jsonSettings, token);
 }
Beispiel #6
0
 public SlackRtmClient(ISlackApiClient client, IWebSocketFactory webSocketFactory, SlackJsonSettings jsonSettings, IScheduler scheduler)
 {
     _rawEvents        = Subject.Synchronize(_eventSubject);
     _client           = client;
     _webSocketFactory = webSocketFactory;
     _jsonSettings     = jsonSettings;
     _scheduler        = scheduler;
 }
        public SlackSocketModeClient(
            ICoreSocketModeClient socket,
            SlackJsonSettings jsonSettings,
            ISlackRequestListener requestListener,
            ISlackHandlerFactory handlerFactory)
        {
            _socket          = socket;
            _jsonSettings    = jsonSettings;
            _requestListener = requestListener;
            _handlerFactory  = handlerFactory;

            _requestSubscription = _socket.Messages
                                   .OfType <SocketEnvelope>()
                                   .SelectMany(HandleRequest)
                                   .Subscribe();
        }
        public SlackSocketModeClient(
            ICoreSocketModeClient socket,
            SlackJsonSettings jsonSettings,
            IEnumerable <ISlackRequestListener> requestListeners,
            ISlackHandlerFactory handlerFactory,
            ILogger logger)
        {
            _socket           = socket;
            _jsonSettings     = jsonSettings;
            _requestListeners = requestListeners;
            _handlerFactory   = handlerFactory;
            _log = logger.ForSource <SlackSocketModeClient>();

            _requestSubscription = _socket.Messages
                                   .OfType <SocketEnvelope>()
                                   .SelectMany(HandleRequest)
                                   .Subscribe();
        }
Beispiel #9
0
 private static IObservable <Event> DeserializeEvents(ReconnectingWebSocket webSocket, SlackJsonSettings jsonSettings) =>
 webSocket.Messages
 .Select(m => JsonConvert.DeserializeObject <Event>(m.Message, jsonSettings.SerializerSettings))
 .Publish()
 .RefCount();
Beispiel #10
0
 public Http(Func <HttpClient> getHttpClient, SlackJsonSettings jsonSettings, ILogger logger)
 {
     _getHttpClient = getHttpClient;
     _jsonSettings  = jsonSettings;
     _log           = logger.ForSource <Http>();
 }
Beispiel #11
0
 public Http(HttpClient client, SlackJsonSettings jsonSettings)
 {
     _client       = client;
     _jsonSettings = jsonSettings;
 }
Beispiel #12
0
 public SlackUrlBuilder(SlackJsonSettings jsonSettings) => _jsonSettings = jsonSettings;
Beispiel #13
0
 public static IHttp Http(SlackJsonSettings jsonSettings = null, HttpClient httpClient = null) => new Http(httpClient ?? new HttpClient(), jsonSettings ?? JsonSettings());
Beispiel #14
0
 public static ISlackUrlBuilder UrlBuilder(SlackJsonSettings jsonSettings = null) => new SlackUrlBuilder(jsonSettings ?? JsonSettings());
Beispiel #15
0
 public static IHttp Http(SlackJsonSettings jsonSettings = null, Func <HttpClient> getHttpClient = null) => new Http(getHttpClient ?? HttpClientFactory(), jsonSettings ?? JsonSettings());
Beispiel #16
0
 public Http(Func <HttpClient> getHttpClient, SlackJsonSettings jsonSettings)
 {
     _getHttpClient = getHttpClient;
     _jsonSettings  = jsonSettings;
 }
Beispiel #17
0
 public static IHttp Http(SlackJsonSettings jsonSettings) => new Http(new HttpClient(), jsonSettings);
Beispiel #18
0
 public static ISlackUrlBuilder UrlBuilder(SlackJsonSettings jsonSettings) => new SlackUrlBuilder(jsonSettings);
Beispiel #19
0
 public Http(HttpClient client, SlackJsonSettings jsonSettings, bool retryOnRateLimit = true)
 {
     _client           = client;
     _jsonSettings     = jsonSettings;
     _retryOnRateLimit = retryOnRateLimit;
 }