@redonvn/zalo-ads-sdk 0.2.0 → 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 +2002 -601
- package/dist/index.d.ts +2002 -601
- package/dist/index.js +2436 -762
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2402 -761
- 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;
|
|
@@ -970,9 +970,16 @@ var ZaloSdkHttpClient = class {
|
|
|
970
970
|
}
|
|
971
971
|
async resolveFile(input) {
|
|
972
972
|
if (typeof input === "string") {
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
973
|
+
if (/^(https?:|data:)/i.test(input)) {
|
|
974
|
+
const response = await this.fetchImpl(input);
|
|
975
|
+
if (!response.ok) throw new Error(`Cannot download upload file URL: HTTP ${response.status}.`);
|
|
976
|
+
return response.blob();
|
|
977
|
+
}
|
|
978
|
+
const fs = await import("fs/promises");
|
|
979
|
+
const bytes2 = await fs.readFile(input);
|
|
980
|
+
const copy = new Uint8Array(bytes2.byteLength);
|
|
981
|
+
copy.set(bytes2);
|
|
982
|
+
return new Blob([copy.buffer], { type: inferMimeType(input) });
|
|
976
983
|
}
|
|
977
984
|
if (input instanceof Blob) return input;
|
|
978
985
|
if (input instanceof ArrayBuffer) return new Blob([input]);
|
|
@@ -994,14 +1001,36 @@ function appendQuery(params, key, value) {
|
|
|
994
1001
|
}
|
|
995
1002
|
function fileNameFrom(value) {
|
|
996
1003
|
if (typeof value === "string") {
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1004
|
+
if (/^https?:/i.test(value)) {
|
|
1005
|
+
try {
|
|
1006
|
+
return new URL(value).pathname.split("/").pop() || "upload";
|
|
1007
|
+
} catch {
|
|
1008
|
+
return "upload";
|
|
1009
|
+
}
|
|
1001
1010
|
}
|
|
1011
|
+
const base = value.split(/[\\/]/).pop();
|
|
1012
|
+
return base || "upload";
|
|
1013
|
+
}
|
|
1014
|
+
if (value && typeof value === "object" && "name" in value && typeof value.name === "string") {
|
|
1015
|
+
return value.name;
|
|
1016
|
+
}
|
|
1017
|
+
if (value instanceof Blob && value.type) {
|
|
1018
|
+
const ext = value.type.split("/")[1]?.replace("jpeg", "jpg");
|
|
1019
|
+
if (ext) return `upload.${ext}`;
|
|
1002
1020
|
}
|
|
1003
1021
|
return "upload";
|
|
1004
1022
|
}
|
|
1023
|
+
function inferMimeType(filePath) {
|
|
1024
|
+
const lower = filePath.toLowerCase();
|
|
1025
|
+
if (lower.endsWith(".jpg") || lower.endsWith(".jpeg")) return "image/jpeg";
|
|
1026
|
+
if (lower.endsWith(".png")) return "image/png";
|
|
1027
|
+
if (lower.endsWith(".gif")) return "image/gif";
|
|
1028
|
+
if (lower.endsWith(".webp")) return "image/webp";
|
|
1029
|
+
if (lower.endsWith(".mp4")) return "video/mp4";
|
|
1030
|
+
if (lower.endsWith(".txt")) return "text/plain";
|
|
1031
|
+
if (lower.endsWith(".csv")) return "text/csv";
|
|
1032
|
+
return "application/octet-stream";
|
|
1033
|
+
}
|
|
1005
1034
|
async function resolveHeaders(auth, context) {
|
|
1006
1035
|
return { ...auth?.headers ?? {}, ...await auth?.getHeaders?.(context) ?? {} };
|
|
1007
1036
|
}
|
|
@@ -1009,43 +1038,7 @@ async function resolveCookies(auth, context) {
|
|
|
1009
1038
|
return { ...auth?.cookies ?? {}, ...await auth?.getCookies?.(context) ?? {} };
|
|
1010
1039
|
}
|
|
1011
1040
|
|
|
1012
|
-
// src/services/
|
|
1013
|
-
var OP_ZaloAdsListFlowsByOfficialAccount = {
|
|
1014
|
-
operationId: "ZaloAds_listFlowsByOfficialAccount",
|
|
1015
|
-
method: "GET",
|
|
1016
|
-
endpoint: "/api/flow/getByOaId",
|
|
1017
|
-
baseUrl: "https://ads.zalo.me",
|
|
1018
|
-
binaryFields: [],
|
|
1019
|
-
pathFields: [],
|
|
1020
|
-
queryFields: ["oaId", "limit", "offset", "flowId"],
|
|
1021
|
-
headerFields: [],
|
|
1022
|
-
cookieFields: [],
|
|
1023
|
-
bodyFields: []
|
|
1024
|
-
};
|
|
1025
|
-
var OP_ZaloAdsCreateFlow = {
|
|
1026
|
-
operationId: "ZaloAds_createFlow",
|
|
1027
|
-
method: "POST",
|
|
1028
|
-
endpoint: "/api/flow/create",
|
|
1029
|
-
baseUrl: "https://ads.zalo.me",
|
|
1030
|
-
binaryFields: [],
|
|
1031
|
-
pathFields: [],
|
|
1032
|
-
queryFields: [],
|
|
1033
|
-
headerFields: [],
|
|
1034
|
-
cookieFields: [],
|
|
1035
|
-
bodyFields: ["oaId", "id", "name", "messages"]
|
|
1036
|
-
};
|
|
1037
|
-
var OP_ZaloAdsUpdateFlow = {
|
|
1038
|
-
operationId: "ZaloAds_updateFlow",
|
|
1039
|
-
method: "POST",
|
|
1040
|
-
endpoint: "/api/flow/update",
|
|
1041
|
-
baseUrl: "https://ads.zalo.me",
|
|
1042
|
-
binaryFields: [],
|
|
1043
|
-
pathFields: [],
|
|
1044
|
-
queryFields: [],
|
|
1045
|
-
headerFields: [],
|
|
1046
|
-
cookieFields: [],
|
|
1047
|
-
bodyFields: ["oaId", "id", "name", "messages"]
|
|
1048
|
-
};
|
|
1041
|
+
// src/services/campaigns.service.ts
|
|
1049
1042
|
var OP_ZaloAdsUpdateVideoAd = {
|
|
1050
1043
|
operationId: "ZaloAds_updateVideoAd",
|
|
1051
1044
|
method: "POST",
|
|
@@ -1073,22 +1066,6 @@ var OP_ZaloAdsChangeCampaignStatus = {
|
|
|
1073
1066
|
"campaignId"
|
|
1074
1067
|
]
|
|
1075
1068
|
};
|
|
1076
|
-
var OP_ZaloAdsCreateCustomAudience = {
|
|
1077
|
-
"operationId": "ZaloAds_createCustomAudience",
|
|
1078
|
-
"method": "POST",
|
|
1079
|
-
"endpoint": "/api/ad/audience",
|
|
1080
|
-
"baseUrl": "https://ads.zalo.me",
|
|
1081
|
-
"binaryFields": [],
|
|
1082
|
-
"pathFields": [],
|
|
1083
|
-
"queryFields": [],
|
|
1084
|
-
"headerFields": [],
|
|
1085
|
-
"cookieFields": [],
|
|
1086
|
-
"bodyFields": [
|
|
1087
|
-
"name",
|
|
1088
|
-
"caType",
|
|
1089
|
-
"targeting"
|
|
1090
|
-
]
|
|
1091
|
-
};
|
|
1092
1069
|
var OP_ZaloAdsCreateEcommerceCampaign = {
|
|
1093
1070
|
"operationId": "ZaloAds_createEcommerceCampaign",
|
|
1094
1071
|
"method": "POST",
|
|
@@ -1173,54 +1150,6 @@ var OP_ZaloAdsCreatePostCampaign = {
|
|
|
1173
1150
|
"data"
|
|
1174
1151
|
]
|
|
1175
1152
|
};
|
|
1176
|
-
var OP_ZaloAdsCreateConversion = {
|
|
1177
|
-
"operationId": "ZaloAds_createConversion",
|
|
1178
|
-
"method": "POST",
|
|
1179
|
-
"endpoint": "/api/conversion/add",
|
|
1180
|
-
"baseUrl": "https://ads.zalo.me",
|
|
1181
|
-
"binaryFields": [],
|
|
1182
|
-
"pathFields": [],
|
|
1183
|
-
"queryFields": [],
|
|
1184
|
-
"headerFields": [],
|
|
1185
|
-
"cookieFields": [],
|
|
1186
|
-
"bodyFields": [
|
|
1187
|
-
"name",
|
|
1188
|
-
"landingPage",
|
|
1189
|
-
"urlType",
|
|
1190
|
-
"labelId",
|
|
1191
|
-
"buttonIds",
|
|
1192
|
-
"elements",
|
|
1193
|
-
"keywords"
|
|
1194
|
-
]
|
|
1195
|
-
};
|
|
1196
|
-
var OP_ZaloAdsDeleteConversion = {
|
|
1197
|
-
"operationId": "ZaloAds_deleteConversion",
|
|
1198
|
-
"method": "DELETE",
|
|
1199
|
-
"endpoint": "/api/conversion/delete/{conversionId}",
|
|
1200
|
-
"baseUrl": "https://ads.zalo.me",
|
|
1201
|
-
"binaryFields": [],
|
|
1202
|
-
"pathFields": [
|
|
1203
|
-
"conversionId"
|
|
1204
|
-
],
|
|
1205
|
-
"queryFields": [],
|
|
1206
|
-
"headerFields": [],
|
|
1207
|
-
"cookieFields": [],
|
|
1208
|
-
"bodyFields": []
|
|
1209
|
-
};
|
|
1210
|
-
var OP_ZaloAdsDeleteCustomAudience = {
|
|
1211
|
-
"operationId": "ZaloAds_deleteCustomAudience",
|
|
1212
|
-
"method": "DELETE",
|
|
1213
|
-
"endpoint": "/api/ad/audience/{customAudienceId}",
|
|
1214
|
-
"baseUrl": "https://ads.zalo.me",
|
|
1215
|
-
"binaryFields": [],
|
|
1216
|
-
"pathFields": [
|
|
1217
|
-
"customAudienceId"
|
|
1218
|
-
],
|
|
1219
|
-
"queryFields": [],
|
|
1220
|
-
"headerFields": [],
|
|
1221
|
-
"cookieFields": [],
|
|
1222
|
-
"bodyFields": []
|
|
1223
|
-
};
|
|
1224
1153
|
var OP_ZaloAdsGetAdById = {
|
|
1225
1154
|
"operationId": "ZaloAds_getAdById",
|
|
1226
1155
|
"method": "GET",
|
|
@@ -1251,10 +1180,10 @@ var OP_ZaloAdsGetAdChangeLog = {
|
|
|
1251
1180
|
"cookieFields": [],
|
|
1252
1181
|
"bodyFields": []
|
|
1253
1182
|
};
|
|
1254
|
-
var
|
|
1255
|
-
"operationId": "
|
|
1183
|
+
var OP_ZaloAdsGetApiPlaceGetalldistricts = {
|
|
1184
|
+
"operationId": "ZaloAds_getApiPlaceGetalldistricts",
|
|
1256
1185
|
"method": "GET",
|
|
1257
|
-
"endpoint": "/api/
|
|
1186
|
+
"endpoint": "/api/place/getAllDistricts",
|
|
1258
1187
|
"baseUrl": "https://ads.zalo.me",
|
|
1259
1188
|
"binaryFields": [],
|
|
1260
1189
|
"pathFields": [],
|
|
@@ -1263,46 +1192,54 @@ var OP_ZaloAdsGetApiAdGetlistadadvancetargeting = {
|
|
|
1263
1192
|
"cookieFields": [],
|
|
1264
1193
|
"bodyFields": []
|
|
1265
1194
|
};
|
|
1266
|
-
var
|
|
1267
|
-
"operationId": "
|
|
1195
|
+
var OP_ZaloAdsGetApiSpellCheckV2 = {
|
|
1196
|
+
"operationId": "ZaloAds_getApiSpellCheckV2",
|
|
1268
1197
|
"method": "GET",
|
|
1269
|
-
"endpoint": "/api/
|
|
1198
|
+
"endpoint": "/api/spell-check/v2",
|
|
1270
1199
|
"baseUrl": "https://ads.zalo.me",
|
|
1271
1200
|
"binaryFields": [],
|
|
1272
1201
|
"pathFields": [],
|
|
1273
|
-
"queryFields": [
|
|
1202
|
+
"queryFields": [
|
|
1203
|
+
"text"
|
|
1204
|
+
],
|
|
1274
1205
|
"headerFields": [],
|
|
1275
1206
|
"cookieFields": [],
|
|
1276
1207
|
"bodyFields": []
|
|
1277
1208
|
};
|
|
1278
|
-
var
|
|
1279
|
-
"operationId": "
|
|
1209
|
+
var OP_ZaloAdsGetZaapiCheckcamphasmanyads = {
|
|
1210
|
+
"operationId": "ZaloAds_getZaapiCheckcamphasmanyads",
|
|
1280
1211
|
"method": "GET",
|
|
1281
|
-
"endpoint": "/
|
|
1212
|
+
"endpoint": "/zaapi/checkCampHasManyAds",
|
|
1282
1213
|
"baseUrl": "https://ads.zalo.me",
|
|
1283
1214
|
"binaryFields": [],
|
|
1284
1215
|
"pathFields": [],
|
|
1285
|
-
"queryFields": [
|
|
1216
|
+
"queryFields": [
|
|
1217
|
+
"campaignId",
|
|
1218
|
+
"campId"
|
|
1219
|
+
],
|
|
1286
1220
|
"headerFields": [],
|
|
1287
1221
|
"cookieFields": [],
|
|
1288
1222
|
"bodyFields": []
|
|
1289
1223
|
};
|
|
1290
|
-
var
|
|
1291
|
-
"operationId": "
|
|
1224
|
+
var OP_ZaloAdsGetZaapiGetadsfromcampaignid = {
|
|
1225
|
+
"operationId": "ZaloAds_getZaapiGetadsfromcampaignid",
|
|
1292
1226
|
"method": "GET",
|
|
1293
|
-
"endpoint": "/
|
|
1227
|
+
"endpoint": "/zaapi/getAdsFromCampaignId",
|
|
1294
1228
|
"baseUrl": "https://ads.zalo.me",
|
|
1295
1229
|
"binaryFields": [],
|
|
1296
1230
|
"pathFields": [],
|
|
1297
|
-
"queryFields": [
|
|
1231
|
+
"queryFields": [
|
|
1232
|
+
"campaignId",
|
|
1233
|
+
"campId"
|
|
1234
|
+
],
|
|
1298
1235
|
"headerFields": [],
|
|
1299
1236
|
"cookieFields": [],
|
|
1300
1237
|
"bodyFields": []
|
|
1301
1238
|
};
|
|
1302
|
-
var
|
|
1303
|
-
"operationId": "
|
|
1239
|
+
var OP_ZaloAdsGetZaapiGetallpages = {
|
|
1240
|
+
"operationId": "ZaloAds_getZaapiGetallpages",
|
|
1304
1241
|
"method": "GET",
|
|
1305
|
-
"endpoint": "/
|
|
1242
|
+
"endpoint": "/zaapi/getAllPages",
|
|
1306
1243
|
"baseUrl": "https://ads.zalo.me",
|
|
1307
1244
|
"binaryFields": [],
|
|
1308
1245
|
"pathFields": [],
|
|
@@ -1311,24 +1248,24 @@ var OP_ZaloAdsGetApiConversionStandardEvents = {
|
|
|
1311
1248
|
"cookieFields": [],
|
|
1312
1249
|
"bodyFields": []
|
|
1313
1250
|
};
|
|
1314
|
-
var
|
|
1315
|
-
"operationId": "
|
|
1251
|
+
var OP_ZaloAdsGetZaapiGetownedarticles = {
|
|
1252
|
+
"operationId": "ZaloAds_getZaapiGetownedarticles",
|
|
1316
1253
|
"method": "GET",
|
|
1317
|
-
"endpoint": "/
|
|
1254
|
+
"endpoint": "/zaapi/getOwnedArticles",
|
|
1318
1255
|
"baseUrl": "https://ads.zalo.me",
|
|
1319
1256
|
"binaryFields": [],
|
|
1320
1257
|
"pathFields": [],
|
|
1321
1258
|
"queryFields": [
|
|
1322
|
-
"
|
|
1259
|
+
"pageId"
|
|
1323
1260
|
],
|
|
1324
1261
|
"headerFields": [],
|
|
1325
1262
|
"cookieFields": [],
|
|
1326
1263
|
"bodyFields": []
|
|
1327
1264
|
};
|
|
1328
|
-
var
|
|
1329
|
-
"operationId": "
|
|
1265
|
+
var OP_ZaloAdsGetZaapiGetownedpages = {
|
|
1266
|
+
"operationId": "ZaloAds_getZaapiGetownedpages",
|
|
1330
1267
|
"method": "GET",
|
|
1331
|
-
"endpoint": "/
|
|
1268
|
+
"endpoint": "/zaapi/getOwnedPages",
|
|
1332
1269
|
"baseUrl": "https://ads.zalo.me",
|
|
1333
1270
|
"binaryFields": [],
|
|
1334
1271
|
"pathFields": [],
|
|
@@ -1337,323 +1274,419 @@ var OP_ZaloAdsGetApiFilegroups = {
|
|
|
1337
1274
|
"cookieFields": [],
|
|
1338
1275
|
"bodyFields": []
|
|
1339
1276
|
};
|
|
1340
|
-
var
|
|
1341
|
-
"operationId": "
|
|
1277
|
+
var OP_ZaloAdsListFormsByOfficialAccount = {
|
|
1278
|
+
"operationId": "ZaloAds_listFormsByOfficialAccount",
|
|
1342
1279
|
"method": "GET",
|
|
1343
|
-
"endpoint": "/api/
|
|
1280
|
+
"endpoint": "/api/form/getByOaId",
|
|
1344
1281
|
"baseUrl": "https://ads.zalo.me",
|
|
1345
1282
|
"binaryFields": [],
|
|
1346
1283
|
"pathFields": [],
|
|
1347
|
-
"queryFields": [
|
|
1284
|
+
"queryFields": [
|
|
1285
|
+
"oaId",
|
|
1286
|
+
"isAll"
|
|
1287
|
+
],
|
|
1348
1288
|
"headerFields": [],
|
|
1349
1289
|
"cookieFields": [],
|
|
1350
1290
|
"bodyFields": []
|
|
1351
1291
|
};
|
|
1352
|
-
var
|
|
1353
|
-
"operationId": "
|
|
1292
|
+
var OP_ZaloAdsListMiniPagesByTemplate = {
|
|
1293
|
+
"operationId": "ZaloAds_listMiniPagesByTemplate",
|
|
1354
1294
|
"method": "GET",
|
|
1355
|
-
"endpoint": "/api/
|
|
1295
|
+
"endpoint": "/api/mini-pages",
|
|
1356
1296
|
"baseUrl": "https://ads.zalo.me",
|
|
1357
1297
|
"binaryFields": [],
|
|
1358
1298
|
"pathFields": [],
|
|
1359
1299
|
"queryFields": [
|
|
1360
|
-
"
|
|
1361
|
-
"startDate"
|
|
1300
|
+
"templateIds"
|
|
1362
1301
|
],
|
|
1363
1302
|
"headerFields": [],
|
|
1364
1303
|
"cookieFields": [],
|
|
1365
1304
|
"bodyFields": []
|
|
1366
1305
|
};
|
|
1367
|
-
var
|
|
1368
|
-
"operationId": "
|
|
1369
|
-
"method": "
|
|
1370
|
-
"endpoint": "/
|
|
1306
|
+
var OP_ZaloAdsPostZaapiDeletead = {
|
|
1307
|
+
"operationId": "ZaloAds_postZaapiDeletead",
|
|
1308
|
+
"method": "POST",
|
|
1309
|
+
"endpoint": "/zaapi/deleteAd",
|
|
1371
1310
|
"baseUrl": "https://ads.zalo.me",
|
|
1372
1311
|
"binaryFields": [],
|
|
1373
1312
|
"pathFields": [],
|
|
1374
|
-
"queryFields": [
|
|
1313
|
+
"queryFields": [
|
|
1314
|
+
"adId"
|
|
1315
|
+
],
|
|
1375
1316
|
"headerFields": [],
|
|
1376
1317
|
"cookieFields": [],
|
|
1377
|
-
"bodyFields": [
|
|
1318
|
+
"bodyFields": [
|
|
1319
|
+
"adId"
|
|
1320
|
+
]
|
|
1378
1321
|
};
|
|
1379
|
-
var
|
|
1380
|
-
"operationId": "
|
|
1381
|
-
"method": "
|
|
1382
|
-
"endpoint": "/api/
|
|
1322
|
+
var OP_ZaloAdsRenameCampaign = {
|
|
1323
|
+
"operationId": "ZaloAds_renameCampaign",
|
|
1324
|
+
"method": "POST",
|
|
1325
|
+
"endpoint": "/api/campaign/change-name",
|
|
1383
1326
|
"baseUrl": "https://ads.zalo.me",
|
|
1384
1327
|
"binaryFields": [],
|
|
1385
1328
|
"pathFields": [],
|
|
1386
1329
|
"queryFields": [],
|
|
1387
1330
|
"headerFields": [],
|
|
1388
1331
|
"cookieFields": [],
|
|
1389
|
-
"bodyFields": [
|
|
1332
|
+
"bodyFields": [
|
|
1333
|
+
"campid",
|
|
1334
|
+
"newname"
|
|
1335
|
+
]
|
|
1390
1336
|
};
|
|
1391
|
-
var
|
|
1392
|
-
"operationId": "
|
|
1393
|
-
"method": "
|
|
1394
|
-
"endpoint": "/
|
|
1337
|
+
var OP_ZaloAdsUpdateEcommerceAd = {
|
|
1338
|
+
"operationId": "ZaloAds_updateEcommerceAd",
|
|
1339
|
+
"method": "POST",
|
|
1340
|
+
"endpoint": "/zaapi/UpdateAd",
|
|
1395
1341
|
"baseUrl": "https://ads.zalo.me",
|
|
1396
1342
|
"binaryFields": [],
|
|
1397
1343
|
"pathFields": [],
|
|
1398
|
-
"queryFields": [
|
|
1399
|
-
"to",
|
|
1400
|
-
"from",
|
|
1401
|
-
"memberId"
|
|
1402
|
-
],
|
|
1344
|
+
"queryFields": [],
|
|
1403
1345
|
"headerFields": [],
|
|
1404
1346
|
"cookieFields": [],
|
|
1405
|
-
"bodyFields": [
|
|
1347
|
+
"bodyFields": [
|
|
1348
|
+
"est",
|
|
1349
|
+
"stt",
|
|
1350
|
+
"data",
|
|
1351
|
+
"isBoostAd"
|
|
1352
|
+
]
|
|
1406
1353
|
};
|
|
1407
|
-
var
|
|
1408
|
-
"operationId": "
|
|
1409
|
-
"method": "
|
|
1410
|
-
"endpoint": "/
|
|
1354
|
+
var OP_ZaloAdsUpdateFormAd = {
|
|
1355
|
+
"operationId": "ZaloAds_updateFormAd",
|
|
1356
|
+
"method": "POST",
|
|
1357
|
+
"endpoint": "/zaapi/UpdateAd",
|
|
1411
1358
|
"baseUrl": "https://ads.zalo.me",
|
|
1412
1359
|
"binaryFields": [],
|
|
1413
1360
|
"pathFields": [],
|
|
1414
1361
|
"queryFields": [],
|
|
1415
1362
|
"headerFields": [],
|
|
1416
1363
|
"cookieFields": [],
|
|
1417
|
-
"bodyFields": [
|
|
1364
|
+
"bodyFields": [
|
|
1365
|
+
"est",
|
|
1366
|
+
"stt",
|
|
1367
|
+
"data",
|
|
1368
|
+
"isBoostAd"
|
|
1369
|
+
]
|
|
1418
1370
|
};
|
|
1419
|
-
var
|
|
1420
|
-
"operationId": "
|
|
1421
|
-
"method": "
|
|
1422
|
-
"endpoint": "/
|
|
1371
|
+
var OP_ZaloAdsUpdateMessageAd = {
|
|
1372
|
+
"operationId": "ZaloAds_updateMessageAd",
|
|
1373
|
+
"method": "POST",
|
|
1374
|
+
"endpoint": "/zaapi/UpdateAd",
|
|
1423
1375
|
"baseUrl": "https://ads.zalo.me",
|
|
1424
1376
|
"binaryFields": [],
|
|
1425
1377
|
"pathFields": [],
|
|
1426
1378
|
"queryFields": [],
|
|
1427
1379
|
"headerFields": [],
|
|
1428
1380
|
"cookieFields": [],
|
|
1429
|
-
"bodyFields": [
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
"baseUrl": "https://ads.zalo.me",
|
|
1436
|
-
"binaryFields": [],
|
|
1437
|
-
"pathFields": [],
|
|
1438
|
-
"queryFields": [],
|
|
1439
|
-
"headerFields": [],
|
|
1440
|
-
"cookieFields": [],
|
|
1441
|
-
"bodyFields": []
|
|
1442
|
-
};
|
|
1443
|
-
var OP_ZaloAdsGetReportapiV2Ads = {
|
|
1444
|
-
"operationId": "ZaloAds_getReportapiV2Ads",
|
|
1445
|
-
"method": "GET",
|
|
1446
|
-
"endpoint": "/reportapi/v2/ads",
|
|
1447
|
-
"baseUrl": "https://ads.zalo.me",
|
|
1448
|
-
"binaryFields": [],
|
|
1449
|
-
"pathFields": [],
|
|
1450
|
-
"queryFields": [
|
|
1451
|
-
"to",
|
|
1452
|
-
"from",
|
|
1453
|
-
"filter",
|
|
1454
|
-
"endDate",
|
|
1455
|
-
"refresh",
|
|
1456
|
-
"breakdown",
|
|
1457
|
-
"startDate"
|
|
1458
|
-
],
|
|
1459
|
-
"headerFields": [],
|
|
1460
|
-
"cookieFields": [],
|
|
1461
|
-
"bodyFields": []
|
|
1381
|
+
"bodyFields": [
|
|
1382
|
+
"est",
|
|
1383
|
+
"stt",
|
|
1384
|
+
"data",
|
|
1385
|
+
"isBoostAd"
|
|
1386
|
+
]
|
|
1462
1387
|
};
|
|
1463
|
-
var
|
|
1464
|
-
"operationId": "
|
|
1465
|
-
"method": "
|
|
1466
|
-
"endpoint": "/
|
|
1388
|
+
var OP_ZaloAdsUpdateNewAds = {
|
|
1389
|
+
"operationId": "ZaloAds_UpdateNewAds",
|
|
1390
|
+
"method": "POST",
|
|
1391
|
+
"endpoint": "/zaapi/UploadCrop",
|
|
1467
1392
|
"baseUrl": "https://ads.zalo.me",
|
|
1468
|
-
"binaryFields": [
|
|
1469
|
-
|
|
1470
|
-
"campaignId"
|
|
1471
|
-
],
|
|
1472
|
-
"queryFields": [
|
|
1473
|
-
"startDate",
|
|
1474
|
-
"endDate",
|
|
1475
|
-
"refresh"
|
|
1393
|
+
"binaryFields": [
|
|
1394
|
+
"File"
|
|
1476
1395
|
],
|
|
1477
|
-
"headerFields": [],
|
|
1478
|
-
"cookieFields": [],
|
|
1479
|
-
"bodyFields": []
|
|
1480
|
-
};
|
|
1481
|
-
var OP_ZaloAdsGetReportapiV2UniqueUser = {
|
|
1482
|
-
"operationId": "ZaloAds_getReportapiV2UniqueUser",
|
|
1483
|
-
"method": "GET",
|
|
1484
|
-
"endpoint": "/reportapi/v2/unique-user",
|
|
1485
|
-
"baseUrl": "https://ads.zalo.me",
|
|
1486
|
-
"binaryFields": [],
|
|
1487
1396
|
"pathFields": [],
|
|
1488
1397
|
"queryFields": [],
|
|
1489
1398
|
"headerFields": [],
|
|
1490
1399
|
"cookieFields": [],
|
|
1491
|
-
"bodyFields": [
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
"pathFields": [],
|
|
1500
|
-
"queryFields": [
|
|
1501
|
-
"filter",
|
|
1502
|
-
"endDate",
|
|
1503
|
-
"refresh",
|
|
1504
|
-
"agencyId",
|
|
1505
|
-
"createdBy",
|
|
1506
|
-
"startDate"
|
|
1507
|
-
],
|
|
1508
|
-
"headerFields": [],
|
|
1509
|
-
"cookieFields": [],
|
|
1510
|
-
"bodyFields": []
|
|
1511
|
-
};
|
|
1512
|
-
var OP_ZaloAdsGetZaapiCampaignReportcampaign = {
|
|
1513
|
-
"operationId": "ZaloAds_getZaapiCampaignReportcampaign",
|
|
1514
|
-
"method": "GET",
|
|
1515
|
-
"endpoint": "/zaapi/Campaign/reportCampaign",
|
|
1516
|
-
"baseUrl": "https://ads.zalo.me",
|
|
1517
|
-
"binaryFields": [],
|
|
1518
|
-
"pathFields": [],
|
|
1519
|
-
"queryFields": [
|
|
1520
|
-
"campaignId",
|
|
1521
|
-
"campId"
|
|
1522
|
-
],
|
|
1523
|
-
"headerFields": [],
|
|
1524
|
-
"cookieFields": [],
|
|
1525
|
-
"bodyFields": []
|
|
1526
|
-
};
|
|
1527
|
-
var OP_ZaloAdsGetZaapiCheckcamphasmanyads = {
|
|
1528
|
-
"operationId": "ZaloAds_getZaapiCheckcamphasmanyads",
|
|
1529
|
-
"method": "GET",
|
|
1530
|
-
"endpoint": "/zaapi/checkCampHasManyAds",
|
|
1531
|
-
"baseUrl": "https://ads.zalo.me",
|
|
1532
|
-
"binaryFields": [],
|
|
1533
|
-
"pathFields": [],
|
|
1534
|
-
"queryFields": [
|
|
1535
|
-
"campaignId",
|
|
1536
|
-
"campId"
|
|
1537
|
-
],
|
|
1538
|
-
"headerFields": [],
|
|
1539
|
-
"cookieFields": [],
|
|
1540
|
-
"bodyFields": []
|
|
1400
|
+
"bodyFields": [
|
|
1401
|
+
"File",
|
|
1402
|
+
"x",
|
|
1403
|
+
"y",
|
|
1404
|
+
"width",
|
|
1405
|
+
"height",
|
|
1406
|
+
"scale"
|
|
1407
|
+
]
|
|
1541
1408
|
};
|
|
1542
|
-
var
|
|
1543
|
-
"operationId": "
|
|
1544
|
-
"method": "
|
|
1545
|
-
"endpoint": "/zaapi/
|
|
1409
|
+
var OP_ZaloAdsUpdateOfficialAccountAd = {
|
|
1410
|
+
"operationId": "ZaloAds_updateOfficialAccountAd",
|
|
1411
|
+
"method": "POST",
|
|
1412
|
+
"endpoint": "/zaapi/UpdateAd",
|
|
1546
1413
|
"baseUrl": "https://ads.zalo.me",
|
|
1547
1414
|
"binaryFields": [],
|
|
1548
1415
|
"pathFields": [],
|
|
1549
|
-
"queryFields": [
|
|
1550
|
-
"campaignId",
|
|
1551
|
-
"campId"
|
|
1552
|
-
],
|
|
1416
|
+
"queryFields": [],
|
|
1553
1417
|
"headerFields": [],
|
|
1554
1418
|
"cookieFields": [],
|
|
1555
|
-
"bodyFields": [
|
|
1419
|
+
"bodyFields": [
|
|
1420
|
+
"est",
|
|
1421
|
+
"stt",
|
|
1422
|
+
"data",
|
|
1423
|
+
"isBoostAd"
|
|
1424
|
+
]
|
|
1556
1425
|
};
|
|
1557
|
-
var
|
|
1558
|
-
"operationId": "
|
|
1559
|
-
"method": "
|
|
1560
|
-
"endpoint": "/zaapi/
|
|
1426
|
+
var OP_ZaloAdsUpdatePostAd = {
|
|
1427
|
+
"operationId": "ZaloAds_updatePostAd",
|
|
1428
|
+
"method": "POST",
|
|
1429
|
+
"endpoint": "/zaapi/UpdateAd",
|
|
1561
1430
|
"baseUrl": "https://ads.zalo.me",
|
|
1562
1431
|
"binaryFields": [],
|
|
1563
1432
|
"pathFields": [],
|
|
1564
1433
|
"queryFields": [],
|
|
1565
1434
|
"headerFields": [],
|
|
1566
1435
|
"cookieFields": [],
|
|
1567
|
-
"bodyFields": [
|
|
1436
|
+
"bodyFields": [
|
|
1437
|
+
"est",
|
|
1438
|
+
"stt",
|
|
1439
|
+
"data",
|
|
1440
|
+
"isBoostAd"
|
|
1441
|
+
]
|
|
1568
1442
|
};
|
|
1569
|
-
var
|
|
1570
|
-
"operationId": "
|
|
1571
|
-
"method": "
|
|
1572
|
-
"endpoint": "/zaapi/
|
|
1443
|
+
var OP_ZaloAdsCreateWebsiteCampaign = {
|
|
1444
|
+
"operationId": "ZaloAds_createWebsiteCampaign",
|
|
1445
|
+
"method": "POST",
|
|
1446
|
+
"endpoint": "/zaapi/addNewCamp",
|
|
1573
1447
|
"baseUrl": "https://ads.zalo.me",
|
|
1574
1448
|
"binaryFields": [],
|
|
1575
1449
|
"pathFields": [],
|
|
1576
|
-
"queryFields": [
|
|
1577
|
-
"pageId",
|
|
1578
|
-
"oaId"
|
|
1579
|
-
],
|
|
1450
|
+
"queryFields": [],
|
|
1580
1451
|
"headerFields": [],
|
|
1581
1452
|
"cookieFields": [],
|
|
1582
|
-
"bodyFields": [
|
|
1453
|
+
"bodyFields": [
|
|
1454
|
+
"data"
|
|
1455
|
+
]
|
|
1583
1456
|
};
|
|
1584
|
-
var
|
|
1585
|
-
"operationId": "
|
|
1586
|
-
"method": "
|
|
1587
|
-
"endpoint": "/zaapi/
|
|
1457
|
+
var OP_ZaloAdsUpdateWebsiteAd = {
|
|
1458
|
+
"operationId": "ZaloAds_updateWebsiteAd",
|
|
1459
|
+
"method": "POST",
|
|
1460
|
+
"endpoint": "/zaapi/UpdateAd",
|
|
1588
1461
|
"baseUrl": "https://ads.zalo.me",
|
|
1589
1462
|
"binaryFields": [],
|
|
1590
1463
|
"pathFields": [],
|
|
1591
1464
|
"queryFields": [],
|
|
1592
1465
|
"headerFields": [],
|
|
1593
1466
|
"cookieFields": [],
|
|
1594
|
-
"bodyFields": [
|
|
1467
|
+
"bodyFields": [
|
|
1468
|
+
"est",
|
|
1469
|
+
"stt",
|
|
1470
|
+
"data",
|
|
1471
|
+
"isBoostAd"
|
|
1472
|
+
]
|
|
1595
1473
|
};
|
|
1596
|
-
var
|
|
1597
|
-
"operationId": "
|
|
1598
|
-
"method": "
|
|
1599
|
-
"endpoint": "/
|
|
1474
|
+
var OP_ZaloAdsCreateDisplayCampaign = {
|
|
1475
|
+
"operationId": "ZaloAds_createDisplayCampaign",
|
|
1476
|
+
"method": "POST",
|
|
1477
|
+
"endpoint": "/zaapi/addNewCamp",
|
|
1600
1478
|
"baseUrl": "https://ads.zalo.me",
|
|
1601
1479
|
"binaryFields": [],
|
|
1602
1480
|
"pathFields": [],
|
|
1603
|
-
"queryFields": [
|
|
1604
|
-
"limit",
|
|
1605
|
-
"offset",
|
|
1606
|
-
"joinDateAsc"
|
|
1607
|
-
],
|
|
1481
|
+
"queryFields": [],
|
|
1608
1482
|
"headerFields": [],
|
|
1609
1483
|
"cookieFields": [],
|
|
1610
|
-
"bodyFields": [
|
|
1484
|
+
"bodyFields": [
|
|
1485
|
+
"data"
|
|
1486
|
+
]
|
|
1611
1487
|
};
|
|
1612
|
-
var
|
|
1613
|
-
"operationId": "
|
|
1614
|
-
"method": "
|
|
1615
|
-
"endpoint": "/
|
|
1488
|
+
var OP_ZaloAdsUpdateDisplayAd = {
|
|
1489
|
+
"operationId": "ZaloAds_updateDisplayAd",
|
|
1490
|
+
"method": "POST",
|
|
1491
|
+
"endpoint": "/zaapi/UpdateAd",
|
|
1616
1492
|
"baseUrl": "https://ads.zalo.me",
|
|
1617
1493
|
"binaryFields": [],
|
|
1618
1494
|
"pathFields": [],
|
|
1619
1495
|
"queryFields": [],
|
|
1620
1496
|
"headerFields": [],
|
|
1621
1497
|
"cookieFields": [],
|
|
1622
|
-
"bodyFields": [
|
|
1498
|
+
"bodyFields": [
|
|
1499
|
+
"est",
|
|
1500
|
+
"stt",
|
|
1501
|
+
"data",
|
|
1502
|
+
"isBoostAd"
|
|
1503
|
+
]
|
|
1623
1504
|
};
|
|
1624
|
-
var
|
|
1625
|
-
"operationId": "
|
|
1626
|
-
"method": "
|
|
1627
|
-
"endpoint": "/
|
|
1505
|
+
var OP_ZaloAdsCreateVideoCampaign = {
|
|
1506
|
+
"operationId": "ZaloAds_createVideoCampaign",
|
|
1507
|
+
"method": "POST",
|
|
1508
|
+
"endpoint": "/zaapi/addNewCamp",
|
|
1628
1509
|
"baseUrl": "https://ads.zalo.me",
|
|
1629
1510
|
"binaryFields": [],
|
|
1630
1511
|
"pathFields": [],
|
|
1631
|
-
"queryFields": [
|
|
1632
|
-
"oaId",
|
|
1633
|
-
"isAll"
|
|
1634
|
-
],
|
|
1512
|
+
"queryFields": [],
|
|
1635
1513
|
"headerFields": [],
|
|
1636
1514
|
"cookieFields": [],
|
|
1637
|
-
"bodyFields": [
|
|
1515
|
+
"bodyFields": [
|
|
1516
|
+
"data"
|
|
1517
|
+
]
|
|
1638
1518
|
};
|
|
1639
|
-
var
|
|
1640
|
-
"operationId": "
|
|
1641
|
-
"method": "
|
|
1642
|
-
"endpoint": "/api/
|
|
1519
|
+
var OP_ZaloAdsDeleteCampaign = {
|
|
1520
|
+
"operationId": "ZaloAds_deleteCampaign",
|
|
1521
|
+
"method": "POST",
|
|
1522
|
+
"endpoint": "/api/campaign/change-status",
|
|
1643
1523
|
"baseUrl": "https://ads.zalo.me",
|
|
1644
1524
|
"binaryFields": [],
|
|
1645
1525
|
"pathFields": [],
|
|
1646
|
-
"queryFields": [
|
|
1647
|
-
"templateIds"
|
|
1648
|
-
],
|
|
1526
|
+
"queryFields": [],
|
|
1649
1527
|
"headerFields": [],
|
|
1650
1528
|
"cookieFields": [],
|
|
1651
|
-
"bodyFields": [
|
|
1529
|
+
"bodyFields": [
|
|
1530
|
+
"campaignId",
|
|
1531
|
+
"status"
|
|
1532
|
+
]
|
|
1652
1533
|
};
|
|
1653
|
-
var
|
|
1654
|
-
|
|
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",
|
|
1655
1688
|
"method": "GET",
|
|
1656
|
-
"endpoint": "/api/
|
|
1689
|
+
"endpoint": "/api/whoami",
|
|
1657
1690
|
"baseUrl": "https://ads.zalo.me",
|
|
1658
1691
|
"binaryFields": [],
|
|
1659
1692
|
"pathFields": [],
|
|
@@ -1662,165 +1695,150 @@ var OP_ZaloAdsListPersonalPixelLabels = {
|
|
|
1662
1695
|
"cookieFields": [],
|
|
1663
1696
|
"bodyFields": []
|
|
1664
1697
|
};
|
|
1665
|
-
var
|
|
1666
|
-
"operationId": "
|
|
1667
|
-
"method": "
|
|
1668
|
-
"endpoint": "/api/
|
|
1669
|
-
"baseUrl": "https://ads.zalo.me",
|
|
1670
|
-
"binaryFields": [],
|
|
1671
|
-
"pathFields": [],
|
|
1672
|
-
"queryFields": [],
|
|
1673
|
-
"headerFields": [],
|
|
1674
|
-
"cookieFields": [],
|
|
1675
|
-
"bodyFields": [
|
|
1676
|
-
"gender",
|
|
1677
|
-
"number",
|
|
1678
|
-
"ageRanges",
|
|
1679
|
-
"locations",
|
|
1680
|
-
"platforms",
|
|
1681
|
-
"priceType",
|
|
1682
|
-
"provinces",
|
|
1683
|
-
"wardsTargeting",
|
|
1684
|
-
"districtsTargeting"
|
|
1685
|
-
]
|
|
1686
|
-
};
|
|
1687
|
-
var OP_ZaloAdsPostApiMediaSave = {
|
|
1688
|
-
"operationId": "ZaloAds_postApiMediaSave",
|
|
1689
|
-
"method": "POST",
|
|
1690
|
-
"endpoint": "/api/media/save",
|
|
1698
|
+
var OP_ZaloAdsGetApiPaymentTransactionHistory = {
|
|
1699
|
+
"operationId": "ZaloAds_getApiPaymentTransactionHistory",
|
|
1700
|
+
"method": "GET",
|
|
1701
|
+
"endpoint": "/api/payment/transaction-history",
|
|
1691
1702
|
"baseUrl": "https://ads.zalo.me",
|
|
1692
1703
|
"binaryFields": [],
|
|
1693
1704
|
"pathFields": [],
|
|
1694
|
-
"queryFields": [
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
"data"
|
|
1699
|
-
]
|
|
1700
|
-
};
|
|
1701
|
-
var OP_ZaloAdsPostApiMemberUploadImage = {
|
|
1702
|
-
"operationId": "ZaloAds_postApiMemberUploadImage",
|
|
1703
|
-
"method": "POST",
|
|
1704
|
-
"endpoint": "/api/member/upload-image",
|
|
1705
|
-
"baseUrl": "https://ads.zalo.me",
|
|
1706
|
-
"binaryFields": [
|
|
1707
|
-
"file"
|
|
1705
|
+
"queryFields": [
|
|
1706
|
+
"to",
|
|
1707
|
+
"from",
|
|
1708
|
+
"memberId"
|
|
1708
1709
|
],
|
|
1709
|
-
"pathFields": [],
|
|
1710
|
-
"queryFields": [],
|
|
1711
1710
|
"headerFields": [],
|
|
1712
1711
|
"cookieFields": [],
|
|
1713
|
-
"bodyFields": [
|
|
1714
|
-
"file"
|
|
1715
|
-
]
|
|
1712
|
+
"bodyFields": []
|
|
1716
1713
|
};
|
|
1717
|
-
var
|
|
1718
|
-
"operationId": "
|
|
1719
|
-
"method": "
|
|
1720
|
-
"endpoint": "/
|
|
1714
|
+
var OP_ZaloAdsGetApiBaAccountAllaccessors = {
|
|
1715
|
+
"operationId": "ZaloAds_getApiBaAccountAllaccessors",
|
|
1716
|
+
"method": "GET",
|
|
1717
|
+
"endpoint": "/api/ba/account/allAccessors",
|
|
1721
1718
|
"baseUrl": "https://ads.zalo.me",
|
|
1722
1719
|
"binaryFields": [],
|
|
1723
1720
|
"pathFields": [],
|
|
1724
1721
|
"queryFields": [
|
|
1725
|
-
"
|
|
1722
|
+
"isShowAll"
|
|
1726
1723
|
],
|
|
1727
1724
|
"headerFields": [],
|
|
1728
1725
|
"cookieFields": [],
|
|
1729
|
-
"bodyFields": [
|
|
1730
|
-
"adId"
|
|
1731
|
-
]
|
|
1726
|
+
"bodyFields": []
|
|
1732
1727
|
};
|
|
1733
|
-
var
|
|
1734
|
-
"operationId": "
|
|
1735
|
-
"method": "
|
|
1736
|
-
"endpoint": "/api/
|
|
1728
|
+
var OP_ZaloAdsGetApiBaAccountAllgrantedmembers = {
|
|
1729
|
+
"operationId": "ZaloAds_getApiBaAccountAllgrantedmembers",
|
|
1730
|
+
"method": "GET",
|
|
1731
|
+
"endpoint": "/api/ba/account/allGrantedMembers",
|
|
1737
1732
|
"baseUrl": "https://ads.zalo.me",
|
|
1738
1733
|
"binaryFields": [],
|
|
1739
1734
|
"pathFields": [],
|
|
1740
1735
|
"queryFields": [],
|
|
1741
1736
|
"headerFields": [],
|
|
1742
1737
|
"cookieFields": [],
|
|
1743
|
-
"bodyFields": [
|
|
1744
|
-
"campid",
|
|
1745
|
-
"newname"
|
|
1746
|
-
]
|
|
1738
|
+
"bodyFields": []
|
|
1747
1739
|
};
|
|
1748
|
-
var
|
|
1749
|
-
"operationId": "
|
|
1750
|
-
"method": "
|
|
1751
|
-
"endpoint": "/
|
|
1740
|
+
var OP_ZaloAdsListAgencyCustomersWithBudget = {
|
|
1741
|
+
"operationId": "ZaloAds_listAgencyCustomersWithBudget",
|
|
1742
|
+
"method": "GET",
|
|
1743
|
+
"endpoint": "/api/ba/agency/customersWithBudget",
|
|
1752
1744
|
"baseUrl": "https://ads.zalo.me",
|
|
1753
1745
|
"binaryFields": [],
|
|
1754
1746
|
"pathFields": [],
|
|
1755
|
-
"queryFields": [
|
|
1747
|
+
"queryFields": [
|
|
1748
|
+
"limit",
|
|
1749
|
+
"offset",
|
|
1750
|
+
"joinDateAsc"
|
|
1751
|
+
],
|
|
1756
1752
|
"headerFields": [],
|
|
1757
1753
|
"cookieFields": [],
|
|
1758
|
-
"bodyFields": [
|
|
1759
|
-
"est",
|
|
1760
|
-
"stt",
|
|
1761
|
-
"data",
|
|
1762
|
-
"isBoostAd"
|
|
1763
|
-
]
|
|
1754
|
+
"bodyFields": []
|
|
1764
1755
|
};
|
|
1765
|
-
var
|
|
1766
|
-
"operationId": "
|
|
1767
|
-
"method": "
|
|
1768
|
-
"endpoint": "/
|
|
1756
|
+
var OP_ZaloAdsGetApiNotifiesHeader = {
|
|
1757
|
+
"operationId": "ZaloAds_getApiNotifiesHeader",
|
|
1758
|
+
"method": "GET",
|
|
1759
|
+
"endpoint": "/api/notifies/header",
|
|
1769
1760
|
"baseUrl": "https://ads.zalo.me",
|
|
1770
1761
|
"binaryFields": [],
|
|
1771
1762
|
"pathFields": [],
|
|
1772
1763
|
"queryFields": [],
|
|
1773
1764
|
"headerFields": [],
|
|
1774
1765
|
"cookieFields": [],
|
|
1775
|
-
"bodyFields": [
|
|
1776
|
-
"est",
|
|
1777
|
-
"stt",
|
|
1778
|
-
"data",
|
|
1779
|
-
"isBoostAd"
|
|
1780
|
-
]
|
|
1766
|
+
"bodyFields": []
|
|
1781
1767
|
};
|
|
1782
|
-
var
|
|
1783
|
-
"operationId": "
|
|
1784
|
-
"method": "
|
|
1785
|
-
"endpoint": "/
|
|
1768
|
+
var OP_ZaloAdsGetApiLpNews = {
|
|
1769
|
+
"operationId": "ZaloAds_getApiLpNews",
|
|
1770
|
+
"method": "GET",
|
|
1771
|
+
"endpoint": "/api/lp-news",
|
|
1786
1772
|
"baseUrl": "https://ads.zalo.me",
|
|
1787
1773
|
"binaryFields": [],
|
|
1788
1774
|
"pathFields": [],
|
|
1789
1775
|
"queryFields": [],
|
|
1790
1776
|
"headerFields": [],
|
|
1791
1777
|
"cookieFields": [],
|
|
1792
|
-
"bodyFields": [
|
|
1793
|
-
"est",
|
|
1794
|
-
"stt",
|
|
1795
|
-
"data",
|
|
1796
|
-
"isBoostAd"
|
|
1797
|
-
]
|
|
1778
|
+
"bodyFields": []
|
|
1798
1779
|
};
|
|
1799
|
-
var
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
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
|
+
}
|
|
1819
1835
|
};
|
|
1820
|
-
|
|
1821
|
-
|
|
1836
|
+
|
|
1837
|
+
// src/services/audiences.service.ts
|
|
1838
|
+
var OP_ZaloAdsCreateCustomAudience = {
|
|
1839
|
+
"operationId": "ZaloAds_createCustomAudience",
|
|
1822
1840
|
"method": "POST",
|
|
1823
|
-
"endpoint": "/
|
|
1841
|
+
"endpoint": "/api/ad/audience",
|
|
1824
1842
|
"baseUrl": "https://ads.zalo.me",
|
|
1825
1843
|
"binaryFields": [],
|
|
1826
1844
|
"pathFields": [],
|
|
@@ -1828,64 +1846,55 @@ var OP_ZaloAdsUpdateOfficialAccountAd = {
|
|
|
1828
1846
|
"headerFields": [],
|
|
1829
1847
|
"cookieFields": [],
|
|
1830
1848
|
"bodyFields": [
|
|
1831
|
-
"
|
|
1832
|
-
"
|
|
1833
|
-
"
|
|
1834
|
-
"isBoostAd"
|
|
1849
|
+
"name",
|
|
1850
|
+
"caType",
|
|
1851
|
+
"targeting"
|
|
1835
1852
|
]
|
|
1836
1853
|
};
|
|
1837
|
-
var
|
|
1838
|
-
"operationId": "
|
|
1839
|
-
"method": "
|
|
1840
|
-
"endpoint": "/
|
|
1854
|
+
var OP_ZaloAdsDeleteCustomAudience = {
|
|
1855
|
+
"operationId": "ZaloAds_deleteCustomAudience",
|
|
1856
|
+
"method": "DELETE",
|
|
1857
|
+
"endpoint": "/api/ad/audience/{customAudienceId}",
|
|
1841
1858
|
"baseUrl": "https://ads.zalo.me",
|
|
1842
1859
|
"binaryFields": [],
|
|
1843
|
-
"pathFields": [
|
|
1860
|
+
"pathFields": [
|
|
1861
|
+
"customAudienceId"
|
|
1862
|
+
],
|
|
1844
1863
|
"queryFields": [],
|
|
1845
1864
|
"headerFields": [],
|
|
1846
1865
|
"cookieFields": [],
|
|
1847
|
-
"bodyFields": [
|
|
1848
|
-
"est",
|
|
1849
|
-
"stt",
|
|
1850
|
-
"data",
|
|
1851
|
-
"isBoostAd"
|
|
1852
|
-
]
|
|
1866
|
+
"bodyFields": []
|
|
1853
1867
|
};
|
|
1854
|
-
var
|
|
1855
|
-
"operationId": "
|
|
1856
|
-
"method": "
|
|
1857
|
-
"endpoint": "/
|
|
1868
|
+
var OP_ZaloAdsGetApiAdGetlistadadvancetargeting = {
|
|
1869
|
+
"operationId": "ZaloAds_getApiAdGetlistadadvancetargeting",
|
|
1870
|
+
"method": "GET",
|
|
1871
|
+
"endpoint": "/api/ad/getListAdAdvanceTargeting",
|
|
1858
1872
|
"baseUrl": "https://ads.zalo.me",
|
|
1859
1873
|
"binaryFields": [],
|
|
1860
1874
|
"pathFields": [],
|
|
1861
1875
|
"queryFields": [],
|
|
1862
1876
|
"headerFields": [],
|
|
1863
1877
|
"cookieFields": [],
|
|
1864
|
-
"bodyFields": [
|
|
1865
|
-
"data"
|
|
1866
|
-
]
|
|
1878
|
+
"bodyFields": []
|
|
1867
1879
|
};
|
|
1868
|
-
var
|
|
1869
|
-
"operationId": "
|
|
1870
|
-
"method": "
|
|
1871
|
-
"endpoint": "/
|
|
1880
|
+
var OP_ZaloAdsGetApiCustomAudienceAll = {
|
|
1881
|
+
"operationId": "ZaloAds_getApiCustomAudienceAll",
|
|
1882
|
+
"method": "GET",
|
|
1883
|
+
"endpoint": "/api/custom-audience/all",
|
|
1872
1884
|
"baseUrl": "https://ads.zalo.me",
|
|
1873
1885
|
"binaryFields": [],
|
|
1874
1886
|
"pathFields": [],
|
|
1875
|
-
"queryFields": [
|
|
1887
|
+
"queryFields": [
|
|
1888
|
+
"newWard"
|
|
1889
|
+
],
|
|
1876
1890
|
"headerFields": [],
|
|
1877
1891
|
"cookieFields": [],
|
|
1878
|
-
"bodyFields": [
|
|
1879
|
-
"est",
|
|
1880
|
-
"stt",
|
|
1881
|
-
"data",
|
|
1882
|
-
"isBoostAd"
|
|
1883
|
-
]
|
|
1892
|
+
"bodyFields": []
|
|
1884
1893
|
};
|
|
1885
|
-
var
|
|
1886
|
-
"operationId": "
|
|
1894
|
+
var OP_ZaloAdsPostApiAdEstimateaudience = {
|
|
1895
|
+
"operationId": "ZaloAds_postApiAdEstimateaudience",
|
|
1887
1896
|
"method": "POST",
|
|
1888
|
-
"endpoint": "/
|
|
1897
|
+
"endpoint": "/api/ad/estimateAudience",
|
|
1889
1898
|
"baseUrl": "https://ads.zalo.me",
|
|
1890
1899
|
"binaryFields": [],
|
|
1891
1900
|
"pathFields": [],
|
|
@@ -1893,190 +1902,292 @@ var OP_ZaloAdsCreateDisplayCampaign = {
|
|
|
1893
1902
|
"headerFields": [],
|
|
1894
1903
|
"cookieFields": [],
|
|
1895
1904
|
"bodyFields": [
|
|
1896
|
-
"
|
|
1905
|
+
"gender",
|
|
1906
|
+
"number",
|
|
1907
|
+
"ageRanges",
|
|
1908
|
+
"locations",
|
|
1909
|
+
"platforms",
|
|
1910
|
+
"priceType",
|
|
1911
|
+
"provinces",
|
|
1912
|
+
"wardsTargeting",
|
|
1913
|
+
"districtsTargeting"
|
|
1897
1914
|
]
|
|
1898
1915
|
};
|
|
1899
|
-
var
|
|
1900
|
-
"operationId": "
|
|
1916
|
+
var OP_ZaloAdsUploadCustomAudiencePhoneList = {
|
|
1917
|
+
"operationId": "ZaloAds_uploadCustomAudiencePhoneList",
|
|
1901
1918
|
"method": "POST",
|
|
1902
|
-
"endpoint": "/zaapi/
|
|
1919
|
+
"endpoint": "/zaapi/uploadPhoneList",
|
|
1903
1920
|
"baseUrl": "https://ads.zalo.me",
|
|
1904
|
-
"binaryFields": [
|
|
1921
|
+
"binaryFields": [
|
|
1922
|
+
"File"
|
|
1923
|
+
],
|
|
1905
1924
|
"pathFields": [],
|
|
1906
1925
|
"queryFields": [],
|
|
1907
1926
|
"headerFields": [],
|
|
1908
1927
|
"cookieFields": [],
|
|
1909
1928
|
"bodyFields": [
|
|
1910
|
-
"
|
|
1911
|
-
"
|
|
1912
|
-
"data",
|
|
1913
|
-
"isBoostAd"
|
|
1929
|
+
"File",
|
|
1930
|
+
"isHash"
|
|
1914
1931
|
]
|
|
1915
1932
|
};
|
|
1916
|
-
var
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
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
|
+
}
|
|
2024
|
+
};
|
|
2025
|
+
|
|
2026
|
+
// src/services/reports.service.ts
|
|
2027
|
+
var OP_ZaloAdsGetReportapiV2Ads = {
|
|
2028
|
+
"operationId": "ZaloAds_getReportapiV2Ads",
|
|
2029
|
+
"method": "GET",
|
|
2030
|
+
"endpoint": "/reportapi/v2/ads",
|
|
1920
2031
|
"baseUrl": "https://ads.zalo.me",
|
|
1921
2032
|
"binaryFields": [],
|
|
1922
2033
|
"pathFields": [],
|
|
1923
|
-
"queryFields": [
|
|
2034
|
+
"queryFields": [
|
|
2035
|
+
"to",
|
|
2036
|
+
"from",
|
|
2037
|
+
"filter",
|
|
2038
|
+
"endDate",
|
|
2039
|
+
"refresh",
|
|
2040
|
+
"breakdown",
|
|
2041
|
+
"startDate"
|
|
2042
|
+
],
|
|
1924
2043
|
"headerFields": [],
|
|
1925
2044
|
"cookieFields": [],
|
|
1926
|
-
"bodyFields": [
|
|
1927
|
-
"data"
|
|
1928
|
-
]
|
|
2045
|
+
"bodyFields": []
|
|
1929
2046
|
};
|
|
1930
|
-
var
|
|
1931
|
-
"operationId": "
|
|
1932
|
-
"method": "
|
|
1933
|
-
"endpoint": "/
|
|
2047
|
+
var OP_ZaloAdsGetReportapiV2Campaigns = {
|
|
2048
|
+
"operationId": "ZaloAds_getReportapiV2Campaigns",
|
|
2049
|
+
"method": "GET",
|
|
2050
|
+
"endpoint": "/reportapi/v2/campaigns/{campaignId}",
|
|
1934
2051
|
"baseUrl": "https://ads.zalo.me",
|
|
1935
2052
|
"binaryFields": [],
|
|
1936
|
-
"pathFields": [
|
|
1937
|
-
|
|
2053
|
+
"pathFields": [
|
|
2054
|
+
"campaignId"
|
|
2055
|
+
],
|
|
2056
|
+
"queryFields": [
|
|
2057
|
+
"startDate",
|
|
2058
|
+
"endDate",
|
|
2059
|
+
"refresh"
|
|
2060
|
+
],
|
|
1938
2061
|
"headerFields": [],
|
|
1939
2062
|
"cookieFields": [],
|
|
1940
|
-
"bodyFields": [
|
|
1941
|
-
"campaignId",
|
|
1942
|
-
"status"
|
|
1943
|
-
]
|
|
2063
|
+
"bodyFields": []
|
|
1944
2064
|
};
|
|
1945
|
-
var
|
|
1946
|
-
"operationId": "
|
|
2065
|
+
var OP_ZaloAdsGetReportapiV2UniqueUser = {
|
|
2066
|
+
"operationId": "ZaloAds_getReportapiV2UniqueUser",
|
|
1947
2067
|
"method": "GET",
|
|
1948
|
-
"endpoint": "/
|
|
2068
|
+
"endpoint": "/reportapi/v2/unique-user",
|
|
1949
2069
|
"baseUrl": "https://ads.zalo.me",
|
|
1950
2070
|
"binaryFields": [],
|
|
1951
2071
|
"pathFields": [],
|
|
1952
2072
|
"queryFields": [
|
|
1953
|
-
"
|
|
2073
|
+
"start",
|
|
2074
|
+
"end",
|
|
2075
|
+
"campaignId",
|
|
2076
|
+
"adId"
|
|
1954
2077
|
],
|
|
1955
2078
|
"headerFields": [],
|
|
1956
2079
|
"cookieFields": [],
|
|
1957
2080
|
"bodyFields": []
|
|
1958
2081
|
};
|
|
1959
|
-
var
|
|
1960
|
-
"operationId": "
|
|
1961
|
-
"method": "
|
|
1962
|
-
"endpoint": "/
|
|
2082
|
+
var OP_ZaloAdsGetReportapiV3Campaigns = {
|
|
2083
|
+
"operationId": "ZaloAds_getReportapiV3Campaigns",
|
|
2084
|
+
"method": "GET",
|
|
2085
|
+
"endpoint": "/reportapi/v3/campaigns",
|
|
1963
2086
|
"baseUrl": "https://ads.zalo.me",
|
|
1964
2087
|
"binaryFields": [],
|
|
1965
2088
|
"pathFields": [],
|
|
1966
|
-
"queryFields": [
|
|
1967
|
-
|
|
2089
|
+
"queryFields": [
|
|
2090
|
+
"filter",
|
|
2091
|
+
"endDate",
|
|
2092
|
+
"refresh",
|
|
2093
|
+
"agencyId",
|
|
2094
|
+
"createdBy",
|
|
2095
|
+
"startDate"
|
|
2096
|
+
],
|
|
2097
|
+
"headerFields": [],
|
|
1968
2098
|
"cookieFields": [],
|
|
1969
|
-
"bodyFields": [
|
|
1970
|
-
"scope",
|
|
1971
|
-
"appliedTo",
|
|
1972
|
-
"ruleName",
|
|
1973
|
-
"action",
|
|
1974
|
-
"conditions",
|
|
1975
|
-
"frequency",
|
|
1976
|
-
"appliedIds",
|
|
1977
|
-
"schedule",
|
|
1978
|
-
"campaignIds",
|
|
1979
|
-
"adIds"
|
|
1980
|
-
]
|
|
2099
|
+
"bodyFields": []
|
|
1981
2100
|
};
|
|
1982
|
-
var
|
|
1983
|
-
"operationId": "
|
|
1984
|
-
"method": "
|
|
1985
|
-
"endpoint": "/
|
|
2101
|
+
var OP_ZaloAdsGetReportOverview = {
|
|
2102
|
+
"operationId": "ZaloAds_getReportOverview",
|
|
2103
|
+
"method": "GET",
|
|
2104
|
+
"endpoint": "/reportapi/report/overview",
|
|
1986
2105
|
"baseUrl": "https://ads.zalo.me",
|
|
1987
2106
|
"binaryFields": [],
|
|
1988
2107
|
"pathFields": [],
|
|
1989
|
-
"queryFields": [
|
|
2108
|
+
"queryFields": [
|
|
2109
|
+
"data"
|
|
2110
|
+
],
|
|
1990
2111
|
"headerFields": [],
|
|
1991
2112
|
"cookieFields": [],
|
|
1992
|
-
"bodyFields": [
|
|
1993
|
-
"automatedRuleId",
|
|
1994
|
-
"rowVersion",
|
|
1995
|
-
"appliedTo",
|
|
1996
|
-
"ruleName",
|
|
1997
|
-
"action",
|
|
1998
|
-
"conditions",
|
|
1999
|
-
"schedule",
|
|
2000
|
-
"campaignIds",
|
|
2001
|
-
"adIds"
|
|
2002
|
-
]
|
|
2113
|
+
"bodyFields": []
|
|
2003
2114
|
};
|
|
2004
|
-
var
|
|
2005
|
-
"operationId": "
|
|
2006
|
-
"method": "
|
|
2007
|
-
"endpoint": "/api/
|
|
2115
|
+
var OP_ZaloAdsGetDemographicsReport = {
|
|
2116
|
+
"operationId": "ZaloAds_getDemographicsReport",
|
|
2117
|
+
"method": "GET",
|
|
2118
|
+
"endpoint": "/api/demographics/report",
|
|
2008
2119
|
"baseUrl": "https://ads.zalo.me",
|
|
2009
2120
|
"binaryFields": [],
|
|
2010
2121
|
"pathFields": [],
|
|
2011
|
-
"queryFields": [
|
|
2122
|
+
"queryFields": [
|
|
2123
|
+
"campaignId",
|
|
2124
|
+
"adId",
|
|
2125
|
+
"startDate",
|
|
2126
|
+
"endDate",
|
|
2127
|
+
"agencyId",
|
|
2128
|
+
"from",
|
|
2129
|
+
"to"
|
|
2130
|
+
],
|
|
2012
2131
|
"headerFields": [],
|
|
2013
2132
|
"cookieFields": [],
|
|
2014
|
-
"bodyFields": [
|
|
2015
|
-
"automatedRuleId",
|
|
2016
|
-
"automatedRuleIds",
|
|
2017
|
-
"status"
|
|
2018
|
-
]
|
|
2133
|
+
"bodyFields": []
|
|
2019
2134
|
};
|
|
2020
|
-
var
|
|
2021
|
-
"operationId": "
|
|
2022
|
-
"method": "
|
|
2023
|
-
"endpoint": "/
|
|
2135
|
+
var OP_ZaloAdsDeleteCustomReport = {
|
|
2136
|
+
"operationId": "ZaloAds_deleteCustomReport",
|
|
2137
|
+
"method": "POST",
|
|
2138
|
+
"endpoint": "/reportapi/custom-report/delete/{id}",
|
|
2024
2139
|
"baseUrl": "https://ads.zalo.me",
|
|
2025
2140
|
"binaryFields": [],
|
|
2026
2141
|
"pathFields": [
|
|
2027
|
-
"
|
|
2142
|
+
"id"
|
|
2028
2143
|
],
|
|
2029
2144
|
"queryFields": [],
|
|
2030
2145
|
"headerFields": [],
|
|
2031
2146
|
"cookieFields": [],
|
|
2032
2147
|
"bodyFields": []
|
|
2033
2148
|
};
|
|
2034
|
-
var
|
|
2035
|
-
"operationId": "
|
|
2036
|
-
"method": "
|
|
2037
|
-
"endpoint": "/api/
|
|
2149
|
+
var OP_ZaloAdsListReportFilters = {
|
|
2150
|
+
"operationId": "ZaloAds_listReportFilters",
|
|
2151
|
+
"method": "GET",
|
|
2152
|
+
"endpoint": "/reportapi/api/filter/list",
|
|
2038
2153
|
"baseUrl": "https://ads.zalo.me",
|
|
2039
2154
|
"binaryFields": [],
|
|
2040
2155
|
"pathFields": [],
|
|
2041
|
-
"queryFields": [
|
|
2156
|
+
"queryFields": [
|
|
2157
|
+
"model"
|
|
2158
|
+
],
|
|
2042
2159
|
"headerFields": [],
|
|
2043
2160
|
"cookieFields": [],
|
|
2044
|
-
"bodyFields": [
|
|
2045
|
-
"automatedRuleIds"
|
|
2046
|
-
]
|
|
2161
|
+
"bodyFields": []
|
|
2047
2162
|
};
|
|
2048
|
-
var
|
|
2049
|
-
"operationId": "
|
|
2050
|
-
"method": "
|
|
2051
|
-
"endpoint": "/zaapi/
|
|
2163
|
+
var OP_ZaloAdsGetZaapiCampaignReportcampaign = {
|
|
2164
|
+
"operationId": "ZaloAds_getZaapiCampaignReportcampaign",
|
|
2165
|
+
"method": "GET",
|
|
2166
|
+
"endpoint": "/zaapi/Campaign/reportCampaign",
|
|
2052
2167
|
"baseUrl": "https://ads.zalo.me",
|
|
2053
|
-
"binaryFields": [
|
|
2054
|
-
"File"
|
|
2055
|
-
],
|
|
2168
|
+
"binaryFields": [],
|
|
2056
2169
|
"pathFields": [],
|
|
2057
|
-
"queryFields": [
|
|
2170
|
+
"queryFields": [
|
|
2171
|
+
"campaignId",
|
|
2172
|
+
"campId",
|
|
2173
|
+
"from",
|
|
2174
|
+
"to"
|
|
2175
|
+
],
|
|
2058
2176
|
"headerFields": [],
|
|
2059
2177
|
"cookieFields": [],
|
|
2060
|
-
"bodyFields": [
|
|
2061
|
-
"File",
|
|
2062
|
-
"isHash"
|
|
2063
|
-
]
|
|
2178
|
+
"bodyFields": []
|
|
2064
2179
|
};
|
|
2065
|
-
var
|
|
2066
|
-
"operationId": "
|
|
2067
|
-
"method": "
|
|
2068
|
-
"endpoint": "/
|
|
2180
|
+
var OP_ZaloAdsListCustomReports = {
|
|
2181
|
+
"operationId": "ZaloAds_listCustomReports",
|
|
2182
|
+
"method": "GET",
|
|
2183
|
+
"endpoint": "/reportapi/custom-report/list",
|
|
2069
2184
|
"baseUrl": "https://ads.zalo.me",
|
|
2070
|
-
"binaryFields": [
|
|
2071
|
-
"File"
|
|
2072
|
-
],
|
|
2185
|
+
"binaryFields": [],
|
|
2073
2186
|
"pathFields": [],
|
|
2074
2187
|
"queryFields": [],
|
|
2075
2188
|
"headerFields": [],
|
|
2076
2189
|
"cookieFields": [],
|
|
2077
|
-
"bodyFields": [
|
|
2078
|
-
"File"
|
|
2079
|
-
]
|
|
2190
|
+
"bodyFields": []
|
|
2080
2191
|
};
|
|
2081
2192
|
var OP_ZaloAdsUpsertCustomReport = {
|
|
2082
2193
|
"operationId": "ZaloAds_upsertCustomReport",
|
|
@@ -2095,76 +2206,320 @@ var OP_ZaloAdsUpsertCustomReport = {
|
|
|
2095
2206
|
"isDefault"
|
|
2096
2207
|
]
|
|
2097
2208
|
};
|
|
2098
|
-
var
|
|
2209
|
+
var ZaloReportsService = class {
|
|
2099
2210
|
constructor(client) {
|
|
2100
2211
|
this.client = client;
|
|
2101
2212
|
}
|
|
2102
|
-
|
|
2103
|
-
return this.client.
|
|
2213
|
+
getReportapiV2Ads(request, options) {
|
|
2214
|
+
return this.client.requestWithoutBody(OP_ZaloAdsGetReportapiV2Ads, this.client.toTransportInput(OP_ZaloAdsGetReportapiV2Ads, request), options);
|
|
2104
2215
|
}
|
|
2105
|
-
|
|
2106
|
-
return this.client.
|
|
2216
|
+
getReportapiV2Campaigns(request = {}, options) {
|
|
2217
|
+
return this.client.requestWithoutBody(OP_ZaloAdsGetReportapiV2Campaigns, this.client.toTransportInput(OP_ZaloAdsGetReportapiV2Campaigns, request), options);
|
|
2107
2218
|
}
|
|
2108
|
-
|
|
2109
|
-
return this.client.
|
|
2219
|
+
getReportapiV2UniqueUser(request, options) {
|
|
2220
|
+
return this.client.requestWithoutBody(OP_ZaloAdsGetReportapiV2UniqueUser, this.client.toTransportInput(OP_ZaloAdsGetReportapiV2UniqueUser, request), options);
|
|
2110
2221
|
}
|
|
2111
|
-
|
|
2112
|
-
|
|
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);
|
|
2113
2229
|
}
|
|
2114
|
-
|
|
2115
|
-
return this.client.
|
|
2230
|
+
getReportOverview(request, options) {
|
|
2231
|
+
return this.client.requestWithoutBody(OP_ZaloAdsGetReportOverview, this.client.toTransportInput(OP_ZaloAdsGetReportOverview, request), options);
|
|
2116
2232
|
}
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
return this.client.requestFormUrlEncoded(OP_ZaloAdsDeleteCampaign, this.client.toTransportInput(OP_ZaloAdsDeleteCampaign, payload), options);
|
|
2233
|
+
getDemographicsReport(request, options) {
|
|
2234
|
+
return this.client.requestWithoutBody(OP_ZaloAdsGetDemographicsReport, this.client.toTransportInput(OP_ZaloAdsGetDemographicsReport, request), options);
|
|
2120
2235
|
}
|
|
2121
|
-
|
|
2122
|
-
return this.client.
|
|
2236
|
+
getZaapiCampaignReportcampaign(request, options) {
|
|
2237
|
+
return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiCampaignReportcampaign, this.client.toTransportInput(OP_ZaloAdsGetZaapiCampaignReportcampaign, request), options);
|
|
2123
2238
|
}
|
|
2124
|
-
|
|
2125
|
-
return this.client.
|
|
2239
|
+
listCustomReports(request = {}, options) {
|
|
2240
|
+
return this.client.requestWithoutBody(OP_ZaloAdsListCustomReports, this.client.toTransportInput(OP_ZaloAdsListCustomReports, request), options);
|
|
2126
2241
|
}
|
|
2127
|
-
|
|
2128
|
-
return this.client.
|
|
2242
|
+
upsertCustomReport(request, options) {
|
|
2243
|
+
return this.client.requestJson(OP_ZaloAdsUpsertCustomReport, this.client.toTransportInput(OP_ZaloAdsUpsertCustomReport, request), options);
|
|
2129
2244
|
}
|
|
2130
|
-
|
|
2131
|
-
return this.client.
|
|
2245
|
+
deleteCustomReport(request, options) {
|
|
2246
|
+
return this.client.requestJson(OP_ZaloAdsDeleteCustomReport, this.client.toTransportInput(OP_ZaloAdsDeleteCustomReport, request), options);
|
|
2132
2247
|
}
|
|
2133
|
-
|
|
2134
|
-
return this.client.
|
|
2248
|
+
listReportFilters(request, options) {
|
|
2249
|
+
return this.client.requestWithoutBody(OP_ZaloAdsListReportFilters, this.client.toTransportInput(OP_ZaloAdsListReportFilters, request), options);
|
|
2135
2250
|
}
|
|
2136
|
-
|
|
2137
|
-
|
|
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);
|
|
2138
2254
|
}
|
|
2139
|
-
|
|
2140
|
-
|
|
2255
|
+
/** Báo cáo hiệu quả chiến dịch (API V2) */
|
|
2256
|
+
getCampaignReportV2(...args) {
|
|
2257
|
+
return this.getReportapiV2Campaigns(...args);
|
|
2141
2258
|
}
|
|
2142
|
-
/**
|
|
2143
|
-
|
|
2144
|
-
return this.
|
|
2259
|
+
/** Báo cáo hiệu quả quảng cáo (API V2) */
|
|
2260
|
+
getAdsReportV2(...args) {
|
|
2261
|
+
return this.getReportapiV2Ads(...args);
|
|
2145
2262
|
}
|
|
2146
|
-
|
|
2147
|
-
|
|
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);
|
|
2148
2266
|
}
|
|
2149
|
-
|
|
2150
|
-
|
|
2267
|
+
/** Báo cáo chiến dịch theo ngày/tháng (Legacy ZAAPI) */
|
|
2268
|
+
getCampaignReportLegacy(...args) {
|
|
2269
|
+
return this.getZaapiCampaignReportcampaign(...args);
|
|
2151
2270
|
}
|
|
2152
|
-
|
|
2153
|
-
|
|
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;
|
|
2154
2347
|
}
|
|
2155
|
-
|
|
2156
|
-
return this.client.
|
|
2348
|
+
createConversion(request, options) {
|
|
2349
|
+
return this.client.requestJson(OP_ZaloAdsCreateConversion, this.client.toTransportInput(OP_ZaloAdsCreateConversion, request), options);
|
|
2157
2350
|
}
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
return this.createOfficialAccountCampaign(request, options);
|
|
2351
|
+
deleteConversion(request, options) {
|
|
2352
|
+
return this.client.requestWithoutBody(OP_ZaloAdsDeleteConversion, this.client.toTransportInput(OP_ZaloAdsDeleteConversion, request), options);
|
|
2161
2353
|
}
|
|
2162
|
-
|
|
2163
|
-
return this.client.
|
|
2354
|
+
getApiConversionAll(request = {}, options) {
|
|
2355
|
+
return this.client.requestWithoutBody(OP_ZaloAdsGetApiConversionAll, this.client.toTransportInput(OP_ZaloAdsGetApiConversionAll, request), options);
|
|
2164
2356
|
}
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
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;
|
|
2168
2523
|
}
|
|
2169
2524
|
listAutomatedRules(request = {}, options) {
|
|
2170
2525
|
const queryInput = { query_param: { ruleName: request.ruleName ?? "" } };
|
|
@@ -2179,175 +2534,937 @@ var ZaloAdsService = class {
|
|
|
2179
2534
|
changeAutomatedRuleStatus(request, options) {
|
|
2180
2535
|
return this.client.requestJson(OP_ZaloAdsChangeAutomatedRuleStatus, this.client.toTransportInput(OP_ZaloAdsChangeAutomatedRuleStatus, request), options);
|
|
2181
2536
|
}
|
|
2182
|
-
getAutomatedRuleHistory(request, options) {
|
|
2183
|
-
return this.client.requestWithoutBody(OP_ZaloAdsGetAutomatedRuleHistory, this.client.toTransportInput(OP_ZaloAdsGetAutomatedRuleHistory, request), options);
|
|
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
|
+
};
|
|
3216
|
+
}
|
|
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);
|
|
3251
|
+
}
|
|
3252
|
+
getApiPaymentTransactionHistory(request, options) {
|
|
3253
|
+
return this.account.getApiPaymentTransactionHistory(request, options);
|
|
2184
3254
|
}
|
|
2185
|
-
|
|
2186
|
-
return this.
|
|
3255
|
+
getApiBaAccountAllaccessors(request = {}, options) {
|
|
3256
|
+
return this.account.getApiBaAccountAllaccessors(request, options);
|
|
2187
3257
|
}
|
|
2188
|
-
|
|
2189
|
-
return this.
|
|
3258
|
+
getApiBaAccountAllgrantedmembers(request = {}, options) {
|
|
3259
|
+
return this.account.getApiBaAccountAllgrantedmembers(request, options);
|
|
2190
3260
|
}
|
|
2191
|
-
|
|
2192
|
-
return this.
|
|
3261
|
+
listAgencyCustomersWithBudget(request = { limit: 15, offset: 0, joinDateAsc: true }, options) {
|
|
3262
|
+
return this.account.listAgencyCustomersWithBudget(request, options);
|
|
2193
3263
|
}
|
|
2194
|
-
|
|
2195
|
-
return this.
|
|
3264
|
+
getApiNotifiesHeader(request = {}, options) {
|
|
3265
|
+
return this.account.getApiNotifiesHeader(request, options);
|
|
2196
3266
|
}
|
|
2197
|
-
|
|
2198
|
-
return this.
|
|
3267
|
+
getApiLpNews(request = {}, options) {
|
|
3268
|
+
return this.account.getApiLpNews(request, options);
|
|
2199
3269
|
}
|
|
2200
|
-
|
|
2201
|
-
|
|
3270
|
+
// =========================================================================
|
|
3271
|
+
// Delegations -> this.audiences
|
|
3272
|
+
// =========================================================================
|
|
3273
|
+
postApiAdEstimateaudience(request, options) {
|
|
3274
|
+
return this.audiences.postApiAdEstimateaudience(request, options);
|
|
2202
3275
|
}
|
|
2203
3276
|
getApiAdGetlistadadvancetargeting(request = {}, options) {
|
|
2204
|
-
return this.
|
|
3277
|
+
return this.audiences.getApiAdGetlistadadvancetargeting(request, options);
|
|
2205
3278
|
}
|
|
2206
|
-
|
|
2207
|
-
return this.
|
|
3279
|
+
getApiCustomAudienceAll(request = {}, options) {
|
|
3280
|
+
return this.audiences.getApiCustomAudienceAll(request, options);
|
|
2208
3281
|
}
|
|
2209
|
-
|
|
2210
|
-
return this.
|
|
3282
|
+
createCustomAudience(request, options) {
|
|
3283
|
+
return this.audiences.createCustomAudience(request, options);
|
|
2211
3284
|
}
|
|
2212
|
-
|
|
2213
|
-
return this.
|
|
3285
|
+
deleteCustomAudience(request, options) {
|
|
3286
|
+
return this.audiences.deleteCustomAudience(request, options);
|
|
2214
3287
|
}
|
|
2215
|
-
|
|
2216
|
-
return this.
|
|
3288
|
+
uploadCustomAudiencePhoneList(request, options) {
|
|
3289
|
+
return this.audiences.uploadCustomAudiencePhoneList(request, options);
|
|
2217
3290
|
}
|
|
2218
|
-
|
|
2219
|
-
|
|
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);
|
|
2220
3294
|
}
|
|
2221
|
-
|
|
2222
|
-
|
|
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);
|
|
2223
3298
|
}
|
|
2224
|
-
|
|
2225
|
-
|
|
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);
|
|
2226
3302
|
}
|
|
2227
|
-
|
|
2228
|
-
|
|
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);
|
|
2229
3306
|
}
|
|
2230
|
-
|
|
2231
|
-
|
|
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);
|
|
2232
3310
|
}
|
|
2233
|
-
|
|
2234
|
-
|
|
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);
|
|
2235
3314
|
}
|
|
2236
|
-
|
|
2237
|
-
|
|
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);
|
|
2238
3318
|
}
|
|
2239
|
-
|
|
2240
|
-
|
|
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);
|
|
2241
3322
|
}
|
|
2242
|
-
|
|
2243
|
-
|
|
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);
|
|
2244
3326
|
}
|
|
2245
|
-
|
|
2246
|
-
|
|
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);
|
|
2247
3330
|
}
|
|
3331
|
+
// =========================================================================
|
|
3332
|
+
// Delegations -> this.reports
|
|
3333
|
+
// =========================================================================
|
|
2248
3334
|
getReportapiV2Ads(request, options) {
|
|
2249
|
-
return this.
|
|
3335
|
+
return this.reports.getReportapiV2Ads(request, options);
|
|
2250
3336
|
}
|
|
2251
3337
|
getReportapiV2Campaigns(request = {}, options) {
|
|
2252
|
-
return this.
|
|
3338
|
+
return this.reports.getReportapiV2Campaigns(request, options);
|
|
2253
3339
|
}
|
|
2254
|
-
getReportapiV2UniqueUser(request
|
|
2255
|
-
return this.
|
|
3340
|
+
getReportapiV2UniqueUser(request, options) {
|
|
3341
|
+
return this.reports.getReportapiV2UniqueUser(request, options);
|
|
2256
3342
|
}
|
|
2257
3343
|
getReportapiV3Campaigns(request, options) {
|
|
2258
|
-
|
|
2259
|
-
filter: "[]",
|
|
2260
|
-
agencyId: 0,
|
|
2261
|
-
...request
|
|
2262
|
-
};
|
|
2263
|
-
return this.client.requestWithoutBody(OP_ZaloAdsGetReportapiV3Campaigns, this.client.toTransportInput(OP_ZaloAdsGetReportapiV3Campaigns, normalized), options);
|
|
3344
|
+
return this.reports.getReportapiV3Campaigns(request, options);
|
|
2264
3345
|
}
|
|
2265
|
-
|
|
2266
|
-
return this.
|
|
3346
|
+
getReportOverview(request, options) {
|
|
3347
|
+
return this.reports.getReportOverview(request, options);
|
|
2267
3348
|
}
|
|
2268
|
-
|
|
2269
|
-
return this.
|
|
3349
|
+
getDemographicsReport(request, options) {
|
|
3350
|
+
return this.reports.getDemographicsReport(request, options);
|
|
2270
3351
|
}
|
|
2271
|
-
|
|
2272
|
-
return this.
|
|
3352
|
+
getZaapiCampaignReportcampaign(request, options) {
|
|
3353
|
+
return this.reports.getZaapiCampaignReportcampaign(request, options);
|
|
2273
3354
|
}
|
|
2274
|
-
|
|
2275
|
-
return this.
|
|
3355
|
+
listCustomReports(request = {}, options) {
|
|
3356
|
+
return this.reports.listCustomReports(request, options);
|
|
2276
3357
|
}
|
|
2277
|
-
|
|
2278
|
-
return this.
|
|
3358
|
+
upsertCustomReport(request, options) {
|
|
3359
|
+
return this.reports.upsertCustomReport(request, options);
|
|
2279
3360
|
}
|
|
2280
|
-
|
|
2281
|
-
return this.
|
|
3361
|
+
deleteCustomReport(request, options) {
|
|
3362
|
+
return this.reports.deleteCustomReport(request, options);
|
|
2282
3363
|
}
|
|
2283
|
-
|
|
2284
|
-
return this.
|
|
3364
|
+
listReportFilters(request, options) {
|
|
3365
|
+
return this.reports.listReportFilters(request, options);
|
|
2285
3366
|
}
|
|
2286
|
-
|
|
2287
|
-
|
|
3367
|
+
// =========================================================================
|
|
3368
|
+
// Delegations -> this.conversions
|
|
3369
|
+
// =========================================================================
|
|
3370
|
+
createConversion(request, options) {
|
|
3371
|
+
return this.conversions.createConversion(request, options);
|
|
2288
3372
|
}
|
|
2289
|
-
|
|
2290
|
-
return this.
|
|
3373
|
+
deleteConversion(request, options) {
|
|
3374
|
+
return this.conversions.deleteConversion(request, options);
|
|
2291
3375
|
}
|
|
2292
|
-
|
|
2293
|
-
return this.
|
|
3376
|
+
getApiConversionAll(request = {}, options) {
|
|
3377
|
+
return this.conversions.getApiConversionAll(request, options);
|
|
3378
|
+
}
|
|
3379
|
+
getApiConversionStandardEvents(request = {}, options) {
|
|
3380
|
+
return this.conversions.getApiConversionStandardEvents(request, options);
|
|
2294
3381
|
}
|
|
2295
3382
|
listPersonalPixelLabels(request = {}, options) {
|
|
2296
|
-
return this.
|
|
3383
|
+
return this.conversions.listPersonalPixelLabels(request, options);
|
|
2297
3384
|
}
|
|
2298
|
-
|
|
2299
|
-
|
|
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);
|
|
2300
3388
|
}
|
|
2301
|
-
|
|
2302
|
-
|
|
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);
|
|
2303
3392
|
}
|
|
2304
|
-
|
|
2305
|
-
|
|
3393
|
+
/** Alias cho `listConversionNames` (`GET /api/conversion/names`). */
|
|
3394
|
+
getApiConversionNames(request = {}, options) {
|
|
3395
|
+
return this.conversions.getApiConversionNames(request, options);
|
|
2306
3396
|
}
|
|
2307
|
-
|
|
2308
|
-
|
|
3397
|
+
// =========================================================================
|
|
3398
|
+
// Delegations -> this.automatedRules
|
|
3399
|
+
// =========================================================================
|
|
3400
|
+
listAutomatedRules(request = {}, options) {
|
|
3401
|
+
return this.automatedRules.listAutomatedRules(request, options);
|
|
2309
3402
|
}
|
|
2310
|
-
|
|
2311
|
-
return this.
|
|
3403
|
+
createAutomatedRule(request, options) {
|
|
3404
|
+
return this.automatedRules.createAutomatedRule(request, options);
|
|
2312
3405
|
}
|
|
2313
|
-
|
|
2314
|
-
return this.
|
|
3406
|
+
updateAutomatedRule(request, options) {
|
|
3407
|
+
return this.automatedRules.updateAutomatedRule(request, options);
|
|
2315
3408
|
}
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
return this.updateEcommerceAd(request, options);
|
|
3409
|
+
changeAutomatedRuleStatus(request, options) {
|
|
3410
|
+
return this.automatedRules.changeAutomatedRuleStatus(request, options);
|
|
2319
3411
|
}
|
|
2320
|
-
|
|
2321
|
-
return this.
|
|
3412
|
+
getAutomatedRuleHistory(request, options) {
|
|
3413
|
+
return this.automatedRules.getAutomatedRuleHistory(request, options);
|
|
2322
3414
|
}
|
|
2323
|
-
|
|
2324
|
-
return this.
|
|
3415
|
+
deleteAutomatedRule(request, options) {
|
|
3416
|
+
return this.automatedRules.deleteAutomatedRule(request, options);
|
|
2325
3417
|
}
|
|
2326
|
-
|
|
2327
|
-
|
|
3418
|
+
// =========================================================================
|
|
3419
|
+
// Delegations -> this.flows
|
|
3420
|
+
// =========================================================================
|
|
3421
|
+
listFlowsByOfficialAccount(request, options) {
|
|
3422
|
+
return this.flows.listFlowsByOfficialAccount(request, options);
|
|
2328
3423
|
}
|
|
2329
|
-
|
|
2330
|
-
return this.
|
|
3424
|
+
createFlow(request, options) {
|
|
3425
|
+
return this.flows.createFlow(request, options);
|
|
2331
3426
|
}
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
return this.updateOfficialAccountAd(request, options);
|
|
3427
|
+
updateFlow(request, options) {
|
|
3428
|
+
return this.flows.updateFlow(request, options);
|
|
2335
3429
|
}
|
|
2336
|
-
|
|
2337
|
-
|
|
3430
|
+
// =========================================================================
|
|
3431
|
+
// Delegations -> this.media
|
|
3432
|
+
// =========================================================================
|
|
3433
|
+
getApiFilegroups(request = {}, options) {
|
|
3434
|
+
return this.media.getApiFilegroups(request, options);
|
|
2338
3435
|
}
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
return this.updatePostAd(request, options);
|
|
3436
|
+
getApiMediaItems(request, options) {
|
|
3437
|
+
return this.media.getApiMediaItems(request, options);
|
|
2342
3438
|
}
|
|
2343
|
-
|
|
2344
|
-
return this.
|
|
3439
|
+
getApiMemberFiles(request = {}, options) {
|
|
3440
|
+
return this.media.getApiMemberFiles(request, options);
|
|
3441
|
+
}
|
|
3442
|
+
postApiMediaSave(request, options) {
|
|
3443
|
+
return this.media.postApiMediaSave(request, options);
|
|
3444
|
+
}
|
|
3445
|
+
postApiMemberUploadImage(request, options) {
|
|
3446
|
+
return this.media.postApiMemberUploadImage(request, options);
|
|
3447
|
+
}
|
|
3448
|
+
/** Alias tiện lợi cho `postApiMemberUploadImage` (`POST /api/member/upload-image`). */
|
|
3449
|
+
uploadImage(request, options) {
|
|
3450
|
+
return this.media.uploadImage(request, options);
|
|
2345
3451
|
}
|
|
2346
3452
|
uploadVideo(request, options) {
|
|
2347
|
-
return this.
|
|
3453
|
+
return this.media.uploadVideo(request, options);
|
|
2348
3454
|
}
|
|
2349
|
-
|
|
2350
|
-
|
|
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);
|
|
2351
3468
|
}
|
|
2352
3469
|
};
|
|
2353
3470
|
|
|
@@ -2517,6 +3634,20 @@ var OP_ZaloFormsListSimpleFormsByOfficialAccount = {
|
|
|
2517
3634
|
"cookieFields": [],
|
|
2518
3635
|
"bodyFields": []
|
|
2519
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
|
+
};
|
|
2520
3651
|
var OP_ZaloFormsUpdateFormLeadNotificationInterval = {
|
|
2521
3652
|
"operationId": "ZaloForms_updateFormLeadNotificationInterval",
|
|
2522
3653
|
"method": "POST",
|
|
@@ -2576,11 +3707,403 @@ var ZaloFormsService = class {
|
|
|
2576
3707
|
listSimpleFormsByOfficialAccount(request, options) {
|
|
2577
3708
|
return this.client.requestWithoutBody(OP_ZaloFormsListSimpleFormsByOfficialAccount, this.client.toTransportInput(OP_ZaloFormsListSimpleFormsByOfficialAccount, request), options);
|
|
2578
3709
|
}
|
|
3710
|
+
listScenariosByOfficialAccount(request, options) {
|
|
3711
|
+
return this.client.requestWithoutBody(OP_ZaloFormsListScenariosByOfficialAccount, this.client.toTransportInput(OP_ZaloFormsListScenariosByOfficialAccount, request), options);
|
|
3712
|
+
}
|
|
2579
3713
|
updateFormLeadNotificationInterval(request, options) {
|
|
2580
3714
|
return this.client.requestJson(OP_ZaloFormsUpdateFormLeadNotificationInterval, this.client.toTransportInput(OP_ZaloFormsUpdateFormLeadNotificationInterval, request), options);
|
|
2581
3715
|
}
|
|
2582
3716
|
};
|
|
2583
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
|
+
|
|
2584
4107
|
// src/services/instant-pages.service.ts
|
|
2585
4108
|
var OP_ZaloInstantPagesCloneInstantPage = {
|
|
2586
4109
|
"operationId": "ZaloInstantPages_cloneInstantPage",
|
|
@@ -2783,8 +4306,13 @@ var ZaloInstantPagesService = class {
|
|
|
2783
4306
|
constructor(client) {
|
|
2784
4307
|
this.client = client;
|
|
2785
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;
|
|
2786
4314
|
cloneInstantPage(request, options) {
|
|
2787
|
-
return this.client.
|
|
4315
|
+
return this.client.requestJson(OP_ZaloInstantPagesCloneInstantPage, this.client.toTransportInput(OP_ZaloInstantPagesCloneInstantPage, request), options);
|
|
2788
4316
|
}
|
|
2789
4317
|
getInstantPageDetail(request, options) {
|
|
2790
4318
|
return this.client.requestWithoutBody(OP_ZaloInstantPagesGetInstantPageDetail, this.client.toTransportInput(OP_ZaloInstantPagesGetInstantPageDetail, request), options);
|
|
@@ -2894,6 +4422,32 @@ var OP_ZaloProfileAdsUploadOaCover = {
|
|
|
2894
4422
|
"is-new"
|
|
2895
4423
|
]
|
|
2896
4424
|
};
|
|
4425
|
+
var OP_ZaloProfileAdsGetProvinces = {
|
|
4426
|
+
"operationId": "ZaloProfileAds_getProvinces",
|
|
4427
|
+
"method": "GET",
|
|
4428
|
+
"endpoint": "/ajax/get-province",
|
|
4429
|
+
"baseUrl": "https://profile.ads.zalo.me",
|
|
4430
|
+
"binaryFields": [],
|
|
4431
|
+
"pathFields": [],
|
|
4432
|
+
"queryFields": [],
|
|
4433
|
+
"headerFields": [],
|
|
4434
|
+
"cookieFields": [],
|
|
4435
|
+
"bodyFields": []
|
|
4436
|
+
};
|
|
4437
|
+
var OP_ZaloProfileAdsGetDistricts = {
|
|
4438
|
+
"operationId": "ZaloProfileAds_getDistricts",
|
|
4439
|
+
"method": "GET",
|
|
4440
|
+
"endpoint": "/ajax/get-district",
|
|
4441
|
+
"baseUrl": "https://profile.ads.zalo.me",
|
|
4442
|
+
"binaryFields": [],
|
|
4443
|
+
"pathFields": [],
|
|
4444
|
+
"queryFields": [
|
|
4445
|
+
"provinceId"
|
|
4446
|
+
],
|
|
4447
|
+
"headerFields": [],
|
|
4448
|
+
"cookieFields": [],
|
|
4449
|
+
"bodyFields": []
|
|
4450
|
+
};
|
|
2897
4451
|
var ZaloProfileAdsService = class {
|
|
2898
4452
|
constructor(client) {
|
|
2899
4453
|
this.client = client;
|
|
@@ -2906,6 +4460,11 @@ var ZaloProfileAdsService = class {
|
|
|
2906
4460
|
}
|
|
2907
4461
|
const normalizedRequest = {
|
|
2908
4462
|
option: "createpage",
|
|
4463
|
+
typeId: 2,
|
|
4464
|
+
tier: 0,
|
|
4465
|
+
typeName: "store",
|
|
4466
|
+
categoryId: 10003,
|
|
4467
|
+
agreeTerm: true,
|
|
2909
4468
|
...request,
|
|
2910
4469
|
...csrfToken ? { "crsf-token": csrfToken } : {}
|
|
2911
4470
|
};
|
|
@@ -2939,6 +4498,20 @@ var ZaloProfileAdsService = class {
|
|
|
2939
4498
|
options
|
|
2940
4499
|
);
|
|
2941
4500
|
}
|
|
4501
|
+
getProvinces(options) {
|
|
4502
|
+
return this.client.requestWithoutBody(
|
|
4503
|
+
OP_ZaloProfileAdsGetProvinces,
|
|
4504
|
+
{},
|
|
4505
|
+
options
|
|
4506
|
+
);
|
|
4507
|
+
}
|
|
4508
|
+
getDistricts(request, options) {
|
|
4509
|
+
return this.client.requestWithoutBody(
|
|
4510
|
+
OP_ZaloProfileAdsGetDistricts,
|
|
4511
|
+
this.client.toTransportInput(OP_ZaloProfileAdsGetDistricts, request),
|
|
4512
|
+
options
|
|
4513
|
+
);
|
|
4514
|
+
}
|
|
2942
4515
|
};
|
|
2943
4516
|
|
|
2944
4517
|
// src/services/widget.service.ts
|
|
@@ -3016,6 +4589,17 @@ var ZaloWidgetApiService = class {
|
|
|
3016
4589
|
var ZaloAdsSdk = class {
|
|
3017
4590
|
client;
|
|
3018
4591
|
ads;
|
|
4592
|
+
campaigns;
|
|
4593
|
+
account;
|
|
4594
|
+
audiences;
|
|
4595
|
+
targeting;
|
|
4596
|
+
reports;
|
|
4597
|
+
conversions;
|
|
4598
|
+
pixel;
|
|
4599
|
+
automatedRules;
|
|
4600
|
+
rules;
|
|
4601
|
+
flows;
|
|
4602
|
+
media;
|
|
3019
4603
|
forms;
|
|
3020
4604
|
instantPages;
|
|
3021
4605
|
profileAds;
|
|
@@ -3026,6 +4610,17 @@ var ZaloAdsSdk = class {
|
|
|
3026
4610
|
const resolvedOptions = typeof options === "string" ? { zpsid: options } : options;
|
|
3027
4611
|
this.client = new ZaloSdkHttpClient(resolvedOptions);
|
|
3028
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;
|
|
3029
4624
|
this.forms = new ZaloFormsService(this.client);
|
|
3030
4625
|
this.instantPages = new ZaloInstantPagesService(this.client);
|
|
3031
4626
|
this.profileAds = new ZaloProfileAdsService(this.client);
|
|
@@ -3351,11 +4946,35 @@ var ZaloAdsUpdateMessageAdResponse = class {
|
|
|
3351
4946
|
code;
|
|
3352
4947
|
data;
|
|
3353
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 || {});
|
|
3354
4972
|
export {
|
|
3355
4973
|
ALL_ZALO_ADS_DOMAINS,
|
|
3356
4974
|
MemoryZaloSessionStore,
|
|
3357
4975
|
RedisZaloSessionStore,
|
|
3358
4976
|
TieredZaloSessionStore,
|
|
4977
|
+
ZaloAccountService,
|
|
3359
4978
|
ZaloAdsIntegrationManager as ZaloAdsAccountPool,
|
|
3360
4979
|
ZaloAdsCreateFlowRequest,
|
|
3361
4980
|
ZaloAdsCreateFlowResponse,
|
|
@@ -3372,11 +4991,20 @@ export {
|
|
|
3372
4991
|
ZaloAdsUpdateMessageAdResponse,
|
|
3373
4992
|
ZaloAdsUpdateVideoAdRequest,
|
|
3374
4993
|
ZaloAdsUpdateVideoAdResponse,
|
|
4994
|
+
ZaloAudiencesService,
|
|
3375
4995
|
ZaloAuthManager,
|
|
4996
|
+
ZaloAutomatedRulesService,
|
|
4997
|
+
ZaloCampaignsService,
|
|
3376
4998
|
ZaloChatWidgetService,
|
|
4999
|
+
ZaloConversionsService,
|
|
5000
|
+
ZaloFlowsService,
|
|
3377
5001
|
ZaloFormsService,
|
|
5002
|
+
ZaloInstantPageBlockType,
|
|
3378
5003
|
ZaloInstantPagesService,
|
|
5004
|
+
ZaloInstantPagesValidator,
|
|
5005
|
+
ZaloMediaService,
|
|
3379
5006
|
ZaloProfileAdsService,
|
|
5007
|
+
ZaloReportsService,
|
|
3380
5008
|
ZaloSdkError,
|
|
3381
5009
|
ZaloSdkHttpClient,
|
|
3382
5010
|
ZaloWidgetApiService,
|
|
@@ -3386,6 +5014,19 @@ export {
|
|
|
3386
5014
|
ZaloAdsSdk as default,
|
|
3387
5015
|
defaultSharedMemorySessionStore,
|
|
3388
5016
|
deriveAccountKeyFromZpsid,
|
|
3389
|
-
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
|
|
3390
5031
|
};
|
|
3391
5032
|
//# sourceMappingURL=index.mjs.map
|