Exemplo n.º 1
0
        /*Retrieve a twitt user from a given screen name, see https://dev.twitter.com/docs/api/1/get/users/show*/
        public static TwittUser GetTwittUser(string screenName)
        {
            OAuthTokens tokens = new OAuthTokens();
            tokens.ConsumerKey = "Removed from github example";
            tokens.ConsumerSecret = "Removed from github example";
            tokens.AccessToken = "Removed from github example";
            tokens.AccessTokenSecret = "Removed from github example";

            var list = new List<string>();

            LookupUsersOptions options = new LookupUsersOptions(){UseSSL = true, APIBaseAddress="http://api.twitter.com/1.1/"};
            options.ScreenNames.Add(screenName);

            TwitterResponse<TwitterUserCollection> res = TwitterUser.Lookup(tokens, options);
            TwitterUserCollection users = res.ResponseObject;
            TwitterUser user = users.First();

            if (user == null) return null;

            TwittUser tu = new TwittUser(
                user.Id.ToString(),
                user.Name,
                user.ScreenName,
                user.Location,
                user.Description);
            return tu;
        }
Exemplo n.º 2
0
 public TwittUser ConvertUserJson(JObject obj)
 {
     var id = makeProperty ("id", obj);
     var name = makeProperty ("name", obj);
     var screenName = makeProperty ("screenName", obj);
     var location = makeProperty ("location", obj);
     var description = makeProperty ("description", obj);
     var user = new TwittUser(id,  name,  screenName,  location,  description);
     return user;
 }