-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathForumCategories.java
More file actions
85 lines (71 loc) · 2.91 KB
/
ForumCategories.java
File metadata and controls
85 lines (71 loc) · 2.91 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
// java examples.forum.ForumCategories YOUR_TOKEN
package examples.forum;
import com.lolzteam.LolzteamClient;
import com.lolzteam.models.*;
public class ForumCategories {
public static void main(String[] args) throws Exception {
if (args.length < 1) {
System.err.println("Usage: ForumCategories <TOKEN>");
System.exit(1);
}
LolzteamClient client = LolzteamClient.create(args[0]);
var forum = client.forum();
System.out.println("--- categories ---");
CategoriesListResponse cats = forum.categoriesList(null, null, null);
System.out.println("categories: " + cats.getCategories());
System.out.println("\n--- category #1 ---");
try {
CategoriesGetResponse cat = forum.categoriesGet(1L);
System.out.println("category: " + cat.getCategory());
} catch (Exception e) {
System.err.println(" skip: " + e.getMessage());
}
System.out.println("\n--- forums ---");
ForumsListResponse forums = forum.forumsList(null, null, null);
System.out.println("forums: " + forums.getForums());
long forumId = 1L;
System.out.println("\n--- forum #" + forumId + " ---");
try {
ForumsGetResponse f = forum.forumsGet(forumId);
System.out.println("forum: " + f.getForum());
} catch (Exception e) {
System.err.println(" skip: " + e.getMessage());
}
System.out.println("\n--- grouped forums ---");
try {
ForumsGroupedResponse grouped = forum.forumsGrouped();
System.out.println("grouped: " + grouped);
} catch (Exception e) {
System.err.println(" skip: " + e.getMessage());
}
System.out.println("\n--- navigation ---");
try {
NavigationListResponse nav = forum.navigationList(null);
System.out.println("navigation: " + nav);
} catch (Exception e) {
System.err.println(" skip: " + e.getMessage());
}
System.out.println("\n--- pages ---");
try {
PagesListResponse pages = forum.pagesList(null, null);
System.out.println("pages: " + pages);
} catch (Exception e) {
System.err.println(" skip: " + e.getMessage());
}
System.out.println("\n--- followed forums ---");
try {
ForumsFollowedResponse followed = forum.forumsFollowed(null);
System.out.println("followed: " + followed);
} catch (Exception e) {
System.err.println(" skip: " + e.getMessage());
}
System.out.println("\n--- link forums ---");
try {
LinksListResponse links = forum.linksList();
System.out.println("links: " + links);
} catch (Exception e) {
System.err.println(" skip: " + e.getMessage());
}
System.out.println("\ndone");
}
}