-
Notifications
You must be signed in to change notification settings - Fork 419
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #85 from jpush/dev
Add new APIs, prepare release v3.3.0
- Loading branch information
Showing
14 changed files
with
374 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package cn.jpush.api.push; | ||
|
||
import cn.jiguang.common.resp.BaseResult; | ||
import com.google.gson.annotations.Expose; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class CIDResult extends BaseResult { | ||
|
||
@Expose public List<String> cidlist = new ArrayList<String>(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package cn.jpush.api.push; | ||
|
||
import cn.jiguang.common.ClientConfig; | ||
import cn.jiguang.common.ServiceHelper; | ||
import cn.jiguang.common.connection.HttpProxy; | ||
import cn.jiguang.common.connection.IHttpClient; | ||
import cn.jiguang.common.connection.NativeHttpClient; | ||
import cn.jiguang.common.resp.APIConnectionException; | ||
import cn.jiguang.common.resp.APIRequestException; | ||
import cn.jiguang.common.resp.BaseResult; | ||
import cn.jiguang.common.resp.ResponseWrapper; | ||
import cn.jiguang.common.utils.Preconditions; | ||
import cn.jpush.api.push.model.PushPayload; | ||
|
||
/** | ||
* Created by caiyaoguan on 2017/7/4. | ||
*/ | ||
public class GroupPushClient { | ||
|
||
private IHttpClient _httpClient; | ||
private String _baseUrl; | ||
private String _groupPushPath; | ||
|
||
public GroupPushClient(String groupMasterSecret, String groupKey) { | ||
this(groupMasterSecret, groupKey, null, ClientConfig.getInstance()); | ||
} | ||
|
||
public GroupPushClient(String groupMasterSecret, String groupKey, HttpProxy proxy, ClientConfig conf) { | ||
ServiceHelper.checkBasic(groupKey, groupMasterSecret); | ||
this._baseUrl = (String) conf.get(ClientConfig.PUSH_HOST_NAME); | ||
this._groupPushPath = (String) conf.get(ClientConfig.GROUP_PUSH_PATH); | ||
String authCode = ServiceHelper.getBasicAuthorization("group-" + groupKey, groupMasterSecret); | ||
this._httpClient = new NativeHttpClient(authCode, proxy, conf); | ||
} | ||
|
||
public PushResult sendGroupPush(PushPayload pushPayload) throws APIConnectionException, APIRequestException { | ||
Preconditions.checkArgument(! (null == pushPayload), "pushPayload should not be null"); | ||
|
||
ResponseWrapper response = _httpClient.sendPost(_baseUrl + _groupPushPath, pushPayload.toString()); | ||
|
||
return BaseResult.fromResponse(response, PushResult.class); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.