zalo-api-sdk 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/.tmp-cache/_update-notifier-last-checked +0 -0
- package/CODE_OF_CONDUCT.md +157 -0
- package/CONTRIBUTING.md +491 -0
- package/LICENSE +21 -0
- package/README.md +421 -0
- package/SECURITY.md +82 -0
- package/commit-push.sh +79 -0
- package/deploy.sh +172 -0
- package/dist/Errors/ZaloApiError.d.ts +4 -0
- package/dist/Errors/ZaloApiError.js +7 -0
- package/dist/Errors/index.d.ts +1 -0
- package/dist/Errors/index.js +1 -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/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/createNoteGroup.d.ts +7 -0
- package/dist/apis/createNoteGroup.js +47 -0
- package/dist/apis/createPoll.d.ts +57 -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 +10 -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/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/editNoteGroup.d.ts +32 -0
- package/dist/apis/editNoteGroup.js +40 -0
- package/dist/apis/editReminder.d.ts +18 -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 +34 -0
- package/dist/apis/fetchAccountInfo.js +10 -0
- package/dist/apis/findUser.d.ts +15 -0
- package/dist/apis/findUser.js +40 -0
- package/dist/apis/forwardMessage.d.ts +26 -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 +34 -0
- package/dist/apis/getAllFriends.js +32 -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/getBizAccount.d.ts +19 -0
- package/dist/apis/getBizAccount.js +27 -0
- package/dist/apis/getCatalogList.d.ts +12 -0
- package/dist/apis/getCatalogList.js +32 -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/getFriendRequestStatus.d.ts +8 -0
- package/dist/apis/getFriendRequestStatus.js +25 -0
- package/dist/apis/getGroupBlockedMember.d.ts +17 -0
- package/dist/apis/getGroupBlockedMember.js +29 -0
- package/dist/apis/getGroupInfo.d.ts +43 -0
- package/dist/apis/getGroupInfo.js +32 -0
- package/dist/apis/getGroupLinkDetail.d.ts +6 -0
- package/dist/apis/getGroupLinkDetail.js +25 -0
- package/dist/apis/getGroupLinkInfo.d.ts +31 -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 +15 -0
- package/dist/apis/getLabels.js +28 -0
- package/dist/apis/getListBoard.d.ts +15 -0
- package/dist/apis/getListBoard.js +45 -0
- package/dist/apis/getListReminder.d.ts +22 -0
- package/dist/apis/getListReminder.js +47 -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 +10 -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 +14 -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/getQuickMessage.d.ts +7 -0
- package/dist/apis/getQuickMessage.js +24 -0
- package/dist/apis/getReceivedFriendRequests.d.ts +35 -0
- package/dist/apis/getReceivedFriendRequests.js +22 -0
- package/dist/apis/getReminder.d.ts +13 -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/getSentFriendRequest.d.ts +17 -0
- package/dist/apis/getSentFriendRequest.js +24 -0
- package/dist/apis/getStickers.d.ts +1 -0
- package/dist/apis/getStickers.js +40 -0
- package/dist/apis/getStickersDetail.d.ts +24 -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 +39 -0
- package/dist/apis/getUserInfo.js +42 -0
- package/dist/apis/inviteUserToGroups.d.ts +10 -0
- package/dist/apis/inviteUserToGroups.js +30 -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 +100 -0
- package/dist/apis/listen.js +424 -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 +359 -0
- package/dist/apis/parseLink.d.ts +21 -0
- package/dist/apis/parseLink.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 +6 -0
- package/dist/apis/reviewPendingMemberRequest.js +31 -0
- package/dist/apis/sendBankCard.d.ts +9 -0
- package/dist/apis/sendBankCard.js +39 -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 +460 -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 +6 -0
- package/dist/apis/sendSticker.js +56 -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/setHiddenConversations.d.ts +3 -0
- package/dist/apis/setHiddenConversations.js +37 -0
- package/dist/apis/setMute.d.ts +17 -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/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/updateAutoDeleteChat.d.ts +9 -0
- package/dist/apis/updateAutoDeleteChat.js +40 -0
- package/dist/apis/updateAutoReply.d.ts +14 -0
- package/dist/apis/updateAutoReply.js +37 -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 +24 -0
- package/dist/apis/updateLabels.js +34 -0
- package/dist/apis/updateLang.d.ts +7 -0
- package/dist/apis/updateLang.js +32 -0
- package/dist/apis/updateProductCatalog.d.ts +25 -0
- package/dist/apis/updateProductCatalog.js +51 -0
- package/dist/apis/updateProfile.d.ts +13 -0
- package/dist/apis/updateProfile.js +42 -0
- package/dist/apis/updateQuickMessage.d.ts +11 -0
- package/dist/apis/updateQuickMessage.js +61 -0
- package/dist/apis/updateSettings.d.ts +3 -0
- package/dist/apis/updateSettings.js +23 -0
- package/dist/apis/uploadAttachment.d.ts +50 -0
- package/dist/apis/uploadAttachment.js +205 -0
- package/dist/apis/uploadProductPhoto.d.ts +14 -0
- package/dist/apis/uploadProductPhoto.js +50 -0
- package/dist/cjs/Errors/ZaloApiError.cjs +11 -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/addQuickMessage.cjs +65 -0
- package/dist/cjs/apis/addReaction.cjs +304 -0
- package/dist/cjs/apis/addUnreadMark.cjs +62 -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/createNoteGroup.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 +73 -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 +60 -0
- package/dist/cjs/apis/deleteMessage.cjs +62 -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/editNoteGroup.cjs +45 -0
- package/dist/cjs/apis/editReminder.cjs +71 -0
- package/dist/cjs/apis/enableGroupLink.cjs +30 -0
- package/dist/cjs/apis/fetchAccountInfo.cjs +15 -0
- package/dist/cjs/apis/findUser.cjs +45 -0
- package/dist/cjs/apis/forwardMessage.cjs +109 -0
- package/dist/cjs/apis/getAliasList.cjs +32 -0
- package/dist/cjs/apis/getAllFriends.cjs +37 -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/getBizAccount.cjs +32 -0
- package/dist/cjs/apis/getCatalogList.cjs +37 -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/getFriendRequestStatus.cjs +30 -0
- package/dist/cjs/apis/getGroupBlockedMember.cjs +34 -0
- package/dist/cjs/apis/getGroupInfo.cjs +37 -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 +55 -0
- package/dist/cjs/apis/getListReminder.cjs +57 -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/getQuickMessage.cjs +29 -0
- package/dist/cjs/apis/getReceivedFriendRequests.cjs +27 -0
- package/dist/cjs/apis/getReminder.cjs +30 -0
- package/dist/cjs/apis/getReminderResponses.cjs +29 -0
- package/dist/cjs/apis/getSentFriendRequest.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 +47 -0
- package/dist/cjs/apis/inviteUserToGroups.cjs +35 -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 +435 -0
- package/dist/cjs/apis/lockPoll.cjs +33 -0
- package/dist/cjs/apis/login.cjs +102 -0
- package/dist/cjs/apis/loginQR.cjs +364 -0
- package/dist/cjs/apis/parseLink.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 +50 -0
- package/dist/cjs/apis/removeUnreadMark.cjs +60 -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 +36 -0
- package/dist/cjs/apis/sendBankCard.cjs +49 -0
- package/dist/cjs/apis/sendCard.cjs +69 -0
- package/dist/cjs/apis/sendDeliveredEvent.cjs +65 -0
- package/dist/cjs/apis/sendFriendRequest.cjs +44 -0
- package/dist/cjs/apis/sendLink.cjs +71 -0
- package/dist/cjs/apis/sendMessage.cjs +469 -0
- package/dist/cjs/apis/sendReport.cjs +63 -0
- package/dist/cjs/apis/sendSeenEvent.cjs +73 -0
- package/dist/cjs/apis/sendSticker.cjs +66 -0
- package/dist/cjs/apis/sendTypingEvent.cjs +43 -0
- package/dist/cjs/apis/sendVideo.cjs +128 -0
- package/dist/cjs/apis/sendVoice.cjs +83 -0
- package/dist/cjs/apis/setHiddenConversations.cjs +47 -0
- package/dist/cjs/apis/setMute.cjs +77 -0
- package/dist/cjs/apis/setPinnedConversations.cjs +44 -0
- package/dist/cjs/apis/unblockUser.cjs +33 -0
- package/dist/cjs/apis/undo.cjs +52 -0
- package/dist/cjs/apis/undoFriendRequest.cjs +32 -0
- package/dist/cjs/apis/updateAutoDeleteChat.cjs +50 -0
- package/dist/cjs/apis/updateAutoReply.cjs +42 -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 +37 -0
- package/dist/cjs/apis/updateProductCatalog.cjs +56 -0
- package/dist/cjs/apis/updateProfile.cjs +47 -0
- package/dist/cjs/apis/updateQuickMessage.cjs +66 -0
- package/dist/cjs/apis/updateSettings.cjs +28 -0
- package/dist/cjs/apis/uploadAttachment.cjs +215 -0
- package/dist/cjs/apis/uploadProductPhoto.cjs +55 -0
- package/dist/cjs/context.cjs +34 -0
- package/dist/cjs/index.cjs +121 -0
- package/dist/cjs/models/AutoReply.cjs +9 -0
- package/dist/cjs/models/DeliveredMessage.cjs +23 -0
- package/dist/cjs/models/Enum.cjs +95 -0
- package/dist/cjs/models/FriendEvent.cjs +87 -0
- package/dist/cjs/models/GroupEvent.cjs +88 -0
- package/dist/cjs/models/Message.cjs +32 -0
- package/dist/cjs/models/Reaction.cjs +74 -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 +46 -0
- package/dist/cjs/update.cjs +27 -0
- package/dist/cjs/utils.cjs +732 -0
- package/dist/cjs/zalo.cjs +360 -0
- package/dist/context.d.ts +177 -0
- package/dist/context.js +28 -0
- package/dist/index.d.ts +130 -0
- package/dist/index.js +11 -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 +54 -0
- package/dist/models/Board.js +1 -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 +87 -0
- package/dist/models/Enum.js +93 -0
- package/dist/models/FriendEvent.d.ts +107 -0
- package/dist/models/FriendEvent.js +83 -0
- package/dist/models/GroupEvent.d.ts +197 -0
- package/dist/models/GroupEvent.js +84 -0
- package/dist/models/Message.d.ts +91 -0
- package/dist/models/Message.js +26 -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 +35 -0
- package/dist/models/Reminder.js +1 -0
- package/dist/models/SeenMessage.d.ts +26 -0
- package/dist/models/SeenMessage.js +17 -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/ZBusiness.d.ts +29 -0
- package/dist/models/ZBusiness.js +42 -0
- package/dist/models/index.d.ts +17 -0
- package/dist/models/index.js +17 -0
- package/dist/update.d.ts +2 -0
- package/dist/update.js +22 -0
- package/dist/utils.d.ts +168 -0
- package/dist/utils.js +748 -0
- package/dist/zalo.d.ts +291 -0
- package/dist/zalo.js +354 -0
- package/eslint.config.js +21 -0
- package/index.d.ts +2 -0
- package/package.json +143 -0
- package/qr.png +0 -0
- package/rollup.config.js +28 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { ThreadType } from "../models/index.js";
|
|
3
|
+
import { apiFactory } from "../utils.js";
|
|
4
|
+
export const addUnreadMarkFactory = apiFactory()((api, ctx, utils) => {
|
|
5
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.conversation[0]}/api/conv/addUnreadMark`);
|
|
6
|
+
/**
|
|
7
|
+
* Add unread mark to conversation
|
|
8
|
+
*
|
|
9
|
+
* @param threadId Thread ID
|
|
10
|
+
* @param type Thread type (User/Group)
|
|
11
|
+
*
|
|
12
|
+
* @throws ZaloApiError
|
|
13
|
+
*/
|
|
14
|
+
return async function addUnreadMark(threadId, type = ThreadType.User) {
|
|
15
|
+
const timestamp = Date.now();
|
|
16
|
+
const timestampString = timestamp.toString();
|
|
17
|
+
const isGroup = type === ThreadType.Group;
|
|
18
|
+
const requestParams = {
|
|
19
|
+
param: JSON.stringify({
|
|
20
|
+
[isGroup ? "convsGroup" : "convsUser"]: [
|
|
21
|
+
{
|
|
22
|
+
id: threadId,
|
|
23
|
+
cliMsgId: timestampString,
|
|
24
|
+
fromUid: "0",
|
|
25
|
+
ts: timestamp,
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
[isGroup ? "convsUser" : "convsGroup"]: [],
|
|
29
|
+
imei: ctx.imei,
|
|
30
|
+
}),
|
|
31
|
+
};
|
|
32
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(requestParams));
|
|
33
|
+
if (!encryptedParams)
|
|
34
|
+
throw new ZaloApiError("Failed to encrypt params");
|
|
35
|
+
const response = await utils.request(serviceURL, {
|
|
36
|
+
method: "POST",
|
|
37
|
+
body: new URLSearchParams({
|
|
38
|
+
params: encryptedParams,
|
|
39
|
+
}),
|
|
40
|
+
});
|
|
41
|
+
return utils.resolve(response, (result) => {
|
|
42
|
+
const data = result.data;
|
|
43
|
+
if (typeof data.data === "string") {
|
|
44
|
+
return {
|
|
45
|
+
data: JSON.parse(data.data),
|
|
46
|
+
status: data.status,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
return result.data;
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type AddUserToGroupResponse = {
|
|
2
|
+
errorMembers: string[];
|
|
3
|
+
error_data: Record<string, string[]>;
|
|
4
|
+
};
|
|
5
|
+
export declare const addUserToGroupFactory: (ctx: import("../context.js").ContextBase, api: import("../zalo.js").API) => (memberId: string | string[], groupId: string) => Promise<AddUserToGroupResponse>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export const addUserToGroupFactory = apiFactory()((api, ctx, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.group[0]}/api/group/invite/v2`);
|
|
5
|
+
/**
|
|
6
|
+
* Add user to existing group
|
|
7
|
+
*
|
|
8
|
+
* @param memberId User ID or list of user IDs to add
|
|
9
|
+
* @param groupId Group ID
|
|
10
|
+
*
|
|
11
|
+
* @throws ZaloApiError
|
|
12
|
+
*/
|
|
13
|
+
return async function addUserToGroup(memberId, groupId) {
|
|
14
|
+
if (!Array.isArray(memberId))
|
|
15
|
+
memberId = [memberId];
|
|
16
|
+
const params = {
|
|
17
|
+
grid: groupId,
|
|
18
|
+
members: memberId,
|
|
19
|
+
membersTypes: memberId.map(() => -1),
|
|
20
|
+
imei: ctx.imei,
|
|
21
|
+
clientLang: ctx.language,
|
|
22
|
+
};
|
|
23
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
24
|
+
if (!encryptedParams)
|
|
25
|
+
throw new ZaloApiError("Failed to encrypt params");
|
|
26
|
+
const response = await utils.request(serviceURL, {
|
|
27
|
+
method: "POST",
|
|
28
|
+
body: new URLSearchParams({
|
|
29
|
+
params: encryptedParams,
|
|
30
|
+
}),
|
|
31
|
+
});
|
|
32
|
+
return utils.resolve(response);
|
|
33
|
+
};
|
|
34
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export const blockUserFactory = apiFactory()((api, ctx, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.friend[0]}/api/friend/block`);
|
|
5
|
+
/**
|
|
6
|
+
* Block a User
|
|
7
|
+
*
|
|
8
|
+
* @param userId The ID of the User to block
|
|
9
|
+
*
|
|
10
|
+
* @throws ZaloApiError
|
|
11
|
+
*/
|
|
12
|
+
return async function blockUser(userId) {
|
|
13
|
+
const params = {
|
|
14
|
+
fid: userId,
|
|
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(serviceURL, {
|
|
21
|
+
method: "POST",
|
|
22
|
+
body: new URLSearchParams({
|
|
23
|
+
params: encryptedParams,
|
|
24
|
+
}),
|
|
25
|
+
});
|
|
26
|
+
return utils.resolve(response);
|
|
27
|
+
};
|
|
28
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export const blockViewFeedFactory = apiFactory()((api, ctx, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.friend[0]}/api/friend/feed/block`);
|
|
5
|
+
/**
|
|
6
|
+
* Block/Unblock friend view feed by ID
|
|
7
|
+
*
|
|
8
|
+
* @param isBlockFeed Boolean to block/unblock view feed
|
|
9
|
+
* @param userId User ID to block/unblock view feed
|
|
10
|
+
*
|
|
11
|
+
* @throws ZaloApiError
|
|
12
|
+
*/
|
|
13
|
+
return async function blockViewFeed(isBlockFeed, userId) {
|
|
14
|
+
const params = {
|
|
15
|
+
fid: userId,
|
|
16
|
+
isBlockFeed: isBlockFeed ? 1 : 0,
|
|
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,3 @@
|
|
|
1
|
+
import type { AttachmentSource } from "../models/index.js";
|
|
2
|
+
export type ChangeAccountAvatarResponse = "";
|
|
3
|
+
export declare const changeAccountAvatarFactory: (ctx: import("../context.js").ContextBase, api: import("../zalo.js").API) => (avatarSource: AttachmentSource) => Promise<"">;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import FormData from "form-data";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
4
|
+
import { apiFactory, formatTime, getImageMetaData } from "../utils.js";
|
|
5
|
+
export const changeAccountAvatarFactory = apiFactory()((api, ctx, utils) => {
|
|
6
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.file[0]}/api/profile/upavatar`);
|
|
7
|
+
/**
|
|
8
|
+
* Change account avatar
|
|
9
|
+
*
|
|
10
|
+
* @param avatarSource Attachment source, can be a file path or an Attachment object
|
|
11
|
+
*
|
|
12
|
+
* @throws ZaloApiError
|
|
13
|
+
*/
|
|
14
|
+
return async function changeAccountAvatar(avatarSource) {
|
|
15
|
+
const isSourceFilePath = typeof avatarSource == "string";
|
|
16
|
+
const imageMetaData = isSourceFilePath ? await getImageMetaData(avatarSource) : avatarSource.metadata;
|
|
17
|
+
const fileSize = imageMetaData.totalSize || 0;
|
|
18
|
+
const params = {
|
|
19
|
+
avatarSize: 120,
|
|
20
|
+
clientId: String(ctx.uid + formatTime("%H:%M %d/%m/%Y")),
|
|
21
|
+
language: ctx.language,
|
|
22
|
+
metaData: JSON.stringify({
|
|
23
|
+
origin: {
|
|
24
|
+
width: imageMetaData.width || 1080,
|
|
25
|
+
height: imageMetaData.height || 1080,
|
|
26
|
+
},
|
|
27
|
+
processed: {
|
|
28
|
+
width: imageMetaData.width || 1080,
|
|
29
|
+
height: imageMetaData.height || 1080,
|
|
30
|
+
size: fileSize,
|
|
31
|
+
},
|
|
32
|
+
}),
|
|
33
|
+
};
|
|
34
|
+
const avatarData = isSourceFilePath ? fs.readFileSync(avatarSource) : avatarSource.data;
|
|
35
|
+
const formData = new FormData();
|
|
36
|
+
formData.append("fileContent", avatarData, {
|
|
37
|
+
filename: "blob",
|
|
38
|
+
contentType: "image/jpeg",
|
|
39
|
+
});
|
|
40
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
41
|
+
if (!encryptedParams)
|
|
42
|
+
throw new ZaloApiError("Failed to encrypt params");
|
|
43
|
+
const response = await utils.request(utils.makeURL(serviceURL, {
|
|
44
|
+
params: encryptedParams,
|
|
45
|
+
}), {
|
|
46
|
+
method: "POST",
|
|
47
|
+
headers: formData.getHeaders(),
|
|
48
|
+
body: formData.getBuffer(),
|
|
49
|
+
});
|
|
50
|
+
return utils.resolve(response);
|
|
51
|
+
};
|
|
52
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export const changeFriendAliasFactory = apiFactory()((api, ctx, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.alias[0]}/api/alias/update`);
|
|
5
|
+
/**
|
|
6
|
+
* Change friend's alias
|
|
7
|
+
*
|
|
8
|
+
* @param alias new alias (nickname - bietdanh)
|
|
9
|
+
* @param friendId friend id
|
|
10
|
+
*
|
|
11
|
+
* @throws ZaloApiError
|
|
12
|
+
*/
|
|
13
|
+
return async function changeFriendAlias(alias, friendId) {
|
|
14
|
+
const params = {
|
|
15
|
+
friendId: friendId,
|
|
16
|
+
alias: alias,
|
|
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,3 @@
|
|
|
1
|
+
import type { AttachmentSource } from "../models/index.js";
|
|
2
|
+
export type ChangeGroupAvatarResponse = "";
|
|
3
|
+
export declare const changeGroupAvatarFactory: (ctx: import("../context.js").ContextBase, api: import("../zalo.js").API) => (avatarSource: AttachmentSource, groupId: string) => Promise<"">;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import FormData from "form-data";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
4
|
+
import { apiFactory, getFullTimeFromMillisecond, getImageMetaData } from "../utils.js";
|
|
5
|
+
export const changeGroupAvatarFactory = apiFactory()((api, ctx, utils) => {
|
|
6
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.file[0]}/api/group/upavatar`);
|
|
7
|
+
/**
|
|
8
|
+
* Change group avatar
|
|
9
|
+
*
|
|
10
|
+
* @param avatarSource Attachment source, can be a file path or an Attachment object
|
|
11
|
+
* @param groupId Group ID
|
|
12
|
+
*
|
|
13
|
+
* @throws ZaloApiError
|
|
14
|
+
*/
|
|
15
|
+
return async function changeGroupAvatar(avatarSource, groupId) {
|
|
16
|
+
const params = {
|
|
17
|
+
grid: groupId,
|
|
18
|
+
avatarSize: 120,
|
|
19
|
+
clientId: `g${groupId}${getFullTimeFromMillisecond(new Date().getTime())}`,
|
|
20
|
+
imei: ctx.imei,
|
|
21
|
+
};
|
|
22
|
+
const isSourceFilePath = typeof avatarSource == "string";
|
|
23
|
+
const imageMetaData = isSourceFilePath ? await getImageMetaData(avatarSource) : avatarSource.metadata;
|
|
24
|
+
params.originWidth = imageMetaData.width || 1080;
|
|
25
|
+
params.originHeight = imageMetaData.height || 1080;
|
|
26
|
+
const avatarData = isSourceFilePath ? fs.readFileSync(avatarSource) : avatarSource.data;
|
|
27
|
+
const formData = new FormData();
|
|
28
|
+
formData.append("fileContent", avatarData, {
|
|
29
|
+
filename: "blob",
|
|
30
|
+
contentType: "image/jpeg",
|
|
31
|
+
});
|
|
32
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
33
|
+
if (!encryptedParams)
|
|
34
|
+
throw new ZaloApiError("Failed to encrypt params");
|
|
35
|
+
const response = await utils.request(utils.makeURL(serviceURL, {
|
|
36
|
+
params: encryptedParams,
|
|
37
|
+
}), {
|
|
38
|
+
method: "POST",
|
|
39
|
+
headers: formData.getHeaders(),
|
|
40
|
+
body: formData.getBuffer(),
|
|
41
|
+
});
|
|
42
|
+
return utils.resolve(response);
|
|
43
|
+
};
|
|
44
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export const changeGroupNameFactory = apiFactory()((api, ctx, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.group[0]}/api/group/updateinfo`);
|
|
5
|
+
/**
|
|
6
|
+
* Change group name
|
|
7
|
+
*
|
|
8
|
+
* @param name New group name
|
|
9
|
+
* @param groupId Group ID
|
|
10
|
+
*
|
|
11
|
+
* @throws ZaloApiError
|
|
12
|
+
*/
|
|
13
|
+
return async function changeGroupName(name, groupId) {
|
|
14
|
+
if (name.length == 0)
|
|
15
|
+
name = Date.now().toString();
|
|
16
|
+
const params = {
|
|
17
|
+
grid: groupId,
|
|
18
|
+
gname: name,
|
|
19
|
+
imei: ctx.imei,
|
|
20
|
+
};
|
|
21
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
22
|
+
if (!encryptedParams)
|
|
23
|
+
throw new ZaloApiError("Failed to encrypt params");
|
|
24
|
+
const response = await utils.request(serviceURL, {
|
|
25
|
+
method: "POST",
|
|
26
|
+
body: new URLSearchParams({
|
|
27
|
+
params: encryptedParams,
|
|
28
|
+
}),
|
|
29
|
+
});
|
|
30
|
+
return utils.resolve(response);
|
|
31
|
+
};
|
|
32
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export const changeGroupOwnerFactory = apiFactory()((api, ctx, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.group[0]}/api/group/change-owner`);
|
|
5
|
+
/**
|
|
6
|
+
* Change group owner
|
|
7
|
+
*
|
|
8
|
+
* @param memberId User Id of new group owner
|
|
9
|
+
* @param groupId Group Id
|
|
10
|
+
* @note Be careful when changing the key, as it will result in losing group admin rights
|
|
11
|
+
*
|
|
12
|
+
* @throws ZaloApiError
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
return async function changeGroupOwner(memberId, groupId) {
|
|
16
|
+
const params = {
|
|
17
|
+
grid: groupId,
|
|
18
|
+
newAdminId: memberId,
|
|
19
|
+
imei: ctx.imei,
|
|
20
|
+
language: ctx.language,
|
|
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(utils.makeURL(serviceURL, { params: encryptedParams }), {
|
|
26
|
+
method: "GET",
|
|
27
|
+
});
|
|
28
|
+
return utils.resolve(response);
|
|
29
|
+
};
|
|
30
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { AutoReplyItem, AutoReplyScope } from "../models/index.js";
|
|
2
|
+
export type CreateAutoReplyPayload = {
|
|
3
|
+
content: string;
|
|
4
|
+
isEnable: boolean;
|
|
5
|
+
startTime: number;
|
|
6
|
+
endTime: number;
|
|
7
|
+
scope: AutoReplyScope;
|
|
8
|
+
uids?: string | string[];
|
|
9
|
+
};
|
|
10
|
+
export type CreateAutoReplyResponse = {
|
|
11
|
+
item: AutoReplyItem;
|
|
12
|
+
version: number;
|
|
13
|
+
};
|
|
14
|
+
export declare const createAutoReplyFactory: (ctx: import("../context.js").ContextBase, api: import("../zalo.js").API) => (payload: CreateAutoReplyPayload) => Promise<CreateAutoReplyResponse>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export const createAutoReplyFactory = apiFactory()((api, ctx, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.auto_reply[0]}/api/autoreply/create`);
|
|
5
|
+
/**
|
|
6
|
+
* Create auto reply
|
|
7
|
+
*
|
|
8
|
+
* @param payload payload
|
|
9
|
+
*
|
|
10
|
+
* @note this API used for zBusiness
|
|
11
|
+
* @throws ZaloApiError
|
|
12
|
+
*/
|
|
13
|
+
return async function createAutoReply(payload) {
|
|
14
|
+
const uids = Array.isArray(payload.uids) ? payload.uids : [payload.uids];
|
|
15
|
+
const resultUids = (payload.scope === 2 || payload.scope === 3) ? uids : [];
|
|
16
|
+
const params = {
|
|
17
|
+
cliLang: ctx.language,
|
|
18
|
+
enable: payload.isEnable,
|
|
19
|
+
content: payload.content,
|
|
20
|
+
startTime: payload.startTime,
|
|
21
|
+
endTime: payload.endTime,
|
|
22
|
+
recurrence: ["RRULE:FREQ=DAILY;"],
|
|
23
|
+
scope: payload.scope,
|
|
24
|
+
uids: resultUids,
|
|
25
|
+
};
|
|
26
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
27
|
+
if (!encryptedParams)
|
|
28
|
+
throw new ZaloApiError("Failed to encrypt params");
|
|
29
|
+
const response = await utils.request(serviceURL, {
|
|
30
|
+
method: "POST",
|
|
31
|
+
body: new URLSearchParams({
|
|
32
|
+
params: encryptedParams,
|
|
33
|
+
}),
|
|
34
|
+
});
|
|
35
|
+
return utils.resolve(response);
|
|
36
|
+
};
|
|
37
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CatalogItem } from "../models/index.js";
|
|
2
|
+
export type CreateCatalogResponse = {
|
|
3
|
+
item: CatalogItem;
|
|
4
|
+
version_ls_catalog: number;
|
|
5
|
+
version_catalog: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const createCatalogFactory: (ctx: import("../context.js").ContextBase, api: import("../zalo.js").API) => (catalogName: string) => Promise<CreateCatalogResponse>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export const createCatalogFactory = apiFactory()((api, _, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.catalog[0]}/api/prodcatalog/catalog/create`);
|
|
5
|
+
/**
|
|
6
|
+
* Create catalog?
|
|
7
|
+
*
|
|
8
|
+
* @param catalogName catalog name
|
|
9
|
+
*
|
|
10
|
+
* @note this API is used for zBusiness
|
|
11
|
+
* @throws ZaloApiError
|
|
12
|
+
*/
|
|
13
|
+
return async function createCatalog(catalogName) {
|
|
14
|
+
const params = {
|
|
15
|
+
catalog_name: catalogName,
|
|
16
|
+
catalog_photo: "",
|
|
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,28 @@
|
|
|
1
|
+
import type { AttachmentSource } from "../models/index.js";
|
|
2
|
+
export type CreateGroupResponse = {
|
|
3
|
+
groupType: number;
|
|
4
|
+
sucessMembers: string[];
|
|
5
|
+
groupId: string;
|
|
6
|
+
errorMembers: string[];
|
|
7
|
+
error_data: Record<string, unknown>;
|
|
8
|
+
};
|
|
9
|
+
export type CreateGroupOptions = {
|
|
10
|
+
/**
|
|
11
|
+
* Group name
|
|
12
|
+
*/
|
|
13
|
+
name?: string;
|
|
14
|
+
/**
|
|
15
|
+
* List of member IDs to add to the group
|
|
16
|
+
*/
|
|
17
|
+
members: string[];
|
|
18
|
+
/**
|
|
19
|
+
* Avatar source, can be a file path or an Attachment object
|
|
20
|
+
*/
|
|
21
|
+
avatarSource?: AttachmentSource;
|
|
22
|
+
/**
|
|
23
|
+
* Path to the avatar image file
|
|
24
|
+
* @deprecated Use `avatarSource` instead
|
|
25
|
+
*/
|
|
26
|
+
avatarPath?: string;
|
|
27
|
+
};
|
|
28
|
+
export declare const createGroupFactory: (ctx: import("../context.js").ContextBase, api: import("../zalo.js").API) => (options: CreateGroupOptions) => Promise<CreateGroupResponse>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export const createGroupFactory = apiFactory()((api, ctx, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.group[0]}/api/group/create/v2`);
|
|
5
|
+
/**
|
|
6
|
+
* Create a new group
|
|
7
|
+
*
|
|
8
|
+
* @param options Group options
|
|
9
|
+
*
|
|
10
|
+
* @throws ZaloApiError
|
|
11
|
+
*/
|
|
12
|
+
return async function createGroup(options) {
|
|
13
|
+
if (options.members.length == 0)
|
|
14
|
+
throw new ZaloApiError("Group must have at least one member");
|
|
15
|
+
const params = {
|
|
16
|
+
clientId: Date.now(),
|
|
17
|
+
gname: String(Date.now()),
|
|
18
|
+
gdesc: null,
|
|
19
|
+
members: options.members,
|
|
20
|
+
membersTypes: options.members.map(() => -1),
|
|
21
|
+
nameChanged: 0,
|
|
22
|
+
createLink: 1,
|
|
23
|
+
clientLang: ctx.language,
|
|
24
|
+
imei: ctx.imei,
|
|
25
|
+
zsource: 601,
|
|
26
|
+
};
|
|
27
|
+
if (options.name && options.name.length > 0) {
|
|
28
|
+
params.gname = options.name;
|
|
29
|
+
params.nameChanged = 1;
|
|
30
|
+
}
|
|
31
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
32
|
+
if (!encryptedParams)
|
|
33
|
+
throw new ZaloApiError("Failed to encrypt message");
|
|
34
|
+
const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams }), {
|
|
35
|
+
method: "POST",
|
|
36
|
+
});
|
|
37
|
+
const data = await utils.resolve(response);
|
|
38
|
+
options.avatarSource = options.avatarSource || options.avatarPath;
|
|
39
|
+
if (options.avatarSource)
|
|
40
|
+
await api.changeGroupAvatar(options.avatarSource, data.groupId).catch(utils.logger.error);
|
|
41
|
+
return data;
|
|
42
|
+
};
|
|
43
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { NoteDetail } from "../models/index.js";
|
|
2
|
+
export type CreateNoteGroupOptions = {
|
|
3
|
+
title: string;
|
|
4
|
+
pinAct?: boolean;
|
|
5
|
+
};
|
|
6
|
+
export type CreateNoteGroupResponse = NoteDetail;
|
|
7
|
+
export declare const createNoteGroupFactory: (ctx: import("../context.js").ContextBase, api: import("../zalo.js").API) => (options: CreateNoteGroupOptions, groupId: string) => Promise<NoteDetail>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export const createNoteGroupFactory = apiFactory()((api, ctx, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.group_board[0]}/api/board/topic/createv2`);
|
|
5
|
+
/**
|
|
6
|
+
* Create a note in a group
|
|
7
|
+
*
|
|
8
|
+
* @param options note options
|
|
9
|
+
* @param options.title note title
|
|
10
|
+
* @param options.pinAct pin action (pin note)
|
|
11
|
+
* @param groupId group id
|
|
12
|
+
*
|
|
13
|
+
* @throws ZaloApiError
|
|
14
|
+
*/
|
|
15
|
+
return async function createNoteGroup(options, groupId) {
|
|
16
|
+
const params = {
|
|
17
|
+
grid: groupId,
|
|
18
|
+
type: 0,
|
|
19
|
+
color: -16777216,
|
|
20
|
+
emoji: "",
|
|
21
|
+
startTime: -1,
|
|
22
|
+
duration: -1,
|
|
23
|
+
params: JSON.stringify({
|
|
24
|
+
title: options.title,
|
|
25
|
+
}),
|
|
26
|
+
repeat: 0,
|
|
27
|
+
src: 1,
|
|
28
|
+
imei: ctx.imei,
|
|
29
|
+
pinAct: options.pinAct ? 1 : 0,
|
|
30
|
+
};
|
|
31
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
32
|
+
if (!encryptedParams)
|
|
33
|
+
throw new ZaloApiError("Failed to encrypt params");
|
|
34
|
+
const response = await utils.request(serviceURL, {
|
|
35
|
+
method: "POST",
|
|
36
|
+
body: new URLSearchParams({
|
|
37
|
+
params: encryptedParams,
|
|
38
|
+
}),
|
|
39
|
+
});
|
|
40
|
+
return utils.resolve(response, (result) => {
|
|
41
|
+
if (typeof result.data.params === "string") {
|
|
42
|
+
result.data.params = JSON.parse(result.data.params);
|
|
43
|
+
}
|
|
44
|
+
return result.data;
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for creating a poll.
|
|
3
|
+
*/
|
|
4
|
+
export type CreatePollOptions = {
|
|
5
|
+
/**
|
|
6
|
+
* Question for the poll.
|
|
7
|
+
*/
|
|
8
|
+
question: string;
|
|
9
|
+
/**
|
|
10
|
+
* List of options for the poll.
|
|
11
|
+
*/
|
|
12
|
+
options: string[];
|
|
13
|
+
/**
|
|
14
|
+
* Poll expiration time in milliseconds (0 = no expiration).
|
|
15
|
+
*/
|
|
16
|
+
expiredTime?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Allows multiple choices in the poll.
|
|
19
|
+
*/
|
|
20
|
+
allowMultiChoices?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Allows members to add new options to the poll.
|
|
23
|
+
*/
|
|
24
|
+
allowAddNewOption?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Hides voting results until the user has voted.
|
|
27
|
+
*/
|
|
28
|
+
hideVotePreview?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Hides poll voters (anonymous poll).
|
|
31
|
+
*/
|
|
32
|
+
isAnonymous?: boolean;
|
|
33
|
+
};
|
|
34
|
+
export type CreatePollResponse = {
|
|
35
|
+
creator: string;
|
|
36
|
+
question: string;
|
|
37
|
+
options: {
|
|
38
|
+
content: string;
|
|
39
|
+
votes: number;
|
|
40
|
+
voted: boolean;
|
|
41
|
+
voters: string[];
|
|
42
|
+
option_id: number;
|
|
43
|
+
}[];
|
|
44
|
+
joined: boolean;
|
|
45
|
+
closed: boolean;
|
|
46
|
+
poll_id: string;
|
|
47
|
+
allow_multi_choices: boolean;
|
|
48
|
+
allow_add_new_option: boolean;
|
|
49
|
+
is_anonymous: boolean;
|
|
50
|
+
poll_type: number;
|
|
51
|
+
created_time: number;
|
|
52
|
+
updated_time: number;
|
|
53
|
+
expired_time: number;
|
|
54
|
+
is_hide_vote_preview: boolean;
|
|
55
|
+
num_vote: number;
|
|
56
|
+
};
|
|
57
|
+
export declare const createPollFactory: (ctx: import("../context.js").ContextBase, api: import("../zalo.js").API) => (options: CreatePollOptions, groupId: string) => Promise<CreatePollResponse>;
|