@seayoo-web/gamer-api 2.4.5 → 2.5.1
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 +309 -265
- package/package.json +4 -4
- package/types/src/event.d.ts +32 -1
- package/types/src/event.engage/engage.d.ts +8 -2
- package/types/src/event.engage/engage.lotteryDraw.reward.d.ts +5 -1
- package/types/src/event.engage/engage.zeroChatGPT.d.ts +21 -0
- package/types/src/event.engage/index.d.ts +3 -2
- package/types/src/event.guards.d.ts +6 -0
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.
|
|
4
|
+
"version": "2.5.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"source": "index.ts",
|
|
7
7
|
"main": "./dist/index.js",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/node": "^22.13.1",
|
|
33
33
|
"@seayoo-web/combo-webview": "^2.5.4",
|
|
34
|
-
"@seayoo-web/scripts": "^2.5.7",
|
|
35
34
|
"@seayoo-web/request": "^3.2.0",
|
|
36
|
-
"@seayoo-web/
|
|
37
|
-
"@seayoo-web/utils": "^3.6.0"
|
|
35
|
+
"@seayoo-web/scripts": "^2.6.0",
|
|
36
|
+
"@seayoo-web/utils": "^3.6.0",
|
|
37
|
+
"@seayoo-web/tsconfig": "^1.0.4"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"@seayoo-web/combo-webview": "^2.5.4",
|
package/types/src/event.d.ts
CHANGED
|
@@ -73,6 +73,15 @@ export declare class EventApi {
|
|
|
73
73
|
server_id: string;
|
|
74
74
|
role_id: string;
|
|
75
75
|
}, requestOptions?: IRequestOptions): Promise<import("./event.define").UserFeatureStatus[]>;
|
|
76
|
+
/**
|
|
77
|
+
* 获取用户在目标活动下的某个玩法的参与次数
|
|
78
|
+
*
|
|
79
|
+
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=uYCsjWyL36
|
|
80
|
+
*/
|
|
81
|
+
getUserEngagementCount(featureId: number, option?: {
|
|
82
|
+
server_id: string;
|
|
83
|
+
role_id: string;
|
|
84
|
+
}): Promise<Record<string, number>>;
|
|
76
85
|
/**
|
|
77
86
|
* 获取当前登录用户参与某个玩法的记录
|
|
78
87
|
*
|
|
@@ -122,11 +131,13 @@ export declare class EventApi {
|
|
|
122
131
|
role_name?: string;
|
|
123
132
|
}, requestOptions?: IRequestOptions): Promise<import("./event.define").EngageResponse | {
|
|
124
133
|
message: string;
|
|
125
|
-
error: RequestInternalError | "event_not_found" | "feature_not_found" | "invalid_weixin_appid" | "invalid_weixin_openid" | "event_not_started" | "event_already_ended" | "engage_feature_reached_limit" | "comment_too_frequently" | "lottery_reward_is_empty" | "invalid_merchant_parameter" | "budget_not_enough" | "combo_id_not_found" | "query_user_order_total_amount_err" | "unique_gift_code_is_empty" | "player_created_at_out_of_range" | "user_had_joined_a_team" | "team_is_full" | "disband_team_not_allowed" | "change_team_visibility_not_allowed" | "team_not_found" | "join_team_conflict" | "team_has_been_disbanded" | "exceeded_assembled_team_limit" | "invalid_engage_lottery_draw_ticket" | "lottery_ticket_not_found" | "draw_lottery_ticket_not_start" | "draw_lottery_ticket_is_ended" | "activation_group_not_found" | "activation_group_expired" | "no_claim_activation_key_eligibility" | "no_activation_key_available";
|
|
134
|
+
error: RequestInternalError | "event_not_found" | "feature_not_found" | "invalid_weixin_appid" | "invalid_weixin_openid" | "event_not_started" | "event_already_ended" | "engage_feature_reached_limit" | "comment_too_frequently" | "lottery_reward_is_empty" | "invalid_merchant_parameter" | "budget_not_enough" | "combo_id_not_found" | "query_user_order_total_amount_err" | "unique_gift_code_is_empty" | "player_created_at_out_of_range" | "user_had_joined_a_team" | "team_is_full" | "disband_team_not_allowed" | "change_team_visibility_not_allowed" | "team_not_found" | "join_team_conflict" | "team_has_been_disbanded" | "exceeded_assembled_team_limit" | "invalid_engage_lottery_draw_ticket" | "lottery_ticket_not_found" | "draw_lottery_ticket_not_start" | "draw_lottery_ticket_is_ended" | "activation_group_not_found" | "activation_group_expired" | "no_claim_activation_key_eligibility" | "no_activation_key_available" | "activation_key_all_claimed";
|
|
126
135
|
}>;
|
|
127
136
|
/**
|
|
128
137
|
* 用户领取除红包和实物奖励以外的所有奖励
|
|
129
138
|
*
|
|
139
|
+
* @deprecated 请优先使用 `claimRewardsV2` 接口
|
|
140
|
+
*
|
|
130
141
|
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=lCGuqgvUDP
|
|
131
142
|
*/
|
|
132
143
|
claimRewards(params: {
|
|
@@ -144,6 +155,26 @@ export declare class EventApi {
|
|
|
144
155
|
message: string;
|
|
145
156
|
error: RequestInternalError | "invalid_server_id" | "invalid_role_id" | "event_not_found" | "engagement_not_found" | "event_not_started" | "event_already_ended" | "claim_rewards_not_started" | "claim_rewards_already_ended" | "no_rewards_to_claim" | "reward_received" | "claim_reward_error";
|
|
146
157
|
}>;
|
|
158
|
+
/**
|
|
159
|
+
* 用户领取除红包和实物奖励以外的所有奖励
|
|
160
|
+
*
|
|
161
|
+
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=vdc4SrqXjF
|
|
162
|
+
*/
|
|
163
|
+
claimRewardsV2(params: {
|
|
164
|
+
/** 用户参与记录 ID */
|
|
165
|
+
engagement_id: number;
|
|
166
|
+
/** 产生奖励的来源 */
|
|
167
|
+
reward_source: RewardSource;
|
|
168
|
+
/** 游戏服务器 ID,领取游戏道具时为必填 */
|
|
169
|
+
server_id?: string | number;
|
|
170
|
+
/** 游戏角色 ID,领取游戏道具时为必填 */
|
|
171
|
+
role_id?: string;
|
|
172
|
+
/** 游戏角色名 */
|
|
173
|
+
role_name?: string;
|
|
174
|
+
}, requestOptions?: IRequestOptions): Promise<import("./event.engage").UserReward[] | {
|
|
175
|
+
message: string;
|
|
176
|
+
error: RequestInternalError | "invalid_server_id" | "invalid_role_id" | "event_not_found" | "engagement_not_found" | "event_not_started" | "event_already_ended" | "claim_rewards_not_started" | "claim_rewards_already_ended" | "no_rewards_to_claim" | "reward_received" | "claim_reward_error";
|
|
177
|
+
}>;
|
|
147
178
|
/**
|
|
148
179
|
* 用户领取红包奖励
|
|
149
180
|
*
|
|
@@ -11,6 +11,7 @@ import { type WeixinSubscribeEngagementData } from "./engage.subscribe";
|
|
|
11
11
|
import { type SurveyEngagementData } from "./engage.survey";
|
|
12
12
|
import { type TeamEngagementData } from "./engage.team";
|
|
13
13
|
import { type VoteEngagementData } from "./engage.vote";
|
|
14
|
+
import { type ZeroChatGPTData } from "./engage.zeroChatGPT";
|
|
14
15
|
export * from "./engage.cashback";
|
|
15
16
|
export * from "./engage.comment";
|
|
16
17
|
export * from "./engage.giftcode";
|
|
@@ -26,7 +27,7 @@ export * from "./engage.team";
|
|
|
26
27
|
export * from "./engage.vote";
|
|
27
28
|
export * from "./engage.claimActivationKey";
|
|
28
29
|
export type EmptyObject = Record<string | number | symbol, never>;
|
|
29
|
-
export type UserEngagementData = PreregisterEngagementData | LotteryEngagementData | SurveyEngagementData | InviteEngagementData | ShareEngagementData | VoteEngagementData | WeixinSubscribeEngagementData | CashbackEngagementData | GiftCodeEngagementData | TeamEngagementData | QuestEngagementData | LotteryDrawEngagementData | ClaimActivationKeyEngagementData | EmptyObject;
|
|
30
|
+
export type UserEngagementData = PreregisterEngagementData | LotteryEngagementData | SurveyEngagementData | InviteEngagementData | ShareEngagementData | VoteEngagementData | WeixinSubscribeEngagementData | CashbackEngagementData | GiftCodeEngagementData | TeamEngagementData | QuestEngagementData | LotteryDrawEngagementData | ClaimActivationKeyEngagementData | ZeroChatGPTData | EmptyObject;
|
|
30
31
|
export declare const UserEngagementDataValidator: import("@seayoo-web/utils").UnionValidator<[import("@seayoo-web/utils").ObjectValidator<{
|
|
31
32
|
platforms: string[];
|
|
32
33
|
}, false, false>, import("@seayoo-web/utils").ObjectValidator<LotteryEngagementData, false, false>, import("@seayoo-web/utils").ObjectValidator<{
|
|
@@ -40,7 +41,12 @@ export declare const UserEngagementDataValidator: import("@seayoo-web/utils").Un
|
|
|
40
41
|
status: /*elided*/ any;
|
|
41
42
|
reward: /*elided*/ any;
|
|
42
43
|
})[];
|
|
43
|
-
}, false, false>, import("@seayoo-web/utils").ObjectValidator<ClaimActivationKeyEngagementData, false, false>, import("@seayoo-web/utils").
|
|
44
|
+
}, false, false>, import("@seayoo-web/utils").ObjectValidator<ClaimActivationKeyEngagementData, false, false>, import("@seayoo-web/utils").ObjectValidator<{
|
|
45
|
+
conversations: {
|
|
46
|
+
role: /*elided*/ any;
|
|
47
|
+
content: /*elided*/ any;
|
|
48
|
+
}[];
|
|
49
|
+
}, false, false>, import("@seayoo-web/utils").CustomValidator<EmptyObject, false, false>], false, false> & {
|
|
44
50
|
optional: never;
|
|
45
51
|
maybeNull: never;
|
|
46
52
|
key: never;
|
|
@@ -32,7 +32,11 @@ export interface UserReward {
|
|
|
32
32
|
feature_type: FeatureType;
|
|
33
33
|
/** 领奖时间 */
|
|
34
34
|
receive_time: number;
|
|
35
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* 提供额外扩展信息,比如收获地址等,由 reward_item_type 值决定
|
|
37
|
+
*
|
|
38
|
+
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=merUzJsVYH
|
|
39
|
+
*/
|
|
36
40
|
extra_data?: Record<string, unknown>;
|
|
37
41
|
}
|
|
38
42
|
export declare const UserRewardValidator: import("@seayoo-web/utils").ObjectValidator<UserReward, false, false>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type ZeroChatGPTEngagementParam = {
|
|
2
|
+
/** 聊天内容 */
|
|
3
|
+
content: string;
|
|
4
|
+
};
|
|
5
|
+
export type Conversation = {
|
|
6
|
+
role: string;
|
|
7
|
+
content: string;
|
|
8
|
+
};
|
|
9
|
+
export type ZeroChatGPTData = {
|
|
10
|
+
conversations: Conversation[];
|
|
11
|
+
};
|
|
12
|
+
export declare const ConversationValidator: import("@seayoo-web/utils").ObjectValidator<{
|
|
13
|
+
role: string;
|
|
14
|
+
content: string;
|
|
15
|
+
}, false, false>;
|
|
16
|
+
export declare const ZeroChatGPTDataValidator: import("@seayoo-web/utils").ObjectValidator<{
|
|
17
|
+
conversations: {
|
|
18
|
+
role: /*elided*/ any;
|
|
19
|
+
content: /*elided*/ any;
|
|
20
|
+
}[];
|
|
21
|
+
}, false, false>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type UserEngagementData, type CommentEngagementParam, type PreregisterEngagementParam, type LotteryEngagementParam, type LotteryDrawEngagementParam, type ShareEngagementParam, type SubscribeEngagementParam, type TeamEngagementParam, type VoteEngagementParam } from "./engage";
|
|
2
2
|
import { type Reward } from "./reward";
|
|
3
3
|
import type { FeatureType } from "../event.enums";
|
|
4
|
+
import type { ZeroChatGPTEngagementParam } from "./engage.zeroChatGPT";
|
|
4
5
|
export * from "./engage";
|
|
5
6
|
export * from "./reward";
|
|
6
7
|
export type UserEngagement = {
|
|
@@ -31,9 +32,9 @@ export declare const UserEngagementValidator: import("@seayoo-web/utils").Object
|
|
|
31
32
|
/**
|
|
32
33
|
* 部分玩法参与时需要提供的参数
|
|
33
34
|
*/
|
|
34
|
-
export type EngagementParam = PreregisterEngagementParam | LotteryEngagementParam | CommentEngagementParam | ShareEngagementParam | VoteEngagementParam | SubscribeEngagementParam | TeamEngagementParam | LotteryDrawEngagementParam;
|
|
35
|
+
export type EngagementParam = PreregisterEngagementParam | LotteryEngagementParam | CommentEngagementParam | ShareEngagementParam | VoteEngagementParam | SubscribeEngagementParam | TeamEngagementParam | LotteryDrawEngagementParam | ZeroChatGPTEngagementParam;
|
|
35
36
|
export type EngagementFeatureType = FeatureType | unknown;
|
|
36
37
|
/**
|
|
37
38
|
* 根据玩法类型推导需要提交的参数数据类型
|
|
38
39
|
*/
|
|
39
|
-
export type InferEngagementParam<T extends EngagementFeatureType> = [unknown] extends [T] ? EngagementParam : [T] extends ["preregister"] ? PreregisterEngagementParam : [T] extends ["lottery"] ? LotteryEngagementParam : [T] extends ["comment"] ? CommentEngagementParam : [T] extends ["share"] ? ShareEngagementParam : [T] extends ["vote"] ? VoteEngagementParam : [T] extends ["weixin_subscribe"] ? SubscribeEngagementParam : [T] extends ["team"] ? TeamEngagementParam : [T] extends ["lottery_draw"] ? LotteryDrawEngagementParam : null;
|
|
40
|
+
export type InferEngagementParam<T extends EngagementFeatureType> = [unknown] extends [T] ? EngagementParam : [T] extends ["preregister"] ? PreregisterEngagementParam : [T] extends ["lottery"] ? LotteryEngagementParam : [T] extends ["comment"] ? CommentEngagementParam : [T] extends ["share"] ? ShareEngagementParam : [T] extends ["vote"] ? VoteEngagementParam : [T] extends ["weixin_subscribe"] ? SubscribeEngagementParam : [T] extends ["team"] ? TeamEngagementParam : [T] extends ["lottery_draw"] ? LotteryDrawEngagementParam : [T] extends ["zero_chatgpt"] ? ZeroChatGPTEngagementParam : null;
|
|
@@ -12,6 +12,9 @@ export declare const isEngagementsResponse: (data: unknown) => data is {
|
|
|
12
12
|
export declare const isUserFeatureStatusResponse: (data: unknown) => data is {
|
|
13
13
|
status: import("./event.define").UserFeatureStatus[];
|
|
14
14
|
};
|
|
15
|
+
export declare const isEngagementCountResponse: (data: unknown) => data is {
|
|
16
|
+
engagements_counts: Record<string, number>;
|
|
17
|
+
};
|
|
15
18
|
export declare const isUserEngagementsResponse: (data: unknown) => data is {
|
|
16
19
|
engagements: import("./event.engage").UserEngagement[];
|
|
17
20
|
next_token: string | undefined;
|
|
@@ -20,6 +23,9 @@ export declare const isEngageResponse: (data: unknown) => data is import("./even
|
|
|
20
23
|
export declare const isClaimRewardsResponse: (data: unknown) => data is {
|
|
21
24
|
claimed_items: import("./event.define").ClaimedItem[];
|
|
22
25
|
};
|
|
26
|
+
export declare const isClaimRewardsV2Response: (data: unknown) => data is {
|
|
27
|
+
rewards: import("./event.engage").UserReward[];
|
|
28
|
+
};
|
|
23
29
|
export declare const isClaimWeixinHongbaoResponse: (data: unknown) => data is {
|
|
24
30
|
reward_status: import("./event.enums").ClaimRewardStatus;
|
|
25
31
|
};
|