├── src ├── main │ ├── resources │ │ ├── jsonsource │ │ │ ├── group │ │ │ │ └── mute │ │ │ │ │ └── api.json │ │ │ ├── ultragroup │ │ │ │ └── mute │ │ │ │ │ └── api.json │ │ │ ├── UserTag.json │ │ │ ├── agent │ │ │ │ └── verify.json │ │ │ ├── chatbot │ │ │ │ └── verify.json │ │ │ ├── PushMessage.json │ │ │ ├── message │ │ │ │ └── TemplateMessage.json │ │ │ ├── TemplateMessage.json │ │ │ ├── broadcast │ │ │ │ ├── verify.json │ │ │ │ └── api.json │ │ │ ├── user │ │ │ │ ├── online-status │ │ │ │ │ └── api.json │ │ │ │ └── chat │ │ │ │ │ └── api.json │ │ │ ├── sensitiveword │ │ │ │ └── verify.json │ │ │ └── conversation │ │ │ │ └── verify.json │ │ └── app.properties │ └── java │ │ └── io │ │ └── rong │ │ ├── models │ │ ├── response │ │ │ ├── ChatRoomQuery.java │ │ │ ├── ResultData.java │ │ │ ├── GroupRemarkModel.java │ │ │ ├── ChatMetadata.java │ │ │ ├── ChatroomEntryListResult.java │ │ │ ├── GroupMuteWhitelistResult.java │ │ │ ├── GetTagResult.java │ │ │ ├── RemarkNameResult.java │ │ │ ├── GroupBanInfo.java │ │ │ ├── GroupUser.java │ │ │ ├── FollowedMember.java │ │ │ ├── CheckChatRoomUserResult.java │ │ │ ├── ResponseResult.java │ │ │ ├── UserDeactivateResult.java │ │ │ ├── ExtraContent.java │ │ │ ├── CheckFriendsResult.java │ │ │ ├── GroupBanResult.java │ │ │ ├── QueryMembersResult.java │ │ │ ├── QueryUserProfilesResp.java │ │ │ ├── ChatroomKeepaliveResult.java │ │ │ ├── QueryFriendsResult.java │ │ │ ├── PagingQueryMembersResult.java │ │ │ ├── QueryChatbotsResult.java │ │ │ ├── PagingQueryJoinedGroupsResult.java │ │ │ ├── GroupMuteAllMembersListResult.java │ │ │ ├── BlockPushPeriodResult.java │ │ │ ├── BroadcastResult.java │ │ │ ├── OperationGroupResult.java │ │ │ ├── GetPermissionResult.java │ │ │ ├── GroupMuteAllMembersCheckResult.java │ │ │ ├── Usage.java │ │ │ ├── PermissionSetting.java │ │ │ ├── QueryHistoryMessageResult.java │ │ │ ├── ChatroomDemotionMsgResult.java │ │ │ ├── CheckStatusResult.java │ │ │ ├── PageResult.java │ │ │ ├── QueryGroupProfilesResult.java │ │ │ ├── WhiteListResult.java │ │ │ ├── BatchAddSensitiveWordResult.java │ │ │ ├── CheckOnlineResult.java │ │ │ ├── SMSVerifyCodeResult.java │ │ │ ├── UserList.java │ │ │ ├── BlockUserResult.java │ │ │ ├── MessageResult.java │ │ │ ├── CheckFriendResult.java │ │ │ ├── ChatroomBanListResult.java │ │ │ ├── StatusResult.java │ │ │ ├── SMSSendCodeResult.java │ │ │ ├── GroupBanWhitelistResult.java │ │ │ ├── PagingQueryGroupsResult.java │ │ │ ├── QueryGroupManagersResult.java │ │ │ ├── GagGroupUser.java │ │ │ ├── SetManagersResult.java │ │ │ ├── PagingQueryWhitelistResult.java │ │ │ ├── ListGagGroupUserResult.java │ │ │ ├── PagingQueryBlacklistResult.java │ │ │ ├── FollowedMemberResult.java │ │ │ ├── GroupMuteMembersListResult.java │ │ │ ├── CheckChatRoomUsersResult.java │ │ │ ├── GagChatRoomUser.java │ │ │ ├── BlackListResult.java │ │ │ ├── BlockChatRoomUser.java │ │ │ ├── PWhiteListResult.java │ │ │ ├── PagingQueryChatbotsResult.java │ │ │ ├── HistoryMessageResult.java │ │ │ ├── NotdisturbStatusResult.java │ │ │ ├── ListBlockChatroomUserResult.java │ │ │ ├── ExpansionResult.java │ │ │ ├── UserResult.java │ │ │ ├── SMSImageCodeResult.java │ │ │ ├── UserProfile.java │ │ │ ├── UserGroupQueryResult.java │ │ │ ├── GetUserRemarksResult.java │ │ │ ├── ListWordfilterResult.java │ │ │ ├── PushResult.java │ │ │ ├── GroupUserQueryResult.java │ │ │ ├── EntrustGroupInfo.java │ │ │ ├── BanListResult.java │ │ │ ├── ConversationNotificationResult.java │ │ │ ├── PagingQueryAgentsResult.java │ │ │ ├── ListGagChatroomUserResult.java │ │ │ ├── ChannelListResult.java │ │ │ ├── MessageUIDEntry.java │ │ │ ├── GroupMember.java │ │ │ ├── ChatroomEntryResult.java │ │ │ ├── TokenResult.java │ │ │ ├── ChatroomWhitelistMsgResult.java │ │ │ └── ChatroomUserQueryResult.java │ │ ├── message │ │ │ ├── Platform.java │ │ │ ├── Audit.java │ │ │ ├── MentionMessageContent.java │ │ │ └── MentionedInfo.java │ │ ├── profile │ │ │ ├── ImportEntrustGroupModel.java │ │ │ ├── KickOutEntrustGroupModel.java │ │ │ ├── CreateEntrustGroupModel.java │ │ │ ├── PagingGetFriendsModel.java │ │ │ ├── PagingQueryMembersModel.java │ │ │ ├── PagingQueryUserProfilesModel.java │ │ │ ├── PageModel.java │ │ │ ├── QueryJoinedGroupsModel.java │ │ │ ├── GroupRemarkNameModel.java │ │ │ ├── MemberInfoModel.java │ │ │ ├── UserProfileModel.java │ │ │ ├── QuitEntrustGroupModel.java │ │ │ ├── TransferOwnerModel.java │ │ │ └── FriendProfileModel.java │ │ ├── push │ │ │ ├── PushModel.java │ │ │ ├── BroadcastModel.java │ │ │ ├── BroadcastPushPublicPart.java │ │ │ └── AudienceCustom.java │ │ ├── conversation │ │ │ ├── ConversationMuteModel.java │ │ │ ├── ConversationTopModel.java │ │ │ ├── UserConversationTagModel.java │ │ │ ├── ConversationAttrModel.java │ │ │ ├── ConversationTagModel.java │ │ │ └── ConversationSetTopModel.java │ │ ├── user │ │ │ ├── RemarkModel.java │ │ │ ├── GetTagModel.java │ │ │ ├── UserIdListModel.java │ │ │ ├── TagModel.java │ │ │ ├── BatchTagModel.java │ │ │ ├── ExpireModel.java │ │ │ ├── BlockPushPeriodModel.java │ │ │ ├── BanModel.java │ │ │ └── BanListModel.java │ │ ├── bot │ │ │ ├── SetChatbotIntegration.java │ │ │ └── ChatbotAuthInfo.java │ │ ├── group │ │ │ ├── GroupMemberCount.java │ │ │ ├── GroupBanModel.java │ │ │ └── UserGroup.java │ │ ├── ultragroup │ │ │ ├── UltraGroupBanModel.java │ │ │ ├── UserUltraGroup.java │ │ │ └── UltraGroupMember.java │ │ ├── agent │ │ │ ├── AgentConfig.java │ │ │ ├── Model.java │ │ │ ├── Memory.java │ │ │ ├── Prompt.java │ │ │ ├── AgentModel.java │ │ │ ├── ChatModel.java │ │ │ └── ModelOptions.java │ │ ├── BlockUsers.java │ │ ├── CommonConstrants.java │ │ ├── sensitiveword │ │ │ └── AddSensitiveWordsModel.java │ │ ├── Result.java │ │ ├── chatroom │ │ │ └── ChatroomDestroyTypeModel.java │ │ └── User.java │ │ ├── util │ │ ├── ParamNotNull.java │ │ └── GsonUtil.java │ │ ├── messages │ │ ├── TypingStatusMessage.java │ │ ├── BaseMessage.java │ │ ├── CustomTxtMessage.java │ │ ├── CmdNtfMessage.java │ │ ├── CmdMsgMessage.java │ │ ├── InfoNtfMessage.java │ │ ├── RcCmdMessage.java │ │ └── ReadReceiptMessage.java │ │ ├── exception │ │ ├── ParamError.java │ │ ├── ParamException.java │ │ └── RcloudException.java │ │ ├── CenterEnum.java │ │ ├── example │ │ ├── group │ │ │ └── RemarkExample.java │ │ ├── user │ │ │ ├── BanExample.java │ │ │ ├── RemarkExample.java │ │ │ └── BlockExample.java │ │ ├── chatroom │ │ │ ├── DistributeExample.java │ │ │ ├── DemotionExample.java │ │ │ └── whitelist │ │ │ │ └── MessageExample.java │ │ └── InitRongCloudExample.java │ │ └── methods │ │ ├── chatroom │ │ └── whitelist │ │ │ └── Whitelist.java │ │ └── group │ │ ├── ban │ │ └── whitelist │ │ │ └── Whitelist.java │ │ └── mute │ │ └── whitelist │ │ └── MuteWhiteList.java └── test │ └── java │ └── io │ └── rong │ ├── Test.java │ ├── messages │ └── GifMessageTest.java │ └── models │ └── push │ └── PlatformNotificationTest.java ├── lib ├── gson-2.2.4.jar ├── xstream-1.5.0.jar ├── fastjson-1.2.4.jar ├── commons-codec-1.4.jar ├── commons-lang3-3.4.jar ├── jackson-databind-2.2.2.jar └── jackson-annotations-2.2.2.jar ├── .gitignore ├── .project ├── LICENSE └── .classpath /src/main/resources/jsonsource/group/mute/api.json: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/main/resources/jsonsource/ultragroup/mute/api.json: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/main/resources/app.properties: -------------------------------------------------------------------------------- 1 | app.version=${project.version} -------------------------------------------------------------------------------- /src/test/java/io/rong/Test.java: -------------------------------------------------------------------------------- 1 | package io.rong; 2 | 3 | public class Test { 4 | } 5 | -------------------------------------------------------------------------------- /lib/gson-2.2.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rongcloud/server-sdk-java/HEAD/lib/gson-2.2.4.jar -------------------------------------------------------------------------------- /lib/xstream-1.5.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rongcloud/server-sdk-java/HEAD/lib/xstream-1.5.0.jar -------------------------------------------------------------------------------- /lib/fastjson-1.2.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rongcloud/server-sdk-java/HEAD/lib/fastjson-1.2.4.jar -------------------------------------------------------------------------------- /lib/commons-codec-1.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rongcloud/server-sdk-java/HEAD/lib/commons-codec-1.4.jar -------------------------------------------------------------------------------- /lib/commons-lang3-3.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rongcloud/server-sdk-java/HEAD/lib/commons-lang3-3.4.jar -------------------------------------------------------------------------------- /lib/jackson-databind-2.2.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rongcloud/server-sdk-java/HEAD/lib/jackson-databind-2.2.2.jar -------------------------------------------------------------------------------- /lib/jackson-annotations-2.2.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rongcloud/server-sdk-java/HEAD/lib/jackson-annotations-2.2.2.jar -------------------------------------------------------------------------------- /src/main/resources/jsonsource/UserTag.json: -------------------------------------------------------------------------------- 1 | { 2 | "userId": "31232", 3 | "tags": [ 4 | "bj", 5 | "male" 6 | ] 7 | } -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/ChatRoomQuery.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | public class ChatRoomQuery { 4 | 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/message/Platform.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.message; 2 | 3 | public interface Platform { 4 | 5 | void addParamIfNotBlank(String name, String param); 6 | 7 | } 8 | 9 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/profile/ImportEntrustGroupModel.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.profile; 2 | 3 | /** 4 | * @author RongCloud 5 | */ 6 | public class ImportEntrustGroupModel extends EntrustGroupModel { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | *.zip 3 | *.bak 4 | src/.metadata/ 5 | bin/ 6 | .settings/ 7 | .idea*/ 8 | target/ 9 | logs/ 10 | *.iml 11 | *.iml 12 | src/com.fcloud.connectmanager/build.xml 13 | .fuse* 14 | src/out/ 15 | *.pyc 16 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/profile/KickOutEntrustGroupModel.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.profile; 2 | 3 | /** 4 | * @author RongCloud 5 | */ 6 | public class KickOutEntrustGroupModel extends QuitEntrustGroupModel { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /src/main/resources/jsonsource/agent/verify.json: -------------------------------------------------------------------------------- 1 | { 2 | "agentCreate": { 3 | }, 4 | "agentGet": { 5 | }, 6 | "agentDelete": { 7 | }, 8 | "agentUpdate": { 9 | }, 10 | "agentList": { 11 | }, 12 | "agentChat": { 13 | } 14 | } -------------------------------------------------------------------------------- /src/main/resources/jsonsource/chatbot/verify.json: -------------------------------------------------------------------------------- 1 | { 2 | "botCreate": { 3 | }, 4 | "botGet": { 5 | }, 6 | "botDelete": { 7 | }, 8 | "botUpdate": { 9 | }, 10 | "botList": { 11 | }, 12 | "botAddIntegration": { 13 | }, 14 | "botDeleteIntegration": { 15 | }, 16 | "botDUpdateIntegration": { 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/push/PushModel.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.push; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | /** 6 | * Push notification message body 7 | */ 8 | public class PushModel extends BroadcastPushPublicPart { 9 | 10 | @Override 11 | public String toString() { 12 | return GsonUtil.toJson(this, PushModel.class); 13 | } 14 | } -------------------------------------------------------------------------------- /src/main/resources/jsonsource/PushMessage.json: -------------------------------------------------------------------------------- 1 | { 2 | "platform": ["ios","android"], 3 | "fromuserid": "U161142135", 4 | "audience": { 5 | "tag":["1"], 6 | "is_to_all": false 7 | }, 8 | "message": { 9 | "content":"{\"content\":\"sadfsadfa\",\"extra\":\"www.baidu.com\"}", 10 | "objectName": "RC:TxtMsg" 11 | }, 12 | "notification":{"alert":"this is a push"} 13 | } 14 | 15 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/profile/CreateEntrustGroupModel.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.profile; 2 | 3 | /** 4 | * @author RongCloud 5 | */ 6 | public class CreateEntrustGroupModel extends EntrustGroupModel { 7 | 8 | private String[] userIds; 9 | 10 | public String[] getUserIds() { 11 | return userIds; 12 | } 13 | 14 | public CreateEntrustGroupModel setUserIds(String[] userIds) { 15 | this.userIds = userIds; 16 | return this; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/ResultData.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | /** 4 | * @author RongCloud 5 | */ 6 | public class ResultData extends ResponseResult{ 7 | 8 | private T data; 9 | 10 | 11 | public T getData() { 12 | return data; 13 | } 14 | 15 | public void setData(T data) { 16 | this.data = data; 17 | } 18 | 19 | public ResultData(Integer code, String msg) { 20 | super(code, msg); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/conversation/ConversationMuteModel.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.conversation; 2 | 3 | /** 4 | * @author RongCloud 5 | */ 6 | public class ConversationMuteModel { 7 | 8 | 9 | 10 | private Integer mute; 11 | 12 | 13 | public Integer getMute() { 14 | return mute; 15 | } 16 | 17 | public void setMute(Integer mute) { 18 | this.mute = mute; 19 | } 20 | 21 | public Integer getUnPushLevel() { 22 | return mute; 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/profile/PagingGetFriendsModel.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.profile; 2 | 3 | 4 | /** 5 | * @author RongCloud 6 | */ 7 | public class PagingGetFriendsModel extends PageModel { 8 | 9 | /** 10 | * The ID of the user performing the operation. 11 | */ 12 | private String userId; 13 | 14 | public String getUserId() { 15 | return userId; 16 | } 17 | 18 | public void setUserId(String userId) { 19 | this.userId = userId; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/user/RemarkModel.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.user; 2 | 3 | public class RemarkModel { 4 | private String id; 5 | private String remark; 6 | 7 | public String getId() { 8 | return id; 9 | } 10 | 11 | public void setId(String id) { 12 | this.id = id; 13 | } 14 | 15 | public String getRemark() { 16 | return remark; 17 | } 18 | 19 | public void setRemark(String remark) { 20 | this.remark = remark; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/io/rong/util/ParamNotNull.java: -------------------------------------------------------------------------------- 1 | package io.rong.util; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | 9 | /** 10 | * Annotation used to validate that the transmitted parameter is not null. 11 | * Created by star on 2017/12/20. 12 | * @version 13 | * @author hc 14 | */ 15 | @Target({ElementType.FIELD}) 16 | @Retention(RetentionPolicy.RUNTIME) 17 | public @interface ParamNotNull { 18 | 19 | } -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/GroupRemarkModel.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.models.Result; 4 | import io.rong.util.GsonUtil; 5 | 6 | public class GroupRemarkModel extends Result { 7 | private String remark; 8 | 9 | public String getRemark() { 10 | return remark; 11 | } 12 | 13 | public void setRemark(String remark) { 14 | this.remark = remark; 15 | } 16 | 17 | public String toString() { 18 | return GsonUtil.toJson(this, GroupRemarkModel.class); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/bot/SetChatbotIntegration.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.bot; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | public class SetChatbotIntegration extends ChatbotIntegration { 6 | private String userId; 7 | 8 | public String getUserId() { 9 | return userId; 10 | } 11 | 12 | public void setUserId(String userId) { 13 | this.userId = userId; 14 | } 15 | 16 | @Override 17 | public String toString() { 18 | return GsonUtil.toJson(this, SetChatbotIntegration.class); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/bot/ChatbotAuthInfo.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.bot; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | 6 | /** 7 | * @author RongCloud 8 | */ 9 | public class ChatbotAuthInfo { 10 | private String apiKey; 11 | 12 | public String getApiKey() { 13 | return apiKey; 14 | } 15 | 16 | public void setApiKey(String apiKey) { 17 | this.apiKey = apiKey; 18 | } 19 | 20 | @Override 21 | public String toString() { 22 | return GsonUtil.toJson(this, ChatbotAuthInfo.class); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/ChatMetadata.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | 4 | import io.rong.util.GsonUtil; 5 | 6 | 7 | /** 8 | * @author RongCloud 9 | */ 10 | public class ChatMetadata { 11 | 12 | private Usage usage; 13 | 14 | public Usage getUsage() { 15 | return usage; 16 | } 17 | 18 | public void setUsage(Usage usage) { 19 | this.usage = usage; 20 | } 21 | 22 | @Override 23 | public String toString() { 24 | return GsonUtil.toJson(this, ChatMetadata.class); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/ChatroomEntryListResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import java.util.List; 4 | 5 | import io.rong.models.Result; 6 | import io.rong.util.GsonUtil; 7 | 8 | /** 9 | * Response template for querying chatroom attributes 10 | * 11 | * @author RongCloud 12 | * 13 | */ 14 | public class ChatroomEntryListResult extends Result { 15 | 16 | public List keys; 17 | 18 | @Override 19 | public String toString() { 20 | return GsonUtil.toJson(this, ChatroomEntryListResult.class); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/test/java/io/rong/messages/GifMessageTest.java: -------------------------------------------------------------------------------- 1 | package io.rong.messages; 2 | 3 | 4 | import io.rong.util.GsonUtil; 5 | import org.junit.Assert; 6 | import org.junit.Test; 7 | 8 | 9 | /** 10 | * @author huhangtao 11 | * @date 2024/8/8 16:48 12 | */ 13 | public class GifMessageTest { 14 | 15 | @Test 16 | public void test() throws Exception { 17 | GifMessage gifMessage = new GifMessage(null, null, null, null, null); 18 | gifMessage.setExtra("ext"); 19 | Assert.assertEquals("{\"extra\":\"ext\"}", GsonUtil.toJson(gifMessage)); 20 | } 21 | } -------------------------------------------------------------------------------- /src/main/java/io/rong/models/group/GroupMemberCount.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.group; 2 | 3 | import io.rong.models.Result; 4 | import io.rong.util.GsonUtil; 5 | 6 | public class GroupMemberCount extends Result { 7 | 8 | private int memberCount; 9 | 10 | public int getMemberCount() { 11 | return memberCount; 12 | } 13 | 14 | public void setMemberCount(int memberCount) { 15 | this.memberCount = memberCount; 16 | } 17 | 18 | @Override 19 | public String toString() { 20 | return GsonUtil.toJson(this, GroupMemberCount.class); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/resources/jsonsource/message/TemplateMessage.json: -------------------------------------------------------------------------------- 1 | { 2 | "senderId": "OScHVP1tQ", 3 | "objectName": "RC:TxtMsg", 4 | "template": { 5 | "content": "{name}, Chinese score {score}" 6 | }, 7 | "content": { 8 | "NomSvNyME": { 9 | "data": { 10 | "{name}": "Xiaoming", 11 | "{score}": "90" 12 | }, 13 | "push": "{name} Your results are out" 14 | }, 15 | "8LNK7JOeR": { 16 | "data": { 17 | "{name}": "XiaoHong", 18 | "{score}": "95" 19 | }, 20 | "push": "{name} Your results are out" 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/GroupMuteWhitelistResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.models.Result; 4 | import io.rong.util.GsonUtil; 5 | 6 | public class GroupMuteWhitelistResult extends Result { 7 | private String[] userIds; 8 | 9 | public String[] getUserIds() { 10 | return userIds; 11 | } 12 | 13 | public void setUserIds(String[] userIds) { 14 | this.userIds = userIds; 15 | } 16 | 17 | @Override 18 | public String toString() { 19 | return GsonUtil.toJson(this, GroupBanWhitelistResult.class); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/conversation/ConversationTopModel.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.conversation; 2 | 3 | /** 4 | * @author RongCloud 5 | */ 6 | public class ConversationTopModel { 7 | 8 | 9 | public Boolean top; 10 | 11 | public Long topTime; 12 | 13 | public Boolean getTop() { 14 | return top; 15 | } 16 | 17 | public void setTop(Boolean top) { 18 | this.top = top; 19 | } 20 | 21 | public Long getTopTime() { 22 | return topTime; 23 | } 24 | 25 | public void setTopTime(Long topTime) { 26 | this.topTime = topTime; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/profile/PagingQueryMembersModel.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.profile; 2 | 3 | 4 | /** 5 | * @author RongCloud 6 | */ 7 | public class PagingQueryMembersModel extends PageModel { 8 | 9 | private String groupId; 10 | private Integer type; 11 | 12 | public String getGroupId() { 13 | return groupId; 14 | } 15 | 16 | public void setGroupId(String groupId) { 17 | this.groupId = groupId; 18 | } 19 | 20 | public Integer getType() { 21 | return type; 22 | } 23 | 24 | public void setType(Integer type) { 25 | this.type = type; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | server-sdk-java 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.eclipse.m2e.core.maven2Nature 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/group/GroupBanModel.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.group; 2 | 3 | import io.rong.models.Result; 4 | import io.rong.models.response.GroupBanInfo; 5 | import io.rong.util.GsonUtil; 6 | 7 | public class GroupBanModel extends Result { 8 | private GroupBanInfo[] groupinfo; 9 | 10 | public GroupBanInfo[] getGroupinfo() { 11 | return groupinfo; 12 | } 13 | 14 | public void setGroupinfo(GroupBanInfo[] groupinfo) { 15 | this.groupinfo = groupinfo; 16 | } 17 | 18 | @Override 19 | public String toString() { 20 | return GsonUtil.toJson(this, GroupBanModel.class); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/io/rong/messages/TypingStatusMessage.java: -------------------------------------------------------------------------------- 1 | package io.rong.messages; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | public class TypingStatusMessage extends BaseMessage { 6 | 7 | private String content = "{\"typingContentType\":\"RC:TxtMsg\"}"; 8 | private transient static final String TYPE = "RC:TypSts"; 9 | 10 | public TypingStatusMessage() { 11 | 12 | } 13 | 14 | @Override 15 | public String getType() { 16 | return TYPE; 17 | } 18 | 19 | public String getContent() { 20 | return content; 21 | } 22 | 23 | @Override 24 | public String toString() { 25 | return GsonUtil.toJson(this, TypingStatusMessage.class); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/user/GetTagModel.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.user; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | /** 6 | * Batch user tag information 7 | * 8 | */ 9 | public class GetTagModel { 10 | 11 | /** 12 | * User IDs, supports up to 50 users at a time. (Required) 13 | */ 14 | private String[] userIds; 15 | 16 | public String[] getUserIds() { 17 | return userIds; 18 | } 19 | 20 | public void setUserIds(String[] userIds) { 21 | this.userIds = userIds; 22 | } 23 | 24 | @Override 25 | public String toString() { 26 | return GsonUtil.toJson(this, GetTagModel.class); 27 | } 28 | } -------------------------------------------------------------------------------- /src/main/java/io/rong/models/ultragroup/UltraGroupBanModel.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.ultragroup; 2 | 3 | import io.rong.models.Result; 4 | import io.rong.models.response.GroupBanInfo; 5 | import io.rong.util.GsonUtil; 6 | 7 | public class UltraGroupBanModel extends Result { 8 | private GroupBanInfo[] groupinfo; 9 | 10 | public GroupBanInfo[] getGroupinfo() { 11 | return groupinfo; 12 | } 13 | 14 | public void setGroupinfo(GroupBanInfo[] groupinfo) { 15 | this.groupinfo = groupinfo; 16 | } 17 | 18 | @Override 19 | public String toString() { 20 | return GsonUtil.toJson(this, UltraGroupBanModel.class); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/resources/jsonsource/TemplateMessage.json: -------------------------------------------------------------------------------- 1 | { 2 | "fromUserId": "fromuser", 3 | "objectName": "RC:TxtMsg", 4 | "content": "{\"content\":\"{c}{d}{e}\",\"extra\":\"bb\"}", 5 | "toUserId": [ 6 | "21", 7 | "22" 8 | ], 9 | "values": [ 10 | { 11 | "{c}": "1", 12 | "{d}": "2", 13 | "{e}": "3" 14 | }, 15 | { 16 | "{c}": "4", 17 | "{d}": "5", 18 | "{e}": "6" 19 | } 20 | ], 21 | "pushContent": [ 22 | "push{c}", 23 | "push{c}" 24 | ], 25 | "pushData": [ 26 | "pushd", 27 | "pushd" 28 | ] 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/GetTagResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.models.Result; 4 | import io.rong.util.GsonUtil; 5 | 6 | /** 7 | * Result of getTag operation. 8 | */ 9 | public class GetTagResult extends Result { 10 | 11 | /** 12 | * Array of all tags associated with the user. 13 | */ 14 | private Object result; 15 | 16 | public Object getResult() { 17 | return result; 18 | } 19 | 20 | public void setResult(Object result) { 21 | this.result = result; 22 | } 23 | 24 | @Override 25 | public String toString() { 26 | return GsonUtil.toJson(this, GetTagResult.class); 27 | } 28 | } -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/RemarkNameResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | /** 6 | * Query Remark Name Result 7 | */ 8 | public class RemarkNameResult extends ResponseResult { 9 | 10 | // Remark Name 11 | String remarkName; 12 | 13 | public RemarkNameResult(Integer code, String msg) { 14 | super(code, msg); 15 | } 16 | 17 | public String getRemarkName() { 18 | return remarkName; 19 | } 20 | 21 | public void setRemarkName(String remarkName) { 22 | this.remarkName = remarkName; 23 | } 24 | 25 | @Override 26 | public String toString() { 27 | return GsonUtil.toJson(this, RemarkNameResult.class); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/GroupBanInfo.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | public class GroupBanInfo { 6 | private String groupId; 7 | private Integer stat; 8 | 9 | public String getGroupId() { 10 | return groupId; 11 | } 12 | 13 | public void setGroupId(String groupId) { 14 | this.groupId = groupId; 15 | } 16 | 17 | public Integer getStat() { 18 | return stat; 19 | } 20 | 21 | public void setStat(Integer stat) { 22 | this.stat = stat; 23 | } 24 | 25 | @Override 26 | public String toString() { 27 | return GsonUtil.toJson(this, GroupBanInfo.class); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/GroupUser.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | /** 6 | * Group user information. 7 | * @author RongCloud 8 | */ 9 | public class GroupUser { 10 | // User ID. 11 | String id; 12 | 13 | public GroupUser(String id) { 14 | this.id = id; 15 | } 16 | 17 | /** 18 | * Set the user ID. 19 | * 20 | */ 21 | public void setId(String id) { 22 | this.id = id; 23 | } 24 | 25 | /** 26 | * Get the user ID. 27 | * 28 | * @return String 29 | */ 30 | public String getId() { 31 | return id; 32 | } 33 | 34 | @Override 35 | public String toString() { 36 | return GsonUtil.toJson(this, GroupUser.class); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/FollowedMember.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | /** 4 | * Author: RongCloud 5 | */ 6 | public class FollowedMember { 7 | 8 | /** 9 | * Member ID of the followed user 10 | */ 11 | private String userId; 12 | /** 13 | * Timestamp when the user was followed 14 | */ 15 | private Long timestamp; 16 | 17 | public String getUserId() { 18 | return userId; 19 | } 20 | 21 | public void setUserId(String userId) { 22 | this.userId = userId; 23 | } 24 | 25 | public Long getTimestamp() { 26 | return timestamp; 27 | } 28 | 29 | public void setTimestamp(Long timestamp) { 30 | this.timestamp = timestamp; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/io/rong/exception/ParamError.java: -------------------------------------------------------------------------------- 1 | package io.rong.exception; 2 | 3 | import com.thoughtworks.xstream.annotations.XStreamAlias; 4 | 5 | @XStreamAlias("error") 6 | public class ParamError extends Error { 7 | public ParamError(int errorCode, String apiURL, String errorMessage) { 8 | super(errorCode, errorCode, apiURL, errorMessage); 9 | } 10 | 11 | public ParamError(int errorCode, int httpCode, String apiURL, 12 | String errorMessage) { 13 | super(errorCode, httpCode, apiURL, errorMessage); 14 | } 15 | 16 | public ParamError(String apiURL) { 17 | this(1002, 400, apiURL, "Missing parameters, please check."); 18 | } 19 | 20 | public ParamError(String apiURL, String message) { 21 | this(1002, 400, apiURL, message); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/CheckChatRoomUserResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.models.Result; 4 | import io.rong.util.GsonUtil; 5 | 6 | public class CheckChatRoomUserResult extends Result { 7 | public Boolean isInChrm; 8 | 9 | public CheckChatRoomUserResult(Integer code, Boolean isInChrm) { 10 | super(code, ""); 11 | this.isInChrm = isInChrm; 12 | } 13 | 14 | public Boolean getInChrm() { 15 | return this.isInChrm; 16 | } 17 | 18 | public void setInChrm(Boolean inChrm) { 19 | this.isInChrm = inChrm; 20 | } 21 | 22 | @Override 23 | public String toString() { 24 | return GsonUtil.toJson(this, CheckChatRoomUserResult.class); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/profile/PagingQueryUserProfilesModel.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.profile; 2 | 3 | 4 | /** 5 | * @author RongCloud 6 | */ 7 | public class PagingQueryUserProfilesModel { 8 | 9 | private int page; 10 | private int size; 11 | private int order; 12 | 13 | public int getPage() { 14 | return page; 15 | } 16 | 17 | public void setPage(int page) { 18 | this.page = page; 19 | } 20 | 21 | public int getSize() { 22 | return size; 23 | } 24 | 25 | public void setSize(int size) { 26 | this.size = size; 27 | } 28 | 29 | public int getOrder() { 30 | return order; 31 | } 32 | 33 | public void setOrder(int order) { 34 | this.order = order; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/ResponseResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.models.Result; 4 | import io.rong.util.GsonUtil; 5 | 6 | /** 7 | * HTTP success response result. 8 | */ 9 | public class ResponseResult extends Result { 10 | 11 | private String reqBody; 12 | 13 | public ResponseResult(Integer code, String msg) { 14 | super(code, msg); 15 | this.code = code; 16 | this.errorMessage = msg; 17 | } 18 | 19 | 20 | public String getReqBody() { 21 | return reqBody; 22 | } 23 | 24 | 25 | public void setReqBody(String reqBody) { 26 | this.reqBody = reqBody; 27 | } 28 | 29 | @Override 30 | public String toString() { 31 | return GsonUtil.toJson(this, ResponseResult.class); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/UserDeactivateResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.models.Result; 4 | 5 | import java.util.List; 6 | 7 | public class UserDeactivateResult extends Result { 8 | private List users; 9 | 10 | public List getUsers() { 11 | return users; 12 | } 13 | 14 | public void setUsers(List users) { 15 | this.users = users; 16 | } 17 | 18 | @Override 19 | public String toString() { 20 | return "UserAbandonResult{" + 21 | "code=" + code + 22 | ", errorMessage='" + errorMessage + '\'' + 23 | ", requestId='" + requestId + '\'' + 24 | ", users=" + users + 25 | '}'; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/ExtraContent.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.models.BlockUsers; 4 | import io.rong.util.GsonUtil; 5 | 6 | public class ExtraContent { 7 | 8 | String v; 9 | String ts; 10 | 11 | public ExtraContent(String v, String ts) { 12 | this.v = v; 13 | this.ts = ts; 14 | } 15 | 16 | public String getV() { 17 | return v; 18 | } 19 | 20 | public void setV(String v) { 21 | this.v = v; 22 | } 23 | 24 | public String getTs() { 25 | return ts; 26 | } 27 | 28 | public void setTs(String ts) { 29 | this.ts = ts; 30 | } 31 | @Override 32 | public String toString() { 33 | return GsonUtil.toJson(this, BlockUsers.class); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/resources/jsonsource/broadcast/verify.json: -------------------------------------------------------------------------------- 1 | { 2 | "broadcast": { 3 | "_self": { 4 | "require": { 5 | "must": true, 6 | "invalid": "20005" 7 | }, 8 | "typeof": { 9 | "type": "object", 10 | "invalid": "20001" 11 | } 12 | }, 13 | "fromUserId": { 14 | "require": { 15 | "must": true, 16 | "invalid": "20005" 17 | }, 18 | "length": { 19 | "max": 64, 20 | "min": 1, 21 | "invalid": "20003" 22 | } 23 | }, 24 | "objectName": { 25 | "require": { 26 | "must": true, 27 | "invalid": "20005" 28 | }, 29 | "length": { 30 | "max": 32, 31 | "min": 1, 32 | "invalid": "20003" 33 | } 34 | }, 35 | "message": { 36 | "require": { 37 | "must": true, 38 | "invalid": "20005" 39 | } 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/CheckFriendsResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | 4 | import io.rong.util.GsonUtil; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * @author RongCloud 10 | */ 11 | public class CheckFriendsResult extends PageResult { 12 | 13 | 14 | private List results; 15 | 16 | public CheckFriendsResult(Integer code, String msg) { 17 | super(code, msg); 18 | } 19 | 20 | public List getResults() { 21 | return results; 22 | } 23 | 24 | public void setResults(List results) { 25 | this.results = results; 26 | } 27 | 28 | @Override 29 | public String toString() { 30 | return GsonUtil.toJson(this, CheckFriendsResult.class); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/GroupBanResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.models.Result; 4 | import io.rong.models.group.GroupModel; 5 | import io.rong.util.GsonUtil; 6 | 7 | public class GroupBanResult extends Result { 8 | public GroupBanResult(Integer code, String errorMessage, GroupModel[] groups) { 9 | super(code, errorMessage); 10 | this.groups = groups; 11 | } 12 | 13 | private GroupModel[] groups; 14 | 15 | public GroupModel[] getGroups() { 16 | return groups; 17 | } 18 | 19 | public void setGroups(GroupModel[] groups) { 20 | this.groups = groups; 21 | } 22 | 23 | @Override 24 | public String toString() { 25 | return GsonUtil.toJson(this, GroupBanResult.class); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/QueryMembersResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * @author RongCloud 9 | */ 10 | public class QueryMembersResult extends ResponseResult { 11 | 12 | private List members; 13 | 14 | public QueryMembersResult(Integer code, String errorMessage) { 15 | super(code, errorMessage); 16 | } 17 | 18 | public List getMembers() { 19 | return members; 20 | } 21 | 22 | public void setMembers(List members) { 23 | this.members = members; 24 | } 25 | 26 | @Override 27 | public String toString() { 28 | return GsonUtil.toJson(this, QueryMembersResult.class); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/QueryUserProfilesResp.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | 4 | import io.rong.util.GsonUtil; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * @author RongCloud 10 | */ 11 | public class QueryUserProfilesResp extends ResponseResult { 12 | 13 | private List userList; 14 | 15 | public QueryUserProfilesResp(Integer code, String msg) { 16 | super(code, msg); 17 | } 18 | 19 | public List getUserList() { 20 | return userList; 21 | } 22 | 23 | public void setUserList(List userList) { 24 | this.userList = userList; 25 | } 26 | 27 | @Override 28 | public String toString() { 29 | return GsonUtil.toJson(this, QueryUserProfilesResp.class); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/profile/PageModel.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.profile; 2 | 3 | 4 | /** 5 | * @author RongCloud 6 | */ 7 | public class PageModel { 8 | 9 | private String pageToken; 10 | private Integer size; 11 | private Integer order; 12 | 13 | public String getPageToken() { 14 | return pageToken; 15 | } 16 | 17 | public void setPageToken(String pageToken) { 18 | this.pageToken = pageToken; 19 | } 20 | 21 | public Integer getSize() { 22 | return size; 23 | } 24 | 25 | public void setSize(Integer size) { 26 | this.size = size; 27 | } 28 | 29 | public Integer getOrder() { 30 | return order; 31 | } 32 | 33 | public void setOrder(Integer order) { 34 | this.order = order; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/ChatroomKeepaliveResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.models.Result; 4 | import io.rong.util.GsonUtil; 5 | 6 | public class ChatroomKeepaliveResult extends Result{ 7 | private String[] chatroomIds; 8 | 9 | public ChatroomKeepaliveResult(Integer code, String msg, String[] chatrooms) { 10 | super(code, msg); 11 | this.chatroomIds = chatrooms; 12 | } 13 | 14 | public String[] getChatroomIds() { 15 | return this.chatroomIds; 16 | } 17 | 18 | public void setChatroomIds(String[] chatroomIds) { 19 | this.chatroomIds = chatroomIds; 20 | } 21 | 22 | @Override 23 | public String toString() { 24 | return GsonUtil.toJson(this, ChatroomKeepaliveResult.class); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/message/Audit.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.message; 2 | 3 | /** 4 | * @author RongCloud 5 | */ 6 | public class Audit { 7 | 8 | private Integer auditType; 9 | private String strategy; 10 | 11 | public Audit(Integer auditType, String strategy) { 12 | this.auditType = auditType; 13 | this.strategy = strategy; 14 | } 15 | public Audit() { 16 | } 17 | 18 | public Integer getAuditType() { 19 | return auditType; 20 | } 21 | 22 | public void setAuditType(Integer auditType) { 23 | this.auditType = auditType; 24 | } 25 | 26 | public String getStrategy() { 27 | return strategy; 28 | } 29 | 30 | public void setStrategy(String strategy) { 31 | this.strategy = strategy; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/QueryFriendsResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | 4 | import io.rong.util.GsonUtil; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * @author RongCloud 10 | */ 11 | public class QueryFriendsResult extends PageResult { 12 | 13 | 14 | private List friendList; 15 | 16 | public QueryFriendsResult(Integer code, String msg) { 17 | super(code, msg); 18 | } 19 | 20 | public List getFriendList() { 21 | return friendList; 22 | } 23 | 24 | public void setFriendList(List friendList) { 25 | this.friendList = friendList; 26 | } 27 | 28 | @Override 29 | public String toString() { 30 | return GsonUtil.toJson(this, QueryFriendsResult.class); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/PagingQueryMembersResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * @author RongCloud 9 | */ 10 | public class PagingQueryMembersResult extends PageResult { 11 | 12 | private List members; 13 | 14 | public PagingQueryMembersResult(Integer code, String errorMessage) { 15 | super(code, errorMessage); 16 | } 17 | 18 | public List getMembers() { 19 | return members; 20 | } 21 | 22 | public void setMembers(List members) { 23 | this.members = members; 24 | } 25 | 26 | @Override 27 | public String toString() { 28 | return GsonUtil.toJson(this, PagingQueryMembersResult.class); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/group/UserGroup.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.group; 2 | 3 | /** 4 | * @author RongCloud 5 | */ 6 | public class UserGroup { 7 | 8 | private String id; 9 | private GroupModel[] groups; 10 | 11 | public UserGroup() { 12 | } 13 | 14 | public UserGroup(String id, GroupModel[] groups) { 15 | this.id = id; 16 | this.groups = groups; 17 | } 18 | 19 | public String getId() { 20 | return this.id; 21 | } 22 | 23 | public UserGroup setId(String id) { 24 | this.id = id; 25 | return this; 26 | } 27 | 28 | public GroupModel[] getGroups() { 29 | return this.groups; 30 | } 31 | 32 | public UserGroup setGroups(GroupModel[] groups) { 33 | this.groups = groups; 34 | return this; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/QueryChatbotsResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | 4 | import io.rong.models.bot.ChatbotInfoModel; 5 | import io.rong.util.GsonUtil; 6 | 7 | import java.util.List; 8 | 9 | 10 | /** 11 | * @author RongCloud 12 | */ 13 | public class QueryChatbotsResult extends ResponseResult { 14 | private List bots; 15 | 16 | public List getBots() { 17 | return bots; 18 | } 19 | 20 | public void setBots(List bots) { 21 | this.bots = bots; 22 | } 23 | 24 | public QueryChatbotsResult(Integer code, String msg) { 25 | super(code, msg); 26 | } 27 | 28 | @Override 29 | public String toString() { 30 | return GsonUtil.toJson(this, QueryChatbotsResult.class); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/profile/QueryJoinedGroupsModel.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.profile; 2 | 3 | 4 | /** 5 | * @author RongCloud 6 | */ 7 | public class QueryJoinedGroupsModel extends PageModel { 8 | 9 | /** 10 | * User ID 11 | */ 12 | private String userId; 13 | /** 14 | * Group role type: 15 | * 0: All (default) 16 | * 1: Group Owner 17 | * 2: Group Administrator 18 | * 3: Regular Group Member 19 | */ 20 | private Integer role; 21 | 22 | public String getUserId() { 23 | return userId; 24 | } 25 | 26 | public void setUserId(String userId) { 27 | this.userId = userId; 28 | } 29 | 30 | public Integer getRole() { 31 | return role; 32 | } 33 | 34 | public void setRole(Integer role) { 35 | this.role = role; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/PagingQueryJoinedGroupsResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * @author RongCloud 9 | */ 10 | public class PagingQueryJoinedGroupsResult extends PageResult { 11 | 12 | private List groups; 13 | 14 | public PagingQueryJoinedGroupsResult(Integer code, String errorMessage) { 15 | super(code, errorMessage); 16 | } 17 | 18 | public List getGroups() { 19 | return groups; 20 | } 21 | 22 | public void setGroups(List groups) { 23 | this.groups = groups; 24 | } 25 | 26 | @Override 27 | public String toString() { 28 | return GsonUtil.toJson(this, PagingQueryJoinedGroupsResult.class); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/GroupMuteAllMembersListResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.models.Result; 4 | import io.rong.models.group.GroupModel; 5 | import io.rong.util.GsonUtil; 6 | 7 | public class GroupMuteAllMembersListResult extends Result { 8 | public GroupMuteAllMembersListResult(Integer code, String errorMessage, GroupModel[] groups) { 9 | super(code, errorMessage); 10 | this.groups = groups; 11 | } 12 | 13 | private GroupModel[] groups; 14 | 15 | public GroupModel[] getGroups() { 16 | return groups; 17 | } 18 | 19 | public void setGroups(GroupModel[] groups) { 20 | this.groups = groups; 21 | } 22 | 23 | @Override 24 | public String toString() { 25 | return GsonUtil.toJson(this, GroupMuteAllMembersListResult.class); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/BlockPushPeriodResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.models.user.BlockPushPeriodModel; 4 | import io.rong.util.GsonUtil; 5 | 6 | /** 7 | * @author jinyuhe 8 | * @date 2022/07/22 9 | */ 10 | public class BlockPushPeriodResult extends ResponseResult{ 11 | private BlockPushPeriodModel data; 12 | 13 | public BlockPushPeriodResult(Integer code, String msg, BlockPushPeriodModel data) { 14 | super(code, msg); 15 | this.data = data; 16 | } 17 | 18 | public BlockPushPeriodModel getData() { 19 | return data; 20 | } 21 | 22 | public void setData(BlockPushPeriodModel data) { 23 | this.data = data; 24 | } 25 | 26 | @Override 27 | public String toString() { 28 | return GsonUtil.toJson(this, BlockPushPeriodResult.class); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/BroadcastResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | /** 6 | * Push notification response result. 7 | */ 8 | public class BroadcastResult extends ResponseResult { 9 | 10 | /** 11 | * The Message UID of the broadcast message. 12 | */ 13 | private String messageUID; 14 | 15 | 16 | public BroadcastResult(Integer code, String msg) { 17 | super(code, msg); 18 | } 19 | 20 | 21 | public String getMessageUID() { 22 | return messageUID; 23 | } 24 | 25 | public BroadcastResult setMessageUID(String messageUID) { 26 | this.messageUID = messageUID; 27 | return this; 28 | } 29 | 30 | @Override 31 | public String toString() { 32 | return GsonUtil.toJson(this, BroadcastResult.class); 33 | } 34 | 35 | 36 | } -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/OperationGroupResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | /** 6 | * Operation group returns results 7 | */ 8 | public class OperationGroupResult extends ResponseResult { 9 | 10 | /** 11 | * Message UID. 12 | */ 13 | private String messageUID; 14 | 15 | public OperationGroupResult(Integer code, String errorMessage) { 16 | super(code, errorMessage); 17 | } 18 | 19 | public String getMessageUID() { 20 | return messageUID; 21 | } 22 | 23 | public OperationGroupResult setMessageUID(String messageUID) { 24 | this.messageUID = messageUID; 25 | return this; 26 | } 27 | 28 | @Override 29 | public String toString() { 30 | return GsonUtil.toJson(this, OperationGroupResult.class); 31 | } 32 | 33 | 34 | } -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/GetPermissionResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | 4 | import io.rong.util.GsonUtil; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * @author RongCloud 10 | */ 11 | public class GetPermissionResult extends PageResult { 12 | 13 | 14 | private List permissionSettings; 15 | 16 | public GetPermissionResult(Integer code, String msg) { 17 | super(code, msg); 18 | } 19 | 20 | public List getPermissionSettings() { 21 | return permissionSettings; 22 | } 23 | 24 | public void setPermissionSettings(List permissionSettings) { 25 | this.permissionSettings = permissionSettings; 26 | } 27 | 28 | @Override 29 | public String toString() { 30 | return GsonUtil.toJson(this, GetPermissionResult.class); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/GroupMuteAllMembersCheckResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.models.Result; 4 | import io.rong.models.group.GroupModel; 5 | import io.rong.util.GsonUtil; 6 | 7 | public class GroupMuteAllMembersCheckResult extends Result { 8 | public GroupMuteAllMembersCheckResult(Integer code, String errorMessage, GroupModel[] groups) { 9 | super(code, errorMessage); 10 | this.groups = groups; 11 | } 12 | 13 | private GroupModel[] groups; 14 | 15 | public GroupModel[] getGroups() { 16 | return groups; 17 | } 18 | 19 | public void setGroups(GroupModel[] groups) { 20 | this.groups = groups; 21 | } 22 | 23 | @Override 24 | public String toString() { 25 | return GsonUtil.toJson(this, GroupMuteAllMembersCheckResult.class); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/ultragroup/UserUltraGroup.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.ultragroup; 2 | 3 | /** 4 | * @author RongCloud 5 | */ 6 | public class UserUltraGroup { 7 | 8 | private String id; 9 | private UltraGroupModel[] groups; 10 | 11 | public UserUltraGroup() { 12 | } 13 | 14 | public UserUltraGroup(String id, UltraGroupModel[] groups) { 15 | this.id = id; 16 | this.groups = groups; 17 | } 18 | 19 | public String getId() { 20 | return this.id; 21 | } 22 | 23 | public UserUltraGroup setId(String id) { 24 | this.id = id; 25 | return this; 26 | } 27 | 28 | public UltraGroupModel[] getGroups() { 29 | return this.groups; 30 | } 31 | 32 | public UserUltraGroup setGroups(UltraGroupModel[] groups) { 33 | this.groups = groups; 34 | return this; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/Usage.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | public class Usage { 4 | private Integer promptTokens; 5 | private Integer completionTokens; 6 | private Integer totalTokens; 7 | 8 | public Integer getPromptTokens() { 9 | return promptTokens; 10 | } 11 | 12 | public void setPromptTokens(Integer promptTokens) { 13 | this.promptTokens = promptTokens; 14 | } 15 | 16 | public Integer getCompletionTokens() { 17 | return completionTokens; 18 | } 19 | 20 | public void setCompletionTokens(Integer completionTokens) { 21 | this.completionTokens = completionTokens; 22 | } 23 | 24 | public Integer getTotalTokens() { 25 | return totalTokens; 26 | } 27 | 28 | public void setTotalTokens(Integer totalTokens) { 29 | this.totalTokens = totalTokens; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/user/UserIdListModel.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.user; 2 | 3 | import io.rong.models.Result; 4 | import io.rong.util.GsonUtil; 5 | 6 | import java.util.List; 7 | 8 | public class UserIdListModel extends Result { 9 | private List members; 10 | 11 | public UserIdListModel(Integer code, String errorMessage, List members) { 12 | super(code, errorMessage); 13 | this.members = members; 14 | } 15 | 16 | public UserIdListModel(List members) { 17 | this.members = members; 18 | } 19 | 20 | public List getMembers() { 21 | return members; 22 | } 23 | 24 | public void setMembers(List members) { 25 | this.members = members; 26 | } 27 | 28 | @Override 29 | public String toString() { 30 | return GsonUtil.toJson(this, UserIdListModel.class); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/PermissionSetting.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | /** 4 | * @author RongCloud 5 | */ 6 | public class PermissionSetting { 7 | /** 8 | * User ID. 9 | */ 10 | String userId; 11 | /** 12 | * 0: Not set (default), in this state, the friend request permission set at the App Key level applies 13 | * 1: Allow anyone to add as a friend directly 14 | * 2: Require user approval to add as a friend 15 | * 3: Do not allow anyone to add as a friend 16 | */ 17 | String type; 18 | 19 | public String getUserId() { 20 | return userId; 21 | } 22 | 23 | public void setUserId(String userId) { 24 | this.userId = userId; 25 | } 26 | 27 | public String getType() { 28 | return type; 29 | } 30 | 31 | public void setType(String type) { 32 | this.type = type; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/QueryHistoryMessageResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | import java.util.ArrayList; 6 | import java.util.List; 7 | 8 | /** 9 | * Query history message 10 | */ 11 | public class QueryHistoryMessageResult extends ResponseResult { 12 | 13 | private List data = new ArrayList<>(); 14 | 15 | public QueryHistoryMessageResult(Integer code, String errorMessage) { 16 | super(code, errorMessage); 17 | } 18 | 19 | public List getData() { 20 | return data; 21 | } 22 | 23 | public QueryHistoryMessageResult setData(List data) { 24 | this.data = data; 25 | return this; 26 | } 27 | 28 | @Override 29 | public String toString() { 30 | return GsonUtil.toJson(this, QueryHistoryMessageResult.class); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/io/rong/CenterEnum.java: -------------------------------------------------------------------------------- 1 | package io.rong; 2 | 3 | public enum CenterEnum { 4 | 5 | BJ("https://api.rong-api.com", "https://api-b.rong-api.com"), 6 | SG("https://api.sg-light-api.com", "https://api-b.sg-light-api.com"), 7 | SG_B("https://api.sg-b-light-api.com", "https://api-b.sg-b-light-api.com"), 8 | NA("https://api.us-light-api.com", "https://api-b.us-light-api.com"), 9 | SAU("https://api.sau-light-api.com", "https://api-b.sau-light-api.com"), 10 | ; 11 | 12 | 13 | private final String primaryUrl; 14 | private final String backupUrl; 15 | 16 | CenterEnum(String primaryUrl, String backupUrl) { 17 | this.primaryUrl = primaryUrl; 18 | this.backupUrl = backupUrl; 19 | } 20 | 21 | public String getPrimaryUrl() { 22 | return primaryUrl; 23 | } 24 | 25 | public String getBackupUrl() { 26 | return backupUrl; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/resources/jsonsource/user/online-status/api.json: -------------------------------------------------------------------------------- 1 | { 2 | "check": { 3 | 4 | "url": "user/checkOnline", 5 | "params": { 6 | "user": { 7 | "id": "aFo990k" 8 | } 9 | }, 10 | "response": { 11 | "success": { 12 | "code": 200, 13 | "status": 1 14 | }, 15 | "fail": { 16 | "20003": { 17 | "code": "1002", 18 | "errorMessage": "{{name}} length exceeds limit, {{name}} >= {{min}} and {{name}} <= {{max}} Units: bytes" 19 | }, 20 | "20005": { 21 | "code": "1002", 22 | "errorMessage": "Parameter id is required" 23 | }, 24 | "20001": { 25 | "code": "1002", 26 | "errorMessage": "The parameter type is incorrect. Please check the parameter type. It should be passed in as {{currentType}}" 27 | }, 28 | "1004": { 29 | "code": "1004", 30 | "errorMessage": "Signature error. Please check whether Appkey and Secret are correct." 31 | } 32 | } 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/ChatroomDemotionMsgResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.models.Result; 4 | import io.rong.util.GsonUtil; 5 | 6 | public class ChatroomDemotionMsgResult extends Result{ 7 | 8 | private String[] objectNames; 9 | 10 | public ChatroomDemotionMsgResult(Integer code, String msg, String[] objectNames) { 11 | super(code, msg); 12 | this.objectNames = objectNames; 13 | } 14 | 15 | public ChatroomDemotionMsgResult(String[] objectNames) { 16 | this.objectNames = objectNames; 17 | } 18 | 19 | public String[] getObjectNames() { 20 | return this.objectNames; 21 | } 22 | 23 | public void setObjectNames(String[] objectNames) { 24 | this.objectNames = objectNames; 25 | } 26 | 27 | @Override 28 | public String toString() { 29 | return GsonUtil.toJson(this, ChatroomDemotionMsgResult.class); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/CheckStatusResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.models.Result; 4 | import io.rong.util.GsonUtil; 5 | 6 | /** 7 | * CheckStatusResult 8 | */ 9 | public class CheckStatusResult extends Result { 10 | 11 | // Mute or other statuses 12 | String status; 13 | 14 | public CheckStatusResult(Integer code, String status, String errorMessage) { 15 | super(code, errorMessage); 16 | this.code = code; 17 | this.status = status; 18 | this.errorMessage = errorMessage; 19 | } 20 | /** 21 | * Set the status 22 | * 23 | */ 24 | public void setStatus(String status) { 25 | this.status = status; 26 | } 27 | 28 | /** 29 | * Get the status 30 | * 31 | * @return String 32 | */ 33 | public String getStatus() { 34 | return status; 35 | } 36 | 37 | @Override 38 | public String toString() { 39 | return GsonUtil.toJson(this, CheckStatusResult.class); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/PageResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | /** 6 | * @author RongCloud 7 | */ 8 | public class PageResult extends ResponseResult { 9 | 10 | private Integer totalCount; 11 | private String pageToken; 12 | 13 | public PageResult(Integer code, String errorMessage) { 14 | super(code, errorMessage); 15 | } 16 | 17 | public Integer getTotalCount() { 18 | return totalCount; 19 | } 20 | 21 | public void setTotalCount(Integer totalCount) { 22 | this.totalCount = totalCount; 23 | } 24 | 25 | public String getPageToken() { 26 | return pageToken; 27 | } 28 | 29 | public void setPageToken(String pageToken) { 30 | this.pageToken = pageToken; 31 | } 32 | 33 | @Override 34 | public String toString() { 35 | return GsonUtil.toJson(this, PageResult.class); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/QueryGroupProfilesResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | 4 | import io.rong.models.profile.EntrustGroupProfileModel; 5 | import io.rong.util.GsonUtil; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @author RongCloud 11 | */ 12 | public class QueryGroupProfilesResult extends ResponseResult { 13 | 14 | private List profiles; 15 | 16 | public QueryGroupProfilesResult(Integer code, String msg) { 17 | super(code, msg); 18 | } 19 | 20 | public List getProfiles() { 21 | return profiles; 22 | } 23 | 24 | public QueryGroupProfilesResult setProfiles(List profiles) { 25 | this.profiles = profiles; 26 | return this; 27 | } 28 | 29 | @Override 30 | public String toString() { 31 | return GsonUtil.toJson(this, QueryGroupProfilesResult.class); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/WhiteListResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.models.Result; 4 | import io.rong.models.user.UserModel; 5 | import io.rong.util.GsonUtil; 6 | 7 | /** 8 | * @author RongCloud 9 | */ 10 | public class WhiteListResult extends Result{ 11 | 12 | private UserModel[] members; 13 | 14 | public WhiteListResult(Integer code, String msg, UserModel[] members) { 15 | super(code, msg); 16 | this.members = members; 17 | } 18 | 19 | public WhiteListResult(UserModel[] members) { 20 | this.members = members; 21 | } 22 | 23 | public UserModel[] getMembers() { 24 | return this.members; 25 | } 26 | 27 | public void setMembers(UserModel[] members) { 28 | this.members = members; 29 | } 30 | 31 | @Override 32 | public String toString() { 33 | return GsonUtil.toJson(this, WhiteListResult.class); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/agent/AgentConfig.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.agent; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | 6 | /** 7 | * @author RongCloud 8 | */ 9 | public class AgentConfig { 10 | 11 | private Model model; 12 | private Prompt prompt; 13 | private Memory memory; 14 | 15 | public Model getModel() { 16 | return model; 17 | } 18 | 19 | public void setModel(Model model) { 20 | this.model = model; 21 | } 22 | 23 | public Prompt getPrompt() { 24 | return prompt; 25 | } 26 | 27 | public void setPrompt(Prompt prompt) { 28 | this.prompt = prompt; 29 | } 30 | 31 | public Memory getMemory() { 32 | return memory; 33 | } 34 | 35 | public void setMemory(Memory memory) { 36 | this.memory = memory; 37 | } 38 | 39 | @Override 40 | public String toString() { 41 | return GsonUtil.toJson(this, AgentConfig.class); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/user/TagModel.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.user; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | /** 6 | * User tag information 7 | * 8 | */ 9 | public class TagModel { 10 | 11 | /** 12 | * User ID. (Required) 13 | */ 14 | private String userId; 15 | 16 | /** 17 | * User tags. A user can add up to 20 tags, each tag cannot exceed 40 bytes, and tags cannot contain special characters. (Required) 18 | */ 19 | private String[] tags; 20 | 21 | public String getUserId() { 22 | return userId; 23 | } 24 | 25 | public void setUserId(String userId) { 26 | this.userId = userId; 27 | } 28 | 29 | public String[] getTags() { 30 | return tags; 31 | } 32 | 33 | public void setTags(String[] tags) { 34 | this.tags = tags; 35 | } 36 | 37 | @Override 38 | public String toString() { 39 | return GsonUtil.toJson(this, TagModel.class); 40 | } 41 | } -------------------------------------------------------------------------------- /src/main/java/io/rong/models/agent/Model.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.agent; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | /** 6 | * @author RongCloud 7 | */ 8 | public class Model { 9 | private String provider; 10 | private String name; 11 | private ModelOptions options; 12 | 13 | public String getProvider() { 14 | return provider; 15 | } 16 | 17 | public void setProvider(String provider) { 18 | this.provider = provider; 19 | } 20 | 21 | public String getName() { 22 | return name; 23 | } 24 | 25 | public void setName(String name) { 26 | this.name = name; 27 | } 28 | 29 | public ModelOptions getOptions() { 30 | return options; 31 | } 32 | 33 | public void setOptions(ModelOptions options) { 34 | this.options = options; 35 | } 36 | 37 | @Override 38 | public String toString() { 39 | return GsonUtil.toJson(this, Model.class); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/BatchAddSensitiveWordResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.models.Result; 4 | import io.rong.util.GsonUtil; 5 | 6 | /** 7 | * Batch add sensitive words 8 | */ 9 | public class BatchAddSensitiveWordResult extends Result { 10 | 11 | /** 12 | * Remaining quota 13 | */ 14 | private Integer remainQuota; 15 | 16 | public BatchAddSensitiveWordResult(Integer code, String msg) { 17 | super(code, msg); 18 | this.code = code; 19 | this.errorMessage = msg; 20 | } 21 | 22 | public Integer getRemainQuota() { 23 | return remainQuota; 24 | } 25 | 26 | public BatchAddSensitiveWordResult setRemainQuota(Integer remainQuota) { 27 | this.remainQuota = remainQuota; 28 | return this; 29 | } 30 | 31 | @Override 32 | public String toString() { 33 | return GsonUtil.toJson(this, BatchAddSensitiveWordResult.class); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/io/rong/messages/BaseMessage.java: -------------------------------------------------------------------------------- 1 | package io.rong.messages; 2 | 3 | import io.rong.models.message.Audit; 4 | import io.rong.models.message.MentionedInfo; 5 | 6 | /** 7 | * 8 | * Base class for messages. If you want to implement a custom message, you can inherit from this class. 9 | * 10 | **/ 11 | public abstract class BaseMessage { 12 | 13 | protected MentionedInfo mentionedInfo; 14 | /** 15 | * 16 | * The audit configuration of the message. 17 | * 18 | **/ 19 | protected Audit audit; 20 | 21 | public abstract String getType(); 22 | 23 | @Override 24 | public abstract String toString(); 25 | 26 | public MentionedInfo getMentionedInfo() { 27 | return mentionedInfo; 28 | } 29 | 30 | public void setMentionedInfo(MentionedInfo mentionedInfo) { 31 | this.mentionedInfo = mentionedInfo; 32 | } 33 | 34 | public Audit getAudit() { 35 | return audit; 36 | } 37 | 38 | public void setAudit(Audit audit) { 39 | this.audit = audit; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/io/rong/messages/CustomTxtMessage.java: -------------------------------------------------------------------------------- 1 | package io.rong.messages; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | /** 6 | * 7 | * Custom message 8 | * 9 | */ 10 | public class CustomTxtMessage extends BaseMessage { 11 | private String content = ""; 12 | private transient static final String TYPE = "RC:TxtMsg"; 13 | 14 | public CustomTxtMessage(String content) { 15 | this.content = content; 16 | } 17 | @Override 18 | public String getType() { 19 | return TYPE; 20 | } 21 | 22 | /** 23 | * Retrieves the content of the custom message. 24 | * 25 | * @return String 26 | */ 27 | public String getContent() { 28 | return content; 29 | } 30 | 31 | /** 32 | * @param content Sets the content of the custom message. 33 | * 34 | * 35 | */ 36 | public void setContent(String content) { 37 | this.content = content; 38 | } 39 | 40 | @Override 41 | public String toString() { 42 | return GsonUtil.toJson(this, CustomTxtMessage.class); 43 | } 44 | } -------------------------------------------------------------------------------- /src/main/java/io/rong/models/push/BroadcastModel.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.push; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | /** 6 | * Broadcast message body. 7 | */ 8 | public class BroadcastModel extends BroadcastPushPublicPart { 9 | 10 | /** 11 | * The sender's user ID. (Required) 12 | */ 13 | private String fromuserid; 14 | 15 | /** 16 | * The message content to be sent. (Required) 17 | */ 18 | private Message message; 19 | 20 | public String getFromuserid() { 21 | return fromuserid; 22 | } 23 | 24 | public void setFromuserid(String fromuserid) { 25 | this.fromuserid = fromuserid; 26 | } 27 | 28 | public Message getMessage() { 29 | return message; 30 | } 31 | 32 | public void setMessage(Message message) { 33 | this.message = message; 34 | } 35 | 36 | @Override 37 | public String toString() { 38 | return GsonUtil.toJson(this, BroadcastModel.class); 39 | } 40 | } -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/CheckOnlineResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.models.Result; 4 | import io.rong.util.GsonUtil; 5 | 6 | /** 7 | * Result of checking online user status 8 | */ 9 | public class CheckOnlineResult extends Result { 10 | 11 | // User online status, 1 for online, 0 for offline. 12 | String status; 13 | 14 | public CheckOnlineResult(Integer code, String status, String errorMessage) { 15 | super(code, errorMessage); 16 | this.code = code; 17 | this.status = status; 18 | this.errorMessage = errorMessage; 19 | } 20 | /** 21 | * Set the status 22 | * 23 | */ 24 | public void setStatus(String status) { 25 | this.status = status; 26 | } 27 | 28 | /** 29 | * Get the status 30 | * 31 | * @return String 32 | */ 33 | public String getStatus() { 34 | return status; 35 | } 36 | 37 | @Override 38 | public String toString() { 39 | return GsonUtil.toJson(this, CheckOnlineResult.class); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/SMSVerifyCodeResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.models.Result; 4 | import io.rong.util.GsonUtil; 5 | 6 | /** 7 | * SMS verification code result. 8 | */ 9 | public class SMSVerifyCodeResult extends Result { 10 | // Indicates whether the verification is successful: true for success, false for failure. 11 | Boolean success; 12 | 13 | public SMSVerifyCodeResult(Integer code, Boolean success, String errorMessage) { 14 | super(code, errorMessage); 15 | this.code = code; 16 | this.success = success; 17 | this.errorMessage = errorMessage; 18 | } 19 | public void setSuccess(Boolean success) { 20 | this.success = success; 21 | } 22 | 23 | /** 24 | * Get the success status. 25 | * 26 | * @return Boolean 27 | */ 28 | public Boolean getSuccess() { 29 | return success; 30 | } 31 | 32 | @Override 33 | public String toString() { 34 | return GsonUtil.toJson(this, SMSVerifyCodeResult.class); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/UserList.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | public class UserList { 6 | /** 7 | * Response code, 200 indicates success. 8 | * 9 | */ 10 | private Integer code; 11 | /** 12 | * Blocklist user list 13 | */ 14 | private String[] users; 15 | 16 | 17 | public UserList(Integer code, String[] users) { 18 | this.code = code; 19 | this.users = users; 20 | } 21 | 22 | public String[] getUsers() { 23 | return this.users; 24 | } 25 | 26 | public void setUsers(String[] users) { 27 | this.users = users; 28 | } 29 | 30 | public Integer getCode() { 31 | return this.code; 32 | } 33 | 34 | public void setCode(Integer code) { 35 | this.code = code; 36 | } 37 | 38 | @Override 39 | public String toString() { 40 | return GsonUtil.toJson(this, UserList.class); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/BlockUserResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.models.BlockUsers; 4 | import io.rong.models.Result; 5 | import io.rong.util.GsonUtil; 6 | 7 | import java.util.List; 8 | 9 | public class BlockUserResult extends Result { 10 | // List of banned users. 11 | List users; 12 | 13 | public BlockUserResult(Integer code, String errorMessage, List users) { 14 | super(code, errorMessage); 15 | this.users = users; 16 | } 17 | /** 18 | * Set users 19 | * 20 | */ 21 | public void setUsers(List users) { 22 | this.users = users; 23 | } 24 | 25 | /** 26 | * Get users 27 | * 28 | * @return List 29 | */ 30 | public List getUsers() { 31 | return users; 32 | } 33 | @Override 34 | public String toString() { 35 | return GsonUtil.toJson(this, BlockUserResult.class); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/MessageResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * Push notification response result. 9 | */ 10 | public class MessageResult extends ResponseResult { 11 | 12 | /** 13 | * List of Message UIDs for one-to-one chat, group chat, chatroom, and ultra group messages. 14 | */ 15 | private List messageUIDs; 16 | 17 | public MessageResult(Integer code, String errorMessage) { 18 | super(code, errorMessage); 19 | } 20 | 21 | 22 | public List getMessageUIDs() { 23 | return messageUIDs; 24 | } 25 | 26 | public MessageResult setMessageUIDs(List messageUIDs) { 27 | this.messageUIDs = messageUIDs; 28 | return this; 29 | } 30 | 31 | @Override 32 | public String toString() { 33 | return GsonUtil.toJson(this, MessageResult.class); 34 | } 35 | 36 | 37 | } -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/CheckFriendResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | /** 4 | * @author RongCloud 5 | */ 6 | public class CheckFriendResult { 7 | /** 8 | * User ID 9 | */ 10 | private String userId; 11 | /** 12 | * Unidirectional check result: 13 | * 1: Not in my friend list 14 | * 2: In my friend list 15 | * Bidirectional check result: 16 | * 1: In both users' friend lists 17 | * 2: Not in both users' friend lists 18 | * 3: Only in the current user's friend list 19 | * 4: Only in the target user's friend list 20 | */ 21 | private Integer result; 22 | 23 | public String getUserId() { 24 | return userId; 25 | } 26 | 27 | public void setUserId(String userId) { 28 | this.userId = userId; 29 | } 30 | 31 | public Integer getResult() { 32 | return result; 33 | } 34 | 35 | public void setResult(Integer result) { 36 | this.result = result; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/profile/GroupRemarkNameModel.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.profile; 2 | 3 | 4 | /** 5 | * @author RongCloud 6 | */ 7 | public class GroupRemarkNameModel { 8 | 9 | /** 10 | * Group ID 11 | */ 12 | private String groupId; 13 | /** 14 | * User ID 15 | */ 16 | private String userId; 17 | /** 18 | * Group member nickname 19 | */ 20 | private String remarkName; 21 | 22 | 23 | public String getGroupId() { 24 | return groupId; 25 | } 26 | 27 | public void setGroupId(String groupId) { 28 | this.groupId = groupId; 29 | } 30 | 31 | public String getUserId() { 32 | return userId; 33 | } 34 | 35 | public void setUserId(String userId) { 36 | this.userId = userId; 37 | } 38 | 39 | public String getRemarkName() { 40 | return remarkName; 41 | } 42 | 43 | public void setRemarkName(String remarkName) { 44 | this.remarkName = remarkName; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/agent/Memory.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.agent; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | 6 | /** 7 | * @author RongCloud 8 | */ 9 | public class Memory { 10 | private String strategy; 11 | private Integer maxMessages; 12 | private Integer maxTokens; 13 | 14 | public String getStrategy() { 15 | return strategy; 16 | } 17 | 18 | public void setStrategy(String strategy) { 19 | this.strategy = strategy; 20 | } 21 | 22 | public Integer getMaxMessages() { 23 | return maxMessages; 24 | } 25 | 26 | public void setMaxMessages(Integer maxMessages) { 27 | this.maxMessages = maxMessages; 28 | } 29 | 30 | public Integer getMaxTokens() { 31 | return maxTokens; 32 | } 33 | 34 | public void setMaxTokens(Integer maxTokens) { 35 | this.maxTokens = maxTokens; 36 | } 37 | 38 | @Override 39 | public String toString() { 40 | return GsonUtil.toJson(this, Memory.class); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/ChatroomBanListResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.models.Result; 4 | import io.rong.util.GsonUtil; 5 | 6 | public class ChatroomBanListResult extends Result{ 7 | 8 | private String[] chatroomIds; 9 | private String reqBody; 10 | 11 | public ChatroomBanListResult(Integer code, String msg, String[] chatroomIds) { 12 | super(code, msg); 13 | this.chatroomIds = chatroomIds; 14 | } 15 | 16 | public String[] getChatroomIds() { 17 | return this.chatroomIds; 18 | } 19 | 20 | public void setChatroomIds(String[] chatroomIds) { 21 | this.chatroomIds = chatroomIds; 22 | } 23 | 24 | public String getReqBody() { 25 | return reqBody; 26 | } 27 | 28 | public void setReqBody(String reqBody) { 29 | this.reqBody = reqBody; 30 | } 31 | 32 | @Override 33 | public String toString() { 34 | return GsonUtil.toJson(this, ChatroomBanListResult.class); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/StatusResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.models.Result; 4 | import io.rong.util.GsonUtil; 5 | 6 | /** 7 | * HTTP success response with status information. 8 | */ 9 | public class StatusResult extends Result { 10 | 11 | private String status; 12 | private String reqBody; 13 | 14 | public StatusResult(Integer code, String msg) { 15 | super(code, msg); 16 | this.code = code; 17 | this.errorMessage = msg; 18 | } 19 | 20 | public String getStatus() { 21 | return status; 22 | } 23 | 24 | public void setStatus(String status) { 25 | this.status = status; 26 | } 27 | 28 | public String getReqBody() { 29 | return reqBody; 30 | } 31 | 32 | 33 | public void setReqBody(String reqBody) { 34 | this.reqBody = reqBody; 35 | } 36 | 37 | @Override 38 | public String toString() { 39 | return GsonUtil.toJson(this, StatusResult.class); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/conversation/UserConversationTagModel.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.conversation; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * @author RongCloud 7 | */ 8 | public class UserConversationTagModel { 9 | 10 | private String userId; 11 | 12 | private List tags; 13 | 14 | 15 | public UserConversationTagModel() { 16 | } 17 | 18 | public UserConversationTagModel(String userId, List tags) { 19 | this.userId = userId; 20 | this.tags = tags; 21 | } 22 | 23 | public String getUserId() { 24 | return userId; 25 | } 26 | 27 | public UserConversationTagModel setUserId(String userId) { 28 | this.userId = userId; 29 | return this; 30 | } 31 | 32 | public List getTags() { 33 | return tags; 34 | } 35 | 36 | public UserConversationTagModel setTags(List tags) { 37 | this.tags = tags; 38 | return this; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/user/BatchTagModel.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.user; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | /** 6 | * Batch user tag information 7 | * 8 | */ 9 | public class BatchTagModel { 10 | 11 | /** 12 | * User IDs, up to 1000 users supported at once. (Required) 13 | */ 14 | private String[] userIds; 15 | 16 | /** 17 | * User tags, each user can have up to 20 tags, each tag cannot exceed 40 bytes, and tags cannot contain special characters. (Required) 18 | */ 19 | private String[] tags; 20 | 21 | public String[] getUserIds() { 22 | return userIds; 23 | } 24 | 25 | public void setUserIds(String[] userIds) { 26 | this.userIds = userIds; 27 | } 28 | 29 | public String[] getTags() { 30 | return tags; 31 | } 32 | 33 | public void setTags(String[] tags) { 34 | this.tags = tags; 35 | } 36 | 37 | @Override 38 | public String toString() { 39 | return GsonUtil.toJson(this, BatchTagModel.class); 40 | } 41 | } -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/SMSSendCodeResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.models.Result; 4 | import io.rong.util.GsonUtil; 5 | 6 | /** 7 | * SMSSendCodeResult is the successful response result. 8 | */ 9 | public class SMSSendCodeResult extends Result { 10 | // The unique identifier of the SMS verification code. 11 | String sessionId; 12 | 13 | public SMSSendCodeResult(Integer code, String sessionId, String errorMessage) { 14 | super(code, errorMessage); 15 | this.code = code; 16 | this.sessionId = sessionId; 17 | this.errorMessage = errorMessage; 18 | } 19 | 20 | /** 21 | * Set the sessionId. 22 | * 23 | */ 24 | public void setSessionId(String sessionId) { 25 | this.sessionId = sessionId; 26 | } 27 | 28 | /** 29 | * Get the sessionId. 30 | * 31 | * @return String 32 | */ 33 | public String getSessionId() { 34 | return sessionId; 35 | } 36 | 37 | @Override 38 | public String toString() { 39 | return GsonUtil.toJson(this, SMSSendCodeResult.class); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/message/MentionMessageContent.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.message; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | 5 | import io.rong.messages.BaseMessage; 6 | 7 | /** 8 | * @author RongCloud 9 | */ 10 | public class MentionMessageContent { 11 | private BaseMessage content; 12 | 13 | public MentionMessageContent(BaseMessage content, MentionedInfo mentionedInfo) { 14 | this.content = content; 15 | this.content.setMentionedInfo(mentionedInfo); 16 | } 17 | 18 | public BaseMessage getContent() { 19 | return this.content; 20 | } 21 | 22 | public void setContent(BaseMessage content) { 23 | this.content = content; 24 | } 25 | 26 | @Override 27 | public String toString(){ 28 | JSONObject jsonObject = new JSONObject(); 29 | if (content != null) { 30 | jsonObject = JSONObject.parseObject(content.toString()); 31 | return jsonObject.toJSONString(); 32 | } 33 | return jsonObject.toJSONString(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/GroupBanWhitelistResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.models.Result; 4 | import io.rong.util.GsonUtil; 5 | 6 | public class GroupBanWhitelistResult extends Result { 7 | private String[] userIds; 8 | private String reqBody; 9 | 10 | public String[] getUserIds() { 11 | return userIds; 12 | } 13 | 14 | public void setUserIds(String[] userIds) { 15 | this.userIds = userIds; 16 | } 17 | 18 | public String getReqBody() { 19 | return reqBody; 20 | } 21 | 22 | public void setReqBody(String reqBody) { 23 | this.reqBody = reqBody; 24 | } 25 | 26 | public GroupBanWhitelistResult(){ 27 | 28 | } 29 | 30 | public GroupBanWhitelistResult(Integer code, String msg) { 31 | super(code, msg); 32 | this.code = code; 33 | this.errorMessage = msg; 34 | } 35 | 36 | @Override 37 | public String toString() { 38 | return GsonUtil.toJson(this, GroupBanWhitelistResult.class); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/io/rong/util/GsonUtil.java: -------------------------------------------------------------------------------- 1 | package io.rong.util; 2 | 3 | import java.io.Reader; 4 | import java.lang.reflect.Type; 5 | 6 | import com.google.gson.Gson; 7 | import com.google.gson.GsonBuilder; 8 | import com.google.gson.ToNumberPolicy; 9 | 10 | public class GsonUtil { 11 | 12 | private static Gson gson = new GsonBuilder().setObjectToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE).disableHtmlEscaping().create(); 13 | 14 | public static String toJson(Object obj) { 15 | return gson.toJson(obj); 16 | } 17 | 18 | public static String toJson(Object obj, Type type) { 19 | return gson.toJson(obj, type); 20 | } 21 | 22 | public static Object fromJson(String str, Type type) { 23 | return gson.fromJson(str, type); 24 | } 25 | public static T fromJson(Class clazz,String json) { 26 | return gson.fromJson(json, clazz); 27 | } 28 | 29 | public static Object fromJson(Reader reader, Type type) { 30 | return gson.fromJson(reader, type); 31 | } 32 | 33 | private GsonUtil() {} 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/PagingQueryGroupsResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * @author RongCloud 9 | */ 10 | public class PagingQueryGroupsResult extends ResponseResult { 11 | 12 | private String pageToken; 13 | private List groups; 14 | 15 | public PagingQueryGroupsResult(Integer code, String errorMessage) { 16 | super(code, errorMessage); 17 | } 18 | 19 | public String getPageToken() { 20 | return pageToken; 21 | } 22 | 23 | public PagingQueryGroupsResult setPageToken(String pageToken) { 24 | this.pageToken = pageToken; 25 | return this; 26 | } 27 | 28 | public List getGroups() { 29 | return groups; 30 | } 31 | 32 | public void setGroups(List groups) { 33 | this.groups = groups; 34 | } 35 | 36 | @Override 37 | public String toString() { 38 | return GsonUtil.toJson(this, PagingQueryGroupsResult.class); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/message/MentionedInfo.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.message; 2 | 3 | /** 4 | * 5 | * @author RongCloud 6 | */ 7 | public class MentionedInfo { 8 | private int type; 9 | private String[] userIdList; 10 | private String mentionedContent; 11 | 12 | public MentionedInfo(int type, String[] userIds, String mentionedContent) { 13 | this.type = type; 14 | this.userIdList = userIds; 15 | this.mentionedContent = mentionedContent; 16 | } 17 | 18 | public int getType() { 19 | return this.type; 20 | } 21 | 22 | public void setType(int type) { 23 | this.type = type; 24 | } 25 | 26 | public String[] getUserIdList() { 27 | return this.userIdList; 28 | } 29 | 30 | public void setUserIdList(String[] userIdList) { 31 | this.userIdList = userIdList; 32 | } 33 | 34 | public String getMentionedContent() { 35 | return this.mentionedContent; 36 | } 37 | 38 | public void setMentionedContent(String mentionedContent) { 39 | this.mentionedContent = mentionedContent; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/QueryGroupManagersResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * @author RongCloud 9 | */ 10 | public class QueryGroupManagersResult extends ResponseResult { 11 | 12 | private String groupId; 13 | 14 | private List managers; 15 | 16 | public QueryGroupManagersResult(Integer code, String msg) { 17 | super(code, msg); 18 | } 19 | 20 | public String getGroupId() { 21 | return groupId; 22 | } 23 | 24 | public QueryGroupManagersResult setGroupId(String groupId) { 25 | this.groupId = groupId; 26 | return this; 27 | } 28 | 29 | public List getManagers() { 30 | return managers; 31 | } 32 | 33 | public QueryGroupManagersResult setManagers(List managers) { 34 | this.managers = managers; 35 | return this; 36 | } 37 | 38 | @Override 39 | public String toString() { 40 | return GsonUtil.toJson(this, QueryGroupManagersResult.class); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/GagGroupUser.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | /** 6 | * Group user ban information. 7 | * @author RongCloud 8 | */ 9 | public class GagGroupUser { 10 | // Unban time. 11 | String time; 12 | // Group member ID. 13 | String id; 14 | 15 | public GagGroupUser(String time, String id) { 16 | this.time = time; 17 | this.id = id; 18 | } 19 | 20 | /** 21 | * Set the unban time. 22 | * 23 | */ 24 | public GagGroupUser setTime(String time) { 25 | this.time = time; 26 | return this; 27 | } 28 | 29 | /** 30 | * Get the unban time. 31 | * 32 | * @return String 33 | */ 34 | public String getTime() { 35 | return time; 36 | } 37 | 38 | /** 39 | * Get the user ID. 40 | * 41 | * @return String 42 | */ 43 | public String getId() { 44 | return this.id; 45 | } 46 | 47 | /** 48 | * Set the user ID. 49 | * 50 | */ 51 | public void setId(String id) { 52 | this.id = id; 53 | } 54 | 55 | @Override 56 | public String toString() { 57 | return GsonUtil.toJson(this, GagGroupUser.class); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/SetManagersResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | 4 | import io.rong.util.GsonUtil; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Result of setting group administrators 10 | * @author RongCloud 11 | */ 12 | public class SetManagersResult extends ResponseResult { 13 | 14 | private List userIds; 15 | private Integer managerCount; 16 | 17 | public SetManagersResult(Integer code, String msg) { 18 | super(code, msg); 19 | } 20 | 21 | public List getUserIds() { 22 | return userIds; 23 | } 24 | 25 | public SetManagersResult setUserIds(List userIds) { 26 | this.userIds = userIds; 27 | return this; 28 | } 29 | 30 | public Integer getManagerCount() { 31 | return managerCount; 32 | } 33 | 34 | public SetManagersResult setManagerCount(Integer managerCount) { 35 | this.managerCount = managerCount; 36 | return this; 37 | } 38 | 39 | @Override 40 | public String toString() { 41 | return GsonUtil.toJson(this, SetManagersResult.class); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/BlockUsers.java: -------------------------------------------------------------------------------- 1 | package io.rong.models; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | /** 6 | * Banned user information 7 | */ 8 | public class BlockUsers { 9 | // The ID of the banned user. 10 | String id; 11 | // The end time of the ban. 12 | String blockEndTime; 13 | 14 | public BlockUsers(String id, String blockEndTime) { 15 | this.id = id; 16 | this.blockEndTime = blockEndTime; 17 | } 18 | 19 | /** 20 | * Get the user ID. 21 | * 22 | * @return String 23 | */ 24 | public String getId() { 25 | return this.id; 26 | } 27 | /** 28 | * Set the user ID. 29 | * 30 | */ 31 | public void setId(String id) { 32 | this.id = id; 33 | } 34 | 35 | /** 36 | * Set the ban end time. 37 | * 38 | */ 39 | public void setBlockEndTime(String blockEndTime) { 40 | this.blockEndTime = blockEndTime; 41 | } 42 | 43 | /** 44 | * Get the ban end time. 45 | * 46 | * @return String 47 | */ 48 | public String getBlockEndTime() { 49 | return blockEndTime; 50 | } 51 | 52 | @Override 53 | public String toString() { 54 | return GsonUtil.toJson(this, BlockUsers.class); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/io/rong/exception/ParamException.java: -------------------------------------------------------------------------------- 1 | package io.rong.exception; 2 | 3 | 4 | 5 | public class ParamException extends RcloudException{ 6 | 7 | private static final long serialVersionUID = -5021603276540528761L; 8 | 9 | public ParamException(){ 10 | this.error = new ParamError("/"); 11 | } 12 | 13 | public ParamException(String message, Throwable e) { 14 | super(new ParamError("/",message).toString(),e); 15 | this.error = new ParamError("/",message); 16 | } 17 | 18 | public ParamException(Throwable e){ 19 | super(e); 20 | this.error = new ParamError("/"); 21 | } 22 | 23 | public ParamException(String message){ 24 | super(message); 25 | this.error = new ParamError("/",message); 26 | } 27 | 28 | public ParamException(int errorCode, String apiUrl, String message){ 29 | super(new ParamError(errorCode,apiUrl,message).toString()); 30 | this.error = new ParamError(errorCode,apiUrl,message); 31 | 32 | } 33 | 34 | 35 | @Override 36 | public Throwable fillInStackTrace() { 37 | return this; 38 | } 39 | } 40 | 41 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Rong Cloud 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/PagingQueryWhitelistResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * @author RongCloud 9 | */ 10 | public class PagingQueryWhitelistResult extends ResponseResult { 11 | /** 12 | * List of users in the allowlist. 13 | */ 14 | private List users; 15 | 16 | /** 17 | * Page token. If present, it indicates there is more data to fetch in the next request. 18 | */ 19 | private String next; 20 | 21 | public PagingQueryWhitelistResult(Integer code, String msg) { 22 | super(code, msg); 23 | } 24 | 25 | public List getUsers() { 26 | return users; 27 | } 28 | 29 | public void setUsers(List users) { 30 | this.users = users; 31 | } 32 | 33 | public String getNext() { 34 | return next; 35 | } 36 | 37 | public void setNext(String next) { 38 | this.next = next; 39 | } 40 | 41 | @Override 42 | public String toString() { 43 | return GsonUtil.toJson(this, PagingQueryWhitelistResult.class); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/io/rong/example/group/RemarkExample.java: -------------------------------------------------------------------------------- 1 | package io.rong.example.group; 2 | 3 | import io.rong.CenterEnum; 4 | import io.rong.RongCloud; 5 | import io.rong.models.Result; 6 | 7 | /** 8 | * Demo class 9 | * 10 | * @author RongCloud 11 | * 12 | */ 13 | public class RemarkExample { 14 | /** 15 | * Replace with your App Key 16 | */ 17 | private static final String appKey = "appKey"; 18 | /** 19 | * Replace with your App Secret 20 | */ 21 | private static final String appSecret = "appSecret"; 22 | 23 | public static void main(String[] args) throws Exception { 24 | RongCloud rongCloud = RongCloud.getInstance(appKey, appSecret, CenterEnum.BJ); 25 | 26 | Result result = rongCloud.group.remark.set("userId", "groupId", "remark"); 27 | 28 | System.out.println("set remark: " + result.toString()); 29 | 30 | result = rongCloud.group.remark.del("userId", "groupId1"); 31 | 32 | System.out.println("del remark: " + result.toString()); 33 | 34 | result = rongCloud.group.remark.get("abc", "abcaa"); 35 | 36 | System.out.println("get remark: " + result.toString()); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/CommonConstrants.java: -------------------------------------------------------------------------------- 1 | package io.rong.models; 2 | 3 | public class CommonConstrants { 4 | public static final int RCLOUD_TESTUSERS_OUT= 20008; // Exceeded the limit of test users. Please apply for additional quota. 5 | public static final int RCLOUD_SIGN_ERROR= 20000; // Signature error. Please verify the App Key and Secret. 6 | public static final int RCLOUD_FREQUENCY_OUT = 20001; // Exceeded the frequency limit. "20002= {{name}} count exceeds the limit, {{name}} >= {{min}} and {{name}} <= {{max}}" 7 | public static final int RCLOUD_LEN_OUT = 20003; // Exceeded the maximum length of userId (64 bytes). 8 | public static final int RCLOUD_BAN_TIMEOUT = 20004; // Invalid ban duration. The minute value must be >= 1 and <= 43200 (in minutes). 9 | public static final int RCLOUD_PARAM_NULL = 1002; // Parameter error. Required field is missing. 10 | public static final int RCLOUD_PARAM_ERROR= 20006; // "{{name}} parameter is incorrect. Expected type: {{type}}, but got {{currentType}}." 11 | public static final int RCLOUD_ADDRESS_ILLEGAL= 20007; // "{{name}} is not a valid address. Please verify the correctness of {{name}}." 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/ListGagGroupUserResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.models.Result; 4 | import io.rong.util.GsonUtil; 5 | import java.util.List; 6 | 7 | /** 8 | * The result of listing gag group users. 9 | */ 10 | public class ListGagGroupUserResult extends Result { 11 | // List of muted users in the group. 12 | List members; 13 | 14 | public ListGagGroupUserResult(Integer code, String msg, List members) { 15 | super(code, msg); 16 | this.members = members; 17 | } 18 | 19 | public ListGagGroupUserResult(List members) { 20 | this.members = members; 21 | } 22 | 23 | /** 24 | * Get the list of muted users. 25 | 26 | * @return List 27 | */ 28 | public List getMembers() { 29 | return this.members; 30 | } 31 | 32 | /** 33 | * Set the list of muted users. 34 | 35 | */ 36 | public void setMembers(List members) { 37 | this.members = members; 38 | } 39 | 40 | @Override 41 | public String toString() { 42 | return GsonUtil.toJson(this, ListGagGroupUserResult.class); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/PagingQueryBlacklistResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * @author RongCloud 9 | */ 10 | public class PagingQueryBlacklistResult extends ResponseResult { 11 | /** 12 | * List of users in the blocklist 13 | */ 14 | private List users; 15 | 16 | /** 17 | * Pagination token. If present, indicates there are more results to fetch in the next request. 18 | */ 19 | private String next; 20 | 21 | public PagingQueryBlacklistResult(Integer code, String msg) { 22 | super(code, msg); 23 | } 24 | 25 | public List getUsers() { 26 | return users; 27 | } 28 | 29 | public void setUsers(List users) { 30 | this.users = users; 31 | } 32 | 33 | public String getNext() { 34 | return next; 35 | } 36 | 37 | public void setNext(String next) { 38 | this.next = next; 39 | } 40 | 41 | @Override 42 | public String toString() { 43 | return GsonUtil.toJson(this, PagingQueryBlacklistResult.class); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/user/ExpireModel.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.user; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | public class ExpireModel { 6 | 7 | /** 8 | * The user IDs for which the Token needs to be invalidated. Supports up to 20 user IDs. 9 | */ 10 | private String[] userId; 11 | 12 | /** 13 | * The expiration timestamp in milliseconds. Tokens obtained before this timestamp will be invalidated. Users already connected with a Token obtained before this timestamp will not be immediately disconnected but will be unable to reconnect after disconnection. 14 | */ 15 | private long time; 16 | 17 | public String[] getUserId() { 18 | return userId; 19 | } 20 | 21 | public ExpireModel setUserId(String[] userId) { 22 | this.userId = userId; 23 | return this; 24 | } 25 | 26 | public Long getTime() { 27 | return time; 28 | } 29 | 30 | public ExpireModel setTime(long time) { 31 | this.time = time; 32 | return this; 33 | } 34 | 35 | @Override 36 | public String toString() { 37 | return GsonUtil.toJson(this, ExpireModel.class); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/FollowedMemberResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | import java.util.ArrayList; 6 | import java.util.List; 7 | 8 | /** 9 | * Query result for group member aliases 10 | */ 11 | public class FollowedMemberResult extends ResponseResult{ 12 | 13 | private String userId; 14 | private String groupId; 15 | private List members = new ArrayList<>(); 16 | 17 | public FollowedMemberResult(Integer code, String msg) { 18 | super(code, msg); 19 | } 20 | 21 | public String getUserId() { 22 | return userId; 23 | } 24 | 25 | public void setUserId(String userId) { 26 | this.userId = userId; 27 | } 28 | 29 | public String getGroupId() { 30 | return groupId; 31 | } 32 | 33 | public void setGroupId(String groupId) { 34 | this.groupId = groupId; 35 | } 36 | 37 | public List getMembers() { 38 | return members; 39 | } 40 | 41 | public void setMembers(List members) { 42 | this.members = members; 43 | } 44 | 45 | @Override 46 | public String toString() { 47 | return GsonUtil.toJson(this, FollowedMemberResult.class); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/GroupMuteMembersListResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.models.Result; 4 | import io.rong.util.GsonUtil; 5 | 6 | import java.util.List; 7 | 8 | public class GroupMuteMembersListResult extends Result { 9 | // List of muted users in the group. 10 | List members; 11 | 12 | public GroupMuteMembersListResult(Integer code, String msg, List members) { 13 | super(code, msg); 14 | this.members = members; 15 | } 16 | 17 | public GroupMuteMembersListResult(List members) { 18 | this.members = members; 19 | } 20 | 21 | /** 22 | * Get the list of muted members. 23 | * 24 | * @return List 25 | */ 26 | public List getMembers() { 27 | return this.members; 28 | } 29 | 30 | /** 31 | * Set the list of muted members. 32 | * 33 | */ 34 | public void setMembers(List members) { 35 | this.members = members; 36 | } 37 | 38 | @Override 39 | public String toString() { 40 | return GsonUtil.toJson(this, GroupMuteMembersListResult.class); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/user/BlockPushPeriodModel.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.user; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | /** 6 | * 7 | * User Do Not Disturb Settings 8 | * */ 9 | public class BlockPushPeriodModel { 10 | 11 | private String id; 12 | private String startTime; 13 | private Integer period; 14 | private Integer level = 1; 15 | 16 | public String getId() { 17 | return id; 18 | } 19 | 20 | public void setId(String id) { 21 | this.id = id; 22 | } 23 | 24 | public String getStartTime() { 25 | return startTime; 26 | } 27 | 28 | public void setStartTime(String startTime) { 29 | this.startTime = startTime; 30 | } 31 | 32 | public Integer getPeriod() { 33 | return period; 34 | } 35 | 36 | public void setPeriod(Integer period) { 37 | this.period = period; 38 | } 39 | 40 | public Integer getLevel() { 41 | return level; 42 | } 43 | 44 | public void setLevel(Integer level) { 45 | this.level = level; 46 | } 47 | 48 | @Override 49 | public String toString() { 50 | return GsonUtil.toJson(this, BlockPushPeriodModel.class); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/CheckChatRoomUsersResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.models.Result; 4 | import io.rong.util.GsonUtil; 5 | 6 | import java.util.List; 7 | 8 | public class CheckChatRoomUsersResult extends Result { 9 | 10 | private List result; 11 | 12 | public List getResult() { 13 | return result; 14 | } 15 | 16 | public void setResult(List result) { 17 | this.result = result; 18 | } 19 | 20 | @Override 21 | public String toString() { 22 | return GsonUtil.toJson(this, CheckChatRoomUsersResult.class); 23 | } 24 | 25 | 26 | static class ChatRoomUserInChrm{ 27 | private String userId; 28 | private int isInChrm; 29 | 30 | public String getUserId() { 31 | return userId; 32 | } 33 | 34 | public void setUserId(String userId) { 35 | this.userId = userId; 36 | } 37 | 38 | public int getIsInChrm() { 39 | return isInChrm; 40 | } 41 | 42 | public void setIsInChrm(int isInChrm) { 43 | this.isInChrm = isInChrm; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/GagChatRoomUser.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | /** 6 | * Information about a muted user in a chatroom. 7 | * @author RongCloud 8 | */ 9 | public class GagChatRoomUser { 10 | // The unmute time. 11 | String time; 12 | // The ID of the muted user. 13 | String userId; 14 | 15 | public GagChatRoomUser(String time, String userId) { 16 | this.time = time; 17 | this.userId = userId; 18 | } 19 | 20 | /** 21 | * Set the unmute time. 22 | * 23 | */ 24 | public GagChatRoomUser setTime(String time) { 25 | this.time = time; 26 | return this; 27 | } 28 | 29 | /** 30 | * Get the unmute time. 31 | * 32 | * @return String 33 | */ 34 | public String getTime() { 35 | return time; 36 | } 37 | 38 | /** 39 | * Set the user ID. 40 | * 41 | */ 42 | public GagChatRoomUser setUserId(String userId) { 43 | this.userId = userId; 44 | return this; 45 | } 46 | 47 | /** 48 | * Get the user ID. 49 | * 50 | * @return String 51 | */ 52 | public String getUserId() { 53 | return userId; 54 | } 55 | 56 | @Override 57 | public String toString() { 58 | return GsonUtil.toJson(this, GagChatRoomUser.class); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/test/java/io/rong/models/push/PlatformNotificationTest.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.push; 2 | 3 | import io.rong.util.GsonUtil; 4 | import org.junit.Assert; 5 | import org.junit.Test; 6 | 7 | /** 8 | * @author huhangtao 9 | * @date 2024/8/8 18:43 10 | */ 11 | public class PlatformNotificationTest { 12 | 13 | @Test 14 | public void testBuild() { 15 | PlatformNotification platformNotification = new PlatformNotification(); 16 | platformNotification.setInterruptionLevel("passive"); 17 | platformNotification.setThreadId("thread-id"); 18 | PlatformNotification.Platform platform = new PlatformNotification.Platform(); 19 | platform.setCategory("test"); 20 | platform.setCollapseKey("collapse_key"); 21 | platform.setLargeIconUri("large_icon_uri"); 22 | platformNotification.setHw(platform); 23 | Assert.assertEquals("{\"thread-id\":\"thread-id\",\"interruption-level\":\"passive\",\"hw\":{\"large_icon_uri\":\"large_icon_uri\",\"collapse_key\":\"collapse_key\",\"category\":\"test\"}}", GsonUtil.toJson(platformNotification)); 24 | platform.setNotifyLevel(1); 25 | Assert.assertTrue( GsonUtil.toJson(platformNotification).contains("\"notify_level\":1")); 26 | } 27 | } -------------------------------------------------------------------------------- /src/main/java/io/rong/models/profile/MemberInfoModel.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.profile; 2 | 3 | 4 | /** 5 | * @author RongCloud 6 | */ 7 | public class MemberInfoModel { 8 | 9 | /** 10 | * Group ID 11 | */ 12 | private String groupId; 13 | /** 14 | * User ID 15 | */ 16 | private String userId; 17 | /** 18 | * Group member nickname 19 | */ 20 | private String nickname; 21 | /** 22 | * Additional information 23 | */ 24 | private String extra; 25 | 26 | 27 | public String getGroupId() { 28 | return groupId; 29 | } 30 | 31 | public void setGroupId(String groupId) { 32 | this.groupId = groupId; 33 | } 34 | 35 | public String getUserId() { 36 | return userId; 37 | } 38 | 39 | public void setUserId(String userId) { 40 | this.userId = userId; 41 | } 42 | 43 | public String getNickname() { 44 | return nickname; 45 | } 46 | 47 | public void setNickname(String nickname) { 48 | this.nickname = nickname; 49 | } 50 | 51 | public String getExtra() { 52 | return extra; 53 | } 54 | 55 | public void setExtra(String extra) { 56 | this.extra = extra; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/BlackListResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.models.Result; 4 | import io.rong.models.User; 5 | import io.rong.models.user.UserModel; 6 | import io.rong.util.GsonUtil; 7 | 8 | /** 9 | * @author RongCloud 10 | */ 11 | public class BlackListResult extends Result { 12 | /** 13 | * Blocklist user list 14 | */ 15 | UserModel[] users; 16 | 17 | public BlackListResult(Integer code, String errorMessage) { 18 | super(code, errorMessage); 19 | } 20 | 21 | public BlackListResult(Integer code, String msg, UserModel[] users) { 22 | super(code, msg); 23 | this.users = users; 24 | } 25 | 26 | public BlackListResult(UserModel[] users) { 27 | this.users = users; 28 | } 29 | 30 | /** 31 | * Get users 32 | * 33 | * @return User[] 34 | */ 35 | public UserModel[] getUsers() { 36 | return this.users; 37 | } 38 | /** 39 | * Set users 40 | * 41 | */ 42 | public void setUsers(UserModel[] users) { 43 | this.users = users; 44 | } 45 | 46 | @Override 47 | public String toString() { 48 | return GsonUtil.toJson(this, BlackListResult.class); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/BlockChatRoomUser.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | /** 6 | * Information of a banned user in the chatroom. 7 | * @author RongCloud 8 | */ 9 | public class BlockChatRoomUser { 10 | // The user ID in the chatroom. 11 | String userId; 12 | // The time when the user joined the chatroom. 13 | String time; 14 | 15 | public BlockChatRoomUser(String userId, String time) { 16 | this.userId = userId; 17 | this.time = time; 18 | } 19 | 20 | /** 21 | * Sets the userId. 22 | * 23 | */ 24 | public BlockChatRoomUser setUserId(String userId) { 25 | this.userId = userId; 26 | return this; 27 | } 28 | 29 | /** 30 | * Gets the userId. 31 | * 32 | * @return String 33 | */ 34 | public String getUserId() { 35 | return userId; 36 | } 37 | 38 | /** 39 | * Sets the time. 40 | * 41 | */ 42 | public BlockChatRoomUser setTime(String time) { 43 | this.time = time; 44 | return this; 45 | } 46 | 47 | /** 48 | * Gets the time. 49 | * 50 | * @return String 51 | */ 52 | public String getTime() { 53 | return time; 54 | } 55 | 56 | @Override 57 | public String toString() { 58 | return GsonUtil.toJson(this, BlockChatRoomUser.class); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/user/BanModel.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.user; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | public class BanModel { 6 | 7 | /** 8 | * The ID of the banned user. Supports batch setting, with a maximum of 1000 users. 9 | */ 10 | private String[] userId; 11 | /** 12 | * The ban status: 0 to unban, 1 to ban. 13 | */ 14 | private Integer state; 15 | /** 16 | * The conversation type, currently supports one-to-one chat PERSON. 17 | */ 18 | private String type; 19 | 20 | public String[] getUserId() { 21 | return userId; 22 | } 23 | 24 | public BanModel setUserId(String[] userId) { 25 | this.userId = userId; 26 | return this; 27 | } 28 | 29 | public Integer getState() { 30 | return state; 31 | } 32 | 33 | public BanModel setState(int state) { 34 | this.state = state; 35 | return this; 36 | } 37 | 38 | public String getType() { 39 | return type; 40 | } 41 | 42 | public BanModel setType(String type) { 43 | this.type = type; 44 | return this; 45 | } 46 | 47 | @Override 48 | public String toString() { 49 | return GsonUtil.toJson(this, BanModel.class); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/PWhiteListResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.models.Result; 4 | import io.rong.models.user.UserModel; 5 | import io.rong.util.GsonUtil; 6 | 7 | /** 8 | * @author RongCloud 9 | */ 10 | public class PWhiteListResult extends Result { 11 | /** 12 | * List of users in the one-to-one chat allowlist. 13 | */ 14 | UserModel[] users; 15 | 16 | public PWhiteListResult(Integer code, String errorMessage) { 17 | super(code, errorMessage); 18 | } 19 | 20 | public PWhiteListResult(Integer code, String msg, UserModel[] users) { 21 | super(code, msg); 22 | this.users = users; 23 | } 24 | 25 | public PWhiteListResult(UserModel[] users) { 26 | this.users = users; 27 | } 28 | 29 | /** 30 | * Get the users. 31 | * 32 | * @return User[] 33 | */ 34 | public UserModel[] getUsers() { 35 | return this.users; 36 | } 37 | /** 38 | * Set the users. 39 | * 40 | */ 41 | public void setUsers(UserModel[] users) { 42 | this.users = users; 43 | } 44 | 45 | @Override 46 | public String toString() { 47 | return GsonUtil.toJson(this, PWhiteListResult.class); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/PagingQueryChatbotsResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | 4 | import io.rong.models.bot.ChatbotInfoModel; 5 | import io.rong.util.GsonUtil; 6 | 7 | import java.util.List; 8 | 9 | 10 | /** 11 | * @author RongCloud 12 | */ 13 | public class PagingQueryChatbotsResult extends ResponseResult { 14 | private Integer total; 15 | private Boolean hasNext; 16 | private List bots; 17 | 18 | 19 | public Integer getTotal() { 20 | return total; 21 | } 22 | 23 | public void setTotal(Integer total) { 24 | this.total = total; 25 | } 26 | 27 | public Boolean getHasNext() { 28 | return hasNext; 29 | } 30 | 31 | public void setHasNext(Boolean hasNext) { 32 | this.hasNext = hasNext; 33 | } 34 | 35 | public List getBots() { 36 | return bots; 37 | } 38 | 39 | public void setBots(List bots) { 40 | this.bots = bots; 41 | } 42 | 43 | public PagingQueryChatbotsResult(Integer code, String msg) { 44 | super(code, msg); 45 | } 46 | 47 | @Override 48 | public String toString() { 49 | return GsonUtil.toJson(this, PagingQueryChatbotsResult.class); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/user/BanListModel.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.user; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | public class BanListModel { 6 | 7 | /** 8 | * Number of rows to fetch, default is 100, maximum supported is 200. 9 | */ 10 | private Integer num = 100; 11 | /** 12 | * Starting position for query, default is 0. 13 | */ 14 | private Integer offset = 0; 15 | /** 16 | * Conversation type, currently supports one-to-one chat PERSON. 17 | */ 18 | private String type; 19 | 20 | public Integer getNum() { 21 | return num; 22 | } 23 | 24 | public BanListModel setNum(Integer num) { 25 | this.num = num; 26 | return this; 27 | } 28 | 29 | public Integer getOffset() { 30 | return offset; 31 | } 32 | 33 | public BanListModel setOffset(Integer offset) { 34 | this.offset = offset; 35 | return this; 36 | } 37 | 38 | public String getType() { 39 | return type; 40 | } 41 | 42 | public BanListModel setType(String type) { 43 | this.type = type; 44 | return this; 45 | } 46 | 47 | @Override 48 | public String toString() { 49 | return GsonUtil.toJson(this, BanListModel.class); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/io/rong/exception/RcloudException.java: -------------------------------------------------------------------------------- 1 | package io.rong.exception; 2 | 3 | /** 4 | * Created with hc. 5 | * User: hc 6 | * Date: 17-12-19 7 | * Time: 4:45 PM 8 | */ 9 | public abstract class RcloudException extends Exception{ 10 | /** 11 | * 12 | */ 13 | private static final long serialVersionUID = -700374663662873165L; 14 | protected Error error = null; 15 | public RcloudException (){ 16 | } 17 | 18 | public RcloudException(String message,Throwable e) { 19 | super(message,e); 20 | } 21 | 22 | public RcloudException(Throwable e){ 23 | super(e); 24 | } 25 | 26 | public RcloudException(String message){ 27 | super(message); 28 | } 29 | 30 | public Error getError(){ 31 | return error; 32 | } 33 | 34 | public int getErrorCode(){ 35 | if (error == null){ 36 | return 200; 37 | } 38 | return error.code; 39 | } 40 | 41 | public int getHttpCode(){ 42 | if (error == null){ 43 | return 200; 44 | } 45 | return error.httpCode; 46 | } 47 | 48 | public void setUri(String uri){ 49 | if (error == null){ 50 | return ; 51 | } 52 | error.url = uri; 53 | } 54 | } 55 | 56 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/HistoryMessageResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.models.Result; 4 | import io.rong.util.GsonUtil; 5 | 6 | /** 7 | * History message result. 8 | */ 9 | public class HistoryMessageResult extends Result { 10 | 11 | // URL for downloading historical messages. 12 | String url; 13 | // Date of the historical records. (yyyymmddhh) 14 | String date; 15 | 16 | public HistoryMessageResult(Integer code, String url, String date, String errorMessage) { 17 | this.code = code; 18 | this.url = url; 19 | this.date = date; 20 | this.errorMessage = errorMessage; 21 | } 22 | /** 23 | * Set the URL. 24 | * 25 | */ 26 | public void setUrl(String url) { 27 | this.url = url; 28 | } 29 | 30 | /** 31 | * Get the URL. 32 | * 33 | * @return String 34 | */ 35 | public String getUrl() { 36 | return url; 37 | } 38 | 39 | /** 40 | * Set the date. 41 | * 42 | */ 43 | public void setDate(String date) { 44 | this.date = date; 45 | } 46 | 47 | /** 48 | * Get the date. 49 | * 50 | * @return String 51 | */ 52 | public String getDate() { 53 | return date; 54 | } 55 | 56 | @Override 57 | public String toString() { 58 | return GsonUtil.toJson(this, HistoryMessageResult.class); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/NotdisturbStatusResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | public class NotdisturbStatusResult extends ResponseResult{ 6 | String groupId; 7 | String busChannel; 8 | int unpushLevel; 9 | 10 | public NotdisturbStatusResult(Integer code, String msg, String groupId, String busChannel, int unpushLevel) { 11 | super(code, msg); 12 | this.groupId = groupId; 13 | this.busChannel = busChannel; 14 | this.unpushLevel = unpushLevel; 15 | } 16 | 17 | public String getGroupId() { 18 | return groupId; 19 | } 20 | 21 | public void setGroupId(String groupId) { 22 | this.groupId = groupId; 23 | } 24 | 25 | public String getBusChannel() { 26 | return busChannel; 27 | } 28 | 29 | public void setBusChannel(String busChannel) { 30 | this.busChannel = busChannel; 31 | } 32 | 33 | public int getUnpushLevel() { 34 | return unpushLevel; 35 | } 36 | 37 | public void setUnpushLevel(int unpushLevel) { 38 | this.unpushLevel = unpushLevel; 39 | } 40 | 41 | @Override 42 | public String toString() { 43 | return GsonUtil.toJson(this, NotdisturbStatusResult.class); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/ListBlockChatroomUserResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.models.Result; 4 | import io.rong.models.chatroom.ChatroomMember; 5 | import io.rong.util.GsonUtil; 6 | import java.util.List; 7 | 8 | /** 9 | * The result of listing blocked chatroom users. 10 | */ 11 | public class ListBlockChatroomUserResult extends Result { 12 | /** 13 | * The list of banned users. 14 | */ 15 | List members; 16 | 17 | public ListBlockChatroomUserResult(Integer code, String msg, List members) { 18 | super(code, msg); 19 | this.members = members; 20 | } 21 | 22 | public ListBlockChatroomUserResult(List members) { 23 | this.members = members; 24 | } 25 | 26 | /** 27 | * Gets the list of banned users. 28 | * 29 | * @return List 30 | */ 31 | public List getMembers() { 32 | return this.members; 33 | } 34 | 35 | /** 36 | * Sets the list of banned users. 37 | */ 38 | public void setMembers(List members) { 39 | this.members = members; 40 | } 41 | 42 | @Override 43 | public String toString() { 44 | return GsonUtil.toJson(this, ListBlockChatroomUserResult.class); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/agent/Prompt.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.agent; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | import java.util.Map; 6 | 7 | /** 8 | * @author RongCloud 9 | */ 10 | public class Prompt { 11 | private Map variables; 12 | private String id; 13 | private String instructions; 14 | private String openingStatement; 15 | 16 | public Map getVariables() { 17 | return variables; 18 | } 19 | 20 | public void setVariables(Map variables) { 21 | this.variables = variables; 22 | } 23 | 24 | public String getId() { 25 | return id; 26 | } 27 | 28 | public void setId(String id) { 29 | this.id = id; 30 | } 31 | 32 | public String getInstructions() { 33 | return instructions; 34 | } 35 | 36 | public void setInstructions(String instructions) { 37 | this.instructions = instructions; 38 | } 39 | 40 | public String getOpeningStatement() { 41 | return openingStatement; 42 | } 43 | 44 | public void setOpeningStatement(String openingStatement) { 45 | this.openingStatement = openingStatement; 46 | } 47 | 48 | @Override 49 | public String toString() { 50 | return GsonUtil.toJson(this, Prompt.class); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/resources/jsonsource/broadcast/api.json: -------------------------------------------------------------------------------- 1 | { 2 | "send": { 3 | "url": "/message/broadcast", 4 | "params": { 5 | "message": { 6 | "conversationType": 1, 7 | "from": "2191", 8 | "objectName": "RC:TxtMsg", 9 | "content": { 10 | "content":"hello" 11 | }, 12 | "pushContent": "this is a push", 13 | "pushData": { 14 | "pushData":"hello" 15 | }, 16 | "os": "ios", 17 | "contentAvailable": 0 18 | } 19 | }, 20 | "response": { 21 | "success": { 22 | "code": 200 23 | }, 24 | "fail": { 25 | "20003": { 26 | "code": "1002", 27 | "errorMessage": "{{name}} length exceeds limit, {{name}} >= {{min}} and {{name}} <= {{max}} Units: bytes" 28 | }, 29 | "20005": { 30 | "code": "1002", 31 | "errorMessage": "{{name}} parameter is required" 32 | }, 33 | "20001": { 34 | "code": "1002", 35 | "errorMessage": "The parameter type is incorrect. Please check the parameter type. It should be passed in as {{currentType}}" 36 | }, 37 | "1004": { 38 | "code": "1004", 39 | "errorMessage": "Signature error. Please check whether Appkey and Secret are correct." 40 | }, 41 | "1008": { 42 | "code": "1008", 43 | "errorMessage": "The call frequency exceeds the limit." 44 | } 45 | } 46 | } 47 | 48 | } 49 | } -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/ExpansionResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.models.Result; 4 | import io.rong.util.GsonUtil; 5 | 6 | import java.util.HashMap; 7 | 8 | /** 9 | * Get Extended Information 10 | */ 11 | public class ExpansionResult extends Result { 12 | 13 | private String reqBody; 14 | private HashMap extraContent; 15 | 16 | public ExpansionResult(Integer code, String errorMessage) { 17 | super(code, errorMessage); 18 | } 19 | 20 | public ExpansionResult(Integer code, String errorMessage, HashMap extraContent) { 21 | super(code, errorMessage); 22 | this.extraContent = extraContent; 23 | } 24 | 25 | public String getReqBody() { 26 | return reqBody; 27 | } 28 | 29 | 30 | public void setReqBody(String reqBody) { 31 | this.reqBody = reqBody; 32 | } 33 | 34 | 35 | public HashMap getExtraContent() { 36 | return extraContent; 37 | } 38 | 39 | public void setExtraContent(HashMap extraContent) { 40 | this.extraContent = extraContent; 41 | } 42 | 43 | @Override 44 | public String toString() { 45 | return GsonUtil.toJson(this, ExpansionResult.class); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/UserResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.models.Result; 4 | import io.rong.util.GsonUtil; 5 | 6 | /** 7 | * Result of getToken. 8 | */ 9 | public class UserResult extends Result { 10 | // User name. 11 | String userName; 12 | // User avatar URL. 13 | String userPortrait; 14 | // User creation time. 15 | String createTime; 16 | 17 | public UserResult(String userName, String userPortrait, String createTime, String errorMessage) { 18 | this.userName = userName; 19 | this.userPortrait = userPortrait; 20 | this.createTime = createTime; 21 | this.errorMessage = errorMessage; 22 | } 23 | 24 | public String getUserName() { 25 | return userName; 26 | } 27 | 28 | public void setUserName(String userName) { 29 | this.userName = userName; 30 | } 31 | 32 | public String getUserPortrait() { 33 | return userPortrait; 34 | } 35 | 36 | public void setUserPortrait(String userPortrait) { 37 | this.userPortrait = userPortrait; 38 | } 39 | 40 | public String getCreateTime() { 41 | return createTime; 42 | } 43 | 44 | public void setCreateTime(String createTime) { 45 | this.createTime = createTime; 46 | } 47 | 48 | @Override 49 | public String toString() { 50 | return GsonUtil.toJson(this, UserResult.class); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/SMSImageCodeResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.models.Result; 4 | import io.rong.util.GsonUtil; 5 | 6 | /** 7 | * Successful result of getImageCode 8 | */ 9 | public class SMSImageCodeResult extends Result { 10 | // URL of the returned image verification code. 11 | String url; 12 | // ID of the returned image verification code. 13 | String verifyId; 14 | 15 | public SMSImageCodeResult(Integer code, String url, String verifyId, String errorMessage) { 16 | this.code = code; 17 | this.url = url; 18 | this.verifyId = verifyId; 19 | this.errorMessage = errorMessage; 20 | } 21 | 22 | /** 23 | * Sets the URL 24 | * 25 | */ 26 | public void setUrl(String url) { 27 | this.url = url; 28 | } 29 | 30 | /** 31 | * Gets the URL 32 | * 33 | * @return String 34 | */ 35 | public String getUrl() { 36 | return url; 37 | } 38 | 39 | /** 40 | * Sets the verifyId 41 | * 42 | */ 43 | public void setVerifyId(String verifyId) { 44 | this.verifyId = verifyId; 45 | } 46 | 47 | /** 48 | * Gets the verifyId 49 | * 50 | * @return String 51 | */ 52 | public String getVerifyId() { 53 | return verifyId; 54 | } 55 | 56 | @Override 57 | public String toString() { 58 | return GsonUtil.toJson(this, SMSImageCodeResult.class); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/UserProfile.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | /** 4 | * @author RongCloud 5 | */ 6 | public class UserProfile { 7 | /** 8 | * User ID 9 | */ 10 | private String userId; 11 | /** 12 | * Version number of the user's hosted information 13 | */ 14 | private Long version; 15 | /** 16 | * Basic user information 17 | */ 18 | private String userProfile; 19 | /** 20 | * Custom extended attributes 21 | */ 22 | private String userExtProfile; 23 | 24 | public String getUserId() { 25 | return userId; 26 | } 27 | 28 | public void setUserId(String userId) { 29 | this.userId = userId; 30 | } 31 | 32 | public Long getVersion() { 33 | return version; 34 | } 35 | 36 | public void setVersion(Long version) { 37 | this.version = version; 38 | } 39 | 40 | public String getUserProfile() { 41 | return userProfile; 42 | } 43 | 44 | public void setUserProfile(String userProfile) { 45 | this.userProfile = userProfile; 46 | } 47 | 48 | public String getUserExtProfile() { 49 | return userExtProfile; 50 | } 51 | 52 | public void setUserExtProfile(String userExtProfile) { 53 | this.userExtProfile = userExtProfile; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/UserGroupQueryResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.models.Result; 4 | import io.rong.models.user.UserModel; 5 | import io.rong.util.GsonUtil; 6 | import io.rong.models.group.GroupModel; 7 | 8 | public class UserGroupQueryResult extends Result { 9 | 10 | private String reqBody; 11 | 12 | private GroupModel[] groups; 13 | 14 | public UserGroupQueryResult(Integer code, String msg, GroupModel[] groups) { 15 | super(code, msg); 16 | this.groups = groups; 17 | } 18 | 19 | public UserGroupQueryResult(Integer code, String errorMessage) { 20 | this.code = code; 21 | this.errorMessage = errorMessage; 22 | } 23 | 24 | public UserGroupQueryResult(GroupModel[] groups) { 25 | this.groups = groups; 26 | } 27 | 28 | public GroupModel[] getGroups() { 29 | return this.groups; 30 | } 31 | 32 | public void setGroups(GroupModel[] groups) { 33 | this.groups = groups; 34 | } 35 | 36 | public String getReqBody() { 37 | return reqBody; 38 | } 39 | 40 | public void setReqBody(String reqBody) { 41 | this.reqBody = reqBody; 42 | } 43 | 44 | @Override 45 | public String toString() { 46 | return GsonUtil.toJson(this, UserGroupQueryResult.class); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/GetUserRemarksResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.models.Result; 4 | import io.rong.util.GsonUtil; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Response result for getuserRemark 10 | */ 11 | public class GetUserRemarksResult extends Result { 12 | 13 | private int total; 14 | List users; 15 | 16 | public int getTotal() { 17 | return total; 18 | } 19 | 20 | public void setTotal(int total) { 21 | this.total = total; 22 | } 23 | 24 | public List getUsers() { 25 | return users; 26 | } 27 | 28 | public void setUsers(List users) { 29 | this.users = users; 30 | } 31 | 32 | @Override 33 | public String toString() { 34 | return GsonUtil.toJson(this, GetUserRemarksResult.class); 35 | } 36 | 37 | private class UserRemark { 38 | private String id; 39 | 40 | public String getId() { 41 | return id; 42 | } 43 | 44 | public void setId(String id) { 45 | this.id = id; 46 | } 47 | 48 | public String getRemark() { 49 | return remark; 50 | } 51 | 52 | public void setRemark(String remark) { 53 | this.remark = remark; 54 | } 55 | 56 | private String remark; 57 | } 58 | } -------------------------------------------------------------------------------- /src/main/java/io/rong/models/profile/UserProfileModel.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.profile; 2 | 3 | 4 | /** 5 | * @author RongCloud 6 | */ 7 | public class UserProfileModel { 8 | /** 9 | * Target ID 10 | */ 11 | private String userId; 12 | /** 13 | * User basic information 14 | * JSON data, the length of KV pairs is configurable, with a default maximum of 20. 15 | */ 16 | private String userProfile; 17 | /** 18 | * Extended user information 19 | * JSON data, the length of the key should not exceed 32 characters, and the key must be prefixed with 'ext_'. The length of the value should not exceed 256 characters. The length of KV pairs is configurable, with a default maximum of 20. 20 | */ 21 | private String userExtProfile; 22 | 23 | public String getUserId() { 24 | return userId; 25 | } 26 | 27 | public void setUserId(String userId) { 28 | this.userId = userId; 29 | } 30 | 31 | public String getUserProfile() { 32 | return userProfile; 33 | } 34 | 35 | public void setUserProfile(String userProfile) { 36 | this.userProfile = userProfile; 37 | } 38 | 39 | public String getUserExtProfile() { 40 | return userExtProfile; 41 | } 42 | 43 | public void setUserExtProfile(String userExtProfile) { 44 | this.userExtProfile = userExtProfile; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/ListWordfilterResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.models.Result; 4 | import io.rong.models.sensitiveword.SensitiveWordModel; 5 | import io.rong.util.GsonUtil; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Result of listWordfilter operation 11 | */ 12 | public class ListWordfilterResult extends Result { 13 | // Sensitive word content. 14 | List words; 15 | 16 | public ListWordfilterResult(Integer code, List words, String errorMessage) { 17 | super(code, errorMessage); 18 | this.code = code; 19 | this.words = words; 20 | this.errorMessage = errorMessage; 21 | } 22 | 23 | /** 24 | * Set the code 25 | * 26 | */ 27 | public void setCode(Integer code) { 28 | this.code = code; 29 | } 30 | 31 | /** 32 | * Get the code 33 | * 34 | * @return Integer 35 | */ 36 | public Integer getCode() { 37 | return code; 38 | } 39 | 40 | /** 41 | * Set the words 42 | * 43 | */ 44 | public void setWords(List words) { 45 | this.words = words; 46 | } 47 | 48 | /** 49 | * Get the words 50 | * 51 | * @return List 52 | */ 53 | public List getWords() { 54 | return words; 55 | } 56 | 57 | @Override 58 | public String toString() { 59 | return GsonUtil.toJson(this, ListWordfilterResult.class); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/PushResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.models.Result; 4 | import io.rong.util.GsonUtil; 5 | 6 | /** 7 | * Push notification result. 8 | */ 9 | public class PushResult extends Result { 10 | 11 | /** 12 | * The unique identifier of the push notification. 13 | */ 14 | private String id; 15 | 16 | /** 17 | * The message ID of the push notification. 18 | */ 19 | private String messageUID; 20 | 21 | private String reqBody; 22 | 23 | public String getId() { 24 | return id; 25 | } 26 | 27 | public void setId(String id) { 28 | this.id = id; 29 | } 30 | 31 | public String getReqBody() { 32 | return reqBody; 33 | } 34 | 35 | 36 | public void setReqBody(String reqBody) { 37 | this.reqBody = reqBody; 38 | } 39 | 40 | public PushResult(Integer code, String id) { 41 | super(code, id); 42 | this.code = code; 43 | this.id = id; 44 | } 45 | 46 | public String getMessageUID() { 47 | return messageUID; 48 | } 49 | 50 | public PushResult setMessageUID(String messageUID) { 51 | this.messageUID = messageUID; 52 | return this; 53 | } 54 | 55 | @Override 56 | public String toString() { 57 | return GsonUtil.toJson(this, PushResult.class); 58 | } 59 | 60 | 61 | } -------------------------------------------------------------------------------- /src/main/java/io/rong/messages/CmdNtfMessage.java: -------------------------------------------------------------------------------- 1 | package io.rong.messages; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | /** 6 | * 7 | * A general command notification message. This type of message does not have a push notification. 8 | * 9 | */ 10 | public class CmdNtfMessage extends BaseMessage { 11 | private String name = ""; 12 | private String data = ""; 13 | private transient static final String TYPE = "RC:CmdNtf"; 14 | 15 | public CmdNtfMessage(String name, String data) { 16 | this.name = name; 17 | this.data = data; 18 | } 19 | @Override 20 | public String getType() { 21 | return TYPE; 22 | } 23 | 24 | /** 25 | * Gets the command name, which can be customized. 26 | * 27 | * @return String 28 | */ 29 | public String getName() { 30 | return name; 31 | } 32 | 33 | /** 34 | * @param name Sets the command name, which can be customized. 35 | * 36 | * 37 | */ 38 | public void setName(String name) { 39 | this.name = name; 40 | } 41 | 42 | /** 43 | * Gets the content of the command. 44 | * 45 | * @return String 46 | */ 47 | public String getData() { 48 | return data; 49 | } 50 | 51 | /** 52 | * @param data The content of the command to be set. 53 | */ 54 | public void setData(String data) { 55 | this.data = data; 56 | } 57 | 58 | @Override 59 | public String toString() { 60 | return GsonUtil.toJson(this, CmdNtfMessage.class); 61 | } 62 | } -------------------------------------------------------------------------------- /src/main/resources/jsonsource/sensitiveword/verify.json: -------------------------------------------------------------------------------- 1 | { 2 | "rule": { 3 | "_self": { 4 | "require": { 5 | "must": true, 6 | "invalid": "20005" 7 | }, 8 | "typeof": { 9 | "type": "object", 10 | "invalid": "20001" 11 | } 12 | }, 13 | "keyword": { 14 | "require": { 15 | "must": true, 16 | "invalid": "20005" 17 | }, 18 | "length": { 19 | "max": 64, 20 | "min": 1, 21 | "invalid": "20003" 22 | } 23 | }, 24 | "replace": { 25 | "length": { 26 | "max": 64, 27 | "min": 1, 28 | "invalid": "20003" 29 | } 30 | } 31 | }, 32 | "sensitive": { 33 | "_self": { 34 | "require": { 35 | "must": true, 36 | "invalid": "20005" 37 | }, 38 | "typeof": { 39 | "type": "object", 40 | "invalid": "20001" 41 | } 42 | }, 43 | "keyword": { 44 | "require": { 45 | "must": true, 46 | "invalid": "20005" 47 | }, 48 | "length": { 49 | "max": 64, 50 | "min": 1, 51 | "invalid": "20003" 52 | } 53 | }, 54 | "replace": { 55 | "length": { 56 | "max": 64, 57 | "min": 1, 58 | "invalid": "20003" 59 | } 60 | }, 61 | "keywords": { 62 | "require": { 63 | "must": true, 64 | "invalid": "20005" 65 | }, 66 | "size": { 67 | "max": 50, 68 | "min": 1, 69 | "invalid": "20003" 70 | }, 71 | "typeof": { 72 | "type": "array", 73 | "invalid": "20001" 74 | } 75 | } 76 | } 77 | } -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/GroupUserQueryResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.models.Result; 4 | import io.rong.util.GsonUtil; 5 | import java.util.List; 6 | 7 | /** 8 | * Group user query result. 9 | */ 10 | public class GroupUserQueryResult extends Result{ 11 | 12 | // The user ID of the group member. 13 | String id; 14 | // The list of group members. 15 | List members; 16 | 17 | public GroupUserQueryResult(Integer code, String msg, String id, List members) { 18 | super(code, msg); 19 | this.id = id; 20 | this.members = members; 21 | } 22 | 23 | public GroupUserQueryResult(String id, List members) { 24 | this.id = id; 25 | this.members = members; 26 | } 27 | 28 | /** 29 | * Set the ID. 30 | * 31 | */ 32 | public void setId(String id) { 33 | this.id = id; 34 | } 35 | 36 | /** 37 | * Get the ID. 38 | * 39 | * @return String 40 | */ 41 | public String getId() { 42 | return id; 43 | } 44 | 45 | /** 46 | * Get the members. 47 | * 48 | * @return members 49 | */ 50 | public List getMembers() { 51 | return this.members; 52 | } 53 | /** 54 | * Set members 55 | * 56 | */ 57 | public void setMembers(List members) { 58 | this.members = members; 59 | } 60 | 61 | @Override 62 | public String toString() { 63 | return GsonUtil.toJson(this, GroupUserQueryResult.class); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/EntrustGroupInfo.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | 4 | /** 5 | * @author RongCloud 6 | */ 7 | public class EntrustGroupInfo { 8 | private String groupId; 9 | private String owner; 10 | private String creator; 11 | private String name; 12 | private String portraitUrl; 13 | private Long time; 14 | 15 | public String getGroupId() { 16 | return groupId; 17 | } 18 | 19 | public void setGroupId(String groupId) { 20 | this.groupId = groupId; 21 | } 22 | 23 | public String getOwner() { 24 | return owner; 25 | } 26 | 27 | public void setOwner(String owner) { 28 | this.owner = owner; 29 | } 30 | 31 | public String getCreator() { 32 | return creator; 33 | } 34 | 35 | public void setCreator(String creator) { 36 | this.creator = creator; 37 | } 38 | 39 | public String getName() { 40 | return name; 41 | } 42 | 43 | public void setName(String name) { 44 | this.name = name; 45 | } 46 | 47 | public String getPortraitUrl() { 48 | return portraitUrl; 49 | } 50 | 51 | public void setPortraitUrl(String portraitUrl) { 52 | this.portraitUrl = portraitUrl; 53 | } 54 | 55 | public Long getTime() { 56 | return time; 57 | } 58 | 59 | public void setTime(Long time) { 60 | this.time = time; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/BanListResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.models.Result; 4 | import io.rong.models.user.UserModel; 5 | import io.rong.util.GsonUtil; 6 | 7 | /** 8 | * @author RongCloud 9 | */ 10 | public class BanListResult extends Result { 11 | /** 12 | * User list 13 | */ 14 | String[] users; 15 | 16 | /** 17 | * Total count 18 | */ 19 | Integer total; 20 | 21 | public BanListResult(Integer code, String errorMessage) { 22 | super(code, errorMessage); 23 | } 24 | 25 | public BanListResult(Integer code, String msg, String[] users) { 26 | super(code, msg); 27 | this.users = users; 28 | } 29 | 30 | public BanListResult(String[] users) { 31 | this.users = users; 32 | } 33 | 34 | /** 35 | * Get users 36 | * 37 | * @return User[] 38 | */ 39 | public String[] getUsers() { 40 | return this.users; 41 | } 42 | /** 43 | * Set users 44 | * 45 | */ 46 | public void setUsers(String[] users) { 47 | this.users = users; 48 | } 49 | 50 | public Integer getTotal() { 51 | return total; 52 | } 53 | 54 | public void setTotal(Integer total) { 55 | this.total = total; 56 | } 57 | 58 | @Override 59 | public String toString() { 60 | return GsonUtil.toJson(this, BanListResult.class); 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/io/rong/methods/chatroom/whitelist/Whitelist.java: -------------------------------------------------------------------------------- 1 | package io.rong.methods.chatroom.whitelist; 2 | 3 | import io.rong.RongCloud; 4 | import io.rong.exception.ParamException; 5 | import io.rong.models.CheckMethod; 6 | import io.rong.models.response.ResponseResult; 7 | import io.rong.models.CommonConstrants; 8 | import io.rong.util.CommonUtil; 9 | import io.rong.util.GsonUtil; 10 | import io.rong.util.HttpUtil; 11 | 12 | import java.net.HttpURLConnection; 13 | import java.net.URLEncoder; 14 | /** 15 | * 16 | * Chatroom User Allowlist Service 17 | * 18 | * @author RongCloud 19 | * */ 20 | public class Whitelist { 21 | private static final String UTF8 = "UTF-8"; 22 | private static final String PATH = "chatroom/whitelist"; 23 | private String appKey; 24 | private String appSecret; 25 | private RongCloud rongCloud; 26 | public User user; 27 | public Messages message; 28 | 29 | public RongCloud getRongCloud() { 30 | return rongCloud; 31 | } 32 | public void setRongCloud(RongCloud rongCloud) { 33 | this.rongCloud = rongCloud; 34 | message.setRongCloud(rongCloud); 35 | user.setRongCloud(rongCloud); 36 | } 37 | public Whitelist(String appKey, String appSecret) { 38 | this.appKey = appKey; 39 | this.appSecret = appSecret; 40 | this.message = new Messages(appKey,appSecret); 41 | this.user = new User(appKey,appSecret,rongCloud); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/sensitiveword/AddSensitiveWordsModel.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.sensitiveword; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * Batch add sensitive words 9 | */ 10 | public class AddSensitiveWordsModel { 11 | 12 | /** 13 | * List of sensitive words 14 | */ 15 | List words; 16 | 17 | public List getWords() { 18 | return words; 19 | } 20 | 21 | public AddSensitiveWordsModel setWords(List words) { 22 | this.words = words; 23 | return this; 24 | } 25 | 26 | @Override 27 | public String toString() { 28 | return GsonUtil.toJson(this, AddSensitiveWordsModel.class); 29 | } 30 | 31 | 32 | public static class SensitiveWord { 33 | /** 34 | * Sensitive word, required, length no more than 32 characters 35 | */ 36 | private String word; 37 | /** 38 | * Replacement word, optional, length no more than 32 characters 39 | */ 40 | private String replaceWord; 41 | 42 | public String getWord() { 43 | return word; 44 | } 45 | 46 | public SensitiveWord setWord(String word) { 47 | this.word = word; 48 | return this; 49 | } 50 | 51 | public String getReplaceWord() { 52 | return replaceWord; 53 | } 54 | 55 | public SensitiveWord setReplaceWord(String replaceWord) { 56 | this.replaceWord = replaceWord; 57 | return this; 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/conversation/ConversationAttrModel.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.conversation; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * @author RongCloud 7 | */ 8 | public class ConversationAttrModel { 9 | 10 | private String targetId; 11 | 12 | private Integer conversationType; 13 | 14 | private List tags; 15 | 16 | private ConversationTopModel top; 17 | 18 | private ConversationMuteModel mute; 19 | 20 | 21 | public String getTargetId() { 22 | return targetId; 23 | } 24 | 25 | public void setTargetId(String targetId) { 26 | this.targetId = targetId; 27 | } 28 | 29 | public Integer getConversationType() { 30 | return conversationType; 31 | } 32 | 33 | public void setConversationType(Integer conversationType) { 34 | this.conversationType = conversationType; 35 | } 36 | 37 | public List getTags() { 38 | return tags; 39 | } 40 | 41 | public void setTags(List tags) { 42 | this.tags = tags; 43 | } 44 | 45 | public ConversationTopModel getTop() { 46 | return top; 47 | } 48 | 49 | public void setTop(ConversationTopModel top) { 50 | this.top = top; 51 | } 52 | 53 | public ConversationMuteModel getMute() { 54 | return mute; 55 | } 56 | 57 | public void setMute(ConversationMuteModel mute) { 58 | this.mute = mute; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/push/BroadcastPushPublicPart.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.push; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | /** 6 | * Common parameters for broadcast push. 7 | */ 8 | public class BroadcastPushPublicPart { 9 | 10 | /** 11 | * Target operating systems. At least one of iOS or Android must be specified. If you need to push messages to both systems, both must be filled. (Required) 12 | */ 13 | private String[] platform; 14 | 15 | /** 16 | * Push conditions, including: tag, userid, is_to_all. (Required) 17 | */ 18 | private Audience audience; 19 | 20 | /** 21 | * Push message content by operating system type. 22 | */ 23 | private Notification notification; 24 | 25 | public String[] getPlatform() { 26 | return platform; 27 | } 28 | 29 | public void setPlatform(String[] platform) { 30 | this.platform = platform; 31 | } 32 | 33 | public Audience getAudience() { 34 | return audience; 35 | } 36 | 37 | public void setAudience(Audience audience) { 38 | this.audience = audience; 39 | } 40 | 41 | public Notification getNotification() { 42 | return notification; 43 | } 44 | 45 | public void setNotification(Notification notification) { 46 | this.notification = notification; 47 | } 48 | 49 | @Override 50 | public String toString() { 51 | return GsonUtil.toJson(this, BroadcastPushPublicPart.class); 52 | } 53 | } -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/ConversationNotificationResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.models.Result; 4 | import io.rong.util.GsonUtil; 5 | 6 | public class ConversationNotificationResult extends Result { 7 | 8 | // Indicates the status of the Do Not Disturb setting for messages, where 0 means disabled and 1 means enabled. 9 | Integer isMuted; 10 | 11 | public ConversationNotificationResult(Integer code, Integer isMuted, String errorMessage) { 12 | super(code,errorMessage); 13 | this.code = code; 14 | this.isMuted = isMuted; 15 | this.errorMessage = errorMessage; 16 | } 17 | 18 | /** 19 | * Sets the code. 20 | * 21 | */ 22 | public void setCode(Integer code) { 23 | this.code = code; 24 | } 25 | 26 | /** 27 | * Gets the code. 28 | * 29 | * @return Integer 30 | */ 31 | public Integer getCode() { 32 | return code; 33 | } 34 | 35 | /** 36 | * Gets the Muted status. 37 | * 38 | * @return String 39 | */ 40 | public Integer getIsMuted() { 41 | return this.isMuted; 42 | } 43 | /** 44 | * Sets the Muted status. 45 | * 46 | */ 47 | public void setIsMuted(Integer isMuted) { 48 | this.isMuted = isMuted; 49 | } 50 | 51 | @Override 52 | public String toString() { 53 | return GsonUtil.toJson(this, ConversationNotificationResult.class); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/PagingQueryAgentsResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | 4 | import io.rong.models.agent.AgentModel; 5 | import io.rong.util.GsonUtil; 6 | 7 | import java.util.List; 8 | 9 | 10 | /** 11 | * @author RongCloud 12 | */ 13 | public class PagingQueryAgentsResult extends ResponseResult { 14 | private Integer total; 15 | private Integer totalPages; 16 | private Boolean hasNext; 17 | private List agents; 18 | 19 | public PagingQueryAgentsResult(Integer code, String msg) { 20 | super(code, msg); 21 | } 22 | 23 | 24 | public Integer getTotal() { 25 | return total; 26 | } 27 | 28 | public void setTotal(Integer total) { 29 | this.total = total; 30 | } 31 | 32 | public Integer getTotalPages() { 33 | return totalPages; 34 | } 35 | 36 | public void setTotalPages(Integer totalPages) { 37 | this.totalPages = totalPages; 38 | } 39 | 40 | public Boolean getHasNext() { 41 | return hasNext; 42 | } 43 | 44 | public void setHasNext(Boolean hasNext) { 45 | this.hasNext = hasNext; 46 | } 47 | 48 | public List getAgents() { 49 | return agents; 50 | } 51 | 52 | public void setAgents(List agents) { 53 | this.agents = agents; 54 | } 55 | 56 | @Override 57 | public String toString() { 58 | return GsonUtil.toJson(this, PagingQueryAgentsResult.class); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/io/rong/messages/CmdMsgMessage.java: -------------------------------------------------------------------------------- 1 | package io.rong.messages; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | /** 6 | * 7 | * General command notification message. This type of message does not have push notification. 8 | * It differs from the general command notification message in that it is not stored or counted. 9 | * 10 | */ 11 | public class CmdMsgMessage extends BaseMessage { 12 | private String name = ""; 13 | private String data = ""; 14 | private transient static final String TYPE = "RC:CmdMsg"; 15 | 16 | public CmdMsgMessage(String name, String data) { 17 | this.name = name; 18 | this.data = data; 19 | } 20 | 21 | @Override 22 | public String getType() { 23 | return TYPE; 24 | } 25 | 26 | /** 27 | * Gets the command name, which can be user-defined. 28 | * 29 | * @return String 30 | */ 31 | public String getName() { 32 | return name; 33 | } 34 | 35 | /** 36 | * @param name Sets the command name, which can be user-defined. 37 | * 38 | * 39 | */ 40 | public void setName(String name) { 41 | this.name = name; 42 | } 43 | 44 | /** 45 | * Gets the content of the command. 46 | * 47 | * @return String 48 | */ 49 | public String getData() { 50 | return data; 51 | } 52 | 53 | /** 54 | * @param data The content of the command to be set 55 | */ 56 | public void setData(String data) { 57 | this.data = data; 58 | } 59 | 60 | @Override 61 | public String toString() { 62 | return GsonUtil.toJson(this, CmdMsgMessage.class); 63 | } 64 | } -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/ListGagChatroomUserResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.models.Result; 4 | import io.rong.models.chatroom.ChatroomMember; 5 | import io.rong.util.GsonUtil; 6 | import java.util.List; 7 | 8 | /** 9 | * Result of listing muted users in a chatroom. 10 | */ 11 | public class ListGagChatroomUserResult extends Result{ 12 | /** 13 | * List of muted users in the chatroom. 14 | * 15 | */ 16 | List members; 17 | 18 | public ListGagChatroomUserResult(Integer code, String msg, List members) { 19 | super(code, msg); 20 | this.members = members; 21 | } 22 | 23 | public ListGagChatroomUserResult(List members) { 24 | this.members = members; 25 | } 26 | 27 | /** 28 | * Sets the code. 29 | * 30 | */ 31 | @Override 32 | public void setCode(Integer code) { 33 | this.code = code; 34 | } 35 | 36 | /** 37 | * Gets the code. 38 | * 39 | * @return Integer 40 | */ 41 | @Override 42 | public Integer getCode() { 43 | return code; 44 | } 45 | /** 46 | * Gets the members. 47 | * 48 | * @return List 49 | */ 50 | public List getMembers() { 51 | return this.members; 52 | } 53 | /** 54 | * Set members 55 | * 56 | */ 57 | public void setMembers(List members) { 58 | this.members = members; 59 | } 60 | 61 | 62 | @Override 63 | public String toString() { 64 | return GsonUtil.toJson(this, ListGagChatroomUserResult.class); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/ultragroup/UltraGroupMember.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.ultragroup; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | /** 6 | * @author RongCloud 7 | */ 8 | public class UltraGroupMember { 9 | /** 10 | * The ID of the group member. 11 | */ 12 | public String id; 13 | /** 14 | * The ID of the group. 15 | */ 16 | public String groupId; 17 | 18 | public UltraGroupMember() { 19 | super(); 20 | } 21 | 22 | public UltraGroupMember(String id, String groupId) { 23 | this.id = id; 24 | this.groupId = groupId; 25 | } 26 | 27 | /** 28 | * @param id Sets the ID of the group member. 29 | * 30 | */ 31 | public UltraGroupMember setId(String id) { 32 | this.id = id; 33 | return this; 34 | } 35 | 36 | /** 37 | * Gets the ID of the group member. 38 | * 39 | * @return String 40 | */ 41 | public String getId() { 42 | return id; 43 | } 44 | 45 | /** 46 | * Gets the ID of the group. 47 | * 48 | * @return String 49 | */ 50 | public String getGroupId() { 51 | return this.groupId; 52 | } 53 | /** 54 | * @param groupId Sets the group ID 55 | * 56 | * 57 | */ 58 | public void setGroupId(String groupId) { 59 | this.groupId = groupId; 60 | } 61 | 62 | @Override 63 | public String toString() { 64 | return GsonUtil.toJson(this, UltraGroupMember.class); 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/io/rong/messages/InfoNtfMessage.java: -------------------------------------------------------------------------------- 1 | package io.rong.messages; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | /** 6 | * 7 | * Gray bar notification message. This type of message does not have a push notification. 8 | * 9 | */ 10 | public class InfoNtfMessage extends BaseMessage { 11 | private String message = ""; 12 | private String extra = ""; 13 | private transient static final String TYPE = "RC:InfoNtf"; 14 | 15 | public InfoNtfMessage(String message, String extra) { 16 | this.message = message; 17 | this.extra = extra; 18 | } 19 | @Override 20 | public String getType() { 21 | return TYPE; 22 | } 23 | 24 | /** 25 | * Gets the content of the gray bar message. 26 | * 27 | * @return String 28 | */ 29 | public String getMessage() { 30 | return message; 31 | } 32 | 33 | /** 34 | * @param message Sets the content of the gray bar message. 35 | * 36 | * 37 | */ 38 | public void setMessage(String message) { 39 | this.message = message; 40 | } 41 | 42 | /** 43 | * Gets the extra information (if developers need it, they can parse it on the App side). 44 | * 45 | * @return String 46 | */ 47 | public String getExtra() { 48 | return extra; 49 | } 50 | 51 | /** 52 | * @param extra Sets additional information (if needed, developers can parse it on the App side). 53 | * 54 | * 55 | */ 56 | public void setExtra(String extra) { 57 | this.extra = extra; 58 | } 59 | 60 | @Override 61 | public String toString() { 62 | return GsonUtil.toJson(this, InfoNtfMessage.class); 63 | } 64 | } -------------------------------------------------------------------------------- /src/main/java/io/rong/models/Result.java: -------------------------------------------------------------------------------- 1 | package io.rong.models; 2 | /** 3 | * Base HTTP success response result. 4 | */ 5 | public abstract class Result { 6 | /** 7 | * Response code, 200 indicates success. 8 | */ 9 | public Integer code; 10 | /** 11 | * Error message. 12 | */ 13 | public String errorMessage; 14 | 15 | public String requestId; 16 | 17 | public Result(Integer code, String errorMessage) { 18 | this.code = code; 19 | this.errorMessage = errorMessage; 20 | } 21 | 22 | public Result() { 23 | 24 | } 25 | /** 26 | * Sets the response code. 27 | */ 28 | public void setCode(Integer code) { 29 | this.code = code; 30 | } 31 | 32 | /** 33 | * Gets the response code. 34 | * 35 | * @return Integer 36 | */ 37 | public Integer getCode() { 38 | return code; 39 | } 40 | 41 | /** 42 | * Gets the error message. 43 | * 44 | * @return String 45 | */ 46 | public String getErrorMessage() { 47 | return errorMessage; 48 | } 49 | /** 50 | * Set the error message 51 | * 52 | */ 53 | public void setErrorMessage(String errorMessage) { 54 | this.errorMessage = errorMessage; 55 | } 56 | 57 | public String getRequestId() { 58 | return requestId; 59 | } 60 | 61 | public void setRequestId(String requestId) { 62 | this.requestId = requestId; 63 | } 64 | 65 | @Override 66 | public abstract String toString(); 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/ChannelListResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.models.Result; 4 | import io.rong.util.GsonUtil; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * ChannelListResult 10 | */ 11 | public class ChannelListResult extends Result { 12 | 13 | // Channel list 14 | List channelList; 15 | 16 | public ChannelListResult(Integer code, List channelList , String errorMessage) { 17 | super(code, errorMessage); 18 | this.code = code; 19 | this.channelList = channelList; 20 | this.errorMessage = errorMessage; 21 | } 22 | 23 | public List getChannelList() { 24 | return channelList; 25 | } 26 | 27 | public void setChannelList(List channelList) { 28 | this.channelList = channelList; 29 | } 30 | 31 | @Override 32 | public String toString() { 33 | return GsonUtil.toJson(this, ChannelListResult.class); 34 | } 35 | 36 | 37 | class ChannelInfo { 38 | String channelId; 39 | int type; 40 | String createTime; 41 | 42 | public String getChannelId() { 43 | return channelId; 44 | } 45 | 46 | public void setChannelId(String channelId) { 47 | this.channelId = channelId; 48 | } 49 | 50 | public String getCreateTime() { 51 | return createTime; 52 | } 53 | 54 | public void setCreateTime(String createTime) { 55 | this.createTime = createTime; 56 | } 57 | 58 | public int getType() { 59 | return type; 60 | } 61 | 62 | public void setType(int type) { 63 | this.type = type; 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/conversation/ConversationTagModel.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.conversation; 2 | 3 | /** 4 | * @author RongCloud 5 | */ 6 | public class ConversationTagModel { 7 | 8 | /** 9 | * Conversation tag ID; length must not exceed 10 10 | */ 11 | private String tagId; 12 | 13 | /** 14 | * Conversation tag name; length must not exceed 15 15 | */ 16 | private String tagName; 17 | 18 | private Long createTime; 19 | 20 | public ConversationTagModel() { 21 | } 22 | 23 | public ConversationTagModel(String tagId, String tagName) { 24 | this.tagId = tagId; 25 | this.tagName = tagName; 26 | } 27 | 28 | public ConversationTagModel(String tagId, String tagName, Long createTime) { 29 | this.tagId = tagId; 30 | this.tagName = tagName; 31 | this.createTime = createTime; 32 | } 33 | 34 | public String getTagId() { 35 | return tagId; 36 | } 37 | 38 | public ConversationTagModel setTagId(String tagId) { 39 | this.tagId = tagId; 40 | return this; 41 | } 42 | 43 | public String getTagName() { 44 | return tagName; 45 | } 46 | 47 | public ConversationTagModel setTagName(String tagName) { 48 | this.tagName = tagName; 49 | return this; 50 | } 51 | 52 | public Long getCreateTime() { 53 | return createTime; 54 | } 55 | 56 | public ConversationTagModel setCreateTime(Long createTime) { 57 | this.createTime = createTime; 58 | return this; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/MessageUIDEntry.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | /** 4 | * @author huhangtao 5 | * @date 2024/8/8 14:54 6 | */ 7 | public class MessageUIDEntry { 8 | /** 9 | * Indicates the value when sending a one-to-one chat message. 10 | */ 11 | private String userId; 12 | /** 13 | * Indicates the value when sending a group or ultra group message. 14 | */ 15 | private String groupId; 16 | /** 17 | * Indicates the value when sending a chatroom message. 18 | */ 19 | private String chatroomId; 20 | /** 21 | * Specifies the Message ID. 22 | */ 23 | private String messageUID; 24 | 25 | public String getUserId() { 26 | return userId; 27 | } 28 | 29 | public MessageUIDEntry setUserId(String userId) { 30 | this.userId = userId; 31 | return this; 32 | } 33 | 34 | public String getGroupId() { 35 | return groupId; 36 | } 37 | 38 | public MessageUIDEntry setGroupId(String groupId) { 39 | this.groupId = groupId; 40 | return this; 41 | } 42 | 43 | public String getChatroomId() { 44 | return chatroomId; 45 | } 46 | 47 | public MessageUIDEntry setChatroomId(String chatroomId) { 48 | this.chatroomId = chatroomId; 49 | return this; 50 | } 51 | 52 | public String getMessageUID() { 53 | return messageUID; 54 | } 55 | 56 | public MessageUIDEntry setMessageUID(String messageUID) { 57 | this.messageUID = messageUID; 58 | return this; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/GroupMember.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | 4 | /** 5 | * @author RongCloud 6 | */ 7 | public class GroupMember { 8 | /** 9 | * User ID 10 | */ 11 | private String userId; 12 | /** 13 | * Group alias: defaults to the user's name if not set 14 | */ 15 | private String nickname; 16 | /** 17 | * Group role: 18 | * 0: Regular group member 19 | * 1: Group owner 20 | * 2: Group administrator 21 | */ 22 | private Integer role; 23 | /** 24 | * Join time 25 | */ 26 | private Long time; 27 | /** 28 | * Additional information for group member 29 | */ 30 | private String extra; 31 | 32 | 33 | public String getUserId() { 34 | return userId; 35 | } 36 | 37 | public void setUserId(String userId) { 38 | this.userId = userId; 39 | } 40 | 41 | public String getNickname() { 42 | return nickname; 43 | } 44 | 45 | public void setNickname(String nickname) { 46 | this.nickname = nickname; 47 | } 48 | 49 | public Integer getRole() { 50 | return role; 51 | } 52 | 53 | public void setRole(Integer role) { 54 | this.role = role; 55 | } 56 | 57 | public Long getTime() { 58 | return time; 59 | } 60 | 61 | public void setTime(Long time) { 62 | this.time = time; 63 | } 64 | 65 | public String getExtra() { 66 | return extra; 67 | } 68 | 69 | public void setExtra(String extra) { 70 | this.extra = extra; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/ChatroomEntryResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.models.Result; 4 | import io.rong.models.chatroom.ChatroomEntryModel; 5 | import io.rong.util.GsonUtil; 6 | 7 | /** 8 | * Response template for querying chatroom custom attributes 9 | * 10 | * @author RongCloud 11 | * 12 | */ 13 | public class ChatroomEntryResult extends Result { 14 | public String key; 15 | public String value; 16 | public String userId; 17 | public int autoDelete; 18 | public String lastSetTime; 19 | 20 | 21 | public String getKey() { 22 | return key; 23 | } 24 | 25 | public void setKey(String key) { 26 | this.key = key; 27 | } 28 | 29 | 30 | public String getValue() { 31 | return value; 32 | } 33 | 34 | public void setValue(String value) { 35 | this.value = value; 36 | } 37 | 38 | 39 | public String getUserId() { 40 | return userId; 41 | } 42 | 43 | public void setUserId(String userId) { 44 | this.userId = userId; 45 | } 46 | 47 | 48 | public int getAutoDelete() { 49 | return autoDelete; 50 | } 51 | 52 | public void setAutoDelete(int autoDelete) { 53 | this.autoDelete = autoDelete; 54 | } 55 | 56 | public void setAutoDelete(Boolean autoDelete) { 57 | this.autoDelete = autoDelete ? 1 : 0; 58 | } 59 | 60 | 61 | public String getLastSetTime() { 62 | return lastSetTime; 63 | } 64 | 65 | public void setLastSetTime(String lastSetTime) { 66 | this.lastSetTime = lastSetTime; 67 | } 68 | 69 | 70 | @Override 71 | public String toString() { 72 | return GsonUtil.toJson(this, ChatroomEntryResult.class); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/profile/QuitEntrustGroupModel.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.profile; 2 | 3 | /** 4 | * @author RongCloud 5 | */ 6 | public class QuitEntrustGroupModel { 7 | 8 | /** 9 | * Group ID 10 | */ 11 | private String groupId; 12 | private String[] userIds; 13 | private Integer isDelBan; 14 | private Integer isDelWhite; 15 | private Integer isDelFollowed; 16 | 17 | 18 | public String getGroupId() { 19 | return groupId; 20 | } 21 | 22 | public QuitEntrustGroupModel setGroupId(String groupId) { 23 | this.groupId = groupId; 24 | return this; 25 | } 26 | 27 | public String[] getUserIds() { 28 | return userIds; 29 | } 30 | 31 | public QuitEntrustGroupModel setUserIds(String[] userIds) { 32 | this.userIds = userIds; 33 | return this; 34 | } 35 | 36 | public Integer getIsDelBan() { 37 | return isDelBan; 38 | } 39 | 40 | public QuitEntrustGroupModel setIsDelBan(Integer isDelBan) { 41 | this.isDelBan = isDelBan; 42 | return this; 43 | } 44 | 45 | public Integer getIsDelWhite() { 46 | return isDelWhite; 47 | } 48 | 49 | public QuitEntrustGroupModel setIsDelWhite(Integer isDelWhite) { 50 | this.isDelWhite = isDelWhite; 51 | return this; 52 | } 53 | 54 | public Integer getIsDelFollowed() { 55 | return isDelFollowed; 56 | } 57 | 58 | public QuitEntrustGroupModel setIsDelFollowed(Integer isDelFollowed) { 59 | this.isDelFollowed = isDelFollowed; 60 | return this; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/io/rong/methods/group/ban/whitelist/Whitelist.java: -------------------------------------------------------------------------------- 1 | package io.rong.methods.group.ban.whitelist; 2 | 3 | import io.rong.RongCloud; 4 | import io.rong.models.CheckMethod; 5 | import io.rong.models.Result; 6 | import io.rong.models.group.GroupMember; 7 | import io.rong.models.group.GroupModel; 8 | import io.rong.models.response.GroupBanWhitelistResult; 9 | import io.rong.models.response.ResponseResult; 10 | import io.rong.util.CommonUtil; 11 | import io.rong.util.GsonUtil; 12 | import io.rong.util.HttpUtil; 13 | 14 | import java.net.HttpURLConnection; 15 | import java.net.URLEncoder; 16 | /** 17 | * Group Mute Exceptions Service 18 | * When a group is muted, if certain users need to be allowed to speak, they can be added to the group's mute exceptions list. The group mute exceptions list only takes effect when the group is set to mute all members. 19 | * @author rc 20 | * 21 | * */ 22 | public class Whitelist { 23 | private static final String UTF8 = "UTF-8"; 24 | private static final String PATH = "group/ban/whitelist"; 25 | private String appKey; 26 | private String appSecret; 27 | private RongCloud rongCloud; 28 | public User user; 29 | 30 | public RongCloud getRongCloud() { 31 | return rongCloud; 32 | } 33 | public void setRongCloud(RongCloud rongCloud) { 34 | this.rongCloud = rongCloud; 35 | } 36 | public Whitelist(String appKey, String appSecret, RongCloud rongCloud) { 37 | this.appKey = appKey; 38 | this.appSecret = appSecret; 39 | this.rongCloud = rongCloud; 40 | this.user = new User(appKey,appSecret,rongCloud); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/conversation/ConversationSetTopModel.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.conversation; 2 | 3 | /** 4 | * @author RongCloud 5 | */ 6 | public class ConversationSetTopModel { 7 | private String userId; 8 | private Integer conversationType; 9 | private String targetId; 10 | private Boolean setTop; 11 | 12 | public ConversationSetTopModel(String userId, Integer conversationType, String targetId, Boolean setTop) { 13 | this.userId = userId; 14 | this.conversationType = conversationType; 15 | this.targetId = targetId; 16 | this.setTop = setTop; 17 | } 18 | 19 | public ConversationSetTopModel() { 20 | } 21 | 22 | public String getUserId() { 23 | return userId; 24 | } 25 | 26 | public ConversationSetTopModel setUserId(String userId) { 27 | this.userId = userId; 28 | return this; 29 | } 30 | 31 | public Integer getConversationType() { 32 | return conversationType; 33 | } 34 | 35 | public ConversationSetTopModel setConversationType(Integer conversationType) { 36 | this.conversationType = conversationType; 37 | return this; 38 | } 39 | 40 | public String getTargetId() { 41 | return targetId; 42 | } 43 | 44 | public ConversationSetTopModel setTargetId(String targetId) { 45 | this.targetId = targetId; 46 | return this; 47 | } 48 | 49 | public Boolean getSetTop() { 50 | return setTop; 51 | } 52 | 53 | public ConversationSetTopModel setSetTop(Boolean setTop) { 54 | this.setTop = setTop; 55 | return this; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/agent/AgentModel.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.agent; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | 6 | /** 7 | * @author RongCloud 8 | */ 9 | public class AgentModel { 10 | private String agentId; 11 | private String name; 12 | private String description; 13 | private String type; 14 | private String status; 15 | private AgentConfig agentConfig; 16 | 17 | public String getAgentId() { 18 | return agentId; 19 | } 20 | 21 | public void setAgentId(String agentId) { 22 | this.agentId = agentId; 23 | } 24 | 25 | public String getName() { 26 | return name; 27 | } 28 | 29 | public void setName(String name) { 30 | this.name = name; 31 | } 32 | 33 | public String getDescription() { 34 | return description; 35 | } 36 | 37 | public void setDescription(String description) { 38 | this.description = description; 39 | } 40 | 41 | public String getType() { 42 | return type; 43 | } 44 | 45 | public void setType(String type) { 46 | this.type = type; 47 | } 48 | 49 | public String getStatus() { 50 | return status; 51 | } 52 | 53 | public void setStatus(String status) { 54 | this.status = status; 55 | } 56 | 57 | public AgentConfig getAgentConfig() { 58 | return agentConfig; 59 | } 60 | 61 | public void setAgentConfig(AgentConfig agentConfig) { 62 | this.agentConfig = agentConfig; 63 | } 64 | 65 | @Override 66 | public String toString() { 67 | return GsonUtil.toJson(this, AgentModel.class); 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /src/main/java/io/rong/example/user/BanExample.java: -------------------------------------------------------------------------------- 1 | package io.rong.example.user; 2 | 3 | import io.rong.CenterEnum; 4 | import io.rong.RongCloud; 5 | import io.rong.methods.user.chat.Ban; 6 | import io.rong.models.Result; 7 | import io.rong.models.response.BanListResult; 8 | import io.rong.models.user.BanListModel; 9 | import io.rong.models.user.BanModel; 10 | 11 | /** 12 | * Demo class 13 | * 14 | * @author RongCloud 15 | */ 16 | public class BanExample { 17 | 18 | /** 19 | * Replace with your App Key 20 | */ 21 | private static final String appKey = ""; 22 | /** 23 | * Replace with your App Secret 24 | */ 25 | private static final String appSecret = ""; 26 | 27 | public static void main(String[] args) throws Exception { 28 | 29 | RongCloud rongCloud = RongCloud.getInstance(appKey, appSecret, CenterEnum.BJ); 30 | 31 | Ban ban = rongCloud.user.ban; 32 | 33 | /** 34 | * 35 | * Set user mute 36 | */ 37 | BanModel model = new BanModel() 38 | .setUserId(new String[]{"CHIQ1", "CHIQ2"}) 39 | .setState(1) 40 | .setType("PERSON"); 41 | 42 | Result result = ban.set(model); 43 | System.out.println("set: " + result.toString()); 44 | 45 | 46 | BanListModel blModel = new BanListModel() 47 | .setType("PERSON"); 48 | /** 49 | * 50 | * 51 | * 52 | * Query muted user list 53 | */ 54 | BanListResult blResult = ban.getList(blModel); 55 | System.out.println("getList: " + blResult.toString()); 56 | 57 | 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/io/rong/example/chatroom/DistributeExample.java: -------------------------------------------------------------------------------- 1 | package io.rong.example.chatroom; 2 | 3 | import io.rong.CenterEnum; 4 | import io.rong.RongCloud; 5 | import io.rong.methods.chatroom.distribute.Distribute; 6 | import io.rong.models.chatroom.ChatroomModel; 7 | import io.rong.models.response.ResponseResult; 8 | 9 | public class DistributeExample { 10 | /** 11 | * Replace with your App Key 12 | */ 13 | private static final String appKey = "appKey"; 14 | /** 15 | * Replace with your App Secret 16 | */ 17 | private static final String appSecret = "appSecret"; 18 | 19 | 20 | public static void main(String[] args) throws Exception { 21 | 22 | RongCloud rongCloud = RongCloud.getInstance(appKey, appSecret, CenterEnum.BJ); 23 | // Custom API URL 24 | // RongCloud rongCloud = RongCloud.getInstance(appKey, appSecret, api); 25 | 26 | Distribute distribute = rongCloud.chatroom.distribute; 27 | 28 | /** 29 | * 30 | * 31 | * Stop Chatroom Message Distribution 32 | */ 33 | ChatroomModel chatroomModel = new ChatroomModel() 34 | .setId("d7ec7a8b8d8546c98b0973417209a548"); 35 | ResponseResult result = distribute.stop(chatroomModel); 36 | 37 | System.out.println("stopDistributionMessage: " + result.toString()); 38 | 39 | /** 40 | * 41 | * 42 | * Resume Chatroom Message Distribution 43 | */ 44 | ResponseResult resumeResult = distribute.resume(chatroomModel); 45 | System.out.println("resumeDistributionMessage: " + resumeResult.toString()); 46 | 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/resources/jsonsource/conversation/verify.json: -------------------------------------------------------------------------------- 1 | { 2 | "conversation": { 3 | "_self": { 4 | "require": { 5 | "must": true, 6 | "invalid": "20005" 7 | }, 8 | "typeof": { 9 | "type": "object", 10 | "invalid": "20001" 11 | } 12 | }, 13 | "type": { 14 | "require": { 15 | "must": true, 16 | "invalid": "20005" 17 | } 18 | }, 19 | "userId": { 20 | "require": { 21 | "must": true, 22 | "invalid": "20005" 23 | }, 24 | "length": { 25 | "max": 64, 26 | "min": 1, 27 | "invalid": "20003" 28 | } 29 | }, 30 | "targetId": { 31 | "require": { 32 | "must": true, 33 | "invalid": "20005" 34 | }, 35 | "length": { 36 | "max": 64, 37 | "min": 1, 38 | "invalid": "20003" 39 | } 40 | } 41 | }, 42 | "setTop": { 43 | "userId": { 44 | "require": { 45 | "must": true, 46 | "invalid": "20005" 47 | }, 48 | "length": { 49 | "max": 64, 50 | "min": 1, 51 | "invalid": "20003" 52 | } 53 | }, 54 | "targetId": { 55 | "require": { 56 | "must": true, 57 | "invalid": "20005" 58 | }, 59 | "length": { 60 | "max": 64, 61 | "min": 1, 62 | "invalid": "20003" 63 | } 64 | }, 65 | "setTop": { 66 | "require": { 67 | "must": true, 68 | "invalid": "20005" 69 | } 70 | }, 71 | "conversationType": { 72 | "require": { 73 | "must": true, 74 | "invalid": "20005" 75 | } 76 | } 77 | } 78 | } -------------------------------------------------------------------------------- /src/main/java/io/rong/methods/group/mute/whitelist/MuteWhiteList.java: -------------------------------------------------------------------------------- 1 | package io.rong.methods.group.mute.whitelist; 2 | 3 | import io.rong.RongCloud; 4 | import io.rong.methods.group.ban.whitelist.User; 5 | /** 6 | * Group Mute Whitelist Service 7 | * When a group is muted, if certain users need to be allowed to speak, they can be added to the group mute whitelist. The group mute whitelist only takes effect when the group is set to mute all members. 8 | * @author rc 9 | * 10 | * */ 11 | public class MuteWhiteList { 12 | private static final String UTF8 = "UTF-8"; 13 | private static final String PATH = "group/ban/whitelist"; 14 | private String appKey; 15 | private String appSecret; 16 | private RongCloud rongCloud; 17 | public User user; 18 | 19 | public RongCloud getRongCloud() { 20 | return rongCloud; 21 | } 22 | public void setRongCloud(RongCloud rongCloud) { 23 | this.rongCloud = rongCloud; 24 | } 25 | public MuteWhiteList(String appKey, String appSecret, RongCloud rongCloud) { 26 | this.appKey = appKey; 27 | this.appSecret = appSecret; 28 | this.rongCloud = rongCloud; 29 | this.user = new User(appKey,appSecret,rongCloud); 30 | 31 | } 32 | 33 | public static String getUTF8() { 34 | return UTF8; 35 | } 36 | 37 | public String getAppKey() { 38 | return appKey; 39 | } 40 | 41 | public void setAppKey(String appKey) { 42 | this.appKey = appKey; 43 | } 44 | 45 | public String getAppSecret() { 46 | return appSecret; 47 | } 48 | 49 | public void setAppSecret(String appSecret) { 50 | this.appSecret = appSecret; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/agent/ChatModel.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.agent; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | import java.util.Map; 6 | 7 | /** 8 | * @author RongCloud 9 | */ 10 | public class ChatModel { 11 | private String conversationId; 12 | private Boolean memory; 13 | private String agentId; 14 | private String query; 15 | private Map variables; 16 | private String user; 17 | 18 | public String getConversationId() { 19 | return conversationId; 20 | } 21 | 22 | public void setConversationId(String conversationId) { 23 | this.conversationId = conversationId; 24 | } 25 | 26 | public Boolean getMemory() { 27 | return memory; 28 | } 29 | 30 | public void setMemory(Boolean memory) { 31 | this.memory = memory; 32 | } 33 | 34 | public String getAgentId() { 35 | return agentId; 36 | } 37 | 38 | public void setAgentId(String agentId) { 39 | this.agentId = agentId; 40 | } 41 | 42 | public String getQuery() { 43 | return query; 44 | } 45 | 46 | public void setQuery(String query) { 47 | this.query = query; 48 | } 49 | 50 | public Map getVariables() { 51 | return variables; 52 | } 53 | 54 | public void setVariables(Map variables) { 55 | this.variables = variables; 56 | } 57 | 58 | public String getUser() { 59 | return user; 60 | } 61 | 62 | public void setUser(String user) { 63 | this.user = user; 64 | } 65 | 66 | @Override 67 | public String toString() { 68 | return GsonUtil.toJson(this, ChatModel.class); 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/chatroom/ChatroomDestroyTypeModel.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.chatroom; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | /** 6 | * @author RongCloud 7 | */ 8 | public class ChatroomDestroyTypeModel { 9 | /** 10 | * The user ID of the chatroom. 11 | */ 12 | public String id; 13 | /** 14 | * Specifies the destruction method of the chatroom. 15 | */ 16 | public Integer destroyType; 17 | /** 18 | * Sets the destruction time of the chatroom. 19 | */ 20 | public Integer destroyTime; 21 | 22 | public ChatroomDestroyTypeModel() { 23 | super(); 24 | } 25 | public ChatroomDestroyTypeModel(String id, Integer destroyType, Integer destroyTime) { 26 | this.id = id; 27 | this.destroyType = destroyType; 28 | this.destroyTime = destroyTime; 29 | } 30 | 31 | public String getId() { 32 | return id; 33 | } 34 | 35 | public ChatroomDestroyTypeModel setId(String id) { 36 | this.id = id; 37 | return this; 38 | } 39 | 40 | public Integer getDestroyType() { 41 | return destroyType; 42 | } 43 | 44 | public ChatroomDestroyTypeModel setDestroyType(Integer destroyType) { 45 | this.destroyType = destroyType; 46 | return this; 47 | } 48 | 49 | public Integer getDestroyTime() { 50 | return destroyTime; 51 | } 52 | 53 | public ChatroomDestroyTypeModel setDestroyTime(Integer destroyTime) { 54 | this.destroyTime = destroyTime; 55 | return this; 56 | } 57 | 58 | @Override 59 | public String toString() { 60 | return GsonUtil.toJson(this, ChatroomDestroyTypeModel.class); 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/io/rong/example/chatroom/DemotionExample.java: -------------------------------------------------------------------------------- 1 | package io.rong.example.chatroom; 2 | 3 | import io.rong.CenterEnum; 4 | import io.rong.RongCloud; 5 | import io.rong.methods.chatroom.demotion.Demotion; 6 | import io.rong.models.response.ChatroomDemotionMsgResult; 7 | import io.rong.models.response.ResponseResult; 8 | 9 | public class DemotionExample { 10 | /** 11 | * Replace with your appKey 12 | */ 13 | private static final String appKey = "appKey"; 14 | /** 15 | * Replace with your appSecret 16 | */ 17 | private static final String appSecret = "appSecret"; 18 | 19 | 20 | public static void main(String[] args) throws Exception { 21 | RongCloud rongCloud = RongCloud.getInstance(appKey, appSecret, CenterEnum.BJ); 22 | 23 | Demotion demotion = rongCloud.chatroom.demotion; 24 | 25 | /** 26 | * 27 | * Add in-app chatroom message demotion 28 | */ 29 | String[] messageType = {"RC:VcMsg", "RC:ImgTextMsg", "RC:ImgMsg"}; 30 | ResponseResult addResult = demotion.add(messageType); 31 | System.out.println("add demotion: " + addResult.toString()); 32 | 33 | /** 34 | * 35 | * Remove in-app chatroom message demotion 36 | */ 37 | ResponseResult removeResult = demotion.remove(messageType); 38 | System.out.println("remove demotion: " + removeResult.toString()); 39 | 40 | 41 | /** 42 | * Retrieves the list of demotion messages and prints the result. 43 | */ 44 | ChatroomDemotionMsgResult demotionMsgResult = demotion.getList(); 45 | System.out.println("get demotion: " + demotionMsgResult.toString()); 46 | 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/TokenResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.models.Result; 4 | import io.rong.util.GsonUtil; 5 | 6 | /** 7 | * Result of getToken 8 | */ 9 | public class TokenResult extends Result { 10 | // User Token, which can be stored within the application and has a length of up to 256 bytes. 11 | String token; 12 | // User ID, which is the same as the input User ID. 13 | String userId; 14 | 15 | private String reqBody; 16 | 17 | public TokenResult(Integer code, String token, String userId, String errorMessage) { 18 | this.code = code; 19 | this.token = token; 20 | this.userId = userId; 21 | this.errorMessage = errorMessage; 22 | } 23 | 24 | /** 25 | * Set the token 26 | */ 27 | public void setToken(String token) { 28 | this.token = token; 29 | } 30 | 31 | /** 32 | * Get the token 33 | * 34 | * @return String 35 | */ 36 | public String getToken() { 37 | return token; 38 | } 39 | 40 | /** 41 | * Set the userId 42 | */ 43 | public void setUserId(String userId) { 44 | this.userId = userId; 45 | } 46 | 47 | /** 48 | * Get the userId 49 | */ 50 | 51 | /** 52 | * @return String 53 | */ 54 | public String getUserId() { 55 | return userId; 56 | } 57 | 58 | 59 | public String getReqBody() { 60 | return reqBody; 61 | } 62 | 63 | 64 | public void setReqBody(String reqBody) { 65 | this.reqBody = reqBody; 66 | } 67 | 68 | @Override 69 | public String toString() { 70 | return GsonUtil.toJson(this, TokenResult.class); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/main/java/io/rong/messages/RcCmdMessage.java: -------------------------------------------------------------------------------- 1 | package io.rong.messages; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | public class RcCmdMessage extends BaseMessage { 6 | private transient static final String TYPE = "RC:RcCmd"; 7 | private String conversationType = "6"; 8 | private String messageUId; 9 | private int isAdmin = 0; 10 | private int isDelete = 0; 11 | 12 | 13 | public RcCmdMessage(String messageUId) { 14 | this.messageUId = messageUId; 15 | } 16 | 17 | public RcCmdMessage(String messageUId, int isAdmin, int isDelete) { 18 | this.messageUId = messageUId; 19 | this.isAdmin = isAdmin; 20 | this.isDelete = isDelete; 21 | } 22 | 23 | public String getConversationType() { 24 | return conversationType; 25 | } 26 | 27 | public void setConversationType(String conversationType) { 28 | this.conversationType = conversationType; 29 | } 30 | 31 | public String getMessageUId() { 32 | return messageUId; 33 | } 34 | 35 | public void setMessageUId(String messageUId) { 36 | this.messageUId = messageUId; 37 | } 38 | 39 | public int getIsAdmin() { 40 | return isAdmin; 41 | } 42 | 43 | public void setIsAdmin(int isAdmin) { 44 | this.isAdmin = isAdmin; 45 | } 46 | 47 | public int getIsDelete() { 48 | return isDelete; 49 | } 50 | 51 | public void setIsDelete(int isDelete) { 52 | this.isDelete = isDelete; 53 | } 54 | 55 | @Override 56 | public String getType() { 57 | return TYPE; 58 | } 59 | 60 | @Override 61 | public String toString() { 62 | return GsonUtil.toJson(this, RcCmdMessage.class); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/io/rong/messages/ReadReceiptMessage.java: -------------------------------------------------------------------------------- 1 | package io.rong.messages; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | /** 6 | * A message type for read receipt notification. 7 | */ 8 | public class ReadReceiptMessage extends BaseMessage { 9 | 10 | /** 11 | * The send time of the last message - Required. Example: 1589437637920 12 | */ 13 | private String lastMessageSendTime = ""; 14 | 15 | /** 16 | * The Message UID of the last message. 17 | */ 18 | private String messageUId = ""; 19 | 20 | /** 21 | * The message type. Refer to: CodeUtil.ConversationType class. 22 | */ 23 | private int type = 1; 24 | 25 | private transient static final String TYPE = "RC:ReadNtf"; 26 | 27 | public ReadReceiptMessage() { 28 | super(); 29 | } 30 | 31 | public ReadReceiptMessage(String lastMessageSendTime, String messageUId, int type) { 32 | super(); 33 | this.lastMessageSendTime = lastMessageSendTime; 34 | this.messageUId = messageUId; 35 | this.type = type; 36 | } 37 | 38 | public String getLastMessageSendTime() { 39 | return lastMessageSendTime; 40 | } 41 | 42 | public void setLastMessageSendTime(String lastMessageSendTime) { 43 | this.lastMessageSendTime = lastMessageSendTime; 44 | } 45 | 46 | public String getMessageUId() { 47 | return messageUId; 48 | } 49 | 50 | public void setMessageUId(String messageUId) { 51 | this.messageUId = messageUId; 52 | } 53 | 54 | public int getMessageType() { 55 | return type; 56 | } 57 | 58 | public void setMessageType(int type) { 59 | this.type = type; 60 | } 61 | 62 | @Override 63 | public String getType() { 64 | return TYPE; 65 | } 66 | 67 | @Override 68 | public String toString() { 69 | return GsonUtil.toJson(this, ReadReceiptMessage.class); 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /src/main/resources/jsonsource/user/chat/api.json: -------------------------------------------------------------------------------- 1 | { 2 | "set": { 3 | "url": "user/chat/fb/set", 4 | "params": { 5 | "set": { 6 | "userId": ["ujadk90ha1"], 7 | "state": 0, 8 | "type": "PERSON" 9 | } 10 | }, 11 | "response": { 12 | "success": { 13 | "code": 200 14 | }, 15 | "fail": { 16 | "20003": { 17 | "code": "1002", 18 | "errorMessage": "{{name}} length exceeds limit, {{name}} >= {{min}} and {{name}} <= {{max}} Units: bytes" 19 | }, 20 | "1004": { 21 | "code": "1004", 22 | "errorMessage": "Signature error. Please check whether Appkey and Secret are correct." 23 | }, 24 | "1008": { 25 | "code": "1008", 26 | "errorMessage": "Call frequency exceeds limit" 27 | } 28 | } 29 | } 30 | }, 31 | "getList": { 32 | "docs": "https://docs.rongcloud.cn/v4/5X/views/im/server/user/ban.html#ban-querylist", 33 | "url": "user/chat/fb/querylist", 34 | "params": { 35 | "getList": { 36 | "type": "PERSON" 37 | } 38 | }, 39 | "response": { 40 | "success": { 41 | "code": "200", 42 | "errorMessage": "Success" 43 | }, 44 | "fail": { 45 | "1005": { 46 | "code": "1005", 47 | "errorMessage": "{{name}} length exceeds limit, {{name}} >= {{min}} and {{name}} <= {{max}}" 48 | }, 49 | "1004": { 50 | "code": "1004", 51 | "errorMessage": "Signature error. Please check whether Appkey and Secret are correct." 52 | }, 53 | "1008": { 54 | "code": "1008", 55 | "errorMessage": "Call frequency exceeds limit" 56 | } 57 | } 58 | } 59 | } 60 | } -------------------------------------------------------------------------------- /src/main/java/io/rong/models/profile/TransferOwnerModel.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.profile; 2 | 3 | /** 4 | * @author RongCloud 5 | */ 6 | public class TransferOwnerModel { 7 | private String groupId; 8 | private String newOwner; 9 | private Integer isDelBan; 10 | private Integer isDelWhite; 11 | private Integer isDelFollowed; 12 | private Integer isQuit; 13 | 14 | public String getGroupId() { 15 | return groupId; 16 | } 17 | 18 | public TransferOwnerModel setGroupId(String groupId) { 19 | this.groupId = groupId; 20 | return this; 21 | } 22 | 23 | public String getNewOwner() { 24 | return newOwner; 25 | } 26 | 27 | public TransferOwnerModel setNewOwner(String newOwner) { 28 | this.newOwner = newOwner; 29 | return this; 30 | } 31 | 32 | public Integer getIsDelBan() { 33 | return isDelBan; 34 | } 35 | 36 | public TransferOwnerModel setIsDelBan(Integer isDelBan) { 37 | this.isDelBan = isDelBan; 38 | return this; 39 | } 40 | 41 | public Integer getIsDelWhite() { 42 | return isDelWhite; 43 | } 44 | 45 | public TransferOwnerModel setIsDelWhite(Integer isDelWhite) { 46 | this.isDelWhite = isDelWhite; 47 | return this; 48 | } 49 | 50 | public Integer getIsDelFollowed() { 51 | return isDelFollowed; 52 | } 53 | 54 | public TransferOwnerModel setIsDelFollowed(Integer isDelFollowed) { 55 | this.isDelFollowed = isDelFollowed; 56 | return this; 57 | } 58 | 59 | public Integer getIsQuit() { 60 | return isQuit; 61 | } 62 | 63 | public TransferOwnerModel setIsQuit(Integer isQuit) { 64 | this.isQuit = isQuit; 65 | return this; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/ChatroomWhitelistMsgResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.models.Result; 4 | import io.rong.util.GsonUtil; 5 | 6 | public class ChatroomWhitelistMsgResult extends Result { 7 | private String[] objectNames; 8 | 9 | /** 10 | * Constructs a new ChatroomWhitelistMsgResult with the specified code, message, and object names. 11 | * 12 | * @param code The result code. 13 | * @param msg The result message. 14 | * @param objectNames The list of object names in the chatroom allowlist. 15 | */ 16 | public ChatroomWhitelistMsgResult(Integer code, String msg, String[] objectNames) { 17 | super(code, msg); 18 | this.objectNames = objectNames; 19 | } 20 | 21 | /** 22 | * Constructs a new ChatroomWhitelistMsgResult with the specified object names. 23 | * 24 | * @param objectNames The list of object names in the chatroom allowlist. 25 | */ 26 | public ChatroomWhitelistMsgResult(String[] objectNames) { 27 | this.objectNames = objectNames; 28 | } 29 | 30 | /** 31 | * Returns the list of object names in the chatroom allowlist. 32 | * 33 | * @return The list of object names. 34 | */ 35 | public String[] getObjectNames() { 36 | return this.objectNames; 37 | } 38 | 39 | /** 40 | * Sets the list of object names in the chatroom allowlist. 41 | * 42 | * @param objectNames The list of object names to set. 43 | */ 44 | public void setObjectNames(String[] objectNames) { 45 | this.objectNames = objectNames; 46 | } 47 | 48 | @Override 49 | public String toString() { 50 | return GsonUtil.toJson(this, ChatroomWhitelistMsgResult.class); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/io/rong/example/user/RemarkExample.java: -------------------------------------------------------------------------------- 1 | package io.rong.example.user; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | import io.rong.CenterEnum; 5 | import io.rong.RongCloud; 6 | import io.rong.models.Result; 7 | import io.rong.models.response.GetTagResult; 8 | import io.rong.models.user.BatchTagModel; 9 | import io.rong.models.user.GetTagModel; 10 | import io.rong.models.user.RemarkModel; 11 | import io.rong.models.user.TagModel; 12 | import io.rong.util.JsonUtil; 13 | 14 | import java.util.ArrayList; 15 | import java.util.List; 16 | 17 | /** 18 | * Demo class 19 | * 20 | * @author RongCloud 21 | * 22 | */ 23 | public class RemarkExample { 24 | /** 25 | * Replace with your App Key here 26 | */ 27 | private static final String appKey = "appKey"; 28 | /** 29 | * Replace with your App Secret here 30 | */ 31 | private static final String appSecret = "appSecret"; 32 | 33 | 34 | public static void main(String[] args) throws Exception { 35 | RongCloud rongCloud = RongCloud.getInstance(appKey, appSecret, CenterEnum.BJ); 36 | List remarks = new ArrayList<>(); 37 | RemarkModel remarkModel = new RemarkModel(); 38 | remarkModel.setId("user1"); 39 | remarkModel.setRemark("remark1"); 40 | remarks.add(remarkModel); 41 | 42 | 43 | Result result = rongCloud.user.remark.set("userId", JSON.toJSONString(remarks)); 44 | 45 | System.out.println("set remark: " + result.toString()); 46 | 47 | result = rongCloud.user.remark.del("userId", "user1"); 48 | 49 | System.out.println("del remark: " + result.toString()); 50 | 51 | 52 | result = rongCloud.user.remark.get("userId"); 53 | 54 | System.out.println("get remark: " + result.toString()); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/agent/ModelOptions.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.agent; 2 | 3 | import io.rong.util.GsonUtil; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * @author RongCloud 9 | */ 10 | public class ModelOptions { 11 | 12 | private Float temperature; 13 | private Float topP; 14 | private Integer maxTokens; 15 | private Float frequencyPenalty; 16 | private Float presencePenalty; 17 | private List stop; 18 | 19 | public Float getTemperature() { 20 | return temperature; 21 | } 22 | 23 | public void setTemperature(Float temperature) { 24 | this.temperature = temperature; 25 | } 26 | 27 | public Float getTopP() { 28 | return topP; 29 | } 30 | 31 | public void setTopP(Float topP) { 32 | this.topP = topP; 33 | } 34 | 35 | public Integer getMaxTokens() { 36 | return maxTokens; 37 | } 38 | 39 | public void setMaxTokens(Integer maxTokens) { 40 | this.maxTokens = maxTokens; 41 | } 42 | 43 | public Float getFrequencyPenalty() { 44 | return frequencyPenalty; 45 | } 46 | 47 | public void setFrequencyPenalty(Float frequencyPenalty) { 48 | this.frequencyPenalty = frequencyPenalty; 49 | } 50 | 51 | public Float getPresencePenalty() { 52 | return presencePenalty; 53 | } 54 | 55 | public void setPresencePenalty(Float presencePenalty) { 56 | this.presencePenalty = presencePenalty; 57 | } 58 | 59 | public List getStop() { 60 | return stop; 61 | } 62 | 63 | public void setStop(List stop) { 64 | this.stop = stop; 65 | } 66 | 67 | @Override 68 | public String toString() { 69 | return GsonUtil.toJson(this, ModelOptions.class); 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/profile/FriendProfileModel.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.profile; 2 | 3 | 4 | /** 5 | * @author RongCloud 6 | */ 7 | public class FriendProfileModel { 8 | /** 9 | * Operation user ID 10 | */ 11 | private String userId; 12 | /** 13 | * Target user ID, the user ID to be added as a friend 14 | */ 15 | private String targetId; 16 | /** 17 | * Friend remark name 18 | */ 19 | private String remarkName; 20 | /** 21 | * Extended Information: Developers can add custom extended attributes (Key, Value) according to their business needs. By default, up to 10 extended information items can be set. 22 | * Key is limited to 32 characters, including uppercase and lowercase letters, numbers, and '_', with the format fixed as ext_xxxxx. 23 | * Value is limited to 256 characters, with no restrictions. 24 | * Example: {"ext_key1":"value1","ext_key2":"value2"} 25 | */ 26 | private String friendExtProfile; 27 | 28 | public String getUserId() { 29 | return userId; 30 | } 31 | 32 | public void setUserId(String userId) { 33 | this.userId = userId; 34 | } 35 | 36 | public String getTargetId() { 37 | return targetId; 38 | } 39 | 40 | public void setTargetId(String targetId) { 41 | this.targetId = targetId; 42 | } 43 | 44 | public String getRemarkName() { 45 | return remarkName; 46 | } 47 | 48 | public void setRemarkName(String remarkName) { 49 | this.remarkName = remarkName; 50 | } 51 | 52 | public String getFriendExtProfile() { 53 | return friendExtProfile; 54 | } 55 | 56 | public void setFriendExtProfile(String friendExtProfile) { 57 | this.friendExtProfile = friendExtProfile; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/push/AudienceCustom.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.push; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | 7 | /** 8 | * Push Plus tag-based push notification 9 | * 10 | * @author lang 11 | */ 12 | public class AudienceCustom extends Audience { 13 | public static String AND = "AND"; 14 | public static String OR = "OR"; 15 | 16 | public List getTagItems() { 17 | return tagItems; 18 | } 19 | 20 | public void setTagItems(TagItem... ts) { 21 | for (TagItem t : ts) { 22 | tagItems.add(t); 23 | } 24 | } 25 | 26 | protected List tagItems = new ArrayList(); 27 | 28 | 29 | public static class TagItem { 30 | private String tags[] = {}; 31 | private boolean isNot = false; 32 | private String tagsOperator = OR; 33 | private String itemsOperator = OR; 34 | 35 | public String[] getTags() { 36 | return tags; 37 | } 38 | 39 | public void setTags(String[] tags) { 40 | this.tags = tags; 41 | } 42 | 43 | public boolean getIsNot() { 44 | return isNot; 45 | } 46 | 47 | public void setIsNot(boolean isNot) { 48 | this.isNot = isNot; 49 | } 50 | 51 | public String getTagsOperator() { 52 | return tagsOperator; 53 | } 54 | 55 | public void setTagsOperator(String tagsOperator) { 56 | this.tagsOperator = tagsOperator; 57 | } 58 | 59 | public String getItemsOperator() { 60 | return itemsOperator; 61 | } 62 | 63 | public void setItemsOperator(String itemsOperator) { 64 | this.itemsOperator = itemsOperator; 65 | } 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/response/ChatroomUserQueryResult.java: -------------------------------------------------------------------------------- 1 | package io.rong.models.response; 2 | 3 | import io.rong.models.Result; 4 | import io.rong.models.chatroom.ChatroomMember; 5 | import io.rong.util.GsonUtil; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * The result of chatroom user query. 11 | */ 12 | public class ChatroomUserQueryResult extends Result { 13 | /** 14 | * The total number of users in the chatroom. 15 | */ 16 | Integer total; 17 | /** 18 | * The list of chatroom members. 19 | */ 20 | List members; 21 | 22 | public ChatroomUserQueryResult(Integer code, String msg, Integer total, List members) { 23 | super(code, msg); 24 | this.total = total; 25 | this.members = members; 26 | } 27 | 28 | public ChatroomUserQueryResult(Integer total, List members) { 29 | this.total = total; 30 | this.members = members; 31 | } 32 | 33 | /** 34 | * Sets the total number of users. 35 | */ 36 | public void setTotal(Integer total) { 37 | this.total = total; 38 | } 39 | 40 | /** 41 | * Gets the total number of users. 42 | * 43 | * @return Integer 44 | */ 45 | public Integer getTotal() { 46 | return total; 47 | } 48 | 49 | /** 50 | * Get members 51 | * 52 | * @return List 53 | */ 54 | public List getMembers() { 55 | return this.members; 56 | } 57 | 58 | /** 59 | * Set members 60 | * 61 | */ 62 | public void setMembers(List members) { 63 | this.members = members; 64 | } 65 | 66 | @Override 67 | public String toString() { 68 | return GsonUtil.toJson(this, ChatroomUserQueryResult.class); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/main/java/io/rong/example/InitRongCloudExample.java: -------------------------------------------------------------------------------- 1 | package io.rong.example; 2 | 3 | import io.rong.CenterEnum; 4 | import io.rong.RongCloud; 5 | import io.rong.RongCloudConfig; 6 | import io.rong.models.response.TokenResult; 7 | import io.rong.models.user.UserModel; 8 | 9 | /** 10 | * @author rongcloud 11 | */ 12 | public class InitRongCloudExample { 13 | 14 | /** 15 | * Replace it with your App Key 16 | */ 17 | private static final String appKey = "your_app_key"; 18 | /** 19 | * Replace it with your App Secret 20 | */ 21 | private static final String appSecret = "your_app_secret"; 22 | 23 | public static void main(String[] args) throws Exception { 24 | 25 | //Method 1, use the default api host 26 | RongCloud rongCloud = RongCloud.getInstance(appKey, appSecret, CenterEnum.BJ); 27 | TokenResult result = rongCloud.user.register(new UserModel("uid", "name", "xxx")); 28 | System.out.println("getToken: " + result.toString()); 29 | 30 | // Method 2, use the specified api host 31 | rongCloud = RongCloud.getInstance(appKey, appSecret, "https://api.rong-api.com", "https://api-b.rong-api.com"); 32 | result = rongCloud.user.register(new UserModel("uid", "name", "xxx")); 33 | System.out.println("getToken: " + result.toString()); 34 | 35 | // Method 3, use the specified api host, and set the http connection timeout and read timeout 36 | RongCloudConfig cloudConfig = new RongCloudConfig("https://api.rong-api.com", null); 37 | cloudConfig.httpConnectTimeout = 30000; 38 | rongCloud = RongCloud.getInstance(appKey, appSecret, cloudConfig); 39 | result = rongCloud.user.register(new UserModel("uid", "name", "xxx")); 40 | System.out.println("getToken: " + result.toString()); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/io/rong/models/User.java: -------------------------------------------------------------------------------- 1 | package io.rong.models; 2 | 3 | public class User { 4 | /** 5 | * userId: User ID, with a maximum length of 64 bytes. It is the unique identifier for the user within the App. 6 | * It must be ensured that the same User ID is not repeated within the same App. Duplicate User IDs will be treated as the same user. 7 | */ 8 | public String id; 9 | /** 10 | * User name, with a maximum length of 128 bytes. It is used to display the user's name in push notifications. 11 | * The updated user name will take effect within 5 minutes after refreshing. (Optional, refresh if provided, ignore if not provided) 12 | */ 13 | public String name; 14 | /** 15 | * portraitUri: User avatar URI, with a maximum length of 1024 bytes. 16 | * It is used to display the user's avatar in push notifications. (Optional, refresh if provided, ignore if not provided) 17 | */ 18 | public String portraitUri; 19 | 20 | public User(String id, String name,String portraitUri) { 21 | this.id = id; 22 | this.name = name; 23 | this.portraitUri = portraitUri; 24 | } 25 | /** 26 | * Set the user ID. 27 | * 28 | */ 29 | public void setId(String id) { 30 | this.id = id; 31 | } 32 | 33 | /** 34 | * Get the user ID. 35 | * 36 | * @return String 37 | */ 38 | public String getId() { 39 | return id; 40 | } 41 | 42 | public String getName() { 43 | return this.name; 44 | } 45 | 46 | public void setName(String name) { 47 | this.name = name; 48 | } 49 | 50 | public String getPortraitUri() { 51 | return this.portraitUri; 52 | } 53 | 54 | public void setPortraitUri(String portraitUri) { 55 | this.portraitUri = portraitUri; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/io/rong/example/user/BlockExample.java: -------------------------------------------------------------------------------- 1 | package io.rong.example.user; 2 | 3 | import io.rong.CenterEnum; 4 | import io.rong.RongCloud; 5 | import io.rong.methods.user.block.Block; 6 | import io.rong.models.Result; 7 | import io.rong.models.response.BlockUserResult; 8 | import io.rong.models.response.ResponseResult; 9 | import io.rong.models.user.UserModel; 10 | 11 | public class BlockExample { 12 | /** 13 | * Replace with your App Key 14 | */ 15 | private static final String appKey = "appKey"; 16 | /** 17 | * Replace with your App Secret 18 | */ 19 | private static final String appSecret = "appSecret"; 20 | 21 | public static void main(String[] args) throws Exception { 22 | 23 | RongCloud rongCloud = RongCloud.getInstance(appKey, appSecret, CenterEnum.BJ); 24 | // Custom API URL 25 | // RongCloud rongCloud = RongCloud.getInstance(appKey, appSecret,api); 26 | 27 | Block Block = rongCloud.user.block; 28 | 29 | /** 30 | * 31 | * 32 | * Unban a user 33 | * 34 | */ 35 | UserModel user = new UserModel().setId("hkjo09h").setMinute(1000); 36 | 37 | Result addBlockResult = (ResponseResult)Block.add(user); 38 | System.out.println("userAddBlock: " + addBlockResult.toString()); 39 | 40 | /** 41 | * 42 | * 43 | * Unban a user 44 | * 45 | */ 46 | ResponseResult unBlockResult = (ResponseResult)Block.remove(user.id); 47 | System.out.println("unBlock: " + unBlockResult.toString()); 48 | 49 | /** 50 | * 51 | * 52 | * Get blocked users list 53 | * 54 | */ 55 | BlockUserResult blockResult = (BlockUserResult)Block.getList(); 56 | System.out.println("queryBlock: " + blockResult.toString()); 57 | 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/io/rong/example/chatroom/whitelist/MessageExample.java: -------------------------------------------------------------------------------- 1 | package io.rong.example.chatroom.whitelist; 2 | 3 | import io.rong.CenterEnum; 4 | import io.rong.RongCloud; 5 | import io.rong.methods.chatroom.whitelist.Whitelist; 6 | import io.rong.models.response.ChatroomWhitelistMsgResult; 7 | import io.rong.models.response.ResponseResult; 8 | 9 | /** 10 | * @author RongCloud 11 | */ 12 | public class MessageExample { 13 | /** 14 | * Replace with your App Key 15 | */ 16 | private static final String appKey = "appKey"; 17 | /** 18 | * Replace with your App Secret 19 | */ 20 | private static final String appSecret = "appSecret"; 21 | 22 | 23 | public static void main(String[] args) throws Exception { 24 | RongCloud rongCloud = RongCloud.getInstance(appKey, appSecret, CenterEnum.BJ); 25 | // Custom API endpoint 26 | // RongCloud rongCloud = RongCloud.getInstance(appKey, appSecret, api); 27 | 28 | Whitelist whitelist = rongCloud.chatroom.whiteList; 29 | String[] messageType = {"RC:VcMsg", "RC:ImgTextMsg", "RC:ImgMsg"}; 30 | 31 | /** 32 | * 33 | * Add chatroom message allowlist 34 | */ 35 | 36 | ResponseResult addResult = whitelist.message.add(messageType); 37 | System.out.println("add whitelist: " + addResult.toString()); 38 | /** 39 | * 40 | * Get chatroom message allowlist 41 | */ 42 | 43 | ChatroomWhitelistMsgResult getResult = whitelist.message.getList(); 44 | System.out.println("get whitelist: " + getResult.toString()); 45 | 46 | /** 47 | * 48 | * Delete chatroom message allowlist 49 | */ 50 | ResponseResult removeResult = whitelist.message.remove(messageType); 51 | System.out.println("remove whitelist: " + removeResult.toString()); 52 | 53 | } 54 | } 55 | --------------------------------------------------------------------------------