-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPosts.java
More file actions
39 lines (32 loc) · 1.27 KB
/
Posts.java
File metadata and controls
39 lines (32 loc) · 1.27 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
// java examples.forum.Posts YOUR_TOKEN
package examples.forum;
import com.lolzteam.LolzteamClient;
import com.lolzteam.models.*;
public class Posts {
public static void main(String[] args) throws Exception {
if (args.length < 1) {
System.err.println("Usage: Posts <TOKEN>");
System.exit(1);
}
LolzteamClient client = LolzteamClient.create(args[0]);
var forum = client.forum();
System.out.println("--- последние посты ---");
PostsListResponse postsResp = forum.postsList(null, null, null, 5L, null);
System.out.println("posts: " + postsResp.getPosts());
System.out.println("\n--- пост #1 ---");
try {
PostsGetResponse resp = forum.postsGet(1L);
System.out.println("post: " + resp.getPost());
} catch (Exception e) {
System.err.println(" skip: " + e.getMessage());
}
System.out.println("\n--- инфо о треде #1 ---");
try {
ThreadsGetResponse resp = forum.threadsGet(1L, null);
System.out.println("thread: " + resp.getThread());
} catch (Exception e) {
System.err.println(" skip: " + e.getMessage());
}
System.out.println("\ndone");
}
}