zalo-toolkit 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (393) hide show
  1. package/dist/Errors/ZaloApiError.d.ts +4 -0
  2. package/dist/Errors/ZaloApiError.js +7 -0
  3. package/dist/Errors/ZaloApiLoginQRAborted.d.ts +4 -0
  4. package/dist/Errors/ZaloApiLoginQRAborted.js +7 -0
  5. package/dist/Errors/ZaloApiLoginQRDeclined.d.ts +4 -0
  6. package/dist/Errors/ZaloApiLoginQRDeclined.js +7 -0
  7. package/dist/Errors/ZaloApiMissingImageMetadataGetter.d.ts +4 -0
  8. package/dist/Errors/ZaloApiMissingImageMetadataGetter.js +7 -0
  9. package/dist/Errors/index.d.ts +4 -0
  10. package/dist/Errors/index.js +4 -0
  11. package/dist/apis/acceptFriendRequest.d.ts +2 -0
  12. package/dist/apis/acceptFriendRequest.js +28 -0
  13. package/dist/apis/addGroupBlockedMember.d.ts +2 -0
  14. package/dist/apis/addGroupBlockedMember.js +28 -0
  15. package/dist/apis/addGroupDeputy.d.ts +2 -0
  16. package/dist/apis/addGroupDeputy.js +31 -0
  17. package/dist/apis/addPollOptions.d.ts +14 -0
  18. package/dist/apis/addPollOptions.js +26 -0
  19. package/dist/apis/addQuickMessage.d.ts +11 -0
  20. package/dist/apis/addQuickMessage.js +60 -0
  21. package/dist/apis/addReaction.d.ts +19 -0
  22. package/dist/apis/addReaction.js +292 -0
  23. package/dist/apis/addUnreadMark.d.ts +8 -0
  24. package/dist/apis/addUnreadMark.js +52 -0
  25. package/dist/apis/addUserToGroup.d.ts +5 -0
  26. package/dist/apis/addUserToGroup.js +34 -0
  27. package/dist/apis/blockUser.d.ts +2 -0
  28. package/dist/apis/blockUser.js +28 -0
  29. package/dist/apis/blockViewFeed.d.ts +2 -0
  30. package/dist/apis/blockViewFeed.js +30 -0
  31. package/dist/apis/changeAccountAvatar.d.ts +2 -0
  32. package/dist/apis/changeAccountAvatar.js +51 -0
  33. package/dist/apis/changeFriendAlias.d.ts +2 -0
  34. package/dist/apis/changeFriendAlias.js +27 -0
  35. package/dist/apis/changeGroupAvatar.d.ts +2 -0
  36. package/dist/apis/changeGroupAvatar.js +42 -0
  37. package/dist/apis/changeGroupName.d.ts +4 -0
  38. package/dist/apis/changeGroupName.js +32 -0
  39. package/dist/apis/changeGroupOwner.d.ts +4 -0
  40. package/dist/apis/changeGroupOwner.js +31 -0
  41. package/dist/apis/createAutoReply.d.ts +14 -0
  42. package/dist/apis/createAutoReply.js +37 -0
  43. package/dist/apis/createCatalog.d.ts +7 -0
  44. package/dist/apis/createCatalog.js +29 -0
  45. package/dist/apis/createGroup.d.ts +22 -0
  46. package/dist/apis/createGroup.js +43 -0
  47. package/dist/apis/createNote.d.ts +7 -0
  48. package/dist/apis/createNote.js +47 -0
  49. package/dist/apis/createPoll.d.ts +55 -0
  50. package/dist/apis/createPoll.js +40 -0
  51. package/dist/apis/createProductCatalog.d.ts +23 -0
  52. package/dist/apis/createProductCatalog.js +50 -0
  53. package/dist/apis/createReminder.d.ts +12 -0
  54. package/dist/apis/createReminder.js +63 -0
  55. package/dist/apis/custom.d.ts +9 -0
  56. package/dist/apis/custom.js +15 -0
  57. package/dist/apis/deleteAutoReply.d.ts +5 -0
  58. package/dist/apis/deleteAutoReply.js +29 -0
  59. package/dist/apis/deleteAvatar.d.ts +9 -0
  60. package/dist/apis/deleteAvatar.js +27 -0
  61. package/dist/apis/deleteCatalog.d.ts +2 -0
  62. package/dist/apis/deleteCatalog.js +28 -0
  63. package/dist/apis/deleteChat.d.ts +19 -0
  64. package/dist/apis/deleteChat.js +50 -0
  65. package/dist/apis/deleteGroupInviteBox.d.ts +9 -0
  66. package/dist/apis/deleteGroupInviteBox.js +27 -0
  67. package/dist/apis/deleteMessage.d.ts +14 -0
  68. package/dist/apis/deleteMessage.js +52 -0
  69. package/dist/apis/deleteProductCatalog.d.ts +10 -0
  70. package/dist/apis/deleteProductCatalog.js +31 -0
  71. package/dist/apis/disableGroupLink.d.ts +2 -0
  72. package/dist/apis/disableGroupLink.js +24 -0
  73. package/dist/apis/disperseGroup.d.ts +2 -0
  74. package/dist/apis/disperseGroup.js +28 -0
  75. package/dist/apis/editNote.d.ts +17 -0
  76. package/dist/apis/editNote.js +46 -0
  77. package/dist/apis/editReminder.d.ts +13 -0
  78. package/dist/apis/editReminder.js +61 -0
  79. package/dist/apis/enableGroupLink.d.ts +6 -0
  80. package/dist/apis/enableGroupLink.js +25 -0
  81. package/dist/apis/fetchAccountInfo.d.ts +3 -0
  82. package/dist/apis/fetchAccountInfo.js +10 -0
  83. package/dist/apis/findUser.d.ts +15 -0
  84. package/dist/apis/findUser.js +40 -0
  85. package/dist/apis/forwardAttachment.d.ts +16 -0
  86. package/dist/apis/forwardAttachment.js +80 -0
  87. package/dist/apis/forwardMessage.d.ts +33 -0
  88. package/dist/apis/forwardMessage.js +119 -0
  89. package/dist/apis/getAliasList.d.ts +8 -0
  90. package/dist/apis/getAliasList.js +28 -0
  91. package/dist/apis/getAllFriends.d.ts +3 -0
  92. package/dist/apis/getAllFriends.js +32 -0
  93. package/dist/apis/getAllGroups.d.ts +7 -0
  94. package/dist/apis/getAllGroups.js +10 -0
  95. package/dist/apis/getArchivedChatList.d.ts +5 -0
  96. package/dist/apis/getArchivedChatList.js +23 -0
  97. package/dist/apis/getAutoDeleteChat.d.ts +9 -0
  98. package/dist/apis/getAutoDeleteChat.js +21 -0
  99. package/dist/apis/getAutoReplyList.d.ts +6 -0
  100. package/dist/apis/getAutoReplyList.js +24 -0
  101. package/dist/apis/getAvatarList.d.ts +12 -0
  102. package/dist/apis/getAvatarList.js +28 -0
  103. package/dist/apis/getBizAccount.d.ts +24 -0
  104. package/dist/apis/getBizAccount.js +27 -0
  105. package/dist/apis/getCatalogList.d.ts +18 -0
  106. package/dist/apis/getCatalogList.js +32 -0
  107. package/dist/apis/getContext.d.ts +1 -0
  108. package/dist/apis/getContext.js +4 -0
  109. package/dist/apis/getCookie.d.ts +1 -0
  110. package/dist/apis/getCookie.js +9 -0
  111. package/dist/apis/getFriendBoardList.d.ts +5 -0
  112. package/dist/apis/getFriendBoardList.js +26 -0
  113. package/dist/apis/getFriendOnlines.d.ts +10 -0
  114. package/dist/apis/getFriendOnlines.js +35 -0
  115. package/dist/apis/getFriendRecommendations.d.ts +42 -0
  116. package/dist/apis/getFriendRecommendations.js +27 -0
  117. package/dist/apis/getFriendRequestStatus.d.ts +8 -0
  118. package/dist/apis/getFriendRequestStatus.js +25 -0
  119. package/dist/apis/getGroupBlockedMember.d.ts +23 -0
  120. package/dist/apis/getGroupBlockedMember.js +29 -0
  121. package/dist/apis/getGroupInfo.d.ts +16 -0
  122. package/dist/apis/getGroupInfo.js +32 -0
  123. package/dist/apis/getGroupInviteBoxInfo.d.ts +32 -0
  124. package/dist/apis/getGroupInviteBoxInfo.js +38 -0
  125. package/dist/apis/getGroupInviteBoxList.d.ts +38 -0
  126. package/dist/apis/getGroupInviteBoxList.js +31 -0
  127. package/dist/apis/getGroupLinkDetail.d.ts +9 -0
  128. package/dist/apis/getGroupLinkDetail.js +25 -0
  129. package/dist/apis/getGroupLinkInfo.d.ts +34 -0
  130. package/dist/apis/getGroupLinkInfo.js +28 -0
  131. package/dist/apis/getGroupMembersInfo.d.ts +17 -0
  132. package/dist/apis/getGroupMembersInfo.js +24 -0
  133. package/dist/apis/getHiddenConversations.d.ts +11 -0
  134. package/dist/apis/getHiddenConversations.js +23 -0
  135. package/dist/apis/getLabels.d.ts +7 -0
  136. package/dist/apis/getLabels.js +28 -0
  137. package/dist/apis/getLastMessage.d.ts +9 -0
  138. package/dist/apis/getLastMessage.js +20 -0
  139. package/dist/apis/getListBoard.d.ts +21 -0
  140. package/dist/apis/getListBoard.js +45 -0
  141. package/dist/apis/getListReminder.d.ts +28 -0
  142. package/dist/apis/getListReminder.js +47 -0
  143. package/dist/apis/getMute.d.ts +13 -0
  144. package/dist/apis/getMute.js +22 -0
  145. package/dist/apis/getOwnId.d.ts +1 -0
  146. package/dist/apis/getOwnId.js +4 -0
  147. package/dist/apis/getPendingGroupMembers.d.ts +11 -0
  148. package/dist/apis/getPendingGroupMembers.js +27 -0
  149. package/dist/apis/getPinConversations.d.ts +5 -0
  150. package/dist/apis/getPinConversations.js +22 -0
  151. package/dist/apis/getPollDetail.d.ts +3 -0
  152. package/dist/apis/getPollDetail.js +30 -0
  153. package/dist/apis/getProductCatalogList.d.ts +20 -0
  154. package/dist/apis/getProductCatalogList.js +33 -0
  155. package/dist/apis/getQR.d.ts +4 -0
  156. package/dist/apis/getQR.js +29 -0
  157. package/dist/apis/getQuickMessageList.d.ts +7 -0
  158. package/dist/apis/getQuickMessageList.js +24 -0
  159. package/dist/apis/getRecommendFriends.d.ts +40 -0
  160. package/dist/apis/getRecommendFriends.js +20 -0
  161. package/dist/apis/getRelatedFriendGroup.d.ts +6 -0
  162. package/dist/apis/getRelatedFriendGroup.js +30 -0
  163. package/dist/apis/getReminder.d.ts +3 -0
  164. package/dist/apis/getReminder.js +25 -0
  165. package/dist/apis/getReminderResponses.d.ts +5 -0
  166. package/dist/apis/getReminderResponses.js +24 -0
  167. package/dist/apis/getSentFriendRequest.d.ts +18 -0
  168. package/dist/apis/getSentFriendRequest.js +24 -0
  169. package/dist/apis/getSettings.d.ts +3 -0
  170. package/dist/apis/getSettings.js +20 -0
  171. package/dist/apis/getStickers.d.ts +1 -0
  172. package/dist/apis/getStickers.js +40 -0
  173. package/dist/apis/getStickersDetail.d.ts +24 -0
  174. package/dist/apis/getStickersDetail.js +40 -0
  175. package/dist/apis/getUnreadMark.d.ts +14 -0
  176. package/dist/apis/getUnreadMark.js +30 -0
  177. package/dist/apis/getUserInfo.d.ts +8 -0
  178. package/dist/apis/getUserInfo.js +42 -0
  179. package/dist/apis/inviteUserToGroups.d.ts +10 -0
  180. package/dist/apis/inviteUserToGroups.js +30 -0
  181. package/dist/apis/joinGroupInviteBox.d.ts +2 -0
  182. package/dist/apis/joinGroupInviteBox.js +25 -0
  183. package/dist/apis/joinGroupLink.d.ts +2 -0
  184. package/dist/apis/joinGroupLink.js +27 -0
  185. package/dist/apis/keepAlive.d.ts +4 -0
  186. package/dist/apis/keepAlive.js +22 -0
  187. package/dist/apis/lastOnline.d.ts +7 -0
  188. package/dist/apis/lastOnline.js +26 -0
  189. package/dist/apis/leaveGroup.d.ts +4 -0
  190. package/dist/apis/leaveGroup.js +33 -0
  191. package/dist/apis/listen.d.ts +141 -0
  192. package/dist/apis/listen.js +822 -0
  193. package/dist/apis/lockPoll.d.ts +2 -0
  194. package/dist/apis/lockPoll.js +28 -0
  195. package/dist/apis/login.d.ts +3 -0
  196. package/dist/apis/login.js +96 -0
  197. package/dist/apis/loginQR.d.ts +42 -0
  198. package/dist/apis/loginQR.js +274 -0
  199. package/dist/apis/parseLink.d.ts +21 -0
  200. package/dist/apis/parseLink.js +27 -0
  201. package/dist/apis/rejectFriendRequest.d.ts +2 -0
  202. package/dist/apis/rejectFriendRequest.js +27 -0
  203. package/dist/apis/removeFriend.d.ts +2 -0
  204. package/dist/apis/removeFriend.js +28 -0
  205. package/dist/apis/removeFriendAlias.d.ts +2 -0
  206. package/dist/apis/removeFriendAlias.js +24 -0
  207. package/dist/apis/removeGroupBlockedMember.d.ts +2 -0
  208. package/dist/apis/removeGroupBlockedMember.js +28 -0
  209. package/dist/apis/removeGroupDeputy.d.ts +2 -0
  210. package/dist/apis/removeGroupDeputy.js +30 -0
  211. package/dist/apis/removeQuickMessage.d.ts +5 -0
  212. package/dist/apis/removeQuickMessage.js +27 -0
  213. package/dist/apis/removeReminder.d.ts +3 -0
  214. package/dist/apis/removeReminder.js +40 -0
  215. package/dist/apis/removeUnreadMark.d.ts +8 -0
  216. package/dist/apis/removeUnreadMark.js +50 -0
  217. package/dist/apis/removeUserFromGroup.d.ts +4 -0
  218. package/dist/apis/removeUserFromGroup.js +34 -0
  219. package/dist/apis/resetHiddenConversPin.d.ts +2 -0
  220. package/dist/apis/resetHiddenConversPin.js +20 -0
  221. package/dist/apis/reuseAvatar.d.ts +2 -0
  222. package/dist/apis/reuseAvatar.js +26 -0
  223. package/dist/apis/reviewPendingMemberRequest.d.ts +14 -0
  224. package/dist/apis/reviewPendingMemberRequest.js +38 -0
  225. package/dist/apis/sendBankCard.d.ts +9 -0
  226. package/dist/apis/sendBankCard.js +37 -0
  227. package/dist/apis/sendCard.d.ts +10 -0
  228. package/dist/apis/sendCard.js +59 -0
  229. package/dist/apis/sendDeliveredEvent.d.ts +16 -0
  230. package/dist/apis/sendDeliveredEvent.js +55 -0
  231. package/dist/apis/sendFriendRequest.d.ts +2 -0
  232. package/dist/apis/sendFriendRequest.js +39 -0
  233. package/dist/apis/sendLink.d.ts +10 -0
  234. package/dist/apis/sendLink.js +57 -0
  235. package/dist/apis/sendMessage.d.ts +100 -0
  236. package/dist/apis/sendMessage.js +437 -0
  237. package/dist/apis/sendReport.d.ts +17 -0
  238. package/dist/apis/sendReport.js +53 -0
  239. package/dist/apis/sendSeenEvent.d.ts +16 -0
  240. package/dist/apis/sendSeenEvent.js +63 -0
  241. package/dist/apis/sendSticker.d.ts +10 -0
  242. package/dist/apis/sendSticker.js +56 -0
  243. package/dist/apis/sendTypingEvent.d.ts +5 -0
  244. package/dist/apis/sendTypingEvent.js +33 -0
  245. package/dist/apis/sendVideo.d.ts +35 -0
  246. package/dist/apis/sendVideo.js +118 -0
  247. package/dist/apis/sendVoice.d.ts +12 -0
  248. package/dist/apis/sendVoice.js +73 -0
  249. package/dist/apis/setArchivedConversations.d.ts +10 -0
  250. package/dist/apis/setArchivedConversations.js +34 -0
  251. package/dist/apis/setHiddenConversations.d.ts +3 -0
  252. package/dist/apis/setHiddenConversations.js +39 -0
  253. package/dist/apis/setMute.d.ts +20 -0
  254. package/dist/apis/setMute.js +67 -0
  255. package/dist/apis/setPinnedConversations.d.ts +3 -0
  256. package/dist/apis/setPinnedConversations.js +34 -0
  257. package/dist/apis/sharePoll.d.ts +2 -0
  258. package/dist/apis/sharePoll.js +28 -0
  259. package/dist/apis/unblockUser.d.ts +2 -0
  260. package/dist/apis/unblockUser.js +28 -0
  261. package/dist/apis/undo.d.ts +9 -0
  262. package/dist/apis/undo.js +42 -0
  263. package/dist/apis/undoFriendRequest.d.ts +2 -0
  264. package/dist/apis/undoFriendRequest.js +27 -0
  265. package/dist/apis/updateActiveStatus.d.ts +4 -0
  266. package/dist/apis/updateActiveStatus.js +27 -0
  267. package/dist/apis/updateAutoDeleteChat.d.ts +9 -0
  268. package/dist/apis/updateAutoDeleteChat.js +40 -0
  269. package/dist/apis/updateAutoReply.d.ts +15 -0
  270. package/dist/apis/updateAutoReply.js +38 -0
  271. package/dist/apis/updateCatalog.d.ts +11 -0
  272. package/dist/apis/updateCatalog.js +30 -0
  273. package/dist/apis/updateGroupSettings.d.ts +40 -0
  274. package/dist/apis/updateGroupSettings.js +43 -0
  275. package/dist/apis/updateHiddenConversPin.d.ts +2 -0
  276. package/dist/apis/updateHiddenConversPin.js +30 -0
  277. package/dist/apis/updateLabels.d.ts +15 -0
  278. package/dist/apis/updateLabels.js +34 -0
  279. package/dist/apis/updateLang.d.ts +6 -0
  280. package/dist/apis/updateLang.js +30 -0
  281. package/dist/apis/updateProductCatalog.d.ts +25 -0
  282. package/dist/apis/updateProductCatalog.js +51 -0
  283. package/dist/apis/updateProfile.d.ts +20 -0
  284. package/dist/apis/updateProfile.js +43 -0
  285. package/dist/apis/updateQuickMessage.d.ts +11 -0
  286. package/dist/apis/updateQuickMessage.js +61 -0
  287. package/dist/apis/updateSettings.d.ts +16 -0
  288. package/dist/apis/updateSettings.js +90 -0
  289. package/dist/apis/uploadAttachment.d.ts +51 -0
  290. package/dist/apis/uploadAttachment.js +195 -0
  291. package/dist/apis/uploadProductPhoto.d.ts +13 -0
  292. package/dist/apis/uploadProductPhoto.js +45 -0
  293. package/dist/apis/votePoll.d.ts +5 -0
  294. package/dist/apis/votePoll.js +29 -0
  295. package/dist/apis.d.ts +293 -0
  296. package/dist/apis.js +287 -0
  297. package/dist/cjs/Errors/ZaloApiError.cjs +11 -0
  298. package/dist/cjs/Errors/ZaloApiLoginQRAborted.cjs +12 -0
  299. package/dist/cjs/Errors/ZaloApiLoginQRDeclined.cjs +12 -0
  300. package/dist/cjs/Errors/ZaloApiMissingImageMetadataGetter.cjs +12 -0
  301. package/dist/cjs/apis/login.cjs +102 -0
  302. package/dist/cjs/apis/loginQR.cjs +282 -0
  303. package/dist/cjs/apis/reviewPendingMemberRequest.cjs +21 -0
  304. package/dist/cjs/apis/sendMessage.cjs +44 -0
  305. package/dist/cjs/apis/sendReport.cjs +28 -0
  306. package/dist/cjs/apis/setMute.cjs +33 -0
  307. package/dist/cjs/apis/updateAutoDeleteChat.cjs +28 -0
  308. package/dist/cjs/apis/updateLang.cjs +19 -0
  309. package/dist/cjs/apis/updateSettings.cjs +29 -0
  310. package/dist/cjs/context.cjs +19 -0
  311. package/dist/cjs/index.cjs +142 -0
  312. package/dist/cjs/models/AutoReply.cjs +9 -0
  313. package/dist/cjs/models/Board.cjs +8 -0
  314. package/dist/cjs/models/DeliveredMessage.cjs +23 -0
  315. package/dist/cjs/models/Enum.cjs +253 -0
  316. package/dist/cjs/models/FriendEvent.cjs +87 -0
  317. package/dist/cjs/models/Group.cjs +13 -0
  318. package/dist/cjs/models/GroupEvent.cjs +94 -0
  319. package/dist/cjs/models/Listen.cjs +134 -0
  320. package/dist/cjs/models/Message.cjs +40 -0
  321. package/dist/cjs/models/Reaction.cjs +74 -0
  322. package/dist/cjs/models/Reminder.cjs +9 -0
  323. package/dist/cjs/models/SeenMessage.cjs +23 -0
  324. package/dist/cjs/models/Typing.cjs +23 -0
  325. package/dist/cjs/models/Undo.cjs +16 -0
  326. package/dist/cjs/models/ZBusiness.cjs +39 -0
  327. package/dist/cjs/utils.cjs +320 -0
  328. package/dist/cjs/zalo.cjs +127 -0
  329. package/dist/context.d.ts +199 -0
  330. package/dist/context.js +27 -0
  331. package/dist/core/enums/common.d.ts +11 -0
  332. package/dist/core/enums/common.js +12 -0
  333. package/dist/core/interfaces/common.d.ts +7 -0
  334. package/dist/core/interfaces/common.js +1 -0
  335. package/dist/core/utils/deserializer.d.ts +4 -0
  336. package/dist/core/utils/deserializer.js +25 -0
  337. package/dist/core/utils/index.d.ts +2 -0
  338. package/dist/core/utils/index.js +28 -0
  339. package/dist/core/utils/serializer.d.ts +9 -0
  340. package/dist/core/utils/serializer.js +24 -0
  341. package/dist/index.d.ts +144 -0
  342. package/dist/index.js +12 -0
  343. package/dist/models/AutoReply.d.ts +20 -0
  344. package/dist/models/AutoReply.js +7 -0
  345. package/dist/models/Board.d.ts +60 -0
  346. package/dist/models/Board.js +6 -0
  347. package/dist/models/Catalog.d.ts +16 -0
  348. package/dist/models/Catalog.js +1 -0
  349. package/dist/models/DeliveredMessage.d.ts +27 -0
  350. package/dist/models/DeliveredMessage.js +17 -0
  351. package/dist/models/Enum.d.ts +247 -0
  352. package/dist/models/Enum.js +251 -0
  353. package/dist/models/FriendEvent.d.ts +107 -0
  354. package/dist/models/FriendEvent.js +83 -0
  355. package/dist/models/Group.d.ts +125 -0
  356. package/dist/models/Group.js +11 -0
  357. package/dist/models/GroupEvent.d.ts +178 -0
  358. package/dist/models/GroupEvent.js +90 -0
  359. package/dist/models/Label.d.ts +10 -0
  360. package/dist/models/Label.js +1 -0
  361. package/dist/models/Listen.d.ts +186 -0
  362. package/dist/models/Listen.js +194 -0
  363. package/dist/models/Message.d.ts +97 -0
  364. package/dist/models/Message.js +34 -0
  365. package/dist/models/Mute.d.ts +10 -0
  366. package/dist/models/Mute.js +1 -0
  367. package/dist/models/ProductCatalog.d.ts +17 -0
  368. package/dist/models/ProductCatalog.js +1 -0
  369. package/dist/models/QuickMessage.d.ts +25 -0
  370. package/dist/models/QuickMessage.js +1 -0
  371. package/dist/models/Reaction.d.ts +85 -0
  372. package/dist/models/Reaction.js +70 -0
  373. package/dist/models/Reminder.d.ts +51 -0
  374. package/dist/models/Reminder.js +7 -0
  375. package/dist/models/SeenMessage.d.ts +26 -0
  376. package/dist/models/SeenMessage.js +17 -0
  377. package/dist/models/Typing.d.ts +24 -0
  378. package/dist/models/Typing.js +17 -0
  379. package/dist/models/Undo.d.ts +34 -0
  380. package/dist/models/Undo.js +12 -0
  381. package/dist/models/User.d.ts +49 -0
  382. package/dist/models/User.js +1 -0
  383. package/dist/models/ZBusiness.d.ts +22 -0
  384. package/dist/models/ZBusiness.js +35 -0
  385. package/dist/models/index.d.ts +19 -0
  386. package/dist/models/index.js +19 -0
  387. package/dist/socket/config-socket.d.ts +38 -0
  388. package/dist/socket/config-socket.js +202 -0
  389. package/dist/utils.d.ts +190 -0
  390. package/dist/utils.js +749 -0
  391. package/dist/zalo.d.ts +64 -0
  392. package/dist/zalo.js +103 -0
  393. package/package.json +61 -0
