internal IApiConnectionLegacy ApiConnection;
- public TwitterAppToken AppToken { get; private set; } = TwitterAppToken.GetDefault();
+ public APIAuthType AuthType { get; private set; } = APIAuthType.None;
public TwitterApi()
=> this.ApiConnection = new TwitterApiConnection(new TwitterCredentialNone());
public void Initialize(ITwitterCredential credential, long userId, string screenName)
{
- this.AppToken = credential.AppToken;
+ this.AuthType = credential.AuthType;
var newInstance = new TwitterApiConnection(credential);
var oldInstance = Interlocked.Exchange(ref this.ApiConnection, newInstance);
var status = new PostStatusParams();
var statusTextCompat = this.FormatStatusText(this.StatusText.Text);
- if (this.GetRestStatusCount(statusTextCompat) >= 0 && this.tw.Api.AppToken.AuthType == APIAuthType.OAuth1)
+ if (this.GetRestStatusCount(statusTextCompat) >= 0 && this.tw.Api.AuthType == APIAuthType.OAuth1)
{
// auto_populate_reply_metadata や attachment_url を使用しなくても 140 字以内に
// 収まる場合はこれらのオプションを使用せずに投稿する
if (endpointName == null)
{
- var authByCookie = this.tw.Api.AppToken.AuthType == APIAuthType.TwitterComCookie;
+ var authByCookie = this.tw.Api.AuthType == APIAuthType.TwitterComCookie;
// 表示中のタブに応じて更新
endpointName = tabType switch
TwitterStatus status;
- if (this.Api.AppToken.AuthType == APIAuthType.TwitterComCookie)
+ if (this.Api.AuthType == APIAuthType.TwitterComCookie)
{
var request = new CreateTweetRequest
{
public async Task DeleteTweet(TwitterStatusId tweetId)
{
- if (this.Api.AppToken.AuthType == APIAuthType.TwitterComCookie)
+ if (this.Api.AuthType == APIAuthType.TwitterComCookie)
{
var request = new DeleteTweetRequest
{
var target = post.RetweetedId ?? id; // 再RTの場合は元発言をRT
- if (this.Api.AppToken.AuthType == APIAuthType.TwitterComCookie)
+ if (this.Api.AuthType == APIAuthType.TwitterComCookie)
{
var request = new CreateRetweetRequest
{
if (post.RetweetedId == null)
throw new ArgumentException("post is not retweeted status", nameof(post));
- if (this.Api.AppToken.AuthType == APIAuthType.TwitterComCookie)
+ if (this.Api.AuthType == APIAuthType.TwitterComCookie)
{
var request = new DeleteRetweetRequest
{
public async Task<TwitterUser> GetUserInfo(string screenName)
{
- if (this.Api.AppToken.AuthType == APIAuthType.TwitterComCookie)
+ if (this.Api.AuthType == APIAuthType.TwitterComCookie)
{
var request = new UserByScreenNameRequest
{
var count = GetApiResultCount(MyCommon.WORKERTYPE.UserTimeline, more, false);
TwitterStatus[] statuses;
- if (this.Api.AppToken.AuthType == APIAuthType.TwitterComCookie)
+ if (this.Api.AuthType == APIAuthType.TwitterComCookie)
{
var userId = tab.UserId;
if (MyCommon.IsNullOrEmpty(userId))
this.CheckAccountState();
TwitterStatus status;
- if (this.Api.AppToken.AuthType == APIAuthType.TwitterComCookie)
+ if (this.Api.AuthType == APIAuthType.TwitterComCookie)
{
var request = new TweetDetailRequest
{
var count = GetApiResultCount(MyCommon.WORKERTYPE.List, more, startup);
TwitterStatus[] statuses;
- if (this.Api.AppToken.AuthType == APIAuthType.TwitterComCookie)
+ if (this.Api.AuthType == APIAuthType.TwitterComCookie)
{
var request = new ListLatestTweetsTimelineRequest(tab.ListInfo.Id.ToString())
{
var count = GetApiResultCount(MyCommon.WORKERTYPE.PublicSearch, more, false);
TwitterStatus[] statuses;
- if (this.Api.AppToken.AuthType == APIAuthType.TwitterComCookie)
+ if (this.Api.AuthType == APIAuthType.TwitterComCookie)
{
var request = new SearchTimelineRequest(tab.SearchWords)
{