@trungdlp/zca-js 1.0.0
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/.prettierrc +5 -0
- package/CODE_OF_CONDUCT.md +163 -0
- package/CONTRIBUTING.md +470 -0
- package/LICENSE +21 -0
- package/README.md +225 -0
- package/SECURITY.md +83 -0
- package/dist/Errors/ZaloApiError.d.ts +4 -0
- package/dist/Errors/ZaloApiError.js +7 -0
- package/dist/Errors/ZaloApiLoginQRAborted.d.ts +4 -0
- package/dist/Errors/ZaloApiLoginQRAborted.js +7 -0
- package/dist/Errors/ZaloApiLoginQRDeclined.d.ts +4 -0
- package/dist/Errors/ZaloApiLoginQRDeclined.js +7 -0
- package/dist/Errors/ZaloApiMissingImageMetadataGetter.d.ts +4 -0
- package/dist/Errors/ZaloApiMissingImageMetadataGetter.js +7 -0
- package/dist/Errors/index.d.ts +4 -0
- package/dist/Errors/index.js +4 -0
- package/dist/apis/acceptFriendRequest.d.ts +2 -0
- package/dist/apis/acceptFriendRequest.js +28 -0
- package/dist/apis/addGroupBlockedMember.d.ts +2 -0
- package/dist/apis/addGroupBlockedMember.js +28 -0
- package/dist/apis/addGroupDeputy.d.ts +2 -0
- package/dist/apis/addGroupDeputy.js +30 -0
- package/dist/apis/addPollOptions.d.ts +14 -0
- package/dist/apis/addPollOptions.js +26 -0
- package/dist/apis/addQuickMessage.d.ts +11 -0
- package/dist/apis/addQuickMessage.js +60 -0
- package/dist/apis/addReaction.d.ts +18 -0
- package/dist/apis/addReaction.js +294 -0
- package/dist/apis/addUnreadMark.d.ts +8 -0
- package/dist/apis/addUnreadMark.js +52 -0
- package/dist/apis/addUserToGroup.d.ts +5 -0
- package/dist/apis/addUserToGroup.js +34 -0
- package/dist/apis/blockUser.d.ts +2 -0
- package/dist/apis/blockUser.js +28 -0
- package/dist/apis/blockViewFeed.d.ts +2 -0
- package/dist/apis/blockViewFeed.js +30 -0
- package/dist/apis/changeAccountAvatar.d.ts +3 -0
- package/dist/apis/changeAccountAvatar.js +52 -0
- package/dist/apis/changeFriendAlias.d.ts +2 -0
- package/dist/apis/changeFriendAlias.js +27 -0
- package/dist/apis/changeGroupAvatar.d.ts +3 -0
- package/dist/apis/changeGroupAvatar.js +44 -0
- package/dist/apis/changeGroupName.d.ts +4 -0
- package/dist/apis/changeGroupName.js +32 -0
- package/dist/apis/changeGroupOwner.d.ts +4 -0
- package/dist/apis/changeGroupOwner.js +30 -0
- package/dist/apis/createAutoReply.d.ts +14 -0
- package/dist/apis/createAutoReply.js +37 -0
- package/dist/apis/createCatalog.d.ts +7 -0
- package/dist/apis/createCatalog.js +29 -0
- package/dist/apis/createGroup.d.ts +28 -0
- package/dist/apis/createGroup.js +43 -0
- package/dist/apis/createNote.d.ts +7 -0
- package/dist/apis/createNote.js +47 -0
- package/dist/apis/createPoll.d.ts +36 -0
- package/dist/apis/createPoll.js +40 -0
- package/dist/apis/createProductCatalog.d.ts +23 -0
- package/dist/apis/createProductCatalog.js +50 -0
- package/dist/apis/createReminder.d.ts +12 -0
- package/dist/apis/createReminder.js +63 -0
- package/dist/apis/custom.d.ts +9 -0
- package/dist/apis/custom.js +15 -0
- package/dist/apis/deleteAutoReply.d.ts +5 -0
- package/dist/apis/deleteAutoReply.js +29 -0
- package/dist/apis/deleteAvatar.d.ts +9 -0
- package/dist/apis/deleteAvatar.js +27 -0
- package/dist/apis/deleteCatalog.d.ts +2 -0
- package/dist/apis/deleteCatalog.js +28 -0
- package/dist/apis/deleteChat.d.ts +19 -0
- package/dist/apis/deleteChat.js +50 -0
- package/dist/apis/deleteGroupInviteBox.d.ts +9 -0
- package/dist/apis/deleteGroupInviteBox.js +27 -0
- package/dist/apis/deleteMessage.d.ts +14 -0
- package/dist/apis/deleteMessage.js +52 -0
- package/dist/apis/deleteProductCatalog.d.ts +10 -0
- package/dist/apis/deleteProductCatalog.js +31 -0
- package/dist/apis/disableGroupLink.d.ts +2 -0
- package/dist/apis/disableGroupLink.js +24 -0
- package/dist/apis/disperseGroup.d.ts +2 -0
- package/dist/apis/disperseGroup.js +28 -0
- package/dist/apis/editNote.d.ts +17 -0
- package/dist/apis/editNote.js +46 -0
- package/dist/apis/editReminder.d.ts +13 -0
- package/dist/apis/editReminder.js +61 -0
- package/dist/apis/enableGroupLink.d.ts +6 -0
- package/dist/apis/enableGroupLink.js +25 -0
- package/dist/apis/fetchAccountInfo.d.ts +3 -0
- package/dist/apis/fetchAccountInfo.js +10 -0
- package/dist/apis/findUser.d.ts +3 -0
- package/dist/apis/findUser.js +41 -0
- package/dist/apis/findUserByUsername.d.ts +3 -0
- package/dist/apis/findUserByUsername.js +26 -0
- package/dist/apis/forwardMessage.d.ts +24 -0
- package/dist/apis/forwardMessage.js +99 -0
- package/dist/apis/getAliasList.d.ts +8 -0
- package/dist/apis/getAliasList.js +27 -0
- package/dist/apis/getAllFriends.d.ts +3 -0
- package/dist/apis/getAllFriends.js +33 -0
- package/dist/apis/getAllGroups.d.ts +7 -0
- package/dist/apis/getAllGroups.js +10 -0
- package/dist/apis/getArchivedChatList.d.ts +5 -0
- package/dist/apis/getArchivedChatList.js +23 -0
- package/dist/apis/getAutoDeleteChat.d.ts +9 -0
- package/dist/apis/getAutoDeleteChat.js +21 -0
- package/dist/apis/getAutoReplyList.d.ts +6 -0
- package/dist/apis/getAutoReplyList.js +24 -0
- package/dist/apis/getAvatarList.d.ts +12 -0
- package/dist/apis/getAvatarList.js +28 -0
- package/dist/apis/getAvatarUrlProfile.d.ts +6 -0
- package/dist/apis/getAvatarUrlProfile.js +29 -0
- package/dist/apis/getBizAccount.d.ts +24 -0
- package/dist/apis/getBizAccount.js +27 -0
- package/dist/apis/getCatalogList.d.ts +18 -0
- package/dist/apis/getCatalogList.js +32 -0
- package/dist/apis/getCloseFriends.d.ts +3 -0
- package/dist/apis/getCloseFriends.js +20 -0
- package/dist/apis/getContext.d.ts +1 -0
- package/dist/apis/getContext.js +4 -0
- package/dist/apis/getCookie.d.ts +1 -0
- package/dist/apis/getCookie.js +9 -0
- package/dist/apis/getFriendBoardList.d.ts +5 -0
- package/dist/apis/getFriendBoardList.js +26 -0
- package/dist/apis/getFriendOnlines.d.ts +10 -0
- package/dist/apis/getFriendOnlines.js +35 -0
- package/dist/apis/getFriendRecommendations.d.ts +42 -0
- package/dist/apis/getFriendRecommendations.js +27 -0
- package/dist/apis/getFriendRequestStatus.d.ts +8 -0
- package/dist/apis/getFriendRequestStatus.js +25 -0
- package/dist/apis/getFullAvatar.d.ts +5 -0
- package/dist/apis/getFullAvatar.js +25 -0
- package/dist/apis/getGroupBlockedMember.d.ts +23 -0
- package/dist/apis/getGroupBlockedMember.js +29 -0
- package/dist/apis/getGroupChatHistory.d.ts +8 -0
- package/dist/apis/getGroupChatHistory.js +36 -0
- package/dist/apis/getGroupInfo.d.ts +16 -0
- package/dist/apis/getGroupInfo.js +32 -0
- package/dist/apis/getGroupInviteBoxInfo.d.ts +32 -0
- package/dist/apis/getGroupInviteBoxInfo.js +38 -0
- package/dist/apis/getGroupInviteBoxList.d.ts +38 -0
- package/dist/apis/getGroupInviteBoxList.js +31 -0
- package/dist/apis/getGroupLinkDetail.d.ts +9 -0
- package/dist/apis/getGroupLinkDetail.js +25 -0
- package/dist/apis/getGroupLinkInfo.d.ts +34 -0
- package/dist/apis/getGroupLinkInfo.js +28 -0
- package/dist/apis/getGroupMembersInfo.d.ts +17 -0
- package/dist/apis/getGroupMembersInfo.js +24 -0
- package/dist/apis/getHiddenConversations.d.ts +11 -0
- package/dist/apis/getHiddenConversations.js +23 -0
- package/dist/apis/getLabels.d.ts +7 -0
- package/dist/apis/getLabels.js +28 -0
- package/dist/apis/getListBoard.d.ts +21 -0
- package/dist/apis/getListBoard.js +45 -0
- package/dist/apis/getListReminder.d.ts +28 -0
- package/dist/apis/getListReminder.js +47 -0
- package/dist/apis/getMultiUsersByPhone.d.ts +5 -0
- package/dist/apis/getMultiUsersByPhone.js +38 -0
- package/dist/apis/getMute.d.ts +13 -0
- package/dist/apis/getMute.js +22 -0
- package/dist/apis/getOwnId.d.ts +1 -0
- package/dist/apis/getOwnId.js +4 -0
- package/dist/apis/getPendingGroupMembers.d.ts +11 -0
- package/dist/apis/getPendingGroupMembers.js +27 -0
- package/dist/apis/getPinConversations.d.ts +5 -0
- package/dist/apis/getPinConversations.js +22 -0
- package/dist/apis/getPollDetail.d.ts +3 -0
- package/dist/apis/getPollDetail.js +30 -0
- package/dist/apis/getProductCatalogList.d.ts +20 -0
- package/dist/apis/getProductCatalogList.js +33 -0
- package/dist/apis/getQR.d.ts +4 -0
- package/dist/apis/getQR.js +29 -0
- package/dist/apis/getQuickMessageList.d.ts +7 -0
- package/dist/apis/getQuickMessageList.js +24 -0
- package/dist/apis/getRelatedFriendGroup.d.ts +6 -0
- package/dist/apis/getRelatedFriendGroup.js +30 -0
- package/dist/apis/getReminder.d.ts +3 -0
- package/dist/apis/getReminder.js +25 -0
- package/dist/apis/getReminderResponses.d.ts +5 -0
- package/dist/apis/getReminderResponses.js +24 -0
- package/dist/apis/getSearchSticker.d.ts +3 -0
- package/dist/apis/getSearchSticker.js +28 -0
- package/dist/apis/getSentFriendRequest.d.ts +18 -0
- package/dist/apis/getSentFriendRequest.js +24 -0
- package/dist/apis/getSettings.d.ts +3 -0
- package/dist/apis/getSettings.js +20 -0
- package/dist/apis/getStickerCategoryDetail.d.ts +3 -0
- package/dist/apis/getStickerCategoryDetail.js +24 -0
- package/dist/apis/getStickers.d.ts +1 -0
- package/dist/apis/getStickers.js +40 -0
- package/dist/apis/getStickersDetail.d.ts +3 -0
- package/dist/apis/getStickersDetail.js +40 -0
- package/dist/apis/getUnreadMark.d.ts +14 -0
- package/dist/apis/getUnreadMark.js +30 -0
- package/dist/apis/getUserInfo.d.ts +8 -0
- package/dist/apis/getUserInfo.js +43 -0
- package/dist/apis/inviteUserToGroups.d.ts +10 -0
- package/dist/apis/inviteUserToGroups.js +30 -0
- package/dist/apis/joinGroupInviteBox.d.ts +2 -0
- package/dist/apis/joinGroupInviteBox.js +25 -0
- package/dist/apis/joinGroupLink.d.ts +2 -0
- package/dist/apis/joinGroupLink.js +27 -0
- package/dist/apis/keepAlive.d.ts +4 -0
- package/dist/apis/keepAlive.js +22 -0
- package/dist/apis/lastOnline.d.ts +7 -0
- package/dist/apis/lastOnline.js +26 -0
- package/dist/apis/leaveGroup.d.ts +4 -0
- package/dist/apis/leaveGroup.js +33 -0
- package/dist/apis/listen.d.ts +102 -0
- package/dist/apis/listen.js +425 -0
- package/dist/apis/lockPoll.d.ts +2 -0
- package/dist/apis/lockPoll.js +28 -0
- package/dist/apis/login.d.ts +3 -0
- package/dist/apis/login.js +96 -0
- package/dist/apis/loginQR.d.ts +70 -0
- package/dist/apis/loginQR.js +365 -0
- package/dist/apis/parseLink.d.ts +21 -0
- package/dist/apis/parseLink.js +27 -0
- package/dist/apis/rejectFriendRequest.d.ts +2 -0
- package/dist/apis/rejectFriendRequest.js +27 -0
- package/dist/apis/removeFriend.d.ts +2 -0
- package/dist/apis/removeFriend.js +28 -0
- package/dist/apis/removeFriendAlias.d.ts +2 -0
- package/dist/apis/removeFriendAlias.js +24 -0
- package/dist/apis/removeGroupBlockedMember.d.ts +2 -0
- package/dist/apis/removeGroupBlockedMember.js +28 -0
- package/dist/apis/removeGroupDeputy.d.ts +2 -0
- package/dist/apis/removeGroupDeputy.js +30 -0
- package/dist/apis/removeQuickMessage.d.ts +5 -0
- package/dist/apis/removeQuickMessage.js +27 -0
- package/dist/apis/removeReminder.d.ts +3 -0
- package/dist/apis/removeReminder.js +40 -0
- package/dist/apis/removeUnreadMark.d.ts +8 -0
- package/dist/apis/removeUnreadMark.js +50 -0
- package/dist/apis/removeUserFromGroup.d.ts +4 -0
- package/dist/apis/removeUserFromGroup.js +34 -0
- package/dist/apis/resetHiddenConversPin.d.ts +2 -0
- package/dist/apis/resetHiddenConversPin.js +20 -0
- package/dist/apis/reuseAvatar.d.ts +2 -0
- package/dist/apis/reuseAvatar.js +26 -0
- package/dist/apis/reviewPendingMemberRequest.d.ts +14 -0
- package/dist/apis/reviewPendingMemberRequest.js +38 -0
- package/dist/apis/sendBankCard.d.ts +9 -0
- package/dist/apis/sendBankCard.js +37 -0
- package/dist/apis/sendCard.d.ts +10 -0
- package/dist/apis/sendCard.js +59 -0
- package/dist/apis/sendDeliveredEvent.d.ts +16 -0
- package/dist/apis/sendDeliveredEvent.js +55 -0
- package/dist/apis/sendFriendRequest.d.ts +2 -0
- package/dist/apis/sendFriendRequest.js +39 -0
- package/dist/apis/sendLink.d.ts +10 -0
- package/dist/apis/sendLink.js +61 -0
- package/dist/apis/sendMessage.d.ts +99 -0
- package/dist/apis/sendMessage.js +451 -0
- package/dist/apis/sendReport.d.ts +17 -0
- package/dist/apis/sendReport.js +53 -0
- package/dist/apis/sendSeenEvent.d.ts +16 -0
- package/dist/apis/sendSeenEvent.js +63 -0
- package/dist/apis/sendSticker.d.ts +10 -0
- package/dist/apis/sendSticker.js +57 -0
- package/dist/apis/sendTypingEvent.d.ts +5 -0
- package/dist/apis/sendTypingEvent.js +33 -0
- package/dist/apis/sendVideo.d.ts +35 -0
- package/dist/apis/sendVideo.js +118 -0
- package/dist/apis/sendVoice.d.ts +12 -0
- package/dist/apis/sendVoice.js +73 -0
- package/dist/apis/setArchivedConversations.d.ts +10 -0
- package/dist/apis/setArchivedConversations.js +34 -0
- package/dist/apis/setHiddenConversations.d.ts +3 -0
- package/dist/apis/setHiddenConversations.js +39 -0
- package/dist/apis/setMute.d.ts +20 -0
- package/dist/apis/setMute.js +67 -0
- package/dist/apis/setPinnedConversations.d.ts +3 -0
- package/dist/apis/setPinnedConversations.js +34 -0
- package/dist/apis/sharePoll.d.ts +2 -0
- package/dist/apis/sharePoll.js +28 -0
- package/dist/apis/unblockUser.d.ts +2 -0
- package/dist/apis/unblockUser.js +28 -0
- package/dist/apis/undo.d.ts +9 -0
- package/dist/apis/undo.js +42 -0
- package/dist/apis/undoFriendRequest.d.ts +2 -0
- package/dist/apis/undoFriendRequest.js +27 -0
- package/dist/apis/updateActiveStatus.d.ts +4 -0
- package/dist/apis/updateActiveStatus.js +27 -0
- package/dist/apis/updateAutoDeleteChat.d.ts +9 -0
- package/dist/apis/updateAutoDeleteChat.js +40 -0
- package/dist/apis/updateAutoReply.d.ts +15 -0
- package/dist/apis/updateAutoReply.js +38 -0
- package/dist/apis/updateCatalog.d.ts +11 -0
- package/dist/apis/updateCatalog.js +30 -0
- package/dist/apis/updateGroupSettings.d.ts +40 -0
- package/dist/apis/updateGroupSettings.js +43 -0
- package/dist/apis/updateHiddenConversPin.d.ts +2 -0
- package/dist/apis/updateHiddenConversPin.js +30 -0
- package/dist/apis/updateLabels.d.ts +15 -0
- package/dist/apis/updateLabels.js +34 -0
- package/dist/apis/updateLang.d.ts +6 -0
- package/dist/apis/updateLang.js +30 -0
- package/dist/apis/updateProductCatalog.d.ts +25 -0
- package/dist/apis/updateProductCatalog.js +51 -0
- package/dist/apis/updateProfile.d.ts +20 -0
- package/dist/apis/updateProfile.js +43 -0
- package/dist/apis/updateQuickMessage.d.ts +11 -0
- package/dist/apis/updateQuickMessage.js +61 -0
- package/dist/apis/updateSettings.d.ts +16 -0
- package/dist/apis/updateSettings.js +90 -0
- package/dist/apis/updateStatus.d.ts +2 -0
- package/dist/apis/updateStatus.js +27 -0
- package/dist/apis/upgradeGroupCommunity.d.ts +2 -0
- package/dist/apis/upgradeGroupCommunity.js +27 -0
- package/dist/apis/uploadAttachment.d.ts +50 -0
- package/dist/apis/uploadAttachment.js +196 -0
- package/dist/apis/uploadProductPhoto.d.ts +14 -0
- package/dist/apis/uploadProductPhoto.js +50 -0
- package/dist/apis/votePoll.d.ts +5 -0
- package/dist/apis/votePoll.js +29 -0
- package/dist/apis.d.ts +299 -0
- package/dist/apis.js +299 -0
- package/dist/cjs/Errors/ZaloApiError.cjs +11 -0
- package/dist/cjs/Errors/ZaloApiLoginQRAborted.cjs +12 -0
- package/dist/cjs/Errors/ZaloApiLoginQRDeclined.cjs +12 -0
- package/dist/cjs/Errors/ZaloApiMissingImageMetadataGetter.cjs +12 -0
- package/dist/cjs/apis/acceptFriendRequest.cjs +33 -0
- package/dist/cjs/apis/addGroupBlockedMember.cjs +33 -0
- package/dist/cjs/apis/addGroupDeputy.cjs +35 -0
- package/dist/cjs/apis/addPollOptions.cjs +31 -0
- package/dist/cjs/apis/addQuickMessage.cjs +65 -0
- package/dist/cjs/apis/addReaction.cjs +307 -0
- package/dist/cjs/apis/addUnreadMark.cjs +65 -0
- package/dist/cjs/apis/addUserToGroup.cjs +39 -0
- package/dist/cjs/apis/blockUser.cjs +33 -0
- package/dist/cjs/apis/blockViewFeed.cjs +35 -0
- package/dist/cjs/apis/changeAccountAvatar.cjs +57 -0
- package/dist/cjs/apis/changeFriendAlias.cjs +32 -0
- package/dist/cjs/apis/changeGroupAvatar.cjs +49 -0
- package/dist/cjs/apis/changeGroupName.cjs +37 -0
- package/dist/cjs/apis/changeGroupOwner.cjs +35 -0
- package/dist/cjs/apis/createAutoReply.cjs +42 -0
- package/dist/cjs/apis/createCatalog.cjs +34 -0
- package/dist/cjs/apis/createGroup.cjs +48 -0
- package/dist/cjs/apis/createNote.cjs +52 -0
- package/dist/cjs/apis/createPoll.cjs +45 -0
- package/dist/cjs/apis/createProductCatalog.cjs +55 -0
- package/dist/cjs/apis/createReminder.cjs +76 -0
- package/dist/cjs/apis/custom.cjs +19 -0
- package/dist/cjs/apis/deleteAutoReply.cjs +34 -0
- package/dist/cjs/apis/deleteAvatar.cjs +32 -0
- package/dist/cjs/apis/deleteCatalog.cjs +33 -0
- package/dist/cjs/apis/deleteChat.cjs +63 -0
- package/dist/cjs/apis/deleteGroupInviteBox.cjs +32 -0
- package/dist/cjs/apis/deleteMessage.cjs +65 -0
- package/dist/cjs/apis/deleteProductCatalog.cjs +36 -0
- package/dist/cjs/apis/disableGroupLink.cjs +29 -0
- package/dist/cjs/apis/disperseGroup.cjs +33 -0
- package/dist/cjs/apis/editNote.cjs +51 -0
- package/dist/cjs/apis/editReminder.cjs +74 -0
- package/dist/cjs/apis/enableGroupLink.cjs +30 -0
- package/dist/cjs/apis/fetchAccountInfo.cjs +15 -0
- package/dist/cjs/apis/findUser.cjs +46 -0
- package/dist/cjs/apis/findUserByUsername.cjs +31 -0
- package/dist/cjs/apis/forwardMessage.cjs +112 -0
- package/dist/cjs/apis/getAliasList.cjs +32 -0
- package/dist/cjs/apis/getAllFriends.cjs +38 -0
- package/dist/cjs/apis/getAllGroups.cjs +15 -0
- package/dist/cjs/apis/getArchivedChatList.cjs +28 -0
- package/dist/cjs/apis/getAutoDeleteChat.cjs +26 -0
- package/dist/cjs/apis/getAutoReplyList.cjs +29 -0
- package/dist/cjs/apis/getAvatarList.cjs +33 -0
- package/dist/cjs/apis/getAvatarUrlProfile.cjs +34 -0
- package/dist/cjs/apis/getBizAccount.cjs +32 -0
- package/dist/cjs/apis/getCatalogList.cjs +37 -0
- package/dist/cjs/apis/getCloseFriends.cjs +25 -0
- package/dist/cjs/apis/getContext.cjs +9 -0
- package/dist/cjs/apis/getCookie.cjs +14 -0
- package/dist/cjs/apis/getFriendBoardList.cjs +31 -0
- package/dist/cjs/apis/getFriendOnlines.cjs +40 -0
- package/dist/cjs/apis/getFriendRecommendations.cjs +32 -0
- package/dist/cjs/apis/getFriendRequestStatus.cjs +30 -0
- package/dist/cjs/apis/getFullAvatar.cjs +30 -0
- package/dist/cjs/apis/getGroupBlockedMember.cjs +34 -0
- package/dist/cjs/apis/getGroupChatHistory.cjs +50 -0
- package/dist/cjs/apis/getGroupInfo.cjs +37 -0
- package/dist/cjs/apis/getGroupInviteBoxInfo.cjs +43 -0
- package/dist/cjs/apis/getGroupInviteBoxList.cjs +36 -0
- package/dist/cjs/apis/getGroupLinkDetail.cjs +30 -0
- package/dist/cjs/apis/getGroupLinkInfo.cjs +33 -0
- package/dist/cjs/apis/getGroupMembersInfo.cjs +29 -0
- package/dist/cjs/apis/getHiddenConversations.cjs +28 -0
- package/dist/cjs/apis/getLabels.cjs +33 -0
- package/dist/cjs/apis/getListBoard.cjs +58 -0
- package/dist/cjs/apis/getListReminder.cjs +60 -0
- package/dist/cjs/apis/getMultiUsersByPhone.cjs +43 -0
- package/dist/cjs/apis/getMute.cjs +27 -0
- package/dist/cjs/apis/getOwnId.cjs +9 -0
- package/dist/cjs/apis/getPendingGroupMembers.cjs +32 -0
- package/dist/cjs/apis/getPinConversations.cjs +27 -0
- package/dist/cjs/apis/getPollDetail.cjs +35 -0
- package/dist/cjs/apis/getProductCatalogList.cjs +38 -0
- package/dist/cjs/apis/getQR.cjs +34 -0
- package/dist/cjs/apis/getQuickMessageList.cjs +29 -0
- package/dist/cjs/apis/getRelatedFriendGroup.cjs +35 -0
- package/dist/cjs/apis/getReminder.cjs +30 -0
- package/dist/cjs/apis/getReminderResponses.cjs +29 -0
- package/dist/cjs/apis/getSearchSticker.cjs +33 -0
- package/dist/cjs/apis/getSentFriendRequest.cjs +29 -0
- package/dist/cjs/apis/getSettings.cjs +25 -0
- package/dist/cjs/apis/getStickerCategoryDetail.cjs +29 -0
- package/dist/cjs/apis/getStickers.cjs +45 -0
- package/dist/cjs/apis/getStickersDetail.cjs +45 -0
- package/dist/cjs/apis/getUnreadMark.cjs +35 -0
- package/dist/cjs/apis/getUserInfo.cjs +48 -0
- package/dist/cjs/apis/inviteUserToGroups.cjs +35 -0
- package/dist/cjs/apis/joinGroupInviteBox.cjs +30 -0
- package/dist/cjs/apis/joinGroupLink.cjs +32 -0
- package/dist/cjs/apis/keepAlive.cjs +27 -0
- package/dist/cjs/apis/lastOnline.cjs +31 -0
- package/dist/cjs/apis/leaveGroup.cjs +38 -0
- package/dist/cjs/apis/listen.cjs +439 -0
- package/dist/cjs/apis/lockPoll.cjs +33 -0
- package/dist/cjs/apis/login.cjs +102 -0
- package/dist/cjs/apis/loginQR.cjs +370 -0
- package/dist/cjs/apis/parseLink.cjs +32 -0
- package/dist/cjs/apis/rejectFriendRequest.cjs +32 -0
- package/dist/cjs/apis/removeFriend.cjs +33 -0
- package/dist/cjs/apis/removeFriendAlias.cjs +29 -0
- package/dist/cjs/apis/removeGroupBlockedMember.cjs +33 -0
- package/dist/cjs/apis/removeGroupDeputy.cjs +35 -0
- package/dist/cjs/apis/removeQuickMessage.cjs +32 -0
- package/dist/cjs/apis/removeReminder.cjs +53 -0
- package/dist/cjs/apis/removeUnreadMark.cjs +63 -0
- package/dist/cjs/apis/removeUserFromGroup.cjs +39 -0
- package/dist/cjs/apis/resetHiddenConversPin.cjs +25 -0
- package/dist/cjs/apis/reuseAvatar.cjs +31 -0
- package/dist/cjs/apis/reviewPendingMemberRequest.cjs +43 -0
- package/dist/cjs/apis/sendBankCard.cjs +50 -0
- package/dist/cjs/apis/sendCard.cjs +72 -0
- package/dist/cjs/apis/sendDeliveredEvent.cjs +68 -0
- package/dist/cjs/apis/sendFriendRequest.cjs +44 -0
- package/dist/cjs/apis/sendLink.cjs +74 -0
- package/dist/cjs/apis/sendMessage.cjs +464 -0
- package/dist/cjs/apis/sendReport.cjs +66 -0
- package/dist/cjs/apis/sendSeenEvent.cjs +76 -0
- package/dist/cjs/apis/sendSticker.cjs +70 -0
- package/dist/cjs/apis/sendTypingEvent.cjs +46 -0
- package/dist/cjs/apis/sendVideo.cjs +131 -0
- package/dist/cjs/apis/sendVoice.cjs +86 -0
- package/dist/cjs/apis/setArchivedConversations.cjs +39 -0
- package/dist/cjs/apis/setHiddenConversations.cjs +52 -0
- package/dist/cjs/apis/setMute.cjs +80 -0
- package/dist/cjs/apis/setPinnedConversations.cjs +47 -0
- package/dist/cjs/apis/sharePoll.cjs +33 -0
- package/dist/cjs/apis/unblockUser.cjs +33 -0
- package/dist/cjs/apis/undo.cjs +55 -0
- package/dist/cjs/apis/undoFriendRequest.cjs +32 -0
- package/dist/cjs/apis/updateActiveStatus.cjs +32 -0
- package/dist/cjs/apis/updateAutoDeleteChat.cjs +53 -0
- package/dist/cjs/apis/updateAutoReply.cjs +43 -0
- package/dist/cjs/apis/updateCatalog.cjs +35 -0
- package/dist/cjs/apis/updateGroupSettings.cjs +48 -0
- package/dist/cjs/apis/updateHiddenConversPin.cjs +35 -0
- package/dist/cjs/apis/updateLabels.cjs +39 -0
- package/dist/cjs/apis/updateLang.cjs +35 -0
- package/dist/cjs/apis/updateProductCatalog.cjs +56 -0
- package/dist/cjs/apis/updateProfile.cjs +48 -0
- package/dist/cjs/apis/updateQuickMessage.cjs +66 -0
- package/dist/cjs/apis/updateSettings.cjs +95 -0
- package/dist/cjs/apis/updateStatus.cjs +32 -0
- package/dist/cjs/apis/upgradeGroupCommunity.cjs +32 -0
- package/dist/cjs/apis/uploadAttachment.cjs +209 -0
- package/dist/cjs/apis/uploadProductPhoto.cjs +55 -0
- package/dist/cjs/apis/votePoll.cjs +34 -0
- package/dist/cjs/apis.cjs +304 -0
- package/dist/cjs/context.cjs +34 -0
- package/dist/cjs/index.cjs +149 -0
- package/dist/cjs/models/AutoReply.cjs +9 -0
- package/dist/cjs/models/Board.cjs +8 -0
- package/dist/cjs/models/DeliveredMessage.cjs +23 -0
- package/dist/cjs/models/Enum.cjs +253 -0
- package/dist/cjs/models/FriendEvent.cjs +87 -0
- package/dist/cjs/models/Group.cjs +13 -0
- package/dist/cjs/models/GroupEvent.cjs +94 -0
- package/dist/cjs/models/Message.cjs +35 -0
- package/dist/cjs/models/Reaction.cjs +74 -0
- package/dist/cjs/models/Reminder.cjs +9 -0
- package/dist/cjs/models/SeenMessage.cjs +23 -0
- package/dist/cjs/models/Typing.cjs +23 -0
- package/dist/cjs/models/Undo.cjs +16 -0
- package/dist/cjs/models/ZBusiness.cjs +39 -0
- package/dist/cjs/update.cjs +34 -0
- package/dist/cjs/utils.cjs +680 -0
- package/dist/cjs/zalo.cjs +112 -0
- package/dist/context.d.ts +179 -0
- package/dist/context.js +28 -0
- package/dist/index.d.ts +156 -0
- package/dist/index.js +13 -0
- package/dist/models/Attachment.d.ts +9 -0
- package/dist/models/Attachment.js +1 -0
- package/dist/models/AutoReply.d.ts +20 -0
- package/dist/models/AutoReply.js +7 -0
- package/dist/models/Board.d.ts +60 -0
- package/dist/models/Board.js +6 -0
- package/dist/models/Catalog.d.ts +16 -0
- package/dist/models/Catalog.js +1 -0
- package/dist/models/DeliveredMessage.d.ts +27 -0
- package/dist/models/DeliveredMessage.js +17 -0
- package/dist/models/Enum.d.ts +247 -0
- package/dist/models/Enum.js +251 -0
- package/dist/models/FriendEvent.d.ts +107 -0
- package/dist/models/FriendEvent.js +83 -0
- package/dist/models/Group.d.ts +125 -0
- package/dist/models/Group.js +11 -0
- package/dist/models/GroupEvent.d.ts +178 -0
- package/dist/models/GroupEvent.js +90 -0
- package/dist/models/Label.d.ts +10 -0
- package/dist/models/Label.js +1 -0
- package/dist/models/Message.d.ts +91 -0
- package/dist/models/Message.js +29 -0
- package/dist/models/ProductCatalog.d.ts +17 -0
- package/dist/models/ProductCatalog.js +1 -0
- package/dist/models/QuickMessage.d.ts +25 -0
- package/dist/models/QuickMessage.js +1 -0
- package/dist/models/Reaction.d.ts +85 -0
- package/dist/models/Reaction.js +70 -0
- package/dist/models/Reminder.d.ts +51 -0
- package/dist/models/Reminder.js +7 -0
- package/dist/models/SeenMessage.d.ts +26 -0
- package/dist/models/SeenMessage.js +17 -0
- package/dist/models/Sticker.d.ts +27 -0
- package/dist/models/Sticker.js +1 -0
- package/dist/models/Typing.d.ts +24 -0
- package/dist/models/Typing.js +17 -0
- package/dist/models/Undo.d.ts +34 -0
- package/dist/models/Undo.js +12 -0
- package/dist/models/User.d.ts +62 -0
- package/dist/models/User.js +1 -0
- package/dist/models/ZBusiness.d.ts +22 -0
- package/dist/models/ZBusiness.js +35 -0
- package/dist/models/index.d.ts +21 -0
- package/dist/models/index.js +21 -0
- package/dist/update.d.ts +2 -0
- package/dist/update.js +29 -0
- package/dist/utils.d.ts +166 -0
- package/dist/utils.js +697 -0
- package/dist/zalo.d.ts +41 -0
- package/dist/zalo.js +107 -0
- package/eslint.config.js +21 -0
- package/index.d.ts +2 -0
- package/package.json +78 -0
- package/rollup.config.js +28 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export const getMultiUsersByPhoneFactory = apiFactory()((api, ctx, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.friend[0]}/api/friend/profile/multiget`);
|
|
5
|
+
/**
|
|
6
|
+
* Get multiple user(s) by phone number
|
|
7
|
+
*
|
|
8
|
+
* @param phoneNumber Phone(s) number
|
|
9
|
+
* @param isAvatarSizeMax Is avatar size max (default: true)
|
|
10
|
+
*
|
|
11
|
+
* @throws {ZaloApiError}
|
|
12
|
+
*/
|
|
13
|
+
return async function getMultiUsersByPhone(phoneNumbers, isAvatarSizeMax = true) {
|
|
14
|
+
if (!phoneNumbers)
|
|
15
|
+
throw new ZaloApiError("Missing phoneNumber");
|
|
16
|
+
if (!Array.isArray(phoneNumbers))
|
|
17
|
+
phoneNumbers = [phoneNumbers];
|
|
18
|
+
phoneNumbers = phoneNumbers.map((phone) => {
|
|
19
|
+
if (phone.startsWith("0")) {
|
|
20
|
+
if (ctx.language == "vi")
|
|
21
|
+
phone = "84" + phone.slice(1);
|
|
22
|
+
}
|
|
23
|
+
return phone;
|
|
24
|
+
});
|
|
25
|
+
const params = {
|
|
26
|
+
phones: phoneNumbers,
|
|
27
|
+
avatar_size: isAvatarSizeMax ? 240 : 120,
|
|
28
|
+
language: ctx.language,
|
|
29
|
+
};
|
|
30
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
31
|
+
if (!encryptedParams)
|
|
32
|
+
throw new ZaloApiError("Failed to encrypt params");
|
|
33
|
+
const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams }), {
|
|
34
|
+
method: "GET",
|
|
35
|
+
});
|
|
36
|
+
return utils.resolve(response);
|
|
37
|
+
};
|
|
38
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type MuteEntriesInfo = {
|
|
2
|
+
id: string;
|
|
3
|
+
duration: number;
|
|
4
|
+
startTime: number;
|
|
5
|
+
systemTime: number;
|
|
6
|
+
currentTime: number;
|
|
7
|
+
muteMode: number;
|
|
8
|
+
};
|
|
9
|
+
export type GetMuteResponse = {
|
|
10
|
+
chatEntries: MuteEntriesInfo[];
|
|
11
|
+
groupChatEntries: MuteEntriesInfo[];
|
|
12
|
+
};
|
|
13
|
+
export declare const getMuteFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").API) => () => Promise<GetMuteResponse>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export const getMuteFactory = apiFactory()((api, ctx, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.profile[0]}/api/social/profile/getmute`);
|
|
5
|
+
/**
|
|
6
|
+
* Get mute
|
|
7
|
+
*
|
|
8
|
+
* @throws {ZaloApiError}
|
|
9
|
+
*/
|
|
10
|
+
return async function getMute() {
|
|
11
|
+
const params = {
|
|
12
|
+
imei: ctx.imei,
|
|
13
|
+
};
|
|
14
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
15
|
+
if (!encryptedParams)
|
|
16
|
+
throw new ZaloApiError("Failed to encrypt params");
|
|
17
|
+
const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams }), {
|
|
18
|
+
method: "GET",
|
|
19
|
+
});
|
|
20
|
+
return utils.resolve(response);
|
|
21
|
+
};
|
|
22
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getOwnIdFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").API) => () => string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type GetPendingGroupMembersUserInfo = {
|
|
2
|
+
uid: string;
|
|
3
|
+
dpn: string;
|
|
4
|
+
avatar: string;
|
|
5
|
+
user_submit: null;
|
|
6
|
+
};
|
|
7
|
+
export type GetPendingGroupMembersResponse = {
|
|
8
|
+
time: number;
|
|
9
|
+
users: GetPendingGroupMembersUserInfo[];
|
|
10
|
+
};
|
|
11
|
+
export declare const getPendingGroupMembersFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").API) => (groupId: string) => Promise<GetPendingGroupMembersResponse>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export const getPendingGroupMembersFactory = apiFactory()((api, ctx, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.group[0]}/api/group/pending-mems/list`);
|
|
5
|
+
/**
|
|
6
|
+
* Get pending group members
|
|
7
|
+
*
|
|
8
|
+
* @param groupId - The id of the group to get the pending members
|
|
9
|
+
*
|
|
10
|
+
* @note Only the group leader and deputy group leader can view
|
|
11
|
+
*
|
|
12
|
+
* @throws {ZaloApiError}
|
|
13
|
+
*/
|
|
14
|
+
return async function getPendingGroupMembers(groupId) {
|
|
15
|
+
const params = {
|
|
16
|
+
grid: groupId,
|
|
17
|
+
imei: ctx.imei,
|
|
18
|
+
};
|
|
19
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
20
|
+
if (!encryptedParams)
|
|
21
|
+
throw new 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,22 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export const getPinConversationsFactory = apiFactory()((api, ctx, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.conversation[0]}/api/pinconvers/list`);
|
|
5
|
+
/**
|
|
6
|
+
* Get pin conversations
|
|
7
|
+
*
|
|
8
|
+
* @throws {ZaloApiError}
|
|
9
|
+
*/
|
|
10
|
+
return async function getPinConversations() {
|
|
11
|
+
const params = {
|
|
12
|
+
imei: ctx.imei,
|
|
13
|
+
};
|
|
14
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
15
|
+
if (!encryptedParams)
|
|
16
|
+
throw new ZaloApiError("Failed to encrypt params");
|
|
17
|
+
const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams }), {
|
|
18
|
+
method: "GET",
|
|
19
|
+
});
|
|
20
|
+
return utils.resolve(response);
|
|
21
|
+
};
|
|
22
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export const getPollDetailFactory = apiFactory()((api, ctx, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.group[0]}/api/poll/detail`);
|
|
5
|
+
/**
|
|
6
|
+
* Get poll detail
|
|
7
|
+
*
|
|
8
|
+
* @param pollId Poll ID
|
|
9
|
+
*
|
|
10
|
+
* @throws {ZaloApiError}
|
|
11
|
+
*/
|
|
12
|
+
return async function getPollDetail(pollId) {
|
|
13
|
+
if (!pollId)
|
|
14
|
+
throw new ZaloApiError("Missing poll id");
|
|
15
|
+
const params = {
|
|
16
|
+
poll_id: pollId,
|
|
17
|
+
imei: ctx.imei,
|
|
18
|
+
};
|
|
19
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
20
|
+
if (!encryptedParams)
|
|
21
|
+
throw new ZaloApiError("Failed to encrypt message");
|
|
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,20 @@
|
|
|
1
|
+
import type { ProductCatalogItem } from "../models/index.js";
|
|
2
|
+
export type GetProductCatalogListPayload = {
|
|
3
|
+
catalogId: string;
|
|
4
|
+
/**
|
|
5
|
+
* Number of items to retrieve (default: 100)
|
|
6
|
+
*/
|
|
7
|
+
limit?: number;
|
|
8
|
+
versionCatalog?: number;
|
|
9
|
+
lastProductId?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Page number (default: 0)
|
|
12
|
+
*/
|
|
13
|
+
page?: number;
|
|
14
|
+
};
|
|
15
|
+
export type GetProductCatalogListResponse = {
|
|
16
|
+
items: ProductCatalogItem[];
|
|
17
|
+
version: number;
|
|
18
|
+
has_more: number;
|
|
19
|
+
};
|
|
20
|
+
export declare const getProductCatalogListFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").API) => (payload: GetProductCatalogListPayload) => Promise<GetProductCatalogListResponse>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export const getProductCatalogListFactory = apiFactory()((api, _, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.catalog[0]}/api/prodcatalog/product/list`);
|
|
5
|
+
/**
|
|
6
|
+
* Get product catalog list?
|
|
7
|
+
*
|
|
8
|
+
* @param payload payload
|
|
9
|
+
*
|
|
10
|
+
* @note this API is used for zBusiness
|
|
11
|
+
* @throws {ZaloApiError}
|
|
12
|
+
*/
|
|
13
|
+
return async function getProductCatalogList(payload) {
|
|
14
|
+
var _a, _b, _c, _d;
|
|
15
|
+
const params = {
|
|
16
|
+
catalog_id: payload.catalogId,
|
|
17
|
+
limit: (_a = payload.limit) !== null && _a !== void 0 ? _a : 100,
|
|
18
|
+
version_catalog: (_b = payload.versionCatalog) !== null && _b !== void 0 ? _b : 0,
|
|
19
|
+
last_product_id: (_c = payload.lastProductId) !== null && _c !== void 0 ? _c : -1,
|
|
20
|
+
page: (_d = payload.page) !== null && _d !== void 0 ? _d : 0,
|
|
21
|
+
};
|
|
22
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
23
|
+
if (!encryptedParams)
|
|
24
|
+
throw new ZaloApiError("Failed to encrypt params");
|
|
25
|
+
const response = await utils.request(serviceURL, {
|
|
26
|
+
method: "POST",
|
|
27
|
+
body: new URLSearchParams({
|
|
28
|
+
params: encryptedParams,
|
|
29
|
+
}),
|
|
30
|
+
});
|
|
31
|
+
return utils.resolve(response);
|
|
32
|
+
};
|
|
33
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export const getQRFactory = apiFactory()((api, _, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.friend[0]}/api/friend/mget-qr`);
|
|
5
|
+
/**
|
|
6
|
+
* Get QR code for users
|
|
7
|
+
*
|
|
8
|
+
* @param userId User ID or list of user IDs
|
|
9
|
+
*
|
|
10
|
+
* @throws {ZaloApiError}
|
|
11
|
+
*/
|
|
12
|
+
return async function getQR(userId) {
|
|
13
|
+
if (typeof userId == "string")
|
|
14
|
+
userId = [userId];
|
|
15
|
+
const params = {
|
|
16
|
+
fids: userId,
|
|
17
|
+
};
|
|
18
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
19
|
+
if (!encryptedParams)
|
|
20
|
+
throw new ZaloApiError("Failed to encrypt params");
|
|
21
|
+
const response = await utils.request(serviceURL, {
|
|
22
|
+
method: "POST",
|
|
23
|
+
body: new URLSearchParams({
|
|
24
|
+
params: encryptedParams,
|
|
25
|
+
}),
|
|
26
|
+
});
|
|
27
|
+
return utils.resolve(response);
|
|
28
|
+
};
|
|
29
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { QuickMessage } from "../models/index.js";
|
|
2
|
+
export type GetQuickMessageListResponse = {
|
|
3
|
+
cursor: number;
|
|
4
|
+
version: number;
|
|
5
|
+
items: QuickMessage[];
|
|
6
|
+
};
|
|
7
|
+
export declare const getQuickMessageListFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").API) => () => Promise<GetQuickMessageListResponse>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export const getQuickMessageListFactory = apiFactory()((api, ctx, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.quick_message[0]}/api/quickmessage/list`);
|
|
5
|
+
/**
|
|
6
|
+
* Get quick message list
|
|
7
|
+
*
|
|
8
|
+
* @throws {ZaloApiError}
|
|
9
|
+
*/
|
|
10
|
+
return async function getQuickMessageList() {
|
|
11
|
+
const params = {
|
|
12
|
+
version: 0,
|
|
13
|
+
lang: 0,
|
|
14
|
+
imei: ctx.imei,
|
|
15
|
+
};
|
|
16
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
17
|
+
if (!encryptedParams)
|
|
18
|
+
throw new 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
|
+
export type GetRelatedFriendGroupResponse = {
|
|
2
|
+
groupRelateds: {
|
|
3
|
+
[friendId: string]: string[];
|
|
4
|
+
};
|
|
5
|
+
};
|
|
6
|
+
export declare const getRelatedFriendGroupFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").API) => (friendId: string | string[]) => Promise<GetRelatedFriendGroupResponse>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export const getRelatedFriendGroupFactory = apiFactory()((api, ctx, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.friend[0]}/api/friend/group/related`);
|
|
5
|
+
/**
|
|
6
|
+
* Get related friend group
|
|
7
|
+
*
|
|
8
|
+
* @param friendId friend ids
|
|
9
|
+
*
|
|
10
|
+
* @note this API is used for zBusiness
|
|
11
|
+
* @throws {ZaloApiError}
|
|
12
|
+
*/
|
|
13
|
+
return async function getRelatedFriendGroup(friendId) {
|
|
14
|
+
const friendIds = Array.isArray(friendId) ? friendId : [friendId];
|
|
15
|
+
const params = {
|
|
16
|
+
friend_ids: JSON.stringify(friendIds),
|
|
17
|
+
imei: ctx.imei,
|
|
18
|
+
};
|
|
19
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
20
|
+
if (!encryptedParams)
|
|
21
|
+
throw new 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,25 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export const getReminderFactory = apiFactory()((api, ctx, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.group_board[0]}/api/board/topic/getReminder`);
|
|
5
|
+
/**
|
|
6
|
+
* Get reminder details from a group
|
|
7
|
+
*
|
|
8
|
+
* @param reminderId Reminder ID
|
|
9
|
+
*
|
|
10
|
+
* @throws {ZaloApiError}
|
|
11
|
+
*/
|
|
12
|
+
return async function getReminder(reminderId) {
|
|
13
|
+
const params = {
|
|
14
|
+
eventId: reminderId,
|
|
15
|
+
imei: ctx.imei,
|
|
16
|
+
};
|
|
17
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
18
|
+
if (!encryptedParams)
|
|
19
|
+
throw new 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);
|
|
24
|
+
};
|
|
25
|
+
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type GetReminderResponsesResponse = {
|
|
2
|
+
rejectMember: string[];
|
|
3
|
+
acceptMember: string[];
|
|
4
|
+
};
|
|
5
|
+
export declare const getReminderResponsesFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").API) => (reminderId: string) => Promise<GetReminderResponsesResponse>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export const getReminderResponsesFactory = apiFactory()((api, _ctx, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.group_board[0]}/api/board/topic/listResponseEvent`);
|
|
5
|
+
/**
|
|
6
|
+
* Get reminder responses
|
|
7
|
+
*
|
|
8
|
+
* @param reminderId reminder id
|
|
9
|
+
*
|
|
10
|
+
* @throws {ZaloApiError}
|
|
11
|
+
*/
|
|
12
|
+
return async function getReminderResponses(reminderId) {
|
|
13
|
+
const params = {
|
|
14
|
+
eventId: reminderId,
|
|
15
|
+
};
|
|
16
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
17
|
+
if (!encryptedParams)
|
|
18
|
+
throw new 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,3 @@
|
|
|
1
|
+
import type { StickerBasic } from "../models/index.js";
|
|
2
|
+
export type GetSearchStickerResponse = StickerBasic[];
|
|
3
|
+
export declare const getSearchStickerFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").API) => (keyword: string, limit?: number) => Promise<GetSearchStickerResponse>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export const getSearchStickerFactory = apiFactory()((api, ctx, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.sticker[0]}/api/message/sticker/search`);
|
|
5
|
+
/**
|
|
6
|
+
* Get search sticker
|
|
7
|
+
*
|
|
8
|
+
* @param keyword Keyword to search sticker
|
|
9
|
+
* @param limit Limit of stickers to return (default: 50)
|
|
10
|
+
*
|
|
11
|
+
* @throws {ZaloApiError}
|
|
12
|
+
*/
|
|
13
|
+
return async function getSearchSticker(keyword, limit = 50) {
|
|
14
|
+
const params = {
|
|
15
|
+
keyword: keyword,
|
|
16
|
+
limit: limit,
|
|
17
|
+
srcType: 0,
|
|
18
|
+
imei: ctx.imei,
|
|
19
|
+
};
|
|
20
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
21
|
+
if (!encryptedParams)
|
|
22
|
+
throw new ZaloApiError("Failed to encrypt params");
|
|
23
|
+
const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams }), {
|
|
24
|
+
method: "GET",
|
|
25
|
+
});
|
|
26
|
+
return utils.resolve(response);
|
|
27
|
+
};
|
|
28
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ZBusinessPackage } from "../models/ZBusiness.js";
|
|
2
|
+
export type SentFriendRequestInfo = {
|
|
3
|
+
userId: string;
|
|
4
|
+
zaloName: string;
|
|
5
|
+
displayName: string;
|
|
6
|
+
avatar: string;
|
|
7
|
+
globalId: string;
|
|
8
|
+
bizPkg: ZBusinessPackage;
|
|
9
|
+
fReqInfo: {
|
|
10
|
+
message: string;
|
|
11
|
+
src: number;
|
|
12
|
+
time: number;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export type GetSentFriendRequestResponse = {
|
|
16
|
+
[userId: string]: SentFriendRequestInfo;
|
|
17
|
+
};
|
|
18
|
+
export declare const getSentFriendRequestFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").API) => () => Promise<GetSentFriendRequestResponse>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export const getSentFriendRequestFactory = apiFactory()((api, ctx, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.friend[0]}/api/friend/requested/list`);
|
|
5
|
+
/**
|
|
6
|
+
* Get friend requested
|
|
7
|
+
*
|
|
8
|
+
* @note Zalo might throw an error with code 112 if you have no friend requests.
|
|
9
|
+
*
|
|
10
|
+
* @throws {ZaloApiError}
|
|
11
|
+
*/
|
|
12
|
+
return async function getSentFriendRequest() {
|
|
13
|
+
const params = {
|
|
14
|
+
imei: ctx.imei,
|
|
15
|
+
};
|
|
16
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
17
|
+
if (!encryptedParams)
|
|
18
|
+
throw new 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,20 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export const getSettingsFactory = apiFactory()((_api, _ctx, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`https://wpa.chat.zalo.me/api/setting/me`);
|
|
5
|
+
/**
|
|
6
|
+
* Get my account settings
|
|
7
|
+
*
|
|
8
|
+
* @throws {ZaloApiError}
|
|
9
|
+
*/
|
|
10
|
+
return async function getSettings() {
|
|
11
|
+
const params = {};
|
|
12
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
13
|
+
if (!encryptedParams)
|
|
14
|
+
throw new ZaloApiError("Failed to encrypt params");
|
|
15
|
+
const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams }), {
|
|
16
|
+
method: "GET",
|
|
17
|
+
});
|
|
18
|
+
return utils.resolve(response);
|
|
19
|
+
};
|
|
20
|
+
});
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { StickerDetail } from "../models/index.js";
|
|
2
|
+
export type GetStickerCategoryDetailResponse = StickerDetail[];
|
|
3
|
+
export declare const getStickerCategoryDetailFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").API) => (cateId: number) => Promise<GetStickerCategoryDetailResponse>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export const getStickerCategoryDetailFactory = apiFactory()((api, ctx, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.sticker[0]}/api/message/sticker/category/sticker_detail`);
|
|
5
|
+
/**
|
|
6
|
+
* Get sticker category detail
|
|
7
|
+
*
|
|
8
|
+
* @param cateId Sticker category ID
|
|
9
|
+
*
|
|
10
|
+
* @throws {ZaloApiError}
|
|
11
|
+
*/
|
|
12
|
+
return async function getStickerCategoryDetail(cateId) {
|
|
13
|
+
const params = {
|
|
14
|
+
cid: cateId,
|
|
15
|
+
};
|
|
16
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
17
|
+
if (!encryptedParams)
|
|
18
|
+
throw new 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 @@
|
|
|
1
|
+
export declare const getStickersFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").API) => (keyword: string) => Promise<number[]>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export const getStickersFactory = apiFactory()((api, ctx, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.sticker}/api/message/sticker`);
|
|
5
|
+
/**
|
|
6
|
+
* Get stickers by keyword
|
|
7
|
+
*
|
|
8
|
+
* @param keyword Keyword to search for
|
|
9
|
+
* @returns Sticker IDs
|
|
10
|
+
*
|
|
11
|
+
* @throws {ZaloApiError}
|
|
12
|
+
*/
|
|
13
|
+
return async function getStickers(keyword) {
|
|
14
|
+
if (!keyword)
|
|
15
|
+
throw new ZaloApiError("Missing keyword");
|
|
16
|
+
const params = {
|
|
17
|
+
keyword: keyword,
|
|
18
|
+
gif: 1,
|
|
19
|
+
guggy: 0,
|
|
20
|
+
imei: ctx.imei,
|
|
21
|
+
};
|
|
22
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
23
|
+
if (!encryptedParams)
|
|
24
|
+
throw new ZaloApiError("Failed to encrypt message");
|
|
25
|
+
const finalServiceUrl = new URL(serviceURL);
|
|
26
|
+
finalServiceUrl.pathname = finalServiceUrl.pathname + "/suggest/stickers";
|
|
27
|
+
const response = await utils.request(utils.makeURL(finalServiceUrl.toString(), {
|
|
28
|
+
params: encryptedParams,
|
|
29
|
+
}));
|
|
30
|
+
return utils.resolve(response, (result) => {
|
|
31
|
+
const suggestions = result.data;
|
|
32
|
+
const stickerIds = [];
|
|
33
|
+
// @TODO: Implement these
|
|
34
|
+
// suggestions.sugg_guggy, suggestions.sugg_gif
|
|
35
|
+
if (suggestions.sugg_sticker)
|
|
36
|
+
suggestions.sugg_sticker.forEach((sticker) => stickerIds.push(sticker.sticker_id));
|
|
37
|
+
return stickerIds;
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
});
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { StickerDetail } from "../models/index.js";
|
|
2
|
+
export type StickerDetailResponse = StickerDetail[];
|
|
3
|
+
export declare const getStickersDetailFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").API) => (stickerIds: number | number[]) => Promise<StickerDetailResponse>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory, resolveResponse } from "../utils.js";
|
|
3
|
+
export const getStickersDetailFactory = apiFactory()((api, ctx, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.sticker}/api/message/sticker/sticker_detail`);
|
|
5
|
+
/**
|
|
6
|
+
* Get stickers detail by sticker IDs
|
|
7
|
+
*
|
|
8
|
+
* @param stickerIds Sticker IDs to search for
|
|
9
|
+
*
|
|
10
|
+
* @throws {ZaloApiError}
|
|
11
|
+
*/
|
|
12
|
+
return async function getStickersDetail(stickerIds) {
|
|
13
|
+
if (!stickerIds)
|
|
14
|
+
throw new ZaloApiError("Missing sticker id");
|
|
15
|
+
if (!Array.isArray(stickerIds))
|
|
16
|
+
stickerIds = [stickerIds];
|
|
17
|
+
if (stickerIds.length == 0)
|
|
18
|
+
throw new ZaloApiError("Missing sticker id");
|
|
19
|
+
const stickers = [];
|
|
20
|
+
const tasks = stickerIds.map((stickerId) => getStickerDetail(stickerId));
|
|
21
|
+
const tasksResult = await Promise.allSettled(tasks);
|
|
22
|
+
tasksResult.forEach((result) => {
|
|
23
|
+
if (result.status === "fulfilled")
|
|
24
|
+
stickers.push(result.value);
|
|
25
|
+
});
|
|
26
|
+
return stickers;
|
|
27
|
+
};
|
|
28
|
+
async function getStickerDetail(stickerId) {
|
|
29
|
+
const params = {
|
|
30
|
+
sid: stickerId,
|
|
31
|
+
};
|
|
32
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
33
|
+
if (!encryptedParams)
|
|
34
|
+
throw new ZaloApiError("Failed to encrypt message");
|
|
35
|
+
const response = await utils.request(utils.makeURL(serviceURL, {
|
|
36
|
+
params: encryptedParams,
|
|
37
|
+
}));
|
|
38
|
+
return resolveResponse(ctx, response);
|
|
39
|
+
}
|
|
40
|
+
});
|