Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.twitterapime.rest
Class Timeline

    java.lang.Object
      com.twitterapime.rest.Timeline

    public final class Timeline

extends java.lang.Object

This class defines the methods responsible for accessing the main timelines (i.e. public, home, user, mentions and DMs) provided by Twitter.

     Credential c = new Credential(...);
     UserAccountManager uam = UserAccountManager.getInstance(c);

     if (uam.verifyCredential()) {
       Timeline ter = Timeline.getInstance(uam);

       Query q = QueryComposer.count(5); //return only 5 latest tweets.

       ter.startGetHomeTweets(q, new SearchDeviceListener() {
           public void searchCompleted() {}
           public void searchFailed(Throwable cause) {}
           public void tweetFound(Tweet tweet) {
               System.out.println(tweet);
           }
       });
     }

Since:
  1.2
Version:
  1.1
Author:
  Ernandes Mourao Junior (ernandes@gmail.com)
See Also:
  `UserAccountManager`, `SearchDeviceListener`, `QueryComposer`

Field Summary
`static java.lang.String` | `TWITTER_API_URL_SERVICE_DIRECT_MESSAGES` Key for Twitter API URL service direct messages.
`static java.lang.String` | `TWITTER_API_URL_SERVICE_DIRECT_MESSAGES_SENT` Key for Twitter API URL service direct messages sent.
`static java.lang.String` | `TWITTER_API_URL_SERVICE_STATUSES_HOME_TIMELINE` Key for Twitter API URL service statuses home timeline.
`static java.lang.String` | `TWITTER_API_URL_SERVICE_STATUSES_MENTIONS` Key for Twitter API URL service statuses mentions.
`static java.lang.String` | `TWITTER_API_URL_SERVICE_STATUSES_PUBLIC_TIMELINE` Key for Twitter API URL service statuses public timeline.
`static java.lang.String` | `TWITTER_API_URL_SERVICE_STATUSES_USER_TIMELINE` Key for Twitter API URL service statuses user timeline.

Method Summary
`static Timeline` | `getInstance()` Get a single instance of Timeline class, which is NOT associated to any user account.
`static Timeline` | `getInstance(UserAccountManager uam)` Get an instance of Timeline class and associate it to a given user account.
`void` | `setServiceURL(java.lang.String serviceKey, java.lang.String url)` Set a new URL to a given Twitter API service.
`void` | `startGetDirectMessages(Query q, boolean received, SearchDeviceListener l)` Get all Direct Messages from/to the authenticating user according to given filter.
`void` | `startGetHomeTweets(Query q, SearchDeviceListener l)` Get most recent tweets, including retweets, posted by the authenticating user and the user's friends according to given filter.
`void` | `startGetMentions(Query q, SearchDeviceListener l)` Get most recent mentions (status containing @username) for the authenticating user according to given filter.
`void` | `startGetPublicTweets(SearchDeviceListener l)` Get most recent tweets from non-protected users who have set a custom user icon.
`void` | `startGetUserTweets(Query q, SearchDeviceListener l)` Get most recent tweets posted from the authenticating user and that user's friends according to given filter.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### TWITTER_API_URL_SERVICE_STATUSES_PUBLIC_TIMELINE

    public static final java.lang.String TWITTER_API_URL_SERVICE_STATUSES_PUBLIC_TIMELINE

  Key for Twitter API URL service statuses public timeline.

  See Also:
    `setServiceURL(String, String)`, `startGetPublicTweets(SearchDeviceListener)`, Constant Field Values

### TWITTER_API_URL_SERVICE_STATUSES_HOME_TIMELINE

    public static final java.lang.String TWITTER_API_URL_SERVICE_STATUSES_HOME_TIMELINE

  Key for Twitter API URL service statuses home timeline.

  See Also:
    `setServiceURL(String, String)`, `startGetHomeTweets(Query, SearchDeviceListener)`, Constant Field Values

### TWITTER_API_URL_SERVICE_STATUSES_USER_TIMELINE

    public static final java.lang.String TWITTER_API_URL_SERVICE_STATUSES_USER_TIMELINE

  Key for Twitter API URL service statuses user timeline.

  See Also:
    `setServiceURL(String, String)`, `startGetUserTweets(Query, SearchDeviceListener)`, Constant Field Values

### TWITTER_API_URL_SERVICE_STATUSES_MENTIONS

    public static final java.lang.String TWITTER_API_URL_SERVICE_STATUSES_MENTIONS

  Key for Twitter API URL service statuses mentions.

  See Also:
    `setServiceURL(String, String)`, `startGetMentions(Query, SearchDeviceListener)`, Constant Field Values

### TWITTER_API_URL_SERVICE_DIRECT_MESSAGES

    public static final java.lang.String TWITTER_API_URL_SERVICE_DIRECT_MESSAGES

  Key for Twitter API URL service direct messages.

  See Also:
    `setServiceURL(String, String)`, `startGetDirectMessages(Query, boolean, SearchDeviceListener)`, Constant Field Values

### TWITTER_API_URL_SERVICE_DIRECT_MESSAGES_SENT

    public static final java.lang.String TWITTER_API_URL_SERVICE_DIRECT_MESSAGES_SENT

  Key for Twitter API URL service direct messages sent.

  See Also:
    `setServiceURL(String, String)`, `startGetDirectMessages(Query, boolean, SearchDeviceListener)`, Constant Field Values

