@Test public void searchPush() throws Exception { NCMBPushService pushService = new NCMBPushService(NCMB.getCurrentContext()); JSONObject query = new JSONObject(); query.put("where", new JSONObject("{target:[android]}")); query.put("limit", 2); List results = pushService.searchPush(query); Assert.assertEquals(2, results.size()); for (int i = 0; i < results.size(); i++) { Assert.assertEquals(new JSONArray("[android]"), ((NCMBPush) results.get(i)).getTarget()); } }
public List searchPush(JSONObject conditions) throws NCMBException { RequestParams request = createRequestParams(null, null, conditions, NCMBRequest.HTTP_METHOD_GET); NCMBResponse response = sendRequest(request); if (response.statusCode != HTTP_STATUS_PUSH_GOTTEN) { throw new NCMBException(NCMBException.NOT_EFFICIENT_VALUE, "Gotten failed."); } return createSearchResults(response.responseData); }
NCMBPushService extends NCMBService { public List searchPush(JSONObject conditions) throws NCMBException { RequestParams request = createRequestParams(null, null, conditions, NCMBRequest.HTTP_METHOD_GET); NCMBResponse response = sendRequest(request); if (response.statusCode != HTTP_STATUS_PUSH_GOTTEN) { throw new NCMBException(NCMBException.NOT_EFFICIENT_VALUE, "Gotten failed."); } return createSearchResults(response.responseData); } }
NCMBPushService extends NCMBService { public List searchPush(JSONObject conditions) throws NCMBException { RequestParams request = createRequestParams(null, null, conditions, NCMBRequest.HTTP_METHOD_GET); NCMBResponse response = sendRequest(request); if (response.statusCode != HTTP_STATUS_PUSH_GOTTEN) { throw new NCMBException(NCMBException.NOT_EFFICIENT_VALUE, "Gotten failed."); } return createSearchResults(response.responseData); } NCMBPushService(NCMBContext context); }
NCMBPushService extends NCMBService { public List searchPush(JSONObject conditions) throws NCMBException { RequestParams request = createRequestParams(null, null, conditions, NCMBRequest.HTTP_METHOD_GET); NCMBResponse response = sendRequest(request); if (response.statusCode != HTTP_STATUS_PUSH_GOTTEN) { throw new NCMBException(NCMBException.NOT_EFFICIENT_VALUE, "Gotten failed."); } return createSearchResults(response.responseData); } NCMBPushService(NCMBContext context); JSONObject sendPush(JSONObject params); void sendPushInBackground(final JSONObject params, ExecuteServiceCallback callback); JSONObject updatePush(String pushId, JSONObject params); void updatePushInBackground(final String pushId, final JSONObject params, final ExecuteServiceCallback callback); void deletePush(String pushId); void deletePushInBackground(String pushId, DoneCallback callback); NCMBPush fetchPush(String pushId); void fetchPushInBackground(final String pushId, final FetchCallback callback); List searchPush(JSONObject conditions); void searchPushInBackground(JSONObject conditions, final SearchPushCallback callback); void sendPushReceiptStatusInBackground(String pushId, ExecuteServiceCallback callback); }
NCMBPushService extends NCMBService { public List searchPush(JSONObject conditions) throws NCMBException { RequestParams request = createRequestParams(null, null, conditions, NCMBRequest.HTTP_METHOD_GET); NCMBResponse response = sendRequest(request); if (response.statusCode != HTTP_STATUS_PUSH_GOTTEN) { throw new NCMBException(NCMBException.NOT_EFFICIENT_VALUE, "Gotten failed."); } return createSearchResults(response.responseData); } NCMBPushService(NCMBContext context); JSONObject sendPush(JSONObject params); void sendPushInBackground(final JSONObject params, ExecuteServiceCallback callback); JSONObject updatePush(String pushId, JSONObject params); void updatePushInBackground(final String pushId, final JSONObject params, final ExecuteServiceCallback callback); void deletePush(String pushId); void deletePushInBackground(String pushId, DoneCallback callback); NCMBPush fetchPush(String pushId); void fetchPushInBackground(final String pushId, final FetchCallback callback); List searchPush(JSONObject conditions); void searchPushInBackground(JSONObject conditions, final SearchPushCallback callback); void sendPushReceiptStatusInBackground(String pushId, ExecuteServiceCallback callback); static final String SERVICE_PATH; static final int HTTP_STATUS_PUSH_CREATED; static final int HTTP_STATUS_PUSH_UPDATED; static final int HTTP_STATUS_PUSH_DELETED; static final int HTTP_STATUS_PUSH_GOTTEN; static final int HTTP_STATUS_PUSH_RECEIPTSTATUS; }