|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.twitterapime.rest.FriendshipManager
public final class FriendshipManager
This class defines the methods responsible for managing friendship (friends and followers).
Credential c = new Credential(...); UserAccountManager uam = UserAccountManager.getInstance(c); if (uam.verifyCredential()) { FriendshipManager fdr = FriendshipManager.getInstance(uam); String[] ids = fdr.getFriendsID(null); } ... FriendshipManager fdr = FriendshipManager.getInstance(); String[] ids = fdr.getFriendsID(new UserAccount("twapime"), null);
Field Summary | |
---|---|
static java.lang.String |
TWITTER_API_URL_SERVICE_BLOCKS_CREATE
Key for Twitter API URL service blocks create. |
static java.lang.String |
TWITTER_API_URL_SERVICE_BLOCKS_DESTROY
Key for Twitter API URL service blocks destroy. |
static java.lang.String |
TWITTER_API_URL_SERVICE_BLOCKS_EXISTS
Key for Twitter API URL service friendships exists. |
static java.lang.String |
TWITTER_API_URL_SERVICE_FOLLOWERS_ID
Key for Twitter API URL service followers id. |
static java.lang.String |
TWITTER_API_URL_SERVICE_FRIENDS_ID
Key for Twitter API URL service friends id. |
static java.lang.String |
TWITTER_API_URL_SERVICE_FRIENDSHIPS_CREATE
Key for Twitter API URL service friendships create. |
static java.lang.String |
TWITTER_API_URL_SERVICE_FRIENDSHIPS_DESTROY
Key for Twitter API URL service friendships destroy. |
static java.lang.String |
TWITTER_API_URL_SERVICE_FRIENDSHIPS_EXISTS
Key for Twitter API URL service friendships exists. |
Method Summary | |
---|---|
UserAccount |
block(UserAccount ua)
Allows the authenticating user to block the user specified in the given UserAccount object. |
UserAccount |
follow(UserAccount ua)
Allows the authenticating user to follow the user specified in the given UserAccount object. |
java.lang.String[] |
getFollowersID(Query query)
Get the followers ID list of verified user. |
java.lang.String[] |
getFollowersID(UserAccount user,
Query query)
Get the followers ID list of a given user. |
java.lang.String[] |
getFriendsID(Query query)
Get the friends ID list of verified user. |
java.lang.String[] |
getFriendsID(UserAccount user,
Query query)
Get the friends ID list of a given user. |
static FriendshipManager |
getInstance()
Get a single instance of FriendshipManager class, which is NOT associated to any user account. |
static FriendshipManager |
getInstance(UserAccountManager uam)
Get an instance of FriendshipManager class and associate it to a given user account. |
boolean |
isBlocking(UserAccount ua)
Verify whether the authenticating user is blocking the user specified in the given UserAccount object. |
boolean |
isFollowing(UserAccount ua)
Verify whether the authenticating user is following the user specified in the given UserAccount object. |
void |
setServiceURL(java.lang.String serviceKey,
java.lang.String url)
Set a new URL to a given Twitter API service. |
UserAccount |
unblock(UserAccount ua)
Allows the authenticating user to unblock the user specified in the given UserAccount object. |
UserAccount |
unfollow(UserAccount ua)
Allows the authenticating user to unfollow the user specified in the given UserAccount object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String TWITTER_API_URL_SERVICE_FRIENDS_ID
Key for Twitter API URL service friends id.
setServiceURL(String, String)
,
getFriendsID(Query)
,
Constant Field Valuespublic static final java.lang.String TWITTER_API_URL_SERVICE_FOLLOWERS_ID
Key for Twitter API URL service followers id.
setServiceURL(String, String)
,
getFollowersID(Query)
,
Constant Field Valuespublic static final java.lang.String TWITTER_API_URL_SERVICE_FRIENDSHIPS_CREATE
Key for Twitter API URL service friendships create.
setServiceURL(String, String)
,
follow(UserAccount)
,
Constant Field Valuespublic static final java.lang.String TWITTER_API_URL_SERVICE_FRIENDSHIPS_DESTROY
Key for Twitter API URL service friendships destroy.
setServiceURL(String, String)
,
unfollow(UserAccount)
,
Constant Field Valuespublic static final java.lang.String TWITTER_API_URL_SERVICE_FRIENDSHIPS_EXISTS
Key for Twitter API URL service friendships exists.
setServiceURL(String, String)
,
isFollowing(UserAccount)
,
Constant Field Valuespublic static final java.lang.String TWITTER_API_URL_SERVICE_BLOCKS_CREATE
Key for Twitter API URL service blocks create.
setServiceURL(String, String)
,
block(UserAccount)
,
Constant Field Valuespublic static final java.lang.String TWITTER_API_URL_SERVICE_BLOCKS_DESTROY
Key for Twitter API URL service blocks destroy.
setServiceURL(String, String)
,
unblock(UserAccount)
,
Constant Field Valuespublic static final java.lang.String TWITTER_API_URL_SERVICE_BLOCKS_EXISTS
Key for Twitter API URL service friendships exists.
setServiceURL(String, String)
,
isBlocking(UserAccount)
,
Constant Field ValuesMethod Detail |
---|
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.
serviceKey
- Service key.url
- New URL.TWITTER_API_URL_SERVICE_FRIENDS_ID
,
TWITTER_API_URL_SERVICE_FOLLOWERS_ID
,
TWITTER_API_URL_SERVICE_BLOCKS_CREATE
,
TWITTER_API_URL_SERVICE_BLOCKS_DESTROY
,
TWITTER_API_URL_SERVICE_BLOCKS_EXISTS
,
TWITTER_API_URL_SERVICE_FRIENDSHIPS_CREATE
,
TWITTER_API_URL_SERVICE_FRIENDSHIPS_DESTROY
,
TWITTER_API_URL_SERVICE_FRIENDSHIPS_EXISTS
public static FriendshipManager getInstance(UserAccountManager uam)
Get an instance of FriendshipManager class and associate it to a given user account.
uam
- User account manager.
java.lang.IllegalArgumentException
- If UserAccountManager is null.
java.lang.SecurityException
- If UserAccountManager is not verified.public static FriendshipManager getInstance()
Get a single instance of FriendshipManager class, which is NOT associated to any user account.
public java.lang.String[] getFriendsID(Query query) throws java.io.IOException, LimitExceededException
Get the friends ID list of verified user.
As the number of friends of a given user can be very large, you have to
specify a max count. Passing null
will return all of them.
But be aware it may take a little awhile and consume a lot of memory.
query
- Max count of IDs to be returned. Use
QueryComposer.count(int)
only.
java.io.IOException
- If an I/O error occurs.
LimitExceededException
- If the limit of access is exceeded.
java.lang.SecurityException
- If user account manager is not informed.UserAccountManager.getUserAccount(UserAccount)
public java.lang.String[] getFriendsID(UserAccount user, Query query) throws java.io.IOException, LimitExceededException
Get the friends ID list of a given user.
As the number of friends of a given user can be very large, you have to
specify a max count. Passing null
will return all of them.
But be aware it may take a little awhile and consume a lot of memory.
user
- User.query
- Max count of IDs to be returned. Use
QueryComposer.count(int)
only.
java.io.IOException
- If an I/O error occurs.
LimitExceededException
- If the limit of access is exceeded.
java.lang.IllegalArgumentException
- If user is not informed.
java.lang.SecurityException
- Given user is protected.UserAccountManager.getUserAccount(UserAccount)
public java.lang.String[] getFollowersID(Query query) throws java.io.IOException, LimitExceededException
Get the followers ID list of verified user.
As the number of followers of a given user can be very large, you have to
specify a max count. Passing null
will return all of them.
But be aware it may take a little awhile and consume a lot of memory.
query
- Max count of IDs to be returned. Use
QueryComposer.count(int)
only.
java.io.IOException
- If an I/O error occurs.
LimitExceededException
- If the limit of access is exceeded.
java.lang.SecurityException
- If user account manager is not informed.UserAccountManager.getUserAccount(UserAccount)
public java.lang.String[] getFollowersID(UserAccount user, Query query) throws java.io.IOException, LimitExceededException
Get the followers ID list of a given user.
As the number of followers of a given user can be very large, you have to
specify a max count. Passing null
will return all of them.
But be aware it may take a little awhile and consume a lot of memory.
user
- User.query
- Max count of IDs to be returned. Use
QueryComposer.count(int)
only.
java.io.IOException
- If an I/O error occurs.
LimitExceededException
- If the limit of access is exceeded.
java.lang.IllegalArgumentException
- If user is not informed.
java.lang.SecurityException
- Given user is protected.UserAccountManager.getUserAccount(UserAccount)
public UserAccount follow(UserAccount ua) throws java.io.IOException, LimitExceededException
Allows the authenticating user to follow the user specified in the given UserAccount object.
ua
- UserAccount object containing the user name or ID.
java.io.IOException
- If an I/O error occurs.
InvalidQueryException
- User already followed or does not exist.
java.lang.SecurityException
- If it is not authenticated.
LimitExceededException
- If limit has been hit.public UserAccount unfollow(UserAccount ua) throws java.io.IOException, LimitExceededException
Allows the authenticating user to unfollow the user specified in the given UserAccount object.
ua
- UserAccount object containing the user name or ID.
java.io.IOException
- If an I/O error occurs.
InvalidQueryException
- User already unfollowed or does not exist.
java.lang.SecurityException
- If it is not authenticated.
LimitExceededException
- If limit has been hit.public boolean isFollowing(UserAccount ua) throws java.io.IOException, LimitExceededException
Verify whether the authenticating user is following the user specified in the given UserAccount object.
ua
- UserAccount object containing the user name or ID.
java.io.IOException
- If an I/O error occurs.
LimitExceededException
- If limit has been hit.
InvalidQueryException
- If user does not exist or is protected.
java.lang.SecurityException
- If it is not authenticated.public UserAccount block(UserAccount ua) throws java.io.IOException, LimitExceededException
Allows the authenticating user to block the user specified in the given UserAccount object.
ua
- UserAccount object containing the user name or ID.
java.io.IOException
- If an I/O error occurs.
InvalidQueryException
- User does not exist.
java.lang.SecurityException
- If it is not authenticated.
LimitExceededException
- If limit has been hit.public UserAccount unblock(UserAccount ua) throws java.io.IOException, LimitExceededException
Allows the authenticating user to unblock the user specified in the given UserAccount object.
ua
- UserAccount object containing the user name or ID.
java.io.IOException
- If an I/O error occurs.
InvalidQueryException
- User does not exist.
java.lang.SecurityException
- If it is not authenticated.
LimitExceededException
- If limit has been hit.public boolean isBlocking(UserAccount ua) throws java.io.IOException, LimitExceededException
Verify whether the authenticating user is blocking the user specified in the given UserAccount object.
ua
- UserAccount object containing the user name or ID.
java.io.IOException
- If an I/O error occurs.
LimitExceededException
- If limit has been hit.
InvalidQueryException
- If user does not exist or is protected.
java.lang.SecurityException
- If it is not authenticated.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |