@seayoo-web/gamer-api 2.10.9 → 2.10.11
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 +3 -4
- package/package.json +5 -5
- package/types/src/event.d.ts +3 -3
- package/types/src/event.engage/engage.claimActivationKey.d.ts +1 -0
- package/types/src/event.engage/engage.comment.d.ts +1 -0
- package/types/src/event.engage/engage.giftcode.d.ts +1 -0
- package/types/src/event.engage/engage.lottery.d.ts +1 -0
- package/types/src/event.engage/engage.lotteryDraw.d.ts +1 -0
- package/types/src/event.engage/engage.quest.d.ts +1 -0
- package/types/src/event.engage/engage.team.d.ts +1 -0
- package/types/src/event.engage/engage.vote2.d.ts +1 -0
- package/types/src/event.engage/index.d.ts +8 -2
package/dist/index.js
CHANGED
|
@@ -1465,7 +1465,7 @@ class Yr {
|
|
|
1465
1465
|
/**
|
|
1466
1466
|
* 用户参与某个玩法
|
|
1467
1467
|
*
|
|
1468
|
-
* 💡可以设置泛型参数来快速确定 engagementParam
|
|
1468
|
+
* 💡可以设置泛型参数来快速确定 engagementParam 数据类型和返回值
|
|
1469
1469
|
*
|
|
1470
1470
|
* 💡需要先调用 `visit` 接口提交访问信息
|
|
1471
1471
|
*
|
|
@@ -1486,7 +1486,6 @@ class Yr {
|
|
|
1486
1486
|
return o ?? {
|
|
1487
1487
|
message: p,
|
|
1488
1488
|
error: g
|
|
1489
|
-
// 您的道具数量不足,请先获取足够的道具
|
|
1490
1489
|
};
|
|
1491
1490
|
}
|
|
1492
1491
|
/**
|
|
@@ -1693,7 +1692,7 @@ class Yr {
|
|
|
1693
1692
|
if (!await this.token.autoLogin()) return null;
|
|
1694
1693
|
const { data: r, code: a, message: o } = await this.req.post(
|
|
1695
1694
|
"event/vote2/rewards",
|
|
1696
|
-
{ feature_id: t },
|
|
1695
|
+
{ feature_id: t, event_id: this.event },
|
|
1697
1696
|
ir,
|
|
1698
1697
|
n
|
|
1699
1698
|
);
|
|
@@ -1711,7 +1710,7 @@ class Yr {
|
|
|
1711
1710
|
if (!await this.token.autoLogin()) return [];
|
|
1712
1711
|
const { data: r } = await this.req.get("event/vote2/leaderboard", sr, {
|
|
1713
1712
|
...n,
|
|
1714
|
-
params: { feature_id: t }
|
|
1713
|
+
params: { feature_id: t, event_id: this.event }
|
|
1715
1714
|
});
|
|
1716
1715
|
return r?.candidate_votes || [];
|
|
1717
1716
|
}
|
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.10.
|
|
4
|
+
"version": "2.10.11",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"source": "index.ts",
|
|
7
7
|
"main": "./dist/index.js",
|
|
@@ -31,16 +31,16 @@
|
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/node": "^22.13.1",
|
|
33
33
|
"@seayoo-web/combo-webview": "2.7.0",
|
|
34
|
-
"@seayoo-web/tsconfig": "1.0.5",
|
|
35
|
-
"@seayoo-web/utils": "4.1.3",
|
|
36
34
|
"@seayoo-web/request": "3.4.0",
|
|
35
|
+
"@seayoo-web/tsconfig": "1.0.5",
|
|
37
36
|
"@seayoo-web/scripts": "3.1.3",
|
|
37
|
+
"@seayoo-web/utils": "4.1.3",
|
|
38
38
|
"@seayoo-web/validator": "1.1.1"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"@seayoo-web/combo-webview": "^2.7.0",
|
|
42
41
|
"@seayoo-web/utils": "^4.1.3",
|
|
43
|
-
"@seayoo-web/validator": "^1.1.1"
|
|
42
|
+
"@seayoo-web/validator": "^1.1.1",
|
|
43
|
+
"@seayoo-web/combo-webview": "^2.7.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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EngagementFeatureType, InferEngagementParam } from "./event.define";
|
|
1
|
+
import type { EngagementFeatureType, InferEngagementError, InferEngagementParam } from "./event.define";
|
|
2
2
|
import type { GamerItemType, RewardSource } from "./event.enums";
|
|
3
3
|
import type { AuthToken } from "./token";
|
|
4
4
|
import type { RequestInternalError, IRequestOptions } from "@seayoo-web/request";
|
|
@@ -110,7 +110,7 @@ export declare class EventApi {
|
|
|
110
110
|
/**
|
|
111
111
|
* 用户参与某个玩法
|
|
112
112
|
*
|
|
113
|
-
* 💡可以设置泛型参数来快速确定 engagementParam
|
|
113
|
+
* 💡可以设置泛型参数来快速确定 engagementParam 数据类型和返回值
|
|
114
114
|
*
|
|
115
115
|
* 💡需要先调用 `visit` 接口提交访问信息
|
|
116
116
|
*
|
|
@@ -129,7 +129,7 @@ export declare class EventApi {
|
|
|
129
129
|
role_name?: string;
|
|
130
130
|
}, requestOptions?: IRequestOptions): Promise<import("./event.define").EngageResponse | {
|
|
131
131
|
message: string;
|
|
132
|
-
error: RequestInternalError |
|
|
132
|
+
error: RequestInternalError | InferEngagementError<T>;
|
|
133
133
|
}>;
|
|
134
134
|
/**
|
|
135
135
|
* 用户领取除红包和实物奖励以外的所有奖励
|
|
@@ -3,3 +3,4 @@ export interface ClaimActivationKeyEngagementData {
|
|
|
3
3
|
activation_key: string;
|
|
4
4
|
}
|
|
5
5
|
export declare const ClaimActivationKeyEngagementDataValidator: import("@seayoo-web/validator").ObjectValidator<ClaimActivationKeyEngagementData, false, false>;
|
|
6
|
+
export type ClaimActivationKeyEngagementError = "activation_group_not_found" | "activation_group_expired" | "no_claim_activation_key_eligibility" | "no_activation_key_available";
|
|
@@ -3,3 +3,4 @@ export interface GiftCodeEngagementData {
|
|
|
3
3
|
gift_code: string;
|
|
4
4
|
}
|
|
5
5
|
export declare const GiftCodeEngagementDataValidator: import("@seayoo-web/validator").ObjectValidator<GiftCodeEngagementData, false, false>;
|
|
6
|
+
export type GiftCodeEngagementError = "unique_gift_code_is_empty";
|
|
@@ -40,3 +40,4 @@ export type QuestProgress = {
|
|
|
40
40
|
team?: QuestProgressTeam;
|
|
41
41
|
};
|
|
42
42
|
export declare const QuestProgressValidator: import("@seayoo-web/validator").ObjectValidator<QuestProgress, false, false>;
|
|
43
|
+
export type QuestEngagementError = "player_created_at_out_of_range" | "query_user_order_total_amount_err";
|
|
@@ -51,3 +51,4 @@ export type TeamEngagementParam = {
|
|
|
51
51
|
/** 组队码 */
|
|
52
52
|
team_code?: string;
|
|
53
53
|
};
|
|
54
|
+
export type TeamEngagementError = "team_not_found" | "team_is_full" | "user_had_joined_a_team" | "join_team_conflict" | "team_has_been_disbanded" | "exceeded_assembled_team_limit" | "change_team_visibility_not_allowed" | "disband_team_not_allowed";
|
|
@@ -36,3 +36,4 @@ export interface CandidateVote {
|
|
|
36
36
|
my_votes: number;
|
|
37
37
|
}
|
|
38
38
|
export declare const CandidateVoteValidator: import("@seayoo-web/validator").ObjectValidator<CandidateVote, false, false>;
|
|
39
|
+
export type Vote2EngagementError = "vote_not_started" | "vote_already_ended" | "vote_candidate_not_found" | "consume_item_not_enough";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type UserEngagementData, type CommentEngagementParam, type PreregisterEngagementParam, type LotteryEngagementParam, type LotteryDrawEngagementParam, type ShareEngagementParam, type SubscribeEngagementParam, type TeamEngagementParam, type VoteEngagementParam, type Vote2EngagementParam } from "./engage";
|
|
1
|
+
import { type UserEngagementData, type CommentEngagementParam, type PreregisterEngagementParam, type LotteryEngagementParam, type LotteryDrawEngagementParam, type ShareEngagementParam, type SubscribeEngagementParam, type TeamEngagementParam, type VoteEngagementParam, type Vote2EngagementParam, type Vote2EngagementError, type LotteryEngagementError, type ClaimActivationKeyEngagementError, type LotteryDrawEngagementError, type TeamEngagementError, type GiftCodeEngagementError } from "./engage";
|
|
2
2
|
import { type Reward } from "./reward";
|
|
3
3
|
import type { FeatureType } from "../event.enums";
|
|
4
4
|
import type { ZeroChatGPTEngagementParam } from "./engage.zeroChatGPT";
|
|
@@ -37,4 +37,10 @@ export type EngagementFeatureType = FeatureType | unknown;
|
|
|
37
37
|
/**
|
|
38
38
|
* 根据玩法类型推导需要提交的参数数据类型
|
|
39
39
|
*/
|
|
40
|
-
export type InferEngagementParam<T extends EngagementFeatureType> = [
|
|
40
|
+
export type InferEngagementParam<T extends EngagementFeatureType> = [T] extends ["preregister"] ? PreregisterEngagementParam : [T] extends ["lottery"] ? LotteryEngagementParam : [T] extends ["comment"] ? CommentEngagementParam : [T] extends ["share"] ? ShareEngagementParam : [T] extends ["vote"] ? VoteEngagementParam : [T] extends ["vote2"] ? Vote2EngagementParam : [T] extends ["weixin_subscribe"] ? SubscribeEngagementParam : [T] extends ["team"] ? TeamEngagementParam : [T] extends ["lottery_draw"] ? LotteryDrawEngagementParam : [T] extends ["zero_chatgpt"] ? ZeroChatGPTEngagementParam : EngagementParam;
|
|
41
|
+
export type EngagementCommonError = "invalid_token" | "event_not_found" | "feature_not_found" | "visit_record_not_found" | "event_not_started" | "event_already_ended" | "engage_feature_reached_limit" | "invalid_merchant_parameter" | "budget_not_enough" | "combo_id_not_found";
|
|
42
|
+
export type EngagementError = EngagementCommonError | TeamEngagementError | Vote2EngagementError | ClaimActivationKeyEngagementError | LotteryDrawEngagementError | LotteryEngagementError | GiftCodeEngagementError;
|
|
43
|
+
/**
|
|
44
|
+
* 根据玩法类型推导额外的错误字段
|
|
45
|
+
*/
|
|
46
|
+
export type InferEngagementError<T extends EngagementFeatureType> = ([T] extends ["vote2"] ? Vote2EngagementError : [T] extends ["claim_activation_key"] ? ClaimActivationKeyEngagementError : [T] extends ["lottery"] ? LotteryEngagementError : [T] extends ["lottery_draw"] ? LotteryDrawEngagementError : [T] extends ["team"] ? TeamEngagementError : [T] extends ["gift_code"] ? GiftCodeEngagementError : EngagementError) | EngagementCommonError;
|