polyv-live-api-sdk 1.0.19 → 1.0.20
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 +303 -97
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +110 -24
- package/dist/index.js +303 -97
- package/dist/index.js.map +1 -1
- package/dist/services/channel.service.d.ts +4 -3
- package/dist/services/channel.service.d.ts.map +1 -1
- package/dist/services/chat.service.d.ts +1 -1
- package/dist/services/chat.service.d.ts.map +1 -1
- package/dist/services/live-interaction.service.d.ts.map +1 -1
- package/dist/services/player.service.d.ts +1 -1
- package/dist/services/player.service.d.ts.map +1 -1
- package/dist/services/v4/ai.service.d.ts.map +1 -1
- package/dist/services/v4/channel.service.d.ts +11 -5
- package/dist/services/v4/channel.service.d.ts.map +1 -1
- package/dist/services/v4/global.service.d.ts.map +1 -1
- package/dist/services/v4/robot.service.d.ts.map +1 -1
- package/dist/services/v4/user.service.d.ts.map +1 -1
- package/dist/services/v4/webapp.service.d.ts.map +1 -1
- package/dist/services/web.service.d.ts +1 -1
- package/dist/services/web.service.d.ts.map +1 -1
- package/dist/types/channel.d.ts +20 -7
- package/dist/types/channel.d.ts.map +1 -1
- package/dist/types/chat-censor-role.d.ts +5 -3
- package/dist/types/chat-censor-role.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/player.d.ts +4 -2
- package/dist/types/player.d.ts.map +1 -1
- package/dist/types/v4-channel.d.ts +53 -6
- package/dist/types/v4-channel.d.ts.map +1 -1
- package/dist/types/web.d.ts +4 -0
- package/dist/types/web.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import CryptoJS from 'crypto-js';
|
|
2
|
-
import { createHash } from 'crypto';
|
|
3
|
-
import
|
|
2
|
+
import { createHash, createDecipheriv } from 'crypto';
|
|
3
|
+
import axios2 from 'axios';
|
|
4
4
|
|
|
5
5
|
// src/errors/polyv-error.ts
|
|
6
6
|
var PolyVError = class _PolyVError extends Error {
|
|
@@ -1264,7 +1264,8 @@ var ChannelService = class {
|
|
|
1264
1264
|
* Update teacher document relation
|
|
1265
1265
|
*
|
|
1266
1266
|
* Adds or removes the binding between a teacher and documents.
|
|
1267
|
-
* Note: fileIds is passed in the body
|
|
1267
|
+
* Note: fileIds is passed in the request body as application/x-www-form-urlencoded
|
|
1268
|
+
* (NOT signed), while teacherId/operation are query-string parameters that ARE signed.
|
|
1268
1269
|
*
|
|
1269
1270
|
* @param teacherId - The teacher ID
|
|
1270
1271
|
* @param fileIds - File IDs, comma-separated
|
|
@@ -1287,10 +1288,15 @@ var ChannelService = class {
|
|
|
1287
1288
|
if (!fileIds || fileIds.trim() === "") {
|
|
1288
1289
|
throw PolyVValidationError.required("fileIds");
|
|
1289
1290
|
}
|
|
1291
|
+
const form = new URLSearchParams();
|
|
1292
|
+
form.set("fileIds", fileIds);
|
|
1290
1293
|
const response = await this.client.httpClient.post(
|
|
1291
1294
|
"/live/v4/channel/doc/teacher/update-relation",
|
|
1292
|
-
|
|
1293
|
-
{
|
|
1295
|
+
form,
|
|
1296
|
+
{
|
|
1297
|
+
params: { teacherId, operation },
|
|
1298
|
+
headers: { "Content-Type": "application/x-www-form-urlencoded" }
|
|
1299
|
+
}
|
|
1294
1300
|
);
|
|
1295
1301
|
return response;
|
|
1296
1302
|
}
|
|
@@ -2707,11 +2713,10 @@ var ChannelService = class {
|
|
|
2707
2713
|
throw PolyVValidationError.required("fileId");
|
|
2708
2714
|
}
|
|
2709
2715
|
const params = { channelId, fileId: options.fileId };
|
|
2710
|
-
if (options.startTime !== void 0) {
|
|
2711
|
-
params.
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
params.endTime = options.endTime;
|
|
2716
|
+
if (options.startTime !== void 0 && options.endTime !== void 0) {
|
|
2717
|
+
params.deleteTimeFrame = JSON.stringify([
|
|
2718
|
+
{ start: options.startTime, end: options.endTime }
|
|
2719
|
+
]);
|
|
2715
2720
|
}
|
|
2716
2721
|
if (options.fileName !== void 0) {
|
|
2717
2722
|
params.fileName = options.fileName;
|
|
@@ -2945,12 +2950,16 @@ var ChannelService = class {
|
|
|
2945
2950
|
if (!channelId || channelId.trim() === "") {
|
|
2946
2951
|
throw PolyVValidationError.required("channelId");
|
|
2947
2952
|
}
|
|
2948
|
-
if (!options.
|
|
2949
|
-
throw PolyVValidationError.required("
|
|
2953
|
+
if (!options.startTime || String(options.startTime).trim() === "") {
|
|
2954
|
+
throw PolyVValidationError.required("startTime");
|
|
2955
|
+
}
|
|
2956
|
+
if (!options.endTime || String(options.endTime).trim() === "") {
|
|
2957
|
+
throw PolyVValidationError.required("endTime");
|
|
2950
2958
|
}
|
|
2951
2959
|
const params = {
|
|
2952
2960
|
channelId,
|
|
2953
|
-
|
|
2961
|
+
startTime: options.startTime,
|
|
2962
|
+
endTime: options.endTime
|
|
2954
2963
|
};
|
|
2955
2964
|
if (options.fileName !== void 0) {
|
|
2956
2965
|
params.fileName = options.fileName;
|
|
@@ -2986,12 +2995,16 @@ var ChannelService = class {
|
|
|
2986
2995
|
if (!channelId || channelId.trim() === "") {
|
|
2987
2996
|
throw PolyVValidationError.required("channelId");
|
|
2988
2997
|
}
|
|
2989
|
-
if (!options.
|
|
2990
|
-
throw PolyVValidationError.required("
|
|
2998
|
+
if (!options.startTime || String(options.startTime).trim() === "") {
|
|
2999
|
+
throw PolyVValidationError.required("startTime");
|
|
3000
|
+
}
|
|
3001
|
+
if (!options.endTime || String(options.endTime).trim() === "") {
|
|
3002
|
+
throw PolyVValidationError.required("endTime");
|
|
2991
3003
|
}
|
|
2992
3004
|
const params = {
|
|
2993
3005
|
channelId,
|
|
2994
|
-
|
|
3006
|
+
startTime: options.startTime,
|
|
3007
|
+
endTime: options.endTime
|
|
2995
3008
|
};
|
|
2996
3009
|
if (options.fileName !== void 0) {
|
|
2997
3010
|
params.fileName = options.fileName;
|
|
@@ -3028,13 +3041,17 @@ var ChannelService = class {
|
|
|
3028
3041
|
if (!channelId || channelId.trim() === "") {
|
|
3029
3042
|
throw PolyVValidationError.required("channelId");
|
|
3030
3043
|
}
|
|
3031
|
-
if (!options.
|
|
3032
|
-
throw PolyVValidationError.required("
|
|
3044
|
+
if (!options.type || options.type.trim() === "") {
|
|
3045
|
+
throw PolyVValidationError.required("type");
|
|
3046
|
+
}
|
|
3047
|
+
const params = { channelId, type: options.type };
|
|
3048
|
+
if (options.fromStartStop !== void 0) {
|
|
3049
|
+
params.fromStartStop = options.fromStartStop;
|
|
3033
3050
|
}
|
|
3034
3051
|
await this.client.httpClient.post(
|
|
3035
3052
|
"/live/v3/channel/record/add-breakpoint",
|
|
3036
3053
|
null,
|
|
3037
|
-
{ params
|
|
3054
|
+
{ params }
|
|
3038
3055
|
);
|
|
3039
3056
|
return true;
|
|
3040
3057
|
}
|
|
@@ -6009,8 +6026,25 @@ var ChannelService = class {
|
|
|
6009
6026
|
return response;
|
|
6010
6027
|
}
|
|
6011
6028
|
};
|
|
6012
|
-
|
|
6013
|
-
|
|
6029
|
+
var APICHAT_USERLIST_SIGN_SECRET = "polyvChatSignForExternal";
|
|
6030
|
+
function buildChatUserListSign(params) {
|
|
6031
|
+
let content = APICHAT_USERLIST_SIGN_SECRET;
|
|
6032
|
+
for (const key of Object.keys(params).sort()) {
|
|
6033
|
+
content += key + params[key];
|
|
6034
|
+
}
|
|
6035
|
+
content += APICHAT_USERLIST_SIGN_SECRET;
|
|
6036
|
+
return createHash("md5").update(content, "utf8").digest("hex").toUpperCase();
|
|
6037
|
+
}
|
|
6038
|
+
function decryptChatUserList(encryptedHex, sign) {
|
|
6039
|
+
const key = Buffer.from(sign.slice(0, 16), "utf8");
|
|
6040
|
+
const decipher = createDecipheriv("aes-128-cbc", key, key);
|
|
6041
|
+
const decrypted = Buffer.concat([
|
|
6042
|
+
decipher.update(Buffer.from(encryptedHex, "hex")),
|
|
6043
|
+
decipher.final()
|
|
6044
|
+
]);
|
|
6045
|
+
const json = Buffer.from(decrypted.toString("utf8"), "base64").toString("utf8");
|
|
6046
|
+
return JSON.parse(json);
|
|
6047
|
+
}
|
|
6014
6048
|
var ChatService = class {
|
|
6015
6049
|
client;
|
|
6016
6050
|
/**
|
|
@@ -6106,9 +6140,17 @@ var ChatService = class {
|
|
|
6106
6140
|
* ```
|
|
6107
6141
|
*/
|
|
6108
6142
|
async sendChat(params) {
|
|
6143
|
+
const encodedContent = typeof params.content === "string" ? Buffer.from(params.content, "utf8").toString("base64url") : params.content;
|
|
6109
6144
|
const response = await this.client.httpClient.post(
|
|
6110
6145
|
`/live/v1/channelSetting/${params.channelId}/send-chat`,
|
|
6111
|
-
|
|
6146
|
+
null,
|
|
6147
|
+
{
|
|
6148
|
+
params: {
|
|
6149
|
+
userId: params.userId,
|
|
6150
|
+
content: encodedContent,
|
|
6151
|
+
imgUrl: params.imgUrl
|
|
6152
|
+
}
|
|
6153
|
+
}
|
|
6112
6154
|
);
|
|
6113
6155
|
return response;
|
|
6114
6156
|
}
|
|
@@ -6400,11 +6442,27 @@ var ChatService = class {
|
|
|
6400
6442
|
if (params.len !== void 0 && (params.len < 1 || params.len > 1e3)) {
|
|
6401
6443
|
throw new PolyVValidationError("len must be between 1 and 1000");
|
|
6402
6444
|
}
|
|
6403
|
-
const
|
|
6445
|
+
const query = {
|
|
6446
|
+
roomId: params.roomId,
|
|
6447
|
+
page: String(params.page ?? 1),
|
|
6448
|
+
len: String(params.len ?? 100),
|
|
6449
|
+
hide: "0",
|
|
6450
|
+
toGetSubRooms: String(params.toGetSubRooms ?? false)
|
|
6451
|
+
};
|
|
6452
|
+
const sign = buildChatUserListSign(query);
|
|
6453
|
+
const response = await axios2.get(
|
|
6404
6454
|
"https://apichat.polyv.net/front/userlistExternal",
|
|
6405
|
-
{
|
|
6455
|
+
{
|
|
6456
|
+
params: { ...query, sign },
|
|
6457
|
+
responseType: "text",
|
|
6458
|
+
transformResponse: [(data) => data]
|
|
6459
|
+
}
|
|
6406
6460
|
);
|
|
6407
|
-
|
|
6461
|
+
const body = typeof response.data === "string" ? response.data.trim() : "";
|
|
6462
|
+
if (!body) {
|
|
6463
|
+
return { count: 0, userlist: [] };
|
|
6464
|
+
}
|
|
6465
|
+
return decryptChatUserList(body, sign);
|
|
6408
6466
|
}
|
|
6409
6467
|
/**
|
|
6410
6468
|
* updateAdminInfo - 更新管理员信息
|
|
@@ -6419,7 +6477,7 @@ var ChatService = class {
|
|
|
6419
6477
|
* channelId: '123456',
|
|
6420
6478
|
* nickname: '管理员',
|
|
6421
6479
|
* actor: '管理员1',
|
|
6422
|
-
* avatar:
|
|
6480
|
+
* avatar: avatarFile,
|
|
6423
6481
|
* });
|
|
6424
6482
|
* console.log(result.data);
|
|
6425
6483
|
* ```
|
|
@@ -6434,16 +6492,39 @@ var ChatService = class {
|
|
|
6434
6492
|
if (!params.actor) {
|
|
6435
6493
|
throw new PolyVValidationError("actor is required");
|
|
6436
6494
|
}
|
|
6437
|
-
|
|
6438
|
-
|
|
6439
|
-
|
|
6440
|
-
|
|
6441
|
-
|
|
6442
|
-
|
|
6495
|
+
if (!params.avatar) {
|
|
6496
|
+
throw new PolyVValidationError("avatar is required");
|
|
6497
|
+
}
|
|
6498
|
+
const timestamp = Date.now();
|
|
6499
|
+
const { sign } = generateSignature(
|
|
6500
|
+
{
|
|
6501
|
+
appId: this.client.config.appId,
|
|
6502
|
+
timestamp,
|
|
6503
|
+
nickname: params.nickname,
|
|
6504
|
+
actor: params.actor
|
|
6505
|
+
},
|
|
6506
|
+
{ appSecret: this.client.config.appSecret }
|
|
6507
|
+
);
|
|
6508
|
+
const formData = new FormData();
|
|
6509
|
+
formData.append("appId", this.client.config.appId);
|
|
6510
|
+
formData.append("timestamp", String(timestamp));
|
|
6511
|
+
formData.append("sign", sign);
|
|
6512
|
+
formData.append("nickname", params.nickname);
|
|
6513
|
+
formData.append("actor", params.actor);
|
|
6514
|
+
if (params.avatar instanceof Blob) {
|
|
6515
|
+
formData.append("avatar", params.avatar, params.avatar.name || "avatar.png");
|
|
6516
|
+
} else {
|
|
6517
|
+
formData.append("avatar", new Blob([params.avatar]), "avatar.png");
|
|
6443
6518
|
}
|
|
6444
6519
|
const response = await this.client.httpClient.post(
|
|
6445
6520
|
`/live/v2/channelSetting/${params.channelId}/set-chat-admin`,
|
|
6446
|
-
|
|
6521
|
+
formData,
|
|
6522
|
+
{
|
|
6523
|
+
headers: {
|
|
6524
|
+
"Content-Type": "multipart/form-data",
|
|
6525
|
+
"X-Skip-Auth": "true"
|
|
6526
|
+
}
|
|
6527
|
+
}
|
|
6447
6528
|
);
|
|
6448
6529
|
return response;
|
|
6449
6530
|
}
|
|
@@ -7369,10 +7450,19 @@ var LiveInteractionService = class {
|
|
|
7369
7450
|
this.validateRequiredString(params.lotteryId, "lotteryId");
|
|
7370
7451
|
this.validateRequiredString(params.winnerCode, "winnerCode");
|
|
7371
7452
|
this.validateRequiredString(params.viewerId, "viewerId");
|
|
7453
|
+
const body = {
|
|
7454
|
+
channelId: params.channelId,
|
|
7455
|
+
lotteryId: params.lotteryId,
|
|
7456
|
+
winnerCode: params.winnerCode,
|
|
7457
|
+
viewerId: params.viewerId
|
|
7458
|
+
};
|
|
7459
|
+
if (params.receiveInfo !== void 0) {
|
|
7460
|
+
body.receiveInfo = JSON.stringify(params.receiveInfo);
|
|
7461
|
+
}
|
|
7372
7462
|
const response = await this.client.httpClient.post(
|
|
7373
7463
|
"/live/v4/channel/lottery/add-receive-info",
|
|
7374
|
-
|
|
7375
|
-
{ params: this.compactParams(params) }
|
|
7464
|
+
body,
|
|
7465
|
+
{ params: this.compactParams({ channelId: params.channelId }) }
|
|
7376
7466
|
);
|
|
7377
7467
|
return response;
|
|
7378
7468
|
}
|
|
@@ -8330,10 +8420,29 @@ var WebService = class {
|
|
|
8330
8420
|
if (!params.imgfile) {
|
|
8331
8421
|
throw new PolyVValidationError("imgfile is required");
|
|
8332
8422
|
}
|
|
8423
|
+
const timestamp = Date.now();
|
|
8424
|
+
const { sign } = generateSignature(
|
|
8425
|
+
{ appId: this.client.config.appId, timestamp },
|
|
8426
|
+
{ appSecret: this.client.config.appSecret }
|
|
8427
|
+
);
|
|
8428
|
+
const formData = new FormData();
|
|
8429
|
+
formData.append("appId", this.client.config.appId);
|
|
8430
|
+
formData.append("timestamp", String(timestamp));
|
|
8431
|
+
formData.append("sign", sign);
|
|
8432
|
+
if (params.imgfile instanceof Blob) {
|
|
8433
|
+
formData.append("imgfile", params.imgfile, params.imgfile.name || "logo.png");
|
|
8434
|
+
} else {
|
|
8435
|
+
formData.append("imgfile", params.imgfile);
|
|
8436
|
+
}
|
|
8333
8437
|
const response = await this.client.httpClient.post(
|
|
8334
8438
|
`/live/v2/channelSetting/${params.channelId}/setCoverImg`,
|
|
8335
|
-
|
|
8336
|
-
{
|
|
8439
|
+
formData,
|
|
8440
|
+
{
|
|
8441
|
+
headers: {
|
|
8442
|
+
"Content-Type": "multipart/form-data",
|
|
8443
|
+
"X-Skip-Auth": "true"
|
|
8444
|
+
}
|
|
8445
|
+
}
|
|
8337
8446
|
);
|
|
8338
8447
|
return response;
|
|
8339
8448
|
}
|
|
@@ -8883,18 +8992,20 @@ var WebService = class {
|
|
|
8883
8992
|
if (params.enabled !== void 0 && !["Y", "N"].includes(params.enabled)) {
|
|
8884
8993
|
throw new PolyVValidationError("enabled must be Y or N");
|
|
8885
8994
|
}
|
|
8995
|
+
const apiParams = {};
|
|
8996
|
+
if (params.channelId) {
|
|
8997
|
+
apiParams.channelId = params.channelId;
|
|
8998
|
+
}
|
|
8886
8999
|
const body = {
|
|
8887
9000
|
goods: params.goods
|
|
8888
9001
|
};
|
|
8889
|
-
if (params.channelId) {
|
|
8890
|
-
body.channelId = params.channelId;
|
|
8891
|
-
}
|
|
8892
9002
|
if (params.enabled) {
|
|
8893
9003
|
body.enabled = params.enabled;
|
|
8894
9004
|
}
|
|
8895
9005
|
const response = await this.client.httpClient.post(
|
|
8896
9006
|
"/live/v3/channel/donate/update-good",
|
|
8897
|
-
body
|
|
9007
|
+
body,
|
|
9008
|
+
{ params: apiParams }
|
|
8898
9009
|
);
|
|
8899
9010
|
return response;
|
|
8900
9011
|
}
|
|
@@ -9035,15 +9146,32 @@ var WebService = class {
|
|
|
9035
9146
|
if (params.files.length > 6) {
|
|
9036
9147
|
throw new PolyVValidationError("files must contain 1-6 files");
|
|
9037
9148
|
}
|
|
9149
|
+
const timestamp = Date.now();
|
|
9150
|
+
const { sign } = generateSignature(
|
|
9151
|
+
{ appId: this.client.config.appId, timestamp, type: params.type },
|
|
9152
|
+
{ appSecret: this.client.config.appSecret }
|
|
9153
|
+
);
|
|
9038
9154
|
const formData = new FormData();
|
|
9155
|
+
formData.append("appId", this.client.config.appId);
|
|
9156
|
+
formData.append("timestamp", String(timestamp));
|
|
9157
|
+
formData.append("sign", sign);
|
|
9039
9158
|
formData.append("type", params.type);
|
|
9040
9159
|
for (const file of params.files) {
|
|
9041
|
-
|
|
9160
|
+
if (file instanceof Blob) {
|
|
9161
|
+
formData.append("file", file, file.name || "image.png");
|
|
9162
|
+
} else {
|
|
9163
|
+
formData.append("file", file);
|
|
9164
|
+
}
|
|
9042
9165
|
}
|
|
9043
9166
|
const response = await this.client.httpClient.post(
|
|
9044
9167
|
"/live/v3/common/upload-image",
|
|
9045
9168
|
formData,
|
|
9046
|
-
{
|
|
9169
|
+
{
|
|
9170
|
+
headers: {
|
|
9171
|
+
"Content-Type": "multipart/form-data",
|
|
9172
|
+
"X-Skip-Auth": "true"
|
|
9173
|
+
}
|
|
9174
|
+
}
|
|
9047
9175
|
);
|
|
9048
9176
|
return response;
|
|
9049
9177
|
}
|
|
@@ -9371,16 +9499,38 @@ var WebService = class {
|
|
|
9371
9499
|
if (!params.file) {
|
|
9372
9500
|
throw new PolyVValidationError("file is required");
|
|
9373
9501
|
}
|
|
9502
|
+
const timestamp = Date.now();
|
|
9503
|
+
const signParams = {
|
|
9504
|
+
appId: this.client.config.appId,
|
|
9505
|
+
timestamp,
|
|
9506
|
+
rank: params.rank
|
|
9507
|
+
};
|
|
9508
|
+
if (params.channelId) {
|
|
9509
|
+
signParams.channelId = params.channelId;
|
|
9510
|
+
}
|
|
9511
|
+
const { sign } = generateSignature(signParams, { appSecret: this.client.config.appSecret });
|
|
9374
9512
|
const formData = new FormData();
|
|
9513
|
+
formData.append("appId", this.client.config.appId);
|
|
9514
|
+
formData.append("timestamp", String(timestamp));
|
|
9515
|
+
formData.append("sign", sign);
|
|
9375
9516
|
formData.append("rank", params.rank.toString());
|
|
9376
|
-
formData.append("file", params.file);
|
|
9377
9517
|
if (params.channelId) {
|
|
9378
9518
|
formData.append("channelId", params.channelId);
|
|
9379
9519
|
}
|
|
9520
|
+
if (params.file instanceof Blob) {
|
|
9521
|
+
formData.append("file", params.file, params.file.name || "whitelist.xls");
|
|
9522
|
+
} else {
|
|
9523
|
+
formData.append("file", params.file);
|
|
9524
|
+
}
|
|
9380
9525
|
const response = await this.client.httpClient.post(
|
|
9381
9526
|
"/live/v3/channel/auth/upload-white-list",
|
|
9382
9527
|
formData,
|
|
9383
|
-
{
|
|
9528
|
+
{
|
|
9529
|
+
headers: {
|
|
9530
|
+
"Content-Type": "multipart/form-data",
|
|
9531
|
+
"X-Skip-Auth": "true"
|
|
9532
|
+
}
|
|
9533
|
+
}
|
|
9384
9534
|
);
|
|
9385
9535
|
return response;
|
|
9386
9536
|
}
|
|
@@ -9537,15 +9687,19 @@ var WebService = class {
|
|
|
9537
9687
|
*
|
|
9538
9688
|
* @example
|
|
9539
9689
|
* ```typescript
|
|
9540
|
-
* const result = await client.web.getRecordField({ channelId: '123456' });
|
|
9690
|
+
* const result = await client.web.getRecordField({ channelId: '123456', rank: 1 });
|
|
9541
9691
|
* console.log(result.infoFields);
|
|
9542
9692
|
* ```
|
|
9543
9693
|
*/
|
|
9544
9694
|
async getRecordField(params) {
|
|
9545
9695
|
this.validateChannelId(params.channelId);
|
|
9696
|
+
const rank = params.rank ?? 1;
|
|
9697
|
+
if (rank !== 1 && rank !== 2) {
|
|
9698
|
+
throw new PolyVValidationError("rank must be 1 (primary) or 2 (secondary)");
|
|
9699
|
+
}
|
|
9546
9700
|
const response = await this.client.httpClient.get(
|
|
9547
9701
|
"/live/v3/channel/auth/get-record-field",
|
|
9548
|
-
{ params: { channelId: params.channelId } }
|
|
9702
|
+
{ params: { channelId: params.channelId, rank } }
|
|
9549
9703
|
);
|
|
9550
9704
|
return response;
|
|
9551
9705
|
}
|
|
@@ -9618,9 +9772,13 @@ var WebService = class {
|
|
|
9618
9772
|
*/
|
|
9619
9773
|
async downloadRecordInfo(params) {
|
|
9620
9774
|
this.validateChannelId(params.channelId);
|
|
9775
|
+
const rank = params.rank ?? 1;
|
|
9776
|
+
if (rank !== 1 && rank !== 2) {
|
|
9777
|
+
throw new PolyVValidationError("rank must be 1 (primary) or 2 (secondary)");
|
|
9778
|
+
}
|
|
9621
9779
|
const response = await this.client.httpClient.get(
|
|
9622
9780
|
"/live/v3/channel/auth/download-record-info",
|
|
9623
|
-
{ params: { channelId: params.channelId }, responseType: "arraybuffer" }
|
|
9781
|
+
{ params: { channelId: params.channelId, rank }, responseType: "arraybuffer" }
|
|
9624
9782
|
);
|
|
9625
9783
|
return response;
|
|
9626
9784
|
}
|
|
@@ -10984,15 +11142,15 @@ var PlayerService = class {
|
|
|
10984
11142
|
if (params.marqueeRestrict === "Y" && !params.url) {
|
|
10985
11143
|
throw new PolyVValidationError('url is required when marqueeRestrict is "Y"');
|
|
10986
11144
|
}
|
|
10987
|
-
const
|
|
11145
|
+
const queryParams = {
|
|
10988
11146
|
marqueeRestrict: params.marqueeRestrict
|
|
10989
11147
|
};
|
|
10990
11148
|
if (params.url !== void 0) {
|
|
10991
|
-
|
|
11149
|
+
queryParams.url = params.url;
|
|
10992
11150
|
}
|
|
10993
|
-
const response = await this.client.httpClient.
|
|
11151
|
+
const response = await this.client.httpClient.get(
|
|
10994
11152
|
`/live/v2/channelRestrict/${channelId}/set-diyurl-marquee`,
|
|
10995
|
-
|
|
11153
|
+
{ params: queryParams }
|
|
10996
11154
|
);
|
|
10997
11155
|
return response;
|
|
10998
11156
|
}
|
|
@@ -11011,7 +11169,7 @@ var PlayerService = class {
|
|
|
11011
11169
|
* ```typescript
|
|
11012
11170
|
* await client.player.updateHeadAdvert(123456, {
|
|
11013
11171
|
* headAdvertType: 'IMAGE',
|
|
11014
|
-
*
|
|
11172
|
+
* headAdvertMediaUrl: 'https://example.com/ad.jpg',
|
|
11015
11173
|
* });
|
|
11016
11174
|
* ```
|
|
11017
11175
|
*/
|
|
@@ -11021,33 +11179,32 @@ var PlayerService = class {
|
|
|
11021
11179
|
if (params.enabled !== void 0) {
|
|
11022
11180
|
this.validateYNValue(params.enabled, "enabled");
|
|
11023
11181
|
}
|
|
11024
|
-
const
|
|
11025
|
-
headAdvertType: params.headAdvertType
|
|
11182
|
+
const requestParams = {
|
|
11183
|
+
headAdvertType: String(params.headAdvertType).toLowerCase()
|
|
11026
11184
|
};
|
|
11027
|
-
|
|
11028
|
-
|
|
11029
|
-
|
|
11030
|
-
if (params.headAdvertFlv !== void 0) {
|
|
11031
|
-
body.headAdvertFlv = params.headAdvertFlv;
|
|
11185
|
+
const mediaUrl = params.headAdvertMediaUrl ?? params.headAdvertImage ?? params.headAdvertFlv;
|
|
11186
|
+
if (mediaUrl !== void 0) {
|
|
11187
|
+
requestParams.headAdvertMediaUrl = mediaUrl;
|
|
11032
11188
|
}
|
|
11033
11189
|
if (params.headAdvertHref !== void 0) {
|
|
11034
|
-
|
|
11190
|
+
requestParams.headAdvertHref = params.headAdvertHref;
|
|
11035
11191
|
}
|
|
11036
11192
|
if (params.headAdvertDuration !== void 0) {
|
|
11037
|
-
|
|
11193
|
+
requestParams.headAdvertDuration = params.headAdvertDuration;
|
|
11038
11194
|
}
|
|
11039
11195
|
if (params.headAdvertWidth !== void 0) {
|
|
11040
|
-
|
|
11196
|
+
requestParams.headAdvertWidth = params.headAdvertWidth;
|
|
11041
11197
|
}
|
|
11042
11198
|
if (params.headAdvertHeight !== void 0) {
|
|
11043
|
-
|
|
11199
|
+
requestParams.headAdvertHeight = params.headAdvertHeight;
|
|
11044
11200
|
}
|
|
11045
11201
|
if (params.enabled !== void 0) {
|
|
11046
|
-
|
|
11202
|
+
requestParams.enabled = params.enabled;
|
|
11047
11203
|
}
|
|
11048
11204
|
const response = await this.client.httpClient.post(
|
|
11049
11205
|
`/live/v2/channelAdvert/${channelId}/updateHead`,
|
|
11050
|
-
|
|
11206
|
+
null,
|
|
11207
|
+
{ params: requestParams }
|
|
11051
11208
|
);
|
|
11052
11209
|
return response;
|
|
11053
11210
|
}
|
|
@@ -11951,7 +12108,7 @@ var V4AiService = class {
|
|
|
11951
12108
|
}
|
|
11952
12109
|
await this.client.httpClient.post(
|
|
11953
12110
|
"/live/v4/ai/digital-human/set-organizations",
|
|
11954
|
-
|
|
12111
|
+
params.items
|
|
11955
12112
|
);
|
|
11956
12113
|
}
|
|
11957
12114
|
// ============================================
|
|
@@ -11999,7 +12156,7 @@ var V4AiService = class {
|
|
|
11999
12156
|
}
|
|
12000
12157
|
const response = await this.client.httpClient.get(
|
|
12001
12158
|
"/live/v4/ai/video-produce/get",
|
|
12002
|
-
{ params }
|
|
12159
|
+
{ params: { aiPPTVideoId: params.id } }
|
|
12003
12160
|
);
|
|
12004
12161
|
return response;
|
|
12005
12162
|
}
|
|
@@ -12063,7 +12220,7 @@ var V4AiService = class {
|
|
|
12063
12220
|
}
|
|
12064
12221
|
await this.client.httpClient.post(
|
|
12065
12222
|
"/live/v4/ai/video-produce/delete",
|
|
12066
|
-
params
|
|
12223
|
+
{ aiPPTVideoId: params.id }
|
|
12067
12224
|
);
|
|
12068
12225
|
}
|
|
12069
12226
|
/**
|
|
@@ -12288,7 +12445,7 @@ var V4RobotService = class {
|
|
|
12288
12445
|
}
|
|
12289
12446
|
const response = await this.client.httpClient.post(
|
|
12290
12447
|
"/live/v4/global/robot/save-batch",
|
|
12291
|
-
params
|
|
12448
|
+
params.robots
|
|
12292
12449
|
);
|
|
12293
12450
|
return response;
|
|
12294
12451
|
}
|
|
@@ -13024,9 +13181,11 @@ var V4ChannelService = class {
|
|
|
13024
13181
|
*/
|
|
13025
13182
|
async distributeCreateBatch(params) {
|
|
13026
13183
|
this.validateChannelId(params.channelId);
|
|
13184
|
+
const { channelId, distributes } = params;
|
|
13027
13185
|
await this.client.httpClient.post(
|
|
13028
13186
|
"/live/v4/channel/distribute/create-batch",
|
|
13029
|
-
|
|
13187
|
+
distributes,
|
|
13188
|
+
{ params: { channelId } }
|
|
13030
13189
|
);
|
|
13031
13190
|
}
|
|
13032
13191
|
/**
|
|
@@ -13036,9 +13195,11 @@ var V4ChannelService = class {
|
|
|
13036
13195
|
*/
|
|
13037
13196
|
async distributeUpdateBatch(params) {
|
|
13038
13197
|
this.validateChannelId(params.channelId);
|
|
13198
|
+
const { channelId, distributes } = params;
|
|
13039
13199
|
await this.client.httpClient.post(
|
|
13040
13200
|
"/live/v4/channel/distribute/update-batch",
|
|
13041
|
-
|
|
13201
|
+
distributes,
|
|
13202
|
+
{ params: { channelId } }
|
|
13042
13203
|
);
|
|
13043
13204
|
}
|
|
13044
13205
|
/**
|
|
@@ -13051,7 +13212,7 @@ var V4ChannelService = class {
|
|
|
13051
13212
|
await this.client.httpClient.post(
|
|
13052
13213
|
"/live/v4/channel/distribute/delete-batch",
|
|
13053
13214
|
null,
|
|
13054
|
-
{ params: { channelId: params.channelId,
|
|
13215
|
+
{ params: { channelId: params.channelId, distributeIds: params.ids.join(",") } }
|
|
13055
13216
|
);
|
|
13056
13217
|
}
|
|
13057
13218
|
/**
|
|
@@ -13075,10 +13236,11 @@ var V4ChannelService = class {
|
|
|
13075
13236
|
*/
|
|
13076
13237
|
async updateMasterSwitch(params) {
|
|
13077
13238
|
this.validateChannelId(params.channelId);
|
|
13239
|
+
const { channelId, enabled } = params;
|
|
13078
13240
|
await this.client.httpClient.post(
|
|
13079
13241
|
"/live/v4/channel/distribute/update-master-switch",
|
|
13080
13242
|
null,
|
|
13081
|
-
{ params }
|
|
13243
|
+
{ params: { channelId, distributeEnabled: enabled } }
|
|
13082
13244
|
);
|
|
13083
13245
|
}
|
|
13084
13246
|
/**
|
|
@@ -13088,10 +13250,11 @@ var V4ChannelService = class {
|
|
|
13088
13250
|
*/
|
|
13089
13251
|
async updateSwitch(params) {
|
|
13090
13252
|
this.validateChannelId(params.channelId);
|
|
13253
|
+
const { channelId, distributeId, enabled } = params;
|
|
13091
13254
|
await this.client.httpClient.post(
|
|
13092
13255
|
"/live/v4/channel/distribute/update-switch",
|
|
13093
13256
|
null,
|
|
13094
|
-
{ params }
|
|
13257
|
+
{ params: { channelId, distributeIds: String(distributeId), distributeEnabled: enabled } }
|
|
13095
13258
|
);
|
|
13096
13259
|
}
|
|
13097
13260
|
// ============================================
|
|
@@ -13348,29 +13511,56 @@ var V4ChannelService = class {
|
|
|
13348
13511
|
return response;
|
|
13349
13512
|
}
|
|
13350
13513
|
/**
|
|
13351
|
-
* Save interaction event
|
|
13514
|
+
* Save interaction event (create one or more interaction listener tasks).
|
|
13515
|
+
*
|
|
13516
|
+
* The body carries channelId/tasks/allDone (plus optional callbackUrl/payload);
|
|
13517
|
+
* only appId/timestamp are signed (query), the JSON body is unsigned.
|
|
13352
13518
|
*
|
|
13353
13519
|
* @param params - Save parameters
|
|
13354
13520
|
*/
|
|
13355
13521
|
async interactionEventSave(params) {
|
|
13356
13522
|
this.validateChannelId(params.channelId);
|
|
13357
|
-
|
|
13523
|
+
if (!Array.isArray(params.tasks) || params.tasks.length === 0) {
|
|
13524
|
+
throw new PolyVValidationError("tasks must be a non-empty array", "tasks");
|
|
13525
|
+
}
|
|
13526
|
+
if (params.allDone !== "Y" && params.allDone !== "N") {
|
|
13527
|
+
throw new PolyVValidationError("allDone must be 'Y' or 'N'", "allDone");
|
|
13528
|
+
}
|
|
13529
|
+
const body = {
|
|
13530
|
+
channelId: Number(params.channelId),
|
|
13531
|
+
tasks: params.tasks,
|
|
13532
|
+
allDone: params.allDone
|
|
13533
|
+
};
|
|
13534
|
+
if (params.callbackUrl !== void 0) body.callbackUrl = params.callbackUrl;
|
|
13535
|
+
if (params.payload !== void 0) body.payload = params.payload;
|
|
13536
|
+
const response = await this.client.httpClient.post(
|
|
13358
13537
|
"/live/v4/channel/interaction-event/save",
|
|
13359
|
-
|
|
13538
|
+
body
|
|
13360
13539
|
);
|
|
13540
|
+
return response;
|
|
13361
13541
|
}
|
|
13362
13542
|
/**
|
|
13363
|
-
* Delete interaction event
|
|
13543
|
+
* Delete interaction event.
|
|
13544
|
+
*
|
|
13545
|
+
* The body carries channelId + taskIds (pass the activityId when the activity
|
|
13546
|
+
* was saved with allDone=Y); only appId/timestamp are signed (query).
|
|
13364
13547
|
*
|
|
13365
13548
|
* @param params - Delete parameters
|
|
13366
13549
|
*/
|
|
13367
13550
|
async interactionEventDelete(params) {
|
|
13368
13551
|
this.validateChannelId(params.channelId);
|
|
13369
|
-
|
|
13552
|
+
if (!Array.isArray(params.taskIds) || params.taskIds.length === 0) {
|
|
13553
|
+
throw new PolyVValidationError("taskIds must be a non-empty array", "taskIds");
|
|
13554
|
+
}
|
|
13555
|
+
const body = {
|
|
13556
|
+
channelId: Number(params.channelId),
|
|
13557
|
+
taskIds: params.taskIds
|
|
13558
|
+
};
|
|
13559
|
+
const response = await this.client.httpClient.post(
|
|
13370
13560
|
"/live/v4/channel/interaction-event/delete",
|
|
13371
|
-
|
|
13372
|
-
{ params }
|
|
13561
|
+
body
|
|
13373
13562
|
);
|
|
13563
|
+
return response;
|
|
13374
13564
|
}
|
|
13375
13565
|
/**
|
|
13376
13566
|
* Create inviter
|
|
@@ -15059,10 +15249,19 @@ var V4ChannelService = class {
|
|
|
15059
15249
|
this.validateOptionalYn(params.aiKnowledgeQuizEnabled, "aiKnowledgeQuizEnabled");
|
|
15060
15250
|
this.validateOptionalYn(params.aiSummaryAuditEnabled, "aiSummaryAuditEnabled");
|
|
15061
15251
|
this.validateOptionalYn(params.syncToPlaybackDotEnabled, "syncToPlaybackDotEnabled");
|
|
15252
|
+
const body = { fileId: params.fileId };
|
|
15253
|
+
if (params.aiKnowledgeQuizEnabled !== void 0) {
|
|
15254
|
+
body.aiKnowledgeQuizEnabled = params.aiKnowledgeQuizEnabled;
|
|
15255
|
+
}
|
|
15256
|
+
if (params.aiSummaryAuditEnabled !== void 0) {
|
|
15257
|
+
body.aiSummaryAuditEnabled = params.aiSummaryAuditEnabled;
|
|
15258
|
+
}
|
|
15259
|
+
if (params.syncToPlaybackDotEnabled !== void 0) {
|
|
15260
|
+
body.syncToPlaybackDotEnabled = params.syncToPlaybackDotEnabled;
|
|
15261
|
+
}
|
|
15062
15262
|
const response = await this.client.httpClient.post(
|
|
15063
15263
|
"/live/v4/channel/record-file/subtitle/outline/create",
|
|
15064
|
-
|
|
15065
|
-
{ params }
|
|
15264
|
+
body
|
|
15066
15265
|
);
|
|
15067
15266
|
return response;
|
|
15068
15267
|
}
|
|
@@ -15089,8 +15288,7 @@ var V4ChannelService = class {
|
|
|
15089
15288
|
});
|
|
15090
15289
|
await this.client.httpClient.post(
|
|
15091
15290
|
"/live/v4/channel/record-file/subtitle/batch-publish",
|
|
15092
|
-
|
|
15093
|
-
{ params }
|
|
15291
|
+
params.subtitles
|
|
15094
15292
|
);
|
|
15095
15293
|
}
|
|
15096
15294
|
/**
|
|
@@ -15979,14 +16177,16 @@ var V4UserService = class {
|
|
|
15979
16177
|
if (params.childEmail) {
|
|
15980
16178
|
await this.client.httpClient.post(
|
|
15981
16179
|
"/live/v4/user/children/delete",
|
|
15982
|
-
|
|
16180
|
+
void 0,
|
|
16181
|
+
{ params: { childEmail: params.childEmail } }
|
|
15983
16182
|
);
|
|
15984
16183
|
return;
|
|
15985
16184
|
}
|
|
15986
16185
|
if (params.childEmails && params.childEmails.length > 0) {
|
|
15987
16186
|
await this.client.httpClient.post(
|
|
15988
16187
|
"/live/v4/user/children/delete",
|
|
15989
|
-
|
|
16188
|
+
void 0,
|
|
16189
|
+
{ params: { childEmails: params.childEmails } }
|
|
15990
16190
|
);
|
|
15991
16191
|
return;
|
|
15992
16192
|
}
|
|
@@ -16107,7 +16307,8 @@ var V4UserService = class {
|
|
|
16107
16307
|
this.validateRequiredNumber(params.organizationId, "organizationId");
|
|
16108
16308
|
await this.client.httpClient.post(
|
|
16109
16309
|
"/live/v4/user/organization/delete",
|
|
16110
|
-
|
|
16310
|
+
void 0,
|
|
16311
|
+
{ params: { organizationId: params.organizationId } }
|
|
16111
16312
|
);
|
|
16112
16313
|
}
|
|
16113
16314
|
// ============================================
|
|
@@ -17328,7 +17529,8 @@ var V4UserService = class {
|
|
|
17328
17529
|
this.validateYnValue(params.enabled, "enabled");
|
|
17329
17530
|
await this.client.httpClient.post(
|
|
17330
17531
|
"/live/v4/user/global-setting/pv-show/update",
|
|
17331
|
-
|
|
17532
|
+
void 0,
|
|
17533
|
+
{ params: { enabled: params.enabled } }
|
|
17332
17534
|
);
|
|
17333
17535
|
}
|
|
17334
17536
|
// ============================================
|
|
@@ -17792,14 +17994,16 @@ var V4GlobalService = class {
|
|
|
17792
17994
|
* ```
|
|
17793
17995
|
*/
|
|
17794
17996
|
async updatePageSetting(params) {
|
|
17795
|
-
const queryParams =
|
|
17997
|
+
const queryParams = {};
|
|
17796
17998
|
for (const [key, value] of Object.entries(params)) {
|
|
17797
17999
|
if (value !== void 0) {
|
|
17798
|
-
queryParams
|
|
18000
|
+
queryParams[key] = String(value);
|
|
17799
18001
|
}
|
|
17800
18002
|
}
|
|
17801
18003
|
await this.client.httpClient.post(
|
|
17802
|
-
|
|
18004
|
+
"/live/v4/user/template/page-setting/update",
|
|
18005
|
+
void 0,
|
|
18006
|
+
{ params: queryParams }
|
|
17803
18007
|
);
|
|
17804
18008
|
}
|
|
17805
18009
|
};
|
|
@@ -18682,7 +18886,9 @@ var V4WebAppService = class {
|
|
|
18682
18886
|
throw new PolyVValidationError("roleId is required", "roleId");
|
|
18683
18887
|
}
|
|
18684
18888
|
await this.client.httpClient.post(
|
|
18685
|
-
|
|
18889
|
+
"/live/v4/user/webapp-role/delete",
|
|
18890
|
+
void 0,
|
|
18891
|
+
{ params: { id: roleId } }
|
|
18686
18892
|
);
|
|
18687
18893
|
}
|
|
18688
18894
|
};
|
|
@@ -19381,7 +19587,7 @@ var PolyVClient = class {
|
|
|
19381
19587
|
* Create and configure the Axios HTTP client with interceptors
|
|
19382
19588
|
*/
|
|
19383
19589
|
createHttpClient() {
|
|
19384
|
-
const client =
|
|
19590
|
+
const client = axios2.create({
|
|
19385
19591
|
baseURL: this.config.baseUrl,
|
|
19386
19592
|
timeout: this.config.timeout,
|
|
19387
19593
|
headers: this.config.headers
|
|
@@ -19444,12 +19650,12 @@ var PolyVClient = class {
|
|
|
19444
19650
|
* Transform Axios errors to PolyVAPIError
|
|
19445
19651
|
*/
|
|
19446
19652
|
transformAxiosError(error) {
|
|
19447
|
-
if (
|
|
19653
|
+
if (axios2.isCancel(error)) {
|
|
19448
19654
|
return new PolyVAPIError("Request cancelled", 0, {
|
|
19449
19655
|
code: "REQUEST_CANCELLED"
|
|
19450
19656
|
});
|
|
19451
19657
|
}
|
|
19452
|
-
if (
|
|
19658
|
+
if (axios2.isAxiosError(error)) {
|
|
19453
19659
|
if (error.response) {
|
|
19454
19660
|
const { status, data } = error.response;
|
|
19455
19661
|
return new PolyVAPIError(
|