@softtynet/zca-js 2.3.3 → 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/getGroupCloudMessagePath.d.ts +19 -0
- package/dist/apis/group/getGroupCloudMessagePath.js +51 -0
- package/dist/apis/group/getMultiGroupCloudMessages.d.ts +5 -0
- package/dist/apis/group/getMultiGroupCloudMessages.js +29 -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 +45 -0
- package/dist/apis.js +75 -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 +8 -7
- package/dist/cjs/apis/group/getGroupCloudMessagePath.cjs +69 -0
- package/dist/cjs/apis/group/getGroupHistoryLegacy.cjs +7 -6
- package/dist/cjs/apis/group/getGroupMessageStatus.cjs +7 -6
- 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 +75 -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 +9 -2
- package/dist/cjs/realtime/listener.cjs +18 -6
- package/dist/cjs/update.cjs +10 -1
- package/dist/cjs/utils.cjs +21 -68
- 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 +15 -0
- package/dist/realtime/listener.d.ts +1 -0
- package/dist/realtime/listener.js +18 -6
- package/dist/update.js +10 -1
- package/dist/utils.d.ts +0 -7
- package/dist/utils.js +15 -64
- 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,13 +78,16 @@ 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";
|
|
83
91
|
import { getGroupHistoryLegacyFactory } from "./apis/group/getGroupHistoryLegacy.js";
|
|
84
92
|
import { getGroupInfoFactory } from "./apis/group/getGroupInfo.js";
|
|
85
93
|
import { getGroupInfoV2Factory } from "./apis/group/getGroupInfoV2.js";
|
|
@@ -103,12 +111,15 @@ import { getListPinTopicsFactory } from "./apis/board/getListPinTopics.js";
|
|
|
103
111
|
import { getListReminderFactory } from "./apis/board/getListReminder.js";
|
|
104
112
|
import { getMediaStorePreviewFactory } from "./apis/media/getMediaStorePreview.js";
|
|
105
113
|
import { getMiniProfileFactory } from "./apis/profile/getMiniProfile.js";
|
|
114
|
+
import { getMultiGroupCloudMessagesFactory } from "./apis/group/getMultiGroupCloudMessages.js";
|
|
106
115
|
import { getMultiUsersByPhonesFactory } from "./apis/friend/getMultiUsersByPhones.js";
|
|
107
116
|
import { getMuteFactory } from "./apis/chat/getMute.js";
|
|
108
117
|
import { getNoisedIdsFactory } from "./apis/auth/getNoisedIds.js";
|
|
109
118
|
import { getOwnIdFactory } from "./apis/auth/getOwnId.js";
|
|
110
119
|
import { getPendingGroupMembersFactory } from "./apis/group/getPendingGroupMembers.js";
|
|
111
120
|
import { getPersonalizedStickerListFactory } from "./apis/sticker/getPersonalizedStickerList.js";
|
|
121
|
+
import { getPersonalMediaFactory } from "./apis/media/getPersonalMedia.js";
|
|
122
|
+
import { getPersonalMediaPreviewFactory } from "./apis/media/getPersonalMediaPreview.js";
|
|
112
123
|
import { getPhonebookV2Factory } from "./apis/friend/getPhonebookV2.js";
|
|
113
124
|
import { getPinConversationsFactory } from "./apis/chat/getPinConversations.js";
|
|
114
125
|
import { getPollDetailFactory } from "./apis/board/getPollDetail.js";
|
|
@@ -132,6 +143,7 @@ import { getStickersFactory } from "./apis/sticker/getStickers.js";
|
|
|
132
143
|
import { getStickersDetailFactory } from "./apis/sticker/getStickersDetail.js";
|
|
133
144
|
import { getStickerSuggestionFactory } from "./apis/sticker/getStickerSuggestion.js";
|
|
134
145
|
import { getStickerSuggestKeywordsFactory } from "./apis/sticker/getStickerSuggestKeywords.js";
|
|
146
|
+
import { getSuggestedConversationsFactory } from "./apis/chat/getSuggestedConversations.js";
|
|
135
147
|
import { getSyncDataFactory } from "./apis/sync/getSyncData.js";
|
|
136
148
|
import { getUnreadMarkFactory } from "./apis/chat/getUnreadMark.js";
|
|
137
149
|
import { getUsageMyCloudFactory } from "./apis/zcloud/getUsageMyCloud.js";
|
|
@@ -156,6 +168,7 @@ import { removeFriendFactory } from "./apis/friend/removeFriend.js";
|
|
|
156
168
|
import { removeFriendAliasFactory } from "./apis/friend/removeFriendAlias.js";
|
|
157
169
|
import { removeGroupBlockedMemberFactory } from "./apis/group/removeGroupBlockedMember.js";
|
|
158
170
|
import { removeGroupDeputyFactory } from "./apis/group/removeGroupDeputy.js";
|
|
171
|
+
import { removePersonalMediaFactory } from "./apis/media/removePersonalMedia.js";
|
|
159
172
|
import { removeQuickMessageFactory } from "./apis/business/removeQuickMessage.js";
|
|
160
173
|
import { removeReminderFactory } from "./apis/board/removeReminder.js";
|
|
161
174
|
import { removeUnreadMarkFactory } from "./apis/chat/removeUnreadMark.js";
|
|
@@ -197,6 +210,7 @@ import { updateGroupSettingsFactory } from "./apis/group/updateGroupSettings.js"
|
|
|
197
210
|
import { updateHiddenConversPinFactory } from "./apis/chat/updateHiddenConversPin.js";
|
|
198
211
|
import { updateLabelsFactory } from "./apis/business/updateLabels.js";
|
|
199
212
|
import { updateLangFactory } from "./apis/auth/updateLang.js";
|
|
213
|
+
import { updatePinConversationsFactory } from "./apis/chat/updatePinConversations.js";
|
|
200
214
|
import { updateProductCatalogFactory } from "./apis/business/updateProductCatalog.js";
|
|
201
215
|
import { updateProfileFactory } from "./apis/profile/updateProfile.js";
|
|
202
216
|
import { updateProfileBioFactory } from "./apis/profile/updateProfileBio.js";
|
|
@@ -207,6 +221,7 @@ import { upgradeGroupToCommunityFactory } from "./apis/group/upgradeGroupToCommu
|
|
|
207
221
|
import { uploadAttachmentFactory } from "./apis/media/uploadAttachment.js";
|
|
208
222
|
import { uploadProductPhotoFactory } from "./apis/business/uploadProductPhoto.js";
|
|
209
223
|
import { verifyCloudMediaFactory } from "./apis/zcloud/verifyCloudMedia.js";
|
|
224
|
+
import { verifyFriendFactory } from "./apis/friend/verifyFriend.js";
|
|
210
225
|
import { voiceToTextFactory } from "./apis/media/voiceToText.js";
|
|
211
226
|
import { votePollFactory } from "./apis/board/votePoll.js";
|
|
212
227
|
import { customFactory } from "./apis/custom.js";
|
|
@@ -231,6 +246,7 @@ export class API {
|
|
|
231
246
|
const createNamespace = (api) => ({
|
|
232
247
|
get decryptGids() { return api.decryptGids; },
|
|
233
248
|
get encryptGids() { return api.encryptGids; },
|
|
249
|
+
get exportSession() { return api.exportSession; },
|
|
234
250
|
get getContext() { return api.getContext; },
|
|
235
251
|
get getCookie() { return api.getCookie; },
|
|
236
252
|
get getListDevice() { return api.getListDevice; },
|
|
@@ -326,12 +342,14 @@ export class API {
|
|
|
326
342
|
get forwardMessage() { return api.forwardMessage; },
|
|
327
343
|
get getArchivedChatList() { return api.getArchivedChatList; },
|
|
328
344
|
get getAutoDeleteChat() { return api.getAutoDeleteChat; },
|
|
345
|
+
get getDirectMessageStatus() { return api.getDirectMessageStatus; },
|
|
329
346
|
get getHiddenConversations() { return api.getHiddenConversations; },
|
|
330
347
|
get getLastSeen() { return api.getLastSeen; },
|
|
331
348
|
get getLastSeenReaction() { return api.getLastSeenReaction; },
|
|
332
349
|
get getMute() { return api.getMute; },
|
|
333
350
|
get getPinConversations() { return api.getPinConversations; },
|
|
334
351
|
get getRecentSearchList() { return api.getRecentSearchList; },
|
|
352
|
+
get getSuggestedConversations() { return api.getSuggestedConversations; },
|
|
335
353
|
get getUnreadMark() { return api.getUnreadMark; },
|
|
336
354
|
get parseLink() { return api.parseLink; },
|
|
337
355
|
get preloadConversations() { return api.preloadConversations; },
|
|
@@ -356,6 +374,7 @@ export class API {
|
|
|
356
374
|
get updateArchivedChatList() { return api.updateArchivedChatList; },
|
|
357
375
|
get updateAutoDeleteChat() { return api.updateAutoDeleteChat; },
|
|
358
376
|
get updateHiddenConversPin() { return api.updateHiddenConversPin; },
|
|
377
|
+
get updatePinConversations() { return api.updatePinConversations; },
|
|
359
378
|
get updateRecentSearch() { return api.updateRecentSearch; },
|
|
360
379
|
});
|
|
361
380
|
this._domains.chat = createNamespace(this);
|
|
@@ -380,8 +399,10 @@ export class API {
|
|
|
380
399
|
get getExtraFriendInfo() { return api.getExtraFriendInfo; },
|
|
381
400
|
get getFriendBoardList() { return api.getFriendBoardList; },
|
|
382
401
|
get getFriendOnlines() { return api.getFriendOnlines; },
|
|
402
|
+
get getFriendProfilesV2() { return api.getFriendProfilesV2; },
|
|
383
403
|
get getFriendRecommendations() { return api.getFriendRecommendations; },
|
|
384
404
|
get getFriendRequestStatus() { return api.getFriendRequestStatus; },
|
|
405
|
+
get getFriendsActivePCWeb() { return api.getFriendsActivePCWeb; },
|
|
385
406
|
get getFriendsEmojiStatus() { return api.getFriendsEmojiStatus; },
|
|
386
407
|
get getLastReadContactTab() { return api.getLastReadContactTab; },
|
|
387
408
|
get getMultiUsersByPhones() { return api.getMultiUsersByPhones; },
|
|
@@ -395,6 +416,7 @@ export class API {
|
|
|
395
416
|
get sendFriendRequest() { return api.sendFriendRequest; },
|
|
396
417
|
get unblockUser() { return api.unblockUser; },
|
|
397
418
|
get undoFriendRequest() { return api.undoFriendRequest; },
|
|
419
|
+
get verifyFriend() { return api.verifyFriend; },
|
|
398
420
|
});
|
|
399
421
|
this._domains.friend = createNamespace(this);
|
|
400
422
|
}
|
|
@@ -406,19 +428,23 @@ export class API {
|
|
|
406
428
|
get addGroupBlockedMember() { return api.addGroupBlockedMember; },
|
|
407
429
|
get addGroupDeputy() { return api.addGroupDeputy; },
|
|
408
430
|
get addUserToGroup() { return api.addUserToGroup; },
|
|
431
|
+
get analyseGroup() { return api.analyseGroup; },
|
|
409
432
|
get changeGroupAvatar() { return api.changeGroupAvatar; },
|
|
410
433
|
get changeGroupName() { return api.changeGroupName; },
|
|
411
434
|
get changeGroupOwner() { return api.changeGroupOwner; },
|
|
435
|
+
get checkQuotaCommunityMember() { return api.checkQuotaCommunityMember; },
|
|
412
436
|
get createGroup() { return api.createGroup; },
|
|
413
437
|
get deleteGroupInviteBox() { return api.deleteGroupInviteBox; },
|
|
414
438
|
get disableGroupLink() { return api.disableGroupLink; },
|
|
415
439
|
get disperseGroup() { return api.disperseGroup; },
|
|
416
440
|
get enableGroupLink() { return api.enableGroupLink; },
|
|
417
441
|
get getAllGroups() { return api.getAllGroups; },
|
|
442
|
+
get getE2eeGroupList() { return api.getE2eeGroupList; },
|
|
418
443
|
get getExtraGroupInfo() { return api.getExtraGroupInfo; },
|
|
419
444
|
get getGroupBlockedMember() { return api.getGroupBlockedMember; },
|
|
420
445
|
get getGroupChatHistory() { return api.getGroupChatHistory; },
|
|
421
446
|
get getGroupCloudMessageJump() { return api.getGroupCloudMessageJump; },
|
|
447
|
+
get getGroupCloudMessagePath() { return api.getGroupCloudMessagePath; },
|
|
422
448
|
get getGroupHistoryLegacy() { return api.getGroupHistoryLegacy; },
|
|
423
449
|
get getGroupInfo() { return api.getGroupInfo; },
|
|
424
450
|
get getGroupInfoV2() { return api.getGroupInfoV2; },
|
|
@@ -429,6 +455,7 @@ export class API {
|
|
|
429
455
|
get getGroupListV3() { return api.getGroupListV3; },
|
|
430
456
|
get getGroupMembersInfo() { return api.getGroupMembersInfo; },
|
|
431
457
|
get getGroupMessageStatus() { return api.getGroupMessageStatus; },
|
|
458
|
+
get getMultiGroupCloudMessages() { return api.getMultiGroupCloudMessages; },
|
|
432
459
|
get getPendingGroupMembers() { return api.getPendingGroupMembers; },
|
|
433
460
|
get getQuotaCommunity() { return api.getQuotaCommunity; },
|
|
434
461
|
get getRelatedFriendGroup() { return api.getRelatedFriendGroup; },
|
|
@@ -452,7 +479,10 @@ export class API {
|
|
|
452
479
|
const createNamespace = (api) => ({
|
|
453
480
|
get getConversationMedia() { return api.getConversationMedia; },
|
|
454
481
|
get getMediaStorePreview() { return api.getMediaStorePreview; },
|
|
482
|
+
get getPersonalMedia() { return api.getPersonalMedia; },
|
|
483
|
+
get getPersonalMediaPreview() { return api.getPersonalMediaPreview; },
|
|
455
484
|
get removeConversationMedia() { return api.removeConversationMedia; },
|
|
485
|
+
get removePersonalMedia() { return api.removePersonalMedia; },
|
|
456
486
|
get uploadAttachment() { return api.uploadAttachment; },
|
|
457
487
|
get voiceToText() { return api.voiceToText; },
|
|
458
488
|
});
|
|
@@ -559,6 +589,9 @@ export class API {
|
|
|
559
589
|
get addUserToGroup() {
|
|
560
590
|
return (this._cache.addUserToGroup ??= addUserToGroupFactory(this.ctx, this));
|
|
561
591
|
}
|
|
592
|
+
get analyseGroup() {
|
|
593
|
+
return (this._cache.analyseGroup ??= analyseGroupFactory(this.ctx, this));
|
|
594
|
+
}
|
|
562
595
|
get blockUser() {
|
|
563
596
|
return (this._cache.blockUser ??= blockUserFactory(this.ctx, this));
|
|
564
597
|
}
|
|
@@ -586,6 +619,9 @@ export class API {
|
|
|
586
619
|
get changeGroupOwner() {
|
|
587
620
|
return (this._cache.changeGroupOwner ??= changeGroupOwnerFactory(this.ctx, this));
|
|
588
621
|
}
|
|
622
|
+
get checkQuotaCommunityMember() {
|
|
623
|
+
return (this._cache.checkQuotaCommunityMember ??= checkQuotaCommunityMemberFactory(this.ctx, this));
|
|
624
|
+
}
|
|
589
625
|
get clearUnreadFriendRequests() {
|
|
590
626
|
return (this._cache.clearUnreadFriendRequests ??= clearUnreadFriendRequestsFactory(this.ctx, this));
|
|
591
627
|
}
|
|
@@ -664,6 +700,9 @@ export class API {
|
|
|
664
700
|
get endVoiceCall() {
|
|
665
701
|
return (this._cache.endVoiceCall ??= endVoiceCallFactory(this.ctx, this));
|
|
666
702
|
}
|
|
703
|
+
get exportSession() {
|
|
704
|
+
return (this._cache.exportSession ??= exportSessionFactory(this.ctx, this));
|
|
705
|
+
}
|
|
667
706
|
get fetchAccountInfo() {
|
|
668
707
|
return (this._cache.fetchAccountInfo ??= fetchAccountInfoFactory(this.ctx, this));
|
|
669
708
|
}
|
|
@@ -733,6 +772,12 @@ export class API {
|
|
|
733
772
|
get getCookie() {
|
|
734
773
|
return (this._cache.getCookie ??= getCookieFactory(this.ctx, this));
|
|
735
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
|
+
}
|
|
736
781
|
get getEmojiStatusConfig() {
|
|
737
782
|
return (this._cache.getEmojiStatusConfig ??= getEmojiStatusConfigFactory(this.ctx, this));
|
|
738
783
|
}
|
|
@@ -757,12 +802,18 @@ export class API {
|
|
|
757
802
|
get getFriendOnlines() {
|
|
758
803
|
return (this._cache.getFriendOnlines ??= getFriendOnlinesFactory(this.ctx, this));
|
|
759
804
|
}
|
|
805
|
+
get getFriendProfilesV2() {
|
|
806
|
+
return (this._cache.getFriendProfilesV2 ??= getFriendProfilesV2Factory(this.ctx, this));
|
|
807
|
+
}
|
|
760
808
|
get getFriendRecommendations() {
|
|
761
809
|
return (this._cache.getFriendRecommendations ??= getFriendRecommendationsFactory(this.ctx, this));
|
|
762
810
|
}
|
|
763
811
|
get getFriendRequestStatus() {
|
|
764
812
|
return (this._cache.getFriendRequestStatus ??= getFriendRequestStatusFactory(this.ctx, this));
|
|
765
813
|
}
|
|
814
|
+
get getFriendsActivePCWeb() {
|
|
815
|
+
return (this._cache.getFriendsActivePCWeb ??= getFriendsActivePCWebFactory(this.ctx, this));
|
|
816
|
+
}
|
|
766
817
|
get getFriendsEmojiStatus() {
|
|
767
818
|
return (this._cache.getFriendsEmojiStatus ??= getFriendsEmojiStatusFactory(this.ctx, this));
|
|
768
819
|
}
|
|
@@ -778,6 +829,9 @@ export class API {
|
|
|
778
829
|
get getGroupCloudMessageJump() {
|
|
779
830
|
return (this._cache.getGroupCloudMessageJump ??= getGroupCloudMessageJumpFactory(this.ctx, this));
|
|
780
831
|
}
|
|
832
|
+
get getGroupCloudMessagePath() {
|
|
833
|
+
return (this._cache.getGroupCloudMessagePath ??= getGroupCloudMessagePathFactory(this.ctx, this));
|
|
834
|
+
}
|
|
781
835
|
get getGroupHistoryLegacy() {
|
|
782
836
|
return (this._cache.getGroupHistoryLegacy ??= getGroupHistoryLegacyFactory(this.ctx, this));
|
|
783
837
|
}
|
|
@@ -847,6 +901,9 @@ export class API {
|
|
|
847
901
|
get getMiniProfile() {
|
|
848
902
|
return (this._cache.getMiniProfile ??= getMiniProfileFactory(this.ctx, this));
|
|
849
903
|
}
|
|
904
|
+
get getMultiGroupCloudMessages() {
|
|
905
|
+
return (this._cache.getMultiGroupCloudMessages ??= getMultiGroupCloudMessagesFactory(this.ctx, this));
|
|
906
|
+
}
|
|
850
907
|
get getMultiUsersByPhones() {
|
|
851
908
|
return (this._cache.getMultiUsersByPhones ??= getMultiUsersByPhonesFactory(this.ctx, this));
|
|
852
909
|
}
|
|
@@ -865,6 +922,12 @@ export class API {
|
|
|
865
922
|
get getPersonalizedStickerList() {
|
|
866
923
|
return (this._cache.getPersonalizedStickerList ??= getPersonalizedStickerListFactory(this.ctx, this));
|
|
867
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
|
+
}
|
|
868
931
|
get getPhonebookV2() {
|
|
869
932
|
return (this._cache.getPhonebookV2 ??= getPhonebookV2Factory(this.ctx, this));
|
|
870
933
|
}
|
|
@@ -934,6 +997,9 @@ export class API {
|
|
|
934
997
|
get getStickerSuggestKeywords() {
|
|
935
998
|
return (this._cache.getStickerSuggestKeywords ??= getStickerSuggestKeywordsFactory(this.ctx, this));
|
|
936
999
|
}
|
|
1000
|
+
get getSuggestedConversations() {
|
|
1001
|
+
return (this._cache.getSuggestedConversations ??= getSuggestedConversationsFactory(this.ctx, this));
|
|
1002
|
+
}
|
|
937
1003
|
get getSyncData() {
|
|
938
1004
|
return (this._cache.getSyncData ??= getSyncDataFactory(this.ctx, this));
|
|
939
1005
|
}
|
|
@@ -1006,6 +1072,9 @@ export class API {
|
|
|
1006
1072
|
get removeGroupDeputy() {
|
|
1007
1073
|
return (this._cache.removeGroupDeputy ??= removeGroupDeputyFactory(this.ctx, this));
|
|
1008
1074
|
}
|
|
1075
|
+
get removePersonalMedia() {
|
|
1076
|
+
return (this._cache.removePersonalMedia ??= removePersonalMediaFactory(this.ctx, this));
|
|
1077
|
+
}
|
|
1009
1078
|
get removeQuickMessage() {
|
|
1010
1079
|
return (this._cache.removeQuickMessage ??= removeQuickMessageFactory(this.ctx, this));
|
|
1011
1080
|
}
|
|
@@ -1129,6 +1198,9 @@ export class API {
|
|
|
1129
1198
|
get updateLang() {
|
|
1130
1199
|
return (this._cache.updateLang ??= updateLangFactory(this.ctx, this));
|
|
1131
1200
|
}
|
|
1201
|
+
get updatePinConversations() {
|
|
1202
|
+
return (this._cache.updatePinConversations ??= updatePinConversationsFactory(this.ctx, this));
|
|
1203
|
+
}
|
|
1132
1204
|
get updateProductCatalog() {
|
|
1133
1205
|
return (this._cache.updateProductCatalog ??= updateProductCatalogFactory(this.ctx, this));
|
|
1134
1206
|
}
|
|
@@ -1159,6 +1231,9 @@ export class API {
|
|
|
1159
1231
|
get verifyCloudMedia() {
|
|
1160
1232
|
return (this._cache.verifyCloudMedia ??= verifyCloudMediaFactory(this.ctx, this));
|
|
1161
1233
|
}
|
|
1234
|
+
get verifyFriend() {
|
|
1235
|
+
return (this._cache.verifyFriend ??= verifyFriendFactory(this.ctx, this));
|
|
1236
|
+
}
|
|
1162
1237
|
get voiceToText() {
|
|
1163
1238
|
return (this._cache.voiceToText ??= voiceToTextFactory(this.ctx, this));
|
|
1164
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;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ZaloApiError = require('../../Errors/ZaloApiError.cjs');
|
|
4
|
+
var utils = require('../../utils.cjs');
|
|
5
|
+
|
|
6
|
+
const checkQuotaCommunityMemberFactory = utils.apiFactory()((api, ctx, utils) => {
|
|
7
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.group[0]}/api/group/quota/members-comm`);
|
|
8
|
+
/**
|
|
9
|
+
* Kiểm tra điều kiện/hạn mức thành viên Cộng đồng đối với một thành viên cụ thể trong nhóm (command 12182)
|
|
10
|
+
*
|
|
11
|
+
* @param groupId ID của nhóm
|
|
12
|
+
* @param uid UID của thành viên cần kiểm tra
|
|
13
|
+
* @throws {ZaloApiError}
|
|
14
|
+
*/
|
|
15
|
+
return async function checkQuotaCommunityMember(groupId, uid) {
|
|
16
|
+
if (!groupId) {
|
|
17
|
+
throw new ZaloApiError.ZaloApiError("Missing groupId");
|
|
18
|
+
}
|
|
19
|
+
if (!uid) {
|
|
20
|
+
throw new ZaloApiError.ZaloApiError("Missing uid");
|
|
21
|
+
}
|
|
22
|
+
const cleanGroupId = groupId.startsWith("g") ? groupId.slice(1) : groupId;
|
|
23
|
+
const params = {
|
|
24
|
+
language: ctx.language || "vi",
|
|
25
|
+
grId: cleanGroupId,
|
|
26
|
+
uid: String(uid),
|
|
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(utils.makeURL(serviceURL, { params: encryptedParams }), {
|
|
33
|
+
method: "GET",
|
|
34
|
+
});
|
|
35
|
+
return utils.resolve(response);
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
exports.checkQuotaCommunityMemberFactory = checkQuotaCommunityMemberFactory;
|