@wppconnect/wa-js 2.10.1 → 2.11.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 (48) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/dist/assert/assertProduct.d.ts +22 -0
  3. package/dist/assert/index.d.ts +1 -0
  4. package/dist/catalog/functions/addProductImage.d.ts +28 -0
  5. package/dist/catalog/functions/changeProductImage.d.ts +28 -0
  6. package/dist/catalog/functions/createCollection.d.ts +26 -0
  7. package/dist/catalog/functions/createProduct.d.ts +47 -0
  8. package/dist/catalog/functions/deleteCollection.d.ts +26 -0
  9. package/dist/catalog/functions/deleteProduct.d.ts +30 -0
  10. package/dist/catalog/functions/editCollection.d.ts +32 -0
  11. package/dist/catalog/functions/editProduct.d.ts +36 -0
  12. package/dist/catalog/functions/getCollections.d.ts +31 -0
  13. package/dist/catalog/functions/getProductById.d.ts +28 -0
  14. package/dist/catalog/functions/getProducts.d.ts +27 -0
  15. package/dist/catalog/functions/index.d.ts +14 -0
  16. package/dist/catalog/functions/removeProductImage.d.ts +29 -0
  17. package/dist/catalog/functions/setProductVisibility.d.ts +30 -0
  18. package/dist/catalog/functions/updateCartEnabled.d.ts +30 -0
  19. package/dist/chat/functions/canMarkPlayed.d.ts +27 -0
  20. package/dist/chat/functions/getMessages.d.ts +25 -0
  21. package/dist/chat/functions/getPlatformFromMessage.d.ts +34 -0
  22. package/dist/chat/functions/index.d.ts +3 -0
  23. package/dist/chat/functions/markPlayed.d.ts +27 -0
  24. package/dist/contact/functions/getBusinessProfile.d.ts +27 -0
  25. package/dist/contact/functions/index.d.ts +1 -0
  26. package/dist/labels/functions/getLabelById.d.ts +17 -0
  27. package/dist/labels/functions/index.d.ts +1 -0
  28. package/dist/profile/functions/editBusinessProfile.d.ts +177 -0
  29. package/dist/profile/functions/index.d.ts +1 -0
  30. package/dist/status/functions/index.d.ts +1 -0
  31. package/dist/status/functions/sendReadStatus.d.ts +25 -0
  32. package/dist/whatsapp/collections/CatalogCollection.d.ts +3 -1
  33. package/dist/whatsapp/functions/calculateFilehashFromBlob.d.ts +19 -0
  34. package/dist/whatsapp/functions/collections.d.ts +37 -0
  35. package/dist/whatsapp/functions/editBusinessProfile.d.ts +20 -0
  36. package/dist/whatsapp/functions/index.d.ts +5 -0
  37. package/dist/whatsapp/functions/markSeen.d.ts +2 -1
  38. package/dist/whatsapp/functions/msgFindQuery.d.ts +2 -1
  39. package/dist/whatsapp/functions/productVisibilitySet.d.ts +21 -0
  40. package/dist/whatsapp/functions/products.d.ts +5 -0
  41. package/dist/whatsapp/functions/updateCartEnabled.d.ts +19 -0
  42. package/dist/whatsapp/misc/ProductCatalogSession.d.ts +27 -0
  43. package/dist/whatsapp/misc/index.d.ts +1 -0
  44. package/dist/whatsapp/models/CatalogModel.d.ts +2 -0
  45. package/dist/whatsapp/models/ProductCollModel.d.ts +4 -0
  46. package/dist/whatsapp/models/ProductModel.d.ts +2 -1
  47. package/dist/wppconnect-wa.js +1 -1
  48. package/package.json +9 -9
package/CHANGELOG.md CHANGED
@@ -1,3 +1,5 @@
1
+ # 2.11.0 (2022-08-13)
2
+
1
3
  ## 2.10.1 (2022-08-09)
2
4
 
3
5
  # 2.10.0 (2022-08-04)
@@ -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 { WPPError } from '../util';
17
+ import { ProductModel } from '../whatsapp';
18
+ export declare class InvalidProduct extends WPPError {
19
+ readonly id: string;
20
+ constructor(id: string);
21
+ }
22
+ export declare function assertGetProduct(productId: string): Promise<ProductModel>;
@@ -16,4 +16,5 @@
16
16
  export * from './assertChat';
17
17
  export * from './assertColor';
18
18
  export * from './assertIsBusiness';
19
+ export * from './assertProduct';
19
20
  export * from './assertWid';
