-
Notifications
You must be signed in to change notification settings - Fork 220
Expand file tree
/
Copy pathGagExample.java
More file actions
76 lines (61 loc) · 2.25 KB
/
GagExample.java
File metadata and controls
76 lines (61 loc) · 2.25 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package io.rong.example.chatroom;
import io.rong.CenterEnum;
import io.rong.RongCloud;
import io.rong.methods.chatroom.gag.Gag;
import io.rong.models.chatroom.ChatroomMember;
import io.rong.models.chatroom.ChatroomModel;
import io.rong.models.response.ListGagChatroomUserResult;
import io.rong.models.response.ResponseResult;
/**
* Example of Chatroom Mute
* @author RongCloud
*/
public class GagExample {
/**
* Replace with your App Key
* */
private static final String appKey = "appKey";
/**
* Replace with your App Secret
* */
private static final String appSecret = "appSecret";
public static void main(String[] args) throws Exception {
RongCloud rongCloud = RongCloud.getInstance(appKey, appSecret, CenterEnum.BJ);
//Custom API URL
//RongCloud rongCloud = RongCloud.getInstance(appKey, appSecret,api);
Gag gag = rongCloud.chatroom.gag;
/**
*
* Add a muted user to the chatroom (When you want to prevent a user from sending messages in a chatroom, you can mute them.
* The muted user can still receive and view messages in the chatroom but cannot send messages.)
*/
ChatroomMember[] members = {
new ChatroomMember().setId("qawr34h"),new ChatroomMember().setId("qawr35h")
};
ChatroomModel chatroom = new ChatroomModel()
.setId("hjhf07kk")
.setMembers(members)
.setMinute(5);
ResponseResult result = gag.add(chatroom);
System.out.println("addGagUser: " + result.toString());
/**
*
* Method to query muted chatroom members
*/
chatroom = new ChatroomModel()
.setId("hjhf07kk");
ListGagChatroomUserResult chatroomListGagUserResult = gag.getList(chatroom);
System.out.println("ListGagUser: " + chatroomListGagUserResult.toString());
/**
*
*
*
* Method to remove muted chatroom members
*/
chatroom = new ChatroomModel()
.setId("hjhf07kk")
.setMembers(members);
ResponseResult removeResult = gag.remove(chatroom);
System.out.println("rollbackGagUser: " + result.toString());
}
}