@softtynet/zca-js 2.2.8 → 2.2.9
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/README.md +1 -0
- package/dist/apis/clearUnreadFriendRequests.d.ts +2 -0
- package/dist/apis/clearUnreadFriendRequests.js +29 -0
- package/dist/apis/encryptGids.d.ts +4 -0
- package/dist/apis/encryptGids.js +24 -0
- package/dist/apis/getAliasListV2.d.ts +10 -0
- package/dist/apis/getAliasListV2.js +28 -0
- package/dist/apis/getBlockFriends.d.ts +6 -0
- package/dist/apis/getBlockFriends.js +28 -0
- package/dist/apis/getCloudInfo.d.ts +3 -0
- package/dist/apis/getCloudInfo.js +34 -0
- package/dist/apis/getCloudSettings.d.ts +10 -0
- package/dist/apis/getCloudSettings.js +34 -0
- package/dist/apis/getCloudViewerKey.d.ts +5 -0
- package/dist/apis/getCloudViewerKey.js +25 -0
- package/dist/apis/getConversationMedia.d.ts +26 -0
- package/dist/apis/getConversationMedia.js +39 -0
- package/dist/apis/getEmojiStatusConfig.d.ts +17 -0
- package/dist/apis/getEmojiStatusConfig.js +23 -0
- package/dist/apis/getExtraFriendInfo.d.ts +3 -0
- package/dist/apis/getExtraFriendInfo.js +31 -0
- package/dist/apis/getExtraGroupInfo.d.ts +7 -0
- package/dist/apis/getExtraGroupInfo.js +32 -0
- package/dist/apis/getFamilyProfile.d.ts +3 -0
- package/dist/apis/getFamilyProfile.js +34 -0
- package/dist/apis/getFamilyUsage.d.ts +7 -0
- package/dist/apis/getFamilyUsage.js +34 -0
- package/dist/apis/getFamilyViewerKey.d.ts +5 -0
- package/dist/apis/getFamilyViewerKey.js +25 -0
- package/dist/apis/getFriendsEmojiStatus.d.ts +17 -0
- package/dist/apis/getFriendsEmojiStatus.js +30 -0
- package/dist/apis/getGroupCloudMessageJump.d.ts +3 -0
- package/dist/apis/getGroupCloudMessageJump.js +46 -0
- package/dist/apis/getLastReadContactTab.d.ts +4 -0
- package/dist/apis/getLastReadContactTab.js +15 -0
- package/dist/apis/getLastSeen.d.ts +11 -0
- package/dist/apis/getLastSeen.js +40 -0
- package/dist/apis/getLastSeenReaction.d.ts +9 -0
- package/dist/apis/getLastSeenReaction.js +28 -0
- package/dist/apis/getListPinTopics.d.ts +5 -0
- package/dist/apis/getListPinTopics.js +28 -0
- package/dist/apis/getMediaStorePreview.d.ts +3 -0
- package/dist/apis/getMediaStorePreview.js +31 -0
- package/dist/apis/getMiniProfile.d.ts +13 -0
- package/dist/apis/getMiniProfile.js +34 -0
- package/dist/apis/getPersonalizedStickerList.d.ts +5 -0
- package/dist/apis/getPersonalizedStickerList.js +24 -0
- package/dist/apis/getPhonebookV2.d.ts +6 -0
- package/dist/apis/getPhonebookV2.js +21 -0
- package/dist/apis/getProfileRank.d.ts +5 -0
- package/dist/apis/getProfileRank.js +25 -0
- package/dist/apis/getProfileVerificationStatus.d.ts +5 -0
- package/dist/apis/getProfileVerificationStatus.js +20 -0
- package/dist/apis/getQuotaCommunity.d.ts +8 -0
- package/dist/apis/getQuotaCommunity.js +27 -0
- package/dist/apis/getRecentSearchList.d.ts +6 -0
- package/dist/apis/getRecentSearchList.js +25 -0
- package/dist/apis/getStickerCategoriesV2.d.ts +17 -0
- package/dist/apis/getStickerCategoriesV2.js +21 -0
- package/dist/apis/getStickerCategoryData.d.ts +3 -0
- package/dist/apis/getStickerCategoryData.js +25 -0
- package/dist/apis/getStickerHello.d.ts +16 -0
- package/dist/apis/getStickerHello.js +34 -0
- package/dist/apis/getStickerSuggestKeywords.d.ts +12 -0
- package/dist/apis/getStickerSuggestKeywords.js +24 -0
- package/dist/apis/getStickerSuggestion.d.ts +12 -0
- package/dist/apis/getStickerSuggestion.js +30 -0
- package/dist/apis/getUsageMyCloud.d.ts +7 -0
- package/dist/apis/getUsageMyCloud.js +34 -0
- package/dist/apis/getUsageZCloud.d.ts +11 -0
- package/dist/apis/getUsageZCloud.js +34 -0
- package/dist/apis/keepAlive.d.ts +2 -1
- package/dist/apis/keepAlive.js +5 -3
- package/dist/apis/listen.d.ts +13 -0
- package/dist/apis/listen.js +10 -0
- package/dist/apis/readContactTab.d.ts +2 -0
- package/dist/apis/readContactTab.js +26 -0
- package/dist/apis/removeConversationMedia.d.ts +8 -0
- package/dist/apis/removeConversationMedia.js +30 -0
- package/dist/apis/undoMultiMessage.d.ts +9 -0
- package/dist/apis/undoMultiMessage.js +46 -0
- package/dist/apis/updateRecentSearch.d.ts +11 -0
- package/dist/apis/updateRecentSearch.js +41 -0
- package/dist/apis/verifyCloudMedia.d.ts +14 -0
- package/dist/apis/verifyCloudMedia.js +43 -0
- package/dist/apis/voiceToText.d.ts +4 -0
- package/dist/apis/voiceToText.js +30 -0
- package/dist/apis.d.ts +82 -0
- package/dist/apis.js +82 -0
- package/dist/cjs/apis/clearUnreadFriendRequests.cjs +34 -0
- package/dist/cjs/apis/encryptGids.cjs +29 -0
- package/dist/cjs/apis/getAliasListV2.cjs +33 -0
- package/dist/cjs/apis/getBlockFriends.cjs +33 -0
- package/dist/cjs/apis/getCloudInfo.cjs +39 -0
- package/dist/cjs/apis/getCloudSettings.cjs +39 -0
- package/dist/cjs/apis/getCloudViewerKey.cjs +30 -0
- package/dist/cjs/apis/getConversationMedia.cjs +44 -0
- package/dist/cjs/apis/getEmojiStatusConfig.cjs +28 -0
- package/dist/cjs/apis/getExtraFriendInfo.cjs +36 -0
- package/dist/cjs/apis/getExtraGroupInfo.cjs +37 -0
- package/dist/cjs/apis/getFamilyProfile.cjs +39 -0
- package/dist/cjs/apis/getFamilyUsage.cjs +39 -0
- package/dist/cjs/apis/getFamilyViewerKey.cjs +30 -0
- package/dist/cjs/apis/getFriendsEmojiStatus.cjs +35 -0
- package/dist/cjs/apis/getGroupCloudMessageJump.cjs +63 -0
- package/dist/cjs/apis/getLastReadContactTab.cjs +20 -0
- package/dist/cjs/apis/getLastSeen.cjs +45 -0
- package/dist/cjs/apis/getLastSeenReaction.cjs +33 -0
- package/dist/cjs/apis/getListPinTopics.cjs +33 -0
- package/dist/cjs/apis/getMediaStorePreview.cjs +36 -0
- package/dist/cjs/apis/getMiniProfile.cjs +39 -0
- package/dist/cjs/apis/getPersonalizedStickerList.cjs +29 -0
- package/dist/cjs/apis/getPhonebookV2.cjs +26 -0
- package/dist/cjs/apis/getProfileRank.cjs +30 -0
- package/dist/cjs/apis/getProfileVerificationStatus.cjs +25 -0
- package/dist/cjs/apis/getQuotaCommunity.cjs +32 -0
- package/dist/cjs/apis/getRecentSearchList.cjs +30 -0
- package/dist/cjs/apis/getStickerCategoriesV2.cjs +26 -0
- package/dist/cjs/apis/getStickerCategoryData.cjs +30 -0
- package/dist/cjs/apis/getStickerHello.cjs +39 -0
- package/dist/cjs/apis/getStickerSuggestKeywords.cjs +29 -0
- package/dist/cjs/apis/getStickerSuggestion.cjs +35 -0
- package/dist/cjs/apis/getUsageMyCloud.cjs +39 -0
- package/dist/cjs/apis/getUsageZCloud.cjs +39 -0
- package/dist/cjs/apis/keepAlive.cjs +5 -3
- package/dist/cjs/apis/listen.cjs +10 -0
- package/dist/cjs/apis/readContactTab.cjs +31 -0
- package/dist/cjs/apis/removeConversationMedia.cjs +35 -0
- package/dist/cjs/apis/undoMultiMessage.cjs +62 -0
- package/dist/cjs/apis/updateRecentSearch.cjs +46 -0
- package/dist/cjs/apis/verifyCloudMedia.cjs +48 -0
- package/dist/cjs/apis/voiceToText.cjs +35 -0
- package/dist/cjs/apis.cjs +82 -0
- package/dist/cjs/index.cjs +2 -0
- package/dist/cjs/utils.cjs +25 -0
- package/dist/context.d.ts +4 -0
- package/dist/index.d.ts +42 -1
- package/dist/index.js +1 -1
- package/dist/utils.d.ts +10 -0
- package/dist/utils.js +23 -0
- package/docs/INTEGRATION_GUIDE_SYNC_AND_CALL.md +110 -0
- package/package.json +1 -1
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ZaloApiError = require('../Errors/ZaloApiError.cjs');
|
|
4
|
+
var utils = require('../utils.cjs');
|
|
5
|
+
|
|
6
|
+
const getAliasListV2Factory = utils.apiFactory()((api, ctx, utils) => {
|
|
7
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.alias[0]}/api/alias/list/v2`);
|
|
8
|
+
/**
|
|
9
|
+
* Lấy danh sách tên gợi nhớ (Alias) của bạn bè chuẩn V2 có hỗ trợ phân trang (command 12205)
|
|
10
|
+
*
|
|
11
|
+
* @param page Trang cần lấy (mặc định: 1)
|
|
12
|
+
* @param count Số lượng mục mỗi trang (mặc định: 100)
|
|
13
|
+
* @throws {ZaloApiError}
|
|
14
|
+
*/
|
|
15
|
+
return async function getAliasListV2(page = 1, count = 100) {
|
|
16
|
+
const params = {
|
|
17
|
+
page,
|
|
18
|
+
count,
|
|
19
|
+
src: -1,
|
|
20
|
+
imei: ctx.imei,
|
|
21
|
+
};
|
|
22
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
23
|
+
if (!encryptedParams) {
|
|
24
|
+
throw new ZaloApiError.ZaloApiError("Failed to encrypt params");
|
|
25
|
+
}
|
|
26
|
+
const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams }), {
|
|
27
|
+
method: "GET",
|
|
28
|
+
});
|
|
29
|
+
return utils.resolve(response);
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
exports.getAliasListV2Factory = getAliasListV2Factory;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ZaloApiError = require('../Errors/ZaloApiError.cjs');
|
|
4
|
+
var utils = require('../utils.cjs');
|
|
5
|
+
|
|
6
|
+
const getBlockFriendsFactory = utils.apiFactory()((api, _ctx, utils) => {
|
|
7
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.friend[0]}/api/friend/blocklistv2`);
|
|
8
|
+
/**
|
|
9
|
+
* Lấy danh sách người dùng đang bị chặn chuẩn V2 (command 11429)
|
|
10
|
+
*
|
|
11
|
+
* @param page Trang cần lấy (mặc định: 1)
|
|
12
|
+
* @param count Số lượng mỗi trang (mặc định: 50)
|
|
13
|
+
* @param avatarSize Kích thước ảnh đại diện (mặc định: 120)
|
|
14
|
+
* @throws {ZaloApiError}
|
|
15
|
+
*/
|
|
16
|
+
return async function getBlockFriends(page = 1, count = 50, avatarSize = 120) {
|
|
17
|
+
const params = {
|
|
18
|
+
page,
|
|
19
|
+
count,
|
|
20
|
+
avatar: avatarSize,
|
|
21
|
+
};
|
|
22
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
23
|
+
if (!encryptedParams) {
|
|
24
|
+
throw new ZaloApiError.ZaloApiError("Failed to encrypt params");
|
|
25
|
+
}
|
|
26
|
+
const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams }), {
|
|
27
|
+
method: "GET",
|
|
28
|
+
});
|
|
29
|
+
return utils.resolve(response);
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
exports.getBlockFriendsFactory = getBlockFriendsFactory;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ZaloApiError = require('../Errors/ZaloApiError.cjs');
|
|
4
|
+
var utils = require('../utils.cjs');
|
|
5
|
+
|
|
6
|
+
const getCloudInfoFactory = utils.apiFactory()((api, _ctx, utils$1) => {
|
|
7
|
+
var _a;
|
|
8
|
+
const baseDomain = ((_a = api.zpwServiceMap.zcloud) === null || _a === void 0 ? void 0 : _a[0]) || "https://zcld.chat.zalo.me";
|
|
9
|
+
const serviceURL = utils$1.makeURL(`${baseDomain}/zalocloud/cloudinfopcweb/v1/info`);
|
|
10
|
+
/**
|
|
11
|
+
* Lấy thông tin gói thuê bao Zalo Cloud (command 12754)
|
|
12
|
+
*
|
|
13
|
+
* @param viewerKeyInfo (Tùy chọn) Cặp `{ viewer_key, enk }` từ `api.getCloudViewerKey()`.
|
|
14
|
+
* @throws {ZaloApiError}
|
|
15
|
+
*/
|
|
16
|
+
return async function getCloudInfo(viewerKeyInfo) {
|
|
17
|
+
const keyInfo = viewerKeyInfo !== null && viewerKeyInfo !== void 0 ? viewerKeyInfo : (await api.getCloudViewerKey());
|
|
18
|
+
if (!(keyInfo === null || keyInfo === void 0 ? void 0 : keyInfo.viewer_key) || !(keyInfo === null || keyInfo === void 0 ? void 0 : keyInfo.enk)) {
|
|
19
|
+
throw new ZaloApiError.ZaloApiError("Invalid CloudViewerKey");
|
|
20
|
+
}
|
|
21
|
+
const response = await utils$1.request(serviceURL, {
|
|
22
|
+
method: "GET",
|
|
23
|
+
headers: {
|
|
24
|
+
"cloud-viewer-key": keyInfo.viewer_key,
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
const json = (await response.json());
|
|
28
|
+
if (json.error_code !== 0 && json.error_code !== -904) {
|
|
29
|
+
throw new ZaloApiError.ZaloApiError(json.error_message || "getCloudInfo failed", json.error_code);
|
|
30
|
+
}
|
|
31
|
+
if (!json.data) {
|
|
32
|
+
return {};
|
|
33
|
+
}
|
|
34
|
+
const decrypted = utils.decryptZCloudAES(json.data, keyInfo.enk);
|
|
35
|
+
return JSON.parse(decrypted);
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
exports.getCloudInfoFactory = getCloudInfoFactory;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ZaloApiError = require('../Errors/ZaloApiError.cjs');
|
|
4
|
+
var utils = require('../utils.cjs');
|
|
5
|
+
|
|
6
|
+
const getCloudSettingsFactory = utils.apiFactory()((api, _ctx, utils$1) => {
|
|
7
|
+
var _a;
|
|
8
|
+
const baseDomain = ((_a = api.zpwServiceMap.zcloud) === null || _a === void 0 ? void 0 : _a[0]) || "https://zcld.chat.zalo.me";
|
|
9
|
+
const serviceURL = utils$1.makeURL(`${baseDomain}/cloudmedia/info/pc/v1/cloud-settings`);
|
|
10
|
+
/**
|
|
11
|
+
* Lấy cấu hình giới hạn tệp và cài đặt ZCloud của tài khoản (command 12756)
|
|
12
|
+
*
|
|
13
|
+
* @param viewerKeyInfo (Tùy chọn) Cặp `{ viewer_key, enk }` từ `api.getCloudViewerKey()`. Nếu không truyền sẽ tự động lấy mới.
|
|
14
|
+
* @throws {ZaloApiError}
|
|
15
|
+
*/
|
|
16
|
+
return async function getCloudSettings(viewerKeyInfo) {
|
|
17
|
+
const keyInfo = viewerKeyInfo !== null && viewerKeyInfo !== void 0 ? viewerKeyInfo : (await api.getCloudViewerKey());
|
|
18
|
+
if (!(keyInfo === null || keyInfo === void 0 ? void 0 : keyInfo.viewer_key) || !(keyInfo === null || keyInfo === void 0 ? void 0 : keyInfo.enk)) {
|
|
19
|
+
throw new ZaloApiError.ZaloApiError("Invalid CloudViewerKey");
|
|
20
|
+
}
|
|
21
|
+
const response = await utils$1.request(serviceURL, {
|
|
22
|
+
method: "GET",
|
|
23
|
+
headers: {
|
|
24
|
+
"cloud-viewer-key": keyInfo.viewer_key,
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
const json = (await response.json());
|
|
28
|
+
if (json.error_code !== 0 && json.error_code !== -904) {
|
|
29
|
+
throw new ZaloApiError.ZaloApiError(json.error_message || "getCloudSettings failed", json.error_code);
|
|
30
|
+
}
|
|
31
|
+
if (!json.data) {
|
|
32
|
+
throw new ZaloApiError.ZaloApiError("Empty ZCloud settings data", json.error_code);
|
|
33
|
+
}
|
|
34
|
+
const decrypted = utils.decryptZCloudAES(json.data, keyInfo.enk);
|
|
35
|
+
return JSON.parse(decrypted);
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
exports.getCloudSettingsFactory = getCloudSettingsFactory;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ZaloApiError = require('../Errors/ZaloApiError.cjs');
|
|
4
|
+
var utils = require('../utils.cjs');
|
|
5
|
+
|
|
6
|
+
const getCloudViewerKeyFactory = utils.apiFactory()((_api, _ctx, utils) => {
|
|
7
|
+
const serviceURL = utils.makeURL("https://wpa.chat.zalo.me/api/getCloudViewerKey");
|
|
8
|
+
/**
|
|
9
|
+
* Lấy cặp khóa phiên (`viewer_key` và khóa giải mã AES-256 `enk`) cho hệ thống ZCloud / MyCloud (command 12741)
|
|
10
|
+
*
|
|
11
|
+
* @throws {ZaloApiError}
|
|
12
|
+
*/
|
|
13
|
+
return async function getCloudViewerKey() {
|
|
14
|
+
const response = await utils.request(serviceURL, {
|
|
15
|
+
method: "GET",
|
|
16
|
+
});
|
|
17
|
+
const res = await utils.resolve(response);
|
|
18
|
+
if (typeof res === "string") {
|
|
19
|
+
try {
|
|
20
|
+
return JSON.parse(res);
|
|
21
|
+
}
|
|
22
|
+
catch (_a) {
|
|
23
|
+
throw new ZaloApiError.ZaloApiError("Failed to parse CloudViewerKey response");
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return res;
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
exports.getCloudViewerKeyFactory = getCloudViewerKeyFactory;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ZaloApiError = require('../Errors/ZaloApiError.cjs');
|
|
4
|
+
var utils = require('../utils.cjs');
|
|
5
|
+
|
|
6
|
+
const getConversationMediaFactory = utils.apiFactory()((api, ctx, utils) => {
|
|
7
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.media_store[0]}/api/mediastore/list`);
|
|
8
|
+
/**
|
|
9
|
+
* Lấy danh sách Kho Lưu Trữ (Ảnh/Video `"media"`, File `"file"`, hoặc Link `"link"`) trong hội thoại nhóm (command 11841)
|
|
10
|
+
*
|
|
11
|
+
* @param options Tùy chọn truy vấn (`groupId`, `mediaType`, `limit`, `lastId`, `lastFetchId`)
|
|
12
|
+
* @throws {ZaloApiError}
|
|
13
|
+
*/
|
|
14
|
+
return async function getConversationMedia(options) {
|
|
15
|
+
var _a, _b;
|
|
16
|
+
const rawGroupId = options.groupId || options.threadId;
|
|
17
|
+
if (!rawGroupId) {
|
|
18
|
+
throw new ZaloApiError.ZaloApiError("Missing groupId");
|
|
19
|
+
}
|
|
20
|
+
const groupId = rawGroupId.startsWith("g") ? rawGroupId.slice(1) : rawGroupId;
|
|
21
|
+
const params = {
|
|
22
|
+
media_type: (_a = options.mediaType) !== null && _a !== void 0 ? _a : "media",
|
|
23
|
+
group_id: groupId,
|
|
24
|
+
limit: (_b = options.limit) !== null && _b !== void 0 ? _b : 20,
|
|
25
|
+
imei: ctx.imei,
|
|
26
|
+
};
|
|
27
|
+
if (options.lastId !== undefined) {
|
|
28
|
+
params.last_id = options.lastId;
|
|
29
|
+
}
|
|
30
|
+
if (options.lastFetchId !== undefined && !Number.isNaN(options.lastFetchId)) {
|
|
31
|
+
params.lastFetchId = options.lastFetchId;
|
|
32
|
+
}
|
|
33
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
34
|
+
if (!encryptedParams) {
|
|
35
|
+
throw new ZaloApiError.ZaloApiError("Failed to encrypt params");
|
|
36
|
+
}
|
|
37
|
+
const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams }), {
|
|
38
|
+
method: "GET",
|
|
39
|
+
});
|
|
40
|
+
return utils.resolve(response);
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
exports.getConversationMediaFactory = getConversationMediaFactory;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ZaloApiError = require('../Errors/ZaloApiError.cjs');
|
|
4
|
+
var utils = require('../utils.cjs');
|
|
5
|
+
|
|
6
|
+
const getEmojiStatusConfigFactory = utils.apiFactory()((api, _ctx, utils) => {
|
|
7
|
+
var _a;
|
|
8
|
+
const baseDomain = ((_a = api.zpwServiceMap.emoji_stt) === null || _a === void 0 ? void 0 : _a[0]) || "https://emoji-status.chat.zalo.me";
|
|
9
|
+
const serviceURL = utils.makeURL(`${baseDomain}/api/v1/emoji-status/resource-config`);
|
|
10
|
+
/**
|
|
11
|
+
* Lấy cấu hình và danh sách bộ biểu tượng Trạng thái Emoji (Emoji Status - command 16300)
|
|
12
|
+
*
|
|
13
|
+
* @param version Phiên bản bộ nhớ đệm (mặc định: 0 để lấy đầy đủ danh sách)
|
|
14
|
+
* @throws {ZaloApiError}
|
|
15
|
+
*/
|
|
16
|
+
return async function getEmojiStatusConfig(version = 0) {
|
|
17
|
+
const encryptedParams = utils.encodeAES(JSON.stringify({ version }));
|
|
18
|
+
if (!encryptedParams) {
|
|
19
|
+
throw new ZaloApiError.ZaloApiError("Failed to encrypt params");
|
|
20
|
+
}
|
|
21
|
+
const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams }), {
|
|
22
|
+
method: "GET",
|
|
23
|
+
});
|
|
24
|
+
return utils.resolve(response);
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
exports.getEmojiStatusConfigFactory = getEmojiStatusConfigFactory;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ZaloApiError = require('../Errors/ZaloApiError.cjs');
|
|
4
|
+
var utils = require('../utils.cjs');
|
|
5
|
+
|
|
6
|
+
const getExtraFriendInfoFactory = utils.apiFactory()((api, ctx, utils) => {
|
|
7
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.friend[0]}/api/friend/context/multiget`);
|
|
8
|
+
/**
|
|
9
|
+
* Lấy ngữ cảnh và vai trò mở rộng (ví dụ `role: ["boss"]`) của danh sách bạn bè (command 11442)
|
|
10
|
+
*
|
|
11
|
+
* @param friendIds Mảng UID cần truy vấn
|
|
12
|
+
* @throws {ZaloApiError}
|
|
13
|
+
*/
|
|
14
|
+
return async function getExtraFriendInfo(friendIds) {
|
|
15
|
+
if (!Array.isArray(friendIds) || friendIds.length === 0) {
|
|
16
|
+
return {};
|
|
17
|
+
}
|
|
18
|
+
const params = {
|
|
19
|
+
fids: friendIds,
|
|
20
|
+
imei: ctx.imei,
|
|
21
|
+
};
|
|
22
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
23
|
+
if (!encryptedParams) {
|
|
24
|
+
throw new ZaloApiError.ZaloApiError("Failed to encrypt params");
|
|
25
|
+
}
|
|
26
|
+
const response = await utils.request(serviceURL, {
|
|
27
|
+
method: "POST",
|
|
28
|
+
body: new URLSearchParams({
|
|
29
|
+
params: encryptedParams,
|
|
30
|
+
}),
|
|
31
|
+
});
|
|
32
|
+
return utils.resolve(response);
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
exports.getExtraFriendInfoFactory = getExtraFriendInfoFactory;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ZaloApiError = require('../Errors/ZaloApiError.cjs');
|
|
4
|
+
var utils = require('../utils.cjs');
|
|
5
|
+
|
|
6
|
+
const getExtraGroupInfoFactory = utils.apiFactory()((api, ctx, utils) => {
|
|
7
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.group[0]}/api/group/userctx/multiget`);
|
|
8
|
+
/**
|
|
9
|
+
* Lấy ngữ cảnh và vai trò mở rộng của người dùng đối với nhiều nhóm (command 12607)
|
|
10
|
+
*
|
|
11
|
+
* @param groupIds Mảng ID các nhóm cần truy vấn
|
|
12
|
+
* @throws {ZaloApiError}
|
|
13
|
+
*/
|
|
14
|
+
return async function getExtraGroupInfo(groupIds) {
|
|
15
|
+
if (!Array.isArray(groupIds) || groupIds.length === 0) {
|
|
16
|
+
return {};
|
|
17
|
+
}
|
|
18
|
+
const cleanGroupIds = groupIds.map((g) => (g.startsWith("g") ? g.slice(1) : g));
|
|
19
|
+
const params = {
|
|
20
|
+
grids: cleanGroupIds,
|
|
21
|
+
imei: ctx.imei,
|
|
22
|
+
};
|
|
23
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
24
|
+
if (!encryptedParams) {
|
|
25
|
+
throw new ZaloApiError.ZaloApiError("Failed to encrypt params");
|
|
26
|
+
}
|
|
27
|
+
const response = await utils.request(serviceURL, {
|
|
28
|
+
method: "POST",
|
|
29
|
+
body: new URLSearchParams({
|
|
30
|
+
params: encryptedParams,
|
|
31
|
+
}),
|
|
32
|
+
});
|
|
33
|
+
return utils.resolve(response);
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
exports.getExtraGroupInfoFactory = getExtraGroupInfoFactory;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ZaloApiError = require('../Errors/ZaloApiError.cjs');
|
|
4
|
+
var utils = require('../utils.cjs');
|
|
5
|
+
|
|
6
|
+
const getFamilyProfileFactory = utils.apiFactory()((api, _ctx, utils$1) => {
|
|
7
|
+
var _a;
|
|
8
|
+
const baseDomain = ((_a = api.zpwServiceMap.zfamily) === null || _a === void 0 ? void 0 : _a[0]) || "https://zfml.chat.zalo.me";
|
|
9
|
+
const serviceURL = utils$1.makeURL(`${baseDomain}/zfamily/pc/family-profile/v1/family`);
|
|
10
|
+
/**
|
|
11
|
+
* Lấy thông tin nhóm gia đình ZFamily (command 12757)
|
|
12
|
+
*
|
|
13
|
+
* @param familyKeyInfo (Tùy chọn) Cặp `{ viewer_key, enk }` từ `api.getFamilyViewerKey()`.
|
|
14
|
+
* @throws {ZaloApiError}
|
|
15
|
+
*/
|
|
16
|
+
return async function getFamilyProfile(familyKeyInfo) {
|
|
17
|
+
const keyInfo = familyKeyInfo !== null && familyKeyInfo !== void 0 ? familyKeyInfo : (await api.getFamilyViewerKey());
|
|
18
|
+
if (!(keyInfo === null || keyInfo === void 0 ? void 0 : keyInfo.viewer_key) || !(keyInfo === null || keyInfo === void 0 ? void 0 : keyInfo.enk)) {
|
|
19
|
+
throw new ZaloApiError.ZaloApiError("Invalid FamilyViewerKey");
|
|
20
|
+
}
|
|
21
|
+
const response = await utils$1.request(serviceURL, {
|
|
22
|
+
method: "GET",
|
|
23
|
+
headers: {
|
|
24
|
+
"zfamily-viewer-key": keyInfo.viewer_key,
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
const json = (await response.json());
|
|
28
|
+
if (json.error_code !== 0 && json.error_code !== -904) {
|
|
29
|
+
throw new ZaloApiError.ZaloApiError(json.error_message || "getFamilyProfile failed", json.error_code);
|
|
30
|
+
}
|
|
31
|
+
if (!json.data) {
|
|
32
|
+
return {};
|
|
33
|
+
}
|
|
34
|
+
const decrypted = utils.decryptZCloudAES(json.data, keyInfo.enk);
|
|
35
|
+
return JSON.parse(decrypted);
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
exports.getFamilyProfileFactory = getFamilyProfileFactory;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ZaloApiError = require('../Errors/ZaloApiError.cjs');
|
|
4
|
+
var utils = require('../utils.cjs');
|
|
5
|
+
|
|
6
|
+
const getFamilyUsageFactory = utils.apiFactory()((api, _ctx, utils$1) => {
|
|
7
|
+
var _a;
|
|
8
|
+
const baseDomain = ((_a = api.zpwServiceMap.zcloud) === null || _a === void 0 ? void 0 : _a[0]) || "https://zcld.chat.zalo.me";
|
|
9
|
+
const serviceURL = utils$1.makeURL(`${baseDomain}/cloudmedia/info/pc/v1/family-usage`);
|
|
10
|
+
/**
|
|
11
|
+
* Kiểm tra dung lượng sử dụng gói ZCloud Gia đình (Family Usage - command 12758)
|
|
12
|
+
*
|
|
13
|
+
* @param viewerKeyInfo (Tùy chọn) Cặp `{ viewer_key, enk }` từ `api.getCloudViewerKey()`. Nếu không truyền sẽ tự động lấy mới.
|
|
14
|
+
* @throws {ZaloApiError}
|
|
15
|
+
*/
|
|
16
|
+
return async function getFamilyUsage(viewerKeyInfo) {
|
|
17
|
+
const keyInfo = viewerKeyInfo !== null && viewerKeyInfo !== void 0 ? viewerKeyInfo : (await api.getCloudViewerKey());
|
|
18
|
+
if (!(keyInfo === null || keyInfo === void 0 ? void 0 : keyInfo.viewer_key) || !(keyInfo === null || keyInfo === void 0 ? void 0 : keyInfo.enk)) {
|
|
19
|
+
throw new ZaloApiError.ZaloApiError("Invalid CloudViewerKey");
|
|
20
|
+
}
|
|
21
|
+
const response = await utils$1.request(serviceURL, {
|
|
22
|
+
method: "GET",
|
|
23
|
+
headers: {
|
|
24
|
+
"cloud-viewer-key": keyInfo.viewer_key,
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
const json = (await response.json());
|
|
28
|
+
if (json.error_code !== 0 && json.error_code !== -904) {
|
|
29
|
+
throw new ZaloApiError.ZaloApiError(json.error_message || "getFamilyUsage failed", json.error_code);
|
|
30
|
+
}
|
|
31
|
+
if (!json.data) {
|
|
32
|
+
throw new ZaloApiError.ZaloApiError("Empty FamilyUsage data", json.error_code);
|
|
33
|
+
}
|
|
34
|
+
const decrypted = utils.decryptZCloudAES(json.data, keyInfo.enk);
|
|
35
|
+
return JSON.parse(decrypted);
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
exports.getFamilyUsageFactory = getFamilyUsageFactory;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ZaloApiError = require('../Errors/ZaloApiError.cjs');
|
|
4
|
+
var utils = require('../utils.cjs');
|
|
5
|
+
|
|
6
|
+
const getFamilyViewerKeyFactory = utils.apiFactory()((_api, _ctx, utils) => {
|
|
7
|
+
const serviceURL = utils.makeURL("https://wpa.chat.zalo.me/api/getFamilyViewerKey");
|
|
8
|
+
/**
|
|
9
|
+
* Lấy cặp khóa phiên (`viewer_key` và khóa giải mã AES-256 `enk`) cho gói gia đình ZFamily (command 12759)
|
|
10
|
+
*
|
|
11
|
+
* @throws {ZaloApiError}
|
|
12
|
+
*/
|
|
13
|
+
return async function getFamilyViewerKey() {
|
|
14
|
+
const response = await utils.request(serviceURL, {
|
|
15
|
+
method: "GET",
|
|
16
|
+
});
|
|
17
|
+
const res = await utils.resolve(response);
|
|
18
|
+
if (typeof res === "string") {
|
|
19
|
+
try {
|
|
20
|
+
return JSON.parse(res);
|
|
21
|
+
}
|
|
22
|
+
catch (_a) {
|
|
23
|
+
throw new ZaloApiError.ZaloApiError("Failed to parse FamilyViewerKey response");
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return res;
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
exports.getFamilyViewerKeyFactory = getFamilyViewerKeyFactory;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ZaloApiError = require('../Errors/ZaloApiError.cjs');
|
|
4
|
+
var utils = require('../utils.cjs');
|
|
5
|
+
|
|
6
|
+
const getFriendsEmojiStatusFactory = utils.apiFactory()((api, _ctx, utils) => {
|
|
7
|
+
var _a;
|
|
8
|
+
const baseDomain = ((_a = api.zpwServiceMap.emoji_stt) === null || _a === void 0 ? void 0 : _a[0]) || "https://emoji-status.chat.zalo.me";
|
|
9
|
+
const serviceURL = utils.makeURL(`${baseDomain}/api/v1/emoji-status/friends`);
|
|
10
|
+
/**
|
|
11
|
+
* Lấy danh sách trạng thái Emoji (Emoji Status) hiện tại của bạn bè (command 16301)
|
|
12
|
+
*
|
|
13
|
+
* @param options Tùy chọn phân trang (`version`, `fromUid`, `maxEmojiStatusId`, `page`)
|
|
14
|
+
* @throws {ZaloApiError}
|
|
15
|
+
*/
|
|
16
|
+
return async function getFriendsEmojiStatus(options = {}) {
|
|
17
|
+
var _a, _b, _c, _d;
|
|
18
|
+
const params = {
|
|
19
|
+
version: (_a = options.version) !== null && _a !== void 0 ? _a : 0,
|
|
20
|
+
fromUid: (_b = options.fromUid) !== null && _b !== void 0 ? _b : "0",
|
|
21
|
+
maxEmojiStatusId: String((_c = options.maxEmojiStatusId) !== null && _c !== void 0 ? _c : "0"),
|
|
22
|
+
page: (_d = options.page) !== null && _d !== void 0 ? _d : 1,
|
|
23
|
+
};
|
|
24
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
25
|
+
if (!encryptedParams) {
|
|
26
|
+
throw new ZaloApiError.ZaloApiError("Failed to encrypt params");
|
|
27
|
+
}
|
|
28
|
+
const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams }), {
|
|
29
|
+
method: "GET",
|
|
30
|
+
});
|
|
31
|
+
return utils.resolve(response);
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
exports.getFriendsEmojiStatusFactory = getFriendsEmojiStatusFactory;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ZaloApiError = require('../Errors/ZaloApiError.cjs');
|
|
4
|
+
require('../models/AutoReply.cjs');
|
|
5
|
+
require('../models/Bank.cjs');
|
|
6
|
+
require('../models/Board.cjs');
|
|
7
|
+
require('../models/Enum.cjs');
|
|
8
|
+
require('../models/FriendEvent.cjs');
|
|
9
|
+
require('../models/Group.cjs');
|
|
10
|
+
require('../models/GroupEvent.cjs');
|
|
11
|
+
var Message = require('../models/Message.cjs');
|
|
12
|
+
require('../models/Reaction.cjs');
|
|
13
|
+
require('../models/Reminder.cjs');
|
|
14
|
+
require('../models/ZBusiness.cjs');
|
|
15
|
+
require('../models/SyncEvent.cjs');
|
|
16
|
+
require('../models/CallEvent.cjs');
|
|
17
|
+
var utils = require('../utils.cjs');
|
|
18
|
+
|
|
19
|
+
const getGroupCloudMessageJumpFactory = utils.apiFactory()((api, ctx, utils) => {
|
|
20
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.group_cloud_message[0]}/api/cm/rgetv2`);
|
|
21
|
+
/**
|
|
22
|
+
* Nhảy tới vị trí một tin nhắn nhóm cụ thể trên Zalo Cloud Message và lấy ngữ cảnh xung quanh (command 12508)
|
|
23
|
+
*
|
|
24
|
+
* @param groupId ID nhóm
|
|
25
|
+
* @param globalMsgId ID tin nhắn toàn cục cần nhảy tới
|
|
26
|
+
* @param count Số lượng tin nhắn ngữ cảnh cần tải (mặc định `20`)
|
|
27
|
+
* @param msgJump Cờ nhảy tin nhắn (mặc định `1`)
|
|
28
|
+
* @param msgIds Danh sách msgId bổ sung (mặc định `[]`)
|
|
29
|
+
* @throws {ZaloApiError}
|
|
30
|
+
*/
|
|
31
|
+
return async function getGroupCloudMessageJump(groupId, globalMsgId, count = 20, msgJump = 1, msgIds = []) {
|
|
32
|
+
if (!groupId)
|
|
33
|
+
throw new ZaloApiError.ZaloApiError("Missing groupId");
|
|
34
|
+
if (groupId.startsWith("g"))
|
|
35
|
+
groupId = groupId.slice(1);
|
|
36
|
+
const params = {
|
|
37
|
+
groupId,
|
|
38
|
+
globalMsgId: String(globalMsgId),
|
|
39
|
+
count: Math.min(Math.max(count, 1), 50),
|
|
40
|
+
msgJump,
|
|
41
|
+
msgIds,
|
|
42
|
+
src: 3,
|
|
43
|
+
};
|
|
44
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
45
|
+
if (!encryptedParams)
|
|
46
|
+
throw new ZaloApiError.ZaloApiError("Failed to encrypt params");
|
|
47
|
+
const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams, nretry: 0 }), {
|
|
48
|
+
method: "GET",
|
|
49
|
+
});
|
|
50
|
+
const page = await utils.resolve(response, (result) => {
|
|
51
|
+
let data = result.data;
|
|
52
|
+
if (typeof data === "string") {
|
|
53
|
+
data = JSON.parse(data);
|
|
54
|
+
}
|
|
55
|
+
return data;
|
|
56
|
+
});
|
|
57
|
+
const rawMsgs = Array.isArray(page === null || page === void 0 ? void 0 : page.groupMsgs) ? page.groupMsgs : [];
|
|
58
|
+
const groupMsgs = rawMsgs.map((data) => new Message.GroupMessage(ctx.uid, data));
|
|
59
|
+
return Object.assign({}, page || {}, { groupMsgs });
|
|
60
|
+
};
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
exports.getGroupCloudMessageJumpFactory = getGroupCloudMessageJumpFactory;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var utils = require('../utils.cjs');
|
|
4
|
+
|
|
5
|
+
const getLastReadContactTabFactory = utils.apiFactory()((api, _ctx, utils) => {
|
|
6
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.friend[0]}/api/friend/last-read-contact-tab`);
|
|
7
|
+
/**
|
|
8
|
+
* Lấy dấu thời gian lần cuối đọc tab Danh bạ (command 12230)
|
|
9
|
+
*
|
|
10
|
+
* @throws {ZaloApiError}
|
|
11
|
+
*/
|
|
12
|
+
return async function getLastReadContactTab() {
|
|
13
|
+
const response = await utils.request(serviceURL, {
|
|
14
|
+
method: "GET",
|
|
15
|
+
});
|
|
16
|
+
return utils.resolve(response);
|
|
17
|
+
};
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
exports.getLastReadContactTabFactory = getLastReadContactTabFactory;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ZaloApiError = require('../Errors/ZaloApiError.cjs');
|
|
4
|
+
var utils = require('../utils.cjs');
|
|
5
|
+
|
|
6
|
+
const getLastSeenFactory = utils.apiFactory()((api, _ctx, utils) => {
|
|
7
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.chat[0]}/api/preloadconvers/get-last-seen`);
|
|
8
|
+
/**
|
|
9
|
+
* Lấy thông tin trạng thái đã xem cuối cùng của danh sách nhóm và cá nhân (command 12009)
|
|
10
|
+
*
|
|
11
|
+
* @param options Danh sách ID nhóm (`groupIds`) và UID cá nhân (`userIds`)
|
|
12
|
+
* @throws {ZaloApiError}
|
|
13
|
+
*/
|
|
14
|
+
return async function getLastSeen(options = {}) {
|
|
15
|
+
var _a, _b;
|
|
16
|
+
const group = ((_a = options.groupIds) !== null && _a !== void 0 ? _a : []).map((g) => (g.startsWith("g") ? g.slice(1) : g));
|
|
17
|
+
const oneone = (_b = options.userIds) !== null && _b !== void 0 ? _b : [];
|
|
18
|
+
const params = {
|
|
19
|
+
param: JSON.stringify({ group, oneone }),
|
|
20
|
+
};
|
|
21
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
22
|
+
if (!encryptedParams) {
|
|
23
|
+
throw new ZaloApiError.ZaloApiError("Failed to encrypt params");
|
|
24
|
+
}
|
|
25
|
+
const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams }), {
|
|
26
|
+
method: "GET",
|
|
27
|
+
});
|
|
28
|
+
return utils.resolve(response, (result) => {
|
|
29
|
+
var _a;
|
|
30
|
+
const raw = result.data;
|
|
31
|
+
if (raw && typeof raw.data === "string") {
|
|
32
|
+
try {
|
|
33
|
+
const inner = JSON.parse(raw.data);
|
|
34
|
+
return ((_a = inner === null || inner === void 0 ? void 0 : inner.data) !== null && _a !== void 0 ? _a : inner);
|
|
35
|
+
}
|
|
36
|
+
catch (_b) {
|
|
37
|
+
return raw;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return raw;
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
exports.getLastSeenFactory = getLastSeenFactory;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ZaloApiError = require('../Errors/ZaloApiError.cjs');
|
|
4
|
+
var utils = require('../utils.cjs');
|
|
5
|
+
|
|
6
|
+
const getLastSeenReactionFactory = utils.apiFactory()((api, _ctx, utils) => {
|
|
7
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.reaction[0]}/api/react/gLastSn`);
|
|
8
|
+
/**
|
|
9
|
+
* Lấy trạng thái đã xem cảm xúc (Reaction) cuối cùng của danh sách nhóm và cá nhân (command 12450)
|
|
10
|
+
*
|
|
11
|
+
* @param options Danh sách ID nhóm (`groupIds`) và UID cá nhân (`userIds`)
|
|
12
|
+
* @throws {ZaloApiError}
|
|
13
|
+
*/
|
|
14
|
+
return async function getLastSeenReaction(options = {}) {
|
|
15
|
+
var _a, _b;
|
|
16
|
+
const group = ((_a = options.groupIds) !== null && _a !== void 0 ? _a : []).map((g) => (g.startsWith("g") ? g.slice(1) : g));
|
|
17
|
+
const oneone = (_b = options.userIds) !== null && _b !== void 0 ? _b : [];
|
|
18
|
+
const params = {
|
|
19
|
+
group,
|
|
20
|
+
oneone,
|
|
21
|
+
};
|
|
22
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
23
|
+
if (!encryptedParams) {
|
|
24
|
+
throw new ZaloApiError.ZaloApiError("Failed to encrypt params");
|
|
25
|
+
}
|
|
26
|
+
const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams }), {
|
|
27
|
+
method: "GET",
|
|
28
|
+
});
|
|
29
|
+
return utils.resolve(response);
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
exports.getLastSeenReactionFactory = getLastSeenReactionFactory;
|