lxns-rhythm-api 0.1.11 → 0.1.13

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.mjs CHANGED
@@ -23,6 +23,29 @@ let LevelIndex = /* @__PURE__ */ function(LevelIndex) {
23
23
  }({});
24
24
  //#endregion
25
25
  //#region src/api/chunithm/personal-api.ts
26
+ function scoreSearchParams$1(options) {
27
+ const params = new URLSearchParams();
28
+ if (options?.songId !== void 0) params.set("song_id", String(options.songId));
29
+ if (options?.songType !== void 0) params.set("song_type", options.songType);
30
+ if (options?.levelIndex !== void 0) params.set("level_index", String(options.levelIndex));
31
+ return params;
32
+ }
33
+ function aliasListSearchParams$1(options) {
34
+ const params = new URLSearchParams();
35
+ if (options?.page !== void 0) params.set("page", String(options.page));
36
+ if (options?.sort !== void 0) params.set("sort", options.sort);
37
+ if (options?.approved !== void 0) params.set("approved", String(options.approved));
38
+ if (options?.songId !== void 0) params.set("song_id", String(options.songId));
39
+ return params;
40
+ }
41
+ function commentSearchParams$1(options) {
42
+ const params = new URLSearchParams({
43
+ song_id: String(options.songId),
44
+ level_index: String(options.levelIndex)
45
+ });
46
+ if (options.songType !== void 0) params.set("song_type", options.songType);
47
+ return params;
48
+ }
26
49
  /**
27
50
  * chunithm 个人 API(需用户身份)
28
51
  */
@@ -39,6 +62,20 @@ var ChunithmPersonalApi = class {
39
62
  return this.http.get("player").json();
40
63
  }
41
64
  /**
65
+ * 更新玩家信息
66
+ * PUT /api/v0/user/chunithm/player
67
+ */
68
+ async updatePlayer(player) {
69
+ return this.http.put("player", { json: player }).json();
70
+ }
71
+ /**
72
+ * 解绑玩家信息
73
+ * DELETE /api/v0/user/chunithm/player
74
+ */
75
+ async deletePlayer() {
76
+ return this.http.delete("player").json();
77
+ }
78
+ /**
42
79
  * 获取玩家所有成绩
43
80
  * GET /api/v0/user/chunithm/player/scores
44
81
  */
@@ -53,9 +90,217 @@ var ChunithmPersonalApi = class {
53
90
  const body = { scores };
54
91
  return this.http.post("player/scores", { json: body }).json();
55
92
  }
