@redonvn/zalo-ads-sdk 0.2.2 → 0.2.4
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.d.mts +1035 -91
- package/dist/index.d.ts +1035 -91
- package/dist/index.js +2362 -798
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2338 -797
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ var ZaloSdkError = class extends Error {
|
|
|
3
3
|
status;
|
|
4
4
|
operationId;
|
|
5
5
|
responseBody;
|
|
6
|
-
constructor(message, status, operationId, responseBody) {
|
|
6
|
+
constructor(message, status = 500, operationId = "unknown", responseBody = null) {
|
|
7
7
|
super(message);
|
|
8
8
|
this.name = "ZaloSdkError";
|
|
9
9
|
this.status = status;
|
|
@@ -1038,43 +1038,7 @@ async function resolveCookies(auth, context) {
|
|
|
1038
1038
|
return { ...auth?.cookies ?? {}, ...await auth?.getCookies?.(context) ?? {} };
|
|
1039
1039
|
}
|
|
1040
1040
|
|
|
1041
|
-
// src/services/
|
|
1042
|
-
var OP_ZaloAdsListFlowsByOfficialAccount = {
|
|
1043
|
-
operationId: "ZaloAds_listFlowsByOfficialAccount",
|
|
1044
|
-
method: "GET",
|
|
1045
|
-
endpoint: "/api/flow/getByOaId",
|
|
1046
|
-
baseUrl: "https://ads.zalo.me",
|
|
1047
|
-
binaryFields: [],
|
|
1048
|
-
pathFields: [],
|
|
1049
|
-
queryFields: ["oaId", "limit", "offset", "flowId"],
|
|
1050
|
-
headerFields: [],
|
|
1051
|
-
cookieFields: [],
|
|
1052
|
-
bodyFields: []
|
|
1053
|
-
};
|
|
1054
|
-
var OP_ZaloAdsCreateFlow = {
|
|
1055
|
-
operationId: "ZaloAds_createFlow",
|
|
1056
|
-
method: "POST",
|
|
1057
|
-
endpoint: "/api/flow/create",
|
|
1058
|
-
baseUrl: "https://ads.zalo.me",
|
|
1059
|
-
binaryFields: [],
|
|
1060
|
-
pathFields: [],
|
|
1061
|
-
queryFields: [],
|
|
1062
|
-
headerFields: [],
|
|
1063
|
-
cookieFields: [],
|
|
1064
|
-
bodyFields: ["oaId", "id", "name", "messages"]
|
|
1065
|
-
};
|
|
1066
|
-
var OP_ZaloAdsUpdateFlow = {
|
|
1067
|
-
operationId: "ZaloAds_updateFlow",
|
|
1068
|
-
method: "POST",
|
|
1069
|
-
endpoint: "/api/flow/update",
|
|
1070
|
-
baseUrl: "https://ads.zalo.me",
|
|
1071
|
-
binaryFields: [],
|
|
1072
|
-
pathFields: [],
|
|
1073
|
-
queryFields: [],
|
|
1074
|
-
headerFields: [],
|
|
1075
|
-
cookieFields: [],
|
|
1076
|
-
bodyFields: ["oaId", "id", "name", "messages"]
|
|
1077
|
-
};
|
|
1041
|
+
// src/services/campaigns.service.ts
|
|
1078
1042
|
var OP_ZaloAdsUpdateVideoAd = {
|
|
1079
1043
|
operationId: "ZaloAds_updateVideoAd",
|
|
1080
1044
|
method: "POST",
|
|
@@ -1102,22 +1066,6 @@ var OP_ZaloAdsChangeCampaignStatus = {
|
|
|
1102
1066
|
"campaignId"
|
|
1103
1067
|
]
|
|
1104
1068
|
};
|
|
1105
|
-
var OP_ZaloAdsCreateCustomAudience = {
|
|
1106
|
-
"operationId": "ZaloAds_createCustomAudience",
|
|
1107
|
-
"method": "POST",
|
|
1108
|
-
"endpoint": "/api/ad/audience",
|
|
1109
|
-
"baseUrl": "https://ads.zalo.me",
|
|
1110
|
-
"binaryFields": [],
|
|
1111
|
-
"pathFields": [],
|
|
1112
|
-
"queryFields": [],
|
|
1113
|
-
"headerFields": [],
|
|
1114
|
-
"cookieFields": [],
|
|
1115
|
-
"bodyFields": [
|
|
1116
|
-
"name",
|
|
1117
|
-
"caType",
|
|
1118
|
-
"targeting"
|
|
1119
|
-
]
|
|
1120
|
-
};
|
|
1121
1069
|
var OP_ZaloAdsCreateEcommerceCampaign = {
|
|
1122
1070
|
"operationId": "ZaloAds_createEcommerceCampaign",
|
|
1123
1071
|
"method": "POST",
|
|
@@ -1202,54 +1150,6 @@ var OP_ZaloAdsCreatePostCampaign = {
|
|
|
1202
1150
|
"data"
|
|
1203
1151
|
]
|
|
1204
1152
|
};
|
|
1205
|
-
var OP_ZaloAdsCreateConversion = {
|
|
1206
|
-
"operationId": "ZaloAds_createConversion",
|
|
1207
|
-
"method": "POST",
|
|
1208
|
-
"endpoint": "/api/conversion/add",
|
|
1209
|
-
"baseUrl": "https://ads.zalo.me",
|
|
1210
|
-
"binaryFields": [],
|
|
1211
|
-
"pathFields": [],
|
|
1212
|
-
"queryFields": [],
|
|
1213
|
-
"headerFields": [],
|
|
1214
|
-
"cookieFields": [],
|
|
1215
|
-
"bodyFields": [
|
|
1216
|
-
"name",
|
|
1217
|
-
"landingPage",
|
|
1218
|
-
"urlType",
|
|
1219
|
-
"labelId",
|
|
1220
|
-
"buttonIds",
|
|
1221
|
-
"elements",
|
|
1222
|
-
"keywords"
|
|
1223
|
-
]
|
|
1224
|
-
};
|
|
1225
|
-
var OP_ZaloAdsDeleteConversion = {
|
|
1226
|
-
"operationId": "ZaloAds_deleteConversion",
|
|
1227
|
-
"method": "DELETE",
|
|
1228
|
-
"endpoint": "/api/conversion/delete/{conversionId}",
|
|
1229
|
-
"baseUrl": "https://ads.zalo.me",
|
|
1230
|
-
"binaryFields": [],
|
|
1231
|
-
"pathFields": [
|
|
1232
|
-
"conversionId"
|
|
1233
|
-
],
|
|
1234
|
-
"queryFields": [],
|
|
1235
|
-
"headerFields": [],
|
|
1236
|
-
"cookieFields": [],
|
|
1237
|
-
"bodyFields": []
|
|
1238
|
-
};
|
|
1239
|
-
var OP_ZaloAdsDeleteCustomAudience = {
|
|
1240
|
-
"operationId": "ZaloAds_deleteCustomAudience",
|
|
1241
|
-
"method": "DELETE",
|
|
1242
|
-
"endpoint": "/api/ad/audience/{customAudienceId}",
|
|
1243
|
-
"baseUrl": "https://ads.zalo.me",
|
|
1244
|
-
"binaryFields": [],
|
|
1245
|
-
"pathFields": [
|
|
1246
|
-
"customAudienceId"
|
|
1247
|
-
],
|
|
1248
|
-
"queryFields": [],
|
|
1249
|
-
"headerFields": [],
|
|
1250
|
-
"cookieFields": [],
|
|
1251
|
-
"bodyFields": []
|
|
1252
|
-
};
|
|
1253
1153
|
var OP_ZaloAdsGetAdById = {
|
|
1254
1154
|
"operationId": "ZaloAds_getAdById",
|
|
1255
1155
|
"method": "GET",
|
|
@@ -1280,10 +1180,10 @@ var OP_ZaloAdsGetAdChangeLog = {
|
|
|
1280
1180
|
"cookieFields": [],
|
|
1281
1181
|
"bodyFields": []
|
|
1282
1182
|
};
|
|
1283
|
-
var
|
|
1284
|
-
"operationId": "
|
|
1183
|
+
var OP_ZaloAdsGetApiPlaceGetalldistricts = {
|
|
1184
|
+
"operationId": "ZaloAds_getApiPlaceGetalldistricts",
|
|
1285
1185
|
"method": "GET",
|
|
1286
|
-
"endpoint": "/api/
|
|
1186
|
+
"endpoint": "/api/place/getAllDistricts",
|
|
1287
1187
|
"baseUrl": "https://ads.zalo.me",
|
|
1288
1188
|
"binaryFields": [],
|
|
1289
1189
|
"pathFields": [],
|
|
@@ -1292,48 +1192,54 @@ var OP_ZaloAdsGetApiAdGetlistadadvancetargeting = {
|
|
|
1292
1192
|
"cookieFields": [],
|
|
1293
1193
|
"bodyFields": []
|
|
1294
1194
|
};
|
|
1295
|
-
var
|
|
1296
|
-
"operationId": "
|
|
1195
|
+
var OP_ZaloAdsGetApiSpellCheckV2 = {
|
|
1196
|
+
"operationId": "ZaloAds_getApiSpellCheckV2",
|
|
1297
1197
|
"method": "GET",
|
|
1298
|
-
"endpoint": "/api/
|
|
1198
|
+
"endpoint": "/api/spell-check/v2",
|
|
1299
1199
|
"baseUrl": "https://ads.zalo.me",
|
|
1300
1200
|
"binaryFields": [],
|
|
1301
1201
|
"pathFields": [],
|
|
1302
1202
|
"queryFields": [
|
|
1303
|
-
"
|
|
1203
|
+
"text"
|
|
1304
1204
|
],
|
|
1305
1205
|
"headerFields": [],
|
|
1306
1206
|
"cookieFields": [],
|
|
1307
1207
|
"bodyFields": []
|
|
1308
1208
|
};
|
|
1309
|
-
var
|
|
1310
|
-
"operationId": "
|
|
1209
|
+
var OP_ZaloAdsGetZaapiCheckcamphasmanyads = {
|
|
1210
|
+
"operationId": "ZaloAds_getZaapiCheckcamphasmanyads",
|
|
1311
1211
|
"method": "GET",
|
|
1312
|
-
"endpoint": "/
|
|
1212
|
+
"endpoint": "/zaapi/checkCampHasManyAds",
|
|
1313
1213
|
"baseUrl": "https://ads.zalo.me",
|
|
1314
1214
|
"binaryFields": [],
|
|
1315
1215
|
"pathFields": [],
|
|
1316
|
-
"queryFields": [
|
|
1216
|
+
"queryFields": [
|
|
1217
|
+
"campaignId",
|
|
1218
|
+
"campId"
|
|
1219
|
+
],
|
|
1317
1220
|
"headerFields": [],
|
|
1318
1221
|
"cookieFields": [],
|
|
1319
1222
|
"bodyFields": []
|
|
1320
1223
|
};
|
|
1321
|
-
var
|
|
1322
|
-
"operationId": "
|
|
1224
|
+
var OP_ZaloAdsGetZaapiGetadsfromcampaignid = {
|
|
1225
|
+
"operationId": "ZaloAds_getZaapiGetadsfromcampaignid",
|
|
1323
1226
|
"method": "GET",
|
|
1324
|
-
"endpoint": "/
|
|
1227
|
+
"endpoint": "/zaapi/getAdsFromCampaignId",
|
|
1325
1228
|
"baseUrl": "https://ads.zalo.me",
|
|
1326
1229
|
"binaryFields": [],
|
|
1327
1230
|
"pathFields": [],
|
|
1328
|
-
"queryFields": [
|
|
1231
|
+
"queryFields": [
|
|
1232
|
+
"campaignId",
|
|
1233
|
+
"campId"
|
|
1234
|
+
],
|
|
1329
1235
|
"headerFields": [],
|
|
1330
1236
|
"cookieFields": [],
|
|
1331
1237
|
"bodyFields": []
|
|
1332
1238
|
};
|
|
1333
|
-
var
|
|
1334
|
-
"operationId": "
|
|
1239
|
+
var OP_ZaloAdsGetZaapiGetallpages = {
|
|
1240
|
+
"operationId": "ZaloAds_getZaapiGetallpages",
|
|
1335
1241
|
"method": "GET",
|
|
1336
|
-
"endpoint": "/
|
|
1242
|
+
"endpoint": "/zaapi/getAllPages",
|
|
1337
1243
|
"baseUrl": "https://ads.zalo.me",
|
|
1338
1244
|
"binaryFields": [],
|
|
1339
1245
|
"pathFields": [],
|
|
@@ -1342,24 +1248,24 @@ var OP_ZaloAdsGetApiConversionStandardEvents = {
|
|
|
1342
1248
|
"cookieFields": [],
|
|
1343
1249
|
"bodyFields": []
|
|
1344
1250
|
};
|
|
1345
|
-
var
|
|
1346
|
-
"operationId": "
|
|
1251
|
+
var OP_ZaloAdsGetZaapiGetownedarticles = {
|
|
1252
|
+
"operationId": "ZaloAds_getZaapiGetownedarticles",
|
|
1347
1253
|
"method": "GET",
|
|
1348
|
-
"endpoint": "/
|
|
1254
|
+
"endpoint": "/zaapi/getOwnedArticles",
|
|
1349
1255
|
"baseUrl": "https://ads.zalo.me",
|
|
1350
1256
|
"binaryFields": [],
|
|
1351
1257
|
"pathFields": [],
|
|
1352
1258
|
"queryFields": [
|
|
1353
|
-
"
|
|
1259
|
+
"pageId"
|
|
1354
1260
|
],
|
|
1355
1261
|
"headerFields": [],
|
|
1356
1262
|
"cookieFields": [],
|
|
1357
1263
|
"bodyFields": []
|
|
1358
1264
|
};
|
|
1359
|
-
var
|
|
1360
|
-
"operationId": "
|
|
1265
|
+
var OP_ZaloAdsGetZaapiGetownedpages = {
|
|
1266
|
+
"operationId": "ZaloAds_getZaapiGetownedpages",
|
|
1361
1267
|
"method": "GET",
|
|
1362
|
-
"endpoint": "/
|
|
1268
|
+
"endpoint": "/zaapi/getOwnedPages",
|
|
1363
1269
|
"baseUrl": "https://ads.zalo.me",
|
|
1364
1270
|
"binaryFields": [],
|
|
1365
1271
|
"pathFields": [],
|
|
@@ -1368,336 +1274,252 @@ var OP_ZaloAdsGetApiFilegroups = {
|
|
|
1368
1274
|
"cookieFields": [],
|
|
1369
1275
|
"bodyFields": []
|
|
1370
1276
|
};
|
|
1371
|
-
var
|
|
1372
|
-
"operationId": "
|
|
1277
|
+
var OP_ZaloAdsListFormsByOfficialAccount = {
|
|
1278
|
+
"operationId": "ZaloAds_listFormsByOfficialAccount",
|
|
1373
1279
|
"method": "GET",
|
|
1374
|
-
"endpoint": "/api/
|
|
1280
|
+
"endpoint": "/api/form/getByOaId",
|
|
1375
1281
|
"baseUrl": "https://ads.zalo.me",
|
|
1376
1282
|
"binaryFields": [],
|
|
1377
1283
|
"pathFields": [],
|
|
1378
|
-
"queryFields": [
|
|
1284
|
+
"queryFields": [
|
|
1285
|
+
"oaId",
|
|
1286
|
+
"isAll"
|
|
1287
|
+
],
|
|
1379
1288
|
"headerFields": [],
|
|
1380
1289
|
"cookieFields": [],
|
|
1381
1290
|
"bodyFields": []
|
|
1382
1291
|
};
|
|
1383
|
-
var
|
|
1384
|
-
"operationId": "
|
|
1292
|
+
var OP_ZaloAdsListMiniPagesByTemplate = {
|
|
1293
|
+
"operationId": "ZaloAds_listMiniPagesByTemplate",
|
|
1385
1294
|
"method": "GET",
|
|
1386
|
-
"endpoint": "/api/
|
|
1295
|
+
"endpoint": "/api/mini-pages",
|
|
1387
1296
|
"baseUrl": "https://ads.zalo.me",
|
|
1388
1297
|
"binaryFields": [],
|
|
1389
1298
|
"pathFields": [],
|
|
1390
1299
|
"queryFields": [
|
|
1391
|
-
"
|
|
1392
|
-
"startDate"
|
|
1300
|
+
"templateIds"
|
|
1393
1301
|
],
|
|
1394
1302
|
"headerFields": [],
|
|
1395
1303
|
"cookieFields": [],
|
|
1396
1304
|
"bodyFields": []
|
|
1397
1305
|
};
|
|
1398
|
-
var
|
|
1399
|
-
"operationId": "
|
|
1400
|
-
"method": "
|
|
1401
|
-
"endpoint": "/
|
|
1306
|
+
var OP_ZaloAdsPostZaapiDeletead = {
|
|
1307
|
+
"operationId": "ZaloAds_postZaapiDeletead",
|
|
1308
|
+
"method": "POST",
|
|
1309
|
+
"endpoint": "/zaapi/deleteAd",
|
|
1402
1310
|
"baseUrl": "https://ads.zalo.me",
|
|
1403
1311
|
"binaryFields": [],
|
|
1404
1312
|
"pathFields": [],
|
|
1405
|
-
"queryFields": [
|
|
1313
|
+
"queryFields": [
|
|
1314
|
+
"adId"
|
|
1315
|
+
],
|
|
1406
1316
|
"headerFields": [],
|
|
1407
1317
|
"cookieFields": [],
|
|
1408
|
-
"bodyFields": [
|
|
1318
|
+
"bodyFields": [
|
|
1319
|
+
"adId"
|
|
1320
|
+
]
|
|
1409
1321
|
};
|
|
1410
|
-
var
|
|
1411
|
-
"operationId": "
|
|
1412
|
-
"method": "
|
|
1413
|
-
"endpoint": "/api/
|
|
1322
|
+
var OP_ZaloAdsRenameCampaign = {
|
|
1323
|
+
"operationId": "ZaloAds_renameCampaign",
|
|
1324
|
+
"method": "POST",
|
|
1325
|
+
"endpoint": "/api/campaign/change-name",
|
|
1414
1326
|
"baseUrl": "https://ads.zalo.me",
|
|
1415
1327
|
"binaryFields": [],
|
|
1416
1328
|
"pathFields": [],
|
|
1417
1329
|
"queryFields": [],
|
|
1418
1330
|
"headerFields": [],
|
|
1419
1331
|
"cookieFields": [],
|
|
1420
|
-
"bodyFields": [
|
|
1332
|
+
"bodyFields": [
|
|
1333
|
+
"campid",
|
|
1334
|
+
"newname"
|
|
1335
|
+
]
|
|
1421
1336
|
};
|
|
1422
|
-
var
|
|
1423
|
-
"operationId": "
|
|
1424
|
-
"method": "
|
|
1425
|
-
"endpoint": "/
|
|
1337
|
+
var OP_ZaloAdsUpdateEcommerceAd = {
|
|
1338
|
+
"operationId": "ZaloAds_updateEcommerceAd",
|
|
1339
|
+
"method": "POST",
|
|
1340
|
+
"endpoint": "/zaapi/UpdateAd",
|
|
1426
1341
|
"baseUrl": "https://ads.zalo.me",
|
|
1427
1342
|
"binaryFields": [],
|
|
1428
1343
|
"pathFields": [],
|
|
1429
|
-
"queryFields": [
|
|
1430
|
-
"to",
|
|
1431
|
-
"from",
|
|
1432
|
-
"memberId"
|
|
1433
|
-
],
|
|
1344
|
+
"queryFields": [],
|
|
1434
1345
|
"headerFields": [],
|
|
1435
1346
|
"cookieFields": [],
|
|
1436
|
-
"bodyFields": [
|
|
1347
|
+
"bodyFields": [
|
|
1348
|
+
"est",
|
|
1349
|
+
"stt",
|
|
1350
|
+
"data",
|
|
1351
|
+
"isBoostAd"
|
|
1352
|
+
]
|
|
1437
1353
|
};
|
|
1438
|
-
var
|
|
1439
|
-
"operationId": "
|
|
1440
|
-
"method": "
|
|
1441
|
-
"endpoint": "/
|
|
1354
|
+
var OP_ZaloAdsUpdateFormAd = {
|
|
1355
|
+
"operationId": "ZaloAds_updateFormAd",
|
|
1356
|
+
"method": "POST",
|
|
1357
|
+
"endpoint": "/zaapi/UpdateAd",
|
|
1442
1358
|
"baseUrl": "https://ads.zalo.me",
|
|
1443
1359
|
"binaryFields": [],
|
|
1444
1360
|
"pathFields": [],
|
|
1445
1361
|
"queryFields": [],
|
|
1446
1362
|
"headerFields": [],
|
|
1447
1363
|
"cookieFields": [],
|
|
1448
|
-
"bodyFields": [
|
|
1364
|
+
"bodyFields": [
|
|
1365
|
+
"est",
|
|
1366
|
+
"stt",
|
|
1367
|
+
"data",
|
|
1368
|
+
"isBoostAd"
|
|
1369
|
+
]
|
|
1449
1370
|
};
|
|
1450
|
-
var
|
|
1451
|
-
"operationId": "
|
|
1452
|
-
"method": "
|
|
1453
|
-
"endpoint": "/
|
|
1371
|
+
var OP_ZaloAdsUpdateMessageAd = {
|
|
1372
|
+
"operationId": "ZaloAds_updateMessageAd",
|
|
1373
|
+
"method": "POST",
|
|
1374
|
+
"endpoint": "/zaapi/UpdateAd",
|
|
1454
1375
|
"baseUrl": "https://ads.zalo.me",
|
|
1455
1376
|
"binaryFields": [],
|
|
1456
1377
|
"pathFields": [],
|
|
1457
|
-
"queryFields": [
|
|
1458
|
-
"text"
|
|
1459
|
-
],
|
|
1378
|
+
"queryFields": [],
|
|
1460
1379
|
"headerFields": [],
|
|
1461
1380
|
"cookieFields": [],
|
|
1462
|
-
"bodyFields": [
|
|
1381
|
+
"bodyFields": [
|
|
1382
|
+
"est",
|
|
1383
|
+
"stt",
|
|
1384
|
+
"data",
|
|
1385
|
+
"isBoostAd"
|
|
1386
|
+
]
|
|
1463
1387
|
};
|
|
1464
|
-
var
|
|
1465
|
-
"operationId": "
|
|
1466
|
-
"method": "
|
|
1467
|
-
"endpoint": "/
|
|
1468
|
-
"baseUrl": "https://ads.zalo.me",
|
|
1469
|
-
"binaryFields": [],
|
|
1470
|
-
"pathFields": [],
|
|
1471
|
-
"queryFields": [],
|
|
1472
|
-
"headerFields": [],
|
|
1473
|
-
"cookieFields": [],
|
|
1474
|
-
"bodyFields": []
|
|
1475
|
-
};
|
|
1476
|
-
var OP_ZaloAdsGetReportapiV2Ads = {
|
|
1477
|
-
"operationId": "ZaloAds_getReportapiV2Ads",
|
|
1478
|
-
"method": "GET",
|
|
1479
|
-
"endpoint": "/reportapi/v2/ads",
|
|
1480
|
-
"baseUrl": "https://ads.zalo.me",
|
|
1481
|
-
"binaryFields": [],
|
|
1482
|
-
"pathFields": [],
|
|
1483
|
-
"queryFields": [
|
|
1484
|
-
"to",
|
|
1485
|
-
"from",
|
|
1486
|
-
"filter",
|
|
1487
|
-
"endDate",
|
|
1488
|
-
"refresh",
|
|
1489
|
-
"breakdown",
|
|
1490
|
-
"startDate"
|
|
1491
|
-
],
|
|
1492
|
-
"headerFields": [],
|
|
1493
|
-
"cookieFields": [],
|
|
1494
|
-
"bodyFields": []
|
|
1495
|
-
};
|
|
1496
|
-
var OP_ZaloAdsGetReportapiV2Campaigns = {
|
|
1497
|
-
"operationId": "ZaloAds_getReportapiV2Campaigns",
|
|
1498
|
-
"method": "GET",
|
|
1499
|
-
"endpoint": "/reportapi/v2/campaigns/{campaignId}",
|
|
1388
|
+
var OP_ZaloAdsUpdateNewAds = {
|
|
1389
|
+
"operationId": "ZaloAds_UpdateNewAds",
|
|
1390
|
+
"method": "POST",
|
|
1391
|
+
"endpoint": "/zaapi/UploadCrop",
|
|
1500
1392
|
"baseUrl": "https://ads.zalo.me",
|
|
1501
|
-
"binaryFields": [
|
|
1502
|
-
|
|
1503
|
-
"campaignId"
|
|
1504
|
-
],
|
|
1505
|
-
"queryFields": [
|
|
1506
|
-
"startDate",
|
|
1507
|
-
"endDate",
|
|
1508
|
-
"refresh"
|
|
1393
|
+
"binaryFields": [
|
|
1394
|
+
"File"
|
|
1509
1395
|
],
|
|
1510
|
-
"headerFields": [],
|
|
1511
|
-
"cookieFields": [],
|
|
1512
|
-
"bodyFields": []
|
|
1513
|
-
};
|
|
1514
|
-
var OP_ZaloAdsGetReportapiV2UniqueUser = {
|
|
1515
|
-
"operationId": "ZaloAds_getReportapiV2UniqueUser",
|
|
1516
|
-
"method": "GET",
|
|
1517
|
-
"endpoint": "/reportapi/v2/unique-user",
|
|
1518
|
-
"baseUrl": "https://ads.zalo.me",
|
|
1519
|
-
"binaryFields": [],
|
|
1520
1396
|
"pathFields": [],
|
|
1521
1397
|
"queryFields": [],
|
|
1522
1398
|
"headerFields": [],
|
|
1523
1399
|
"cookieFields": [],
|
|
1524
|
-
"bodyFields": [
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
"pathFields": [],
|
|
1533
|
-
"queryFields": [
|
|
1534
|
-
"filter",
|
|
1535
|
-
"endDate",
|
|
1536
|
-
"refresh",
|
|
1537
|
-
"agencyId",
|
|
1538
|
-
"createdBy",
|
|
1539
|
-
"startDate"
|
|
1540
|
-
],
|
|
1541
|
-
"headerFields": [],
|
|
1542
|
-
"cookieFields": [],
|
|
1543
|
-
"bodyFields": []
|
|
1544
|
-
};
|
|
1545
|
-
var OP_ZaloAdsGetZaapiCampaignReportcampaign = {
|
|
1546
|
-
"operationId": "ZaloAds_getZaapiCampaignReportcampaign",
|
|
1547
|
-
"method": "GET",
|
|
1548
|
-
"endpoint": "/zaapi/Campaign/reportCampaign",
|
|
1549
|
-
"baseUrl": "https://ads.zalo.me",
|
|
1550
|
-
"binaryFields": [],
|
|
1551
|
-
"pathFields": [],
|
|
1552
|
-
"queryFields": [
|
|
1553
|
-
"campaignId",
|
|
1554
|
-
"campId"
|
|
1555
|
-
],
|
|
1556
|
-
"headerFields": [],
|
|
1557
|
-
"cookieFields": [],
|
|
1558
|
-
"bodyFields": []
|
|
1559
|
-
};
|
|
1560
|
-
var OP_ZaloAdsGetZaapiCheckcamphasmanyads = {
|
|
1561
|
-
"operationId": "ZaloAds_getZaapiCheckcamphasmanyads",
|
|
1562
|
-
"method": "GET",
|
|
1563
|
-
"endpoint": "/zaapi/checkCampHasManyAds",
|
|
1564
|
-
"baseUrl": "https://ads.zalo.me",
|
|
1565
|
-
"binaryFields": [],
|
|
1566
|
-
"pathFields": [],
|
|
1567
|
-
"queryFields": [
|
|
1568
|
-
"campaignId",
|
|
1569
|
-
"campId"
|
|
1570
|
-
],
|
|
1571
|
-
"headerFields": [],
|
|
1572
|
-
"cookieFields": [],
|
|
1573
|
-
"bodyFields": []
|
|
1574
|
-
};
|
|
1575
|
-
var OP_ZaloAdsGetZaapiGetadsfromcampaignid = {
|
|
1576
|
-
"operationId": "ZaloAds_getZaapiGetadsfromcampaignid",
|
|
1577
|
-
"method": "GET",
|
|
1578
|
-
"endpoint": "/zaapi/getAdsFromCampaignId",
|
|
1579
|
-
"baseUrl": "https://ads.zalo.me",
|
|
1580
|
-
"binaryFields": [],
|
|
1581
|
-
"pathFields": [],
|
|
1582
|
-
"queryFields": [
|
|
1583
|
-
"campaignId",
|
|
1584
|
-
"campId"
|
|
1585
|
-
],
|
|
1586
|
-
"headerFields": [],
|
|
1587
|
-
"cookieFields": [],
|
|
1588
|
-
"bodyFields": []
|
|
1400
|
+
"bodyFields": [
|
|
1401
|
+
"File",
|
|
1402
|
+
"x",
|
|
1403
|
+
"y",
|
|
1404
|
+
"width",
|
|
1405
|
+
"height",
|
|
1406
|
+
"scale"
|
|
1407
|
+
]
|
|
1589
1408
|
};
|
|
1590
|
-
var
|
|
1591
|
-
"operationId": "
|
|
1592
|
-
"method": "
|
|
1593
|
-
"endpoint": "/zaapi/
|
|
1409
|
+
var OP_ZaloAdsUpdateOfficialAccountAd = {
|
|
1410
|
+
"operationId": "ZaloAds_updateOfficialAccountAd",
|
|
1411
|
+
"method": "POST",
|
|
1412
|
+
"endpoint": "/zaapi/UpdateAd",
|
|
1594
1413
|
"baseUrl": "https://ads.zalo.me",
|
|
1595
1414
|
"binaryFields": [],
|
|
1596
1415
|
"pathFields": [],
|
|
1597
1416
|
"queryFields": [],
|
|
1598
1417
|
"headerFields": [],
|
|
1599
1418
|
"cookieFields": [],
|
|
1600
|
-
"bodyFields": [
|
|
1419
|
+
"bodyFields": [
|
|
1420
|
+
"est",
|
|
1421
|
+
"stt",
|
|
1422
|
+
"data",
|
|
1423
|
+
"isBoostAd"
|
|
1424
|
+
]
|
|
1601
1425
|
};
|
|
1602
|
-
var
|
|
1603
|
-
"operationId": "
|
|
1604
|
-
"method": "
|
|
1605
|
-
"endpoint": "/zaapi/
|
|
1426
|
+
var OP_ZaloAdsUpdatePostAd = {
|
|
1427
|
+
"operationId": "ZaloAds_updatePostAd",
|
|
1428
|
+
"method": "POST",
|
|
1429
|
+
"endpoint": "/zaapi/UpdateAd",
|
|
1606
1430
|
"baseUrl": "https://ads.zalo.me",
|
|
1607
1431
|
"binaryFields": [],
|
|
1608
1432
|
"pathFields": [],
|
|
1609
|
-
"queryFields": [
|
|
1610
|
-
"pageId"
|
|
1611
|
-
],
|
|
1433
|
+
"queryFields": [],
|
|
1612
1434
|
"headerFields": [],
|
|
1613
1435
|
"cookieFields": [],
|
|
1614
|
-
"bodyFields": [
|
|
1436
|
+
"bodyFields": [
|
|
1437
|
+
"est",
|
|
1438
|
+
"stt",
|
|
1439
|
+
"data",
|
|
1440
|
+
"isBoostAd"
|
|
1441
|
+
]
|
|
1615
1442
|
};
|
|
1616
|
-
var
|
|
1617
|
-
"operationId": "
|
|
1618
|
-
"method": "
|
|
1619
|
-
"endpoint": "/zaapi/
|
|
1443
|
+
var OP_ZaloAdsCreateWebsiteCampaign = {
|
|
1444
|
+
"operationId": "ZaloAds_createWebsiteCampaign",
|
|
1445
|
+
"method": "POST",
|
|
1446
|
+
"endpoint": "/zaapi/addNewCamp",
|
|
1620
1447
|
"baseUrl": "https://ads.zalo.me",
|
|
1621
1448
|
"binaryFields": [],
|
|
1622
1449
|
"pathFields": [],
|
|
1623
1450
|
"queryFields": [],
|
|
1624
1451
|
"headerFields": [],
|
|
1625
1452
|
"cookieFields": [],
|
|
1626
|
-
"bodyFields": [
|
|
1453
|
+
"bodyFields": [
|
|
1454
|
+
"data"
|
|
1455
|
+
]
|
|
1627
1456
|
};
|
|
1628
|
-
var
|
|
1629
|
-
"operationId": "
|
|
1630
|
-
"method": "
|
|
1631
|
-
"endpoint": "/
|
|
1457
|
+
var OP_ZaloAdsUpdateWebsiteAd = {
|
|
1458
|
+
"operationId": "ZaloAds_updateWebsiteAd",
|
|
1459
|
+
"method": "POST",
|
|
1460
|
+
"endpoint": "/zaapi/UpdateAd",
|
|
1632
1461
|
"baseUrl": "https://ads.zalo.me",
|
|
1633
1462
|
"binaryFields": [],
|
|
1634
1463
|
"pathFields": [],
|
|
1635
|
-
"queryFields": [
|
|
1636
|
-
"limit",
|
|
1637
|
-
"offset",
|
|
1638
|
-
"joinDateAsc"
|
|
1639
|
-
],
|
|
1464
|
+
"queryFields": [],
|
|
1640
1465
|
"headerFields": [],
|
|
1641
1466
|
"cookieFields": [],
|
|
1642
|
-
"bodyFields": [
|
|
1467
|
+
"bodyFields": [
|
|
1468
|
+
"est",
|
|
1469
|
+
"stt",
|
|
1470
|
+
"data",
|
|
1471
|
+
"isBoostAd"
|
|
1472
|
+
]
|
|
1643
1473
|
};
|
|
1644
|
-
var
|
|
1645
|
-
"operationId": "
|
|
1646
|
-
"method": "
|
|
1647
|
-
"endpoint": "/
|
|
1474
|
+
var OP_ZaloAdsCreateDisplayCampaign = {
|
|
1475
|
+
"operationId": "ZaloAds_createDisplayCampaign",
|
|
1476
|
+
"method": "POST",
|
|
1477
|
+
"endpoint": "/zaapi/addNewCamp",
|
|
1648
1478
|
"baseUrl": "https://ads.zalo.me",
|
|
1649
1479
|
"binaryFields": [],
|
|
1650
1480
|
"pathFields": [],
|
|
1651
1481
|
"queryFields": [],
|
|
1652
1482
|
"headerFields": [],
|
|
1653
1483
|
"cookieFields": [],
|
|
1654
|
-
"bodyFields": [
|
|
1484
|
+
"bodyFields": [
|
|
1485
|
+
"data"
|
|
1486
|
+
]
|
|
1655
1487
|
};
|
|
1656
|
-
var
|
|
1657
|
-
"operationId": "
|
|
1658
|
-
"method": "
|
|
1659
|
-
"endpoint": "/
|
|
1488
|
+
var OP_ZaloAdsUpdateDisplayAd = {
|
|
1489
|
+
"operationId": "ZaloAds_updateDisplayAd",
|
|
1490
|
+
"method": "POST",
|
|
1491
|
+
"endpoint": "/zaapi/UpdateAd",
|
|
1660
1492
|
"baseUrl": "https://ads.zalo.me",
|
|
1661
1493
|
"binaryFields": [],
|
|
1662
1494
|
"pathFields": [],
|
|
1663
|
-
"queryFields": [
|
|
1664
|
-
"oaId",
|
|
1665
|
-
"isAll"
|
|
1666
|
-
],
|
|
1495
|
+
"queryFields": [],
|
|
1667
1496
|
"headerFields": [],
|
|
1668
1497
|
"cookieFields": [],
|
|
1669
|
-
"bodyFields": [
|
|
1498
|
+
"bodyFields": [
|
|
1499
|
+
"est",
|
|
1500
|
+
"stt",
|
|
1501
|
+
"data",
|
|
1502
|
+
"isBoostAd"
|
|
1503
|
+
]
|
|
1670
1504
|
};
|
|
1671
|
-
var
|
|
1672
|
-
"operationId": "
|
|
1673
|
-
"method": "
|
|
1674
|
-
"endpoint": "/
|
|
1505
|
+
var OP_ZaloAdsCreateVideoCampaign = {
|
|
1506
|
+
"operationId": "ZaloAds_createVideoCampaign",
|
|
1507
|
+
"method": "POST",
|
|
1508
|
+
"endpoint": "/zaapi/addNewCamp",
|
|
1675
1509
|
"baseUrl": "https://ads.zalo.me",
|
|
1676
1510
|
"binaryFields": [],
|
|
1677
1511
|
"pathFields": [],
|
|
1678
|
-
"queryFields": [
|
|
1679
|
-
"templateIds"
|
|
1680
|
-
],
|
|
1512
|
+
"queryFields": [],
|
|
1681
1513
|
"headerFields": [],
|
|
1682
1514
|
"cookieFields": [],
|
|
1683
|
-
"bodyFields": [
|
|
1515
|
+
"bodyFields": [
|
|
1516
|
+
"data"
|
|
1517
|
+
]
|
|
1684
1518
|
};
|
|
1685
|
-
var
|
|
1686
|
-
"operationId": "
|
|
1687
|
-
"method": "
|
|
1688
|
-
"endpoint": "/api/
|
|
1689
|
-
"baseUrl": "https://ads.zalo.me",
|
|
1690
|
-
"binaryFields": [],
|
|
1691
|
-
"pathFields": [],
|
|
1692
|
-
"queryFields": [],
|
|
1693
|
-
"headerFields": [],
|
|
1694
|
-
"cookieFields": [],
|
|
1695
|
-
"bodyFields": []
|
|
1696
|
-
};
|
|
1697
|
-
var OP_ZaloAdsPostApiAdEstimateaudience = {
|
|
1698
|
-
"operationId": "ZaloAds_postApiAdEstimateaudience",
|
|
1699
|
-
"method": "POST",
|
|
1700
|
-
"endpoint": "/api/ad/estimateAudience",
|
|
1519
|
+
var OP_ZaloAdsDeleteCampaign = {
|
|
1520
|
+
"operationId": "ZaloAds_deleteCampaign",
|
|
1521
|
+
"method": "POST",
|
|
1522
|
+
"endpoint": "/api/campaign/change-status",
|
|
1701
1523
|
"baseUrl": "https://ads.zalo.me",
|
|
1702
1524
|
"binaryFields": [],
|
|
1703
1525
|
"pathFields": [],
|
|
@@ -1705,154 +1527,318 @@ var OP_ZaloAdsPostApiAdEstimateaudience = {
|
|
|
1705
1527
|
"headerFields": [],
|
|
1706
1528
|
"cookieFields": [],
|
|
1707
1529
|
"bodyFields": [
|
|
1708
|
-
"
|
|
1709
|
-
"
|
|
1710
|
-
"ageRanges",
|
|
1711
|
-
"locations",
|
|
1712
|
-
"platforms",
|
|
1713
|
-
"priceType",
|
|
1714
|
-
"provinces",
|
|
1715
|
-
"wardsTargeting",
|
|
1716
|
-
"districtsTargeting"
|
|
1530
|
+
"campaignId",
|
|
1531
|
+
"status"
|
|
1717
1532
|
]
|
|
1718
1533
|
};
|
|
1719
|
-
var
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1534
|
+
var ZaloCampaignsService = class {
|
|
1535
|
+
constructor(client) {
|
|
1536
|
+
this.client = client;
|
|
1537
|
+
}
|
|
1538
|
+
updateVideoAd(request, options) {
|
|
1539
|
+
return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateVideoAd, this.client.toTransportInput(OP_ZaloAdsUpdateVideoAd, request), options);
|
|
1540
|
+
}
|
|
1541
|
+
changeCampaignStatus(request, options) {
|
|
1542
|
+
return this.client.requestFormUrlEncoded(OP_ZaloAdsChangeCampaignStatus, this.client.toTransportInput(OP_ZaloAdsChangeCampaignStatus, request), options);
|
|
1543
|
+
}
|
|
1544
|
+
deleteCampaign(request, options) {
|
|
1545
|
+
const payload = { campaignId: request.campaignId, status: request.status ?? -2 };
|
|
1546
|
+
return this.client.requestFormUrlEncoded(OP_ZaloAdsDeleteCampaign, this.client.toTransportInput(OP_ZaloAdsDeleteCampaign, payload), options);
|
|
1547
|
+
}
|
|
1548
|
+
createWebsiteCampaign(request, options) {
|
|
1549
|
+
return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateWebsiteCampaign, this.client.toTransportInput(OP_ZaloAdsCreateWebsiteCampaign, request), options);
|
|
1550
|
+
}
|
|
1551
|
+
updateWebsiteAd(request, options) {
|
|
1552
|
+
return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateWebsiteAd, this.client.toTransportInput(OP_ZaloAdsUpdateWebsiteAd, request), options);
|
|
1553
|
+
}
|
|
1554
|
+
createDisplayCampaign(request, options) {
|
|
1555
|
+
return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateDisplayCampaign, this.client.toTransportInput(OP_ZaloAdsCreateDisplayCampaign, request), options);
|
|
1556
|
+
}
|
|
1557
|
+
updateDisplayAd(request, options) {
|
|
1558
|
+
return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateDisplayAd, this.client.toTransportInput(OP_ZaloAdsUpdateDisplayAd, request), options);
|
|
1559
|
+
}
|
|
1560
|
+
createVideoCampaign(request, options) {
|
|
1561
|
+
return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateVideoCampaign, this.client.toTransportInput(OP_ZaloAdsCreateVideoCampaign, request), options);
|
|
1562
|
+
}
|
|
1563
|
+
createEcommerceCampaign(request, options) {
|
|
1564
|
+
return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateEcommerceCampaign, this.client.toTransportInput(OP_ZaloAdsCreateEcommerceCampaign, request), options);
|
|
1565
|
+
}
|
|
1566
|
+
/** Alias theo tên tool chuẩn `zalo_ads_create_commerce_campaign` trong Project Schema Zalo ADS (`campaignType = 22`). */
|
|
1567
|
+
createCommerceCampaign(request, options) {
|
|
1568
|
+
return this.createEcommerceCampaign(request, options);
|
|
1569
|
+
}
|
|
1570
|
+
createForm(request, options) {
|
|
1571
|
+
return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateForm, this.client.toTransportInput(OP_ZaloAdsCreateForm, request), options);
|
|
1572
|
+
}
|
|
1573
|
+
createFormCampaign(request, options) {
|
|
1574
|
+
return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateFormCampaign, this.client.toTransportInput(OP_ZaloAdsCreateFormCampaign, request), options);
|
|
1575
|
+
}
|
|
1576
|
+
createMessageCampaign(request, options) {
|
|
1577
|
+
return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateMessageCampaign, this.client.toTransportInput(OP_ZaloAdsCreateMessageCampaign, request), options);
|
|
1578
|
+
}
|
|
1579
|
+
createOfficialAccountCampaign(request, options) {
|
|
1580
|
+
return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateOfficialAccountCampaign, this.client.toTransportInput(OP_ZaloAdsCreateOfficialAccountCampaign, request), options);
|
|
1581
|
+
}
|
|
1582
|
+
/** Alias theo tên tool chuẩn `zalo_ads_create_oa_campaign` trong Project Schema Zalo ADS (`campaignType = 3`). */
|
|
1583
|
+
createOaCampaign(request, options) {
|
|
1584
|
+
return this.createOfficialAccountCampaign(request, options);
|
|
1585
|
+
}
|
|
1586
|
+
createPostCampaign(request, options) {
|
|
1587
|
+
return this.client.requestFormUrlEncoded(OP_ZaloAdsCreatePostCampaign, this.client.toTransportInput(OP_ZaloAdsCreatePostCampaign, request), options);
|
|
1588
|
+
}
|
|
1589
|
+
/** Alias theo tên tool chuẩn `zalo_ads_create_article_campaign` trong Project Schema Zalo ADS (`campaignType = 4`). */
|
|
1590
|
+
createArticleCampaign(request, options) {
|
|
1591
|
+
return this.createPostCampaign(request, options);
|
|
1592
|
+
}
|
|
1593
|
+
getAdById(request = {}, options) {
|
|
1594
|
+
return this.client.requestWithoutBody(OP_ZaloAdsGetAdById, this.client.toTransportInput(OP_ZaloAdsGetAdById, request), options);
|
|
1595
|
+
}
|
|
1596
|
+
getAdChangeLog(request, options) {
|
|
1597
|
+
return this.client.requestWithoutBody(OP_ZaloAdsGetAdChangeLog, this.client.toTransportInput(OP_ZaloAdsGetAdChangeLog, request), options);
|
|
1598
|
+
}
|
|
1599
|
+
getApiPlaceGetalldistricts(request = {}, options) {
|
|
1600
|
+
return this.client.requestWithoutBody(OP_ZaloAdsGetApiPlaceGetalldistricts, this.client.toTransportInput(OP_ZaloAdsGetApiPlaceGetalldistricts, request), options);
|
|
1601
|
+
}
|
|
1602
|
+
getApiSpellCheckV2(request, options) {
|
|
1603
|
+
return this.client.requestWithoutBody(OP_ZaloAdsGetApiSpellCheckV2, this.client.toTransportInput(OP_ZaloAdsGetApiSpellCheckV2, request), options);
|
|
1604
|
+
}
|
|
1605
|
+
getZaapiCheckcamphasmanyads(request = {}, options) {
|
|
1606
|
+
return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiCheckcamphasmanyads, this.client.toTransportInput(OP_ZaloAdsGetZaapiCheckcamphasmanyads, request), options);
|
|
1607
|
+
}
|
|
1608
|
+
getZaapiGetadsfromcampaignid(request = {}, options) {
|
|
1609
|
+
return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiGetadsfromcampaignid, this.client.toTransportInput(OP_ZaloAdsGetZaapiGetadsfromcampaignid, request), options);
|
|
1610
|
+
}
|
|
1611
|
+
getZaapiGetallpages(request = {}, options) {
|
|
1612
|
+
return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiGetallpages, this.client.toTransportInput(OP_ZaloAdsGetZaapiGetallpages, request), options);
|
|
1613
|
+
}
|
|
1614
|
+
getAllPages(request = {}, options) {
|
|
1615
|
+
return this.getZaapiGetallpages(request, options);
|
|
1616
|
+
}
|
|
1617
|
+
getZaapiGetownedarticles(request, options) {
|
|
1618
|
+
return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiGetownedarticles, this.client.toTransportInput(OP_ZaloAdsGetZaapiGetownedarticles, request), options);
|
|
1619
|
+
}
|
|
1620
|
+
getOwnedArticles(request, options) {
|
|
1621
|
+
return this.getZaapiGetownedarticles(request, options);
|
|
1622
|
+
}
|
|
1623
|
+
getZaapiGetownedpages(request = {}, options) {
|
|
1624
|
+
return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiGetownedpages, this.client.toTransportInput(OP_ZaloAdsGetZaapiGetownedpages, request), options);
|
|
1625
|
+
}
|
|
1626
|
+
getOwnedPages(request = {}, options) {
|
|
1627
|
+
return this.getZaapiGetownedpages(request, options);
|
|
1628
|
+
}
|
|
1629
|
+
listFormsByOfficialAccount(request, options) {
|
|
1630
|
+
return this.client.requestWithoutBody(OP_ZaloAdsListFormsByOfficialAccount, this.client.toTransportInput(OP_ZaloAdsListFormsByOfficialAccount, request), options);
|
|
1631
|
+
}
|
|
1632
|
+
listMiniPagesByTemplate(request, options) {
|
|
1633
|
+
return this.client.requestWithoutBody(OP_ZaloAdsListMiniPagesByTemplate, this.client.toTransportInput(OP_ZaloAdsListMiniPagesByTemplate, request), options);
|
|
1634
|
+
}
|
|
1635
|
+
postZaapiDeletead(request = {}, options) {
|
|
1636
|
+
return this.client.requestWithoutBody(OP_ZaloAdsPostZaapiDeletead, this.client.toTransportInput(OP_ZaloAdsPostZaapiDeletead, request), options);
|
|
1637
|
+
}
|
|
1638
|
+
renameCampaign(request, options) {
|
|
1639
|
+
return this.client.requestFormUrlEncoded(OP_ZaloAdsRenameCampaign, this.client.toTransportInput(OP_ZaloAdsRenameCampaign, request), options);
|
|
1640
|
+
}
|
|
1641
|
+
updateEcommerceAd(request, options) {
|
|
1642
|
+
return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateEcommerceAd, this.client.toTransportInput(OP_ZaloAdsUpdateEcommerceAd, request), options);
|
|
1643
|
+
}
|
|
1644
|
+
/** Alias theo tên tool chuẩn `zalo_ads_update_commerce_ad` trong Project Schema Zalo ADS (`Type = 23`, gắn `MiniPageId`). */
|
|
1645
|
+
updateCommerceAd(request, options) {
|
|
1646
|
+
return this.updateEcommerceAd(request, options);
|
|
1647
|
+
}
|
|
1648
|
+
updateFormAd(request, options) {
|
|
1649
|
+
return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateFormAd, this.client.toTransportInput(OP_ZaloAdsUpdateFormAd, request), options);
|
|
1650
|
+
}
|
|
1651
|
+
updateMessageAd(request, options) {
|
|
1652
|
+
return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateMessageAd, this.client.toTransportInput(OP_ZaloAdsUpdateMessageAd, request), options);
|
|
1653
|
+
}
|
|
1654
|
+
updateNewAds(request, options) {
|
|
1655
|
+
return this.client.requestMultipart(OP_ZaloAdsUpdateNewAds, this.client.toTransportInput(OP_ZaloAdsUpdateNewAds, request), options);
|
|
1656
|
+
}
|
|
1657
|
+
updateOfficialAccountAd(request, options) {
|
|
1658
|
+
return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateOfficialAccountAd, this.client.toTransportInput(OP_ZaloAdsUpdateOfficialAccountAd, request), options);
|
|
1659
|
+
}
|
|
1660
|
+
/** Alias theo tên tool chuẩn `zalo_ads_update_oa_ad` trong Project Schema Zalo ADS (`Type = 2`, `Action = 6`). */
|
|
1661
|
+
updateOaAd(request, options) {
|
|
1662
|
+
return this.updateOfficialAccountAd(request, options);
|
|
1663
|
+
}
|
|
1664
|
+
updatePostAd(request, options) {
|
|
1665
|
+
return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdatePostAd, this.client.toTransportInput(OP_ZaloAdsUpdatePostAd, request), options);
|
|
1666
|
+
}
|
|
1667
|
+
/** Alias theo tên tool chuẩn `zalo_ads_update_article_ad` trong Project Schema Zalo ADS (`Type = 3`, gắn `ZaloFeedId`). */
|
|
1668
|
+
updateArticleAd(request, options) {
|
|
1669
|
+
return this.updatePostAd(request, options);
|
|
1670
|
+
}
|
|
1671
|
+
/** Xóa quảng cáo */
|
|
1672
|
+
deleteAd(...args) {
|
|
1673
|
+
return this.postZaapiDeletead(...args);
|
|
1674
|
+
}
|
|
1675
|
+
/** Danh sách quận/huyện để nhắm mục tiêu */
|
|
1676
|
+
getAllDistricts(...args) {
|
|
1677
|
+
return this.getApiPlaceGetalldistricts(...args);
|
|
1678
|
+
}
|
|
1679
|
+
/** Kiểm tra chính tả văn bản quảng cáo */
|
|
1680
|
+
getSpellCheckV2(...args) {
|
|
1681
|
+
return this.getApiSpellCheckV2(...args);
|
|
1682
|
+
}
|
|
1683
|
+
};
|
|
1684
|
+
|
|
1685
|
+
// src/services/account.service.ts
|
|
1686
|
+
var OP_ZaloAdsGetApiWhoami = {
|
|
1687
|
+
"operationId": "ZaloAds_getApiWhoami",
|
|
1688
|
+
"method": "GET",
|
|
1689
|
+
"endpoint": "/api/whoami",
|
|
1723
1690
|
"baseUrl": "https://ads.zalo.me",
|
|
1724
1691
|
"binaryFields": [],
|
|
1725
1692
|
"pathFields": [],
|
|
1726
1693
|
"queryFields": [],
|
|
1727
1694
|
"headerFields": [],
|
|
1728
1695
|
"cookieFields": [],
|
|
1729
|
-
"bodyFields": [
|
|
1730
|
-
"data"
|
|
1731
|
-
]
|
|
1696
|
+
"bodyFields": []
|
|
1732
1697
|
};
|
|
1733
|
-
var
|
|
1734
|
-
"operationId": "
|
|
1735
|
-
"method": "
|
|
1736
|
-
"endpoint": "/api/
|
|
1698
|
+
var OP_ZaloAdsGetApiPaymentTransactionHistory = {
|
|
1699
|
+
"operationId": "ZaloAds_getApiPaymentTransactionHistory",
|
|
1700
|
+
"method": "GET",
|
|
1701
|
+
"endpoint": "/api/payment/transaction-history",
|
|
1737
1702
|
"baseUrl": "https://ads.zalo.me",
|
|
1738
|
-
"binaryFields": [
|
|
1739
|
-
"File"
|
|
1740
|
-
],
|
|
1703
|
+
"binaryFields": [],
|
|
1741
1704
|
"pathFields": [],
|
|
1742
|
-
"queryFields": [
|
|
1705
|
+
"queryFields": [
|
|
1706
|
+
"to",
|
|
1707
|
+
"from",
|
|
1708
|
+
"memberId"
|
|
1709
|
+
],
|
|
1743
1710
|
"headerFields": [],
|
|
1744
1711
|
"cookieFields": [],
|
|
1745
|
-
"bodyFields": [
|
|
1746
|
-
"File"
|
|
1747
|
-
]
|
|
1712
|
+
"bodyFields": []
|
|
1748
1713
|
};
|
|
1749
|
-
var
|
|
1750
|
-
"operationId": "
|
|
1751
|
-
"method": "
|
|
1752
|
-
"endpoint": "/
|
|
1714
|
+
var OP_ZaloAdsGetApiBaAccountAllaccessors = {
|
|
1715
|
+
"operationId": "ZaloAds_getApiBaAccountAllaccessors",
|
|
1716
|
+
"method": "GET",
|
|
1717
|
+
"endpoint": "/api/ba/account/allAccessors",
|
|
1753
1718
|
"baseUrl": "https://ads.zalo.me",
|
|
1754
1719
|
"binaryFields": [],
|
|
1755
1720
|
"pathFields": [],
|
|
1756
1721
|
"queryFields": [
|
|
1757
|
-
"
|
|
1722
|
+
"isShowAll"
|
|
1758
1723
|
],
|
|
1759
1724
|
"headerFields": [],
|
|
1760
1725
|
"cookieFields": [],
|
|
1761
|
-
"bodyFields": [
|
|
1762
|
-
"adId"
|
|
1763
|
-
]
|
|
1726
|
+
"bodyFields": []
|
|
1764
1727
|
};
|
|
1765
|
-
var
|
|
1766
|
-
"operationId": "
|
|
1767
|
-
"method": "
|
|
1768
|
-
"endpoint": "/api/
|
|
1728
|
+
var OP_ZaloAdsGetApiBaAccountAllgrantedmembers = {
|
|
1729
|
+
"operationId": "ZaloAds_getApiBaAccountAllgrantedmembers",
|
|
1730
|
+
"method": "GET",
|
|
1731
|
+
"endpoint": "/api/ba/account/allGrantedMembers",
|
|
1769
1732
|
"baseUrl": "https://ads.zalo.me",
|
|
1770
1733
|
"binaryFields": [],
|
|
1771
1734
|
"pathFields": [],
|
|
1772
1735
|
"queryFields": [],
|
|
1773
1736
|
"headerFields": [],
|
|
1774
1737
|
"cookieFields": [],
|
|
1775
|
-
"bodyFields": [
|
|
1776
|
-
"campid",
|
|
1777
|
-
"newname"
|
|
1778
|
-
]
|
|
1738
|
+
"bodyFields": []
|
|
1779
1739
|
};
|
|
1780
|
-
var
|
|
1781
|
-
"operationId": "
|
|
1782
|
-
"method": "
|
|
1783
|
-
"endpoint": "/
|
|
1740
|
+
var OP_ZaloAdsListAgencyCustomersWithBudget = {
|
|
1741
|
+
"operationId": "ZaloAds_listAgencyCustomersWithBudget",
|
|
1742
|
+
"method": "GET",
|
|
1743
|
+
"endpoint": "/api/ba/agency/customersWithBudget",
|
|
1784
1744
|
"baseUrl": "https://ads.zalo.me",
|
|
1785
1745
|
"binaryFields": [],
|
|
1786
1746
|
"pathFields": [],
|
|
1787
|
-
"queryFields": [
|
|
1747
|
+
"queryFields": [
|
|
1748
|
+
"limit",
|
|
1749
|
+
"offset",
|
|
1750
|
+
"joinDateAsc"
|
|
1751
|
+
],
|
|
1788
1752
|
"headerFields": [],
|
|
1789
1753
|
"cookieFields": [],
|
|
1790
|
-
"bodyFields": [
|
|
1791
|
-
"est",
|
|
1792
|
-
"stt",
|
|
1793
|
-
"data",
|
|
1794
|
-
"isBoostAd"
|
|
1795
|
-
]
|
|
1754
|
+
"bodyFields": []
|
|
1796
1755
|
};
|
|
1797
|
-
var
|
|
1798
|
-
"operationId": "
|
|
1799
|
-
"method": "
|
|
1800
|
-
"endpoint": "/
|
|
1756
|
+
var OP_ZaloAdsGetApiNotifiesHeader = {
|
|
1757
|
+
"operationId": "ZaloAds_getApiNotifiesHeader",
|
|
1758
|
+
"method": "GET",
|
|
1759
|
+
"endpoint": "/api/notifies/header",
|
|
1801
1760
|
"baseUrl": "https://ads.zalo.me",
|
|
1802
1761
|
"binaryFields": [],
|
|
1803
1762
|
"pathFields": [],
|
|
1804
1763
|
"queryFields": [],
|
|
1805
1764
|
"headerFields": [],
|
|
1806
1765
|
"cookieFields": [],
|
|
1807
|
-
"bodyFields": [
|
|
1808
|
-
"est",
|
|
1809
|
-
"stt",
|
|
1810
|
-
"data",
|
|
1811
|
-
"isBoostAd"
|
|
1812
|
-
]
|
|
1766
|
+
"bodyFields": []
|
|
1813
1767
|
};
|
|
1814
|
-
var
|
|
1815
|
-
"operationId": "
|
|
1816
|
-
"method": "
|
|
1817
|
-
"endpoint": "/
|
|
1768
|
+
var OP_ZaloAdsGetApiLpNews = {
|
|
1769
|
+
"operationId": "ZaloAds_getApiLpNews",
|
|
1770
|
+
"method": "GET",
|
|
1771
|
+
"endpoint": "/api/lp-news",
|
|
1818
1772
|
"baseUrl": "https://ads.zalo.me",
|
|
1819
1773
|
"binaryFields": [],
|
|
1820
1774
|
"pathFields": [],
|
|
1821
1775
|
"queryFields": [],
|
|
1822
1776
|
"headerFields": [],
|
|
1823
1777
|
"cookieFields": [],
|
|
1824
|
-
"bodyFields": [
|
|
1825
|
-
"est",
|
|
1826
|
-
"stt",
|
|
1827
|
-
"data",
|
|
1828
|
-
"isBoostAd"
|
|
1829
|
-
]
|
|
1778
|
+
"bodyFields": []
|
|
1830
1779
|
};
|
|
1831
|
-
var
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1780
|
+
var ZaloAccountService = class {
|
|
1781
|
+
constructor(client) {
|
|
1782
|
+
this.client = client;
|
|
1783
|
+
}
|
|
1784
|
+
getApiWhoami(request = {}, options) {
|
|
1785
|
+
return this.client.requestWithoutBody(OP_ZaloAdsGetApiWhoami, this.client.toTransportInput(OP_ZaloAdsGetApiWhoami, request), options);
|
|
1786
|
+
}
|
|
1787
|
+
getApiPaymentTransactionHistory(request, options) {
|
|
1788
|
+
return this.client.requestWithoutBody(OP_ZaloAdsGetApiPaymentTransactionHistory, this.client.toTransportInput(OP_ZaloAdsGetApiPaymentTransactionHistory, request), options);
|
|
1789
|
+
}
|
|
1790
|
+
getApiBaAccountAllaccessors(request = {}, options) {
|
|
1791
|
+
return this.client.requestWithoutBody(OP_ZaloAdsGetApiBaAccountAllaccessors, this.client.toTransportInput(OP_ZaloAdsGetApiBaAccountAllaccessors, request), options);
|
|
1792
|
+
}
|
|
1793
|
+
getApiBaAccountAllgrantedmembers(request = {}, options) {
|
|
1794
|
+
return this.client.requestWithoutBody(OP_ZaloAdsGetApiBaAccountAllgrantedmembers, this.client.toTransportInput(OP_ZaloAdsGetApiBaAccountAllgrantedmembers, request), options);
|
|
1795
|
+
}
|
|
1796
|
+
listAgencyCustomersWithBudget(request = { limit: 15, offset: 0, joinDateAsc: true }, options) {
|
|
1797
|
+
const normalized = {
|
|
1798
|
+
limit: 15,
|
|
1799
|
+
offset: 0,
|
|
1800
|
+
joinDateAsc: true,
|
|
1801
|
+
...request
|
|
1802
|
+
};
|
|
1803
|
+
return this.client.requestWithoutBody(OP_ZaloAdsListAgencyCustomersWithBudget, this.client.toTransportInput(OP_ZaloAdsListAgencyCustomersWithBudget, normalized), options);
|
|
1804
|
+
}
|
|
1805
|
+
getApiNotifiesHeader(request = {}, options) {
|
|
1806
|
+
return this.client.requestWithoutBody(OP_ZaloAdsGetApiNotifiesHeader, this.client.toTransportInput(OP_ZaloAdsGetApiNotifiesHeader, request), options);
|
|
1807
|
+
}
|
|
1808
|
+
getApiLpNews(request = {}, options) {
|
|
1809
|
+
return this.client.requestWithoutBody(OP_ZaloAdsGetApiLpNews, this.client.toTransportInput(OP_ZaloAdsGetApiLpNews, request), options);
|
|
1810
|
+
}
|
|
1811
|
+
/** Lấy thông tin tài khoản đang đăng nhập */
|
|
1812
|
+
getWhoami(...args) {
|
|
1813
|
+
return this.getApiWhoami(...args);
|
|
1814
|
+
}
|
|
1815
|
+
/** Lịch sử giao dịch thanh toán */
|
|
1816
|
+
getPaymentTransactionHistory(...args) {
|
|
1817
|
+
return this.getApiPaymentTransactionHistory(...args);
|
|
1818
|
+
}
|
|
1819
|
+
/** Danh sách accessor tài khoản BA */
|
|
1820
|
+
getBaAccountAllAccessors(...args) {
|
|
1821
|
+
return this.getApiBaAccountAllaccessors(...args);
|
|
1822
|
+
}
|
|
1823
|
+
/** Danh sách thành viên được cấp quyền BA */
|
|
1824
|
+
getBaAccountAllGrantedMembers(...args) {
|
|
1825
|
+
return this.getApiBaAccountAllgrantedmembers(...args);
|
|
1826
|
+
}
|
|
1827
|
+
/** Thông báo trên thanh tiêu đề */
|
|
1828
|
+
getNotifiesHeader(...args) {
|
|
1829
|
+
return this.getApiNotifiesHeader(...args);
|
|
1830
|
+
}
|
|
1831
|
+
/** Tin tức landing page / bảng tin */
|
|
1832
|
+
getLpNews(...args) {
|
|
1833
|
+
return this.getApiLpNews(...args);
|
|
1834
|
+
}
|
|
1851
1835
|
};
|
|
1852
|
-
|
|
1853
|
-
|
|
1836
|
+
|
|
1837
|
+
// src/services/audiences.service.ts
|
|
1838
|
+
var OP_ZaloAdsCreateCustomAudience = {
|
|
1839
|
+
"operationId": "ZaloAds_createCustomAudience",
|
|
1854
1840
|
"method": "POST",
|
|
1855
|
-
"endpoint": "/
|
|
1841
|
+
"endpoint": "/api/ad/audience",
|
|
1856
1842
|
"baseUrl": "https://ads.zalo.me",
|
|
1857
1843
|
"binaryFields": [],
|
|
1858
1844
|
"pathFields": [],
|
|
@@ -1860,64 +1846,55 @@ var OP_ZaloAdsUpdateOfficialAccountAd = {
|
|
|
1860
1846
|
"headerFields": [],
|
|
1861
1847
|
"cookieFields": [],
|
|
1862
1848
|
"bodyFields": [
|
|
1863
|
-
"
|
|
1864
|
-
"
|
|
1865
|
-
"
|
|
1866
|
-
"isBoostAd"
|
|
1849
|
+
"name",
|
|
1850
|
+
"caType",
|
|
1851
|
+
"targeting"
|
|
1867
1852
|
]
|
|
1868
1853
|
};
|
|
1869
|
-
var
|
|
1870
|
-
"operationId": "
|
|
1871
|
-
"method": "
|
|
1872
|
-
"endpoint": "/
|
|
1854
|
+
var OP_ZaloAdsDeleteCustomAudience = {
|
|
1855
|
+
"operationId": "ZaloAds_deleteCustomAudience",
|
|
1856
|
+
"method": "DELETE",
|
|
1857
|
+
"endpoint": "/api/ad/audience/{customAudienceId}",
|
|
1873
1858
|
"baseUrl": "https://ads.zalo.me",
|
|
1874
1859
|
"binaryFields": [],
|
|
1875
|
-
"pathFields": [
|
|
1860
|
+
"pathFields": [
|
|
1861
|
+
"customAudienceId"
|
|
1862
|
+
],
|
|
1876
1863
|
"queryFields": [],
|
|
1877
1864
|
"headerFields": [],
|
|
1878
1865
|
"cookieFields": [],
|
|
1879
|
-
"bodyFields": [
|
|
1880
|
-
"est",
|
|
1881
|
-
"stt",
|
|
1882
|
-
"data",
|
|
1883
|
-
"isBoostAd"
|
|
1884
|
-
]
|
|
1866
|
+
"bodyFields": []
|
|
1885
1867
|
};
|
|
1886
|
-
var
|
|
1887
|
-
"operationId": "
|
|
1888
|
-
"method": "
|
|
1889
|
-
"endpoint": "/
|
|
1868
|
+
var OP_ZaloAdsGetApiAdGetlistadadvancetargeting = {
|
|
1869
|
+
"operationId": "ZaloAds_getApiAdGetlistadadvancetargeting",
|
|
1870
|
+
"method": "GET",
|
|
1871
|
+
"endpoint": "/api/ad/getListAdAdvanceTargeting",
|
|
1890
1872
|
"baseUrl": "https://ads.zalo.me",
|
|
1891
1873
|
"binaryFields": [],
|
|
1892
1874
|
"pathFields": [],
|
|
1893
1875
|
"queryFields": [],
|
|
1894
1876
|
"headerFields": [],
|
|
1895
1877
|
"cookieFields": [],
|
|
1896
|
-
"bodyFields": [
|
|
1897
|
-
"data"
|
|
1898
|
-
]
|
|
1878
|
+
"bodyFields": []
|
|
1899
1879
|
};
|
|
1900
|
-
var
|
|
1901
|
-
"operationId": "
|
|
1902
|
-
"method": "
|
|
1903
|
-
"endpoint": "/
|
|
1880
|
+
var OP_ZaloAdsGetApiCustomAudienceAll = {
|
|
1881
|
+
"operationId": "ZaloAds_getApiCustomAudienceAll",
|
|
1882
|
+
"method": "GET",
|
|
1883
|
+
"endpoint": "/api/custom-audience/all",
|
|
1904
1884
|
"baseUrl": "https://ads.zalo.me",
|
|
1905
1885
|
"binaryFields": [],
|
|
1906
1886
|
"pathFields": [],
|
|
1907
|
-
"queryFields": [
|
|
1887
|
+
"queryFields": [
|
|
1888
|
+
"newWard"
|
|
1889
|
+
],
|
|
1908
1890
|
"headerFields": [],
|
|
1909
1891
|
"cookieFields": [],
|
|
1910
|
-
"bodyFields": [
|
|
1911
|
-
"est",
|
|
1912
|
-
"stt",
|
|
1913
|
-
"data",
|
|
1914
|
-
"isBoostAd"
|
|
1915
|
-
]
|
|
1892
|
+
"bodyFields": []
|
|
1916
1893
|
};
|
|
1917
|
-
var
|
|
1918
|
-
"operationId": "
|
|
1894
|
+
var OP_ZaloAdsPostApiAdEstimateaudience = {
|
|
1895
|
+
"operationId": "ZaloAds_postApiAdEstimateaudience",
|
|
1919
1896
|
"method": "POST",
|
|
1920
|
-
"endpoint": "/
|
|
1897
|
+
"endpoint": "/api/ad/estimateAudience",
|
|
1921
1898
|
"baseUrl": "https://ads.zalo.me",
|
|
1922
1899
|
"binaryFields": [],
|
|
1923
1900
|
"pathFields": [],
|
|
@@ -1925,190 +1902,292 @@ var OP_ZaloAdsCreateDisplayCampaign = {
|
|
|
1925
1902
|
"headerFields": [],
|
|
1926
1903
|
"cookieFields": [],
|
|
1927
1904
|
"bodyFields": [
|
|
1928
|
-
"
|
|
1905
|
+
"gender",
|
|
1906
|
+
"number",
|
|
1907
|
+
"ageRanges",
|
|
1908
|
+
"locations",
|
|
1909
|
+
"platforms",
|
|
1910
|
+
"priceType",
|
|
1911
|
+
"provinces",
|
|
1912
|
+
"wardsTargeting",
|
|
1913
|
+
"districtsTargeting"
|
|
1929
1914
|
]
|
|
1930
1915
|
};
|
|
1931
|
-
var
|
|
1932
|
-
"operationId": "
|
|
1916
|
+
var OP_ZaloAdsUploadCustomAudiencePhoneList = {
|
|
1917
|
+
"operationId": "ZaloAds_uploadCustomAudiencePhoneList",
|
|
1933
1918
|
"method": "POST",
|
|
1934
|
-
"endpoint": "/zaapi/
|
|
1919
|
+
"endpoint": "/zaapi/uploadPhoneList",
|
|
1935
1920
|
"baseUrl": "https://ads.zalo.me",
|
|
1936
|
-
"binaryFields": [
|
|
1921
|
+
"binaryFields": [
|
|
1922
|
+
"File"
|
|
1923
|
+
],
|
|
1937
1924
|
"pathFields": [],
|
|
1938
1925
|
"queryFields": [],
|
|
1939
1926
|
"headerFields": [],
|
|
1940
1927
|
"cookieFields": [],
|
|
1941
1928
|
"bodyFields": [
|
|
1942
|
-
"
|
|
1943
|
-
"
|
|
1944
|
-
"data",
|
|
1945
|
-
"isBoostAd"
|
|
1929
|
+
"File",
|
|
1930
|
+
"isHash"
|
|
1946
1931
|
]
|
|
1947
1932
|
};
|
|
1948
|
-
var
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1933
|
+
var ZaloAudiencesService = class {
|
|
1934
|
+
constructor(client) {
|
|
1935
|
+
this.client = client;
|
|
1936
|
+
}
|
|
1937
|
+
postApiAdEstimateaudience(request, options) {
|
|
1938
|
+
return this.client.requestJson(OP_ZaloAdsPostApiAdEstimateaudience, this.client.toTransportInput(OP_ZaloAdsPostApiAdEstimateaudience, request), options);
|
|
1939
|
+
}
|
|
1940
|
+
getApiAdGetlistadadvancetargeting(request = {}, options) {
|
|
1941
|
+
return this.client.requestWithoutBody(OP_ZaloAdsGetApiAdGetlistadadvancetargeting, this.client.toTransportInput(OP_ZaloAdsGetApiAdGetlistadadvancetargeting, request), options);
|
|
1942
|
+
}
|
|
1943
|
+
getApiCustomAudienceAll(request = {}, options) {
|
|
1944
|
+
return this.client.requestWithoutBody(OP_ZaloAdsGetApiCustomAudienceAll, this.client.toTransportInput(OP_ZaloAdsGetApiCustomAudienceAll, request), options);
|
|
1945
|
+
}
|
|
1946
|
+
createCustomAudience(request, options) {
|
|
1947
|
+
return this.client.requestJson(OP_ZaloAdsCreateCustomAudience, this.client.toTransportInput(OP_ZaloAdsCreateCustomAudience, request), options);
|
|
1948
|
+
}
|
|
1949
|
+
deleteCustomAudience(request, options) {
|
|
1950
|
+
return this.client.requestWithoutBody(OP_ZaloAdsDeleteCustomAudience, this.client.toTransportInput(OP_ZaloAdsDeleteCustomAudience, request), options);
|
|
1951
|
+
}
|
|
1952
|
+
uploadCustomAudiencePhoneList(request, options) {
|
|
1953
|
+
return this.client.requestMultipart(OP_ZaloAdsUploadCustomAudiencePhoneList, this.client.toTransportInput(OP_ZaloAdsUploadCustomAudiencePhoneList, request), options);
|
|
1954
|
+
}
|
|
1955
|
+
/** Tạo mới 'Nhóm đối tượng đã lưu' (`caType = 1` - `DEFAULT`) trên Zalo Ads (`POST /api/ad/audience`). */
|
|
1956
|
+
createSavedAudience(request, options) {
|
|
1957
|
+
const targetingStr = typeof request.targeting === "string" ? request.targeting : JSON.stringify(request.targeting);
|
|
1958
|
+
return this.createCustomAudience(
|
|
1959
|
+
{
|
|
1960
|
+
name: request.name,
|
|
1961
|
+
caType: 1,
|
|
1962
|
+
targeting: targetingStr
|
|
1963
|
+
},
|
|
1964
|
+
options
|
|
1965
|
+
);
|
|
1966
|
+
}
|
|
1967
|
+
/** Tạo mới Nhóm đối tượng từ danh sách Số điện thoại (`caType = 3` - `PHONE_LIST`). */
|
|
1968
|
+
createPhoneAudience(request, options) {
|
|
1969
|
+
const targetingStr = typeof request.targeting === "string" ? request.targeting : JSON.stringify(request.targeting);
|
|
1970
|
+
return this.createCustomAudience({ name: request.name, caType: 3, targeting: targetingStr }, options);
|
|
1971
|
+
}
|
|
1972
|
+
/** Tạo mới Nhóm đối tượng tương tự Lookalike (`caType = 6` - `LOOKALIKE`). */
|
|
1973
|
+
createLookalikeAudience(request, options) {
|
|
1974
|
+
const targetingStr = typeof request.targeting === "string" ? request.targeting : JSON.stringify(request.targeting);
|
|
1975
|
+
return this.createCustomAudience({ name: request.name, caType: 6, targeting: targetingStr }, options);
|
|
1976
|
+
}
|
|
1977
|
+
/** Tạo mới Nhóm đối tượng phát sinh sự kiện trên Zalo Form (`caType = 12` - `FORM_EVENT_AUDIENCE`). */
|
|
1978
|
+
createFormEventAudience(request, options) {
|
|
1979
|
+
const targetingStr = typeof request.targeting === "string" ? request.targeting : JSON.stringify(request.targeting);
|
|
1980
|
+
return this.createCustomAudience({ name: request.name, caType: 12, targeting: targetingStr }, options);
|
|
1981
|
+
}
|
|
1982
|
+
/** Tạo mới Nhóm đối tượng phát sinh sự kiện trên Kịch bản Tin nhắn OA (`caType = 11` - `MESSAGE_AUDIENCE`). */
|
|
1983
|
+
createMessageOaEventAudience(request, options) {
|
|
1984
|
+
const targetingStr = typeof request.targeting === "string" ? request.targeting : JSON.stringify(request.targeting);
|
|
1985
|
+
return this.createCustomAudience({ name: request.name, caType: 11, targeting: targetingStr }, options);
|
|
1986
|
+
}
|
|
1987
|
+
/** Tạo mới Nhóm đối tượng phát sinh sự kiện trên Kịch bản Tin nhắn cá nhân (`caType = 14` - `MESSAGE_PERSONAL_EVENT_AUDIENCE`). */
|
|
1988
|
+
createMessagePersonalEventAudience(request, options) {
|
|
1989
|
+
const targetingStr = typeof request.targeting === "string" ? request.targeting : JSON.stringify(request.targeting);
|
|
1990
|
+
return this.createCustomAudience({ name: request.name, caType: 14, targeting: targetingStr }, options);
|
|
1991
|
+
}
|
|
1992
|
+
/** Tạo mới Nhóm đối tượng từ Trung tâm Lead - Zalo Form (`caType = 10` - `FORM_AUDIENCE`). */
|
|
1993
|
+
createFormLeadAudience(request, options) {
|
|
1994
|
+
const targetingStr = typeof request.targeting === "string" ? request.targeting : JSON.stringify(request.targeting);
|
|
1995
|
+
return this.createCustomAudience({ name: request.name, caType: 10, targeting: targetingStr }, options);
|
|
1996
|
+
}
|
|
1997
|
+
/** Tạo mới Nhóm đối tượng từ Trung tâm Lead - Commerce Form (`caType = 15` - `COMMERCE_FORM_AUDIENCE`). */
|
|
1998
|
+
createCommerceFormAudience(request, options) {
|
|
1999
|
+
const targetingStr = typeof request.targeting === "string" ? request.targeting : JSON.stringify(request.targeting);
|
|
2000
|
+
return this.createCustomAudience({ name: request.name, caType: 15, targeting: targetingStr }, options);
|
|
2001
|
+
}
|
|
2002
|
+
/** Tạo mới Nhóm đối tượng từ Trung tâm Lead - Kịch bản Tin nhắn OA (`caType = 13` - `MESSAGE_OA_AUDIENCE`). */
|
|
2003
|
+
createMessageOaLeadAudience(request, options) {
|
|
2004
|
+
const targetingStr = typeof request.targeting === "string" ? request.targeting : JSON.stringify(request.targeting);
|
|
2005
|
+
return this.createCustomAudience({ name: request.name, caType: 13, targeting: targetingStr }, options);
|
|
2006
|
+
}
|
|
2007
|
+
/** Tạo mới Nhóm đối tượng từ Dữ liệu chuyển đổi Lead Signal (`caType = 16` - `LEAD_SIGNAL_AUDIENCE`). */
|
|
2008
|
+
createLeadSignalAudience(request, options) {
|
|
2009
|
+
const targetingStr = typeof request.targeting === "string" ? request.targeting : JSON.stringify(request.targeting);
|
|
2010
|
+
return this.createCustomAudience({ name: request.name, caType: 16, targeting: targetingStr }, options);
|
|
2011
|
+
}
|
|
2012
|
+
/** Ước tính quy mô đối tượng tiếp cận */
|
|
2013
|
+
estimateAudience(...args) {
|
|
2014
|
+
return this.postApiAdEstimateaudience(...args);
|
|
2015
|
+
}
|
|
2016
|
+
/** Danh sách toàn bộ nhóm đối tượng tùy chỉnh */
|
|
2017
|
+
listCustomAudiences(...args) {
|
|
2018
|
+
return this.getApiCustomAudienceAll(...args);
|
|
2019
|
+
}
|
|
2020
|
+
/** Danh sách cấu hình nhắm mục tiêu nâng cao */
|
|
2021
|
+
getListAdAdvanceTargeting(...args) {
|
|
2022
|
+
return this.getApiAdGetlistadadvancetargeting(...args);
|
|
2023
|
+
}
|
|
1961
2024
|
};
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
"
|
|
2025
|
+
|
|
2026
|
+
// src/services/reports.service.ts
|
|
2027
|
+
var OP_ZaloAdsGetReportapiV2Ads = {
|
|
2028
|
+
"operationId": "ZaloAds_getReportapiV2Ads",
|
|
2029
|
+
"method": "GET",
|
|
2030
|
+
"endpoint": "/reportapi/v2/ads",
|
|
1966
2031
|
"baseUrl": "https://ads.zalo.me",
|
|
1967
2032
|
"binaryFields": [],
|
|
1968
2033
|
"pathFields": [],
|
|
1969
|
-
"queryFields": [
|
|
2034
|
+
"queryFields": [
|
|
2035
|
+
"to",
|
|
2036
|
+
"from",
|
|
2037
|
+
"filter",
|
|
2038
|
+
"endDate",
|
|
2039
|
+
"refresh",
|
|
2040
|
+
"breakdown",
|
|
2041
|
+
"startDate"
|
|
2042
|
+
],
|
|
1970
2043
|
"headerFields": [],
|
|
1971
2044
|
"cookieFields": [],
|
|
1972
|
-
"bodyFields": [
|
|
1973
|
-
"campaignId",
|
|
1974
|
-
"status"
|
|
1975
|
-
]
|
|
2045
|
+
"bodyFields": []
|
|
1976
2046
|
};
|
|
1977
|
-
var
|
|
1978
|
-
"operationId": "
|
|
2047
|
+
var OP_ZaloAdsGetReportapiV2Campaigns = {
|
|
2048
|
+
"operationId": "ZaloAds_getReportapiV2Campaigns",
|
|
1979
2049
|
"method": "GET",
|
|
1980
|
-
"endpoint": "/
|
|
2050
|
+
"endpoint": "/reportapi/v2/campaigns/{campaignId}",
|
|
1981
2051
|
"baseUrl": "https://ads.zalo.me",
|
|
1982
2052
|
"binaryFields": [],
|
|
1983
|
-
"pathFields": [
|
|
2053
|
+
"pathFields": [
|
|
2054
|
+
"campaignId"
|
|
2055
|
+
],
|
|
1984
2056
|
"queryFields": [
|
|
1985
|
-
"
|
|
2057
|
+
"startDate",
|
|
2058
|
+
"endDate",
|
|
2059
|
+
"refresh"
|
|
1986
2060
|
],
|
|
1987
2061
|
"headerFields": [],
|
|
1988
2062
|
"cookieFields": [],
|
|
1989
2063
|
"bodyFields": []
|
|
1990
2064
|
};
|
|
1991
|
-
var
|
|
1992
|
-
"operationId": "
|
|
1993
|
-
"method": "
|
|
1994
|
-
"endpoint": "/
|
|
2065
|
+
var OP_ZaloAdsGetReportapiV2UniqueUser = {
|
|
2066
|
+
"operationId": "ZaloAds_getReportapiV2UniqueUser",
|
|
2067
|
+
"method": "GET",
|
|
2068
|
+
"endpoint": "/reportapi/v2/unique-user",
|
|
1995
2069
|
"baseUrl": "https://ads.zalo.me",
|
|
1996
2070
|
"binaryFields": [],
|
|
1997
2071
|
"pathFields": [],
|
|
1998
|
-
"queryFields": [
|
|
2072
|
+
"queryFields": [
|
|
2073
|
+
"start",
|
|
2074
|
+
"end",
|
|
2075
|
+
"campaignId",
|
|
2076
|
+
"adId"
|
|
2077
|
+
],
|
|
1999
2078
|
"headerFields": [],
|
|
2000
2079
|
"cookieFields": [],
|
|
2001
|
-
"bodyFields": [
|
|
2002
|
-
"scope",
|
|
2003
|
-
"appliedTo",
|
|
2004
|
-
"ruleName",
|
|
2005
|
-
"action",
|
|
2006
|
-
"conditions",
|
|
2007
|
-
"frequency",
|
|
2008
|
-
"appliedIds",
|
|
2009
|
-
"schedule",
|
|
2010
|
-
"campaignIds",
|
|
2011
|
-
"adIds"
|
|
2012
|
-
]
|
|
2080
|
+
"bodyFields": []
|
|
2013
2081
|
};
|
|
2014
|
-
var
|
|
2015
|
-
"operationId": "
|
|
2016
|
-
"method": "
|
|
2017
|
-
"endpoint": "/
|
|
2082
|
+
var OP_ZaloAdsGetReportapiV3Campaigns = {
|
|
2083
|
+
"operationId": "ZaloAds_getReportapiV3Campaigns",
|
|
2084
|
+
"method": "GET",
|
|
2085
|
+
"endpoint": "/reportapi/v3/campaigns",
|
|
2018
2086
|
"baseUrl": "https://ads.zalo.me",
|
|
2019
2087
|
"binaryFields": [],
|
|
2020
2088
|
"pathFields": [],
|
|
2021
|
-
"queryFields": [
|
|
2089
|
+
"queryFields": [
|
|
2090
|
+
"filter",
|
|
2091
|
+
"endDate",
|
|
2092
|
+
"refresh",
|
|
2093
|
+
"agencyId",
|
|
2094
|
+
"createdBy",
|
|
2095
|
+
"startDate"
|
|
2096
|
+
],
|
|
2022
2097
|
"headerFields": [],
|
|
2023
2098
|
"cookieFields": [],
|
|
2024
|
-
"bodyFields": [
|
|
2025
|
-
"automatedRuleId",
|
|
2026
|
-
"rowVersion",
|
|
2027
|
-
"appliedTo",
|
|
2028
|
-
"ruleName",
|
|
2029
|
-
"action",
|
|
2030
|
-
"conditions",
|
|
2031
|
-
"schedule",
|
|
2032
|
-
"campaignIds",
|
|
2033
|
-
"adIds"
|
|
2034
|
-
]
|
|
2099
|
+
"bodyFields": []
|
|
2035
2100
|
};
|
|
2036
|
-
var
|
|
2037
|
-
"operationId": "
|
|
2038
|
-
"method": "
|
|
2039
|
-
"endpoint": "/
|
|
2101
|
+
var OP_ZaloAdsGetReportOverview = {
|
|
2102
|
+
"operationId": "ZaloAds_getReportOverview",
|
|
2103
|
+
"method": "GET",
|
|
2104
|
+
"endpoint": "/reportapi/report/overview",
|
|
2040
2105
|
"baseUrl": "https://ads.zalo.me",
|
|
2041
2106
|
"binaryFields": [],
|
|
2042
2107
|
"pathFields": [],
|
|
2043
|
-
"queryFields": [
|
|
2108
|
+
"queryFields": [
|
|
2109
|
+
"data"
|
|
2110
|
+
],
|
|
2044
2111
|
"headerFields": [],
|
|
2045
2112
|
"cookieFields": [],
|
|
2046
|
-
"bodyFields": [
|
|
2047
|
-
"automatedRuleId",
|
|
2048
|
-
"automatedRuleIds",
|
|
2049
|
-
"status"
|
|
2050
|
-
]
|
|
2113
|
+
"bodyFields": []
|
|
2051
2114
|
};
|
|
2052
|
-
var
|
|
2053
|
-
"operationId": "
|
|
2115
|
+
var OP_ZaloAdsGetDemographicsReport = {
|
|
2116
|
+
"operationId": "ZaloAds_getDemographicsReport",
|
|
2054
2117
|
"method": "GET",
|
|
2055
|
-
"endpoint": "/api/
|
|
2118
|
+
"endpoint": "/api/demographics/report",
|
|
2056
2119
|
"baseUrl": "https://ads.zalo.me",
|
|
2057
2120
|
"binaryFields": [],
|
|
2058
|
-
"pathFields": [
|
|
2059
|
-
|
|
2121
|
+
"pathFields": [],
|
|
2122
|
+
"queryFields": [
|
|
2123
|
+
"campaignId",
|
|
2124
|
+
"adId",
|
|
2125
|
+
"startDate",
|
|
2126
|
+
"endDate",
|
|
2127
|
+
"agencyId",
|
|
2128
|
+
"from",
|
|
2129
|
+
"to"
|
|
2060
2130
|
],
|
|
2061
|
-
"queryFields": [],
|
|
2062
2131
|
"headerFields": [],
|
|
2063
2132
|
"cookieFields": [],
|
|
2064
2133
|
"bodyFields": []
|
|
2065
2134
|
};
|
|
2066
|
-
var
|
|
2067
|
-
"operationId": "
|
|
2135
|
+
var OP_ZaloAdsDeleteCustomReport = {
|
|
2136
|
+
"operationId": "ZaloAds_deleteCustomReport",
|
|
2068
2137
|
"method": "POST",
|
|
2069
|
-
"endpoint": "/
|
|
2138
|
+
"endpoint": "/reportapi/custom-report/delete/{id}",
|
|
2070
2139
|
"baseUrl": "https://ads.zalo.me",
|
|
2071
2140
|
"binaryFields": [],
|
|
2072
|
-
"pathFields": [
|
|
2141
|
+
"pathFields": [
|
|
2142
|
+
"id"
|
|
2143
|
+
],
|
|
2073
2144
|
"queryFields": [],
|
|
2074
2145
|
"headerFields": [],
|
|
2075
2146
|
"cookieFields": [],
|
|
2076
|
-
"bodyFields": [
|
|
2077
|
-
"automatedRuleIds"
|
|
2078
|
-
]
|
|
2147
|
+
"bodyFields": []
|
|
2079
2148
|
};
|
|
2080
|
-
var
|
|
2081
|
-
"operationId": "
|
|
2082
|
-
"method": "
|
|
2083
|
-
"endpoint": "/
|
|
2149
|
+
var OP_ZaloAdsListReportFilters = {
|
|
2150
|
+
"operationId": "ZaloAds_listReportFilters",
|
|
2151
|
+
"method": "GET",
|
|
2152
|
+
"endpoint": "/reportapi/api/filter/list",
|
|
2084
2153
|
"baseUrl": "https://ads.zalo.me",
|
|
2085
|
-
"binaryFields": [
|
|
2086
|
-
"File"
|
|
2087
|
-
],
|
|
2154
|
+
"binaryFields": [],
|
|
2088
2155
|
"pathFields": [],
|
|
2089
|
-
"queryFields": [
|
|
2156
|
+
"queryFields": [
|
|
2157
|
+
"model"
|
|
2158
|
+
],
|
|
2090
2159
|
"headerFields": [],
|
|
2091
2160
|
"cookieFields": [],
|
|
2092
|
-
"bodyFields": [
|
|
2093
|
-
"File",
|
|
2094
|
-
"isHash"
|
|
2095
|
-
]
|
|
2161
|
+
"bodyFields": []
|
|
2096
2162
|
};
|
|
2097
|
-
var
|
|
2098
|
-
"operationId": "
|
|
2099
|
-
"method": "
|
|
2100
|
-
"endpoint": "/
|
|
2163
|
+
var OP_ZaloAdsGetZaapiCampaignReportcampaign = {
|
|
2164
|
+
"operationId": "ZaloAds_getZaapiCampaignReportcampaign",
|
|
2165
|
+
"method": "GET",
|
|
2166
|
+
"endpoint": "/zaapi/Campaign/reportCampaign",
|
|
2101
2167
|
"baseUrl": "https://ads.zalo.me",
|
|
2102
|
-
"binaryFields": [
|
|
2103
|
-
|
|
2168
|
+
"binaryFields": [],
|
|
2169
|
+
"pathFields": [],
|
|
2170
|
+
"queryFields": [
|
|
2171
|
+
"campaignId",
|
|
2172
|
+
"campId",
|
|
2173
|
+
"from",
|
|
2174
|
+
"to"
|
|
2104
2175
|
],
|
|
2176
|
+
"headerFields": [],
|
|
2177
|
+
"cookieFields": [],
|
|
2178
|
+
"bodyFields": []
|
|
2179
|
+
};
|
|
2180
|
+
var OP_ZaloAdsListCustomReports = {
|
|
2181
|
+
"operationId": "ZaloAds_listCustomReports",
|
|
2182
|
+
"method": "GET",
|
|
2183
|
+
"endpoint": "/reportapi/custom-report/list",
|
|
2184
|
+
"baseUrl": "https://ads.zalo.me",
|
|
2185
|
+
"binaryFields": [],
|
|
2105
2186
|
"pathFields": [],
|
|
2106
2187
|
"queryFields": [],
|
|
2107
2188
|
"headerFields": [],
|
|
2108
2189
|
"cookieFields": [],
|
|
2109
|
-
"bodyFields": [
|
|
2110
|
-
"File"
|
|
2111
|
-
]
|
|
2190
|
+
"bodyFields": []
|
|
2112
2191
|
};
|
|
2113
2192
|
var OP_ZaloAdsUpsertCustomReport = {
|
|
2114
2193
|
"operationId": "ZaloAds_upsertCustomReport",
|
|
@@ -2127,282 +2206,1265 @@ var OP_ZaloAdsUpsertCustomReport = {
|
|
|
2127
2206
|
"isDefault"
|
|
2128
2207
|
]
|
|
2129
2208
|
};
|
|
2130
|
-
var
|
|
2209
|
+
var ZaloReportsService = class {
|
|
2131
2210
|
constructor(client) {
|
|
2132
2211
|
this.client = client;
|
|
2133
2212
|
}
|
|
2134
|
-
|
|
2135
|
-
return this.client.
|
|
2136
|
-
}
|
|
2137
|
-
createFlow(request, options) {
|
|
2138
|
-
return this.client.requestJson(OP_ZaloAdsCreateFlow, this.client.toTransportInput(OP_ZaloAdsCreateFlow, request), options);
|
|
2139
|
-
}
|
|
2140
|
-
updateFlow(request, options) {
|
|
2141
|
-
return this.client.requestJson(OP_ZaloAdsUpdateFlow, this.client.toTransportInput(OP_ZaloAdsUpdateFlow, request), options);
|
|
2142
|
-
}
|
|
2143
|
-
listFlowsByOfficialAccount(request, options) {
|
|
2144
|
-
return this.client.requestWithoutBody(OP_ZaloAdsListFlowsByOfficialAccount, this.client.toTransportInput(OP_ZaloAdsListFlowsByOfficialAccount, request), options);
|
|
2145
|
-
}
|
|
2146
|
-
changeCampaignStatus(request, options) {
|
|
2147
|
-
return this.client.requestFormUrlEncoded(OP_ZaloAdsChangeCampaignStatus, this.client.toTransportInput(OP_ZaloAdsChangeCampaignStatus, request), options);
|
|
2148
|
-
}
|
|
2149
|
-
deleteCampaign(request, options) {
|
|
2150
|
-
const payload = { campaignId: request.campaignId, status: request.status ?? -2 };
|
|
2151
|
-
return this.client.requestFormUrlEncoded(OP_ZaloAdsDeleteCampaign, this.client.toTransportInput(OP_ZaloAdsDeleteCampaign, payload), options);
|
|
2152
|
-
}
|
|
2153
|
-
createCustomAudience(request, options) {
|
|
2154
|
-
return this.client.requestJson(OP_ZaloAdsCreateCustomAudience, this.client.toTransportInput(OP_ZaloAdsCreateCustomAudience, request), options);
|
|
2155
|
-
}
|
|
2156
|
-
createWebsiteCampaign(request, options) {
|
|
2157
|
-
return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateWebsiteCampaign, this.client.toTransportInput(OP_ZaloAdsCreateWebsiteCampaign, request), options);
|
|
2158
|
-
}
|
|
2159
|
-
updateWebsiteAd(request, options) {
|
|
2160
|
-
return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateWebsiteAd, this.client.toTransportInput(OP_ZaloAdsUpdateWebsiteAd, request), options);
|
|
2213
|
+
getReportapiV2Ads(request, options) {
|
|
2214
|
+
return this.client.requestWithoutBody(OP_ZaloAdsGetReportapiV2Ads, this.client.toTransportInput(OP_ZaloAdsGetReportapiV2Ads, request), options);
|
|
2161
2215
|
}
|
|
2162
|
-
|
|
2163
|
-
return this.client.
|
|
2216
|
+
getReportapiV2Campaigns(request = {}, options) {
|
|
2217
|
+
return this.client.requestWithoutBody(OP_ZaloAdsGetReportapiV2Campaigns, this.client.toTransportInput(OP_ZaloAdsGetReportapiV2Campaigns, request), options);
|
|
2164
2218
|
}
|
|
2165
|
-
|
|
2166
|
-
return this.client.
|
|
2219
|
+
getReportapiV2UniqueUser(request, options) {
|
|
2220
|
+
return this.client.requestWithoutBody(OP_ZaloAdsGetReportapiV2UniqueUser, this.client.toTransportInput(OP_ZaloAdsGetReportapiV2UniqueUser, request), options);
|
|
2167
2221
|
}
|
|
2168
|
-
|
|
2169
|
-
|
|
2222
|
+
getReportapiV3Campaigns(request, options) {
|
|
2223
|
+
const normalized = {
|
|
2224
|
+
filter: "[]",
|
|
2225
|
+
agencyId: 0,
|
|
2226
|
+
...request
|
|
2227
|
+
};
|
|
2228
|
+
return this.client.requestWithoutBody(OP_ZaloAdsGetReportapiV3Campaigns, this.client.toTransportInput(OP_ZaloAdsGetReportapiV3Campaigns, normalized), options);
|
|
2170
2229
|
}
|
|
2171
|
-
|
|
2172
|
-
return this.client.
|
|
2230
|
+
getReportOverview(request, options) {
|
|
2231
|
+
return this.client.requestWithoutBody(OP_ZaloAdsGetReportOverview, this.client.toTransportInput(OP_ZaloAdsGetReportOverview, request), options);
|
|
2173
2232
|
}
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
return this.createEcommerceCampaign(request, options);
|
|
2233
|
+
getDemographicsReport(request, options) {
|
|
2234
|
+
return this.client.requestWithoutBody(OP_ZaloAdsGetDemographicsReport, this.client.toTransportInput(OP_ZaloAdsGetDemographicsReport, request), options);
|
|
2177
2235
|
}
|
|
2178
|
-
|
|
2179
|
-
return this.client.
|
|
2236
|
+
getZaapiCampaignReportcampaign(request, options) {
|
|
2237
|
+
return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiCampaignReportcampaign, this.client.toTransportInput(OP_ZaloAdsGetZaapiCampaignReportcampaign, request), options);
|
|
2180
2238
|
}
|
|
2181
|
-
|
|
2182
|
-
return this.client.
|
|
2239
|
+
listCustomReports(request = {}, options) {
|
|
2240
|
+
return this.client.requestWithoutBody(OP_ZaloAdsListCustomReports, this.client.toTransportInput(OP_ZaloAdsListCustomReports, request), options);
|
|
2183
2241
|
}
|
|
2184
|
-
|
|
2185
|
-
return this.client.
|
|
2242
|
+
upsertCustomReport(request, options) {
|
|
2243
|
+
return this.client.requestJson(OP_ZaloAdsUpsertCustomReport, this.client.toTransportInput(OP_ZaloAdsUpsertCustomReport, request), options);
|
|
2186
2244
|
}
|
|
2187
|
-
|
|
2188
|
-
return this.client.
|
|
2245
|
+
deleteCustomReport(request, options) {
|
|
2246
|
+
return this.client.requestJson(OP_ZaloAdsDeleteCustomReport, this.client.toTransportInput(OP_ZaloAdsDeleteCustomReport, request), options);
|
|
2189
2247
|
}
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
return this.createOfficialAccountCampaign(request, options);
|
|
2248
|
+
listReportFilters(request, options) {
|
|
2249
|
+
return this.client.requestWithoutBody(OP_ZaloAdsListReportFilters, this.client.toTransportInput(OP_ZaloAdsListReportFilters, request), options);
|
|
2193
2250
|
}
|
|
2194
|
-
|
|
2195
|
-
|
|
2251
|
+
/** Báo cáo hiệu quả chiến dịch (API V3 - Khuyên dùng) */
|
|
2252
|
+
getCampaignReportV3(...args) {
|
|
2253
|
+
return this.getReportapiV3Campaigns(...args);
|
|
2196
2254
|
}
|
|
2197
|
-
/**
|
|
2198
|
-
|
|
2199
|
-
return this.
|
|
2255
|
+
/** Báo cáo hiệu quả chiến dịch (API V2) */
|
|
2256
|
+
getCampaignReportV2(...args) {
|
|
2257
|
+
return this.getReportapiV2Campaigns(...args);
|
|
2200
2258
|
}
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
return this.
|
|
2259
|
+
/** Báo cáo hiệu quả quảng cáo (API V2) */
|
|
2260
|
+
getAdsReportV2(...args) {
|
|
2261
|
+
return this.getReportapiV2Ads(...args);
|
|
2204
2262
|
}
|
|
2205
|
-
|
|
2206
|
-
|
|
2263
|
+
/** Báo cáo người dùng tiếp cận duy nhất (Unique Reach) */
|
|
2264
|
+
getUniqueUserReport(...args) {
|
|
2265
|
+
return this.getReportapiV2UniqueUser(...args);
|
|
2207
2266
|
}
|
|
2208
|
-
|
|
2209
|
-
|
|
2267
|
+
/** Báo cáo chiến dịch theo ngày/tháng (Legacy ZAAPI) */
|
|
2268
|
+
getCampaignReportLegacy(...args) {
|
|
2269
|
+
return this.getZaapiCampaignReportcampaign(...args);
|
|
2210
2270
|
}
|
|
2211
|
-
|
|
2212
|
-
|
|
2271
|
+
};
|
|
2272
|
+
|
|
2273
|
+
// src/services/conversions.service.ts
|
|
2274
|
+
var OP_ZaloAdsCreateConversion = {
|
|
2275
|
+
"operationId": "ZaloAds_createConversion",
|
|
2276
|
+
"method": "POST",
|
|
2277
|
+
"endpoint": "/api/conversion/add",
|
|
2278
|
+
"baseUrl": "https://ads.zalo.me",
|
|
2279
|
+
"binaryFields": [],
|
|
2280
|
+
"pathFields": [],
|
|
2281
|
+
"queryFields": [],
|
|
2282
|
+
"headerFields": [],
|
|
2283
|
+
"cookieFields": [],
|
|
2284
|
+
"bodyFields": [
|
|
2285
|
+
"name",
|
|
2286
|
+
"landingPage",
|
|
2287
|
+
"urlType",
|
|
2288
|
+
"labelId",
|
|
2289
|
+
"buttonIds",
|
|
2290
|
+
"elements",
|
|
2291
|
+
"keywords"
|
|
2292
|
+
]
|
|
2293
|
+
};
|
|
2294
|
+
var OP_ZaloAdsDeleteConversion = {
|
|
2295
|
+
"operationId": "ZaloAds_deleteConversion",
|
|
2296
|
+
"method": "DELETE",
|
|
2297
|
+
"endpoint": "/api/conversion/delete/{conversionId}",
|
|
2298
|
+
"baseUrl": "https://ads.zalo.me",
|
|
2299
|
+
"binaryFields": [],
|
|
2300
|
+
"pathFields": [
|
|
2301
|
+
"conversionId"
|
|
2302
|
+
],
|
|
2303
|
+
"queryFields": [],
|
|
2304
|
+
"headerFields": [],
|
|
2305
|
+
"cookieFields": [],
|
|
2306
|
+
"bodyFields": []
|
|
2307
|
+
};
|
|
2308
|
+
var OP_ZaloAdsGetApiConversionAll = {
|
|
2309
|
+
"operationId": "ZaloAds_getApiConversionAll",
|
|
2310
|
+
"method": "GET",
|
|
2311
|
+
"endpoint": "/api/conversion/all",
|
|
2312
|
+
"baseUrl": "https://ads.zalo.me",
|
|
2313
|
+
"binaryFields": [],
|
|
2314
|
+
"pathFields": [],
|
|
2315
|
+
"queryFields": [],
|
|
2316
|
+
"headerFields": [],
|
|
2317
|
+
"cookieFields": [],
|
|
2318
|
+
"bodyFields": []
|
|
2319
|
+
};
|
|
2320
|
+
var OP_ZaloAdsGetApiConversionStandardEvents = {
|
|
2321
|
+
"operationId": "ZaloAds_getApiConversionStandardEvents",
|
|
2322
|
+
"method": "GET",
|
|
2323
|
+
"endpoint": "/api/conversion/standard-events",
|
|
2324
|
+
"baseUrl": "https://ads.zalo.me",
|
|
2325
|
+
"binaryFields": [],
|
|
2326
|
+
"pathFields": [],
|
|
2327
|
+
"queryFields": [],
|
|
2328
|
+
"headerFields": [],
|
|
2329
|
+
"cookieFields": [],
|
|
2330
|
+
"bodyFields": []
|
|
2331
|
+
};
|
|
2332
|
+
var OP_ZaloAdsListPersonalPixelLabels = {
|
|
2333
|
+
"operationId": "ZaloAds_listPersonalPixelLabels",
|
|
2334
|
+
"method": "GET",
|
|
2335
|
+
"endpoint": "/api/conversion/support-personal-pixel-labels",
|
|
2336
|
+
"baseUrl": "https://ads.zalo.me",
|
|
2337
|
+
"binaryFields": [],
|
|
2338
|
+
"pathFields": [],
|
|
2339
|
+
"queryFields": [],
|
|
2340
|
+
"headerFields": [],
|
|
2341
|
+
"cookieFields": [],
|
|
2342
|
+
"bodyFields": []
|
|
2343
|
+
};
|
|
2344
|
+
var ZaloConversionsService = class {
|
|
2345
|
+
constructor(client) {
|
|
2346
|
+
this.client = client;
|
|
2347
|
+
}
|
|
2348
|
+
createConversion(request, options) {
|
|
2349
|
+
return this.client.requestJson(OP_ZaloAdsCreateConversion, this.client.toTransportInput(OP_ZaloAdsCreateConversion, request), options);
|
|
2350
|
+
}
|
|
2351
|
+
deleteConversion(request, options) {
|
|
2352
|
+
return this.client.requestWithoutBody(OP_ZaloAdsDeleteConversion, this.client.toTransportInput(OP_ZaloAdsDeleteConversion, request), options);
|
|
2353
|
+
}
|
|
2354
|
+
getApiConversionAll(request = {}, options) {
|
|
2355
|
+
return this.client.requestWithoutBody(OP_ZaloAdsGetApiConversionAll, this.client.toTransportInput(OP_ZaloAdsGetApiConversionAll, request), options);
|
|
2356
|
+
}
|
|
2357
|
+
getApiConversionStandardEvents(request = {}, options) {
|
|
2358
|
+
return this.client.requestWithoutBody(OP_ZaloAdsGetApiConversionStandardEvents, this.client.toTransportInput(OP_ZaloAdsGetApiConversionStandardEvents, request), options);
|
|
2359
|
+
}
|
|
2360
|
+
listPersonalPixelLabels(request = {}, options) {
|
|
2361
|
+
return this.client.requestWithoutBody(OP_ZaloAdsListPersonalPixelLabels, this.client.toTransportInput(OP_ZaloAdsListPersonalPixelLabels, request), options);
|
|
2362
|
+
}
|
|
2363
|
+
/** Lấy danh sách tài khoản Zalo Official Account (OA) có dữ liệu chuyển đổi (Lead Signal) (`GET /api/ad/audience/leadSignal/oas`). */
|
|
2364
|
+
listLeadSignalOas(options) {
|
|
2365
|
+
return this.client.requestWithoutBody(
|
|
2366
|
+
{
|
|
2367
|
+
operationId: "ZaloAds_listLeadSignalOas",
|
|
2368
|
+
method: "GET",
|
|
2369
|
+
endpoint: "/api/ad/audience/leadSignal/oas",
|
|
2370
|
+
baseUrl: "https://ads.zalo.me",
|
|
2371
|
+
binaryFields: [],
|
|
2372
|
+
pathFields: [],
|
|
2373
|
+
queryFields: [],
|
|
2374
|
+
headerFields: [],
|
|
2375
|
+
cookieFields: [],
|
|
2376
|
+
bodyFields: []
|
|
2377
|
+
},
|
|
2378
|
+
void 0,
|
|
2379
|
+
options
|
|
2380
|
+
);
|
|
2381
|
+
}
|
|
2382
|
+
/** Lấy danh sách rút gọn gồm ID và tên của toàn bộ các sự kiện chuyển đổi (Conversion) đã tạo trên tài khoản quảng cáo Zalo Ads (`GET /api/conversion/names`). */
|
|
2383
|
+
listConversionNames(request = {}, options) {
|
|
2384
|
+
const op = {
|
|
2385
|
+
operationId: "ZaloAds_listConversionNames",
|
|
2386
|
+
method: "GET",
|
|
2387
|
+
endpoint: "/api/conversion/names",
|
|
2388
|
+
baseUrl: "https://ads.zalo.me",
|
|
2389
|
+
binaryFields: [],
|
|
2390
|
+
pathFields: [],
|
|
2391
|
+
queryFields: [],
|
|
2392
|
+
headerFields: [],
|
|
2393
|
+
cookieFields: [],
|
|
2394
|
+
bodyFields: []
|
|
2395
|
+
};
|
|
2396
|
+
return this.client.requestWithoutBody(
|
|
2397
|
+
op,
|
|
2398
|
+
this.client.toTransportInput(op, request),
|
|
2399
|
+
options
|
|
2400
|
+
);
|
|
2401
|
+
}
|
|
2402
|
+
/** Alias cho `listConversionNames` (`GET /api/conversion/names`). */
|
|
2403
|
+
getApiConversionNames(request = {}, options) {
|
|
2404
|
+
return this.listConversionNames(request, options);
|
|
2405
|
+
}
|
|
2406
|
+
/** Danh sách toàn bộ sự kiện chuyển đổi */
|
|
2407
|
+
listConversions(...args) {
|
|
2408
|
+
return this.getApiConversionAll(...args);
|
|
2409
|
+
}
|
|
2410
|
+
/** Danh sách sự kiện chuyển đổi tiêu chuẩn */
|
|
2411
|
+
getConversionStandardEvents(...args) {
|
|
2412
|
+
return this.getApiConversionStandardEvents(...args);
|
|
2413
|
+
}
|
|
2414
|
+
};
|
|
2415
|
+
|
|
2416
|
+
// src/services/automated-rules.service.ts
|
|
2417
|
+
var OP_ZaloAdsListAutomatedRules = {
|
|
2418
|
+
"operationId": "ZaloAds_listAutomatedRules",
|
|
2419
|
+
"method": "GET",
|
|
2420
|
+
"endpoint": "/api/automatedrules/list",
|
|
2421
|
+
"baseUrl": "https://ads.zalo.me",
|
|
2422
|
+
"binaryFields": [],
|
|
2423
|
+
"pathFields": [],
|
|
2424
|
+
"queryFields": [
|
|
2425
|
+
"ruleName"
|
|
2426
|
+
],
|
|
2427
|
+
"headerFields": [],
|
|
2428
|
+
"cookieFields": [],
|
|
2429
|
+
"bodyFields": []
|
|
2430
|
+
};
|
|
2431
|
+
var OP_ZaloAdsCreateAutomatedRule = {
|
|
2432
|
+
"operationId": "ZaloAds_createAutomatedRule",
|
|
2433
|
+
"method": "POST",
|
|
2434
|
+
"endpoint": "/api/automatedrules/create",
|
|
2435
|
+
"baseUrl": "https://ads.zalo.me",
|
|
2436
|
+
"binaryFields": [],
|
|
2437
|
+
"pathFields": [],
|
|
2438
|
+
"queryFields": [],
|
|
2439
|
+
"headerFields": [],
|
|
2440
|
+
"cookieFields": [],
|
|
2441
|
+
"bodyFields": [
|
|
2442
|
+
"scope",
|
|
2443
|
+
"appliedTo",
|
|
2444
|
+
"ruleName",
|
|
2445
|
+
"action",
|
|
2446
|
+
"conditions",
|
|
2447
|
+
"frequency",
|
|
2448
|
+
"appliedIds",
|
|
2449
|
+
"schedule",
|
|
2450
|
+
"campaignIds",
|
|
2451
|
+
"adIds"
|
|
2452
|
+
]
|
|
2453
|
+
};
|
|
2454
|
+
var OP_ZaloAdsUpdateAutomatedRule = {
|
|
2455
|
+
"operationId": "ZaloAds_updateAutomatedRule",
|
|
2456
|
+
"method": "POST",
|
|
2457
|
+
"endpoint": "/api/automatedrules/update",
|
|
2458
|
+
"baseUrl": "https://ads.zalo.me",
|
|
2459
|
+
"binaryFields": [],
|
|
2460
|
+
"pathFields": [],
|
|
2461
|
+
"queryFields": [],
|
|
2462
|
+
"headerFields": [],
|
|
2463
|
+
"cookieFields": [],
|
|
2464
|
+
"bodyFields": [
|
|
2465
|
+
"automatedRuleId",
|
|
2466
|
+
"rowVersion",
|
|
2467
|
+
"appliedTo",
|
|
2468
|
+
"ruleName",
|
|
2469
|
+
"action",
|
|
2470
|
+
"conditions",
|
|
2471
|
+
"schedule",
|
|
2472
|
+
"campaignIds",
|
|
2473
|
+
"adIds"
|
|
2474
|
+
]
|
|
2475
|
+
};
|
|
2476
|
+
var OP_ZaloAdsChangeAutomatedRuleStatus = {
|
|
2477
|
+
"operationId": "ZaloAds_changeAutomatedRuleStatus",
|
|
2478
|
+
"method": "POST",
|
|
2479
|
+
"endpoint": "/api/automatedrules/change-status",
|
|
2480
|
+
"baseUrl": "https://ads.zalo.me",
|
|
2481
|
+
"binaryFields": [],
|
|
2482
|
+
"pathFields": [],
|
|
2483
|
+
"queryFields": [],
|
|
2484
|
+
"headerFields": [],
|
|
2485
|
+
"cookieFields": [],
|
|
2486
|
+
"bodyFields": [
|
|
2487
|
+
"automatedRuleId",
|
|
2488
|
+
"automatedRuleIds",
|
|
2489
|
+
"status"
|
|
2490
|
+
]
|
|
2491
|
+
};
|
|
2492
|
+
var OP_ZaloAdsGetAutomatedRuleHistory = {
|
|
2493
|
+
"operationId": "ZaloAds_getAutomatedRuleHistory",
|
|
2494
|
+
"method": "GET",
|
|
2495
|
+
"endpoint": "/api/automatedrules/history/{automatedRuleId}",
|
|
2496
|
+
"baseUrl": "https://ads.zalo.me",
|
|
2497
|
+
"binaryFields": [],
|
|
2498
|
+
"pathFields": [
|
|
2499
|
+
"automatedRuleId"
|
|
2500
|
+
],
|
|
2501
|
+
"queryFields": [],
|
|
2502
|
+
"headerFields": [],
|
|
2503
|
+
"cookieFields": [],
|
|
2504
|
+
"bodyFields": []
|
|
2505
|
+
};
|
|
2506
|
+
var OP_ZaloAdsDeleteAutomatedRule = {
|
|
2507
|
+
"operationId": "ZaloAds_deleteAutomatedRule",
|
|
2508
|
+
"method": "POST",
|
|
2509
|
+
"endpoint": "/api/automatedrules/delete",
|
|
2510
|
+
"baseUrl": "https://ads.zalo.me",
|
|
2511
|
+
"binaryFields": [],
|
|
2512
|
+
"pathFields": [],
|
|
2513
|
+
"queryFields": [],
|
|
2514
|
+
"headerFields": [],
|
|
2515
|
+
"cookieFields": [],
|
|
2516
|
+
"bodyFields": [
|
|
2517
|
+
"automatedRuleIds"
|
|
2518
|
+
]
|
|
2519
|
+
};
|
|
2520
|
+
var ZaloAutomatedRulesService = class {
|
|
2521
|
+
constructor(client) {
|
|
2522
|
+
this.client = client;
|
|
2523
|
+
}
|
|
2524
|
+
listAutomatedRules(request = {}, options) {
|
|
2525
|
+
const queryInput = { query_param: { ruleName: request.ruleName ?? "" } };
|
|
2526
|
+
return this.client.requestWithoutBody(OP_ZaloAdsListAutomatedRules, queryInput, options);
|
|
2527
|
+
}
|
|
2528
|
+
createAutomatedRule(request, options) {
|
|
2529
|
+
return this.client.requestJson(OP_ZaloAdsCreateAutomatedRule, this.client.toTransportInput(OP_ZaloAdsCreateAutomatedRule, request), options);
|
|
2530
|
+
}
|
|
2531
|
+
updateAutomatedRule(request, options) {
|
|
2532
|
+
return this.client.requestJson(OP_ZaloAdsUpdateAutomatedRule, this.client.toTransportInput(OP_ZaloAdsUpdateAutomatedRule, request), options);
|
|
2533
|
+
}
|
|
2534
|
+
changeAutomatedRuleStatus(request, options) {
|
|
2535
|
+
return this.client.requestJson(OP_ZaloAdsChangeAutomatedRuleStatus, this.client.toTransportInput(OP_ZaloAdsChangeAutomatedRuleStatus, request), options);
|
|
2536
|
+
}
|
|
2537
|
+
getAutomatedRuleHistory(request, options) {
|
|
2538
|
+
return this.client.requestWithoutBody(OP_ZaloAdsGetAutomatedRuleHistory, this.client.toTransportInput(OP_ZaloAdsGetAutomatedRuleHistory, request), options);
|
|
2539
|
+
}
|
|
2540
|
+
deleteAutomatedRule(request, options) {
|
|
2541
|
+
return this.client.requestJson(OP_ZaloAdsDeleteAutomatedRule, this.client.toTransportInput(OP_ZaloAdsDeleteAutomatedRule, request), options);
|
|
2542
|
+
}
|
|
2543
|
+
};
|
|
2544
|
+
|
|
2545
|
+
// src/services/flows.service.ts
|
|
2546
|
+
var OP_ZaloAdsListFlowsByOfficialAccount = {
|
|
2547
|
+
operationId: "ZaloAds_listFlowsByOfficialAccount",
|
|
2548
|
+
method: "GET",
|
|
2549
|
+
endpoint: "/api/flow/getByOaId",
|
|
2550
|
+
baseUrl: "https://ads.zalo.me",
|
|
2551
|
+
binaryFields: [],
|
|
2552
|
+
pathFields: [],
|
|
2553
|
+
queryFields: ["oaId", "limit", "offset", "flowId"],
|
|
2554
|
+
headerFields: [],
|
|
2555
|
+
cookieFields: [],
|
|
2556
|
+
bodyFields: []
|
|
2557
|
+
};
|
|
2558
|
+
var OP_ZaloAdsCreateFlow = {
|
|
2559
|
+
operationId: "ZaloAds_createFlow",
|
|
2560
|
+
method: "POST",
|
|
2561
|
+
endpoint: "/api/flow/create",
|
|
2562
|
+
baseUrl: "https://ads.zalo.me",
|
|
2563
|
+
binaryFields: [],
|
|
2564
|
+
pathFields: [],
|
|
2565
|
+
queryFields: [],
|
|
2566
|
+
headerFields: [],
|
|
2567
|
+
cookieFields: [],
|
|
2568
|
+
bodyFields: ["oaId", "id", "name", "messages"]
|
|
2569
|
+
};
|
|
2570
|
+
var OP_ZaloAdsUpdateFlow = {
|
|
2571
|
+
operationId: "ZaloAds_updateFlow",
|
|
2572
|
+
method: "POST",
|
|
2573
|
+
endpoint: "/api/flow/update",
|
|
2574
|
+
baseUrl: "https://ads.zalo.me",
|
|
2575
|
+
binaryFields: [],
|
|
2576
|
+
pathFields: [],
|
|
2577
|
+
queryFields: [],
|
|
2578
|
+
headerFields: [],
|
|
2579
|
+
cookieFields: [],
|
|
2580
|
+
bodyFields: ["oaId", "id", "name", "messages"]
|
|
2581
|
+
};
|
|
2582
|
+
var ZaloFlowsService = class {
|
|
2583
|
+
constructor(client) {
|
|
2584
|
+
this.client = client;
|
|
2585
|
+
}
|
|
2586
|
+
listFlowsByOfficialAccount(request, options) {
|
|
2587
|
+
return this.client.requestWithoutBody(OP_ZaloAdsListFlowsByOfficialAccount, this.client.toTransportInput(OP_ZaloAdsListFlowsByOfficialAccount, request), options);
|
|
2588
|
+
}
|
|
2589
|
+
createFlow(request, options) {
|
|
2590
|
+
return this.client.requestJson(OP_ZaloAdsCreateFlow, this.client.toTransportInput(OP_ZaloAdsCreateFlow, request), options);
|
|
2591
|
+
}
|
|
2592
|
+
updateFlow(request, options) {
|
|
2593
|
+
return this.client.requestJson(OP_ZaloAdsUpdateFlow, this.client.toTransportInput(OP_ZaloAdsUpdateFlow, request), options);
|
|
2594
|
+
}
|
|
2595
|
+
};
|
|
2596
|
+
|
|
2597
|
+
// src/services/media.service.ts
|
|
2598
|
+
var OP_ZaloAdsGetApiMediaItems = {
|
|
2599
|
+
operationId: "ZaloAds_getApiMediaItems",
|
|
2600
|
+
method: "GET",
|
|
2601
|
+
endpoint: "/api/media/items",
|
|
2602
|
+
baseUrl: "https://ads.zalo.me",
|
|
2603
|
+
binaryFields: [],
|
|
2604
|
+
pathFields: [],
|
|
2605
|
+
queryFields: ["endDate", "startDate"],
|
|
2606
|
+
headerFields: [],
|
|
2607
|
+
cookieFields: [],
|
|
2608
|
+
bodyFields: []
|
|
2609
|
+
};
|
|
2610
|
+
var OP_ZaloAdsGetApiMemberFiles = {
|
|
2611
|
+
operationId: "ZaloAds_getApiMemberFiles",
|
|
2612
|
+
method: "GET",
|
|
2613
|
+
endpoint: "/api/member/files",
|
|
2614
|
+
baseUrl: "https://ads.zalo.me",
|
|
2615
|
+
binaryFields: [],
|
|
2616
|
+
pathFields: [],
|
|
2617
|
+
queryFields: [],
|
|
2618
|
+
headerFields: [],
|
|
2619
|
+
cookieFields: [],
|
|
2620
|
+
bodyFields: []
|
|
2621
|
+
};
|
|
2622
|
+
var OP_ZaloAdsGetApiFilegroups = {
|
|
2623
|
+
operationId: "ZaloAds_getApiFilegroups",
|
|
2624
|
+
method: "GET",
|
|
2625
|
+
endpoint: "/api/filegroups",
|
|
2626
|
+
baseUrl: "https://ads.zalo.me",
|
|
2627
|
+
binaryFields: [],
|
|
2628
|
+
pathFields: [],
|
|
2629
|
+
queryFields: [],
|
|
2630
|
+
headerFields: [],
|
|
2631
|
+
cookieFields: [],
|
|
2632
|
+
bodyFields: []
|
|
2633
|
+
};
|
|
2634
|
+
var OP_ZaloAdsPostApiMediaSave = {
|
|
2635
|
+
operationId: "ZaloAds_postApiMediaSave",
|
|
2636
|
+
method: "POST",
|
|
2637
|
+
endpoint: "/api/media/save",
|
|
2638
|
+
baseUrl: "https://ads.zalo.me",
|
|
2639
|
+
binaryFields: [],
|
|
2640
|
+
pathFields: [],
|
|
2641
|
+
queryFields: [],
|
|
2642
|
+
headerFields: [],
|
|
2643
|
+
cookieFields: [],
|
|
2644
|
+
bodyFields: ["data"]
|
|
2645
|
+
};
|
|
2646
|
+
var OP_ZaloAdsPostApiMemberUploadImage = {
|
|
2647
|
+
operationId: "ZaloAds_postApiMemberUploadImage",
|
|
2648
|
+
method: "POST",
|
|
2649
|
+
endpoint: "/api/member/upload-image",
|
|
2650
|
+
baseUrl: "https://ads.zalo.me",
|
|
2651
|
+
binaryFields: ["File"],
|
|
2652
|
+
pathFields: [],
|
|
2653
|
+
queryFields: [],
|
|
2654
|
+
headerFields: [],
|
|
2655
|
+
cookieFields: [],
|
|
2656
|
+
bodyFields: ["File"]
|
|
2657
|
+
};
|
|
2658
|
+
var OP_ZaloAdsUploadVideo = {
|
|
2659
|
+
operationId: "ZaloAds_uploadVideo",
|
|
2660
|
+
method: "POST",
|
|
2661
|
+
endpoint: "/api/member/upload-video",
|
|
2662
|
+
baseUrl: "https://ads.zalo.me",
|
|
2663
|
+
binaryFields: ["File"],
|
|
2664
|
+
pathFields: [],
|
|
2665
|
+
queryFields: [],
|
|
2666
|
+
headerFields: [],
|
|
2667
|
+
cookieFields: [],
|
|
2668
|
+
bodyFields: ["File"]
|
|
2669
|
+
};
|
|
2670
|
+
var OP_ZaloAdsUpdateNewAds2 = {
|
|
2671
|
+
operationId: "ZaloAds_UpdateNewAds",
|
|
2672
|
+
method: "POST",
|
|
2673
|
+
endpoint: "/zaapi/UploadCrop",
|
|
2674
|
+
baseUrl: "https://ads.zalo.me",
|
|
2675
|
+
binaryFields: ["File"],
|
|
2676
|
+
pathFields: [],
|
|
2677
|
+
queryFields: [],
|
|
2678
|
+
headerFields: [],
|
|
2679
|
+
cookieFields: [],
|
|
2680
|
+
bodyFields: ["File", "x", "y", "width", "height", "scale"]
|
|
2681
|
+
};
|
|
2682
|
+
function extractJpegDimensions(buffer) {
|
|
2683
|
+
let i = 2;
|
|
2684
|
+
while (i < buffer.length - 8) {
|
|
2685
|
+
if (buffer[i] !== 255) {
|
|
2686
|
+
i++;
|
|
2687
|
+
continue;
|
|
2688
|
+
}
|
|
2689
|
+
const marker = buffer[i + 1];
|
|
2690
|
+
if (marker === 192 || marker === 193 || marker === 194) {
|
|
2691
|
+
const height = buffer[i + 5] << 8 | buffer[i + 6];
|
|
2692
|
+
const width = buffer[i + 7] << 8 | buffer[i + 8];
|
|
2693
|
+
return { width, height };
|
|
2694
|
+
}
|
|
2695
|
+
const len = buffer[i + 2] << 8 | buffer[i + 3];
|
|
2696
|
+
i += 2 + len;
|
|
2697
|
+
}
|
|
2698
|
+
return null;
|
|
2699
|
+
}
|
|
2700
|
+
function extractPngDimensions(buffer) {
|
|
2701
|
+
if (buffer.length >= 24 && buffer[0] === 137 && buffer[1] === 80 && buffer[2] === 78 && buffer[3] === 71) {
|
|
2702
|
+
const width = buffer[16] << 24 | buffer[17] << 16 | buffer[18] << 8 | buffer[19];
|
|
2703
|
+
const height = buffer[20] << 24 | buffer[21] << 16 | buffer[22] << 8 | buffer[23];
|
|
2704
|
+
return { width, height };
|
|
2705
|
+
}
|
|
2706
|
+
return null;
|
|
2707
|
+
}
|
|
2708
|
+
function isUint8Array(val) {
|
|
2709
|
+
if (val instanceof Uint8Array) {
|
|
2710
|
+
return true;
|
|
2711
|
+
}
|
|
2712
|
+
if (typeof val === "object" && val !== null && typeof val.constructor?.isBuffer === "function") {
|
|
2713
|
+
return val.constructor.isBuffer(val);
|
|
2714
|
+
}
|
|
2715
|
+
return false;
|
|
2716
|
+
}
|
|
2717
|
+
function resolveFileName(input, defaultPrefix = "media") {
|
|
2718
|
+
if (typeof input === "string") {
|
|
2719
|
+
const clean = input.split(/[?#]/)[0];
|
|
2720
|
+
const match = clean.match(/[^/\\]+$/);
|
|
2721
|
+
if (match && match[0]) return match[0];
|
|
2722
|
+
}
|
|
2723
|
+
if (input && typeof input === "object") {
|
|
2724
|
+
const record = input;
|
|
2725
|
+
if (typeof record.name === "string" && record.name) return record.name;
|
|
2726
|
+
if (typeof record.originalname === "string" && record.originalname) return record.originalname;
|
|
2727
|
+
if (typeof record.fileName === "string" && record.fileName) return record.fileName;
|
|
2728
|
+
}
|
|
2729
|
+
return `${defaultPrefix}_${Date.now()}.jpg`;
|
|
2730
|
+
}
|
|
2731
|
+
var ZaloMediaService = class {
|
|
2732
|
+
constructor(client) {
|
|
2733
|
+
this.client = client;
|
|
2734
|
+
}
|
|
2735
|
+
// ==========================================================================
|
|
2736
|
+
// 1. RAW API METHODS (Chuẩn theo OpenAPI spec media-and-assets, không validate)
|
|
2737
|
+
// ==========================================================================
|
|
2738
|
+
/**
|
|
2739
|
+
* Lấy danh sách ảnh, video trong thư viện Zalo Ads theo khoảng thời gian (`GET /api/media/items`).
|
|
2740
|
+
*/
|
|
2741
|
+
getApiMediaItems(request, options) {
|
|
2742
|
+
return this.client.requestWithoutBody(
|
|
2743
|
+
OP_ZaloAdsGetApiMediaItems,
|
|
2744
|
+
this.client.toTransportInput(OP_ZaloAdsGetApiMediaItems, request),
|
|
2745
|
+
options
|
|
2746
|
+
);
|
|
2747
|
+
}
|
|
2748
|
+
/**
|
|
2749
|
+
* Alias cho `getApiMediaItems`.
|
|
2750
|
+
*/
|
|
2751
|
+
listMediaItems(request, options) {
|
|
2752
|
+
return this.getApiMediaItems(request, options);
|
|
2753
|
+
}
|
|
2754
|
+
/**
|
|
2755
|
+
* Lấy các tệp do thành viên hiện tại quản lý trong tài khoản quảng cáo (`GET /api/member/files`).
|
|
2756
|
+
*/
|
|
2757
|
+
getApiMemberFiles(request = {}, options) {
|
|
2758
|
+
return this.client.requestWithoutBody(
|
|
2759
|
+
OP_ZaloAdsGetApiMemberFiles,
|
|
2760
|
+
this.client.toTransportInput(OP_ZaloAdsGetApiMemberFiles, request),
|
|
2761
|
+
options
|
|
2762
|
+
);
|
|
2763
|
+
}
|
|
2764
|
+
/**
|
|
2765
|
+
* Alias cho `getApiMemberFiles`.
|
|
2766
|
+
*/
|
|
2767
|
+
listMemberFiles(request = {}, options) {
|
|
2768
|
+
return this.getApiMemberFiles(request, options);
|
|
2769
|
+
}
|
|
2770
|
+
/**
|
|
2771
|
+
* Lấy danh sách nhóm tệp trong kho media (`GET /api/filegroups`).
|
|
2772
|
+
*/
|
|
2773
|
+
getApiFilegroups(request = {}, options) {
|
|
2774
|
+
return this.client.requestWithoutBody(
|
|
2775
|
+
OP_ZaloAdsGetApiFilegroups,
|
|
2776
|
+
this.client.toTransportInput(OP_ZaloAdsGetApiFilegroups, request),
|
|
2777
|
+
options
|
|
2778
|
+
);
|
|
2779
|
+
}
|
|
2780
|
+
/**
|
|
2781
|
+
* Alias cho `getApiFilegroups`.
|
|
2782
|
+
*/
|
|
2783
|
+
listFilegroups(request = {}, options) {
|
|
2784
|
+
return this.getApiFilegroups(request, options);
|
|
2785
|
+
}
|
|
2786
|
+
/**
|
|
2787
|
+
* Lưu tài nguyên media vào thư viện Zalo Ads sau khi đã có URL ảnh/video và metadata (`POST /api/media/save`).
|
|
2788
|
+
* Phản hồi trả về `{ code: 0, data: <MediaId> }`.
|
|
2789
|
+
*/
|
|
2790
|
+
postApiMediaSave(request, options) {
|
|
2791
|
+
const normalized = {
|
|
2792
|
+
...request,
|
|
2793
|
+
data: typeof request.data === "string" ? request.data : JSON.stringify(request.data)
|
|
2794
|
+
};
|
|
2795
|
+
return this.client.requestFormUrlEncoded(
|
|
2796
|
+
OP_ZaloAdsPostApiMediaSave,
|
|
2797
|
+
this.client.toTransportInput(OP_ZaloAdsPostApiMediaSave, normalized),
|
|
2798
|
+
options
|
|
2799
|
+
);
|
|
2800
|
+
}
|
|
2801
|
+
/**
|
|
2802
|
+
* Alias cho `postApiMediaSave`.
|
|
2803
|
+
*/
|
|
2804
|
+
saveMedia(request, options) {
|
|
2805
|
+
return this.postApiMediaSave(request, options);
|
|
2806
|
+
}
|
|
2807
|
+
/**
|
|
2808
|
+
* Tải ảnh lên kho media của tài khoản quảng cáo (`POST /api/member/upload-image`).
|
|
2809
|
+
* Sử dụng multipart/form-data với trường `File` (chữ hoa). Trả về URL CDN Adtima.
|
|
2810
|
+
*/
|
|
2811
|
+
postApiMemberUploadImage(request, options) {
|
|
2812
|
+
const file = request.File ?? request.file;
|
|
2813
|
+
if (typeof file === "string" && !/^(https?:|data:)/i.test(file)) {
|
|
2814
|
+
throw new ZaloSdkError(
|
|
2815
|
+
"\u0110\u01B0\u1EDDng d\u1EABn t\u1EC7p c\u1EE5c b\u1ED9 tr\xEAn \u1ED5 c\u1EE9ng kh\xF4ng \u0111\u01B0\u1EE3c h\u1ED7 tr\u1EE3. Vui l\xF2ng truy\u1EC1n Buffer/Uint8Array (v\xED d\u1EE5: req.file.buffer t\u1EEB Multer), Web Blob/File ho\u1EB7c URL \u1EA3nh c\xF4ng khai (http/https).",
|
|
2816
|
+
400,
|
|
2817
|
+
"postApiMemberUploadImage",
|
|
2818
|
+
null
|
|
2819
|
+
);
|
|
2820
|
+
}
|
|
2821
|
+
const normalized = {
|
|
2822
|
+
File: file
|
|
2823
|
+
};
|
|
2824
|
+
return this.client.requestMultipart(
|
|
2825
|
+
OP_ZaloAdsPostApiMemberUploadImage,
|
|
2826
|
+
this.client.toTransportInput(OP_ZaloAdsPostApiMemberUploadImage, normalized),
|
|
2827
|
+
options
|
|
2828
|
+
);
|
|
2829
|
+
}
|
|
2830
|
+
/**
|
|
2831
|
+
* Alias cho `postApiMemberUploadImage`.
|
|
2832
|
+
*/
|
|
2833
|
+
uploadImage(request, options) {
|
|
2834
|
+
return this.postApiMemberUploadImage(request, options);
|
|
2835
|
+
}
|
|
2836
|
+
/**
|
|
2837
|
+
* Tải video lên kho media của tài khoản quảng cáo (`POST /api/member/upload-video`).
|
|
2838
|
+
* Định dạng chuẩn .MP4 (H.264), tối đa 150MB. Trả về URL video trên Adtima CDN.
|
|
2839
|
+
*/
|
|
2840
|
+
uploadVideo(request, options) {
|
|
2841
|
+
const file = request.File ?? request.file;
|
|
2842
|
+
if (typeof file === "string" && !/^(https?:|data:)/i.test(file)) {
|
|
2843
|
+
throw new ZaloSdkError(
|
|
2844
|
+
"\u0110\u01B0\u1EDDng d\u1EABn t\u1EC7p c\u1EE5c b\u1ED9 tr\xEAn \u1ED5 c\u1EE9ng kh\xF4ng \u0111\u01B0\u1EE3c h\u1ED7 tr\u1EE3. Vui l\xF2ng truy\u1EC1n Buffer/Uint8Array (v\xED d\u1EE5: req.file.buffer), Web Blob/File ho\u1EB7c URL video c\xF4ng khai (http/https).",
|
|
2845
|
+
400,
|
|
2846
|
+
"uploadVideo",
|
|
2847
|
+
null
|
|
2848
|
+
);
|
|
2849
|
+
}
|
|
2850
|
+
const normalized = {
|
|
2851
|
+
File: file
|
|
2852
|
+
};
|
|
2853
|
+
return this.client.requestMultipart(
|
|
2854
|
+
OP_ZaloAdsUploadVideo,
|
|
2855
|
+
this.client.toTransportInput(OP_ZaloAdsUploadVideo, normalized),
|
|
2856
|
+
options
|
|
2857
|
+
);
|
|
2858
|
+
}
|
|
2859
|
+
/**
|
|
2860
|
+
* Tải ảnh và thiết lập vùng crop tạo asset dùng cho quảng cáo Zalo Ads (`POST /zaapi/UploadCrop`).
|
|
2861
|
+
*/
|
|
2862
|
+
updateNewAds(request, options) {
|
|
2863
|
+
return this.client.requestMultipart(
|
|
2864
|
+
OP_ZaloAdsUpdateNewAds2,
|
|
2865
|
+
this.client.toTransportInput(OP_ZaloAdsUpdateNewAds2, request),
|
|
2866
|
+
options
|
|
2867
|
+
);
|
|
2868
|
+
}
|
|
2869
|
+
/**
|
|
2870
|
+
* Alias cho `updateNewAds` (`POST /zaapi/UploadCrop`).
|
|
2871
|
+
*/
|
|
2872
|
+
uploadCrop(request, options) {
|
|
2873
|
+
return this.updateNewAds(request, options);
|
|
2874
|
+
}
|
|
2875
|
+
// ==========================================================================
|
|
2876
|
+
// 2. CONVENIENCE CUSTOM METHODS: UPLOAD + SAVE TRỌN GÓI
|
|
2877
|
+
// ==========================================================================
|
|
2878
|
+
/**
|
|
2879
|
+
* Method tiện ích trọn gói: Tự động tải ảnh lên CDN (`/api/member/upload-image`)
|
|
2880
|
+
* VÀ lưu vào Thư viện Zalo Ads (`/api/media/save`) trong cùng 1 lời gọi duy nhất.
|
|
2881
|
+
*
|
|
2882
|
+
* Trả về MediaId, URL CDN và kích thước để gắn ngay vào Creative/Quảng cáo.
|
|
2883
|
+
*/
|
|
2884
|
+
async uploadAndSaveImage(request, options) {
|
|
2885
|
+
if (!request.file) {
|
|
2886
|
+
throw new ZaloSdkError(
|
|
2887
|
+
"ZaloMediaService: `file` l\xE0 tham s\u1ED1 b\u1EAFt bu\u1ED9c trong uploadAndSaveImage.",
|
|
2888
|
+
400,
|
|
2889
|
+
"uploadAndSaveImage",
|
|
2890
|
+
null
|
|
2891
|
+
);
|
|
2892
|
+
}
|
|
2893
|
+
if (typeof request.file === "string" && !/^(https?:|data:)/i.test(request.file)) {
|
|
2894
|
+
throw new ZaloSdkError(
|
|
2895
|
+
"\u0110\u01B0\u1EDDng d\u1EABn t\u1EC7p c\u1EE5c b\u1ED9 tr\xEAn \u1ED5 c\u1EE9ng kh\xF4ng \u0111\u01B0\u1EE3c h\u1ED7 tr\u1EE3. Vui l\xF2ng truy\u1EC1n Buffer/Uint8Array (v\xED d\u1EE5: req.file.buffer t\u1EEB Multer), Web Blob/File ho\u1EB7c URL \u1EA3nh c\xF4ng khai (http/https).",
|
|
2896
|
+
400,
|
|
2897
|
+
"uploadAndSaveImage",
|
|
2898
|
+
null
|
|
2899
|
+
);
|
|
2900
|
+
}
|
|
2901
|
+
const fileName = request.fileName || resolveFileName(request.file, "image");
|
|
2902
|
+
let width = request.width;
|
|
2903
|
+
let height = request.height;
|
|
2904
|
+
if ((!width || !height) && isUint8Array(request.file)) {
|
|
2905
|
+
const dims = extractJpegDimensions(request.file) || extractPngDimensions(request.file);
|
|
2906
|
+
if (dims) {
|
|
2907
|
+
width = width || dims.width;
|
|
2908
|
+
height = height || dims.height;
|
|
2909
|
+
}
|
|
2910
|
+
}
|
|
2911
|
+
const resolvedWidth = width && width > 0 ? width : 1200;
|
|
2912
|
+
const resolvedHeight = height && height > 0 ? height : 710;
|
|
2913
|
+
const uploadRes = await this.postApiMemberUploadImage({ File: request.file }, options);
|
|
2914
|
+
if (!uploadRes || uploadRes.code !== 0 || !uploadRes.data) {
|
|
2915
|
+
throw new ZaloSdkError(
|
|
2916
|
+
uploadRes?.msg || "T\u1EA3i \u1EA3nh l\xEAn Zalo Ads th\u1EA5t b\u1EA1i \u1EDF b\u01B0\u1EDBc upload CDN.",
|
|
2917
|
+
uploadRes?.code || 500,
|
|
2918
|
+
"uploadAndSaveImage_upload",
|
|
2919
|
+
uploadRes
|
|
2920
|
+
);
|
|
2921
|
+
}
|
|
2922
|
+
const cdnUrl = uploadRes.data;
|
|
2923
|
+
const mediaType = request.type !== void 0 ? request.type : 1;
|
|
2924
|
+
const savePayload = {
|
|
2925
|
+
Name: fileName,
|
|
2926
|
+
Type: mediaType,
|
|
2927
|
+
Settings: {
|
|
2928
|
+
Url: cdnUrl,
|
|
2929
|
+
Width: resolvedWidth,
|
|
2930
|
+
Height: resolvedHeight,
|
|
2931
|
+
...request.thumbUrl ? { ThumbUrl: request.thumbUrl } : {}
|
|
2932
|
+
}
|
|
2933
|
+
};
|
|
2934
|
+
const saveRes = await this.postApiMediaSave({ data: savePayload }, options);
|
|
2935
|
+
if (!saveRes || saveRes.code !== 0 || typeof saveRes.data !== "number") {
|
|
2936
|
+
throw new ZaloSdkError(
|
|
2937
|
+
"L\u01B0u \u1EA3nh v\xE0o Th\u01B0 vi\u1EC7n Media Zalo Ads th\u1EA5t b\u1EA1i \u1EDF b\u01B0\u1EDBc save.",
|
|
2938
|
+
saveRes?.code || 500,
|
|
2939
|
+
"uploadAndSaveImage_save",
|
|
2940
|
+
saveRes
|
|
2941
|
+
);
|
|
2942
|
+
}
|
|
2943
|
+
return {
|
|
2944
|
+
code: 0,
|
|
2945
|
+
mediaId: saveRes.data,
|
|
2946
|
+
cdnUrl,
|
|
2947
|
+
name: fileName,
|
|
2948
|
+
width: resolvedWidth,
|
|
2949
|
+
height: resolvedHeight,
|
|
2950
|
+
type: mediaType,
|
|
2951
|
+
rawUploadResponse: uploadRes,
|
|
2952
|
+
rawSaveResponse: saveRes
|
|
2953
|
+
};
|
|
2954
|
+
}
|
|
2955
|
+
/**
|
|
2956
|
+
* Method tiện ích trọn gói cho Video: Tự động tải video lên CDN (`/api/member/upload-video`)
|
|
2957
|
+
* VÀ lưu vào Thư viện Zalo Ads (`/api/media/save`) để cấp MediaId.
|
|
2958
|
+
*/
|
|
2959
|
+
async uploadAndSaveVideo(request, options) {
|
|
2960
|
+
if (!request.file) {
|
|
2961
|
+
throw new ZaloSdkError(
|
|
2962
|
+
"ZaloMediaService: `file` l\xE0 tham s\u1ED1 b\u1EAFt bu\u1ED9c trong uploadAndSaveVideo.",
|
|
2963
|
+
400,
|
|
2964
|
+
"uploadAndSaveVideo",
|
|
2965
|
+
null
|
|
2966
|
+
);
|
|
2967
|
+
}
|
|
2968
|
+
if (typeof request.file === "string" && !/^(https?:|data:)/i.test(request.file)) {
|
|
2969
|
+
throw new ZaloSdkError(
|
|
2970
|
+
"\u0110\u01B0\u1EDDng d\u1EABn t\u1EC7p c\u1EE5c b\u1ED9 tr\xEAn \u1ED5 c\u1EE9ng kh\xF4ng \u0111\u01B0\u1EE3c h\u1ED7 tr\u1EE3. Vui l\xF2ng truy\u1EC1n Buffer/Uint8Array, Web Blob/File ho\u1EB7c URL video c\xF4ng khai (http/https).",
|
|
2971
|
+
400,
|
|
2972
|
+
"uploadAndSaveVideo",
|
|
2973
|
+
null
|
|
2974
|
+
);
|
|
2975
|
+
}
|
|
2976
|
+
const fileName = request.fileName || resolveFileName(request.file, "video");
|
|
2977
|
+
const width = request.width || 1920;
|
|
2978
|
+
const height = request.height || 1080;
|
|
2979
|
+
const duration = request.duration || 30;
|
|
2980
|
+
const uploadRes = await this.uploadVideo({ File: request.file }, options);
|
|
2981
|
+
if (!uploadRes || uploadRes.code !== 0 || !uploadRes.data) {
|
|
2982
|
+
throw new ZaloSdkError(
|
|
2983
|
+
uploadRes?.msg || "T\u1EA3i video l\xEAn Zalo Ads th\u1EA5t b\u1EA1i \u1EDF b\u01B0\u1EDBc upload CDN.",
|
|
2984
|
+
uploadRes?.code || 500,
|
|
2985
|
+
"uploadAndSaveVideo_upload",
|
|
2986
|
+
uploadRes
|
|
2987
|
+
);
|
|
2988
|
+
}
|
|
2989
|
+
const cdnUrl = uploadRes.data;
|
|
2990
|
+
const savePayload = {
|
|
2991
|
+
Name: fileName,
|
|
2992
|
+
Type: 2,
|
|
2993
|
+
// 2 = Video
|
|
2994
|
+
Settings: {
|
|
2995
|
+
Url: cdnUrl,
|
|
2996
|
+
Width: width,
|
|
2997
|
+
Height: height,
|
|
2998
|
+
Duration: duration,
|
|
2999
|
+
...request.thumbUrl ? { ThumbUrl: request.thumbUrl } : {}
|
|
3000
|
+
}
|
|
3001
|
+
};
|
|
3002
|
+
const saveRes = await this.postApiMediaSave({ data: savePayload }, options);
|
|
3003
|
+
if (!saveRes || saveRes.code !== 0 || typeof saveRes.data !== "number") {
|
|
3004
|
+
throw new ZaloSdkError(
|
|
3005
|
+
"L\u01B0u video v\xE0o Th\u01B0 vi\u1EC7n Media Zalo Ads th\u1EA5t b\u1EA1i \u1EDF b\u01B0\u1EDBc save.",
|
|
3006
|
+
saveRes?.code || 500,
|
|
3007
|
+
"uploadAndSaveVideo_save",
|
|
3008
|
+
saveRes
|
|
3009
|
+
);
|
|
3010
|
+
}
|
|
3011
|
+
return {
|
|
3012
|
+
code: 0,
|
|
3013
|
+
mediaId: saveRes.data,
|
|
3014
|
+
cdnUrl,
|
|
3015
|
+
name: fileName,
|
|
3016
|
+
width,
|
|
3017
|
+
height,
|
|
3018
|
+
duration,
|
|
3019
|
+
type: 2,
|
|
3020
|
+
rawUploadResponse: uploadRes,
|
|
3021
|
+
rawSaveResponse: saveRes
|
|
3022
|
+
};
|
|
3023
|
+
}
|
|
3024
|
+
// ==========================================================================
|
|
3025
|
+
// 3. STANDALONE VALIDATION METHODS (Cho Backend sử dụng độc lập, không chặn API)
|
|
3026
|
+
// ==========================================================================
|
|
3027
|
+
/**
|
|
3028
|
+
* Kiểm tra tính hợp lệ của tệp Ảnh theo quy chuẩn Zalo Ads:
|
|
3029
|
+
* - "No file chosen": Bắt buộc phải có tệp.
|
|
3030
|
+
* - Dung lượng: Tối đa 2MB (2 * 1024 * 1024 bytes).
|
|
3031
|
+
* - Kích thước: Tối thiểu 150x150 pixels.
|
|
3032
|
+
* - Định dạng: Hỗ trợ .JPG, .JPEG, .PNG.
|
|
3033
|
+
*
|
|
3034
|
+
* Trả về `{ isValid: boolean, status: 'VALID' | 'INVALID', errors: string[], metadata: {...} }`.
|
|
3035
|
+
*/
|
|
3036
|
+
validateImage(input) {
|
|
3037
|
+
const errors = [];
|
|
3038
|
+
let sizeBytes = input.sizeBytes;
|
|
3039
|
+
let fileName = input.fileName;
|
|
3040
|
+
let format = input.format;
|
|
3041
|
+
let width = input.width;
|
|
3042
|
+
let height = input.height;
|
|
3043
|
+
const file = input.file;
|
|
3044
|
+
const hasFile = Boolean(
|
|
3045
|
+
file !== null && file !== void 0 && (typeof file !== "string" || file.trim() !== "")
|
|
3046
|
+
);
|
|
3047
|
+
if (!hasFile && sizeBytes === void 0) {
|
|
3048
|
+
errors.push("No file chosen");
|
|
3049
|
+
return {
|
|
3050
|
+
isValid: false,
|
|
3051
|
+
status: "INVALID",
|
|
3052
|
+
errors,
|
|
3053
|
+
metadata: { fileDetected: false }
|
|
3054
|
+
};
|
|
3055
|
+
}
|
|
3056
|
+
if (file && typeof file === "object") {
|
|
3057
|
+
const rec = file;
|
|
3058
|
+
if (typeof rec.size === "number" && sizeBytes === void 0) {
|
|
3059
|
+
sizeBytes = rec.size;
|
|
3060
|
+
}
|
|
3061
|
+
if (typeof rec.originalname === "string" && !fileName) {
|
|
3062
|
+
fileName = rec.originalname;
|
|
3063
|
+
}
|
|
3064
|
+
if (typeof rec.mimetype === "string" && !format) {
|
|
3065
|
+
format = rec.mimetype;
|
|
3066
|
+
}
|
|
3067
|
+
if (isUint8Array(rec.buffer)) {
|
|
3068
|
+
if (sizeBytes === void 0) sizeBytes = rec.buffer.byteLength;
|
|
3069
|
+
const dims = extractJpegDimensions(rec.buffer) || extractPngDimensions(rec.buffer);
|
|
3070
|
+
if (dims) {
|
|
3071
|
+
width = width || dims.width;
|
|
3072
|
+
height = height || dims.height;
|
|
3073
|
+
}
|
|
3074
|
+
} else if (isUint8Array(file)) {
|
|
3075
|
+
if (sizeBytes === void 0) sizeBytes = file.byteLength;
|
|
3076
|
+
const dims = extractJpegDimensions(file) || extractPngDimensions(file);
|
|
3077
|
+
if (dims) {
|
|
3078
|
+
width = width || dims.width;
|
|
3079
|
+
height = height || dims.height;
|
|
3080
|
+
}
|
|
3081
|
+
}
|
|
3082
|
+
} else if (typeof file === "string" && !fileName) {
|
|
3083
|
+
fileName = resolveFileName(file);
|
|
3084
|
+
}
|
|
3085
|
+
if (sizeBytes !== void 0 && sizeBytes <= 0) {
|
|
3086
|
+
errors.push("No file chosen");
|
|
3087
|
+
}
|
|
3088
|
+
const MAX_IMAGE_BYTES = 2 * 1024 * 1024;
|
|
3089
|
+
if (sizeBytes !== void 0 && sizeBytes > MAX_IMAGE_BYTES) {
|
|
3090
|
+
const sizeMB = (sizeBytes / (1024 * 1024)).toFixed(2);
|
|
3091
|
+
errors.push(`Dung l\u01B0\u1EE3ng \u1EA3nh v\u01B0\u1EE3t qu\xE1 gi\u1EDBi h\u1EA1n t\u1ED1i \u0111a 2MB (dung l\u01B0\u1EE3ng hi\u1EC7n t\u1EA1i: ${sizeMB}MB).`);
|
|
3092
|
+
}
|
|
3093
|
+
if (width !== void 0 && height !== void 0) {
|
|
3094
|
+
if (width < 150 || height < 150) {
|
|
3095
|
+
errors.push(`K\xEDch th\u01B0\u1EDBc \u1EA3nh t\u1ED1i thi\u1EC3u 150x150 (k\xEDch th\u01B0\u1EDBc hi\u1EC7n t\u1EA1i: ${width}x${height} pixels).`);
|
|
3096
|
+
}
|
|
3097
|
+
}
|
|
3098
|
+
const nameToCheck = (fileName || format || "").toLowerCase();
|
|
3099
|
+
if (nameToCheck) {
|
|
3100
|
+
const isAllowedFormat = nameToCheck.endsWith(".jpg") || nameToCheck.endsWith(".jpeg") || nameToCheck.endsWith(".png") || nameToCheck.includes("image/jpeg") || nameToCheck.includes("image/jpg") || nameToCheck.includes("image/png");
|
|
3101
|
+
if (!isAllowedFormat) {
|
|
3102
|
+
errors.push("\u0110\u1ECBnh d\u1EA1ng \u1EA3nh kh\xF4ng h\u1EE3p l\u1EC7, y\xEAu c\u1EA7u \u0111\u1ECBnh d\u1EA1ng .JPG, .JPEG ho\u1EB7c .PNG.");
|
|
3103
|
+
}
|
|
3104
|
+
}
|
|
3105
|
+
const isValid = errors.length === 0;
|
|
3106
|
+
return {
|
|
3107
|
+
isValid,
|
|
3108
|
+
status: isValid ? "VALID" : "INVALID",
|
|
3109
|
+
errors,
|
|
3110
|
+
metadata: {
|
|
3111
|
+
fileDetected: true,
|
|
3112
|
+
sizeBytes,
|
|
3113
|
+
width,
|
|
3114
|
+
height,
|
|
3115
|
+
format: format || (fileName ? fileName.split(".").pop() : void 0)
|
|
3116
|
+
}
|
|
3117
|
+
};
|
|
3118
|
+
}
|
|
3119
|
+
/**
|
|
3120
|
+
* Kiểm tra tính hợp lệ của tệp Video theo quy chuẩn Zalo Ads:
|
|
3121
|
+
* - "No file chosen": Bắt buộc phải có tệp.
|
|
3122
|
+
* - Định dạng: .MP4 H.264.
|
|
3123
|
+
* - Dung lượng: Tối đa 150MB (150 * 1024 * 1024 bytes).
|
|
3124
|
+
* - Thời lượng: Tối đa 60 giây.
|
|
3125
|
+
* - Tỉ lệ khung hình: 16:9, 9:16 hoặc 1:1.
|
|
3126
|
+
*
|
|
3127
|
+
* Trả về `{ isValid: boolean, status: 'VALID' | 'INVALID', errors: string[], metadata: {...} }`.
|
|
3128
|
+
*/
|
|
3129
|
+
validateVideo(input) {
|
|
3130
|
+
const errors = [];
|
|
3131
|
+
let sizeBytes = input.sizeBytes;
|
|
3132
|
+
let fileName = input.fileName;
|
|
3133
|
+
let format = input.format;
|
|
3134
|
+
const durationSeconds = input.durationSeconds;
|
|
3135
|
+
const width = input.width;
|
|
3136
|
+
const height = input.height;
|
|
3137
|
+
const file = input.file;
|
|
3138
|
+
const hasFile = Boolean(
|
|
3139
|
+
file !== null && file !== void 0 && (typeof file !== "string" || file.trim() !== "")
|
|
3140
|
+
);
|
|
3141
|
+
if (!hasFile && sizeBytes === void 0) {
|
|
3142
|
+
errors.push("No file chosen");
|
|
3143
|
+
return {
|
|
3144
|
+
isValid: false,
|
|
3145
|
+
status: "INVALID",
|
|
3146
|
+
errors,
|
|
3147
|
+
metadata: { fileDetected: false }
|
|
3148
|
+
};
|
|
3149
|
+
}
|
|
3150
|
+
if (file && typeof file === "object") {
|
|
3151
|
+
const rec = file;
|
|
3152
|
+
if (typeof rec.size === "number" && sizeBytes === void 0) {
|
|
3153
|
+
sizeBytes = rec.size;
|
|
3154
|
+
}
|
|
3155
|
+
if (typeof rec.originalname === "string" && !fileName) {
|
|
3156
|
+
fileName = rec.originalname;
|
|
3157
|
+
}
|
|
3158
|
+
if (typeof rec.mimetype === "string" && !format) {
|
|
3159
|
+
format = rec.mimetype;
|
|
3160
|
+
}
|
|
3161
|
+
if (isUint8Array(rec.buffer)) {
|
|
3162
|
+
if (sizeBytes === void 0) sizeBytes = rec.buffer.byteLength;
|
|
3163
|
+
} else if (isUint8Array(file)) {
|
|
3164
|
+
if (sizeBytes === void 0) sizeBytes = file.byteLength;
|
|
3165
|
+
}
|
|
3166
|
+
} else if (typeof file === "string" && !fileName) {
|
|
3167
|
+
fileName = resolveFileName(file);
|
|
3168
|
+
}
|
|
3169
|
+
if (sizeBytes !== void 0 && sizeBytes <= 0) {
|
|
3170
|
+
errors.push("No file chosen");
|
|
3171
|
+
}
|
|
3172
|
+
const nameToCheck = (fileName || format || "").toLowerCase();
|
|
3173
|
+
if (nameToCheck) {
|
|
3174
|
+
const isMp4 = nameToCheck.endsWith(".mp4") || nameToCheck.includes("video/mp4") || nameToCheck.includes("h264");
|
|
3175
|
+
if (!isMp4) {
|
|
3176
|
+
errors.push("\u0110\u1ECBnh d\u1EA1ng video kh\xF4ng h\u1EE3p l\u1EC7, y\xEAu c\u1EA7u \u0111\u1ECBnh d\u1EA1ng .MP4 (H.264).");
|
|
3177
|
+
}
|
|
3178
|
+
}
|
|
3179
|
+
const MAX_VIDEO_BYTES = 150 * 1024 * 1024;
|
|
3180
|
+
if (sizeBytes !== void 0 && sizeBytes > MAX_VIDEO_BYTES) {
|
|
3181
|
+
const sizeMB = (sizeBytes / (1024 * 1024)).toFixed(2);
|
|
3182
|
+
errors.push(`Dung l\u01B0\u1EE3ng video v\u01B0\u1EE3t qu\xE1 gi\u1EDBi h\u1EA1n t\u1ED1i \u0111a 150MB (dung l\u01B0\u1EE3ng hi\u1EC7n t\u1EA1i: ${sizeMB}MB).`);
|
|
3183
|
+
}
|
|
3184
|
+
if (durationSeconds !== void 0 && durationSeconds > 60) {
|
|
3185
|
+
errors.push(`Th\u1EDDi l\u01B0\u1EE3ng video v\u01B0\u1EE3t qu\xE1 gi\u1EDBi h\u1EA1n t\u1ED1i \u0111a 60 gi\xE2y (th\u1EDDi l\u01B0\u1EE3ng hi\u1EC7n t\u1EA1i: ${durationSeconds} gi\xE2y).`);
|
|
3186
|
+
}
|
|
3187
|
+
let ratioLabel;
|
|
3188
|
+
if (width !== void 0 && height !== void 0 && width > 0 && height > 0) {
|
|
3189
|
+
const ratio = width / height;
|
|
3190
|
+
const is16_9 = Math.abs(ratio - 16 / 9) <= 0.06;
|
|
3191
|
+
const is9_16 = Math.abs(ratio - 9 / 16) <= 0.04;
|
|
3192
|
+
const is1_1 = Math.abs(ratio - 1) <= 0.05;
|
|
3193
|
+
if (is16_9) ratioLabel = "16:9";
|
|
3194
|
+
else if (is9_16) ratioLabel = "9:16";
|
|
3195
|
+
else if (is1_1) ratioLabel = "1:1";
|
|
3196
|
+
else {
|
|
3197
|
+
ratioLabel = `${width}:${height} (~${ratio.toFixed(2)})`;
|
|
3198
|
+
errors.push(`T\u1EC9 l\u1EC7 khung h\xECnh video ph\u1EA3i l\xE0 16:9, 9:16 ho\u1EB7c 1:1 (t\u1EC9 l\u1EC7 hi\u1EC7n t\u1EA1i: ${width}x${height} - ${ratioLabel}).`);
|
|
3199
|
+
}
|
|
3200
|
+
}
|
|
3201
|
+
const isValid = errors.length === 0;
|
|
3202
|
+
return {
|
|
3203
|
+
isValid,
|
|
3204
|
+
status: isValid ? "VALID" : "INVALID",
|
|
3205
|
+
errors,
|
|
3206
|
+
metadata: {
|
|
3207
|
+
fileDetected: true,
|
|
3208
|
+
sizeBytes,
|
|
3209
|
+
width,
|
|
3210
|
+
height,
|
|
3211
|
+
durationSeconds,
|
|
3212
|
+
format: format || (fileName ? fileName.split(".").pop() : void 0),
|
|
3213
|
+
aspectRatio: ratioLabel
|
|
3214
|
+
}
|
|
3215
|
+
};
|
|
2213
3216
|
}
|
|
2214
|
-
|
|
2215
|
-
|
|
3217
|
+
};
|
|
3218
|
+
|
|
3219
|
+
// src/services/ads.service.ts
|
|
3220
|
+
var ZaloAdsService = class extends ZaloCampaignsService {
|
|
3221
|
+
account;
|
|
3222
|
+
audiences;
|
|
3223
|
+
targeting;
|
|
3224
|
+
reports;
|
|
3225
|
+
conversions;
|
|
3226
|
+
pixel;
|
|
3227
|
+
automatedRules;
|
|
3228
|
+
rules;
|
|
3229
|
+
flows;
|
|
3230
|
+
media;
|
|
3231
|
+
campaigns;
|
|
3232
|
+
constructor(client) {
|
|
3233
|
+
super(client);
|
|
3234
|
+
this.account = new ZaloAccountService(client);
|
|
3235
|
+
this.audiences = new ZaloAudiencesService(client);
|
|
3236
|
+
this.targeting = this.audiences;
|
|
3237
|
+
this.reports = new ZaloReportsService(client);
|
|
3238
|
+
this.conversions = new ZaloConversionsService(client);
|
|
3239
|
+
this.pixel = this.conversions;
|
|
3240
|
+
this.automatedRules = new ZaloAutomatedRulesService(client);
|
|
3241
|
+
this.rules = this.automatedRules;
|
|
3242
|
+
this.flows = new ZaloFlowsService(client);
|
|
3243
|
+
this.media = new ZaloMediaService(client);
|
|
3244
|
+
this.campaigns = this;
|
|
3245
|
+
}
|
|
3246
|
+
// =========================================================================
|
|
3247
|
+
// Delegations -> this.account
|
|
3248
|
+
// =========================================================================
|
|
3249
|
+
getApiWhoami(request = {}, options) {
|
|
3250
|
+
return this.account.getApiWhoami(request, options);
|
|
2216
3251
|
}
|
|
2217
|
-
|
|
2218
|
-
return this.
|
|
3252
|
+
getApiPaymentTransactionHistory(request, options) {
|
|
3253
|
+
return this.account.getApiPaymentTransactionHistory(request, options);
|
|
2219
3254
|
}
|
|
2220
|
-
|
|
2221
|
-
return this.
|
|
3255
|
+
getApiBaAccountAllaccessors(request = {}, options) {
|
|
3256
|
+
return this.account.getApiBaAccountAllaccessors(request, options);
|
|
2222
3257
|
}
|
|
2223
|
-
|
|
2224
|
-
return this.
|
|
3258
|
+
getApiBaAccountAllgrantedmembers(request = {}, options) {
|
|
3259
|
+
return this.account.getApiBaAccountAllgrantedmembers(request, options);
|
|
2225
3260
|
}
|
|
2226
|
-
|
|
2227
|
-
return this.
|
|
3261
|
+
listAgencyCustomersWithBudget(request = { limit: 15, offset: 0, joinDateAsc: true }, options) {
|
|
3262
|
+
return this.account.listAgencyCustomersWithBudget(request, options);
|
|
2228
3263
|
}
|
|
2229
|
-
|
|
2230
|
-
return this.
|
|
3264
|
+
getApiNotifiesHeader(request = {}, options) {
|
|
3265
|
+
return this.account.getApiNotifiesHeader(request, options);
|
|
2231
3266
|
}
|
|
2232
|
-
|
|
2233
|
-
return this.
|
|
3267
|
+
getApiLpNews(request = {}, options) {
|
|
3268
|
+
return this.account.getApiLpNews(request, options);
|
|
3269
|
+
}
|
|
3270
|
+
// =========================================================================
|
|
3271
|
+
// Delegations -> this.audiences
|
|
3272
|
+
// =========================================================================
|
|
3273
|
+
postApiAdEstimateaudience(request, options) {
|
|
3274
|
+
return this.audiences.postApiAdEstimateaudience(request, options);
|
|
2234
3275
|
}
|
|
2235
3276
|
getApiAdGetlistadadvancetargeting(request = {}, options) {
|
|
2236
|
-
return this.
|
|
3277
|
+
return this.audiences.getApiAdGetlistadadvancetargeting(request, options);
|
|
2237
3278
|
}
|
|
2238
|
-
|
|
2239
|
-
return this.
|
|
3279
|
+
getApiCustomAudienceAll(request = {}, options) {
|
|
3280
|
+
return this.audiences.getApiCustomAudienceAll(request, options);
|
|
2240
3281
|
}
|
|
2241
|
-
|
|
2242
|
-
return this.
|
|
3282
|
+
createCustomAudience(request, options) {
|
|
3283
|
+
return this.audiences.createCustomAudience(request, options);
|
|
2243
3284
|
}
|
|
2244
|
-
|
|
2245
|
-
return this.
|
|
3285
|
+
deleteCustomAudience(request, options) {
|
|
3286
|
+
return this.audiences.deleteCustomAudience(request, options);
|
|
2246
3287
|
}
|
|
2247
|
-
|
|
2248
|
-
return this.
|
|
3288
|
+
uploadCustomAudiencePhoneList(request, options) {
|
|
3289
|
+
return this.audiences.uploadCustomAudiencePhoneList(request, options);
|
|
2249
3290
|
}
|
|
2250
|
-
|
|
2251
|
-
|
|
3291
|
+
/** Tạo mới 'Nhóm đối tượng đã lưu' (`caType = 1` - `DEFAULT`) trên Zalo Ads (`POST /api/ad/audience`). */
|
|
3292
|
+
createSavedAudience(request, options) {
|
|
3293
|
+
return this.audiences.createSavedAudience(request, options);
|
|
2252
3294
|
}
|
|
2253
|
-
|
|
2254
|
-
|
|
3295
|
+
/** Tạo mới Nhóm đối tượng từ danh sách Số điện thoại (`caType = 3` - `PHONE_LIST`). */
|
|
3296
|
+
createPhoneAudience(request, options) {
|
|
3297
|
+
return this.audiences.createPhoneAudience(request, options);
|
|
2255
3298
|
}
|
|
2256
|
-
|
|
2257
|
-
|
|
3299
|
+
/** Tạo mới Nhóm đối tượng tương tự Lookalike (`caType = 6` - `LOOKALIKE`). */
|
|
3300
|
+
createLookalikeAudience(request, options) {
|
|
3301
|
+
return this.audiences.createLookalikeAudience(request, options);
|
|
2258
3302
|
}
|
|
2259
|
-
|
|
2260
|
-
|
|
3303
|
+
/** Tạo mới Nhóm đối tượng phát sinh sự kiện trên Zalo Form (`caType = 12` - `FORM_EVENT_AUDIENCE`). */
|
|
3304
|
+
createFormEventAudience(request, options) {
|
|
3305
|
+
return this.audiences.createFormEventAudience(request, options);
|
|
2261
3306
|
}
|
|
2262
|
-
|
|
2263
|
-
|
|
3307
|
+
/** Tạo mới Nhóm đối tượng phát sinh sự kiện trên Kịch bản Tin nhắn OA (`caType = 11` - `MESSAGE_AUDIENCE`). */
|
|
3308
|
+
createMessageOaEventAudience(request, options) {
|
|
3309
|
+
return this.audiences.createMessageOaEventAudience(request, options);
|
|
2264
3310
|
}
|
|
2265
|
-
|
|
2266
|
-
|
|
3311
|
+
/** Tạo mới Nhóm đối tượng phát sinh sự kiện trên Kịch bản Tin nhắn cá nhân (`caType = 14` - `MESSAGE_PERSONAL_EVENT_AUDIENCE`). */
|
|
3312
|
+
createMessagePersonalEventAudience(request, options) {
|
|
3313
|
+
return this.audiences.createMessagePersonalEventAudience(request, options);
|
|
2267
3314
|
}
|
|
2268
|
-
|
|
2269
|
-
|
|
3315
|
+
/** Tạo mới Nhóm đối tượng từ Trung tâm Lead - Zalo Form (`caType = 10` - `FORM_AUDIENCE`). */
|
|
3316
|
+
createFormLeadAudience(request, options) {
|
|
3317
|
+
return this.audiences.createFormLeadAudience(request, options);
|
|
2270
3318
|
}
|
|
2271
|
-
|
|
2272
|
-
|
|
3319
|
+
/** Tạo mới Nhóm đối tượng từ Trung tâm Lead - Commerce Form (`caType = 15` - `COMMERCE_FORM_AUDIENCE`). */
|
|
3320
|
+
createCommerceFormAudience(request, options) {
|
|
3321
|
+
return this.audiences.createCommerceFormAudience(request, options);
|
|
2273
3322
|
}
|
|
2274
|
-
|
|
2275
|
-
|
|
3323
|
+
/** Tạo mới Nhóm đối tượng từ Trung tâm Lead - Kịch bản Tin nhắn OA (`caType = 13` - `MESSAGE_OA_AUDIENCE`). */
|
|
3324
|
+
createMessageOaLeadAudience(request, options) {
|
|
3325
|
+
return this.audiences.createMessageOaLeadAudience(request, options);
|
|
2276
3326
|
}
|
|
2277
|
-
|
|
2278
|
-
|
|
3327
|
+
/** Tạo mới Nhóm đối tượng từ Dữ liệu chuyển đổi Lead Signal (`caType = 16` - `LEAD_SIGNAL_AUDIENCE`). */
|
|
3328
|
+
createLeadSignalAudience(request, options) {
|
|
3329
|
+
return this.audiences.createLeadSignalAudience(request, options);
|
|
2279
3330
|
}
|
|
3331
|
+
// =========================================================================
|
|
3332
|
+
// Delegations -> this.reports
|
|
3333
|
+
// =========================================================================
|
|
2280
3334
|
getReportapiV2Ads(request, options) {
|
|
2281
|
-
return this.
|
|
3335
|
+
return this.reports.getReportapiV2Ads(request, options);
|
|
2282
3336
|
}
|
|
2283
3337
|
getReportapiV2Campaigns(request = {}, options) {
|
|
2284
|
-
return this.
|
|
3338
|
+
return this.reports.getReportapiV2Campaigns(request, options);
|
|
2285
3339
|
}
|
|
2286
|
-
getReportapiV2UniqueUser(request
|
|
2287
|
-
return this.
|
|
3340
|
+
getReportapiV2UniqueUser(request, options) {
|
|
3341
|
+
return this.reports.getReportapiV2UniqueUser(request, options);
|
|
2288
3342
|
}
|
|
2289
3343
|
getReportapiV3Campaigns(request, options) {
|
|
2290
|
-
|
|
2291
|
-
filter: "[]",
|
|
2292
|
-
agencyId: 0,
|
|
2293
|
-
...request
|
|
2294
|
-
};
|
|
2295
|
-
return this.client.requestWithoutBody(OP_ZaloAdsGetReportapiV3Campaigns, this.client.toTransportInput(OP_ZaloAdsGetReportapiV3Campaigns, normalized), options);
|
|
3344
|
+
return this.reports.getReportapiV3Campaigns(request, options);
|
|
2296
3345
|
}
|
|
2297
|
-
|
|
2298
|
-
return this.
|
|
3346
|
+
getReportOverview(request, options) {
|
|
3347
|
+
return this.reports.getReportOverview(request, options);
|
|
2299
3348
|
}
|
|
2300
|
-
|
|
2301
|
-
return this.
|
|
3349
|
+
getDemographicsReport(request, options) {
|
|
3350
|
+
return this.reports.getDemographicsReport(request, options);
|
|
2302
3351
|
}
|
|
2303
|
-
|
|
2304
|
-
return this.
|
|
3352
|
+
getZaapiCampaignReportcampaign(request, options) {
|
|
3353
|
+
return this.reports.getZaapiCampaignReportcampaign(request, options);
|
|
2305
3354
|
}
|
|
2306
|
-
|
|
2307
|
-
return this.
|
|
3355
|
+
listCustomReports(request = {}, options) {
|
|
3356
|
+
return this.reports.listCustomReports(request, options);
|
|
2308
3357
|
}
|
|
2309
|
-
|
|
2310
|
-
return this.
|
|
3358
|
+
upsertCustomReport(request, options) {
|
|
3359
|
+
return this.reports.upsertCustomReport(request, options);
|
|
2311
3360
|
}
|
|
2312
|
-
|
|
2313
|
-
return this.
|
|
3361
|
+
deleteCustomReport(request, options) {
|
|
3362
|
+
return this.reports.deleteCustomReport(request, options);
|
|
2314
3363
|
}
|
|
2315
|
-
|
|
2316
|
-
return this.
|
|
3364
|
+
listReportFilters(request, options) {
|
|
3365
|
+
return this.reports.listReportFilters(request, options);
|
|
2317
3366
|
}
|
|
2318
|
-
|
|
2319
|
-
|
|
3367
|
+
// =========================================================================
|
|
3368
|
+
// Delegations -> this.conversions
|
|
3369
|
+
// =========================================================================
|
|
3370
|
+
createConversion(request, options) {
|
|
3371
|
+
return this.conversions.createConversion(request, options);
|
|
2320
3372
|
}
|
|
2321
|
-
|
|
2322
|
-
return this.
|
|
3373
|
+
deleteConversion(request, options) {
|
|
3374
|
+
return this.conversions.deleteConversion(request, options);
|
|
2323
3375
|
}
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
limit: 15,
|
|
2327
|
-
offset: 0,
|
|
2328
|
-
joinDateAsc: true,
|
|
2329
|
-
...request
|
|
2330
|
-
};
|
|
2331
|
-
return this.client.requestWithoutBody(OP_ZaloAdsListAgencyCustomersWithBudget, this.client.toTransportInput(OP_ZaloAdsListAgencyCustomersWithBudget, normalized), options);
|
|
3376
|
+
getApiConversionAll(request = {}, options) {
|
|
3377
|
+
return this.conversions.getApiConversionAll(request, options);
|
|
2332
3378
|
}
|
|
2333
|
-
|
|
2334
|
-
return this.
|
|
3379
|
+
getApiConversionStandardEvents(request = {}, options) {
|
|
3380
|
+
return this.conversions.getApiConversionStandardEvents(request, options);
|
|
2335
3381
|
}
|
|
2336
|
-
|
|
2337
|
-
return this.
|
|
3382
|
+
listPersonalPixelLabels(request = {}, options) {
|
|
3383
|
+
return this.conversions.listPersonalPixelLabels(request, options);
|
|
2338
3384
|
}
|
|
2339
|
-
|
|
2340
|
-
|
|
3385
|
+
/** Lấy danh sách tài khoản Zalo Official Account (OA) có dữ liệu chuyển đổi (Lead Signal) (`GET /api/ad/audience/leadSignal/oas`). */
|
|
3386
|
+
listLeadSignalOas(options) {
|
|
3387
|
+
return this.conversions.listLeadSignalOas(options);
|
|
2341
3388
|
}
|
|
2342
|
-
|
|
2343
|
-
|
|
3389
|
+
/** Lấy danh sách rút gọn gồm ID và tên của toàn bộ các sự kiện chuyển đổi (Conversion) đã tạo trên tài khoản quảng cáo Zalo Ads (`GET /api/conversion/names`). */
|
|
3390
|
+
listConversionNames(request = {}, options) {
|
|
3391
|
+
return this.conversions.listConversionNames(request, options);
|
|
2344
3392
|
}
|
|
2345
|
-
|
|
2346
|
-
|
|
3393
|
+
/** Alias cho `listConversionNames` (`GET /api/conversion/names`). */
|
|
3394
|
+
getApiConversionNames(request = {}, options) {
|
|
3395
|
+
return this.conversions.getApiConversionNames(request, options);
|
|
2347
3396
|
}
|
|
2348
|
-
|
|
2349
|
-
|
|
3397
|
+
// =========================================================================
|
|
3398
|
+
// Delegations -> this.automatedRules
|
|
3399
|
+
// =========================================================================
|
|
3400
|
+
listAutomatedRules(request = {}, options) {
|
|
3401
|
+
return this.automatedRules.listAutomatedRules(request, options);
|
|
2350
3402
|
}
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
...request,
|
|
2354
|
-
File: request.File ?? request.file
|
|
2355
|
-
};
|
|
2356
|
-
return this.client.requestMultipart(OP_ZaloAdsPostApiMemberUploadImage, this.client.toTransportInput(OP_ZaloAdsPostApiMemberUploadImage, normalized), options);
|
|
3403
|
+
createAutomatedRule(request, options) {
|
|
3404
|
+
return this.automatedRules.createAutomatedRule(request, options);
|
|
2357
3405
|
}
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
return this.postApiMemberUploadImage(request, options);
|
|
3406
|
+
updateAutomatedRule(request, options) {
|
|
3407
|
+
return this.automatedRules.updateAutomatedRule(request, options);
|
|
2361
3408
|
}
|
|
2362
|
-
|
|
2363
|
-
return this.
|
|
3409
|
+
changeAutomatedRuleStatus(request, options) {
|
|
3410
|
+
return this.automatedRules.changeAutomatedRuleStatus(request, options);
|
|
2364
3411
|
}
|
|
2365
|
-
|
|
2366
|
-
return this.
|
|
3412
|
+
getAutomatedRuleHistory(request, options) {
|
|
3413
|
+
return this.automatedRules.getAutomatedRuleHistory(request, options);
|
|
2367
3414
|
}
|
|
2368
|
-
|
|
2369
|
-
return this.
|
|
3415
|
+
deleteAutomatedRule(request, options) {
|
|
3416
|
+
return this.automatedRules.deleteAutomatedRule(request, options);
|
|
2370
3417
|
}
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
3418
|
+
// =========================================================================
|
|
3419
|
+
// Delegations -> this.flows
|
|
3420
|
+
// =========================================================================
|
|
3421
|
+
listFlowsByOfficialAccount(request, options) {
|
|
3422
|
+
return this.flows.listFlowsByOfficialAccount(request, options);
|
|
2374
3423
|
}
|
|
2375
|
-
|
|
2376
|
-
return this.
|
|
3424
|
+
createFlow(request, options) {
|
|
3425
|
+
return this.flows.createFlow(request, options);
|
|
2377
3426
|
}
|
|
2378
|
-
|
|
2379
|
-
return this.
|
|
3427
|
+
updateFlow(request, options) {
|
|
3428
|
+
return this.flows.updateFlow(request, options);
|
|
2380
3429
|
}
|
|
2381
|
-
|
|
2382
|
-
|
|
3430
|
+
// =========================================================================
|
|
3431
|
+
// Delegations -> this.media
|
|
3432
|
+
// =========================================================================
|
|
3433
|
+
getApiFilegroups(request = {}, options) {
|
|
3434
|
+
return this.media.getApiFilegroups(request, options);
|
|
2383
3435
|
}
|
|
2384
|
-
|
|
2385
|
-
return this.
|
|
3436
|
+
getApiMediaItems(request, options) {
|
|
3437
|
+
return this.media.getApiMediaItems(request, options);
|
|
2386
3438
|
}
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
return this.updateOfficialAccountAd(request, options);
|
|
3439
|
+
getApiMemberFiles(request = {}, options) {
|
|
3440
|
+
return this.media.getApiMemberFiles(request, options);
|
|
2390
3441
|
}
|
|
2391
|
-
|
|
2392
|
-
return this.
|
|
3442
|
+
postApiMediaSave(request, options) {
|
|
3443
|
+
return this.media.postApiMediaSave(request, options);
|
|
2393
3444
|
}
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
return this.updatePostAd(request, options);
|
|
3445
|
+
postApiMemberUploadImage(request, options) {
|
|
3446
|
+
return this.media.postApiMemberUploadImage(request, options);
|
|
2397
3447
|
}
|
|
2398
|
-
|
|
2399
|
-
|
|
3448
|
+
/** Alias tiện lợi cho `postApiMemberUploadImage` (`POST /api/member/upload-image`). */
|
|
3449
|
+
uploadImage(request, options) {
|
|
3450
|
+
return this.media.uploadImage(request, options);
|
|
2400
3451
|
}
|
|
2401
3452
|
uploadVideo(request, options) {
|
|
2402
|
-
return this.
|
|
3453
|
+
return this.media.uploadVideo(request, options);
|
|
2403
3454
|
}
|
|
2404
|
-
|
|
2405
|
-
|
|
3455
|
+
/**
|
|
3456
|
+
* Kiểm tra tính hợp lệ của tệp Ảnh theo quy chuẩn Zalo Ads (độc lập cho backend).
|
|
3457
|
+
* Tiêu chí: Có file, Dung lượng tối đa 2MB, Kích thước tối thiểu 150x150, Định dạng JPG/PNG.
|
|
3458
|
+
*/
|
|
3459
|
+
validateImage(input) {
|
|
3460
|
+
return this.media.validateImage(input);
|
|
3461
|
+
}
|
|
3462
|
+
/**
|
|
3463
|
+
* Kiểm tra tính hợp lệ của tệp Video theo quy chuẩn Zalo Ads (độc lập cho backend).
|
|
3464
|
+
* Tiêu chí: Có file, Định dạng .MP4 H.264, Dung lượng tối đa 150MB, Thời lượng tối đa 60s, Tỉ lệ 16:9, 9:16 hoặc 1:1.
|
|
3465
|
+
*/
|
|
3466
|
+
validateVideo(input) {
|
|
3467
|
+
return this.media.validateVideo(input);
|
|
2406
3468
|
}
|
|
2407
3469
|
};
|
|
2408
3470
|
|
|
@@ -2572,6 +3634,20 @@ var OP_ZaloFormsListSimpleFormsByOfficialAccount = {
|
|
|
2572
3634
|
"cookieFields": [],
|
|
2573
3635
|
"bodyFields": []
|
|
2574
3636
|
};
|
|
3637
|
+
var OP_ZaloFormsListScenariosByOfficialAccount = {
|
|
3638
|
+
"operationId": "ZaloForms_listScenariosByOfficialAccount",
|
|
3639
|
+
"method": "GET",
|
|
3640
|
+
"endpoint": "/client/manage/api/manageConversation/getScenariosByOaId",
|
|
3641
|
+
"baseUrl": "https://form.ads.zalo.me",
|
|
3642
|
+
"binaryFields": [],
|
|
3643
|
+
"pathFields": [],
|
|
3644
|
+
"queryFields": [
|
|
3645
|
+
"oaId"
|
|
3646
|
+
],
|
|
3647
|
+
"headerFields": [],
|
|
3648
|
+
"cookieFields": [],
|
|
3649
|
+
"bodyFields": []
|
|
3650
|
+
};
|
|
2575
3651
|
var OP_ZaloFormsUpdateFormLeadNotificationInterval = {
|
|
2576
3652
|
"operationId": "ZaloForms_updateFormLeadNotificationInterval",
|
|
2577
3653
|
"method": "POST",
|
|
@@ -2631,11 +3707,403 @@ var ZaloFormsService = class {
|
|
|
2631
3707
|
listSimpleFormsByOfficialAccount(request, options) {
|
|
2632
3708
|
return this.client.requestWithoutBody(OP_ZaloFormsListSimpleFormsByOfficialAccount, this.client.toTransportInput(OP_ZaloFormsListSimpleFormsByOfficialAccount, request), options);
|
|
2633
3709
|
}
|
|
3710
|
+
listScenariosByOfficialAccount(request, options) {
|
|
3711
|
+
return this.client.requestWithoutBody(OP_ZaloFormsListScenariosByOfficialAccount, this.client.toTransportInput(OP_ZaloFormsListScenariosByOfficialAccount, request), options);
|
|
3712
|
+
}
|
|
2634
3713
|
updateFormLeadNotificationInterval(request, options) {
|
|
2635
3714
|
return this.client.requestJson(OP_ZaloFormsUpdateFormLeadNotificationInterval, this.client.toTransportInput(OP_ZaloFormsUpdateFormLeadNotificationInterval, request), options);
|
|
2636
3715
|
}
|
|
2637
3716
|
};
|
|
2638
3717
|
|
|
3718
|
+
// src/validators/instant-pages.validator.ts
|
|
3719
|
+
function isPositiveInteger(val) {
|
|
3720
|
+
if (typeof val === "number") return Number.isInteger(val) && val > 0;
|
|
3721
|
+
if (typeof val === "string" && val.trim() !== "") {
|
|
3722
|
+
const num = Number(val);
|
|
3723
|
+
return Number.isInteger(num) && num > 0;
|
|
3724
|
+
}
|
|
3725
|
+
return false;
|
|
3726
|
+
}
|
|
3727
|
+
function toPositiveInteger(val) {
|
|
3728
|
+
return typeof val === "number" ? Math.floor(val) : parseInt(String(val), 10);
|
|
3729
|
+
}
|
|
3730
|
+
function validateCloneInstantPageRequest(input) {
|
|
3731
|
+
const errors = [];
|
|
3732
|
+
if (!input || typeof input !== "object") {
|
|
3733
|
+
return { isValid: false, errors: ["D\u1EEF li\u1EC7u y\xEAu c\u1EA7u sao ch\xE9p Instant Page ph\u1EA3i l\xE0 m\u1ED9t \u0111\u1ED1i t\u01B0\u1EE3ng (object)."] };
|
|
3734
|
+
}
|
|
3735
|
+
const obj = input;
|
|
3736
|
+
if (!isPositiveInteger(obj.instantPageId)) {
|
|
3737
|
+
errors.push("Tr\u01B0\u1EDDng 'instantPageId' l\xE0 b\u1EAFt bu\u1ED9c v\xE0 ph\u1EA3i l\xE0 s\u1ED1 nguy\xEAn d\u01B0\u01A1ng (> 0).");
|
|
3738
|
+
}
|
|
3739
|
+
return {
|
|
3740
|
+
isValid: errors.length === 0,
|
|
3741
|
+
errors,
|
|
3742
|
+
data: errors.length === 0 ? { instantPageId: toPositiveInteger(obj.instantPageId) } : void 0
|
|
3743
|
+
};
|
|
3744
|
+
}
|
|
3745
|
+
function validateGetInstantPageDetailRequest(input) {
|
|
3746
|
+
const errors = [];
|
|
3747
|
+
if (!input || typeof input !== "object") {
|
|
3748
|
+
return { isValid: false, errors: ["D\u1EEF li\u1EC7u y\xEAu c\u1EA7u l\u1EA5y chi ti\u1EBFt Instant Page ph\u1EA3i l\xE0 m\u1ED9t \u0111\u1ED1i t\u01B0\u1EE3ng (object)."] };
|
|
3749
|
+
}
|
|
3750
|
+
const obj = input;
|
|
3751
|
+
if (!isPositiveInteger(obj.instantPageId)) {
|
|
3752
|
+
errors.push("Tr\u01B0\u1EDDng 'instantPageId' l\xE0 b\u1EAFt bu\u1ED9c v\xE0 ph\u1EA3i l\xE0 s\u1ED1 nguy\xEAn d\u01B0\u01A1ng (> 0).");
|
|
3753
|
+
}
|
|
3754
|
+
return {
|
|
3755
|
+
isValid: errors.length === 0,
|
|
3756
|
+
errors,
|
|
3757
|
+
data: errors.length === 0 ? { instantPageId: toPositiveInteger(obj.instantPageId) } : void 0
|
|
3758
|
+
};
|
|
3759
|
+
}
|
|
3760
|
+
function validateGetInstantPageSharedUserRequest(input) {
|
|
3761
|
+
const errors = [];
|
|
3762
|
+
if (!input || typeof input !== "object") {
|
|
3763
|
+
return { isValid: false, errors: ["D\u1EEF li\u1EC7u y\xEAu c\u1EA7u l\u1EA5y th\xF4ng tin ng\u01B0\u1EDDi d\xF9ng chia s\u1EBB ph\u1EA3i l\xE0 m\u1ED9t \u0111\u1ED1i t\u01B0\u1EE3ng (object)."] };
|
|
3764
|
+
}
|
|
3765
|
+
const obj = input;
|
|
3766
|
+
if (!isPositiveInteger(obj.instantPageId)) {
|
|
3767
|
+
errors.push("Tr\u01B0\u1EDDng 'instantPageId' l\xE0 b\u1EAFt bu\u1ED9c v\xE0 ph\u1EA3i l\xE0 s\u1ED1 nguy\xEAn d\u01B0\u01A1ng (> 0).");
|
|
3768
|
+
}
|
|
3769
|
+
if (!isPositiveInteger(obj.userId)) {
|
|
3770
|
+
errors.push("Tr\u01B0\u1EDDng 'userId' l\xE0 b\u1EAFt bu\u1ED9c v\xE0 ph\u1EA3i l\xE0 s\u1ED1 nguy\xEAn d\u01B0\u01A1ng (> 0).");
|
|
3771
|
+
}
|
|
3772
|
+
return {
|
|
3773
|
+
isValid: errors.length === 0,
|
|
3774
|
+
errors,
|
|
3775
|
+
data: errors.length === 0 ? {
|
|
3776
|
+
instantPageId: toPositiveInteger(obj.instantPageId),
|
|
3777
|
+
userId: toPositiveInteger(obj.userId)
|
|
3778
|
+
} : void 0
|
|
3779
|
+
};
|
|
3780
|
+
}
|
|
3781
|
+
function validateListInstantPageEditHistoryRequest(input) {
|
|
3782
|
+
const errors = [];
|
|
3783
|
+
if (!input || typeof input !== "object") {
|
|
3784
|
+
return { isValid: false, errors: ["D\u1EEF li\u1EC7u y\xEAu c\u1EA7u l\u1EA5y l\u1ECBch s\u1EED ch\u1EC9nh s\u1EEDa ph\u1EA3i l\xE0 m\u1ED9t \u0111\u1ED1i t\u01B0\u1EE3ng (object)."] };
|
|
3785
|
+
}
|
|
3786
|
+
const obj = input;
|
|
3787
|
+
if (!isPositiveInteger(obj.instantPageId)) {
|
|
3788
|
+
errors.push("Tr\u01B0\u1EDDng 'instantPageId' l\xE0 b\u1EAFt bu\u1ED9c v\xE0 ph\u1EA3i l\xE0 s\u1ED1 nguy\xEAn d\u01B0\u01A1ng (> 0).");
|
|
3789
|
+
}
|
|
3790
|
+
let limit = void 0;
|
|
3791
|
+
if (obj.limit !== void 0 && obj.limit !== null) {
|
|
3792
|
+
if (!isPositiveInteger(obj.limit)) {
|
|
3793
|
+
errors.push("Tr\u01B0\u1EDDng 'limit' n\u1EBFu c\xF3 ph\u1EA3i l\xE0 s\u1ED1 nguy\xEAn >= 1.");
|
|
3794
|
+
} else {
|
|
3795
|
+
limit = toPositiveInteger(obj.limit);
|
|
3796
|
+
}
|
|
3797
|
+
}
|
|
3798
|
+
let offset = void 0;
|
|
3799
|
+
if (obj.offset !== void 0 && obj.offset !== null) {
|
|
3800
|
+
const num = Number(obj.offset);
|
|
3801
|
+
if (!Number.isInteger(num) || num < 0) {
|
|
3802
|
+
errors.push("Tr\u01B0\u1EDDng 'offset' n\u1EBFu c\xF3 ph\u1EA3i l\xE0 s\u1ED1 nguy\xEAn >= 0.");
|
|
3803
|
+
} else {
|
|
3804
|
+
offset = num;
|
|
3805
|
+
}
|
|
3806
|
+
}
|
|
3807
|
+
return {
|
|
3808
|
+
isValid: errors.length === 0,
|
|
3809
|
+
errors,
|
|
3810
|
+
data: errors.length === 0 ? {
|
|
3811
|
+
instantPageId: toPositiveInteger(obj.instantPageId),
|
|
3812
|
+
...limit !== void 0 ? { limit } : {},
|
|
3813
|
+
...offset !== void 0 ? { offset } : {}
|
|
3814
|
+
} : void 0
|
|
3815
|
+
};
|
|
3816
|
+
}
|
|
3817
|
+
function validateListInstantPageFormRecordsRequest(input) {
|
|
3818
|
+
const errors = [];
|
|
3819
|
+
if (!input || typeof input !== "object") {
|
|
3820
|
+
return { isValid: false, errors: ["D\u1EEF li\u1EC7u y\xEAu c\u1EA7u t\u1EA3i b\u1EA3n ghi form ph\u1EA3i l\xE0 m\u1ED9t \u0111\u1ED1i t\u01B0\u1EE3ng (object)."] };
|
|
3821
|
+
}
|
|
3822
|
+
const obj = input;
|
|
3823
|
+
if (!isPositiveInteger(obj.instantPageId)) {
|
|
3824
|
+
errors.push("Tr\u01B0\u1EDDng 'instantPageId' l\xE0 b\u1EAFt bu\u1ED9c v\xE0 ph\u1EA3i l\xE0 s\u1ED1 nguy\xEAn d\u01B0\u01A1ng (> 0).");
|
|
3825
|
+
}
|
|
3826
|
+
return {
|
|
3827
|
+
isValid: errors.length === 0,
|
|
3828
|
+
errors,
|
|
3829
|
+
data: errors.length === 0 ? { instantPageId: toPositiveInteger(obj.instantPageId) } : void 0
|
|
3830
|
+
};
|
|
3831
|
+
}
|
|
3832
|
+
function validateListInstantPageSharesRequest(input) {
|
|
3833
|
+
const errors = [];
|
|
3834
|
+
if (!input || typeof input !== "object") {
|
|
3835
|
+
return { isValid: false, errors: ["D\u1EEF li\u1EC7u y\xEAu c\u1EA7u l\u1EA5y danh s\xE1ch ng\u01B0\u1EDDi \u0111\u01B0\u1EE3c chia s\u1EBB ph\u1EA3i l\xE0 m\u1ED9t \u0111\u1ED1i t\u01B0\u1EE3ng (object)."] };
|
|
3836
|
+
}
|
|
3837
|
+
const obj = input;
|
|
3838
|
+
if (!isPositiveInteger(obj.instantPageId)) {
|
|
3839
|
+
errors.push("Tr\u01B0\u1EDDng 'instantPageId' l\xE0 b\u1EAFt bu\u1ED9c v\xE0 ph\u1EA3i l\xE0 s\u1ED1 nguy\xEAn d\u01B0\u01A1ng (> 0).");
|
|
3840
|
+
}
|
|
3841
|
+
return {
|
|
3842
|
+
isValid: errors.length === 0,
|
|
3843
|
+
errors,
|
|
3844
|
+
data: errors.length === 0 ? { instantPageId: toPositiveInteger(obj.instantPageId) } : void 0
|
|
3845
|
+
};
|
|
3846
|
+
}
|
|
3847
|
+
function validateListInstantPageUsersRequest(input) {
|
|
3848
|
+
if (input !== void 0 && input !== null && typeof input !== "object") {
|
|
3849
|
+
return { isValid: false, errors: ["D\u1EEF li\u1EC7u y\xEAu c\u1EA7u l\u1EA5y danh s\xE1ch ng\u01B0\u1EDDi d\xF9ng ph\u1EA3i l\xE0 m\u1ED9t \u0111\u1ED1i t\u01B0\u1EE3ng ho\u1EB7c \u0111\u1EC3 tr\u1ED1ng."] };
|
|
3850
|
+
}
|
|
3851
|
+
return { isValid: true, errors: [], data: {} };
|
|
3852
|
+
}
|
|
3853
|
+
function validateListMiniPageTemplatesRequest(input) {
|
|
3854
|
+
if (input !== void 0 && input !== null && typeof input !== "object") {
|
|
3855
|
+
return { isValid: false, errors: ["D\u1EEF li\u1EC7u y\xEAu c\u1EA7u l\u1EA5y m\u1EABu giao di\u1EC7n ph\u1EA3i l\xE0 m\u1ED9t \u0111\u1ED1i t\u01B0\u1EE3ng ho\u1EB7c \u0111\u1EC3 tr\u1ED1ng."] };
|
|
3856
|
+
}
|
|
3857
|
+
return { isValid: true, errors: [], data: {} };
|
|
3858
|
+
}
|
|
3859
|
+
function validateSearchInstantPagesRequest(input) {
|
|
3860
|
+
const errors = [];
|
|
3861
|
+
if (input === void 0 || input === null) {
|
|
3862
|
+
return { isValid: true, errors: [], data: {} };
|
|
3863
|
+
}
|
|
3864
|
+
if (typeof input !== "object") {
|
|
3865
|
+
return { isValid: false, errors: ["D\u1EEF li\u1EC7u t\xECm ki\u1EBFm Instant Page ph\u1EA3i l\xE0 m\u1ED9t \u0111\u1ED1i t\u01B0\u1EE3ng."] };
|
|
3866
|
+
}
|
|
3867
|
+
const obj = input;
|
|
3868
|
+
const data = {};
|
|
3869
|
+
if (obj.id !== void 0 && obj.id !== null && obj.id !== "") {
|
|
3870
|
+
if (!isPositiveInteger(obj.id)) {
|
|
3871
|
+
errors.push("B\u1ED9 l\u1ECDc 'id' n\u1EBFu c\xF3 ph\u1EA3i l\xE0 s\u1ED1 nguy\xEAn d\u01B0\u01A1ng (> 0).");
|
|
3872
|
+
} else {
|
|
3873
|
+
data.id = toPositiveInteger(obj.id);
|
|
3874
|
+
}
|
|
3875
|
+
}
|
|
3876
|
+
if (obj.name !== void 0 && obj.name !== null) {
|
|
3877
|
+
if (typeof obj.name !== "string") {
|
|
3878
|
+
errors.push("B\u1ED9 l\u1ECDc 'name' n\u1EBFu c\xF3 ph\u1EA3i l\xE0 chu\u1ED7i k\xFD t\u1EF1.");
|
|
3879
|
+
} else {
|
|
3880
|
+
data.name = obj.name;
|
|
3881
|
+
}
|
|
3882
|
+
}
|
|
3883
|
+
if (obj.group !== void 0 && obj.group !== null && obj.group !== "") {
|
|
3884
|
+
const grp = Number(obj.group);
|
|
3885
|
+
if (grp !== 1 && grp !== 2) {
|
|
3886
|
+
errors.push("B\u1ED9 l\u1ECDc 'group' ch\u1EC9 nh\u1EADn gi\xE1 tr\u1ECB 1 (Trang s\u1EA3n ph\u1EA9m) ho\u1EB7c 2 (K\u1ECBch b\u1EA3n tin nh\u1EAFn).");
|
|
3887
|
+
} else {
|
|
3888
|
+
data.group = grp;
|
|
3889
|
+
}
|
|
3890
|
+
}
|
|
3891
|
+
return {
|
|
3892
|
+
isValid: errors.length === 0,
|
|
3893
|
+
errors,
|
|
3894
|
+
data: errors.length === 0 ? data : void 0
|
|
3895
|
+
};
|
|
3896
|
+
}
|
|
3897
|
+
function validateUpdateInstantPageRequest(input) {
|
|
3898
|
+
const errors = [];
|
|
3899
|
+
if (!input || typeof input !== "object") {
|
|
3900
|
+
return { isValid: false, errors: ["D\u1EEF li\u1EC7u c\u1EADp nh\u1EADt Instant Page ph\u1EA3i l\xE0 m\u1ED9t \u0111\u1ED1i t\u01B0\u1EE3ng (object)."] };
|
|
3901
|
+
}
|
|
3902
|
+
const obj = input;
|
|
3903
|
+
const instantPageId = obj.instantPageId ?? obj.id;
|
|
3904
|
+
if (!isPositiveInteger(instantPageId)) {
|
|
3905
|
+
errors.push("Tr\u01B0\u1EDDng 'instantPageId' (ho\u1EB7c 'id') l\xE0 b\u1EAFt bu\u1ED9c v\xE0 ph\u1EA3i l\xE0 s\u1ED1 nguy\xEAn d\u01B0\u01A1ng (> 0).");
|
|
3906
|
+
}
|
|
3907
|
+
const numericId = toPositiveInteger(instantPageId);
|
|
3908
|
+
const data = {
|
|
3909
|
+
instantPageId: numericId,
|
|
3910
|
+
id: numericId
|
|
3911
|
+
};
|
|
3912
|
+
if (obj.name !== void 0 && obj.name !== null) {
|
|
3913
|
+
if (typeof obj.name !== "string") {
|
|
3914
|
+
errors.push("Tr\u01B0\u1EDDng 'name' ph\u1EA3i l\xE0 chu\u1ED7i k\xFD t\u1EF1.");
|
|
3915
|
+
} else {
|
|
3916
|
+
data.name = obj.name;
|
|
3917
|
+
}
|
|
3918
|
+
}
|
|
3919
|
+
if (obj.oaId !== void 0 && obj.oaId !== null) {
|
|
3920
|
+
if (typeof obj.oaId !== "string") {
|
|
3921
|
+
errors.push(`Tr\u01B0\u1EDDng 'oaId' ph\u1EA3i l\xE0 chu\u1ED7i k\xFD t\u1EF1 (ho\u1EB7c chu\u1ED7i r\u1ED7ng "").`);
|
|
3922
|
+
} else {
|
|
3923
|
+
data.oaId = obj.oaId;
|
|
3924
|
+
}
|
|
3925
|
+
}
|
|
3926
|
+
if (obj.active !== void 0 && obj.active !== null) {
|
|
3927
|
+
if (typeof obj.active === "boolean") {
|
|
3928
|
+
errors.push("Tr\u01B0\u1EDDng 'active' b\u1EAFt bu\u1ED9c l\xE0 s\u1ED1 nguy\xEAn 0 (T\u1EAFt) ho\u1EB7c 1 (B\u1EADt), kh\xF4ng \u0111\u01B0\u1EE3c truy\u1EC1n ki\u1EC3u boolean (true/false) v\xEC Zalo Ads API s\u1EBD tr\u1EA3 v\u1EC1 l\u1ED7i HTTP 400.");
|
|
3929
|
+
} else if (obj.active !== 0 && obj.active !== 1) {
|
|
3930
|
+
errors.push("Tr\u01B0\u1EDDng 'active' ch\u1EC9 nh\u1EADn gi\xE1 tr\u1ECB s\u1ED1 nguy\xEAn 0 (T\u1EAFt) ho\u1EB7c 1 (B\u1EADt).");
|
|
3931
|
+
} else {
|
|
3932
|
+
data.active = obj.active;
|
|
3933
|
+
}
|
|
3934
|
+
}
|
|
3935
|
+
if (obj.status !== void 0 && obj.status !== null) {
|
|
3936
|
+
const st = Number(obj.status);
|
|
3937
|
+
if (![0, 1, 2, 3].includes(st)) {
|
|
3938
|
+
errors.push("Tr\u01B0\u1EDDng 'status' ph\u1EA3i l\xE0 m\u1ED9t trong c\xE1c m\xE3: 0 (B\u1EA3n sao m\u1EDBi), 1 (B\u1EA3n nh\xE1p), 2 (\u0110\xE3 xu\u1EA5t b\u1EA3n), 3 (L\u01B0u tr\u1EEF).");
|
|
3939
|
+
} else {
|
|
3940
|
+
data.status = st;
|
|
3941
|
+
}
|
|
3942
|
+
}
|
|
3943
|
+
if (obj.draft !== void 0 && obj.draft !== null) {
|
|
3944
|
+
if (typeof obj.draft !== "string") {
|
|
3945
|
+
errors.push("Tr\u01B0\u1EDDng 'draft' ph\u1EA3i l\xE0 chu\u1ED7i JSON (JSON-encoded string).");
|
|
3946
|
+
} else if (obj.draft.trim() !== "") {
|
|
3947
|
+
try {
|
|
3948
|
+
JSON.parse(obj.draft);
|
|
3949
|
+
data.draft = obj.draft;
|
|
3950
|
+
} catch (err) {
|
|
3951
|
+
errors.push(`Tr\u01B0\u1EDDng 'draft' kh\xF4ng ph\u1EA3i l\xE0 chu\u1ED7i JSON h\u1EE3p l\u1EC7: ${err.message}`);
|
|
3952
|
+
}
|
|
3953
|
+
} else {
|
|
3954
|
+
data.draft = "";
|
|
3955
|
+
}
|
|
3956
|
+
}
|
|
3957
|
+
if (obj.content !== void 0 && obj.content !== null) {
|
|
3958
|
+
if (typeof obj.content !== "string") {
|
|
3959
|
+
errors.push("Tr\u01B0\u1EDDng 'content' ph\u1EA3i l\xE0 chu\u1ED7i JSON (JSON-encoded string).");
|
|
3960
|
+
} else if (obj.content.trim() !== "") {
|
|
3961
|
+
try {
|
|
3962
|
+
JSON.parse(obj.content);
|
|
3963
|
+
data.content = obj.content;
|
|
3964
|
+
} catch (err) {
|
|
3965
|
+
errors.push(`Tr\u01B0\u1EDDng 'content' kh\xF4ng ph\u1EA3i l\xE0 chu\u1ED7i JSON h\u1EE3p l\u1EC7: ${err.message}`);
|
|
3966
|
+
}
|
|
3967
|
+
} else {
|
|
3968
|
+
data.content = "";
|
|
3969
|
+
}
|
|
3970
|
+
}
|
|
3971
|
+
const hasUpdateField = data.name !== void 0 || data.oaId !== void 0 || data.active !== void 0 || data.status !== void 0 || data.draft !== void 0 || data.content !== void 0;
|
|
3972
|
+
if (!hasUpdateField) {
|
|
3973
|
+
errors.push("Y\xEAu c\u1EA7u c\u1EADp nh\u1EADt Instant Page ph\u1EA3i c\xF3 \xEDt nh\u1EA5t m\u1ED9t tr\u01B0\u1EDDng thay \u0111\u1ED5i: 'name', 'oaId', 'active', 'status', 'draft', ho\u1EB7c 'content'.");
|
|
3974
|
+
}
|
|
3975
|
+
return {
|
|
3976
|
+
isValid: errors.length === 0,
|
|
3977
|
+
errors,
|
|
3978
|
+
data: errors.length === 0 ? data : void 0
|
|
3979
|
+
};
|
|
3980
|
+
}
|
|
3981
|
+
function validateListInstantPageLeadsRequest(input) {
|
|
3982
|
+
const errors = [];
|
|
3983
|
+
if (!input || typeof input !== "object") {
|
|
3984
|
+
return { isValid: false, errors: ["D\u1EEF li\u1EC7u y\xEAu c\u1EA7u l\u1EA5y th\u1ED1ng k\xEA leads ph\u1EA3i l\xE0 m\u1ED9t \u0111\u1ED1i t\u01B0\u1EE3ng."] };
|
|
3985
|
+
}
|
|
3986
|
+
const obj = input;
|
|
3987
|
+
let idsString = "";
|
|
3988
|
+
if (typeof obj.ids === "string" && obj.ids.trim() !== "") {
|
|
3989
|
+
idsString = obj.ids.trim();
|
|
3990
|
+
} else if (Array.isArray(obj.ids) && obj.ids.length > 0) {
|
|
3991
|
+
idsString = obj.ids.join(",");
|
|
3992
|
+
} else {
|
|
3993
|
+
errors.push("Tr\u01B0\u1EDDng 'ids' l\xE0 b\u1EAFt bu\u1ED9c v\xE0 ph\u1EA3i l\xE0 chu\u1ED7i c\xE1c ID ph\xE2n t\xE1ch b\u1EB1ng d\u1EA5u ph\u1EA9y (v\xED d\u1EE5: '81433,76292') ho\u1EB7c m\u1EA3ng c\xE1c ID.");
|
|
3994
|
+
}
|
|
3995
|
+
if (idsString) {
|
|
3996
|
+
const idParts = idsString.split(",").map((s) => s.trim()).filter(Boolean);
|
|
3997
|
+
if (idParts.length === 0) {
|
|
3998
|
+
errors.push("Tr\u01B0\u1EDDng 'ids' kh\xF4ng ch\u1EE9a b\u1EA5t k\u1EF3 ID h\u1EE3p l\u1EC7 n\xE0o.");
|
|
3999
|
+
} else {
|
|
4000
|
+
for (const id of idParts) {
|
|
4001
|
+
if (!isPositiveInteger(id)) {
|
|
4002
|
+
errors.push(`M\xE3 trang '${id}' trong danh s\xE1ch 'ids' kh\xF4ng ph\u1EA3i l\xE0 s\u1ED1 nguy\xEAn d\u01B0\u01A1ng h\u1EE3p l\u1EC7.`);
|
|
4003
|
+
}
|
|
4004
|
+
}
|
|
4005
|
+
}
|
|
4006
|
+
}
|
|
4007
|
+
return {
|
|
4008
|
+
isValid: errors.length === 0,
|
|
4009
|
+
errors,
|
|
4010
|
+
data: errors.length === 0 ? { ids: idsString } : void 0
|
|
4011
|
+
};
|
|
4012
|
+
}
|
|
4013
|
+
function validateListOfficialAccountsRequest(input) {
|
|
4014
|
+
if (input !== void 0 && input !== null && typeof input !== "object") {
|
|
4015
|
+
return { isValid: false, errors: ["D\u1EEF li\u1EC7u y\xEAu c\u1EA7u l\u1EA5y danh s\xE1ch Official Accounts ph\u1EA3i l\xE0 m\u1ED9t \u0111\u1ED1i t\u01B0\u1EE3ng ho\u1EB7c \u0111\u1EC3 tr\u1ED1ng."] };
|
|
4016
|
+
}
|
|
4017
|
+
return { isValid: true, errors: [], data: {} };
|
|
4018
|
+
}
|
|
4019
|
+
function validateUpsertInstantPageFormRequest(input) {
|
|
4020
|
+
const errors = [];
|
|
4021
|
+
if (!input || typeof input !== "object") {
|
|
4022
|
+
return { isValid: false, errors: ["D\u1EEF li\u1EC7u c\u1EA5u h\xECnh bi\u1EC3u m\u1EABu Instant Page ph\u1EA3i l\xE0 m\u1ED9t \u0111\u1ED1i t\u01B0\u1EE3ng."] };
|
|
4023
|
+
}
|
|
4024
|
+
const obj = input;
|
|
4025
|
+
if (!isPositiveInteger(obj.instantPageId)) {
|
|
4026
|
+
errors.push("Tr\u01B0\u1EDDng 'instantPageId' l\xE0 b\u1EAFt bu\u1ED9c v\xE0 ph\u1EA3i l\xE0 s\u1ED1 nguy\xEAn d\u01B0\u01A1ng (> 0).");
|
|
4027
|
+
}
|
|
4028
|
+
if (!obj.oaId || typeof obj.oaId !== "string" || !/^\d+$/.test(obj.oaId.trim())) {
|
|
4029
|
+
errors.push("Tr\u01B0\u1EDDng 'oaId' l\xE0 b\u1EAFt bu\u1ED9c v\xE0 ph\u1EA3i l\xE0 chu\u1ED7i s\u1ED1 \u0111\u1ECBnh danh Zalo Official Account.");
|
|
4030
|
+
}
|
|
4031
|
+
if (!obj.formName || typeof obj.formName !== "string" || obj.formName.trim() === "") {
|
|
4032
|
+
errors.push("Tr\u01B0\u1EDDng 'formName' l\xE0 b\u1EAFt bu\u1ED9c v\xE0 kh\xF4ng \u0111\u01B0\u1EE3c \u0111\u1EC3 tr\u1ED1ng.");
|
|
4033
|
+
}
|
|
4034
|
+
if (!Array.isArray(obj.questions) || obj.questions.length === 0) {
|
|
4035
|
+
errors.push("Tr\u01B0\u1EDDng 'questions' l\xE0 b\u1EAFt bu\u1ED9c v\xE0 ph\u1EA3i ch\u1EE9a \xEDt nh\u1EA5t m\u1ED9t c\xE2u h\u1ECFi (minItems: 1).");
|
|
4036
|
+
} else {
|
|
4037
|
+
obj.questions.forEach((q, idx) => {
|
|
4038
|
+
if (!q || typeof q !== "object") {
|
|
4039
|
+
errors.push(`C\xE2u h\u1ECFi s\u1ED1 ${idx + 1} ph\u1EA3i l\xE0 m\u1ED9t \u0111\u1ED1i t\u01B0\u1EE3ng.`);
|
|
4040
|
+
return;
|
|
4041
|
+
}
|
|
4042
|
+
const question = q;
|
|
4043
|
+
if (question.type !== 1 && question.type !== 2) {
|
|
4044
|
+
errors.push(`C\xE2u h\u1ECFi s\u1ED1 ${idx + 1}: Tr\u01B0\u1EDDng 'type' b\u1EAFt bu\u1ED9c l\xE0 1 (nh\u1EADp li\u1EC7u) ho\u1EB7c 2 (l\u1EF1a ch\u1ECDn ph\u01B0\u01A1ng \xE1n).`);
|
|
4045
|
+
}
|
|
4046
|
+
if (!question.title || typeof question.title !== "string" || question.title.trim() === "") {
|
|
4047
|
+
errors.push(`C\xE2u h\u1ECFi s\u1ED1 ${idx + 1}: Tr\u01B0\u1EDDng 'title' kh\xF4ng \u0111\u01B0\u1EE3c \u0111\u1EC3 tr\u1ED1ng.`);
|
|
4048
|
+
}
|
|
4049
|
+
if (!Array.isArray(question.answers) || question.answers.length === 0) {
|
|
4050
|
+
errors.push(`C\xE2u h\u1ECFi s\u1ED1 ${idx + 1}: Tr\u01B0\u1EDDng 'answers' ph\u1EA3i ch\u1EE9a \xEDt nh\u1EA5t m\u1ED9t ph\u01B0\u01A1ng \xE1n/\xF4 nh\u1EADp li\u1EC7u.`);
|
|
4051
|
+
} else {
|
|
4052
|
+
question.answers.forEach((ans, ansIdx) => {
|
|
4053
|
+
if (!ans || typeof ans !== "object") {
|
|
4054
|
+
errors.push(`C\xE2u h\u1ECFi s\u1ED1 ${idx + 1}, ph\u01B0\u01A1ng \xE1n ${ansIdx + 1}: Ph\u1EA3i l\xE0 m\u1ED9t \u0111\u1ED1i t\u01B0\u1EE3ng.`);
|
|
4055
|
+
return;
|
|
4056
|
+
}
|
|
4057
|
+
const answer = ans;
|
|
4058
|
+
if (answer.type === void 0 || typeof answer.type !== "number") {
|
|
4059
|
+
errors.push(`C\xE2u h\u1ECFi s\u1ED1 ${idx + 1}, ph\u01B0\u01A1ng \xE1n ${ansIdx + 1}: Tr\u01B0\u1EDDng 'type' b\u1EAFt bu\u1ED9c l\xE0 s\u1ED1 nguy\xEAn.`);
|
|
4060
|
+
}
|
|
4061
|
+
});
|
|
4062
|
+
}
|
|
4063
|
+
});
|
|
4064
|
+
}
|
|
4065
|
+
const useCustomConsent = typeof obj.useCustomConsent === "boolean" ? obj.useCustomConsent : false;
|
|
4066
|
+
let consentConfig = obj.consentConfig;
|
|
4067
|
+
if (useCustomConsent) {
|
|
4068
|
+
if (!consentConfig || typeof consentConfig !== "object") {
|
|
4069
|
+
errors.push("Khi 'useCustomConsent' = true, tr\u01B0\u1EDDng 'consentConfig' l\xE0 b\u1EAFt bu\u1ED9c.");
|
|
4070
|
+
} else {
|
|
4071
|
+
if (!consentConfig.address || typeof consentConfig.address !== "string") errors.push("C\u1EA5u h\xECnh \u0111i\u1EC1u kho\u1EA3n: 'address' kh\xF4ng \u0111\u01B0\u1EE3c \u0111\u1EC3 tr\u1ED1ng.");
|
|
4072
|
+
if (!consentConfig.ownerName || typeof consentConfig.ownerName !== "string") errors.push("C\u1EA5u h\xECnh \u0111i\u1EC1u kho\u1EA3n: 'ownerName' kh\xF4ng \u0111\u01B0\u1EE3c \u0111\u1EC3 tr\u1ED1ng.");
|
|
4073
|
+
if (!consentConfig.ownerEmail || typeof consentConfig.ownerEmail !== "string") errors.push("C\u1EA5u h\xECnh \u0111i\u1EC1u kho\u1EA3n: 'ownerEmail' kh\xF4ng \u0111\u01B0\u1EE3c \u0111\u1EC3 tr\u1ED1ng.");
|
|
4074
|
+
if (!consentConfig.ownerPhone || typeof consentConfig.ownerPhone !== "string") errors.push("C\u1EA5u h\xECnh \u0111i\u1EC1u kho\u1EA3n: 'ownerPhone' kh\xF4ng \u0111\u01B0\u1EE3c \u0111\u1EC3 tr\u1ED1ng.");
|
|
4075
|
+
}
|
|
4076
|
+
}
|
|
4077
|
+
const data = {
|
|
4078
|
+
instantPageId: toPositiveInteger(obj.instantPageId),
|
|
4079
|
+
oaId: String(obj.oaId).trim(),
|
|
4080
|
+
formName: String(obj.formName).trim(),
|
|
4081
|
+
questions: obj.questions ?? [],
|
|
4082
|
+
useCustomConsent,
|
|
4083
|
+
consentConfig
|
|
4084
|
+
};
|
|
4085
|
+
return {
|
|
4086
|
+
isValid: errors.length === 0,
|
|
4087
|
+
errors,
|
|
4088
|
+
data: errors.length === 0 ? data : void 0
|
|
4089
|
+
};
|
|
4090
|
+
}
|
|
4091
|
+
var ZaloInstantPagesValidator = {
|
|
4092
|
+
validateCloneInstantPage: validateCloneInstantPageRequest,
|
|
4093
|
+
validateGetInstantPageDetail: validateGetInstantPageDetailRequest,
|
|
4094
|
+
validateGetInstantPageSharedUser: validateGetInstantPageSharedUserRequest,
|
|
4095
|
+
validateListInstantPageEditHistory: validateListInstantPageEditHistoryRequest,
|
|
4096
|
+
validateListInstantPageFormRecords: validateListInstantPageFormRecordsRequest,
|
|
4097
|
+
validateListInstantPageShares: validateListInstantPageSharesRequest,
|
|
4098
|
+
validateListInstantPageUsers: validateListInstantPageUsersRequest,
|
|
4099
|
+
validateListMiniPageTemplates: validateListMiniPageTemplatesRequest,
|
|
4100
|
+
validateSearchInstantPages: validateSearchInstantPagesRequest,
|
|
4101
|
+
validateUpdateInstantPage: validateUpdateInstantPageRequest,
|
|
4102
|
+
validateListInstantPageLeads: validateListInstantPageLeadsRequest,
|
|
4103
|
+
validateListOfficialAccounts: validateListOfficialAccountsRequest,
|
|
4104
|
+
validateUpsertInstantPageForm: validateUpsertInstantPageFormRequest
|
|
4105
|
+
};
|
|
4106
|
+
|
|
2639
4107
|
// src/services/instant-pages.service.ts
|
|
2640
4108
|
var OP_ZaloInstantPagesCloneInstantPage = {
|
|
2641
4109
|
"operationId": "ZaloInstantPages_cloneInstantPage",
|
|
@@ -2838,8 +4306,13 @@ var ZaloInstantPagesService = class {
|
|
|
2838
4306
|
constructor(client) {
|
|
2839
4307
|
this.client = client;
|
|
2840
4308
|
}
|
|
4309
|
+
/**
|
|
4310
|
+
* Bộ công cụ kiểm tra tính hợp lệ dữ liệu (Standalone Validators) cho 13 API Instant Pages.
|
|
4311
|
+
* Dùng ở backend (NestJS/Express/Fastify), middleware hoặc AI Agent để verify payload trước khi gọi SDK.
|
|
4312
|
+
*/
|
|
4313
|
+
static validator = ZaloInstantPagesValidator;
|
|
2841
4314
|
cloneInstantPage(request, options) {
|
|
2842
|
-
return this.client.
|
|
4315
|
+
return this.client.requestJson(OP_ZaloInstantPagesCloneInstantPage, this.client.toTransportInput(OP_ZaloInstantPagesCloneInstantPage, request), options);
|
|
2843
4316
|
}
|
|
2844
4317
|
getInstantPageDetail(request, options) {
|
|
2845
4318
|
return this.client.requestWithoutBody(OP_ZaloInstantPagesGetInstantPageDetail, this.client.toTransportInput(OP_ZaloInstantPagesGetInstantPageDetail, request), options);
|
|
@@ -3116,6 +4589,17 @@ var ZaloWidgetApiService = class {
|
|
|
3116
4589
|
var ZaloAdsSdk = class {
|
|
3117
4590
|
client;
|
|
3118
4591
|
ads;
|
|
4592
|
+
campaigns;
|
|
4593
|
+
account;
|
|
4594
|
+
audiences;
|
|
4595
|
+
targeting;
|
|
4596
|
+
reports;
|
|
4597
|
+
conversions;
|
|
4598
|
+
pixel;
|
|
4599
|
+
automatedRules;
|
|
4600
|
+
rules;
|
|
4601
|
+
flows;
|
|
4602
|
+
media;
|
|
3119
4603
|
forms;
|
|
3120
4604
|
instantPages;
|
|
3121
4605
|
profileAds;
|
|
@@ -3126,6 +4610,17 @@ var ZaloAdsSdk = class {
|
|
|
3126
4610
|
const resolvedOptions = typeof options === "string" ? { zpsid: options } : options;
|
|
3127
4611
|
this.client = new ZaloSdkHttpClient(resolvedOptions);
|
|
3128
4612
|
this.ads = new ZaloAdsService(this.client);
|
|
4613
|
+
this.campaigns = this.ads;
|
|
4614
|
+
this.account = this.ads.account;
|
|
4615
|
+
this.audiences = this.ads.audiences;
|
|
4616
|
+
this.targeting = this.ads.audiences;
|
|
4617
|
+
this.reports = this.ads.reports;
|
|
4618
|
+
this.conversions = this.ads.conversions;
|
|
4619
|
+
this.pixel = this.ads.conversions;
|
|
4620
|
+
this.automatedRules = this.ads.automatedRules;
|
|
4621
|
+
this.rules = this.ads.automatedRules;
|
|
4622
|
+
this.flows = this.ads.flows;
|
|
4623
|
+
this.media = this.ads.media;
|
|
3129
4624
|
this.forms = new ZaloFormsService(this.client);
|
|
3130
4625
|
this.instantPages = new ZaloInstantPagesService(this.client);
|
|
3131
4626
|
this.profileAds = new ZaloProfileAdsService(this.client);
|
|
@@ -3451,11 +4946,35 @@ var ZaloAdsUpdateMessageAdResponse = class {
|
|
|
3451
4946
|
code;
|
|
3452
4947
|
data;
|
|
3453
4948
|
};
|
|
4949
|
+
|
|
4950
|
+
// src/dtos/instant-pages.dto.ts
|
|
4951
|
+
var ZaloInstantPageBlockType = /* @__PURE__ */ ((ZaloInstantPageBlockType2) => {
|
|
4952
|
+
ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["CAROUSEL_SLIDER"] = 1] = "CAROUSEL_SLIDER";
|
|
4953
|
+
ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["COUNTDOWN"] = 2] = "COUNTDOWN";
|
|
4954
|
+
ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["RICH_TEXT"] = 4] = "RICH_TEXT";
|
|
4955
|
+
ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["HERO_IMAGE"] = 6] = "HERO_IMAGE";
|
|
4956
|
+
ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["FORM_NAME"] = 7] = "FORM_NAME";
|
|
4957
|
+
ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["ORDER_CTA_BUTTON"] = 8] = "ORDER_CTA_BUTTON";
|
|
4958
|
+
ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["FORM_PHONE"] = 9] = "FORM_PHONE";
|
|
4959
|
+
ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["FORM_ADDRESS"] = 10] = "FORM_ADDRESS";
|
|
4960
|
+
ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["FOOTER"] = 14] = "FOOTER";
|
|
4961
|
+
ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["FORM_QUANTITY"] = 16] = "FORM_QUANTITY";
|
|
4962
|
+
ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["PRODUCT_VARIANT"] = 18] = "PRODUCT_VARIANT";
|
|
4963
|
+
ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["PRODUCT_TITLE_PRICE"] = 19] = "PRODUCT_TITLE_PRICE";
|
|
4964
|
+
ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["QUICK_QUESTIONS"] = 20] = "QUICK_QUESTIONS";
|
|
4965
|
+
ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["MESSAGE_CTA_BUTTON"] = 21] = "MESSAGE_CTA_BUTTON";
|
|
4966
|
+
ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["SECTION_HEADING"] = 22] = "SECTION_HEADING";
|
|
4967
|
+
ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["CALL_HOTLINE_BUTTON"] = 23] = "CALL_HOTLINE_BUTTON";
|
|
4968
|
+
ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["KEY_VALUE_TABLE"] = 25] = "KEY_VALUE_TABLE";
|
|
4969
|
+
ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["CONSENT_NOTICE"] = 27] = "CONSENT_NOTICE";
|
|
4970
|
+
return ZaloInstantPageBlockType2;
|
|
4971
|
+
})(ZaloInstantPageBlockType || {});
|
|
3454
4972
|
export {
|
|
3455
4973
|
ALL_ZALO_ADS_DOMAINS,
|
|
3456
4974
|
MemoryZaloSessionStore,
|
|
3457
4975
|
RedisZaloSessionStore,
|
|
3458
4976
|
TieredZaloSessionStore,
|
|
4977
|
+
ZaloAccountService,
|
|
3459
4978
|
ZaloAdsIntegrationManager as ZaloAdsAccountPool,
|
|
3460
4979
|
ZaloAdsCreateFlowRequest,
|
|
3461
4980
|
ZaloAdsCreateFlowResponse,
|
|
@@ -3472,11 +4991,20 @@ export {
|
|
|
3472
4991
|
ZaloAdsUpdateMessageAdResponse,
|
|
3473
4992
|
ZaloAdsUpdateVideoAdRequest,
|
|
3474
4993
|
ZaloAdsUpdateVideoAdResponse,
|
|
4994
|
+
ZaloAudiencesService,
|
|
3475
4995
|
ZaloAuthManager,
|
|
4996
|
+
ZaloAutomatedRulesService,
|
|
4997
|
+
ZaloCampaignsService,
|
|
3476
4998
|
ZaloChatWidgetService,
|
|
4999
|
+
ZaloConversionsService,
|
|
5000
|
+
ZaloFlowsService,
|
|
3477
5001
|
ZaloFormsService,
|
|
5002
|
+
ZaloInstantPageBlockType,
|
|
3478
5003
|
ZaloInstantPagesService,
|
|
5004
|
+
ZaloInstantPagesValidator,
|
|
5005
|
+
ZaloMediaService,
|
|
3479
5006
|
ZaloProfileAdsService,
|
|
5007
|
+
ZaloReportsService,
|
|
3480
5008
|
ZaloSdkError,
|
|
3481
5009
|
ZaloSdkHttpClient,
|
|
3482
5010
|
ZaloWidgetApiService,
|
|
@@ -3486,6 +5014,19 @@ export {
|
|
|
3486
5014
|
ZaloAdsSdk as default,
|
|
3487
5015
|
defaultSharedMemorySessionStore,
|
|
3488
5016
|
deriveAccountKeyFromZpsid,
|
|
3489
|
-
parseZaloCookieInput
|
|
5017
|
+
parseZaloCookieInput,
|
|
5018
|
+
validateCloneInstantPageRequest,
|
|
5019
|
+
validateGetInstantPageDetailRequest,
|
|
5020
|
+
validateGetInstantPageSharedUserRequest,
|
|
5021
|
+
validateListInstantPageEditHistoryRequest,
|
|
5022
|
+
validateListInstantPageFormRecordsRequest,
|
|
5023
|
+
validateListInstantPageLeadsRequest,
|
|
5024
|
+
validateListInstantPageSharesRequest,
|
|
5025
|
+
validateListInstantPageUsersRequest,
|
|
5026
|
+
validateListMiniPageTemplatesRequest,
|
|
5027
|
+
validateListOfficialAccountsRequest,
|
|
5028
|
+
validateSearchInstantPagesRequest,
|
|
5029
|
+
validateUpdateInstantPageRequest,
|
|
5030
|
+
validateUpsertInstantPageFormRequest
|
|
3490
5031
|
};
|
|
3491
5032
|
//# sourceMappingURL=index.mjs.map
|