@open-wa/schema 5.0.0 → 5.2.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/dist/generated/index.cjs +8 -2
- package/dist/generated/index.cjs.map +1 -1
- package/dist/generated/index.d.cts +7868 -994
- package/dist/generated/index.d.cts.map +1 -1
- package/dist/generated/index.d.mts +7868 -994
- package/dist/generated/index.d.mts.map +1 -1
- package/dist/generated/index.mjs +8 -2
- package/dist/generated/index.mjs.map +1 -1
- package/dist/index-C9Ad0lEr.d.cts +4729 -0
- package/dist/index-C9Ad0lEr.d.cts.map +1 -0
- package/dist/index-D0QN2PaW.d.mts +4729 -0
- package/dist/index-D0QN2PaW.d.mts.map +1 -0
- package/dist/index.cjs +109 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +53 -2
- package/dist/index.mjs.map +1 -1
- package/dist/methods/index.cjs +6 -1
- package/dist/methods/index.d.cts +2 -2
- package/dist/methods/index.d.mts +2 -2
- package/dist/methods/index.mjs +2 -2
- package/dist/{methods-Dizm7Fn9.cjs → methods-BGmdzjd3.cjs} +904 -76
- package/dist/methods-BGmdzjd3.cjs.map +1 -0
- package/dist/{methods-CZqeUhKy.mjs → methods-BhLsQNtL.mjs} +587 -77
- package/dist/methods-BhLsQNtL.mjs.map +1 -0
- package/package.json +4 -3
- package/src/__tests__/generators.contract.test.ts +181 -0
- package/src/__tests__/registry.contract.test.ts +81 -0
- package/src/client-config.ts +30 -0
- package/src/codecs.test.ts +41 -0
- package/src/codecs.ts +191 -0
- package/src/common-types.ts +287 -0
- package/src/config.ts +47 -0
- package/src/enums.ts +63 -0
- package/src/events/groups.ts +33 -0
- package/src/events/index.ts +4 -0
- package/src/events/messaging.ts +86 -0
- package/src/events/registry.ts +124 -0
- package/src/events/state.ts +59 -0
- package/src/generated/AliasMap.ts +216 -0
- package/src/generated/BaseClient.ts +878 -0
- package/src/generated/BaseNamespacedClient.ts +214 -0
- package/src/generated/index.ts +5 -0
- package/src/generated/openapi.json +30049 -0
- package/src/generated/types.ts +383 -0
- package/src/http-manifest.ts +97 -0
- package/src/implementor.test.ts +88 -0
- package/src/implementor.ts +75 -0
- package/src/index.ts +46 -0
- package/src/interactive.ts +151 -0
- package/src/methods/business.ts +52 -0
- package/src/methods/chats.ts +264 -0
- package/src/methods/communities.ts +121 -0
- package/src/methods/contacts.ts +160 -0
- package/src/methods/groups.ts +378 -0
- package/src/methods/index.ts +34 -0
- package/src/methods/interactive.ts +21 -0
- package/src/methods/labels.ts +88 -0
- package/src/methods/media.ts +36 -0
- package/src/methods/messaging.ts +836 -0
- package/src/methods/session.ts +262 -0
- package/src/methods/status.ts +122 -0
- package/src/output-json-schema.ts +27 -0
- package/src/parameters.ts +237 -0
- package/src/registry.test.ts +30 -0
- package/src/registry.ts +601 -0
- package/src/return-types.ts +125 -0
- package/dist/index-BHcd0h7x.d.mts +0 -1265
- package/dist/index-BHcd0h7x.d.mts.map +0 -1
- package/dist/index-ChYFQM1K.d.cts +0 -1265
- package/dist/index-ChYFQM1K.d.cts.map +0 -1
- package/dist/methods-CZqeUhKy.mjs.map +0 -1
- package/dist/methods-Dizm7Fn9.cjs.map +0 -1
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { defineListenerV2 } from './registry';
|
|
3
|
+
|
|
4
|
+
export const StateEnum = z.enum([
|
|
5
|
+
'STARTING',
|
|
6
|
+
'AUTHENTICATING',
|
|
7
|
+
'READY',
|
|
8
|
+
'STOPPED',
|
|
9
|
+
'CONNECTED',
|
|
10
|
+
'DISCONNECTED',
|
|
11
|
+
'SYNCING',
|
|
12
|
+
'CONFLICT',
|
|
13
|
+
'UNLAUNCHED',
|
|
14
|
+
'PAIRING',
|
|
15
|
+
'TIMEOUT',
|
|
16
|
+
]);
|
|
17
|
+
|
|
18
|
+
export const stateChangedEvent = defineListenerV2('stateChanged', {
|
|
19
|
+
legacyName: 'onStateChanged',
|
|
20
|
+
meta: {
|
|
21
|
+
description: 'Fired when connection state changes',
|
|
22
|
+
namespace: 'state',
|
|
23
|
+
status: 'stable',
|
|
24
|
+
license: 'none',
|
|
25
|
+
},
|
|
26
|
+
payload: z.object({
|
|
27
|
+
state: StateEnum,
|
|
28
|
+
previousState: StateEnum.optional(),
|
|
29
|
+
}),
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export const chatStateEvent = defineListenerV2('chatState', {
|
|
33
|
+
legacyName: 'onChatState',
|
|
34
|
+
meta: {
|
|
35
|
+
description: 'Fired when someone is typing or recording',
|
|
36
|
+
namespace: 'state',
|
|
37
|
+
status: 'stable',
|
|
38
|
+
license: 'none',
|
|
39
|
+
},
|
|
40
|
+
payload: z.object({
|
|
41
|
+
chatId: z.string(),
|
|
42
|
+
state: z.enum(['typing', 'recording', 'paused']),
|
|
43
|
+
senderId: z.string(),
|
|
44
|
+
}),
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
export const logoutEvent = defineListenerV2('logout', {
|
|
48
|
+
legacyName: 'onLogout',
|
|
49
|
+
meta: {
|
|
50
|
+
description: 'Fired when the session is logged out',
|
|
51
|
+
namespace: 'state',
|
|
52
|
+
status: 'stable',
|
|
53
|
+
license: 'none',
|
|
54
|
+
},
|
|
55
|
+
payload: z.object({
|
|
56
|
+
reason: z.string().optional(),
|
|
57
|
+
timestamp: z.number(),
|
|
58
|
+
}),
|
|
59
|
+
});
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/**
|
|
3
|
+
* This file was automatically generated by packages/schema/scripts/gen-client-implementation.ts
|
|
4
|
+
* Do not edit this file manually.
|
|
5
|
+
*/
|
|
6
|
+
export const clientMethodAliasMap = {
|
|
7
|
+
"messages.sendText": "sendText",
|
|
8
|
+
"messages.sendTextWithMentions": "sendTextWithMentions",
|
|
9
|
+
"messages.sendReplyWithMentions": "sendReplyWithMentions",
|
|
10
|
+
"messages.sendPaymentRequest": "sendPaymentRequest",
|
|
11
|
+
"messages.sendImage": "sendImage",
|
|
12
|
+
"messages.sendFile": "sendFile",
|
|
13
|
+
"messages.sendAudio": "sendAudio",
|
|
14
|
+
"sendVoiceNote": "sendPtt",
|
|
15
|
+
"messages.sendPtt": "sendPtt",
|
|
16
|
+
"messages.sendVoiceNote": "sendPtt",
|
|
17
|
+
"messages.sendVideoAsGif": "sendVideoAsGif",
|
|
18
|
+
"messages.sendLocation": "sendLocation",
|
|
19
|
+
"messages.sendVCard": "sendVCard",
|
|
20
|
+
"messages.sendContact": "sendContact",
|
|
21
|
+
"sendContacts": "sendMultipleContacts",
|
|
22
|
+
"messages.sendContacts": "sendMultipleContacts",
|
|
23
|
+
"messages.sendMultipleContacts": "sendMultipleContacts",
|
|
24
|
+
"messages.sendButtons": "sendButtons",
|
|
25
|
+
"messages.sendAdvancedButtons": "sendAdvancedButtons",
|
|
26
|
+
"sendList": "sendListMessage",
|
|
27
|
+
"messages.sendList": "sendListMessage",
|
|
28
|
+
"messages.sendPoll": "sendPoll",
|
|
29
|
+
"messages.sendBanner": "sendBanner",
|
|
30
|
+
"sendYoutubeLink": "sendYouTubeLink",
|
|
31
|
+
"messages.sendYouTubeLink": "sendYouTubeLink",
|
|
32
|
+
"messages.sendYoutubeLink": "sendYouTubeLink",
|
|
33
|
+
"sendLink": "sendLinkWithAutoPreview",
|
|
34
|
+
"messages.sendLinkWithAutoPreview": "sendLinkWithAutoPreview",
|
|
35
|
+
"messages.sendLink": "sendLinkWithAutoPreview",
|
|
36
|
+
"sendLinkWithThumbnail": "sendMessageWithThumb",
|
|
37
|
+
"messages.sendLinkWithThumbnail": "sendMessageWithThumb",
|
|
38
|
+
"messages.sendWithThumb": "sendMessageWithThumb",
|
|
39
|
+
"messages.forward": "forwardMessages",
|
|
40
|
+
"messages.delete": "deleteMessage",
|
|
41
|
+
"getMessage": "getMessageById",
|
|
42
|
+
"messages.get": "getMessageById",
|
|
43
|
+
"messages.getById": "getMessageById",
|
|
44
|
+
"listMessages": "getAllMessages",
|
|
45
|
+
"messages.getAll": "getAllMessages",
|
|
46
|
+
"messages.all": "getAllMessages",
|
|
47
|
+
"messages.list": "getAllMessages",
|
|
48
|
+
"messages.getMyLast": "getMyLastMessage",
|
|
49
|
+
"messages.getStarred": "getStarredMessages",
|
|
50
|
+
"messages.getUnsent": "getUnsentMessages",
|
|
51
|
+
"messages.getInfo": "getMessageInfo",
|
|
52
|
+
"messages.getVCards": "getVCards",
|
|
53
|
+
"getGptArray": "getMessagesForLLM",
|
|
54
|
+
"messages.getForLLM": "getMessagesForLLM",
|
|
55
|
+
"messages.getGptArray": "getMessagesForLLM",
|
|
56
|
+
"messages.star": "starMessage",
|
|
57
|
+
"messages.unstar": "unstarMessage",
|
|
58
|
+
"messages.react": "react",
|
|
59
|
+
"messages.sendSeen": "sendSeen",
|
|
60
|
+
"loadOlderMessages": "loadEarlierMessages",
|
|
61
|
+
"messages.loadEarlier": "loadEarlierMessages",
|
|
62
|
+
"messages.loadOlder": "loadEarlierMessages",
|
|
63
|
+
"messages.sendFileFromUrl": "sendFileFromUrl",
|
|
64
|
+
"listChats": "getAllChats",
|
|
65
|
+
"chats.getAll": "getAllChats",
|
|
66
|
+
"chats.all": "getAllChats",
|
|
67
|
+
"chats.list": "getAllChats",
|
|
68
|
+
"chats.ids": "getAllChatIds",
|
|
69
|
+
"listChatIds": "getAllChatIds",
|
|
70
|
+
"chatIds.getAll": "getAllChatIds",
|
|
71
|
+
"chatIds.all": "getAllChatIds",
|
|
72
|
+
"chatIds.list": "getAllChatIds",
|
|
73
|
+
"getChatById": "getChat",
|
|
74
|
+
"chats.get": "getChat",
|
|
75
|
+
"chats.getById": "getChat",
|
|
76
|
+
"chats.getWithNonContacts": "getChatWithNonContacts",
|
|
77
|
+
"chats.archive": "archiveChat",
|
|
78
|
+
"chats.unarchive": "unarchiveChat",
|
|
79
|
+
"chats.clear": "clearChat",
|
|
80
|
+
"chats.delete": "deleteChat",
|
|
81
|
+
"chats.pin": "pinChat",
|
|
82
|
+
"chats.unpin": "unpinChat",
|
|
83
|
+
"chats.mute": "muteChat",
|
|
84
|
+
"chats.unmute": "unmuteChat",
|
|
85
|
+
"chats.markAsRead": "markAsRead",
|
|
86
|
+
"chats.markAsUnread": "markAsUnread",
|
|
87
|
+
"chats.setEphemeral": "setChatEphemeral",
|
|
88
|
+
"chats.isOnline": "isChatOnline",
|
|
89
|
+
"listContacts": "getAllContacts",
|
|
90
|
+
"contacts.getAll": "getAllContacts",
|
|
91
|
+
"contacts.all": "getAllContacts",
|
|
92
|
+
"contacts.list": "getAllContacts",
|
|
93
|
+
"contacts.get": "getContact",
|
|
94
|
+
"contacts.getCommonGroups": "getCommonGroups",
|
|
95
|
+
"contacts.getNumberProfile": "getNumberProfile",
|
|
96
|
+
"contacts.getBlockedIds": "getBlockedIds",
|
|
97
|
+
"contactBlock": "blockContact",
|
|
98
|
+
"contacts.block": "blockContact",
|
|
99
|
+
"contacts.contactBlock": "blockContact",
|
|
100
|
+
"contactUnblock": "unblockContact",
|
|
101
|
+
"contacts.unblock": "unblockContact",
|
|
102
|
+
"contacts.contactUnblock": "unblockContact",
|
|
103
|
+
"getReadReceipts": "checkReadReceipts",
|
|
104
|
+
"contacts.checkReadReceipts": "checkReadReceipts",
|
|
105
|
+
"contacts.getReadReceipts": "checkReadReceipts",
|
|
106
|
+
"contacts.checkNumberStatus": "checkNumberStatus",
|
|
107
|
+
"getProfilePicFromServer": "getProfilePicture",
|
|
108
|
+
"contacts.getProfilePicture": "getProfilePicture",
|
|
109
|
+
"contacts.getProfilePicFromServer": "getProfilePicture",
|
|
110
|
+
"groups.getMembers": "getGroupMembers",
|
|
111
|
+
"listGroups": "getAllGroups",
|
|
112
|
+
"groups.getAll": "getAllGroups",
|
|
113
|
+
"groups.all": "getAllGroups",
|
|
114
|
+
"groups.list": "getAllGroups",
|
|
115
|
+
"getGroupMemberIds": "getGroupMembersId",
|
|
116
|
+
"groups.getMemberIds": "getGroupMembersId",
|
|
117
|
+
"groups.getMembersId": "getGroupMembersId",
|
|
118
|
+
"groups.getInfo": "getGroupInfo",
|
|
119
|
+
"groups.getAdmins": "getGroupAdmins",
|
|
120
|
+
"groups.getKicked": "getKickedGroups",
|
|
121
|
+
"groups.getInviteLink": "getGroupInviteLink",
|
|
122
|
+
"groups.create": "createGroup",
|
|
123
|
+
"groups.leave": "leaveGroup",
|
|
124
|
+
"joinGroup": "joinGroupViaLink",
|
|
125
|
+
"groups.join": "joinGroupViaLink",
|
|
126
|
+
"groups.joinViaLink": "joinGroupViaLink",
|
|
127
|
+
"groups.revokeInviteLink": "revokeGroupInviteLink",
|
|
128
|
+
"groups.setTitle": "setGroupTitle",
|
|
129
|
+
"groups.setDescription": "setGroupDescription",
|
|
130
|
+
"groups.setIcon": "setGroupIcon",
|
|
131
|
+
"groups.setAdminsOnly": "setGroupToAdminsOnly",
|
|
132
|
+
"groups.setToAdminsOnly": "setGroupToAdminsOnly",
|
|
133
|
+
"groups.setEditAdminsOnly": "setGroupEditToAdminsOnly",
|
|
134
|
+
"groups.setEditToAdminsOnly": "setGroupEditToAdminsOnly",
|
|
135
|
+
"addGroupParticipant": "addParticipant",
|
|
136
|
+
"groups.addParticipant": "addParticipant",
|
|
137
|
+
"removeGroupParticipant": "removeParticipant",
|
|
138
|
+
"groups.removeParticipant": "removeParticipant",
|
|
139
|
+
"promoteGroupParticipant": "promoteParticipant",
|
|
140
|
+
"groups.promoteParticipant": "promoteParticipant",
|
|
141
|
+
"demoteGroupParticipant": "demoteParticipant",
|
|
142
|
+
"groups.demoteParticipant": "demoteParticipant",
|
|
143
|
+
"groups.approveJoinRequest": "approveGroupJoinRequest",
|
|
144
|
+
"groups.rejectJoinRequest": "rejectGroupJoinRequest",
|
|
145
|
+
"listCommunities": "getAllCommunities",
|
|
146
|
+
"communities.getAll": "getAllCommunities",
|
|
147
|
+
"communities.all": "getAllCommunities",
|
|
148
|
+
"communities.list": "getAllCommunities",
|
|
149
|
+
"communities.getInfo": "getCommunityInfo",
|
|
150
|
+
"communities.getParticipantIds": "getCommunityParticipantIds",
|
|
151
|
+
"communities.getAdminIds": "getCommunityAdminIds",
|
|
152
|
+
"communities.getParticipants": "getCommunityParticipants",
|
|
153
|
+
"communities.getAdmins": "getCommunityAdmins",
|
|
154
|
+
"status.postText": "postTextStatus",
|
|
155
|
+
"status.postImage": "postImageStatus",
|
|
156
|
+
"status.postVideo": "postVideoStatus",
|
|
157
|
+
"getStatuses": "getStories",
|
|
158
|
+
"status.getAll": "getStories",
|
|
159
|
+
"status.getStories": "getStories",
|
|
160
|
+
"status.get": "getStories",
|
|
161
|
+
"mystatus.getStatus": "getStatus",
|
|
162
|
+
"status.delete": "deleteStatus",
|
|
163
|
+
"deleteAllStatuses": "deleteAllStatus",
|
|
164
|
+
"status.deleteAll": "deleteAllStatus",
|
|
165
|
+
"listLabels": "getAllLabels",
|
|
166
|
+
"labels.getAll": "getAllLabels",
|
|
167
|
+
"labels.all": "getAllLabels",
|
|
168
|
+
"labels.list": "getAllLabels",
|
|
169
|
+
"labels.getChats": "getChatsByLabel",
|
|
170
|
+
"labels.getChatsBy": "getChatsByLabel",
|
|
171
|
+
"labels.add": "addLabel",
|
|
172
|
+
"labels.remove": "removeLabel",
|
|
173
|
+
"business.getProfile": "getBusinessProfile",
|
|
174
|
+
"getBusinessProfilesProducts": "getBusinessProducts",
|
|
175
|
+
"business.getProducts": "getBusinessProducts",
|
|
176
|
+
"business.getProfilesProducts": "getBusinessProducts",
|
|
177
|
+
"business.getOrder": "getOrder",
|
|
178
|
+
"session.getMe": "getMe",
|
|
179
|
+
"session.getHostNumber": "getHostNumber",
|
|
180
|
+
"session.getConnectionState": "getConnectionState",
|
|
181
|
+
"getWhatsAppVersion": "getWAVersion",
|
|
182
|
+
"session.getWAVersion": "getWAVersion",
|
|
183
|
+
"session.getWhatsAppVersion": "getWAVersion",
|
|
184
|
+
"session.getBatteryLevel": "getBatteryLevel",
|
|
185
|
+
"getIsPlugged": "isPlugged",
|
|
186
|
+
"session.isPlugged": "isPlugged",
|
|
187
|
+
"session.getIsPlugged": "isPlugged",
|
|
188
|
+
"session.getFeatures": "getFeatures",
|
|
189
|
+
"session.getLicenseType": "getLicenseType",
|
|
190
|
+
"getGeneratedUserAgent": "getUserAgent",
|
|
191
|
+
"session.getUserAgent": "getUserAgent",
|
|
192
|
+
"session.getGeneratedUserAgent": "getUserAgent",
|
|
193
|
+
"session.getProcessStats": "getProcessStats",
|
|
194
|
+
"getAmountOfLoadedMessages": "getLoadedMessageCount",
|
|
195
|
+
"session.getLoadedMessageCount": "getLoadedMessageCount",
|
|
196
|
+
"session.getAmountOfLoadedMessages": "getLoadedMessageCount",
|
|
197
|
+
"takeScreenshot": "getSnapshot",
|
|
198
|
+
"session.getSnapshot": "getSnapshot",
|
|
199
|
+
"session.takeScreenshot": "getSnapshot",
|
|
200
|
+
"session.healthCheck": "healthCheck",
|
|
201
|
+
"setDisplayName": "setMyName",
|
|
202
|
+
"session.setName": "setMyName",
|
|
203
|
+
"session.setMyName": "setMyName",
|
|
204
|
+
"session.setDisplayName": "setMyName",
|
|
205
|
+
"setStatusText": "setMyStatus",
|
|
206
|
+
"session.setStatus": "setMyStatus",
|
|
207
|
+
"session.setMyStatus": "setMyStatus",
|
|
208
|
+
"session.setStatusText": "setMyStatus",
|
|
209
|
+
"setProfilePic": "setProfilePicture",
|
|
210
|
+
"session.setProfilePicture": "setProfilePicture",
|
|
211
|
+
"session.setProfilePic": "setProfilePicture",
|
|
212
|
+
"media.decrypt": "decryptMedia",
|
|
213
|
+
"media.download": "downloadMedia",
|
|
214
|
+
"messages.sendInteractive": "sendInteractive",
|
|
215
|
+
"messages.sendRaw": "sendRawMessage"
|
|
216
|
+
} as const;
|