@phuquy2203/n8n-nodes-zl-sumo 2.0.15
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 +0 -0
- package/dist/credentials/ZaloApi.credentials.d.ts +7 -0
- package/dist/credentials/ZaloApi.credentials.js +49 -0
- package/dist/nodes/Zalo/Zalo.node.d.ts +5 -0
- package/dist/nodes/Zalo/Zalo.node.js +260 -0
- package/dist/nodes/Zalo/zalo.png +0 -0
- package/dist/nodes/Zalo/zalo.svg +3 -0
- package/dist/src/Errors/ZaloApiError.d.ts +4 -0
- package/dist/src/Errors/ZaloApiError.js +11 -0
- package/dist/src/Errors/ZaloApiLoginQRAborted.d.ts +4 -0
- package/dist/src/Errors/ZaloApiLoginQRAborted.js +11 -0
- package/dist/src/Errors/ZaloApiLoginQRDeclined.d.ts +4 -0
- package/dist/src/Errors/ZaloApiLoginQRDeclined.js +11 -0
- package/dist/src/Errors/ZaloApiMissingImageMetadataGetter.d.ts +4 -0
- package/dist/src/Errors/ZaloApiMissingImageMetadataGetter.js +11 -0
- package/dist/src/Errors/index.d.ts +4 -0
- package/dist/src/Errors/index.js +20 -0
- package/dist/src/apis/acceptFriendRequest.d.ts +2 -0
- package/dist/src/apis/acceptFriendRequest.js +31 -0
- package/dist/src/apis/addGroupBlockedMember.d.ts +2 -0
- package/dist/src/apis/addGroupBlockedMember.js +31 -0
- package/dist/src/apis/addGroupDeputy.d.ts +2 -0
- package/dist/src/apis/addGroupDeputy.js +33 -0
- package/dist/src/apis/addPollOptions.d.ts +14 -0
- package/dist/src/apis/addPollOptions.js +29 -0
- package/dist/src/apis/addQuickMessage.d.ts +11 -0
- package/dist/src/apis/addQuickMessage.js +63 -0
- package/dist/src/apis/addReaction.d.ts +18 -0
- package/dist/src/apis/addReaction.js +297 -0
- package/dist/src/apis/addUnreadMark.d.ts +8 -0
- package/dist/src/apis/addUnreadMark.js +55 -0
- package/dist/src/apis/addUserToGroup.d.ts +5 -0
- package/dist/src/apis/addUserToGroup.js +37 -0
- package/dist/src/apis/blockUser.d.ts +2 -0
- package/dist/src/apis/blockUser.js +31 -0
- package/dist/src/apis/blockViewFeed.d.ts +2 -0
- package/dist/src/apis/blockViewFeed.js +33 -0
- package/dist/src/apis/changeAccountAvatar.d.ts +3 -0
- package/dist/src/apis/changeAccountAvatar.js +58 -0
- package/dist/src/apis/changeFriendAlias.d.ts +2 -0
- package/dist/src/apis/changeFriendAlias.js +30 -0
- package/dist/src/apis/changeGroupAvatar.d.ts +3 -0
- package/dist/src/apis/changeGroupAvatar.js +50 -0
- package/dist/src/apis/changeGroupName.d.ts +4 -0
- package/dist/src/apis/changeGroupName.js +35 -0
- package/dist/src/apis/changeGroupOwner.d.ts +4 -0
- package/dist/src/apis/changeGroupOwner.js +33 -0
- package/dist/src/apis/createAutoReply.d.ts +14 -0
- package/dist/src/apis/createAutoReply.js +40 -0
- package/dist/src/apis/createCatalog.d.ts +7 -0
- package/dist/src/apis/createCatalog.js +32 -0
- package/dist/src/apis/createGroup.d.ts +28 -0
- package/dist/src/apis/createGroup.js +46 -0
- package/dist/src/apis/createNote.d.ts +7 -0
- package/dist/src/apis/createNote.js +50 -0
- package/dist/src/apis/createPoll.d.ts +36 -0
- package/dist/src/apis/createPoll.js +43 -0
- package/dist/src/apis/createProductCatalog.d.ts +23 -0
- package/dist/src/apis/createProductCatalog.js +53 -0
- package/dist/src/apis/createReminder.d.ts +12 -0
- package/dist/src/apis/createReminder.js +66 -0
- package/dist/src/apis/custom.d.ts +9 -0
- package/dist/src/apis/custom.js +17 -0
- package/dist/src/apis/deleteAutoReply.d.ts +5 -0
- package/dist/src/apis/deleteAutoReply.js +32 -0
- package/dist/src/apis/deleteAvatar.d.ts +9 -0
- package/dist/src/apis/deleteAvatar.js +30 -0
- package/dist/src/apis/deleteCatalog.d.ts +2 -0
- package/dist/src/apis/deleteCatalog.js +31 -0
- package/dist/src/apis/deleteChat.d.ts +19 -0
- package/dist/src/apis/deleteChat.js +53 -0
- package/dist/src/apis/deleteGroupInviteBox.d.ts +9 -0
- package/dist/src/apis/deleteGroupInviteBox.js +30 -0
- package/dist/src/apis/deleteMessage.d.ts +14 -0
- package/dist/src/apis/deleteMessage.js +55 -0
- package/dist/src/apis/deleteProductCatalog.d.ts +10 -0
- package/dist/src/apis/deleteProductCatalog.js +34 -0
- package/dist/src/apis/disableGroupLink.d.ts +2 -0
- package/dist/src/apis/disableGroupLink.js +27 -0
- package/dist/src/apis/disperseGroup.d.ts +2 -0
- package/dist/src/apis/disperseGroup.js +31 -0
- package/dist/src/apis/editNote.d.ts +17 -0
- package/dist/src/apis/editNote.js +49 -0
- package/dist/src/apis/editReminder.d.ts +13 -0
- package/dist/src/apis/editReminder.js +64 -0
- package/dist/src/apis/enableGroupLink.d.ts +6 -0
- package/dist/src/apis/enableGroupLink.js +28 -0
- package/dist/src/apis/fetchAccountInfo.d.ts +3 -0
- package/dist/src/apis/fetchAccountInfo.js +13 -0
- package/dist/src/apis/findUser.d.ts +15 -0
- package/dist/src/apis/findUser.js +43 -0
- package/dist/src/apis/forwardMessage.d.ts +24 -0
- package/dist/src/apis/forwardMessage.js +102 -0
- package/dist/src/apis/getAliasList.d.ts +8 -0
- package/dist/src/apis/getAliasList.js +30 -0
- package/dist/src/apis/getAllFriends.d.ts +3 -0
- package/dist/src/apis/getAllFriends.js +35 -0
- package/dist/src/apis/getAllGroups.d.ts +7 -0
- package/dist/src/apis/getAllGroups.js +13 -0
- package/dist/src/apis/getArchivedChatList.d.ts +5 -0
- package/dist/src/apis/getArchivedChatList.js +26 -0
- package/dist/src/apis/getAutoDeleteChat.d.ts +9 -0
- package/dist/src/apis/getAutoDeleteChat.js +24 -0
- package/dist/src/apis/getAutoReplyList.d.ts +6 -0
- package/dist/src/apis/getAutoReplyList.js +27 -0
- package/dist/src/apis/getAvatarList.d.ts +12 -0
- package/dist/src/apis/getAvatarList.js +31 -0
- package/dist/src/apis/getBizAccount.d.ts +24 -0
- package/dist/src/apis/getBizAccount.js +30 -0
- package/dist/src/apis/getCatalogList.d.ts +18 -0
- package/dist/src/apis/getCatalogList.js +35 -0
- package/dist/src/apis/getContext.d.ts +1 -0
- package/dist/src/apis/getContext.js +7 -0
- package/dist/src/apis/getCookie.d.ts +1 -0
- package/dist/src/apis/getCookie.js +12 -0
- package/dist/src/apis/getFriendBoardList.d.ts +5 -0
- package/dist/src/apis/getFriendBoardList.js +29 -0
- package/dist/src/apis/getFriendOnlines.d.ts +10 -0
- package/dist/src/apis/getFriendOnlines.js +38 -0
- package/dist/src/apis/getFriendRecommendations.d.ts +42 -0
- package/dist/src/apis/getFriendRecommendations.js +30 -0
- package/dist/src/apis/getFriendRequestStatus.d.ts +8 -0
- package/dist/src/apis/getFriendRequestStatus.js +28 -0
- package/dist/src/apis/getGroupBlockedMember.d.ts +23 -0
- package/dist/src/apis/getGroupBlockedMember.js +32 -0
- package/dist/src/apis/getGroupInfo.d.ts +16 -0
- package/dist/src/apis/getGroupInfo.js +35 -0
- package/dist/src/apis/getGroupInviteBoxInfo.d.ts +32 -0
- package/dist/src/apis/getGroupInviteBoxInfo.js +41 -0
- package/dist/src/apis/getGroupInviteBoxList.d.ts +38 -0
- package/dist/src/apis/getGroupInviteBoxList.js +34 -0
- package/dist/src/apis/getGroupLinkDetail.d.ts +9 -0
- package/dist/src/apis/getGroupLinkDetail.js +28 -0
- package/dist/src/apis/getGroupLinkInfo.d.ts +34 -0
- package/dist/src/apis/getGroupLinkInfo.js +31 -0
- package/dist/src/apis/getGroupMembersInfo.d.ts +17 -0
- package/dist/src/apis/getGroupMembersInfo.js +27 -0
- package/dist/src/apis/getHiddenConversations.d.ts +11 -0
- package/dist/src/apis/getHiddenConversations.js +26 -0
- package/dist/src/apis/getLabels.d.ts +7 -0
- package/dist/src/apis/getLabels.js +31 -0
- package/dist/src/apis/getListBoard.d.ts +21 -0
- package/dist/src/apis/getListBoard.js +48 -0
- package/dist/src/apis/getListReminder.d.ts +28 -0
- package/dist/src/apis/getListReminder.js +50 -0
- package/dist/src/apis/getMute.d.ts +13 -0
- package/dist/src/apis/getMute.js +25 -0
- package/dist/src/apis/getOwnId.d.ts +1 -0
- package/dist/src/apis/getOwnId.js +7 -0
- package/dist/src/apis/getPendingGroupMembers.d.ts +11 -0
- package/dist/src/apis/getPendingGroupMembers.js +30 -0
- package/dist/src/apis/getPinConversations.d.ts +5 -0
- package/dist/src/apis/getPinConversations.js +25 -0
- package/dist/src/apis/getPollDetail.d.ts +3 -0
- package/dist/src/apis/getPollDetail.js +33 -0
- package/dist/src/apis/getProductCatalogList.d.ts +20 -0
- package/dist/src/apis/getProductCatalogList.js +36 -0
- package/dist/src/apis/getQR.d.ts +4 -0
- package/dist/src/apis/getQR.js +32 -0
- package/dist/src/apis/getQuickMessageList.d.ts +7 -0
- package/dist/src/apis/getQuickMessageList.js +27 -0
- package/dist/src/apis/getRelatedFriendGroup.d.ts +6 -0
- package/dist/src/apis/getRelatedFriendGroup.js +33 -0
- package/dist/src/apis/getReminder.d.ts +3 -0
- package/dist/src/apis/getReminder.js +28 -0
- package/dist/src/apis/getReminderResponses.d.ts +5 -0
- package/dist/src/apis/getReminderResponses.js +27 -0
- package/dist/src/apis/getSentFriendRequest.d.ts +18 -0
- package/dist/src/apis/getSentFriendRequest.js +27 -0
- package/dist/src/apis/getSettings.d.ts +3 -0
- package/dist/src/apis/getSettings.js +23 -0
- package/dist/src/apis/getStickers.d.ts +1 -0
- package/dist/src/apis/getStickers.js +43 -0
- package/dist/src/apis/getStickersDetail.d.ts +24 -0
- package/dist/src/apis/getStickersDetail.js +43 -0
- package/dist/src/apis/getUnreadMark.d.ts +14 -0
- package/dist/src/apis/getUnreadMark.js +33 -0
- package/dist/src/apis/getUserInfo.d.ts +8 -0
- package/dist/src/apis/getUserInfo.js +45 -0
- package/dist/src/apis/inviteUserToGroups.d.ts +10 -0
- package/dist/src/apis/inviteUserToGroups.js +33 -0
- package/dist/src/apis/joinGroupInviteBox.d.ts +2 -0
- package/dist/src/apis/joinGroupInviteBox.js +28 -0
- package/dist/src/apis/joinGroupLink.d.ts +2 -0
- package/dist/src/apis/joinGroupLink.js +30 -0
- package/dist/src/apis/keepAlive.d.ts +4 -0
- package/dist/src/apis/keepAlive.js +25 -0
- package/dist/src/apis/lastOnline.d.ts +7 -0
- package/dist/src/apis/lastOnline.js +29 -0
- package/dist/src/apis/leaveGroup.d.ts +4 -0
- package/dist/src/apis/leaveGroup.js +36 -0
- package/dist/src/apis/listen.d.ts +103 -0
- package/dist/src/apis/listen.js +432 -0
- package/dist/src/apis/lockPoll.d.ts +2 -0
- package/dist/src/apis/lockPoll.js +31 -0
- package/dist/src/apis/login.d.ts +3 -0
- package/dist/src/apis/login.js +101 -0
- package/dist/src/apis/loginQR.d.ts +70 -0
- package/dist/src/apis/loginQR.js +369 -0
- package/dist/src/apis/parseLink.d.ts +21 -0
- package/dist/src/apis/parseLink.js +30 -0
- package/dist/src/apis/rejectFriendRequest.d.ts +2 -0
- package/dist/src/apis/rejectFriendRequest.js +30 -0
- package/dist/src/apis/removeFriend.d.ts +2 -0
- package/dist/src/apis/removeFriend.js +31 -0
- package/dist/src/apis/removeFriendAlias.d.ts +2 -0
- package/dist/src/apis/removeFriendAlias.js +27 -0
- package/dist/src/apis/removeGroupBlockedMember.d.ts +2 -0
- package/dist/src/apis/removeGroupBlockedMember.js +31 -0
- package/dist/src/apis/removeGroupDeputy.d.ts +2 -0
- package/dist/src/apis/removeGroupDeputy.js +33 -0
- package/dist/src/apis/removeQuickMessage.d.ts +5 -0
- package/dist/src/apis/removeQuickMessage.js +30 -0
- package/dist/src/apis/removeReminder.d.ts +3 -0
- package/dist/src/apis/removeReminder.js +43 -0
- package/dist/src/apis/removeUnreadMark.d.ts +8 -0
- package/dist/src/apis/removeUnreadMark.js +53 -0
- package/dist/src/apis/removeUserFromGroup.d.ts +4 -0
- package/dist/src/apis/removeUserFromGroup.js +37 -0
- package/dist/src/apis/resetHiddenConversPin.d.ts +2 -0
- package/dist/src/apis/resetHiddenConversPin.js +23 -0
- package/dist/src/apis/reuseAvatar.d.ts +2 -0
- package/dist/src/apis/reuseAvatar.js +29 -0
- package/dist/src/apis/reviewPendingMemberRequest.d.ts +14 -0
- package/dist/src/apis/reviewPendingMemberRequest.js +41 -0
- package/dist/src/apis/sendBankCard.d.ts +9 -0
- package/dist/src/apis/sendBankCard.js +40 -0
- package/dist/src/apis/sendCard.d.ts +10 -0
- package/dist/src/apis/sendCard.js +62 -0
- package/dist/src/apis/sendDeliveredEvent.d.ts +16 -0
- package/dist/src/apis/sendDeliveredEvent.js +58 -0
- package/dist/src/apis/sendFriendRequest.d.ts +2 -0
- package/dist/src/apis/sendFriendRequest.js +42 -0
- package/dist/src/apis/sendLink.d.ts +10 -0
- package/dist/src/apis/sendLink.js +64 -0
- package/dist/src/apis/sendMessage.d.ts +99 -0
- package/dist/src/apis/sendMessage.js +455 -0
- package/dist/src/apis/sendReport.d.ts +17 -0
- package/dist/src/apis/sendReport.js +56 -0
- package/dist/src/apis/sendSeenEvent.d.ts +16 -0
- package/dist/src/apis/sendSeenEvent.js +66 -0
- package/dist/src/apis/sendSticker.d.ts +10 -0
- package/dist/src/apis/sendSticker.js +60 -0
- package/dist/src/apis/sendTypingEvent.d.ts +5 -0
- package/dist/src/apis/sendTypingEvent.js +36 -0
- package/dist/src/apis/sendVideo.d.ts +35 -0
- package/dist/src/apis/sendVideo.js +121 -0
- package/dist/src/apis/sendVoice.d.ts +12 -0
- package/dist/src/apis/sendVoice.js +76 -0
- package/dist/src/apis/setArchivedConversations.d.ts +10 -0
- package/dist/src/apis/setArchivedConversations.js +37 -0
- package/dist/src/apis/setHiddenConversations.d.ts +3 -0
- package/dist/src/apis/setHiddenConversations.js +42 -0
- package/dist/src/apis/setMute.d.ts +20 -0
- package/dist/src/apis/setMute.js +70 -0
- package/dist/src/apis/setPinnedConversations.d.ts +3 -0
- package/dist/src/apis/setPinnedConversations.js +37 -0
- package/dist/src/apis/sharePoll.d.ts +2 -0
- package/dist/src/apis/sharePoll.js +31 -0
- package/dist/src/apis/unblockUser.d.ts +2 -0
- package/dist/src/apis/unblockUser.js +31 -0
- package/dist/src/apis/undo.d.ts +9 -0
- package/dist/src/apis/undo.js +45 -0
- package/dist/src/apis/undoFriendRequest.d.ts +2 -0
- package/dist/src/apis/undoFriendRequest.js +30 -0
- package/dist/src/apis/updateActiveStatus.d.ts +4 -0
- package/dist/src/apis/updateActiveStatus.js +30 -0
- package/dist/src/apis/updateAutoDeleteChat.d.ts +9 -0
- package/dist/src/apis/updateAutoDeleteChat.js +43 -0
- package/dist/src/apis/updateAutoReply.d.ts +15 -0
- package/dist/src/apis/updateAutoReply.js +41 -0
- package/dist/src/apis/updateCatalog.d.ts +11 -0
- package/dist/src/apis/updateCatalog.js +33 -0
- package/dist/src/apis/updateGroupSettings.d.ts +40 -0
- package/dist/src/apis/updateGroupSettings.js +46 -0
- package/dist/src/apis/updateHiddenConversPin.d.ts +2 -0
- package/dist/src/apis/updateHiddenConversPin.js +33 -0
- package/dist/src/apis/updateLabels.d.ts +15 -0
- package/dist/src/apis/updateLabels.js +37 -0
- package/dist/src/apis/updateLang.d.ts +6 -0
- package/dist/src/apis/updateLang.js +33 -0
- package/dist/src/apis/updateProductCatalog.d.ts +25 -0
- package/dist/src/apis/updateProductCatalog.js +54 -0
- package/dist/src/apis/updateProfile.d.ts +20 -0
- package/dist/src/apis/updateProfile.js +46 -0
- package/dist/src/apis/updateQuickMessage.d.ts +11 -0
- package/dist/src/apis/updateQuickMessage.js +64 -0
- package/dist/src/apis/updateSettings.d.ts +16 -0
- package/dist/src/apis/updateSettings.js +93 -0
- package/dist/src/apis/uploadAttachment.d.ts +50 -0
- package/dist/src/apis/uploadAttachment.js +202 -0
- package/dist/src/apis/uploadProductPhoto.d.ts +14 -0
- package/dist/src/apis/uploadProductPhoto.js +56 -0
- package/dist/src/apis/votePoll.d.ts +5 -0
- package/dist/src/apis/votePoll.js +32 -0
- package/dist/src/apis.d.ts +279 -0
- package/dist/src/apis.js +283 -0
- package/dist/src/context.d.ts +183 -0
- package/dist/src/context.js +33 -0
- package/dist/src/index.d.ts +146 -0
- package/dist/src/index.js +41 -0
- package/dist/src/models/Attachment.d.ts +11 -0
- package/dist/src/models/Attachment.js +2 -0
- package/dist/src/models/AutoReply.d.ts +20 -0
- package/dist/src/models/AutoReply.js +10 -0
- package/dist/src/models/Board.d.ts +60 -0
- package/dist/src/models/Board.js +9 -0
- package/dist/src/models/Catalog.d.ts +16 -0
- package/dist/src/models/Catalog.js +2 -0
- package/dist/src/models/DeliveredMessage.d.ts +27 -0
- package/dist/src/models/DeliveredMessage.js +22 -0
- package/dist/src/models/Enum.d.ts +247 -0
- package/dist/src/models/Enum.js +254 -0
- package/dist/src/models/FriendEvent.d.ts +107 -0
- package/dist/src/models/FriendEvent.js +87 -0
- package/dist/src/models/Group.d.ts +125 -0
- package/dist/src/models/Group.js +14 -0
- package/dist/src/models/GroupEvent.d.ts +178 -0
- package/dist/src/models/GroupEvent.js +94 -0
- package/dist/src/models/Label.d.ts +10 -0
- package/dist/src/models/Label.js +2 -0
- package/dist/src/models/Message.d.ts +91 -0
- package/dist/src/models/Message.js +34 -0
- package/dist/src/models/ProductCatalog.d.ts +17 -0
- package/dist/src/models/ProductCatalog.js +2 -0
- package/dist/src/models/QuickMessage.d.ts +25 -0
- package/dist/src/models/QuickMessage.js +2 -0
- package/dist/src/models/Reaction.d.ts +85 -0
- package/dist/src/models/Reaction.js +74 -0
- package/dist/src/models/Reminder.d.ts +51 -0
- package/dist/src/models/Reminder.js +10 -0
- package/dist/src/models/SeenMessage.d.ts +26 -0
- package/dist/src/models/SeenMessage.js +22 -0
- package/dist/src/models/Typing.d.ts +24 -0
- package/dist/src/models/Typing.js +22 -0
- package/dist/src/models/Undo.d.ts +34 -0
- package/dist/src/models/Undo.js +16 -0
- package/dist/src/models/User.d.ts +49 -0
- package/dist/src/models/User.js +2 -0
- package/dist/src/models/ZBusiness.d.ts +22 -0
- package/dist/src/models/ZBusiness.js +38 -0
- package/dist/src/models/index.d.ts +20 -0
- package/dist/src/models/index.js +36 -0
- package/dist/src/update.d.ts +2 -0
- package/dist/src/update.js +33 -0
- package/dist/src/utils.d.ts +169 -0
- package/dist/src/utils.js +737 -0
- package/dist/src/zalo.d.ts +41 -0
- package/dist/src/zalo.js +110 -0
- package/package.json +60 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findUserFactory = void 0;
|
|
4
|
+
const ZaloApiError_js_1 = require("../Errors/ZaloApiError.js");
|
|
5
|
+
const utils_js_1 = require("../utils.js");
|
|
6
|
+
exports.findUserFactory = (0, utils_js_1.apiFactory)()((api, ctx, utils) => {
|
|
7
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.friend[0]}/api/friend/profile/get`);
|
|
8
|
+
/**
|
|
9
|
+
* Find user by phone number
|
|
10
|
+
*
|
|
11
|
+
* @param phoneNumber Phone number
|
|
12
|
+
*
|
|
13
|
+
* @throws {ZaloApiError}
|
|
14
|
+
*/
|
|
15
|
+
return async function findUser(phoneNumber) {
|
|
16
|
+
if (!phoneNumber)
|
|
17
|
+
throw new ZaloApiError_js_1.ZaloApiError("Missing phoneNumber");
|
|
18
|
+
if (phoneNumber.startsWith("0")) {
|
|
19
|
+
if (ctx.language == "vi")
|
|
20
|
+
phoneNumber = "84" + phoneNumber.slice(1);
|
|
21
|
+
}
|
|
22
|
+
const params = {
|
|
23
|
+
phone: phoneNumber,
|
|
24
|
+
avatar_size: 240,
|
|
25
|
+
language: ctx.language,
|
|
26
|
+
imei: ctx.imei,
|
|
27
|
+
reqSrc: 40,
|
|
28
|
+
};
|
|
29
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
30
|
+
if (!encryptedParams)
|
|
31
|
+
throw new ZaloApiError_js_1.ZaloApiError("Failed to encrypt message");
|
|
32
|
+
const finalServiceUrl = new URL(serviceURL);
|
|
33
|
+
finalServiceUrl.searchParams.append("params", encryptedParams);
|
|
34
|
+
const response = await utils.request(utils.makeURL(finalServiceUrl.toString(), {
|
|
35
|
+
params: encryptedParams,
|
|
36
|
+
}));
|
|
37
|
+
return utils.resolve(response, (result) => {
|
|
38
|
+
if (result.error && result.error.code != 216)
|
|
39
|
+
throw new ZaloApiError_js_1.ZaloApiError(result.error.message, result.error.code);
|
|
40
|
+
return result.data;
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ThreadType } from "../models/index.js";
|
|
2
|
+
export type ForwardMessagePayload = {
|
|
3
|
+
message: string;
|
|
4
|
+
ttl?: number;
|
|
5
|
+
reference?: {
|
|
6
|
+
id: string;
|
|
7
|
+
ts: number;
|
|
8
|
+
logSrcType: number;
|
|
9
|
+
fwLvl: number;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export type ForwardMessageSuccess = {
|
|
13
|
+
clientId: string;
|
|
14
|
+
msgId: string;
|
|
15
|
+
};
|
|
16
|
+
export type ForwardMessageFail = {
|
|
17
|
+
clientId: string;
|
|
18
|
+
error_code: string;
|
|
19
|
+
};
|
|
20
|
+
export type ForwardMessageResponse = {
|
|
21
|
+
success: ForwardMessageSuccess[];
|
|
22
|
+
fail: ForwardMessageFail[];
|
|
23
|
+
};
|
|
24
|
+
export declare const forwardMessageFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").API) => (payload: ForwardMessagePayload, threadIds: string[], type?: ThreadType) => Promise<ForwardMessageResponse>;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.forwardMessageFactory = void 0;
|
|
4
|
+
const ZaloApiError_js_1 = require("../Errors/ZaloApiError.js");
|
|
5
|
+
const index_js_1 = require("../models/index.js");
|
|
6
|
+
const utils_js_1 = require("../utils.js");
|
|
7
|
+
exports.forwardMessageFactory = (0, utils_js_1.apiFactory)()((api, ctx, utils) => {
|
|
8
|
+
const serviceURL = {
|
|
9
|
+
[index_js_1.ThreadType.User]: utils.makeURL(`${api.zpwServiceMap.file[0]}/api/message/mforward`),
|
|
10
|
+
[index_js_1.ThreadType.Group]: utils.makeURL(`${api.zpwServiceMap.file[0]}/api/group/mforward`),
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Forward message to multiple threads
|
|
14
|
+
*
|
|
15
|
+
* @param payload Forward message payload
|
|
16
|
+
* @param threadId Thread ID(s)
|
|
17
|
+
* @param type Thread type (User/Group)
|
|
18
|
+
*
|
|
19
|
+
* @throws {ZaloApiError}
|
|
20
|
+
*/
|
|
21
|
+
return async function forwardMessage(payload, threadIds, type = index_js_1.ThreadType.User) {
|
|
22
|
+
var _a, _b;
|
|
23
|
+
if (!payload.message)
|
|
24
|
+
throw new ZaloApiError_js_1.ZaloApiError("Missing message content");
|
|
25
|
+
if (!threadIds || threadIds.length === 0)
|
|
26
|
+
throw new ZaloApiError_js_1.ZaloApiError("Missing thread IDs");
|
|
27
|
+
const timestamp = Date.now();
|
|
28
|
+
const clientId = timestamp.toString();
|
|
29
|
+
const msgInfo = {
|
|
30
|
+
message: payload.message,
|
|
31
|
+
reference: payload.reference
|
|
32
|
+
? JSON.stringify({
|
|
33
|
+
type: 3,
|
|
34
|
+
data: JSON.stringify(payload.reference),
|
|
35
|
+
})
|
|
36
|
+
: undefined,
|
|
37
|
+
};
|
|
38
|
+
const decorLog = payload.reference
|
|
39
|
+
? {
|
|
40
|
+
fw: {
|
|
41
|
+
pmsg: {
|
|
42
|
+
st: 1,
|
|
43
|
+
ts: payload.reference.ts,
|
|
44
|
+
id: payload.reference.id,
|
|
45
|
+
},
|
|
46
|
+
rmsg: {
|
|
47
|
+
st: 1,
|
|
48
|
+
ts: payload.reference.ts,
|
|
49
|
+
id: payload.reference.id,
|
|
50
|
+
},
|
|
51
|
+
fwLvl: payload.reference.fwLvl,
|
|
52
|
+
},
|
|
53
|
+
}
|
|
54
|
+
: null;
|
|
55
|
+
let params;
|
|
56
|
+
if (type === index_js_1.ThreadType.User) {
|
|
57
|
+
params = {
|
|
58
|
+
toIds: threadIds.map((threadId) => {
|
|
59
|
+
var _a;
|
|
60
|
+
return ({
|
|
61
|
+
clientId,
|
|
62
|
+
toUid: threadId,
|
|
63
|
+
ttl: (_a = payload.ttl) !== null && _a !== void 0 ? _a : 0,
|
|
64
|
+
});
|
|
65
|
+
}),
|
|
66
|
+
imei: ctx.imei,
|
|
67
|
+
ttl: (_a = payload.ttl) !== null && _a !== void 0 ? _a : 0,
|
|
68
|
+
msgType: "1",
|
|
69
|
+
totalIds: threadIds.length,
|
|
70
|
+
msgInfo: JSON.stringify(msgInfo),
|
|
71
|
+
decorLog: JSON.stringify(decorLog),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
params = {
|
|
76
|
+
grids: threadIds.map((threadId) => {
|
|
77
|
+
var _a;
|
|
78
|
+
return ({
|
|
79
|
+
clientId,
|
|
80
|
+
grid: threadId,
|
|
81
|
+
ttl: (_a = payload.ttl) !== null && _a !== void 0 ? _a : 0,
|
|
82
|
+
});
|
|
83
|
+
}),
|
|
84
|
+
ttl: (_b = payload.ttl) !== null && _b !== void 0 ? _b : 0,
|
|
85
|
+
msgType: "1",
|
|
86
|
+
totalIds: threadIds.length,
|
|
87
|
+
msgInfo: JSON.stringify(msgInfo),
|
|
88
|
+
decorLog: JSON.stringify(decorLog),
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
92
|
+
if (!encryptedParams)
|
|
93
|
+
throw new ZaloApiError_js_1.ZaloApiError("Failed to encrypt params");
|
|
94
|
+
const response = await utils.request(serviceURL[type], {
|
|
95
|
+
method: "POST",
|
|
96
|
+
body: new URLSearchParams({
|
|
97
|
+
params: encryptedParams,
|
|
98
|
+
}),
|
|
99
|
+
});
|
|
100
|
+
return utils.resolve(response);
|
|
101
|
+
};
|
|
102
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type GetAliasListResponse = {
|
|
2
|
+
items: {
|
|
3
|
+
userId: string;
|
|
4
|
+
alias: string;
|
|
5
|
+
}[];
|
|
6
|
+
updateTime: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const getAliasListFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").API) => (count?: number, page?: number) => Promise<GetAliasListResponse>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAliasListFactory = void 0;
|
|
4
|
+
const ZaloApiError_js_1 = require("../Errors/ZaloApiError.js");
|
|
5
|
+
const utils_js_1 = require("../utils.js");
|
|
6
|
+
exports.getAliasListFactory = (0, utils_js_1.apiFactory)()((api, ctx, utils) => {
|
|
7
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.alias[0]}/api/alias/list`);
|
|
8
|
+
/**
|
|
9
|
+
* Get alias list
|
|
10
|
+
*
|
|
11
|
+
* @param count Page size (default: 100)
|
|
12
|
+
* @param page Page number (default: 1)
|
|
13
|
+
*
|
|
14
|
+
* @throws {ZaloApiError}
|
|
15
|
+
*/
|
|
16
|
+
return async function getAliasList(count = 100, page = 1) {
|
|
17
|
+
const params = {
|
|
18
|
+
page,
|
|
19
|
+
count,
|
|
20
|
+
imei: ctx.imei,
|
|
21
|
+
};
|
|
22
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
23
|
+
if (!encryptedParams)
|
|
24
|
+
throw new ZaloApiError_js_1.ZaloApiError("Failed to encrypt params");
|
|
25
|
+
const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams }), {
|
|
26
|
+
method: "GET",
|
|
27
|
+
});
|
|
28
|
+
return utils.resolve(response);
|
|
29
|
+
};
|
|
30
|
+
});
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { User } from "../models/index.js";
|
|
2
|
+
export type GetAllFriendsResponse = User[];
|
|
3
|
+
export declare const getAllFriendsFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").API) => (count?: number, page?: number) => Promise<GetAllFriendsResponse>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAllFriendsFactory = void 0;
|
|
4
|
+
const ZaloApiError_js_1 = require("../Errors/ZaloApiError.js");
|
|
5
|
+
const utils_js_1 = require("../utils.js");
|
|
6
|
+
exports.getAllFriendsFactory = (0, utils_js_1.apiFactory)()((api, ctx, utils) => {
|
|
7
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.profile[0]}/api/social/friend/getfriends`);
|
|
8
|
+
/**
|
|
9
|
+
* Get all friends
|
|
10
|
+
*
|
|
11
|
+
* @param count Page size (default: 20000)
|
|
12
|
+
* @param page Page number (default: 1)
|
|
13
|
+
*
|
|
14
|
+
* @throws {ZaloApiError}
|
|
15
|
+
*/
|
|
16
|
+
return async function getAllFriends(count = 20000, page = 1) {
|
|
17
|
+
const params = {
|
|
18
|
+
incInvalid: 1,
|
|
19
|
+
page,
|
|
20
|
+
count,
|
|
21
|
+
avatar_size: 120,
|
|
22
|
+
actiontime: 0,
|
|
23
|
+
imei: ctx.imei,
|
|
24
|
+
};
|
|
25
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
26
|
+
if (!encryptedParams)
|
|
27
|
+
throw new ZaloApiError_js_1.ZaloApiError("Failed to encrypt message");
|
|
28
|
+
const response = await utils.request(utils.makeURL(serviceURL, {
|
|
29
|
+
params: encryptedParams,
|
|
30
|
+
}), {
|
|
31
|
+
method: "GET",
|
|
32
|
+
});
|
|
33
|
+
return utils.resolve(response);
|
|
34
|
+
};
|
|
35
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type GetAllGroupsResponse = {
|
|
2
|
+
version: string;
|
|
3
|
+
gridVerMap: {
|
|
4
|
+
[groupId: string]: string;
|
|
5
|
+
};
|
|
6
|
+
};
|
|
7
|
+
export declare const getAllGroupsFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").API) => () => Promise<GetAllGroupsResponse>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAllGroupsFactory = void 0;
|
|
4
|
+
const utils_js_1 = require("../utils.js");
|
|
5
|
+
exports.getAllGroupsFactory = (0, utils_js_1.apiFactory)()((api, _, utils) => {
|
|
6
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.group_poll[0]}/api/group/getlg/v4`);
|
|
7
|
+
return async function getAllGroups() {
|
|
8
|
+
const response = await utils.request(serviceURL, {
|
|
9
|
+
method: "GET",
|
|
10
|
+
});
|
|
11
|
+
return utils.resolve(response);
|
|
12
|
+
};
|
|
13
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getArchivedChatListFactory = void 0;
|
|
4
|
+
const ZaloApiError_js_1 = require("../Errors/ZaloApiError.js");
|
|
5
|
+
const utils_js_1 = require("../utils.js");
|
|
6
|
+
exports.getArchivedChatListFactory = (0, utils_js_1.apiFactory)()((api, ctx, utils) => {
|
|
7
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.label[0]}/api/archivedchat/list`);
|
|
8
|
+
/**
|
|
9
|
+
* Get arcnived chat list
|
|
10
|
+
*
|
|
11
|
+
* @throws {ZaloApiError}
|
|
12
|
+
*/
|
|
13
|
+
return async function getArchivedChatList() {
|
|
14
|
+
const params = {
|
|
15
|
+
version: 1,
|
|
16
|
+
imei: ctx.imei,
|
|
17
|
+
};
|
|
18
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
19
|
+
if (!encryptedParams)
|
|
20
|
+
throw new ZaloApiError_js_1.ZaloApiError("Failed to encrypt params");
|
|
21
|
+
const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams }), {
|
|
22
|
+
method: "GET",
|
|
23
|
+
});
|
|
24
|
+
return utils.resolve(response);
|
|
25
|
+
};
|
|
26
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type GetAutoDeleteChatResponse = {
|
|
2
|
+
convers: {
|
|
3
|
+
destId: string;
|
|
4
|
+
isGroup: boolean;
|
|
5
|
+
ttl: number;
|
|
6
|
+
createdAt: number;
|
|
7
|
+
}[];
|
|
8
|
+
};
|
|
9
|
+
export declare const getAutoDeleteChatFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").API) => () => Promise<GetAutoDeleteChatResponse>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAutoDeleteChatFactory = void 0;
|
|
4
|
+
const ZaloApiError_js_1 = require("../Errors/ZaloApiError.js");
|
|
5
|
+
const utils_js_1 = require("../utils.js");
|
|
6
|
+
exports.getAutoDeleteChatFactory = (0, utils_js_1.apiFactory)()((api, _ctx, utils) => {
|
|
7
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.conversation[0]}/api/conv/autodelete/getConvers`);
|
|
8
|
+
/**
|
|
9
|
+
* Get auto delete chat
|
|
10
|
+
*
|
|
11
|
+
* @throws {ZaloApiError}
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
return async function getAutoDeleteChat() {
|
|
15
|
+
const params = {};
|
|
16
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
17
|
+
if (!encryptedParams)
|
|
18
|
+
throw new ZaloApiError_js_1.ZaloApiError("Failed to encrypt params");
|
|
19
|
+
const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams }), {
|
|
20
|
+
method: "GET",
|
|
21
|
+
});
|
|
22
|
+
return utils.resolve(response);
|
|
23
|
+
};
|
|
24
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { AutoReplyItem } from "../models/index.js";
|
|
2
|
+
export type GetAutoReplyListResponse = {
|
|
3
|
+
item: AutoReplyItem[];
|
|
4
|
+
version: number;
|
|
5
|
+
};
|
|
6
|
+
export declare const getAutoReplyListFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").API) => () => Promise<GetAutoReplyListResponse>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAutoReplyListFactory = void 0;
|
|
4
|
+
const ZaloApiError_js_1 = require("../Errors/ZaloApiError.js");
|
|
5
|
+
const utils_js_1 = require("../utils.js");
|
|
6
|
+
exports.getAutoReplyListFactory = (0, utils_js_1.apiFactory)()((api, ctx, utils) => {
|
|
7
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.auto_reply[0]}/api/autoreply/list`);
|
|
8
|
+
/**
|
|
9
|
+
* Get auto reply list
|
|
10
|
+
*
|
|
11
|
+
* @note this API used for zBusiness
|
|
12
|
+
* @throws {ZaloApiError}
|
|
13
|
+
*/
|
|
14
|
+
return async function getAutoReplyList() {
|
|
15
|
+
const params = {
|
|
16
|
+
version: 0,
|
|
17
|
+
cliLang: ctx.language,
|
|
18
|
+
};
|
|
19
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
20
|
+
if (!encryptedParams)
|
|
21
|
+
throw new ZaloApiError_js_1.ZaloApiError("Failed to encrypt params");
|
|
22
|
+
const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams }), {
|
|
23
|
+
method: "GET",
|
|
24
|
+
});
|
|
25
|
+
return utils.resolve(response);
|
|
26
|
+
};
|
|
27
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type GetAvatarListResponse = {
|
|
2
|
+
albumId: string;
|
|
3
|
+
nextPhotoId: string;
|
|
4
|
+
hasMore: number;
|
|
5
|
+
photos: {
|
|
6
|
+
photoId: string;
|
|
7
|
+
thumbnail: string;
|
|
8
|
+
url: string;
|
|
9
|
+
bkUrl: string;
|
|
10
|
+
}[];
|
|
11
|
+
};
|
|
12
|
+
export declare const getAvatarListFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").API) => (count?: number, page?: number) => Promise<GetAvatarListResponse>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAvatarListFactory = void 0;
|
|
4
|
+
const ZaloApiError_js_1 = require("../Errors/ZaloApiError.js");
|
|
5
|
+
const utils_js_1 = require("../utils.js");
|
|
6
|
+
exports.getAvatarListFactory = (0, utils_js_1.apiFactory)()((api, ctx, utils) => {
|
|
7
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.profile[0]}/api/social/avatar-list`);
|
|
8
|
+
/**
|
|
9
|
+
* Get avatar list
|
|
10
|
+
*
|
|
11
|
+
* @param count The number of avatars to fetch (default: 50)
|
|
12
|
+
* @param page The page number to fetch (default: 1)
|
|
13
|
+
*
|
|
14
|
+
* @throws {ZaloApiError}
|
|
15
|
+
*/
|
|
16
|
+
return async function getAvatarList(count = 50, page = 1) {
|
|
17
|
+
const params = {
|
|
18
|
+
page,
|
|
19
|
+
albumId: "0",
|
|
20
|
+
count,
|
|
21
|
+
imei: ctx.imei,
|
|
22
|
+
};
|
|
23
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
24
|
+
if (!encryptedParams)
|
|
25
|
+
throw new ZaloApiError_js_1.ZaloApiError("Failed to encrypt params");
|
|
26
|
+
const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams }), {
|
|
27
|
+
method: "GET",
|
|
28
|
+
});
|
|
29
|
+
return utils.resolve(response);
|
|
30
|
+
};
|
|
31
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { BusinessCategory } from "../models/index.js";
|
|
2
|
+
export type GetBizAccountResponse = {
|
|
3
|
+
biz?: {
|
|
4
|
+
desc: string | null;
|
|
5
|
+
cate: BusinessCategory;
|
|
6
|
+
addr: string;
|
|
7
|
+
website: string;
|
|
8
|
+
email: string;
|
|
9
|
+
};
|
|
10
|
+
setting_start_page?: {
|
|
11
|
+
enable_biz_label: number;
|
|
12
|
+
enable_cate: number;
|
|
13
|
+
enable_add: number;
|
|
14
|
+
cta_profile: number;
|
|
15
|
+
/**
|
|
16
|
+
* Relative path used to build the catalog URL.
|
|
17
|
+
*
|
|
18
|
+
* Example: https://catalog.zalo.me/${cta_catalog}
|
|
19
|
+
*/
|
|
20
|
+
cta_catalog: string | null;
|
|
21
|
+
} | null;
|
|
22
|
+
pkgId: number;
|
|
23
|
+
};
|
|
24
|
+
export declare const getBizAccountFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").API) => (friendId: string) => Promise<GetBizAccountResponse>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getBizAccountFactory = void 0;
|
|
4
|
+
const ZaloApiError_js_1 = require("../Errors/ZaloApiError.js");
|
|
5
|
+
const utils_js_1 = require("../utils.js");
|
|
6
|
+
exports.getBizAccountFactory = (0, utils_js_1.apiFactory)()((api, _ctx, utils) => {
|
|
7
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.profile[0]}/api/social/friend/get-bizacc`);
|
|
8
|
+
/**
|
|
9
|
+
* Get biz account
|
|
10
|
+
*
|
|
11
|
+
* @param friendId The friend ID to get biz account
|
|
12
|
+
*
|
|
13
|
+
* @throws {ZaloApiError}
|
|
14
|
+
*/
|
|
15
|
+
return async function getBizAccount(friendId) {
|
|
16
|
+
const params = {
|
|
17
|
+
fid: friendId,
|
|
18
|
+
};
|
|
19
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
20
|
+
if (!encryptedParams)
|
|
21
|
+
throw new ZaloApiError_js_1.ZaloApiError("Failed to encrypt params");
|
|
22
|
+
const response = await utils.request(serviceURL, {
|
|
23
|
+
method: "POST",
|
|
24
|
+
body: new URLSearchParams({
|
|
25
|
+
params: encryptedParams,
|
|
26
|
+
}),
|
|
27
|
+
});
|
|
28
|
+
return utils.resolve(response);
|
|
29
|
+
};
|
|
30
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { CatalogItem } from "../models/index.js";
|
|
2
|
+
export type GetCatalogListPayload = {
|
|
3
|
+
/**
|
|
4
|
+
* Number of items to retrieve (default: 20)
|
|
5
|
+
*/
|
|
6
|
+
limit?: number;
|
|
7
|
+
lastProductId?: number;
|
|
8
|
+
/**
|
|
9
|
+
* Page number (default: 0)
|
|
10
|
+
*/
|
|
11
|
+
page?: number;
|
|
12
|
+
};
|
|
13
|
+
export type GetCatalogListResponse = {
|
|
14
|
+
items: CatalogItem[];
|
|
15
|
+
version: number;
|
|
16
|
+
has_more: number;
|
|
17
|
+
};
|
|
18
|
+
export declare const getCatalogListFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").API) => (payload?: GetCatalogListPayload) => Promise<GetCatalogListResponse>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCatalogListFactory = void 0;
|
|
4
|
+
const ZaloApiError_js_1 = require("../Errors/ZaloApiError.js");
|
|
5
|
+
const utils_js_1 = require("../utils.js");
|
|
6
|
+
exports.getCatalogListFactory = (0, utils_js_1.apiFactory)()((api, _, utils) => {
|
|
7
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.catalog[0]}/api/prodcatalog/catalog/list`);
|
|
8
|
+
/**
|
|
9
|
+
* Get catalog list?
|
|
10
|
+
*
|
|
11
|
+
* @param payload payload
|
|
12
|
+
*
|
|
13
|
+
* @note this API is used for zBusiness
|
|
14
|
+
* @throws {ZaloApiError}
|
|
15
|
+
*/
|
|
16
|
+
return async function getCatalogList(payload) {
|
|
17
|
+
var _a, _b, _c;
|
|
18
|
+
const params = {
|
|
19
|
+
version_list_catalog: 0,
|
|
20
|
+
limit: (_a = payload === null || payload === void 0 ? void 0 : payload.limit) !== null && _a !== void 0 ? _a : 20,
|
|
21
|
+
last_product_id: (_b = payload === null || payload === void 0 ? void 0 : payload.lastProductId) !== null && _b !== void 0 ? _b : -1,
|
|
22
|
+
page: (_c = payload === null || payload === void 0 ? void 0 : payload.page) !== null && _c !== void 0 ? _c : 0,
|
|
23
|
+
};
|
|
24
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
25
|
+
if (!encryptedParams)
|
|
26
|
+
throw new ZaloApiError_js_1.ZaloApiError("Failed to encrypt params");
|
|
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
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getContextFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").API) => () => import("../context.js").ContextSession;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getCookieFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").API) => () => import("tough-cookie").CookieJar;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCookieFactory = void 0;
|
|
4
|
+
const utils_js_1 = require("../utils.js");
|
|
5
|
+
exports.getCookieFactory = (0, utils_js_1.apiFactory)()((_, ctx) => {
|
|
6
|
+
/**
|
|
7
|
+
* Get the current cookie string
|
|
8
|
+
*/
|
|
9
|
+
return function getCookie() {
|
|
10
|
+
return ctx.cookie;
|
|
11
|
+
};
|
|
12
|
+
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type GetFriendBoardListResponse = {
|
|
2
|
+
data: string[];
|
|
3
|
+
version: number;
|
|
4
|
+
};
|
|
5
|
+
export declare const getFriendBoardListFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").API) => (conversationId: string) => Promise<GetFriendBoardListResponse>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getFriendBoardListFactory = void 0;
|
|
4
|
+
const ZaloApiError_js_1 = require("../Errors/ZaloApiError.js");
|
|
5
|
+
const utils_js_1 = require("../utils.js");
|
|
6
|
+
exports.getFriendBoardListFactory = (0, utils_js_1.apiFactory)()((api, ctx, utils) => {
|
|
7
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.friend_board[0]}/api/friendboard/list`);
|
|
8
|
+
/**
|
|
9
|
+
* Get friend board list
|
|
10
|
+
*
|
|
11
|
+
* @param conversationId conversation id
|
|
12
|
+
*
|
|
13
|
+
* @throws {ZaloApiError}
|
|
14
|
+
*/
|
|
15
|
+
return async function getFriendBoardList(conversationId) {
|
|
16
|
+
const params = {
|
|
17
|
+
conversationId: conversationId,
|
|
18
|
+
version: 0,
|
|
19
|
+
imei: ctx.imei,
|
|
20
|
+
};
|
|
21
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
22
|
+
if (!encryptedParams)
|
|
23
|
+
throw new ZaloApiError_js_1.ZaloApiError("Failed to encrypt params");
|
|
24
|
+
const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams }), {
|
|
25
|
+
method: "GET",
|
|
26
|
+
});
|
|
27
|
+
return utils.resolve(response);
|
|
28
|
+
};
|
|
29
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type GetFriendOnlinesStatus = {
|
|
2
|
+
userId: string;
|
|
3
|
+
status: string;
|
|
4
|
+
};
|
|
5
|
+
export type GetFriendOnlinesResponse = {
|
|
6
|
+
predefine: string[];
|
|
7
|
+
ownerStatus: string;
|
|
8
|
+
onlines: GetFriendOnlinesStatus[];
|
|
9
|
+
};
|
|
10
|
+
export declare const getFriendOnlinesFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").API) => () => Promise<GetFriendOnlinesResponse>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getFriendOnlinesFactory = void 0;
|
|
4
|
+
const ZaloApiError_js_1 = require("../Errors/ZaloApiError.js");
|
|
5
|
+
const utils_js_1 = require("../utils.js");
|
|
6
|
+
exports.getFriendOnlinesFactory = (0, utils_js_1.apiFactory)()((api, ctx, utils) => {
|
|
7
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.profile[0]}/api/social/friend/onlines`);
|
|
8
|
+
/**
|
|
9
|
+
* Get friend onlines?
|
|
10
|
+
*
|
|
11
|
+
* @throws {ZaloApiError}
|
|
12
|
+
*/
|
|
13
|
+
return async function getFriendOnlines() {
|
|
14
|
+
const params = {
|
|
15
|
+
imei: ctx.imei,
|
|
16
|
+
};
|
|
17
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
18
|
+
if (!encryptedParams)
|
|
19
|
+
throw new ZaloApiError_js_1.ZaloApiError("Failed to encrypt params");
|
|
20
|
+
const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams }), {
|
|
21
|
+
method: "GET",
|
|
22
|
+
});
|
|
23
|
+
return utils.resolve(response, (result) => {
|
|
24
|
+
const data = result.data;
|
|
25
|
+
if (Array.isArray(data.onlines)) {
|
|
26
|
+
for (const online of data.onlines) {
|
|
27
|
+
if (typeof online.status === "string") {
|
|
28
|
+
const parsed = JSON.parse(online.status);
|
|
29
|
+
if (parsed && typeof parsed.status === "string") {
|
|
30
|
+
online.status = parsed.status;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return data;
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
});
|