@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.
- package/CHANGELOG.md +26 -0
- package/README.md +68 -0
- package/dist/auth/eventEmitter.d.ts +52 -0
- package/dist/{blocklist/Blocklist.d.ts → auth/events/index.d.ts} +3 -11
- package/dist/{contact/types.d.ts → auth/events/registerChangeEvent.d.ts} +1 -3
- package/dist/auth/events/registerIdleEvent.d.ts +16 -0
- package/dist/auth/events/registerLogoutEvent.d.ts +16 -0
- package/dist/auth/functions/getAuthCode.d.ts +22 -0
- package/dist/{contact/Contact.d.ts → auth/functions/index.d.ts} +7 -11
- package/dist/auth/functions/isAuthenticated.d.ts +16 -0
- package/dist/auth/functions/isIdle.d.ts +16 -0
- package/dist/auth/functions/isMultiDevice.d.ts +16 -0
- package/dist/auth/functions/logout.d.ts +16 -0
- package/dist/auth/functions/poke.d.ts +16 -0
- package/dist/auth/functions/setMultiDevice.d.ts +23 -0
- package/dist/auth/index.d.ts +3 -4
- package/dist/auth/types.d.ts +0 -5
- package/dist/blocklist/eventEmitter.d.ts +49 -0
- package/dist/blocklist/events/index.d.ts +16 -0
- package/dist/blocklist/events/registerSyncedEvent.d.ts +16 -0
- package/dist/blocklist/functions/all.d.ts +17 -0
- package/dist/blocklist/functions/blockContact.d.ts +18 -0
- package/dist/blocklist/functions/index.d.ts +19 -0
- package/dist/blocklist/functions/isBlocked.d.ts +17 -0
- package/dist/blocklist/functions/unblockContact.d.ts +18 -0
- package/dist/blocklist/index.d.ts +3 -5
- package/dist/blocklist/types.d.ts +0 -3
- package/dist/chat/defaultSendMessageOptions.d.ts +19 -0
- package/dist/chat/eventEmitter.d.ts +107 -0
- package/dist/chat/events/index.d.ts +18 -0
- package/dist/chat/events/registerAckMessageEvent.d.ts +16 -0
- package/dist/chat/events/registerLiveLocationUpdateEvent.d.ts +16 -0
- package/dist/chat/events/registerRevokeMessageEvent.d.ts +16 -0
- package/dist/chat/functions/clear.d.ts +26 -0
- package/dist/chat/functions/delete.d.ts +26 -0
- package/dist/chat/functions/deleteMessage.d.ts +35 -0
- package/dist/chat/functions/downloadMedia.d.ts +21 -0
- package/dist/chat/functions/find.d.ts +24 -0
- package/dist/chat/functions/generateMessageID.d.ts +22 -0
- package/dist/chat/functions/get.d.ts +22 -0
- package/dist/chat/functions/getMessageById.d.ts +35 -0
- package/dist/chat/functions/getMessages.d.ts +48 -0
- package/dist/chat/functions/index.d.ts +37 -0
- package/dist/chat/functions/markIsComposing.d.ts +31 -0
- package/dist/chat/functions/markIsPaused.d.ts +27 -0
- package/dist/chat/functions/markIsRead.d.ts +30 -0
- package/dist/chat/functions/markIsRecording.d.ts +31 -0
- package/dist/chat/functions/markIsUnread.d.ts +29 -0
- package/dist/chat/functions/prepareLinkPreview.d.ts +53 -0
- package/dist/chat/functions/prepareMessageButtons.d.ts +40 -0
- package/dist/chat/functions/prepareRawMessage.d.ts +23 -0
- package/dist/chat/functions/sendFileMessage.d.ts +116 -0
- package/dist/{group/types.d.ts → chat/functions/sendListMessage.d.ts} +26 -25
- package/dist/chat/functions/sendRawMessage.d.ts +22 -0
- package/dist/chat/functions/sendTextMessage.d.ts +23 -0
- package/dist/chat/functions/sendVCardContactMessage.d.ts +27 -0
- package/dist/chat/index.d.ts +4 -4
- package/dist/chat/types.d.ts +0 -105
- package/dist/contact/eventEmitter.d.ts +48 -0
- package/dist/contact/functions/index.d.ts +16 -0
- package/dist/contact/functions/queryExists.d.ts +20 -0
- package/dist/contact/index.d.ts +2 -5
- package/dist/group/eventEmitter.d.ts +48 -0
- package/dist/group/functions/addParticipants.d.ts +17 -0
- package/dist/group/functions/canAdd.d.ts +17 -0
- package/dist/group/functions/canDemote.d.ts +17 -0
- package/dist/group/functions/canPromote.d.ts +17 -0
- package/dist/group/functions/canRemove.d.ts +17 -0
- package/dist/group/functions/create.d.ts +25 -0
- package/dist/group/functions/demoteParticipants.d.ts +17 -0
- package/dist/group/functions/ensureGroup.d.ts +17 -0
- package/dist/group/functions/ensureGroupAndParticipants.d.ts +20 -0
- package/dist/group/functions/getParticipants.d.ts +25 -0
- package/dist/group/functions/iAmAdmin.d.ts +17 -0
- package/dist/group/functions/iAmMember.d.ts +17 -0
- package/dist/group/functions/iAmRestrictedMember.d.ts +17 -0
- package/dist/group/functions/iAmSuperAdmin.d.ts +17 -0
- package/dist/group/functions/index.d.ts +31 -0
- package/dist/group/functions/promoteParticipants.d.ts +17 -0
- package/dist/group/functions/removeParticipants.d.ts +17 -0
- package/dist/group/index.d.ts +2 -5
- package/dist/index.d.ts +8 -8
- package/dist/labels/eventEmitter.d.ts +48 -0
- package/dist/labels/functions/addNewLabel.d.ts +35 -0
- package/dist/{auth/Auth.d.ts → labels/functions/addOrRemoveLabels.d.ts} +15 -16
- package/dist/labels/functions/colorIsInLabelPalette.d.ts +26 -0
- package/dist/labels/functions/deleteAllLabels.d.ts +17 -0
- package/dist/labels/functions/deleteLabel.d.ts +21 -0
- package/dist/labels/functions/getAllLabels.d.ts +17 -0
- package/dist/labels/functions/getLabelColorPalette.d.ts +19 -0
- package/dist/labels/functions/getNewLabelColor.d.ts +19 -0
- package/dist/labels/functions/index.d.ts +23 -0
- package/dist/labels/index.d.ts +2 -4
- package/dist/labels/types.d.ts +5 -6
- package/dist/status/{types.d.ts → defaultSendStatusOptions.d.ts} +3 -12
- package/dist/status/eventEmitter.d.ts +49 -0
- package/dist/status/events/index.d.ts +16 -0
- package/dist/status/events/registerSyncedEvent.d.ts +16 -0
- package/dist/status/functions/get.d.ts +17 -0
- package/dist/status/functions/getMyStatus.d.ts +17 -0
- package/dist/status/functions/index.d.ts +19 -0
- package/dist/status/functions/sendRawStatus.d.ts +20 -0
- package/dist/status/functions/sendTextStatus.d.ts +31 -0
- package/dist/status/index.d.ts +4 -5
- package/dist/util/blobToBase64.d.ts +16 -0
- package/dist/util/convertToFile.d.ts +16 -0
- package/dist/util/index.d.ts +2 -0
- package/dist/webpack.d.ts +2 -1
- package/dist/whatsapp/collections/BaseCollection.d.ts +3 -3
- package/dist/whatsapp/collections/BlocklistCollection.d.ts +1 -1
- package/dist/whatsapp/collections/BusinessCategoriesResultCollection.d.ts +1 -1
- package/dist/whatsapp/collections/BusinessProfileCollection.d.ts +1 -1
- package/dist/whatsapp/collections/ButtonCollection.d.ts +1 -1
- package/dist/whatsapp/collections/CallCollection.d.ts +1 -1
- package/dist/whatsapp/collections/CartCollection.d.ts +1 -1
- package/dist/whatsapp/collections/CartItemCollection.d.ts +1 -1
- package/dist/whatsapp/collections/CatalogCollection.d.ts +1 -1
- package/dist/whatsapp/collections/ChatCollection.d.ts +1 -1
- package/dist/whatsapp/collections/ChatstateCollection.d.ts +1 -1
- package/dist/whatsapp/collections/Collection.d.ts +4 -3
- package/dist/whatsapp/collections/ContactCollection.d.ts +1 -1
- package/dist/whatsapp/collections/EmojiVariantCollection.d.ts +1 -1
- package/dist/whatsapp/collections/GroupMetadataCollection.d.ts +3 -5
- package/dist/whatsapp/collections/LabelCollection.d.ts +3 -2
- package/dist/whatsapp/collections/LabelItemCollection.d.ts +1 -1
- package/dist/whatsapp/collections/LiveLocationCollection.d.ts +3 -4
- package/dist/whatsapp/collections/MsgCollection.d.ts +1 -1
- package/dist/whatsapp/collections/MsgInfoCollection.d.ts +1 -1
- package/dist/whatsapp/collections/MuteCollection.d.ts +1 -1
- package/dist/whatsapp/collections/OrderCollection.d.ts +1 -1
- package/dist/whatsapp/collections/OrderItemCollection.d.ts +1 -1
- package/dist/whatsapp/collections/ParticipantCollection.d.ts +1 -1
- package/dist/whatsapp/collections/PresenceCollection.d.ts +1 -1
- package/dist/whatsapp/collections/ProductCollCollection.d.ts +1 -1
- package/dist/whatsapp/collections/ProductCollection.d.ts +1 -1
- package/dist/whatsapp/collections/ProductImageCollection.d.ts +1 -1
- package/dist/whatsapp/collections/ProductMessageListCollection.d.ts +1 -1
- package/dist/whatsapp/collections/ProfilePicThumbCollection.d.ts +1 -1
- package/dist/whatsapp/collections/QuickReplyCollection.d.ts +1 -1
- package/dist/whatsapp/collections/RecentEmojiCollection.d.ts +1 -1
- package/dist/whatsapp/collections/RecentStickerCollection.d.ts +1 -1
- package/dist/whatsapp/collections/StarredMsgCollection.d.ts +1 -1
- package/dist/whatsapp/collections/StarredStickerCollection.d.ts +1 -1
- package/dist/whatsapp/collections/StatusCollection.d.ts +1 -1
- package/dist/whatsapp/collections/StatusV3Collection.d.ts +1 -1
- package/dist/whatsapp/collections/StickerCollection.d.ts +1 -1
- package/dist/whatsapp/collections/StickerPackCollection.d.ts +1 -1
- package/dist/whatsapp/collections/StickerSearchCollection.d.ts +1 -1
- package/dist/whatsapp/collections/TemplateButtonCollection.d.ts +1 -1
- package/dist/whatsapp/enums/LogoutReason.d.ts +1 -1
- package/dist/whatsapp/enums/OUTWARD_TYPES.d.ts +1 -1
- package/dist/whatsapp/enums/SendMsgResult.d.ts +1 -1
- package/dist/whatsapp/functions/addAndSendMsgToChat.d.ts +1 -1
- package/dist/whatsapp/functions/blockContact.d.ts +2 -2
- package/dist/whatsapp/functions/fetchLinkPreview.d.ts +29 -0
- package/dist/whatsapp/functions/findChat.d.ts +1 -1
- package/dist/whatsapp/functions/findFirstWebLink.d.ts +17 -0
- package/dist/whatsapp/functions/getOrGenerate.d.ts +1 -1
- package/dist/whatsapp/functions/groupParticipants.d.ts +4 -4
- package/dist/whatsapp/functions/handleAck.d.ts +21 -0
- package/dist/whatsapp/functions/index.d.ts +3 -0
- package/dist/whatsapp/functions/isAuthenticated.d.ts +1 -1
- package/dist/whatsapp/functions/markSeen.d.ts +3 -3
- package/dist/whatsapp/functions/msgFindQuery.d.ts +1 -1
- package/dist/whatsapp/functions/products.d.ts +4 -4
- package/dist/whatsapp/functions/randomId.d.ts +2 -2
- package/dist/whatsapp/functions/sendClear.d.ts +1 -1
- package/dist/whatsapp/functions/sendCreateGroup.d.ts +1 -1
- package/dist/whatsapp/functions/sendDelete.d.ts +1 -1
- package/dist/whatsapp/functions/sendQueryExists.d.ts +1 -1
- package/dist/whatsapp/functions/sendTextMsgToChat.d.ts +1 -1
- package/dist/whatsapp/functions/uploadProductImage.d.ts +1 -1
- package/dist/whatsapp/misc/Base64.d.ts +1 -1
- package/dist/whatsapp/misc/Browser.d.ts +1 -1
- package/dist/whatsapp/misc/ChatPresence.d.ts +1 -1
- package/dist/whatsapp/misc/Clock.d.ts +2 -2
- package/dist/whatsapp/misc/Cmd.d.ts +2 -2
- package/dist/whatsapp/misc/Conn.d.ts +1 -1
- package/dist/whatsapp/misc/Constants.d.ts +1 -1
- package/dist/whatsapp/misc/EventEmitter.d.ts +1 -1
- package/dist/whatsapp/misc/Features.d.ts +1 -1
- package/dist/whatsapp/misc/ImageUtils.d.ts +1 -1
- package/dist/whatsapp/misc/Locale.d.ts +1 -1
- package/dist/whatsapp/misc/MediaBlobCache.d.ts +30 -0
- package/dist/whatsapp/misc/MediaObject.d.ts +2 -1
- package/dist/whatsapp/misc/MediaObjectUtil.d.ts +1 -1
- package/dist/whatsapp/misc/MediaPrep.d.ts +1 -1
- package/dist/whatsapp/misc/MediaUtils.d.ts +1 -1
- package/dist/whatsapp/misc/MsgKey.d.ts +1 -1
- package/dist/whatsapp/misc/MsgLoadState.d.ts +2 -2
- package/dist/whatsapp/misc/OpaqueData.d.ts +3 -3
- package/dist/whatsapp/misc/State.d.ts +1 -1
- package/dist/whatsapp/misc/UserPrefs.d.ts +1 -1
- package/dist/whatsapp/misc/VCard.d.ts +1 -1
- package/dist/whatsapp/misc/Wid.d.ts +1 -1
- package/dist/whatsapp/misc/WidFactory.d.ts +1 -1
- package/dist/whatsapp/misc/index.d.ts +1 -0
- package/dist/whatsapp/models/AttachMediaModel.d.ts +2 -2
- package/dist/whatsapp/models/BlocklistModel.d.ts +2 -2
- package/dist/whatsapp/models/BusinessCategoriesResultModel.d.ts +2 -2
- package/dist/whatsapp/models/BusinessProfileModel.d.ts +2 -2
- package/dist/whatsapp/models/CallModel.d.ts +2 -2
- package/dist/whatsapp/models/CallParticipantModel.d.ts +2 -2
- package/dist/whatsapp/models/CartItemModel.d.ts +2 -2
- package/dist/whatsapp/models/CartModel.d.ts +2 -2
- package/dist/whatsapp/models/CatalogModel.d.ts +2 -2
- package/dist/whatsapp/models/ChatModel.d.ts +2 -2
- package/dist/whatsapp/models/ChatPreferenceModel.d.ts +2 -2
- package/dist/whatsapp/models/ChatstateModel.d.ts +2 -2
- package/dist/whatsapp/models/ConnModel.d.ts +2 -2
- package/dist/whatsapp/models/ContactModel.d.ts +2 -2
- package/dist/whatsapp/models/ConversionTupleModel.d.ts +2 -2
- package/dist/whatsapp/models/EmojiVariantModel.d.ts +2 -2
- package/dist/whatsapp/models/GroupMetadataModel.d.ts +2 -2
- package/dist/whatsapp/models/LabelItemModel.d.ts +2 -2
- package/dist/whatsapp/models/LabelModel.d.ts +2 -2
- package/dist/whatsapp/models/LiveLocationModel.d.ts +4 -3
- package/dist/whatsapp/models/LiveLocationParticipantModel.d.ts +2 -2
- package/dist/whatsapp/models/MediaDataModel.d.ts +2 -2
- package/dist/whatsapp/models/Model.d.ts +1 -1
- package/dist/whatsapp/models/ModelChatBase.d.ts +1 -1
- package/dist/whatsapp/models/MsgButtonReplyMsgModel.d.ts +2 -2
- package/dist/whatsapp/models/MsgInfoModel.d.ts +2 -2
- package/dist/whatsapp/models/MsgModel.d.ts +25 -15
- package/dist/whatsapp/models/MuteModel.d.ts +2 -2
- package/dist/whatsapp/models/OrderItemModel.d.ts +2 -2
- package/dist/whatsapp/models/OrderModel.d.ts +2 -2
- package/dist/whatsapp/models/ParticipantModel.d.ts +2 -2
- package/dist/whatsapp/models/ProductCollModel.d.ts +2 -2
- package/dist/whatsapp/models/ProductImageModel.d.ts +2 -2
- package/dist/whatsapp/models/ProductMessageListModel.d.ts +2 -2
- package/dist/whatsapp/models/ProductModel.d.ts +2 -2
- package/dist/whatsapp/models/ProfilePicThumbModel.d.ts +2 -2
- package/dist/whatsapp/models/QuickReplyModel.d.ts +2 -2
- package/dist/whatsapp/models/RecentEmojiModel.d.ts +2 -2
- package/dist/whatsapp/models/RecentStickerModel.d.ts +2 -2
- package/dist/whatsapp/models/ReplyButtonModel.d.ts +2 -2
- package/dist/whatsapp/models/StateModel.d.ts +2 -2
- package/dist/whatsapp/models/StatusModel.d.ts +2 -2
- package/dist/whatsapp/models/StatusV3Model.d.ts +2 -2
- package/dist/whatsapp/models/StickerModel.d.ts +2 -2
- package/dist/whatsapp/models/StickerPackModel.d.ts +2 -2
- package/dist/whatsapp/models/TemplateButtonModel.d.ts +2 -2
- package/dist/whatsapp/models/UnreadMentionModel.d.ts +2 -2
- package/dist/whatsapp/models/WebCallModel.d.ts +2 -2
- package/dist/whatsapp/multidevice/adv.d.ts +1 -1
- package/dist/whatsapp/multidevice/waNoiseInfo.d.ts +1 -1
- package/dist/whatsapp/multidevice/waSignalStore.d.ts +1 -1
- package/dist/whatsapp/stores.d.ts +29 -29
- package/dist/wppconnect-wa.js +1 -1
- package/package.json +14 -14
- package/dist/chat/Chat.d.ts +0 -225
- package/dist/group/Group.d.ts +0 -45
- package/dist/labels/Labels.d.ts +0 -52
- package/dist/status/Status.d.ts +0 -37
|
@@ -0,0 +1,53 @@
|
|
|
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 { RawMessage } from '..';
|
|
17
|
+
export interface LinkPreviewOptions {
|
|
18
|
+
/**
|
|
19
|
+
* Send text message with link preview
|
|
20
|
+
*
|
|
21
|
+
* @default true
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```javascript
|
|
25
|
+
* // Automatic detection
|
|
26
|
+
* WPP.chat.sendTextMessage('<number>@c.us', 'See https://www.youtube.com/watch?v=v1PBptSDIh8');
|
|
27
|
+
*
|
|
28
|
+
* // Overriding the title and description
|
|
29
|
+
* WPP.chat.sendTextMessage('<number>@c.us', 'See https://www.youtube.com/watch?v=v1PBptSDIh8', {
|
|
30
|
+
* linkPreview: {
|
|
31
|
+
* title: 'Another text',
|
|
32
|
+
* description: 'Another description'
|
|
33
|
+
* }
|
|
34
|
+
* });
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
linkPreview?: boolean | {
|
|
38
|
+
title?: string;
|
|
39
|
+
description?: string;
|
|
40
|
+
canonicalUrl?: string;
|
|
41
|
+
matchedText?: string;
|
|
42
|
+
richPreviewType?: number;
|
|
43
|
+
thumbnail?: string;
|
|
44
|
+
doNotPlayInline: boolean;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Prepare a message for link preview
|
|
49
|
+
*
|
|
50
|
+
* @category Message
|
|
51
|
+
* @internal
|
|
52
|
+
*/
|
|
53
|
+
export declare function prepareLinkPreview<T extends RawMessage>(message: T, options: LinkPreviewOptions): Promise<T>;
|
|
@@ -0,0 +1,40 @@
|
|
|
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 { RawMessage } from '..';
|
|
17
|
+
export interface MessageButtonsOptions {
|
|
18
|
+
/**
|
|
19
|
+
* List of buttons, with at least 1 option and a maximum of 3
|
|
20
|
+
*/
|
|
21
|
+
buttons?: Array<{
|
|
22
|
+
id: string;
|
|
23
|
+
text: string;
|
|
24
|
+
}>;
|
|
25
|
+
/**
|
|
26
|
+
* Title for buttons, only for text message
|
|
27
|
+
*/
|
|
28
|
+
title?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Footer text for buttons
|
|
31
|
+
*/
|
|
32
|
+
footer?: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Prepare a message for buttons
|
|
36
|
+
*
|
|
37
|
+
* @category Message
|
|
38
|
+
* @internal
|
|
39
|
+
*/
|
|
40
|
+
export declare function prepareMessageButtons<T extends RawMessage>(message: T, options: MessageButtonsOptions): T;
|
|
@@ -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
|
+
import { ChatModel } from '../../whatsapp';
|
|
17
|
+
import { RawMessage, SendMessageOptions } from '..';
|
|
18
|
+
/**
|
|
19
|
+
* Prepare a raw message
|
|
20
|
+
* @category Message
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
export declare function prepareRawMessage<T extends RawMessage>(chat: ChatModel, message: T, options?: SendMessageOptions): Promise<T>;
|
|
@@ -0,0 +1,116 @@
|
|
|
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 { SendMessageOptions, SendMessageReturn } from '..';
|
|
17
|
+
import { MessageButtonsOptions } from '.';
|
|
18
|
+
export interface FileMessageOptions extends SendMessageOptions {
|
|
19
|
+
type: string;
|
|
20
|
+
caption?: string;
|
|
21
|
+
filename?: string;
|
|
22
|
+
mimetype?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface AutoDetectMessageOptions extends FileMessageOptions {
|
|
25
|
+
type: 'auto-detect';
|
|
26
|
+
}
|
|
27
|
+
export interface AudioMessageOptions extends FileMessageOptions {
|
|
28
|
+
type: 'audio';
|
|
29
|
+
isPtt?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface DocumentMessageOptions extends FileMessageOptions, MessageButtonsOptions {
|
|
32
|
+
type: 'document';
|
|
33
|
+
}
|
|
34
|
+
export interface ImageMessageOptions extends FileMessageOptions, MessageButtonsOptions {
|
|
35
|
+
type: 'image';
|
|
36
|
+
isViewOnce?: boolean;
|
|
37
|
+
}
|
|
38
|
+
export interface StickerMessageOptions extends FileMessageOptions {
|
|
39
|
+
type: 'sticker';
|
|
40
|
+
}
|
|
41
|
+
export interface VideoMessageOptions extends FileMessageOptions, MessageButtonsOptions {
|
|
42
|
+
type: 'video';
|
|
43
|
+
isGif?: boolean;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Send a file message, that can be an audio, document, image, sticker or video
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```javascript
|
|
50
|
+
* // Single document
|
|
51
|
+
* WPP.chat.sendFileMessage(
|
|
52
|
+
* '<number>@c.us',
|
|
53
|
+
* 'data:image/jpeg;base64,<a long base64 file...>',
|
|
54
|
+
* {
|
|
55
|
+
* type: 'document',
|
|
56
|
+
* caption: 'My document', // Optional
|
|
57
|
+
* filename: 'myfile.doc', // Optional
|
|
58
|
+
* mimetype: 'application/msword' // Optional
|
|
59
|
+
* }
|
|
60
|
+
* );
|
|
61
|
+
*
|
|
62
|
+
* // Image with view once
|
|
63
|
+
* WPP.chat.sendFileMessage(
|
|
64
|
+
* '<number>@c.us',
|
|
65
|
+
* 'data:image/jpeg;base64,<a long base64 file...>',
|
|
66
|
+
* {
|
|
67
|
+
* type: 'image',
|
|
68
|
+
* caption: 'My image', // Optional
|
|
69
|
+
* isViewOnce: true
|
|
70
|
+
* }
|
|
71
|
+
* );
|
|
72
|
+
*
|
|
73
|
+
* // PTT audio
|
|
74
|
+
* WPP.chat.sendFileMessage(
|
|
75
|
+
* '<number>@c.us',
|
|
76
|
+
* 'data:audio/mp3;base64,<a long base64 file...>',
|
|
77
|
+
* {
|
|
78
|
+
* type: 'audio',
|
|
79
|
+
* isPtt: true // false for common audio
|
|
80
|
+
* }
|
|
81
|
+
* );
|
|
82
|
+
*
|
|
83
|
+
* // Image with view buttons
|
|
84
|
+
* WPP.chat.sendFileMessage(
|
|
85
|
+
* '<number>@c.us',
|
|
86
|
+
* 'data:image/jpeg;base64,<a long base64 file...>',
|
|
87
|
+
* {
|
|
88
|
+
* type: 'image',
|
|
89
|
+
* caption: 'My image'
|
|
90
|
+
* buttons: [
|
|
91
|
+
* {
|
|
92
|
+
* id: 'your custom id 1',
|
|
93
|
+
* text: 'Some text'
|
|
94
|
+
* },
|
|
95
|
+
* {
|
|
96
|
+
* id: 'another id 2',
|
|
97
|
+
* text: 'Another text'
|
|
98
|
+
* }
|
|
99
|
+
* ],
|
|
100
|
+
* footer: 'Footer text' // Optional
|
|
101
|
+
* }
|
|
102
|
+
* );
|
|
103
|
+
*
|
|
104
|
+
* // Image as Sticker
|
|
105
|
+
* WPP.chat.sendFileMessage(
|
|
106
|
+
* '<number>@c.us',
|
|
107
|
+
* 'data:image/png;base64,<a long base64 file...>',
|
|
108
|
+
* {
|
|
109
|
+
* type: 'sticker'
|
|
110
|
+
* }
|
|
111
|
+
* );
|
|
112
|
+
* ```
|
|
113
|
+
* @category Message
|
|
114
|
+
* @return {SendMessageReturn} The result
|
|
115
|
+
*/
|
|
116
|
+
export declare function sendFileMessage(chatId: any, content: any, options: AutoDetectMessageOptions | AudioMessageOptions | DocumentMessageOptions | ImageMessageOptions | VideoMessageOptions | StickerMessageOptions): Promise<SendMessageReturn>;
|
|
@@ -13,28 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import {
|
|
17
|
-
export interface ChatEventTypes {
|
|
18
|
-
change: string;
|
|
19
|
-
idle: undefined;
|
|
20
|
-
}
|
|
21
|
-
export interface GetMessagesOptions {
|
|
22
|
-
count?: number;
|
|
23
|
-
direction?: 'after' | 'before';
|
|
24
|
-
id?: string;
|
|
25
|
-
}
|
|
26
|
-
export interface SendMessageOptions {
|
|
27
|
-
waitForAck?: boolean;
|
|
28
|
-
createChat?: boolean;
|
|
29
|
-
}
|
|
30
|
-
export interface MessageButtonsOptions {
|
|
31
|
-
buttons?: Array<{
|
|
32
|
-
id: string;
|
|
33
|
-
text: string;
|
|
34
|
-
}>;
|
|
35
|
-
title?: string;
|
|
36
|
-
footer?: string;
|
|
37
|
-
}
|
|
16
|
+
import { SendMessageOptions, SendMessageReturn } from '..';
|
|
38
17
|
export interface ListMessageOptions extends SendMessageOptions {
|
|
39
18
|
buttonText: string;
|
|
40
19
|
description: string;
|
|
@@ -47,6 +26,28 @@ export interface ListMessageOptions extends SendMessageOptions {
|
|
|
47
26
|
}>;
|
|
48
27
|
}>;
|
|
49
28
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Send a list message
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```javascript
|
|
34
|
+
* WPP.chat.sendListMessage('<number>@c.us', {
|
|
35
|
+
* buttonText: 'Click Me!',
|
|
36
|
+
* description: "Hello it's list message",
|
|
37
|
+
* sections: [{
|
|
38
|
+
* title: 'Section 1',
|
|
39
|
+
* rows: [{
|
|
40
|
+
* rowId: 'rowid1',
|
|
41
|
+
* title: 'Row 1',
|
|
42
|
+
* description: "Hello it's description 1",
|
|
43
|
+
* },{
|
|
44
|
+
* rowId: 'rowid2',
|
|
45
|
+
* title: 'Row 2',
|
|
46
|
+
* description: "Hello it's description 2",
|
|
47
|
+
* }]
|
|
48
|
+
* }]
|
|
49
|
+
* });
|
|
50
|
+
* ```
|
|
51
|
+
* @category Message
|
|
52
|
+
*/
|
|
53
|
+
export declare function sendListMessage(chatId: any, options: ListMessageOptions): Promise<SendMessageReturn>;
|
|
@@ -0,0 +1,22 @@
|
|
|
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 { RawMessage, SendMessageOptions, SendMessageReturn } from '..';
|
|
17
|
+
/**
|
|
18
|
+
* Send a raw message
|
|
19
|
+
*
|
|
20
|
+
* @category Message
|
|
21
|
+
*/
|
|
22
|
+
export declare function sendRawMessage(chatId: any, rawMessage: RawMessage, options?: SendMessageOptions): Promise<SendMessageReturn>;
|
|
@@ -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
|
+
import { LinkPreviewOptions, MessageButtonsOptions, SendMessageOptions, SendMessageReturn } from '..';
|
|
17
|
+
export declare type TextMessageOptions = SendMessageOptions & MessageButtonsOptions & LinkPreviewOptions;
|
|
18
|
+
/**
|
|
19
|
+
* Send a text message
|
|
20
|
+
*
|
|
21
|
+
* @category Message
|
|
22
|
+
*/
|
|
23
|
+
export declare function sendTextMessage(chatId: any, content: any, options?: TextMessageOptions): Promise<SendMessageReturn>;
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
import { SendMessageOptions, SendMessageReturn } from '..';
|
|
18
|
+
export interface VCardContact {
|
|
19
|
+
id: string | Wid;
|
|
20
|
+
name: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Send a VCard as message
|
|
24
|
+
*
|
|
25
|
+
* @category Message
|
|
26
|
+
*/
|
|
27
|
+
export declare function sendVCardContactMessage(chatId: any, contacts: string | Wid | VCardContact | (string | Wid | VCardContact)[], options?: SendMessageOptions): Promise<SendMessageReturn>;
|
package/dist/chat/index.d.ts
CHANGED
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import
|
|
17
|
-
export * from './
|
|
16
|
+
import './events';
|
|
17
|
+
export * from './defaultSendMessageOptions';
|
|
18
|
+
export { clearListeners, EventTypes, listenerCount, off, on, once, UnsubscribeFn, } from './eventEmitter';
|
|
19
|
+
export * from './functions';
|
|
18
20
|
export * from './types';
|
|
19
|
-
declare const _default: Chat;
|
|
20
|
-
export default _default;
|
package/dist/chat/types.d.ts
CHANGED
|
@@ -15,52 +15,6 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { ModelPropertiesContructor, MsgKey, MsgModel, Wid } from '../whatsapp';
|
|
17
17
|
import { SendMsgResult } from '../whatsapp/enums';
|
|
18
|
-
export interface ChatEventTypes {
|
|
19
|
-
change: string;
|
|
20
|
-
idle: undefined;
|
|
21
|
-
msg_revoke: {
|
|
22
|
-
/**
|
|
23
|
-
* Author of message, only for groups
|
|
24
|
-
*/
|
|
25
|
-
author?: Wid;
|
|
26
|
-
from: Wid;
|
|
27
|
-
/**
|
|
28
|
-
* Message id of revoke event
|
|
29
|
-
*/
|
|
30
|
-
id: MsgKey;
|
|
31
|
-
/**
|
|
32
|
-
* Message id of revoked message
|
|
33
|
-
*/
|
|
34
|
-
refId: MsgKey;
|
|
35
|
-
to: Wid;
|
|
36
|
-
};
|
|
37
|
-
msg_ack_change: {
|
|
38
|
-
ack: number;
|
|
39
|
-
/**
|
|
40
|
-
* Who sended the ack, only for groups, broadcast and status
|
|
41
|
-
*/
|
|
42
|
-
sender?: Wid;
|
|
43
|
-
/**
|
|
44
|
-
* The chat that sended the messeage
|
|
45
|
-
*/
|
|
46
|
-
chat: Wid;
|
|
47
|
-
/**
|
|
48
|
-
* Message id of revoke event
|
|
49
|
-
*/
|
|
50
|
-
ids: MsgKey[];
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
export interface GetMessagesOptions {
|
|
54
|
-
count?: number;
|
|
55
|
-
direction?: 'after' | 'before';
|
|
56
|
-
id?: string;
|
|
57
|
-
}
|
|
58
|
-
export interface DeleteMessageReturn {
|
|
59
|
-
id: string;
|
|
60
|
-
sendMsgResult: Promise<SendMsgResult>;
|
|
61
|
-
isRevoked: boolean;
|
|
62
|
-
isDeleted: boolean;
|
|
63
|
-
}
|
|
64
18
|
export interface SendMessageOptions {
|
|
65
19
|
/**
|
|
66
20
|
* Create a new chat to a new contact
|
|
@@ -147,63 +101,4 @@ export interface SendMessageReturn {
|
|
|
147
101
|
ack: number;
|
|
148
102
|
sendMsgResult: Promise<SendMsgResult>;
|
|
149
103
|
}
|
|
150
|
-
export interface MessageButtonsOptions {
|
|
151
|
-
/**
|
|
152
|
-
* List of buttons, with at least 1 option and a maximum of 3
|
|
153
|
-
*/
|
|
154
|
-
buttons?: Array<{
|
|
155
|
-
id: string;
|
|
156
|
-
text: string;
|
|
157
|
-
}>;
|
|
158
|
-
/**
|
|
159
|
-
* Title for buttons, only for text message
|
|
160
|
-
*/
|
|
161
|
-
title?: string;
|
|
162
|
-
/**
|
|
163
|
-
* Footer text for buttons
|
|
164
|
-
*/
|
|
165
|
-
footer?: string;
|
|
166
|
-
}
|
|
167
|
-
export interface ListMessageOptions extends SendMessageOptions {
|
|
168
|
-
buttonText: string;
|
|
169
|
-
description: string;
|
|
170
|
-
sections: Array<{
|
|
171
|
-
title: string;
|
|
172
|
-
rows: Array<{
|
|
173
|
-
rowId: string;
|
|
174
|
-
title: string;
|
|
175
|
-
description: string;
|
|
176
|
-
}>;
|
|
177
|
-
}>;
|
|
178
|
-
}
|
|
179
|
-
export declare type TextMessageOptions = SendMessageOptions & MessageButtonsOptions;
|
|
180
|
-
export interface FileMessageOptions extends SendMessageOptions {
|
|
181
|
-
type: string;
|
|
182
|
-
caption?: string;
|
|
183
|
-
filename?: string;
|
|
184
|
-
mimetype?: string;
|
|
185
|
-
}
|
|
186
|
-
export interface AutoDetectMessageOptions extends FileMessageOptions {
|
|
187
|
-
type: 'auto-detect';
|
|
188
|
-
}
|
|
189
|
-
export interface AudioMessageOptions extends FileMessageOptions {
|
|
190
|
-
type: 'audio';
|
|
191
|
-
isPtt?: boolean;
|
|
192
|
-
}
|
|
193
|
-
export interface DocumentMessageOptions extends FileMessageOptions, MessageButtonsOptions {
|
|
194
|
-
type: 'document';
|
|
195
|
-
}
|
|
196
|
-
export interface ImageMessageOptions extends FileMessageOptions, MessageButtonsOptions {
|
|
197
|
-
type: 'image';
|
|
198
|
-
isViewOnce?: boolean;
|
|
199
|
-
}
|
|
200
|
-
export interface VideoMessageOptions extends FileMessageOptions, MessageButtonsOptions {
|
|
201
|
-
type: 'video';
|
|
202
|
-
isGif?: boolean;
|
|
203
|
-
}
|
|
204
|
-
export interface VCardContact {
|
|
205
|
-
id: string | Wid;
|
|
206
|
-
name: string;
|
|
207
|
-
}
|
|
208
|
-
export declare type AllMessageOptions = SendMessageOptions & MessageButtonsOptions & Partial<ListMessageOptions>;
|
|
209
104
|
export declare type RawMessage = ModelPropertiesContructor<MsgModel>;
|
|
@@ -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,16 @@
|
|
|
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 { queryExists } from './queryExists';
|
|
@@ -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 { Wid } from '../../whatsapp';
|
|
17
|
+
export declare function queryExists(contactId: string | Wid): Promise<{
|
|
18
|
+
wid: Wid;
|
|
19
|
+
biz: boolean;
|
|
20
|
+
} | null | undefined>;
|
package/dist/contact/index.d.ts
CHANGED
|
@@ -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
|
-
|
|
17
|
-
export * from './
|
|
18
|
-
export * from './types';
|
|
19
|
-
declare const _default: Contact;
|
|
20
|
-
export default _default;
|
|
16
|
+
export { clearListeners, EventTypes, listenerCount, off, on, once, UnsubscribeFn, } from './eventEmitter';
|
|
17
|
+
export * from './functions';
|
|
@@ -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,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 addParticipants(groupId: string | Wid, participantsIds: (string | Wid) | (string | Wid)[]): Promise<void>;
|