Beispiel #1
0
 public EventDispatcher(GitterClient client, ILog log, IEnumerable <RobotPart> handlers)
 {
     _client          = client;
     _log             = log;
     _messageHandlers = new List <RobotPart>(handlers);
     _lock            = new object();
 }
Beispiel #2
0
 public StreamClient(EngineSettings settings, IInbox inbox, HttpClient client, GitterClient gitter, ILog log)
     : base(log)
 {
     _client   = client;
     _inbox    = inbox;
     _settings = settings;
     _log      = log;
     _gitter   = gitter;
 }
Beispiel #3
0
        public Engine(EngineSettings settings, IInbox inbox, ILog log, IEnumerable <RobotPart> handlers)
            : base(log)
        {
            if (string.IsNullOrWhiteSpace(settings.Token))
            {
                throw new ArgumentException("No Gitter API key set.", nameof(settings));
            }

            _log = log;

            var client = new HttpClient {
                Timeout = TimeSpan.FromMilliseconds(Timeout.Infinite)
            };

            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", settings.Token);

            var gitter = new GitterClient(client);

            _inbox                  = inbox;
            _streamClient           = new StreamClient(settings, _inbox, client, gitter, _log);
            _webJobShutdownListener = new WebJobShutdownListener(_log);
            _dispatcher             = new EventDispatcher(gitter, _log, handlers);
        }
Beispiel #4
0
 protected Context(GitterClient client, GitterUser bot)
 {
     GitterClient = client;
     Bot          = bot;
 }