|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.twitterapime.rest.UserAccountManager
public final class UserAccountManager
This class is responsible for managing the user account.
Credential c = new Credential(...); UserAccountManager uam = UserAccountManager.getInstance(c) if (uam.verifyCredential()) { System.out.println("User logged in..."); } uam.signOut();
Field Summary | |
---|---|
static java.lang.String |
TWITTER_API_URL_SERVICE_ACCOUNT_RATE_LIMIT_STATUS
Key for Twitter API URL service account rate limit status. |
static java.lang.String |
TWITTER_API_URL_SERVICE_ACCOUNT_UPDATE_PROFILE
Key for Twitter API URL service account update profile. |
static java.lang.String |
TWITTER_API_URL_SERVICE_ACCOUNT_VERIFY_CREDENTIALS
Key for Twitter API URL service account verify credentials. |
static java.lang.String |
TWITTER_API_URL_SERVICE_OAUTH_ACCESS_TOKEN
Key for Twitter API URL service OAuth access token. |
static java.lang.String |
TWITTER_API_URL_SERVICE_USERS_SHOW
Key for Twitter API URL service users show. |
Method Summary | |
---|---|
UserAccount |
block(UserAccount ua)
FriendshipManager.block(UserAccount) |
boolean |
equals(java.lang.Object o)
|
UserAccount |
follow(UserAccount ua)
FriendshipManager.follow(UserAccount) |
java.lang.String[] |
getFollowersID(Query query)
FriendshipManager.getFollowersID(Query) |
java.lang.String[] |
getFriendsID(Query query)
FriendshipManager.getFriendsID(Query) |
static UserAccountManager |
getInstance(Credential c)
Get an instance of UserAccountManager class and associate it to a given user credential. |
RateLimitStatus |
getRateLimitStatus()
Returns a set of info about the number of API requests available to the requesting user before the REST API limit is reached for the current hour. |
UserAccount |
getUserAccount()
Get the logged user's account. |
UserAccount |
getUserAccount(UserAccount user)
Get the account of a given user. |
int |
hashCode()
|
boolean |
isBlocking(UserAccount ua)
FriendshipManager.isBlocking(UserAccount) |
boolean |
isFollowing(UserAccount ua)
FriendshipManager.isFollowing(UserAccount) |
boolean |
isVerified()
Return whether it is properly verified. |
void |
setServiceURL(java.lang.String serviceKey,
java.lang.String url)
Set a new URL to a given Twitter API service. |
void |
signOut()
Ends the session of the authenticating user. |
UserAccount |
unblock(UserAccount ua)
FriendshipManager.unblock(UserAccount) |
UserAccount |
unfollow(UserAccount ua)
FriendshipManager.unfollow(UserAccount) |
UserAccount |
updateProfile(UserAccount newUserInfo)
Update account information of authenticated user. |
boolean |
verifyCredential()
Verify whether the given user's credential are valid. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String TWITTER_API_URL_SERVICE_ACCOUNT_VERIFY_CREDENTIALS
Key for Twitter API URL service account verify credentials.
setServiceURL(String, String)
,
verifyCredential()
,
Constant Field Valuespublic static final java.lang.String TWITTER_API_URL_SERVICE_OAUTH_ACCESS_TOKEN
Key for Twitter API URL service OAuth access token.
setServiceURL(String, String)
,
verifyCredential()
,
Constant Field Valuespublic static final java.lang.String TWITTER_API_URL_SERVICE_ACCOUNT_RATE_LIMIT_STATUS
Key for Twitter API URL service account rate limit status.
setServiceURL(String, String)
,
getRateLimitStatus()
,
Constant Field Valuespublic static final java.lang.String TWITTER_API_URL_SERVICE_USERS_SHOW
Key for Twitter API URL service users show.
setServiceURL(String, String)
,
getUserAccount()
,
Constant Field Valuespublic static final java.lang.String TWITTER_API_URL_SERVICE_ACCOUNT_UPDATE_PROFILE
Key for Twitter API URL service account update profile.
setServiceURL(String, String)
,
getUserAccount()
,
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_ACCOUNT_RATE_LIMIT_STATUS
,
TWITTER_API_URL_SERVICE_ACCOUNT_VERIFY_CREDENTIALS
,
TWITTER_API_URL_SERVICE_OAUTH_ACCESS_TOKEN
,
TWITTER_API_URL_SERVICE_USERS_SHOW
public static UserAccountManager getInstance(Credential c)
Get an instance of UserAccountManager class and associate it to a given user credential.
c
- Credentials.
java.lang.IllegalArgumentException
- If credential is null.public RateLimitStatus getRateLimitStatus() throws java.io.IOException, LimitExceededException
Returns a set of info about the number of API requests available to the requesting user before the REST API limit is reached for the current hour.
Stay aware of these limits, since it can impact the usage of some methods of this API.
java.io.IOException
- If an I/O error occurs.
java.lang.SecurityException
- If it is not properly logged in.
LimitExceededException
- If limit has been hit.public boolean isVerified()
Return whether it is properly verified.
public boolean verifyCredential() throws java.io.IOException, LimitExceededException
Verify whether the given user's credential are valid. This method authenticates the API to Twitter REST API.
java.io.IOException
- If an I/O error occurs.
LimitExceededException
- If limit has been hit.public void signOut() throws java.io.IOException, LimitExceededException
Ends the session of the authenticating user.
Once signed out, this instance is no longer valid for use as well as another one dependent of it. Dump them!
java.io.IOException
- If an I/O error occurs.
java.lang.SecurityException
- If it is not properly logged in.
LimitExceededException
- If limit has been hit.public UserAccount getUserAccount() throws java.io.IOException, LimitExceededException
Get the logged user's account.
java.lang.SecurityException
- If it is not properly logged in.
java.io.IOException
- If an I/O error occurs.
LimitExceededException
- If limit has been hit.public UserAccount getUserAccount(UserAccount user) throws java.io.IOException, LimitExceededException
Get the account of a given user.
user
- User.
java.lang.SecurityException
- If it is not properly logged in.
java.io.IOException
- If an I/O error occurs.
LimitExceededException
- If limit has been hit.
java.lang.IllegalArgumentException
- If user/id/username is null/empty.public UserAccount follow(UserAccount ua) throws java.io.IOException, LimitExceededException
FriendshipManager.follow(UserAccount)
java.io.IOException
LimitExceededException
public UserAccount unfollow(UserAccount ua) throws java.io.IOException, LimitExceededException
FriendshipManager.unfollow(UserAccount)
java.io.IOException
LimitExceededException
public boolean isFollowing(UserAccount ua) throws java.io.IOException, LimitExceededException
FriendshipManager.isFollowing(UserAccount)
java.io.IOException
LimitExceededException
public UserAccount block(UserAccount ua) throws java.io.IOException, LimitExceededException
FriendshipManager.block(UserAccount)
java.io.IOException
LimitExceededException
public UserAccount unblock(UserAccount ua) throws java.io.IOException, LimitExceededException
FriendshipManager.unblock(UserAccount)
java.io.IOException
LimitExceededException
public boolean isBlocking(UserAccount ua) throws java.io.IOException, LimitExceededException
FriendshipManager.isBlocking(UserAccount)
java.io.IOException
LimitExceededException
public java.lang.String[] getFriendsID(Query query) throws java.io.IOException, LimitExceededException
FriendshipManager.getFriendsID(Query)
java.io.IOException
LimitExceededException
public java.lang.String[] getFollowersID(Query query) throws java.io.IOException, LimitExceededException
FriendshipManager.getFollowersID(Query)
java.io.IOException
LimitExceededException
public UserAccount updateProfile(UserAccount newUserInfo) throws java.io.IOException, LimitExceededException
Update account information of authenticated user. Only name, description, URL and location can be changed.
newUserInfo
-
java.io.IOException
- If an I/O error occurs.
LimitExceededException
- If limit has been hit.
java.lang.SecurityException
- If it is not authenticated.
java.lang.IllegalArgumentException
- If user info is null/empty.MetadataSet.USERACCOUNT_USER_NAME
,
MetadataSet.USERACCOUNT_DESCRIPTION
,
MetadataSet.USERACCOUNT_URL
,
MetadataSet.USERACCOUNT_LOCATION
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
Object.equals(java.lang.Object)
public int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |