-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProfilePosts.java
More file actions
41 lines (33 loc) · 1.51 KB
/
ProfilePosts.java
File metadata and controls
41 lines (33 loc) · 1.51 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
// java examples.forum.ProfilePosts YOUR_TOKEN [USER_ID]
package examples.forum;
import com.lolzteam.LolzteamClient;
import com.lolzteam.models.*;
public class ProfilePosts {
public static void main(String[] args) throws Exception {
if (args.length < 1) {
System.err.println("Usage: ProfilePosts <TOKEN> [USER_ID]");
System.exit(1);
}
long userId = args.length > 1 ? Long.parseLong(args[1]) : 1L;
LolzteamClient client = LolzteamClient.create(args[0]);
var forum = client.forum();
System.out.println("--- посты на стене пользователя #" + userId + " ---");
ProfilePostsListResponse postsResp = forum.profilePostsList(userId, null, null, 10L, null);
System.out.println("profile posts: " + postsResp.getProfilePosts());
System.out.println("\n--- пост ---");
try {
ProfilePostsGetResponse resp = forum.profilePostsGet(1L);
System.out.println("profile post: " + resp.getProfilePost());
} catch (Exception e) {
System.err.println(" skip: " + e.getMessage());
}
System.out.println("\n--- комментарии ---");
try {
ProfilePostsCommentsListResponse resp = forum.profilePostsCommentsList(1L, null, 5L);
System.out.println("comments: " + resp.getComments());
} catch (Exception e) {
System.err.println(" skip: " + e.getMessage());
}
System.out.println("\ndone");
}
}