@@ -0,0 +1,28 @@
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
+ * Add image on product
18
+ * This function include additional images on product
19
+ * for change main image use @changeProductImage
20
+ *
21
+ * @example
22
+ * ```javascript
23
+ * await WPP.catalog.addProductImage('686859858689', 'data:image/jpeg;base64,.....');
24
+ * ```
25
+ *
26
+ * @category Catalog
27
+ */
28
+ export declare function addProductImage(productId: string, content: string): Promise<any>;
@@ -0,0 +1,28 @@
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
+ * Add image on product
18
+ * This function change main image of product
19
+ * for change additional images use @addProductImage
20
+ *
21
+ * @example
22
+ * ```javascript
23
+ * await WPP.catalog.changeProductImage('686859858689', 'data:image/jpeg;base64,.....');
24
+ * ```
25
+ *
26
+ * @category Catalog
27
+ */
28
+ export declare function changeProductImage(productId: string, content: string): Promise<any>;
@@ -0,0 +1,26 @@
1
+ /*!
2
+ * Copyright 2022 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
+ * Create new collection
18
+ *
19
+ * @example
20
+ * ```javascript
21
+ * const myCatalog = await WPP.catalog.createCollection('Collection Name', ['565656589898']);
22
+ * ```
23
+ *
24
+ * @return Return collection created
25
+ */
26
+ export declare function createCollection(collectionName: string, productsId: string[]): Promise<any>;
@@ -0,0 +1,47 @@
1
+ /*!
2
+ * Copyright 2022 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 { ProductModel } from '../../whatsapp';
17
+ /**
18
+ * Create new product
19
+ *
20
+ * @example
21
+ * ```javascript
22
+ * const myCatalog = await WPP.catalog.addProduct(
23
+ {
24
+ name: 'Product name',
25
+ image: 'base64 image string',
26
+ description: 'product description',
27
+ price: '89.90',
28
+ isHidden: false,
29
+ url: 'https://wppconnect.io',
30
+ retailerId: 'AKA001',
31
+ }
32
+ );
33
+ * ```
34
+ *
35
+ * @return Your created product
36
+ */
37
+ export interface createProductParams {
38
+ name: string;
39
+ image: string;
40
+ description?: string;
41
+ price?: number;
42
+ isHidden?: boolean;
43
+ url?: string;
44
+ retailerId?: string;
45
+ currency?: string;
46
+ }
47
+ export declare function createProduct(params: createProductParams): Promise<ProductModel>;
@@ -0,0 +1,26 @@
1
+ /*!
2
+ * Copyright 2022 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
+ * Delete a collection
18
+ *
19
+ * @example
20
+ * ```javascript
21
+ * const myCatalog = await WPP.catalog.deleteCollection("377095767832354");
22
+ * ```
23
+ *
24
+ * @return Return sucess or error
25
+ */
26
+ export declare function deleteCollection(collectionId: string): Promise<any>;
@@ -0,0 +1,30 @@
1
+ /*!
2
+ * Copyright 2022 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
+ * Get your current catalog
18
+ *
19
+ * @example
20
+ * ```javascript
21
+ * // Delete product by id
22
+ * const myCatalog = await WPP.catalog.delProducts('6104203702939361');
23
+ *
24
+ * // Delete various products
25
+ * const myCatalog = await WPP.catalog.delProducts(['6104203702939361', '6104289702939361']);
26
+ * ```
27
+ *
28
+ * @return Return sucess or error of product deleted
29
+ */
30
+ export declare function delProducts(productsIds: string[]): Promise<any>;
@@ -0,0 +1,32 @@
1
+ /*!
2
+ * Copyright 2022 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
+ * Create new collection
18
+ *
19
+ * @example
20
+ * ```javascript
21
+ * const myCatalog = await WPP.catalog.EditCollection('565656589898', { collectionName: 'New Name for collection', productsToAdd: ['5656523223'], productsToRemove: ['5656523232']});
22
+ * ```
23
+ *
24
+ * @return Return collection edited
25
+ */
26
+ interface paramsEditCollection {
27
+ name?: string;
28
+ productsToAdd?: string[];
29
+ productsToRemove?: string[];
30
+ }
31
+ export declare function editCollection(collectionId: string, params: paramsEditCollection): Promise<any>;
32
+ export {};
@@ -0,0 +1,36 @@
1
+ /*!
2
+ * Copyright 2022 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 { ProductModel } from '../../whatsapp';
17
+ /**
18
+ * Get your current catalog
19
+ *
20
+ * @example
21
+ * ```javascript
22
+ * // Get your current catalog
23
+ * const myCatalog = WPP.catalog.editProduct('5498255476885590', {name: 'Plano 01', price: '89990', description: 'Insert description for your product', isHidden: true, url: 'http://www.wppconnect.io', retailerId: 'AKA001'});
24
+ * ```
25
+ *
26
+ * @return Return model of product edited
27
+ */
28
+ export interface editProductParams {
29
+ name?: string;
30
+ description?: string;
31
+ price?: number;
32
+ isHidden?: boolean;
33
+ url?: string;
34
+ retailerId?: string;
35
+ }
36
+ export declare function editProduct(productId: string, params: editProductParams): Promise<ProductModel>;
@@ -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
+ import { ProductCollModel } from '../../whatsapp';
17
+ /**
18
+ * Get collections of catalog
19
+ *
20
+ * @example
21
+ * ```javascript
22
+ * // Retrieve 20 collections of chat
23
+ * const myCatalog = await WPP.catalog.getCollections('552198554578@c.us', '20');
24
+ *
25
+ * // Retrieve 20 collections of chat and products arrays limit with 10 products
26
+ * const myCatalog = await WPP.catalog.getCollections('552198554578@c.us', '20', '10');
27
+ * ```
28
+ *
29
+ * @return Your collections of products
30
+ */
31
+ export declare function getCollections(chatId: string, qnt?: number, productsCount?: number): Promise<ProductCollModel[]>;
@@ -0,0 +1,28 @@
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 { ProductModel } from '../../whatsapp';
17
+ /**
18
+ * Retrieves product by id
19
+ *
20
+ * @example
21
+ * ```javascript
22
+ * // Retrieve data of product
23
+ * await WPP.catalog.getProductById('5521985565656@c.us', '68685985868923');
24
+ * ```
25
+ *
26
+ * @category Catalog
27
+ */
28
+ export declare function getProductById(chatId: string, productId: number): Promise<ProductModel>;
@@ -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
+ /**
17
+ * Retrieves product by contact id
18
+ *
19
+ * @example
20
+ * Get products of catalogs
21
+ * ```javascript
22
+ * await WPP.catalog.getProducts('5521985625689@c.us', 10);
23
+ * ```
24
+ * @return A array with products
25
+ * @category Catalog
26
+ */
27
+ export declare function getProducts(chatId: string, qnt: number): Promise<any[]>;
@@ -13,4 +13,18 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ export { addProductImage } from './addProductImage';
17
+ export { changeProductImage } from './changeProductImage';
18
+ export { createCollection } from './createCollection';
19
+ export { createProduct } from './createProduct';
20
+ export { deleteCollection } from './deleteCollection';
21
+ export { delProducts } from './deleteProduct';
22
+ export { editCollection } from './editCollection';
23
+ export { editProduct } from './editProduct';
24
+ export { getCollections } from './getCollections';
16
25
  export { getMyCatalog } from './getMyCatalog';
