77import cn .jiguang .common .connection .NativeHttpClient ;
88import cn .jiguang .common .resp .APIConnectionException ;
99import cn .jiguang .common .resp .APIRequestException ;
10- import cn .jiguang .common .resp .BaseResult ;
1110import cn .jiguang .common .resp .ResponseWrapper ;
1211import cn .jiguang .common .utils .Preconditions ;
1312import cn .jpush .api .push .model .PushPayload ;
13+ import com .google .gson .Gson ;
14+ import com .google .gson .reflect .TypeToken ;
15+
16+ import java .util .Map ;
1417
1518/**
1619 * Created by caiyaoguan on 2017/7/4.
@@ -20,6 +23,7 @@ public class GroupPushClient {
2023 private IHttpClient _httpClient ;
2124 private String _baseUrl ;
2225 private String _groupPushPath ;
26+ private Gson _gson = new Gson ();
2327
2428 public GroupPushClient (String groupMasterSecret , String groupKey ) {
2529 this (groupMasterSecret , groupKey , null , ClientConfig .getInstance ());
@@ -33,12 +37,12 @@ public GroupPushClient(String groupMasterSecret, String groupKey, HttpProxy prox
3337 this ._httpClient = new NativeHttpClient (authCode , proxy , conf );
3438 }
3539
36- public PushResult sendGroupPush (PushPayload pushPayload ) throws APIConnectionException , APIRequestException {
40+ public Map < String , PushResult > sendGroupPush (PushPayload pushPayload ) throws APIConnectionException , APIRequestException {
3741 Preconditions .checkArgument (! (null == pushPayload ), "pushPayload should not be null" );
3842
3943 ResponseWrapper response = _httpClient .sendPost (_baseUrl + _groupPushPath , pushPayload .toString ());
40-
41- return BaseResult . fromResponse ( response , PushResult . class );
44+ return _gson . fromJson ( response . responseContent ,
45+ new TypeToken < Map < String , PushResult >>(){}. getType () );
4246 }
4347
4448}
0 commit comments