@open-wa/schema 5.0.0-alpha.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.
Files changed (54) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/LICENSE.md +67 -0
  3. package/README.md +19 -0
  4. package/client_migration_doc.md +467 -0
  5. package/codecs_and_params_plan.md +936 -0
  6. package/migration_plan_doc.md +223 -0
  7. package/package.json +90 -0
  8. package/scripts/gen-client-implementation.ts +129 -0
  9. package/scripts/gen-client-reference-docs.ts +621 -0
  10. package/scripts/gen-openapi.ts +96 -0
  11. package/scripts/gen-types.ts +43 -0
  12. package/scripts/verify-v5-pipeline.ts +85 -0
  13. package/src/__tests__/generators.contract.test.ts +181 -0
  14. package/src/__tests__/registry.contract.test.ts +81 -0
  15. package/src/client-config.ts +30 -0
  16. package/src/codecs.test.ts +41 -0
  17. package/src/codecs.ts +191 -0
  18. package/src/common-types.ts +280 -0
  19. package/src/config.ts +47 -0
  20. package/src/enums.ts +63 -0
  21. package/src/events/groups.ts +33 -0
  22. package/src/events/index.ts +4 -0
  23. package/src/events/messaging.ts +72 -0
  24. package/src/events/registry.ts +114 -0
  25. package/src/events/state.ts +59 -0
  26. package/src/generated/AliasMap.ts +214 -0
  27. package/src/generated/BaseClient.ts +868 -0
  28. package/src/generated/BaseNamespacedClient.ts +212 -0
  29. package/src/generated/index.ts +5 -0
  30. package/src/generated/openapi.json +7799 -0
  31. package/src/generated/types.ts +377 -0
  32. package/src/http-manifest.ts +97 -0
  33. package/src/implementor.test.ts +88 -0
  34. package/src/implementor.ts +75 -0
  35. package/src/index.ts +43 -0
  36. package/src/methods/business.ts +51 -0
  37. package/src/methods/chats.ts +263 -0
  38. package/src/methods/communities.ts +119 -0
  39. package/src/methods/contacts.ts +158 -0
  40. package/src/methods/groups.ts +376 -0
  41. package/src/methods/index.ts +33 -0
  42. package/src/methods/labels.ts +86 -0
  43. package/src/methods/media.ts +36 -0
  44. package/src/methods/messaging.ts +828 -0
  45. package/src/methods/session.ts +261 -0
  46. package/src/methods/status.ts +120 -0
  47. package/src/open-wa-utils.d.ts +4 -0
  48. package/src/parameters.ts +237 -0
  49. package/src/registry.test.ts +30 -0
  50. package/src/registry.ts +601 -0
  51. package/tsconfig.generated.json +11 -0
  52. package/tsconfig.json +15 -0
  53. package/tsdown.config.ts +16 -0
  54. package/vitest.config.ts +10 -0
