|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.stackmob.sdk.api.StackMob
public class StackMob
The StackMob object is your interface for accessing StackMob's many features. Its functions include:
A StackMob instance is created with authorization credentials along with some optional configuration parameters. To use different configurations in one app, simply instantiate multiple StackMob objects.
| Nested Class Summary | |
|---|---|
static class |
StackMob.OAuthVersion
The two different OAuth versions the SDK can use for authentication. |
| Field Summary | |
|---|---|
static String |
DEFAULT_API_HOST
|
static String |
DEFAULT_PASSWORD_FIELD
|
static StackMobRedirectedCallback |
DEFAULT_REDIRECTED_CALLBACK
|
static String |
DEFAULT_USER_ID
|
static String |
DEFAULT_USER_SCHEMA_NAME
|
protected StackMobRedirectedCallback |
redirectedCallback
An internal redirected callback. |
protected StackMobRedirectedCallback |
userRedirectedCallback
The redirected callback set by the user |
| Constructor Summary | |
|---|---|
StackMob(Integer apiVersionNumber,
String apiKey)
a StackMob constructor allowing you to specify the OAuth version. |
|
StackMob(StackMob.OAuthVersion oauthVersion,
Integer apiVersionNumber,
String apiKey,
String apiSecret)
a StackMob constructor allowing you to specify the OAuth version. |
|
StackMob(StackMob.OAuthVersion oauthVersion,
Integer apiVersionNumber,
String apiKey,
String apiSecret,
String apiHost,
String userSchema,
String userIdName,
String passwordFieldName,
StackMobRedirectedCallback redirectedCallback)
the most complete StackMob constructor allowing you to set values for everything |
|
StackMob(StackMob other)
Copy constructor |
|
| Method Summary | |
|---|---|
void |
facebookLogin(String token,
StackMobOptions options,
StackMobRawCallback callback)
login to StackMob with Facebook credentials. |
void |
facebookLogin(String token,
StackMobRawCallback callback)
login to StackMob with Facebook credentials. |
void |
facebookPostMessage(String msg,
StackMobRawCallback callback)
post a message to Facebook. |
void |
forgotPassword(String username,
StackMobRawCallback callback)
send out a password reset email to a user who's forgotten their password |
StackMobDatastore |
getDatastore()
|
ExecutorService |
getExecutor()
get the executor used for requests |
void |
getFacebookUserInfo(StackMobRawCallback callback)
get facebook user info for the current user. |
void |
getLoggedInUser(StackMobCallback callback)
Gets the user object for the currently logged in oauth2 user. |
void |
getLoggedInUser(StackMobOptions options,
StackMobCallback callback)
Gets the user object for the currently logged in oauth2 user. |
String |
getLoggedInUsername()
get the logged in user locally. |
StackMob.OAuthVersion |
getOAuthVersion()
get the OAuthVersion this StackMob object is configured for |
String |
getPasswordField()
the name of the password field in the user object |
StackMobRedirectedCallback |
getRedirectedCallback()
get the callback used for redirected requests |
StackMobSession |
getSession()
get the session that this StackMob object contains |
static StackMob |
getStackMob()
Get the singleton StackMob object. |
void |
getTwitterUserInfo(StackMobRawCallback callback)
get twitter user info for the current user. |
String |
getUserIdName()
the primary key for the user object |
static String |
getVersion()
The current android sdk version |
void |
gigyaLogin(String gigyaUid,
String timestamp,
String sig,
StackMobOptions options,
StackMobRawCallback callback)
login to StackMob with gigya credentials. |
boolean |
isLoggedIn()
check whether a user is currently logged in. |
boolean |
isLoggedOut()
check whether the user is logged out. |
boolean |
isUserLoggedIn(String username)
check if a specific user is logged in. |
void |
linkUserWithFacebookToken(String token,
StackMobRawCallback callback)
link an existing StackMob user with an existing Facebook user via Facebook credentials. |
void |
linkUserWithTwitterToken(String token,
String secret,
StackMobRawCallback callback)
link an existing StackMob user with an existing Twitter user via Twitter credentials. |
void |
login(Map<String,String> params,
StackMobOptions options,
StackMobRawCallback callback)
call the login method on StackMob |
void |
login(Map<String,String> params,
StackMobRawCallback callback)
call the login method on StackMob |
void |
logout(StackMobRawCallback callback)
call the logout method on StackMob, invalidating your credentials. |
void |
refreshLogin(StackMobRawCallback callback)
Refresh the current OAuth2 login. |
boolean |
refreshRequired()
check whether a refreshLogin(com.stackmob.sdk.callback.StackMobRawCallback) call is required
to continue making authenticated requests. |
void |
registerWithFacebookToken(String token,
String username,
StackMobRawCallback callback)
create a new user on StackMob and associate it with an existing Facebook user via Facebook credentials. |
void |
registerWithTwitterToken(String token,
String secret,
String username,
StackMobRawCallback callback)
create a new user on StackMob and associate it with an existing Twitter user via Twitter credentials. |
void |
resetPassword(String oldPassword,
String newPassword,
StackMobRawCallback callback)
reset the logged in user's password |
void |
setSession(StackMobSession session)
set a specific session |
static void |
setStackMob(StackMob stackmob)
Set the singleton StackMob to a particular one for convenience. |
void |
twitterLogin(String token,
String secret,
StackMobOptions options,
StackMobRawCallback callback)
login to StackMob with twitter credentials. |
void |
twitterLogin(String token,
String secret,
StackMobRawCallback callback)
login to StackMob with twitter credentials. |
void |
twitterStatusUpdate(String message,
StackMobRawCallback callback)
update the logged in users’s Twitter status. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static String DEFAULT_API_HOST
public static String DEFAULT_USER_SCHEMA_NAME
public static String DEFAULT_USER_ID
public static String DEFAULT_PASSWORD_FIELD
public static StackMobRedirectedCallback DEFAULT_REDIRECTED_CALLBACK
protected StackMobRedirectedCallback userRedirectedCallback
protected StackMobRedirectedCallback redirectedCallback
| Constructor Detail |
|---|
public StackMob(Integer apiVersionNumber,
String apiKey)
apiVersionNumber - the version of your app's API that you want to use with this StackMob session. pass 0 for sandboxapiKey - the api key for your app
public StackMob(StackMob.OAuthVersion oauthVersion,
Integer apiVersionNumber,
String apiKey,
String apiSecret)
oauthVersion - whether to use oauth1 or oauth2apiVersionNumber - the version of your app's API that you want to use with this StackMob session. pass 0 for sandboxapiKey - the api key for your appapiSecret - the api secret for your app
public StackMob(StackMob.OAuthVersion oauthVersion,
Integer apiVersionNumber,
String apiKey,
String apiSecret,
String apiHost,
String userSchema,
String userIdName,
String passwordFieldName,
StackMobRedirectedCallback redirectedCallback)
oauthVersion - whether to use oauth1 or oauth2apiVersionNumber - the version of your app's API that you want to use with this StackMob session. pass 0 for sandboxapiKey - the api key for your appapiSecret - the api secret for your app. Can be null if you're using OAuth2apiHost - the base of the url for api requestsuserSchema - the name of your app's user object. if you do not have a user object, pass the empty strinrg here and do not use the login, logout, facebook or twitter methods, as they will failuserIdName - the name of your app's user object primary keypasswordFieldName - the name of your app's user object primary keyredirectedCallback - callback to be called if the StackMob platform issues a redirect. you should use this callback to cache the new URLs. here is a sample callback:
new StackMobRedirectedCallback() {
public void redirected(HttpRequest origRequest, HttpResponse response, HttpRequest newRequest) {
try {
URI uri = new URI(newRequest.getRequestLine().getUri());
cache(uri.getHost);
}
catch (URISyntaxException e) {
handleException(e);
}
}
}
}
note that this callback may be called in a background threadpublic StackMob(StackMob other)
other - the StackMob to copy| Method Detail |
|---|
public static String getVersion()
public static StackMob getStackMob()
public static void setStackMob(StackMob stackmob)
stackmob - the new singletonpublic StackMobDatastore getDatastore()
public void login(Map<String,String> params,
StackMobRawCallback callback)
params - parameters to pass to the login methodcallback - callback to be called when the server returns. may execute in a separate thread
public void login(Map<String,String> params,
StackMobOptions options,
StackMobRawCallback callback)
params - parameters to pass to the login methodoptions - additional options, such as headers, to modify the requestcallback - callback to be called when the server returns. may execute in a separate threadpublic void refreshLogin(StackMobRawCallback callback)
callback - callback to be called when the server returns. may execute in a separate threadpublic void logout(StackMobRawCallback callback)
callback - callback to be called when the server returns. may execute in a separate thread
public void twitterLogin(String token,
String secret,
StackMobRawCallback callback)
registerWithTwitterToken(String, String, String, com.stackmob.sdk.callback.StackMobRawCallback) or
linkUserWithTwitterToken(String, String, com.stackmob.sdk.callback.StackMobRawCallback)
token - the twitter session key (this is a per user key - different from the consumer key)secret - the twitter session secret (this is a per user secret - different from the consumer secret)callback - callback to be called when the server returns. may execute in a separate thread
public void twitterLogin(String token,
String secret,
StackMobOptions options,
StackMobRawCallback callback)
registerWithTwitterToken(String, String, String, com.stackmob.sdk.callback.StackMobRawCallback) or
linkUserWithTwitterToken(String, String, com.stackmob.sdk.callback.StackMobRawCallback)
token - the twitter session key (this is a per user key - different from the consumer key)secret - the twitter session secret (this is a per user secret - different from the consumer secret)options - additional options, such as headers, to modify the requestcallback - callback to be called when the server returns. may execute in a separate thread
public void twitterStatusUpdate(String message,
StackMobRawCallback callback)
message - the message to send. must be <= 140 characterscallback - callback to be called when the server returns. may execute in a separate thread
public void registerWithTwitterToken(String token,
String secret,
String username,
StackMobRawCallback callback)
token - the twitter session key (this is a per user key - different from the consumer key)secret - the twitter session secret (this is a per user secret - different from the consumer secret)username - the username that the user should havecallback - callback to be called when the server returns. may execute in a separate thread
public void linkUserWithTwitterToken(String token,
String secret,
StackMobRawCallback callback)
token - the twitter session key (this is a per user key - different from the consumer key)secret - the twitter session secret (this is a per user secret - different from the consumer secret)callback - callback to be called when the server returns. may execute in a separate thread
public void facebookLogin(String token,
StackMobRawCallback callback)
registerWithFacebookToken(String, String, com.stackmob.sdk.callback.StackMobRawCallback) or
linkUserWithFacebookToken(String, com.stackmob.sdk.callback.StackMobRawCallback)
token - the facebook user tokencallback - callback to be called when the server returns. may execute in a separate thread
public void facebookLogin(String token,
StackMobOptions options,
StackMobRawCallback callback)
registerWithFacebookToken(String, String, com.stackmob.sdk.callback.StackMobRawCallback) or
linkUserWithFacebookToken(String, com.stackmob.sdk.callback.StackMobRawCallback)
token - the facebook user tokenoptions - additional options, such as headers, to modify the requestcallback - callback to be called when the server returns. may execute in a separate thread
public void registerWithFacebookToken(String token,
String username,
StackMobRawCallback callback)
token - the facebook user tokenusername - the StackMob username that the new user should havecallback - callback to be called when the server returns. may execute in a separate thread
public void linkUserWithFacebookToken(String token,
StackMobRawCallback callback)
token - the Facebook user tokencallback - callback to be called when the server returns. may execute in a separate thread
public void facebookPostMessage(String msg,
StackMobRawCallback callback)
msg - the message to postcallback - callback to be called when the server returns. may execute in a separate thread
public void gigyaLogin(String gigyaUid,
String timestamp,
String sig,
StackMobOptions options,
StackMobRawCallback callback)
gigyaUid - The parameter UIDtimestamp - The parameter signatureTimestampsig - The parameter UIDSignatureoptions - additional options, such as headers, to modify the requestcallback - callback to be called when the server returns. may execute in a separate threadpublic void getFacebookUserInfo(StackMobRawCallback callback)
callback - callback to be called when the server returns. may execute in a separate threadpublic void getTwitterUserInfo(StackMobRawCallback callback)
callback - callback to be called when the server returns. may execute in a separate thread
public void forgotPassword(String username,
StackMobRawCallback callback)
username - the user who's forgotten their passwordcallback - callback to be called when the server returns. may execute in a separate thread
public void resetPassword(String oldPassword,
String newPassword,
StackMobRawCallback callback)
oldPassword - the old temporary passwordnewPassword - the new password that the user just createdcallback - callback to be called when the server returns. may execute in a separate threadpublic void getLoggedInUser(StackMobCallback callback)
callback - callback to be called when the server returns. may execute in a separate thread
public void getLoggedInUser(StackMobOptions options,
StackMobCallback callback)
options - additional options, such as headers, to modify the requestcallback - callback to be called when the server returns. may execute in a separate threadpublic String getLoggedInUsername()
getLoggedInUser(com.stackmob.sdk.callback.StackMobCallback) should be
use instead
public boolean isLoggedIn()
public boolean refreshRequired()
refreshLogin(com.stackmob.sdk.callback.StackMobRawCallback) call is required
to continue making authenticated requests. This will happen automatically, so there's no reason to
check this method unless you're overriding the existing refresh token system. If there are no credentials
at all this will be false.
public boolean isUserLoggedIn(String username)
getLoggedInUser(com.stackmob.sdk.callback.StackMobCallback) instead
username - the user to check
public boolean isLoggedOut()
public StackMobSession getSession()
public void setSession(StackMobSession session)
session - the session to setpublic ExecutorService getExecutor()
public StackMobRedirectedCallback getRedirectedCallback()
public StackMob.OAuthVersion getOAuthVersion()
public String getUserIdName()
public String getPasswordField()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||