-
Notifications
You must be signed in to change notification settings - Fork 220
Expand file tree
/
Copy pathEntrustUserExample.java
More file actions
89 lines (73 loc) · 2.67 KB
/
Copy pathEntrustUserExample.java
File metadata and controls
89 lines (73 loc) · 2.67 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
77
78
79
80
81
82
83
84
85
86
87
88
89
package io.rong.example.profile;
import io.rong.CenterEnum;
import io.rong.RongCloud;
import io.rong.methods.profile.EntrustUser;
import io.rong.models.profile.PagingQueryUserProfilesModel;
import io.rong.models.profile.UserProfileModel;
import io.rong.models.response.QueryUserProfilesResp;
import io.rong.models.response.ResponseResult;
/**
* Group Information Hosting Service
* <p>
*
* @author RongCloud
* @version 3.6.0
*/
public class EntrustUserExample {
/**
* Replace with your App Key here
*/
private static final String APP_KEY = "appKey";
/**
* Replace with your App Secret here
*/
private static final String APP_SECRET = "secret";
/**
* Initialization
*/
private static EntrustUser entrustUser = RongCloud.getInstance(APP_KEY, APP_SECRET, CenterEnum.BJ).entrustUser;
/**
* Local testing
*
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
// User profile settings
setProfileExample();
// Batch query user profiles
batchQueryUserProfilesExample();
// Clear user hosting information
cleanProfileExample();
// Paginate through the list of all users in the application
pagingQueryUserProfilesExample();
}
// Set user profile
private static void setProfileExample() throws Exception {
UserProfileModel userProfileModel = new UserProfileModel();
userProfileModel.setUserProfile("{\"name\":\"name\"}");
userProfileModel.setUserId("userId");
userProfileModel.setUserExtProfile("{\"ext_\":\"ext\"}");
ResponseResult responseResult = entrustUser.setProfile(userProfileModel);
System.out.println(responseResult);
}
// Batch query user profiles
private static void batchQueryUserProfilesExample() throws Exception {
QueryUserProfilesResp userProfilesResp = entrustUser.batchQueryUserProfiles("uid1");
System.out.println(userProfilesResp);
}
// Clear user profile hosting information
private static void cleanProfileExample() throws Exception {
ResponseResult responseResult = entrustUser.cleanProfile("uid1");
System.out.println(responseResult);
}
// Paginate through the list of all users in the application
private static void pagingQueryUserProfilesExample() throws Exception {
PagingQueryUserProfilesModel input = new PagingQueryUserProfilesModel();
input.setPage(1);
input.setSize(10);
input.setOrder(1);
QueryUserProfilesResp userProfilesResp = entrustUser.pagingQueryUserProfiles(input);
System.out.println(userProfilesResp);
}
}