public class JMessageClient extends Object
| 构造器和说明 |
|---|
JMessageClient(String appkey,
String masterSecret)
Create a JMessage Client.
|
JMessageClient(String appkey,
String masterSecret,
cn.jpush.api.common.connection.HttpProxy proxy)
Create a JMessage Client with a proxy.
|
JMessageClient(String appkey,
String masterSecret,
cn.jpush.api.common.connection.HttpProxy proxy,
JMessageConfig config)
Create a JMessage Client by custom Client configuration.
|
JMessageClient(String appkey,
String masterSecret,
int maxRetryTimes)
Create a JMessage Client with custom maxRetryTimes.
|
JMessageClient(String appkey,
String masterSecret,
String hostname)
Create a JMessage Client with a custom hostname.
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addOrRemoveMembers(long gid,
String[] addList,
String[] removeList)
Add or remove members from a group
|
CreateGroupResult |
createGroup(String owner,
String gname,
String desc,
String... userlist) |
void |
deleteGroup(long gid) |
void |
deleteUser(String username) |
UserListResult |
getAdminListByAppkey(int start,
int count)
Get admins by appkey
|
GroupInfoResult |
getGroupInfo(long gid) |
GroupListResult |
getGroupListByAppkey(int start,
int count) |
UserGroupsResult |
getGroupListByUser(String username)
Get all groups of a user
|
MemberListResult |
getGroupMembers(long gid) |
UserInfoResult |
getUserInfo(String username) |
UserListResult |
getUserList(int start,
int count)
Get user list
|
String |
registerAdmins(String username,
String password) |
String |
registerUsers(RegisterInfo[] users) |
SendMessageResult |
sendGroupTextByAdmin(String targetId,
String fromId,
MessageBody body)
Send group text message by admin
|
SendMessageResult |
sendMessage(Integer version,
String targetType,
String targetId,
String fromType,
String fromId,
String messageType,
MessageBody messageBody)
Send message
|
SendMessageResult |
sendSingleTextByAdmin(String targetId,
String fromId,
MessageBody body)
Send single text message by admin
|
void |
updateGroupInfo(long gid,
String groupName,
String groupDesc) |
void |
updateUserInfo(String username,
String nickname,
String birthday,
String signature,
int gender,
String region,
String address) |
void |
updateUserPassword(String username,
String password) |
public JMessageClient(String appkey, String masterSecret)
appkey - The KEY of one application on JPush.masterSecret - API access secret of the appKey.public JMessageClient(String appkey, String masterSecret, int maxRetryTimes)
appkey - The KEY of one application on JPush.masterSecret - API access secret of the appKey.maxRetryTimes - The max retry times.public JMessageClient(String appkey, String masterSecret, cn.jpush.api.common.connection.HttpProxy proxy)
appkey - The KEY of one application on JPush.masterSecret - API access secret of the appKey.proxy - The proxy, if there is no proxy, should be null.public JMessageClient(String appkey, String masterSecret, String hostname)
appkey - The KEY of one application on JPush.masterSecret - API access secret of the appKey.hostname - The custom hostname.public JMessageClient(String appkey, String masterSecret, cn.jpush.api.common.connection.HttpProxy proxy, JMessageConfig config)
appkey - The KEY of one application on JPush.masterSecret - API access secret of the appKey.proxy - The proxy, if there is no proxy, should be null.config - The client configuration. Can use JMessageConfig.getInstance() as default.public String registerUsers(RegisterInfo[] users) throws cn.jpush.api.common.resp.APIConnectionException, cn.jpush.api.common.resp.APIRequestException
cn.jpush.api.common.resp.APIConnectionExceptioncn.jpush.api.common.resp.APIRequestExceptionpublic String registerAdmins(String username, String password) throws cn.jpush.api.common.resp.APIConnectionException, cn.jpush.api.common.resp.APIRequestException
cn.jpush.api.common.resp.APIConnectionExceptioncn.jpush.api.common.resp.APIRequestExceptionpublic UserInfoResult getUserInfo(String username) throws cn.jpush.api.common.resp.APIConnectionException, cn.jpush.api.common.resp.APIRequestException
cn.jpush.api.common.resp.APIConnectionExceptioncn.jpush.api.common.resp.APIRequestExceptionpublic void updateUserPassword(String username, String password) throws cn.jpush.api.common.resp.APIConnectionException, cn.jpush.api.common.resp.APIRequestException
cn.jpush.api.common.resp.APIConnectionExceptioncn.jpush.api.common.resp.APIRequestExceptionpublic void updateUserInfo(String username, String nickname, String birthday, String signature, int gender, String region, String address) throws cn.jpush.api.common.resp.APIConnectionException, cn.jpush.api.common.resp.APIRequestException
cn.jpush.api.common.resp.APIConnectionExceptioncn.jpush.api.common.resp.APIRequestExceptionpublic UserListResult getUserList(int start, int count) throws cn.jpush.api.common.resp.APIConnectionException, cn.jpush.api.common.resp.APIRequestException
start - The start index of the listcount - The number that how many you want to get from listcn.jpush.api.common.resp.APIConnectionExceptioncn.jpush.api.common.resp.APIRequestExceptionpublic UserListResult getAdminListByAppkey(int start, int count) throws cn.jpush.api.common.resp.APIConnectionException, cn.jpush.api.common.resp.APIRequestException
start - The start index of the listcount - The number that how many you want to get from listcn.jpush.api.common.resp.APIConnectionExceptioncn.jpush.api.common.resp.APIRequestExceptionpublic UserGroupsResult getGroupListByUser(String username) throws cn.jpush.api.common.resp.APIConnectionException, cn.jpush.api.common.resp.APIRequestException
username - cn.jpush.api.common.resp.APIConnectionExceptioncn.jpush.api.common.resp.APIRequestExceptionpublic void deleteUser(String username) throws cn.jpush.api.common.resp.APIConnectionException, cn.jpush.api.common.resp.APIRequestException
cn.jpush.api.common.resp.APIConnectionExceptioncn.jpush.api.common.resp.APIRequestExceptionpublic GroupInfoResult getGroupInfo(long gid) throws cn.jpush.api.common.resp.APIConnectionException, cn.jpush.api.common.resp.APIRequestException
cn.jpush.api.common.resp.APIConnectionExceptioncn.jpush.api.common.resp.APIRequestExceptionpublic MemberListResult getGroupMembers(long gid) throws cn.jpush.api.common.resp.APIConnectionException, cn.jpush.api.common.resp.APIRequestException
cn.jpush.api.common.resp.APIConnectionExceptioncn.jpush.api.common.resp.APIRequestExceptionpublic GroupListResult getGroupListByAppkey(int start, int count) throws cn.jpush.api.common.resp.APIConnectionException, cn.jpush.api.common.resp.APIRequestException
cn.jpush.api.common.resp.APIConnectionExceptioncn.jpush.api.common.resp.APIRequestExceptionpublic CreateGroupResult createGroup(String owner, String gname, String desc, String... userlist) throws cn.jpush.api.common.resp.APIConnectionException, cn.jpush.api.common.resp.APIRequestException
cn.jpush.api.common.resp.APIConnectionExceptioncn.jpush.api.common.resp.APIRequestExceptionpublic void addOrRemoveMembers(long gid,
String[] addList,
String[] removeList)
throws cn.jpush.api.common.resp.APIConnectionException,
cn.jpush.api.common.resp.APIRequestException
gid - The group idaddList - If this parameter is null then send remove requestremoveList - If this parameter is null then send add requestcn.jpush.api.common.resp.APIConnectionExceptioncn.jpush.api.common.resp.APIRequestExceptionpublic void deleteGroup(long gid)
throws cn.jpush.api.common.resp.APIConnectionException,
cn.jpush.api.common.resp.APIRequestException
cn.jpush.api.common.resp.APIConnectionExceptioncn.jpush.api.common.resp.APIRequestExceptionpublic void updateGroupInfo(long gid,
String groupName,
String groupDesc)
throws cn.jpush.api.common.resp.APIConnectionException,
cn.jpush.api.common.resp.APIRequestException
cn.jpush.api.common.resp.APIConnectionExceptioncn.jpush.api.common.resp.APIRequestExceptionpublic SendMessageResult sendMessage(Integer version, String targetType, String targetId, String fromType, String fromId, String messageType, MessageBody messageBody) throws cn.jpush.api.common.resp.APIConnectionException, cn.jpush.api.common.resp.APIRequestException
version - Current version is 1targetType - Group or singletargetId - The message receiverfromType - Only support admin nowfromId - SendermessageType - Only support text nowmessageBody - A MessageBody instancecn.jpush.api.common.resp.APIConnectionExceptioncn.jpush.api.common.resp.APIRequestExceptionpublic SendMessageResult sendSingleTextByAdmin(String targetId, String fromId, MessageBody body) throws cn.jpush.api.common.resp.APIConnectionException, cn.jpush.api.common.resp.APIRequestException
targetId - fromId - body - cn.jpush.api.common.resp.APIConnectionExceptioncn.jpush.api.common.resp.APIRequestExceptionpublic SendMessageResult sendGroupTextByAdmin(String targetId, String fromId, MessageBody body) throws cn.jpush.api.common.resp.APIConnectionException, cn.jpush.api.common.resp.APIRequestException
targetId - fromId - body - cn.jpush.api.common.resp.APIConnectionExceptioncn.jpush.api.common.resp.APIRequestExceptionCopyright © 2016. All Rights Reserved.