@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.
Files changed (100) hide show
  1. package/dist/index.d.mts +26 -19
  2. package/dist/index.d.ts +26 -19
  3. package/dist/index.js +173 -62
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +173 -62
  6. package/dist/index.mjs.map +1 -1
  7. package/package.json +1 -3
  8. package/src/api/errors.ts +0 -220
  9. package/src/api/routes.ts +0 -76
  10. package/src/api/service.ts +0 -141
  11. package/src/index.ts +0 -89
  12. package/src/modules/chats/index.ts +0 -253
  13. package/src/modules/chats/schemas/archive.ts +0 -15
  14. package/src/modules/chats/schemas/check.ts +0 -20
  15. package/src/modules/chats/schemas/delete-message.ts +0 -16
  16. package/src/modules/chats/schemas/fetch-profile-picture.ts +0 -13
  17. package/src/modules/chats/schemas/find-all.ts +0 -49
  18. package/src/modules/chats/schemas/find-contacts.ts +0 -17
  19. package/src/modules/chats/schemas/find-messages.ts +0 -55
  20. package/src/modules/chats/schemas/find-status-message.ts +0 -11
  21. package/src/modules/chats/schemas/get-base64-from-media-message.ts +0 -20
  22. package/src/modules/chats/schemas/index.ts +0 -33
  23. package/src/modules/chats/schemas/mark-as-read.ts +0 -20
  24. package/src/modules/chats/schemas/mark-as-unread.ts +0 -17
  25. package/src/modules/chats/schemas/presence.ts +0 -41
  26. package/src/modules/chats/schemas/update-message.ts +0 -16
  27. package/src/modules/groups/index.ts +0 -246
  28. package/src/modules/groups/schemas/accept-invite-code.ts +0 -14
  29. package/src/modules/groups/schemas/common.ts +0 -89
  30. package/src/modules/groups/schemas/create.ts +0 -15
  31. package/src/modules/groups/schemas/fetch-invite-code.ts +0 -13
  32. package/src/modules/groups/schemas/find-all.ts +0 -26
  33. package/src/modules/groups/schemas/find-by-invite-code.ts +0 -39
  34. package/src/modules/groups/schemas/find-by-jid.ts +0 -14
  35. package/src/modules/groups/schemas/find-members.ts +0 -16
  36. package/src/modules/groups/schemas/index.ts +0 -24
  37. package/src/modules/groups/schemas/leave.ts +0 -14
  38. package/src/modules/groups/schemas/revoke-invite-code.ts +0 -14
  39. package/src/modules/groups/schemas/send-group-invite.ts +0 -15
  40. package/src/modules/groups/schemas/toggle-ephemeral.ts +0 -15
  41. package/src/modules/groups/schemas/update-description.ts +0 -15
  42. package/src/modules/groups/schemas/update-members.ts +0 -18
  43. package/src/modules/groups/schemas/update-picture.ts +0 -15
  44. package/src/modules/groups/schemas/update-setting.ts +0 -16
  45. package/src/modules/groups/schemas/update-subject.ts +0 -15
  46. package/src/modules/index.ts +0 -7
  47. package/src/modules/instance/index.ts +0 -126
  48. package/src/modules/instance/schemas/connect.ts +0 -14
  49. package/src/modules/instance/schemas/connection-state.ts +0 -16
  50. package/src/modules/instance/schemas/create.ts +0 -99
  51. package/src/modules/instance/schemas/delete.ts +0 -21
  52. package/src/modules/instance/schemas/fetch-all.ts +0 -57
  53. package/src/modules/instance/schemas/index.ts +0 -8
  54. package/src/modules/instance/schemas/logout.ts +0 -22
  55. package/src/modules/instance/schemas/restart.ts +0 -13
  56. package/src/modules/instance/schemas/set-presence.ts +0 -20
  57. package/src/modules/messages/index.ts +0 -246
  58. package/src/modules/messages/schemas/audio.ts +0 -12
  59. package/src/modules/messages/schemas/base.ts +0 -11
  60. package/src/modules/messages/schemas/contact.ts +0 -70
  61. package/src/modules/messages/schemas/document.ts +0 -12
  62. package/src/modules/messages/schemas/image.ts +0 -12
  63. package/src/modules/messages/schemas/index.ts +0 -31
  64. package/src/modules/messages/schemas/list.ts +0 -36
  65. package/src/modules/messages/schemas/location.ts +0 -76
  66. package/src/modules/messages/schemas/media.ts +0 -51
  67. package/src/modules/messages/schemas/poll.ts +0 -87
  68. package/src/modules/messages/schemas/reaction.ts +0 -21
  69. package/src/modules/messages/schemas/status.ts +0 -18
  70. package/src/modules/messages/schemas/sticker.ts +0 -77
  71. package/src/modules/messages/schemas/template.ts +0 -39
  72. package/src/modules/messages/schemas/text.ts +0 -88
  73. package/src/modules/messages/schemas/video.ts +0 -12
  74. package/src/modules/messages/schemas/voice.ts +0 -94
  75. package/src/modules/profile/index.ts +0 -110
  76. package/src/modules/profile/schemas/fetch-business-profile.ts +0 -29
  77. package/src/modules/profile/schemas/fetch-privacy-settings.ts +0 -11
  78. package/src/modules/profile/schemas/fetch-profile.ts +0 -23
  79. package/src/modules/profile/schemas/index.ts +0 -8
  80. package/src/modules/profile/schemas/remove-picture.ts +0 -4
  81. package/src/modules/profile/schemas/update-name.ts +0 -11
  82. package/src/modules/profile/schemas/update-picture.ts +0 -11
  83. package/src/modules/profile/schemas/update-privacy-settings.ts +0 -18
  84. package/src/modules/profile/schemas/update-status.ts +0 -11
  85. package/src/modules/settings/index.ts +0 -28
  86. package/src/modules/settings/schemas/find.ts +0 -11
  87. package/src/modules/settings/schemas/index.ts +0 -2
  88. package/src/modules/settings/schemas/set.ts +0 -18
  89. package/src/modules/webhook/index.ts +0 -28
  90. package/src/modules/webhook/schemas/find.ts +0 -7
  91. package/src/modules/webhook/schemas/index.ts +0 -2
  92. package/src/modules/webhook/schemas/set.ts +0 -16
  93. package/src/schemas/client.ts +0 -23
  94. package/src/schemas/common.ts +0 -44
  95. package/src/types/api.ts +0 -17
  96. package/src/types/events.ts +0 -53
  97. package/src/types/messages.ts +0 -5
  98. package/src/types/tags.ts +0 -14
  99. package/src/types/webhooks.ts +0 -255
  100. package/src/utils/phone-numer-from-jid.ts +0 -9
