How to check whether user is following an another user in twitter with Twitter API and TweetSharp

When you have the required keys and tokens you can check whether the user is following another user in twitter by using the Twitter API. I am using TweetSharp c# library to perform this task. I have tried with below code and worked for me. If you ever want to do it, try using below code segment.

_consumerKey = Your consumer key
_consumerSecret = Your consumer secret
_token = Authorized token
_tokenSecret = Token secret
TwitterService service = new TwitterService(_consumerKey, _consumerSecret);
service.AuthenticateWith(_token, _tokenSecret);
var user =  service.VerifyCredentials(new VerifyCredentialsOptions());
var twitterFriendship = service.GetFriendshipInfo(new GetFriendshipInfoOptions() { SourceScreenName = user.ScreenName, TargetScreenName = "profileName goes here" });

Now you have the required object and you check it using below condition.

(twitterFriendship.Relationship.Source.Following && twitterFriendship.Relationship.Target.FollowedBy)?true:false;

Cmder console for windows

Found this console for windows. It is a combination of ConEmu and Clink. This is a portable application and need to add into our PATH( not mandatory). With the full version, you have git for windows installed. So just download, unzip and run. We can add custom themes for cmder. This support multiple tabs with different users. If you are working with vs code, you can integrate cmder as the terminal. You can downlod cmder from here.

Integrate with vscode