@softtynet/zca-js 2.3.2 → 2.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +63 -21
- package/dist/apis/auth/exportSession.d.ts +7 -0
- package/dist/apis/auth/exportSession.js +17 -0
- package/dist/apis/chat/getDirectMessageStatus.d.ts +14 -0
- package/dist/apis/chat/getDirectMessageStatus.js +52 -0
- package/dist/apis/chat/getSuggestedConversations.d.ts +5 -0
- package/dist/apis/chat/getSuggestedConversations.js +24 -0
- package/dist/apis/chat/updatePinConversations.d.ts +24 -0
- package/dist/apis/chat/updatePinConversations.js +40 -0
- package/dist/apis/friend/getFriendProfilesV2.d.ts +26 -0
- package/dist/apis/friend/getFriendProfilesV2.js +38 -0
- package/dist/apis/friend/getFriendsActivePCWeb.d.ts +6 -0
- package/dist/apis/friend/getFriendsActivePCWeb.js +15 -0
- package/dist/apis/friend/verifyFriend.d.ts +11 -0
- package/dist/apis/friend/verifyFriend.js +37 -0
- package/dist/apis/group/analyseGroup.d.ts +4 -0
- package/dist/apis/group/analyseGroup.js +28 -0
- package/dist/apis/group/checkQuotaCommunityMember.d.ts +6 -0
- package/dist/apis/group/checkQuotaCommunityMember.js +34 -0
- package/dist/apis/group/getE2eeGroupList.d.ts +7 -0
- package/dist/apis/group/getE2eeGroupList.js +15 -0
- package/dist/apis/group/getGroupChatHistory.d.ts +37 -6
- package/dist/apis/group/getGroupChatHistory.js +41 -19
- package/dist/apis/group/getGroupCloudMessagePath.d.ts +19 -0
- package/dist/apis/group/getGroupCloudMessagePath.js +51 -0
- package/dist/apis/group/getGroupHistoryLegacy.d.ts +7 -0
- package/dist/apis/group/getGroupHistoryLegacy.js +62 -0
- package/dist/apis/group/getGroupInfoV2.d.ts +30 -0
- package/dist/apis/group/getGroupInfoV2.js +48 -0
- package/dist/apis/group/getGroupListV3.d.ts +19 -0
- package/dist/apis/group/getGroupListV3.js +29 -0
- package/dist/apis/group/getGroupMessageStatus.d.ts +26 -0
- package/dist/apis/group/getGroupMessageStatus.js +77 -0
- package/dist/apis/group/getMultiGroupCloudMessages.d.ts +5 -0
- package/dist/apis/group/getMultiGroupCloudMessages.js +29 -0
- package/dist/apis/media/getConversationMedia.d.ts +10 -0
- package/dist/apis/media/getPersonalMedia.d.ts +8 -0
- package/dist/apis/media/getPersonalMedia.js +31 -0
- package/dist/apis/media/getPersonalMediaPreview.d.ts +3 -0
- package/dist/apis/media/getPersonalMediaPreview.js +24 -0
- package/dist/apis/media/removePersonalMedia.d.ts +9 -0
- package/dist/apis/media/removePersonalMedia.js +28 -0
- package/dist/apis.d.ts +57 -0
- package/dist/apis.js +95 -0
- package/dist/cjs/apis/auth/exportSession.cjs +22 -0
- package/dist/cjs/apis/chat/getDirectMessageStatus.cjs +58 -0
- package/dist/cjs/apis/chat/getSuggestedConversations.cjs +29 -0
- package/dist/cjs/apis/chat/updatePinConversations.cjs +45 -0
- package/dist/cjs/apis/friend/getFriendProfilesV2.cjs +43 -0
- package/dist/cjs/apis/friend/getFriendsActivePCWeb.cjs +20 -0
- package/dist/cjs/apis/friend/verifyFriend.cjs +42 -0
- package/dist/cjs/apis/group/analyseGroup.cjs +33 -0
- package/dist/cjs/apis/group/checkQuotaCommunityMember.cjs +39 -0
- package/dist/cjs/apis/group/getE2eeGroupList.cjs +20 -0
- package/dist/cjs/apis/group/getGroupChatHistory.cjs +41 -18
- package/dist/cjs/apis/group/getGroupCloudMessagePath.cjs +69 -0
- package/dist/cjs/apis/group/getGroupHistoryLegacy.cjs +80 -0
- package/dist/cjs/apis/group/getGroupInfoV2.cjs +53 -0
- package/dist/cjs/apis/group/getGroupListV3.cjs +34 -0
- package/dist/cjs/apis/group/getGroupMessageStatus.cjs +83 -0
- package/dist/cjs/apis/group/getMultiGroupCloudMessages.cjs +34 -0
- package/dist/cjs/apis/media/getPersonalMedia.cjs +36 -0
- package/dist/cjs/apis/media/getPersonalMediaPreview.cjs +29 -0
- package/dist/cjs/apis/media/removePersonalMedia.cjs +33 -0
- package/dist/cjs/apis.cjs +95 -0
- package/dist/cjs/constants/endpoints.cjs +13 -0
- package/dist/cjs/constants/protocol.cjs +1 -1
- package/dist/cjs/context.cjs +20 -2
- package/dist/cjs/core/zcloud-client.cjs +1 -2
- package/dist/cjs/crypto/ws-cipher.cjs +66 -2
- package/dist/cjs/index.cjs +2 -0
- package/dist/cjs/realtime/listener.cjs +18 -6
- package/dist/cjs/update.cjs +10 -1
- package/dist/cjs/utils.cjs +22 -5
- package/dist/constants/endpoints.d.ts +13 -0
- package/dist/constants/endpoints.js +13 -0
- package/dist/constants/protocol.d.ts +1 -1
- package/dist/constants/protocol.js +1 -1
- package/dist/context.d.ts +10 -0
- package/dist/context.js +20 -2
- package/dist/crypto/ws-cipher.d.ts +7 -0
- package/dist/crypto/ws-cipher.js +64 -2
- package/dist/index.d.ts +22 -3
- package/dist/index.js +1 -1
- package/dist/realtime/listener.d.ts +1 -0
- package/dist/realtime/listener.js +18 -6
- package/dist/update.js +10 -1
- package/dist/utils.js +17 -4
- package/index.d.ts +1 -1
- package/package.json +15 -5
package/dist/apis.js
CHANGED
|
@@ -7,6 +7,7 @@ import { addQuickMessageFactory } from "./apis/business/addQuickMessage.js";
|
|
|
7
7
|
import { addReactionFactory } from "./apis/chat/addReaction.js";
|
|
8
8
|
import { addUnreadMarkFactory } from "./apis/chat/addUnreadMark.js";
|
|
9
9
|
import { addUserToGroupFactory } from "./apis/group/addUserToGroup.js";
|
|
10
|
+
import { analyseGroupFactory } from "./apis/group/analyseGroup.js";
|
|
10
11
|
import { blockUserFactory } from "./apis/friend/blockUser.js";
|
|
11
12
|
import { blockViewFeedFactory } from "./apis/friend/blockViewFeed.js";
|
|
12
13
|
import { cancelPullMobileFactory } from "./apis/sync/cancelPullMobile.js";
|
|
@@ -16,6 +17,7 @@ import { changeFriendAliasFactory } from "./apis/friend/changeFriendAlias.js";
|
|
|
16
17
|
import { changeGroupAvatarFactory } from "./apis/group/changeGroupAvatar.js";
|
|
17
18
|
import { changeGroupNameFactory } from "./apis/group/changeGroupName.js";
|
|
18
19
|
import { changeGroupOwnerFactory } from "./apis/group/changeGroupOwner.js";
|
|
20
|
+
import { checkQuotaCommunityMemberFactory } from "./apis/group/checkQuotaCommunityMember.js";
|
|
19
21
|
import { clearUnreadFriendRequestsFactory } from "./apis/friend/clearUnreadFriendRequests.js";
|
|
20
22
|
import { createAutoReplyFactory } from "./apis/business/createAutoReply.js";
|
|
21
23
|
import { createBankAccountFactory } from "./apis/business/createBankAccount.js";
|
|
@@ -42,6 +44,7 @@ import { editReminderFactory } from "./apis/board/editReminder.js";
|
|
|
42
44
|
import { enableGroupLinkFactory } from "./apis/group/enableGroupLink.js";
|
|
43
45
|
import { encryptGidsFactory } from "./apis/auth/encryptGids.js";
|
|
44
46
|
import { endVoiceCallFactory } from "./apis/call/endVoiceCall.js";
|
|
47
|
+
import { exportSessionFactory } from "./apis/auth/exportSession.js";
|
|
45
48
|
import { fetchAccountInfoFactory } from "./apis/profile/fetchAccountInfo.js";
|
|
46
49
|
import { findUserFactory } from "./apis/friend/findUser.js";
|
|
47
50
|
import { findUserByUsernameFactory } from "./apis/friend/findUserByUsername.js";
|
|
@@ -65,6 +68,8 @@ import { getCloudViewerKeyFactory } from "./apis/zcloud/getCloudViewerKey.js";
|
|
|
65
68
|
import { getContextFactory } from "./apis/auth/getContext.js";
|
|
66
69
|
import { getConversationMediaFactory } from "./apis/media/getConversationMedia.js";
|
|
67
70
|
import { getCookieFactory } from "./apis/auth/getCookie.js";
|
|
71
|
+
import { getDirectMessageStatusFactory } from "./apis/chat/getDirectMessageStatus.js";
|
|
72
|
+
import { getE2eeGroupListFactory } from "./apis/group/getE2eeGroupList.js";
|
|
68
73
|
import { getEmojiStatusConfigFactory } from "./apis/profile/getEmojiStatusConfig.js";
|
|
69
74
|
import { getExtraFriendInfoFactory } from "./apis/friend/getExtraFriendInfo.js";
|
|
70
75
|
import { getExtraGroupInfoFactory } from "./apis/group/getExtraGroupInfo.js";
|
|
@@ -73,19 +78,26 @@ import { getFamilyUsageFactory } from "./apis/zcloud/getFamilyUsage.js";
|
|
|
73
78
|
import { getFamilyViewerKeyFactory } from "./apis/zcloud/getFamilyViewerKey.js";
|
|
74
79
|
import { getFriendBoardListFactory } from "./apis/friend/getFriendBoardList.js";
|
|
75
80
|
import { getFriendOnlinesFactory } from "./apis/friend/getFriendOnlines.js";
|
|
81
|
+
import { getFriendProfilesV2Factory } from "./apis/friend/getFriendProfilesV2.js";
|
|
76
82
|
import { getFriendRecommendationsFactory } from "./apis/friend/getFriendRecommendations.js";
|
|
77
83
|
import { getFriendRequestStatusFactory } from "./apis/friend/getFriendRequestStatus.js";
|
|
84
|
+
import { getFriendsActivePCWebFactory } from "./apis/friend/getFriendsActivePCWeb.js";
|
|
78
85
|
import { getFriendsEmojiStatusFactory } from "./apis/friend/getFriendsEmojiStatus.js";
|
|
79
86
|
import { getFullAvatarFactory } from "./apis/profile/getFullAvatar.js";
|
|
80
87
|
import { getGroupBlockedMemberFactory } from "./apis/group/getGroupBlockedMember.js";
|
|
81
88
|
import { getGroupChatHistoryFactory } from "./apis/group/getGroupChatHistory.js";
|
|
82
89
|
import { getGroupCloudMessageJumpFactory } from "./apis/group/getGroupCloudMessageJump.js";
|
|
90
|
+
import { getGroupCloudMessagePathFactory } from "./apis/group/getGroupCloudMessagePath.js";
|
|
91
|
+
import { getGroupHistoryLegacyFactory } from "./apis/group/getGroupHistoryLegacy.js";
|
|
83
92
|
import { getGroupInfoFactory } from "./apis/group/getGroupInfo.js";
|
|
93
|
+
import { getGroupInfoV2Factory } from "./apis/group/getGroupInfoV2.js";
|
|
84
94
|
import { getGroupInviteBoxInfoFactory } from "./apis/group/getGroupInviteBoxInfo.js";
|
|
85
95
|
import { getGroupInviteBoxListFactory } from "./apis/group/getGroupInviteBoxList.js";
|
|
86
96
|
import { getGroupLinkDetailFactory } from "./apis/group/getGroupLinkDetail.js";
|
|
87
97
|
import { getGroupLinkInfoFactory } from "./apis/group/getGroupLinkInfo.js";
|
|
98
|
+
import { getGroupListV3Factory } from "./apis/group/getGroupListV3.js";
|
|
88
99
|
import { getGroupMembersInfoFactory } from "./apis/group/getGroupMembersInfo.js";
|
|
100
|
+
import { getGroupMessageStatusFactory } from "./apis/group/getGroupMessageStatus.js";
|
|
89
101
|
import { getHiddenConversationsFactory } from "./apis/chat/getHiddenConversations.js";
|
|
90
102
|
import { getLabelsFactory } from "./apis/business/getLabels.js";
|
|
91
103
|
import { getLastReadContactTabFactory } from "./apis/friend/getLastReadContactTab.js";
|
|
@@ -99,12 +111,15 @@ import { getListPinTopicsFactory } from "./apis/board/getListPinTopics.js";
|
|
|
99
111
|
import { getListReminderFactory } from "./apis/board/getListReminder.js";
|
|
100
112
|
import { getMediaStorePreviewFactory } from "./apis/media/getMediaStorePreview.js";
|
|
101
113
|
import { getMiniProfileFactory } from "./apis/profile/getMiniProfile.js";
|
|
114
|
+
import { getMultiGroupCloudMessagesFactory } from "./apis/group/getMultiGroupCloudMessages.js";
|
|
102
115
|
import { getMultiUsersByPhonesFactory } from "./apis/friend/getMultiUsersByPhones.js";
|
|
103
116
|
import { getMuteFactory } from "./apis/chat/getMute.js";
|
|
104
117
|
import { getNoisedIdsFactory } from "./apis/auth/getNoisedIds.js";
|
|
105
118
|
import { getOwnIdFactory } from "./apis/auth/getOwnId.js";
|
|
106
119
|
import { getPendingGroupMembersFactory } from "./apis/group/getPendingGroupMembers.js";
|
|
107
120
|
import { getPersonalizedStickerListFactory } from "./apis/sticker/getPersonalizedStickerList.js";
|
|
121
|
+
import { getPersonalMediaFactory } from "./apis/media/getPersonalMedia.js";
|
|
122
|
+
import { getPersonalMediaPreviewFactory } from "./apis/media/getPersonalMediaPreview.js";
|
|
108
123
|
import { getPhonebookV2Factory } from "./apis/friend/getPhonebookV2.js";
|
|
109
124
|
import { getPinConversationsFactory } from "./apis/chat/getPinConversations.js";
|
|
110
125
|
import { getPollDetailFactory } from "./apis/board/getPollDetail.js";
|
|
@@ -128,6 +143,7 @@ import { getStickersFactory } from "./apis/sticker/getStickers.js";
|
|
|
128
143
|
import { getStickersDetailFactory } from "./apis/sticker/getStickersDetail.js";
|
|
129
144
|
import { getStickerSuggestionFactory } from "./apis/sticker/getStickerSuggestion.js";
|
|
130
145
|
import { getStickerSuggestKeywordsFactory } from "./apis/sticker/getStickerSuggestKeywords.js";
|
|
146
|
+
import { getSuggestedConversationsFactory } from "./apis/chat/getSuggestedConversations.js";
|
|
131
147
|
import { getSyncDataFactory } from "./apis/sync/getSyncData.js";
|
|
132
148
|
import { getUnreadMarkFactory } from "./apis/chat/getUnreadMark.js";
|
|
133
149
|
import { getUsageMyCloudFactory } from "./apis/zcloud/getUsageMyCloud.js";
|
|
@@ -152,6 +168,7 @@ import { removeFriendFactory } from "./apis/friend/removeFriend.js";
|
|
|
152
168
|
import { removeFriendAliasFactory } from "./apis/friend/removeFriendAlias.js";
|
|
153
169
|
import { removeGroupBlockedMemberFactory } from "./apis/group/removeGroupBlockedMember.js";
|
|
154
170
|
import { removeGroupDeputyFactory } from "./apis/group/removeGroupDeputy.js";
|
|
171
|
+
import { removePersonalMediaFactory } from "./apis/media/removePersonalMedia.js";
|
|
155
172
|
import { removeQuickMessageFactory } from "./apis/business/removeQuickMessage.js";
|
|
156
173
|
import { removeReminderFactory } from "./apis/board/removeReminder.js";
|
|
157
174
|
import { removeUnreadMarkFactory } from "./apis/chat/removeUnreadMark.js";
|
|
@@ -193,6 +210,7 @@ import { updateGroupSettingsFactory } from "./apis/group/updateGroupSettings.js"
|
|
|
193
210
|
import { updateHiddenConversPinFactory } from "./apis/chat/updateHiddenConversPin.js";
|
|
194
211
|
import { updateLabelsFactory } from "./apis/business/updateLabels.js";
|
|
195
212
|
import { updateLangFactory } from "./apis/auth/updateLang.js";
|
|
213
|
+
import { updatePinConversationsFactory } from "./apis/chat/updatePinConversations.js";
|
|
196
214
|
import { updateProductCatalogFactory } from "./apis/business/updateProductCatalog.js";
|
|
197
215
|
import { updateProfileFactory } from "./apis/profile/updateProfile.js";
|
|
198
216
|
import { updateProfileBioFactory } from "./apis/profile/updateProfileBio.js";
|
|
@@ -203,6 +221,7 @@ import { upgradeGroupToCommunityFactory } from "./apis/group/upgradeGroupToCommu
|
|
|
203
221
|
import { uploadAttachmentFactory } from "./apis/media/uploadAttachment.js";
|
|
204
222
|
import { uploadProductPhotoFactory } from "./apis/business/uploadProductPhoto.js";
|
|
205
223
|
import { verifyCloudMediaFactory } from "./apis/zcloud/verifyCloudMedia.js";
|
|
224
|
+
import { verifyFriendFactory } from "./apis/friend/verifyFriend.js";
|
|
206
225
|
import { voiceToTextFactory } from "./apis/media/voiceToText.js";
|
|
207
226
|
import { votePollFactory } from "./apis/board/votePoll.js";
|
|
208
227
|
import { customFactory } from "./apis/custom.js";
|
|
@@ -227,6 +246,7 @@ export class API {
|
|
|
227
246
|
const createNamespace = (api) => ({
|
|
228
247
|
get decryptGids() { return api.decryptGids; },
|
|
229
248
|
get encryptGids() { return api.encryptGids; },
|
|
249
|
+
get exportSession() { return api.exportSession; },
|
|
230
250
|
get getContext() { return api.getContext; },
|
|
231
251
|
get getCookie() { return api.getCookie; },
|
|
232
252
|
get getListDevice() { return api.getListDevice; },
|
|
@@ -322,12 +342,14 @@ export class API {
|
|
|
322
342
|
get forwardMessage() { return api.forwardMessage; },
|
|
323
343
|
get getArchivedChatList() { return api.getArchivedChatList; },
|
|
324
344
|
get getAutoDeleteChat() { return api.getAutoDeleteChat; },
|
|
345
|
+
get getDirectMessageStatus() { return api.getDirectMessageStatus; },
|
|
325
346
|
get getHiddenConversations() { return api.getHiddenConversations; },
|
|
326
347
|
get getLastSeen() { return api.getLastSeen; },
|
|
327
348
|
get getLastSeenReaction() { return api.getLastSeenReaction; },
|
|
328
349
|
get getMute() { return api.getMute; },
|
|
329
350
|
get getPinConversations() { return api.getPinConversations; },
|
|
330
351
|
get getRecentSearchList() { return api.getRecentSearchList; },
|
|
352
|
+
get getSuggestedConversations() { return api.getSuggestedConversations; },
|
|
331
353
|
get getUnreadMark() { return api.getUnreadMark; },
|
|
332
354
|
get parseLink() { return api.parseLink; },
|
|
333
355
|
get preloadConversations() { return api.preloadConversations; },
|
|
@@ -352,6 +374,7 @@ export class API {
|
|
|
352
374
|
get updateArchivedChatList() { return api.updateArchivedChatList; },
|
|
353
375
|
get updateAutoDeleteChat() { return api.updateAutoDeleteChat; },
|
|
354
376
|
get updateHiddenConversPin() { return api.updateHiddenConversPin; },
|
|
377
|
+
get updatePinConversations() { return api.updatePinConversations; },
|
|
355
378
|
get updateRecentSearch() { return api.updateRecentSearch; },
|
|
356
379
|
});
|
|
357
380
|
this._domains.chat = createNamespace(this);
|
|
@@ -376,8 +399,10 @@ export class API {
|
|
|
376
399
|
get getExtraFriendInfo() { return api.getExtraFriendInfo; },
|
|
377
400
|
get getFriendBoardList() { return api.getFriendBoardList; },
|
|
378
401
|
get getFriendOnlines() { return api.getFriendOnlines; },
|
|
402
|
+
get getFriendProfilesV2() { return api.getFriendProfilesV2; },
|
|
379
403
|
get getFriendRecommendations() { return api.getFriendRecommendations; },
|
|
380
404
|
get getFriendRequestStatus() { return api.getFriendRequestStatus; },
|
|
405
|
+
get getFriendsActivePCWeb() { return api.getFriendsActivePCWeb; },
|
|
381
406
|
get getFriendsEmojiStatus() { return api.getFriendsEmojiStatus; },
|
|
382
407
|
get getLastReadContactTab() { return api.getLastReadContactTab; },
|
|
383
408
|
get getMultiUsersByPhones() { return api.getMultiUsersByPhones; },
|
|
@@ -391,6 +416,7 @@ export class API {
|
|
|
391
416
|
get sendFriendRequest() { return api.sendFriendRequest; },
|
|
392
417
|
get unblockUser() { return api.unblockUser; },
|
|
393
418
|
get undoFriendRequest() { return api.undoFriendRequest; },
|
|
419
|
+
get verifyFriend() { return api.verifyFriend; },
|
|
394
420
|
});
|
|
395
421
|
this._domains.friend = createNamespace(this);
|
|
396
422
|
}
|
|
@@ -402,25 +428,34 @@ export class API {
|
|
|
402
428
|
get addGroupBlockedMember() { return api.addGroupBlockedMember; },
|
|
403
429
|
get addGroupDeputy() { return api.addGroupDeputy; },
|
|
404
430
|
get addUserToGroup() { return api.addUserToGroup; },
|
|
431
|
+
get analyseGroup() { return api.analyseGroup; },
|
|
405
432
|
get changeGroupAvatar() { return api.changeGroupAvatar; },
|
|
406
433
|
get changeGroupName() { return api.changeGroupName; },
|
|
407
434
|
get changeGroupOwner() { return api.changeGroupOwner; },
|
|
435
|
+
get checkQuotaCommunityMember() { return api.checkQuotaCommunityMember; },
|
|
408
436
|
get createGroup() { return api.createGroup; },
|
|
409
437
|
get deleteGroupInviteBox() { return api.deleteGroupInviteBox; },
|
|
410
438
|
get disableGroupLink() { return api.disableGroupLink; },
|
|
411
439
|
get disperseGroup() { return api.disperseGroup; },
|
|
412
440
|
get enableGroupLink() { return api.enableGroupLink; },
|
|
413
441
|
get getAllGroups() { return api.getAllGroups; },
|
|
442
|
+
get getE2eeGroupList() { return api.getE2eeGroupList; },
|
|
414
443
|
get getExtraGroupInfo() { return api.getExtraGroupInfo; },
|
|
415
444
|
get getGroupBlockedMember() { return api.getGroupBlockedMember; },
|
|
416
445
|
get getGroupChatHistory() { return api.getGroupChatHistory; },
|
|
417
446
|
get getGroupCloudMessageJump() { return api.getGroupCloudMessageJump; },
|
|
447
|
+
get getGroupCloudMessagePath() { return api.getGroupCloudMessagePath; },
|
|
448
|
+
get getGroupHistoryLegacy() { return api.getGroupHistoryLegacy; },
|
|
418
449
|
get getGroupInfo() { return api.getGroupInfo; },
|
|
450
|
+
get getGroupInfoV2() { return api.getGroupInfoV2; },
|
|
419
451
|
get getGroupInviteBoxInfo() { return api.getGroupInviteBoxInfo; },
|
|
420
452
|
get getGroupInviteBoxList() { return api.getGroupInviteBoxList; },
|
|
421
453
|
get getGroupLinkDetail() { return api.getGroupLinkDetail; },
|
|
422
454
|
get getGroupLinkInfo() { return api.getGroupLinkInfo; },
|
|
455
|
+
get getGroupListV3() { return api.getGroupListV3; },
|
|
423
456
|
get getGroupMembersInfo() { return api.getGroupMembersInfo; },
|
|
457
|
+
get getGroupMessageStatus() { return api.getGroupMessageStatus; },
|
|
458
|
+
get getMultiGroupCloudMessages() { return api.getMultiGroupCloudMessages; },
|
|
424
459
|
get getPendingGroupMembers() { return api.getPendingGroupMembers; },
|
|
425
460
|
get getQuotaCommunity() { return api.getQuotaCommunity; },
|
|
426
461
|
get getRelatedFriendGroup() { return api.getRelatedFriendGroup; },
|
|
@@ -444,7 +479,10 @@ export class API {
|
|
|
444
479
|
const createNamespace = (api) => ({
|
|
445
480
|
get getConversationMedia() { return api.getConversationMedia; },
|
|
446
481
|
get getMediaStorePreview() { return api.getMediaStorePreview; },
|
|
482
|
+
get getPersonalMedia() { return api.getPersonalMedia; },
|
|
483
|
+
get getPersonalMediaPreview() { return api.getPersonalMediaPreview; },
|
|
447
484
|
get removeConversationMedia() { return api.removeConversationMedia; },
|
|
485
|
+
get removePersonalMedia() { return api.removePersonalMedia; },
|
|
448
486
|
get uploadAttachment() { return api.uploadAttachment; },
|
|
449
487
|
get voiceToText() { return api.voiceToText; },
|
|
450
488
|
});
|
|
@@ -551,6 +589,9 @@ export class API {
|
|
|
551
589
|
get addUserToGroup() {
|
|
552
590
|
return (this._cache.addUserToGroup ??= addUserToGroupFactory(this.ctx, this));
|
|
553
591
|
}
|
|
592
|
+
get analyseGroup() {
|
|
593
|
+
return (this._cache.analyseGroup ??= analyseGroupFactory(this.ctx, this));
|
|
594
|
+
}
|
|
554
595
|
get blockUser() {
|
|
555
596
|
return (this._cache.blockUser ??= blockUserFactory(this.ctx, this));
|
|
556
597
|
}
|
|
@@ -578,6 +619,9 @@ export class API {
|
|
|
578
619
|
get changeGroupOwner() {
|
|
579
620
|
return (this._cache.changeGroupOwner ??= changeGroupOwnerFactory(this.ctx, this));
|
|
580
621
|
}
|
|
622
|
+
get checkQuotaCommunityMember() {
|
|
623
|
+
return (this._cache.checkQuotaCommunityMember ??= checkQuotaCommunityMemberFactory(this.ctx, this));
|
|
624
|
+
}
|
|
581
625
|
get clearUnreadFriendRequests() {
|
|
582
626
|
return (this._cache.clearUnreadFriendRequests ??= clearUnreadFriendRequestsFactory(this.ctx, this));
|
|
583
627
|
}
|
|
@@ -656,6 +700,9 @@ export class API {
|
|
|
656
700
|
get endVoiceCall() {
|
|
657
701
|
return (this._cache.endVoiceCall ??= endVoiceCallFactory(this.ctx, this));
|
|
658
702
|
}
|
|
703
|
+
get exportSession() {
|
|
704
|
+
return (this._cache.exportSession ??= exportSessionFactory(this.ctx, this));
|
|
705
|
+
}
|
|
659
706
|
get fetchAccountInfo() {
|
|
660
707
|
return (this._cache.fetchAccountInfo ??= fetchAccountInfoFactory(this.ctx, this));
|
|
661
708
|
}
|
|
@@ -725,6 +772,12 @@ export class API {
|
|
|
725
772
|
get getCookie() {
|
|
726
773
|
return (this._cache.getCookie ??= getCookieFactory(this.ctx, this));
|
|
727
774
|
}
|
|
775
|
+
get getDirectMessageStatus() {
|
|
776
|
+
return (this._cache.getDirectMessageStatus ??= getDirectMessageStatusFactory(this.ctx, this));
|
|
777
|
+
}
|
|
778
|
+
get getE2eeGroupList() {
|
|
779
|
+
return (this._cache.getE2eeGroupList ??= getE2eeGroupListFactory(this.ctx, this));
|
|
780
|
+
}
|
|
728
781
|
get getEmojiStatusConfig() {
|
|
729
782
|
return (this._cache.getEmojiStatusConfig ??= getEmojiStatusConfigFactory(this.ctx, this));
|
|
730
783
|
}
|
|
@@ -749,12 +802,18 @@ export class API {
|
|
|
749
802
|
get getFriendOnlines() {
|
|
750
803
|
return (this._cache.getFriendOnlines ??= getFriendOnlinesFactory(this.ctx, this));
|
|
751
804
|
}
|
|
805
|
+
get getFriendProfilesV2() {
|
|
806
|
+
return (this._cache.getFriendProfilesV2 ??= getFriendProfilesV2Factory(this.ctx, this));
|
|
807
|
+
}
|
|
752
808
|
get getFriendRecommendations() {
|
|
753
809
|
return (this._cache.getFriendRecommendations ??= getFriendRecommendationsFactory(this.ctx, this));
|
|
754
810
|
}
|
|
755
811
|
get getFriendRequestStatus() {
|
|
756
812
|
return (this._cache.getFriendRequestStatus ??= getFriendRequestStatusFactory(this.ctx, this));
|
|
757
813
|
}
|
|
814
|
+
get getFriendsActivePCWeb() {
|
|
815
|
+
return (this._cache.getFriendsActivePCWeb ??= getFriendsActivePCWebFactory(this.ctx, this));
|
|
816
|
+
}
|
|
758
817
|
get getFriendsEmojiStatus() {
|
|
759
818
|
return (this._cache.getFriendsEmojiStatus ??= getFriendsEmojiStatusFactory(this.ctx, this));
|
|
760
819
|
}
|
|
@@ -770,9 +829,18 @@ export class API {
|
|
|
770
829
|
get getGroupCloudMessageJump() {
|
|
771
830
|
return (this._cache.getGroupCloudMessageJump ??= getGroupCloudMessageJumpFactory(this.ctx, this));
|
|
772
831
|
}
|
|
832
|
+
get getGroupCloudMessagePath() {
|
|
833
|
+
return (this._cache.getGroupCloudMessagePath ??= getGroupCloudMessagePathFactory(this.ctx, this));
|
|
834
|
+
}
|
|
835
|
+
get getGroupHistoryLegacy() {
|
|
836
|
+
return (this._cache.getGroupHistoryLegacy ??= getGroupHistoryLegacyFactory(this.ctx, this));
|
|
837
|
+
}
|
|
773
838
|
get getGroupInfo() {
|
|
774
839
|
return (this._cache.getGroupInfo ??= getGroupInfoFactory(this.ctx, this));
|
|
775
840
|
}
|
|
841
|
+
get getGroupInfoV2() {
|
|
842
|
+
return (this._cache.getGroupInfoV2 ??= getGroupInfoV2Factory(this.ctx, this));
|
|
843
|
+
}
|
|
776
844
|
get getGroupInviteBoxInfo() {
|
|
777
845
|
return (this._cache.getGroupInviteBoxInfo ??= getGroupInviteBoxInfoFactory(this.ctx, this));
|
|
778
846
|
}
|
|
@@ -785,9 +853,15 @@ export class API {
|
|
|
785
853
|
get getGroupLinkInfo() {
|
|
786
854
|
return (this._cache.getGroupLinkInfo ??= getGroupLinkInfoFactory(this.ctx, this));
|
|
787
855
|
}
|
|
856
|
+
get getGroupListV3() {
|
|
857
|
+
return (this._cache.getGroupListV3 ??= getGroupListV3Factory(this.ctx, this));
|
|
858
|
+
}
|
|
788
859
|
get getGroupMembersInfo() {
|
|
789
860
|
return (this._cache.getGroupMembersInfo ??= getGroupMembersInfoFactory(this.ctx, this));
|
|
790
861
|
}
|
|
862
|
+
get getGroupMessageStatus() {
|
|
863
|
+
return (this._cache.getGroupMessageStatus ??= getGroupMessageStatusFactory(this.ctx, this));
|
|
864
|
+
}
|
|
791
865
|
get getHiddenConversations() {
|
|
792
866
|
return (this._cache.getHiddenConversations ??= getHiddenConversationsFactory(this.ctx, this));
|
|
793
867
|
}
|
|
@@ -827,6 +901,9 @@ export class API {
|
|
|
827
901
|
get getMiniProfile() {
|
|
828
902
|
return (this._cache.getMiniProfile ??= getMiniProfileFactory(this.ctx, this));
|
|
829
903
|
}
|
|
904
|
+
get getMultiGroupCloudMessages() {
|
|
905
|
+
return (this._cache.getMultiGroupCloudMessages ??= getMultiGroupCloudMessagesFactory(this.ctx, this));
|
|
906
|
+
}
|
|
830
907
|
get getMultiUsersByPhones() {
|
|
831
908
|
return (this._cache.getMultiUsersByPhones ??= getMultiUsersByPhonesFactory(this.ctx, this));
|
|
832
909
|
}
|
|
@@ -845,6 +922,12 @@ export class API {
|
|
|
845
922
|
get getPersonalizedStickerList() {
|
|
846
923
|
return (this._cache.getPersonalizedStickerList ??= getPersonalizedStickerListFactory(this.ctx, this));
|
|
847
924
|
}
|
|
925
|
+
get getPersonalMedia() {
|
|
926
|
+
return (this._cache.getPersonalMedia ??= getPersonalMediaFactory(this.ctx, this));
|
|
927
|
+
}
|
|
928
|
+
get getPersonalMediaPreview() {
|
|
929
|
+
return (this._cache.getPersonalMediaPreview ??= getPersonalMediaPreviewFactory(this.ctx, this));
|
|
930
|
+
}
|
|
848
931
|
get getPhonebookV2() {
|
|
849
932
|
return (this._cache.getPhonebookV2 ??= getPhonebookV2Factory(this.ctx, this));
|
|
850
933
|
}
|
|
@@ -914,6 +997,9 @@ export class API {
|
|
|
914
997
|
get getStickerSuggestKeywords() {
|
|
915
998
|
return (this._cache.getStickerSuggestKeywords ??= getStickerSuggestKeywordsFactory(this.ctx, this));
|
|
916
999
|
}
|
|
1000
|
+
get getSuggestedConversations() {
|
|
1001
|
+
return (this._cache.getSuggestedConversations ??= getSuggestedConversationsFactory(this.ctx, this));
|
|
1002
|
+
}
|
|
917
1003
|
get getSyncData() {
|
|
918
1004
|
return (this._cache.getSyncData ??= getSyncDataFactory(this.ctx, this));
|
|
919
1005
|
}
|
|
@@ -986,6 +1072,9 @@ export class API {
|
|
|
986
1072
|
get removeGroupDeputy() {
|
|
987
1073
|
return (this._cache.removeGroupDeputy ??= removeGroupDeputyFactory(this.ctx, this));
|
|
988
1074
|
}
|
|
1075
|
+
get removePersonalMedia() {
|
|
1076
|
+
return (this._cache.removePersonalMedia ??= removePersonalMediaFactory(this.ctx, this));
|
|
1077
|
+
}
|
|
989
1078
|
get removeQuickMessage() {
|
|
990
1079
|
return (this._cache.removeQuickMessage ??= removeQuickMessageFactory(this.ctx, this));
|
|
991
1080
|
}
|
|
@@ -1109,6 +1198,9 @@ export class API {
|
|
|
1109
1198
|
get updateLang() {
|
|
1110
1199
|
return (this._cache.updateLang ??= updateLangFactory(this.ctx, this));
|
|
1111
1200
|
}
|
|
1201
|
+
get updatePinConversations() {
|
|
1202
|
+
return (this._cache.updatePinConversations ??= updatePinConversationsFactory(this.ctx, this));
|
|
1203
|
+
}
|
|
1112
1204
|
get updateProductCatalog() {
|
|
1113
1205
|
return (this._cache.updateProductCatalog ??= updateProductCatalogFactory(this.ctx, this));
|
|
1114
1206
|
}
|
|
@@ -1139,6 +1231,9 @@ export class API {
|
|
|
1139
1231
|
get verifyCloudMedia() {
|
|
1140
1232
|
return (this._cache.verifyCloudMedia ??= verifyCloudMediaFactory(this.ctx, this));
|
|
1141
1233
|
}
|
|
1234
|
+
get verifyFriend() {
|
|
1235
|
+
return (this._cache.verifyFriend ??= verifyFriendFactory(this.ctx, this));
|
|
1236
|
+
}
|
|
1142
1237
|
get voiceToText() {
|
|
1143
1238
|
return (this._cache.voiceToText ??= voiceToTextFactory(this.ctx, this));
|
|
1144
1239
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var utils = require('../../utils.cjs');
|
|
4
|
+
|
|
5
|
+
const exportSessionFactory = utils.apiFactory()((_api, ctx) => {
|
|
6
|
+
/**
|
|
7
|
+
* Xuất toàn bộ thông tin phiên đăng nhập hiện tại (`uid`, `imei`, `userAgent`, `language`, `cookie`)
|
|
8
|
+
* dưới định dạng chuẩn `Credentials` để lưu trữ (JSON/Database) và truyền trực tiếp vào `zalo.login(session)`.
|
|
9
|
+
*/
|
|
10
|
+
return function exportSession() {
|
|
11
|
+
const serializedJar = ctx.cookie?.toJSON();
|
|
12
|
+
return {
|
|
13
|
+
uid: ctx.uid,
|
|
14
|
+
imei: ctx.imei,
|
|
15
|
+
userAgent: ctx.userAgent,
|
|
16
|
+
language: ctx.language || "vi",
|
|
17
|
+
cookie: serializedJar?.cookies ?? [],
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
exports.exportSessionFactory = exportSessionFactory;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ZaloApiError = require('../../Errors/ZaloApiError.cjs');
|
|
4
|
+
var utils = require('../../utils.cjs');
|
|
5
|
+
var wsCipher = require('../../crypto/ws-cipher.cjs');
|
|
6
|
+
|
|
7
|
+
const getDirectMessageStatusFactory = utils.apiFactory()((api, _ctx, utils) => {
|
|
8
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.chat[0]}/api/message/getStatusMsg`);
|
|
9
|
+
/**
|
|
10
|
+
* Truy vấn trạng thái Đã nhận (`deliver`) và Đã xem (`seen`) tin nhắn trong các hội thoại cá nhân 1-1 (command 12016)
|
|
11
|
+
*
|
|
12
|
+
* @param data Danh sách UID hoặc đối tượng truy vấn `{ tId }`
|
|
13
|
+
* @throws {ZaloApiError}
|
|
14
|
+
*/
|
|
15
|
+
return async function getDirectMessageStatus(data) {
|
|
16
|
+
if (!Array.isArray(data) || data.length === 0) {
|
|
17
|
+
throw new ZaloApiError.ZaloApiError("Missing data");
|
|
18
|
+
}
|
|
19
|
+
const formattedData = data.map((item) => (typeof item === "string" ? { tId: item } : item));
|
|
20
|
+
const params = {
|
|
21
|
+
param: JSON.stringify({
|
|
22
|
+
data: formattedData,
|
|
23
|
+
}),
|
|
24
|
+
};
|
|
25
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
26
|
+
if (!encryptedParams) {
|
|
27
|
+
throw new ZaloApiError.ZaloApiError("Failed to encrypt params");
|
|
28
|
+
}
|
|
29
|
+
const response = await utils.request(serviceURL, {
|
|
30
|
+
method: "POST",
|
|
31
|
+
body: new URLSearchParams({
|
|
32
|
+
params: encryptedParams,
|
|
33
|
+
}),
|
|
34
|
+
});
|
|
35
|
+
return utils.resolve(response, (result) => {
|
|
36
|
+
let rawData = result.data;
|
|
37
|
+
if (typeof rawData === "string" && rawData.length > 0) {
|
|
38
|
+
try {
|
|
39
|
+
const parsed = JSON.parse(wsCipher.preParseJsonIds(rawData));
|
|
40
|
+
rawData = "data" in parsed && parsed.data ? parsed.data : parsed;
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
// Giữ nguyên nếu không phải chuỗi JSON lồng
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (rawData && typeof rawData === "object") {
|
|
47
|
+
const obj = rawData;
|
|
48
|
+
return {
|
|
49
|
+
...obj,
|
|
50
|
+
statusInfos: Array.isArray(obj.statusInfos) ? obj.statusInfos : [],
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
return { statusInfos: [] };
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
exports.getDirectMessageStatusFactory = getDirectMessageStatusFactory;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ZaloApiError = require('../../Errors/ZaloApiError.cjs');
|
|
4
|
+
var utils = require('../../utils.cjs');
|
|
5
|
+
|
|
6
|
+
const getSuggestedConversationsFactory = utils.apiFactory()((api, ctx, utils) => {
|
|
7
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.conversation[0]}/api/suggestconvers/list`);
|
|
8
|
+
/**
|
|
9
|
+
* Lấy danh sách các cuộc hội thoại được gợi ý (command 11233)
|
|
10
|
+
*
|
|
11
|
+
* @param language Ngôn ngữ hiển thị (mặc định theo `ctx.language` hoặc `"vi"`)
|
|
12
|
+
* @throws {ZaloApiError}
|
|
13
|
+
*/
|
|
14
|
+
return async function getSuggestedConversations(language) {
|
|
15
|
+
const params = {
|
|
16
|
+
language: language ?? ctx.language ?? "vi",
|
|
17
|
+
};
|
|
18
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
19
|
+
if (!encryptedParams) {
|
|
20
|
+
throw new ZaloApiError.ZaloApiError("Failed to encrypt params");
|
|
21
|
+
}
|
|
22
|
+
const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams }), {
|
|
23
|
+
method: "GET",
|
|
24
|
+
});
|
|
25
|
+
return utils.resolve(response);
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
exports.getSuggestedConversationsFactory = getSuggestedConversationsFactory;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ZaloApiError = require('../../Errors/ZaloApiError.cjs');
|
|
4
|
+
var utils = require('../../utils.cjs');
|
|
5
|
+
|
|
6
|
+
const updatePinConversationsFactory = utils.apiFactory()((api, _ctx, utils) => {
|
|
7
|
+
const v1ServiceURL = utils.makeURL(`${api.zpwServiceMap.conversation[0]}/api/pinconvers/update`);
|
|
8
|
+
const v2ServiceURL = utils.makeURL(`${api.zpwServiceMap.conversation[0]}/api/pinconvers/updatev2`);
|
|
9
|
+
/**
|
|
10
|
+
* Cập nhật danh sách hội thoại ghim qua `/api/pinconvers/update` (command 12121) hoặc `/api/pinconvers/updatev2` (command 12122)
|
|
11
|
+
*
|
|
12
|
+
* @param options Cấu hình danh sách hội thoại ghim
|
|
13
|
+
* @throws {ZaloApiError}
|
|
14
|
+
*/
|
|
15
|
+
return async function updatePinConversations(options) {
|
|
16
|
+
if (!options || !Array.isArray(options.conversations)) {
|
|
17
|
+
throw new ZaloApiError.ZaloApiError("Missing conversations");
|
|
18
|
+
}
|
|
19
|
+
const useV2 = options.actionType !== undefined;
|
|
20
|
+
const targetURL = useV2 ? v2ServiceURL : v1ServiceURL;
|
|
21
|
+
const params = useV2
|
|
22
|
+
? {
|
|
23
|
+
actionType: options.actionType,
|
|
24
|
+
conversations: options.conversations,
|
|
25
|
+
tab: options.tab,
|
|
26
|
+
}
|
|
27
|
+
: {
|
|
28
|
+
version: options.version ?? 0,
|
|
29
|
+
conversations: options.conversations,
|
|
30
|
+
};
|
|
31
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
32
|
+
if (!encryptedParams) {
|
|
33
|
+
throw new ZaloApiError.ZaloApiError("Failed to encrypt params");
|
|
34
|
+
}
|
|
35
|
+
const response = await utils.request(targetURL, {
|
|
36
|
+
method: "POST",
|
|
37
|
+
body: new URLSearchParams({
|
|
38
|
+
params: encryptedParams,
|
|
39
|
+
}),
|
|
40
|
+
});
|
|
41
|
+
return utils.resolve(response);
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
exports.updatePinConversationsFactory = updatePinConversationsFactory;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ZaloApiError = require('../../Errors/ZaloApiError.cjs');
|
|
4
|
+
var utils = require('../../utils.cjs');
|
|
5
|
+
|
|
6
|
+
const getFriendProfilesV2Factory = utils.apiFactory()((api, ctx, utils) => {
|
|
7
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.profile[0]}/api/social/friend/getprofiles/v2`);
|
|
8
|
+
/**
|
|
9
|
+
* Lấy hàng loạt hồ sơ chi tiết của danh sách bạn bè kèm trạng thái online qua `/api/social/friend/getprofiles/v2` (command 11140)
|
|
10
|
+
*
|
|
11
|
+
* @param friendIds Mảng UID cần lấy hồ sơ (có thể kèm hậu tố `_version` hoặc truyền UID thuần)
|
|
12
|
+
* @param options Tùy chọn truy vấn
|
|
13
|
+
* @throws {ZaloApiError}
|
|
14
|
+
*/
|
|
15
|
+
return async function getFriendProfilesV2(friendIds, options = {}) {
|
|
16
|
+
const rawIds = Array.isArray(friendIds) ? friendIds : [friendIds];
|
|
17
|
+
if (rawIds.length === 0) {
|
|
18
|
+
throw new ZaloApiError.ZaloApiError("Missing friendIds");
|
|
19
|
+
}
|
|
20
|
+
const friendPversionMap = rawIds.map((id) => (id.includes("_") ? id : `${id}_0`));
|
|
21
|
+
const params = {
|
|
22
|
+
phonebook_version: options.phonebookVersion ?? 0,
|
|
23
|
+
friend_pversion_map: friendPversionMap,
|
|
24
|
+
avatar_size: options.avatarSize ?? 120,
|
|
25
|
+
language: options.language ?? ctx.language ?? "vi",
|
|
26
|
+
show_online_status: options.showOnlineStatus !== false ? 1 : 0,
|
|
27
|
+
imei: ctx.imei,
|
|
28
|
+
};
|
|
29
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
30
|
+
if (!encryptedParams) {
|
|
31
|
+
throw new ZaloApiError.ZaloApiError("Failed to encrypt params");
|
|
32
|
+
}
|
|
33
|
+
const response = await utils.request(serviceURL, {
|
|
34
|
+
method: "POST",
|
|
35
|
+
body: new URLSearchParams({
|
|
36
|
+
params: encryptedParams,
|
|
37
|
+
}),
|
|
38
|
+
});
|
|
39
|
+
return utils.resolve(response);
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
exports.getFriendProfilesV2Factory = getFriendProfilesV2Factory;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var utils = require('../../utils.cjs');
|
|
4
|
+
|
|
5
|
+
const getFriendsActivePCWebFactory = utils.apiFactory()((api, _ctx, utils) => {
|
|
6
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.profile[0]}/api/social/friend/active-pcweb`);
|
|
7
|
+
/**
|
|
8
|
+
* Lấy danh sách bạn bè đang hoạt động trên Zalo PC / Web qua `/api/social/friend/active-pcweb` (command 12072)
|
|
9
|
+
*
|
|
10
|
+
* @throws {ZaloApiError}
|
|
11
|
+
*/
|
|
12
|
+
return async function getFriendsActivePCWeb() {
|
|
13
|
+
const response = await utils.request(serviceURL, {
|
|
14
|
+
method: "GET",
|
|
15
|
+
});
|
|
16
|
+
return utils.resolve(response);
|
|
17
|
+
};
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
exports.getFriendsActivePCWebFactory = getFriendsActivePCWebFactory;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ZaloApiError = require('../../Errors/ZaloApiError.cjs');
|
|
4
|
+
var utils = require('../../utils.cjs');
|
|
5
|
+
|
|
6
|
+
const verifyFriendFactory = utils.apiFactory()((api, ctx, utils) => {
|
|
7
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.profile[0]}/api/social/friend/verify`);
|
|
8
|
+
/**
|
|
9
|
+
* Kiểm tra và xác thực danh sách bạn bè qua `/api/social/friend/verify` (command 11138)
|
|
10
|
+
*
|
|
11
|
+
* @param friendIds Danh sách UID bạn bè cần xác thực
|
|
12
|
+
* @param options Tùy chọn truy vấn
|
|
13
|
+
* @throws {ZaloApiError}
|
|
14
|
+
*/
|
|
15
|
+
return async function verifyFriend(friendIds, options = {}) {
|
|
16
|
+
const rawIds = Array.isArray(friendIds) ? friendIds : [friendIds];
|
|
17
|
+
if (rawIds.length === 0) {
|
|
18
|
+
throw new ZaloApiError.ZaloApiError("Missing friendIds");
|
|
19
|
+
}
|
|
20
|
+
const friendPversionMap = rawIds.map((id) => (id.includes("_") ? id : `${id}_0`));
|
|
21
|
+
const params = {
|
|
22
|
+
phonebook_version: options.phonebookVersion ?? 0,
|
|
23
|
+
friend_pversion_map: friendPversionMap,
|
|
24
|
+
avatar_size: options.avatarSize ?? 120,
|
|
25
|
+
language: options.language ?? ctx.language ?? "vi",
|
|
26
|
+
imei: ctx.imei,
|
|
27
|
+
};
|
|
28
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
29
|
+
if (!encryptedParams) {
|
|
30
|
+
throw new ZaloApiError.ZaloApiError("Failed to encrypt params");
|
|
31
|
+
}
|
|
32
|
+
const response = await utils.request(serviceURL, {
|
|
33
|
+
method: "POST",
|
|
34
|
+
body: new URLSearchParams({
|
|
35
|
+
params: encryptedParams,
|
|
36
|
+
}),
|
|
37
|
+
});
|
|
38
|
+
return utils.resolve(response);
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
exports.verifyFriendFactory = verifyFriendFactory;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ZaloApiError = require('../../Errors/ZaloApiError.cjs');
|
|
4
|
+
var utils = require('../../utils.cjs');
|
|
5
|
+
|
|
6
|
+
const analyseGroupFactory = utils.apiFactory()((api, _ctx, utils) => {
|
|
7
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.group[0]}/api/group/analyse`);
|
|
8
|
+
/**
|
|
9
|
+
* Lấy dữ liệu phân tích/thống kê của nhóm qua `/api/group/analyse` (command 12407)
|
|
10
|
+
*
|
|
11
|
+
* @param groupId ID của nhóm
|
|
12
|
+
* @throws {ZaloApiError}
|
|
13
|
+
*/
|
|
14
|
+
return async function analyseGroup(groupId) {
|
|
15
|
+
if (!groupId) {
|
|
16
|
+
throw new ZaloApiError.ZaloApiError("Missing groupId");
|
|
17
|
+
}
|
|
18
|
+
const cleanGroupId = groupId.startsWith("g") ? groupId.slice(1) : groupId;
|
|
19
|
+
const params = {
|
|
20
|
+
grid: cleanGroupId,
|
|
21
|
+
};
|
|
22
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
23
|
+
if (!encryptedParams) {
|
|
24
|
+
throw new ZaloApiError.ZaloApiError("Failed to encrypt params");
|
|
25
|
+
}
|
|
26
|
+
const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams }), {
|
|
27
|
+
method: "GET",
|
|
28
|
+
});
|
|
29
|
+
return utils.resolve(response);
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
exports.analyseGroupFactory = analyseGroupFactory;
|