Skip to content

Commit 224d63a

Browse files
committed
Add getScheduleMsgIds API
1 parent 184df35 commit 224d63a

File tree

4 files changed

+59
-1
lines changed

4 files changed

+59
-1
lines changed

src/main/java/cn/jpush/api/JPushClient.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import cn.jpush.api.push.model.notification.Notification;
3434
import cn.jpush.api.schedule.ScheduleClient;
3535
import cn.jpush.api.schedule.ScheduleListResult;
36+
import cn.jpush.api.schedule.ScheduleMsgIdsResult;
3637
import cn.jpush.api.schedule.ScheduleResult;
3738
import cn.jpush.api.schedule.model.SchedulePayload;
3839
import cn.jpush.api.schedule.model.TriggerPayload;
@@ -1053,6 +1054,18 @@ public ScheduleResult getSchedule(String scheduleId)
10531054
throws APIConnectionException, APIRequestException {
10541055
return _scheduleClient.getSchedule(scheduleId);
10551056
}
1057+
1058+
/**
1059+
* Get the message id by the schedule id.
1060+
* @param scheduleId The schedule id.
1061+
* @return The message id list.
1062+
* @throws APIConnectionException if a remote or network exception occurs.
1063+
* @throws APIRequestException if a request exception occurs.
1064+
*/
1065+
public ScheduleMsgIdsResult getScheduleMsgIds(String scheduleId)
1066+
throws APIConnectionException, APIRequestException {
1067+
return _scheduleClient.getScheduleMsgIds(scheduleId);
1068+
}
10561069

10571070
/**
10581071
* Get the schedule list size and the first page.

src/main/java/cn/jpush/api/device/DeviceClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ public DefaultResult bindMobile(String registrationId, String mobile)
154154
// delete bind while mobile is empty.
155155
mobile = "";
156156
} else {
157-
Preconditions.checkArgument(StringUtils.isMobileNumber(mobile), "The mobile format is incorrect. " + mobile);
157+
// Preconditions.checkArgument(StringUtils.isMobileNumber(mobile), "The mobile format is incorrect. " + mobile);
158158
}
159159

160160
String url = hostName + devicesPath + "/" + registrationId;

src/main/java/cn/jpush/api/schedule/ScheduleClient.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,14 @@ public ScheduleResult getSchedule(String scheduleId) throws APIConnectionExcepti
118118
ResponseWrapper response = _httpClient.sendGet(hostName + schedulePath + "/" + scheduleId);
119119
return ScheduleResult.fromResponse(response, ScheduleResult.class);
120120
}
121+
122+
public ScheduleMsgIdsResult getScheduleMsgIds(String scheduleId) throws APIConnectionException, APIRequestException{
123+
124+
Preconditions.checkArgument(StringUtils.isNotEmpty(scheduleId), "scheduleId should not be empty");
125+
126+
ResponseWrapper response = _httpClient.sendGet(hostName + schedulePath + "/" + scheduleId + "/msg_ids");
127+
return ScheduleResult.fromResponse(response, ScheduleMsgIdsResult.class);
128+
}
121129

122130
public ScheduleResult updateSchedule(String scheduleId, SchedulePayload payload) throws APIConnectionException, APIRequestException{
123131

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package cn.jpush.api.schedule;
2+
3+
4+
5+
import java.util.List;
6+
7+
import com.google.gson.JsonObject;
8+
import com.google.gson.annotations.Expose;
9+
10+
import cn.jiguang.common.resp.BaseResult;
11+
12+
public class ScheduleMsgIdsResult extends BaseResult{
13+
14+
private static final long serialVersionUID = 995450157929893257L;
15+
16+
@Expose int count;
17+
18+
@Expose List<JsonObject> msgids;
19+
20+
public int getCount() {
21+
return count;
22+
}
23+
24+
public void setCount(int count) {
25+
this.count = count;
26+
}
27+
28+
public List<JsonObject> getMsgids() {
29+
return msgids;
30+
}
31+
32+
public void setMsgids(List<JsonObject> msgids) {
33+
this.msgids = msgids;
34+
}
35+
36+
37+
}

0 commit comments

Comments
 (0)