polyv-live-api-sdk 1.0.18 → 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 (38) hide show
  1. package/dist/index.cjs +427 -157
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +164 -37
  4. package/dist/index.js +427 -157
  5. package/dist/index.js.map +1 -1
  6. package/dist/services/account.service.d.ts +4 -4
  7. package/dist/services/channel.service.d.ts +13 -8
  8. package/dist/services/channel.service.d.ts.map +1 -1
  9. package/dist/services/chat.service.d.ts +1 -1
  10. package/dist/services/chat.service.d.ts.map +1 -1
  11. package/dist/services/live-interaction.service.d.ts.map +1 -1
  12. package/dist/services/player.service.d.ts +1 -1
  13. package/dist/services/player.service.d.ts.map +1 -1
  14. package/dist/services/statistics.service.d.ts.map +1 -1
  15. package/dist/services/v4/ai.service.d.ts.map +1 -1
  16. package/dist/services/v4/channel.service.d.ts +11 -5
  17. package/dist/services/v4/channel.service.d.ts.map +1 -1
  18. package/dist/services/v4/global.service.d.ts.map +1 -1
  19. package/dist/services/v4/robot.service.d.ts.map +1 -1
  20. package/dist/services/v4/user.service.d.ts.map +1 -1
  21. package/dist/services/v4/webapp.service.d.ts.map +1 -1
  22. package/dist/services/web.service.d.ts +1 -1
  23. package/dist/services/web.service.d.ts.map +1 -1
  24. package/dist/types/account.d.ts +2 -1
  25. package/dist/types/account.d.ts.map +1 -1
  26. package/dist/types/channel.d.ts +59 -10
  27. package/dist/types/channel.d.ts.map +1 -1
  28. package/dist/types/chat-censor-role.d.ts +5 -3
  29. package/dist/types/chat-censor-role.d.ts.map +1 -1
  30. package/dist/types/index.d.ts +1 -1
  31. package/dist/types/index.d.ts.map +1 -1
  32. package/dist/types/player.d.ts +4 -2
  33. package/dist/types/player.d.ts.map +1 -1
  34. package/dist/types/v4-channel.d.ts +53 -6
  35. package/dist/types/v4-channel.d.ts.map +1 -1
  36. package/dist/types/web.d.ts +4 -0
  37. package/dist/types/web.d.ts.map +1 -1
  38. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import CryptoJS from 'crypto-js';
2
- import { createHash } from 'crypto';
3
- import axios from 'axios';
2
+ import { createHash, createDecipheriv } from 'crypto';
3
+ import axios2 from 'axios';
4
4
 
5
5
  // src/errors/polyv-error.ts
6
6
  var PolyVError = class _PolyVError extends Error {
@@ -576,6 +576,32 @@ var ChannelService = class {
576
576
  throw PolyVValidationError.required(field);
577
577
  }
578
578
  }
