public static IServiceCollection AddTweetOperations(this IServiceCollection services, IConfiguration configuration)
        {
            var twitterApiSettings = new TwitterApiSettings
            {
                Key    = configuration[Constants.TWITTER_API_KEY],
                Secret = configuration[Constants.TWITTER_API_SECRET]
            };

            services
            .AddSingleton(twitterApiSettings)
            .AddSingleton <ITweetOperations, TweetOperations>();

            return(services);
        }
Пример #2
0
 public TweetOperations(TwitterApiSettings twitterApiSettings, IMapper mapper)
 {
     _consumerKey    = twitterApiSettings.Key;
     _consumerSecret = twitterApiSettings.Secret;
     _mapper         = mapper;
 }