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.js CHANGED
@@ -7619,7 +7619,8 @@ var WebService = class {
7619
7619
  * ```typescript
7620
7620
  * const result = await client.web.updateWhiteList({
7621
7621
  * rank: 1,
7622
- * code: '13800138000',
7622
+ * oldCode: '13800138000',
7623
+ * code: '13900139000',
7623
7624
  * name: 'Updated Name',
7624
7625
  * channelId: '123456',
7625
7626
  * });
@@ -7629,6 +7630,9 @@ var WebService = class {
7629
7630
  if (params.rank !== 1 && params.rank !== 2) {
7630
7631
  throw new PolyVValidationError("rank must be 1 or 2");
7631
7632
  }
7633
+ if (!params.oldCode || params.oldCode.trim() === "") {
7634
+ throw new PolyVValidationError("oldCode is required");
7635
+ }
7632
7636
  if (!params.code || params.code.trim() === "") {
7633
7637
  throw new PolyVValidationError("code is required");
7634
7638
  }
@@ -7640,6 +7644,7 @@ var WebService = class {
7640
7644
  }
7641
7645
  const apiParams = {
7642
7646
  rank: params.rank,
7647
+ oldCode: params.oldCode,
7643
7648
  code: params.code
7644
7649
  };
7645
7650
  if (params.name) {
@@ -7664,24 +7669,39 @@ var WebService = class {
7664
7669
  *
7665
7670
  * @example
7666
7671
  * ```typescript
7672
+ * // Delete specific codes
7667
7673
  * const result = await client.web.deleteWhiteList({
7668
7674
  * rank: 1,
7675
+ * isClear: 'N',
7669
7676
  * codes: '13800138000,13800138001',
7670
7677
  * channelId: '123456',
7671
7678
  * });
7679
+ *
7680
+ * // Clear all
7681
+ * const result = await client.web.deleteWhiteList({
7682
+ * rank: 1,
7683
+ * isClear: 'Y',
7684
+ * channelId: '123456',
7685
+ * });
7672
7686
  * ```
7673
7687
  */
7674
7688
  async deleteWhiteList(params) {
7675
7689
  if (params.rank !== 1 && params.rank !== 2) {
7676
7690
  throw new PolyVValidationError("rank must be 1 or 2");
7677
7691
  }
7678
- if (!params.codes || params.codes.trim() === "") {
7679
- throw new PolyVValidationError("codes is required");
7692
+ if (!params.isClear) {
7693
+ throw new PolyVValidationError("isClear is required");
7694
+ }
7695
+ if (params.isClear === "N" && (!params.codes || params.codes.trim() === "")) {
7696
+ throw new PolyVValidationError("codes is required when isClear=N");
7680
7697
  }
7681
7698
  const apiParams = {
7682
7699
  rank: params.rank,
7683
- codes: params.codes
7700
+ isClear: params.isClear
7684
7701
  };
7702
+ if (params.codes) {
7703
+ apiParams.code = params.codes;
7704
+ }
7685
7705
  if (params.channelId) {
7686
7706
  apiParams.channelId = params.channelId;
7687
7707
  }
@@ -13119,7 +13139,7 @@ var V4UserService = class {
13119
13139
  */
13120
13140
  async listViewerLabels() {
13121
13141
  const response = await this.client.httpClient.get(
13122
- "/live/v4/user/viewer-record/label/list",
13142
+ "/live/v4/user/viewer-label/list",
13123
13143
  {}
13124
13144
  );
13125
13145
  return response;
@@ -13199,8 +13219,11 @@ var V4UserService = class {
13199
13219
  this.validateRequiredString(params.viewerUnionId, "viewerUnionId");
13200
13220
  this.validateRequiredNumber(params.labelId, "labelId");
13201
13221
  await this.client.httpClient.post(
13202
- "/live/v4/user/viewer-record/label/add",
13203
- params
13222
+ "/live/v4/user/viewer-label/add-viewers-label",
13223
+ {
13224
+ viewerUnionIds: [params.viewerUnionId],
13225
+ labelIds: [params.labelId]
13226
+ }
13204
13227
  );
13205
13228
  }
13206
13229
  /**
@@ -13220,8 +13243,11 @@ var V4UserService = class {
13220
13243
  this.validateRequiredString(params.viewerUnionId, "viewerUnionId");
13221
13244
  this.validateRequiredNumber(params.labelId, "labelId");
13222
13245
  await this.client.httpClient.post(
13223
- "/live/v4/user/viewer-record/label/delete-ref",
13224
- params
13246
+ "/live/v4/user/viewer-label/remove-viewers-label",
13247
+ {
13248
+ viewerUnionIds: [params.viewerUnionId],
13249
+ labelIds: [params.labelId]
13250
+ }
13225
13251
  );
13226
13252
  }
13227
13253
  // ============================================
@@ -14235,6 +14261,47 @@ var V4UserService = class {
14235
14261
  return response;
14236
14262
  }
14237
14263
  // ============================================
14264
+ // Story 13-3: Global Channel Settings APIs
14265
+ // ============================================
14266
+ /**
14267
+ * Get global channel settings
14268
+ *
14269
+ * @returns Global channel settings
14270
+ *
14271
+ * @example
14272
+ * ```typescript
14273
+ * const settings = await client.v4User.getGlobalChannelSettings();
14274
+ * ```
14275
+ */
14276
+ async getGlobalChannelSettings() {
14277
+ const response = await this.client.httpClient.get(
14278
+ "/live/v4/user/global-setting/switch/get",
14279
+ {}
14280
+ );
14281
+ return response;
14282
+ }
14283
+ /**
14284
+ * Update global channel settings
14285
+ *
14286
+ * @param params - Update parameters
14287
+ *
14288
+ * @example
14289
+ * ```typescript
14290
+ * await client.v4User.updateGlobalChannelSettings({
14291
+ * channelConcurrencesEnabled: 'Y',
14292
+ * donateEnabled: 'N',
14293
+ * coverImgType: 'contain',
14294
+ * });
14295
+ * ```
14296
+ */
14297
+ async updateGlobalChannelSettings(params) {
14298
+ this.validateGlobalSettingsParams(params);
14299
+ await this.client.httpClient.post(
14300
+ "/live/v4/user/global-setting/switch/update",
14301
+ params
14302
+ );
14303
+ }
14304
+ // ============================================
14238
14305
  // Private Validation Helpers
14239
14306
  // ============================================
14240
14307
  /**
@@ -14264,6 +14331,31 @@ var V4UserService = class {
14264
14331
  throw new PolyVValidationError(`${fieldName} is required`, fieldName, value);
14265
14332
  }
14266
14333
  }
14334
+ /**
14335
+ * Validate global settings update parameters
14336
+ */
14337
+ validateGlobalSettingsParams(params) {
14338
+ const booleanFields = [
14339
+ "channelConcurrencesEnabled",
14340
+ "timelyConvertEnabled",
14341
+ "donateEnabled",
14342
+ "rebirthAutoUploadEnabled",
14343
+ "rebirthAutoConvertEnabled",
14344
+ "pptCoveredEnabled",
14345
+ "testModeButtonEnabled"
14346
+ ];
14347
+ for (const field of booleanFields) {
14348
+ const value = params[field];
14349
+ if (value !== void 0 && value !== "Y" && value !== "N") {
14350
+ throw new PolyVValidationError(`${field} must be 'Y' or 'N'`, field, value);
14351
+ }
14352
+ }
14353
+ if (params.coverImgType !== void 0) {
14354
+ if (params.coverImgType !== "contain" && params.coverImgType !== "cover") {
14355
+ throw new PolyVValidationError("coverImgType must be 'contain' or 'cover'", "coverImgType", params.coverImgType);
14356
+ }
14357
+ }
14358
+ }
14267
14359
  };
14268
14360
 
14269
14361
  // src/services/v4/global.service.ts