/// <summary> /// Gets the user details. /// </summary> /// <param name="accessToken">May contain an access token, which will have to be used in obtaining information about the user.</param> public override UserInfo GetUserInfo(AccessToken accessToken = null) { // help: https://dev.twitter.com/rest/reference/get/users/show accessToken = base.GetSpecifiedTokenOrCurrent(accessToken); string url = "https://api.twitter.com/1.1/users/show.json"; // query parameters var parameters = new HttpParameterCollection(); parameters.AddUrlParameter("user_id", accessToken["user_id"].ToString()); parameters.AddUrlParameter("screen_name", accessToken["screen_name"].ToString()); parameters.AddUrlParameter("include_entities", "false"); this.Authorization["oauth_token"] = accessToken["oauth_token"].ToString(); this.Authorization.TokenSecret = accessToken["oauth_token_secret"].ToString(); // execute the request var result = OAuthUtility.Get(url, parameters, this.Authorization); // field mapping var map = new ApiDataMapping(); map.Add("id_str", "UserId", typeof(string)); map.Add("name", "DisplayName"); map.Add("screen_name", "UserName"); map.Add("profile_image_url", "Userpic"); map.Add("url", "Url"); map.Add("birthday", "Birthday", typeof(DateTime), @"dd\.MM\.yyyy"); map.Add("lang", "Language"); //map.Add("verified", "Url"); //map.Add("location", "Url"); // parse the server response and returns the UserInfo instance return(new UserInfo(result, map)); }
private void GetTweets() { this.Cursor = Cursors.WaitCursor; var parameters = new HttpParameterCollection(); if (!String.IsNullOrEmpty(this.LastTweetId)) { parameters.AddUrlParameter("max_id", this.LastTweetId); } OAuthUtility.GetAsync ( "https://api.twitter.com/1.1/statuses/user_timeline.json", parameters: parameters, authorization: this.GetAuth(), callback: GetTweets_Result ); }
/// <summary> /// Gets the user details. /// </summary> /// <param name="accessToken">May contain an access token, which will have to be used in obtaining information about the user.</param> public override UserInfo GetUserInfo(AccessToken accessToken = null) { // help: https://dev.twitter.com/docs/api/1/get/users/show accessToken = base.GetSpecifiedTokenOrCurrent(accessToken); string url = "https://api.twitter.com/1.1/users/show.json"; // query parameters var parameters = new HttpParameterCollection(); parameters.AddUrlParameter("user_id", accessToken["user_id"].ToString()); parameters.AddUrlParameter("screen_name", accessToken["screen_name"].ToString()); parameters.AddUrlParameter("include_entities", "false"); this.Authorization["oauth_token"] = accessToken["oauth_token"].ToString(); this.Authorization.TokenSecret = accessToken["oauth_token_secret"].ToString(); // execute the request var result = OAuthUtility.Get(url, parameters, this.Authorization); // field mapping var map = new ApiDataMapping(); map.Add("id_str", "UserId", typeof(string)); map.Add("name", "DisplayName"); map.Add("screen_name", "UserName"); map.Add("profile_image_url", "Userpic"); map.Add("url", "Url"); map.Add("birthday", "Birthday", typeof(DateTime), @"dd\.MM\.yyyy"); //map.Add("verified", "Url"); //map.Add("location", "Url"); // parse the server response and returns the UserInfo instance return new UserInfo(result, map); }