93
+ /**
94
+ * 删除玩家成绩。不传参数时删除全部成绩,传参数时删除匹配的历史成绩。
95
+ * DELETE /api/v0/user/chunithm/player/scores
96
+ */
97
+ async deleteScores(options) {
98
+ return this.http.delete("player/scores", { searchParams: scoreSearchParams$1(options) }).json();
99
+ }
100
+ /**
101
+ * 删除单条最佳成绩
102
+ * DELETE /api/v0/user/chunithm/player/score
103
+ */
104
+ async deleteScore(options) {
105
+ return this.http.delete("player/score", { searchParams: scoreSearchParams$1(options) }).json();
106
+ }
107
+ async getBests(options) {
108
+ return this.http.get("player/bests", { searchParams: scoreSearchParams$1(options) }).json();
109
+ }
110
+ /**
111
+ * 获取单谱面成绩排行
112
+ * GET /api/v0/user/chunithm/player/score/ranking
113
+ */
114
+ async getScoreRanking(options) {
115
+ return this.http.get("player/score/ranking", { searchParams: scoreSearchParams$1(options) }).json();
116
+ }
117
+ /**
118
+ * 获取单谱面成绩历史
119
+ * GET /api/v0/user/chunithm/player/score/history
120
+ */
121
+ async getScoreHistory(options) {
122
+ return this.http.get("player/score/history", { searchParams: scoreSearchParams$1(options) }).json();
123
+ }
124
+ /**
125
+ * 获取成绩上传热力图
126
+ * GET /api/v0/user/chunithm/player/heatmap
127
+ */
128
+ async getHeatmap() {
129
+ return this.http.get("player/heatmap").json();
130
+ }
131
+ /**
132
+ * 获取 Rating 趋势
133
+ * GET /api/v0/user/chunithm/player/trend
134
+ */
135
+ async getTrend(version) {
136
+ return this.http.get("player/trend", { searchParams: { version } }).json();
137
+ }
138
+ /**
139
+ * 获取玩家已获得的收藏品列表
140
+ * GET /api/v0/user/chunithm/player/{collectionType}
141
+ */
142
+ async getPlayerCollectionList(collectionType) {
143
+ return this.http.get(`player/${collectionType}`).json();
144
+ }
145
+ /**
146
+ * 获取玩家收藏品进度
147
+ * GET /api/v0/user/chunithm/player/{collectionType}/{id}
148
+ */
149
+ async getPlayerCollection(collectionType, id) {
150
+ return this.http.get(`player/${collectionType}/${id}`).json();
151
+ }
152
+ /**
153
+ * 通过 NET 的 HTML 源代码同步玩家数据
154
+ * POST /api/v0/user/chunithm/player/html
155
+ */
156
+ async postHtml(htmlSource) {
157
+ return this.http.post("player/html", {
158
+ body: htmlSource,
159
+ headers: { "content-type": "text/plain" }
160
+ }).json();
161
+ }
162
+ /**
163
+ * 导出玩家成绩
164
+ * GET /api/v0/user/chunithm/player/scores/export/{type}
165
+ */
166
+ async exportScores(type = "csv") {
167
+ return new Uint8Array(await this.http.get(`player/scores/export/${type}`).arrayBuffer());
168
+ }
169
+ /**
170
+ * 导入玩家成绩
171
+ * POST /api/v0/user/chunithm/player/scores/import
172
+ */
173
+ async importScores(file, fileName) {
174
+ const body = new FormData();
175
+ if (fileName) body.append("file", file, fileName);
176
+ else body.append("file", file);
177
+ return this.http.post("player/scores/import", { body }).json();
178
+ }
179
+ /**
180
+ * 获取玩家年度总结
181
+ * GET /api/v0/user/chunithm/player/year-in-review/{year}
182
+ */
183
+ async getYearInReview(year, options) {
184
+ return this.http.get(`player/year-in-review/${year}`, { searchParams: { ...options } }).json();
185
+ }
186
+ /**
187
+ * 生成年度总结分享链接
188
+ * POST /api/v0/user/chunithm/player/year-in-review/{year}/share
189
+ */
190
+ async createYearInReviewShare(year, body = { public: true }) {
191
+ return this.http.post(`player/year-in-review/${year}/share`, { json: body }).json();
192
+ }
193
+ /**
194
+ * 获取游戏个人配置
195
+ * GET /api/v0/user/chunithm/config
196
+ */
197
+ async getConfig() {
198
+ return this.http.get("config").json();
199
+ }
200
+ /**
201
+ * 更新游戏个人配置
202
+ * POST /api/v0/user/chunithm/config
203
+ */
204
+ async updateConfig(config) {
205
+ return this.http.post("config", { json: config }).json();
206
+ }
207
+ /**
208
+ * 获取登录用户可见的别名列表
209
+ * GET /api/v0/user/chunithm/alias/list
210
+ */
211
+ async getAliasList(options) {
212
+ return this.http.get("alias/list", { searchParams: aliasListSearchParams$1(options) }).json();
213
+ }
214
+ /**
215
+ * 获取登录用户的别名投票记录
216
+ * GET /api/v0/user/chunithm/alias/votes
217
+ */
218
+ async getAliasVotes() {
219
+ return this.http.get("alias/votes").json();
220
+ }
221
+ /**
222
+ * 创建曲目别名
223
+ * POST /api/v0/user/chunithm/alias
224
+ */
225
+ async createAlias(body) {
226
+ return this.http.post("alias", { json: body }).json();
227
+ }
228
+ /**
229
+ * 为曲目别名投票
230
+ * POST /api/v0/user/chunithm/alias/{aliasId}/vote/{up|down}
231
+ */
232
+ async voteAlias(aliasId, vote) {
233
+ const direction = typeof vote === "boolean" ? vote ? "up" : "down" : vote;
234
+ return this.http.post(`alias/${aliasId}/vote/${direction}`).json();
235
+ }
236
+ /**
237
+ * 删除当前用户创建的曲目别名
238
+ * DELETE /api/v0/user/chunithm/alias/{aliasId}
239
+ */
240
+ async deleteAlias(aliasId) {
241
+ return this.http.delete(`alias/${aliasId}`).json();
242
+ }
243
+ /**
244
+ * 获取谱面评论
245
+ * GET /api/v0/user/chunithm/comment/list
246
+ */
247
+ async getComments(options) {
248
+ return this.http.get("comment/list", { searchParams: commentSearchParams$1(options) }).json();
249
+ }
250
+ /**
251
+ * 创建或更新谱面评论
252
+ * POST /api/v0/user/chunithm/comment
253
+ */
254
+ async createComment(body) {
255
+ return this.http.post("comment", { json: body }).json();
256
+ }
257
+ /**
258
+ * 删除谱面评论
259
+ * DELETE /api/v0/user/chunithm/comment/{commentId}
260
+ */
261
+ async deleteComment(commentId) {
262
+ return this.http.delete(`comment/${commentId}`).json();
263
+ }
264
+ /**
265
+ * 点赞谱面评论
266
+ * POST /api/v0/user/chunithm/comment/{commentId}/like
267
+ */
268
+ async likeComment(commentId) {
269
+ return this.http.post(`comment/${commentId}/like`).json();
270
+ }
271
+ /**
272
+ * 取消点赞谱面评论
273
+ * DELETE /api/v0/user/chunithm/comment/{commentId}/like
274
+ */
275
+ async unlikeComment(commentId) {
276
+ return this.http.delete(`comment/${commentId}/like`).json();
277
+ }
56
278
  };
