@seayoo-web/gamer-api 1.1.6 → 1.1.8
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/README.md +64 -25
- package/dist/index.js +221 -184
- package/package.json +5 -5
- package/types/src/event.d.ts +24 -0
- package/types/src/event.define.d.ts +35 -1
- package/types/src/event.enums.d.ts +20 -4
- package/types/src/event.guards.d.ts +6 -1
- package/types/src/token.d.ts +5 -1
- package/types/src/utils.d.ts +1 -1
- package/types/src/weixin.d.ts +4 -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": "1.1.
|
|
4
|
+
"version": "1.1.8",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"source": "index.ts",
|
|
7
7
|
"main": "./dist/index.js",
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
"@types/node": "^22.13.1",
|
|
25
25
|
"@seayoo-web/combo-webview": "^2.5.0",
|
|
26
26
|
"@seayoo-web/tsconfig": "^1.0.3",
|
|
27
|
-
"@seayoo-web/
|
|
28
|
-
"@seayoo-web/utils": "^3.
|
|
29
|
-
"@seayoo-web/
|
|
27
|
+
"@seayoo-web/request": "^2.1.2",
|
|
28
|
+
"@seayoo-web/utils": "^3.1.1",
|
|
29
|
+
"@seayoo-web/scripts": "^1.3.15"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"@seayoo-web/combo-webview": "^2.5.0",
|
|
33
|
-
"@seayoo-web/utils": "^3.
|
|
33
|
+
"@seayoo-web/utils": "^3.1.1"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"build": "vite build && tsc --emitDeclarationOnly",
|
package/types/src/event.d.ts
CHANGED
|
@@ -64,6 +64,8 @@ export declare class EventApi {
|
|
|
64
64
|
*
|
|
65
65
|
* 💡活动下包含 engage_account_type 为 role_id 的玩法时,前端需要提供 server_id 和 role_id
|
|
66
66
|
*
|
|
67
|
+
* 🔕请求静默进行,无消息提示
|
|
68
|
+
*
|
|
67
69
|
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=WzX5BrMNpL
|
|
68
70
|
*/
|
|
69
71
|
getUserFeatureStatus(option?: {
|
|
@@ -74,8 +76,30 @@ export declare class EventApi {
|
|
|
74
76
|
* 获取当前登录用户参与某个玩法的记录
|
|
75
77
|
*
|
|
76
78
|
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=WSbAeDZc8F
|
|
79
|
+
*
|
|
80
|
+
* @deprecated 请改用 getUserEngagementsV2
|
|
77
81
|
*/
|
|
78
82
|
getUserEngagements(featureId: number): Promise<import("./event.define").UserEngagement[]>;
|
|
83
|
+
/**
|
|
84
|
+
* 获取当前登录用户参与某个玩法的记录
|
|
85
|
+
*
|
|
86
|
+
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=NFDdV1dwWb
|
|
87
|
+
*/
|
|
88
|
+
getUserEngagementsV2(featureId: number, option?: {
|
|
89
|
+
/** 单页返回的最大数量,默认 10 */
|
|
90
|
+
max_results?: number;
|
|
91
|
+
next_token?: string;
|
|
92
|
+
/** 是否返回参与获得的记录,默认 false */
|
|
93
|
+
return_rewards?: string;
|
|
94
|
+
/**
|
|
95
|
+
* 当玩法的 engage_account_type 为 role_id 时,可提供 server_id 和 role_id 获取具体角色的参与记录
|
|
96
|
+
*/
|
|
97
|
+
server_id?: string;
|
|
98
|
+
/**
|
|
99
|
+
* 当玩法的 engage_account_type 为 role_id 时,可提供 server_id 和 role_id 获取具体角色的参与记录
|
|
100
|
+
*/
|
|
101
|
+
role_id?: string;
|
|
102
|
+
}): Promise<import("./event.define").UserEngagementV2[]>;
|
|
79
103
|
/**
|
|
80
104
|
* 用户参与某个玩法(需要先调用 visit 接口)
|
|
81
105
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CliamRewardStatus, FeatureType, GamerItemType, LotteryDrawAction, LotteryTicketStatus, QuestObjective, RewardSoure, RewardStatusPrefix, RewardStatusSuffix, TeamAction, TeamVisibility } from "./event.enums";
|
|
1
|
+
import type { CliamRewardStatus, FeatureType, GamerItemType, LotteryDrawAction, LotteryTicketStatus, QuestObjective, RewardSoure, RewardStatusPrefix, RewardStatusSuffix, RewardStatusSuffixV2, TeamAction, TeamVisibility } from "./event.enums";
|
|
2
2
|
export interface VerifyMobileResult {
|
|
3
3
|
/** 手机号是否允许登录此游戏(游戏 ID 由 Request Header 的 Origin 或 Referer 决定) */
|
|
4
4
|
allowed: boolean;
|
|
@@ -39,6 +39,9 @@ export interface UserFeatureStatus {
|
|
|
39
39
|
/** 是否有已获得但尚未领取的玩法参与奖励 */
|
|
40
40
|
has_unclaimed_rewards: boolean;
|
|
41
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* 用户参与记录,已经作废
|
|
44
|
+
*/
|
|
42
45
|
export interface UserEngagement {
|
|
43
46
|
/** 参与记录 ID */
|
|
44
47
|
engagement_id: number;
|
|
@@ -68,6 +71,37 @@ export interface UserEngagement {
|
|
|
68
71
|
role_id?: string;
|
|
69
72
|
created_at: number;
|
|
70
73
|
}
|
|
74
|
+
export type UserEngagementV2 = Pick<UserEngagement, "engagement_id" | "feature_id" | "sequence" | "data" | "server_id" | "role_id" | "created_at"> & {
|
|
75
|
+
user_id: number;
|
|
76
|
+
/** 参与奖励列表 */
|
|
77
|
+
rewards?: Reward[];
|
|
78
|
+
};
|
|
79
|
+
export interface Reward {
|
|
80
|
+
/** 用户奖励记录 id */
|
|
81
|
+
reward_id: number;
|
|
82
|
+
/** 奖励道具 id */
|
|
83
|
+
reward_item_id: number;
|
|
84
|
+
/** 奖励道具类型 */
|
|
85
|
+
reward_item_type: GamerItemType;
|
|
86
|
+
/** 奖励道具数量 */
|
|
87
|
+
reward_count: number;
|
|
88
|
+
/** 奖励状态 */
|
|
89
|
+
reward_status: RewardStatusSuffixV2;
|
|
90
|
+
/** 奖励来源 */
|
|
91
|
+
reward_source: RewardSoure;
|
|
92
|
+
/** 奖励道具名称 */
|
|
93
|
+
reward_item_name: string;
|
|
94
|
+
/** 奖励道具图片地址 */
|
|
95
|
+
reward_item_icon_url: string;
|
|
96
|
+
/** 奖励道具描述 */
|
|
97
|
+
reward_item_desc?: string;
|
|
98
|
+
/** 奖励道具评级,用于前端展示 */
|
|
99
|
+
reward_item_rating: number;
|
|
100
|
+
/** 领奖时间 */
|
|
101
|
+
receive_time: number;
|
|
102
|
+
/** 提供额外扩展信息,比如收获地址等 */
|
|
103
|
+
extra_data?: Record<string, unknown>;
|
|
104
|
+
}
|
|
71
105
|
export interface PreregisterEngagementData {
|
|
72
106
|
/** 用户预约平台 */
|
|
73
107
|
platforms: string[];
|
|
@@ -88,19 +88,35 @@ export declare const enum VoteOptionSource {
|
|
|
88
88
|
/** 投票入围 */
|
|
89
89
|
Shortlisted = "shortlisted"
|
|
90
90
|
}
|
|
91
|
-
/**
|
|
91
|
+
/**
|
|
92
|
+
* 奖励领取状态(不含发货状态和领取失败)
|
|
93
|
+
*/
|
|
92
94
|
export declare const enum RewardStatusPrefix {
|
|
93
95
|
/** 未获得奖励 */
|
|
94
96
|
Ineligible = "ineligible",
|
|
95
97
|
/** 奖励未领取 */
|
|
96
|
-
|
|
98
|
+
Unclaimed = "unaccalimed",
|
|
97
99
|
/** 奖励已领取 */
|
|
98
100
|
Received = "received"
|
|
99
101
|
}
|
|
100
|
-
/**
|
|
102
|
+
/**
|
|
103
|
+
* 已获得实物奖励的奖励状态
|
|
104
|
+
*
|
|
105
|
+
* @deprecated
|
|
106
|
+
*/
|
|
101
107
|
export declare const enum RewardStatusSuffix {
|
|
102
108
|
/** 奖励未领取 */
|
|
103
|
-
|
|
109
|
+
Unclaimed = "unaccalimed",
|
|
110
|
+
/** 奖励已领取 */
|
|
111
|
+
Received = "received",
|
|
112
|
+
/** 奖励发放失败 */
|
|
113
|
+
Failed = "failed",
|
|
114
|
+
/** 奖励已发货 */
|
|
115
|
+
Delivered = "delivered"
|
|
116
|
+
}
|
|
117
|
+
export declare const enum RewardStatusSuffixV2 {
|
|
118
|
+
/** 奖励未领取 */
|
|
119
|
+
Unclaimed = "unclaimed",
|
|
104
120
|
/** 奖励已领取 */
|
|
105
121
|
Received = "received",
|
|
106
122
|
/** 奖励发放失败 */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ClaimedItem, CommentEngagement, EngageResponse, TeamEngagement, UserEngagement, UserFeatureStatus, UserReward, VerifyMobileResult } from "./event.define";
|
|
1
|
+
import type { ClaimedItem, CommentEngagement, EngageResponse, Reward, TeamEngagement, UserEngagement, UserEngagementV2, UserFeatureStatus, UserReward, VerifyMobileResult } from "./event.define";
|
|
2
2
|
import type { CliamRewardStatus } from "./event.enums";
|
|
3
3
|
export declare function isVerifyMobileResponse(data: unknown): data is VerifyMobileResult;
|
|
4
4
|
export declare function isCommonCountResponse(data: unknown): data is {
|
|
@@ -16,6 +16,11 @@ export declare function isUserFeatureStatusResponse(data: unknown): data is {
|
|
|
16
16
|
export declare function isUserEngagementsResponse(data: unknown): data is {
|
|
17
17
|
engagements: UserEngagement[];
|
|
18
18
|
};
|
|
19
|
+
export declare function isUserEngagementsV2Response(data: unknown): data is {
|
|
20
|
+
engagements: UserEngagementV2[];
|
|
21
|
+
};
|
|
22
|
+
export declare function isUserEngagementV2(data: unknown): data is UserEngagementV2;
|
|
23
|
+
export declare function isReward(data: unknown): data is Reward;
|
|
19
24
|
export declare function isEngageResponse(data: unknown): data is EngageResponse;
|
|
20
25
|
export declare function isClaimRewardsResponse(data: unknown): data is {
|
|
21
26
|
claimed_items: ClaimedItem[];
|
package/types/src/token.d.ts
CHANGED
|
@@ -62,11 +62,15 @@ export declare class AuthToken {
|
|
|
62
62
|
* - 此方法通常不需要手动调用,在需要登录的接口调用时会自动执行
|
|
63
63
|
* - 为了提高页面执行速度,可以在设置 Token 后立即调用 autoLogin
|
|
64
64
|
*
|
|
65
|
+
* 🔕请求静默进行,无消息提示
|
|
66
|
+
*
|
|
65
67
|
* https://kdocs.cn/l/cf2mO2uRLqh9?linkname=ReeJpWraRO
|
|
66
68
|
*/
|
|
67
69
|
autoLogin(): Promise<boolean>;
|
|
68
70
|
/**
|
|
69
|
-
*
|
|
71
|
+
* 获取当前登录用户的 Session 的信息
|
|
72
|
+
*
|
|
73
|
+
* 🔕请求静默进行,无消息提示
|
|
70
74
|
*
|
|
71
75
|
* https://kdocs.cn/l/cf2mO2uRLqh9?linkname=OdGVCdQxEu
|
|
72
76
|
*/
|
package/types/src/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const console: Pick<Console, "
|
|
1
|
+
export declare const console: Pick<Console, "error" | "log" | "warn">;
|
|
2
2
|
/** 检测是否在 combo webview */
|
|
3
3
|
export declare function inComboWebview(): boolean;
|
|
4
4
|
export declare function isRootEndpoint(path: string): boolean;
|
package/types/src/weixin.d.ts
CHANGED
|
@@ -41,6 +41,8 @@ export declare class WeixinApi {
|
|
|
41
41
|
* - 由于小程序的存储是以用户维度隔离的,每个微信用户在每个小程序下只要成功调用一次此 API 就会缓存请求结果。
|
|
42
42
|
* - 微信公众号网页授权请使用 webLogin 方法
|
|
43
43
|
*
|
|
44
|
+
* 🔕请求静默进行,无消息提示
|
|
45
|
+
*
|
|
44
46
|
* https://kdocs.cn/l/cf2mO2uRLqh9?linkname=GwIZ0givCb
|
|
45
47
|
*/
|
|
46
48
|
login(): Promise<import("./weixin.define").WeixinLoginResponse | {
|
|
@@ -72,6 +74,8 @@ export declare class WeixinApi {
|
|
|
72
74
|
*
|
|
73
75
|
* 用于从游戏内跳转至小程序时,将微信用户身份和游戏内身份关联起来,使得后续的企业微信客服流程能够知道该微信用户在游戏内的身份。
|
|
74
76
|
*
|
|
77
|
+
* 🔕请求静默进行,无消息提示
|
|
78
|
+
*
|
|
75
79
|
* https://kdocs.cn/l/cf2mO2uRLqh9?linkname=ci73N833Mk
|
|
76
80
|
*
|
|
77
81
|
* @param weixinToken 调用 login 后,得到的 weixinToken,如果 weixinToken 为空则跳过不处理
|