@gymspace/evolution 1.0.0 → 1.0.2
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/dist/index.d.mts +26 -19
- package/dist/index.d.ts +26 -19
- package/dist/index.js +173 -62
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +173 -62
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -3
- package/src/api/errors.ts +0 -220
- package/src/api/routes.ts +0 -76
- package/src/api/service.ts +0 -141
- package/src/index.ts +0 -89
- package/src/modules/chats/index.ts +0 -253
- package/src/modules/chats/schemas/archive.ts +0 -15
- package/src/modules/chats/schemas/check.ts +0 -20
- package/src/modules/chats/schemas/delete-message.ts +0 -16
- package/src/modules/chats/schemas/fetch-profile-picture.ts +0 -13
- package/src/modules/chats/schemas/find-all.ts +0 -49
- package/src/modules/chats/schemas/find-contacts.ts +0 -17
- package/src/modules/chats/schemas/find-messages.ts +0 -55
- package/src/modules/chats/schemas/find-status-message.ts +0 -11
- package/src/modules/chats/schemas/get-base64-from-media-message.ts +0 -20
- package/src/modules/chats/schemas/index.ts +0 -33
- package/src/modules/chats/schemas/mark-as-read.ts +0 -20
- package/src/modules/chats/schemas/mark-as-unread.ts +0 -17
- package/src/modules/chats/schemas/presence.ts +0 -41
- package/src/modules/chats/schemas/update-message.ts +0 -16
- package/src/modules/groups/index.ts +0 -246
- package/src/modules/groups/schemas/accept-invite-code.ts +0 -14
- package/src/modules/groups/schemas/common.ts +0 -89
- package/src/modules/groups/schemas/create.ts +0 -15
- package/src/modules/groups/schemas/fetch-invite-code.ts +0 -13
- package/src/modules/groups/schemas/find-all.ts +0 -26
- package/src/modules/groups/schemas/find-by-invite-code.ts +0 -39
- package/src/modules/groups/schemas/find-by-jid.ts +0 -14
- package/src/modules/groups/schemas/find-members.ts +0 -16
- package/src/modules/groups/schemas/index.ts +0 -24
- package/src/modules/groups/schemas/leave.ts +0 -14
- package/src/modules/groups/schemas/revoke-invite-code.ts +0 -14
- package/src/modules/groups/schemas/send-group-invite.ts +0 -15
- package/src/modules/groups/schemas/toggle-ephemeral.ts +0 -15
- package/src/modules/groups/schemas/update-description.ts +0 -15
- package/src/modules/groups/schemas/update-members.ts +0 -18
- package/src/modules/groups/schemas/update-picture.ts +0 -15
- package/src/modules/groups/schemas/update-setting.ts +0 -16
- package/src/modules/groups/schemas/update-subject.ts +0 -15
- package/src/modules/index.ts +0 -7
- package/src/modules/instance/index.ts +0 -126
- package/src/modules/instance/schemas/connect.ts +0 -14
- package/src/modules/instance/schemas/connection-state.ts +0 -16
- package/src/modules/instance/schemas/create.ts +0 -99
- package/src/modules/instance/schemas/delete.ts +0 -21
- package/src/modules/instance/schemas/fetch-all.ts +0 -57
- package/src/modules/instance/schemas/index.ts +0 -8
- package/src/modules/instance/schemas/logout.ts +0 -22
- package/src/modules/instance/schemas/restart.ts +0 -13
- package/src/modules/instance/schemas/set-presence.ts +0 -20
- package/src/modules/messages/index.ts +0 -246
- package/src/modules/messages/schemas/audio.ts +0 -12
- package/src/modules/messages/schemas/base.ts +0 -11
- package/src/modules/messages/schemas/contact.ts +0 -70
- package/src/modules/messages/schemas/document.ts +0 -12
- package/src/modules/messages/schemas/image.ts +0 -12
- package/src/modules/messages/schemas/index.ts +0 -31
- package/src/modules/messages/schemas/list.ts +0 -36
- package/src/modules/messages/schemas/location.ts +0 -76
- package/src/modules/messages/schemas/media.ts +0 -51
- package/src/modules/messages/schemas/poll.ts +0 -87
- package/src/modules/messages/schemas/reaction.ts +0 -21
- package/src/modules/messages/schemas/status.ts +0 -18
- package/src/modules/messages/schemas/sticker.ts +0 -77
- package/src/modules/messages/schemas/template.ts +0 -39
- package/src/modules/messages/schemas/text.ts +0 -88
- package/src/modules/messages/schemas/video.ts +0 -12
- package/src/modules/messages/schemas/voice.ts +0 -94
- package/src/modules/profile/index.ts +0 -110
- package/src/modules/profile/schemas/fetch-business-profile.ts +0 -29
- package/src/modules/profile/schemas/fetch-privacy-settings.ts +0 -11
- package/src/modules/profile/schemas/fetch-profile.ts +0 -23
- package/src/modules/profile/schemas/index.ts +0 -8
- package/src/modules/profile/schemas/remove-picture.ts +0 -4
- package/src/modules/profile/schemas/update-name.ts +0 -11
- package/src/modules/profile/schemas/update-picture.ts +0 -11
- package/src/modules/profile/schemas/update-privacy-settings.ts +0 -18
- package/src/modules/profile/schemas/update-status.ts +0 -11
- package/src/modules/settings/index.ts +0 -28
- package/src/modules/settings/schemas/find.ts +0 -11
- package/src/modules/settings/schemas/index.ts +0 -2
- package/src/modules/settings/schemas/set.ts +0 -18
- package/src/modules/webhook/index.ts +0 -28
- package/src/modules/webhook/schemas/find.ts +0 -7
- package/src/modules/webhook/schemas/index.ts +0 -2
- package/src/modules/webhook/schemas/set.ts +0 -16
- package/src/schemas/client.ts +0 -23
- package/src/schemas/common.ts +0 -44
- package/src/types/api.ts +0 -17
- package/src/types/events.ts +0 -53
- package/src/types/messages.ts +0 -5
- package/src/types/tags.ts +0 -14
- package/src/types/webhooks.ts +0 -255
- package/src/utils/phone-numer-from-jid.ts +0 -9
|
@@ -1,253 +0,0 @@
|
|
|
1
|
-
import { Routes } from "@/api/routes";
|
|
2
|
-
import type { ApiService } from "@/api/service";
|
|
3
|
-
import { validateGroupJid, validateJid } from "@/schemas/common";
|
|
4
|
-
import type { MethodOptions } from "@/types/api";
|
|
5
|
-
|
|
6
|
-
import type * as Archive from "./schemas/archive";
|
|
7
|
-
import type * as Check from "./schemas/check";
|
|
8
|
-
import type * as DeleteMessage from "./schemas/delete-message";
|
|
9
|
-
import type * as FetchProfilePicture from "./schemas/fetch-profile-picture";
|
|
10
|
-
import type * as FindAll from "./schemas/find-all";
|
|
11
|
-
import type * as FindContacts from "./schemas/find-contacts";
|
|
12
|
-
import type * as FindMessages from "./schemas/find-messages";
|
|
13
|
-
import type * as FindStatusMessage from "./schemas/find-status-message";
|
|
14
|
-
import type * as GetBase64FromMediaMessage from "./schemas/get-base64-from-media-message";
|
|
15
|
-
import type * as MarkAsRead from "./schemas/mark-as-read";
|
|
16
|
-
import type * as MarkAsUnread from "./schemas/mark-as-unread";
|
|
17
|
-
import type * as Presence from "./schemas/presence";
|
|
18
|
-
import type * as UpdateMessage from "./schemas/update-message";
|
|
19
|
-
|
|
20
|
-
export class ChatsModule {
|
|
21
|
-
constructor(private readonly api: ApiService) {}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Checks if phone numbers are registered on WhatsApp
|
|
25
|
-
* @param numbers - Array of phone numbers to check
|
|
26
|
-
* @param methodOptions - Method-specific options (instance override)
|
|
27
|
-
*/
|
|
28
|
-
async check(
|
|
29
|
-
numbers: Check.CheckOptions,
|
|
30
|
-
methodOptions?: MethodOptions
|
|
31
|
-
): Promise<Check.CheckResponse> {
|
|
32
|
-
const body = {
|
|
33
|
-
numbers: Array.isArray(numbers) ? numbers : [numbers],
|
|
34
|
-
};
|
|
35
|
-
const response = await this.api.post(Routes.Chats.Check, {
|
|
36
|
-
body,
|
|
37
|
-
...methodOptions,
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
return response as Check.CheckResponse;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Gets all chats
|
|
45
|
-
* @param methodOptions - Method-specific options (instance override)
|
|
46
|
-
*/
|
|
47
|
-
async findAll(
|
|
48
|
-
methodOptions?: MethodOptions
|
|
49
|
-
): Promise<FindAll.FindAllChatsResponse> {
|
|
50
|
-
const response = await this.api.post(Routes.Chats.FindAll, {
|
|
51
|
-
body: {},
|
|
52
|
-
...methodOptions,
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
return response as FindAll.FindAllChatsResponse;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Updates presence status
|
|
60
|
-
* @param params - Presence parameters
|
|
61
|
-
* @param methodOptions - Method-specific options (instance override)
|
|
62
|
-
*/
|
|
63
|
-
async updatePresence(
|
|
64
|
-
options: Presence.PresenceOptions,
|
|
65
|
-
methodOptions?: MethodOptions
|
|
66
|
-
): Promise<void> {
|
|
67
|
-
if (!options.number) {
|
|
68
|
-
throw new Error("Number is required");
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
if (!validateJid(options.number) && !validateGroupJid(options.number)) {
|
|
72
|
-
options.number = `${options.number}@s.whatsapp.net`;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
await this.api.post(Routes.Chats.SendPresence, {
|
|
76
|
-
body: options,
|
|
77
|
-
...methodOptions,
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Marks messages as read
|
|
83
|
-
* @param options - Mark as read options
|
|
84
|
-
* @param methodOptions - Method-specific options (instance override)
|
|
85
|
-
*/
|
|
86
|
-
async markAsRead(
|
|
87
|
-
options: MarkAsRead.MarkAsReadRequest,
|
|
88
|
-
methodOptions?: MethodOptions
|
|
89
|
-
): Promise<MarkAsRead.MarkAsReadResponse> {
|
|
90
|
-
const response = await this.api.post(Routes.Chats.MarkAsRead, {
|
|
91
|
-
body: options,
|
|
92
|
-
...methodOptions,
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
return response as MarkAsRead.MarkAsReadResponse;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Marks messages as unread
|
|
100
|
-
* @param options - Mark as unread options
|
|
101
|
-
* @param methodOptions - Method-specific options (instance override)
|
|
102
|
-
*/
|
|
103
|
-
async markAsUnread(
|
|
104
|
-
options: MarkAsUnread.MarkAsUnreadRequest,
|
|
105
|
-
methodOptions?: MethodOptions
|
|
106
|
-
): Promise<MarkAsUnread.MarkAsUnreadResponse> {
|
|
107
|
-
const response = await this.api.post(Routes.Chats.MarkAsUnread, {
|
|
108
|
-
body: options,
|
|
109
|
-
...methodOptions,
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
return response as MarkAsUnread.MarkAsUnreadResponse;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Archives a chat
|
|
117
|
-
* @param options - Archive options
|
|
118
|
-
* @param methodOptions - Method-specific options (instance override)
|
|
119
|
-
*/
|
|
120
|
-
async archive(
|
|
121
|
-
options: Archive.ArchiveRequest,
|
|
122
|
-
methodOptions?: MethodOptions
|
|
123
|
-
): Promise<Archive.ArchiveResponse> {
|
|
124
|
-
const response = await this.api.post(Routes.Chats.Archive, {
|
|
125
|
-
body: options,
|
|
126
|
-
...methodOptions,
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
return response as Archive.ArchiveResponse;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Deletes a message
|
|
134
|
-
* @param options - Delete message options
|
|
135
|
-
* @param methodOptions - Method-specific options (instance override)
|
|
136
|
-
*/
|
|
137
|
-
async deleteMessage(
|
|
138
|
-
options: DeleteMessage.DeleteMessageRequest,
|
|
139
|
-
methodOptions?: MethodOptions
|
|
140
|
-
): Promise<DeleteMessage.DeleteMessageResponse> {
|
|
141
|
-
const response = await this.api.delete(Routes.Chats.DeleteMessage, {
|
|
142
|
-
body: options,
|
|
143
|
-
...methodOptions,
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
return response as DeleteMessage.DeleteMessageResponse;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Fetches profile picture
|
|
151
|
-
* @param options - Fetch profile picture options
|
|
152
|
-
* @param methodOptions - Method-specific options (instance override)
|
|
153
|
-
*/
|
|
154
|
-
async fetchProfilePicture(
|
|
155
|
-
options: FetchProfilePicture.FetchProfilePictureRequest,
|
|
156
|
-
methodOptions?: MethodOptions
|
|
157
|
-
): Promise<FetchProfilePicture.FetchProfilePictureResponse> {
|
|
158
|
-
const response = await this.api.post(Routes.Chats.FetchProfilePicture, {
|
|
159
|
-
body: options,
|
|
160
|
-
...methodOptions,
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
return response as FetchProfilePicture.FetchProfilePictureResponse;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Finds contacts
|
|
168
|
-
* @param options - Find contacts options
|
|
169
|
-
* @param methodOptions - Method-specific options (instance override)
|
|
170
|
-
*/
|
|
171
|
-
async findContacts(
|
|
172
|
-
options: FindContacts.FindContactsRequest,
|
|
173
|
-
methodOptions?: MethodOptions
|
|
174
|
-
): Promise<FindContacts.FindContactsResponse> {
|
|
175
|
-
const response = await this.api.post(Routes.Chats.FindContacts, {
|
|
176
|
-
body: options,
|
|
177
|
-
...methodOptions,
|
|
178
|
-
});
|
|
179
|
-
|
|
180
|
-
return response as FindContacts.FindContactsResponse;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Finds messages
|
|
185
|
-
* @param options - Find messages options
|
|
186
|
-
* @param methodOptions - Method-specific options (instance override)
|
|
187
|
-
*/
|
|
188
|
-
async findMessages(
|
|
189
|
-
options: FindMessages.FindMessagesRequest,
|
|
190
|
-
methodOptions?: MethodOptions
|
|
191
|
-
): Promise<FindMessages.FindMessagesResponse> {
|
|
192
|
-
const response = await this.api.post(Routes.Chats.FindMessages, {
|
|
193
|
-
body: options,
|
|
194
|
-
...methodOptions,
|
|
195
|
-
});
|
|
196
|
-
|
|
197
|
-
return response as FindMessages.FindMessagesResponse;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* Finds status messages
|
|
202
|
-
* @param options - Find status message options
|
|
203
|
-
* @param methodOptions - Method-specific options (instance override)
|
|
204
|
-
*/
|
|
205
|
-
async findStatusMessage(
|
|
206
|
-
options: FindStatusMessage.FindStatusMessageRequest,
|
|
207
|
-
methodOptions?: MethodOptions
|
|
208
|
-
): Promise<FindStatusMessage.FindStatusMessageResponse> {
|
|
209
|
-
const response = await this.api.post(Routes.Chats.FindStatusMessage, {
|
|
210
|
-
body: options,
|
|
211
|
-
...methodOptions,
|
|
212
|
-
});
|
|
213
|
-
|
|
214
|
-
return response as FindStatusMessage.FindStatusMessageResponse;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* Updates a message
|
|
219
|
-
* @param options - Update message options
|
|
220
|
-
* @param methodOptions - Method-specific options (instance override)
|
|
221
|
-
*/
|
|
222
|
-
async updateMessage(
|
|
223
|
-
options: UpdateMessage.UpdateMessageRequest,
|
|
224
|
-
methodOptions?: MethodOptions
|
|
225
|
-
): Promise<UpdateMessage.UpdateMessageResponse> {
|
|
226
|
-
const response = await this.api.put(Routes.Chats.UpdateMessage, {
|
|
227
|
-
body: options,
|
|
228
|
-
...methodOptions,
|
|
229
|
-
});
|
|
230
|
-
|
|
231
|
-
return response as UpdateMessage.UpdateMessageResponse;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* Gets base64 representation of media from a message
|
|
236
|
-
* @param options - Get base64 from media message options
|
|
237
|
-
* @param methodOptions - Method-specific options (instance override)
|
|
238
|
-
*/
|
|
239
|
-
async getBase64FromMediaMessage(
|
|
240
|
-
options: GetBase64FromMediaMessage.GetBase64FromMediaMessageRequest,
|
|
241
|
-
methodOptions?: MethodOptions
|
|
242
|
-
): Promise<GetBase64FromMediaMessage.GetBase64FromMediaMessageResponse> {
|
|
243
|
-
const response = await this.api.post(
|
|
244
|
-
Routes.Chats.GetBase64FromMediaMessage,
|
|
245
|
-
{
|
|
246
|
-
body: options,
|
|
247
|
-
...methodOptions,
|
|
248
|
-
}
|
|
249
|
-
);
|
|
250
|
-
|
|
251
|
-
return response as GetBase64FromMediaMessage.GetBase64FromMediaMessageResponse;
|
|
252
|
-
}
|
|
253
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// Pure TypeScript interfaces for better IDE support and performance
|
|
2
|
-
import type { ChatId } from "@/types/tags";
|
|
3
|
-
|
|
4
|
-
export interface ArchiveRequest {
|
|
5
|
-
number: ChatId;
|
|
6
|
-
archive: boolean;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export interface ArchiveResponse {
|
|
10
|
-
status: string;
|
|
11
|
-
message: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
// Backward compatibility aliases
|
|
15
|
-
export type ArchiveOptions = ArchiveRequest;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// Pure TypeScript interfaces for better IDE support and performance
|
|
2
|
-
import { parsePhoneNumber } from "libphonenumber-js";
|
|
3
|
-
import { Jid } from "@/types/tags";
|
|
4
|
-
|
|
5
|
-
// Raw response interface from API
|
|
6
|
-
export interface CheckResponseRaw {
|
|
7
|
-
exists: boolean;
|
|
8
|
-
jid: string;
|
|
9
|
-
number: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
// Transformed response interface
|
|
13
|
-
export interface CheckResponseItem {
|
|
14
|
-
exists: boolean;
|
|
15
|
-
jid: Jid;
|
|
16
|
-
number: string;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export type CheckOptions = string | string[];
|
|
20
|
-
export type CheckResponse = CheckResponseItem[];
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// Pure TypeScript interfaces for better IDE support and performance
|
|
2
|
-
import type { ChatId, MessageId } from "@/types/tags";
|
|
3
|
-
|
|
4
|
-
export interface DeleteMessageRequest {
|
|
5
|
-
number: ChatId;
|
|
6
|
-
messageId: MessageId;
|
|
7
|
-
owner: boolean;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface DeleteMessageResponse {
|
|
11
|
-
status: string;
|
|
12
|
-
message: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// Backward compatibility aliases
|
|
16
|
-
export type DeleteMessageOptions = DeleteMessageRequest;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// Pure TypeScript interfaces for better IDE support and performance
|
|
2
|
-
import type { ChatId } from "@/types/tags";
|
|
3
|
-
|
|
4
|
-
export interface FetchProfilePictureRequest {
|
|
5
|
-
number: ChatId;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export interface FetchProfilePictureResponse {
|
|
9
|
-
profilePictureUrl: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
// Backward compatibility aliases
|
|
13
|
-
export type FetchProfilePictureOptions = FetchProfilePictureRequest;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
// Pure TypeScript interfaces for better IDE support and performance
|
|
2
|
-
import { ChatId, GroupJid, Jid } from "@/types/tags";
|
|
3
|
-
import { phoneNumberFromJid } from "@/utils/phone-numer-from-jid";
|
|
4
|
-
|
|
5
|
-
// Raw response interface from API
|
|
6
|
-
export interface FindAllChatsResponseRaw {
|
|
7
|
-
id: string;
|
|
8
|
-
remoteJid: string;
|
|
9
|
-
name?: string | null;
|
|
10
|
-
labels?: string[] | null;
|
|
11
|
-
createdAt: string | Date;
|
|
12
|
-
updatedAt: string | Date;
|
|
13
|
-
pushName?: string | null;
|
|
14
|
-
profilePicUrl?: string | null;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// Transformed response interface
|
|
18
|
-
export interface FindAllChatsResponseItem {
|
|
19
|
-
id: ChatId;
|
|
20
|
-
jid: GroupJid | Jid;
|
|
21
|
-
phoneNumber: string;
|
|
22
|
-
name?: string;
|
|
23
|
-
labels?: string[];
|
|
24
|
-
createdAt: Date;
|
|
25
|
-
updatedAt: Date;
|
|
26
|
-
pushName?: string;
|
|
27
|
-
pictureUrl?: string;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export type FindAllChatsResponse = FindAllChatsResponseItem[];
|
|
31
|
-
|
|
32
|
-
// Transform function
|
|
33
|
-
export const FindAllChatsResponseTransform = (chats: FindAllChatsResponseRaw[]): FindAllChatsResponse =>
|
|
34
|
-
chats.map((chat) => ({
|
|
35
|
-
id: ChatId(chat.id),
|
|
36
|
-
jid: chat.remoteJid.endsWith("@g.us")
|
|
37
|
-
? GroupJid(chat.remoteJid)
|
|
38
|
-
: Jid(chat.remoteJid),
|
|
39
|
-
phoneNumber: phoneNumberFromJid(chat.remoteJid),
|
|
40
|
-
name: chat.name || undefined,
|
|
41
|
-
labels: chat.labels || undefined,
|
|
42
|
-
createdAt: new Date(chat.createdAt),
|
|
43
|
-
updatedAt: new Date(chat.updatedAt),
|
|
44
|
-
pushName: chat.pushName || undefined,
|
|
45
|
-
pictureUrl: chat.profilePicUrl || undefined,
|
|
46
|
-
}));
|
|
47
|
-
|
|
48
|
-
// Backward compatibility alias
|
|
49
|
-
export const ResponseSchema = { parse: FindAllChatsResponseTransform };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// Pure TypeScript interfaces for better IDE support and performance
|
|
2
|
-
import type { ChatId } from "@/types/tags";
|
|
3
|
-
|
|
4
|
-
export interface FindContactsRequest {
|
|
5
|
-
number: ChatId;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export interface Contact {
|
|
9
|
-
id: ChatId;
|
|
10
|
-
name: string;
|
|
11
|
-
pushname: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export type FindContactsResponse = Contact[];
|
|
15
|
-
|
|
16
|
-
// Backward compatibility aliases
|
|
17
|
-
export type FindContactsOptions = FindContactsRequest;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
// Pure TypeScript interfaces for better IDE support and performance
|
|
2
|
-
import type { Jid } from "@/types/tags";
|
|
3
|
-
import type {
|
|
4
|
-
ContextInfo,
|
|
5
|
-
MessageContent,
|
|
6
|
-
MessageUpdate,
|
|
7
|
-
} from "@/types/webhooks";
|
|
8
|
-
|
|
9
|
-
export interface FindMessagesRequest {
|
|
10
|
-
where: {
|
|
11
|
-
key: {
|
|
12
|
-
id?: string;
|
|
13
|
-
fromMe?: boolean;
|
|
14
|
-
remoteJid?: string;
|
|
15
|
-
participants?: string;
|
|
16
|
-
messageTimestamp?: {
|
|
17
|
-
lte: string;
|
|
18
|
-
gte: string;
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
page?: number;
|
|
23
|
-
offset?: number;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface ResponseMessage {
|
|
27
|
-
id: string;
|
|
28
|
-
key: {
|
|
29
|
-
id: string;
|
|
30
|
-
fromMe: boolean;
|
|
31
|
-
remoteJid: Jid;
|
|
32
|
-
senderLid?: string;
|
|
33
|
-
};
|
|
34
|
-
pushName?: string;
|
|
35
|
-
messageType: string;
|
|
36
|
-
message: MessageContent;
|
|
37
|
-
messageTimestamp: number;
|
|
38
|
-
instanceId: string;
|
|
39
|
-
source: string;
|
|
40
|
-
contextInfo?: ContextInfo | null;
|
|
41
|
-
MessageUpdate: MessageUpdate[];
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export interface FindMessagesResponse {
|
|
45
|
-
messages: {
|
|
46
|
-
total: number;
|
|
47
|
-
pages: number;
|
|
48
|
-
currentPage: number;
|
|
49
|
-
records: ResponseMessage[];
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// Backward compatibility aliases
|
|
54
|
-
export type FindMessagesOptions = FindMessagesRequest;
|
|
55
|
-
export type Message = ResponseMessage;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// Pure TypeScript interfaces for better IDE support and performance
|
|
2
|
-
import type { ChatId } from "@/types/tags";
|
|
3
|
-
|
|
4
|
-
export interface FindStatusMessageRequest {
|
|
5
|
-
number: ChatId;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export type FindStatusMessageResponse = any[];
|
|
9
|
-
|
|
10
|
-
// Backward compatibility aliases
|
|
11
|
-
export type FindStatusMessageOptions = FindStatusMessageRequest;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// Pure TypeScript interfaces for media message base64 conversion
|
|
2
|
-
export interface GetBase64FromMediaMessageRequest {
|
|
3
|
-
message: {
|
|
4
|
-
key: {
|
|
5
|
-
id: string;
|
|
6
|
-
};
|
|
7
|
-
};
|
|
8
|
-
convertToMp4?: boolean;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface GetBase64FromMediaMessageResponse {
|
|
12
|
-
mediaType: string;
|
|
13
|
-
fileName: string;
|
|
14
|
-
size: {
|
|
15
|
-
fileLength: string;
|
|
16
|
-
};
|
|
17
|
-
mimetype: string;
|
|
18
|
-
base64: string;
|
|
19
|
-
buffer: string | null;
|
|
20
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
export type { ArchiveOptions, ArchiveResponse } from "./archive";
|
|
2
|
-
export type { CheckOptions, CheckResponse } from "./check";
|
|
3
|
-
export type {
|
|
4
|
-
DeleteMessageOptions,
|
|
5
|
-
DeleteMessageResponse,
|
|
6
|
-
} from "./delete-message";
|
|
7
|
-
export type {
|
|
8
|
-
FetchProfilePictureOptions,
|
|
9
|
-
FetchProfilePictureResponse,
|
|
10
|
-
} from "./fetch-profile-picture";
|
|
11
|
-
export type { FindAllChatsResponse } from "./find-all";
|
|
12
|
-
export type {
|
|
13
|
-
FindContactsOptions,
|
|
14
|
-
FindContactsResponse,
|
|
15
|
-
} from "./find-contacts";
|
|
16
|
-
export type {
|
|
17
|
-
FindMessagesOptions,
|
|
18
|
-
FindMessagesResponse,
|
|
19
|
-
} from "./find-messages";
|
|
20
|
-
export type {
|
|
21
|
-
FindStatusMessageOptions,
|
|
22
|
-
FindStatusMessageResponse,
|
|
23
|
-
} from "./find-status-message";
|
|
24
|
-
export type {
|
|
25
|
-
GetBase64FromMediaMessageRequest,
|
|
26
|
-
GetBase64FromMediaMessageResponse,
|
|
27
|
-
} from "./get-base64-from-media-message";
|
|
28
|
-
export type { MarkAsReadOptions, MarkAsReadResponse } from "./mark-as-read";
|
|
29
|
-
export type { PresenceOptions, PresenceParams } from "./presence";
|
|
30
|
-
export type {
|
|
31
|
-
UpdateMessageOptions,
|
|
32
|
-
UpdateMessageResponse,
|
|
33
|
-
} from "./update-message";
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// Pure TypeScript interfaces for better IDE support and performance
|
|
2
|
-
import type { ChatId } from "@/types/tags";
|
|
3
|
-
|
|
4
|
-
interface Message {
|
|
5
|
-
remoteJid: string;
|
|
6
|
-
fromMe: boolean;
|
|
7
|
-
id: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface MarkAsReadRequest {
|
|
11
|
-
readMessages: Message[];
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface MarkAsReadResponse {
|
|
15
|
-
message: string;
|
|
16
|
-
read: "success" | "error";
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// Backward compatibility aliases
|
|
20
|
-
export type MarkAsReadOptions = MarkAsReadRequest;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { ChatId } from "@/types/tags";
|
|
2
|
-
|
|
3
|
-
interface Message {
|
|
4
|
-
remoteJid: string;
|
|
5
|
-
fromMe: boolean;
|
|
6
|
-
id: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export interface MarkAsUnreadRequest {
|
|
10
|
-
lastMessage: Message[];
|
|
11
|
-
chat: ChatId;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface MarkAsUnreadResponse {
|
|
15
|
-
message: string;
|
|
16
|
-
unread: "success" | "error";
|
|
17
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
// Pure TypeScript interfaces for better IDE support and performance
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Options for presence configuration
|
|
5
|
-
*/
|
|
6
|
-
export interface PresenceOptions {
|
|
7
|
-
/**
|
|
8
|
-
* Delay of the presence in milliseconds
|
|
9
|
-
*/
|
|
10
|
-
delay: number;
|
|
11
|
-
/**
|
|
12
|
-
* Presence state
|
|
13
|
-
* - `composing`: typing a message
|
|
14
|
-
* - `recording`: recording an audio
|
|
15
|
-
*/
|
|
16
|
-
presence: "composing" | "recording";
|
|
17
|
-
/**
|
|
18
|
-
* Chat number or JID to receive the presence
|
|
19
|
-
*/
|
|
20
|
-
number: string;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Input parameters for the presence method (excluding number)
|
|
24
|
-
*/
|
|
25
|
-
export interface PresenceParams {
|
|
26
|
-
/**
|
|
27
|
-
* Delay of the presence in milliseconds
|
|
28
|
-
*/
|
|
29
|
-
delay: number;
|
|
30
|
-
/**
|
|
31
|
-
* Presence state
|
|
32
|
-
* - `composing`: typing a message
|
|
33
|
-
* - `recording`: recording an audio
|
|
34
|
-
*/
|
|
35
|
-
presence: "composing" | "recording";
|
|
36
|
-
/**
|
|
37
|
-
* Whether to wait until the presence is finished (duration)
|
|
38
|
-
* @deprecated This parameter is not used by the Evolution API
|
|
39
|
-
*/
|
|
40
|
-
waitUntilFinish?: boolean;
|
|
41
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// Pure TypeScript interfaces for better IDE support and performance
|
|
2
|
-
import type { ChatId, MessageId } from "@/types/tags";
|
|
3
|
-
|
|
4
|
-
export interface UpdateMessageRequest {
|
|
5
|
-
number: ChatId;
|
|
6
|
-
messageId: MessageId;
|
|
7
|
-
message: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface UpdateMessageResponse {
|
|
11
|
-
status: string;
|
|
12
|
-
message: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// Backward compatibility aliases
|
|
16
|
-
export type UpdateMessageOptions = UpdateMessageRequest;
|