polyv-live-api-sdk 1.0.3 → 1.0.5

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
@@ -7626,7 +7626,8 @@ var WebService = class {
7626
7626
  * ```typescript
7627
7627
  * const result = await client.web.updateWhiteList({
7628
7628
  * rank: 1,
7629
- * code: '13800138000',
7629
+ * oldCode: '13800138000',
7630
+ * code: '13900139000',
7630
7631
  * name: 'Updated Name',
7631
7632
  * channelId: '123456',
7632
7633
  * });
@@ -7636,6 +7637,9 @@ var WebService = class {
7636
7637
  if (params.rank !== 1 && params.rank !== 2) {
7637
7638
  throw new PolyVValidationError("rank must be 1 or 2");
7638
7639
  }
7640
+ if (!params.oldCode || params.oldCode.trim() === "") {
7641
+ throw new PolyVValidationError("oldCode is required");
7642
+ }
7639
7643
  if (!params.code || params.code.trim() === "") {
7640
7644
  throw new PolyVValidationError("code is required");
7641
7645
  }
@@ -7647,6 +7651,7 @@ var WebService = class {
7647
7651
  }
7648
7652
  const apiParams = {
7649
7653
  rank: params.rank,
7654
+ oldCode: params.oldCode,
7650
7655
  code: params.code
7651
7656
  };
7652
7657
  if (params.name) {
@@ -7671,24 +7676,39 @@ var WebService = class {
7671
7676
  *
7672
7677
  * @example
7673
7678
  * ```typescript
7679
+ * // Delete specific codes
7674
7680
  * const result = await client.web.deleteWhiteList({
7675
7681
  * rank: 1,
7682
+ * isClear: 'N',
7676
7683
  * codes: '13800138000,13800138001',
7677
7684
  * channelId: '123456',
7678
7685
  * });
7686
+ *
7687
+ * // Clear all
7688
+ * const result = await client.web.deleteWhiteList({
7689
+ * rank: 1,
7690
+ * isClear: 'Y',
7691
+ * channelId: '123456',
7692
+ * });
7679
7693
  * ```
7680
7694
  */
7681
7695
  async deleteWhiteList(params) {
7682
7696
  if (params.rank !== 1 && params.rank !== 2) {
7683
7697
  throw new PolyVValidationError("rank must be 1 or 2");
7684
7698
  }
7685
- if (!params.codes || params.codes.trim() === "") {
7686
- throw new PolyVValidationError("codes is required");
7699
+ if (!params.isClear) {
7700
+ throw new PolyVValidationError("isClear is required");
7701
+ }
7702
+ if (params.isClear === "N" && (!params.codes || params.codes.trim() === "")) {
7703
+ throw new PolyVValidationError("codes is required when isClear=N");
7687
7704
  }
7688
7705
  const apiParams = {
7689
7706
  rank: params.rank,
7690
- codes: params.codes
7707
+ isClear: params.isClear
7691
7708
  };
7709
+ if (params.codes) {
7710
+ apiParams.code = params.codes;
7711
+ }
7692
7712
  if (params.channelId) {
7693
7713
  apiParams.channelId = params.channelId;
7694
7714
  }
@@ -13126,7 +13146,7 @@ var V4UserService = class {
13126
13146
  */
13127
13147
  async listViewerLabels() {
13128
13148
  const response = await this.client.httpClient.get(
13129
- "/live/v4/user/viewer-record/label/list",
13149
+ "/live/v4/user/viewer-label/list",
13130
13150
  {}
13131
13151
  );
13132
13152
  return response;
@@ -13206,8 +13226,11 @@ var V4UserService = class {
13206
13226
  this.validateRequiredString(params.viewerUnionId, "viewerUnionId");
13207
13227
  this.validateRequiredNumber(params.labelId, "labelId");
13208
13228
  await this.client.httpClient.post(
13209
- "/live/v4/user/viewer-record/label/add",
13210
- params
13229
+ "/live/v4/user/viewer-label/add-viewers-label",
13230
+ {
13231
+ viewerUnionIds: [params.viewerUnionId],
13232
+ labelIds: [params.labelId]
13233
+ }
13211
13234
  );
13212
13235
  }
13213
13236
  /**
@@ -13227,8 +13250,11 @@ var V4UserService = class {
13227
13250
  this.validateRequiredString(params.viewerUnionId, "viewerUnionId");
13228
13251
  this.validateRequiredNumber(params.labelId, "labelId");
13229
13252
  await this.client.httpClient.post(
13230
- "/live/v4/user/viewer-record/label/delete-ref",
13231
- params
13253
+ "/live/v4/user/viewer-label/remove-viewers-label",
13254
+ {
13255
+ viewerUnionIds: [params.viewerUnionId],
13256
+ labelIds: [params.labelId]
13257
+ }
13232
13258
  );
13233
13259
  }
13234
13260
  // ============================================
@@ -14242,6 +14268,47 @@ var V4UserService = class {
14242
14268
  return response;
14243
14269
  }
14244
14270
  // ============================================
14271
+ // Story 13-3: Global Channel Settings APIs
14272
+ // ============================================
14273
+ /**
14274
+ * Get global channel settings
14275
+ *
14276
+ * @returns Global channel settings
14277
+ *
14278
+ * @example
14279
+ * ```typescript
14280
+ * const settings = await client.v4User.getGlobalChannelSettings();
14281
+ * ```
14282
+ */
14283
+ async getGlobalChannelSettings() {
14284
+ const response = await this.client.httpClient.get(
14285
+ "/live/v4/user/global-setting/switch/get",
14286
+ {}
14287
+ );
14288
+ return response;
14289
+ }
14290
+ /**
14291
+ * Update global channel settings
14292
+ *
14293
+ * @param params - Update parameters
14294
+ *
14295
+ * @example
14296
+ * ```typescript
14297
+ * await client.v4User.updateGlobalChannelSettings({
14298
+ * channelConcurrencesEnabled: 'Y',
14299
+ * donateEnabled: 'N',
14300
+ * coverImgType: 'contain',
14301
+ * });
14302
+ * ```
14303
+ */
14304
+ async updateGlobalChannelSettings(params) {
14305
+ this.validateGlobalSettingsParams(params);
14306
+ await this.client.httpClient.post(
14307
+ "/live/v4/user/global-setting/switch/update",
14308
+ params
14309
+ );
14310
+ }
14311
+ // ============================================
14245
14312
  // Private Validation Helpers
14246
14313
  // ============================================
14247
14314
  /**
@@ -14271,6 +14338,31 @@ var V4UserService = class {
14271
14338
  throw new PolyVValidationError(`${fieldName} is required`, fieldName, value);
14272
14339
  }
14273
14340
  }
14341
+ /**
14342
+ * Validate global settings update parameters
14343
+ */
14344
+ validateGlobalSettingsParams(params) {
14345
+ const booleanFields = [
14346
+ "channelConcurrencesEnabled",
14347
+ "timelyConvertEnabled",
14348
+ "donateEnabled",
14349
+ "rebirthAutoUploadEnabled",
14350
+ "rebirthAutoConvertEnabled",
14351
+ "pptCoveredEnabled",
14352
+ "testModeButtonEnabled"
14353
+ ];
14354
+ for (const field of booleanFields) {
14355
+ const value = params[field];
14356
+ if (value !== void 0 && value !== "Y" && value !== "N") {
14357
+ throw new PolyVValidationError(`${field} must be 'Y' or 'N'`, field, value);
14358
+ }
14359
+ }
14360
+ if (params.coverImgType !== void 0) {
14361
+ if (params.coverImgType !== "contain" && params.coverImgType !== "cover") {
14362
+ throw new PolyVValidationError("coverImgType must be 'contain' or 'cover'", "coverImgType", params.coverImgType);
14363
+ }
14364
+ }
14365
+ }
14274
14366
  };
14275
14367
 
14276
14368
  // src/services/v4/global.service.ts