Method Detail

### setServiceURL

    public void setServiceURL(java.lang.String serviceKey,
                              java.lang.String url)

  Set a new URL to a given Twitter API service. This method is very useful in case Twitter API decides to change a service's URL. So there is no need to wait for a new version of this API to get it working back.

  Be careful about using this method, since it can cause unexpected results, case you enter an invalid URL.

  Parameters:
    `serviceKey` - Service key.
    `url` - New URL.
  See Also:
    `TWITTER_API_URL_SERVICE_DIRECT_MESSAGES`, `TWITTER_API_URL_SERVICE_DIRECT_MESSAGES_SENT`, `TWITTER_API_URL_SERVICE_STATUSES_HOME_TIMELINE`, `TWITTER_API_URL_SERVICE_STATUSES_MENTIONS`, `TWITTER_API_URL_SERVICE_STATUSES_PUBLIC_TIMELINE`, `TWITTER_API_URL_SERVICE_STATUSES_USER_TIMELINE`

### getInstance

    public static Timeline getInstance(UserAccountManager uam)

  Get an instance of Timeline class and associate it to a given user account.

  Parameters:
    `uam` - User account manager.
  Returns:
    Timeline instance.
  Throws:
    `java.lang.IllegalArgumentException` - If UserAccountManager is null.
    `java.lang.SecurityException` - If UserAccountManager is not verified.

### getInstance

    public static Timeline getInstance()

  Get a single instance of Timeline class, which is NOT associated to any user account.

  Returns:
    Timeline single instance.

### startGetPublicTweets

    public void startGetPublicTweets(SearchDeviceListener l)

  Get most recent tweets from non-protected users who have set a custom user icon.

  This method does not wait for the search process is completed to return. To have access to this search's result, a SearchDeviceListener object must be registered.

  Parameters:
    `l` - Listener object to be notified about the search's result.
  Throws:
    `java.lang.IllegalArgumentException` - If listener is null.

### startGetHomeTweets

    public void startGetHomeTweets(Query q,
                                   SearchDeviceListener l)

  Get most recent tweets, including retweets, posted by the authenticating user and the user's friends according to given filter. This is the equivalent to timeline home on the Web.

  This method does not wait for the search process is completed to return. To have access to this search's result, a SearchDeviceListener object must be registered.

  In order to create the query, only the following methods can be used as filters:

  - `QueryComposer.sinceID(String)`
  - `QueryComposer.maxID(String)`
  - `QueryComposer.count(int)`
  - `QueryComposer.page(int)`

  Parameters:
    `q` - The filter query. If null all tweets are returned.
    `l` - Listener object to be notified about the search's result.
  Throws:
    `java.lang.SecurityException` - If it is not authenticated.
    `java.lang.IllegalArgumentException` - If listener is null.

### startGetUserTweets

    public void startGetUserTweets(Query q,
                                   SearchDeviceListener l)

  Get most recent tweets posted from the authenticating user and that user's friends according to given filter. This is the equivalent of the Web user page for your own user.

  This method does not wait for the search process is completed to return. To have access to this search's result, a SearchDeviceListener object must be registered.

  In order to create the query, only the following methods can be used as filters:

  - `QueryComposer.sinceID(String)`
  - `QueryComposer.maxID(String)`
  - `QueryComposer.count(int)`
  - `QueryComposer.page(int)`

  Parameters:
    `q` - The filter query. If null all tweets are returned.
    `l` - Listener object to be notified about the search's result.
  Throws:
    `java.lang.SecurityException` - If it is not authenticated.
    `java.lang.IllegalArgumentException` - If listener is null.

### startGetMentions

    public void startGetMentions(Query q,
                                 SearchDeviceListener l)

  Get most recent mentions (status containing @username) for the authenticating user according to given filter.

  This method does not wait for the search process is completed to return. To have access to this search's result, a SearchDeviceListener object must be registered.

  In order to create the query, only the following methods can be used as filters:

  - `QueryComposer.sinceID(String)`
  - `QueryComposer.maxID(String)`
  - `QueryComposer.count(int)`
  - `QueryComposer.page(int)`

  Parameters:
    `q` - The filter query. If null all tweets are returned.
    `l` - Listener object to be notified about the search's result.
  Throws:
    `java.lang.SecurityException` - If it is not authenticated.
    `java.lang.IllegalArgumentException` - If listener is null.

### startGetDirectMessages

    public void startGetDirectMessages(Query q,
                                       boolean received,
                                       SearchDeviceListener l)

  Get all Direct Messages from/to the authenticating user according to given filter.

  This method does not wait for the search process is completed to return. To have access to this search's result, a SearchDeviceListener object must be registered.

  In order to create the query, only the following methods can be used as filters:

  - `QueryComposer.sinceID(String)`
  - `QueryComposer.maxID(String)`
  - `QueryComposer.count(int)`
  - `QueryComposer.page(int)`

  Parameters:
    `q` - The filter query. If null all DMs are returned.
    `l` - Listener object to be notified about the search's result.
    `received` - Return received DMs (true), otherwise, sent ones.
  Throws:
    `java.lang.SecurityException` - If it is not authenticated.
    `java.lang.IllegalArgumentException` - If listener is null.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2010 Twitter API ME Team. All Rights Reserved.