26
+ export { getProductById } from './getProductById';
27
+ export { getProducts } from './getProducts';
28
+ export { removeProductImage } from './removeProductImage';
29
+ export { setProductVisibility } from './setProductVisibility';
30
+ export { updateCartEnabled } from './updateCartEnabled';
@@ -0,0 +1,29 @@
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 { ProductModel } from '../../whatsapp';
17
+ /**
18
+ * Remove image on product
19
+ * This function remove additional images of product
20
+ * for change main image use @changeProductImage
21
+ *
22
+ * @example
23
+ * ```javascript
24
+ * await WPP.catalog.removeProductImage('68685985868923', '0');
25
+ * ```
26
+ * @param index - Index of array additionalImageCdnUrl
27
+ * @category Catalog
28
+ */
29
+ export declare function removeProductImage(productId: string, index: string): Promise<ProductModel>;
@@ -0,0 +1,30 @@
1
+ /*!
2
+ * Copyright 2022 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
+ * Get your current catalog
18
+ *
19
+ * @example
20
+ * ```javascript
21
+ * // Set product visibility hidden
22
+ * const myCatalog = await WPP.catalog.setProductVisibility(54985569989897, true);
23
+ * ```
24
+ * // Set product visible
25
+ * const myCatalog = await WPP.catalog.setProductVisibility(54985569989897, false);
26
+ * ```
27
+ *
28
+ * @return Return sucess of product visibility set
29
+ */
30
+ export declare function setProductVisibility(productId: any, isHidden: boolean): Promise<any>;
@@ -0,0 +1,30 @@
1
+ /*!
2
+ * Copyright 2022 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
+ * Get your current catalog
18
+ *
19
+ * @example
20
+ * ```javascript
21
+ * // Set product visibility hidden
22
+ * const myCatalog = await WPP.catalog.setProductVisibility(54985569989897, true);
23
+ * ```
24
+ * // Set product visible
25
+ * const myCatalog = await WPP.catalog.setProductVisibility(54985569989897, false);
26
+ * ```
27
+ *
28
+ * @return Return sucess of product visibility set
29
+ */
30
+ export declare function updateCartEnabled(enabled: boolean): Promise<any>;
@@ -0,0 +1,27 @@
1
+ /*!
2
+ * Copyright 2022 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 { Stringable } from '../../types';
17
+ import { MsgKey, MsgModel } from '../../whatsapp';
18
+ /**
19
+ * Get if message can played
20
+ *
21
+ * @example
22
+ * ```javascript
23
+ * WPP.chat.canMarkPlayed('[message_id]');
24
+ * ```
25
+ * @category Message
26
+ */
27
+ export declare function canMarkPlayed(messageId: string | MsgKey | MsgModel | Stringable): Promise<any>;
@@ -20,6 +20,7 @@ export interface GetMessagesOptions {
20
20
  direction?: 'after' | 'before';
21
21
  id?: string;
22
22
  onlyUnread?: boolean;
23
+ media?: 'url' | 'document' | 'all' | 'image';
23
24
  }
