-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathManaging.java
More file actions
71 lines (61 loc) · 2.71 KB
/
Managing.java
File metadata and controls
71 lines (61 loc) · 2.71 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
package examples.market;
// java examples/market/Managing.java YOUR_TOKEN ITEM_ID
//
// Управление своим лотом на маркете.
import com.lolzteam.LolzteamClient;
import com.lolzteam.models.*;
public class Managing {
public static void main(String[] args) throws Exception {
String token = args[0];
long itemId = Long.parseLong(args[1]);
LolzteamClient client = LolzteamClient.create(token);
System.out.println("--- информация о лоте #" + itemId + " ---");
try {
ManagingGetResponse resp = client.market().managingGet(itemId, null);
Item item = resp.getItem();
System.out.println("title: " + item.getTitle());
System.out.println("price: " + item.getPrice());
System.out.println("category: " + item.getCategoryId());
} catch (Exception e) {
System.err.println("err: " + e.getMessage());
return;
}
System.out.println("\n--- AI-оценка цены ---");
try {
ManagingAIPriceResponse resp = client.market().managingAIPrice(itemId);
System.out.println("ai price: " + resp);
} catch (Exception e) {
System.err.println("skip: " + e.getMessage());
}
System.out.println("\n--- проверка гарантии ---");
try {
ManagingCheckGuaranteeResponse resp = client.market().managingCheckGuarantee(itemId);
System.out.println("guarantee: " + resp);
} catch (Exception e) {
System.err.println("skip: " + e.getMessage());
}
System.out.println("\n--- добавить в избранное ---");
try {
client.market().managingFavorite(itemId);
System.out.println("added to favorites");
} catch (Exception e) {
System.err.println("skip: " + e.getMessage());
}
System.out.println("\n--- удалить из избранного ---");
try {
client.market().managingUnfavorite(itemId);
System.out.println("removed from favorites");
} catch (Exception e) {
System.err.println("skip: " + e.getMessage());
}
System.out.println("\n--- поднять лот (bump) ---");
try {
client.market().managingBump(itemId);
System.out.println("bumped");
} catch (Exception e) {
System.err.println("skip (возможно, слишком рано): " + e.getMessage());
}
System.out.println("\nНОТА: изменение цены/описания не выполнено (используй managingEdit)");
System.out.println("done");
}
}