UNPKG

@warriorteam/zalo-personal

Version:

Unofficial Zalo Personal API for JavaScript - A powerful library for interacting with Zalo personal accounts with URL attachment support, auto-reply, product catalog, and business features

302 lines (301 loc) 19.8 kB
import { Listener } from "./apis/listen.js"; import { acceptFriendRequestFactory } from "./apis/acceptFriendRequest.js"; import { addGroupBlockedMemberFactory } from "./apis/addGroupBlockedMember.js"; import { addGroupDeputyFactory } from "./apis/addGroupDeputy.js"; import { addPollOptionsFactory } from "./apis/addPollOptions.js"; import { addQuickMessageFactory } from "./apis/addQuickMessage.js"; import { addReactionFactory } from "./apis/addReaction.js"; import { addUnreadMarkFactory } from "./apis/addUnreadMark.js"; import { addUserToGroupFactory } from "./apis/addUserToGroup.js"; import { blockUserFactory } from "./apis/blockUser.js"; import { blockViewFeedFactory } from "./apis/blockViewFeed.js"; import { changeAccountAvatarFactory } from "./apis/changeAccountAvatar.js"; import { changeFriendAliasFactory } from "./apis/changeFriendAlias.js"; import { changeGroupAvatarFactory } from "./apis/changeGroupAvatar.js"; import { changeGroupNameFactory } from "./apis/changeGroupName.js"; import { changeGroupOwnerFactory } from "./apis/changeGroupOwner.js"; import { createAutoReplyFactory } from "./apis/createAutoReply.js"; import { createCatalogFactory } from "./apis/createCatalog.js"; import { createGroupFactory } from "./apis/createGroup.js"; import { createNoteFactory } from "./apis/createNote.js"; import { createPollFactory } from "./apis/createPoll.js"; import { createProductCatalogFactory } from "./apis/createProductCatalog.js"; import { createReminderFactory } from "./apis/createReminder.js"; import { deleteAutoReplyFactory } from "./apis/deleteAutoReply.js"; import { deleteAvatarFactory } from "./apis/deleteAvatar.js"; import { deleteCatalogFactory } from "./apis/deleteCatalog.js"; import { deleteChatFactory } from "./apis/deleteChat.js"; import { deleteGroupInviteBoxFactory } from "./apis/deleteGroupInviteBox.js"; import { deleteMessageFactory } from "./apis/deleteMessage.js"; import { deleteProductCatalogFactory } from "./apis/deleteProductCatalog.js"; import { disableGroupLinkFactory } from "./apis/disableGroupLink.js"; import { disperseGroupFactory } from "./apis/disperseGroup.js"; import { editNoteFactory } from "./apis/editNote.js"; import { editReminderFactory } from "./apis/editReminder.js"; import { enableGroupLinkFactory } from "./apis/enableGroupLink.js"; import { fetchAccountInfoFactory } from "./apis/fetchAccountInfo.js"; import { findUserFactory } from "./apis/findUser.js"; import { findUserByUsernameFactory } from "./apis/findUserByUsername.js"; import { forwardMessageFactory } from "./apis/forwardMessage.js"; import { getAliasListFactory } from "./apis/getAliasList.js"; import { getAllFriendsFactory } from "./apis/getAllFriends.js"; import { getAllGroupsFactory } from "./apis/getAllGroups.js"; import { getArchivedChatListFactory } from "./apis/getArchivedChatList.js"; import { getAutoDeleteChatFactory } from "./apis/getAutoDeleteChat.js"; import { getAutoReplyListFactory } from "./apis/getAutoReplyList.js"; import { getAvatarListFactory } from "./apis/getAvatarList.js"; import { getAvatarUrlProfileFactory } from "./apis/getAvatarUrlProfile.js"; import { getBizAccountFactory } from "./apis/getBizAccount.js"; import { getCatalogListFactory } from "./apis/getCatalogList.js"; import { getCloseFriendsFactory } from "./apis/getCloseFriends.js"; import { getContextFactory } from "./apis/getContext.js"; import { getCookieFactory } from "./apis/getCookie.js"; import { getFriendBoardListFactory } from "./apis/getFriendBoardList.js"; import { getFriendOnlinesFactory } from "./apis/getFriendOnlines.js"; import { getFriendRecommendationsFactory } from "./apis/getFriendRecommendations.js"; import { getFriendRequestStatusFactory } from "./apis/getFriendRequestStatus.js"; import { getFullAvatarFactory } from "./apis/getFullAvatar.js"; import { getGroupBlockedMemberFactory } from "./apis/getGroupBlockedMember.js"; import { getGroupChatHistoryFactory } from "./apis/getGroupChatHistory.js"; import { getGroupInfoFactory } from "./apis/getGroupInfo.js"; import { getGroupInviteBoxInfoFactory } from "./apis/getGroupInviteBoxInfo.js"; import { getGroupInviteBoxListFactory } from "./apis/getGroupInviteBoxList.js"; import { getGroupLinkDetailFactory } from "./apis/getGroupLinkDetail.js"; import { getGroupLinkInfoFactory } from "./apis/getGroupLinkInfo.js"; import { getGroupMembersInfoFactory } from "./apis/getGroupMembersInfo.js"; import { getHiddenConversationsFactory } from "./apis/getHiddenConversations.js"; import { getLabelsFactory } from "./apis/getLabels.js"; import { getListBoardFactory } from "./apis/getListBoard.js"; import { getListReminderFactory } from "./apis/getListReminder.js"; import { getMultiUsersByPhonesFactory } from "./apis/getMultiUsersByPhones.js"; import { getMuteFactory } from "./apis/getMute.js"; import { getOwnIdFactory } from "./apis/getOwnId.js"; import { getPendingGroupMembersFactory } from "./apis/getPendingGroupMembers.js"; import { getPinConversationsFactory } from "./apis/getPinConversations.js"; import { getPollDetailFactory } from "./apis/getPollDetail.js"; import { getProductCatalogListFactory } from "./apis/getProductCatalogList.js"; import { getQRFactory } from "./apis/getQR.js"; import { getQuickMessageListFactory } from "./apis/getQuickMessageList.js"; import { getRelatedFriendGroupFactory } from "./apis/getRelatedFriendGroup.js"; import { getReminderFactory } from "./apis/getReminder.js"; import { getReminderResponsesFactory } from "./apis/getReminderResponses.js"; import { getSentFriendRequestFactory } from "./apis/getSentFriendRequest.js"; import { getSettingsFactory } from "./apis/getSettings.js"; import { getStickerCategoryDetailFactory } from "./apis/getStickerCategoryDetail.js"; import { getStickersFactory } from "./apis/getStickers.js"; import { getStickersDetailFactory } from "./apis/getStickersDetail.js"; import { getUnreadMarkFactory } from "./apis/getUnreadMark.js"; import { getUserInfoFactory } from "./apis/getUserInfo.js"; import { inviteUserToGroupsFactory } from "./apis/inviteUserToGroups.js"; import { joinGroupInviteBoxFactory } from "./apis/joinGroupInviteBox.js"; import { joinGroupLinkFactory } from "./apis/joinGroupLink.js"; import { keepAliveFactory } from "./apis/keepAlive.js"; import { lastOnlineFactory } from "./apis/lastOnline.js"; import { leaveGroupFactory } from "./apis/leaveGroup.js"; import { lockPollFactory } from "./apis/lockPoll.js"; import { parseLinkFactory } from "./apis/parseLink.js"; import { rejectFriendRequestFactory } from "./apis/rejectFriendRequest.js"; import { removeFriendFactory } from "./apis/removeFriend.js"; import { removeFriendAliasFactory } from "./apis/removeFriendAlias.js"; import { removeGroupBlockedMemberFactory } from "./apis/removeGroupBlockedMember.js"; import { removeGroupDeputyFactory } from "./apis/removeGroupDeputy.js"; import { removeQuickMessageFactory } from "./apis/removeQuickMessage.js"; import { removeReminderFactory } from "./apis/removeReminder.js"; import { removeUnreadMarkFactory } from "./apis/removeUnreadMark.js"; import { removeUserFromGroupFactory } from "./apis/removeUserFromGroup.js"; import { resetHiddenConversPinFactory } from "./apis/resetHiddenConversPin.js"; import { reuseAvatarFactory } from "./apis/reuseAvatar.js"; import { reviewPendingMemberRequestFactory } from "./apis/reviewPendingMemberRequest.js"; import { searchStickerFactory } from "./apis/searchSticker.js"; import { sendBankCardFactory } from "./apis/sendBankCard.js"; import { sendCardFactory } from "./apis/sendCard.js"; import { sendDeliveredEventFactory } from "./apis/sendDeliveredEvent.js"; import { sendFriendRequestFactory } from "./apis/sendFriendRequest.js"; import { sendImageByUrlFactory } from "./apis/sendImageByUrl.js"; import { sendLinkFactory } from "./apis/sendLink.js"; import { sendMessageFactory } from "./apis/sendMessage.js"; import { sendReportFactory } from "./apis/sendReport.js"; import { sendSeenEventFactory } from "./apis/sendSeenEvent.js"; import { sendStickerFactory } from "./apis/sendSticker.js"; import { sendTypingEventFactory } from "./apis/sendTypingEvent.js"; import { sendVideoFactory } from "./apis/sendVideo.js"; import { sendVoiceFactory } from "./apis/sendVoice.js"; import { setHiddenConversationsFactory } from "./apis/setHiddenConversations.js"; import { setMuteFactory } from "./apis/setMute.js"; import { setPinnedConversationsFactory } from "./apis/setPinnedConversations.js"; import { sharePollFactory } from "./apis/sharePoll.js"; import { unblockUserFactory } from "./apis/unblockUser.js"; import { undoFactory } from "./apis/undo.js"; import { undoFriendRequestFactory } from "./apis/undoFriendRequest.js"; import { updateActiveStatusFactory } from "./apis/updateActiveStatus.js"; import { updateArchivedChatListFactory } from "./apis/updateArchivedChatList.js"; import { updateAutoDeleteChatFactory } from "./apis/updateAutoDeleteChat.js"; import { updateAutoReplyFactory } from "./apis/updateAutoReply.js"; import { updateCatalogFactory } from "./apis/updateCatalog.js"; import { updateGroupSettingsFactory } from "./apis/updateGroupSettings.js"; import { updateHiddenConversPinFactory } from "./apis/updateHiddenConversPin.js"; import { updateLabelsFactory } from "./apis/updateLabels.js"; import { updateLangFactory } from "./apis/updateLang.js"; import { updateProductCatalogFactory } from "./apis/updateProductCatalog.js"; import { updateProfileFactory } from "./apis/updateProfile.js"; import { updateProfileBioFactory } from "./apis/updateProfileBio.js"; import { updateQuickMessageFactory } from "./apis/updateQuickMessage.js"; import { updateSettingsFactory } from "./apis/updateSettings.js"; import { upgradeGroupToCommunityFactory } from "./apis/upgradeGroupToCommunity.js"; import { uploadAttachmentFactory } from "./apis/uploadAttachment.js"; import { uploadProductPhotoFactory } from "./apis/uploadProductPhoto.js"; import { votePollFactory } from "./apis/votePoll.js"; import { customFactory } from "./apis/custom.js"; export class API { constructor(ctx, zpwServiceMap, wsUrls) { this.zpwServiceMap = zpwServiceMap; this.listener = new Listener(ctx, wsUrls); this.acceptFriendRequest = acceptFriendRequestFactory(ctx, this); this.addGroupBlockedMember = addGroupBlockedMemberFactory(ctx, this); this.addGroupDeputy = addGroupDeputyFactory(ctx, this); this.addPollOptions = addPollOptionsFactory(ctx, this); this.addQuickMessage = addQuickMessageFactory(ctx, this); this.addReaction = addReactionFactory(ctx, this); this.addUnreadMark = addUnreadMarkFactory(ctx, this); this.addUserToGroup = addUserToGroupFactory(ctx, this); this.blockUser = blockUserFactory(ctx, this); this.blockViewFeed = blockViewFeedFactory(ctx, this); this.changeAccountAvatar = changeAccountAvatarFactory(ctx, this); this.changeFriendAlias = changeFriendAliasFactory(ctx, this); this.changeGroupAvatar = changeGroupAvatarFactory(ctx, this); this.changeGroupName = changeGroupNameFactory(ctx, this); this.changeGroupOwner = changeGroupOwnerFactory(ctx, this); this.createAutoReply = createAutoReplyFactory(ctx, this); this.createCatalog = createCatalogFactory(ctx, this); this.createGroup = createGroupFactory(ctx, this); this.createNote = createNoteFactory(ctx, this); this.createPoll = createPollFactory(ctx, this); this.createProductCatalog = createProductCatalogFactory(ctx, this); this.createReminder = createReminderFactory(ctx, this); this.deleteAutoReply = deleteAutoReplyFactory(ctx, this); this.deleteAvatar = deleteAvatarFactory(ctx, this); this.deleteCatalog = deleteCatalogFactory(ctx, this); this.deleteChat = deleteChatFactory(ctx, this); this.deleteGroupInviteBox = deleteGroupInviteBoxFactory(ctx, this); this.deleteMessage = deleteMessageFactory(ctx, this); this.deleteProductCatalog = deleteProductCatalogFactory(ctx, this); this.disableGroupLink = disableGroupLinkFactory(ctx, this); this.disperseGroup = disperseGroupFactory(ctx, this); this.editNote = editNoteFactory(ctx, this); this.editReminder = editReminderFactory(ctx, this); this.enableGroupLink = enableGroupLinkFactory(ctx, this); this.fetchAccountInfo = fetchAccountInfoFactory(ctx, this); this.findUser = findUserFactory(ctx, this); this.findUserByUsername = findUserByUsernameFactory(ctx, this); this.forwardMessage = forwardMessageFactory(ctx, this); this.getAliasList = getAliasListFactory(ctx, this); this.getAllFriends = getAllFriendsFactory(ctx, this); this.getAllGroups = getAllGroupsFactory(ctx, this); this.getArchivedChatList = getArchivedChatListFactory(ctx, this); this.getAutoDeleteChat = getAutoDeleteChatFactory(ctx, this); this.getAutoReplyList = getAutoReplyListFactory(ctx, this); this.getAvatarList = getAvatarListFactory(ctx, this); this.getAvatarUrlProfile = getAvatarUrlProfileFactory(ctx, this); this.getBizAccount = getBizAccountFactory(ctx, this); this.getCatalogList = getCatalogListFactory(ctx, this); this.getCloseFriends = getCloseFriendsFactory(ctx, this); this.getContext = getContextFactory(ctx, this); this.getCookie = getCookieFactory(ctx, this); this.getFriendBoardList = getFriendBoardListFactory(ctx, this); this.getFriendOnlines = getFriendOnlinesFactory(ctx, this); this.getFriendRecommendations = getFriendRecommendationsFactory(ctx, this); this.getFriendRequestStatus = getFriendRequestStatusFactory(ctx, this); this.getFullAvatar = getFullAvatarFactory(ctx, this); this.getGroupBlockedMember = getGroupBlockedMemberFactory(ctx, this); this.getGroupChatHistory = getGroupChatHistoryFactory(ctx, this); this.getGroupInfo = getGroupInfoFactory(ctx, this); this.getGroupInviteBoxInfo = getGroupInviteBoxInfoFactory(ctx, this); this.getGroupInviteBoxList = getGroupInviteBoxListFactory(ctx, this); this.getGroupLinkDetail = getGroupLinkDetailFactory(ctx, this); this.getGroupLinkInfo = getGroupLinkInfoFactory(ctx, this); this.getGroupMembersInfo = getGroupMembersInfoFactory(ctx, this); this.getHiddenConversations = getHiddenConversationsFactory(ctx, this); this.getLabels = getLabelsFactory(ctx, this); this.getListBoard = getListBoardFactory(ctx, this); this.getListReminder = getListReminderFactory(ctx, this); this.getMultiUsersByPhones = getMultiUsersByPhonesFactory(ctx, this); this.getMute = getMuteFactory(ctx, this); this.getOwnId = getOwnIdFactory(ctx, this); this.getPendingGroupMembers = getPendingGroupMembersFactory(ctx, this); this.getPinConversations = getPinConversationsFactory(ctx, this); this.getPollDetail = getPollDetailFactory(ctx, this); this.getProductCatalogList = getProductCatalogListFactory(ctx, this); this.getQR = getQRFactory(ctx, this); this.getQuickMessageList = getQuickMessageListFactory(ctx, this); this.getRelatedFriendGroup = getRelatedFriendGroupFactory(ctx, this); this.getReminder = getReminderFactory(ctx, this); this.getReminderResponses = getReminderResponsesFactory(ctx, this); this.getSentFriendRequest = getSentFriendRequestFactory(ctx, this); this.getSettings = getSettingsFactory(ctx, this); this.getStickerCategoryDetail = getStickerCategoryDetailFactory(ctx, this); this.getStickers = getStickersFactory(ctx, this); this.getStickersDetail = getStickersDetailFactory(ctx, this); this.getUnreadMark = getUnreadMarkFactory(ctx, this); this.getUserInfo = getUserInfoFactory(ctx, this); this.inviteUserToGroups = inviteUserToGroupsFactory(ctx, this); this.joinGroupInviteBox = joinGroupInviteBoxFactory(ctx, this); this.joinGroupLink = joinGroupLinkFactory(ctx, this); this.keepAlive = keepAliveFactory(ctx, this); this.lastOnline = lastOnlineFactory(ctx, this); this.leaveGroup = leaveGroupFactory(ctx, this); this.lockPoll = lockPollFactory(ctx, this); this.parseLink = parseLinkFactory(ctx, this); this.rejectFriendRequest = rejectFriendRequestFactory(ctx, this); this.removeFriend = removeFriendFactory(ctx, this); this.removeFriendAlias = removeFriendAliasFactory(ctx, this); this.removeGroupBlockedMember = removeGroupBlockedMemberFactory(ctx, this); this.removeGroupDeputy = removeGroupDeputyFactory(ctx, this); this.removeQuickMessage = removeQuickMessageFactory(ctx, this); this.removeReminder = removeReminderFactory(ctx, this); this.removeUnreadMark = removeUnreadMarkFactory(ctx, this); this.removeUserFromGroup = removeUserFromGroupFactory(ctx, this); this.resetHiddenConversPin = resetHiddenConversPinFactory(ctx, this); this.reuseAvatar = reuseAvatarFactory(ctx, this); this.reviewPendingMemberRequest = reviewPendingMemberRequestFactory(ctx, this); this.searchSticker = searchStickerFactory(ctx, this); this.sendBankCard = sendBankCardFactory(ctx, this); this.sendCard = sendCardFactory(ctx, this); this.sendDeliveredEvent = sendDeliveredEventFactory(ctx, this); this.sendFriendRequest = sendFriendRequestFactory(ctx, this); this.sendImageByUrl = sendImageByUrlFactory(ctx, this); this.sendLink = sendLinkFactory(ctx, this); this.sendMessage = sendMessageFactory(ctx, this); this.sendReport = sendReportFactory(ctx, this); this.sendSeenEvent = sendSeenEventFactory(ctx, this); this.sendSticker = sendStickerFactory(ctx, this); this.sendTypingEvent = sendTypingEventFactory(ctx, this); this.sendVideo = sendVideoFactory(ctx, this); this.sendVoice = sendVoiceFactory(ctx, this); this.setHiddenConversations = setHiddenConversationsFactory(ctx, this); this.setMute = setMuteFactory(ctx, this); this.setPinnedConversations = setPinnedConversationsFactory(ctx, this); this.sharePoll = sharePollFactory(ctx, this); this.unblockUser = unblockUserFactory(ctx, this); this.undo = undoFactory(ctx, this); this.undoFriendRequest = undoFriendRequestFactory(ctx, this); this.updateActiveStatus = updateActiveStatusFactory(ctx, this); this.updateArchivedChatList = updateArchivedChatListFactory(ctx, this); this.updateAutoDeleteChat = updateAutoDeleteChatFactory(ctx, this); this.updateAutoReply = updateAutoReplyFactory(ctx, this); this.updateCatalog = updateCatalogFactory(ctx, this); this.updateGroupSettings = updateGroupSettingsFactory(ctx, this); this.updateHiddenConversPin = updateHiddenConversPinFactory(ctx, this); this.updateLabels = updateLabelsFactory(ctx, this); this.updateLang = updateLangFactory(ctx, this); this.updateProductCatalog = updateProductCatalogFactory(ctx, this); this.updateProfile = updateProfileFactory(ctx, this); this.updateProfileBio = updateProfileBioFactory(ctx, this); this.updateQuickMessage = updateQuickMessageFactory(ctx, this); this.updateSettings = updateSettingsFactory(ctx, this); this.upgradeGroupToCommunity = upgradeGroupToCommunityFactory(ctx, this); this.uploadAttachment = uploadAttachmentFactory(ctx, this); this.uploadProductPhoto = uploadProductPhotoFactory(ctx, this); this.votePoll = votePollFactory(ctx, this); this.custom = customFactory(ctx, this); } }