24
25
  /**
25
26
  * Fetch messages from a chat
@@ -54,6 +55,30 @@ export interface GetMessagesOptions {
54
55
  * direction: 'before',
55
56
  * id: '<full message id>'
56
57
  * });
58
+ *
59
+ * // Only media messages (url, document and links)
60
+ * WPP.chat.getMessages('[number]@c.us', {
61
+ * count: 20,
62
+ * media: 'all',
63
+ * });
64
+ *
65
+ * // Only image messages
66
+ * WPP.chat.getMessages('[number]@c.us', {
67
+ * count: 20,
68
+ * media: 'image',
69
+ * });
70
+ *
71
+ * // Only document messages
72
+ * WPP.chat.getMessages('[number]@c.us', {
73
+ * count: 20,
74
+ * media: 'document',
75
+ * });
76
+ *
77
+ * // Only link (url) messages
78
+ * WPP.chat.getMessages('[number]@c.us', {
79
+ * count: 20,
80
+ * media: 'url',
81
+ * });
57
82
  * ```
58
83
  * @category Message
59
84
  * @return {RawMessage[]} List of raw messages
@@ -0,0 +1,34 @@
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 { Stringable } from '../../types';
17
+ import { MsgKey, MsgModel } from '../../whatsapp';
18
+ /**
19
+ * Get the platform message from message ID
20
+ *
21
+ * The platform can be:
22
+ * * android
23
+ * * iphone
24
+ * * web
25
+ * * unknown
26
+ *
27
+ * @example
28
+ * ```javascript
29
+ * // to get platform from a message
30
+ * const platform = WPP.chat.getPlatformFromMessage('[message_id]');
31
+ * ```
32
+ * @category Message
33
+ */
34
+ export declare function getPlatformFromMessage(messageId: string | MsgKey | MsgModel | Stringable): 'android' | 'iphone' | 'web' | 'unknown';
@@ -14,6 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export { archive, unarchive } from './archive';
17
+ export { canMarkPlayed } from './canMarkPlayed';
17
18
  export { canMute } from './canMute';
18
19
  export { clear } from './clear';
19
20
  export { delete } from './delete';
@@ -25,12 +26,14 @@ export { get } from './get';
25
26
  export { getLastSeen } from './getLastSeen';
26
27
  export { getMessageById } from './getMessageById';
27
28
  export { getMessages, GetMessagesOptions } from './getMessages';
29
+ export { getPlatformFromMessage } from './getPlatformFromMessage';
28
30
  export { ChatListOptions, list } from './list';
29
31
  export { markIsComposing } from './markIsComposing';
30
32
  export { markIsPaused } from './markIsPaused';
31
33
  export { markIsRead } from './markIsRead';
32
34
  export { markIsRecording } from './markIsRecording';
33
35
  export { markIsUnread } from './markIsUnread';
36
+ export { markPlayed } from './markPlayed';
34
37
  export { mute } from './mute';
35
38
  export { openChatAt } from './openChatAt';
36
39
  export { openChatBottom } from './openChatBottom';
@@ -0,0 +1,27 @@
1
+ /*!
2
+ * Copyright 2022 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 { Stringable } from '../../types';
17
+ import { MsgKey, MsgModel } from '../../whatsapp';
18
+ /**
19
+ * Mark message as played
20
+ *
21
+ * @example
22
+ * ```javascript
23
+ * WPP.chat.markPlayed('[message_id]');
24
+ * ```
25
+ * @category Message
26
+ */
27
+ export declare function markPlayed(messageId: string | MsgKey | MsgModel | Stringable): Promise<any>;