added twitter credentials

This commit is contained in:
Nicolas Constant 2020-03-21 23:55:49 -04:00
parent 796004fa59
commit b0ef1526b1
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
6 changed files with 31 additions and 11 deletions

View File

@ -4,4 +4,8 @@
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="TweetinviAPI" Version="4.0.3" />
</ItemGroup>
</Project>

View File

@ -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; }
}
}

View File

@ -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);
}
}
}

View File

@ -45,7 +45,10 @@ namespace BirdsiteLive
var twitterSettings = Configuration.GetSection("Twitter").Get<TwitterSettings>();
services.For<TwitterSettings>().Use<TwitterSettings>()
.Ctor<string>("apiKey").Is(twitterSettings.ApiKey);
.Ctor<string>("accessToken").Is(twitterSettings.AccessToken)
.Ctor<string>("accessTokenSecret").Is(twitterSettings.AccessTokenSecret)
.Ctor<string>("consumerKey").Is(twitterSettings.ConsumerKey)
.Ctor<string>("consumerSecret").Is(twitterSettings.ConsumerSecret);
services.Scan(_ =>
{

View File

@ -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"
}
}

View File

@ -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"
}
}