-
Notifications
You must be signed in to change notification settings - Fork 220
Expand file tree
/
Copy pathGagExample.java
More file actions
70 lines (61 loc) · 1.96 KB
/
GagExample.java
File metadata and controls
70 lines (61 loc) · 1.96 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
package io.rong.example.group;
import io.rong.CenterEnum;
import io.rong.RongCloud;
import io.rong.methods.group.gag.Gag;
import io.rong.models.Result;
import io.rong.models.group.GroupMember;
import io.rong.models.group.GroupModel;
import io.rong.models.response.ListGagGroupUserResult;
/**
* Example for muting group members
* @author RongCloud
*
* @version 3.0.0
*/
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";
/**
* Local test execution
*
* @throws Exception
*/
public static void main(String[] args) throws Exception {
RongCloud rongCloud = RongCloud.getInstance(appKey, appSecret, CenterEnum.BJ);
// Custom API endpoint
// RongCloud rongCloud = RongCloud.getInstance(appKey, appSecret,api);
Gag Gag = rongCloud.group.gag;
/**
*
* Method to mute group members
*/
GroupMember[] members = {new GroupMember().setId("ghJiu7H1"),new GroupMember().setId("ghJiu7H2")};
GroupModel group = new GroupModel()
.setId("groupId")
.setMembers(members)
.setMinute(5);
Result result = Gag.add(group);
System.out.println("group.gag.add: " + result.toString());
/**
*
* Query muted group members
*/
ListGagGroupUserResult groupLisGagUserResult = Gag.getList("groupId");
System.out.println("group.gag.getList: " + groupLisGagUserResult.toString());
/**
*
* Remove muted group members
*/
group = new GroupModel()
.setId("groupId")
.setMembers(members);
Result groupRollBackGagUserResult = Gag.remove(group);
System.out.println("group.gag.remove: " + groupRollBackGagUserResult.toString());
}
}