11package cn .jpush .api ;
22
33import java .util .Map ;
4+ import java .util .Set ;
45
56import cn .jpush .api .common .TimeUnit ;
67import cn .jpush .api .common .connection .HttpProxy ;
78import cn .jpush .api .common .resp .APIConnectionException ;
89import cn .jpush .api .common .resp .APIRequestException ;
10+ import cn .jpush .api .common .resp .BooleanResult ;
11+ import cn .jpush .api .common .resp .DefaultResult ;
12+ import cn .jpush .api .device .AliasDeviceListResult ;
13+ import cn .jpush .api .device .DeviceClient ;
14+ import cn .jpush .api .device .TagAliasResult ;
15+ import cn .jpush .api .device .TagListResult ;
916import cn .jpush .api .push .PushClient ;
1017import cn .jpush .api .push .PushResult ;
1118import cn .jpush .api .push .model .Message ;
2431public class JPushClient {
2532 private final PushClient _pushClient ;
2633 private final ReportClient _reportClient ;
34+ private final DeviceClient _deviceClient ;
2735
2836 /**
2937 * Create a JPush Client.
@@ -34,16 +42,19 @@ public class JPushClient {
3442 public JPushClient (String masterSecret , String appKey ) {
3543 _pushClient = new PushClient (masterSecret , appKey );
3644 _reportClient = new ReportClient (masterSecret , appKey );
45+ _deviceClient = new DeviceClient (masterSecret , appKey );
3746 }
3847
3948 public JPushClient (String masterSecret , String appKey , int maxRetryTimes ) {
4049 _pushClient = new PushClient (masterSecret , appKey , maxRetryTimes );
41- _reportClient = new ReportClient (masterSecret , appKey , maxRetryTimes );
50+ _reportClient = new ReportClient (masterSecret , appKey , maxRetryTimes );
51+ _deviceClient = new DeviceClient (masterSecret , appKey , maxRetryTimes );
4252 }
4353
4454 public JPushClient (String masterSecret , String appKey , int maxRetryTimes , HttpProxy proxy ) {
4555 _pushClient = new PushClient (masterSecret , appKey , maxRetryTimes , proxy );
46- _reportClient = new ReportClient (masterSecret , appKey , maxRetryTimes , proxy );
56+ _reportClient = new ReportClient (masterSecret , appKey , maxRetryTimes , proxy );
57+ _deviceClient = new DeviceClient (masterSecret , appKey , maxRetryTimes , proxy );
4758 }
4859
4960 /**
@@ -59,6 +70,7 @@ public JPushClient(String masterSecret, String appKey, int maxRetryTimes, HttpPr
5970 public JPushClient (String masterSecret , String appKey , boolean apnsProduction , long timeToLive ) {
6071 _pushClient = new PushClient (masterSecret , appKey , apnsProduction , timeToLive );
6172 _reportClient = new ReportClient (masterSecret , appKey );
73+ _deviceClient = new DeviceClient (masterSecret , appKey );
6274 }
6375
6476
@@ -291,7 +303,51 @@ public PushResult sendMessageWithRegistrationID(String title, String msgContent,
291303
292304
293305
306+ // ----------------------- Device
294307
308+ public TagAliasResult getDeviceTagAlias (String registrationId )
309+ throws APIConnectionException , APIRequestException {
310+ return _deviceClient .getDeviceTagAlias (registrationId );
311+ }
295312
313+ public DefaultResult updateDeviceTagAlias (String registrationId , String alias , boolean clearTag ,
314+ Set <String > tagsToAdd , Set <String > tagsToRemove )
315+ throws APIConnectionException , APIRequestException {
316+ return _deviceClient .updateDeviceTagAlias (registrationId , alias , clearTag , tagsToAdd , tagsToRemove );
317+ }
318+
319+ public TagListResult getTagList (String platform )
320+ throws APIConnectionException , APIRequestException {
321+ return _deviceClient .getTagList (platform );
322+ }
323+
324+ public BooleanResult isDeviceInTag (String theTag , String registrationID )
325+ throws APIConnectionException , APIRequestException {
326+ return _deviceClient .isDeviceInTag (theTag , registrationID );
327+ }
328+
329+ public DefaultResult addRemoveDevicesFromTag (String theTag ,
330+ Set <String > toAddUsers , Set <String > toRemoveUsers )
331+ throws APIConnectionException , APIRequestException {
332+ return _deviceClient .addRemoveDevicesFromTag (theTag , toAddUsers ,
333+ toRemoveUsers );
334+ }
335+
336+ public DefaultResult deleteTag (String theTag , String platform )
337+ throws APIConnectionException , APIRequestException {
338+ return _deviceClient .deleteTag (theTag , platform );
339+ }
340+
341+ public AliasDeviceListResult getAliasDeviceList (String alias ,
342+ String platform ) throws APIConnectionException , APIRequestException {
343+ return _deviceClient .getAliasDeviceList (alias , platform );
344+ }
345+
346+ public DefaultResult deleteAlias (String alias , String platform )
347+ throws APIConnectionException , APIRequestException {
348+ return _deviceClient .deleteAlias (alias , platform );
349+ }
350+
351+
296352}
297353
0 commit comments