@wppconnect/wa-js 1.0.16 → 1.1.3

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 (255) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +68 -0
  3. package/dist/auth/eventEmitter.d.ts +52 -0
  4. package/dist/{blocklist/Blocklist.d.ts → auth/events/index.d.ts} +3 -11
  5. package/dist/{contact/types.d.ts → auth/events/registerChangeEvent.d.ts} +1 -3
  6. package/dist/auth/events/registerIdleEvent.d.ts +16 -0
  7. package/dist/auth/events/registerLogoutEvent.d.ts +16 -0
  8. package/dist/auth/functions/getAuthCode.d.ts +22 -0
  9. package/dist/{contact/Contact.d.ts → auth/functions/index.d.ts} +7 -11
  10. package/dist/auth/functions/isAuthenticated.d.ts +16 -0
  11. package/dist/auth/functions/isIdle.d.ts +16 -0
  12. package/dist/auth/functions/isMultiDevice.d.ts +16 -0
  13. package/dist/auth/functions/logout.d.ts +16 -0
  14. package/dist/auth/functions/poke.d.ts +16 -0
  15. package/dist/auth/functions/setMultiDevice.d.ts +23 -0
  16. package/dist/auth/index.d.ts +3 -4
  17. package/dist/auth/types.d.ts +0 -5
  18. package/dist/blocklist/eventEmitter.d.ts +49 -0
  19. package/dist/blocklist/events/index.d.ts +16 -0
  20. package/dist/blocklist/events/registerSyncedEvent.d.ts +16 -0
  21. package/dist/blocklist/functions/all.d.ts +17 -0
  22. package/dist/blocklist/functions/blockContact.d.ts +18 -0
  23. package/dist/blocklist/functions/index.d.ts +19 -0
  24. package/dist/blocklist/functions/isBlocked.d.ts +17 -0
  25. package/dist/blocklist/functions/unblockContact.d.ts +18 -0
  26. package/dist/blocklist/index.d.ts +3 -5
  27. package/dist/blocklist/types.d.ts +0 -3
  28. package/dist/chat/defaultSendMessageOptions.d.ts +19 -0
  29. package/dist/chat/eventEmitter.d.ts +107 -0
  30. package/dist/chat/events/index.d.ts +18 -0
  31. package/dist/chat/events/registerAckMessageEvent.d.ts +16 -0
  32. package/dist/chat/events/registerLiveLocationUpdateEvent.d.ts +16 -0
  33. package/dist/chat/events/registerRevokeMessageEvent.d.ts +16 -0
  34. package/dist/chat/functions/clear.d.ts +26 -0
  35. package/dist/chat/functions/delete.d.ts +26 -0
  36. package/dist/chat/functions/deleteMessage.d.ts +35 -0
  37. package/dist/chat/functions/downloadMedia.d.ts +21 -0
  38. package/dist/chat/functions/find.d.ts +24 -0
  39. package/dist/chat/functions/generateMessageID.d.ts +22 -0
  40. package/dist/chat/functions/get.d.ts +22 -0
  41. package/dist/chat/functions/getMessageById.d.ts +35 -0
  42. package/dist/chat/functions/getMessages.d.ts +48 -0
  43. package/dist/chat/functions/index.d.ts +37 -0
  44. package/dist/chat/functions/markIsComposing.d.ts +31 -0
  45. package/dist/chat/functions/markIsPaused.d.ts +27 -0
  46. package/dist/chat/functions/markIsRead.d.ts +30 -0
  47. package/dist/chat/functions/markIsRecording.d.ts +31 -0
  48. package/dist/chat/functions/markIsUnread.d.ts +29 -0
  49. package/dist/chat/functions/prepareLinkPreview.d.ts +53 -0
  50. package/dist/chat/functions/prepareMessageButtons.d.ts +40 -0
  51. package/dist/chat/functions/prepareRawMessage.d.ts +23 -0
  52. package/dist/chat/functions/sendFileMessage.d.ts +116 -0
  53. package/dist/{group/types.d.ts → chat/functions/sendListMessage.d.ts} +26 -25
  54. package/dist/chat/functions/sendRawMessage.d.ts +22 -0
  55. package/dist/chat/functions/sendTextMessage.d.ts +23 -0
  56. package/dist/chat/functions/sendVCardContactMessage.d.ts +27 -0
  57. package/dist/chat/index.d.ts +4 -4
  58. package/dist/chat/types.d.ts +0 -105
  59. package/dist/contact/eventEmitter.d.ts +48 -0
  60. package/dist/contact/functions/index.d.ts +16 -0
  61. package/dist/contact/functions/queryExists.d.ts +20 -0
  62. package/dist/contact/index.d.ts +2 -5
  63. package/dist/group/eventEmitter.d.ts +48 -0
  64. package/dist/group/functions/addParticipants.d.ts +17 -0
  65. package/dist/group/functions/canAdd.d.ts +17 -0
  66. package/dist/group/functions/canDemote.d.ts +17 -0
  67. package/dist/group/functions/canPromote.d.ts +17 -0
  68. package/dist/group/functions/canRemove.d.ts +17 -0
  69. package/dist/group/functions/create.d.ts +25 -0
  70. package/dist/group/functions/demoteParticipants.d.ts +17 -0
  71. package/dist/group/functions/ensureGroup.d.ts +17 -0
  72. package/dist/group/functions/ensureGroupAndParticipants.d.ts +20 -0
  73. package/dist/group/functions/getParticipants.d.ts +25 -0
  74. package/dist/group/functions/iAmAdmin.d.ts +17 -0
  75. package/dist/group/functions/iAmMember.d.ts +17 -0
  76. package/dist/group/functions/iAmRestrictedMember.d.ts +17 -0
  77. package/dist/group/functions/iAmSuperAdmin.d.ts +17 -0
  78. package/dist/group/functions/index.d.ts +31 -0
  79. package/dist/group/functions/promoteParticipants.d.ts +17 -0
  80. package/dist/group/functions/removeParticipants.d.ts +17 -0
  81. package/dist/group/index.d.ts +2 -5
  82. package/dist/index.d.ts +8 -8
  83. package/dist/labels/eventEmitter.d.ts +48 -0
  84. package/dist/labels/functions/addNewLabel.d.ts +35 -0
  85. package/dist/{auth/Auth.d.ts → labels/functions/addOrRemoveLabels.d.ts} +15 -16
  86. package/dist/labels/functions/colorIsInLabelPalette.d.ts +26 -0
  87. package/dist/labels/functions/deleteAllLabels.d.ts +17 -0
  88. package/dist/labels/functions/deleteLabel.d.ts +21 -0
  89. package/dist/labels/functions/getAllLabels.d.ts +17 -0
  90. package/dist/labels/functions/getLabelColorPalette.d.ts +19 -0
  91. package/dist/labels/functions/getNewLabelColor.d.ts +19 -0
  92. package/dist/labels/functions/index.d.ts +23 -0
  93. package/dist/labels/index.d.ts +2 -4
  94. package/dist/labels/types.d.ts +5 -6
  95. package/dist/status/{types.d.ts → defaultSendStatusOptions.d.ts} +3 -12
  96. package/dist/status/eventEmitter.d.ts +49 -0
  97. package/dist/status/events/index.d.ts +16 -0
  98. package/dist/status/events/registerSyncedEvent.d.ts +16 -0
  99. package/dist/status/functions/get.d.ts +17 -0
  100. package/dist/status/functions/getMyStatus.d.ts +17 -0
  101. package/dist/status/functions/index.d.ts +19 -0
  102. package/dist/status/functions/sendRawStatus.d.ts +20 -0
  103. package/dist/status/functions/sendTextStatus.d.ts +31 -0
  104. package/dist/status/index.d.ts +4 -5
  105. package/dist/util/blobToBase64.d.ts +16 -0
  106. package/dist/util/convertToFile.d.ts +16 -0
  107. package/dist/util/index.d.ts +2 -0
  108. package/dist/webpack.d.ts +2 -1
  109. package/dist/whatsapp/collections/BaseCollection.d.ts +3 -3
  110. package/dist/whatsapp/collections/BlocklistCollection.d.ts +1 -1
  111. package/dist/whatsapp/collections/BusinessCategoriesResultCollection.d.ts +1 -1
  112. package/dist/whatsapp/collections/BusinessProfileCollection.d.ts +1 -1
  113. package/dist/whatsapp/collections/ButtonCollection.d.ts +1 -1
  114. package/dist/whatsapp/collections/CallCollection.d.ts +1 -1
  115. package/dist/whatsapp/collections/CartCollection.d.ts +1 -1
  116. package/dist/whatsapp/collections/CartItemCollection.d.ts +1 -1
  117. package/dist/whatsapp/collections/CatalogCollection.d.ts +1 -1
  118. package/dist/whatsapp/collections/ChatCollection.d.ts +1 -1
  119. package/dist/whatsapp/collections/ChatstateCollection.d.ts +1 -1
  120. package/dist/whatsapp/collections/Collection.d.ts +4 -3
  121. package/dist/whatsapp/collections/ContactCollection.d.ts +1 -1
  122. package/dist/whatsapp/collections/EmojiVariantCollection.d.ts +1 -1
  123. package/dist/whatsapp/collections/GroupMetadataCollection.d.ts +3 -5
  124. package/dist/whatsapp/collections/LabelCollection.d.ts +3 -2
  125. package/dist/whatsapp/collections/LabelItemCollection.d.ts +1 -1
  126. package/dist/whatsapp/collections/LiveLocationCollection.d.ts +3 -4
  127. package/dist/whatsapp/collections/MsgCollection.d.ts +1 -1
  128. package/dist/whatsapp/collections/MsgInfoCollection.d.ts +1 -1
  129. package/dist/whatsapp/collections/MuteCollection.d.ts +1 -1
  130. package/dist/whatsapp/collections/OrderCollection.d.ts +1 -1
  131. package/dist/whatsapp/collections/OrderItemCollection.d.ts +1 -1
  132. package/dist/whatsapp/collections/ParticipantCollection.d.ts +1 -1
  133. package/dist/whatsapp/collections/PresenceCollection.d.ts +1 -1
  134. package/dist/whatsapp/collections/ProductCollCollection.d.ts +1 -1
  135. package/dist/whatsapp/collections/ProductCollection.d.ts +1 -1
  136. package/dist/whatsapp/collections/ProductImageCollection.d.ts +1 -1
  137. package/dist/whatsapp/collections/ProductMessageListCollection.d.ts +1 -1
  138. package/dist/whatsapp/collections/ProfilePicThumbCollection.d.ts +1 -1
  139. package/dist/whatsapp/collections/QuickReplyCollection.d.ts +1 -1
  140. package/dist/whatsapp/collections/RecentEmojiCollection.d.ts +1 -1
  141. package/dist/whatsapp/collections/RecentStickerCollection.d.ts +1 -1
  142. package/dist/whatsapp/collections/StarredMsgCollection.d.ts +1 -1
  143. package/dist/whatsapp/collections/StarredStickerCollection.d.ts +1 -1
  144. package/dist/whatsapp/collections/StatusCollection.d.ts +1 -1
  145. package/dist/whatsapp/collections/StatusV3Collection.d.ts +1 -1
  146. package/dist/whatsapp/collections/StickerCollection.d.ts +1 -1
  147. package/dist/whatsapp/collections/StickerPackCollection.d.ts +1 -1
  148. package/dist/whatsapp/collections/StickerSearchCollection.d.ts +1 -1
  149. package/dist/whatsapp/collections/TemplateButtonCollection.d.ts +1 -1
  150. package/dist/whatsapp/enums/LogoutReason.d.ts +1 -1
  151. package/dist/whatsapp/enums/OUTWARD_TYPES.d.ts +1 -1
  152. package/dist/whatsapp/enums/SendMsgResult.d.ts +1 -1
  153. package/dist/whatsapp/functions/addAndSendMsgToChat.d.ts +1 -1
  154. package/dist/whatsapp/functions/blockContact.d.ts +2 -2
  155. package/dist/whatsapp/functions/fetchLinkPreview.d.ts +29 -0
  156. package/dist/whatsapp/functions/findChat.d.ts +1 -1
  157. package/dist/whatsapp/functions/findFirstWebLink.d.ts +17 -0
  158. package/dist/whatsapp/functions/getOrGenerate.d.ts +1 -1
  159. package/dist/whatsapp/functions/groupParticipants.d.ts +4 -4
  160. package/dist/whatsapp/functions/handleAck.d.ts +21 -0
  161. package/dist/whatsapp/functions/index.d.ts +3 -0
  162. package/dist/whatsapp/functions/isAuthenticated.d.ts +1 -1
  163. package/dist/whatsapp/functions/markSeen.d.ts +3 -3
  164. package/dist/whatsapp/functions/msgFindQuery.d.ts +1 -1
  165. package/dist/whatsapp/functions/products.d.ts +4 -4
  166. package/dist/whatsapp/functions/randomId.d.ts +2 -2
  167. package/dist/whatsapp/functions/sendClear.d.ts +1 -1
  168. package/dist/whatsapp/functions/sendCreateGroup.d.ts +1 -1
  169. package/dist/whatsapp/functions/sendDelete.d.ts +1 -1
  170. package/dist/whatsapp/functions/sendQueryExists.d.ts +1 -1
  171. package/dist/whatsapp/functions/sendTextMsgToChat.d.ts +1 -1
  172. package/dist/whatsapp/functions/uploadProductImage.d.ts +1 -1
  173. package/dist/whatsapp/misc/Base64.d.ts +1 -1
  174. package/dist/whatsapp/misc/Browser.d.ts +1 -1
  175. package/dist/whatsapp/misc/ChatPresence.d.ts +1 -1
  176. package/dist/whatsapp/misc/Clock.d.ts +2 -2
  177. package/dist/whatsapp/misc/Cmd.d.ts +2 -2
  178. package/dist/whatsapp/misc/Conn.d.ts +1 -1
  179. package/dist/whatsapp/misc/Constants.d.ts +1 -1
  180. package/dist/whatsapp/misc/EventEmitter.d.ts +1 -1
  181. package/dist/whatsapp/misc/Features.d.ts +1 -1
  182. package/dist/whatsapp/misc/ImageUtils.d.ts +1 -1
  183. package/dist/whatsapp/misc/Locale.d.ts +1 -1
  184. package/dist/whatsapp/misc/MediaBlobCache.d.ts +30 -0
  185. package/dist/whatsapp/misc/MediaObject.d.ts +2 -1
  186. package/dist/whatsapp/misc/MediaObjectUtil.d.ts +1 -1
  187. package/dist/whatsapp/misc/MediaPrep.d.ts +1 -1
  188. package/dist/whatsapp/misc/MediaUtils.d.ts +1 -1
  189. package/dist/whatsapp/misc/MsgKey.d.ts +1 -1
  190. package/dist/whatsapp/misc/MsgLoadState.d.ts +2 -2
  191. package/dist/whatsapp/misc/OpaqueData.d.ts +3 -3
  192. package/dist/whatsapp/misc/State.d.ts +1 -1
  193. package/dist/whatsapp/misc/UserPrefs.d.ts +1 -1
  194. package/dist/whatsapp/misc/VCard.d.ts +1 -1
  195. package/dist/whatsapp/misc/Wid.d.ts +1 -1
  196. package/dist/whatsapp/misc/WidFactory.d.ts +1 -1
  197. package/dist/whatsapp/misc/index.d.ts +1 -0
  198. package/dist/whatsapp/models/AttachMediaModel.d.ts +2 -2
  199. package/dist/whatsapp/models/BlocklistModel.d.ts +2 -2
  200. package/dist/whatsapp/models/BusinessCategoriesResultModel.d.ts +2 -2
  201. package/dist/whatsapp/models/BusinessProfileModel.d.ts +2 -2
  202. package/dist/whatsapp/models/CallModel.d.ts +2 -2
  203. package/dist/whatsapp/models/CallParticipantModel.d.ts +2 -2
  204. package/dist/whatsapp/models/CartItemModel.d.ts +2 -2
  205. package/dist/whatsapp/models/CartModel.d.ts +2 -2
  206. package/dist/whatsapp/models/CatalogModel.d.ts +2 -2
  207. package/dist/whatsapp/models/ChatModel.d.ts +2 -2
  208. package/dist/whatsapp/models/ChatPreferenceModel.d.ts +2 -2
  209. package/dist/whatsapp/models/ChatstateModel.d.ts +2 -2
  210. package/dist/whatsapp/models/ConnModel.d.ts +2 -2
  211. package/dist/whatsapp/models/ContactModel.d.ts +2 -2
  212. package/dist/whatsapp/models/ConversionTupleModel.d.ts +2 -2
  213. package/dist/whatsapp/models/EmojiVariantModel.d.ts +2 -2
  214. package/dist/whatsapp/models/GroupMetadataModel.d.ts +2 -2
  215. package/dist/whatsapp/models/LabelItemModel.d.ts +2 -2
  216. package/dist/whatsapp/models/LabelModel.d.ts +2 -2
  217. package/dist/whatsapp/models/LiveLocationModel.d.ts +4 -3
  218. package/dist/whatsapp/models/LiveLocationParticipantModel.d.ts +2 -2
  219. package/dist/whatsapp/models/MediaDataModel.d.ts +2 -2
  220. package/dist/whatsapp/models/Model.d.ts +1 -1
  221. package/dist/whatsapp/models/ModelChatBase.d.ts +1 -1
  222. package/dist/whatsapp/models/MsgButtonReplyMsgModel.d.ts +2 -2
  223. package/dist/whatsapp/models/MsgInfoModel.d.ts +2 -2
  224. package/dist/whatsapp/models/MsgModel.d.ts +25 -15
  225. package/dist/whatsapp/models/MuteModel.d.ts +2 -2
  226. package/dist/whatsapp/models/OrderItemModel.d.ts +2 -2
  227. package/dist/whatsapp/models/OrderModel.d.ts +2 -2
  228. package/dist/whatsapp/models/ParticipantModel.d.ts +2 -2
  229. package/dist/whatsapp/models/ProductCollModel.d.ts +2 -2
  230. package/dist/whatsapp/models/ProductImageModel.d.ts +2 -2
  231. package/dist/whatsapp/models/ProductMessageListModel.d.ts +2 -2
  232. package/dist/whatsapp/models/ProductModel.d.ts +2 -2
  233. package/dist/whatsapp/models/ProfilePicThumbModel.d.ts +2 -2
  234. package/dist/whatsapp/models/QuickReplyModel.d.ts +2 -2
  235. package/dist/whatsapp/models/RecentEmojiModel.d.ts +2 -2
  236. package/dist/whatsapp/models/RecentStickerModel.d.ts +2 -2
  237. package/dist/whatsapp/models/ReplyButtonModel.d.ts +2 -2
  238. package/dist/whatsapp/models/StateModel.d.ts +2 -2
  239. package/dist/whatsapp/models/StatusModel.d.ts +2 -2
  240. package/dist/whatsapp/models/StatusV3Model.d.ts +2 -2
  241. package/dist/whatsapp/models/StickerModel.d.ts +2 -2
  242. package/dist/whatsapp/models/StickerPackModel.d.ts +2 -2
  243. package/dist/whatsapp/models/TemplateButtonModel.d.ts +2 -2
  244. package/dist/whatsapp/models/UnreadMentionModel.d.ts +2 -2
  245. package/dist/whatsapp/models/WebCallModel.d.ts +2 -2
  246. package/dist/whatsapp/multidevice/adv.d.ts +1 -1
  247. package/dist/whatsapp/multidevice/waNoiseInfo.d.ts +1 -1
  248. package/dist/whatsapp/multidevice/waSignalStore.d.ts +1 -1
  249. package/dist/whatsapp/stores.d.ts +29 -29
  250. package/dist/wppconnect-wa.js +1 -1
  251. package/package.json +14 -14
  252. package/dist/chat/Chat.d.ts +0 -225
  253. package/dist/group/Group.d.ts +0 -45
  254. package/dist/labels/Labels.d.ts +0 -52
  255. package/dist/status/Status.d.ts +0 -37
