public class JMessageClient
extends java.lang.Object
| 构造器和说明 |
|---|
JMessageClient(java.lang.String appkey,
java.lang.String masterSecret)
Create a JMessage Client.
|
JMessageClient(java.lang.String appkey,
java.lang.String masterSecret,
cn.jiguang.common.connection.HttpProxy proxy)
Create a JMessage Client with a proxy.
|
JMessageClient(java.lang.String appkey,
java.lang.String masterSecret,
cn.jiguang.common.connection.HttpProxy proxy,
JMessageConfig config)
Create a JMessage Client by custom Client configuration.
|
JMessageClient(java.lang.String appkey,
java.lang.String masterSecret,
int maxRetryTimes)
Create a JMessage Client with custom maxRetryTimes.
|
JMessageClient(java.lang.String appkey,
java.lang.String masterSecret,
java.lang.String hostname)
Create a JMessage Client with a custom hostname.
|
| 限定符和类型 | 方法和说明 |
|---|---|
cn.jiguang.common.resp.ResponseWrapper |
addBlackList(java.lang.String username,
java.lang.String... users)
Add Users to black list
|
cn.jiguang.common.resp.ResponseWrapper |
addCrossBlacklist(java.lang.String username,
CrossBlacklist[] blacklists)
Add blacklist whose users belong to another app to a given user.
|
cn.jiguang.common.resp.ResponseWrapper |
addCrossFriends(java.lang.String username,
CrossFriendPayload payload)
Add users from cross app.
|
cn.jiguang.common.resp.ResponseWrapper |
addFriends(java.lang.String username,
java.lang.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,
java.lang.String[] addList,
java.lang.String[] removeList)
Add or remove members from a group
|
CreateGroupResult |
createGroup(java.lang.String owner,
java.lang.String gname,
java.lang.String desc,
java.lang.String... userlist) |
cn.jiguang.common.resp.ResponseWrapper |
deleteCrossBlacklist(java.lang.String username,
CrossBlacklist[] blacklists)
Delete blacklist whose users belong to another app from a given user.
|
cn.jiguang.common.resp.ResponseWrapper |
deleteCrossFriends(java.lang.String username,
CrossFriendPayload payload)
Delete cross app friends
|
cn.jiguang.common.resp.ResponseWrapper |
deleteFriends(java.lang.String username,
java.lang.String... users)
Delete friends
|
void |
deleteGroup(long gid) |
void |
deleteUser(java.lang.String username) |
DownloadResult |
downloadFile(java.lang.String mediaId)
Download file with mediaId, will return DownloadResult which include url.
|
UserListResult |
getAdminListByAppkey(int start,
int count)
Get admins by appkey
|
UserInfoResult[] |
getBlackList(java.lang.String username)
Get a user's all black list
|
UserInfoResult[] |
getCrossBlacklist(java.lang.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(java.lang.String username)
Get all friends'info from a gived username
|
GroupInfoResult |
getGroupInfo(long gid) |
GroupListResult |
getGroupListByAppkey(int start,
int count) |
UserGroupsResult |
getGroupListByUser(java.lang.String username)
Get all groups of a user
|
MemberListResult |
getGroupMembers(long gid) |
MessageListResult |
getMessageList(int count,
java.lang.String begin_time,
java.lang.String end_time)
Get message list from history, messages will store 60 days.
|
MessageListResult |
getMessageListByCursor(java.lang.String cursor) |
UserInfoResult |
getUserInfo(java.lang.String username) |
UserListResult |
getUserList(int start,
int count)
Get user list
|
MessageListResult |
getUserMessages(java.lang.String username,
int count,
java.lang.String begin_time,
java.lang.String end_time)
Get message list from user's record, messages will store 60 days.
|
MessageListResult |
getUserMessagesByCursor(java.lang.String username,
java.lang.String cursor)
Get user's message list with cursor, the cursor will effective in 120 seconds.
|
UserStateResult |
getUserState(java.lang.String username) |
java.lang.String |
registerAdmins(java.lang.String username,
java.lang.String password) |
java.lang.String |
registerUsers(RegisterInfo[] users) |
cn.jiguang.common.resp.ResponseWrapper |
removeBlacklist(java.lang.String username,
java.lang.String... users) |
SendMessageResult |
sendGroupTextByAdmin(java.lang.String targetId,
java.lang.String fromId,
MessageBody body)
Send group text message by admin
|
SendMessageResult |
sendMessage(java.lang.Integer version,
java.lang.String targetType,
java.lang.String targetId,
java.lang.String fromType,
java.lang.String fromId,
MessageType messageType,
MessageBody messageBody)
Send message
|
SendMessageResult |
sendMessage(MessagePayload payload) |
SendMessageResult |
sendSingleTextByAdmin(java.lang.String targetId,
java.lang.String fromId,
MessageBody body)
Send single text message by admin
|
cn.jiguang.common.resp.ResponseWrapper |
setCrossNoDisturb(java.lang.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(java.lang.String username,
NoDisturbPayload payload)
Set don't disturb service while receiving messages.
|
cn.jiguang.common.resp.ResponseWrapper |
updateFriendsNote(java.lang.String username,
FriendNote[] array)
Update friends' note information.
|
void |
updateGroupInfo(long gid,
java.lang.String groupName,
java.lang.String groupDesc) |
void |
updateUserInfo(java.lang.String username,
java.lang.String nickname,
java.lang.String birthday,
java.lang.String signature,
int gender,
java.lang.String region,
java.lang.String address) |
void |
updateUserPassword(java.lang.String username,
java.lang.String password) |
UploadResult |
uploadFile(java.lang.String path)
Upload file, only support image file(jpg, bmp, gif, png) currently,
file size should not larger than 8M.
|
public JMessageClient(java.lang.String appkey,
java.lang.String masterSecret)
appkey - The KEY of one application on JPush.masterSecret - API access secret of the appKey.public JMessageClient(java.lang.String appkey,
java.lang.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(java.lang.String appkey,
java.lang.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(java.lang.String appkey,
java.lang.String masterSecret,
java.lang.String hostname)
appkey - The KEY of one application on JPush.masterSecret - API access secret of the appKey.hostname - The custom hostname.public JMessageClient(java.lang.String appkey,
java.lang.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 java.lang.String registerUsers(RegisterInfo[] users) throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
cn.jiguang.common.resp.APIConnectionExceptioncn.jiguang.common.resp.APIRequestExceptionpublic java.lang.String registerAdmins(java.lang.String username,
java.lang.String password)
throws cn.jiguang.common.resp.APIConnectionException,
cn.jiguang.common.resp.APIRequestException
cn.jiguang.common.resp.APIConnectionExceptioncn.jiguang.common.resp.APIRequestExceptionpublic UserInfoResult getUserInfo(java.lang.String username) throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
cn.jiguang.common.resp.APIConnectionExceptioncn.jiguang.common.resp.APIRequestExceptionpublic UserStateResult getUserState(java.lang.String username) throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
cn.jiguang.common.resp.APIConnectionExceptioncn.jiguang.common.resp.APIRequestExceptionpublic void updateUserPassword(java.lang.String username,
java.lang.String password)
throws cn.jiguang.common.resp.APIConnectionException,
cn.jiguang.common.resp.APIRequestException
cn.jiguang.common.resp.APIConnectionExceptioncn.jiguang.common.resp.APIRequestExceptionpublic void updateUserInfo(java.lang.String username,
java.lang.String nickname,
java.lang.String birthday,
java.lang.String signature,
int gender,
java.lang.String region,
java.lang.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(java.lang.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(java.lang.String username,
java.lang.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(java.lang.String username,
java.lang.String... users)
throws cn.jiguang.common.resp.APIConnectionException,
cn.jiguang.common.resp.APIRequestException
cn.jiguang.common.resp.APIConnectionExceptioncn.jiguang.common.resp.APIRequestExceptionpublic UserGroupsResult getGroupListByUser(java.lang.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(java.lang.String username)
throws cn.jiguang.common.resp.APIConnectionException,
cn.jiguang.common.resp.APIRequestException
cn.jiguang.common.resp.APIConnectionExceptioncn.jiguang.common.resp.APIRequestExceptionpublic 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(java.lang.String owner, java.lang.String gname, java.lang.String desc, java.lang.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,
java.lang.String[] addList,
java.lang.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,
java.lang.String groupName,
java.lang.String groupDesc)
throws cn.jiguang.common.resp.APIConnectionException,
cn.jiguang.common.resp.APIRequestException
cn.jiguang.common.resp.APIConnectionExceptioncn.jiguang.common.resp.APIRequestExceptionpublic SendMessageResult sendMessage(java.lang.Integer version, java.lang.String targetType, java.lang.String targetId, java.lang.String fromType, java.lang.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 DownloadResult downloadFile(java.lang.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(java.lang.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 SendMessageResult sendSingleTextByAdmin(java.lang.String targetId, java.lang.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(java.lang.String targetId, java.lang.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, java.lang.String begin_time, java.lang.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(java.lang.String cursor) throws cn.jiguang.common.resp.APIConnectionException, cn.jiguang.common.resp.APIRequestException
cn.jiguang.common.resp.APIConnectionExceptioncn.jiguang.common.resp.APIRequestExceptionpublic MessageListResult getUserMessages(java.lang.String username, int count, java.lang.String begin_time, java.lang.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(java.lang.String username, java.lang.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 setNoDisturb(java.lang.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(java.lang.String username,
java.lang.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(java.lang.String username,
java.lang.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(java.lang.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(java.lang.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 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(java.lang.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(java.lang.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(java.lang.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(java.lang.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(java.lang.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(java.lang.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 exceptionCopyright © 2017. All Rights Reserved.