public virtual IAsyncResult BeginGetUserProfileFor(GetUserProfileForOptions options) { var user_id = options.UserId; var screen_name = options.ScreenName; var include_entities = options.IncludeEntities; return BeginWithHammock<TwitterUser>(WebMethod.Get, "users/show", FormatAsString, "?user_id=", user_id, "&screen_name=", screen_name, "&include_entities=", include_entities); }
public virtual void GetUserProfileFor(GetUserProfileForOptions options, Action<TwitterUser, TwitterResponse> action) { var user_id = options.UserId; var screen_name = options.ScreenName; var include_entities = options.IncludeEntities; WithHammock(action, "users/show", FormatAsString, "?user_id=", user_id, "&screen_name=", screen_name, "&include_entities=", include_entities); }
public virtual Task<TwitterResponse<TwitterUser>> GetUserProfileForAsync(GetUserProfileForOptions options) { var user_id = options.UserId; var screen_name = options.ScreenName; var include_entities = options.IncludeEntities; return ExecuteRequest<TwitterUser>("users/show", FormatAsString, "?user_id=", user_id, "&screen_name=", screen_name, "&include_entities=", include_entities); }
static void Main(string[] args) { //OAuthInfo myOAuth = new OAuthInfo(); //myOAuth.ConsumerKey = "8TmvHbMNWugTpk9lIpbdQ"; //myOAuth.ConsumerSecret = "AmDxGd29eSUjERuyy20p5bZaFrpLfgYTCP5Qi1K0crw"; //myOAuth.AccessToken = "21985278-14mhmDF5238JlIeA68ak2MudVhXuHsmkhsNoMTDsp"; //myOAuth.AccessSecret = "MTpjzzkibGWM6KU8Za2B4WJUieskPEjrAVxBhY2oQ"; //TinyTwitter TT = new TinyTwitter(new OAuthInfo()); //IEnumerable<Tweet> mytimneline = TT.GetHomeTimeline(null, 2); //Console.ReadKey(); var service = new TwitterService("tedRo766zL7mr7TKZkOugA", "WREOp5SZ71EtLCt3T4RboUv1IrkUpPkCpcBxkAGk8"); //var service = new TwitterService("bWDpCLO2mIByqMYoaRh2Cg", "X4veUKVWhB09wipWhVpaVhXvLDHqzIjnOLOGXxiY8Y"); service.AuthenticateWith("21985278-dud1wSertHCQYTUK5ta5AA0ciqWB31ZsT8Dt8DJg", "yPDp2TTOOhQj6XDxX7P5TxmNtHZcQ6sJumth8DVzRk"); //service.AuthenticateWith("25963011-QuJkeaEcXqB92bhMxoIJHKBLFHP1rPZysu6K68IqZ", "pY0TXRW8aIUSDfSUpJAzsQ2s2Oay2A0HBdiaK1Z8"); //var tweets = service.ListTweetsOnHomeTimeline(new ListTweetsOnHomeTimelineOptions()); //var tweets = service.ListRetweetsOfMyTweets(new ListRetweetsOfMyTweetsOptions()); //var tweets = service.ListFavoriteTweets(new ListFavoriteTweetsOptions()); var tweets = service.ListTweetsMentioningMe(new ListTweetsMentioningMeOptions()); //var MyTweetOptions = new SendTweetOptions(); //MyTweetOptions.Status = "Hello World"; //service.SendTweet(MyTweetOptions); var myFriendLists = service.GetIncomingFriendRequests(new GetIncomingFriendRequestsOptions()); foreach (var FriendLists in myFriendLists) { var MyFriendOptions = new GetUserProfileForOptions(); MyFriendOptions.UserId = FriendLists; var MyFriend = service.GetUserProfileFor(MyFriendOptions); Console.WriteLine("{0} says", FriendLists.ToString()); Console.ReadKey(); } //foreach (var tweet in tweets) //{ // Console.WriteLine("{0} says '{1}'", tweet.Id, tweet.Text); // Console.ReadKey(); //} //using TweetSharp; // Pass your credentials to the service // TwitterService service = new TwitterService("bWDpCLO2mIByqMYoaRh2Cg", "X4veUKVWhB09wipWhVpaVhXvLDHqzIjnOLOGXxiY8Y"); // Step 1 - Retrieve an OAuth Request Token //OAuthRequestToken requestToken = service.GetRequestToken(); // Step 2 - Redirect to the OAuth Authorization URL //Uri uri = service.GetAuthorizationUri(requestToken); //Process.Start(uri.ToString()); // Step 3 - Exchange the Request Token for an Access Token //string verifier = Console.ReadLine(); // <-- This is input into your application by your user //OAuthAccessToken access = service.GetAccessToken(requestToken, verifier); // Step 4 - User authenticates using the Access Token //service.AuthenticateWith(access.Token, access.TokenSecret); //IEnumerable<TwitterStatus> mentions = service.ListTweetsMentioningMe); //var tweets = service.ListTweetsOnHomeTimeline(new ListTweetsOnHomeTimelineOptions()); //var myRetweetsOption = new ListRetweetsOfMyTweetsOptions(); //myRetweetsOption.SinceId = 313064862320300032; //tweets = service.ListRetweetsOfMyTweets(myRetweetsOption); // //foreach (var tweet in tweets) //{ //Console.WriteLine("{0} says '{1}' id:{3} ", tweet.User.ScreenName, tweet.Text, tweet.Id); // Console.WriteLine("{0} says '{1}' ", tweet.Id, tweet.Text); //Console.ReadKey(); //} //Console.ReadKey(); }
public virtual Task<TwitterAsyncResult<TwitterUser>> GetUserProfileForAsync(GetUserProfileForOptions options) { var user_id = options.UserId; var screen_name = options.ScreenName; var include_entities = options.IncludeEntities; return WithHammockTask<TwitterUser>(_client, "users/show", FormatAsString, "?user_id=", user_id, "&screen_name=", screen_name, "&include_entities=", include_entities); }
public static TwitterUser GetUserIdFromUsername(TwitterService service, string screenname) { GetUserProfileForOptions options = new GetUserProfileForOptions (); options.ScreenName = screenname; return service.GetUserProfileFor (options); }
/// <summary> /// Accesses the profile of a user /// </summary> /// <param name="command">The entire command string</param> /// <returns></returns> private void ShowProfile(string command) { GetUserProfileForOptions profileOpts = new GetUserProfileForOptions(); string screenName = ""; try { bool exceptionTest = command.Split(' ')[1].StartsWith("@"); } catch (IndexOutOfRangeException) { ScreenDraw.ShowMessage("Wrong syntax. Use /profile [id] or /profile @[name]"); return; } if (command.Split(' ')[1].StartsWith("@")) { screenName = command.Split(' ')[1].Remove(0, 1); } else if (command.Split(' ')[1].Length != 2) { ScreenDraw.ShowMessage("Wrong syntax. Use /profile [id] or /profile @[name]"); return; } else { screenName = TweetIdentification.GetTweetID(command.Split(' ')[1]).Status; } profileOpts.ScreenName = screenName; TwitterUser profile = User.Account.GetUserProfileFor(profileOpts); ScreenDraw showProfile = new ScreenDraw(); if (GetUpdates.IsFollowing(screenName)) /* Because the profile object doesn't say this */ { ScreenDraw.IsFollowing = true; } else { ScreenDraw.IsFollowing = false; } if (GetUpdates.IsBlocked(screenName)) { ScreenDraw.IsBlocked = true; } else { ScreenDraw.IsBlocked = false; } if (User.Account.Response.Error == null) { showProfile.ShowUserProfile(profile); } else { ScreenDraw.ShowMessage(User.Account.Response.Error.Code + ": " + User.Account.Response.Error.Message); } return; }