From b0ef1526b107e867953d625a5ab41d7c5bf0dee9 Mon Sep 17 00:00:00 2001 From: Nicolas Constant Date: Sat, 21 Mar 2020 23:55:49 -0400 Subject: [PATCH] added twitter credentials --- .../BirdsiteLive.Twitter.csproj | 4 ++++ .../Settings/TwitterSettings.cs | 17 +++++++++-------- src/BirdsiteLive.Twitter/TwitterService.cs | 6 ++++++ src/BirdsiteLive/Startup.cs | 5 ++++- src/BirdsiteLive/appsettings.Development.json | 5 ++++- src/BirdsiteLive/appsettings.json | 5 ++++- 6 files changed, 31 insertions(+), 11 deletions(-) diff --git a/src/BirdsiteLive.Twitter/BirdsiteLive.Twitter.csproj b/src/BirdsiteLive.Twitter/BirdsiteLive.Twitter.csproj index 9f5c4f4..84e0bf0 100644 --- a/src/BirdsiteLive.Twitter/BirdsiteLive.Twitter.csproj +++ b/src/BirdsiteLive.Twitter/BirdsiteLive.Twitter.csproj @@ -4,4 +4,8 @@ netstandard2.0 + + + + diff --git a/src/BirdsiteLive.Twitter/Settings/TwitterSettings.cs b/src/BirdsiteLive.Twitter/Settings/TwitterSettings.cs index 3725746..024a6de 100644 --- a/src/BirdsiteLive.Twitter/Settings/TwitterSettings.cs +++ b/src/BirdsiteLive.Twitter/Settings/TwitterSettings.cs @@ -3,17 +3,18 @@ public class TwitterSettings { #region Ctor - public TwitterSettings() + public TwitterSettings(string apiKey, string consumerKey, string consumerSecret, string accessToken, string accessTokenSecret) { - - } - - public TwitterSettings(string apiKey) - { - ApiKey = apiKey; + ConsumerKey = consumerKey; + ConsumerSecret = consumerSecret; + AccessToken = accessToken; + AccessTokenSecret = accessTokenSecret; } #endregion - public string ApiKey { get; set; } + public string ConsumerKey { get; set; } + public string ConsumerSecret { get; set; } + public string AccessToken { get; set; } + public string AccessTokenSecret { get; set; } } } \ No newline at end of file diff --git a/src/BirdsiteLive.Twitter/TwitterService.cs b/src/BirdsiteLive.Twitter/TwitterService.cs index 1f11c6a..261a9b3 100644 --- a/src/BirdsiteLive.Twitter/TwitterService.cs +++ b/src/BirdsiteLive.Twitter/TwitterService.cs @@ -1,5 +1,6 @@ using System; using BirdsiteLive.Twitter.Settings; +using Tweetinvi; namespace BirdsiteLive.Twitter { @@ -17,5 +18,10 @@ namespace BirdsiteLive.Twitter _settings = settings; } #endregion + + public void GetUser(string username) + { + var user = User.GetUserFromScreenName(username); + } } } diff --git a/src/BirdsiteLive/Startup.cs b/src/BirdsiteLive/Startup.cs index c5aa247..b63cb07 100644 --- a/src/BirdsiteLive/Startup.cs +++ b/src/BirdsiteLive/Startup.cs @@ -45,7 +45,10 @@ namespace BirdsiteLive var twitterSettings = Configuration.GetSection("Twitter").Get(); services.For().Use() - .Ctor("apiKey").Is(twitterSettings.ApiKey); + .Ctor("accessToken").Is(twitterSettings.AccessToken) + .Ctor("accessTokenSecret").Is(twitterSettings.AccessTokenSecret) + .Ctor("consumerKey").Is(twitterSettings.ConsumerKey) + .Ctor("consumerSecret").Is(twitterSettings.ConsumerSecret); services.Scan(_ => { diff --git a/src/BirdsiteLive/appsettings.Development.json b/src/BirdsiteLive/appsettings.Development.json index 559669d..48e3df0 100644 --- a/src/BirdsiteLive/appsettings.Development.json +++ b/src/BirdsiteLive/appsettings.Development.json @@ -10,6 +10,9 @@ "Domain": "domain.name" }, "Twitter": { - "ApiKey": "twitter.api.key" + "ConsumerKey": "twitter.api.key", + "ConsumerSecret": "twitter.api.key", + "AccessToken": "twitter.api.key", + "AccessTokenSecret": "twitter.api.key" } } diff --git a/src/BirdsiteLive/appsettings.json b/src/BirdsiteLive/appsettings.json index b5f881b..6de0ca3 100644 --- a/src/BirdsiteLive/appsettings.json +++ b/src/BirdsiteLive/appsettings.json @@ -11,6 +11,9 @@ "Domain": "domain.name" }, "Twitter": { - "ApiKey": "twitter.api.key" + "ConsumerKey": "twitter.api.key", + "ConsumerSecret": "twitter.api.key", + "AccessToken": "twitter.api.key", + "AccessTokenSecret": "twitter.api.key" } }