57
279
  //#endregion
58
280
  //#region src/api/maimai/personal-api.ts
281
+ function scoreSearchParams(options) {
282
+ const params = new URLSearchParams();
283
+ if (options?.songId !== void 0) params.set("song_id", String(options.songId));
284
+ if (options?.songType !== void 0) params.set("song_type", options.songType);
285
+ if (options?.levelIndex !== void 0) params.set("level_index", String(options.levelIndex));
286
+ return params;
287
+ }
288
+ function aliasListSearchParams(options) {
289
+ const params = new URLSearchParams();
290
+ if (options?.page !== void 0) params.set("page", String(options.page));
291
+ if (options?.sort !== void 0) params.set("sort", options.sort);
292
+ if (options?.approved !== void 0) params.set("approved", String(options.approved));
293
+ if (options?.songId !== void 0) params.set("song_id", String(options.songId));
294
+ return params;
295
+ }
296
+ function commentSearchParams(options) {
297
+ const params = new URLSearchParams({
298
+ song_id: String(options.songId),
299
+ level_index: String(options.levelIndex)
300
+ });
301
+ if (options.songType !== void 0) params.set("song_type", options.songType);
302
+ return params;
303
+ }
59
304
  /**
60
305
  * maimai 个人 API(需用户身份,路径遵循文档)
61
306
  */
@@ -73,6 +318,20 @@ var MaimaiPersonalApi = class {
73
318
  return this.http.get("player").json();
74
319
  }
