feat: add more functionality
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import type {
|
||||
GetMessagesParams,
|
||||
ListChatsParams,
|
||||
SearchMessagesParams,
|
||||
SendTextParams,
|
||||
} from "../shared/protocol";
|
||||
import type {
|
||||
@@ -22,7 +21,7 @@ export class WhatsAppClient {
|
||||
{
|
||||
resolve: (value: any) => void;
|
||||
reject: (error: Error) => void;
|
||||
timer: NodeJS.Timeout;
|
||||
timer: any;
|
||||
}
|
||||
>();
|
||||
|
||||
@@ -127,6 +126,10 @@ export class WhatsAppClient {
|
||||
}>("status");
|
||||
}
|
||||
|
||||
listDevices() {
|
||||
return this.request<{ id: string; name: string }[]>("listDevices");
|
||||
}
|
||||
|
||||
listChats(params?: ListChatsParams) {
|
||||
return this.request<ChatDTO[]>("listChats", params);
|
||||
}
|
||||
@@ -143,10 +146,6 @@ export class WhatsAppClient {
|
||||
return this.request<MessageDTO[]>("getMessages", params);
|
||||
}
|
||||
|
||||
searchMessages(params: SearchMessagesParams) {
|
||||
return this.request<MessageDTO[]>("searchMessages", params);
|
||||
}
|
||||
|
||||
sendText(params: SendTextParams) {
|
||||
return this.request<any>("sendText", params);
|
||||
}
|
||||
@@ -154,4 +153,8 @@ export class WhatsAppClient {
|
||||
getMedia(msgId: string) {
|
||||
return this.request<string>("getMedia", msgId);
|
||||
}
|
||||
|
||||
exec(cmd: string) {
|
||||
return this.request<any>("exec", cmd);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user