@easecation/ecapi-sdk 0.1.0 → 0.1.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/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,36 +15,64 @@ 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 {
18
+ /**
19
+ * Get current user profile.
20
+ * Note: backend expects Authorization token for this endpoint in some deployments.
21
+ */
14
22
  getMe(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
15
23
  loginByPassword(payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
16
24
  loginByOauth2(payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
17
25
  refreshToken(payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
26
+ /**
27
+ * Get current user's OpenID.
28
+ * May return 404 if OpenID context is unavailable for current auth mode.
29
+ */
18
30
  getOpenId(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
31
+ /** List all registered users (admin-scoped endpoint). */
19
32
  listAll(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
20
33
  updatePermissions(payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
34
+ /** Query user detail by user id. */
21
35
  getById(id: string, query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
22
36
  }
23
37
  export declare class PlayerScoreApi extends BaseApi {
38
+ /**
39
+ * Get player score summary.
40
+ * Common required query: `nick`, `game`.
41
+ */
24
42
  getScore(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
43
+ /** Get player score stages. Common required query: `nick`. */
25
44
  getStages(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
45
+ /**
46
+ * Get top ranking records.
47
+ * Common required query: `game`, `score_type`, `deadline_type`, `limit`, `is_ascending`.
48
+ */
26
49
  getTop(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
27
50
  deleteTop(query?: QueryParams, options?: Omit<RequestOptions, "query">): Promise<unknown>;
28
51
  getConfig(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
29
52
  getLeaderboard(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
30
53
  }
31
54
  export declare class PlayerTasksApi extends BaseApi {
55
+ /**
56
+ * List tasks for one player.
57
+ * Common required query: `current`, `pageSize`.
58
+ */
32
59
  list(ecid: string, query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
33
60
  create(ecid: string, payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
34
61
  update(ecid: string, taskId: string, payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
35
62
  deleteOne(ecid: string, taskId: string, query?: QueryParams, options?: Omit<RequestOptions, "query">): Promise<unknown>;
36
63
  }
37
64
  export declare class PlayerMerchandiseApi extends BaseApi {
65
+ /**
66
+ * List merchandise items for one player.
67
+ * Common required query: `current`, `pageSize`.
68
+ */
38
69
  list(ecid: string, query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
39
70
  create(ecid: string, payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
40
71
  update(ecid: string, idItem: string, payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
41
72
  deleteOne(ecid: string, idItem: string, query?: QueryParams, options?: Omit<RequestOptions, "query">): Promise<unknown>;
42
73
  }
43
74
  export declare class PlayerYearSummaryApi extends BaseApi {
75
+ /** Get year summary basic info. Common required query: `ecid` (optional `year`). */
44
76
  getBasicInfo(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
45
77
  getLoginStats(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
46
78
  getGameStats(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
@@ -49,8 +81,10 @@ export declare class PlayerYearSummaryApi extends BaseApi {
49
81
  getSocialData(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
50
82
  }
51
83
  export declare class PlayerVoteApi extends BaseApi {
84
+ /** Process vote rewards. Common required query: `players` (semicolon-separated). */
52
85
  processRewards(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
53
86
  }
87
+ /** Player-related endpoints and nested modules. */
54
88
  export declare class PlayerApi extends BaseApi {
55
89
  readonly score: PlayerScoreApi;
56
90
  readonly tasks: PlayerTasksApi;
@@ -58,25 +92,36 @@ export declare class PlayerApi extends BaseApi {
58
92
  readonly yearSummary: PlayerYearSummaryApi;
59
93
  readonly vote: PlayerVoteApi;
60
94
  constructor(http: ECAPIHttpClient);
95
+ /** Get online/runtime player info. Common required query: `name`. */
61
96
  getInfo(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
97
+ /** Search ECID by nickname/ecid keyword. Common required query: `name`. */
62
98
  searchEcid(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
99
+ /** Get player profile data. Common required query: `ecid`. */
63
100
  getUserData(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
101
+ /** Query NetEase player data. Common required query: `name`. */
64
102
  queryNetease(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
65
103
  setRankLevel(payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
66
104
  clearRespackCache(query?: QueryParams, options?: Omit<RequestOptions, "query">): Promise<unknown>;
105
+ /** Get wallet info. Common required query: `ecid`. */
67
106
  getWallet(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
68
107
  listGamingTags(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
69
108
  operateGamingTag(payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
109
+ /** Get recent play history. Common required query: `ecid`. */
70
110
  getLastPlayed(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
111
+ /** Get stage records. Common required query: `ecid`, `start`, `end`. */
71
112
  getStageRecord(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
113
+ /** Get player head icon as binary image data. Common required query: `ecid`. */
72
114
  getHeadicon(query?: QueryParams, options?: Omit<RequestOptions, "query" | "responseType">): Promise<ArrayBuffer>;
115
+ /** Get player skin as binary image data. Common required query: `ecid`. */
73
116
  getSkin(query?: QueryParams, options?: Omit<RequestOptions, "query" | "responseType">): Promise<ArrayBuffer>;
74
117
  batchNeteaseNicknames(payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
118
+ /** Get player binding info. Common required query: `ecid`. */
75
119
  getBinding(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
76
120
  resetBinding(payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
77
121
  updateBinding(payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
78
122
  updateUserData(nick: string, payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
79
123
  updatePassword(ecid: string, payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
124
+ /** Get password hash by ecid. */
80
125
  getPasswordHash(ecid: string, query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
81
126
  }
82
127
  export declare class AdminApi extends BaseApi {
@@ -84,8 +129,11 @@ export declare class AdminApi extends BaseApi {
84
129
  prismDeviceBan(payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
85
130
  getPrismDeviceBanLog(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
86
131
  upsertOverwatchCase(payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
132
+ /** Query overwatch case. Common required query: `record_id`. */
87
133
  getOverwatchCase(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
134
+ /** Query admin operation logs. Common required query: `start`/`end` or `target_nick`. */
88
135
  getOperationLogs(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
136
+ /** Query admin operation statistics. Common required query: `start`, `end`. */
89
137
  getOperationStatistics(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
90
138
  }
91
139
  export declare class PunishApi extends BaseApi {
@@ -105,25 +153,34 @@ export declare class BanApi extends BaseApi {
105
153
  parkourPunish(query?: QueryParams, payload?: Record<string, unknown>, options?: Omit<RequestOptions, "query" | "body">): Promise<unknown>;
106
154
  }
107
155
  export declare class PermissionApi extends BaseApi {
156
+ /** Get player permission. Common required query: `ecid`. */
108
157
  getPermission(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
109
158
  upsert(payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
110
159
  deleteOne(query?: QueryParams, options?: Omit<RequestOptions, "query">): Promise<unknown>;
111
160
  }
112
161
  export declare class LogApi extends BaseApi {
162
+ /** Query action log. Common required query: `start`, `end`, `ecid`. */
113
163
  getAction(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
114
164
  getChat(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
115
165
  getAuth(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
166
+ /** Query teaming log. Common required query: `start`, `end`, `current`, `ecid`. */
116
167
  getTeaming(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
117
168
  getLatestTeaming(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
169
+ /** Query command log. Common required query: `start`, `end`, `current`, `ecid`. */
118
170
  getCommand(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
119
171
  getMail(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
120
172
  }
121
173
  export declare class OrderApi extends BaseApi {
174
+ /** Query delivery status. Common required query: `key`, `ecid`. */
122
175
  getDeliver(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
176
+ /** Query order logs. Common required query: `ecid`. */
123
177
  getLogs(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
178
+ /** Query exchange logs. Common required query: `ecid`, `from`, `to`. */
124
179
  getExchangeLogs(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
180
+ /** Get download task count. Common required query: `from`, `to`. */
125
181
  getDownloadCount(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
126
182
  createDownloadTask(query?: QueryParams, payload?: Record<string, unknown>, options?: Omit<RequestOptions, "query" | "body">): Promise<unknown>;
183
+ /** Get one download task status. Common required query: `downloadId`. */
127
184
  getDownloadStatus(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
128
185
  listDownloadTasks(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
129
186
  }
@@ -136,7 +193,9 @@ export declare class StageApi extends BaseApi {
136
193
  constructor(http: ECAPIHttpClient);
137
194
  getTypes(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
138
195
  create(payload: Record<string, unknown>, options?: Omit<RequestOptions, "body">): Promise<unknown>;
196
+ /** Query stage info by filters such as game/state/runtimeid/requestid. */
139
197
  getInfo(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
198
+ /** Query stage DB id. Common required query: `runtime-id`. */
140
199
  getDbId(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
141
200
  }
142
201
  export declare class ItemApi extends BaseApi {
@@ -204,10 +263,13 @@ export declare class MonitorApi extends BaseApi {
204
263
  constructor(http: ECAPIHttpClient);
205
264
  }
206
265
  export declare class PullConfigApi extends BaseApi {
266
+ /** Pull current config snapshot. */
207
267
  pull(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
208
268
  }
209
269
  export declare class SystemApi extends BaseApi {
270
+ /** Get API root text payload. */
210
271
  getRoot(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
272
+ /** Health check endpoint. */
211
273
  getHealth(query?: QueryParams, options?: NonBodyOptions): Promise<unknown>;
212
274
  }
213
275
  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
@@ -2,6 +2,14 @@ import { ECAPIError } from "./http";
2
2
  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
3
  import { AuthCredentials, ClientOptions, RequestOptions } from "./types";
4
4
  type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
5
+ /**
6
+ * ECAPI main client.
7
+ *
8
+ * Usage:
9
+ * 1) Create a client with `baseUrl` and one auth method.
10
+ * 2) Call grouped APIs via `client.user`, `client.player`, etc.
11
+ * 3) Use `request()` for endpoints not wrapped by typed helpers.
12
+ */
5
13
  export declare class ECAPIClient {
6
14
  private readonly http;
7
15
  readonly user: UserApi;
@@ -25,11 +33,31 @@ export declare class ECAPIClient {
25
33
  readonly monitor: MonitorApi;
26
34
  readonly pullConfig: PullConfigApi;
27
35
  readonly system: SystemApi;
36
+ /**
37
+ * Initialize a new ECAPI client.
38
+ */
28
39
  constructor(options: ClientOptions);
40
+ /**
41
+ * Replace current auth config for subsequent requests.
42
+ */
29
43
  setAuth(auth?: AuthCredentials): void;
44
+ /**
45
+ * Use IAM API Key auth for subsequent requests.
46
+ */
30
47
  setApiKey(apiKey: string): void;
48
+ /**
49
+ * Use app session token auth for subsequent requests.
50
+ */
31
51
  setAppSessionToken(appSessionToken: string): void;
52
+ /**
53
+ * Clear auth headers from subsequent requests.
54
+ */
32
55
  clearAuth(): void;
56
+ /**
57
+ * Low-level request helper.
58
+ *
59
+ * Use this when an endpoint is not yet wrapped by a high-level API method.
60
+ */
33
61
  request<T = unknown>(method: HttpMethod, path: string, options?: RequestOptions): Promise<T>;
34
62
  }
35
63
  export * from "./types";
package/dist/index.js CHANGED
@@ -18,7 +18,18 @@ exports.ECAPIError = exports.ECAPIClient = void 0;
18
18
  const http_1 = require("./http");
19
19
  Object.defineProperty(exports, "ECAPIError", { enumerable: true, get: function () { return http_1.ECAPIError; } });
20
20
  const apis_1 = require("./apis");
21
+ /**
22
+ * ECAPI main client.
23
+ *
24
+ * Usage:
25
+ * 1) Create a client with `baseUrl` and one auth method.
26
+ * 2) Call grouped APIs via `client.user`, `client.player`, etc.
27
+ * 3) Use `request()` for endpoints not wrapped by typed helpers.
28
+ */
21
29
  class ECAPIClient {
30
+ /**
31
+ * Initialize a new ECAPI client.
32
+ */
22
33
  constructor(options) {
23
34
  this.http = new http_1.ECAPIHttpClient(options);
24
35
  this.user = new apis_1.UserApi(this.http);
@@ -43,18 +54,35 @@ class ECAPIClient {
43
54
  this.pullConfig = new apis_1.PullConfigApi(this.http);
44
55
  this.system = new apis_1.SystemApi(this.http);
45
56
  }
57
+ /**
58
+ * Replace current auth config for subsequent requests.
59
+ */
46
60
  setAuth(auth) {
47
61
  this.http.setAuth(auth);
48
62
  }
63
+ /**
64
+ * Use IAM API Key auth for subsequent requests.
65
+ */
49
66
  setApiKey(apiKey) {
50
67
  this.http.setApiKey(apiKey);
51
68
  }
69
+ /**
70
+ * Use app session token auth for subsequent requests.
71
+ */
52
72
  setAppSessionToken(appSessionToken) {
53
73
  this.http.setAppSessionToken(appSessionToken);
54
74
  }
75
+ /**
76
+ * Clear auth headers from subsequent requests.
77
+ */
55
78
  clearAuth() {
56
79
  this.http.clearAuth();
57
80
  }
81
+ /**
82
+ * Low-level request helper.
83
+ *
84
+ * Use this when an endpoint is not yet wrapped by a high-level API method.
85
+ */
58
86
  request(method, path, options) {
59
87
  return this.http.request(method, path, options);
60
88
  }
package/dist/types.d.ts CHANGED
@@ -1,8 +1,20 @@
1
+ /** Primitive values accepted by query/body helpers. */
1
2
  export type Primitive = string | number | boolean | null | undefined;
3
+ /** A query field can be a scalar or an array (serialized as repeated keys). */
2
4
  export type QueryValue = Primitive | Primitive[];
5
+ /** Query string map passed to request options. */
3
6
  export type QueryParams = Record<string, QueryValue>;
7
+ /** Simple HTTP header map. */
4
8
  export type HeaderMap = Record<string, string>;
9
+ /**
10
+ * Expected response decoding mode.
11
+ * - json: parse JSON (default)
12
+ * - text: return UTF-8 string
13
+ * - arrayBuffer: return binary bytes
14
+ * - raw: return fetch/raw response object (transport dependent)
15
+ */
5
16
  export type ResponseType = "json" | "text" | "arrayBuffer" | "raw";
17
+ /** Supported auth modes for ECAPI requests. */
6
18
  export type AuthCredentials = {
7
19
  type: "apiKey";
8
20
  apiKey: string;
@@ -10,17 +22,29 @@ export type AuthCredentials = {
10
22
  type: "appSessionToken";
11
23
  appSessionToken: string;
12
24
  };
25
+ /** Top-level options used when creating `ECAPIClient`. */
13
26
  export interface ClientOptions {
27
+ /** API base URL, e.g. https://console.easecation.net/apiv2 */
14
28
  baseUrl: string;
29
+ /** Default auth used by all requests unless overridden. */
15
30
  auth?: AuthCredentials;
31
+ /** Request timeout in milliseconds. Default is 15000. */
16
32
  timeoutMs?: number;
33
+ /** Headers merged into every request. */
17
34
  defaultHeaders?: HeaderMap;
18
35
  }
36
+ /** Per-request options for all SDK API methods. */
19
37
  export interface RequestOptions {
38
+ /** Query parameters appended to URL. */
20
39
  query?: QueryParams;
40
+ /** Request payload for POST/PUT/PATCH/DELETE where supported. */
21
41
  body?: unknown;
42
+ /** Additional headers for this request only. */
22
43
  headers?: HeaderMap;
44
+ /** Abort signal for request cancellation. */
23
45
  signal?: AbortSignal;
46
+ /** Response parsing mode for this request. */
24
47
  responseType?: ResponseType;
48
+ /** Override client-level auth. Use null to send no auth header. */
25
49
  auth?: AuthCredentials | null;
26
50
  }
package/package.json CHANGED
@@ -1,7 +1,16 @@
1
1
  {
2
2
  "name": "@easecation/ecapi-sdk",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "ECAPI SDK for JavaScript and TypeScript",
5
+ "homepage": "https://github.com/easecation/easecation-api/tree/main/sdk/npm/ecapi-sdk#readme",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/easecation/easecation-api.git",
9
+ "directory": "sdk/npm/ecapi-sdk"
10
+ },
11
+ "bugs": {
12
+ "url": "https://github.com/easecation/easecation-api/issues"
13
+ },
5
14
  "main": "dist/index.js",
6
15
  "types": "dist/index.d.ts",
7
16
  "files": [