polyv-live-api-sdk 1.0.19 → 1.0.20

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.
Files changed (34) hide show
  1. package/dist/index.cjs +303 -97
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +110 -24
  4. package/dist/index.js +303 -97
  5. package/dist/index.js.map +1 -1
  6. package/dist/services/channel.service.d.ts +4 -3
  7. package/dist/services/channel.service.d.ts.map +1 -1
  8. package/dist/services/chat.service.d.ts +1 -1
  9. package/dist/services/chat.service.d.ts.map +1 -1
  10. package/dist/services/live-interaction.service.d.ts.map +1 -1
  11. package/dist/services/player.service.d.ts +1 -1
  12. package/dist/services/player.service.d.ts.map +1 -1
  13. package/dist/services/v4/ai.service.d.ts.map +1 -1
  14. package/dist/services/v4/channel.service.d.ts +11 -5
  15. package/dist/services/v4/channel.service.d.ts.map +1 -1
  16. package/dist/services/v4/global.service.d.ts.map +1 -1
  17. package/dist/services/v4/robot.service.d.ts.map +1 -1
  18. package/dist/services/v4/user.service.d.ts.map +1 -1
  19. package/dist/services/v4/webapp.service.d.ts.map +1 -1
  20. package/dist/services/web.service.d.ts +1 -1
  21. package/dist/services/web.service.d.ts.map +1 -1
  22. package/dist/types/channel.d.ts +20 -7
  23. package/dist/types/channel.d.ts.map +1 -1
  24. package/dist/types/chat-censor-role.d.ts +5 -3
  25. package/dist/types/chat-censor-role.d.ts.map +1 -1
  26. package/dist/types/index.d.ts +1 -1
  27. package/dist/types/index.d.ts.map +1 -1
  28. package/dist/types/player.d.ts +4 -2
  29. package/dist/types/player.d.ts.map +1 -1
  30. package/dist/types/v4-channel.d.ts +53 -6
  31. package/dist/types/v4-channel.d.ts.map +1 -1
  32. package/dist/types/web.d.ts +4 -0
  33. package/dist/types/web.d.ts.map +1 -1
  34. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -2,12 +2,12 @@
2
2
 
3
3
  var CryptoJS = require('crypto-js');
4
4
  var crypto = require('crypto');
5
- var axios = require('axios');
5
+ var axios2 = require('axios');
6
6
 
7
7
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
8
 
9
9
  var CryptoJS__default = /*#__PURE__*/_interopDefault(CryptoJS);
10
- var axios__default = /*#__PURE__*/_interopDefault(axios);
10
+ var axios2__default = /*#__PURE__*/_interopDefault(axios2);
11
11
 
12
12
  // src/errors/polyv-error.ts
