-
Notifications
You must be signed in to change notification settings - Fork 220
Expand file tree
/
Copy pathMuteChatroomsExample.java
More file actions
62 lines (55 loc) · 1.95 KB
/
MuteChatroomsExample.java
File metadata and controls
62 lines (55 loc) · 1.95 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package io.rong.example.user;
import io.rong.CenterEnum;
import io.rong.RongCloud;
import io.rong.methods.user.mute.MuteChatrooms;
import io.rong.models.chatroom.ChatroomMember;
import io.rong.models.chatroom.ChatroomModel;
import io.rong.models.response.ListGagChatroomUserResult;
import io.rong.models.response.ResponseResult;
/**
* Global chatroom mute example
* @author RongCloud
*/
public class MuteChatroomsExample {
/**
* Replace with your appKey
*/
private static final String appKey = "appKey";
/**
* Replace with your appSecret
*/
private static final String appSecret = "appSecret";
public static void main(String[] args) throws Exception {
//RongCloud rongCloud = RongCloud.getInstance(appKey, appSecret);
//Custom API endpoint
RongCloud rongCloud = RongCloud.getInstance(appKey, appSecret, CenterEnum.BJ);
MuteChatrooms muteChatrooms = rongCloud.user.muteChatrooms;
/**
*
* Add global mute for chatroom
*/
ChatroomMember[] members = {
new ChatroomMember().setId("qawr34h"), new ChatroomMember().setId("qawr35h")
};
ChatroomModel chatroom = new ChatroomModel()
.setMembers(members)
.setMinute(5);
ResponseResult result = muteChatrooms.add(chatroom);
System.out.println("addGagUser: " + result.toString());
/**
*
* Get global mute list for chatroom
*/
ListGagChatroomUserResult chatroomListGagUserResult = muteChatrooms.getList();
System.out.println("ListGagUser: " + chatroomListGagUserResult.toString());
/**
*
*
* Remove global mute for chatroom
*/
chatroom = new ChatroomModel()
.setMembers(members);
ResponseResult removeResult = muteChatrooms.remove(chatroom);
System.out.println("removeBanUser: " + removeResult.toString());
}
}