|
||||||||||
| 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 | ||
|---|---|---|
void |
broadcastPushNotification(Map<String,String> payload,
StackMobCallback callback)
broadcast a push notification to all users of this app. |
|
void |
delete(String path,
String id,
StackMobCallback callback)
do a delete request to the stackmob platform |
|
|
deleteIdFrom(String path,
String primaryId,
String field,
T idToDelete,
boolean cascadeDelete,
StackMobCallback callback)
atomically remove elements from an array or has many relationship |
|
|
deleteIdsFrom(String path,
String primaryId,
String field,
List<T> idsToDelete,
boolean cascadeDeletes,
StackMobCallback callback)
atomically remove elements from an array or has many relationship |
|
void |
facebookLogin(String token,
StackMobCallback callback)
login into facebook on the StackMob platform |
|
void |
facebookPostMessage(String msg,
StackMobCallback callback)
post a message to facebook. |
|
void |
get(StackMobQuery query,
StackMobCallback callback)
|
|
void |
get(StackMobQueryWithField query,
StackMobCallback callback)
|
|
void |
get(String path,
Map<String,String> arguments,
Map<String,String> headers,
StackMobCallback callback)
do a get request on the StackMob platform |
|
void |
get(String path,
Map<String,String> arguments,
StackMobCallback callback)
|
|
void |
get(String path,
StackMobCallback callback)
do a get request on the StackMob platform |
|
void |
getAndClearExpiredPushTokens(StackMobCallback callback)
get all expired push tokens for this app, and clear them after they've been returned |
|
void |
getExpiredPushTokens(StackMobCallback callback)
get expired push tokens, but do not clear them after they've been returned |
|
void |
getFacebookUserInfo(StackMobCallback callback)
get facebook user info for the current user. |
|
StackMobSession |
getSession()
get the session that this StackMob object contains |
|
void |
getTokensForUsers(List<String> usernames,
StackMobCallback callback)
get all the tokens for the each of the given users |
|
void |
linkUserWithFacebookToken(String token,
StackMobCallback callback)
link an existing StackMob user with a Facebook user |
|
void |
linkUserWithTwitterToken(String token,
String secret,
StackMobCallback callback)
link an existing stackmob user with an existing twitter user |
|
void |
login(Map<String,String> params,
StackMobCallback callback)
call the login method on StackMob |
|
void |
logout(StackMobCallback callback)
call the logout method on StackMob |
|
void |
post(String path,
Object requestObject,
StackMobCallback callback)
do a post request on the StackMob platform for a single object |
|
|
postBulk(String path,
List<T> requestObjects,
StackMobCallback callback)
do a post request on the StackMob platform with a list of objects |
|
void |
postRelated(String path,
String primaryId,
String relatedField,
Object relatedObject,
StackMobCallback callback)
post a new related object to an existing object. |
|
|
postRelatedBulk(String path,
String primaryId,
String relatedField,
List<T> relatedObjects,
StackMobCallback callback)
post a list of new related objects to an existing object. |
|
void |
pushToTokens(Map<String,String> payload,
List<StackMobPushToken> tokens,
StackMobCallback callback)
send a push notification to a group of tokens |
|
void |
pushToUsers(Map<String,String> payload,
List<String> userIds,
StackMobCallback callback)
send a push notification to a group of users. |
|
void |
put(String path,
String id,
Object requestObject,
StackMobCallback callback)
do a put request on the StackMob platform |
|
|
putRelated(String path,
String primaryId,
String relatedField,
List<T> relatedIds,
StackMobCallback callback)
do a an atomic put request on the StackMob platform with the contents of the has-many relation |
|
void |
registerForPushWithUser(String username,
String registrationID,
StackMobCallback callback)
register a user for C2DM push notifications |
|
void |
registerWithFacebookToken(String token,
String username,
StackMobCallback callback)
create a new StackMob user and link that user with a facebook account |
|
void |
registerWithTwitterToken(String token,
String secret,
String username,
StackMobCallback callback)
create a new user on stackmob and associate it with an existing twitter user |
|
void |
removePushToken(String tokenString,
StackMobPushToken.TokenType tokenType,
StackMobCallback callback)
remove a push token for this app |
|
void |
startSession(StackMobCallback callback)
call the startsession method on StackMob |
|
void |
twitterLogin(String token,
String secret,
StackMobCallback callback)
call the twitterlogin method on stackmob |
|
void |
twitterStatusUpdate(String message,
StackMobCallback 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 |
|---|
public void login(Map<String,String> params,
StackMobCallback callback)
params - parameters to pass to the login methodcallback - callback to be called when the server returns. may execute in a separate threadpublic void logout(StackMobCallback callback)
callback - callback to be called when the server returns. may execute in a separate threadpublic void startSession(StackMobCallback callback)
callback - callback to call when the method completes
public void twitterLogin(String token,
String secret,
StackMobCallback 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 twitterStatusUpdate(String message,
StackMobCallback 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,
StackMobCallback 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,
StackMobCallback 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,
StackMobCallback callback)
token - the facebook user tokencallback - callback to be called when the server returns. may execute in a separate thread
public void registerWithFacebookToken(String token,
String username,
StackMobCallback 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,
StackMobCallback 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,
StackMobCallback callback)
msg - the message to postcallback - callback to be called when the server returns. may execute in a separate threadpublic void getFacebookUserInfo(StackMobCallback callback)
callback - callback to be called when the server returns. may execute in a separate thread
public void pushToTokens(Map<String,String> payload,
List<StackMobPushToken> tokens,
StackMobCallback 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 void pushToUsers(Map<String,String> payload,
List<String> userIds,
StackMobCallback 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 void registerForPushWithUser(String username,
String registrationID,
StackMobCallback 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 void getTokensForUsers(List<String> usernames,
StackMobCallback callback)
usernames - the users whose tokens to getcallback - callback to be called when the server returns. may execute in a separate thread
public void broadcastPushNotification(Map<String,String> payload,
StackMobCallback callback)
payload - the payload to broadcastcallback - callback to be called when the server returns. may execute in a separate threadpublic void getAndClearExpiredPushTokens(StackMobCallback callback)
callback - callback to be called when the server returns. may execute in a separate threadpublic void getExpiredPushTokens(StackMobCallback callback)
callback - callback to be called when the server returns. may execute in a separate thread
public void removePushToken(String tokenString,
StackMobPushToken.TokenType tokenType,
StackMobCallback 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 void get(String path,
StackMobCallback callback)
path - the path to getcallback - callback to be called when the server returns. may execute in a separate thread
public void get(String path,
Map<String,String> arguments,
Map<String,String> headers,
StackMobCallback 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 void get(String path,
Map<String,String> arguments,
StackMobCallback callback)
public void get(StackMobQuery query,
StackMobCallback callback)
public void get(StackMobQueryWithField query,
StackMobCallback callback)
public void post(String path,
Object requestObject,
StackMobCallback 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> void postBulk(String path,
List<T> requestObjects,
StackMobCallback 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 void postRelated(String path,
String primaryId,
String relatedField,
Object relatedObject,
StackMobCallback 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> void postRelatedBulk(String path,
String primaryId,
String relatedField,
List<T> relatedObjects,
StackMobCallback 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 void put(String path,
String id,
Object requestObject,
StackMobCallback 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> void putRelated(String path,
String primaryId,
String relatedField,
List<T> relatedIds,
StackMobCallback 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 void delete(String path,
String id,
StackMobCallback 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> void deleteIdsFrom(String path,
String primaryId,
String field,
List<T> idsToDelete,
boolean cascadeDeletes,
StackMobCallback 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> void deleteIdFrom(String path,
String primaryId,
String field,
T idToDelete,
boolean cascadeDelete,
StackMobCallback 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 threadpublic StackMobSession getSession()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||