feat: WA Business Labels support (#407)

* Get all labels
* Get chats by label
* Get labels assigned to chats

Co-authored-by: Pedro S. Lopez <pslamoros@hotmail.com>
Co-authored-by: Pedro Lopez <pedroslopez@me.com>
This commit is contained in:
dyegoaurelio
2020-12-17 17:30:36 -03:00
committed by Pedro S. Lopez
parent 563f73d290
commit 274d24002b
6 changed files with 166 additions and 2 deletions

26
index.d.ts vendored
View File

@@ -50,6 +50,18 @@ declare namespace WAWebJS {
/** Get all current contact instances */
getContacts(): Promise<Contact[]>
/** Get all current Labels */
getLabels(): Promise<Label[]>
/** Get Label instance by ID */
getLabelById(labelId: string): Promise<Label>
/** Get all Labels assigned to a Chat */
getChatLabels(chatId: string): Promise<Label[]>
/** Get all Chats for a specific Label */
getChatsByLabelId(labelId: string): Promise<Chat[]>
/** Returns the contact ID's profile picture URL, if privacy settings allow it */
getProfilePicUrl(contactId: string): Promise<string>
@@ -520,6 +532,18 @@ declare namespace WAWebJS {
longitude: string,
}
export interface Label {
/** Label name */
name: string,
/** Label ID */
id: string,
/** Color assigned to the label */
hexColor: string,
/** Get all chats that have been assigned this Label */
getChats: () => Promise<Chat[]>
}
/** Options for sending a message */
export interface MessageSendOptions {
/** Show links preview */
@@ -731,6 +755,8 @@ declare namespace WAWebJS {
unmute: () => Promise<void>,
/** Returns the Contact that corresponds to this Chat. */
getContact: () => Promise<Contact>,
/** Returns array of all Labels assigned to this Chat */
getLabels: () => Promise<Label[]>
}
export interface MessageSearchOptions {