@@ -0,0 +1,212 @@
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
+ import { BaseClient } from './BaseClient';
7
+
8
+ export abstract class BaseNamespacedClient extends BaseClient {
9
+ public business = {
10
+ getOrder: this.getOrder,
11
+ getProducts: this.getBusinessProducts,
12
+ getProfile: this.getBusinessProfile,
13
+ getProfilesProducts: this.getBusinessProducts
14
+ };
15
+
16
+ public chatIds = {
17
+ all: this.getAllChatIds,
18
+ getAll: this.getAllChatIds,
19
+ list: this.getAllChatIds
20
+ };
21
+
22
+ public chats = {
23
+ all: this.getAllChats,
24
+ archive: this.archiveChat,
25
+ clear: this.clearChat,
26
+ delete: this.deleteChat,
27
+ get: this.getChat,
28
+ getAll: this.getAllChats,
29
+ getById: this.getChat,
30
+ getWithNonContacts: this.getChatWithNonContacts,
31
+ isOnline: this.isChatOnline,
32
+ list: this.getAllChats,
33
+ markAsRead: this.markAsRead,
34
+ markAsUnread: this.markAsUnread,
35
+ mute: this.muteChat,
36
+ pin: this.pinChat,
37
+ setEphemeral: this.setChatEphemeral,
38
+ unarchive: this.unarchiveChat,
39
+ unmute: this.unmuteChat,
40
+ unpin: this.unpinChat
41
+ };
42
+
43
+ public communities = {
44
+ all: this.getAllCommunities,
45
+ getAdminIds: this.getCommunityAdminIds,
46
+ getAdmins: this.getCommunityAdmins,
47
+ getAll: this.getAllCommunities,
48
+ getInfo: this.getCommunityInfo,
49
+ getParticipantIds: this.getCommunityParticipantIds,
50
+ getParticipants: this.getCommunityParticipants,
51
+ list: this.getAllCommunities
52
+ };
53
+
54
+ public contacts = {
55
+ all: this.getAllContacts,
56
+ block: this.blockContact,
57
+ checkNumberStatus: this.checkNumberStatus,
58
+ checkReadReceipts: this.checkReadReceipts,
59
+ contactBlock: this.blockContact,
60
+ contactUnblock: this.unblockContact,
61
+ get: this.getContact,
62
+ getAll: this.getAllContacts,
63
+ getBlockedIds: this.getBlockedIds,
64
+ getCommonGroups: this.getCommonGroups,
65
+ getNumberProfile: this.getNumberProfile,
66
+ getProfilePicFromServer: this.getProfilePicture,
67
+ getProfilePicture: this.getProfilePicture,
68
+ getReadReceipts: this.checkReadReceipts,
69
+ list: this.getAllContacts,
70
+ unblock: this.unblockContact
71
+ };
72
+
73
+ public groups = {
74
+ addParticipant: this.addParticipant,
75
+ all: this.getAllGroups,
76
+ approveJoinRequest: this.approveGroupJoinRequest,
77
+ create: this.createGroup,
78
+ demoteParticipant: this.demoteParticipant,
79
+ getAdmins: this.getGroupAdmins,
80
+ getAll: this.getAllGroups,
81
+ getInfo: this.getGroupInfo,
82
+ getInviteLink: this.getGroupInviteLink,
83
+ getKicked: this.getKickedGroups,
84
+ getMemberIds: this.getGroupMembersId,
85
+ getMembers: this.getGroupMembers,
86
+ getMembersId: this.getGroupMembersId,
87
+ join: this.joinGroupViaLink,
88
+ joinViaLink: this.joinGroupViaLink,
89
+ leave: this.leaveGroup,
90
+ list: this.getAllGroups,
91
+ promoteParticipant: this.promoteParticipant,
92
+ rejectJoinRequest: this.rejectGroupJoinRequest,
93
+ removeParticipant: this.removeParticipant,
94
+ revokeInviteLink: this.revokeGroupInviteLink,
95
+ setAdminsOnly: this.setGroupToAdminsOnly,
96
+ setDescription: this.setGroupDescription,
97
+ setEditAdminsOnly: this.setGroupEditToAdminsOnly,
98
+ setEditToAdminsOnly: this.setGroupEditToAdminsOnly,
99
+ setIcon: this.setGroupIcon,
100
+ setTitle: this.setGroupTitle,
101
+ setToAdminsOnly: this.setGroupToAdminsOnly
102
+ };
103
+
104
+ public labels = {
105
+ add: this.addLabel,
106
+ all: this.getAllLabels,
107
+ getAll: this.getAllLabels,
108
+ getChats: this.getChatsByLabel,
109
+ getChatsBy: this.getChatsByLabel,
110
+ list: this.getAllLabels,
111
+ remove: this.removeLabel
112
+ };
113
+
114
+ public media = {
115
+ decrypt: this.decryptMedia,
116
+ download: this.downloadMedia
117
+ };
118
+
119
+ public messages = {
120
+ all: this.getAllMessages,
121
+ delete: this.deleteMessage,
122
+ forward: this.forwardMessages,
123
+ get: this.getMessageById,
124
+ getAll: this.getAllMessages,
125
+ getById: this.getMessageById,
126
+ getForLLM: this.getMessagesForLLM,
127
+ getGptArray: this.getMessagesForLLM,
128
+ getInfo: this.getMessageInfo,
129
+ getMyLast: this.getMyLastMessage,
130
+ getStarred: this.getStarredMessages,
131
+ getUnsent: this.getUnsentMessages,
132
+ getVCards: this.getVCards,
133
+ list: this.getAllMessages,
134
+ loadEarlier: this.loadEarlierMessages,
135
+ loadOlder: this.loadEarlierMessages,
136
+ react: this.react,
137
+ sendAdvancedButtons: this.sendAdvancedButtons,
138
+ sendAudio: this.sendAudio,
139
+ sendBanner: this.sendBanner,
140
+ sendButtons: this.sendButtons,
141
+ sendContact: this.sendContact,
142
+ sendContacts: this.sendMultipleContacts,
143
+ sendFile: this.sendFile,
144
+ sendFileFromUrl: this.sendFileFromUrl,
145
+ sendImage: this.sendImage,
146
+ sendLink: this.sendLinkWithAutoPreview,
147
+ sendLinkWithAutoPreview: this.sendLinkWithAutoPreview,
148
+ sendLinkWithThumbnail: this.sendMessageWithThumb,
149
+ sendList: this.sendListMessage,
150
+ sendLocation: this.sendLocation,
151
+ sendMultipleContacts: this.sendMultipleContacts,
152
+ sendPaymentRequest: this.sendPaymentRequest,
153
+ sendPoll: this.sendPoll,
154
+ sendPtt: this.sendPtt,
155
+ sendReplyWithMentions: this.sendReplyWithMentions,
156
+ sendSeen: this.sendSeen,
157
+ sendText: this.sendText,
158
+ sendTextWithMentions: this.sendTextWithMentions,
159
+ sendVCard: this.sendVCard,
160
+ sendVideoAsGif: this.sendVideoAsGif,
161
+ sendVoiceNote: this.sendPtt,
162
+ sendWithThumb: this.sendMessageWithThumb,
163
+ sendYoutubeLink: this.sendYouTubeLink,
164
+ sendYouTubeLink: this.sendYouTubeLink,
165
+ star: this.starMessage,
166
+ unstar: this.unstarMessage
167
+ };
168
+
169
+ public mystatus = {
170
+ getStatus: this.getStatus
171
+ };
172
+
173
+ public session = {
174
+ getAmountOfLoadedMessages: this.getLoadedMessageCount,
175
+ getBatteryLevel: this.getBatteryLevel,
176
+ getConnectionState: this.getConnectionState,
177
+ getFeatures: this.getFeatures,
178
+ getGeneratedUserAgent: this.getUserAgent,
179
+ getHostNumber: this.getHostNumber,
180
+ getIsPlugged: this.isPlugged,
181
+ getLicenseType: this.getLicenseType,
182
+ getLoadedMessageCount: this.getLoadedMessageCount,
183
+ getMe: this.getMe,
184
+ getProcessStats: this.getProcessStats,
185
+ getSnapshot: this.getSnapshot,
186
+ getUserAgent: this.getUserAgent,
187
+ getWAVersion: this.getWAVersion,
188
+ getWhatsAppVersion: this.getWAVersion,
189
+ healthCheck: this.healthCheck,
190
+ isPlugged: this.isPlugged,
191
+ setDisplayName: this.setMyName,
192
+ setMyName: this.setMyName,
193
+ setMyStatus: this.setMyStatus,
194
+ setName: this.setMyName,
195
+ setProfilePic: this.setProfilePicture,
196
+ setProfilePicture: this.setProfilePicture,
197
+ setStatus: this.setMyStatus,
198
+ setStatusText: this.setMyStatus,
199
+ takeScreenshot: this.getSnapshot
200
+ };
201
+
202
+ public status = {
203
+ delete: this.deleteStatus,
204
+ deleteAll: this.deleteAllStatus,
205
+ get: this.getStories,
206
+ getAll: this.getStories,
207
+ getStories: this.getStories,
208
+ postImage: this.postImageStatus,
209
+ postText: this.postTextStatus,
210
+ postVideo: this.postVideoStatus
211
+ };
212
+ }
@@ -0,0 +1,5 @@
1
+ /* eslint-disable */
2
+ export * from './AliasMap';
3
+ export * from './BaseClient';
4
+ export * from './BaseNamespacedClient';
5
+ export * from './types';