@@ -0,0 +1,42 @@
1
+ import { ZaloApiError } from '../Errors/ZaloApiError.js';
2
+ import { ThreadType } from '../models/index.js';
3
+ import { apiFactory } from '../utils.js';
4
+ export const undoFactory = apiFactory()((api, ctx, utils) => {
5
+ const URLType = {
6
+ [ThreadType.User]: utils.makeURL(`${api.zpwServiceMap.chat[0]}/api/message/undo`),
7
+ [ThreadType.Group]: utils.makeURL(`${api.zpwServiceMap.group[0]}/api/group/undomsg`),
8
+ };
9
+ /**
10
+ * Undo a message
11
+ *
12
+ * @param payload Undo payload containing message ID and client message ID
13
+ * @param threadId group or user id
14
+ * @param type Message type (User or Group), default is User
15
+ *
16
+ * @throws {ZaloApiError}
17
+ */
18
+ return async function undo(payload, threadId, type = ThreadType.User) {
19
+ const params = {
20
+ msgId: payload.msgId,
21
+ clientId: Date.now(),
22
+ cliMsgIdUndo: payload.cliMsgId,
23
+ };
24
+ if (type == ThreadType.Group) {
25
+ params['grid'] = threadId;
26
+ params['visibility'] = 0;
27
+ params['imei'] = ctx.imei;
28
+ }
29
+ else
30
+ params['toid'] = threadId;
31
+ const encryptedParams = utils.encodeAES(JSON.stringify(params));
32
+ if (!encryptedParams)
33
+ throw new ZaloApiError('Failed to encrypt message');
34
+ const response = await utils.request(URLType[type], {
35
+ method: 'POST',
36
+ body: new URLSearchParams({
37
+ params: encryptedParams,
38
+ }),
39
+ });
40
+ return utils.resolve(response);
41
+ };
42
+ });
@@ -0,0 +1,2 @@
1
+ export type UndoFriendRequestResponse = '';
2
+ export declare const undoFriendRequestFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").ZaloAPI) => (friendId: string) => Promise<"">;
@@ -0,0 +1,27 @@
1
+ import { ZaloApiError } from '../Errors/ZaloApiError.js';
2
+ import { apiFactory } from '../utils.js';
3
+ export const undoFriendRequestFactory = apiFactory()((api, _ctx, utils) => {
4
+ const serviceURL = utils.makeURL(`${api.zpwServiceMap.friend[0]}/api/friend/undo`);
5
+ /**
6
+ * Undo send a friend request to a user.
7
+ *
8
+ * @param options
9
+ *
10
+ * @throws {ZaloApiError}
11
+ */
12
+ return async function undoFriendRequest(friendId) {
13
+ const params = {
14
+ fid: friendId,
15
+ };
16
+ const encryptedParams = utils.encodeAES(JSON.stringify(params));
17
+ if (!encryptedParams)
18
+ throw new ZaloApiError('Failed to encrypt params');
19
+ const response = await utils.request(serviceURL, {
20
+ method: 'POST',
21
+ body: new URLSearchParams({
22
+ params: encryptedParams,
23
+ }),
24
+ });
25
+ return utils.resolve(response);
26
+ };
27
+ });
@@ -0,0 +1,4 @@
1
+ export type UpdateActiveStatusResponse = {
2
+ status: boolean;
3
+ };
4
+ export declare const updateActiveStatusFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").ZaloAPI) => (active: boolean) => Promise<UpdateActiveStatusResponse>;
@@ -0,0 +1,27 @@
1
+ import { ZaloApiError } from '../Errors/ZaloApiError.js';
2
+ import { apiFactory } from '../utils.js';
3
+ export const updateActiveStatusFactory = apiFactory()((api, ctx, utils) => {
4
+ const pingURL = utils.makeURL(`${api.zpwServiceMap.profile[0]}/api/social/profile/ping`);
5
+ const deactiveURL = utils.makeURL(`${api.zpwServiceMap.profile[0]}/api/social/profile/deactive`);
6
+ /**
7
+ * Update active status?
8
+ *
9
+ * @param active
10
+ *
11
+ * @throws {ZaloApiError}
12
+ */
13
+ return async function updateActiveStatus(active) {
14
+ const params = {
15
+ status: active ? 1 : 0,
16
+ imei: ctx.imei,
17
+ };
18
+ const encryptedParams = utils.encodeAES(JSON.stringify(params));
19
+ if (!encryptedParams)
20
+ throw new ZaloApiError('Failed to encrypt params');
21
+ const targetURL = active ? pingURL : deactiveURL;
22
+ const response = await utils.request(utils.makeURL(targetURL, { params: encryptedParams }), {
23
+ method: 'GET',
24
+ });
25
+ return utils.resolve(response);
26
+ };
27
+ });
@@ -0,0 +1,9 @@
1
+ import { ThreadType } from '../models/index.js';
2
+ export declare enum ChatTTL {
3
+ NO_DELETE = 0,
4
+ ONE_DAY = 86400000,
5
+ SEVEN_DAYS = 604800000,
6
+ FOURTEEN_DAYS = 1209600000
7
+ }
8
+ export type UpdateAutoDeleteChatResponse = '';
9
+ export declare const updateAutoDeleteChatFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").ZaloAPI) => (ttl: ChatTTL, threadId: string, type?: ThreadType) => Promise<"">;
@@ -0,0 +1,40 @@
1
+ import { ZaloApiError } from '../Errors/ZaloApiError.js';
2
+ import { ThreadType } from '../models/index.js';
3
+ import { apiFactory } from '../utils.js';
4
+ export var ChatTTL;
5
+ (function (ChatTTL) {
6
+ ChatTTL[ChatTTL["NO_DELETE"] = 0] = "NO_DELETE";
7
+ ChatTTL[ChatTTL["ONE_DAY"] = 86400000] = "ONE_DAY";
8
+ ChatTTL[ChatTTL["SEVEN_DAYS"] = 604800000] = "SEVEN_DAYS";
9
+ ChatTTL[ChatTTL["FOURTEEN_DAYS"] = 1209600000] = "FOURTEEN_DAYS";
10
+ })(ChatTTL || (ChatTTL = {}));
11
+ export const updateAutoDeleteChatFactory = apiFactory()((api, ctx, utils) => {
12
+ const serviceURL = utils.makeURL(`${api.zpwServiceMap.conversation[0]}/api/conv/autodelete/updateConvers`);
13
+ /**
14
+ * Auto delete chat
15
+ *
16
+ * @param ttl The time to live of the chat
17
+ * @param threadId The thread ID to auto delete chat
18
+ * @param type Type of thread (User or Group)
19
+ *
20
+ * @throws {ZaloApiError}
21
+ */
22
+ return async function updateAutoDeleteChat(ttl, threadId, type = ThreadType.User) {
23
+ const params = {
24
+ threadId: threadId,
25
+ isGroup: type === ThreadType.Group ? 1 : 0,
26
+ ttl: ttl,
27
+ clientLang: ctx.language,
28
+ };
29
+ const encryptedParams = utils.encodeAES(JSON.stringify(params));
30
+ if (!encryptedParams)
31
+ throw new ZaloApiError('Failed to encrypt params');
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
+ });
@@ -0,0 +1,15 @@
1
+ import type { AutoReplyItem, AutoReplyScope } from '../models/index.js';
2
+ export type UpdateAutoReplyPayload = {
3
+ id: number;
4
+ content: string;
5
+ isEnable: boolean;
6
+ startTime: number;
7
+ endTime: number;
8
+ scope: AutoReplyScope;
9
+ uids?: string | string[];
10
+ };
11
+ export type UpdateAutoReplyResponse = {
12
+ item: AutoReplyItem;
13
+ version: number;
14
+ };
15
+ export declare const updateAutoReplyFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").ZaloAPI) => (payload: UpdateAutoReplyPayload) => Promise<UpdateAutoReplyResponse>;
@@ -0,0 +1,38 @@
1
+ import { ZaloApiError } from '../Errors/ZaloApiError.js';
2
+ import { apiFactory } from '../utils.js';
3
+ export const updateAutoReplyFactory = apiFactory()((api, ctx, utils) => {
4
+ const serviceURL = utils.makeURL(`${api.zpwServiceMap.auto_reply[0]}/api/autoreply/update`);
5
+ /**
6
+ * Update auto reply
7
+ *
8
+ * @param payload payload
9
+ *
10
+ * @note this API used for zBusiness
11
+ * @throws {ZaloApiError}
12
+ */
13
+ return async function updateAutoReply(payload) {
14
+ const uids = Array.isArray(payload.uids) ? payload.uids : [payload.uids];
15
+ const resultUids = payload.scope === 2 || payload.scope === 3 ? uids : [];
16
+ const params = {
17
+ cliLang: ctx.language,
18
+ id: payload.id,
19
+ enable: payload.isEnable,
20
+ content: payload.content,
21
+ startTime: payload.startTime,
22
+ endTime: payload.endTime,
23
+ recurrence: ['RRULE:FREQ=DAILY;'],
24
+ scope: payload.scope,
25
+ uids: resultUids,
26
+ };
27
+ const encryptedParams = utils.encodeAES(JSON.stringify(params));
28
+ if (!encryptedParams)
29
+ throw new ZaloApiError('Failed to encrypt params');
30
+ const response = await utils.request(serviceURL, {
31
+ method: 'POST',
32
+ body: new URLSearchParams({
33
+ params: encryptedParams,
34
+ }),
35
+ });
36
+ return utils.resolve(response);
37
+ };
38
+ });
@@ -0,0 +1,11 @@
1
+ import type { CatalogItem } from '../models/index.js';
2
+ export type UpdateCatalogPayload = {
3
+ catalogId: string;
4
+ catalogName: string;
5
+ };
6
+ export type UpdateCatalogResponse = {
7
+ item: CatalogItem;
8
+ version_ls_catalog: number;
9
+ version_catalog: number;
10
+ };
11
+ export declare const updateCatalogFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").ZaloAPI) => (payload: UpdateCatalogPayload) => Promise<UpdateCatalogResponse>;
@@ -0,0 +1,30 @@
1
+ import { ZaloApiError } from '../Errors/ZaloApiError.js';
2
+ import { apiFactory } from '../utils.js';
3
+ export const updateCatalogFactory = apiFactory()((api, _, utils) => {
4
+ const serviceURL = utils.makeURL(`${api.zpwServiceMap.catalog[0]}/api/prodcatalog/catalog/update`);
5
+ /**
6
+ * Update catalog?
7
+ *
8
+ * @param payload payload
9
+ *
10
+ * @note this API is used for zBusiness
11
+ * @throws {ZaloApiError}
12
+ */
13
+ return async function updateCatalog(payload) {
14
+ const params = {
15
+ catalog_id: payload.catalogId,
16
+ catalog_name: payload.catalogName,
17
+ catalog_photo: '', // "" is defaut don't upload photo
18
+ };
19
+ const encryptedParams = utils.encodeAES(JSON.stringify(params));
20
+ if (!encryptedParams)
21
+ throw new ZaloApiError('Failed to encrypt params');
22
+ const response = await utils.request(serviceURL, {
23
+ method: 'POST',
24
+ body: new URLSearchParams({
25
+ params: encryptedParams,
26
+ }),
27
+ });
28
+ return utils.resolve(response);
29
+ };
30
+ });
@@ -0,0 +1,40 @@
1
+ export type UpdateGroupSettingsOptions = {
2
+ /**
3
+ * Disallow group members to change the group name and avatar
4
+ */
5
+ blockName?: boolean;
6
+ /**
7
+ * Highlight messages from owner/admins
8
+ */
9
+ signAdminMsg?: boolean;
10
+ /**
11
+ * Don't pin messages, notes, and polls to the top of a conversation
12
+ */
13
+ setTopicOnly?: boolean;
14
+ /**
15
+ * Allow new members to read most recent messages
16
+ */
17
+ enableMsgHistory?: boolean;
18
+ /**
19
+ * Membership approval
20
+ */
21
+ joinAppr?: boolean;
22
+ /**
23
+ * Disallow group members to create notes & reminders
24
+ */
25
+ lockCreatePost?: boolean;
26
+ /**
27
+ * Disallow group members to create polls
28
+ */
29
+ lockCreatePoll?: boolean;
30
+ /**
31
+ * Disallow group members to send messages
32
+ */
33
+ lockSendMsg?: boolean;
34
+ /**
35
+ * Disallow group members to view full member list (community only)
36
+ */
37
+ lockViewMember?: boolean;
38
+ };
39
+ export type UpdateGroupSettingsResponse = '';
40
+ export declare const updateGroupSettingsFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").ZaloAPI) => (options: UpdateGroupSettingsOptions, groupId: string) => Promise<"">;
@@ -0,0 +1,43 @@
1
+ import { ZaloApiError } from '../Errors/ZaloApiError.js';
2
+ import { apiFactory } from '../utils.js';
3
+ export const updateGroupSettingsFactory = apiFactory()((api, ctx, utils) => {
4
+ const serviceURL = utils.makeURL(`${api.zpwServiceMap.group[0]}/api/group/setting/update`);
5
+ /**
6
+ * Update group settings
7
+ *
8
+ * @param options Options
9
+ * @param groupId Group ID
10
+ *
11
+ * @note Zalo might throw an error with code 166 if you don't have enough permissions to change the settings.
12
+ *
13
+ * @throws {ZaloApiError}
14
+ */
15
+ return async function updateGroupSettings(options, groupId) {
16
+ const params = {
17
+ blockName: options.blockName ? 1 : 0,
18
+ signAdminMsg: options.signAdminMsg ? 1 : 0,
19
+ // addMemberOnly: 0, // very tricky, any idea?
20
+ setTopicOnly: options.setTopicOnly ? 1 : 0,
21
+ enableMsgHistory: options.enableMsgHistory ? 1 : 0,
22
+ joinAppr: options.joinAppr ? 1 : 0,
23
+ lockCreatePost: options.lockCreatePost ? 1 : 0,
24
+ lockCreatePoll: options.lockCreatePoll ? 1 : 0,
25
+ lockSendMsg: options.lockSendMsg ? 1 : 0,
26
+ lockViewMember: options.lockViewMember ? 1 : 0,
27
+ // default values for not implemented options
28
+ bannFeature: 0,
29
+ dirtyMedia: 0,
30
+ banDuration: 0,
31
+ blocked_members: [],
32
+ grid: groupId,
33
+ imei: ctx.imei,
34
+ };
35
+ const encryptedParams = utils.encodeAES(JSON.stringify(params));
36
+ if (!encryptedParams)
37
+ throw new ZaloApiError('Failed to encrypt params');
38
+ const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams }), {
39
+ method: 'GET',
40
+ });
41
+ return utils.resolve(response);
42
+ };
43
+ });
@@ -0,0 +1,2 @@
1
+ export type UpdateHiddenConversPinResponse = '';
2
+ export declare const updateHiddenConversPinFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").ZaloAPI) => (pin: string) => Promise<"">;
@@ -0,0 +1,30 @@
1
+ import { ZaloApiError } from '../Errors/ZaloApiError.js';
2
+ import { apiFactory, encryptPin } from '../utils.js';
3
+ export const updateHiddenConversPinFactory = apiFactory()((api, ctx, utils) => {
4
+ const serviceURL = utils.makeURL(`${api.zpwServiceMap.conversation[0]}/api/hiddenconvers/update-pin`);
5
+ const pinRegex = /^\d{4}$/;
6
+ /**
7
+ * Update hidden conversation pin
8
+ *
9
+ * @param pin The pin to update (must be a 4-digit number between 0000-9999)
10
+ *
11
+ * @throws {ZaloApiError}
12
+ */
13
+ return async function updateHiddenConversPin(pin) {
14
+ if (!pinRegex.test(pin)) {
15
+ throw new ZaloApiError('Pin must be a 4-digit number between 0000-9999');
16
+ }
17
+ const encryptedPin = encryptPin(pin);
18
+ const params = {
19
+ new_pin: encryptedPin,
20
+ imei: ctx.imei,
21
+ };
22
+ const encryptedParams = utils.encodeAES(JSON.stringify(params));
23
+ if (!encryptedParams)
24
+ throw new ZaloApiError('Failed to encrypt params');
25
+ const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams }), {
26
+ method: 'GET',
27
+ });
28
+ return utils.resolve(response);
29
+ };
30
+ });
@@ -0,0 +1,15 @@
1
+ import type { LabelData } from '../models/index.js';
2
+ export type UpdateLabelsPayload = {
3
+ labelData: LabelData[];
4
+ version: number;
5
+ };
6
+ export type UpdateLabelsResponse = {
7
+ labelData: LabelData[];
8
+ version: number;
9
+ lastUpdateTime: number;
10
+ };
11
+ export declare const updateLabelsFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").ZaloAPI) => (payload: UpdateLabelsPayload) => Promise<{
12
+ labelData: any;
13
+ version: number;
14
+ lastUpdateTime: number;
15
+ }>;
@@ -0,0 +1,34 @@
1
+ import { ZaloApiError } from '../Errors/ZaloApiError.js';
2
+ import { apiFactory } from '../utils.js';
3
+ export const updateLabelsFactory = apiFactory()((api, ctx, utils) => {
4
+ const serviceURL = utils.makeURL(`${api.zpwServiceMap.label[0]}/api/convlabel/update`);
5
+ /**
6
+ * Update labels
7
+ *
8
+ * @param label label data
9
+ *
10
+ * @throws {ZaloApiError}
11
+ */
12
+ return async function updateLabels(payload) {
13
+ const params = {
14
+ labelData: JSON.stringify(payload.labelData),
15
+ version: payload.version,
16
+ imei: ctx.imei,
17
+ };
18
+ const encryptedParams = utils.encodeAES(JSON.stringify(params));
19
+ if (!encryptedParams)
20
+ throw new ZaloApiError('Failed to encrypt message');
21
+ const response = await utils.request(serviceURL, {
22
+ method: 'POST',
23
+ body: new URLSearchParams({
24
+ params: encryptedParams,
25
+ }),
26
+ });
27
+ const unFormatted = (await utils.resolve(response));
28
+ return {
29
+ labelData: JSON.parse(unFormatted.labelData),
30
+ version: unFormatted.version,
31
+ lastUpdateTime: unFormatted.lastUpdateTime,
32
+ };
33
+ };
34
+ });
@@ -0,0 +1,6 @@
1
+ export declare enum UpdateLangAvailableLanguages {
2
+ VI = "VI",
3
+ EN = "EN"
4
+ }
5
+ export type UpdateLangResponse = '';
6
+ export declare const updateLangFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").ZaloAPI) => (language?: UpdateLangAvailableLanguages) => Promise<"">;
@@ -0,0 +1,30 @@
1
+ import { ZaloApiError } from '../Errors/ZaloApiError.js';
2
+ import { apiFactory } from '../utils.js';
3
+ export var UpdateLangAvailableLanguages;
4
+ (function (UpdateLangAvailableLanguages) {
5
+ UpdateLangAvailableLanguages["VI"] = "VI";
6
+ UpdateLangAvailableLanguages["EN"] = "EN";
7
+ })(UpdateLangAvailableLanguages || (UpdateLangAvailableLanguages = {}));
8
+ export const updateLangFactory = apiFactory()((api, _, utils) => {
9
+ const serviceURL = utils.makeURL(`${api.zpwServiceMap.profile[0]}/api/social/profile/updatelang`);
10
+ /**
11
+ * Update language?
12
+ *
13
+ * @param language language to update (VI, EN)
14
+ *
15
+ * @note Calling this API alone will not update the user's language.
16
+ * @throws {ZaloApiError}
17
+ */
18
+ return async function updateLang(language = UpdateLangAvailableLanguages.VI) {
19
+ const params = {
20
+ language: language,
21
+ };
22
+ const encryptedParams = utils.encodeAES(JSON.stringify(params));
23
+ if (!encryptedParams)
24
+ throw new ZaloApiError('Failed to encrypt params');
25
+ const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams }), {
26
+ method: 'GET',
27
+ });
28
+ return utils.resolve(response);
29
+ };
30
+ });
@@ -0,0 +1,25 @@
1
+ import type { ProductCatalogItem } from '../models/index.js';
2
+ export type UpdateProductCatalogPayload = {
3
+ catalogId: string;
4
+ productId: string;
5
+ productName: string;
6
+ price: string;
7
+ description: string;
8
+ createTime: number;
9
+ /**
10
+ * Upto 5 media files are allowed, will be ignored if product_photos is provided
11
+ */
12
+ files?: string[];
13
+ /**
14
+ * List of product photo URLs, upto 5
15
+ *
16
+ * You can manually get the URL using `uploadProductPhoto` api
17
+ */
18
+ product_photos?: string[];
19
+ };
20
+ export type UpdateProductCatalogResponse = {
21
+ item: ProductCatalogItem;
22
+ version_ls_catalog: number;
23
+ version_catalog: number;
24
+ };
25
+ export declare const updateProductCatalogFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").ZaloAPI) => (payload: UpdateProductCatalogPayload) => Promise<UpdateProductCatalogResponse>;
@@ -0,0 +1,51 @@
1
+ import { ZaloApiError } from '../Errors/ZaloApiError.js';
2
+ import { apiFactory } from '../utils.js';
3
+ export const updateProductCatalogFactory = apiFactory()((api, _, utils) => {
4
+ const serviceURL = utils.makeURL(`${api.zpwServiceMap.catalog[0]}/api/prodcatalog/product/update`);
5
+ /**
6
+ * Update product catalog?
7
+ *
8
+ * @param payload payload
9
+ *
10
+ * @note this API is used for zBusiness - Maximum 5 media files are supported
11
+ * @throws {ZaloApiError}
12
+ */
13
+ return async function updateProductCatalog(payload) {
14
+ const productPhoto = payload.product_photos || [];
15
+ if (payload.files && payload.files.length == 0) {
16
+ if (payload.files.length > 5) {
17
+ throw new ZaloApiError('Maximum 5 media files are allowed');
18
+ }
19
+ for (const mediaFile of payload.files) {
20
+ const uploadMedia = await api.uploadProductPhoto({
21
+ url: mediaFile,
22
+ });
23
+ const url = uploadMedia.normalUrl || uploadMedia.hdUrl;
24
+ productPhoto.push(url);
25
+ }
26
+ }
27
+ if (productPhoto.length > 5) {
28
+ throw new ZaloApiError('Maximum 5 media files are allowed');
29
+ }
30
+ const params = {
31
+ product_id: payload.productId,
32
+ product_name: payload.productName,
33
+ price: payload.price,
34
+ description: payload.description,
35
+ product_photos: productPhoto,
36
+ catalog_id: payload.catalogId,
37
+ currency_unit: '₫',
38
+ create_time: payload.createTime,
39
+ };
40
+ const encryptedParams = utils.encodeAES(JSON.stringify(params));
41
+ if (!encryptedParams)
42
+ throw new ZaloApiError('Failed to encrypt params');
43
+ const response = await utils.request(serviceURL, {
44
+ method: 'POST',
45
+ body: new URLSearchParams({
46
+ params: encryptedParams,
47
+ }),
48
+ });
49
+ return utils.resolve(response);
50
+ };
51
+ });
@@ -0,0 +1,20 @@
1
+ import type { BusinessCategory, Gender } from '../models/index.js';
2
+ export type UpdateProfilePayload = {
3
+ profile: {
4
+ name: string;
5
+ /**
6
+ * Date of birth in the format YYYY-MM-DD
7
+ */
8
+ dob: `${string}-${string}-${string}`;
9
+ gender: Gender;
10
+ };
11
+ biz?: Partial<{
12
+ cate: BusinessCategory;
13
+ description: string;
14
+ address: string;
15
+ website: string;
16
+ email: string;
17
+ }>;
18
+ };
19
+ export type UpdateProfileResponse = '';
20
+ export declare const updateProfileFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").ZaloAPI) => (payload: UpdateProfilePayload) => Promise<"">;
@@ -0,0 +1,43 @@
1
+ import { ZaloApiError } from '../Errors/ZaloApiError.js';
2
+ import { apiFactory } from '../utils.js';
3
+ export const updateProfileFactory = apiFactory()((api, ctx, utils) => {
4
+ const serviceURL = utils.makeURL(`${api.zpwServiceMap.profile[0]}/api/social/profile/update`);
5
+ /**
6
+ * Change account setting information
7
+ *
8
+ * @param payload payload
9
+ *
10
+ * @note If your account is a Business Account, include the biz.cate field; otherwise the category will be removed.
11
+ * You may leave the other biz fields empty if you don’t want to change them.
12
+ *
13
+ * @throws {ZaloApiError}
14
+ */
15
+ return async function updateProfile(payload) {
16
+ var _a, _b, _c, _d, _e;
17
+ const params = {
18
+ profile: JSON.stringify({
19
+ name: payload.profile.name,
20
+ dob: payload.profile.dob,
21
+ gender: payload.profile.gender,
22
+ }),
23
+ biz: JSON.stringify({
24
+ desc: (_a = payload.biz) === null || _a === void 0 ? void 0 : _a.description,
25
+ cate: (_b = payload.biz) === null || _b === void 0 ? void 0 : _b.cate,
26
+ addr: (_c = payload.biz) === null || _c === void 0 ? void 0 : _c.address,
27
+ website: (_d = payload.biz) === null || _d === void 0 ? void 0 : _d.website,
28
+ email: (_e = payload.biz) === null || _e === void 0 ? void 0 : _e.email,
29
+ }),
30
+ language: ctx.language,
31
+ };
32
+ const encryptedParams = utils.encodeAES(JSON.stringify(params));
33
+ if (!encryptedParams)
34
+ throw new ZaloApiError('Failed to encrypt params');
35
+ const response = await utils.request(serviceURL, {
36
+ method: 'POST',
37
+ body: new URLSearchParams({
38
+ params: encryptedParams,
39
+ }),
40
+ });
41
+ return utils.resolve(response);
42
+ };
43
+ });
@@ -0,0 +1,11 @@
1
+ import type { QuickMessage } from '../models/index.js';
2
+ export type UpdateQuickMessagePayload = {
3
+ keyword: string;
4
+ title: string;
5
+ media?: string;
6
+ };
7
+ export type UpdateQuickMessageResponse = {
8
+ item: QuickMessage;
9
+ version: number;
10
+ };
11
+ export declare const updateQuickMessageFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").ZaloAPI) => (updatePayload: UpdateQuickMessagePayload, itemId: number) => Promise<UpdateQuickMessageResponse>;