コード例 #1
0
 /**
  * do a DELETE request to the StackMob platform, with query parameters.
  *
  * <p>warning! this has the ability to delete a substantial amount of data in one request. use
  * with care!
  *
  * @param query the query on which to match elements to be deleted
  * @param callback callback to be called when the server returns. may execute in a separate thread
  */
 public void delete(StackMobQuery query, StackMobRawCallback callback) {
   new StackMobRequestWithoutPayload(
           this.executor,
           this.session,
           HttpVerbWithoutPayload.DELETE,
           StackMobOptions.none(),
           query.getArguments(),
           query.getObjectName(),
           callback,
           this.redirectedCallback)
       .setUrlFormat(this.host)
       .sendRequest();
 }
コード例 #2
0
 /**
  * do a get request on the StackMob platform
  *
  * @param path the path to get
  * @param callback callback to be called when the server returns. may execute in a separate thread
  */
 public void get(String path, StackMobRawCallback callback) {
   new StackMobRequestWithoutPayload(
           this.executor,
           this.session,
           HttpVerbWithoutPayload.GET,
           StackMobOptions.none(),
           StackMobRequest.EmptyParams,
           path,
           callback,
           this.redirectedCallback)
       .setUrlFormat(this.host)
       .sendRequest();
 }
コード例 #3
0
 /**
  * do a put request on the StackMob platform
  *
  * @param path the path to put
  * @param id the id of the object to put
  * @param body the json body
  * @param callback callback to be called when the server returns. may execute in a separate thread
  */
 public void put(String path, String id, String body, StackMobRawCallback callback) {
   new StackMobRequestWithPayload(
           this.executor,
           this.session,
           HttpVerbWithPayload.PUT,
           StackMobOptions.none(),
           StackMobRequest.EmptyParams,
           body,
           path + "/" + id,
           callback,
           this.redirectedCallback)
       .setUrlFormat(this.host)
       .sendRequest();
 }
コード例 #4
0
 /**
  * do a post request on the StackMob platform with a list of objects
  *
  * @param path the path to get
  * @param requestObjects List of objects to serialize and send in the POST body. the list will be
  *     serialized with Gson
  * @param callback callback to be called when the server returns. may execute in a separate thread
  */
 public <T> void postBulk(String path, List<T> requestObjects, StackMobRawCallback callback) {
   new StackMobRequestWithPayload(
           this.executor,
           this.session,
           HttpVerbWithPayload.POST,
           StackMobOptions.none(),
           StackMobRequest.EmptyParams,
           requestObjects,
           path,
           callback,
           this.redirectedCallback)
       .setUrlFormat(this.host)
       .sendRequest();
 }
コード例 #5
0
 /**
  * do a an atomic put request on the StackMob platform with the contents of the has-many relation
  *
  * @param path the path to get
  * @param primaryId id of the object with the relation
  * @param relatedField name of the relation
  * @param relatedIds list of ids to atomically add to the relation. The type should be the same
  *     type as the primary key field of the related object
  * @param callback 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,
     StackMobRawCallback callback) {
   new StackMobRequestWithPayload(
           this.executor,
           this.session,
           HttpVerbWithPayload.PUT,
           StackMobOptions.none(),
           StackMobRequest.EmptyParams,
           relatedIds,
           String.format("%s/%s/%s", path, primaryId, relatedField),
           callback,
           this.redirectedCallback)
       .setUrlFormat(this.host)
       .sendRequest();
 }