polyv-live-api-sdk 1.0.8 → 1.0.10

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
@@ -4356,6 +4356,74 @@ var ChannelService = class {
4356
4356
  );
4357
4357
  return response;
4358
4358
  }
4359
+ /**
4360
+ * Update channel product library enabled status
4361
+ *
4362
+ * Toggles the channel product library on or off.
4363
+ * All params (channelId, enabled, appId, timestamp) participate in signature.
4364
+ *
4365
+ * @param params - Parameters including channelId and enabled (Y/N)
4366
+ * @returns true if update was successful
4367
+ * @throws PolyVValidationError if required parameters are missing
4368
+ *
4369
+ * @example
4370
+ * ```typescript
4371
+ * await channelService.updateChannelProductEnabled({
4372
+ * channelId: 'ch123456',
4373
+ * enabled: 'Y',
4374
+ * });
4375
+ * ```
4376
+ */
4377
+ async updateChannelProductEnabled(params) {
4378
+ if (!params.channelId || params.channelId.trim() === "") {
4379
+ throw PolyVValidationError.required("channelId");
4380
+ }
4381
+ if (!params.enabled || params.enabled !== "Y" && params.enabled !== "N") {
4382
+ throw PolyVValidationError.required("enabled");
4383
+ }
4384
+ const response = await this.client.httpClient.post(
4385
+ "/live/v3/channel/product/update-enabled",
4386
+ null,
4387
+ { params: { channelId: params.channelId, enabled: params.enabled } }
4388
+ );
4389
+ return response;
4390
+ }
4391
+ /**
4392
+ * Update channel configuration
4393
+ *
4394
+ * Updates a channel config key-value pair via /v3/channel/config/update.
4395
+ * Common keys include: couponEnabled, productEnabled, etc.
4396
+ *
4397
+ * @param params - Parameters including channelId, key, and value
4398
+ * @returns true if update was successful
4399
+ * @throws PolyVValidationError if required parameters are missing
4400
+ *
4401
+ * @example
4402
+ * ```typescript
4403
+ * await channelService.updateChannelConfig({
4404
+ * channelId: 'ch123456',
4405
+ * key: 'couponEnabled',
4406
+ * value: 'Y',
4407
+ * });
4408
+ * ```
4409
+ */
4410
+ async updateChannelConfig(params) {
4411
+ if (!params.channelId || params.channelId.trim() === "") {
4412
+ throw PolyVValidationError.required("channelId");
4413
+ }
4414
+ if (!params.key || params.key.trim() === "") {
4415
+ throw PolyVValidationError.required("key");
4416
+ }
4417
+ if (!params.value || params.value.trim() === "") {
4418
+ throw PolyVValidationError.required("value");
4419
+ }
4420
+ const response = await this.client.httpClient.post(
4421
+ "/live/v3/channel/config/update",
4422
+ null,
4423
+ { params: { channelId: params.channelId, key: params.key, value: params.value } }
4424
+ );
4425
+ return response;
4426
+ }
4359
4427
  };
4360
4428
 
4361
4429
  // src/services/chat.service.ts
@@ -12368,6 +12436,44 @@ var V4ChannelService = class {
12368
12436
  throw new PolyVValidationError("channelId must be a string or number", "channelId");
12369
12437
  }
12370
12438
  }
12439
+ // ============================================
12440
+ // Channel Coupon Association
12441
+ // ============================================
12442
+ /**
12443
+ * Add platform coupons to a channel
12444
+ *
12445
+ * Associates existing platform coupons with a specific channel.
12446
+ * Invalid or already-added coupon IDs are silently ignored.
12447
+ * If all coupon IDs are invalid, the request will fail.
12448
+ *
12449
+ * @param params - Parameters including channelId and couponIds
12450
+ * @returns true if the operation was successful
12451
+ * @throws PolyVValidationError if required parameters are missing
12452
+ *
12453
+ * @example
12454
+ * ```typescript
12455
+ * await v4Channel.addChannelCoupon({
12456
+ * channelId: '3151318',
12457
+ * couponIds: ['caqfi6rqutunvofor5jrqbinswh14p2g'],
12458
+ * });
12459
+ * ```
12460
+ */
12461
+ async addChannelCoupon(params) {
12462
+ if (!params.channelId || String(params.channelId).trim() === "") {
12463
+ throw PolyVValidationError.required("channelId");
12464
+ }
12465
+ if (!Array.isArray(params.couponIds) || params.couponIds.length === 0) {
12466
+ throw new PolyVValidationError("couponIds must be a non-empty array", "couponIds");
12467
+ }
12468
+ if (params.couponIds.length > 30) {
12469
+ throw new PolyVValidationError("couponIds must contain at most 30 items", "couponIds");
12470
+ }
12471
+ const response = await this.client.httpClient.post(
12472
+ "/live/v4/channel/coupon/create",
12473
+ params
12474
+ );
12475
+ return response;
12476
+ }
12371
12477
  /**
12372
12478
  * Validate channel name
12373
12479
  */