@@ -0,0 +1,17 @@
1
+ /*!
2
+ * Copyright 2021 WPPConnect Team
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { Wid } from '../../whatsapp';
17
+ export declare function canAdd(groupId: string | Wid): boolean;
@@ -0,0 +1,17 @@
1
+ /*!
2
+ * Copyright 2021 WPPConnect Team
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { Wid } from '../../whatsapp';
17
+ export declare function canDemote(groupId: string | Wid, participantsIds: (string | Wid) | (string | Wid)[]): boolean;
@@ -0,0 +1,17 @@
1
+ /*!
2
+ * Copyright 2021 WPPConnect Team
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { Wid } from '../../whatsapp';
17
+ export declare function canPromote(groupId: string | Wid, participantsIds: (string | Wid) | (string | Wid)[]): boolean;
@@ -0,0 +1,17 @@
1
+ /*!
2
+ * Copyright 2021 WPPConnect Team
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { Wid } from '../../whatsapp';
17
+ export declare function canRemove(groupId: string | Wid, participantsIds: (string | Wid) | (string | Wid)[]): boolean;
@@ -0,0 +1,25 @@
1
+ /*!
2
+ * Copyright 2021 WPPConnect Team
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { Wid } from '../../whatsapp';
17
+ export declare function create(groupName: string, participantsIds: (string | Wid) | (string | Wid)[]): Promise<{
18
+ gid: Wid;
19
+ participants: {
20
+ [key: string]: {
21
+ code: string;
22
+ };
23
+ }[];
24
+ status: number;
25
+ }>;
@@ -0,0 +1,17 @@
1
+ /*!
2
+ * Copyright 2021 WPPConnect Team
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { Wid } from '../../whatsapp';
17
+ export declare function demoteParticipants(groupId: string | Wid, participantsIds: (string | Wid) | (string | Wid)[]): Promise<void>;
@@ -0,0 +1,17 @@
1
+ /*!
2
+ * Copyright 2021 WPPConnect Team
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { Wid } from '../../whatsapp';
17
+ export declare function ensureGroup(groupId: string | Wid): import("../../whatsapp").ChatModel;
@@ -0,0 +1,20 @@
1
+ /*!
2
+ * Copyright 2021 WPPConnect Team
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { ParticipantModel, Wid } from '../../whatsapp';
17
+ export declare function ensureGroupAndParticipants(groupId: string | Wid, participantsIds: (string | Wid) | (string | Wid)[], createIfNotExists?: boolean): {
18
+ groupChat: import("../../whatsapp").ChatModel;
19
+ participants: ParticipantModel[];
20
+ };
@@ -0,0 +1,25 @@
1
+ /*!
2
+ * Copyright 2021 WPPConnect Team
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { Wid } from '../../whatsapp';
17
+ /**
18
+ * Get an array of participants of a group
19
+ *
20
+ * @example
21
+ * ```javascript
22
+ * WPP.group.getParticipants('<group-id>@g.us');
23
+ * ```
24
+ */
25
+ export declare function getParticipants(groupId: string | Wid): import("../../whatsapp").ParticipantModel[];
@@ -0,0 +1,17 @@
1
+ /*!
2
+ * Copyright 2021 WPPConnect Team
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { Wid } from '../../whatsapp';
17
+ export declare function iAmAdmin(groupId: string | Wid): boolean;
@@ -0,0 +1,17 @@
1
+ /*!
2
+ * Copyright 2021 WPPConnect Team
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { Wid } from '../../whatsapp';
17
+ export declare function iAmMember(groupId: string | Wid): boolean;
@@ -0,0 +1,17 @@
1
+ /*!
2
+ * Copyright 2021 WPPConnect Team
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { Wid } from '../../whatsapp';
17
+ export declare function iAmRestrictedMember(groupId: string | Wid): boolean;
@@ -0,0 +1,17 @@
1
+ /*!
2
+ * Copyright 2021 WPPConnect Team
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { Wid } from '../../whatsapp';
17
+ export declare function iAmSuperAdmin(groupId: string | Wid): boolean;
@@ -0,0 +1,31 @@
1
+ /*!
2
+ * Copyright 2021 WPPConnect Team
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export { addParticipants } from './addParticipants';
17
+ export { canAdd } from './canAdd';
18
+ export { canDemote } from './canDemote';
19
+ export { canPromote } from './canPromote';
20
+ export { canRemove } from './canRemove';
21
+ export { create } from './create';
22
+ export { demoteParticipants } from './demoteParticipants';
23
+ export { ensureGroup } from './ensureGroup';
24
+ export { ensureGroupAndParticipants } from './ensureGroupAndParticipants';
25
+ export { getParticipants } from './getParticipants';
26
+ export { iAmAdmin } from './iAmAdmin';
27
+ export { iAmMember } from './iAmMember';
28
+ export { iAmRestrictedMember } from './iAmRestrictedMember';
29
+ export { iAmSuperAdmin } from './iAmSuperAdmin';
30
+ export { promoteParticipants } from './promoteParticipants';
31
+ export { removeParticipants } from './removeParticipants';
@@ -0,0 +1,17 @@
1
+ /*!
2
+ * Copyright 2021 WPPConnect Team
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { Wid } from '../../whatsapp';
17
+ export declare function promoteParticipants(groupId: string | Wid, participantsIds: (string | Wid) | (string | Wid)[]): Promise<void>;
@@ -0,0 +1,17 @@
1
+ /*!
2
+ * Copyright 2021 WPPConnect Team
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { Wid } from '../../whatsapp';
17
+ export declare function removeParticipants(groupId: string | Wid, participantsIds: (string | Wid) | (string | Wid)[]): Promise<void>;
@@ -13,8 +13,5 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { Group } from './Group';
17
- export * from './Group';
18
- export * from './types';
19
- declare const _default: Group;
20
- export default _default;
16
+ export { clearListeners, EventTypes, listenerCount, off, on, once, UnsubscribeFn, } from './eventEmitter';
17
+ export * from './functions';
package/dist/index.d.ts CHANGED
@@ -20,14 +20,14 @@ import * as webpack from './webpack';
20
20
  export { webpack };
21
21
  export { isInjected, isReady } from './webpack';
22
22
  export * as config from './config';
23
- export * as internal from './internal';
24
- export { default as auth } from './auth';
25
- export { default as blocklist } from './blocklist';
26
- export { default as chat } from './chat';
27
- export { default as contact } from './contact';
28
- export { default as group } from './group';
29
- export { default as status } from './status';
30
- export { default as labels } from './labels';
23
+ export * as auth from './auth';
24
+ export * as blocklist from './blocklist';
25
+ export * as chat from './chat';
26
+ export * as contact from './contact';
27
+ export * as group from './group';
28
+ export * as labels from './labels';
29
+ export * as status from './status';
30
+ export * as util from './util';
31
31
  export * as whatsapp from './whatsapp';
32
32
  export declare const version: string;
33
33
  export declare const license = "Apache-2.0";
@@ -0,0 +1,48 @@
1
+ /*!
2
+ * Copyright 2021 WPPConnect Team
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import Emittery from 'emittery';
17
+ export declare type UnsubscribeFn = () => void;
18
+ export interface EventTypes {
19
+ }
20
+ export declare const eventEmitter: Emittery<EventTypes, EventTypes, never>;
21
+ /**
22
+ * Subscribe to one event.
23
+ * @event
24
+ * @returns An unsubscribe method.
25
+ */
26
+ export declare function on<Name extends keyof EventTypes>(eventName: Name, listener: (eventData: EventTypes[Name]) => void | Promise<void>): UnsubscribeFn;
27
+ /**
28
+ * Subscribe to one or more events only once. It will be unsubscribed after the first event.
29
+ * @event
30
+ */
31
+ export declare function once<Name extends keyof EventTypes>(eventName: Name): Promise<EventTypes[Name]>;
32
+ /**
33
+ * @event
34
+ */
35
+ export declare function off<Name extends keyof EventTypes>(eventName: Name, listener: (eventData: EventTypes[Name]) => void | Promise<void>): void;
36
+ /**
37
+ * Clear all event listeners on the instance.
38
+ *
39
+ * If `eventName` is given, only the listeners for that event are cleared.
40
+ *
41
+ * @event
42
+ */
43
+ export declare function clearListeners<Name extends keyof EventTypes>(eventName?: Name | Name[]): void;
44
+ /**
45
+ * The number of listeners for the `eventName` or all events if not specified.
46
+ * @event
47
+ */
48
+ export declare function listenerCount<Name extends keyof EventTypes>(eventName?: Name | Name[]): number;
@@ -0,0 +1,35 @@
1
+ /*!
2
+ * Copyright 2021 WPPConnect Team
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export interface NewLabelOptions {
17
+ /**
18
+ * If it's decimal, send it as a number. If it's hexadecimal, send it as a string.
19
+ * If labelColor is omitted, the color will be generated automatically
20
+ */
21
+ labelColor?: string | number;
22
+ }
23
+ /**
24
+ * Add a new label
25
+ * Use await WPP.labels.getLabelColorPalette() to get the list of available colors
26
+ * @example
27
+ * ```javascript
28
+ * await WPP.labels.addNewLabel(`Name of label`);
29
+ * //or
30
+ * await WPP.labels.addNewLabel(`Name of label`, { labelColor: '#dfaef0' });
31
+ * //or
32
+ * await WPP.labels.addNewLabel(`Name of label`, { labelColor: 4292849392 });
33
+ * ```
34
+ */
35
+ export declare function addNewLabel(labelName: string, options?: NewLabelOptions): Promise<any>;
@@ -13,20 +13,19 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import Emittery from 'emittery';
17
- import { AuthCode, AuthEventTypes } from './types';
18
- export declare class Auth extends Emittery<AuthEventTypes> {
19
- constructor();
20
- initialize(): Promise<void>;
21
- /**
22
- * Return the current auth code
23
- *
24
- * @return {Promise<AuthCode>}[return description]
25
- */
26
- getAuthCode(): Promise<AuthCode | null>;
27
- isAuthenticated(): boolean;
28
- isIdle(): boolean;
29
- isMultiDevice(): boolean;
30
- poke(): void;
31
- logout(): Promise<any>;
16
+ import { Wid } from '../../whatsapp';
17
+ export interface AddOrRemoveLabelsOptions {
18
+ labelId: string;
19
+ type: 'add' | 'remove';
32
20
  }
21
+ /**
22
+ * Add or remove label from chats
23
+ * @example
24
+ * ```javascript
25
+ * await WPP.labels.addOrRemoveLabels(
26
+ * ['<number>@c.us','<number>@c.us'],
27
+ * [{labelId:'76', type:'add'},{labelId:'75', type:'remove'}]
28
+ * )
29
+ * ```
30
+ */
31
+ export declare function addOrRemoveLabels(chatIds: string | Wid | (string | Wid)[], options: AddOrRemoveLabelsOptions | AddOrRemoveLabelsOptions[]): Promise<any>;
@@ -0,0 +1,26 @@
1
+ /*!
2
+ * Copyright 2021 WPPConnect Team
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /**
17
+ * Check if color is in label palette
18
+ * @param color If it's decimal, send it as a number. If it's hexadecimal, send it as a string
19
+ * @example
20
+ * ```javascript
21
+ * await WPP.labels.colorIsInLabelPalette('#ffd429');
22
+ * //or
23
+ * await WPP.labels.colorIsInLabelPalette(4284794111);
24
+ * ```
25
+ */
26
+ export declare function colorIsInLabelPalette(color: string | number): Promise<boolean>;
@@ -0,0 +1,17 @@
1
+ /*!
2
+ * Copyright 2021 WPPConnect Team
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { DeleteLabelReturn } from '.';
17
+ export declare function deleteAllLabels(): Promise<DeleteLabelReturn[]>;
@@ -0,0 +1,21 @@
1
+ /*!
2
+ * Copyright 2021 WPPConnect Team
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export interface DeleteLabelReturn {
17
+ id: string;
18
+ deleteLabelResult: any;
19
+ }
20
+ export declare function deleteLabel(id: string): Promise<DeleteLabelReturn>;
21
+ export declare function deleteLabel(ids: string[]): Promise<DeleteLabelReturn[]>;
@@ -0,0 +1,17 @@
1
+ /*!
2
+ * Copyright 2021 WPPConnect Team
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { Label } from '..';
17
+ export declare function getAllLabels(): Promise<Label[]>;
@@ -0,0 +1,19 @@
1
+ /*!
2
+ * Copyright 2021 WPPConnect Team
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /**
17
+ * Returns an array of color palette in positive decimal
18
+ */
19
+ export declare function getLabelColorPalette(): Promise<number[]>;
@@ -0,0 +1,19 @@
1
+ /*!
2
+ * Copyright 2021 WPPConnect Team
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /**
17
+ * Return the color of the next label in positive decimal
18
+ */
19
+ export declare function getNewLabelColor(): Promise<number>;
@@ -0,0 +1,23 @@
1
+ /*!
2
+ * Copyright 2021 WPPConnect Team
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export { addNewLabel } from './addNewLabel';
17
+ export { addOrRemoveLabels, AddOrRemoveLabelsOptions, } from './addOrRemoveLabels';
18
+ export { colorIsInLabelPalette } from './colorIsInLabelPalette';
19
+ export { deleteAllLabels } from './deleteAllLabels';
20
+ export { deleteLabel, DeleteLabelReturn } from './deleteLabel';
21
+ export { getAllLabels } from './getAllLabels';
22
+ export { getLabelColorPalette } from './getLabelColorPalette';
23
+ export { getNewLabelColor } from './getNewLabelColor';
@@ -13,8 +13,6 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { Labels } from './Labels';
17
- export * from './Labels';
16
+ export { clearListeners, EventTypes, listenerCount, off, on, once, UnsubscribeFn, } from './eventEmitter';
17
+ export * from './functions';
18
18
  export * from './types';
19
- declare const _default: Labels;
20
- export default _default;