Esempio n. 1
0
        private StreamClient(string apiKey, IStreamClientToken streamClientToken, RestClient client, StreamClientOptions options = null)
        {
            if (string.IsNullOrWhiteSpace(apiKey))
            {
                throw new ArgumentNullException("apiKey", "Must have an apiKey");
            }
            if (streamClientToken is null)
            {
                throw new ArgumentNullException("streamClientToken", "Must have a streamClientToken");
            }

            _apiKey            = apiKey;
            _streamClientToken = streamClientToken;
            _options           = options ?? StreamClientOptions.Default;
            _client            = client;
        }
Esempio n. 2
0
        public StreamClient(string apiKey, string apiSecretOrToken, StreamClientOptions options = null)
        {
            if (string.IsNullOrWhiteSpace(apiKey))
            {
                throw new ArgumentNullException("apiKey", "Must have an apiKey");
            }
            if (string.IsNullOrWhiteSpace(apiSecretOrToken))
            {
                throw new ArgumentNullException("apiSecret", "Must have an apiSecret or user session token");
            }

            _apiKey            = apiKey;
            _streamClientToken = StreamClientToken.For(apiSecretOrToken);
            _options           = options ?? StreamClientOptions.Default;
            _client            = new RestClient(GetBaseUrl(_options.Location), TimeSpan.FromMilliseconds(_options.Timeout));
        }