75
320
  /**
321
+ * 更新玩家信息
322
+ * PUT /api/v0/user/maimai/player
323
+ */
324
+ async updatePlayer(player) {
325
+ return this.http.put("player", { json: player }).json();
326
+ }
327
+ /**
328
+ * 解绑玩家信息
329
+ * DELETE /api/v0/user/maimai/player
330
+ */
331
+ async deletePlayer() {
332
+ return this.http.delete("player").json();
333
+ }
334
+ /**
76
335
  * 获取玩家所有成绩
77
336
  * GET /api/v0/user/maimai/player/scores
78
337
  * @returns PlayerScores
@@ -90,6 +349,191 @@ var MaimaiPersonalApi = class {
90
349
  const body = { scores };
91
350
  return this.http.post("player/scores", { json: body }).json();
92
351
  }
352
+ /**
353
+ * 删除玩家成绩。不传参数时删除全部成绩,传参数时删除匹配的历史成绩。
354
+ * DELETE /api/v0/user/maimai/player/scores
355
+ */
356
+ async deleteScores(options) {
357
+ return this.http.delete("player/scores", { searchParams: scoreSearchParams(options) }).json();
358
+ }
359
+ /**
360
+ * 删除单条最佳成绩
361
+ * DELETE /api/v0/user/maimai/player/score
362
+ */
363
+ async deleteScore(options) {
364
+ return this.http.delete("player/score", { searchParams: scoreSearchParams(options) }).json();
365
+ }
366
+ async getBests(options) {
367
+ return this.http.get("player/bests", { searchParams: scoreSearchParams(options) }).json();
368
+ }
369
+ /**
370
+ * 获取单谱面成绩排行
371
+ * GET /api/v0/user/maimai/player/score/ranking
372
+ */
373
+ async getScoreRanking(options) {
374
+ return this.http.get("player/score/ranking", { searchParams: scoreSearchParams(options) }).json();
375
+ }
376
+ /**
377
+ * 获取单谱面成绩历史
378
+ * GET /api/v0/user/maimai/player/score/history
379
+ */
380
+ async getScoreHistory(options) {
381
+ return this.http.get("player/score/history", { searchParams: scoreSearchParams(options) }).json();
382
+ }
383
+ /**
384
+ * 获取成绩上传热力图
385
+ * GET /api/v0/user/maimai/player/heatmap
386
+ */
387
+ async getHeatmap() {
388
+ return this.http.get("player/heatmap").json();
389
+ }
390
+ /**
391
+ * 获取 DX Rating 趋势
392
+ * GET /api/v0/user/maimai/player/trend
393
+ */
394
+ async getTrend(version) {
395
+ return this.http.get("player/trend", { searchParams: { version } }).json();
396
+ }
397
+ /**
398
+ * 获取玩家已获得的收藏品列表
399
+ * GET /api/v0/user/maimai/player/{collectionType}
400
+ */
401
+ async getPlayerCollectionList(collectionType) {
402
+ return this.http.get(`player/${collectionType}`).json();
403
+ }
404
+ /**
405
+ * 获取玩家收藏品进度
406
+ * GET /api/v0/user/maimai/player/{collectionType}/{id}
407
+ */
408
+ async getPlayerCollection(collectionType, id) {
409
+ return this.http.get(`player/${collectionType}/${id}`).json();
410
+ }
411
+ /**
412
+ * 通过 NET 的 HTML 源代码同步玩家数据
413
+ * POST /api/v0/user/maimai/player/html
414
+ */
415
+ async postHtml(htmlSource) {
416
+ return this.http.post("player/html", {
417
+ body: htmlSource,
418
+ headers: { "content-type": "text/plain" }
419
+ }).json();
420
+ }
421
+ /**
422
+ * 导出玩家成绩
423
+ * GET /api/v0/user/maimai/player/scores/export/{type}
424
+ */
425
+ async exportScores(type = "csv") {
426
+ return new Uint8Array(await this.http.get(`player/scores/export/${type}`).arrayBuffer());
427
+ }
428
+ /**
429
+ * 导入玩家成绩
430
+ * POST /api/v0/user/maimai/player/scores/import
431
+ */
432
+ async importScores(file, fileName) {
433
+ const body = new FormData();
434
+ if (fileName) body.append("file", file, fileName);
435
+ else body.append("file", file);
436
+ return this.http.post("player/scores/import", { body }).json();
437
+ }
438
+ /**
439
+ * 获取玩家年度总结
440
+ * GET /api/v0/user/maimai/player/year-in-review/{year}
441
+ */
442
+ async getYearInReview(year, options) {
443
+ return this.http.get(`player/year-in-review/${year}`, { searchParams: { ...options } }).json();
444
+ }
445
+ /**
446
+ * 生成年度总结分享链接
447
+ * POST /api/v0/user/maimai/player/year-in-review/{year}/share
448
+ */
449
+ async createYearInReviewShare(year, body = { public: true }) {
450
+ return this.http.post(`player/year-in-review/${year}/share`, { json: body }).json();
451
+ }
452
+ /**
453
+ * 获取游戏个人配置
454
+ * GET /api/v0/user/maimai/config
455
+ */
456
+ async getConfig() {
457
+ return this.http.get("config").json();
458
+ }
459
+ /**
460
+ * 更新游戏个人配置
461
+ * POST /api/v0/user/maimai/config
462
+ */
463
+ async updateConfig(config) {
464
+ return this.http.post("config", { json: config }).json();
465
+ }
466
+ /**
467
+ * 获取登录用户可见的别名列表
468
+ * GET /api/v0/user/maimai/alias/list
469
+ */
470
+ async getAliasList(options) {
471
+ return this.http.get("alias/list", { searchParams: aliasListSearchParams(options) }).json();
472
+ }
473
+ /**
474
+ * 获取登录用户的别名投票记录
475
+ * GET /api/v0/user/maimai/alias/votes
476
+ */
477
+ async getAliasVotes() {
478
+ return this.http.get("alias/votes").json();
479
+ }
480
+ /**
481
+ * 创建曲目别名
482
+ * POST /api/v0/user/maimai/alias
483
+ */
484
+ async createAlias(body) {
485
+ return this.http.post("alias", { json: body }).json();
486
+ }
487
+ /**
488
+ * 为曲目别名投票
489
+ * POST /api/v0/user/maimai/alias/{aliasId}/vote/{up|down}
490
+ */
491
+ async voteAlias(aliasId, vote) {
492
+ const direction = typeof vote === "boolean" ? vote ? "up" : "down" : vote;
493
+ return this.http.post(`alias/${aliasId}/vote/${direction}`).json();
494
+ }
495
+ /**
496
+ * 删除当前用户创建的曲目别名
497
+ * DELETE /api/v0/user/maimai/alias/{aliasId}
498
+ */
499
+ async deleteAlias(aliasId) {
500
+ return this.http.delete(`alias/${aliasId}`).json();
501
+ }
502
+ /**
503
+ * 获取谱面评论
504
+ * GET /api/v0/user/maimai/comment/list
505
+ */
506
+ async getComments(options) {
507
+ return this.http.get("comment/list", { searchParams: commentSearchParams(options) }).json();
508
+ }
509
+ /**
510
+ * 创建或更新谱面评论
511
+ * POST /api/v0/user/maimai/comment
512
+ */
513
+ async createComment(body) {
514
+ return this.http.post("comment", { json: body }).json();
515
+ }
516
+ /**
517
+ * 删除谱面评论
518
+ * DELETE /api/v0/user/maimai/comment/{commentId}
519
+ */
520
+ async deleteComment(commentId) {
521
+ return this.http.delete(`comment/${commentId}`).json();
522
+ }
523
+ /**
524
+ * 点赞谱面评论
525
+ * POST /api/v0/user/maimai/comment/{commentId}/like
526
+ */
527
+ async likeComment(commentId) {
528
+ return this.http.post(`comment/${commentId}/like`).json();
529
+ }
530
+ /**
531
+ * 取消点赞谱面评论
532
+ * DELETE /api/v0/user/maimai/comment/{commentId}/like
533
+ */
534
+ async unlikeComment(commentId) {
535
+ return this.http.delete(`comment/${commentId}/like`).json();
536
+ }
93
537
  };
