Пример #1
0
        public TwitterBinder(TwitterBindingAttribute attribute,
                             ITwitterService twitterService, INameResolver nameResolver)
        {
            this._attribute      = attribute;
            this._twitterService = twitterService;
            this._nameResolver   = nameResolver;

            this._twitterService.SetSettings(attribute);
        }
        private void ValidateTwitterConfig(TwitterBindingAttribute attribute, Type paramType)
        {
            if (string.IsNullOrEmpty(attribute.AccessToken))
            {
                throw new InvalidOperationException($"Twitter AccessToken must be set either via the attribute property or via configuration.");
            }

            if (string.IsNullOrEmpty(attribute.AccessTokenSecret))
            {
                throw new InvalidOperationException($"Twitter AccessTokenSecret must be set either via the attribute property or via configuration.");
            }

            if (string.IsNullOrEmpty(attribute.ConsumerKey))
            {
                throw new InvalidOperationException($"Twitter ConsumerKey must be set either via the attribute property or via configuration.");
            }

            if (string.IsNullOrEmpty(attribute.ConsumerSecret))
            {
                throw new InvalidOperationException($"Twitter ConsumerSecret must be set either via the attribute property or via configuration.");
            }
        }
 public IAsyncCollector <string> Convert(TwitterBindingAttribute attribute)
 {
     return(new TwitterBindingAsyncCollector(attribute, _twitterService, _nameResolver));
 }