Package com.parse.twitter
Class ParseTwitterUtils
- java.lang.Object
-
- com.parse.twitter.ParseTwitterUtils
-
public final class ParseTwitterUtils extends java.lang.Object
Provides a set of utilities for using Parse with Twitter.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Twitter
getTwitter()
Gets the sharedTwitter
singleton that Parse is using.static void
initialize(java.lang.String consumerKey, java.lang.String consumerSecret)
Initializes Twitter for use with Parse.static void
initialize(java.lang.String consumerKey, java.lang.String consumerSecret, java.lang.String callbackUrl)
Initializes Twitter for use with Parse.static boolean
isLinked(ParseUser user)
static void
link(ParseUser user, Context context, SaveCallback callback)
Links a ParseUser to a Twitter account, allowing you to use Twitter for authentication, and providing access to Twitter data for the user.static void
link(ParseUser user, java.lang.String twitterId, java.lang.String screenName, java.lang.String authToken, java.lang.String authTokenSecret, SaveCallback callback)
Links a ParseUser to a Twitter account, allowing you to use Twitter for authentication, and providing access to Twitter data for the user.static <any>
linkInBackground(ParseUser user, java.lang.String twitterId, java.lang.String screenName, java.lang.String authToken, java.lang.String authTokenSecret)
Links a ParseUser to a Twitter account, allowing you to use Twitter for authentication, and providing access to Twitter data for the user.static <any>
linkInBackground(Context context, ParseUser user)
Links a ParseUser to a Twitter account, allowing you to use Twitter for authentication, and providing access to Twitter data for the user.static void
logIn(Context context, LogInCallback callback)
Logs in a ParseUser using Twitter for authentication.static void
logIn(java.lang.String twitterId, java.lang.String screenName, java.lang.String authToken, java.lang.String authTokenSecret, LogInCallback callback)
Logs in a ParseUser using Twitter for authentication.static <any>
logInInBackground(Context context)
Logs in a ParseUser using Twitter for authentication.static <any>
logInInBackground(java.lang.String twitterId, java.lang.String screenName, java.lang.String authToken, java.lang.String authTokenSecret)
Logs in a ParseUser using Twitter for authentication.static void
unlink(ParseUser user)
Unlinks a user from a Twitter account.static <any>
unlinkInBackground(ParseUser user)
Unlinks a user from a Twitter account in the background.static void
unlinkInBackground(ParseUser user, SaveCallback callback)
Unlinks a user from a Twitter account in the background.
-
-
-
Method Detail
-
getTwitter
public static Twitter getTwitter()
Gets the sharedTwitter
singleton that Parse is using.- Returns:
Twitter
instance.
-
initialize
public static void initialize(java.lang.String consumerKey, java.lang.String consumerSecret)
Initializes Twitter for use with Parse. This method must be invoked prior to calling#link(ParseUser, Context, SaveCallback)
and#logIn(Context, LogInCallback)
.- Parameters:
consumerKey
- Your Twitter consumer key.consumerSecret
- Your Twitter consumer secret.
-
initialize
public static void initialize(java.lang.String consumerKey, java.lang.String consumerSecret, java.lang.String callbackUrl)
Initializes Twitter for use with Parse. This method must be invoked prior to calling#link(ParseUser, Context, SaveCallback)
and#logIn(Context, LogInCallback)
.- Parameters:
consumerKey
- Your Twitter consumer key.consumerSecret
- Your Twitter consumer secret.callbackUrl
- the callback url
-
isLinked
public static boolean isLinked(ParseUser user)
- Returns:
true
if the user is linked to a Twitter account.
-
linkInBackground
public static <any> linkInBackground(Context context, ParseUser user)
Links a ParseUser to a Twitter account, allowing you to use Twitter for authentication, and providing access to Twitter data for the user. A dialog will be shown to the user for Twitter authentication.- Parameters:
user
- The user to link to a Twitter account.context
- An Android context from which the login dialog can be launched.- Returns:
- A Task that will be resolved when linking is completed.
-
link
public static void link(ParseUser user, Context context, SaveCallback callback)
Links a ParseUser to a Twitter account, allowing you to use Twitter for authentication, and providing access to Twitter data for the user. A dialog will be shown to the user for Twitter authentication.- Parameters:
user
- The user to link to a Twitter account.context
- An Android context from which the login dialog can be launched.callback
- Callback for notifying the calling application when the Twitter authentication has completed, failed, or been canceled.- See Also:
#linkInBackground(Context, ParseUser)
-
linkInBackground
public static <any> linkInBackground(ParseUser user, java.lang.String twitterId, java.lang.String screenName, java.lang.String authToken, java.lang.String authTokenSecret)
Links a ParseUser to a Twitter account, allowing you to use Twitter for authentication, and providing access to Twitter data for the user. This method allows you to handle getting the auth tokens for your users, rather than delegating to the provided dialog log-in.- Parameters:
user
- The user to link to a Twitter account.twitterId
- The user's Twitter ID.screenName
- The user's Twitter screen name.authToken
- The auth token for the session.authTokenSecret
- The auth token secret for the session.- Returns:
- A Task that will be resolved when linking is completed.
-
link
public static void link(ParseUser user, java.lang.String twitterId, java.lang.String screenName, java.lang.String authToken, java.lang.String authTokenSecret, SaveCallback callback)
Links a ParseUser to a Twitter account, allowing you to use Twitter for authentication, and providing access to Twitter data for the user. This method allows you to handle getting the auth tokens for your users, rather than delegating to the provided dialog log-in.- Parameters:
user
- The user to link to a Twitter account.twitterId
- The user's Twitter ID.screenName
- The user's Twitter screen name.authToken
- The auth token for the session.authTokenSecret
- The auth token secret for the session.callback
- Callback for notifying that the authentication data has been saved to the ParseUser.- See Also:
linkInBackground(ParseUser, String, String, String, String)
-
logInInBackground
public static <any> logInInBackground(java.lang.String twitterId, java.lang.String screenName, java.lang.String authToken, java.lang.String authTokenSecret)
Logs in a ParseUser using Twitter for authentication. If a user for the given Twitter credentials does not already exist, a new user will be created. This method allows you to handle getting the auth tokens for your users, rather than delegating to the provided dialog log-in.- Parameters:
twitterId
- The user's Twitter ID.screenName
- The user's Twitter screen name.authToken
- The auth token for the session.authTokenSecret
- The auth token secret for the session.- Returns:
- A Task that will be resolved when logging in is completed.
-
logIn
public static void logIn(java.lang.String twitterId, java.lang.String screenName, java.lang.String authToken, java.lang.String authTokenSecret, LogInCallback callback)
Logs in a ParseUser using Twitter for authentication. If a user for the given Twitter credentials does not already exist, a new user will be created. This method allows you to handle getting the auth tokens for your users, rather than delegating to the provided dialog log-in.- Parameters:
twitterId
- The user's Twitter ID.screenName
- The user's Twitter screen name.authToken
- The auth token for the session.authTokenSecret
- The auth token secret for the session.callback
- Callback for notifying that the authentication data has been saved to the ParseUser.- See Also:
logInInBackground(String, String, String, String)
-
logInInBackground
public static <any> logInInBackground(Context context)
Logs in a ParseUser using Twitter for authentication. If a user for the given Twitter credentials does not already exist, a new user will be created. A dialog will be shown to the user for Twitter authentication.- Parameters:
context
- An Android context from which the login dialog can be launched.- Returns:
- A Task that will be resolved when logging in is completed.
-
logIn
public static void logIn(Context context, LogInCallback callback)
Logs in a ParseUser using Twitter for authentication. If a user for the given Twitter credentials does not already exist, a new user will be created. A dialog will be shown to the user for Twitter authentication.- Parameters:
context
- An Android context from which the login dialog can be launched.callback
- Callback for notifying the calling application when the Twitter authentication has completed, failed, or been canceled.- See Also:
#logInInBackground(android.content.Context)
-
unlink
public static void unlink(ParseUser user) throws ParseException
Unlinks a user from a Twitter account. Unlinking a user will save the user's data.- Parameters:
user
- The user to unlink from a Facebook account.- Throws:
ParseException
-
unlinkInBackground
public static <any> unlinkInBackground(ParseUser user)
Unlinks a user from a Twitter account in the background. Unlinking a user will save the user's data.- Parameters:
user
- The user to unlink from a Facebook account.- Returns:
- A Task that will be resolved when unlinking is completed.
-
unlinkInBackground
public static void unlinkInBackground(ParseUser user, SaveCallback callback)
Unlinks a user from a Twitter account in the background. Unlinking a user will save the user's data.- Parameters:
user
- The user to unlink from a Facebook account.callback
- Callback for notifying when unlinking is complete.- See Also:
unlinkInBackground(ParseUser)
-
-