@@ -1,126 +0,0 @@
1
- import { Routes } from "@/api/routes";
2
- import type { ApiService } from "@/api/service";
3
-
4
- import type * as Connect from "./schemas/connect";
5
- import type * as ConnectionState from "./schemas/connection-state";
6
- import type * as Create from "./schemas/create";
7
- import type * as Delete from "./schemas/delete";
8
- import type * as FetchAll from "./schemas/fetch-all";
9
- import type * as Logout from "./schemas/logout";
10
- import type * as Restart from "./schemas/restart";
11
- import type * as SetPresence from "./schemas/set-presence";
12
-
13
- import type { MethodOptions } from "@/types/api";
14
-
15
- export class InstanceModule {
16
- constructor(private readonly api: ApiService) {}
17
-
18
- async create(
19
- options: Create.CreateInstanceRequest
20
- ): Promise<Create.CreateInstanceResponse> {
21
- const response = await this.api.post(Routes.Instance.Create, {
22
- body: options,
23
- isInstanceUrl: false,
24
- });
25
- return response as Create.CreateInstanceResponse;
26
- }
27
-
28
- async connect(
29
- options: Connect.ConnectRequest,
30
- methodOptions?: MethodOptions
31
- ): Promise<Connect.ConnectResponse> {
32
- const { instanceName } = options;
33
- const instance = methodOptions?.instance ?? instanceName;
34
- if (!instance) {
35
- throw new Error("Instance name is required");
36
- }
37
- const response = await this.api.get(Routes.Instance.Connect, {
38
- instance,
39
- isInstanceUrl: true,
40
- });
41
- return response as Connect.ConnectResponse;
42
- }
43
-
44
- async connectionState(
45
- options: ConnectionState.ConnectionStateRequest,
46
- methodOptions?: MethodOptions
47
- ): Promise<ConnectionState.ConnectionStateResponse> {
48
- const { instanceName } = options;
49
- const instance = methodOptions?.instance ?? instanceName;
50
- if (!instance) {
51
- throw new Error("Instance name is required");
52
- }
53
- const response = await this.api.get(Routes.Instance.ConnectionState, {
54
- instance,
55
- isInstanceUrl: true,
56
- });
57
- return response as ConnectionState.ConnectionStateResponse;
58
- }
59
-
60
- async logout(
61
- options: Logout.LogoutRequest,
62
- methodOptions?: MethodOptions
63
- ): Promise<Logout.LogoutResponse> {
64
- const { instanceName } = options;
65
- const instance = methodOptions?.instance ?? instanceName;
66
- if (!instance) {
67
- throw new Error("Instance name is required");
68
- }
69
- const response = await this.api.delete(Routes.Instance.Logout, {
70
- instance,
71
- isInstanceUrl: true,
72
- });
73
- return response as Logout.LogoutResponse;
74
- }
75
-
76
- async delete(options: Delete.DeleteRequest): Promise<Delete.DeleteResponse> {
77
- const response = await this.api.delete(Routes.Instance.Delete, {
78
- instance: options.instanceName,
79
- isInstanceUrl: true,
80
- });
81
- return response as Delete.DeleteResponse;
82
- }
83
-
84
- async restart(
85
- options: Restart.RestartRequest,
86
- methodOptions?: MethodOptions
87
- ): Promise<Restart.RestartResponse> {
88
- const { instanceName } = options;
89
- const instance = methodOptions?.instance ?? instanceName;
90
- if (!instance) {
91
- throw new Error("Instance name is required");
92
- }
93
- const response = await this.api.post(Routes.Instance.Restart, {
94
- instance,
95
- isInstanceUrl: true,
96
- });
97
- return response as Restart.RestartResponse;
98
- }
99
-
100
- async fetchAll(
101
- options?: FetchAll.FetchAllRequest
102
- ): Promise<FetchAll.FetchAllResponse> {
103
- const response = await this.api.get(Routes.Instance.FetchAll, {
104
- params: options,
105
- isInstanceUrl: false,
106
- });
107
- return response as FetchAll.FetchAllResponse;
108
- }
109
-
110
- async setPresence(
111
- options: SetPresence.SetPresenceRequest,
112
- methodOptions?: MethodOptions
113
- ): Promise<SetPresence.SetPresenceResponse> {
114
- const { instanceName, ...rest } = options;
115
- const instance = methodOptions?.instance ?? instanceName;
116
- if (!instance) {
117
- throw new Error("Instance name is required");
118
- }
119
- const response = await this.api.post(Routes.Instance.SetPresence, {
120
- body: rest,
121
- instance,
122
- isInstanceUrl: true,
123
- });
124
- return response as SetPresence.SetPresenceResponse;
125
- }
126
- }
@@ -1,14 +0,0 @@
1
- // Pure TypeScript interfaces for better IDE support and performance
2
- export interface ConnectRequest {
3
- instanceName: string;
4
- }
5
-
6
- export interface ConnectResponse {
7
- pairingCode: string | null;
8
- code: string;
9
- base64: string;
10
- count: number;
11
- }
12
-
13
- // Backward compatibility aliases
14
- export type ConnectOptions = ConnectRequest;
@@ -1,16 +0,0 @@
1
- // Pure TypeScript interfaces for better IDE support and performance
2
- import { ConnectionState } from "@/types/webhooks";
3
-
4
- export interface ConnectionStateRequest {
5
- instanceName: string;
6
- }
7
-
8
- export interface ConnectionStateResponse {
9
- instance: {
10
- instanceName: string;
11
- state: ConnectionState;
12
- };
13
- }
14
-
15
- // Backward compatibility aliases
16
- export type ConnectionStateOptions = ConnectionStateRequest;
@@ -1,99 +0,0 @@
1
- // Pure TypeScript interfaces for better IDE support and performance
2
-
3
- export interface WebhookConfig {
4
- url?: string;
5
- byEvents?: boolean;
6
- base64?: boolean;
7
- headers?: Record<string, string>;
8
- events?: string[];
9
- }
10
-
11
- export interface RabbitMQConfig {
12
- enabled?: boolean;
13
- events?: string[];
14
- }
15
-
16
- export interface SQSConfig {
17
- enabled?: boolean;
18
- events?: string[];
19
- }
20
-
21
- export interface CreateInstanceRequest {
22
- instanceName: string;
23
- token?: string;
24
- qrcode?: boolean;
25
- number?: string;
26
- integration?: string;
27
-
28
- // Call settings
29
- rejectCall?: boolean;
30
- msgCall?: string;
31
-
32
- // Group and status settings
33
- groupsIgnore?: boolean;
34
- alwaysOnline?: boolean;
35
- readMessages?: boolean;
36
- readStatus?: boolean;
37
- syncFullHistory?: boolean;
38
-
39
- // Proxy settings (flat fields)
40
- proxyHost?: string;
41
- proxyPort?: string;
42
- proxyProtocol?: "http" | "https";
43
- proxyUsername?: string;
44
- proxyPassword?: string;
45
-
46
- // Webhook settings (nested object)
47
- webhook?: WebhookConfig;
48
-
49
- // RabbitMQ settings (nested object)
50
- rabbitmq?: RabbitMQConfig;
51
-
52
- // SQS settings (nested object)
53
- sqs?: SQSConfig;
54
-
55
- // Chatwoot settings
56
- chatwootAccountId?: number;
57
- chatwootToken?: string;
58
- chatwootUrl?: string;
59
- chatwootSignMsg?: boolean;
60
- chatwootReopenConversation?: boolean;
61
- chatwootConversationPending?: boolean;
62
- chatwootImportContacts?: boolean;
63
- chatwootNameInbox?: string;
64
- chatwootMergeBrazilContacts?: boolean;
65
- chatwootImportMessages?: boolean;
66
- chatwootDaysLimitImportMessages?: number;
67
- chatwootOrganization?: string;
68
- chatwootLogo?: string;
69
- }
70
-
71
- export interface InstanceInfo {
72
- instanceName: string;
73
- instanceId: string;
74
- webhook_wa_business?: string | null;
75
- access_token_wa_business?: string;
76
- status: string;
77
- }
78
-
79
- export interface InstanceSettings {
80
- rejectCall?: boolean;
81
- msgCall?: string;
82
- groupsIgnore?: boolean;
83
- alwaysOnline?: boolean;
84
- readMessages?: boolean;
85
- readStatus?: boolean;
86
- syncFullHistory?: boolean;
87
- }
88
-
89
- export interface QRCodeInfo {
90
- code: string;
91
- base64: string;
92
- }
93
-
94
- export interface CreateInstanceResponse {
95
- instance: InstanceInfo;
96
- hash: string; // API returns a string, not an object
97
- settings?: InstanceSettings; // Settings might not always be present
98
- qrcode?: QRCodeInfo;
99
- }
@@ -1,21 +0,0 @@
1
- // Pure TypeScript interfaces for better IDE support and performance
2
-
3
- export interface DeleteRequest {
4
- instanceName: string;
5
- }
6
-
7
- export interface DeleteInstanceInfo {
8
- instanceName: string;
9
- status: string;
10
- }
11
-
12
- export interface DeleteResponse {
13
- status: "SUCCESS" | "ERROR";
14
- error: boolean;
15
- response: {
16
- message: string;
17
- };
18
- }
19
-
20
- // Backward compatibility aliases
21
- export type DeleteOptions = DeleteRequest;
@@ -1,57 +0,0 @@
1
- import { Jid } from "@/types/tags";
2
- import { ConnectionState } from "@/types/webhooks";
3
-
4
- export interface Setting {
5
- id: string;
6
- rejectCall: boolean;
7
- msgCall: string;
8
- groupsIgnore: boolean;
9
- alwaysOnline: boolean;
10
- readMessages: boolean;
11
- readStatus: boolean;
12
- syncFullHistory: boolean;
13
- wavoipToken: string;
14
- createdAt: string;
15
- updatedAt: string;
16
- instanceId: string;
17
- }
18
-
19
- export interface Count {
20
- Message: number;
21
- Contact: number;
22
- Chat: number;
23
- }
24
-
25
- export interface InstanceDetails {
26
- id: string;
27
- name: string;
28
- connectionStatus: ConnectionState;
29
- ownerJid: Jid;
30
- profileName: string;
31
- profilePicUrl: string | null;
32
- profileStatus?: string;
33
- integration: string;
34
- number: string | null;
35
- businessId: string | null;
36
- token: string;
37
- clientName: string;
38
- disconnectionReasonCode: string | number | null;
39
- disconnectionObject: unknown | null;
40
- disconnectionAt: string | null;
41
- createdAt: string;
42
- updatedAt: string;
43
- Chatwoot: unknown | null;
44
- Proxy: unknown | null;
45
- Rabbitmq: unknown | null;
46
- Nats: unknown | null;
47
- Sqs: unknown | null;
48
- Websocket: unknown | null;
49
- Setting: Setting | null;
50
- _count: Count;
51
- }
52
-
53
- export type FetchAllResponse = InstanceDetails[];
54
-
55
- export interface FetchAllRequest {
56
- instanceName?: string;
57
- }
@@ -1,8 +0,0 @@
1
- export * from "./connect";
2
- export * from "./connection-state";
3
- export * from "./create";
4
- export * from "./delete";
5
- export * from "./fetch-all";
6
- export * from "./logout";
7
- export * from "./restart";
8
- export * from "./set-presence";
@@ -1,22 +0,0 @@
1
- // Pure TypeScript interfaces for better IDE support and performance
2
-
3
- export interface LogoutRequest {
4
- instanceName: string;
5
- }
6
-
7
- export interface LogoutInstanceInfo {
8
- instanceName: string;
9
- status: string;
10
- }
11
-
12
- export interface LogoutResponse {
13
- status: "SUCCESS" | "ERROR";
14
- error: boolean;
15
- response: {
16
- message: string;
17
- };
18
- instance: LogoutInstanceInfo;
19
- }
20
-
21
- // Backward compatibility aliases
22
- export type LogoutOptions = LogoutRequest;
@@ -1,13 +0,0 @@
1
- // Pure TypeScript interfaces for better IDE support and performance
2
-
3
- export interface RestartRequest {
4
- instanceName: string;
5
- }
6
-
7
- export interface RestartResponse {
8
- success: boolean;
9
- message: string;
10
- }
11
-
12
- // Backward compatibility aliases
13
- export type RestartOptions = RestartRequest;
@@ -1,20 +0,0 @@
1
- // Pure TypeScript interfaces for better IDE support and performance
2
-
3
- export interface SetPresenceRequest {
4
- instanceName?: string;
5
- presence: "unavailable" | "available";
6
- }
7
-
8
- export interface SetPresenceData {
9
- instance: string;
10
- presence: string;
11
- }
12
-
13
- export interface SetPresenceResponse {
14
- error: boolean;
15
- message: string;
16
- data: SetPresenceData;
17
- }
18
-
19
- // Backward compatibility aliases
20
- export type SetPresenceOptions = SetPresenceRequest;
@@ -1,246 +0,0 @@
1
- import { Routes } from "@/api/routes";
2
- import type { ApiService } from "@/api/service";
3
- import type { MethodOptions } from "@/types/api";
4
-
5
- import type * as Audio from "./schemas/audio";
6
- import type * as Contact from "./schemas/contact";
7
- import type * as Document from "./schemas/document";
8
- import type * as Image from "./schemas/image";
9
- import type * as List from "./schemas/list";
10
- import type * as Location from "./schemas/location";
11
- import type * as Reaction from "./schemas/reaction";
12
- import type * as Status from "./schemas/status";
13
- import type * as Sticker from "./schemas/sticker";
14
- import type * as Template from "./schemas/template";
15
- import type * as Text from "./schemas/text";
16
- import type * as Video from "./schemas/video";
17
- import type * as Voice from "./schemas/voice";
18
-
19
- export class MessagesModule {
20
- constructor(private readonly api: ApiService) {}
21
-
22
- /**
23
- * Sends a text message
24
- * @param options - Text message options
25
- * @param methodOptions - Method-specific options (instance override)
26
- */
27
- async sendText(
28
- options: Text.TextMessageOptions,
29
- methodOptions?: MethodOptions
30
- ): Promise<Text.TextMessageResponse> {
31
- const response = await this.api.post(Routes.Message.SendText, {
32
- body: options,
33
- ...methodOptions,
34
- });
35
-
36
- return response as Text.TextMessageResponse;
37
- }
38
-
39
- /**
40
- * Sends an image
41
- * @param options - Image message options
42
- * @param methodOptions - Method-specific options (instance override)
43
- */
44
- async sendImage(
45
- options: Image.ImageMessageOptions,
46
- methodOptions?: MethodOptions
47
- ): Promise<Image.ImageMessageResponse> {
48
- options.mediatype = "image";
49
- const response = await this.api.post(Routes.Message.SendMedia, {
50
- body: options,
51
- ...methodOptions,
52
- });
53
-
54
- return response as Image.ImageMessageResponse;
55
- }
56
-
57
- /**
58
- * Sends a video
59
- * @param options - Video message options
60
- * @param methodOptions - Method-specific options (instance override)
61
- */
62
- async sendVideo(
63
- options: Video.VideoMessageOptions,
64
- methodOptions?: MethodOptions
65
- ): Promise<Video.VideoMessageResponse> {
66
- options.mediatype = "video";
67
- const response = await this.api.post(Routes.Message.SendMedia, {
68
- body: options,
69
- ...methodOptions,
70
- });
71
-
72
- return response as Video.VideoMessageResponse;
73
- }
74
-
75
- /**
76
- * Sends a document
77
- * @param options - Document message options
78
- * @param methodOptions - Method-specific options (instance override)
79
- */
80
- async sendDocument(
81
- options: Document.DocumentMessageOptions,
82
- methodOptions?: MethodOptions
83
- ): Promise<Document.DocumentMessageResponse> {
84
- options.mediatype = "document";
85
- const response = await this.api.post(Routes.Message.SendMedia, {
86
- body: options,
87
- ...methodOptions,
88
- });
89
-
90
- return response as Document.DocumentMessageResponse;
91
- }
92
-
93
- /**
94
- * Sends an audio
95
- * @param options - Audio message options
96
- * @param methodOptions - Method-specific options (instance override)
97
- */
98
- async sendAudio(
99
- options: Audio.AudioMessageOptions,
100
- methodOptions?: MethodOptions
101
- ): Promise<Audio.AudioMessageResponse> {
102
- options.mediatype = "audio";
103
- const response = await this.api.post(Routes.Message.SendMedia, {
104
- body: options,
105
- ...methodOptions,
106
- });
107
-
108
- return response as Audio.AudioMessageResponse;
109
- }
110
-
111
- /**
112
- * Sends a voice message
113
- * @param options - Voice message options
114
- * @param methodOptions - Method-specific options (instance override)
115
- */
116
- async sendVoice(
117
- options: Voice.VoiceMessageOptions,
118
- methodOptions?: MethodOptions
119
- ): Promise<Voice.VoiceMessageResponse> {
120
- const response = await this.api.post(Routes.Message.SendVoice, {
121
- body: options,
122
- ...methodOptions,
123
- });
124
-
125
- return response as Voice.VoiceMessageResponse;
126
- }
127
-
128
- /**
129
- * Sends a sticker
130
- * @param options - Sticker message options
131
- * @param methodOptions - Method-specific options (instance override)
132
- */
133
- async sendSticker(
134
- options: Sticker.StickerMessageOptions,
135
- methodOptions?: MethodOptions
136
- ): Promise<Sticker.StickerMessageResponse> {
137
- const response = await this.api.post(Routes.Message.SendSticker, {
138
- body: options,
139
- ...methodOptions,
140
- });
141
-
142
- return response as Sticker.StickerMessageResponse;
143
- }
144
-
145
- /**
146
- * Sends a location
147
- * @param options - Location message options
148
- * @param methodOptions - Method-specific options (instance override)
149
- */
150
- async sendLocation(
151
- options: Location.LocationMessageOptions,
152
- methodOptions?: MethodOptions
153
- ): Promise<Location.LocationMessageResponse> {
154
- const response = await this.api.post(Routes.Message.SendLocation, {
155
- body: options,
156
- ...methodOptions,
157
- });
158
-
159
- return response as Location.LocationMessageResponse;
160
- }
161
-
162
- /**
163
- * Sends a contact
164
- * @param options - Contact message options
165
- * @param methodOptions - Method-specific options (instance override)
166
- */
167
- async sendContact(
168
- options: Contact.ContactMessageOptions,
169
- methodOptions?: MethodOptions
170
- ): Promise<Contact.ContactMessageResponse> {
171
- const response = await this.api.post(Routes.Message.SendContact, {
172
- body: options,
173
- ...methodOptions,
174
- });
175
-
176
- return response as Contact.ContactMessageResponse;
177
- }
178
-
179
- /**
180
- * Sends a reaction
181
- * @param options - Reaction message options
182
- * @param methodOptions - Method-specific options (instance override)
183
- */
184
- async sendReaction(
185
- options: Reaction.ReactionMessageOptions,
186
- methodOptions?: MethodOptions
187
- ): Promise<Reaction.ReactionMessageResponse> {
188
- const response = await this.api.post(Routes.Message.SendReaction, {
189
- body: options,
190
- ...methodOptions,
191
- });
192
-
193
- return response as Reaction.ReactionMessageResponse;
194
- }
195
-
196
- /**
197
- * Sends a template
198
- * @param options - Template message options
199
- * @param methodOptions - Method-specific options (instance override)
200
- */
201
- async sendTemplate(
202
- options: Template.TemplateMessageOptions,
203
- methodOptions?: MethodOptions
204
- ): Promise<Template.TemplateMessageResponse> {
205
- const response = await this.api.post(Routes.Message.SendTemplate, {
206
- body: options,
207
- ...methodOptions,
208
- });
209
-
210
- return response as Template.TemplateMessageResponse;
211
- }
212
-
213
- /**
214
- * Sends a status
215
- * @param options - Status message options
216
- * @param methodOptions - Method-specific options (instance override)
217
- */
218
- async sendStatus(
219
- options: Status.StatusMessageOptions,
220
- methodOptions?: MethodOptions
221
- ): Promise<Status.StatusMessageResponse> {
222
- const response = await this.api.post(Routes.Message.SendStatus, {
223
- body: options,
224
- ...methodOptions,
225
- });
226
-
227
- return response as Status.StatusMessageResponse;
228
- }
229
-
230
- /**
231
- * Sends a list
232
- * @param options - List message options
233
- * @param methodOptions - Method-specific options (instance override)
234
- */
235
- async sendList(
236
- options: List.ListMessageOptions,
237
- methodOptions?: MethodOptions
238
- ): Promise<List.ListMessageResponse> {
239
- const response = await this.api.post(Routes.Message.SendList, {
240
- body: options,
241
- ...methodOptions,
242
- });
243
-
244
- return response as List.ListMessageResponse;
245
- }
246
- }
@@ -1,12 +0,0 @@
1
- // Pure TypeScript interfaces for better IDE support and performance
2
- import { MediaMessageOptions, MediaMessageResponse } from "./media";
3
-
4
- // Request interfaces
5
- export interface AudioMessageOptions extends MediaMessageOptions {}
6
-
7
- // Response interfaces
8
- export interface AudioMessageResponse extends MediaMessageResponse {
9
- message: MediaMessageResponse["message"] & {
10
- audioMessage: MediaMessageResponse["message"]["audioMessage"];
11
- };
12
- }
@@ -1,11 +0,0 @@
1
- // Pure TypeScript interfaces for better IDE support and performance
2
- export interface BaseMessageOptions {
3
- /**
4
- * Number (with country code) or JID to receive the message
5
- */
6
- number: string;
7
- /**
8
- * Time in milliseconds before sending message
9
- */
10
- delay?: number;
11
- }