94
538
  //#endregion
95
539
  //#region src/api/oauth/user.ts
@@ -806,6 +1250,13 @@ var ChunithmPublicApi = class {
806
1250
  async getCollectionInfo(collectionType, id, version) {
807
1251
  return this.http.get(`${collectionType}/${id}`, { searchParams: { version } }).json();
808
1252
  }
1253
+ /**
1254
+ * 获取公开分享的年度总结
1255
+ * GET /api/v0/chunithm/year-in-review/{year}/share/{shareToken}
1256
+ */
1257
+ async getYearInReviewShare(year, shareToken, options) {
1258
+ return this.http.get(`year-in-review/${year}/share/${shareToken}`, { searchParams: { ...options } }).json();
1259
+ }
809
1260
  };
810
1261
  //#endregion
811
1262
  //#region src/api/maimai/dev-api.ts
@@ -884,10 +1335,11 @@ var MaimaiDevApi = class {
884
1335
  /**
885
1336
  * DX Rating 趋势
886
1337
  * @param friendCode 好友码
1338
+ * @param version 游戏版本(可选)
887
1339
  * @returns TrendList
888
1340
  */
889
- async getTrend(friendCode) {
890
- return this.http.get(`player/${friendCode}/trend`).json();
1341
+ async getTrend(friendCode, version) {
1342
+ return this.http.get(`player/${friendCode}/trend`, { searchParams: { version } }).json();
891
1343
  }
892
1344
  /**
893
1345
  * 成绩游玩历史记录(仅返回带有 play_time 的成绩)
@@ -1062,6 +1514,13 @@ var MaimaiPublicApi = class {
1062
1514
  async getCollectionGenreInfo(id, options) {
1063
1515
  return this.http.get(`collection-genre/${id}`, { searchParams: { ...options } }).json();
1064
1516
  }
1517
+ /**
1518
+ * 获取公开分享的年度总结
1519
+ * GET /api/v0/maimai/year-in-review/{year}/share/{shareToken}
1520
+ */
1521
+ async getYearInReviewShare(year, shareToken, options) {
1522
+ return this.http.get(`year-in-review/${year}/share/${shareToken}`, { searchParams: { ...options } }).json();
1523
+ }
1065
1524
  };
1066
1525
  //#endregion
1067
1526
  //#region src/lxns-api-error.ts
package/package.json CHANGED
@@ -12,7 +12,7 @@
12
12
  "api-client"
13
13
  ],
14
14
  "author": "amatsuka <amatsukamao@qq.com>",
15
- "version": "0.1.11",
15
+ "version": "0.1.13",
16
16
  "license": "MIT",
17
17
  "repository": {
18
18
  "type": "git",