polyv-live-api-sdk 1.0.11 → 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.cjs CHANGED
@@ -5340,6 +5340,53 @@ var LiveInteractionService = class {
5340
5340
  constructor(client) {
5341
5341
  this.client = client;
5342
5342
  }
5343
+ compactParams(params) {
5344
+ if (!params) return {};
5345
+ return Object.fromEntries(
5346
+ Object.entries(params).filter(([, value]) => value !== void 0 && value !== null)
5347
+ );
5348
+ }
5349
+ validateRequiredString(value, fieldName) {
5350
+ if (typeof value !== "string" || value.trim() === "") {
5351
+ throw new PolyVValidationError(`${fieldName} is required`);
5352
+ }
5353
+ }
5354
+ validateRequiredChannelId(value, fieldName = "channelId") {
5355
+ if (value === void 0 || value === null || typeof value === "string" && value.trim() === "") {
5356
+ throw new PolyVValidationError(`${fieldName} is required`);
5357
+ }
5358
+ }
5359
+ validateRequiredNumber(value, fieldName) {
5360
+ if (typeof value !== "number" || !Number.isFinite(value)) {
5361
+ throw new PolyVValidationError(`${fieldName} is required`);
5362
+ }
5363
+ }
5364
+ validatePositiveInteger(value, fieldName) {
5365
+ if (value === void 0 || value === null) return;
5366
+ if (typeof value !== "number" || !Number.isInteger(value) || value < 1) {
5367
+ throw new PolyVValidationError(`${fieldName} must be a positive integer`);
5368
+ }
5369
+ }
5370
+ validatePageParams(params) {
5371
+ this.validatePositiveInteger(params.page, "page");
5372
+ this.validatePositiveInteger(params.pageSize, "pageSize");
5373
+ this.validatePositiveInteger(params.limit, "limit");
5374
+ }
5375
+ validateTimeRange(params) {
5376
+ this.validateRequiredNumber(params.startTime, "startTime");
5377
+ this.validateRequiredNumber(params.endTime, "endTime");
5378
+ }
5379
+ validateQuestionnairePayload(params) {
5380
+ this.validateRequiredChannelId(params.channelId);
5381
+ this.validateRequiredString(params.questionnaireTitle, "questionnaireTitle");
5382
+ if (!Array.isArray(params.questions) || params.questions.length === 0) {
5383
+ throw new PolyVValidationError("questions is required");
5384
+ }
5385
+ }
5386
+ splitQuestionnairePayload(params) {
5387
+ const { channelId, ...body } = params;
5388
+ return { query: { channelId }, body };
5389
+ }
5343
5390
  // ============================================
5344
5391
  // 签到 (Checkin) APIs
5345
5392
  // ============================================
@@ -5360,12 +5407,10 @@ var LiveInteractionService = class {
5360
5407
  * ```
5361
5408
  */
5362
5409
  async getCheckinList(params) {
5363
- if (!params.channelId) {
5364
- throw new Error("channelId is required");
5365
- }
5410
+ this.validateRequiredChannelId(params.channelId);
5366
5411
  const response = await this.client.httpClient.get(
5367
- "/live/v2/chat/getCheckinList",
5368
- { params }
5412
+ "/live/v3/channel/checkin/list",
5413
+ { params: this.compactParams(params) }
5369
5414
  );
5370
5415
  return response;
5371
5416
  }
@@ -5385,8 +5430,8 @@ var LiveInteractionService = class {
5385
5430
  */
5386
5431
  async getCheckinByCheckinId(params) {
5387
5432
  const response = await this.client.httpClient.get(
5388
- "/live/v2/chat/getCheckinByCheckId",
5389
- { params }
5433
+ "/live/v3/channel/chat/get-checkins",
5434
+ { params: this.compactParams(params) }
5390
5435
  );
5391
5436
  return response;
5392
5437
  }
@@ -5406,8 +5451,8 @@ var LiveInteractionService = class {
5406
5451
  */
5407
5452
  async getCheckinBySessionId(params) {
5408
5453
  const response = await this.client.httpClient.get(
5409
- "/live/v2/chat/getCheckinBySessionId",
5410
- { params }
5454
+ "/live/v3/channel/chat/checkin-by-sessionId",
5455
+ { params: this.compactParams(params) }
5411
5456
  );
5412
5457
  return response;
5413
5458
  }
@@ -5428,8 +5473,8 @@ var LiveInteractionService = class {
5428
5473
  */
5429
5474
  async getCheckinByTime(params) {
5430
5475
  const response = await this.client.httpClient.get(
5431
- "/live/v2/chat/getCheckinByTime",
5432
- { params }
5476
+ "/live/v3/channel/chat/get-checkin-list",
5477
+ { params: this.compactParams(params) }
5433
5478
  );
5434
5479
  return response;
5435
5480
  }
@@ -5451,10 +5496,12 @@ var LiveInteractionService = class {
5451
5496
  * ```
5452
5497
  */
5453
5498
  async createQuestionnaire(params) {
5499
+ this.validateQuestionnairePayload(params);
5500
+ const { query, body } = this.splitQuestionnairePayload(params);
5454
5501
  const response = await this.client.httpClient.post(
5455
- "/live/v2/questionnaire/create",
5456
- null,
5457
- { params }
5502
+ "/live/v4/channel/questionnaire/save",
5503
+ body,
5504
+ { params: query }
5458
5505
  );
5459
5506
  return response;
5460
5507
  }
@@ -5476,9 +5523,8 @@ var LiveInteractionService = class {
5476
5523
  */
5477
5524
  async batchCreateQuestionnaire(params, body) {
5478
5525
  const response = await this.client.httpClient.post(
5479
- "/live/v2/questionnaire/batch_create",
5480
- body,
5481
- { params }
5526
+ "/live/v4/channel/questionnaire/create-batch",
5527
+ body ?? params
5482
5528
  );
5483
5529
  return response;
5484
5530
  }
@@ -5501,12 +5547,22 @@ var LiveInteractionService = class {
5501
5547
  * ```
5502
5548
  */
5503
5549
  async addEditQuestionnaire(params, body) {
5504
- const response = await this.client.httpClient.post(
5505
- "/live/v2/questionnaire/add_edit",
5506
- body,
5507
- { params }
5508
- );
5509
- return response;
5550
+ if (body) {
5551
+ const mappedQuestions = Array.isArray(body.questions) ? body.questions : body.items?.map((item) => ({
5552
+ name: item.question,
5553
+ type: item.type,
5554
+ options: item.options,
5555
+ required: item.required ? "Y" : "N"
5556
+ })) ?? [];
5557
+ const questionnaireTitle = typeof body.questionnaireTitle === "string" ? body.questionnaireTitle : typeof body.title === "string" ? body.title : "";
5558
+ return this.createQuestionnaire({
5559
+ ...body,
5560
+ channelId: params.channelId,
5561
+ questionnaireTitle,
5562
+ questions: mappedQuestions
5563
+ });
5564
+ }
5565
+ return this.createQuestionnaire(params);
5510
5566
  }
5511
5567
  /**
5512
5568
  * 获取频道的问卷列表
@@ -5525,8 +5581,8 @@ var LiveInteractionService = class {
5525
5581
  */
5526
5582
  async listQuestionnaire(params) {
5527
5583
  const response = await this.client.httpClient.get(
5528
- "/live/v3/user/questionnaire/list",
5529
- { params }
5584
+ "/live/v3/channel/questionnaire/list",
5585
+ { params: this.compactParams(params) }
5530
5586
  );
5531
5587
  return response;
5532
5588
  }
@@ -5547,8 +5603,8 @@ var LiveInteractionService = class {
5547
5603
  */
5548
5604
  async listQuestionnaireByPage(params) {
5549
5605
  const response = await this.client.httpClient.get(
5550
- "/live/v3/user/questionnaire/list_by_page",
5551
- { params }
5606
+ "/live/v3/channel/questionnaire/list-answer-records",
5607
+ { params: this.compactParams(params) }
5552
5608
  );
5553
5609
  return response;
5554
5610
  }
@@ -5568,8 +5624,8 @@ var LiveInteractionService = class {
5568
5624
  */
5569
5625
  async getQuestionnaireDetail(params) {
5570
5626
  const response = await this.client.httpClient.get(
5571
- "/live/v3/user/questionnaire/detail",
5572
- { params }
5627
+ "/live/v3/channel/questionnaire/detail",
5628
+ { params: this.compactParams(params) }
5573
5629
  );
5574
5630
  return response;
5575
5631
  }
@@ -5589,8 +5645,8 @@ var LiveInteractionService = class {
5589
5645
  */
5590
5646
  async getQuestionnaireResult(params) {
5591
5647
  const response = await this.client.httpClient.get(
5592
- "/live/v3/user/questionnaire/result",
5593
- { params }
5648
+ "/live/v3/channel/questionnaire/answer-records",
5649
+ { params: this.compactParams(params) }
5594
5650
  );
5595
5651
  return response;
5596
5652
  }
@@ -5612,8 +5668,8 @@ var LiveInteractionService = class {
5612
5668
  */
5613
5669
  async listQuestion(params) {
5614
5670
  const response = await this.client.httpClient.get(
5615
- "/live/v2/question/list",
5616
- { params }
5671
+ "/live/v3/channel/interact/question/list-question",
5672
+ { params: this.compactParams(params) }
5617
5673
  );
5618
5674
  return response;
5619
5675
  }
@@ -5632,8 +5688,8 @@ var LiveInteractionService = class {
5632
5688
  */
5633
5689
  async listQuestionSendTime(params) {
5634
5690
  const response = await this.client.httpClient.get(
5635
- "/live/v2/question/list_send_time",
5636
- { params }
5691
+ "/live/v3/channel/interact/question/list-send-time",
5692
+ { params: this.compactParams(params) }
5637
5693
  );
5638
5694
  return response;
5639
5695
  }
@@ -5656,10 +5712,21 @@ var LiveInteractionService = class {
5656
5712
  * ```
5657
5713
  */
5658
5714
  async addEditQuestion(params) {
5715
+ const { _type, option1_option15, tips1_tips5, ...rest } = params;
5716
+ const query = {
5717
+ ...rest,
5718
+ type: params.type ?? _type
5719
+ };
5720
+ option1_option15?.split(",").forEach((option, index) => {
5721
+ query[`option${index + 1}`] = option;
5722
+ });
5723
+ tips1_tips5?.split(",").forEach((tip, index) => {
5724
+ query[`tips${index + 1}`] = tip;
5725
+ });
5659
5726
  const response = await this.client.httpClient.post(
5660
- "/live/v2/question/add_edit",
5727
+ "/live/v3/channel/interact/question/add-edit-question",
5661
5728
  null,
5662
- { params }
5729
+ { params: this.compactParams(query) }
5663
5730
  );
5664
5731
  return response;
5665
5732
  }
@@ -5679,9 +5746,9 @@ var LiveInteractionService = class {
5679
5746
  */
5680
5747
  async deleteQuestion(params) {
5681
5748
  const response = await this.client.httpClient.post(
5682
- "/live/v2/question/delete",
5749
+ "/live/v3/channel/interact/question/delete-question",
5683
5750
  null,
5684
- { params }
5751
+ { params: this.compactParams(params) }
5685
5752
  );
5686
5753
  return response;
5687
5754
  }
@@ -5702,9 +5769,9 @@ var LiveInteractionService = class {
5702
5769
  */
5703
5770
  async sendQuestion(params) {
5704
5771
  const response = await this.client.httpClient.post(
5705
- "/live/v2/question/send",
5772
+ "/live/v4/channel/question/send",
5706
5773
  null,
5707
- { params }
5774
+ { params: this.compactParams(params) }
5708
5775
  );
5709
5776
  return response;
5710
5777
  }
@@ -5724,9 +5791,9 @@ var LiveInteractionService = class {
5724
5791
  */
5725
5792
  async stopQuestion(params) {
5726
5793
  const response = await this.client.httpClient.post(
5727
- "/live/v2/question/stop",
5794
+ "/live/v4/channel/question/stop",
5728
5795
  null,
5729
- { params }
5796
+ { params: this.compactParams(params) }
5730
5797
  );
5731
5798
  return response;
5732
5799
  }
@@ -5746,9 +5813,9 @@ var LiveInteractionService = class {
5746
5813
  */
5747
5814
  async sendQuestionResult(params) {
5748
5815
  const response = await this.client.httpClient.post(
5749
- "/live/v2/question/send_result",
5816
+ "/live/v4/channel/question/send-result",
5750
5817
  null,
5751
- { params }
5818
+ { params: this.compactParams(params) }
5752
5819
  );
5753
5820
  return response;
5754
5821
  }
@@ -5768,8 +5835,8 @@ var LiveInteractionService = class {
5768
5835
  */
5769
5836
  async getAnswerList(params) {
5770
5837
  const response = await this.client.httpClient.get(
5771
- "/live/v2/chat/getAnswerList",
5772
- { params }
5838
+ "/live/v3/channel/question/answer-records",
5839
+ { params: this.compactParams(params) }
5773
5840
  );
5774
5841
  return response;
5775
5842
  }
@@ -5792,9 +5859,12 @@ var LiveInteractionService = class {
5792
5859
  * ```
5793
5860
  */
5794
5861
  async listLottery(params) {
5862
+ this.validateRequiredChannelId(params.channelId);
5863
+ this.validateTimeRange(params);
5864
+ this.validatePageParams(params);
5795
5865
  const response = await this.client.httpClient.get(
5796
- "/live/v2/chat/list_lottery",
5797
- { params }
5866
+ "/live/v3/channel/lottery/list-lottery",
5867
+ { params: this.compactParams(params) }
5798
5868
  );
5799
5869
  return response;
5800
5870
  }
@@ -5814,9 +5884,12 @@ var LiveInteractionService = class {
5814
5884
  * ```
5815
5885
  */
5816
5886
  async listChannelsLottery(params) {
5887
+ this.validateRequiredString(params.channelIds, "channelIds");
5888
+ this.validateTimeRange(params);
5889
+ this.validatePageParams(params);
5817
5890
  const response = await this.client.httpClient.get(
5818
- "/live/v2/chat/list_channels_lottery",
5819
- { params }
5891
+ "/live/v3/channel/lottery/list-channels-lottery",
5892
+ { params: this.compactParams(params) }
5820
5893
  );
5821
5894
  return response;
5822
5895
  }
@@ -5838,8 +5911,8 @@ var LiveInteractionService = class {
5838
5911
  */
5839
5912
  async getWinnerDetail(params) {
5840
5913
  const response = await this.client.httpClient.get(
5841
- "/live/v2/chat/get_winner_detail",
5842
- { params }
5914
+ "/live/v3/channel/lottery/get-winner-detail",
5915
+ { params: this.compactParams(params) }
5843
5916
  );
5844
5917
  return response;
5845
5918
  }
@@ -5859,8 +5932,8 @@ var LiveInteractionService = class {
5859
5932
  */
5860
5933
  async downloadWinnerDetail(params) {
5861
5934
  const response = await this.client.httpClient.get(
5862
- "/live/v2/chat/download_winner_detail",
5863
- { params }
5935
+ "/live/v3/channel/lottery/download-winner-detail",
5936
+ { params: this.compactParams(params) }
5864
5937
  );
5865
5938
  return response;
5866
5939
  }
@@ -5883,12 +5956,7 @@ var LiveInteractionService = class {
5883
5956
  * ```
5884
5957
  */
5885
5958
  async addReceiveInfo(params) {
5886
- const response = await this.client.httpClient.post(
5887
- "/live/v2/chat/add_receive_info",
5888
- null,
5889
- { params }
5890
- );
5891
- return response;
5959
+ return this.addReceiveInfoV4(params);
5892
5960
  }
5893
5961
  /**
5894
5962
  * 提交中奖者填写的信息 (V4版本)
@@ -5909,9 +5977,9 @@ var LiveInteractionService = class {
5909
5977
  */
5910
5978
  async addReceiveInfoV4(params) {
5911
5979
  const response = await this.client.httpClient.post(
5912
- "/live/v4/chat/add_receive_info",
5980
+ "/live/v4/channel/lottery/add-receive-info",
5913
5981
  null,
5914
- { params }
5982
+ { params: this.compactParams(params) }
5915
5983
  );
5916
5984
  return response;
5917
5985
  }
@@ -5960,9 +6028,9 @@ var LiveInteractionService = class {
5960
6028
  */
5961
6029
  async sendRewardMsg(params) {
5962
6030
  const response = await this.client.httpClient.post(
5963
- "/live/v2/chat/send_reward_msg",
6031
+ "/live/v3/channel/chat/send-reward-msg",
5964
6032
  null,
5965
- { params }
6033
+ { params: this.compactParams(params) }
5966
6034
  );
5967
6035
  return response;
5968
6036
  }
@@ -5983,8 +6051,8 @@ var LiveInteractionService = class {
5983
6051
  */
5984
6052
  async getQuestionList(channelId, params) {
5985
6053
  const response = await this.client.httpClient.get(
5986
- `/live/v2/chat/${channelId}/get_question_list`,
5987
- { params }
6054
+ `/live/v2/chat/${encodeURIComponent(channelId)}/getQuestion`,
6055
+ { params: this.compactParams(params) }
5988
6056
  );
5989
6057
  return response;
5990
6058
  }
@@ -6001,6 +6069,21 @@ var AccountService = class {
6001
6069
  constructor(client) {
6002
6070
  this.client = client;
6003
6071
  }
6072
+ compactParams(params) {
6073
+ if (!params) return {};
6074
+ return Object.fromEntries(
6075
+ Object.entries(params).filter(([, value]) => value !== void 0 && value !== null)
6076
+ );
6077
+ }
6078
+ normalizeEnabled(enabled) {
6079
+ if (typeof enabled === "boolean") {
6080
+ return enabled ? "Y" : "N";
6081
+ }
6082
+ if (enabled !== "Y" && enabled !== "N") {
6083
+ throw new PolyVValidationError("enabled must be Y or N");
6084
+ }
6085
+ return enabled;
6086
+ }
6004
6087
  // ============================================
6005
6088
  // AC1: Category Management APIs
6006
6089
  // ============================================
@@ -6374,9 +6457,10 @@ var AccountService = class {
6374
6457
  * console.log(result.config);
6375
6458
  * ```
6376
6459
  */
6377
- async switchGet() {
6460
+ async switchGet(params) {
6378
6461
  const response = await this.client.httpClient.get(
6379
- "/live/v3/user/switch/get"
6462
+ "/live/v3/channel/switch/get",
6463
+ { params: this.compactParams(params) }
6380
6464
  );
6381
6465
  return response;
6382
6466
  }
@@ -6396,17 +6480,23 @@ var AccountService = class {
6396
6480
  * ```
6397
6481
  */
6398
6482
  async switchUpdate(params) {
6399
- if (!params.param) {
6400
- throw new PolyVValidationError("param is required");
6483
+ const type = params.type ?? params.param;
6484
+ if (!type) {
6485
+ throw new PolyVValidationError("type is required");
6401
6486
  }
6402
6487
  if (params.enabled === void 0 || params.enabled === null) {
6403
6488
  throw new PolyVValidationError("enabled is required");
6404
6489
  }
6405
- const enabledValue = typeof params.enabled === "boolean" ? params.enabled ? "Y" : "N" : params.enabled;
6406
6490
  const response = await this.client.httpClient.post(
6407
- "/live/v3/user/switch/update",
6491
+ "/live/v3/channel/switch/update",
6408
6492
  null,
6409
- { params: { param: params.param, enabled: enabledValue } }
6493
+ {
6494
+ params: this.compactParams({
6495
+ channelId: params.channelId,
6496
+ type,
6497
+ enabled: this.normalizeEnabled(params.enabled)
6498
+ })
6499
+ }
6410
6500
  );
6411
6501
  return { success: response };
6412
6502
  }
@@ -11348,11 +11438,29 @@ var V4ChannelService = class {
11348
11438
  * @param params - Update parameters
11349
11439
  */
11350
11440
  async updateDonate(params) {
11441
+ await this.updateDonateGift({
11442
+ channelId: params.channelId,
11443
+ donateGiftEnabled: params.donateGiftEnabled ?? params.donateEnabled ?? "Y",
11444
+ ...params.giftDonate ? { giftDonate: params.giftDonate } : {}
11445
+ });
11446
+ }
11447
+ /**
11448
+ * Update channel gift donate settings.
11449
+ *
11450
+ * @param params - Update parameters
11451
+ * @returns Donate settings
11452
+ */
11453
+ async updateDonateGift(params) {
11351
11454
  this.validateChannelId(params.channelId);
11352
- await this.client.httpClient.post(
11353
- "/live/v4/channel/donate/update",
11354
- params
11455
+ this.validateRequiredString(params.donateGiftEnabled, "donateGiftEnabled");
11456
+ this.validateOptionalYn(params.donateGiftEnabled, "donateGiftEnabled");
11457
+ const { channelId, ...body } = params;
11458
+ const response = await this.client.httpClient.post(
11459
+ "/live/v4/channel/donate/gift/update",
11460
+ body,
11461
+ { params: { channelId } }
11355
11462
  );
11463
+ return response;
11356
11464
  }
11357
11465
  // ============================================
11358
11466
  // AC6: Distribute APIs (7 APIs)
@@ -11486,10 +11594,12 @@ var V4ChannelService = class {
11486
11594
  * @returns Activity ID
11487
11595
  */
11488
11596
  async lotteryActivityCreate(params) {
11489
- this.validateChannelId(params.channelId);
11597
+ this.validateLotteryActivityBody(params);
11598
+ const { channelId, ...body } = params;
11490
11599
  const response = await this.client.httpClient.post(
11491
- "/live/v4/channel/lottery-activity/lottery-activity-create",
11492
- params
11600
+ "/live/v4/channel/lottery-activity/create",
11601
+ body,
11602
+ { params: { channelId } }
11493
11603
  );
11494
11604
  return response;
11495
11605
  }
@@ -11502,7 +11612,7 @@ var V4ChannelService = class {
11502
11612
  async lotteryActivityGet(params) {
11503
11613
  this.validateChannelId(params.channelId);
11504
11614
  const response = await this.client.httpClient.get(
11505
- "/live/v4/channel/lottery-activity/lottery-activity-get",
11615
+ "/live/v4/channel/lottery-activity/get",
11506
11616
  { params }
11507
11617
  );
11508
11618
  return response;
@@ -11517,7 +11627,7 @@ var V4ChannelService = class {
11517
11627
  this.validateChannelId(params.channelId);
11518
11628
  this.validatePaginationParams(params);
11519
11629
  const response = await this.client.httpClient.get(
11520
- "/live/v4/channel/lottery-activity/lottery-activity-list",
11630
+ "/live/v4/channel/lottery-activity/list",
11521
11631
  { params }
11522
11632
  );
11523
11633
  return response;
@@ -11528,10 +11638,13 @@ var V4ChannelService = class {
11528
11638
  * @param params - Update parameters
11529
11639
  */
11530
11640
  async lotteryActivityUpdate(params) {
11531
- this.validateChannelId(params.channelId);
11641
+ this.validateLotteryActivityBody(params);
11642
+ this.validateRequiredId(params.id, "id");
11643
+ const { channelId, ...body } = params;
11532
11644
  await this.client.httpClient.post(
11533
- "/live/v4/channel/lottery-activity/lottery-activity-update",
11534
- params
11645
+ "/live/v4/channel/lottery-activity/update",
11646
+ body,
11647
+ { params: { channelId } }
11535
11648
  );
11536
11649
  }
11537
11650
  /**
@@ -11541,10 +11654,12 @@ var V4ChannelService = class {
11541
11654
  */
11542
11655
  async lotteryActivityDelete(params) {
11543
11656
  this.validateChannelId(params.channelId);
11657
+ this.validateRequiredId(params.id, "id");
11658
+ const { channelId, ...body } = params;
11544
11659
  await this.client.httpClient.post(
11545
- "/live/v4/channel/lottery-activity/lottery-activity-delete",
11546
- null,
11547
- { params }
11660
+ "/live/v4/channel/lottery-activity/delete",
11661
+ body,
11662
+ { params: { channelId } }
11548
11663
  );
11549
11664
  }
11550
11665
  /**
@@ -11784,7 +11899,7 @@ var V4ChannelService = class {
11784
11899
  async shareGet(params) {
11785
11900
  this.validateChannelId(params.channelId);
11786
11901
  const response = await this.client.httpClient.get(
11787
- "/live/v4/channel/market/share/get",
11902
+ "/live/v4/channel/share/get",
11788
11903
  { params }
11789
11904
  );
11790
11905
  return response;
@@ -11796,10 +11911,16 @@ var V4ChannelService = class {
11796
11911
  */
11797
11912
  async shareUpdate(params) {
11798
11913
  this.validateChannelId(params.channelId);
11799
- await this.client.httpClient.post(
11800
- "/live/v4/channel/market/share/update",
11801
- params
11914
+ this.validateRequiredString(params.shareBtnEnable, "shareBtnEnable");
11915
+ this.validateOptionalYn(params.shareBtnEnable, "shareBtnEnable");
11916
+ this.validateRequiredString(params.titleType, "titleType");
11917
+ this.validateOptionalYn(params.weixinShareCustomUrlWithParamEnabled, "weixinShareCustomUrlWithParamEnabled");
11918
+ this.validateOptionalYn(params.webShareCustomUrlWithParamEnabled, "webShareCustomUrlWithParamEnabled");
11919
+ const response = await this.client.httpClient.get(
11920
+ "/live/v4/channel/share/update",
11921
+ { params }
11802
11922
  );
11923
+ return response;
11803
11924
  }
11804
11925
  /**
11805
11926
  * Create card push
@@ -11808,23 +11929,9 @@ var V4ChannelService = class {
11808
11929
  * @returns Card ID
11809
11930
  */
11810
11931
  async cardPushCreate(params) {
11811
- this.validateChannelId(params.channelId);
11812
- const response = await this.client.httpClient.post(
11813
- "/live/v4/channel/market/cardPush/create",
11814
- params
11815
- );
11816
- return response;
11817
- }
11818
- /**
11819
- * Get card push
11820
- *
11821
- * @param params - Query parameters
11822
- * @returns Card push info
11823
- */
11824
- async cardPushGet(params) {
11825
- this.validateChannelId(params.channelId);
11932
+ this.validateCardPushCreateParams(params);
11826
11933
  const response = await this.client.httpClient.get(
11827
- "/live/v4/channel/market/cardPush/get",
11934
+ "/live/v4/channel/card-push/create",
11828
11935
  { params }
11829
11936
  );
11830
11937
  return response;
@@ -11835,10 +11942,13 @@ var V4ChannelService = class {
11835
11942
  * @param params - Update parameters
11836
11943
  */
11837
11944
  async cardPushUpdate(params) {
11838
- this.validateChannelId(params.channelId);
11945
+ this.validateCardPushIdParams(params);
11946
+ this.validateCardPushOptionalParams(params);
11947
+ const { channelId, cardPushId, ...body } = params;
11839
11948
  await this.client.httpClient.post(
11840
- "/live/v4/channel/market/cardPush/update",
11841
- params
11949
+ "/live/v4/channel/card-push/update",
11950
+ body,
11951
+ { params: { channelId, cardPushId } }
11842
11952
  );
11843
11953
  }
11844
11954
  /**
@@ -11847,9 +11957,9 @@ var V4ChannelService = class {
11847
11957
  * @param params - Delete parameters
11848
11958
  */
11849
11959
  async cardPushDelete(params) {
11850
- this.validateChannelId(params.channelId);
11960
+ this.validateCardPushIdParams(params);
11851
11961
  await this.client.httpClient.post(
11852
- "/live/v4/channel/market/cardPush/delete",
11962
+ "/live/v4/channel/card-push/delete",
11853
11963
  null,
11854
11964
  { params }
11855
11965
  );
@@ -11860,9 +11970,9 @@ var V4ChannelService = class {
11860
11970
  * @param params - Push parameters
11861
11971
  */
11862
11972
  async cardPushPush(params) {
11863
- this.validateChannelId(params.channelId);
11973
+ this.validateCardPushIdParams(params);
11864
11974
  await this.client.httpClient.post(
11865
- "/live/v4/channel/market/cardPush/push",
11975
+ "/live/v4/channel/card-push/push",
11866
11976
  null,
11867
11977
  { params }
11868
11978
  );
@@ -11873,9 +11983,9 @@ var V4ChannelService = class {
11873
11983
  * @param params - Cancel parameters
11874
11984
  */
11875
11985
  async cardPushCancelPush(params) {
11876
- this.validateChannelId(params.channelId);
11986
+ this.validateCardPushIdParams(params);
11877
11987
  await this.client.httpClient.post(
11878
- "/live/v4/channel/market/cardPush/cancelPush",
11988
+ "/live/v4/channel/card-push/cancel-push",
11879
11989
  null,
11880
11990
  { params }
11881
11991
  );
@@ -12046,9 +12156,12 @@ var V4ChannelService = class {
12046
12156
  */
12047
12157
  async productTagCreate(params) {
12048
12158
  this.validateChannelId(params.channelId);
12159
+ this.validateRequiredString(params.name, "name");
12160
+ const { channelId, ...body } = params;
12049
12161
  const response = await this.client.httpClient.post(
12050
- "/live/v4/channel/product-tag/product-tag-create",
12051
- params
12162
+ "/live/v4/channel/product/tag/create",
12163
+ body,
12164
+ { params: { channelId } }
12052
12165
  );
12053
12166
  return response;
12054
12167
  }
@@ -12074,8 +12187,9 @@ var V4ChannelService = class {
12074
12187
  */
12075
12188
  async productTagList(params) {
12076
12189
  this.validateChannelId(params.channelId);
12190
+ this.validateOptionalPaginationParams(params);
12077
12191
  const response = await this.client.httpClient.get(
12078
- "/live/v4/channel/product-tag/product-tag-list",
12192
+ "/live/v4/channel/product/tag/list",
12079
12193
  { params }
12080
12194
  );
12081
12195
  return response;
@@ -12087,9 +12201,13 @@ var V4ChannelService = class {
12087
12201
  */
12088
12202
  async productTagUpdate(params) {
12089
12203
  this.validateChannelId(params.channelId);
12204
+ this.validateRequiredId(params.id, "id");
12205
+ this.validateRequiredString(params.name, "name");
12206
+ const { channelId, ...body } = params;
12090
12207
  await this.client.httpClient.post(
12091
- "/live/v4/channel/product-tag/product-tag-update",
12092
- params
12208
+ "/live/v4/channel/product/tag/update",
12209
+ body,
12210
+ { params: { channelId } }
12093
12211
  );
12094
12212
  }
12095
12213
  /**
@@ -12099,10 +12217,12 @@ var V4ChannelService = class {
12099
12217
  */
12100
12218
  async productTagDelete(params) {
12101
12219
  this.validateChannelId(params.channelId);
12220
+ this.validateRequiredId(params.id, "id");
12221
+ const { channelId, ...body } = params;
12102
12222
  await this.client.httpClient.post(
12103
- "/live/v4/channel/product-tag/product-tag-delete",
12104
- null,
12105
- { params }
12223
+ "/live/v4/channel/product/tag/delete",
12224
+ body,
12225
+ { params: { channelId } }
12106
12226
  );
12107
12227
  }
12108
12228
  /**
@@ -12135,6 +12255,38 @@ var V4ChannelService = class {
12135
12255
  );
12136
12256
  return response;
12137
12257
  }
12258
+ /**
12259
+ * List gift reward records.
12260
+ *
12261
+ * @param params - Query parameters
12262
+ * @returns Gift reward records
12263
+ */
12264
+ async listRewardGifts(params) {
12265
+ this.validateChannelId(params.channelId);
12266
+ this.validateRequiredNumber(params.start, "start");
12267
+ this.validateRequiredNumber(params.end, "end");
12268
+ this.validateOptionalPaginationParams(params);
12269
+ const response = await this.client.httpClient.get(
12270
+ "/live/v4/channel/reward/gift-list",
12271
+ { params }
12272
+ );
12273
+ return response;
12274
+ }
12275
+ /**
12276
+ * List like reward records.
12277
+ *
12278
+ * @param params - Query parameters
12279
+ * @returns Like reward records
12280
+ */
12281
+ async listRewardLikes(params) {
12282
+ this.validateChannelId(params.channelId);
12283
+ this.validateOptionalPaginationParams(params);
12284
+ const response = await this.client.httpClient.get(
12285
+ "/live/v4/channel/reward/like-list",
12286
+ { params }
12287
+ );
12288
+ return response;
12289
+ }
12138
12290
  // ============================================
12139
12291
  // AC11: Task Reward APIs (10 APIs)
12140
12292
  // ============================================
@@ -12418,8 +12570,93 @@ var V4ChannelService = class {
12418
12570
  return response;
12419
12571
  }
12420
12572
  // ============================================
12573
+ // V4 Channel Marketing & Content API Paths
12574
+ // ============================================
12575
+ /**
12576
+ * List channel card pushes.
12577
+ */
12578
+ async listCardPushes(params) {
12579
+ this.validateChannelId(params.channelId);
12580
+ const response = await this.client.httpClient.get(
12581
+ "/live/v4/channel/card-push/list",
12582
+ { params }
12583
+ );
12584
+ return response;
12585
+ }
12586
+ // ============================================
12421
12587
  // Private Validation Helpers
12422
12588
  // ============================================
12589
+ validateRequiredString(value, field) {
12590
+ if (!value || value.trim() === "") {
12591
+ throw new PolyVValidationError(`${field} is required and cannot be empty`, field);
12592
+ }
12593
+ }
12594
+ validateOptionalYn(value, field) {
12595
+ if (value !== void 0 && value !== "Y" && value !== "N") {
12596
+ throw new PolyVValidationError(`${field} must be Y or N`, field, value);
12597
+ }
12598
+ }
12599
+ validateRequiredId(value, field) {
12600
+ if (typeof value === "string") {
12601
+ this.validateRequiredString(value, field);
12602
+ return;
12603
+ }
12604
+ if (typeof value === "number") {
12605
+ if (!Number.isFinite(value) || value <= 0) {
12606
+ throw new PolyVValidationError(`${field} must be a positive number`, field, value);
12607
+ }
12608
+ return;
12609
+ }
12610
+ throw new PolyVValidationError(`${field} is required`, field);
12611
+ }
12612
+ validateRequiredNumber(value, field) {
12613
+ if (typeof value !== "number" || !Number.isFinite(value)) {
12614
+ throw new PolyVValidationError(`${field} is required and must be a number`, field, value);
12615
+ }
12616
+ }
12617
+ validateLotteryActivityBody(params) {
12618
+ this.validateChannelId(params.channelId);
12619
+ this.validateRequiredString(params.activityName, "activityName");
12620
+ this.validateRequiredString(params.lotteryCondition, "lotteryCondition");
12621
+ this.validateRequiredNumber(params.amount, "amount");
12622
+ if (params.amount < 1) {
12623
+ throw new PolyVValidationError("amount must be >= 1", "amount", params.amount);
12624
+ }
12625
+ this.validateRequiredString(params.prizeName, "prizeName");
12626
+ this.validateOptionalYn(params.hiddenWinnerAmount, "hiddenWinnerAmount");
12627
+ this.validateOptionalYn(params.hiddenAttendeeNumber, "hiddenAttendeeNumber");
12628
+ this.validateOptionalYn(params.repeatWinEnabled, "repeatWinEnabled");
12629
+ this.validateOptionalYn(params.receiveEnabled, "receiveEnabled");
12630
+ this.validateOptionalYn(params.lotteryOnlineEnabled, "lotteryOnlineEnabled");
12631
+ this.validateOptionalYn(params.showWinnerCode, "showWinnerCode");
12632
+ this.validateOptionalYn(params.showWinners, "showWinners");
12633
+ }
12634
+ validateCardPushCreateParams(params) {
12635
+ this.validateChannelId(params.channelId);
12636
+ this.validateRequiredString(params.imageType, "imageType");
12637
+ this.validateRequiredString(params.title, "title");
12638
+ if (params.title.length > 16) {
12639
+ throw new PolyVValidationError("title cannot exceed 16 characters", "title", params.title);
12640
+ }
12641
+ this.validateRequiredString(params.link, "link");
12642
+ this.validateRequiredNumber(params.duration, "duration");
12643
+ this.validateRequiredString(params.showCondition, "showCondition");
12644
+ this.validateCardPushOptionalParams(params);
12645
+ }
12646
+ validateCardPushIdParams(params) {
12647
+ this.validateChannelId(params.channelId);
12648
+ this.validateRequiredId(params.cardPushId, "cardPushId");
12649
+ }
12650
+ validateCardPushOptionalParams(params) {
12651
+ this.validateOptionalYn(params.enterEnabled, "enterEnabled");
12652
+ this.validateOptionalYn(params.linkEnabled, "linkEnabled");
12653
+ if (params.countdownMsg !== void 0 && params.countdownMsg.length > 8) {
12654
+ throw new PolyVValidationError("countdownMsg cannot exceed 8 characters", "countdownMsg", params.countdownMsg);
12655
+ }
12656
+ if (params.duration !== void 0 && ![0, 5, 10, 20, 30].includes(params.duration)) {
12657
+ throw new PolyVValidationError("duration must be one of 0, 5, 10, 20, or 30", "duration", params.duration);
12658
+ }
12659
+ }
12423
12660
  /**
12424
12661
  * Validate channel ID
12425
12662
  */
@@ -12496,6 +12733,15 @@ var V4ChannelService = class {
12496
12733
  throw new PolyVValidationError("pageSize must be between 1 and 1000", "pageSize", params.pageSize);
12497
12734
  }
12498
12735
  }
12736
+ validateOptionalPaginationParams(params) {
12737
+ const pageNumber = params.pageNumber ?? params.page;
12738
+ if (pageNumber !== void 0 && pageNumber < 1) {
12739
+ throw new PolyVValidationError("pageNumber must be >= 1", "pageNumber", pageNumber);
12740
+ }
12741
+ if (params.pageSize !== void 0 && (params.pageSize < 1 || params.pageSize > 1e3)) {
12742
+ throw new PolyVValidationError("pageSize must be between 1 and 1000", "pageSize", params.pageSize);
12743
+ }
12744
+ }
12499
12745
  };
12500
12746
 
12501
12747
  // src/services/v4/chat.service.ts
@@ -14096,7 +14342,7 @@ var V4UserService = class {
14096
14342
  */
14097
14343
  async getCallback() {
14098
14344
  const response = await this.client.httpClient.get(
14099
- "/live/v4/user/callback/get",
14345
+ "/live/v4/user/global-setting/callback/get",
14100
14346
  {}
14101
14347
  );
14102
14348
  return response;
@@ -14115,9 +14361,15 @@ var V4UserService = class {
14115
14361
  * ```
14116
14362
  */
14117
14363
  async updateCallback(params) {
14364
+ const { url, enabled, ...rest } = params;
14365
+ const body = {
14366
+ ...rest,
14367
+ ...url !== void 0 ? { streamCallbackUrl: url } : {},
14368
+ ...enabled !== void 0 ? { rebirthVodCallbackEnabled: enabled ? "Y" : "N" } : {}
14369
+ };
14118
14370
  await this.client.httpClient.post(
14119
- "/live/v4/user/callback/update",
14120
- params
14371
+ "/live/v4/user/global-setting/callback/update",
14372
+ body
14121
14373
  );
14122
14374
  }
14123
14375
  /**