@seayoo-web/gamer-api 1.1.5 → 1.1.6
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 +19 -17
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -66,8 +66,10 @@ class Yt {
|
|
|
66
66
|
u(this, "$gamerToken", "");
|
|
67
67
|
u(this, "req");
|
|
68
68
|
u(this, "storage");
|
|
69
|
-
this.storage = m.wx ? Z : Y
|
|
70
|
-
|
|
69
|
+
this.storage = m.wx ? Z : Y;
|
|
70
|
+
const i = O(t) ? t : `https://${j(t)}`;
|
|
71
|
+
this.req = r({
|
|
72
|
+
baseURL: `${i}/v1`,
|
|
71
73
|
timeout: 1e4,
|
|
72
74
|
responseRule: {
|
|
73
75
|
ok: { resolve: "body" },
|
|
@@ -78,8 +80,8 @@ class Yt {
|
|
|
78
80
|
}
|
|
79
81
|
},
|
|
80
82
|
// 使用箭头函数绑定执行上下文
|
|
81
|
-
requestTransformer: (
|
|
82
|
-
this.$gamerToken && (
|
|
83
|
+
requestTransformer: (c) => {
|
|
84
|
+
this.$gamerToken && (c.headers.Authorization = `Bearer ${this.$gamerToken}`);
|
|
83
85
|
}
|
|
84
86
|
}), T() ? this.$gamerToken = h("gamer_token") : this.loadGamerTokenCache();
|
|
85
87
|
}
|
|
@@ -249,7 +251,7 @@ function re(e) {
|
|
|
249
251
|
function f(e) {
|
|
250
252
|
return n(e, "role_card") && re(e.role_card);
|
|
251
253
|
}
|
|
252
|
-
function
|
|
254
|
+
function $(e) {
|
|
253
255
|
return n(e, "name", "avatar_url", "bio", "gender", "birthday") && n(e.birthday, "year", "month", "day");
|
|
254
256
|
}
|
|
255
257
|
function v(e) {
|
|
@@ -483,7 +485,7 @@ class Zt {
|
|
|
483
485
|
* https://kdocs.cn/l/cgp4gSBMbOf1?linkname=TMWBCFcOr2
|
|
484
486
|
*/
|
|
485
487
|
async getUserProfile(t) {
|
|
486
|
-
const { data: r } = await this.req.get("club/user-profile",
|
|
488
|
+
const { data: r } = await this.req.get("club/user-profile", $, {
|
|
487
489
|
params: { member_id: t }
|
|
488
490
|
});
|
|
489
491
|
return r;
|
|
@@ -495,7 +497,7 @@ class Zt {
|
|
|
495
497
|
*/
|
|
496
498
|
async updateUserProfile(t) {
|
|
497
499
|
await this.token.autoLogin();
|
|
498
|
-
const { data: r, code: i } = await this.req.post("club/user-profile", t,
|
|
500
|
+
const { data: r, code: i } = await this.req.post("club/user-profile", t, $);
|
|
499
501
|
return r ?? {
|
|
500
502
|
error: i
|
|
501
503
|
};
|
|
@@ -618,7 +620,7 @@ class Zt {
|
|
|
618
620
|
return r || { redemptions: [] };
|
|
619
621
|
}
|
|
620
622
|
}
|
|
621
|
-
var ke = /* @__PURE__ */ ((e) => (e.EventItem = "event_item", e.GameItem = "game_item", e.PhysicalItem = "physical_item", e.WeixinHongbao = "weixin_hongbao", e.GiftCode = "gift_code", e.LotteryTicket = "lottery_ticket", e.VoidItem = "void_item", e))(ke || {}), be = /* @__PURE__ */ ((e) => (e.UserId = "user_id", e.RoleId = "role_id", e))(be || {}), qe = /* @__PURE__ */ ((e) => (e.None = "none", e.Daily = "daily", e.Weekly = "weekly", e.Monthly = "monthly", e))(qe || {}), o = /* @__PURE__ */ ((e) => (e.Preregister = "preregister", e.Lottery = "lottery", e.Survey = "survey", e.Invite = "invite", e.Share = "share", e.Follow = "follow", e.Subscribe = "weixin_subscribe", e.Comment = "comment", e.Vote = "vote", e.GiftCode = "gift_code", e.Register = "register", e.InvitedRegister = "invited_register", e.ClaimRewards = "claim_rewards", e.Cashback = "cashback", e.Quest = "quest", e.Team = "team", e.LotteryDraw = "lottery_draw", e))(o || {}), Re = /* @__PURE__ */ ((e) => (e.Active = "player_active_points", e.Login = "player_login_days", e.OrderAmount = "order_total_amount", e.Posts = "community_posts", e.Comments = "community_comments", e))(Re || {}), xe = /* @__PURE__ */ ((e) => (e.System = "system", e.UserSubmission = "user_submission", e.Shortlisted = "shortlisted", e))(xe || {}), Ae = /* @__PURE__ */ ((e) => (e.Ineligible = "ineligible", e.Unaccalimed = "unaccalimed", e.Received = "received", e))(Ae || {}), Le = /* @__PURE__ */ ((e) => (e.Unaccalimed = "unaccalimed", e.Received = "received", e.Failed = "failed", e.Delivered = "delivered", e))(Le || {}), Ce = /* @__PURE__ */ ((e) => (e.Ineligible = "ineligible", e.Unaccalimed = "unaccalimed", e.Received = "received", e.Failed = "failed", e))(Ce || {}),
|
|
623
|
+
var ke = /* @__PURE__ */ ((e) => (e.EventItem = "event_item", e.GameItem = "game_item", e.PhysicalItem = "physical_item", e.WeixinHongbao = "weixin_hongbao", e.GiftCode = "gift_code", e.LotteryTicket = "lottery_ticket", e.VoidItem = "void_item", e))(ke || {}), be = /* @__PURE__ */ ((e) => (e.UserId = "user_id", e.RoleId = "role_id", e))(be || {}), qe = /* @__PURE__ */ ((e) => (e.None = "none", e.Daily = "daily", e.Weekly = "weekly", e.Monthly = "monthly", e))(qe || {}), o = /* @__PURE__ */ ((e) => (e.Preregister = "preregister", e.Lottery = "lottery", e.Survey = "survey", e.Invite = "invite", e.Share = "share", e.Follow = "follow", e.Subscribe = "weixin_subscribe", e.Comment = "comment", e.Vote = "vote", e.GiftCode = "gift_code", e.Register = "register", e.InvitedRegister = "invited_register", e.ClaimRewards = "claim_rewards", e.Cashback = "cashback", e.Quest = "quest", e.Team = "team", e.LotteryDraw = "lottery_draw", e))(o || {}), Re = /* @__PURE__ */ ((e) => (e.Active = "player_active_points", e.Login = "player_login_days", e.OrderAmount = "order_total_amount", e.Posts = "community_posts", e.Comments = "community_comments", e))(Re || {}), xe = /* @__PURE__ */ ((e) => (e.System = "system", e.UserSubmission = "user_submission", e.Shortlisted = "shortlisted", e))(xe || {}), Ae = /* @__PURE__ */ ((e) => (e.Ineligible = "ineligible", e.Unaccalimed = "unaccalimed", e.Received = "received", e))(Ae || {}), Le = /* @__PURE__ */ ((e) => (e.Unaccalimed = "unaccalimed", e.Received = "received", e.Failed = "failed", e.Delivered = "delivered", e))(Le || {}), Ce = /* @__PURE__ */ ((e) => (e.Ineligible = "ineligible", e.Unaccalimed = "unaccalimed", e.Received = "received", e.Failed = "failed", e))(Ce || {}), $e = /* @__PURE__ */ ((e) => (e.Output = "output", e.Engage = "engage", e))($e || {}), Ue = /* @__PURE__ */ ((e) => (e.Private = "private", e.Public = "public", e))(Ue || {}), Pe = /* @__PURE__ */ ((e) => (e.Unknown = "unknown", e.Pending = "pending", e.Drawn = "drawn", e.Claimed = "claimed", e.Fail = "fail", e))(Pe || {}), Se = /* @__PURE__ */ ((e) => (e.Assemble = "assemble", e.Join = "join", e.Disband = "disband", e.ChangeVisibility = "change_visibility", e.Query = "query", e))(Se || {}), De = /* @__PURE__ */ ((e) => (e.Query = "query", e.Draw = "draw", e.Claim = "claim", e))(De || {});
|
|
622
624
|
function Ee(e) {
|
|
623
625
|
return n(e, "event_name", "rules", "since", "until", "features") && Array.isArray(e.features) && e.features.every(Ge);
|
|
624
626
|
}
|
|
@@ -1167,16 +1169,16 @@ function q(e) {
|
|
|
1167
1169
|
"create_time"
|
|
1168
1170
|
) && a(e.topics, b) && F(e.forum);
|
|
1169
1171
|
}
|
|
1170
|
-
function
|
|
1172
|
+
function U(e) {
|
|
1171
1173
|
return n(e, "next_token", "posts") && a(e.posts, q);
|
|
1172
1174
|
}
|
|
1173
|
-
function
|
|
1175
|
+
function $t(e) {
|
|
1174
1176
|
return n(e, "post") && q(e.post);
|
|
1175
1177
|
}
|
|
1176
1178
|
function R(e) {
|
|
1177
1179
|
return n(e);
|
|
1178
1180
|
}
|
|
1179
|
-
function
|
|
1181
|
+
function Ut(e) {
|
|
1180
1182
|
return n(e) && ("post" in e ? q(e.post) : !0) && ("antispam" in e ? R(e.antispam) : !0);
|
|
1181
1183
|
}
|
|
1182
1184
|
function g(e) {
|
|
@@ -1295,7 +1297,7 @@ class er {
|
|
|
1295
1297
|
* https://kdocs.cn/l/cbggfJodHLIz?linkname=XKI9lDVrPq
|
|
1296
1298
|
*/
|
|
1297
1299
|
async getPosts(t) {
|
|
1298
|
-
const { data: r, code: i } = await this.req.get("community/posts",
|
|
1300
|
+
const { data: r, code: i } = await this.req.get("community/posts", U, {
|
|
1299
1301
|
params: s(t)
|
|
1300
1302
|
});
|
|
1301
1303
|
return r ?? { error: i };
|
|
@@ -1306,7 +1308,7 @@ class er {
|
|
|
1306
1308
|
* https://kdocs.cn/l/cbggfJodHLIz?linkname=yXubbZuDlC
|
|
1307
1309
|
*/
|
|
1308
1310
|
async getPinnedPosts(t, r, i) {
|
|
1309
|
-
const { data: c, code: d } = await this.req.get("community/pinned-posts",
|
|
1311
|
+
const { data: c, code: d } = await this.req.get("community/pinned-posts", U, {
|
|
1310
1312
|
params: s({ forum_id: t, max_results: r, next_token: i })
|
|
1311
1313
|
});
|
|
1312
1314
|
return c ?? { error: d };
|
|
@@ -1317,7 +1319,7 @@ class er {
|
|
|
1317
1319
|
* https://kdocs.cn/l/cbggfJodHLIz?linkname=hj1AZy5rcP
|
|
1318
1320
|
*/
|
|
1319
1321
|
async getPost(t) {
|
|
1320
|
-
const { data: r, code: i } = await this.req.get("community/post",
|
|
1322
|
+
const { data: r, code: i } = await this.req.get("community/post", $t, {
|
|
1321
1323
|
params: { post_id: t }
|
|
1322
1324
|
});
|
|
1323
1325
|
return (r == null ? void 0 : r.post) ?? { error: i };
|
|
@@ -1328,7 +1330,7 @@ class er {
|
|
|
1328
1330
|
* https://kdocs.cn/l/cbggfJodHLIz?linkname=M5okHBuaVk
|
|
1329
1331
|
*/
|
|
1330
1332
|
async post(t) {
|
|
1331
|
-
const { data: r, code: i } = await this.req.post("community/post", s(t),
|
|
1333
|
+
const { data: r, code: i } = await this.req.post("community/post", s(t), Ut);
|
|
1332
1334
|
return r ?? {
|
|
1333
1335
|
error: i
|
|
1334
1336
|
};
|
|
@@ -1625,11 +1627,11 @@ export {
|
|
|
1625
1627
|
zt as NotificationType,
|
|
1626
1628
|
Ht as PostStatus,
|
|
1627
1629
|
Re as QuestObjective,
|
|
1628
|
-
|
|
1630
|
+
$e as RewardSoure,
|
|
1629
1631
|
Ae as RewardStatusPrefix,
|
|
1630
1632
|
Le as RewardStatusSuffix,
|
|
1631
1633
|
Se as TeamAction,
|
|
1632
|
-
|
|
1634
|
+
Ue as TeamVisibility,
|
|
1633
1635
|
xe as VoteOptionSource,
|
|
1634
1636
|
tr as WeixinApi,
|
|
1635
1637
|
Jt as WeixinWebLoginErrorCode
|
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": "1.1.
|
|
4
|
+
"version": "1.1.6",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"source": "index.ts",
|
|
7
7
|
"main": "./dist/index.js",
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@types/node": "^22.13.1",
|
|
25
25
|
"@seayoo-web/combo-webview": "^2.5.0",
|
|
26
|
-
"@seayoo-web/request": "^2.1.2",
|
|
27
26
|
"@seayoo-web/tsconfig": "^1.0.3",
|
|
28
27
|
"@seayoo-web/scripts": "^1.3.9",
|
|
29
|
-
"@seayoo-web/utils": "^3.0.10"
|
|
28
|
+
"@seayoo-web/utils": "^3.0.10",
|
|
29
|
+
"@seayoo-web/request": "^2.1.2"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"@seayoo-web/combo-webview": "^2.5.0",
|