13
13
  var PolyVError = class _PolyVError extends Error {
@@ -1271,7 +1271,8 @@ var ChannelService = class {
1271
1271
  * Update teacher document relation
1272
1272
  *
1273
1273
  * Adds or removes the binding between a teacher and documents.
1274
- * Note: fileIds is passed in the body, other parameters in query string.
1274
+ * Note: fileIds is passed in the request body as application/x-www-form-urlencoded
1275
+ * (NOT signed), while teacherId/operation are query-string parameters that ARE signed.
1275
1276
  *
1276
1277
  * @param teacherId - The teacher ID
1277
1278
  * @param fileIds - File IDs, comma-separated
@@ -1294,10 +1295,15 @@ var ChannelService = class {
1294
1295
  if (!fileIds || fileIds.trim() === "") {
1295
1296
  throw PolyVValidationError.required("fileIds");
1296
1297
  }
1298
+ const form = new URLSearchParams();
1299
+ form.set("fileIds", fileIds);
1297
1300
  const response = await this.client.httpClient.post(
1298
1301
  "/live/v4/channel/doc/teacher/update-relation",
1299
- { fileIds },
1300
- { params: { teacherId, operation } }
1302
+ form,
1303
+ {
1304
+ params: { teacherId, operation },
1305
+ headers: { "Content-Type": "application/x-www-form-urlencoded" }
1306
+ }
1301
1307
  );
1302
1308
  return response;
1303
1309
  }
@@ -2714,11 +2720,10 @@ var ChannelService = class {
2714
2720
  throw PolyVValidationError.required("fileId");
2715
2721
  }
2716
2722
  const params = { channelId, fileId: options.fileId };
2717
- if (options.startTime !== void 0) {
2718
- params.startTime = options.startTime;
2719
- }
2720
- if (options.endTime !== void 0) {
2721
- params.endTime = options.endTime;
2723
+ if (options.startTime !== void 0 && options.endTime !== void 0) {
2724
+ params.deleteTimeFrame = JSON.stringify([
2725
+ { start: options.startTime, end: options.endTime }
2726
+ ]);
2722
2727
  }
2723
2728
  if (options.fileName !== void 0) {
2724
2729
  params.fileName = options.fileName;
@@ -2952,12 +2957,16 @@ var ChannelService = class {
2952
2957
  if (!channelId || channelId.trim() === "") {
2953
2958
  throw PolyVValidationError.required("channelId");
2954
2959
  }
2955
- if (!options.fileIds || options.fileIds.length === 0) {
2956
- throw PolyVValidationError.required("fileIds");
2960
+ if (!options.startTime || String(options.startTime).trim() === "") {
2961
+ throw PolyVValidationError.required("startTime");
2962
+ }
2963
+ if (!options.endTime || String(options.endTime).trim() === "") {
2964
+ throw PolyVValidationError.required("endTime");
2957
2965
  }
2958
2966
  const params = {
2959
2967
  channelId,
2960
- fileIds: options.fileIds.join(",")
2968
+ startTime: options.startTime,
2969
+ endTime: options.endTime
2961
2970
  };
2962
2971
  if (options.fileName !== void 0) {
2963
2972
  params.fileName = options.fileName;
@@ -2993,12 +3002,16 @@ var ChannelService = class {
2993
3002
  if (!channelId || channelId.trim() === "") {
2994
3003
  throw PolyVValidationError.required("channelId");
2995
3004
  }
2996
- if (!options.fileIds || options.fileIds.length === 0) {
2997
- throw PolyVValidationError.required("fileIds");
3005
+ if (!options.startTime || String(options.startTime).trim() === "") {
3006
+ throw PolyVValidationError.required("startTime");
3007
+ }
3008
+ if (!options.endTime || String(options.endTime).trim() === "") {
3009
+ throw PolyVValidationError.required("endTime");
2998
3010
  }
2999
3011
  const params = {
3000
3012
  channelId,
3001
- fileIds: options.fileIds.join(",")
3013
+ startTime: options.startTime,
3014
+ endTime: options.endTime
3002
3015
  };
3003
3016
  if (options.fileName !== void 0) {
3004
3017
  params.fileName = options.fileName;
@@ -3035,13 +3048,17 @@ var ChannelService = class {
3035
3048
  if (!channelId || channelId.trim() === "") {
3036
3049
  throw PolyVValidationError.required("channelId");
3037
3050
  }
3038
- if (!options.fileId || options.fileId.trim() === "") {
3039
- throw PolyVValidationError.required("fileId");
3051
+ if (!options.type || options.type.trim() === "") {
3052
+ throw PolyVValidationError.required("type");
3053
+ }
3054
+ const params = { channelId, type: options.type };
3055
+ if (options.fromStartStop !== void 0) {
3056
+ params.fromStartStop = options.fromStartStop;
3040
3057
  }
3041
3058
  await this.client.httpClient.post(
3042
3059
  "/live/v3/channel/record/add-breakpoint",
3043
3060
  null,
3044
- { params: { channelId, fileId: options.fileId, time: options.time } }
3061
+ { params }
3045
3062
  );
3046
3063
  return true;
3047
3064
  }
@@ -6016,8 +6033,25 @@ var ChannelService = class {
6016
6033
  return response;
6017
6034
  }
6018
6035
  };
6019
-
6020
- // src/services/chat.service.ts
6036
+ var APICHAT_USERLIST_SIGN_SECRET = "polyvChatSignForExternal";
6037
+ function buildChatUserListSign(params) {
6038
+ let content = APICHAT_USERLIST_SIGN_SECRET;
6039
+ for (const key of Object.keys(params).sort()) {
6040
+ content += key + params[key];
6041
+ }
6042
+ content += APICHAT_USERLIST_SIGN_SECRET;
6043
+ return crypto.createHash("md5").update(content, "utf8").digest("hex").toUpperCase();
6044
+ }
6045
+ function decryptChatUserList(encryptedHex, sign) {
6046
+ const key = Buffer.from(sign.slice(0, 16), "utf8");
6047
+ const decipher = crypto.createDecipheriv("aes-128-cbc", key, key);
6048
+ const decrypted = Buffer.concat([
6049
+ decipher.update(Buffer.from(encryptedHex, "hex")),
6050
+ decipher.final()
6051
+ ]);
6052
+ const json = Buffer.from(decrypted.toString("utf8"), "base64").toString("utf8");
6053
+ return JSON.parse(json);
6054
+ }
6021
6055
  var ChatService = class {
6022
6056
  client;
6023
6057
  /**
@@ -6113,9 +6147,17 @@ var ChatService = class {
6113
6147
  * ```
6114
6148
  */
6115
6149
  async sendChat(params) {
6150
+ const encodedContent = typeof params.content === "string" ? Buffer.from(params.content, "utf8").toString("base64url") : params.content;
6116
6151
  const response = await this.client.httpClient.post(
6117
6152
  `/live/v1/channelSetting/${params.channelId}/send-chat`,
6118
- { userId: params.userId, content: params.content, imgUrl: params.imgUrl }
6153
+ null,
6154
+ {
6155
+ params: {
6156
+ userId: params.userId,
6157
+ content: encodedContent,
6158
+ imgUrl: params.imgUrl
6159
+ }
6160
+ }
6119
6161
  );
6120
6162
  return response;
6121
6163
  }
@@ -6407,11 +6449,27 @@ var ChatService = class {
6407
6449
  if (params.len !== void 0 && (params.len < 1 || params.len > 1e3)) {
6408
6450
  throw new PolyVValidationError("len must be between 1 and 1000");
6409
6451
  }
6410
- const response = await this.client.httpClient.get(
6452
+ const query = {
6453
+ roomId: params.roomId,
6454
+ page: String(params.page ?? 1),
6455
+ len: String(params.len ?? 100),
6456
+ hide: "0",
6457
+ toGetSubRooms: String(params.toGetSubRooms ?? false)
6458
+ };
6459
+ const sign = buildChatUserListSign(query);
6460
+ const response = await axios2__default.default.get(
6411
6461
  "https://apichat.polyv.net/front/userlistExternal",
6412
- { params }
6462
+ {
6463
+ params: { ...query, sign },
6464
+ responseType: "text",
6465
+ transformResponse: [(data) => data]
6466
+ }
6413
6467
  );
6414
- return response;
6468
+ const body = typeof response.data === "string" ? response.data.trim() : "";
6469
+ if (!body) {
6470
+ return { count: 0, userlist: [] };
6471
+ }
6472
+ return decryptChatUserList(body, sign);
6415
6473
  }
6416
6474
  /**
6417
6475
  * updateAdminInfo - 更新管理员信息
@@ -6426,7 +6484,7 @@ var ChatService = class {
6426
6484
  * channelId: '123456',
6427
6485
  * nickname: '管理员',
6428
6486
  * actor: '管理员1',
6429
- * avatar: imageBuffer,
6487
+ * avatar: avatarFile,
6430
6488
  * });
6431
6489
  * console.log(result.data);
6432
6490
  * ```
@@ -6441,16 +6499,39 @@ var ChatService = class {
6441
6499
  if (!params.actor) {
6442
6500
  throw new PolyVValidationError("actor is required");
6443
6501
  }
6444
- const requestBody = {
6445
- nickname: params.nickname,
6446
- actor: params.actor
6447
- };
6448
- if (params.avatar) {
6449
- requestBody.avatar = params.avatar;
6502
+ if (!params.avatar) {
6503
+ throw new PolyVValidationError("avatar is required");
6504
+ }
6505
+ const timestamp = Date.now();
6506
+ const { sign } = generateSignature(
6507
+ {
6508
+ appId: this.client.config.appId,
6509
+ timestamp,
6510
+ nickname: params.nickname,
6511
+ actor: params.actor
6512
+ },
6513
+ { appSecret: this.client.config.appSecret }
6514
+ );
6515
+ const formData = new FormData();
6516
+ formData.append("appId", this.client.config.appId);
6517
+ formData.append("timestamp", String(timestamp));
6518
+ formData.append("sign", sign);
6519
+ formData.append("nickname", params.nickname);
6520
+ formData.append("actor", params.actor);
6521
+ if (params.avatar instanceof Blob) {
6522
+ formData.append("avatar", params.avatar, params.avatar.name || "avatar.png");
6523
+ } else {
6524
+ formData.append("avatar", new Blob([params.avatar]), "avatar.png");
6450
6525
  }
6451
6526
  const response = await this.client.httpClient.post(
6452
6527
  `/live/v2/channelSetting/${params.channelId}/set-chat-admin`,
6453
- requestBody
6528
+ formData,
6529
+ {
6530
+ headers: {
6531
+ "Content-Type": "multipart/form-data",
6532
+ "X-Skip-Auth": "true"
6533
+ }
6534
+ }
6454
6535
  );
6455
6536
  return response;
6456
6537
  }
@@ -7376,10 +7457,19 @@ var LiveInteractionService = class {
7376
7457
  this.validateRequiredString(params.lotteryId, "lotteryId");
7377
7458
  this.validateRequiredString(params.winnerCode, "winnerCode");
7378
7459
  this.validateRequiredString(params.viewerId, "viewerId");
7460
+ const body = {
7461
+ channelId: params.channelId,
7462
+ lotteryId: params.lotteryId,
7463
+ winnerCode: params.winnerCode,
7464
+ viewerId: params.viewerId
7465
+ };
7466
+ if (params.receiveInfo !== void 0) {
7467
+ body.receiveInfo = JSON.stringify(params.receiveInfo);
7468
+ }
7379
7469
  const response = await this.client.httpClient.post(
7380
7470
  "/live/v4/channel/lottery/add-receive-info",
7381
- null,
7382
- { params: this.compactParams(params) }
7471
+ body,
7472
+ { params: this.compactParams({ channelId: params.channelId }) }
7383
7473
  );
7384
7474
  return response;
7385
7475
  }
@@ -8337,10 +8427,29 @@ var WebService = class {
8337
8427
  if (!params.imgfile) {
8338
8428
  throw new PolyVValidationError("imgfile is required");
8339
8429
  }
8430
+ const timestamp = Date.now();
8431
+ const { sign } = generateSignature(
8432
+ { appId: this.client.config.appId, timestamp },
8433
+ { appSecret: this.client.config.appSecret }
8434
+ );
8435
+ const formData = new FormData();
8436
+ formData.append("appId", this.client.config.appId);
8437
+ formData.append("timestamp", String(timestamp));
8438
+ formData.append("sign", sign);
8439
+ if (params.imgfile instanceof Blob) {
8440
+ formData.append("imgfile", params.imgfile, params.imgfile.name || "logo.png");
8441
+ } else {
8442
+ formData.append("imgfile", params.imgfile);
8443
+ }
8340
8444
  const response = await this.client.httpClient.post(
8341
8445
  `/live/v2/channelSetting/${params.channelId}/setCoverImg`,
8342
- null,
8343
- { params: { imgfile: params.imgfile } }
8446
+ formData,
8447
+ {
8448
+ headers: {
8449
+ "Content-Type": "multipart/form-data",
8450
+ "X-Skip-Auth": "true"
8451
+ }
8452
+ }
8344
8453
  );
8345
8454
  return response;
8346
8455
  }
@@ -8890,18 +8999,20 @@ var WebService = class {
8890
8999
  if (params.enabled !== void 0 && !["Y", "N"].includes(params.enabled)) {
8891
9000
  throw new PolyVValidationError("enabled must be Y or N");
8892
9001
  }
9002
+ const apiParams = {};
9003
+ if (params.channelId) {
9004
+ apiParams.channelId = params.channelId;
9005
+ }
8893
9006
  const body = {
8894
9007
  goods: params.goods
8895
9008
  };
8896
- if (params.channelId) {
8897
- body.channelId = params.channelId;
8898
- }
8899
9009
  if (params.enabled) {
8900
9010
  body.enabled = params.enabled;
8901
9011
  }
8902
9012
  const response = await this.client.httpClient.post(
8903
9013
  "/live/v3/channel/donate/update-good",
8904
- body
9014
+ body,
9015
+ { params: apiParams }
8905
9016
  );
8906
9017
  return response;
8907
9018
  }
@@ -9042,15 +9153,32 @@ var WebService = class {
9042
9153
  if (params.files.length > 6) {
9043
9154
  throw new PolyVValidationError("files must contain 1-6 files");
9044
9155
  }
9156
+ const timestamp = Date.now();
9157
+ const { sign } = generateSignature(
9158
+ { appId: this.client.config.appId, timestamp, type: params.type },
9159
+ { appSecret: this.client.config.appSecret }
9160
+ );
9045
9161
  const formData = new FormData();
9162
+ formData.append("appId", this.client.config.appId);
9163
+ formData.append("timestamp", String(timestamp));
9164
+ formData.append("sign", sign);
9046
9165
  formData.append("type", params.type);
9047
9166
  for (const file of params.files) {
9048
- formData.append("files", file);
9167
+ if (file instanceof Blob) {
9168
+ formData.append("file", file, file.name || "image.png");
9169
+ } else {
9170
+ formData.append("file", file);
9171
+ }
9049
9172
  }
9050
9173
  const response = await this.client.httpClient.post(
9051
9174
  "/live/v3/common/upload-image",
9052
9175
  formData,
9053
- { headers: { "Content-Type": "multipart/form-data" } }
9176
+ {
9177
+ headers: {
9178
+ "Content-Type": "multipart/form-data",
9179
+ "X-Skip-Auth": "true"
9180
+ }
9181
+ }
9054
9182
  );
9055
9183
  return response;
9056
9184
  }
@@ -9378,16 +9506,38 @@ var WebService = class {
9378
9506
  if (!params.file) {
9379
9507
  throw new PolyVValidationError("file is required");
9380
9508
  }
9509
+ const timestamp = Date.now();
9510
+ const signParams = {
9511
+ appId: this.client.config.appId,
9512
+ timestamp,
9513
+ rank: params.rank
9514
+ };
9515
+ if (params.channelId) {
9516
+ signParams.channelId = params.channelId;
9517
+ }
9518
+ const { sign } = generateSignature(signParams, { appSecret: this.client.config.appSecret });
9381
9519
  const formData = new FormData();
9520
+ formData.append("appId", this.client.config.appId);
9521
+ formData.append("timestamp", String(timestamp));
9522
+ formData.append("sign", sign);
9382
9523
  formData.append("rank", params.rank.toString());
9383
- formData.append("file", params.file);
9384
9524
  if (params.channelId) {
9385
9525
  formData.append("channelId", params.channelId);
9386
9526
  }
9527
+ if (params.file instanceof Blob) {
9528
+ formData.append("file", params.file, params.file.name || "whitelist.xls");
9529
+ } else {
9530
+ formData.append("file", params.file);
9531
+ }
9387
9532
  const response = await this.client.httpClient.post(
9388
9533
  "/live/v3/channel/auth/upload-white-list",
9389
9534
  formData,
9390
- { headers: { "Content-Type": "multipart/form-data" } }
9535
+ {
9536
+ headers: {
9537
+ "Content-Type": "multipart/form-data",
9538
+ "X-Skip-Auth": "true"
9539
+ }
9540
+ }
9391
9541
  );
9392
9542
  return response;
9393
9543
  }
@@ -9544,15 +9694,19 @@ var WebService = class {
9544
9694
  *
9545
9695
  * @example
9546
9696
  * ```typescript
9547
- * const result = await client.web.getRecordField({ channelId: '123456' });
9697
+ * const result = await client.web.getRecordField({ channelId: '123456', rank: 1 });
9548
9698
  * console.log(result.infoFields);
9549
9699
  * ```
9550
9700
  */
9551
9701
  async getRecordField(params) {
9552
9702
  this.validateChannelId(params.channelId);
9703
+ const rank = params.rank ?? 1;
9704
+ if (rank !== 1 && rank !== 2) {
9705
+ throw new PolyVValidationError("rank must be 1 (primary) or 2 (secondary)");
9706
+ }
9553
9707
  const response = await this.client.httpClient.get(
9554
9708
  "/live/v3/channel/auth/get-record-field",
9555
- { params: { channelId: params.channelId } }
9709
+ { params: { channelId: params.channelId, rank } }
9556
9710
  );
9557
9711
  return response;
9558
9712
  }
@@ -9625,9 +9779,13 @@ var WebService = class {
9625
9779
  */
9626
9780
  async downloadRecordInfo(params) {
9627
9781
  this.validateChannelId(params.channelId);
9782
+ const rank = params.rank ?? 1;
9783
+ if (rank !== 1 && rank !== 2) {
9784
+ throw new PolyVValidationError("rank must be 1 (primary) or 2 (secondary)");
9785
+ }
9628
9786
  const response = await this.client.httpClient.get(
9629
9787
  "/live/v3/channel/auth/download-record-info",
9630
- { params: { channelId: params.channelId }, responseType: "arraybuffer" }
9788
+ { params: { channelId: params.channelId, rank }, responseType: "arraybuffer" }
9631
9789
  );
9632
9790
  return response;
9633
9791
  }
@@ -10991,15 +11149,15 @@ var PlayerService = class {
10991
11149
  if (params.marqueeRestrict === "Y" && !params.url) {
10992
11150
  throw new PolyVValidationError('url is required when marqueeRestrict is "Y"');
10993
11151
  }
10994
- const body = {
11152
+ const queryParams = {
10995
11153
  marqueeRestrict: params.marqueeRestrict
10996
11154
  };
10997
11155
  if (params.url !== void 0) {
10998
- body.url = params.url;
11156
+ queryParams.url = params.url;
10999
11157
  }
11000
- const response = await this.client.httpClient.post(
11158
+ const response = await this.client.httpClient.get(
11001
11159
  `/live/v2/channelRestrict/${channelId}/set-diyurl-marquee`,
11002
- body
11160
+ { params: queryParams }
11003
11161
  );
11004
11162
  return response;
11005
11163
  }
@@ -11018,7 +11176,7 @@ var PlayerService = class {
11018
11176
  * ```typescript
11019
11177
  * await client.player.updateHeadAdvert(123456, {
11020
11178
  * headAdvertType: 'IMAGE',
11021
- * headAdvertImage: 'https://example.com/ad.jpg',
11179
+ * headAdvertMediaUrl: 'https://example.com/ad.jpg',
11022
11180
  * });
11023
11181
  * ```
11024
11182
  */
@@ -11028,33 +11186,32 @@ var PlayerService = class {
11028
11186
  if (params.enabled !== void 0) {
11029
11187
  this.validateYNValue(params.enabled, "enabled");
11030
11188
  }
11031
- const body = {
11032
- headAdvertType: params.headAdvertType
11189
+ const requestParams = {
11190
+ headAdvertType: String(params.headAdvertType).toLowerCase()
11033
11191
  };
11034
- if (params.headAdvertImage !== void 0) {
11035
- body.headAdvertImage = params.headAdvertImage;
11036
- }
11037
- if (params.headAdvertFlv !== void 0) {
11038
- body.headAdvertFlv = params.headAdvertFlv;
11192
+ const mediaUrl = params.headAdvertMediaUrl ?? params.headAdvertImage ?? params.headAdvertFlv;
11193
+ if (mediaUrl !== void 0) {
11194
+ requestParams.headAdvertMediaUrl = mediaUrl;
11039
11195
  }
11040
11196
  if (params.headAdvertHref !== void 0) {
11041
- body.headAdvertHref = params.headAdvertHref;
11197
+ requestParams.headAdvertHref = params.headAdvertHref;
11042
11198
  }
11043
11199
  if (params.headAdvertDuration !== void 0) {
11044
- body.headAdvertDuration = params.headAdvertDuration;
11200
+ requestParams.headAdvertDuration = params.headAdvertDuration;
11045
11201
  }
11046
11202
  if (params.headAdvertWidth !== void 0) {
11047
- body.headAdvertWidth = params.headAdvertWidth;
11203
+ requestParams.headAdvertWidth = params.headAdvertWidth;
11048
11204
  }
11049
11205
  if (params.headAdvertHeight !== void 0) {
11050
- body.headAdvertHeight = params.headAdvertHeight;
11206
+ requestParams.headAdvertHeight = params.headAdvertHeight;
11051
11207
  }
11052
11208
  if (params.enabled !== void 0) {
11053
- body.enabled = params.enabled;
11209
+ requestParams.enabled = params.enabled;
11054
11210
  }
11055
11211
  const response = await this.client.httpClient.post(
11056
11212
  `/live/v2/channelAdvert/${channelId}/updateHead`,
11057
- body
11213
+ null,
11214
+ { params: requestParams }
11058
11215
  );
11059
11216
  return response;
11060
11217
  }
@@ -11958,7 +12115,7 @@ var V4AiService = class {
11958
12115
  }
11959
12116
  await this.client.httpClient.post(
11960
12117
  "/live/v4/ai/digital-human/set-organizations",
11961
- { setOrganizations: params.items }
12118
+ params.items
11962
12119
  );
11963
12120
  }
11964
12121
  // ============================================
@@ -12006,7 +12163,7 @@ var V4AiService = class {
12006
12163
  }
12007
12164
  const response = await this.client.httpClient.get(
12008
12165
  "/live/v4/ai/video-produce/get",
12009
- { params }
12166
+ { params: { aiPPTVideoId: params.id } }
12010
12167
  );
12011
12168
  return response;
12012
12169
  }
@@ -12070,7 +12227,7 @@ var V4AiService = class {
12070
12227
  }
12071
12228
  await this.client.httpClient.post(
12072
12229
  "/live/v4/ai/video-produce/delete",
12073
- params
12230
+ { aiPPTVideoId: params.id }
12074
12231
  );
12075
12232
  }
12076
12233
  /**
@@ -12295,7 +12452,7 @@ var V4RobotService = class {
12295
12452
  }
12296
12453
  const response = await this.client.httpClient.post(
12297
12454
  "/live/v4/global/robot/save-batch",
12298
- params
12455
+ params.robots
12299
12456
  );
12300
12457
  return response;
12301
12458
  }
@@ -13031,9 +13188,11 @@ var V4ChannelService = class {
13031
13188
  */
13032
13189
  async distributeCreateBatch(params) {
13033
13190
  this.validateChannelId(params.channelId);
13191
+ const { channelId, distributes } = params;
13034
13192
  await this.client.httpClient.post(
13035
13193
  "/live/v4/channel/distribute/create-batch",
13036
- params
13194
+ distributes,
13195
+ { params: { channelId } }
13037
13196
  );
13038
13197
  }
13039
13198
  /**
@@ -13043,9 +13202,11 @@ var V4ChannelService = class {
13043
13202
  */
13044
13203
  async distributeUpdateBatch(params) {
13045
13204
  this.validateChannelId(params.channelId);
13205
+ const { channelId, distributes } = params;
13046
13206
  await this.client.httpClient.post(
13047
13207
  "/live/v4/channel/distribute/update-batch",
13048
- params
13208
+ distributes,
13209
+ { params: { channelId } }
13049
13210
  );
13050
13211
  }
13051
13212
  /**
@@ -13058,7 +13219,7 @@ var V4ChannelService = class {
13058
13219
  await this.client.httpClient.post(
13059
13220
  "/live/v4/channel/distribute/delete-batch",
13060
13221
  null,
13061
- { params: { channelId: params.channelId, ids: params.ids.join(",") } }
13222
+ { params: { channelId: params.channelId, distributeIds: params.ids.join(",") } }
13062
13223
  );
13063
13224
  }
13064
13225
  /**
@@ -13082,10 +13243,11 @@ var V4ChannelService = class {
13082
13243
  */
13083
13244
  async updateMasterSwitch(params) {
13084
13245
  this.validateChannelId(params.channelId);
13246
+ const { channelId, enabled } = params;
13085
13247
  await this.client.httpClient.post(
13086
13248
  "/live/v4/channel/distribute/update-master-switch",
13087
13249
  null,
13088
- { params }
13250
+ { params: { channelId, distributeEnabled: enabled } }
13089
13251
  );
13090
13252
  }
13091
13253
  /**
@@ -13095,10 +13257,11 @@ var V4ChannelService = class {
13095
13257
  */
13096
13258
  async updateSwitch(params) {
13097
13259
  this.validateChannelId(params.channelId);
13260
+ const { channelId, distributeId, enabled } = params;
13098
13261
  await this.client.httpClient.post(
13099
13262
  "/live/v4/channel/distribute/update-switch",
13100
13263
  null,
13101
- { params }
13264
+ { params: { channelId, distributeIds: String(distributeId), distributeEnabled: enabled } }
13102
13265
  );
13103
13266
  }
13104
13267
  // ============================================
@@ -13355,29 +13518,56 @@ var V4ChannelService = class {
13355
13518
  return response;
13356
13519
  }
13357
13520
  /**
13358
- * Save interaction event
13521
+ * Save interaction event (create one or more interaction listener tasks).
13522
+ *
13523
+ * The body carries channelId/tasks/allDone (plus optional callbackUrl/payload);
13524
+ * only appId/timestamp are signed (query), the JSON body is unsigned.
13359
13525
  *
13360
13526
  * @param params - Save parameters
13361
13527
  */
13362
13528
  async interactionEventSave(params) {
13363
13529
  this.validateChannelId(params.channelId);
13364
- await this.client.httpClient.post(
13530
+ if (!Array.isArray(params.tasks) || params.tasks.length === 0) {
13531
+ throw new PolyVValidationError("tasks must be a non-empty array", "tasks");
13532
+ }
13533
+ if (params.allDone !== "Y" && params.allDone !== "N") {
13534
+ throw new PolyVValidationError("allDone must be 'Y' or 'N'", "allDone");
13535
+ }
13536
+ const body = {
13537
+ channelId: Number(params.channelId),
13538
+ tasks: params.tasks,
13539
+ allDone: params.allDone
13540
+ };
13541
+ if (params.callbackUrl !== void 0) body.callbackUrl = params.callbackUrl;
13542
+ if (params.payload !== void 0) body.payload = params.payload;
13543
+ const response = await this.client.httpClient.post(
13365
13544
  "/live/v4/channel/interaction-event/save",
13366
- params
13545
+ body
13367
13546
  );
13547
+ return response;
13368
13548
  }
13369
13549
  /**
13370
- * Delete interaction event
13550
+ * Delete interaction event.
13551
+ *
13552
+ * The body carries channelId + taskIds (pass the activityId when the activity
13553
+ * was saved with allDone=Y); only appId/timestamp are signed (query).
13371
13554
  *
13372
13555
  * @param params - Delete parameters
13373
13556
  */
13374
13557
  async interactionEventDelete(params) {
13375
13558
  this.validateChannelId(params.channelId);
13376
- await this.client.httpClient.post(
13559
+ if (!Array.isArray(params.taskIds) || params.taskIds.length === 0) {
13560
+ throw new PolyVValidationError("taskIds must be a non-empty array", "taskIds");
13561
+ }
13562
+ const body = {
13563
+ channelId: Number(params.channelId),
13564
+ taskIds: params.taskIds
13565
+ };
13566
+ const response = await this.client.httpClient.post(
13377
13567
  "/live/v4/channel/interaction-event/delete",
13378
- null,
13379
- { params }
13568
+ body
13380
13569
  );
13570
+ return response;
13381
13571
  }
13382
13572
  /**
13383
13573
  * Create inviter
@@ -15066,10 +15256,19 @@ var V4ChannelService = class {
15066
15256
  this.validateOptionalYn(params.aiKnowledgeQuizEnabled, "aiKnowledgeQuizEnabled");
15067
15257
  this.validateOptionalYn(params.aiSummaryAuditEnabled, "aiSummaryAuditEnabled");
15068
15258
  this.validateOptionalYn(params.syncToPlaybackDotEnabled, "syncToPlaybackDotEnabled");
15259
+ const body = { fileId: params.fileId };
15260
+ if (params.aiKnowledgeQuizEnabled !== void 0) {
15261
+ body.aiKnowledgeQuizEnabled = params.aiKnowledgeQuizEnabled;
15262
+ }
15263
+ if (params.aiSummaryAuditEnabled !== void 0) {
15264
+ body.aiSummaryAuditEnabled = params.aiSummaryAuditEnabled;
15265
+ }
15266
+ if (params.syncToPlaybackDotEnabled !== void 0) {
15267
+ body.syncToPlaybackDotEnabled = params.syncToPlaybackDotEnabled;
15268
+ }
15069
15269
  const response = await this.client.httpClient.post(
15070
15270
  "/live/v4/channel/record-file/subtitle/outline/create",
15071
- null,
15072
- { params }
15271
+ body
15073
15272
  );
15074
15273
  return response;
15075
15274
  }
@@ -15096,8 +15295,7 @@ var V4ChannelService = class {
15096
15295
  });
15097
15296
  await this.client.httpClient.post(
15098
15297
  "/live/v4/channel/record-file/subtitle/batch-publish",
15099
- null,
15100
- { params }
15298
+ params.subtitles
15101
15299
  );
15102
15300
  }
15103
15301
  /**
@@ -15986,14 +16184,16 @@ var V4UserService = class {
15986
16184
  if (params.childEmail) {
15987
16185
  await this.client.httpClient.post(
15988
16186
  "/live/v4/user/children/delete",
15989
- { childEmail: params.childEmail }
16187
+ void 0,
16188
+ { params: { childEmail: params.childEmail } }
15990
16189
  );
15991
16190
  return;
15992
16191
  }
15993
16192
  if (params.childEmails && params.childEmails.length > 0) {
15994
16193
  await this.client.httpClient.post(
15995
16194
  "/live/v4/user/children/delete",
15996
- { childEmails: params.childEmails }
16195
+ void 0,
16196
+ { params: { childEmails: params.childEmails } }
15997
16197
  );
15998
16198
  return;
15999
16199
  }
@@ -16114,7 +16314,8 @@ var V4UserService = class {
16114
16314
  this.validateRequiredNumber(params.organizationId, "organizationId");
16115
16315
  await this.client.httpClient.post(
16116
16316
  "/live/v4/user/organization/delete",
16117
- params
16317
+ void 0,
16318
+ { params: { organizationId: params.organizationId } }
16118
16319
  );
16119
16320
  }
16120
16321
  // ============================================
@@ -17335,7 +17536,8 @@ var V4UserService = class {
17335
17536
  this.validateYnValue(params.enabled, "enabled");
17336
17537
  await this.client.httpClient.post(
17337
17538
  "/live/v4/user/global-setting/pv-show/update",
17338
- params
17539
+ void 0,
17540
+ { params: { enabled: params.enabled } }
17339
17541
  );
17340
17542
  }
17341
17543
  // ============================================
@@ -17799,14 +18001,16 @@ var V4GlobalService = class {
17799
18001
  * ```
17800
18002
  */
17801
18003
  async updatePageSetting(params) {
17802
- const queryParams = new URLSearchParams();
18004
+ const queryParams = {};
17803
18005
  for (const [key, value] of Object.entries(params)) {
17804
18006
  if (value !== void 0) {
17805
- queryParams.append(key, String(value));
18007
+ queryParams[key] = String(value);
17806
18008
  }
17807
18009
  }
17808
18010
  await this.client.httpClient.post(
17809
- `/live/v4/user/template/page-setting/update?${queryParams.toString()}`
18011
+ "/live/v4/user/template/page-setting/update",
18012
+ void 0,
18013
+ { params: queryParams }
17810
18014
  );
17811
18015
  }
17812
18016
  };
@@ -18689,7 +18893,9 @@ var V4WebAppService = class {
18689
18893
  throw new PolyVValidationError("roleId is required", "roleId");
18690
18894
  }
18691
18895
  await this.client.httpClient.post(
18692
- `/live/v4/user/webapp-role/delete?id=${roleId}`
18896
+ "/live/v4/user/webapp-role/delete",
18897
+ void 0,
18898
+ { params: { id: roleId } }
18693
18899
  );
18694
18900
  }
18695
18901
  };
@@ -19388,7 +19594,7 @@ var PolyVClient = class {
19388
19594
  * Create and configure the Axios HTTP client with interceptors
19389
19595
  */
19390
19596
  createHttpClient() {
19391
- const client = axios__default.default.create({
19597
+ const client = axios2__default.default.create({
19392
19598
  baseURL: this.config.baseUrl,
19393
19599
  timeout: this.config.timeout,
19394
19600
  headers: this.config.headers
@@ -19451,12 +19657,12 @@ var PolyVClient = class {
19451
19657
  * Transform Axios errors to PolyVAPIError
19452
19658
  */
19453
19659
  transformAxiosError(error) {
19454
- if (axios__default.default.isCancel(error)) {
19660
+ if (axios2__default.default.isCancel(error)) {
19455
19661
  return new PolyVAPIError("Request cancelled", 0, {
19456
19662
  code: "REQUEST_CANCELLED"
19457
19663
  });
19458
19664
  }
19459
- if (axios__default.default.isAxiosError(error)) {
19665
+ if (axios2__default.default.isAxiosError(error)) {
19460
19666
  if (error.response) {
19461
19667
  const { status, data } = error.response;
19462
19668
  return new PolyVAPIError(