@easecation/ecapi-sdk 0.1.0 → 0.1.2
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 +23 -0
- package/dist/apis.d.ts +5 -130
- package/dist/apis.js +62 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +29 -0
- package/dist/method-signatures.d.ts +785 -0
- package/dist/method-signatures.js +2 -0
- package/dist/src/method-signatures.d.ts +896 -0
- package/dist/types.d.ts +112 -1
- package/package.json +12 -2
- package/src/method-signatures.d.ts +896 -0
package/README.md
CHANGED
|
@@ -38,6 +38,19 @@ client.setAppSessionToken(process.env.EC_APP_SESSION_TOKEN!);
|
|
|
38
38
|
- 支持 per-request 覆盖鉴权:`options.auth`
|
|
39
39
|
- 非 2xx 响应抛出 `ECAPIError`(包含 `status`、`payload`、`url`)
|
|
40
40
|
|
|
41
|
+
## 参数传递(必填/可选)
|
|
42
|
+
|
|
43
|
+
- 所有查询参数统一通过对象传入:`client.player.getWallet({ ecid: "..." })`
|
|
44
|
+
- `QueryParams` 已补齐服务端常用 query key 自动提示
|
|
45
|
+
- 每个 API 的必填/可选参数请查看:`API_REFERENCE.md`
|
|
46
|
+
- 该参考文档由后端 OpenAPI 自动生成,和服务端校验保持一致
|
|
47
|
+
|
|
48
|
+
## IDE 强类型提示
|
|
49
|
+
|
|
50
|
+
- 包内提供方法级类型增强文件 `method-signatures.d.ts`
|
|
51
|
+
- 调用每个 API 时,IDE 会提示该方法对应的 `Query` / `Body` 类型
|
|
52
|
+
- 必填字段会在 TypeScript 类型检查中直接报错,减少运行时试错
|
|
53
|
+
|
|
41
54
|
## API 覆盖
|
|
42
55
|
|
|
43
56
|
> 下列为 SDK 已封装的主要接口,未覆盖部分可通过 `client.request(...)` 直接调用。
|
|
@@ -110,3 +123,13 @@ client.setAppSessionToken(process.env.EC_APP_SESSION_TOKEN!);
|
|
|
110
123
|
- `client.monitor.spamDetector.*` → `/monitor/spam-detector/*`
|
|
111
124
|
- `client.system.getHealth()` → `/health`
|
|
112
125
|
|
|
126
|
+
## 完整 API 参考
|
|
127
|
+
|
|
128
|
+
- `API_REFERENCE.md`
|
|
129
|
+
|
|
130
|
+
更新命令(在 `easecation-api` 根目录执行):
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
python3 sdk/generate_sdk_api_reference.py
|
|
134
|
+
```
|
|
135
|
+
|
package/dist/apis.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { ECAPIHttpClient } from "./http";
|
|
2
2
|
import { QueryParams, RequestOptions } from "./types";
|
|
3
3
|
type NonBodyOptions = Omit<RequestOptions, "query" | "body">;
|
|
4
|
+
/**
|
|
5
|
+
* Shared low-level HTTP wrappers used by all API groups.
|
|
6
|
+
* These helpers keep auth/header/retry behavior consistent across modules.
|
|
7
|
+
*/
|
|
4
8
|
declare class BaseApi {
|
|
5
9
|
protected readonly http: ECAPIHttpClient;
|
|
6
10
|
constructor(http: ECAPIHttpClient);
|
|
@@ -11,46 +15,22 @@ declare class BaseApi {
|
|
|
11
15
|
protected delete<T = unknown>(path: string, query?: QueryParams, options?: Omit<RequestOptions, "query">): Promise<T>;
|
|
12
16
|
}
|
|
13
17
|
export declare class UserApi extends BaseApi {
|
|
14
|
-
getMe(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
15
|
-
loginByPassword(payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
|
|
16
|
-
loginByOauth2(payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
|
|
17
|
-
refreshToken(payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
|
|
18
|
-
getOpenId(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
19
|
-
listAll(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
20
|
-
updatePermissions(payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
|
|
21
|
-
getById(id: string, query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
22
18
|
}
|
|
23
19
|
export declare class PlayerScoreApi extends BaseApi {
|
|
24
|
-
getScore(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
25
|
-
getStages(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
26
|
-
getTop(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
27
|
-
deleteTop(query?: QueryParams, options?: Omit<RequestOptions, "query">): Promise<unknown>;
|
|
28
|
-
getConfig(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
29
|
-
getLeaderboard(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
30
20
|
}
|
|
31
21
|
export declare class PlayerTasksApi extends BaseApi {
|
|
32
|
-
list(ecid: string, query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
33
|
-
create(ecid: string, payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
|
|
34
22
|
update(ecid: string, taskId: string, payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
|
|
35
23
|
deleteOne(ecid: string, taskId: string, query?: QueryParams, options?: Omit<RequestOptions, "query">): Promise<unknown>;
|
|
36
24
|
}
|
|
37
25
|
export declare class PlayerMerchandiseApi extends BaseApi {
|
|
38
|
-
list(ecid: string, query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
39
|
-
create(ecid: string, payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
|
|
40
26
|
update(ecid: string, idItem: string, payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
|
|
41
27
|
deleteOne(ecid: string, idItem: string, query?: QueryParams, options?: Omit<RequestOptions, "query">): Promise<unknown>;
|
|
42
28
|
}
|
|
43
29
|
export declare class PlayerYearSummaryApi extends BaseApi {
|
|
44
|
-
getBasicInfo(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
45
|
-
getLoginStats(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
46
|
-
getGameStats(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
47
|
-
getRankData(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
48
|
-
getCurrencyData(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
49
|
-
getSocialData(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
50
30
|
}
|
|
51
31
|
export declare class PlayerVoteApi extends BaseApi {
|
|
52
|
-
processRewards(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
53
32
|
}
|
|
33
|
+
/** Player-related endpoints and nested modules. */
|
|
54
34
|
export declare class PlayerApi extends BaseApi {
|
|
55
35
|
readonly score: PlayerScoreApi;
|
|
56
36
|
readonly tasks: PlayerTasksApi;
|
|
@@ -58,156 +38,51 @@ export declare class PlayerApi extends BaseApi {
|
|
|
58
38
|
readonly yearSummary: PlayerYearSummaryApi;
|
|
59
39
|
readonly vote: PlayerVoteApi;
|
|
60
40
|
constructor(http: ECAPIHttpClient);
|
|
61
|
-
getInfo(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
62
|
-
searchEcid(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
63
|
-
getUserData(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
64
|
-
queryNetease(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
65
|
-
setRankLevel(payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
|
|
66
|
-
clearRespackCache(query?: QueryParams, options?: Omit<RequestOptions, "query">): Promise<unknown>;
|
|
67
|
-
getWallet(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
68
|
-
listGamingTags(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
69
|
-
operateGamingTag(payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
|
|
70
|
-
getLastPlayed(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
71
|
-
getStageRecord(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
72
|
-
getHeadicon(query?: QueryParams, options?: Omit<RequestOptions, "query" | "responseType">): Promise<ArrayBuffer>;
|
|
73
|
-
getSkin(query?: QueryParams, options?: Omit<RequestOptions, "query" | "responseType">): Promise<ArrayBuffer>;
|
|
74
|
-
batchNeteaseNicknames(payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
|
|
75
|
-
getBinding(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
76
|
-
resetBinding(payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
|
|
77
|
-
updateBinding(payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
|
|
78
|
-
updateUserData(nick: string, payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
|
|
79
|
-
updatePassword(ecid: string, payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
|
|
80
|
-
getPasswordHash(ecid: string, query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
81
41
|
}
|
|
82
42
|
export declare class AdminApi extends BaseApi {
|
|
83
|
-
sendMail(payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
|
|
84
|
-
prismDeviceBan(payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
|
|
85
|
-
getPrismDeviceBanLog(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
86
|
-
upsertOverwatchCase(payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
|
|
87
|
-
getOverwatchCase(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
88
|
-
getOperationLogs(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
89
|
-
getOperationStatistics(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
90
43
|
}
|
|
91
44
|
export declare class PunishApi extends BaseApi {
|
|
92
|
-
hack(payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
|
|
93
|
-
ban(payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
|
|
94
|
-
unban(payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
|
|
95
|
-
mute(payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
|
|
96
|
-
unmute(payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
|
|
97
|
-
warn(payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
|
|
98
|
-
kick(payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
|
|
99
|
-
clearDegree(payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
|
|
100
|
-
overwatch(payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
|
|
101
45
|
}
|
|
102
46
|
export declare class BanApi extends BaseApi {
|
|
103
|
-
ban(payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
|
|
104
|
-
clearDegree(payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
|
|
105
|
-
parkourPunish(query?: QueryParams, payload?: Record<string, unknown>, options?: Omit<RequestOptions, "query" | "body">): Promise<unknown>;
|
|
106
47
|
}
|
|
107
48
|
export declare class PermissionApi extends BaseApi {
|
|
108
|
-
getPermission(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
109
|
-
upsert(payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
|
|
110
|
-
deleteOne(query?: QueryParams, options?: Omit<RequestOptions, "query">): Promise<unknown>;
|
|
111
49
|
}
|
|
112
50
|
export declare class LogApi extends BaseApi {
|
|
113
|
-
getAction(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
114
|
-
getChat(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
115
|
-
getAuth(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
116
|
-
getTeaming(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
117
|
-
getLatestTeaming(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
118
|
-
getCommand(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
119
|
-
getMail(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
120
51
|
}
|
|
121
52
|
export declare class OrderApi extends BaseApi {
|
|
122
|
-
getDeliver(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
123
|
-
getLogs(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
124
|
-
getExchangeLogs(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
125
|
-
getDownloadCount(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
126
|
-
createDownloadTask(query?: QueryParams, payload?: Record<string, unknown>, options?: Omit<RequestOptions, "query" | "body">): Promise<unknown>;
|
|
127
|
-
getDownloadStatus(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
128
|
-
listDownloadTasks(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
129
53
|
}
|
|
130
54
|
export declare class StageLogApi extends BaseApi {
|
|
131
|
-
list(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
132
|
-
query(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
133
55
|
}
|
|
134
56
|
export declare class StageApi extends BaseApi {
|
|
135
57
|
readonly logs: StageLogApi;
|
|
136
58
|
constructor(http: ECAPIHttpClient);
|
|
137
|
-
getTypes(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
138
|
-
create(payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
|
|
139
|
-
getInfo(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
140
|
-
getDbId(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
141
59
|
}
|
|
142
60
|
export declare class ItemApi extends BaseApi {
|
|
143
|
-
getCommodity(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
144
61
|
}
|
|
145
62
|
export declare class CountApi extends BaseApi {
|
|
146
|
-
getHistory(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
147
|
-
getLatest(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
148
|
-
getTypes(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
149
63
|
}
|
|
150
64
|
export declare class ServersApi extends BaseApi {
|
|
151
|
-
list(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
152
|
-
getStatistics(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
153
|
-
getMainstackEvent(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
154
65
|
}
|
|
155
66
|
export declare class LobbyApi extends BaseApi {
|
|
156
|
-
list(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
157
67
|
}
|
|
158
68
|
export declare class CfgLangApi extends BaseApi {
|
|
159
|
-
list(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
160
|
-
compare(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
161
|
-
deploy(payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
|
|
162
|
-
create(query: QueryParams | undefined, payload: Record<string, unknown>, options?: Omit<RequestOptions, "query" | "body">): Promise<unknown>;
|
|
163
|
-
update(query: QueryParams | undefined, payload: Record<string, unknown>, options?: Omit<RequestOptions, "query" | "body">): Promise<unknown>;
|
|
164
|
-
deleteOne(query?: QueryParams, options?: Omit<RequestOptions, "query">): Promise<unknown>;
|
|
165
69
|
}
|
|
166
70
|
export declare class GlobalKVApi extends BaseApi {
|
|
167
|
-
list(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
168
|
-
getOne(key: string, query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
169
|
-
create(payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
|
|
170
|
-
update(key: string, payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
|
|
171
|
-
deleteOne(key: string, query?: QueryParams, options?: Omit<RequestOptions, "query">): Promise<unknown>;
|
|
172
|
-
deleteBatch(payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
|
|
173
71
|
}
|
|
174
72
|
export declare class BroadcastApi extends BaseApi {
|
|
175
|
-
list(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
176
|
-
compare(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
177
|
-
deploy(payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
|
|
178
|
-
getOne(msg: string, query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
179
|
-
create(payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
|
|
180
|
-
update(msg: string, payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
|
|
181
|
-
deleteOne(msg: string, payload?: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
|
|
182
73
|
}
|
|
183
74
|
export declare class EaseChatApi extends BaseApi {
|
|
184
|
-
sendHlaba(payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
|
|
185
|
-
listSubscriptions(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
186
|
-
createSubscription(payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
|
|
187
|
-
deleteSubscription(query?: QueryParams, options?: Omit<RequestOptions, "query">): Promise<unknown>;
|
|
188
75
|
}
|
|
189
76
|
export declare class AuditApi extends BaseApi {
|
|
190
|
-
getAuthLogs(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
191
|
-
getPlayerLogs(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
192
|
-
getPunishmentLogs(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
193
|
-
getPermissionLogs(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
194
|
-
getAdminLogs(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
195
|
-
getConfigLogs(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
196
77
|
}
|
|
197
78
|
export declare class SpamDetectorApi extends BaseApi {
|
|
198
|
-
getStatus(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
199
|
-
control(payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
|
|
200
|
-
getStats(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
201
79
|
}
|
|
202
80
|
export declare class MonitorApi extends BaseApi {
|
|
203
81
|
readonly spamDetector: SpamDetectorApi;
|
|
204
82
|
constructor(http: ECAPIHttpClient);
|
|
205
83
|
}
|
|
206
84
|
export declare class PullConfigApi extends BaseApi {
|
|
207
|
-
pull(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
208
85
|
}
|
|
209
86
|
export declare class SystemApi extends BaseApi {
|
|
210
|
-
getRoot(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
211
|
-
getHealth(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
|
|
212
87
|
}
|
|
213
88
|
export {};
|
package/dist/apis.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SystemApi = exports.PullConfigApi = exports.MonitorApi = exports.SpamDetectorApi = exports.AuditApi = exports.EaseChatApi = exports.BroadcastApi = exports.GlobalKVApi = exports.CfgLangApi = exports.LobbyApi = exports.ServersApi = exports.CountApi = exports.ItemApi = exports.StageApi = exports.StageLogApi = exports.OrderApi = exports.LogApi = exports.PermissionApi = exports.BanApi = exports.PunishApi = exports.AdminApi = exports.PlayerApi = exports.PlayerVoteApi = exports.PlayerYearSummaryApi = exports.PlayerMerchandiseApi = exports.PlayerTasksApi = exports.PlayerScoreApi = exports.UserApi = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Shared low-level HTTP wrappers used by all API groups.
|
|
6
|
+
* These helpers keep auth/header/retry behavior consistent across modules.
|
|
7
|
+
*/
|
|
4
8
|
class BaseApi {
|
|
5
9
|
constructor(http) {
|
|
6
10
|
this.http = http;
|
|
@@ -22,6 +26,10 @@ class BaseApi {
|
|
|
22
26
|
}
|
|
23
27
|
}
|
|
24
28
|
class UserApi extends BaseApi {
|
|
29
|
+
/**
|
|
30
|
+
* Get current user profile.
|
|
31
|
+
* Note: backend expects Authorization token for this endpoint in some deployments.
|
|
32
|
+
*/
|
|
25
33
|
getMe(query, options) {
|
|
26
34
|
return this.get("/user/me", query, options);
|
|
27
35
|
}
|
|
@@ -34,27 +42,42 @@ class UserApi extends BaseApi {
|
|
|
34
42
|
refreshToken(payload, options) {
|
|
35
43
|
return this.post("/user/refresh", payload, options);
|
|
36
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Get current user's OpenID.
|
|
47
|
+
* May return 404 if OpenID context is unavailable for current auth mode.
|
|
48
|
+
*/
|
|
37
49
|
getOpenId(query, options) {
|
|
38
50
|
return this.get("/user/openid", query, options);
|
|
39
51
|
}
|
|
52
|
+
/** List all registered users (admin-scoped endpoint). */
|
|
40
53
|
listAll(query, options) {
|
|
41
54
|
return this.get("/user/all", query, options);
|
|
42
55
|
}
|
|
43
56
|
updatePermissions(payload, options) {
|
|
44
57
|
return this.put("/user/permissions", payload, options);
|
|
45
58
|
}
|
|
59
|
+
/** Query user detail by user id. */
|
|
46
60
|
getById(id, query, options) {
|
|
47
61
|
return this.get(`/user/${encodeURIComponent(id)}`, query, options);
|
|
48
62
|
}
|
|
49
63
|
}
|
|
50
64
|
exports.UserApi = UserApi;
|
|
51
65
|
class PlayerScoreApi extends BaseApi {
|
|
66
|
+
/**
|
|
67
|
+
* Get player score summary.
|
|
68
|
+
* Common required query: `nick`, `game`.
|
|
69
|
+
*/
|
|
52
70
|
getScore(query, options) {
|
|
53
71
|
return super.get("/player/score", query, options);
|
|
54
72
|
}
|
|
73
|
+
/** Get player score stages. Common required query: `nick`. */
|
|
55
74
|
getStages(query, options) {
|
|
56
75
|
return super.get("/player/score/stages", query, options);
|
|
57
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Get top ranking records.
|
|
79
|
+
* Common required query: `game`, `score_type`, `deadline_type`, `limit`, `is_ascending`.
|
|
80
|
+
*/
|
|
58
81
|
getTop(query, options) {
|
|
59
82
|
return super.get("/player/score/top", query, options);
|
|
60
83
|
}
|
|
@@ -70,6 +93,10 @@ class PlayerScoreApi extends BaseApi {
|
|
|
70
93
|
}
|
|
71
94
|
exports.PlayerScoreApi = PlayerScoreApi;
|
|
72
95
|
class PlayerTasksApi extends BaseApi {
|
|
96
|
+
/**
|
|
97
|
+
* List tasks for one player.
|
|
98
|
+
* Common required query: `current`, `pageSize`.
|
|
99
|
+
*/
|
|
73
100
|
list(ecid, query, options) {
|
|
74
101
|
return this.get(`/player/${encodeURIComponent(ecid)}/tasks`, query, options);
|
|
75
102
|
}
|
|
@@ -85,6 +112,10 @@ class PlayerTasksApi extends BaseApi {
|
|
|
85
112
|
}
|
|
86
113
|
exports.PlayerTasksApi = PlayerTasksApi;
|
|
87
114
|
class PlayerMerchandiseApi extends BaseApi {
|
|
115
|
+
/**
|
|
116
|
+
* List merchandise items for one player.
|
|
117
|
+
* Common required query: `current`, `pageSize`.
|
|
118
|
+
*/
|
|
88
119
|
list(ecid, query, options) {
|
|
89
120
|
return this.get(`/player/${encodeURIComponent(ecid)}/merchandise`, query, options);
|
|
90
121
|
}
|
|
@@ -100,6 +131,7 @@ class PlayerMerchandiseApi extends BaseApi {
|
|
|
100
131
|
}
|
|
101
132
|
exports.PlayerMerchandiseApi = PlayerMerchandiseApi;
|
|
102
133
|
class PlayerYearSummaryApi extends BaseApi {
|
|
134
|
+
/** Get year summary basic info. Common required query: `ecid` (optional `year`). */
|
|
103
135
|
getBasicInfo(query, options) {
|
|
104
136
|
return this.get("/player/year-summary/basic-info", query, options);
|
|
105
137
|
}
|
|
@@ -121,11 +153,13 @@ class PlayerYearSummaryApi extends BaseApi {
|
|
|
121
153
|
}
|
|
122
154
|
exports.PlayerYearSummaryApi = PlayerYearSummaryApi;
|
|
123
155
|
class PlayerVoteApi extends BaseApi {
|
|
156
|
+
/** Process vote rewards. Common required query: `players` (semicolon-separated). */
|
|
124
157
|
processRewards(query, options) {
|
|
125
158
|
return this.get("/player/vote", query, options);
|
|
126
159
|
}
|
|
127
160
|
}
|
|
128
161
|
exports.PlayerVoteApi = PlayerVoteApi;
|
|
162
|
+
/** Player-related endpoints and nested modules. */
|
|
129
163
|
class PlayerApi extends BaseApi {
|
|
130
164
|
constructor(http) {
|
|
131
165
|
super(http);
|
|
@@ -135,15 +169,19 @@ class PlayerApi extends BaseApi {
|
|
|
135
169
|
this.yearSummary = new PlayerYearSummaryApi(http);
|
|
136
170
|
this.vote = new PlayerVoteApi(http);
|
|
137
171
|
}
|
|
172
|
+
/** Get online/runtime player info. Common required query: `name`. */
|
|
138
173
|
getInfo(query, options) {
|
|
139
174
|
return this.get("/player/info", query, options);
|
|
140
175
|
}
|
|
176
|
+
/** Search ECID by nickname/ecid keyword. Common required query: `name`. */
|
|
141
177
|
searchEcid(query, options) {
|
|
142
178
|
return this.get("/player/searchecid", query, options);
|
|
143
179
|
}
|
|
180
|
+
/** Get player profile data. Common required query: `ecid`. */
|
|
144
181
|
getUserData(query, options) {
|
|
145
182
|
return this.get("/player/userdata", query, options);
|
|
146
183
|
}
|
|
184
|
+
/** Query NetEase player data. Common required query: `name`. */
|
|
147
185
|
queryNetease(query, options) {
|
|
148
186
|
return this.get("/player/querynetease", query, options);
|
|
149
187
|
}
|
|
@@ -153,6 +191,7 @@ class PlayerApi extends BaseApi {
|
|
|
153
191
|
clearRespackCache(query, options) {
|
|
154
192
|
return this.delete("/player/respack/cache", query, options);
|
|
155
193
|
}
|
|
194
|
+
/** Get wallet info. Common required query: `ecid`. */
|
|
156
195
|
getWallet(query, options) {
|
|
157
196
|
return this.get("/player/wallet", query, options);
|
|
158
197
|
}
|
|
@@ -162,12 +201,15 @@ class PlayerApi extends BaseApi {
|
|
|
162
201
|
operateGamingTag(payload, options) {
|
|
163
202
|
return this.post("/player/gaming-tag", payload, options);
|
|
164
203
|
}
|
|
204
|
+
/** Get recent play history. Common required query: `ecid`. */
|
|
165
205
|
getLastPlayed(query, options) {
|
|
166
206
|
return this.get("/player/last-played", query, options);
|
|
167
207
|
}
|
|
208
|
+
/** Get stage records. Common required query: `ecid`, `start`, `end`. */
|
|
168
209
|
getStageRecord(query, options) {
|
|
169
210
|
return this.get("/player/stage/record", query, options);
|
|
170
211
|
}
|
|
212
|
+
/** Get player head icon as binary image data. Common required query: `ecid`. */
|
|
171
213
|
getHeadicon(query, options) {
|
|
172
214
|
return this.http.request("GET", "/player/headicon", {
|
|
173
215
|
...options,
|
|
@@ -175,6 +217,7 @@ class PlayerApi extends BaseApi {
|
|
|
175
217
|
responseType: "arrayBuffer",
|
|
176
218
|
});
|
|
177
219
|
}
|
|
220
|
+
/** Get player skin as binary image data. Common required query: `ecid`. */
|
|
178
221
|
getSkin(query, options) {
|
|
179
222
|
return this.http.request("GET", "/player/skin", {
|
|
180
223
|
...options,
|
|
@@ -185,6 +228,7 @@ class PlayerApi extends BaseApi {
|
|
|
185
228
|
batchNeteaseNicknames(payload, options) {
|
|
186
229
|
return this.post("/player/neteasenicknames", payload, options);
|
|
187
230
|
}
|
|
231
|
+
/** Get player binding info. Common required query: `ecid`. */
|
|
188
232
|
getBinding(query, options) {
|
|
189
233
|
return this.get("/player/binding", query, options);
|
|
190
234
|
}
|
|
@@ -200,6 +244,7 @@ class PlayerApi extends BaseApi {
|
|
|
200
244
|
updatePassword(ecid, payload, options) {
|
|
201
245
|
return this.post(`/player/password/${encodeURIComponent(ecid)}`, payload, options);
|
|
202
246
|
}
|
|
247
|
+
/** Get password hash by ecid. */
|
|
203
248
|
getPasswordHash(ecid, query, options) {
|
|
204
249
|
return this.get(`/player/password/${encodeURIComponent(ecid)}`, query, options);
|
|
205
250
|
}
|
|
@@ -218,12 +263,15 @@ class AdminApi extends BaseApi {
|
|
|
218
263
|
upsertOverwatchCase(payload, options) {
|
|
219
264
|
return this.post("/admin/overwatch", payload, options);
|
|
220
265
|
}
|
|
266
|
+
/** Query overwatch case. Common required query: `record_id`. */
|
|
221
267
|
getOverwatchCase(query, options) {
|
|
222
268
|
return this.get("/admin/overwatch", query, options);
|
|
223
269
|
}
|
|
270
|
+
/** Query admin operation logs. Common required query: `start`/`end` or `target_nick`. */
|
|
224
271
|
getOperationLogs(query, options) {
|
|
225
272
|
return this.get("/admin/operation", query, options);
|
|
226
273
|
}
|
|
274
|
+
/** Query admin operation statistics. Common required query: `start`, `end`. */
|
|
227
275
|
getOperationStatistics(query, options) {
|
|
228
276
|
return this.get("/admin/operation/statistic", query, options);
|
|
229
277
|
}
|
|
@@ -276,6 +324,7 @@ class BanApi extends BaseApi {
|
|
|
276
324
|
}
|
|
277
325
|
exports.BanApi = BanApi;
|
|
278
326
|
class PermissionApi extends BaseApi {
|
|
327
|
+
/** Get player permission. Common required query: `ecid`. */
|
|
279
328
|
getPermission(query, options) {
|
|
280
329
|
return super.get("/permission", query, options);
|
|
281
330
|
}
|
|
@@ -288,6 +337,7 @@ class PermissionApi extends BaseApi {
|
|
|
288
337
|
}
|
|
289
338
|
exports.PermissionApi = PermissionApi;
|
|
290
339
|
class LogApi extends BaseApi {
|
|
340
|
+
/** Query action log. Common required query: `start`, `end`, `ecid`. */
|
|
291
341
|
getAction(query, options) {
|
|
292
342
|
return this.get("/log/action", query, options);
|
|
293
343
|
}
|
|
@@ -297,12 +347,14 @@ class LogApi extends BaseApi {
|
|
|
297
347
|
getAuth(query, options) {
|
|
298
348
|
return this.get("/log/auth", query, options);
|
|
299
349
|
}
|
|
350
|
+
/** Query teaming log. Common required query: `start`, `end`, `current`, `ecid`. */
|
|
300
351
|
getTeaming(query, options) {
|
|
301
352
|
return this.get("/log/teaming", query, options);
|
|
302
353
|
}
|
|
303
354
|
getLatestTeaming(query, options) {
|
|
304
355
|
return this.get("/log/latestTeaming", query, options);
|
|
305
356
|
}
|
|
357
|
+
/** Query command log. Common required query: `start`, `end`, `current`, `ecid`. */
|
|
306
358
|
getCommand(query, options) {
|
|
307
359
|
return this.get("/log/command", query, options);
|
|
308
360
|
}
|
|
@@ -312,15 +364,19 @@ class LogApi extends BaseApi {
|
|
|
312
364
|
}
|
|
313
365
|
exports.LogApi = LogApi;
|
|
314
366
|
class OrderApi extends BaseApi {
|
|
367
|
+
/** Query delivery status. Common required query: `key`, `ecid`. */
|
|
315
368
|
getDeliver(query, options) {
|
|
316
369
|
return this.get("/order/deliver", query, options);
|
|
317
370
|
}
|
|
371
|
+
/** Query order logs. Common required query: `ecid`. */
|
|
318
372
|
getLogs(query, options) {
|
|
319
373
|
return this.get("/order/logs", query, options);
|
|
320
374
|
}
|
|
375
|
+
/** Query exchange logs. Common required query: `ecid`, `from`, `to`. */
|
|
321
376
|
getExchangeLogs(query, options) {
|
|
322
377
|
return this.get("/order/exchange-logs", query, options);
|
|
323
378
|
}
|
|
379
|
+
/** Get download task count. Common required query: `from`, `to`. */
|
|
324
380
|
getDownloadCount(query, options) {
|
|
325
381
|
return this.get("/order/download/count", query, options);
|
|
326
382
|
}
|
|
@@ -331,6 +387,7 @@ class OrderApi extends BaseApi {
|
|
|
331
387
|
body: payload,
|
|
332
388
|
});
|
|
333
389
|
}
|
|
390
|
+
/** Get one download task status. Common required query: `downloadId`. */
|
|
334
391
|
getDownloadStatus(query, options) {
|
|
335
392
|
return this.get("/order/download/status", query, options);
|
|
336
393
|
}
|
|
@@ -359,9 +416,11 @@ class StageApi extends BaseApi {
|
|
|
359
416
|
create(payload, options) {
|
|
360
417
|
return this.post("/stage/create", payload, options);
|
|
361
418
|
}
|
|
419
|
+
/** Query stage info by filters such as game/state/runtimeid/requestid. */
|
|
362
420
|
getInfo(query, options) {
|
|
363
421
|
return this.get("/stage/info", query, options);
|
|
364
422
|
}
|
|
423
|
+
/** Query stage DB id. Common required query: `runtime-id`. */
|
|
365
424
|
getDbId(query, options) {
|
|
366
425
|
return this.get("/stage/db-id", query, options);
|
|
367
426
|
}
|
|
@@ -528,15 +587,18 @@ class MonitorApi extends BaseApi {
|
|
|
528
587
|
}
|
|
529
588
|
exports.MonitorApi = MonitorApi;
|
|
530
589
|
class PullConfigApi extends BaseApi {
|
|
590
|
+
/** Pull current config snapshot. */
|
|
531
591
|
pull(query, options) {
|
|
532
592
|
return this.get("/pull-config", query, options);
|
|
533
593
|
}
|
|
534
594
|
}
|
|
535
595
|
exports.PullConfigApi = PullConfigApi;
|
|
536
596
|
class SystemApi extends BaseApi {
|
|
597
|
+
/** Get API root text payload. */
|
|
537
598
|
getRoot(query, options) {
|
|
538
599
|
return this.get("/", query, { ...options, responseType: "text" });
|
|
539
600
|
}
|
|
601
|
+
/** Health check endpoint. */
|
|
540
602
|
getHealth(query, options) {
|
|
541
603
|
return this.get("/health", query, options);
|
|
542
604
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
|
+
/// <reference path="../src/method-signatures.d.ts" />
|
|
1
2
|
import { ECAPIError } from "./http";
|
|
2
3
|
import { AdminApi, AuditApi, BanApi, BroadcastApi, CfgLangApi, CountApi, EaseChatApi, GlobalKVApi, ItemApi, LobbyApi, LogApi, MonitorApi, OrderApi, PermissionApi, PlayerApi, PullConfigApi, PunishApi, ServersApi, StageApi, SystemApi, UserApi } from "./apis";
|
|
3
4
|
import { AuthCredentials, ClientOptions, RequestOptions } from "./types";
|
|
4
5
|
type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
6
|
+
/**
|
|
7
|
+
* ECAPI main client.
|
|
8
|
+
*
|
|
9
|
+
* Usage:
|
|
10
|
+
* 1) Create a client with `baseUrl` and one auth method.
|
|
11
|
+
* 2) Call grouped APIs via `client.user`, `client.player`, etc.
|
|
12
|
+
* 3) Use `request()` for endpoints not wrapped by typed helpers.
|
|
13
|
+
*/
|
|
5
14
|
export declare class ECAPIClient {
|
|
6
15
|
private readonly http;
|
|
7
16
|
readonly user: UserApi;
|
|
@@ -25,11 +34,31 @@ export declare class ECAPIClient {
|
|
|
25
34
|
readonly monitor: MonitorApi;
|
|
26
35
|
readonly pullConfig: PullConfigApi;
|
|
27
36
|
readonly system: SystemApi;
|
|
37
|
+
/**
|
|
38
|
+
* Initialize a new ECAPI client.
|
|
39
|
+
*/
|
|
28
40
|
constructor(options: ClientOptions);
|
|
41
|
+
/**
|
|
42
|
+
* Replace current auth config for subsequent requests.
|
|
43
|
+
*/
|
|
29
44
|
setAuth(auth?: AuthCredentials): void;
|
|
45
|
+
/**
|
|
46
|
+
* Use IAM API Key auth for subsequent requests.
|
|
47
|
+
*/
|
|
30
48
|
setApiKey(apiKey: string): void;
|
|
49
|
+
/**
|
|
50
|
+
* Use app session token auth for subsequent requests.
|
|
51
|
+
*/
|
|
31
52
|
setAppSessionToken(appSessionToken: string): void;
|
|
53
|
+
/**
|
|
54
|
+
* Clear auth headers from subsequent requests.
|
|
55
|
+
*/
|
|
32
56
|
clearAuth(): void;
|
|
57
|
+
/**
|
|
58
|
+
* Low-level request helper.
|
|
59
|
+
*
|
|
60
|
+
* Use this when an endpoint is not yet wrapped by a high-level API method.
|
|
61
|
+
*/
|
|
33
62
|
request<T = unknown>(method: HttpMethod, path: string, options?: RequestOptions): Promise<T>;
|
|
34
63
|
}
|
|
35
64
|
export * from "./types";
|
package/dist/index.js
CHANGED
|
@@ -15,10 +15,22 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.ECAPIError = exports.ECAPIClient = void 0;
|
|
18
|
+
/// <reference path="./method-signatures.d.ts" />
|
|
18
19
|
const http_1 = require("./http");
|
|
19
20
|
Object.defineProperty(exports, "ECAPIError", { enumerable: true, get: function () { return http_1.ECAPIError; } });
|
|
20
21
|
const apis_1 = require("./apis");
|
|
22
|
+
/**
|
|
23
|
+
* ECAPI main client.
|
|
24
|
+
*
|
|
25
|
+
* Usage:
|
|
26
|
+
* 1) Create a client with `baseUrl` and one auth method.
|
|
27
|
+
* 2) Call grouped APIs via `client.user`, `client.player`, etc.
|
|
28
|
+
* 3) Use `request()` for endpoints not wrapped by typed helpers.
|
|
29
|
+
*/
|
|
21
30
|
class ECAPIClient {
|
|
31
|
+
/**
|
|
32
|
+
* Initialize a new ECAPI client.
|
|
33
|
+
*/
|
|
22
34
|
constructor(options) {
|
|
23
35
|
this.http = new http_1.ECAPIHttpClient(options);
|
|
24
36
|
this.user = new apis_1.UserApi(this.http);
|
|
@@ -43,18 +55,35 @@ class ECAPIClient {
|
|
|
43
55
|
this.pullConfig = new apis_1.PullConfigApi(this.http);
|
|
44
56
|
this.system = new apis_1.SystemApi(this.http);
|
|
45
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Replace current auth config for subsequent requests.
|
|
60
|
+
*/
|
|
46
61
|
setAuth(auth) {
|
|
47
62
|
this.http.setAuth(auth);
|
|
48
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Use IAM API Key auth for subsequent requests.
|
|
66
|
+
*/
|
|
49
67
|
setApiKey(apiKey) {
|
|
50
68
|
this.http.setApiKey(apiKey);
|
|
51
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* Use app session token auth for subsequent requests.
|
|
72
|
+
*/
|
|
52
73
|
setAppSessionToken(appSessionToken) {
|
|
53
74
|
this.http.setAppSessionToken(appSessionToken);
|
|
54
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* Clear auth headers from subsequent requests.
|
|
78
|
+
*/
|
|
55
79
|
clearAuth() {
|
|
56
80
|
this.http.clearAuth();
|
|
57
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* Low-level request helper.
|
|
84
|
+
*
|
|
85
|
+
* Use this when an endpoint is not yet wrapped by a high-level API method.
|
|
86
|
+
*/
|
|
58
87
|
request(method, path, options) {
|
|
59
88
|
return this.http.request(method, path, options);
|
|
60
89
|
}
|