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,37 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export const updateAutoReplyFactory = apiFactory()((api, ctx, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.auto_reply[0]}/api/autoreply/update`);
|
|
5
|
+
/**
|
|
6
|
+
* Update auto reply
|
|
7
|
+
*
|
|
8
|
+
* @param payload payload
|
|
9
|
+
*
|
|
10
|
+
* @note this API used for zBusiness
|
|
11
|
+
* @throws ZaloApiError
|
|
12
|
+
*/
|
|
13
|
+
return async function updateAutoReply(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,11 @@
|
|
|
1
|
+
import type { CatalogItem } from "../models/index.js";
|
|
2
|
+
export type UpdateCatalogPayload = {
|
|
3
|
+
catalogId: string;
|
|
4
|
+
catalogName: string;
|
|
5
|
+
};
|
|
6
|
+
export type UpdateCatalogResponse = {
|
|
7
|
+
item: CatalogItem;
|
|
8
|
+
version_ls_catalog: number;
|
|
9
|
+
version_catalog: number;
|
|
10
|
+
};
|
|
11
|
+
export declare const updateCatalogFactory: (ctx: import("../context.js").ContextBase, api: import("../zalo.js").API) => (payload: UpdateCatalogPayload) => Promise<UpdateCatalogResponse>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export const updateCatalogFactory = apiFactory()((api, _, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.catalog[0]}/api/prodcatalog/catalog/update`);
|
|
5
|
+
/**
|
|
6
|
+
* Update catalog?
|
|
7
|
+
*
|
|
8
|
+
* @param payload payload
|
|
9
|
+
*
|
|
10
|
+
* @note this API is used for zBusiness
|
|
11
|
+
* @throws ZaloApiError
|
|
12
|
+
*/
|
|
13
|
+
return async function updateCatalog(payload) {
|
|
14
|
+
const params = {
|
|
15
|
+
catalog_id: payload.catalogId,
|
|
16
|
+
catalog_name: payload.catalogName,
|
|
17
|
+
catalog_photo: "", // "" is defaut don't upload photo
|
|
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,40 @@
|
|
|
1
|
+
export type UpdateGroupSettingsOptions = {
|
|
2
|
+
/**
|
|
3
|
+
* Disallow group members to change the group name and avatar
|
|
4
|
+
*/
|
|
5
|
+
blockName?: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Highlight messages from owner/admins
|
|
8
|
+
*/
|
|
9
|
+
signAdminMsg?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Don't pin messages, notes, and polls to the top of a conversation
|
|
12
|
+
*/
|
|
13
|
+
setTopicOnly?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Allow new members to read most recent messages
|
|
16
|
+
*/
|
|
17
|
+
enableMsgHistory?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Membership approval
|
|
20
|
+
*/
|
|
21
|
+
joinAppr?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Disallow group members to create notes & reminders
|
|
24
|
+
*/
|
|
25
|
+
lockCreatePost?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Disallow group members to create polls
|
|
28
|
+
*/
|
|
29
|
+
lockCreatePoll?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Disallow group members to send messages
|
|
32
|
+
*/
|
|
33
|
+
lockSendMsg?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Disallow group members to view full member list (community only)
|
|
36
|
+
*/
|
|
37
|
+
lockViewMember?: boolean;
|
|
38
|
+
};
|
|
39
|
+
export type UpdateGroupSettingsResponse = "";
|
|
40
|
+
export declare const updateGroupSettingsFactory: (ctx: import("../context.js").ContextBase, api: import("../zalo.js").API) => (options: UpdateGroupSettingsOptions, groupId: string) => Promise<"">;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export const updateGroupSettingsFactory = apiFactory()((api, ctx, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.group[0]}/api/group/setting/update`);
|
|
5
|
+
/**
|
|
6
|
+
* Update group settings
|
|
7
|
+
*
|
|
8
|
+
* @param options Options
|
|
9
|
+
* @param groupId Group ID
|
|
10
|
+
*
|
|
11
|
+
* @note Zalo might throw an error with code 166 if you don't have enough permissions to change the settings.
|
|
12
|
+
*
|
|
13
|
+
* @throws ZaloApiError
|
|
14
|
+
*/
|
|
15
|
+
return async function updateGroupSettings(options, groupId) {
|
|
16
|
+
const params = {
|
|
17
|
+
blockName: options.blockName ? 1 : 0,
|
|
18
|
+
signAdminMsg: options.signAdminMsg ? 1 : 0,
|
|
19
|
+
// addMemberOnly: 0, // very tricky, any idea?
|
|
20
|
+
setTopicOnly: options.setTopicOnly ? 1 : 0,
|
|
21
|
+
enableMsgHistory: options.enableMsgHistory ? 1 : 0,
|
|
22
|
+
joinAppr: options.joinAppr ? 1 : 0,
|
|
23
|
+
lockCreatePost: options.lockCreatePost ? 1 : 0,
|
|
24
|
+
lockCreatePoll: options.lockCreatePoll ? 1 : 0,
|
|
25
|
+
lockSendMsg: options.lockSendMsg ? 1 : 0,
|
|
26
|
+
lockViewMember: options.lockViewMember ? 1 : 0,
|
|
27
|
+
// default values for not implemented options
|
|
28
|
+
bannFeature: 0,
|
|
29
|
+
dirtyMedia: 0,
|
|
30
|
+
banDuration: 0,
|
|
31
|
+
blocked_members: [],
|
|
32
|
+
grid: groupId,
|
|
33
|
+
imei: ctx.imei,
|
|
34
|
+
};
|
|
35
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
36
|
+
if (!encryptedParams)
|
|
37
|
+
throw new ZaloApiError("Failed to encrypt params");
|
|
38
|
+
const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams }), {
|
|
39
|
+
method: "GET",
|
|
40
|
+
});
|
|
41
|
+
return utils.resolve(response);
|
|
42
|
+
};
|
|
43
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory, encryptPin } from "../utils.js";
|
|
3
|
+
export const updateHiddenConversPinFactory = apiFactory()((api, ctx, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.conversation[0]}/api/hiddenconvers/update-pin`);
|
|
5
|
+
const pinRegex = /^\d{4}$/;
|
|
6
|
+
/**
|
|
7
|
+
* Update hidden conversation pin
|
|
8
|
+
*
|
|
9
|
+
* @param pin The pin to update (must be a 4-digit number between 0000-9999)
|
|
10
|
+
*
|
|
11
|
+
* @throws ZaloApiError
|
|
12
|
+
*/
|
|
13
|
+
return async function updateHiddenConversPin(pin) {
|
|
14
|
+
if (!pinRegex.test(pin)) {
|
|
15
|
+
throw new ZaloApiError("Pin must be a 4-digit number between 0000-9999");
|
|
16
|
+
}
|
|
17
|
+
const encryptedPin = encryptPin(pin);
|
|
18
|
+
const params = {
|
|
19
|
+
new_pin: encryptedPin,
|
|
20
|
+
imei: ctx.imei,
|
|
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,24 @@
|
|
|
1
|
+
export type LabelData = {
|
|
2
|
+
id: number;
|
|
3
|
+
text: string;
|
|
4
|
+
textKey: string;
|
|
5
|
+
conversations: string[];
|
|
6
|
+
color: string;
|
|
7
|
+
offset: number;
|
|
8
|
+
emoji: string;
|
|
9
|
+
createTime: number;
|
|
10
|
+
};
|
|
11
|
+
export type UpdateLabelsPayload = {
|
|
12
|
+
labelData: LabelData[];
|
|
13
|
+
version: number;
|
|
14
|
+
};
|
|
15
|
+
export type UpdateLabelsResponse = {
|
|
16
|
+
labelData: LabelData[];
|
|
17
|
+
version: number;
|
|
18
|
+
lastUpdateTime: number;
|
|
19
|
+
};
|
|
20
|
+
export declare const updateLabelsFactory: (ctx: import("../context.js").ContextBase, api: import("../zalo.js").API) => (label: UpdateLabelsPayload) => Promise<{
|
|
21
|
+
labelData: any;
|
|
22
|
+
version: number;
|
|
23
|
+
lastUpdateTime: number;
|
|
24
|
+
}>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export const updateLabelsFactory = apiFactory()((api, ctx, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.label[0]}/api/convlabel/update`);
|
|
5
|
+
/**
|
|
6
|
+
* Update labels
|
|
7
|
+
*
|
|
8
|
+
* @param label label data
|
|
9
|
+
*
|
|
10
|
+
* @throws ZaloApiError
|
|
11
|
+
*/
|
|
12
|
+
return async function updateLabels(label) {
|
|
13
|
+
const params = {
|
|
14
|
+
labelData: JSON.stringify(label.labelData),
|
|
15
|
+
version: label.version,
|
|
16
|
+
imei: ctx.imei,
|
|
17
|
+
};
|
|
18
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
19
|
+
if (!encryptedParams)
|
|
20
|
+
throw new ZaloApiError("Failed to encrypt message");
|
|
21
|
+
const response = await utils.request(serviceURL, {
|
|
22
|
+
method: "POST",
|
|
23
|
+
body: new URLSearchParams({
|
|
24
|
+
params: encryptedParams,
|
|
25
|
+
}),
|
|
26
|
+
});
|
|
27
|
+
const unFormatted = (await utils.resolve(response));
|
|
28
|
+
return {
|
|
29
|
+
labelData: JSON.parse(unFormatted.labelData),
|
|
30
|
+
version: unFormatted.version,
|
|
31
|
+
lastUpdateTime: unFormatted.lastUpdateTime,
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare enum UpdateLangAvailableLanguages {
|
|
2
|
+
VI = "VI",
|
|
3
|
+
EN = "EN",
|
|
4
|
+
MY = "MY"
|
|
5
|
+
}
|
|
6
|
+
export type UpdateLangResponse = "";
|
|
7
|
+
export declare const updateLangFactory: (ctx: import("../context.js").ContextBase, api: import("../zalo.js").API) => (language?: UpdateLangAvailableLanguages) => Promise<"">;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export var UpdateLangAvailableLanguages;
|
|
4
|
+
(function (UpdateLangAvailableLanguages) {
|
|
5
|
+
UpdateLangAvailableLanguages["VI"] = "VI";
|
|
6
|
+
UpdateLangAvailableLanguages["EN"] = "EN";
|
|
7
|
+
UpdateLangAvailableLanguages["MY"] = "MY";
|
|
8
|
+
})(UpdateLangAvailableLanguages || (UpdateLangAvailableLanguages = {}));
|
|
9
|
+
export const updateLangFactory = apiFactory()((api, _, utils) => {
|
|
10
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.profile[0]}/api/social/profile/updatelang`);
|
|
11
|
+
/**
|
|
12
|
+
* Update language?
|
|
13
|
+
*
|
|
14
|
+
* @param language language to update (VI, EN, MY)
|
|
15
|
+
*
|
|
16
|
+
* @note Calling this API alone will not update the user's language.
|
|
17
|
+
*
|
|
18
|
+
* @throws ZaloApiError
|
|
19
|
+
*/
|
|
20
|
+
return async function updateLang(language = UpdateLangAvailableLanguages.VI) {
|
|
21
|
+
const params = {
|
|
22
|
+
language: language,
|
|
23
|
+
};
|
|
24
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
25
|
+
if (!encryptedParams)
|
|
26
|
+
throw new ZaloApiError("Failed to encrypt params");
|
|
27
|
+
const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams }), {
|
|
28
|
+
method: "GET",
|
|
29
|
+
});
|
|
30
|
+
return utils.resolve(response);
|
|
31
|
+
};
|
|
32
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { AttachmentSource, ProductCatalogItem } from "../models/index.js";
|
|
2
|
+
export type UpdateProductCatalogPayload = {
|
|
3
|
+
catalogId: string;
|
|
4
|
+
productId: string;
|
|
5
|
+
productName: string;
|
|
6
|
+
price: string;
|
|
7
|
+
description: string;
|
|
8
|
+
createTime: number;
|
|
9
|
+
/**
|
|
10
|
+
* Upto 5 media files are allowed, will be ignored if product_photos is provided
|
|
11
|
+
*/
|
|
12
|
+
files?: AttachmentSource[];
|
|
13
|
+
/**
|
|
14
|
+
* List of product photo URLs, upto 5
|
|
15
|
+
*
|
|
16
|
+
* You can manually get the URL using `uploadProductPhoto` api
|
|
17
|
+
*/
|
|
18
|
+
product_photos?: string[];
|
|
19
|
+
};
|
|
20
|
+
export type UpdateProductCatalogResponse = {
|
|
21
|
+
item: ProductCatalogItem;
|
|
22
|
+
version_ls_catalog: number;
|
|
23
|
+
version_catalog: number;
|
|
24
|
+
};
|
|
25
|
+
export declare const updateProductCatalogFactory: (ctx: import("../context.js").ContextBase, api: import("../zalo.js").API) => (payload: UpdateProductCatalogPayload) => Promise<UpdateProductCatalogResponse>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export const updateProductCatalogFactory = apiFactory()((api, _, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.catalog[0]}/api/prodcatalog/product/update`);
|
|
5
|
+
/**
|
|
6
|
+
* Update product catalog?
|
|
7
|
+
*
|
|
8
|
+
* @param payload payload
|
|
9
|
+
*
|
|
10
|
+
* @note this API is used for zBusiness - Maximum 5 media files are supported
|
|
11
|
+
* @throws ZaloApiError
|
|
12
|
+
*/
|
|
13
|
+
return async function updateProductCatalog(payload) {
|
|
14
|
+
const productPhoto = payload.product_photos || [];
|
|
15
|
+
if (payload.files && payload.files.length == 0) {
|
|
16
|
+
if (payload.files.length > 5) {
|
|
17
|
+
throw new ZaloApiError("Maximum 5 media files are allowed");
|
|
18
|
+
}
|
|
19
|
+
for (const mediaFile of payload.files) {
|
|
20
|
+
const uploadMedia = await api.uploadProductPhoto({
|
|
21
|
+
file: mediaFile,
|
|
22
|
+
});
|
|
23
|
+
const url = uploadMedia.normalUrl || uploadMedia.hdUrl;
|
|
24
|
+
productPhoto.push(url);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (productPhoto.length > 5) {
|
|
28
|
+
throw new ZaloApiError("Maximum 5 media files are allowed");
|
|
29
|
+
}
|
|
30
|
+
const params = {
|
|
31
|
+
product_id: payload.productId,
|
|
32
|
+
product_name: payload.productName,
|
|
33
|
+
price: payload.price,
|
|
34
|
+
description: payload.description,
|
|
35
|
+
product_photos: productPhoto,
|
|
36
|
+
catalog_id: payload.catalogId,
|
|
37
|
+
currency_unit: "₫",
|
|
38
|
+
create_time: payload.createTime,
|
|
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(serviceURL, {
|
|
44
|
+
method: "POST",
|
|
45
|
+
body: new URLSearchParams({
|
|
46
|
+
params: encryptedParams,
|
|
47
|
+
}),
|
|
48
|
+
});
|
|
49
|
+
return utils.resolve(response);
|
|
50
|
+
};
|
|
51
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { BusinessCategory, Gender } from "../models/index.js";
|
|
2
|
+
export type UpdateProfilePayload = {
|
|
3
|
+
name: string;
|
|
4
|
+
dob: `${string}-${string}-${string}`;
|
|
5
|
+
gender: Gender;
|
|
6
|
+
description?: string;
|
|
7
|
+
cate?: BusinessCategory;
|
|
8
|
+
address?: string;
|
|
9
|
+
website?: string;
|
|
10
|
+
email?: string;
|
|
11
|
+
};
|
|
12
|
+
export type ChangeAccountSettingResponse = "";
|
|
13
|
+
export declare const updateProfileFactory: (ctx: import("../context.js").ContextBase, api: import("../zalo.js").API) => (payload: UpdateProfilePayload, isBusiness?: boolean) => Promise<"">;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export const updateProfileFactory = apiFactory()((api, ctx, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.profile[0]}/api/social/profile/update`);
|
|
5
|
+
/**
|
|
6
|
+
* Change account setting information
|
|
7
|
+
*
|
|
8
|
+
* @param payload payload
|
|
9
|
+
* @param isBusiness add info for business
|
|
10
|
+
*
|
|
11
|
+
* @throws ZaloApiError
|
|
12
|
+
*/
|
|
13
|
+
return async function updateProfile(payload, isBusiness = false) {
|
|
14
|
+
const zBusiness = {
|
|
15
|
+
desc: payload.description,
|
|
16
|
+
cate: payload.cate,
|
|
17
|
+
addr: payload.address,
|
|
18
|
+
website: payload.website,
|
|
19
|
+
email: payload.email,
|
|
20
|
+
};
|
|
21
|
+
const infoBusiness = isBusiness ? JSON.stringify(zBusiness) : JSON.stringify({});
|
|
22
|
+
const params = {
|
|
23
|
+
profile: JSON.stringify({
|
|
24
|
+
name: payload.name,
|
|
25
|
+
dob: payload.dob,
|
|
26
|
+
gender: payload.gender,
|
|
27
|
+
}),
|
|
28
|
+
biz: infoBusiness,
|
|
29
|
+
language: ctx.language,
|
|
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);
|
|
41
|
+
};
|
|
42
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { QuickMessage, AttachmentSource } from "../models/index.js";
|
|
2
|
+
export type UpdateQuickMessagePayload = {
|
|
3
|
+
keyword: string;
|
|
4
|
+
title: string;
|
|
5
|
+
media?: AttachmentSource;
|
|
6
|
+
};
|
|
7
|
+
export type UpdateQuickMessageResponse = {
|
|
8
|
+
item: QuickMessage;
|
|
9
|
+
version: number;
|
|
10
|
+
};
|
|
11
|
+
export declare const updateQuickMessageFactory: (ctx: import("../context.js").ContextBase, api: import("../zalo.js").API) => (updatePayload: UpdateQuickMessagePayload, itemId: number) => Promise<UpdateQuickMessageResponse>;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export const updateQuickMessageFactory = apiFactory()((api, _ctx, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.quick_message[0]}/api/quickmessage/update`);
|
|
5
|
+
/**
|
|
6
|
+
* Update quick message
|
|
7
|
+
*
|
|
8
|
+
* @param updatePayload - The payload containing data to update the quick message
|
|
9
|
+
* @param itemId - The id of the quick message to update
|
|
10
|
+
*
|
|
11
|
+
* @note Zalo might throw an error with code 212 if the itemId does not exist.
|
|
12
|
+
*
|
|
13
|
+
* @throws ZaloApiError
|
|
14
|
+
*/
|
|
15
|
+
return async function updateQuickMessage(updatePayload, itemId) {
|
|
16
|
+
const isType = !updatePayload.media ? 0 : 1;
|
|
17
|
+
const params = {
|
|
18
|
+
itemId: itemId,
|
|
19
|
+
keyword: updatePayload.keyword,
|
|
20
|
+
message: {
|
|
21
|
+
title: updatePayload.title,
|
|
22
|
+
params: "",
|
|
23
|
+
},
|
|
24
|
+
type: isType,
|
|
25
|
+
};
|
|
26
|
+
if (isType === 1) {
|
|
27
|
+
if (!updatePayload.media)
|
|
28
|
+
throw new ZaloApiError("Media is required");
|
|
29
|
+
const uploadMedia = await api.uploadProductPhoto({
|
|
30
|
+
file: updatePayload.media,
|
|
31
|
+
});
|
|
32
|
+
const photoId = uploadMedia.photoId;
|
|
33
|
+
const thumbUrl = uploadMedia.thumbUrl;
|
|
34
|
+
const normalUrl = uploadMedia.normalUrl;
|
|
35
|
+
const hdUrl = uploadMedia.hdUrl;
|
|
36
|
+
params.media = {
|
|
37
|
+
items: [
|
|
38
|
+
{
|
|
39
|
+
type: 0,
|
|
40
|
+
photoId: photoId,
|
|
41
|
+
title: "",
|
|
42
|
+
width: "",
|
|
43
|
+
height: "",
|
|
44
|
+
previewThumb: thumbUrl,
|
|
45
|
+
rawUrl: normalUrl || hdUrl,
|
|
46
|
+
thumbUrl: thumbUrl,
|
|
47
|
+
normalUrl: normalUrl || hdUrl,
|
|
48
|
+
hdUrl: hdUrl || normalUrl,
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
54
|
+
if (!encryptedParams)
|
|
55
|
+
throw new ZaloApiError("Failed to encrypt params");
|
|
56
|
+
const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams }), {
|
|
57
|
+
method: "GET",
|
|
58
|
+
});
|
|
59
|
+
return utils.resolve(response);
|
|
60
|
+
};
|
|
61
|
+
});
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export type UpdateSettingsResponse = {};
|
|
2
|
+
export type UpdateSettingsType = "view_birthday" | "online_status" | "seen_status" | "receive_message" | "accept_call" | "phone_search" | "find_me_via_qr" | "common_group" | "find_me_via_contact" | "recommend_friend" | "archive_chat" | "quick_msg";
|
|
3
|
+
export declare const updateSettingsFactory: (ctx: import("../context.js").ContextBase, api: import("../zalo.js").API) => (type: UpdateSettingsType, status: number) => Promise<UpdateSettingsResponse>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export const updateSettingsFactory = apiFactory()((_api, _ctx, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`https://wpa.chat.zalo.me/api/setting/update`);
|
|
5
|
+
/**
|
|
6
|
+
* Set account settings - implement managing various account settings
|
|
7
|
+
*
|
|
8
|
+
* @param type The type of setting to update
|
|
9
|
+
* @param status
|
|
10
|
+
*
|
|
11
|
+
* @throws ZaloApiError
|
|
12
|
+
*/
|
|
13
|
+
return async function updateSettings(type, status) {
|
|
14
|
+
const params = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (type === "view_birthday" && { view_birthday: status })), (type === "online_status" && { show_online_status: status })), (type === "seen_status" && { display_seen_status: status })), (type === "receive_message" && { receive_message: status })), (type === "accept_call" && { accept_stranger_call: status })), (type === "phone_search" && { add_friend_via_phone: status })), (type === "find_me_via_qr" && { add_friend_via_qr: status })), (type === "common_group" && { add_friend_via_group: status })), (type === "find_me_via_contact" && { add_friend_via_contact: status })), (type === "recommend_friend" && { display_on_recommend_friend: status })), (type === "archive_chat" && { archivedChatStatus: status })), (type === "quick_msg" && { quickMessageStatus: status }));
|
|
15
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
16
|
+
if (!encryptedParams)
|
|
17
|
+
throw new ZaloApiError("Failed to encrypt params");
|
|
18
|
+
const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams }), {
|
|
19
|
+
method: "GET",
|
|
20
|
+
});
|
|
21
|
+
return utils.resolve(response);
|
|
22
|
+
};
|
|
23
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ThreadType, type AttachmentSource } from "../models/index.js";
|
|
2
|
+
export type UploadAttachmentImageResponse = {
|
|
3
|
+
normalUrl: string;
|
|
4
|
+
photoId: string;
|
|
5
|
+
finished: number | boolean;
|
|
6
|
+
hdUrl: string;
|
|
7
|
+
thumbUrl: string;
|
|
8
|
+
clientFileId: number;
|
|
9
|
+
chunkId: number;
|
|
10
|
+
fileType: "image";
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
totalSize: number;
|
|
14
|
+
hdSize: number;
|
|
15
|
+
};
|
|
16
|
+
export type UploadAttachmentVideoResponse = {
|
|
17
|
+
finished: number | boolean;
|
|
18
|
+
clientFileId: number;
|
|
19
|
+
chunkId: number;
|
|
20
|
+
fileType: "video";
|
|
21
|
+
fileUrl: string;
|
|
22
|
+
fileId: string;
|
|
23
|
+
checksum: string;
|
|
24
|
+
totalSize: number;
|
|
25
|
+
fileName: string;
|
|
26
|
+
};
|
|
27
|
+
export type UploadAttachmentFileResponse = {
|
|
28
|
+
finished: number | boolean;
|
|
29
|
+
clientFileId: number;
|
|
30
|
+
chunkId: number;
|
|
31
|
+
fileType: "others";
|
|
32
|
+
fileUrl: string;
|
|
33
|
+
fileId: string;
|
|
34
|
+
checksum: string;
|
|
35
|
+
totalSize: number;
|
|
36
|
+
fileName: string;
|
|
37
|
+
};
|
|
38
|
+
export type ImageData = {
|
|
39
|
+
fileName: string;
|
|
40
|
+
totalSize: number | undefined;
|
|
41
|
+
width: number | undefined;
|
|
42
|
+
height: number | undefined;
|
|
43
|
+
};
|
|
44
|
+
export type FileData = {
|
|
45
|
+
fileName: string;
|
|
46
|
+
totalSize: number;
|
|
47
|
+
};
|
|
48
|
+
export type UploadAttachmentType = UploadAttachmentImageResponse | UploadAttachmentVideoResponse | UploadAttachmentFileResponse;
|
|
49
|
+
export type UploadAttachmentResponse = UploadAttachmentType[];
|
|
50
|
+
export declare const uploadAttachmentFactory: (ctx: import("../context.js").ContextBase, api: import("../zalo.js").API) => (sources: AttachmentSource | AttachmentSource[], threadId: string, type?: ThreadType) => Promise<UploadAttachmentType[]>;
|