-
Notifications
You must be signed in to change notification settings - Fork 220
Expand file tree
/
Copy pathBlockExample.java
More file actions
60 lines (49 loc) · 1.56 KB
/
BlockExample.java
File metadata and controls
60 lines (49 loc) · 1.56 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
package io.rong.example.user;
import io.rong.CenterEnum;
import io.rong.RongCloud;
import io.rong.methods.user.block.Block;
import io.rong.models.Result;
import io.rong.models.response.BlockUserResult;
import io.rong.models.response.ResponseResult;
import io.rong.models.user.UserModel;
public class BlockExample {
/**
* 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);
Block Block = rongCloud.user.block;
/**
*
*
* Unban a user
*
*/
UserModel user = new UserModel().setId("hkjo09h").setMinute(1000);
Result addBlockResult = (ResponseResult)Block.add(user);
System.out.println("userAddBlock: " + addBlockResult.toString());
/**
*
*
* Unban a user
*
*/
ResponseResult unBlockResult = (ResponseResult)Block.remove(user.id);
System.out.println("unBlock: " + unBlockResult.toString());
/**
*
*
* Get blocked users list
*
*/
BlockUserResult blockResult = (BlockUserResult)Block.getList();
System.out.println("queryBlock: " + blockResult.toString());
}
}