|
||||||||||
| 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
| Nested Class Summary | |
|---|---|
protected static class |
StackMob.RegistrationIDAndUser
|
| Field Summary | |
|---|---|
protected StackMobRedirectedCallback |
redirectedCallback
|
protected StackMobRedirectedCallback |
userRedirectedCallback
|
| Constructor Summary | |
|---|---|
StackMob(String apiKey,
String apiSecret,
String userObjectName,
Integer apiVersionNumber)
create a new StackMob object |
|
StackMob(String apiKey,
String apiSecret,
String userObjectName,
Integer apiVersionNumber,
String urlFormat,
StackMobRedirectedCallback redirectedCallback)
create a new StackMob object. |
|
StackMob(String apiKey,
String apiSecret,
String userObjectName,
Integer apiVersionNumber,
String apiUrlFormat,
String pushUrlFormat,
StackMobRedirectedCallback redirectedCallback)
|
|
StackMob(String apiKey,
String apiSecret,
String userObjectName,
String appName,
Integer apiVersionNumber)
create a new StackMob object. |
|
| Method Summary | ||
|---|---|---|
StackMobRequestSendResult |
broadcastPushNotification(Map<String,String> payload,
StackMobRawCallback callback)
broadcast a push notification to all users of this app. |
|
StackMobRequestSendResult |
delete(String path,
String id,
StackMobRawCallback callback)
do a delete request to the stackmob platform |
|
|
deleteIdFrom(String path,
String primaryId,
String field,
T idToDelete,
boolean cascadeDelete,
StackMobRawCallback callback)
atomically remove elements from an array or has many relationship |
|
|
deleteIdsFrom(String path,
String primaryId,
String field,
List<T> idsToDelete,
boolean cascadeDeletes,
StackMobRawCallback callback)
atomically remove elements from an array or has many relationship |
|
StackMobRequestSendResult |
facebookLogin(String token,
StackMobRawCallback callback)
login into facebook on the StackMob platform |
|
StackMobRequestSendResult |
facebookPostMessage(String msg,
StackMobRawCallback callback)
post a message to facebook. |
|
StackMobRequestSendResult |
forgotPassword(String username,
StackMobRawCallback callback)
send out a password reset email to a user who's forgotten their password |
|
StackMobRequestSendResult |
get(StackMobQuery query,
StackMobRawCallback callback)
do a get request on the StackMob platform |
|
StackMobRequestSendResult |
get(StackMobQueryWithField query,
StackMobRawCallback callback)
do a get request on the StackMob platform |
|
StackMobRequestSendResult |
get(String path,
Map<String,String> arguments,
List<Map.Entry<String,String>> headers,
StackMobRawCallback callback)
do a get request on the StackMob platform |
|
StackMobRequestSendResult |
get(String path,
Map<String,String> arguments,
Map<String,String> headerMap,
StackMobRawCallback callback)
do a get request on the StackMob platform |
|
StackMobRequestSendResult |
get(String path,
Map<String,String> arguments,
StackMobRawCallback callback)
do a get request on the StackMob platform |
|
StackMobRequestSendResult |
get(String path,
StackMobRawCallback callback)
do a get request on the StackMob platform |
|
StackMobRequestSendResult |
getAndClearExpiredPushTokens(StackMobRawCallback callback)
get all expired push tokens for this app, and clear them after they've been returned |
|
StackMobRequestSendResult |
getExpiredPushTokens(StackMobRawCallback callback)
get expired push tokens, but do not clear them after they've been returned |
|
StackMobRequestSendResult |
getFacebookUserInfo(StackMobRawCallback callback)
get facebook user info for the current user. |
|
StackMobSession |
getSession()
get the session that this StackMob object contains |
|
static StackMob |
getStackMob()
|
|
StackMobRequestSendResult |
getTokensForUsers(List<String> usernames,
StackMobRawCallback callback)
get all the tokens for the each of the given users |
|
StackMobRequestSendResult |
getTwitterUserInfo(StackMobRawCallback callback)
get twitter user info for the current user. |
|
protected static String |
getUserAgent(String appName)
|
|
StackMobRequestSendResult |
linkUserWithFacebookToken(String token,
StackMobRawCallback callback)
link an existing StackMob user with a Facebook user |
|
StackMobRequestSendResult |
linkUserWithTwitterToken(String token,
String secret,
StackMobRawCallback callback)
link an existing stackmob user with an existing twitter user |
|
StackMobRequestSendResult |
login(Map<String,String> params,
StackMobRawCallback callback)
call the login method on StackMob |
|
StackMobRequestSendResult |
logout(StackMobRawCallback callback)
call the logout method on StackMob |
|
StackMobRequestSendResult |
post(String path,
Object requestObject,
StackMobRawCallback callback)
do a post request on the StackMob platform for a single object |
|
|
postBulk(String path,
List<T> requestObjects,
StackMobRawCallback callback)
do a post request on the StackMob platform with a list of objects |
|
StackMobRequestSendResult |
postRelated(String path,
String primaryId,
String relatedField,
Object relatedObject,
StackMobRawCallback callback)
post a new related object to an existing object. |
|
|
postRelatedBulk(String path,
String primaryId,
String relatedField,
List<T> relatedObjects,
StackMobRawCallback callback)
post a list of new related objects to an existing object. |
|
StackMobRequestSendResult |
pushToTokens(Map<String,String> payload,
List<StackMobPushToken> tokens,
StackMobRawCallback callback)
send a push notification to a group of tokens |
|
StackMobRequestSendResult |
pushToUsers(Map<String,String> payload,
List<String> userIds,
StackMobRawCallback callback)
send a push notification to a group of users. |
|
StackMobRequestSendResult |
put(String path,
String id,
Object requestObject,
StackMobRawCallback callback)
do a put request on the StackMob platform |
|
|
putRelated(String path,
String primaryId,
String relatedField,
List<T> relatedIds,
StackMobRawCallback callback)
do a an atomic put request on the StackMob platform with the contents of the has-many relation |
|
StackMobRequestSendResult |
registerForPushWithUser(String username,
String registrationID,
StackMobRawCallback callback)
register a user for C2DM push notifications |
|
StackMobRequestSendResult |
registerWithFacebookToken(String token,
String username,
StackMobRawCallback callback)
create a new StackMob user and link that user with a facebook account |
|
StackMobRequestSendResult |
registerWithTwitterToken(String token,
String secret,
String username,
StackMobRawCallback callback)
create a new user on stackmob and associate it with an existing twitter user |
|
StackMobRequestSendResult |
removePushToken(String tokenString,
StackMobPushToken.TokenType tokenType,
StackMobRawCallback callback)
remove a push token for this app |
|
StackMobRequestSendResult |
resetPassword(String oldPassword,
String newPassword,
StackMobRawCallback callback)
reset the logged in user's password |
|
static void |
setStackMob(StackMob stackmob)
|
|
static void |
setUserAgentName(String name)
|
|
StackMobRequestSendResult |
startSession(StackMobRawCallback callback)
call the startsession method on StackMob |
|
StackMobRequestSendResult |
twitterLogin(String token,
String secret,
StackMobRawCallback callback)
call the twitterlogin method on stackmob |
|
StackMobRequestSendResult |
twitterStatusUpdate(String message,
StackMobRawCallback callback)
call the twitterStatusUpdate method on StackMob |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected StackMobRedirectedCallback userRedirectedCallback
protected StackMobRedirectedCallback redirectedCallback
| Constructor Detail |
|---|
public StackMob(String apiKey,
String apiSecret,
String userObjectName,
String appName,
Integer apiVersionNumber)
apiKey - the api key for your appapiSecret - the api secret for your appuserObjectName - 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 failappName - the name of your applicationapiVersionNumber - the version of your app's API that you want to use with this StackMob session. pass 0 for sandbox
public StackMob(String apiKey,
String apiSecret,
String userObjectName,
Integer apiVersionNumber)
apiKey - the api key for your appapiSecret - the api secret for your appuserObjectName - the name of your app's user object. if you do not have a user object, pass the empty string here and do not use the login, logout, facebook or twitter methods, as they will failapiVersionNumber - the version of your app's API that you want to use with this StackMob session. pass 0 for sandbox
public StackMob(String apiKey,
String apiSecret,
String userObjectName,
Integer apiVersionNumber,
String urlFormat,
StackMobRedirectedCallback redirectedCallback)
apiKey - the api key for your appapiSecret - the api secret for your appuserObjectName - the name of your app's user objectapiVersionNumber - the version number of your app's API that you want to use with this object. pass 0 for sandboxurlFormat - the format of URLs to use. for instance: api.mob1.stackmob.comredirectedCallback - 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 thread
public StackMob(String apiKey,
String apiSecret,
String userObjectName,
Integer apiVersionNumber,
String apiUrlFormat,
String pushUrlFormat,
StackMobRedirectedCallback redirectedCallback)
| Method Detail |
|---|
protected static String getUserAgent(String appName)
public static void setUserAgentName(String name)
public static StackMob getStackMob()
public static void setStackMob(StackMob stackmob)
public StackMobRequestSendResult 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 StackMobRequestSendResult logout(StackMobRawCallback callback)
callback - callback to be called when the server returns. may execute in a separate thread
public StackMobRequestSendResult startSession(StackMobRawCallback callback)
callback - callback to call when the method completes
public StackMobRequestSendResult twitterLogin(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 StackMobRequestSendResult 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 StackMobRequestSendResult 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 StackMobRequestSendResult 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 StackMobRequestSendResult facebookLogin(String token,
StackMobRawCallback callback)
token - the facebook user tokencallback - callback to be called when the server returns. may execute in a separate thread
public StackMobRequestSendResult 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 StackMobRequestSendResult 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 StackMobRequestSendResult 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 StackMobRequestSendResult getFacebookUserInfo(StackMobRawCallback callback)
callback - callback to be called when the server returns. may execute in a separate thread
public StackMobRequestSendResult getTwitterUserInfo(StackMobRawCallback callback)
callback - callback to be called when the server returns. may execute in a separate thread
public StackMobRequestSendResult pushToTokens(Map<String,String> payload,
List<StackMobPushToken> tokens,
StackMobRawCallback callback)
payload - the payload of the push notification to sendtokens - the tokens to which to sendcallback - callback to be called when the server returns. may execute in a separate thread
public StackMobRequestSendResult pushToUsers(Map<String,String> payload,
List<String> userIds,
StackMobRawCallback callback)
payload - the payload to senduserIds - the IDs of the users to which to sendcallback - callback to be called when the server returns. may execute in a separate thread
public StackMobRequestSendResult registerForPushWithUser(String username,
String registrationID,
StackMobRawCallback callback)
username - the StackMob username to registerregistrationID - the C2DM registration ID. see http://code.google.com/android/c2dm/#registering for detail on how to get this IDcallback - callback to be called when the server returns. may execute in a separate thread
public StackMobRequestSendResult getTokensForUsers(List<String> usernames,
StackMobRawCallback callback)
usernames - the users whose tokens to getcallback - callback to be called when the server returns. may execute in a separate thread
public StackMobRequestSendResult broadcastPushNotification(Map<String,String> payload,
StackMobRawCallback callback)
payload - the payload to broadcastcallback - callback to be called when the server returns. may execute in a separate thread
public StackMobRequestSendResult getAndClearExpiredPushTokens(StackMobRawCallback callback)
callback - callback to be called when the server returns. may execute in a separate thread
public StackMobRequestSendResult getExpiredPushTokens(StackMobRawCallback callback)
callback - callback to be called when the server returns. may execute in a separate thread
public StackMobRequestSendResult removePushToken(String tokenString,
StackMobPushToken.TokenType tokenType,
StackMobRawCallback callback)
tokenString - the token valuetokenType - the type of the tokencallback - callback to be called when the server returns. may execute in a separate thread
public StackMobRequestSendResult get(String path,
StackMobRawCallback callback)
path - the path to getcallback - callback to be called when the server returns. may execute in a separate thread
public StackMobRequestSendResult get(String path,
Map<String,String> arguments,
Map<String,String> headerMap,
StackMobRawCallback callback)
path - the path to getarguments - arguments to be encoded into the query string of the get requestheaderMap - any additional headers to sendcallback - callback to be called when the server returns. may execute in a separate thread
public StackMobRequestSendResult get(String path,
Map<String,String> arguments,
List<Map.Entry<String,String>> headers,
StackMobRawCallback callback)
path - the path to getarguments - arguments to be encoded into the query string of the get requestheaders - any additional headers to sendcallback - callback to be called when the server returns. may execute in a separate thread
public StackMobRequestSendResult get(String path,
Map<String,String> arguments,
StackMobRawCallback callback)
path - the path to getarguments - the arguments to be encoded into the query string of the get requestcallback - callback to be called when the server returns. may execute in a separate thread
public StackMobRequestSendResult get(StackMobQuery query,
StackMobRawCallback callback)
query - the query to runcallback - callback to be called when the server returns. may execute in a separate thread
public StackMobRequestSendResult get(StackMobQueryWithField query,
StackMobRawCallback callback)
query - the query to runcallback - callback to be called when the server returns. may execute in a separate thread
public StackMobRequestSendResult post(String path,
Object requestObject,
StackMobRawCallback callback)
path - the path to getrequestObject - the object to serialize and send in the POST body. this object will be serialized with Gsoncallback - callback to be called when the server returns. may execute in a separate thread
public <T> StackMobRequestSendResult postBulk(String path,
List<T> requestObjects,
StackMobRawCallback callback)
path - the path to getrequestObjects - List of objects to serialize and send in the POST body. the list will be serialized with Gsoncallback - callback to be called when the server returns. may execute in a separate thread
public StackMobRequestSendResult postRelated(String path,
String primaryId,
String relatedField,
Object relatedObject,
StackMobRawCallback callback)
path - the path to getprimaryId - id of the object with the relationrelatedField - name of the relationrelatedObject - related object to postcallback - callback to be called when the server returns. may execute in a separate thread
public <T> StackMobRequestSendResult postRelatedBulk(String path,
String primaryId,
String relatedField,
List<T> relatedObjects,
StackMobRawCallback callback)
path - the path to getprimaryId - id of the object with the relationrelatedField - name of the relationrelatedObjects - list of related objects to post. the list will be serialized with Gsoncallback - callback to be called when the server returns. may execute in a separate thread
public StackMobRequestSendResult put(String path,
String id,
Object requestObject,
StackMobRawCallback callback)
path - the path to putid - the id of the object to putrequestObject - the object to serialize and send in the PUT body. this object will be serialized with Gsoncallback - callback to be called when the server returns. may execute in a separate thread
public <T> StackMobRequestSendResult putRelated(String path,
String primaryId,
String relatedField,
List<T> relatedIds,
StackMobRawCallback callback)
path - the path to getprimaryId - id of the object with the relationrelatedField - name of the relationrelatedIds - list of ids to atomically add to the relation. The type should be the same type as the primary
key field of the related objectcallback - callback to be called when the server returns. may execute in a separate thread
public StackMobRequestSendResult delete(String path,
String id,
StackMobRawCallback callback)
path - the path to deleteid - the id of the object to putcallback - callback to be called when the server returns. may execute in a separate thread
public <T> StackMobRequestSendResult deleteIdsFrom(String path,
String primaryId,
String field,
List<T> idsToDelete,
boolean cascadeDeletes,
StackMobRawCallback callback)
path - the path to getprimaryId - id of the object with the relationfield - name of the relation or array field to delete fromidsToDelete - list of ids to atomically remove from field.
ids should be same type as the primary id of the related type (most likely String or Integer)cascadeDeletes - true if related objects specified in idsToDelete should also be deletedcallback - callback to be called when the server returns. may execute in a separate thread
public <T> StackMobRequestSendResult deleteIdFrom(String path,
String primaryId,
String field,
T idToDelete,
boolean cascadeDelete,
StackMobRawCallback callback)
path - the path to getprimaryId - id of the object with the relationfield - name of the relation or array field to delete fromidToDelete - id to atomically remove from field.
should be same type as the primary id of the related type (most likely String or Integer)cascadeDelete - true if related object specified in idToDelete should also be deletedcallback - callback to be called when the server returns. may execute in a separate thread
public StackMobRequestSendResult 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 StackMobRequestSendResult 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 thread
public StackMobSession getSession()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||