-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathForumSearch.java
More file actions
75 lines (65 loc) · 2.79 KB
/
ForumSearch.java
File metadata and controls
75 lines (65 loc) · 2.79 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
// java examples.forum.ForumSearch YOUR_TOKEN
//
// Поиск по форуму: темы, посты, теги, пользователи.
package examples.forum;
import com.lolzteam.LolzteamClient;
import com.lolzteam.models.*;
public class ForumSearch {
public static void main(String[] args) throws Exception {
if (args.length < 1) {
System.err.println("Usage: ForumSearch <TOKEN>");
System.exit(1);
}
LolzteamClient client = LolzteamClient.create(args[0]);
var forum = client.forum();
// Поиск тем
System.out.println("--- search threads: 'steam' ---");
try {
SearchThreadsResponse resp = forum.searchThreads("steam", null, null, null, null, 5L, null);
System.out.println("threads: " + resp.getData());
} catch (Exception e) {
System.err.println(" skip: " + e.getMessage());
}
// Поиск постов
System.out.println("\n--- search posts: 'гарант' ---");
try {
SearchPostsResponse resp = forum.searchPosts("гарант", null, null, null, null, 5L, null);
System.out.println("posts: " + resp.getData());
} catch (Exception e) {
System.err.println(" skip: " + e.getMessage());
}
// Поиск по тегам
System.out.println("\n--- search tagged: 'steam' ---");
try {
SearchTaggedResponse resp = forum.searchTagged("steam", null, null, 5L);
System.out.println("tagged: " + resp);
} catch (Exception e) {
System.err.println(" skip: " + e.getMessage());
}
// Поиск по всему
System.out.println("\n--- search all: 'аккаунт' ---");
try {
SearchAllResponse resp = forum.searchAll("аккаунт", null, null, null, null, 5L);
System.out.println("all: " + resp.getData());
} catch (Exception e) {
System.err.println(" skip: " + e.getMessage());
}
// Поиск пользователей
System.out.println("\n--- search users: 'AS7' ---");
try {
SearchUsersResponse resp = forum.searchUsers("AS7");
System.out.println("users: " + resp.getUsers());
} catch (Exception e) {
System.err.println(" skip: " + e.getMessage());
}
// Поиск постов профиля
System.out.println("\n--- search profile posts ---");
try {
SearchProfilePostsResponse resp = forum.searchProfilePosts("привет", null, null, 5L);
System.out.println("profile posts: " + resp);
} catch (Exception e) {
System.err.println(" skip: " + e.getMessage());
}
System.out.println("\ndone");
}
}