579
+ buildSignedFormBody(params) {
580
+ const timestamp = Date.now();
581
+ const signatureParams = {
582
+ appId: this.client.config.appId,
583
+ timestamp,
584
+ ...params
585
+ };
586
+ const { sign } = generateSignature(signatureParams, {
587
+ appSecret: this.client.config.appSecret
588
+ });
589
+ const form = new URLSearchParams();
590
+ for (const [key, value] of Object.entries({ ...signatureParams, sign })) {
591
+ if (value !== void 0 && value !== null) {
592
+ form.append(key, String(value));
593
+ }
594
+ }
595
+ return form;
596
+ }
597
+ buildSignedFormConfig() {
598
+ return {
599
+ headers: {
600
+ "Content-Type": "application/x-www-form-urlencoded",
601
+ "X-Skip-Auth": "true"
602
+ }
603
+ };
604
+ }
579
605
  validateRequiredText(value, field, maxLength) {
580
606
  if (!value || value.trim() === "") {
581
607
  throw PolyVValidationError.required(field);
@@ -1238,7 +1264,8 @@ var ChannelService = class {
1238
1264
  * Update teacher document relation
1239
1265
  *
1240
1266
  * Adds or removes the binding between a teacher and documents.
1241
- * Note: fileIds is passed in the body, other parameters in query string.
1267
+ * Note: fileIds is passed in the request body as application/x-www-form-urlencoded
1268
+ * (NOT signed), while teacherId/operation are query-string parameters that ARE signed.
1242
1269
  *
1243
1270
  * @param teacherId - The teacher ID
1244
1271
  * @param fileIds - File IDs, comma-separated
@@ -1261,10 +1288,15 @@ var ChannelService = class {
1261
1288
  if (!fileIds || fileIds.trim() === "") {
1262
1289
  throw PolyVValidationError.required("fileIds");
1263
1290
  }
1291
+ const form = new URLSearchParams();
1292
+ form.set("fileIds", fileIds);
1264
1293
  const response = await this.client.httpClient.post(
1265
1294
  "/live/v4/channel/doc/teacher/update-relation",
1266
- { fileIds },
1267
- { params: { teacherId, operation } }
1295
+ form,
1296
+ {
1297
+ params: { teacherId, operation },
1298
+ headers: { "Content-Type": "application/x-www-form-urlencoded" }
1299
+ }
1268
1300
  );
1269
1301
  return response;
1270
1302
  }
@@ -2073,8 +2105,8 @@ var ChannelService = class {
2073
2105
  }
2074
2106
  const response = await this.client.httpClient.post(
2075
2107
  `/live/v2/channel/recordFile/${params.channelId}/convert`,
2076
- null,
2077
- { params: query }
2108
+ this.buildSignedFormBody(query),
2109
+ this.buildSignedFormConfig()
2078
2110
  );
2079
2111
  return response;
2080
2112
  }
@@ -2681,11 +2713,10 @@ var ChannelService = class {
2681
2713
  throw PolyVValidationError.required("fileId");
2682
2714
  }
2683
2715
  const params = { channelId, fileId: options.fileId };
2684
- if (options.startTime !== void 0) {
2685
- params.startTime = options.startTime;
2686
- }
2687
- if (options.endTime !== void 0) {
2688
- params.endTime = options.endTime;
2716
+ if (options.startTime !== void 0 && options.endTime !== void 0) {
2717
+ params.deleteTimeFrame = JSON.stringify([
2718
+ { start: options.startTime, end: options.endTime }
2719
+ ]);
2689
2720
  }
2690
2721
  if (options.fileName !== void 0) {
2691
2722
  params.fileName = options.fileName;
@@ -2713,7 +2744,9 @@ var ChannelService = class {
2713
2744
  * @example
2714
2745
  * ```typescript
2715
2746
  * const result = await channelService.recordConvert('ch123456', {
2716
- * fileId: 'file123',
2747
+ * userId: 'user123',
2748
+ * fileName: 'my-vod',
2749
+ * sessionId: 'fvlyin8qz3',
2717
2750
  * });
2718
2751
  * ```
2719
2752
  */
@@ -2721,37 +2754,62 @@ var ChannelService = class {
2721
2754
  if (!channelId || channelId.trim() === "") {
2722
2755
  throw PolyVValidationError.required("channelId");
2723
2756
  }
2724
- if (!options.fileId || options.fileId.trim() === "") {
2725
- throw PolyVValidationError.required("fileId");
2757
+ if (!options.userId || options.userId.trim() === "") {
2758
+ throw PolyVValidationError.required("userId");
2726
2759
  }
2727
- const params = { channelId, fileId: options.fileId };
2728
- if (options.fileName !== void 0) {
2729
- params.fileName = options.fileName;
2760
+ if (!options.fileName || options.fileName.trim() === "") {
2761
+ throw PolyVValidationError.required("fileName");
2730
2762
  }
2731
- if (options.callbackUrl !== void 0) {
2732
- params.callbackUrl = options.callbackUrl;
2763
+ const hasSessionId = options.sessionId && options.sessionId.trim() !== "";
2764
+ const hasFileUrl = options.fileUrl && options.fileUrl.trim() !== "";
2765
+ if (!hasSessionId && !hasFileUrl) {
2766
+ throw PolyVValidationError.required("sessionId or fileUrl");
2767
+ }
2768
+ const params = {
2769
+ userId: options.userId,
2770
+ fileName: options.fileName
2771
+ };
2772
+ if (options.sessionId) {
2773
+ params.sessionId = options.sessionId;
2774
+ }
2775
+ if (options.fileUrl) {
2776
+ params.fileUrl = options.fileUrl;
2777
+ }
2778
+ if (options.cataid !== void 0) {
2779
+ params.cataid = options.cataid;
2780
+ }
2781
+ if (options.cataname !== void 0) {
2782
+ params.cataname = options.cataname;
2783
+ }
2784
+ if (options.toPlayList !== void 0) {
2785
+ params.toPlayList = options.toPlayList;
2786
+ }
2787
+ if (options.setAsDefault !== void 0) {
2788
+ params.setAsDefault = options.setAsDefault;
2733
2789
  }
2734
2790
  const response = await this.client.httpClient.post(
2735
- "/live/v3/channel/record/convert",
2736
- null,
2737
- { params }
2791
+ `/live/v2/channel/recordFile/${channelId}/convert`,
2792
+ this.buildSignedFormBody(params),
2793
+ this.buildSignedFormConfig()
2738
2794
  );
2739
- return response;
2795
+ const obj = typeof response === "object" && response !== null ? response : void 0;
2796
+ const vid = typeof response === "string" ? response : String(obj?.["vid"] ?? obj?.["fileId"] ?? "");
2797
+ return { vid };
2740
2798
  }
2741
2799
  /**
2742
2800
  * Record convert async
2743
2801
  *
2744
- * Converts a recording file to VOD asynchronously.
2802
+ * Converts recording files to VOD asynchronously.
2745
2803
  *
2746
2804
  * @param channelId - The channel ID
2747
- * @param options - Convert options
2805
+ * @param options - Convert options (requires comma-separated fileIds)
2748
2806
  * @returns true if submitted successfully
2749
2807
  * @throws PolyVValidationError if required parameters are empty
2750
2808
  *
2751
2809
  * @example
2752
2810
  * ```typescript
2753
2811
  * const result = await channelService.recordConvertAsync('ch123456', {
2754
- * fileId: 'file123',
2812
+ * fileIds: 'file1,file2',
2755
2813
  * });
2756
2814
  * ```
2757
2815
  */
@@ -2759,20 +2817,24 @@ var ChannelService = class {
2759
2817
  if (!channelId || channelId.trim() === "") {
2760
2818
  throw PolyVValidationError.required("channelId");
2761
2819
  }
2762
- if (!options.fileId || options.fileId.trim() === "") {
2763
- throw PolyVValidationError.required("fileId");
2820
+ if (!options.fileIds || options.fileIds.trim() === "") {
2821
+ throw PolyVValidationError.required("fileIds");
2764
2822
  }
2765
- const params = { channelId, fileId: options.fileId };
2823
+ const params = { channelId, fileIds: options.fileIds };
2766
2824
  if (options.fileName !== void 0) {
2767
2825
  params.fileName = options.fileName;
2768
2826
  }
2827
+ if (options.cataId !== void 0) {
2828
+ params.cataId = options.cataId;
2829
+ }
2769
2830
  if (options.callbackUrl !== void 0) {
2770
2831
  params.callbackUrl = options.callbackUrl;
2771
2832
  }
2833
+ params.canRepeat = options.canRepeat ?? 1;
2772
2834
  await this.client.httpClient.post(
2773
- "/live/v3/channel/record/convert-async",
2774
- null,
2775
- { params }
2835
+ "/live/v3/channel/record/convert",
2836
+ this.buildSignedFormBody(params),
2837
+ this.buildSignedFormConfig()
2776
2838
  );
2777
2839
  return true;
2778
2840
  }
@@ -2888,12 +2950,16 @@ var ChannelService = class {
2888
2950
  if (!channelId || channelId.trim() === "") {
2889
2951
  throw PolyVValidationError.required("channelId");
2890
2952
  }
2891
- if (!options.fileIds || options.fileIds.length === 0) {
2892
- throw PolyVValidationError.required("fileIds");
2953
+ if (!options.startTime || String(options.startTime).trim() === "") {
2954
+ throw PolyVValidationError.required("startTime");
2955
+ }
2956
+ if (!options.endTime || String(options.endTime).trim() === "") {
2957
+ throw PolyVValidationError.required("endTime");
2893
2958
  }
2894
2959
  const params = {
2895
2960
  channelId,
2896
- fileIds: options.fileIds.join(",")
2961
+ startTime: options.startTime,
2962
+ endTime: options.endTime
2897
2963
  };
2898
2964
  if (options.fileName !== void 0) {
2899
2965
  params.fileName = options.fileName;
@@ -2929,12 +2995,16 @@ var ChannelService = class {
2929
2995
  if (!channelId || channelId.trim() === "") {
2930
2996
  throw PolyVValidationError.required("channelId");
2931
2997
  }
2932
- if (!options.fileIds || options.fileIds.length === 0) {
2933
- throw PolyVValidationError.required("fileIds");
2998
+ if (!options.startTime || String(options.startTime).trim() === "") {
2999
+ throw PolyVValidationError.required("startTime");
3000
+ }
3001
+ if (!options.endTime || String(options.endTime).trim() === "") {
3002
+ throw PolyVValidationError.required("endTime");
2934
3003
  }
2935
3004
  const params = {
2936
3005
  channelId,
2937
- fileIds: options.fileIds.join(",")
3006
+ startTime: options.startTime,
3007
+ endTime: options.endTime
2938
3008
  };
2939
3009
  if (options.fileName !== void 0) {
2940
3010
  params.fileName = options.fileName;
@@ -2971,13 +3041,17 @@ var ChannelService = class {
2971
3041
  if (!channelId || channelId.trim() === "") {
2972
3042
  throw PolyVValidationError.required("channelId");
2973
3043
  }
2974
- if (!options.fileId || options.fileId.trim() === "") {
2975
- throw PolyVValidationError.required("fileId");
3044
+ if (!options.type || options.type.trim() === "") {
3045
+ throw PolyVValidationError.required("type");
3046
+ }
3047
+ const params = { channelId, type: options.type };
3048
+ if (options.fromStartStop !== void 0) {
3049
+ params.fromStartStop = options.fromStartStop;
2976
3050
  }
2977
3051
  await this.client.httpClient.post(
2978
3052
  "/live/v3/channel/record/add-breakpoint",
2979
3053
  null,
2980
- { params: { channelId, fileId: options.fileId, time: options.time } }
3054
+ { params }
2981
3055
  );
2982
3056
  return true;
2983
3057
  }
@@ -5952,8 +6026,25 @@ var ChannelService = class {
5952
6026
  return response;
5953
6027
  }
5954
6028
  };
5955
-
5956
- // src/services/chat.service.ts
6029
+ var APICHAT_USERLIST_SIGN_SECRET = "polyvChatSignForExternal";
6030
+ function buildChatUserListSign(params) {
6031
+ let content = APICHAT_USERLIST_SIGN_SECRET;
6032
+ for (const key of Object.keys(params).sort()) {
6033
+ content += key + params[key];
6034
+ }
6035
+ content += APICHAT_USERLIST_SIGN_SECRET;
6036
+ return createHash("md5").update(content, "utf8").digest("hex").toUpperCase();
6037
+ }
6038
+ function decryptChatUserList(encryptedHex, sign) {
6039
+ const key = Buffer.from(sign.slice(0, 16), "utf8");
6040
+ const decipher = createDecipheriv("aes-128-cbc", key, key);
6041
+ const decrypted = Buffer.concat([
6042
+ decipher.update(Buffer.from(encryptedHex, "hex")),
6043
+ decipher.final()
6044
+ ]);
6045
+ const json = Buffer.from(decrypted.toString("utf8"), "base64").toString("utf8");
6046
+ return JSON.parse(json);
6047
+ }
5957
6048
  var ChatService = class {
5958
6049
  client;
5959
6050
  /**
@@ -6049,9 +6140,17 @@ var ChatService = class {
6049
6140
  * ```
6050
6141
  */
6051
6142
  async sendChat(params) {
6143
+ const encodedContent = typeof params.content === "string" ? Buffer.from(params.content, "utf8").toString("base64url") : params.content;
6052
6144
  const response = await this.client.httpClient.post(
6053
6145
  `/live/v1/channelSetting/${params.channelId}/send-chat`,
6054
- { userId: params.userId, content: params.content, imgUrl: params.imgUrl }
6146
+ null,
6147
+ {
6148
+ params: {
6149
+ userId: params.userId,
6150
+ content: encodedContent,
6151
+ imgUrl: params.imgUrl
6152
+ }
6153
+ }
6055
6154
  );
6056
6155
  return response;
6057
6156
  }
@@ -6343,11 +6442,27 @@ var ChatService = class {
6343
6442
  if (params.len !== void 0 && (params.len < 1 || params.len > 1e3)) {
6344
6443
  throw new PolyVValidationError("len must be between 1 and 1000");
6345
6444
  }
6346
- const response = await this.client.httpClient.get(
6445
+ const query = {
6446
+ roomId: params.roomId,
6447
+ page: String(params.page ?? 1),
6448
+ len: String(params.len ?? 100),
6449
+ hide: "0",
6450
+ toGetSubRooms: String(params.toGetSubRooms ?? false)
6451
+ };
6452
+ const sign = buildChatUserListSign(query);
6453
+ const response = await axios2.get(
6347
6454
  "https://apichat.polyv.net/front/userlistExternal",
6348
- { params }
6455
+ {
6456
+ params: { ...query, sign },
6457
+ responseType: "text",
6458
+ transformResponse: [(data) => data]
6459
+ }
6349
6460
  );
6350
- return response;
6461
+ const body = typeof response.data === "string" ? response.data.trim() : "";
6462
+ if (!body) {
6463
+ return { count: 0, userlist: [] };
6464
+ }
6465
+ return decryptChatUserList(body, sign);
6351
6466
  }
6352
6467
  /**
6353
6468
  * updateAdminInfo - 更新管理员信息
@@ -6362,7 +6477,7 @@ var ChatService = class {
6362
6477
  * channelId: '123456',
6363
6478
  * nickname: '管理员',
6364
6479
  * actor: '管理员1',
6365
- * avatar: imageBuffer,
6480
+ * avatar: avatarFile,
6366
6481
  * });
6367
6482
  * console.log(result.data);
6368
6483
  * ```
@@ -6377,16 +6492,39 @@ var ChatService = class {
6377
6492
  if (!params.actor) {
6378
6493
  throw new PolyVValidationError("actor is required");
6379
6494
  }
6380
- const requestBody = {
6381
- nickname: params.nickname,
6382
- actor: params.actor
6383
- };
6384
- if (params.avatar) {
6385
- requestBody.avatar = params.avatar;
6495
+ if (!params.avatar) {
6496
+ throw new PolyVValidationError("avatar is required");
6497
+ }
6498
+ const timestamp = Date.now();
6499
+ const { sign } = generateSignature(
6500
+ {
6501
+ appId: this.client.config.appId,
6502
+ timestamp,
6503
+ nickname: params.nickname,
6504
+ actor: params.actor
6505
+ },
6506
+ { appSecret: this.client.config.appSecret }
6507
+ );
6508
+ const formData = new FormData();
6509
+ formData.append("appId", this.client.config.appId);
6510
+ formData.append("timestamp", String(timestamp));
6511
+ formData.append("sign", sign);
6512
+ formData.append("nickname", params.nickname);
6513
+ formData.append("actor", params.actor);
6514
+ if (params.avatar instanceof Blob) {
6515
+ formData.append("avatar", params.avatar, params.avatar.name || "avatar.png");
6516
+ } else {
6517
+ formData.append("avatar", new Blob([params.avatar]), "avatar.png");
6386
6518
  }
6387
6519
  const response = await this.client.httpClient.post(
6388
6520
  `/live/v2/channelSetting/${params.channelId}/set-chat-admin`,
6389
- requestBody
6521
+ formData,
6522
+ {
6523
+ headers: {
6524
+ "Content-Type": "multipart/form-data",
6525
+ "X-Skip-Auth": "true"
6526
+ }
6527
+ }
6390
6528
  );
6391
6529
  return response;
6392
6530
  }
@@ -7312,10 +7450,19 @@ var LiveInteractionService = class {
7312
7450
  this.validateRequiredString(params.lotteryId, "lotteryId");
7313
7451
  this.validateRequiredString(params.winnerCode, "winnerCode");
7314
7452
  this.validateRequiredString(params.viewerId, "viewerId");
7453
+ const body = {
7454
+ channelId: params.channelId,
7455
+ lotteryId: params.lotteryId,
7456
+ winnerCode: params.winnerCode,
7457
+ viewerId: params.viewerId
7458
+ };
7459
+ if (params.receiveInfo !== void 0) {
7460
+ body.receiveInfo = JSON.stringify(params.receiveInfo);
7461
+ }
7315
7462
  const response = await this.client.httpClient.post(
7316
7463
  "/live/v4/channel/lottery/add-receive-info",
7317
- null,
7318
- { params: this.compactParams(params) }
7464
+ body,
7465
+ { params: this.compactParams({ channelId: params.channelId }) }
7319
7466
  );
7320
7467
  return response;
7321
7468
  }
@@ -7586,26 +7733,26 @@ var AccountService = class {
7586
7733
  return { success: response };
7587
7734
  }
7588
7735
  /**
7589
- * Update category rank (sort order)
7590
- *
7591
- * @param params - Update parameters
7592
- * @returns Update result
7593
- *
7594
- * @example
7595
- * ```typescript
7596
- * const result = await client.account.updateCategoryRank({
7597
- * categoryId: 12345,
7598
- * rank: 1,
7599
- * });
7600
- * console.log(result.success);
7601
- * ```
7602
- */
7736
+ * Update category rank (sort order)
7737
+ *
7738
+ * @param params - Update parameters
7739
+ * @returns Update result
7740
+ *
7741
+ * @example
7742
+ * ```typescript
7743
+ * const result = await client.account.updateCategoryRank({
7744
+ * categoryId: 12345,
7745
+ * afterCategoryId: 67890,
7746
+ * });
7747
+ * console.log(result.success);
7748
+ * ```
7749
+ */
7603
7750
  async updateCategoryRank(params) {
7604
7751
  if (!params.categoryId || params.categoryId <= 0) {
7605
7752
  throw new PolyVValidationError("categoryId must be a positive number");
7606
7753
  }
7607
- if (params.rank === void 0 || params.rank === null) {
7608
- throw new PolyVValidationError("rank is required");
7754
+ if (params.afterCategoryId === void 0 || params.afterCategoryId === null) {
7755
+ throw new PolyVValidationError("afterCategoryId is required");
7609
7756
  }
7610
7757
  const response = await this.client.httpClient.post(
7611
7758
  "/live/v3/user/category/update-rank",
@@ -8273,10 +8420,29 @@ var WebService = class {
8273
8420
  if (!params.imgfile) {
8274
8421
  throw new PolyVValidationError("imgfile is required");
8275
8422
  }
8423
+ const timestamp = Date.now();
8424
+ const { sign } = generateSignature(
8425
+ { appId: this.client.config.appId, timestamp },
8426
+ { appSecret: this.client.config.appSecret }
8427
+ );
8428
+ const formData = new FormData();
8429
+ formData.append("appId", this.client.config.appId);
8430
+ formData.append("timestamp", String(timestamp));
8431
+ formData.append("sign", sign);
8432
+ if (params.imgfile instanceof Blob) {
8433
+ formData.append("imgfile", params.imgfile, params.imgfile.name || "logo.png");
8434
+ } else {
8435
+ formData.append("imgfile", params.imgfile);
8436
+ }
8276
8437
  const response = await this.client.httpClient.post(
8277
8438
  `/live/v2/channelSetting/${params.channelId}/setCoverImg`,
8278
- null,
8279
- { params: { imgfile: params.imgfile } }
8439
+ formData,
8440
+ {
8441
+ headers: {
8442
+ "Content-Type": "multipart/form-data",
8443
+ "X-Skip-Auth": "true"
8444
+ }
8445
+ }
8280
8446
  );
8281
8447
  return response;
8282
8448
  }
@@ -8826,18 +8992,20 @@ var WebService = class {
8826
8992
  if (params.enabled !== void 0 && !["Y", "N"].includes(params.enabled)) {
8827
8993
  throw new PolyVValidationError("enabled must be Y or N");
8828
8994
  }
8995
+ const apiParams = {};
8996
+ if (params.channelId) {
8997
+ apiParams.channelId = params.channelId;
8998
+ }
8829
8999
  const body = {
8830
9000
  goods: params.goods
8831
9001
  };
8832
- if (params.channelId) {
8833
- body.channelId = params.channelId;
8834
- }
8835
9002
  if (params.enabled) {
8836
9003
  body.enabled = params.enabled;
8837
9004
  }
8838
9005
  const response = await this.client.httpClient.post(
8839
9006
  "/live/v3/channel/donate/update-good",
8840
- body
9007
+ body,
9008
+ { params: apiParams }
8841
9009
  );
8842
9010
  return response;
8843
9011
  }
@@ -8978,15 +9146,32 @@ var WebService = class {
8978
9146
  if (params.files.length > 6) {
8979
9147
  throw new PolyVValidationError("files must contain 1-6 files");
8980
9148
  }
9149
+ const timestamp = Date.now();
9150
+ const { sign } = generateSignature(
9151
+ { appId: this.client.config.appId, timestamp, type: params.type },
9152
+ { appSecret: this.client.config.appSecret }
9153
+ );
8981
9154
  const formData = new FormData();
9155
+ formData.append("appId", this.client.config.appId);
9156
+ formData.append("timestamp", String(timestamp));
9157
+ formData.append("sign", sign);
8982
9158
  formData.append("type", params.type);
8983
9159
  for (const file of params.files) {
8984
- formData.append("files", file);
9160
+ if (file instanceof Blob) {
9161
+ formData.append("file", file, file.name || "image.png");
9162
+ } else {
9163
+ formData.append("file", file);
9164
+ }
8985
9165
  }
8986
9166
  const response = await this.client.httpClient.post(
8987
9167
  "/live/v3/common/upload-image",
8988
9168
  formData,
8989
- { headers: { "Content-Type": "multipart/form-data" } }
9169
+ {
9170
+ headers: {
9171
+ "Content-Type": "multipart/form-data",
9172
+ "X-Skip-Auth": "true"
9173
+ }
9174
+ }
8990
9175
  );
8991
9176
  return response;
8992
9177
  }
@@ -9314,16 +9499,38 @@ var WebService = class {
9314
9499
  if (!params.file) {
9315
9500
  throw new PolyVValidationError("file is required");
9316
9501
  }
9502
+ const timestamp = Date.now();
9503
+ const signParams = {
9504
+ appId: this.client.config.appId,
9505
+ timestamp,
9506
+ rank: params.rank
9507
+ };
9508
+ if (params.channelId) {
9509
+ signParams.channelId = params.channelId;
9510
+ }
9511
+ const { sign } = generateSignature(signParams, { appSecret: this.client.config.appSecret });
9317
9512
  const formData = new FormData();
9513
+ formData.append("appId", this.client.config.appId);
9514
+ formData.append("timestamp", String(timestamp));
9515
+ formData.append("sign", sign);
9318
9516
  formData.append("rank", params.rank.toString());
9319
- formData.append("file", params.file);
9320
9517
  if (params.channelId) {
9321
9518
  formData.append("channelId", params.channelId);
9322
9519
  }
9520
+ if (params.file instanceof Blob) {
9521
+ formData.append("file", params.file, params.file.name || "whitelist.xls");
9522
+ } else {
9523
+ formData.append("file", params.file);
9524
+ }
9323
9525
  const response = await this.client.httpClient.post(
9324
9526
  "/live/v3/channel/auth/upload-white-list",
9325
9527
  formData,
9326
- { headers: { "Content-Type": "multipart/form-data" } }
9528
+ {
9529
+ headers: {
9530
+ "Content-Type": "multipart/form-data",
9531
+ "X-Skip-Auth": "true"
9532
+ }
9533
+ }
9327
9534
  );
9328
9535
  return response;
9329
9536
  }
@@ -9480,15 +9687,19 @@ var WebService = class {
9480
9687
  *
9481
9688
  * @example
9482
9689
  * ```typescript
9483
- * const result = await client.web.getRecordField({ channelId: '123456' });
9690
+ * const result = await client.web.getRecordField({ channelId: '123456', rank: 1 });
9484
9691
  * console.log(result.infoFields);
9485
9692
  * ```
9486
9693
  */
9487
9694
  async getRecordField(params) {
9488
9695
  this.validateChannelId(params.channelId);
9696
+ const rank = params.rank ?? 1;
9697
+ if (rank !== 1 && rank !== 2) {
9698
+ throw new PolyVValidationError("rank must be 1 (primary) or 2 (secondary)");
9699
+ }
9489
9700
  const response = await this.client.httpClient.get(
9490
9701
  "/live/v3/channel/auth/get-record-field",
9491
- { params: { channelId: params.channelId } }
9702
+ { params: { channelId: params.channelId, rank } }
9492
9703
  );
9493
9704
  return response;
9494
9705
  }
@@ -9561,9 +9772,13 @@ var WebService = class {
9561
9772
  */
9562
9773
  async downloadRecordInfo(params) {
9563
9774
  this.validateChannelId(params.channelId);
9775
+ const rank = params.rank ?? 1;
9776
+ if (rank !== 1 && rank !== 2) {
9777
+ throw new PolyVValidationError("rank must be 1 (primary) or 2 (secondary)");
9778
+ }
9564
9779
  const response = await this.client.httpClient.get(
9565
9780
  "/live/v3/channel/auth/download-record-info",
9566
- { params: { channelId: params.channelId }, responseType: "arraybuffer" }
9781
+ { params: { channelId: params.channelId, rank }, responseType: "arraybuffer" }
9567
9782
  );
9568
9783
  return response;
9569
9784
  }
@@ -10927,15 +11142,15 @@ var PlayerService = class {
10927
11142
  if (params.marqueeRestrict === "Y" && !params.url) {
10928
11143
  throw new PolyVValidationError('url is required when marqueeRestrict is "Y"');
10929
11144
  }
10930
- const body = {
11145
+ const queryParams = {
10931
11146
  marqueeRestrict: params.marqueeRestrict
10932
11147
  };
10933
11148
  if (params.url !== void 0) {
10934
- body.url = params.url;
11149
+ queryParams.url = params.url;
10935
11150
  }
10936
- const response = await this.client.httpClient.post(
11151
+ const response = await this.client.httpClient.get(
10937
11152
  `/live/v2/channelRestrict/${channelId}/set-diyurl-marquee`,
10938
- body
11153
+ { params: queryParams }
10939
11154
  );
10940
11155
  return response;
10941
11156
  }
@@ -10954,7 +11169,7 @@ var PlayerService = class {
10954
11169
  * ```typescript
10955
11170
  * await client.player.updateHeadAdvert(123456, {
10956
11171
  * headAdvertType: 'IMAGE',
10957
- * headAdvertImage: 'https://example.com/ad.jpg',
11172
+ * headAdvertMediaUrl: 'https://example.com/ad.jpg',
10958
11173
  * });
10959
11174
  * ```
10960
11175
  */
@@ -10964,33 +11179,32 @@ var PlayerService = class {
10964
11179
  if (params.enabled !== void 0) {
10965
11180
  this.validateYNValue(params.enabled, "enabled");
10966
11181
  }
10967
- const body = {
10968
- headAdvertType: params.headAdvertType
11182
+ const requestParams = {
11183
+ headAdvertType: String(params.headAdvertType).toLowerCase()
10969
11184
  };
10970
- if (params.headAdvertImage !== void 0) {
10971
- body.headAdvertImage = params.headAdvertImage;
10972
- }
10973
- if (params.headAdvertFlv !== void 0) {
10974
- body.headAdvertFlv = params.headAdvertFlv;
11185
+ const mediaUrl = params.headAdvertMediaUrl ?? params.headAdvertImage ?? params.headAdvertFlv;
11186
+ if (mediaUrl !== void 0) {
11187
+ requestParams.headAdvertMediaUrl = mediaUrl;
10975
11188
  }
10976
11189
  if (params.headAdvertHref !== void 0) {
10977
- body.headAdvertHref = params.headAdvertHref;
11190
+ requestParams.headAdvertHref = params.headAdvertHref;
10978
11191
  }
10979
11192
  if (params.headAdvertDuration !== void 0) {
10980
- body.headAdvertDuration = params.headAdvertDuration;
11193
+ requestParams.headAdvertDuration = params.headAdvertDuration;
10981
11194
  }
10982
11195
  if (params.headAdvertWidth !== void 0) {
10983
- body.headAdvertWidth = params.headAdvertWidth;
11196
+ requestParams.headAdvertWidth = params.headAdvertWidth;
10984
11197
  }
10985
11198
  if (params.headAdvertHeight !== void 0) {
10986
- body.headAdvertHeight = params.headAdvertHeight;
11199
+ requestParams.headAdvertHeight = params.headAdvertHeight;
10987
11200
  }
10988
11201
  if (params.enabled !== void 0) {
10989
- body.enabled = params.enabled;
11202
+ requestParams.enabled = params.enabled;
10990
11203
  }
10991
11204
  const response = await this.client.httpClient.post(
10992
11205
  `/live/v2/channelAdvert/${channelId}/updateHead`,
10993
- body
11206
+ null,
11207
+ { params: requestParams }
10994
11208
  );
10995
11209
  return response;
10996
11210
  }
@@ -11894,7 +12108,7 @@ var V4AiService = class {
11894
12108
  }
11895
12109
  await this.client.httpClient.post(
11896
12110
  "/live/v4/ai/digital-human/set-organizations",
11897
- params
12111
+ params.items
11898
12112
  );
11899
12113
  }
11900
12114
  // ============================================
@@ -11942,7 +12156,7 @@ var V4AiService = class {
11942
12156
  }
11943
12157
  const response = await this.client.httpClient.get(
11944
12158
  "/live/v4/ai/video-produce/get",
11945
- { params }
12159
+ { params: { aiPPTVideoId: params.id } }
11946
12160
  );
11947
12161
  return response;
11948
12162
  }
@@ -12006,7 +12220,7 @@ var V4AiService = class {
12006
12220
  }
12007
12221
  await this.client.httpClient.post(
12008
12222
  "/live/v4/ai/video-produce/delete",
12009
- params
12223
+ { aiPPTVideoId: params.id }
12010
12224
  );
12011
12225
  }
12012
12226
  /**
@@ -12231,7 +12445,7 @@ var V4RobotService = class {
12231
12445
  }
12232
12446
  const response = await this.client.httpClient.post(
12233
12447
  "/live/v4/global/robot/save-batch",
12234
- params
12448
+ params.robots
12235
12449
  );
12236
12450
  return response;
12237
12451
  }
@@ -12967,9 +13181,11 @@ var V4ChannelService = class {
12967
13181
  */
12968
13182
  async distributeCreateBatch(params) {
12969
13183
  this.validateChannelId(params.channelId);
13184
+ const { channelId, distributes } = params;
12970
13185
  await this.client.httpClient.post(
12971
13186
  "/live/v4/channel/distribute/create-batch",
12972
- params
13187
+ distributes,
13188
+ { params: { channelId } }
12973
13189
  );
12974
13190
  }
12975
13191
  /**
@@ -12979,9 +13195,11 @@ var V4ChannelService = class {
12979
13195
  */
12980
13196
  async distributeUpdateBatch(params) {
12981
13197
  this.validateChannelId(params.channelId);
13198
+ const { channelId, distributes } = params;
12982
13199
  await this.client.httpClient.post(
12983
13200
  "/live/v4/channel/distribute/update-batch",
12984
- params
13201
+ distributes,
13202
+ { params: { channelId } }
12985
13203
  );
12986
13204
  }
12987
13205
  /**
@@ -12994,7 +13212,7 @@ var V4ChannelService = class {
12994
13212
  await this.client.httpClient.post(
12995
13213
  "/live/v4/channel/distribute/delete-batch",
12996
13214
  null,
12997
- { params: { channelId: params.channelId, ids: params.ids.join(",") } }
13215
+ { params: { channelId: params.channelId, distributeIds: params.ids.join(",") } }
12998
13216
  );
12999
13217
  }
13000
13218
  /**
@@ -13018,10 +13236,11 @@ var V4ChannelService = class {
13018
13236
  */
13019
13237
  async updateMasterSwitch(params) {
13020
13238
  this.validateChannelId(params.channelId);
13239
+ const { channelId, enabled } = params;
13021
13240
  await this.client.httpClient.post(
13022
13241
  "/live/v4/channel/distribute/update-master-switch",
13023
13242
  null,
13024
- { params }
13243
+ { params: { channelId, distributeEnabled: enabled } }
13025
13244
  );
13026
13245
  }
13027
13246
  /**
@@ -13031,10 +13250,11 @@ var V4ChannelService = class {
13031
13250
  */
13032
13251
  async updateSwitch(params) {
13033
13252
  this.validateChannelId(params.channelId);
13253
+ const { channelId, distributeId, enabled } = params;
13034
13254
  await this.client.httpClient.post(
13035
13255
  "/live/v4/channel/distribute/update-switch",
13036
13256
  null,
13037
- { params }
13257
+ { params: { channelId, distributeIds: String(distributeId), distributeEnabled: enabled } }
13038
13258
  );
13039
13259
  }
13040
13260
  // ============================================
@@ -13291,29 +13511,56 @@ var V4ChannelService = class {
13291
13511
  return response;
13292
13512
  }
13293
13513
  /**
13294
- * Save interaction event
13514
+ * Save interaction event (create one or more interaction listener tasks).
13515
+ *
13516
+ * The body carries channelId/tasks/allDone (plus optional callbackUrl/payload);
13517
+ * only appId/timestamp are signed (query), the JSON body is unsigned.
13295
13518
  *
13296
13519
  * @param params - Save parameters
13297
13520
  */
13298
13521
  async interactionEventSave(params) {
13299
13522
  this.validateChannelId(params.channelId);
13300
- await this.client.httpClient.post(
13523
+ if (!Array.isArray(params.tasks) || params.tasks.length === 0) {
13524
+ throw new PolyVValidationError("tasks must be a non-empty array", "tasks");
13525
+ }
13526
+ if (params.allDone !== "Y" && params.allDone !== "N") {
13527
+ throw new PolyVValidationError("allDone must be 'Y' or 'N'", "allDone");
13528
+ }
13529
+ const body = {
13530
+ channelId: Number(params.channelId),
13531
+ tasks: params.tasks,
13532
+ allDone: params.allDone
13533
+ };
13534
+ if (params.callbackUrl !== void 0) body.callbackUrl = params.callbackUrl;
13535
+ if (params.payload !== void 0) body.payload = params.payload;
13536
+ const response = await this.client.httpClient.post(
13301
13537
  "/live/v4/channel/interaction-event/save",
13302
- params
13538
+ body
13303
13539
  );
13540
+ return response;
13304
13541
  }
13305
13542
  /**
13306
- * Delete interaction event
13543
+ * Delete interaction event.
13544
+ *
13545
+ * The body carries channelId + taskIds (pass the activityId when the activity
13546
+ * was saved with allDone=Y); only appId/timestamp are signed (query).
13307
13547
  *
13308
13548
  * @param params - Delete parameters
13309
13549
  */
13310
13550
  async interactionEventDelete(params) {
13311
13551
  this.validateChannelId(params.channelId);
13312
- await this.client.httpClient.post(
13552
+ if (!Array.isArray(params.taskIds) || params.taskIds.length === 0) {
13553
+ throw new PolyVValidationError("taskIds must be a non-empty array", "taskIds");
13554
+ }
13555
+ const body = {
13556
+ channelId: Number(params.channelId),
13557
+ taskIds: params.taskIds
13558
+ };
13559
+ const response = await this.client.httpClient.post(
13313
13560
  "/live/v4/channel/interaction-event/delete",
13314
- null,
13315
- { params }
13561
+ body
13316
13562
  );
13563
+ return response;
13317
13564
  }
13318
13565
  /**
13319
13566
  * Create inviter
@@ -13937,7 +14184,8 @@ var V4ChannelService = class {
13937
14184
  this.validateChannelId(params.channelId);
13938
14185
  await this.client.httpClient.post(
13939
14186
  "/live/v4/channel/role-config/update-by-role",
13940
- params
14187
+ params.config,
14188
+ { params: { channelId: params.channelId, role: params.role } }
13941
14189
  );
13942
14190
  }
13943
14191
  /**
@@ -15001,10 +15249,19 @@ var V4ChannelService = class {
15001
15249
  this.validateOptionalYn(params.aiKnowledgeQuizEnabled, "aiKnowledgeQuizEnabled");
15002
15250
  this.validateOptionalYn(params.aiSummaryAuditEnabled, "aiSummaryAuditEnabled");
15003
15251
  this.validateOptionalYn(params.syncToPlaybackDotEnabled, "syncToPlaybackDotEnabled");
15252
+ const body = { fileId: params.fileId };
15253
+ if (params.aiKnowledgeQuizEnabled !== void 0) {
15254
+ body.aiKnowledgeQuizEnabled = params.aiKnowledgeQuizEnabled;
15255
+ }
15256
+ if (params.aiSummaryAuditEnabled !== void 0) {
15257
+ body.aiSummaryAuditEnabled = params.aiSummaryAuditEnabled;
15258
+ }
15259
+ if (params.syncToPlaybackDotEnabled !== void 0) {
15260
+ body.syncToPlaybackDotEnabled = params.syncToPlaybackDotEnabled;
15261
+ }
15004
15262
  const response = await this.client.httpClient.post(
15005
15263
  "/live/v4/channel/record-file/subtitle/outline/create",
15006
- null,
15007
- { params }
15264
+ body
15008
15265
  );
15009
15266
  return response;
15010
15267
  }
@@ -15031,8 +15288,7 @@ var V4ChannelService = class {
15031
15288
  });
15032
15289
  await this.client.httpClient.post(
15033
15290
  "/live/v4/channel/record-file/subtitle/batch-publish",
15034
- null,
15035
- { params }
15291
+ params.subtitles
15036
15292
  );
15037
15293
  }
15038
15294
  /**
@@ -15921,14 +16177,16 @@ var V4UserService = class {
15921
16177
  if (params.childEmail) {
15922
16178
  await this.client.httpClient.post(
15923
16179
  "/live/v4/user/children/delete",
15924
- { childEmail: params.childEmail }
16180
+ void 0,
16181
+ { params: { childEmail: params.childEmail } }
15925
16182
  );
15926
16183
  return;
15927
16184
  }
15928
16185
  if (params.childEmails && params.childEmails.length > 0) {
15929
16186
  await this.client.httpClient.post(
15930
16187
  "/live/v4/user/children/delete",
15931
- { childEmails: params.childEmails }
16188
+ void 0,
16189
+ { params: { childEmails: params.childEmails } }
15932
16190
  );
15933
16191
  return;
15934
16192
  }
@@ -16049,7 +16307,8 @@ var V4UserService = class {
16049
16307
  this.validateRequiredNumber(params.organizationId, "organizationId");
16050
16308
  await this.client.httpClient.post(
16051
16309
  "/live/v4/user/organization/delete",
16052
- params
16310
+ void 0,
16311
+ { params: { organizationId: params.organizationId } }
16053
16312
  );
16054
16313
  }
16055
16314
  // ============================================
@@ -17270,7 +17529,8 @@ var V4UserService = class {
17270
17529
  this.validateYnValue(params.enabled, "enabled");
17271
17530
  await this.client.httpClient.post(
17272
17531
  "/live/v4/user/global-setting/pv-show/update",
17273
- params
17532
+ void 0,
17533
+ { params: { enabled: params.enabled } }
17274
17534
  );
17275
17535
  }
17276
17536
  // ============================================
@@ -17734,14 +17994,16 @@ var V4GlobalService = class {
17734
17994
  * ```
17735
17995
  */
17736
17996
  async updatePageSetting(params) {
17737
- const queryParams = new URLSearchParams();
17997
+ const queryParams = {};
17738
17998
  for (const [key, value] of Object.entries(params)) {
17739
17999
  if (value !== void 0) {
17740
- queryParams.append(key, String(value));
18000
+ queryParams[key] = String(value);
17741
18001
  }
17742
18002
  }
17743
18003
  await this.client.httpClient.post(
17744
- `/live/v4/user/template/page-setting/update?${queryParams.toString()}`
18004
+ "/live/v4/user/template/page-setting/update",
18005
+ void 0,
18006
+ { params: queryParams }
17745
18007
  );
17746
18008
  }
17747
18009
  };
@@ -18624,7 +18886,9 @@ var V4WebAppService = class {
18624
18886
  throw new PolyVValidationError("roleId is required", "roleId");
18625
18887
  }
18626
18888
  await this.client.httpClient.post(
18627
- `/live/v4/user/webapp-role/delete?id=${roleId}`
18889
+ "/live/v4/user/webapp-role/delete",
18890
+ void 0,
18891
+ { params: { id: roleId } }
18628
18892
  );
18629
18893
  }
18630
18894
  };
@@ -19116,31 +19380,37 @@ var StatisticsService = class {
19116
19380
  "/live/v3/channel/session/stats/export",
19117
19381
  { params }
19118
19382
  );
19119
- if (response && typeof response === "object" && "data" in response) {
19120
- const responseData = response;
19121
- if (responseData.data && typeof responseData.data === "object") {
19122
- const innerData = responseData.data;
19123
- if (innerData.code && innerData.code !== 200) {
19124
- throw new Error(innerData.message || "API Error");
19125
- }
19126
- if ("downloadUrl" in innerData) {
19127
- return innerData;
19128
- }
19129
- if (typeof innerData.data === "string" && innerData.data) {
19130
- return { downloadUrl: innerData.data };
19131
- }
19383
+ if (typeof response === "string") {
19384
+ if (response.trim() === "") {
19385
+ throw new Error("\u573A\u6B21\u62A5\u8868\u5BFC\u51FA\u5931\u8D25\uFF1A\u62A5\u8868\u5C1A\u672A\u751F\u6210\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5");
19132
19386
  }
19387
+ return { downloadUrl: response };
19133
19388
  }
19134
- if (response && typeof response === "object" && "code" in response) {
19135
- const apiResponse = response;
19136
- if (apiResponse.code && apiResponse.code !== 200) {
19137
- throw new Error(String(apiResponse.message || "API Error"));
19389
+ if (response && typeof response === "object") {
19390
+ const obj = response;
19391
+ if (typeof obj["downloadUrl"] === "string" && obj["downloadUrl"]) {
19392
+ return { downloadUrl: obj["downloadUrl"] };
19393
+ }
19394
+ if (obj["code"] !== void 0 && obj["code"] !== 200) {
19395
+ throw new Error(String(obj["message"] || "\u573A\u6B21\u62A5\u8868\u5BFC\u51FA\u5931\u8D25"));
19396
+ }
19397
+ if (typeof obj["data"] === "string" && obj["data"]) {
19398
+ return { downloadUrl: obj["data"] };
19138
19399
  }
19139
- if (typeof apiResponse.data === "string" && apiResponse.data) {
19140
- return { downloadUrl: apiResponse.data };
19400
+ const inner = obj["data"];
19401
+ if (inner && typeof inner === "object") {
19402
+ if (inner["code"] !== void 0 && inner["code"] !== 200) {
19403
+ throw new Error(String(inner["message"] || "\u573A\u6B21\u62A5\u8868\u5BFC\u51FA\u5931\u8D25"));
19404
+ }
19405
+ if (typeof inner["downloadUrl"] === "string" && inner["downloadUrl"]) {
19406
+ return { downloadUrl: inner["downloadUrl"] };
19407
+ }
19408
+ if (typeof inner["data"] === "string" && inner["data"]) {
19409
+ return { downloadUrl: inner["data"] };
19410
+ }
19141
19411
  }
19142
19412
  }
19143
- return response;
19413
+ throw new Error("\u573A\u6B21\u62A5\u8868\u5BFC\u51FA\u5931\u8D25\uFF1A\u63A5\u53E3\u672A\u8FD4\u56DE\u4E0B\u8F7D\u94FE\u63A5\uFF0C\u62A5\u8868\u53EF\u80FD\u5C1A\u672A\u751F\u6210\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5");
19144
19414
  }
19145
19415
  /**
19146
19416
  * Validate parameters for exportSessionStats
@@ -19317,7 +19587,7 @@ var PolyVClient = class {
19317
19587
  * Create and configure the Axios HTTP client with interceptors
19318
19588
  */
19319
19589
  createHttpClient() {
19320
- const client = axios.create({
19590
+ const client = axios2.create({
19321
19591
  baseURL: this.config.baseUrl,
19322
19592
  timeout: this.config.timeout,
19323
19593
  headers: this.config.headers
@@ -19380,12 +19650,12 @@ var PolyVClient = class {
19380
19650
  * Transform Axios errors to PolyVAPIError
19381
19651
  */
19382
19652
  transformAxiosError(error) {
19383
- if (axios.isCancel(error)) {
19653
+ if (axios2.isCancel(error)) {
19384
19654
  return new PolyVAPIError("Request cancelled", 0, {
19385
19655
  code: "REQUEST_CANCELLED"
19386
19656
  });
19387
19657
  }
19388
- if (axios.isAxiosError(error)) {
19658
+ if (axios2.isAxiosError(error)) {
19389
19659
  if (error.response) {
19390
19660
  const { status, data } = error.response;
19391
19661
  return new PolyVAPIError(