-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConversations.java
More file actions
47 lines (40 loc) · 1.65 KB
/
Conversations.java
File metadata and controls
47 lines (40 loc) · 1.65 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
// java examples.forum.Conversations YOUR_TOKEN
package examples.forum;
import com.lolzteam.LolzteamClient;
import com.lolzteam.models.*;
public class Conversations {
public static void main(String[] args) throws Exception {
if (args.length < 1) {
System.err.println("Usage: Conversations <TOKEN>");
System.exit(1);
}
LolzteamClient client = LolzteamClient.create(args[0]);
var forum = client.forum();
System.out.println("--- список диалогов ---");
ConversationsListResponse convResp;
try {
convResp = forum.conversationsList(null, null, 5L);
System.out.println("conversations: " + convResp.getConversations());
} catch (Exception e) {
System.err.println("skip: " + e.getMessage());
System.out.println("\ndone");
return;
}
// Get first conversation details if available
System.out.println("\n--- first conversation details ---");
try {
ConversationsGetResponse resp = forum.conversationsGet(1L);
System.out.println("conversation: " + resp.getConversation());
} catch (Exception e) {
System.err.println(" skip: " + e.getMessage());
}
System.out.println("\n--- messages ---");
try {
ConversationsMessagesListResponse resp = forum.conversationsMessagesList(1L, null, 3L, null, null, null);
System.out.println("messages: " + resp.getMessages());
} catch (Exception e) {
System.err.println(" skip: " + e.getMessage());
}
System.out.println("\ndone");
}
}