public class JMessageClient extends Object
| 构造器和说明 |
|---|
JMessageClient(String appkey,
String masterSecret)
Create a JMessage Client.
|
JMessageClient(String appkey,
String masterSecret,
cn.jiguang.common.connection.HttpProxy proxy)
Create a JMessage Client with a proxy.
|
JMessageClient(String appkey,
String masterSecret,
cn.jiguang.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.
|
| 限定符和类型 | 方法和说明 |
|---|---|
cn.jiguang.common.resp.ResponseWrapper |
addBlackList(String username,
String... users)
Add Users to black list
|
cn.jiguang.common.resp.ResponseWrapper |
addCrossBlacklist(String username,
CrossBlacklist[] blacklists)
Add blacklist whose users belong to another app to a given user.
|
cn.jiguang.common.resp.ResponseWrapper |
addCrossFriends(String username,
CrossFriendPayload payload)
Add users from cross app.
|
cn.jiguang.common.resp.ResponseWrapper |
addFriends(String username,
String... users)
Add friends to username
|
cn.jiguang.common.resp.ResponseWrapper |
addOrRemoveCrossGroupMember(long gid,
CrossGroup[] groups)
Add or remove group members from a given group id.
|
void |
addOrRemoveMembers(long gid,
String[] addList,
String[] removeList)
Add or remove members from a group
|
cn.jiguang.common.resp.ResponseWrapper |
addSensitiveWords(Set<String> words)
Add sensitive words
|
cn.jiguang.common.resp.ResponseWrapper |
addSensitiveWords(String... words)
Add sensitive words
|
CreateGroupResult |
createGroup(String owner,
String gname,
String desc,
String... userlist) |
cn.jiguang.common.resp.ResponseWrapper |
deleteCrossBlacklist(String username,
CrossBlacklist[] blacklists)
Delete blacklist whose users belong to another app from a given user.
|
cn.jiguang.common.resp.ResponseWrapper |
deleteCrossFriends(String username,
CrossFriendPayload payload)
Delete cross app friends
|
cn.jiguang.common.resp.ResponseWrapper |
deleteFriends(String username,
String... users)
Delete friends
|
void |
deleteGroup(long gid) |
cn.jiguang.common.resp.ResponseWrapper |
deleteSensitiveWord(String word)
Delete sensitive word
|
void |
deleteUser(String username) |
DownloadResult |
downloadFile(String mediaId)
Download file with mediaId, will return DownloadResult which include url.
|
UserListResult |
getAdminListByAppkey(int start,
int count)
Get admins by appkey
|
UserInfoResult[] |
getBlackList(String username)
Get a user's all black list
|
UserInfoResult[] |
getCrossBlacklist(String username)
Get all users' info(contains appkey) of user's cross app blacklist
|
MemberListResult |
getCrossGroupMembers(long gid)
Get members' info from cross group
|
UserInfoResult[] |
getFriendsInfo(String username)
Get all friends'info from a gived username
|
GroupInfoResult |
getGroupInfo(long gid) |
GroupListResult |
getGroupListByAppkey(int start,
int count) |
UserGroupsResult |
getGroupListByUser(String username)
Get all groups of a user
|
MemberListResult |
getGroupMembers(long gid) |
MessageListResult |
getMessageList(int count,
String begin_time,
String end_time)
Get message list from history, messages will store 60 days.
|
MessageListResult |
getMessageListByCursor(String cursor) |
SensitiveWordListResult |
getSensitiveWordList(int start,
int count)
Get sensitive word list
|
SensitiveWordStatusResult |
getSensitiveWordStatus()
Get sensitive word status
|
UserInfoResult |
getUserInfo(String username) |
UserListResult |
getUserList(int start,
int count)
Get user list
|
MessageListResult |
getUserMessages(String username,
int count,
String begin_time,
String end_time)
Get message list from user's record, messages will store 60 days.
|
MessageListResult |
getUserMessagesByCursor(String username,
String cursor)
Get user's message list with cursor, the cursor will effective in 120 seconds.
|
UserStateResult |
getUserState(String username) |
String |
registerAdmins(String username,
String password) |
String |
registerUsers(RegisterInfo[] users) |
cn.jiguang.common.resp.ResponseWrapper |
removeBlacklist(String username,
String... users) |
cn.jiguang.common.resp.ResponseWrapper |
retractMessage(String username,
long msgId)
retract message
消息撤回
|
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,
MessageType messageType,
MessageBody messageBody)
Send message
|
SendMessageResult |
sendMessage(MessagePayload payload) |
SendMessageResult |
sendSingleTextByAdmin(String targetId,
String fromId,
MessageBody body)
Send single text message by admin
|
cn.jiguang.common.resp.ResponseWrapper |
setCrossNoDisturb(String username,
CrossNoDisturb[] array)
Set cross app no disturb
https://docs.jiguang.cn/jmessage/server/rest_api_im/#api_1
|
cn.jiguang.common.resp.ResponseWrapper |
setNoDisturb(String username,
NoDisturbPayload payload)
Set don't disturb service while receiving messages.
|
cn.jiguang.common.resp.ResponseWrapper |
updateFriendsNote(String username,
FriendNote[] array)
Update friends' note information.
|
void |
updateGroupInfo(long gid,
String groupName,
String groupDesc) |
cn.jiguang.common.resp.ResponseWrapper |
updateSensitiveWord(String newWord,
String oldWord)
Update sensitive word
|
cn.jiguang.common.resp.ResponseWrapper |
updateSensitiveWordStatus(int status)
Update sensitive word status
|
void |
updateUserInfo(String username,
String nickname,
String birthday,
String signature,
int gender,
String region,
String address) |
void |
updateUserPassword(String username,
String password) |
UploadResult |
uploadFile(String path)
Upload file, only support image file(jpg, bmp, gif, png) currently,
file size should not larger than 8M.
|
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.jiguang.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.jiguang.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.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
cn.jiguang.common.resp.APIConnectionExceptioncn.jiguang.common.resp.APIRequestExceptionpublic String registerAdmins(String username, String password) throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
cn.jiguang.common.resp.APIConnectionExceptioncn.jiguang.common.resp.APIRequestExceptionpublic UserInfoResult getUserInfo(String username) throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
cn.jiguang.common.resp.APIConnectionExceptioncn.jiguang.common.resp.APIRequestExceptionpublic UserStateResult getUserState(String username) throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
cn.jiguang.common.resp.APIConnectionExceptioncn.jiguang.common.resp.APIRequestExceptionpublic void updateUserPassword(String username, String password) throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
cn.jiguang.common.resp.APIConnectionExceptioncn.jiguang.common.resp.APIRequestExceptionpublic void updateUserInfo(String username, String nickname, String birthday, String signature, int gender, String region, String address) throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
cn.jiguang.common.resp.APIConnectionExceptioncn.jiguang.common.resp.APIRequestExceptionpublic UserListResult getUserList(int start, int count) throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
start - The start index of the listcount - The number that how many you want to get from listcn.jiguang.common.resp.APIConnectionException - connect exceptioncn.jiguang.common.resp.APIRequestException - request exceptionpublic UserListResult getAdminListByAppkey(int start, int count) throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
start - The start index of the listcount - The number that how many you want to get from listcn.jiguang.common.resp.APIConnectionException - connect exceptioncn.jiguang.common.resp.APIRequestException - request exceptionpublic UserInfoResult[] getBlackList(String username) throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
username - The owner of the black listcn.jiguang.common.resp.APIConnectionException - connect exceptioncn.jiguang.common.resp.APIRequestException - request exceptionpublic cn.jiguang.common.resp.ResponseWrapper addBlackList(String username, String... users) throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
username - The owner of the black listusers - The users that will add to black listcn.jiguang.common.resp.APIConnectionException - connect exceptioncn.jiguang.common.resp.APIRequestException - request exceptionpublic cn.jiguang.common.resp.ResponseWrapper removeBlacklist(String username, String... users) throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
cn.jiguang.common.resp.APIConnectionExceptioncn.jiguang.common.resp.APIRequestExceptionpublic UserGroupsResult getGroupListByUser(String username) throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
username - Necessarycn.jiguang.common.resp.APIConnectionException - connect exceptioncn.jiguang.common.resp.APIRequestException - request exceptionpublic void deleteUser(String username) throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
cn.jiguang.common.resp.APIConnectionExceptioncn.jiguang.common.resp.APIRequestExceptionpublic cn.jiguang.common.resp.ResponseWrapper setNoDisturb(String username, NoDisturbPayload payload) throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
username - Necessarypayload - NoDisturbPayloadcn.jiguang.common.resp.APIConnectionException - connect exceptioncn.jiguang.common.resp.APIRequestException - request exceptionpublic cn.jiguang.common.resp.ResponseWrapper addFriends(String username, String... users) throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
username - Necessaryusers - username to be addcn.jiguang.common.resp.APIConnectionException - connect exceptioncn.jiguang.common.resp.APIRequestException - request exceptionpublic cn.jiguang.common.resp.ResponseWrapper deleteFriends(String username, String... users) throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
username - Friends you want to delete tousers - username to be deletecn.jiguang.common.resp.APIConnectionException - connect exceptioncn.jiguang.common.resp.APIRequestException - request exceptionpublic cn.jiguang.common.resp.ResponseWrapper updateFriendsNote(String username, FriendNote[] array) throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
username - Necessaryarray - FriendNote arraycn.jiguang.common.resp.APIConnectionException - connect exceptioncn.jiguang.common.resp.APIRequestException - request exceptionpublic UserInfoResult[] getFriendsInfo(String username) throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
username - Necessarycn.jiguang.common.resp.APIConnectionException - connect exceptioncn.jiguang.common.resp.APIRequestException - request exceptionpublic GroupInfoResult getGroupInfo(long gid) throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
cn.jiguang.common.resp.APIConnectionExceptioncn.jiguang.common.resp.APIRequestExceptionpublic MemberListResult getGroupMembers(long gid) throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
cn.jiguang.common.resp.APIConnectionExceptioncn.jiguang.common.resp.APIRequestExceptionpublic GroupListResult getGroupListByAppkey(int start, int count) throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
cn.jiguang.common.resp.APIConnectionExceptioncn.jiguang.common.resp.APIRequestExceptionpublic CreateGroupResult createGroup(String owner, String gname, String desc, String... userlist) throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
cn.jiguang.common.resp.APIConnectionExceptioncn.jiguang.common.resp.APIRequestExceptionpublic void addOrRemoveMembers(long gid,
String[] addList,
String[] removeList)
throws cn.jiguang.common.resp.APIConnectionException,
cn.jiguang.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.jiguang.common.resp.APIConnectionException - connect exceptioncn.jiguang.common.resp.APIRequestException - request exceptionpublic void deleteGroup(long gid)
throws cn.jiguang.common.resp.APIConnectionException,
cn.jiguang.common.resp.APIRequestException
cn.jiguang.common.resp.APIConnectionExceptioncn.jiguang.common.resp.APIRequestExceptionpublic void updateGroupInfo(long gid,
String groupName,
String groupDesc)
throws cn.jiguang.common.resp.APIConnectionException,
cn.jiguang.common.resp.APIRequestException
cn.jiguang.common.resp.APIConnectionExceptioncn.jiguang.common.resp.APIRequestExceptionpublic SendMessageResult sendMessage(Integer version, String targetType, String targetId, String fromType, String fromId, MessageType messageType, MessageBody messageBody) throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
version - Current version is 1targetType - Group or singletargetId - The message receiverfromType - Only support admin nowfromId - SendermessageType - MessageType: text, image or custommessageBody - A MessageBodyResult instancecn.jiguang.common.resp.APIConnectionException - connect exceptioncn.jiguang.common.resp.APIRequestException - request exceptionpublic SendMessageResult sendMessage(MessagePayload payload) throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
cn.jiguang.common.resp.APIConnectionExceptioncn.jiguang.common.resp.APIRequestExceptionpublic SendMessageResult sendSingleTextByAdmin(String targetId, String fromId, MessageBody body) throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
targetId - target user's idfromId - sender's idbody - message body, include text and extra(if needed).cn.jiguang.common.resp.APIConnectionException - connect exceptioncn.jiguang.common.resp.APIRequestException - request exceptionpublic SendMessageResult sendGroupTextByAdmin(String targetId, String fromId, MessageBody body) throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
targetId - target user's idfromId - sender's idbody - message body, include text and extra(if needed).cn.jiguang.common.resp.APIConnectionException - connect exceptioncn.jiguang.common.resp.APIRequestException - request exceptionpublic MessageListResult getMessageList(int count, String begin_time, String end_time) throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
count - Necessary parameter. The count of the message list.begin_time - Necessary parameter. The format must follow by 'yyyy-MM-dd HH:mm:ss'end_time - Necessary parameter. The format must follow by 'yyyy-MM-dd HH:mm:ss'cn.jiguang.common.resp.APIConnectionException - connect exceptioncn.jiguang.common.resp.APIRequestException - request exceptionpublic MessageListResult getMessageListByCursor(String cursor) throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
cn.jiguang.common.resp.APIConnectionExceptioncn.jiguang.common.resp.APIRequestExceptionpublic MessageListResult getUserMessages(String username, int count, String begin_time, String end_time) throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
username - Necessary parameter.count - Necessary parameter. The count of the message list.begin_time - Optional parameter. The format must follow by 'yyyy-MM-dd HH:mm:ss'end_time - Optional parameter. The format must follow by 'yyyy-MM-dd HH:mm:ss'cn.jiguang.common.resp.APIConnectionException - connect exceptioncn.jiguang.common.resp.APIRequestException - request exceptionpublic MessageListResult getUserMessagesByCursor(String username, String cursor) throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
username - Necessary parameter.cursor - First request will return cursorcn.jiguang.common.resp.APIConnectionException - connect exceptioncn.jiguang.common.resp.APIRequestException - request exceptionpublic cn.jiguang.common.resp.ResponseWrapper retractMessage(String username, long msgId) throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
username - 用户名msgId - message idcn.jiguang.common.resp.APIConnectionException - connect exceptioncn.jiguang.common.resp.APIRequestException - request exceptionpublic DownloadResult downloadFile(String mediaId) throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
mediaId - Necessarycn.jiguang.common.resp.APIConnectionException - connect exceptioncn.jiguang.common.resp.APIRequestException - request exceptionpublic UploadResult uploadFile(String path) throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
path - Necessary, the native path of the file you want to uploadcn.jiguang.common.resp.APIConnectionException - connect exceptioncn.jiguang.common.resp.APIRequestException - request exceptionpublic cn.jiguang.common.resp.ResponseWrapper addOrRemoveCrossGroupMember(long gid,
CrossGroup[] groups)
throws cn.jiguang.common.resp.APIConnectionException,
cn.jiguang.common.resp.APIRequestException
gid - Necessary, target group id.groups - Necessarycn.jiguang.common.resp.APIConnectionException - connect exceptioncn.jiguang.common.resp.APIRequestException - request exceptionpublic MemberListResult getCrossGroupMembers(long gid) throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
gid - Necessary, target group idcn.jiguang.common.resp.APIConnectionException - connect exceptioncn.jiguang.common.resp.APIRequestException - request exceptionpublic cn.jiguang.common.resp.ResponseWrapper addCrossBlacklist(String username, CrossBlacklist[] blacklists) throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
username - The owner of the blacklistblacklists - CrossBlacklist arraycn.jiguang.common.resp.APIConnectionException - connect exceptioncn.jiguang.common.resp.APIRequestException - request exceptionpublic cn.jiguang.common.resp.ResponseWrapper deleteCrossBlacklist(String username, CrossBlacklist[] blacklists) throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
username - The owner of the blacklistblacklists - CrossBlacklist arraycn.jiguang.common.resp.APIConnectionException - connect exceptioncn.jiguang.common.resp.APIRequestException - request exceptionpublic UserInfoResult[] getCrossBlacklist(String username) throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
username - Necessary, the owner of blacklistcn.jiguang.common.resp.APIConnectionException - connect exceptioncn.jiguang.common.resp.APIRequestException - request exceptionpublic cn.jiguang.common.resp.ResponseWrapper setCrossNoDisturb(String username, CrossNoDisturb[] array) throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
username - Necessaryarray - CrossNoDisturb arraycn.jiguang.common.resp.APIConnectionException - connect exceptioncn.jiguang.common.resp.APIRequestException - request exceptionpublic cn.jiguang.common.resp.ResponseWrapper addCrossFriends(String username, CrossFriendPayload payload) throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
username - Necessarypayload - CrossFriendPayloadcn.jiguang.common.resp.APIConnectionException - connect exceptioncn.jiguang.common.resp.APIRequestException - request exceptionpublic cn.jiguang.common.resp.ResponseWrapper deleteCrossFriends(String username, CrossFriendPayload payload) throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
username - Necessarypayload - CrossFriendPayloadcn.jiguang.common.resp.APIConnectionException - connect exceptioncn.jiguang.common.resp.APIRequestException - request exceptionpublic cn.jiguang.common.resp.ResponseWrapper addSensitiveWords(String... words) throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
words - String arraycn.jiguang.common.resp.APIConnectionException - connect exceptioncn.jiguang.common.resp.APIRequestException - request exceptionpublic cn.jiguang.common.resp.ResponseWrapper addSensitiveWords(Set<String> words) throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
words - String Setcn.jiguang.common.resp.APIConnectionException - connect exceptioncn.jiguang.common.resp.APIRequestException - request exceptionpublic cn.jiguang.common.resp.ResponseWrapper updateSensitiveWord(String newWord, String oldWord) throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
newWord - new wordoldWord - old wordcn.jiguang.common.resp.APIConnectionException - connect exceptioncn.jiguang.common.resp.APIRequestException - request exceptionpublic cn.jiguang.common.resp.ResponseWrapper deleteSensitiveWord(String word) throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
word - word to be deletedcn.jiguang.common.resp.APIConnectionException - connect exceptioncn.jiguang.common.resp.APIRequestException - request exceptionpublic SensitiveWordListResult getSensitiveWordList(int start, int count) throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
start - the begin of the listcount - the count of the listcn.jiguang.common.resp.APIConnectionException - connect exceptioncn.jiguang.common.resp.APIRequestException - request exceptionpublic cn.jiguang.common.resp.ResponseWrapper updateSensitiveWordStatus(int status)
throws cn.jiguang.common.resp.APIConnectionException,
cn.jiguang.common.resp.APIRequestException
status - 1 represent turn on filtering, 0 represent turn off.cn.jiguang.common.resp.APIConnectionExceptioncn.jiguang.common.resp.APIRequestExceptionpublic SensitiveWordStatusResult getSensitiveWordStatus() throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
cn.jiguang.common.resp.APIConnectionException - connect exceptioncn.jiguang.common.resp.APIRequestException - request exceptionCopyright © 2017. All Rights Reserved.