@gymspace/evolution 1.0.0
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/README.md +1273 -0
- package/dist/index.d.mts +1790 -0
- package/dist/index.d.ts +1790 -0
- package/dist/index.js +1091 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1077 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +63 -0
- package/src/api/errors.ts +220 -0
- package/src/api/routes.ts +76 -0
- package/src/api/service.ts +141 -0
- package/src/index.ts +89 -0
- package/src/modules/chats/index.ts +253 -0
- package/src/modules/chats/schemas/archive.ts +15 -0
- package/src/modules/chats/schemas/check.ts +20 -0
- package/src/modules/chats/schemas/delete-message.ts +16 -0
- package/src/modules/chats/schemas/fetch-profile-picture.ts +13 -0
- package/src/modules/chats/schemas/find-all.ts +49 -0
- package/src/modules/chats/schemas/find-contacts.ts +17 -0
- package/src/modules/chats/schemas/find-messages.ts +55 -0
- package/src/modules/chats/schemas/find-status-message.ts +11 -0
- package/src/modules/chats/schemas/get-base64-from-media-message.ts +20 -0
- package/src/modules/chats/schemas/index.ts +33 -0
- package/src/modules/chats/schemas/mark-as-read.ts +20 -0
- package/src/modules/chats/schemas/mark-as-unread.ts +17 -0
- package/src/modules/chats/schemas/presence.ts +41 -0
- package/src/modules/chats/schemas/update-message.ts +16 -0
- package/src/modules/groups/index.ts +246 -0
- package/src/modules/groups/schemas/accept-invite-code.ts +14 -0
- package/src/modules/groups/schemas/common.ts +89 -0
- package/src/modules/groups/schemas/create.ts +15 -0
- package/src/modules/groups/schemas/fetch-invite-code.ts +13 -0
- package/src/modules/groups/schemas/find-all.ts +26 -0
- package/src/modules/groups/schemas/find-by-invite-code.ts +39 -0
- package/src/modules/groups/schemas/find-by-jid.ts +14 -0
- package/src/modules/groups/schemas/find-members.ts +16 -0
- package/src/modules/groups/schemas/index.ts +24 -0
- package/src/modules/groups/schemas/leave.ts +14 -0
- package/src/modules/groups/schemas/revoke-invite-code.ts +14 -0
- package/src/modules/groups/schemas/send-group-invite.ts +15 -0
- package/src/modules/groups/schemas/toggle-ephemeral.ts +15 -0
- package/src/modules/groups/schemas/update-description.ts +15 -0
- package/src/modules/groups/schemas/update-members.ts +18 -0
- package/src/modules/groups/schemas/update-picture.ts +15 -0
- package/src/modules/groups/schemas/update-setting.ts +16 -0
- package/src/modules/groups/schemas/update-subject.ts +15 -0
- package/src/modules/index.ts +7 -0
- package/src/modules/instance/index.ts +126 -0
- package/src/modules/instance/schemas/connect.ts +14 -0
- package/src/modules/instance/schemas/connection-state.ts +16 -0
- package/src/modules/instance/schemas/create.ts +99 -0
- package/src/modules/instance/schemas/delete.ts +21 -0
- package/src/modules/instance/schemas/fetch-all.ts +57 -0
- package/src/modules/instance/schemas/index.ts +8 -0
- package/src/modules/instance/schemas/logout.ts +22 -0
- package/src/modules/instance/schemas/restart.ts +13 -0
- package/src/modules/instance/schemas/set-presence.ts +20 -0
- package/src/modules/messages/index.ts +246 -0
- package/src/modules/messages/schemas/audio.ts +12 -0
- package/src/modules/messages/schemas/base.ts +11 -0
- package/src/modules/messages/schemas/contact.ts +70 -0
- package/src/modules/messages/schemas/document.ts +12 -0
- package/src/modules/messages/schemas/image.ts +12 -0
- package/src/modules/messages/schemas/index.ts +31 -0
- package/src/modules/messages/schemas/list.ts +36 -0
- package/src/modules/messages/schemas/location.ts +76 -0
- package/src/modules/messages/schemas/media.ts +51 -0
- package/src/modules/messages/schemas/poll.ts +87 -0
- package/src/modules/messages/schemas/reaction.ts +21 -0
- package/src/modules/messages/schemas/status.ts +18 -0
- package/src/modules/messages/schemas/sticker.ts +77 -0
- package/src/modules/messages/schemas/template.ts +39 -0
- package/src/modules/messages/schemas/text.ts +88 -0
- package/src/modules/messages/schemas/video.ts +12 -0
- package/src/modules/messages/schemas/voice.ts +94 -0
- package/src/modules/profile/index.ts +110 -0
- package/src/modules/profile/schemas/fetch-business-profile.ts +29 -0
- package/src/modules/profile/schemas/fetch-privacy-settings.ts +11 -0
- package/src/modules/profile/schemas/fetch-profile.ts +23 -0
- package/src/modules/profile/schemas/index.ts +8 -0
- package/src/modules/profile/schemas/remove-picture.ts +4 -0
- package/src/modules/profile/schemas/update-name.ts +11 -0
- package/src/modules/profile/schemas/update-picture.ts +11 -0
- package/src/modules/profile/schemas/update-privacy-settings.ts +18 -0
- package/src/modules/profile/schemas/update-status.ts +11 -0
- package/src/modules/settings/index.ts +28 -0
- package/src/modules/settings/schemas/find.ts +11 -0
- package/src/modules/settings/schemas/index.ts +2 -0
- package/src/modules/settings/schemas/set.ts +18 -0
- package/src/modules/webhook/index.ts +28 -0
- package/src/modules/webhook/schemas/find.ts +7 -0
- package/src/modules/webhook/schemas/index.ts +2 -0
- package/src/modules/webhook/schemas/set.ts +16 -0
- package/src/schemas/client.ts +23 -0
- package/src/schemas/common.ts +44 -0
- package/src/types/api.ts +17 -0
- package/src/types/events.ts +53 -0
- package/src/types/messages.ts +5 -0
- package/src/types/tags.ts +14 -0
- package/src/types/webhooks.ts +255 -0
- package/src/utils/phone-numer-from-jid.ts +9 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Pure TypeScript interfaces for better IDE support and performance
|
|
2
|
+
import type { GroupJid, Jid } from "@/types/tags";
|
|
3
|
+
|
|
4
|
+
export interface SendGroupInviteRequest {
|
|
5
|
+
groupJid: GroupJid;
|
|
6
|
+
participantJid: Jid;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface SendGroupInviteResponse {
|
|
10
|
+
status: string;
|
|
11
|
+
message: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// Backward compatibility aliases
|
|
15
|
+
export type SendGroupInviteOptions = SendGroupInviteRequest;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Pure TypeScript interfaces for better IDE support and performance
|
|
2
|
+
import type { GroupJid } from "@/types/tags";
|
|
3
|
+
|
|
4
|
+
export interface ToggleEphemeralRequest {
|
|
5
|
+
groupJid: GroupJid;
|
|
6
|
+
duration: number;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface ToggleEphemeralResponse {
|
|
10
|
+
status: string;
|
|
11
|
+
message: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// Backward compatibility aliases
|
|
15
|
+
export type ToggleEphemeralOptions = ToggleEphemeralRequest;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Pure TypeScript interfaces for better IDE support and performance
|
|
2
|
+
import type { GroupJid } from "@/types/tags";
|
|
3
|
+
|
|
4
|
+
export interface UpdateDescriptionRequest {
|
|
5
|
+
groupJid: GroupJid;
|
|
6
|
+
description: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface UpdateDescriptionResponse {
|
|
10
|
+
status: string;
|
|
11
|
+
message: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// Backward compatibility aliases
|
|
15
|
+
export type UpdateDescriptionOptions = UpdateDescriptionRequest;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Pure TypeScript interfaces for better IDE support and performance
|
|
2
|
+
import type { GroupJid, Jid } from "@/types/tags";
|
|
3
|
+
|
|
4
|
+
export interface UpdateMembersRequest {
|
|
5
|
+
groupJid: GroupJid;
|
|
6
|
+
participants: Jid[];
|
|
7
|
+
action: "add" | "remove" | "promote" | "demote";
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface Participant {
|
|
11
|
+
id: Jid;
|
|
12
|
+
status: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type UpdateMembersResponse = Participant[];
|
|
16
|
+
|
|
17
|
+
// Backward compatibility aliases
|
|
18
|
+
export type UpdateMembersOptions = UpdateMembersRequest;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Pure TypeScript interfaces for better IDE support and performance
|
|
2
|
+
import type { GroupJid } from "@/types/tags";
|
|
3
|
+
|
|
4
|
+
export interface UpdatePictureRequest {
|
|
5
|
+
groupJid: GroupJid;
|
|
6
|
+
url: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface UpdatePictureResponse {
|
|
10
|
+
status: string;
|
|
11
|
+
message: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// Backward compatibility aliases
|
|
15
|
+
export type UpdatePictureOptions = UpdatePictureRequest;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Pure TypeScript interfaces for better IDE support and performance
|
|
2
|
+
import type { GroupJid } from "@/types/tags";
|
|
3
|
+
|
|
4
|
+
export interface UpdateSettingRequest {
|
|
5
|
+
groupJid: GroupJid;
|
|
6
|
+
setting: "announcement" | "locked";
|
|
7
|
+
value: boolean;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface UpdateSettingResponse {
|
|
11
|
+
status: string;
|
|
12
|
+
message: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Backward compatibility aliases
|
|
16
|
+
export type UpdateSettingOptions = UpdateSettingRequest;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Pure TypeScript interfaces for better IDE support and performance
|
|
2
|
+
import type { GroupJid } from "@/types/tags";
|
|
3
|
+
|
|
4
|
+
export interface UpdateSubjectRequest {
|
|
5
|
+
groupJid: GroupJid;
|
|
6
|
+
subject: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface UpdateSubjectResponse {
|
|
10
|
+
status: string;
|
|
11
|
+
message: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// Backward compatibility aliases
|
|
15
|
+
export type UpdateSubjectOptions = UpdateSubjectRequest;
|
|
@@ -0,0 +1,126 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
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;
|
|
@@ -0,0 +1,16 @@
|
|
|
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;
|
|
@@ -0,0 +1,99 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
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;
|
|
@@ -0,0 +1,57 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
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;
|
|
@@ -0,0 +1,13 @@
|
|
|
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;
|
|
@@ -0,0 +1,20 @@
|
|
|
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;
|