@seayoo-web/gamer-api 2.15.4 → 2.15.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +99 -80
- package/package.json +4 -4
- package/types/src/event.d.ts +14 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isComboWebView as de } from "@seayoo-web/combo-webview";
|
|
2
|
-
import { isPlainObject as h, supportWx as _, useConsole as ge, usePromise as pe, pruneURL as _e, supportWindow as be, queryString as
|
|
2
|
+
import { isPlainObject as h, supportWx as _, useConsole as ge, usePromise as pe, pruneURL as _e, supportWindow as be, queryString as U, pruneObject as c, omitFields as P, parseJSON as ye, removePara as O } from "@seayoo-web/utils";
|
|
3
3
|
import { v as e, objectGuard as s } from "@seayoo-web/validator";
|
|
4
4
|
function he(i) {
|
|
5
5
|
return h(i, "gamer_token") && typeof i.gamer_token == "string";
|
|
@@ -7,7 +7,7 @@ function he(i) {
|
|
|
7
7
|
function fe(i) {
|
|
8
8
|
return h(i, "gamer_token", "game_id") && typeof i.gamer_token == "string" && typeof i.game_id == "string";
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function N(i) {
|
|
11
11
|
return h(i);
|
|
12
12
|
}
|
|
13
13
|
const j = ge("GamerApiSDK");
|
|
@@ -90,7 +90,7 @@ class ba {
|
|
|
90
90
|
this.$gamerToken && (a.headers.Authorization = `Bearer ${this.$gamerToken}`);
|
|
91
91
|
}
|
|
92
92
|
}), be()) {
|
|
93
|
-
const a = /^(?:localhost|[\d.]+):\d{4}$/.test(location.host), o =
|
|
93
|
+
const a = /^(?:localhost|[\d.]+):\d{4}$/.test(location.host), o = U("gamer_token");
|
|
94
94
|
(de() || a && o) && (this.$gamerToken = o);
|
|
95
95
|
}
|
|
96
96
|
this.$gamerToken || this.loadGamerTokenCache();
|
|
@@ -224,7 +224,7 @@ class ba {
|
|
|
224
224
|
*/
|
|
225
225
|
async getSession() {
|
|
226
226
|
if (!await this.autoLogin()) return null;
|
|
227
|
-
const { data: t } = await this.req.get("session",
|
|
227
|
+
const { data: t } = await this.req.get("session", N, {
|
|
228
228
|
message: !1
|
|
229
229
|
});
|
|
230
230
|
return t;
|
|
@@ -236,7 +236,7 @@ class ba {
|
|
|
236
236
|
*/
|
|
237
237
|
async authRealName(t) {
|
|
238
238
|
if (!await this.autoLogin()) return null;
|
|
239
|
-
const { data: n } = await this.req.post("auth-real-name", c(t),
|
|
239
|
+
const { data: n } = await this.req.post("auth-real-name", c(t), N);
|
|
240
240
|
return n;
|
|
241
241
|
}
|
|
242
242
|
}
|
|
@@ -399,7 +399,7 @@ const Ce = {
|
|
|
399
399
|
updated_at: e.number(),
|
|
400
400
|
redeemable_quantity: e.number().optional()
|
|
401
401
|
}).lock(), Oe = e.object({
|
|
402
|
-
...
|
|
402
|
+
...P(X.shape, "tag"),
|
|
403
403
|
product: Y.clone().optional()
|
|
404
404
|
}).lock(), ya = e.union(
|
|
405
405
|
e.object({
|
|
@@ -436,7 +436,7 @@ const Ce = {
|
|
|
436
436
|
status: Ue,
|
|
437
437
|
created_at: e.number(),
|
|
438
438
|
extra_data: e.union(Ne.clone(), Qe.clone()).satisfies().optional()
|
|
439
|
-
}), Me = e.guard(Pe),
|
|
439
|
+
}), Me = e.guard(Pe), Q = s({ player: Ee }), Ke = s({ roles: e.array(J) }), T = s({ role_card: Ie }), B = e.guard(De), M = e.guard(Z), He = s({ addresses: e.array(Z) }), ze = e.guard(Ae), Je = s({
|
|
440
440
|
credit_logs: e.array(Ge),
|
|
441
441
|
next_token: e.string().optional()
|
|
442
442
|
}), Ze = s({ products: e.array(Y) }), Xe = s({ benefits: e.array(X) }), Ye = s({ benefit: Oe }), We = s({
|
|
@@ -470,7 +470,7 @@ class ha {
|
|
|
470
470
|
*/
|
|
471
471
|
async getCurrentPlayer(t) {
|
|
472
472
|
await this.token.autoLogin();
|
|
473
|
-
const { data: n, code: r, message: a } = await this.req.get("club/current-player",
|
|
473
|
+
const { data: n, code: r, message: a } = await this.req.get("club/current-player", Q, t);
|
|
474
474
|
return n?.player ?? {
|
|
475
475
|
message: a,
|
|
476
476
|
error: r
|
|
@@ -486,7 +486,7 @@ class ha {
|
|
|
486
486
|
const { data: n, code: r, message: a } = await this.req.post(
|
|
487
487
|
"club/link-player",
|
|
488
488
|
{ id_token: this.token.idToken },
|
|
489
|
-
|
|
489
|
+
Q,
|
|
490
490
|
t
|
|
491
491
|
);
|
|
492
492
|
return n?.player ?? {
|
|
@@ -547,7 +547,7 @@ class ha {
|
|
|
547
547
|
*/
|
|
548
548
|
async getUserProfile(t, n) {
|
|
549
549
|
await this.token.autoLogin();
|
|
550
|
-
const { data: r } = await this.req.get("club/user-profile",
|
|
550
|
+
const { data: r } = await this.req.get("club/user-profile", B, {
|
|
551
551
|
...n,
|
|
552
552
|
params: { member_id: t }
|
|
553
553
|
});
|
|
@@ -562,7 +562,7 @@ class ha {
|
|
|
562
562
|
if (Object.keys(t).length === 0)
|
|
563
563
|
return { error: "OptionIsEmpty", message: "请提供需要修改的信息" };
|
|
564
564
|
await this.token.autoLogin();
|
|
565
|
-
const { data: r, code: a, message: o } = await this.req.post("club/user-profile", t,
|
|
565
|
+
const { data: r, code: a, message: o } = await this.req.post("club/user-profile", t, B, n);
|
|
566
566
|
return r ?? {
|
|
567
567
|
message: o,
|
|
568
568
|
error: a
|
|
@@ -588,7 +588,7 @@ class ha {
|
|
|
588
588
|
const { data: r, code: a, message: o } = await this.req.post(
|
|
589
589
|
"/club/add-address",
|
|
590
590
|
c(t),
|
|
591
|
-
|
|
591
|
+
M,
|
|
592
592
|
n
|
|
593
593
|
);
|
|
594
594
|
return r ?? {
|
|
@@ -606,7 +606,7 @@ class ha {
|
|
|
606
606
|
const { data: r, code: a, message: o } = await this.req.post(
|
|
607
607
|
"club/update-address",
|
|
608
608
|
c(t),
|
|
609
|
-
|
|
609
|
+
M,
|
|
610
610
|
n
|
|
611
611
|
);
|
|
612
612
|
return r ?? {
|
|
@@ -856,7 +856,7 @@ const v = {
|
|
|
856
856
|
UserSubmission: "user_submission",
|
|
857
857
|
/** 投票入围 */
|
|
858
858
|
Shortlisted: "shortlisted"
|
|
859
|
-
}, ct = e.string().enum(st).lock(),
|
|
859
|
+
}, ct = e.string().enum(st).lock(), g = {
|
|
860
860
|
/** 未获得奖励 */
|
|
861
861
|
Ineligible: "ineligible",
|
|
862
862
|
/** 奖励未领取 */
|
|
@@ -867,32 +867,32 @@ const v = {
|
|
|
867
867
|
Failed: "failed",
|
|
868
868
|
/** 奖励已发货 */
|
|
869
869
|
Delivered: "delivered"
|
|
870
|
-
}, wa = e.string().enum(
|
|
870
|
+
}, wa = e.string().enum(g).lock(), ut = {
|
|
871
871
|
/** 奖励未领取 */
|
|
872
|
-
Unclaimed:
|
|
872
|
+
Unclaimed: g.Unclaimed,
|
|
873
873
|
/** 奖励已领取 */
|
|
874
|
-
Received:
|
|
874
|
+
Received: g.Received,
|
|
875
875
|
/** 奖励发放失败 */
|
|
876
|
-
Failed:
|
|
876
|
+
Failed: g.Failed,
|
|
877
877
|
/** 奖励已发货 */
|
|
878
|
-
Delivered:
|
|
878
|
+
Delivered: g.Delivered
|
|
879
879
|
}, ne = e.string().enum(ut).lock(), lt = {
|
|
880
880
|
/** 未获得奖励 */
|
|
881
|
-
Ineligible:
|
|
881
|
+
Ineligible: g.Ineligible,
|
|
882
882
|
/** 奖励未领取 */
|
|
883
|
-
Unclaimed:
|
|
883
|
+
Unclaimed: g.Unclaimed,
|
|
884
884
|
/** 奖励已领取 */
|
|
885
|
-
Received:
|
|
885
|
+
Received: g.Received,
|
|
886
886
|
/** 奖励发放失败 */
|
|
887
|
-
Failed:
|
|
887
|
+
Failed: g.Failed,
|
|
888
888
|
/** 奖励已发货 */
|
|
889
|
-
Delivered:
|
|
890
|
-
},
|
|
889
|
+
Delivered: g.Delivered
|
|
890
|
+
}, E = e.string().enum(lt).lock(), mt = {
|
|
891
891
|
/** 玩法产出奖励 */
|
|
892
892
|
Output: "output",
|
|
893
893
|
/** 玩法参与奖励 */
|
|
894
894
|
Engage: "engage"
|
|
895
|
-
},
|
|
895
|
+
}, $ = e.string().enum(mt).lock(), dt = {
|
|
896
896
|
/** 私有队伍 */
|
|
897
897
|
Private: "private",
|
|
898
898
|
/** 公开队伍 */
|
|
@@ -1048,7 +1048,7 @@ const v = {
|
|
|
1048
1048
|
}), Qt = u.InvitedRegister, Bt = e.object({
|
|
1049
1049
|
...l.shape,
|
|
1050
1050
|
feature_type: e.string().enum(Qt)
|
|
1051
|
-
}), Mt = e.string().enum(
|
|
1051
|
+
}), Mt = e.string().enum(P(v, "GiftCode", "LotteryTicket")), Kt = u.Lottery, Ht = e.object({
|
|
1052
1052
|
reward_item_id: e.number(),
|
|
1053
1053
|
reward_item_name: e.string(),
|
|
1054
1054
|
reward_item_type: Mt,
|
|
@@ -1245,14 +1245,14 @@ const v = {
|
|
|
1245
1245
|
}), R = e.object({
|
|
1246
1246
|
reward_id: e.number(),
|
|
1247
1247
|
reward_item_id: e.number(),
|
|
1248
|
-
reward_source:
|
|
1248
|
+
reward_source: $,
|
|
1249
1249
|
reward_item_name: e.string(),
|
|
1250
1250
|
reward_item_type: W,
|
|
1251
1251
|
reward_item_icon_url: e.string(),
|
|
1252
1252
|
reward_item_desc: e.string().optional(),
|
|
1253
1253
|
reward_item_rating: e.number(),
|
|
1254
1254
|
reward_amount: e.number(),
|
|
1255
|
-
reward_status:
|
|
1255
|
+
reward_status: E,
|
|
1256
1256
|
event_id: e.number(),
|
|
1257
1257
|
event_name: e.string(),
|
|
1258
1258
|
feature_id: e.number(),
|
|
@@ -1268,7 +1268,7 @@ const v = {
|
|
|
1268
1268
|
}),
|
|
1269
1269
|
e.object({
|
|
1270
1270
|
ticket: e.string(),
|
|
1271
|
-
status: e.string().enum(
|
|
1271
|
+
status: e.string().enum(P(w, "Unknown", "Pending")),
|
|
1272
1272
|
created_at: e.number(),
|
|
1273
1273
|
reward: R
|
|
1274
1274
|
})
|
|
@@ -1409,7 +1409,7 @@ const v = {
|
|
|
1409
1409
|
comment: e.string(),
|
|
1410
1410
|
video_note: e.number(),
|
|
1411
1411
|
created_at: e.number()
|
|
1412
|
-
}),
|
|
1412
|
+
}), F = e.union(
|
|
1413
1413
|
Fn,
|
|
1414
1414
|
Un,
|
|
1415
1415
|
Qn,
|
|
@@ -1437,13 +1437,13 @@ const v = {
|
|
|
1437
1437
|
reward_item_type: ee,
|
|
1438
1438
|
reward_count: e.number(),
|
|
1439
1439
|
reward_status: ne,
|
|
1440
|
-
reward_source:
|
|
1440
|
+
reward_source: $,
|
|
1441
1441
|
reward_item_name: e.string(),
|
|
1442
1442
|
reward_item_icon_url: e.string(),
|
|
1443
1443
|
reward_item_desc: e.string().optional(),
|
|
1444
1444
|
reward_item_rating: e.number(),
|
|
1445
1445
|
receive_time: e.number(),
|
|
1446
|
-
extra_data: e.union(
|
|
1446
|
+
extra_data: e.union(...F.validators, e.record(e.unknown())).satisfies().optional()
|
|
1447
1447
|
}), or = e.object({
|
|
1448
1448
|
reward_id: e.number(),
|
|
1449
1449
|
reward_item_id: e.number(),
|
|
@@ -1454,7 +1454,7 @@ const v = {
|
|
|
1454
1454
|
reward_item_rating: e.number(),
|
|
1455
1455
|
reward_amount: e.number(),
|
|
1456
1456
|
reward_status: ne,
|
|
1457
|
-
reward_source:
|
|
1457
|
+
reward_source: $,
|
|
1458
1458
|
extra_data: e.record(e.unknown()).optional()
|
|
1459
1459
|
}), ir = e.object({
|
|
1460
1460
|
engagement_id: e.number(),
|
|
@@ -1462,7 +1462,7 @@ const v = {
|
|
|
1462
1462
|
event_id: e.number(),
|
|
1463
1463
|
feature_id: e.number(),
|
|
1464
1464
|
sequence: e.number(),
|
|
1465
|
-
data:
|
|
1465
|
+
data: F.clone().optional(),
|
|
1466
1466
|
server_id: e.string().optional(),
|
|
1467
1467
|
role_id: e.string().optional(),
|
|
1468
1468
|
created_at: e.number(),
|
|
@@ -1483,13 +1483,13 @@ const v = {
|
|
|
1483
1483
|
engagement_id: e.number(),
|
|
1484
1484
|
sequence: e.number(),
|
|
1485
1485
|
feature_id: e.number(),
|
|
1486
|
-
data:
|
|
1486
|
+
data: F.clone().optional()
|
|
1487
1487
|
}).optional(),
|
|
1488
1488
|
rewards: e.array(or).optional(),
|
|
1489
1489
|
scan: e.bool().optional()
|
|
1490
1490
|
}), lr = e.object({
|
|
1491
1491
|
reward_id: e.number(),
|
|
1492
|
-
reward_status:
|
|
1492
|
+
reward_status: E
|
|
1493
1493
|
}), mr = e.guard(qn), dr = e.guard(sr), x = s({ count: e.number() }), gr = s({ first_visit: e.bool() }), pr = s({
|
|
1494
1494
|
engagements: e.union(e.array(rr), e.array(Bn))
|
|
1495
1495
|
}), _r = s({
|
|
@@ -1504,7 +1504,7 @@ const v = {
|
|
|
1504
1504
|
}), wr = s({
|
|
1505
1505
|
rewards: e.array(R)
|
|
1506
1506
|
}), kr = s({
|
|
1507
|
-
reward_status:
|
|
1507
|
+
reward_status: E
|
|
1508
1508
|
}), vr = s({
|
|
1509
1509
|
user_rewards: e.array(R),
|
|
1510
1510
|
next_token: e.string().optional()
|
|
@@ -1520,7 +1520,7 @@ const v = {
|
|
|
1520
1520
|
e.object({
|
|
1521
1521
|
candidate_votes: e.array(er)
|
|
1522
1522
|
})
|
|
1523
|
-
), Lr = e.guard(ae),
|
|
1523
|
+
), Lr = e.guard(ae), L = e.guard(Hn), Sr = e.guard(zn), Ur = e.guard(Jn), Pr = e.guard(Zn), Er = e.guard(Gn);
|
|
1524
1524
|
class Va {
|
|
1525
1525
|
token;
|
|
1526
1526
|
event = 0;
|
|
@@ -1672,7 +1672,7 @@ class Va {
|
|
|
1672
1672
|
*/
|
|
1673
1673
|
async engage(t, n, r, a) {
|
|
1674
1674
|
await this.token.autoLogin();
|
|
1675
|
-
const { data: o, code:
|
|
1675
|
+
const { data: o, code: d, message: p } = await this.req.post(
|
|
1676
1676
|
`event/${this.event}/engage`,
|
|
1677
1677
|
c({
|
|
1678
1678
|
feature_id: t,
|
|
@@ -1684,7 +1684,7 @@ class Va {
|
|
|
1684
1684
|
);
|
|
1685
1685
|
return o ?? {
|
|
1686
1686
|
message: p,
|
|
1687
|
-
error:
|
|
1687
|
+
error: d
|
|
1688
1688
|
};
|
|
1689
1689
|
}
|
|
1690
1690
|
/**
|
|
@@ -1956,7 +1956,7 @@ class Va {
|
|
|
1956
1956
|
*/
|
|
1957
1957
|
async getUgcRecord(t, n) {
|
|
1958
1958
|
if (!await this.token.autoLogin()) return null;
|
|
1959
|
-
const { data: r, code: a, message: o } = await this.req.get("event/ugc/my",
|
|
1959
|
+
const { data: r, code: a, message: o } = await this.req.get("event/ugc/my", L, {
|
|
1960
1960
|
...n,
|
|
1961
1961
|
params: {
|
|
1962
1962
|
max_results: 20,
|
|
@@ -1997,14 +1997,14 @@ class Va {
|
|
|
1997
1997
|
*/
|
|
1998
1998
|
async ugcUploadImage(t, n, r) {
|
|
1999
1999
|
if (!await this.token.autoLogin()) return null;
|
|
2000
|
-
const { data: a, code: o, message:
|
|
2000
|
+
const { data: a, code: o, message: d } = await this.req.post(
|
|
2001
2001
|
"event/ugc/upload-image",
|
|
2002
2002
|
{ feature_id: t, ...n, event_id: this.event },
|
|
2003
2003
|
Ur,
|
|
2004
2004
|
r
|
|
2005
2005
|
);
|
|
2006
2006
|
return a || {
|
|
2007
|
-
message:
|
|
2007
|
+
message: d,
|
|
2008
2008
|
error: o
|
|
2009
2009
|
};
|
|
2010
2010
|
}
|
|
@@ -2014,8 +2014,7 @@ class Va {
|
|
|
2014
2014
|
* https://www.kdocs.cn/l/ckWFDcOsYEUA?linkname=WzvcAPjHAh
|
|
2015
2015
|
*/
|
|
2016
2016
|
async getUgcRecommendation(t, n) {
|
|
2017
|
-
|
|
2018
|
-
const { data: r, code: a, message: o } = await this.req.get("event/ugc/recommendation", M, {
|
|
2017
|
+
const { data: r, code: a, message: o } = await this.req.get("event/ugc/recommendation", L, {
|
|
2019
2018
|
...n,
|
|
2020
2019
|
params: {
|
|
2021
2020
|
feature_id: t,
|
|
@@ -2027,6 +2026,26 @@ class Va {
|
|
|
2027
2026
|
error: a
|
|
2028
2027
|
};
|
|
2029
2028
|
}
|
|
2029
|
+
/**
|
|
2030
|
+
* 用于查询指定活动玩法下,所有已被接收 (review_status = accepted) 的用户投稿内容列表,默认按照投稿时间倒序。
|
|
2031
|
+
*
|
|
2032
|
+
* https://www.kdocs.cn/l/ckWFDcOsYEUA?linkname=VRYN6d3rbd
|
|
2033
|
+
*/
|
|
2034
|
+
async getUgcs(t, n, r) {
|
|
2035
|
+
const { data: a, code: o, message: d } = await this.req.get("event/ugc/ugcs", L, {
|
|
2036
|
+
...r,
|
|
2037
|
+
params: {
|
|
2038
|
+
event_id: this.event,
|
|
2039
|
+
feature_id: t,
|
|
2040
|
+
max_results: 20,
|
|
2041
|
+
...n
|
|
2042
|
+
}
|
|
2043
|
+
});
|
|
2044
|
+
return a || {
|
|
2045
|
+
message: d,
|
|
2046
|
+
error: o
|
|
2047
|
+
};
|
|
2048
|
+
}
|
|
2030
2049
|
/**
|
|
2031
2050
|
* 获取指定活动玩法的 UGC 投稿排行榜数据
|
|
2032
2051
|
*
|
|
@@ -2125,14 +2144,14 @@ const $r = {
|
|
|
2125
2144
|
sort: e.number(),
|
|
2126
2145
|
mode: Fr,
|
|
2127
2146
|
member_ids: e.array(e.number())
|
|
2128
|
-
}).lock(),
|
|
2147
|
+
}).lock(), I = e.object({
|
|
2129
2148
|
topic_id: e.number(),
|
|
2130
2149
|
cover_url: e.string(),
|
|
2131
2150
|
name: e.string(),
|
|
2132
2151
|
description: e.string(),
|
|
2133
2152
|
tags: e.array(e.string()),
|
|
2134
2153
|
post_num: e.number()
|
|
2135
|
-
}).lock(),
|
|
2154
|
+
}).lock(), D = e.object({
|
|
2136
2155
|
post_id: e.number(),
|
|
2137
2156
|
forum: se,
|
|
2138
2157
|
posted_by: e.string(),
|
|
@@ -2146,7 +2165,7 @@ const $r = {
|
|
|
2146
2165
|
comments_num: e.number(),
|
|
2147
2166
|
liked: e.bool(),
|
|
2148
2167
|
image_urls: e.array(e.string()),
|
|
2149
|
-
topics: e.array(
|
|
2168
|
+
topics: e.array(I),
|
|
2150
2169
|
event_ids: e.array(e.number()),
|
|
2151
2170
|
is_pinned: e.bool(),
|
|
2152
2171
|
is_highlighted: e.bool(),
|
|
@@ -2210,7 +2229,7 @@ const $r = {
|
|
|
2210
2229
|
}).lock(), Nr = e.object({
|
|
2211
2230
|
system_message_subject: e.string(),
|
|
2212
2231
|
system_message_content: e.string()
|
|
2213
|
-
}).lock(),
|
|
2232
|
+
}).lock(), A = e.object({
|
|
2214
2233
|
post_id: e.number(),
|
|
2215
2234
|
post_subject: e.string(),
|
|
2216
2235
|
post_summary: e.string(),
|
|
@@ -2218,7 +2237,7 @@ const $r = {
|
|
|
2218
2237
|
}).lock(), V = e.object({
|
|
2219
2238
|
comment_id: e.number(),
|
|
2220
2239
|
comment_content: e.string()
|
|
2221
|
-
}).lock(),
|
|
2240
|
+
}).lock(), G = e.object({
|
|
2222
2241
|
reply_id: e.number(),
|
|
2223
2242
|
reply_content: e.string()
|
|
2224
2243
|
}).lock(), Qr = e.object({
|
|
@@ -2227,7 +2246,7 @@ const $r = {
|
|
|
2227
2246
|
notification_type: e.string().enum(m.System)
|
|
2228
2247
|
}), Br = e.object({
|
|
2229
2248
|
...y.shape,
|
|
2230
|
-
...
|
|
2249
|
+
...A.shape,
|
|
2231
2250
|
notification_type: e.string().enum(
|
|
2232
2251
|
m.PostPinned,
|
|
2233
2252
|
m.PostHighlighted,
|
|
@@ -2236,29 +2255,29 @@ const $r = {
|
|
|
2236
2255
|
)
|
|
2237
2256
|
}), Mr = e.object({
|
|
2238
2257
|
...y.shape,
|
|
2239
|
-
...
|
|
2258
|
+
...A.shape,
|
|
2240
2259
|
...V.shape,
|
|
2241
2260
|
notification_type: e.string().enum(m.PostCommented)
|
|
2242
2261
|
}), Kr = e.object({
|
|
2243
2262
|
...y.shape,
|
|
2244
2263
|
...V.shape,
|
|
2245
|
-
...
|
|
2264
|
+
...G.shape,
|
|
2246
2265
|
notification_type: e.string().enum(m.CommentReplied)
|
|
2247
2266
|
}), Hr = e.object({
|
|
2248
2267
|
...y.shape,
|
|
2249
2268
|
...V.shape,
|
|
2250
|
-
...
|
|
2269
|
+
...A.shape,
|
|
2251
2270
|
notification_type: e.string().enum(m.CommentLiked, m.CommentDeleted)
|
|
2252
2271
|
}), zr = e.object({
|
|
2253
2272
|
...y.shape,
|
|
2254
|
-
...
|
|
2273
|
+
...G.shape,
|
|
2255
2274
|
notification_type: e.string().enum(m.ReplyReplied),
|
|
2256
2275
|
comment_id: e.number(),
|
|
2257
2276
|
reply_to_reply_id: e.number(),
|
|
2258
2277
|
reply_to_reply_content: e.string()
|
|
2259
2278
|
}), Jr = e.object({
|
|
2260
2279
|
...y.shape,
|
|
2261
|
-
...
|
|
2280
|
+
...G.shape,
|
|
2262
2281
|
...V.shape,
|
|
2263
2282
|
notification_type: e.string().enum(m.ReplyLiked, m.ReplyDeleted)
|
|
2264
2283
|
}), Zr = e.union(
|
|
@@ -2269,11 +2288,11 @@ const $r = {
|
|
|
2269
2288
|
Hr,
|
|
2270
2289
|
zr,
|
|
2271
2290
|
Jr
|
|
2272
|
-
).satisfies().lock(), Xr = s({ forums: e.array(se) }), Yr = s({ topics: e.array(
|
|
2273
|
-
posts: e.array(
|
|
2291
|
+
).satisfies().lock(), Xr = s({ forums: e.array(se) }), Yr = s({ topics: e.array(I) }), Wr = s({ topic: I }), ea = s({ post: D }), K = s({
|
|
2292
|
+
posts: e.array(D),
|
|
2274
2293
|
next_token: e.string().optional()
|
|
2275
2294
|
}), ta = s({
|
|
2276
|
-
post:
|
|
2295
|
+
post: D.clone().optional(),
|
|
2277
2296
|
antispam: ce.clone().optional()
|
|
2278
2297
|
}), na = s({
|
|
2279
2298
|
replies: e.array(C),
|
|
@@ -2352,13 +2371,13 @@ class Ta {
|
|
|
2352
2371
|
* https://kdocs.cn/l/cbggfJodHLIz?linkname=yXubbZuDlC
|
|
2353
2372
|
*/
|
|
2354
2373
|
async getPinnedPosts(t, n, r, a) {
|
|
2355
|
-
const { data: o, code:
|
|
2374
|
+
const { data: o, code: d, message: p } = await this.req.get("community/pinned-posts", K, {
|
|
2356
2375
|
...a,
|
|
2357
2376
|
params: c({ forum_id: t, max_results: n, next_token: r })
|
|
2358
2377
|
});
|
|
2359
2378
|
return o ?? {
|
|
2360
2379
|
message: p,
|
|
2361
|
-
error:
|
|
2380
|
+
error: d
|
|
2362
2381
|
};
|
|
2363
2382
|
}
|
|
2364
2383
|
/**
|
|
@@ -2587,7 +2606,7 @@ const ma = s({
|
|
|
2587
2606
|
signature: e.string()
|
|
2588
2607
|
});
|
|
2589
2608
|
var da = /* @__PURE__ */ ((i) => (i.RedirectUriDisMatch = "10003", i.AppidError = "10016", i.AuthorizationError = "10015", i.NoRightForScope = "10005", i.Frequently = "10009", i.AppBanded = "10004", i.ShouldFollow = "10006", i.ScopeNull = "10010", i.RedirectUriNull = "10011", i.AppidNull = "10012", i.StateNull = "10013", i))(da || {});
|
|
2590
|
-
function
|
|
2609
|
+
function S(i) {
|
|
2591
2610
|
return h(i, "open_id", "union_id", "weixin_token");
|
|
2592
2611
|
}
|
|
2593
2612
|
const H = "wx_login_cache";
|
|
@@ -2626,7 +2645,7 @@ class qa {
|
|
|
2626
2645
|
if (!t)
|
|
2627
2646
|
return null;
|
|
2628
2647
|
const n = ye(t);
|
|
2629
|
-
return
|
|
2648
|
+
return S(n) ? (this.token.weixinToken = n.weixin_token, await this.token.autoLogin(), n) : null;
|
|
2630
2649
|
}
|
|
2631
2650
|
/**
|
|
2632
2651
|
* 小程序页面微信静默登录,获取 weixinToken / open_id / union_id。
|
|
@@ -2651,14 +2670,14 @@ class qa {
|
|
|
2651
2670
|
const n = await this.getLoginCache();
|
|
2652
2671
|
if (n)
|
|
2653
2672
|
return n;
|
|
2654
|
-
const r = await ke(), { data: a, code: o, message:
|
|
2673
|
+
const r = await ke(), { data: a, code: o, message: d } = await this.req.post(
|
|
2655
2674
|
"weixin/login",
|
|
2656
2675
|
{ code: r, appid: this.appid },
|
|
2657
|
-
|
|
2676
|
+
S,
|
|
2658
2677
|
{ ...t, message: !1 }
|
|
2659
2678
|
);
|
|
2660
2679
|
return a && (this.token.weixinToken = a.weixin_token, this.token.storage.set(H, JSON.stringify(a))), a ?? {
|
|
2661
|
-
message:
|
|
2680
|
+
message: d,
|
|
2662
2681
|
error: o
|
|
2663
2682
|
};
|
|
2664
2683
|
}
|
|
@@ -2679,9 +2698,9 @@ class qa {
|
|
|
2679
2698
|
* - snsapi_userinfo 【默认】弹出授权页面,可拿到 openid、union_id、昵称、头像等信息,但用户也可能会拒绝授权
|
|
2680
2699
|
*/
|
|
2681
2700
|
async webLogin(t = "snsapi_userinfo", n) {
|
|
2682
|
-
const r =
|
|
2701
|
+
const r = U("code"), a = Date.now(), o = +U("state");
|
|
2683
2702
|
if (!r || !o || o < a - 1e3 * 60 * 5 || o > a) {
|
|
2684
|
-
const me =
|
|
2703
|
+
const me = O(["code", "state"]);
|
|
2685
2704
|
location.replace(
|
|
2686
2705
|
`https://open.weixin.qq.com/connect/oauth2/authorize?appid=${this.appid}&redirect_uri=${encodeURIComponent(me)}&response_type=code&scope=${t}&state=${a}#wechat_redirect`
|
|
2687
2706
|
);
|
|
@@ -2692,13 +2711,13 @@ class qa {
|
|
|
2692
2711
|
message: "Error: " + r,
|
|
2693
2712
|
error: r
|
|
2694
2713
|
};
|
|
2695
|
-
const
|
|
2696
|
-
"replaceState" in history && history.replaceState({}, "",
|
|
2714
|
+
const d = O(["code", "state"]);
|
|
2715
|
+
"replaceState" in history && history.replaceState({}, "", d);
|
|
2697
2716
|
const {
|
|
2698
2717
|
data: p,
|
|
2699
2718
|
code: ue,
|
|
2700
2719
|
message: le
|
|
2701
|
-
} = await this.req.post("weixin/login", { code: r, appid: this.appid },
|
|
2720
|
+
} = await this.req.post("weixin/login", { code: r, appid: this.appid }, S, n);
|
|
2702
2721
|
return p && (this.token.weixinToken = p.weixin_token, await this.token.autoLogin()), p ?? {
|
|
2703
2722
|
message: le,
|
|
2704
2723
|
error: ue
|
|
@@ -2753,7 +2772,7 @@ export {
|
|
|
2753
2772
|
ae as CashbackEngagementDataValidator,
|
|
2754
2773
|
xn as ClaimActivationKeyEngagementDataValidator,
|
|
2755
2774
|
lt as ClaimRewardStatus,
|
|
2756
|
-
|
|
2775
|
+
E as ClaimRewardStatusValidator,
|
|
2757
2776
|
lr as ClaimedItemValidator,
|
|
2758
2777
|
Z as ClubAddressValidator,
|
|
2759
2778
|
ha as ClubApi,
|
|
@@ -2837,8 +2856,8 @@ export {
|
|
|
2837
2856
|
Kr as NotificationCommentReplyValidator,
|
|
2838
2857
|
Hr as NotificationCommentValidator,
|
|
2839
2858
|
V as NotificationPayloadCommentValidator,
|
|
2840
|
-
|
|
2841
|
-
|
|
2859
|
+
A as NotificationPayloadPostValidator,
|
|
2860
|
+
G as NotificationPayloadReplyValidator,
|
|
2842
2861
|
Nr as NotificationPayloadSystemValidator,
|
|
2843
2862
|
Mr as NotificationPostCommentValidator,
|
|
2844
2863
|
Br as NotificationPostValidator,
|
|
@@ -2852,7 +2871,7 @@ export {
|
|
|
2852
2871
|
J as PlayerRoleValidator,
|
|
2853
2872
|
Ir as PostStatus,
|
|
2854
2873
|
ie as PostStatusValidator,
|
|
2855
|
-
|
|
2874
|
+
D as PostValidator,
|
|
2856
2875
|
Fn as PreregisterEngagementDataValidator,
|
|
2857
2876
|
Or as PresignedUrlResponseValidator,
|
|
2858
2877
|
In as QuestEngagementDataValidator,
|
|
@@ -2871,8 +2890,8 @@ export {
|
|
|
2871
2890
|
fa as RewardItemType,
|
|
2872
2891
|
ee as RewardItemTypeValidator,
|
|
2873
2892
|
mt as RewardSource,
|
|
2874
|
-
|
|
2875
|
-
|
|
2893
|
+
$ as RewardSourceValidator,
|
|
2894
|
+
g as RewardStatus,
|
|
2876
2895
|
ut as RewardStatusSuffix,
|
|
2877
2896
|
ne as RewardStatusSuffixValidator,
|
|
2878
2897
|
wa as RewardStatusValidator,
|
|
@@ -2888,7 +2907,7 @@ export {
|
|
|
2888
2907
|
Ca as TeamMemberValidator,
|
|
2889
2908
|
dt as TeamVisibility,
|
|
2890
2909
|
gt as TeamVisibilityValidator,
|
|
2891
|
-
|
|
2910
|
+
I as TopicValidator,
|
|
2892
2911
|
zn as UgcCountResponseValidator,
|
|
2893
2912
|
Kn as UgcEngagementDataValidator,
|
|
2894
2913
|
Zn as UgcLeaderboardResponseValidator,
|
|
@@ -2898,7 +2917,7 @@ export {
|
|
|
2898
2917
|
wt as UgcSocialMedia,
|
|
2899
2918
|
re as UgcSocialMediaValidator,
|
|
2900
2919
|
Jn as UgcUploadImageValidator,
|
|
2901
|
-
|
|
2920
|
+
F as UserEngagementDataValidator,
|
|
2902
2921
|
ir as UserEngagementValidator,
|
|
2903
2922
|
cr as UserFeatureStatusValidator,
|
|
2904
2923
|
R as UserRewardValidator,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seayoo-web/gamer-api",
|
|
3
3
|
"description": "agent for gamer api",
|
|
4
|
-
"version": "2.15.
|
|
4
|
+
"version": "2.15.5",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"source": "index.ts",
|
|
7
7
|
"main": "./dist/index.js",
|
|
@@ -32,15 +32,15 @@
|
|
|
32
32
|
"@types/node": "^22.13.1",
|
|
33
33
|
"@seayoo-web/combo-webview": "2.8.0",
|
|
34
34
|
"@seayoo-web/scripts": "3.1.6",
|
|
35
|
-
"@seayoo-web/utils": "4.1.3",
|
|
36
35
|
"@seayoo-web/request": "3.4.2",
|
|
37
36
|
"@seayoo-web/tsconfig": "1.0.5",
|
|
37
|
+
"@seayoo-web/utils": "4.1.3",
|
|
38
38
|
"@seayoo-web/validator": "2.3.0"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"@seayoo-web/combo-webview": "^2.8.0",
|
|
42
41
|
"@seayoo-web/utils": "^4.1.3",
|
|
43
|
-
"@seayoo-web/validator": "^2.3.0"
|
|
42
|
+
"@seayoo-web/validator": "^2.3.0",
|
|
43
|
+
"@seayoo-web/combo-webview": "^2.8.0"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
46
|
"prebuild": "pnpm -F validator build && pnpm -F request build && pnpm -F combo-webview build",
|
package/types/src/event.d.ts
CHANGED
|
@@ -417,7 +417,20 @@ export declare class EventApi {
|
|
|
417
417
|
getUgcRecommendation(featureId: number, requestOptions?: IRequestOptions): Promise<import("./event.engage").UgcRecordResponse | {
|
|
418
418
|
message: string;
|
|
419
419
|
error: RequestInternalError | "event_not_found" | "feature_not_found";
|
|
420
|
-
}
|
|
420
|
+
}>;
|
|
421
|
+
/**
|
|
422
|
+
* 用于查询指定活动玩法下,所有已被接收 (review_status = accepted) 的用户投稿内容列表,默认按照投稿时间倒序。
|
|
423
|
+
*
|
|
424
|
+
* https://www.kdocs.cn/l/ckWFDcOsYEUA?linkname=VRYN6d3rbd
|
|
425
|
+
*/
|
|
426
|
+
getUgcs(featureId: number, option?: {
|
|
427
|
+
/** 单页返回的最大数量,默认 20 */
|
|
428
|
+
max_results?: number;
|
|
429
|
+
next_token?: string;
|
|
430
|
+
}, requestOptions?: IRequestOptions): Promise<import("./event.engage").UgcRecordResponse | {
|
|
431
|
+
message: string;
|
|
432
|
+
error: RequestInternalError | "event_not_found" | "feature_not_found";
|
|
433
|
+
}>;
|
|
421
434
|
/**
|
|
422
435
|
* 获取指定活动玩法的 UGC 投稿排行榜数据
|
|
423
436
|
*
|