/*
* This file is part of WPPConnect.
*
* WPPConnect is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* WPPConnect is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with WPPConnect. If not, see .
*/
import {
Chat,
Contact,
GetMessagesParam,
HostDevice,
Id,
Message,
PartialMessage,
PresenceEvent,
ProfilePicThumbObj,
SendFileResult,
SendLinkResult,
SendPttResult,
WhatsappProfile,
} from '../api/model';
import { SessionToken } from '../token-store';
interface WAPI {
allNewMessagesListener: (callback: Function) => void;
archiveChat: (chatId: string, option: boolean) => boolean;
arrayBufferToBase64: (buffer: ArrayBuffer) => string;
checkNumberStatus: (contactId: string) => Promise;
downloadFile: (data: string) => Promise;
forwardMessage: (
toChatId: string | Wid,
msgId: string | MsgKey,
options?: {
displayCaptionText?: boolean;
multicast?: boolean;
}
) => boolean;
getAllChats: () => Chat[];
getAllChatsWithMessages: (withNewMessageOnly?: boolean) => Chat[];
getAllChatsWithNewMsg: () => Chat[];
getAllContacts: () => Contact[];
getAllMessagesInChat: (
chatId: string,
includeMe: boolean,
includeNotifications: boolean
) => Message[];
getAllNewMessages: () => Message[];
getAllUnreadMessages: () => PartialMessage[];
getBatteryLevel: () => number;
getBusinessProfilesProducts: (to: string) => any;
getOrderbyMsg: (messageId: string) => any;
getChat: (contactId: string) => Chat;
getChatById: (contactId: string) => Chat;
getChatIsOnline: (chatId: string) => Promise;
getLastSeen: (chatId: string) => Promise;
getContact: (contactId: string) => Contact;
getGroupParticipantIDs: (groupId: string) => Id[];
getHost: () => HostDevice;
getWid: () => string;
getListMute: (type?: string) => object;
getMessageById: (messageId: string) => Promise;
getMessages: (chatId: string, params: GetMessagesParam) => Promise;
getNumberProfile: (contactId: string) => WhatsappProfile;
getSessionTokenBrowser: (removePath?: boolean) => SessionToken;
getTheme: () => string;
getUnreadMessages: (
includeMe: boolean,
includeNotifications: boolean,
useUnreadCount: boolean
) => any;
getWAVersion: () => string;
isConnected: () => boolean;
isLoggedIn: () => boolean;
isRegistered: () => boolean;
joinGroup: (groupId: string) => Promise;
leaveGroup: (groupId: string) => any;
loadAndGetAllMessagesInChat: (
chatId: string,
includeMe: boolean,
includeNotifications: boolean
) => Message[];
loadEarlierMessages: (contactId: string) => Message[];
logout: () => Promise;
onAddedToGroup: (callback: Function) => any;
onIncomingCall: (callback: Function) => any;
onInterfaceChange: (callback: Function) => void;
onLiveLocation: (callback: Function) => any;
onNotificationMessage: (callback: (message: Message) => void) => any;
onParticipantsChanged: (groupId: string, callback: Function) => any;
onStateChange: (callback: Function) => void;
/**
*
* @deprecated in favor of {@link onStreamModeChanged}
*/
onStreamChange: (callback: Function) => void;
onStreamModeChanged: (callback: Function) => void;
onStreamInfoChanged: (callback: Function) => void;
onPresenceChanged: (callback: (presence: PresenceEvent) => void) => void;
pinChat: (
chatId: string,
option: boolean,
nonExistent?: boolean
) => Promise