|
3 | 3 | import cn.jiguang.common.ClientConfig; |
4 | 4 | import cn.jiguang.common.ServiceHelper; |
5 | 5 | import cn.jiguang.common.connection.*; |
6 | | -import cn.jiguang.common.resp.APIConnectionException; |
7 | | -import cn.jiguang.common.resp.APIRequestException; |
8 | | -import cn.jiguang.common.resp.BaseResult; |
9 | | -import cn.jiguang.common.resp.ResponseWrapper; |
| 6 | +import cn.jiguang.common.resp.*; |
10 | 7 | import cn.jiguang.common.utils.Base64; |
11 | 8 | import cn.jiguang.common.utils.Preconditions; |
12 | 9 | import cn.jiguang.common.utils.StringUtils; |
@@ -272,6 +269,21 @@ public CIDResult getCidList(int count, String type) throws APIConnectionExceptio |
272 | 269 | return BaseResult.fromResponse(responseWrapper, CIDResult.class); |
273 | 270 | } |
274 | 271 |
|
| 272 | + /** |
| 273 | + * Delete a push by msgId. |
| 274 | + * @param msgId The message id |
| 275 | + * @return delete result |
| 276 | + * @throws APIConnectionException connect exception |
| 277 | + * @throws APIRequestException request exception |
| 278 | + */ |
| 279 | + public DefaultResult deletePush(String msgId) throws APIConnectionException, APIRequestException { |
| 280 | + Preconditions.checkArgument(StringUtils.isNotEmpty(msgId), "msgId should not be empty"); |
| 281 | + |
| 282 | + ResponseWrapper responseWrapper = _httpClient.sendDelete(_baseUrl + _pushPath + "/" + msgId); |
| 283 | + |
| 284 | + return DefaultResult.fromResponse(responseWrapper); |
| 285 | + } |
| 286 | + |
275 | 287 | public void setHttpClient(IHttpClient client) { |
276 | 288 | this._httpClient = client; |
277 | 289 | } |
|
0 commit comments