Class NTwitterClient

java.lang.Object
com.netlang.twitter.NTwitterClient

public class NTwitterClient extends Object
Class that implements Twitter REST services.

Example:

  		NTwitterClient twitterClient1 =  new NTwitterClient("THE_BEARER");	
 		IDate date1=new IDate("yyyy-MM-dd HH:mm:ss");
		IDate oneWeekAgo=new IDate("yyyy-MM-dd HH:mm:ss");
		oneWeekAgo.sub(0,0,7,0,0,0,0);
		
		List<NTweet> tweets1=twitterClient1.listUserTimeline("userid",oneWeekAgo,date1);
		NTweet tweet1=tweets1.get(0);
		String text1=tweet1.getText();
  
  • Constructor Details

    • NTwitterClient

      public NTwitterClient(String bearerToken)
      Create a new client for communicating with Twitter
      Parameters:
      bearerToken - the access token from twitter
    • NTwitterClient

      public NTwitterClient(String apikey, String secret)
      * Create a new client for communicating with Twitter.
      Parameters:
      apikey - the API key
      secret - the secrete
  • Method Details

    • main

      public static void main(String[] args)
    • listUserTimeline

      public List<NTweet> listUserTimeline(String userid, com.intellus.util.IDate start, com.intellus.util.IDate end)
      Returns all tweets between in a timespan for the specific user
      Parameters:
      userid -
      start -
      end -
      Returns:
    • getUserIdFromName

      public String getUserIdFromName(String name)
      Convert a twitter username to userid
      Parameters:
      name -
      Returns:
    • getTweet

      public NTweet getTweet(String tweetid)
      Get a specific tweet.
      Parameters:
      tweetid -
      Returns:
    • getFollowers

      public List<String> getFollowers(String userid)
      Return all followers fot the given userid
      Parameters:
      userid -
      Returns:
      a list with usernames