polyv-live-api-sdk 1.0.12 → 1.0.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.js CHANGED
@@ -5333,6 +5333,53 @@ var LiveInteractionService = class {
5333
5333
  constructor(client) {
5334
5334
  this.client = client;
5335
5335
  }
5336
+ compactParams(params) {
5337
+ if (!params) return {};
5338
+ return Object.fromEntries(
5339
+ Object.entries(params).filter(([, value]) => value !== void 0 && value !== null)
5340
+ );
5341
+ }
5342
+ validateRequiredString(value, fieldName) {
5343
+ if (typeof value !== "string" || value.trim() === "") {
5344
+ throw new PolyVValidationError(`${fieldName} is required`);
5345
+ }
5346
+ }
5347
+ validateRequiredChannelId(value, fieldName = "channelId") {
5348
+ if (value === void 0 || value === null || typeof value === "string" && value.trim() === "") {
5349
+ throw new PolyVValidationError(`${fieldName} is required`);
5350
+ }
5351
+ }
5352
+ validateRequiredNumber(value, fieldName) {
5353
+ if (typeof value !== "number" || !Number.isFinite(value)) {
5354
+ throw new PolyVValidationError(`${fieldName} is required`);
5355
+ }
5356
+ }
5357
+ validatePositiveInteger(value, fieldName) {
5358
+ if (value === void 0 || value === null) return;
5359
+ if (typeof value !== "number" || !Number.isInteger(value) || value < 1) {
5360
+ throw new PolyVValidationError(`${fieldName} must be a positive integer`);
5361
+ }
5362
+ }
5363
+ validatePageParams(params) {
5364
+ this.validatePositiveInteger(params.page, "page");
5365
+ this.validatePositiveInteger(params.pageSize, "pageSize");
5366
+ this.validatePositiveInteger(params.limit, "limit");
5367
+ }
5368
+ validateTimeRange(params) {
5369
+ this.validateRequiredNumber(params.startTime, "startTime");
5370
+ this.validateRequiredNumber(params.endTime, "endTime");
5371
+ }
5372
+ validateQuestionnairePayload(params) {
5373
+ this.validateRequiredChannelId(params.channelId);
5374
+ this.validateRequiredString(params.questionnaireTitle, "questionnaireTitle");
5375
+ if (!Array.isArray(params.questions) || params.questions.length === 0) {
5376
+ throw new PolyVValidationError("questions is required");
5377
+ }
5378
+ }
5379
+ splitQuestionnairePayload(params) {
5380
+ const { channelId, ...body } = params;
5381
+ return { query: { channelId }, body };
5382
+ }
5336
5383
  // ============================================
5337
5384
  // 签到 (Checkin) APIs
5338
5385
  // ============================================
@@ -5353,12 +5400,10 @@ var LiveInteractionService = class {
5353
5400
  * ```
5354
5401
  */
5355
5402
  async getCheckinList(params) {
5356
- if (!params.channelId) {
5357
- throw new Error("channelId is required");
5358
- }
5403
+ this.validateRequiredChannelId(params.channelId);
5359
5404
  const response = await this.client.httpClient.get(
5360
- "/live/v2/chat/getCheckinList",
5361
- { params }
5405
+ "/live/v3/channel/checkin/list",
5406
+ { params: this.compactParams(params) }
5362
5407
  );
5363
5408
  return response;
5364
5409
  }
@@ -5378,8 +5423,8 @@ var LiveInteractionService = class {
5378
5423
  */
5379
5424
  async getCheckinByCheckinId(params) {
5380
5425
  const response = await this.client.httpClient.get(
5381
- "/live/v2/chat/getCheckinByCheckId",
5382
- { params }
5426
+ "/live/v3/channel/chat/get-checkins",
5427
+ { params: this.compactParams(params) }
5383
5428
  );
5384
5429
  return response;
5385
5430
  }
@@ -5399,8 +5444,8 @@ var LiveInteractionService = class {
5399
5444
  */
5400
5445
  async getCheckinBySessionId(params) {
5401
5446
  const response = await this.client.httpClient.get(
5402
- "/live/v2/chat/getCheckinBySessionId",
5403
- { params }
5447
+ "/live/v3/channel/chat/checkin-by-sessionId",
5448
+ { params: this.compactParams(params) }
5404
5449
  );
5405
5450
  return response;
5406
5451
  }
@@ -5421,8 +5466,8 @@ var LiveInteractionService = class {
5421
5466
  */
5422
5467
  async getCheckinByTime(params) {
5423
5468
  const response = await this.client.httpClient.get(
5424
- "/live/v2/chat/getCheckinByTime",
5425
- { params }
5469
+ "/live/v3/channel/chat/get-checkin-list",
5470
+ { params: this.compactParams(params) }
5426
5471
  );
5427
5472
  return response;
5428
5473
  }
@@ -5444,10 +5489,12 @@ var LiveInteractionService = class {
5444
5489
  * ```
5445
5490
  */
5446
5491
  async createQuestionnaire(params) {
5492
+ this.validateQuestionnairePayload(params);
5493
+ const { query, body } = this.splitQuestionnairePayload(params);
5447
5494
  const response = await this.client.httpClient.post(
5448
- "/live/v2/questionnaire/create",
5449
- null,
5450
- { params }
5495
+ "/live/v4/channel/questionnaire/save",
5496
+ body,
5497
+ { params: query }
5451
5498
  );
5452
5499
  return response;
5453
5500
  }
@@ -5469,9 +5516,8 @@ var LiveInteractionService = class {
5469
5516
  */
5470
5517
  async batchCreateQuestionnaire(params, body) {
5471
5518
  const response = await this.client.httpClient.post(
5472
- "/live/v2/questionnaire/batch_create",
5473
- body,
5474
- { params }
5519
+ "/live/v4/channel/questionnaire/create-batch",
5520
+ body ?? params
5475
5521
  );
5476
5522
  return response;
5477
5523
  }
@@ -5494,12 +5540,22 @@ var LiveInteractionService = class {
5494
5540
  * ```
5495
5541
  */
5496
5542
  async addEditQuestionnaire(params, body) {
5497
- const response = await this.client.httpClient.post(
5498
- "/live/v2/questionnaire/add_edit",
5499
- body,
5500
- { params }
5501
- );
5502
- return response;
5543
+ if (body) {
5544
+ const mappedQuestions = Array.isArray(body.questions) ? body.questions : body.items?.map((item) => ({
5545
+ name: item.question,
5546
+ type: item.type,
5547
+ options: item.options,
5548
+ required: item.required ? "Y" : "N"
5549
+ })) ?? [];
5550
+ const questionnaireTitle = typeof body.questionnaireTitle === "string" ? body.questionnaireTitle : typeof body.title === "string" ? body.title : "";
5551
+ return this.createQuestionnaire({
5552
+ ...body,
5553
+ channelId: params.channelId,
5554
+ questionnaireTitle,
5555
+ questions: mappedQuestions
5556
+ });
5557
+ }
5558
+ return this.createQuestionnaire(params);
5503
5559
  }
5504
5560
  /**
5505
5561
  * 获取频道的问卷列表
@@ -5518,8 +5574,8 @@ var LiveInteractionService = class {
5518
5574
  */
5519
5575
  async listQuestionnaire(params) {
5520
5576
  const response = await this.client.httpClient.get(
5521
- "/live/v3/user/questionnaire/list",
5522
- { params }
5577
+ "/live/v3/channel/questionnaire/list",
5578
+ { params: this.compactParams(params) }
5523
5579
  );
5524
5580
  return response;
5525
5581
  }
@@ -5540,8 +5596,8 @@ var LiveInteractionService = class {
5540
5596
  */
5541
5597
  async listQuestionnaireByPage(params) {
5542
5598
  const response = await this.client.httpClient.get(
5543
- "/live/v3/user/questionnaire/list_by_page",
5544
- { params }
5599
+ "/live/v3/channel/questionnaire/list-answer-records",
5600
+ { params: this.compactParams(params) }
5545
5601
  );
5546
5602
  return response;
5547
5603
  }
@@ -5561,8 +5617,8 @@ var LiveInteractionService = class {
5561
5617
  */
5562
5618
  async getQuestionnaireDetail(params) {
5563
5619
  const response = await this.client.httpClient.get(
5564
- "/live/v3/user/questionnaire/detail",
5565
- { params }
5620
+ "/live/v3/channel/questionnaire/detail",
5621
+ { params: this.compactParams(params) }
5566
5622
  );
5567
5623
  return response;
5568
5624
  }
@@ -5582,8 +5638,8 @@ var LiveInteractionService = class {
5582
5638
  */
5583
5639
  async getQuestionnaireResult(params) {
5584
5640
  const response = await this.client.httpClient.get(
5585
- "/live/v3/user/questionnaire/result",
5586
- { params }
5641
+ "/live/v3/channel/questionnaire/answer-records",
5642
+ { params: this.compactParams(params) }
5587
5643
  );
5588
5644
  return response;
5589
5645
  }
@@ -5605,8 +5661,8 @@ var LiveInteractionService = class {
5605
5661
  */
5606
5662
  async listQuestion(params) {
5607
5663
  const response = await this.client.httpClient.get(
5608
- "/live/v2/question/list",
5609
- { params }
5664
+ "/live/v3/channel/interact/question/list-question",
5665
+ { params: this.compactParams(params) }
5610
5666
  );
5611
5667
  return response;
5612
5668
  }
@@ -5625,8 +5681,8 @@ var LiveInteractionService = class {
5625
5681
  */
5626
5682
  async listQuestionSendTime(params) {
5627
5683
  const response = await this.client.httpClient.get(
5628
- "/live/v2/question/list_send_time",
5629
- { params }
5684
+ "/live/v3/channel/interact/question/list-send-time",
5685
+ { params: this.compactParams(params) }
5630
5686
  );
5631
5687
  return response;
5632
5688
  }
@@ -5649,10 +5705,21 @@ var LiveInteractionService = class {
5649
5705
  * ```
5650
5706
  */
5651
5707
  async addEditQuestion(params) {
5708
+ const { _type, option1_option15, tips1_tips5, ...rest } = params;
5709
+ const query = {
5710
+ ...rest,
5711
+ type: params.type ?? _type
5712
+ };
5713
+ option1_option15?.split(",").forEach((option, index) => {
5714
+ query[`option${index + 1}`] = option;
5715
+ });
5716
+ tips1_tips5?.split(",").forEach((tip, index) => {
5717
+ query[`tips${index + 1}`] = tip;
5718
+ });
5652
5719
  const response = await this.client.httpClient.post(
5653
- "/live/v2/question/add_edit",
5720
+ "/live/v3/channel/interact/question/add-edit-question",
5654
5721
  null,
5655
- { params }
5722
+ { params: this.compactParams(query) }
5656
5723
  );
5657
5724
  return response;
5658
5725
  }
@@ -5672,9 +5739,9 @@ var LiveInteractionService = class {
5672
5739
  */
5673
5740
  async deleteQuestion(params) {
5674
5741
  const response = await this.client.httpClient.post(
5675
- "/live/v2/question/delete",
5742
+ "/live/v3/channel/interact/question/delete-question",
5676
5743
  null,
5677
- { params }
5744
+ { params: this.compactParams(params) }
5678
5745
  );
5679
5746
  return response;
5680
5747
  }
@@ -5695,9 +5762,9 @@ var LiveInteractionService = class {
5695
5762
  */
5696
5763
  async sendQuestion(params) {
5697
5764
  const response = await this.client.httpClient.post(
5698
- "/live/v2/question/send",
5765
+ "/live/v4/channel/question/send",
5699
5766
  null,
5700
- { params }
5767
+ { params: this.compactParams(params) }
5701
5768
  );
5702
5769
  return response;
5703
5770
  }
@@ -5717,9 +5784,9 @@ var LiveInteractionService = class {
5717
5784
  */
5718
5785
  async stopQuestion(params) {
5719
5786
  const response = await this.client.httpClient.post(
5720
- "/live/v2/question/stop",
5787
+ "/live/v4/channel/question/stop",
5721
5788
  null,
5722
- { params }
5789
+ { params: this.compactParams(params) }
5723
5790
  );
5724
5791
  return response;
5725
5792
  }
@@ -5739,9 +5806,9 @@ var LiveInteractionService = class {
5739
5806
  */
5740
5807
  async sendQuestionResult(params) {
5741
5808
  const response = await this.client.httpClient.post(
5742
- "/live/v2/question/send_result",
5809
+ "/live/v4/channel/question/send-result",
5743
5810
  null,
5744
- { params }
5811
+ { params: this.compactParams(params) }
5745
5812
  );
5746
5813
  return response;
5747
5814
  }
@@ -5761,8 +5828,8 @@ var LiveInteractionService = class {
5761
5828
  */
5762
5829
  async getAnswerList(params) {
5763
5830
  const response = await this.client.httpClient.get(
5764
- "/live/v2/chat/getAnswerList",
5765
- { params }
5831
+ "/live/v3/channel/question/answer-records",
5832
+ { params: this.compactParams(params) }
5766
5833
  );
5767
5834
  return response;
5768
5835
  }
@@ -5785,9 +5852,12 @@ var LiveInteractionService = class {
5785
5852
  * ```
5786
5853
  */
5787
5854
  async listLottery(params) {
5855
+ this.validateRequiredChannelId(params.channelId);
5856
+ this.validateTimeRange(params);
5857
+ this.validatePageParams(params);
5788
5858
  const response = await this.client.httpClient.get(
5789
- "/live/v2/chat/list_lottery",
5790
- { params }
5859
+ "/live/v3/channel/lottery/list-lottery",
5860
+ { params: this.compactParams(params) }
5791
5861
  );
5792
5862
  return response;
5793
5863
  }
@@ -5807,9 +5877,12 @@ var LiveInteractionService = class {
5807
5877
  * ```
5808
5878
  */
5809
5879
  async listChannelsLottery(params) {
5880
+ this.validateRequiredString(params.channelIds, "channelIds");
5881
+ this.validateTimeRange(params);
5882
+ this.validatePageParams(params);
5810
5883
  const response = await this.client.httpClient.get(
5811
- "/live/v2/chat/list_channels_lottery",
5812
- { params }
5884
+ "/live/v3/channel/lottery/list-channels-lottery",
5885
+ { params: this.compactParams(params) }
5813
5886
  );
5814
5887
  return response;
5815
5888
  }
@@ -5831,8 +5904,8 @@ var LiveInteractionService = class {
5831
5904
  */
5832
5905
  async getWinnerDetail(params) {
5833
5906
  const response = await this.client.httpClient.get(
5834
- "/live/v2/chat/get_winner_detail",
5835
- { params }
5907
+ "/live/v3/channel/lottery/get-winner-detail",
5908
+ { params: this.compactParams(params) }
5836
5909
  );
5837
5910
  return response;
5838
5911
  }
@@ -5852,8 +5925,8 @@ var LiveInteractionService = class {
5852
5925
  */
5853
5926
  async downloadWinnerDetail(params) {
5854
5927
  const response = await this.client.httpClient.get(
5855
- "/live/v2/chat/download_winner_detail",
5856
- { params }
5928
+ "/live/v3/channel/lottery/download-winner-detail",
5929
+ { params: this.compactParams(params) }
5857
5930
  );
5858
5931
  return response;
5859
5932
  }
@@ -5876,12 +5949,7 @@ var LiveInteractionService = class {
5876
5949
  * ```
5877
5950
  */
5878
5951
  async addReceiveInfo(params) {
5879
- const response = await this.client.httpClient.post(
5880
- "/live/v2/chat/add_receive_info",
5881
- null,
5882
- { params }
5883
- );
5884
- return response;
5952
+ return this.addReceiveInfoV4(params);
5885
5953
  }
5886
5954
  /**
5887
5955
  * 提交中奖者填写的信息 (V4版本)
@@ -5902,9 +5970,9 @@ var LiveInteractionService = class {
5902
5970
  */
5903
5971
  async addReceiveInfoV4(params) {
5904
5972
  const response = await this.client.httpClient.post(
5905
- "/live/v4/chat/add_receive_info",
5973
+ "/live/v4/channel/lottery/add-receive-info",
5906
5974
  null,
5907
- { params }
5975
+ { params: this.compactParams(params) }
5908
5976
  );
5909
5977
  return response;
5910
5978
  }
@@ -5953,9 +6021,9 @@ var LiveInteractionService = class {
5953
6021
  */
5954
6022
  async sendRewardMsg(params) {
5955
6023
  const response = await this.client.httpClient.post(
5956
- "/live/v2/chat/send_reward_msg",
6024
+ "/live/v3/channel/chat/send-reward-msg",
5957
6025
  null,
5958
- { params }
6026
+ { params: this.compactParams(params) }
5959
6027
  );
5960
6028
  return response;
5961
6029
  }
@@ -5976,8 +6044,8 @@ var LiveInteractionService = class {
5976
6044
  */
5977
6045
  async getQuestionList(channelId, params) {
5978
6046
  const response = await this.client.httpClient.get(
5979
- `/live/v2/chat/${channelId}/get_question_list`,
5980
- { params }
6047
+ `/live/v2/chat/${encodeURIComponent(channelId)}/getQuestion`,
6048
+ { params: this.compactParams(params) }
5981
6049
  );
5982
6050
  return response;
5983
6051
  }
@@ -5994,6 +6062,21 @@ var AccountService = class {
5994
6062
  constructor(client) {
5995
6063
  this.client = client;
5996
6064
  }
6065
+ compactParams(params) {
6066
+ if (!params) return {};
6067
+ return Object.fromEntries(
6068
+ Object.entries(params).filter(([, value]) => value !== void 0 && value !== null)
6069
+ );
6070
+ }
6071
+ normalizeEnabled(enabled) {
6072
+ if (typeof enabled === "boolean") {
6073
+ return enabled ? "Y" : "N";
6074
+ }
6075
+ if (enabled !== "Y" && enabled !== "N") {
6076
+ throw new PolyVValidationError("enabled must be Y or N");
6077
+ }
6078
+ return enabled;
6079
+ }
5997
6080
  // ============================================
5998
6081
  // AC1: Category Management APIs
5999
6082
  // ============================================
@@ -6367,9 +6450,10 @@ var AccountService = class {
6367
6450
  * console.log(result.config);
6368
6451
  * ```
6369
6452
  */
6370
- async switchGet() {
6453
+ async switchGet(params) {
6371
6454
  const response = await this.client.httpClient.get(
6372
- "/live/v3/user/switch/get"
6455
+ "/live/v3/channel/switch/get",
6456
+ { params: this.compactParams(params) }
6373
6457
  );
6374
6458
  return response;
6375
6459
  }
@@ -6389,17 +6473,23 @@ var AccountService = class {
6389
6473
  * ```
6390
6474
  */
6391
6475
  async switchUpdate(params) {
6392
- if (!params.param) {
6393
- throw new PolyVValidationError("param is required");
6476
+ const type = params.type ?? params.param;
6477
+ if (!type) {
6478
+ throw new PolyVValidationError("type is required");
6394
6479
  }
6395
6480
  if (params.enabled === void 0 || params.enabled === null) {
6396
6481
  throw new PolyVValidationError("enabled is required");
6397
6482
  }
6398
- const enabledValue = typeof params.enabled === "boolean" ? params.enabled ? "Y" : "N" : params.enabled;
6399
6483
  const response = await this.client.httpClient.post(
6400
- "/live/v3/user/switch/update",
6484
+ "/live/v3/channel/switch/update",
6401
6485
  null,
6402
- { params: { param: params.param, enabled: enabledValue } }
6486
+ {
6487
+ params: this.compactParams({
6488
+ channelId: params.channelId,
6489
+ type,
6490
+ enabled: this.normalizeEnabled(params.enabled)
6491
+ })
6492
+ }
6403
6493
  );
6404
6494
  return { success: response };
6405
6495
  }
@@ -11341,11 +11431,29 @@ var V4ChannelService = class {
11341
11431
  * @param params - Update parameters
11342
11432
  */
11343
11433
  async updateDonate(params) {
11434
+ await this.updateDonateGift({
11435
+ channelId: params.channelId,
11436
+ donateGiftEnabled: params.donateGiftEnabled ?? params.donateEnabled ?? "Y",
11437
+ ...params.giftDonate ? { giftDonate: params.giftDonate } : {}
11438
+ });
11439
+ }
11440
+ /**
11441
+ * Update channel gift donate settings.
11442
+ *
11443
+ * @param params - Update parameters
11444
+ * @returns Donate settings
11445
+ */
11446
+ async updateDonateGift(params) {
11344
11447
  this.validateChannelId(params.channelId);
11345
- await this.client.httpClient.post(
11346
- "/live/v4/channel/donate/update",
11347
- params
11448
+ this.validateRequiredString(params.donateGiftEnabled, "donateGiftEnabled");
11449
+ this.validateOptionalYn(params.donateGiftEnabled, "donateGiftEnabled");
11450
+ const { channelId, ...body } = params;
11451
+ const response = await this.client.httpClient.post(
11452
+ "/live/v4/channel/donate/gift/update",
11453
+ body,
11454
+ { params: { channelId } }
11348
11455
  );
11456
+ return response;
11349
11457
  }
11350
11458
  // ============================================
11351
11459
  // AC6: Distribute APIs (7 APIs)
@@ -11479,7 +11587,7 @@ var V4ChannelService = class {
11479
11587
  * @returns Activity ID
11480
11588
  */
11481
11589
  async lotteryActivityCreate(params) {
11482
- this.validateChannelId(params.channelId);
11590
+ this.validateLotteryActivityBody(params);
11483
11591
  const { channelId, ...body } = params;
11484
11592
  const response = await this.client.httpClient.post(
11485
11593
  "/live/v4/channel/lottery-activity/create",
@@ -11523,7 +11631,8 @@ var V4ChannelService = class {
11523
11631
  * @param params - Update parameters
11524
11632
  */
11525
11633
  async lotteryActivityUpdate(params) {
11526
- this.validateChannelId(params.channelId);
11634
+ this.validateLotteryActivityBody(params);
11635
+ this.validateRequiredId(params.id, "id");
11527
11636
  const { channelId, ...body } = params;
11528
11637
  await this.client.httpClient.post(
11529
11638
  "/live/v4/channel/lottery-activity/update",
@@ -11538,10 +11647,12 @@ var V4ChannelService = class {
11538
11647
  */
11539
11648
  async lotteryActivityDelete(params) {
11540
11649
  this.validateChannelId(params.channelId);
11650
+ this.validateRequiredId(params.id, "id");
11651
+ const { channelId, ...body } = params;
11541
11652
  await this.client.httpClient.post(
11542
11653
  "/live/v4/channel/lottery-activity/delete",
11543
- { id: params.id },
11544
- { params: { channelId: params.channelId } }
11654
+ body,
11655
+ { params: { channelId } }
11545
11656
  );
11546
11657
  }
11547
11658
  /**
@@ -11781,7 +11892,7 @@ var V4ChannelService = class {
11781
11892
  async shareGet(params) {
11782
11893
  this.validateChannelId(params.channelId);
11783
11894
  const response = await this.client.httpClient.get(
11784
- "/live/v4/channel/market/share/get",
11895
+ "/live/v4/channel/share/get",
11785
11896
  { params }
11786
11897
  );
11787
11898
  return response;
@@ -11793,10 +11904,16 @@ var V4ChannelService = class {
11793
11904
  */
11794
11905
  async shareUpdate(params) {
11795
11906
  this.validateChannelId(params.channelId);
11796
- await this.client.httpClient.post(
11797
- "/live/v4/channel/market/share/update",
11798
- params
11907
+ this.validateRequiredString(params.shareBtnEnable, "shareBtnEnable");
11908
+ this.validateOptionalYn(params.shareBtnEnable, "shareBtnEnable");
11909
+ this.validateRequiredString(params.titleType, "titleType");
11910
+ this.validateOptionalYn(params.weixinShareCustomUrlWithParamEnabled, "weixinShareCustomUrlWithParamEnabled");
11911
+ this.validateOptionalYn(params.webShareCustomUrlWithParamEnabled, "webShareCustomUrlWithParamEnabled");
11912
+ const response = await this.client.httpClient.get(
11913
+ "/live/v4/channel/share/update",
11914
+ { params }
11799
11915
  );
11916
+ return response;
11800
11917
  }
11801
11918
  /**
11802
11919
  * Create card push
@@ -11805,23 +11922,9 @@ var V4ChannelService = class {
11805
11922
  * @returns Card ID
11806
11923
  */
11807
11924
  async cardPushCreate(params) {
11808
- this.validateChannelId(params.channelId);
11809
- const response = await this.client.httpClient.post(
11810
- "/live/v4/channel/market/cardPush/create",
11811
- params
11812
- );
11813
- return response;
11814
- }
11815
- /**
11816
- * Get card push
11817
- *
11818
- * @param params - Query parameters
11819
- * @returns Card push info
11820
- */
11821
- async cardPushGet(params) {
11822
- this.validateChannelId(params.channelId);
11925
+ this.validateCardPushCreateParams(params);
11823
11926
  const response = await this.client.httpClient.get(
11824
- "/live/v4/channel/market/cardPush/get",
11927
+ "/live/v4/channel/card-push/create",
11825
11928
  { params }
11826
11929
  );
11827
11930
  return response;
@@ -11832,10 +11935,13 @@ var V4ChannelService = class {
11832
11935
  * @param params - Update parameters
11833
11936
  */
11834
11937
  async cardPushUpdate(params) {
11835
- this.validateChannelId(params.channelId);
11938
+ this.validateCardPushIdParams(params);
11939
+ this.validateCardPushOptionalParams(params);
11940
+ const { channelId, cardPushId, ...body } = params;
11836
11941
  await this.client.httpClient.post(
11837
- "/live/v4/channel/market/cardPush/update",
11838
- params
11942
+ "/live/v4/channel/card-push/update",
11943
+ body,
11944
+ { params: { channelId, cardPushId } }
11839
11945
  );
11840
11946
  }
11841
11947
  /**
@@ -11844,9 +11950,9 @@ var V4ChannelService = class {
11844
11950
  * @param params - Delete parameters
11845
11951
  */
11846
11952
  async cardPushDelete(params) {
11847
- this.validateChannelId(params.channelId);
11953
+ this.validateCardPushIdParams(params);
11848
11954
  await this.client.httpClient.post(
11849
- "/live/v4/channel/market/cardPush/delete",
11955
+ "/live/v4/channel/card-push/delete",
11850
11956
  null,
11851
11957
  { params }
11852
11958
  );
@@ -11857,9 +11963,9 @@ var V4ChannelService = class {
11857
11963
  * @param params - Push parameters
11858
11964
  */
11859
11965
  async cardPushPush(params) {
11860
- this.validateChannelId(params.channelId);
11966
+ this.validateCardPushIdParams(params);
11861
11967
  await this.client.httpClient.post(
11862
- "/live/v4/channel/market/cardPush/push",
11968
+ "/live/v4/channel/card-push/push",
11863
11969
  null,
11864
11970
  { params }
11865
11971
  );
@@ -11870,9 +11976,9 @@ var V4ChannelService = class {
11870
11976
  * @param params - Cancel parameters
11871
11977
  */
11872
11978
  async cardPushCancelPush(params) {
11873
- this.validateChannelId(params.channelId);
11979
+ this.validateCardPushIdParams(params);
11874
11980
  await this.client.httpClient.post(
11875
- "/live/v4/channel/market/cardPush/cancelPush",
11981
+ "/live/v4/channel/card-push/cancel-push",
11876
11982
  null,
11877
11983
  { params }
11878
11984
  );
@@ -12043,9 +12149,12 @@ var V4ChannelService = class {
12043
12149
  */
12044
12150
  async productTagCreate(params) {
12045
12151
  this.validateChannelId(params.channelId);
12152
+ this.validateRequiredString(params.name, "name");
12153
+ const { channelId, ...body } = params;
12046
12154
  const response = await this.client.httpClient.post(
12047
- "/live/v4/channel/product-tag/product-tag-create",
12048
- params
12155
+ "/live/v4/channel/product/tag/create",
12156
+ body,
12157
+ { params: { channelId } }
12049
12158
  );
12050
12159
  return response;
12051
12160
  }
@@ -12071,8 +12180,9 @@ var V4ChannelService = class {
12071
12180
  */
12072
12181
  async productTagList(params) {
12073
12182
  this.validateChannelId(params.channelId);
12183
+ this.validateOptionalPaginationParams(params);
12074
12184
  const response = await this.client.httpClient.get(
12075
- "/live/v4/channel/product-tag/product-tag-list",
12185
+ "/live/v4/channel/product/tag/list",
12076
12186
  { params }
12077
12187
  );
12078
12188
  return response;
@@ -12084,9 +12194,13 @@ var V4ChannelService = class {
12084
12194
  */
12085
12195
  async productTagUpdate(params) {
12086
12196
  this.validateChannelId(params.channelId);
12197
+ this.validateRequiredId(params.id, "id");
12198
+ this.validateRequiredString(params.name, "name");
12199
+ const { channelId, ...body } = params;
12087
12200
  await this.client.httpClient.post(
12088
- "/live/v4/channel/product-tag/product-tag-update",
12089
- params
12201
+ "/live/v4/channel/product/tag/update",
12202
+ body,
12203
+ { params: { channelId } }
12090
12204
  );
12091
12205
  }
12092
12206
  /**
@@ -12096,10 +12210,12 @@ var V4ChannelService = class {
12096
12210
  */
12097
12211
  async productTagDelete(params) {
12098
12212
  this.validateChannelId(params.channelId);
12213
+ this.validateRequiredId(params.id, "id");
12214
+ const { channelId, ...body } = params;
12099
12215
  await this.client.httpClient.post(
12100
- "/live/v4/channel/product-tag/product-tag-delete",
12101
- null,
12102
- { params }
12216
+ "/live/v4/channel/product/tag/delete",
12217
+ body,
12218
+ { params: { channelId } }
12103
12219
  );
12104
12220
  }
12105
12221
  /**
@@ -12132,6 +12248,38 @@ var V4ChannelService = class {
12132
12248
  );
12133
12249
  return response;
12134
12250
  }
12251
+ /**
12252
+ * List gift reward records.
12253
+ *
12254
+ * @param params - Query parameters
12255
+ * @returns Gift reward records
12256
+ */
12257
+ async listRewardGifts(params) {
12258
+ this.validateChannelId(params.channelId);
12259
+ this.validateRequiredNumber(params.start, "start");
12260
+ this.validateRequiredNumber(params.end, "end");
12261
+ this.validateOptionalPaginationParams(params);
12262
+ const response = await this.client.httpClient.get(
12263
+ "/live/v4/channel/reward/gift-list",
12264
+ { params }
12265
+ );
12266
+ return response;
12267
+ }
12268
+ /**
12269
+ * List like reward records.
12270
+ *
12271
+ * @param params - Query parameters
12272
+ * @returns Like reward records
12273
+ */
12274
+ async listRewardLikes(params) {
12275
+ this.validateChannelId(params.channelId);
12276
+ this.validateOptionalPaginationParams(params);
12277
+ const response = await this.client.httpClient.get(
12278
+ "/live/v4/channel/reward/like-list",
12279
+ { params }
12280
+ );
12281
+ return response;
12282
+ }
12135
12283
  // ============================================
12136
12284
  // AC11: Task Reward APIs (10 APIs)
12137
12285
  // ============================================
@@ -12415,8 +12563,93 @@ var V4ChannelService = class {
12415
12563
  return response;
12416
12564
  }
12417
12565
  // ============================================
12566
+ // V4 Channel Marketing & Content API Paths
12567
+ // ============================================
12568
+ /**
12569
+ * List channel card pushes.
12570
+ */
12571
+ async listCardPushes(params) {
12572
+ this.validateChannelId(params.channelId);
12573
+ const response = await this.client.httpClient.get(
12574
+ "/live/v4/channel/card-push/list",
12575
+ { params }
12576
+ );
12577
+ return response;
12578
+ }
12579
+ // ============================================
12418
12580
  // Private Validation Helpers
12419
12581
  // ============================================
12582
+ validateRequiredString(value, field) {
12583
+ if (!value || value.trim() === "") {
12584
+ throw new PolyVValidationError(`${field} is required and cannot be empty`, field);
12585
+ }
12586
+ }
12587
+ validateOptionalYn(value, field) {
12588
+ if (value !== void 0 && value !== "Y" && value !== "N") {
12589
+ throw new PolyVValidationError(`${field} must be Y or N`, field, value);
12590
+ }
12591
+ }
12592
+ validateRequiredId(value, field) {
12593
+ if (typeof value === "string") {
12594
+ this.validateRequiredString(value, field);
12595
+ return;
12596
+ }
12597
+ if (typeof value === "number") {
12598
+ if (!Number.isFinite(value) || value <= 0) {
12599
+ throw new PolyVValidationError(`${field} must be a positive number`, field, value);
12600
+ }
12601
+ return;
12602
+ }
12603
+ throw new PolyVValidationError(`${field} is required`, field);
12604
+ }
12605
+ validateRequiredNumber(value, field) {
12606
+ if (typeof value !== "number" || !Number.isFinite(value)) {
12607
+ throw new PolyVValidationError(`${field} is required and must be a number`, field, value);
12608
+ }
12609
+ }
12610
+ validateLotteryActivityBody(params) {
12611
+ this.validateChannelId(params.channelId);
12612
+ this.validateRequiredString(params.activityName, "activityName");
12613
+ this.validateRequiredString(params.lotteryCondition, "lotteryCondition");
12614
+ this.validateRequiredNumber(params.amount, "amount");
12615
+ if (params.amount < 1) {
12616
+ throw new PolyVValidationError("amount must be >= 1", "amount", params.amount);
12617
+ }
12618
+ this.validateRequiredString(params.prizeName, "prizeName");
12619
+ this.validateOptionalYn(params.hiddenWinnerAmount, "hiddenWinnerAmount");
12620
+ this.validateOptionalYn(params.hiddenAttendeeNumber, "hiddenAttendeeNumber");
12621
+ this.validateOptionalYn(params.repeatWinEnabled, "repeatWinEnabled");
12622
+ this.validateOptionalYn(params.receiveEnabled, "receiveEnabled");
12623
+ this.validateOptionalYn(params.lotteryOnlineEnabled, "lotteryOnlineEnabled");
12624
+ this.validateOptionalYn(params.showWinnerCode, "showWinnerCode");
12625
+ this.validateOptionalYn(params.showWinners, "showWinners");
12626
+ }
12627
+ validateCardPushCreateParams(params) {
12628
+ this.validateChannelId(params.channelId);
12629
+ this.validateRequiredString(params.imageType, "imageType");
12630
+ this.validateRequiredString(params.title, "title");
12631
+ if (params.title.length > 16) {
12632
+ throw new PolyVValidationError("title cannot exceed 16 characters", "title", params.title);
12633
+ }
12634
+ this.validateRequiredString(params.link, "link");
12635
+ this.validateRequiredNumber(params.duration, "duration");
12636
+ this.validateRequiredString(params.showCondition, "showCondition");
12637
+ this.validateCardPushOptionalParams(params);
12638
+ }
12639
+ validateCardPushIdParams(params) {
12640
+ this.validateChannelId(params.channelId);
12641
+ this.validateRequiredId(params.cardPushId, "cardPushId");
12642
+ }
12643
+ validateCardPushOptionalParams(params) {
12644
+ this.validateOptionalYn(params.enterEnabled, "enterEnabled");
12645
+ this.validateOptionalYn(params.linkEnabled, "linkEnabled");
12646
+ if (params.countdownMsg !== void 0 && params.countdownMsg.length > 8) {
12647
+ throw new PolyVValidationError("countdownMsg cannot exceed 8 characters", "countdownMsg", params.countdownMsg);
12648
+ }
12649
+ if (params.duration !== void 0 && ![0, 5, 10, 20, 30].includes(params.duration)) {
12650
+ throw new PolyVValidationError("duration must be one of 0, 5, 10, 20, or 30", "duration", params.duration);
12651
+ }
12652
+ }
12420
12653
  /**
12421
12654
  * Validate channel ID
12422
12655
  */
@@ -12493,6 +12726,15 @@ var V4ChannelService = class {
12493
12726
  throw new PolyVValidationError("pageSize must be between 1 and 1000", "pageSize", params.pageSize);
12494
12727
  }
12495
12728
  }
12729
+ validateOptionalPaginationParams(params) {
12730
+ const pageNumber = params.pageNumber ?? params.page;
12731
+ if (pageNumber !== void 0 && pageNumber < 1) {
12732
+ throw new PolyVValidationError("pageNumber must be >= 1", "pageNumber", pageNumber);
12733
+ }
12734
+ if (params.pageSize !== void 0 && (params.pageSize < 1 || params.pageSize > 1e3)) {
12735
+ throw new PolyVValidationError("pageSize must be between 1 and 1000", "pageSize", params.pageSize);
12736
+ }
12737
+ }
12496
12738
  };
12497
12739
 
12498
12740
  // src/services/v4/chat.service.ts
@@ -14093,7 +14335,7 @@ var V4UserService = class {
14093
14335
  */
14094
14336
  async getCallback() {
14095
14337
  const response = await this.client.httpClient.get(
14096
- "/live/v4/user/callback/get",
14338
+ "/live/v4/user/global-setting/callback/get",
14097
14339
  {}
14098
14340
  );
14099
14341
  return response;
@@ -14112,9 +14354,15 @@ var V4UserService = class {
14112
14354
  * ```
14113
14355
  */
14114
14356
  async updateCallback(params) {
14357
+ const { url, enabled, ...rest } = params;
14358
+ const body = {
14359
+ ...rest,
14360
+ ...url !== void 0 ? { streamCallbackUrl: url } : {},
14361
+ ...enabled !== void 0 ? { rebirthVodCallbackEnabled: enabled ? "Y" : "N" } : {}
14362
+ };
14115
14363
  await this.client.httpClient.post(
14116
- "/live/v4/user/callback/update",
14117
- params
14364
+ "/live/v4/user/global-setting/callback/update",
14365
+ body
14118
14366
  );
14119
14367
  }
14120
14368
  /**