@raphaelvserafim/client-api-whatsapp 1.2.0 → 1.3.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/WhatsApp.d.ts +40 -2
- package/dist/WhatsApp.js +36 -1
- package/dist/WhatsApp.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/services/CallService.d.ts +2 -0
- package/dist/services/CallService.js +14 -0
- package/dist/services/CallService.js.map +1 -1
- package/dist/services/ChatService.d.ts +4 -1
- package/dist/services/ChatService.js +27 -2
- package/dist/services/ChatService.js.map +1 -1
- package/dist/services/CommunityService.d.ts +8 -1
- package/dist/services/CommunityService.js +49 -0
- package/dist/services/CommunityService.js.map +1 -1
- package/dist/services/ContactService.d.ts +6 -0
- package/dist/services/ContactService.js +38 -0
- package/dist/services/ContactService.js.map +1 -1
- package/dist/services/GroupService.d.ts +5 -0
- package/dist/services/GroupService.js +13 -0
- package/dist/services/GroupService.js.map +1 -1
- package/dist/services/InstanceService.d.ts +1 -0
- package/dist/services/InstanceService.js +6 -0
- package/dist/services/InstanceService.js.map +1 -1
- package/dist/services/LabelService.d.ts +1 -0
- package/dist/services/LabelService.js +7 -1
- package/dist/services/LabelService.js.map +1 -1
- package/dist/services/MessageService.d.ts +10 -1
- package/dist/services/MessageService.js +65 -0
- package/dist/services/MessageService.js.map +1 -1
- package/dist/services/NewsletterService.d.ts +23 -0
- package/dist/services/NewsletterService.js +129 -0
- package/dist/services/NewsletterService.js.map +1 -0
- package/dist/services/StatusService.d.ts +14 -0
- package/dist/services/StatusService.js +46 -0
- package/dist/services/StatusService.js.map +1 -0
- package/dist/types/index.d.ts +53 -2
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -1
- package/package.json +1 -1
package/dist/WhatsApp.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Init, WebhookBody, TypeMessage, StatusPresence, Contact, Section, Location, Buttons, Items, HeaderMedia, DownloadableMessage, Product, CommunityCreate, CommunityUpdate, GroupParticipantsAction, ApiResponse, PairingCodeResponse, MobileRegisterData, EventData, InfoInstance, SendMessageRoot, Connect, RegisteredResponse, ContactInfo, GroupInfo, InviteCodeResponse, ChatInfo, LabelInfo, CommunityInfo, CatalogResponse, WebhookStatistics, ListMessagesResponse, DownloadMediaResponse, CallResponse, MessageData, GroupParticipant } from './types';
|
|
1
|
+
import { Init, WebhookBody, TypeMessage, StatusPresence, Contact, Section, Location, Buttons, Items, HeaderMedia, DownloadableMessage, Product, CommunityCreate, CommunityUpdate, GroupParticipantsAction, ApiResponse, PairingCodeResponse, MobileRegisterData, EventData, InfoInstance, SendMessageRoot, Connect, RegisteredResponse, ContactInfo, GroupInfo, InviteCodeResponse, ChatInfo, LabelInfo, CommunityInfo, CatalogResponse, WebhookStatistics, ListMessagesResponse, DownloadMediaResponse, CallResponse, MessageData, GroupParticipant, LiveLocationData, SendContactsData, ProductMessageData, GroupInviteMessageData, CommunityGroupCreate } from './types';
|
|
2
2
|
import { IHttpClient } from './client/IHttpClient';
|
|
3
3
|
import { InstanceService } from './services/InstanceService';
|
|
4
4
|
import { MessageService } from './services/MessageService';
|
|
@@ -10,6 +10,8 @@ import { ContactService } from './services/ContactService';
|
|
|
10
10
|
import { GroupService } from './services/GroupService';
|
|
11
11
|
import { CommunityService } from './services/CommunityService';
|
|
12
12
|
import { BusinessService } from './services/BusinessService';
|
|
13
|
+
import { NewsletterService } from './services/NewsletterService';
|
|
14
|
+
import { StatusService } from './services/StatusService';
|
|
13
15
|
export declare class WhatsApp {
|
|
14
16
|
readonly instance: InstanceService;
|
|
15
17
|
readonly message: MessageService;
|
|
@@ -21,6 +23,8 @@ export declare class WhatsApp {
|
|
|
21
23
|
readonly group: GroupService;
|
|
22
24
|
readonly community: CommunityService;
|
|
23
25
|
readonly business: BusinessService;
|
|
26
|
+
readonly newsletter: NewsletterService;
|
|
27
|
+
readonly status: StatusService;
|
|
24
28
|
constructor(data: Init, httpClient?: IHttpClient);
|
|
25
29
|
connect(): Promise<Connect>;
|
|
26
30
|
info(): Promise<InfoInstance>;
|
|
@@ -35,6 +39,7 @@ export declare class WhatsApp {
|
|
|
35
39
|
pairingCode(phoneNumber: string): Promise<PairingCodeResponse>;
|
|
36
40
|
addMongoDb(uri: string, dbName: string): Promise<ApiResponse>;
|
|
37
41
|
setProxy(proxy: string): Promise<ApiResponse>;
|
|
42
|
+
resync(): Promise<ApiResponse>;
|
|
38
43
|
restart(): Promise<ApiResponse>;
|
|
39
44
|
updateProfileStatus(text: string): Promise<ApiResponse>;
|
|
40
45
|
updateProfilePicture(url: string): Promise<ApiResponse>;
|
|
@@ -85,22 +90,36 @@ export declare class WhatsApp {
|
|
|
85
90
|
sendPoll(to: string, name: string, values: Array<string | number | boolean>, selectableCount?: number): Promise<SendMessageRoot>;
|
|
86
91
|
sendEvent(data: EventData): Promise<SendMessageRoot>;
|
|
87
92
|
pinMessage(id: string, duration?: number): Promise<ApiResponse>;
|
|
93
|
+
unpinMessage(id: string): Promise<ApiResponse>;
|
|
88
94
|
sendCallLink(to: string, type: string, caption?: string): Promise<SendMessageRoot>;
|
|
89
95
|
sendImageBase64(to: string, base64: string, caption?: string): Promise<SendMessageRoot>;
|
|
90
96
|
sendAudioBase64(to: string, base64: string): Promise<SendMessageRoot>;
|
|
91
97
|
sendDocumentBase64(to: string, base64: string, mimetype: string, fileName?: string, caption?: string): Promise<SendMessageRoot>;
|
|
98
|
+
sendContacts(data: SendContactsData): Promise<SendMessageRoot>;
|
|
99
|
+
sendLiveLocation(data: LiveLocationData): Promise<SendMessageRoot>;
|
|
100
|
+
getMessageDetails(messageId: string): Promise<ApiResponse>;
|
|
101
|
+
getMessageMedia(messageId: string, format?: string): Promise<ApiResponse>;
|
|
102
|
+
sendProduct(data: ProductMessageData): Promise<SendMessageRoot>;
|
|
103
|
+
sendGroupInvite(data: GroupInviteMessageData): Promise<SendMessageRoot>;
|
|
104
|
+
requestPhone(to: string): Promise<ApiResponse>;
|
|
105
|
+
createCallLink(type: string): Promise<ApiResponse>;
|
|
92
106
|
getChats(): Promise<{
|
|
93
107
|
status: number;
|
|
94
108
|
data: ChatInfo[];
|
|
95
109
|
}>;
|
|
96
110
|
modifyChat(id: string, action: 'markRead' | 'pin', value: boolean): Promise<ApiResponse>;
|
|
97
111
|
deleteChat(chatId: string): Promise<ApiResponse>;
|
|
98
|
-
getChatMessages(chatId: string): Promise<{
|
|
112
|
+
getChatMessages(chatId: string, page?: number, limit?: number): Promise<{
|
|
99
113
|
status: number;
|
|
100
114
|
data: MessageData[];
|
|
101
115
|
}>;
|
|
116
|
+
presenceSubscribe(jid: string): Promise<ApiResponse>;
|
|
117
|
+
setDisappearing(jid: string, expiration: number): Promise<ApiResponse>;
|
|
118
|
+
getPrivacy(): Promise<ApiResponse>;
|
|
102
119
|
makeCall(to: string, isVideo?: boolean): Promise<CallResponse>;
|
|
103
120
|
rejectCall(id: string, from: string): Promise<ApiResponse>;
|
|
121
|
+
acceptCall(callId: string, callFrom: string): Promise<ApiResponse>;
|
|
122
|
+
endCall(callId: string, peerJid: string): Promise<ApiResponse>;
|
|
104
123
|
getLabels(): Promise<{
|
|
105
124
|
status: number;
|
|
106
125
|
data: LabelInfo[];
|
|
@@ -111,6 +130,7 @@ export declare class WhatsApp {
|
|
|
111
130
|
data: ChatInfo[];
|
|
112
131
|
}>;
|
|
113
132
|
addChatLabel(labelId: string, to: string): Promise<ApiResponse>;
|
|
133
|
+
deleteLabel(labelId: string): Promise<ApiResponse>;
|
|
114
134
|
removeChatLabel(labelId: string, to: string): Promise<ApiResponse>;
|
|
115
135
|
checkRegisteredWhatsapp(number: string): Promise<RegisteredResponse>;
|
|
116
136
|
downloadMedia(type: 'image' | 'video' | 'sticker' | 'audio' | 'document', message: DownloadableMessage): Promise<DownloadMediaResponse>;
|
|
@@ -119,11 +139,17 @@ export declare class WhatsApp {
|
|
|
119
139
|
status: number;
|
|
120
140
|
data: ContactInfo[];
|
|
121
141
|
}>;
|
|
142
|
+
addContact(number: string, name: string): Promise<ApiResponse>;
|
|
122
143
|
contactProfile(id: string): Promise<{
|
|
123
144
|
status: number;
|
|
124
145
|
data: ContactInfo;
|
|
125
146
|
}>;
|
|
147
|
+
removeContact(number: string): Promise<ApiResponse>;
|
|
126
148
|
blockContact(number: string, action: 'block' | 'unblock'): Promise<ApiResponse>;
|
|
149
|
+
clearContactSession(number: string): Promise<ApiResponse>;
|
|
150
|
+
getContactStatus(number: string): Promise<ApiResponse>;
|
|
151
|
+
listBlockedContacts(): Promise<ApiResponse>;
|
|
152
|
+
resolveLids(lids: string[]): Promise<ApiResponse>;
|
|
127
153
|
groups(): Promise<{
|
|
128
154
|
status: number;
|
|
129
155
|
data: GroupInfo[];
|
|
@@ -139,6 +165,11 @@ export declare class WhatsApp {
|
|
|
139
165
|
updateGroup(id: string, name: string, description: string): Promise<ApiResponse>;
|
|
140
166
|
changeGroupSettings(id: string, setting: 'announcement' | 'not_announcement' | 'locked' | 'unlocked'): Promise<ApiResponse>;
|
|
141
167
|
leaveGroup(id: string): Promise<ApiResponse>;
|
|
168
|
+
getGroupMembers(id: string): Promise<{
|
|
169
|
+
status: number;
|
|
170
|
+
data: GroupParticipant[];
|
|
171
|
+
}>;
|
|
172
|
+
getGroupInviteInfo(code: string): Promise<ApiResponse>;
|
|
142
173
|
getInviteGroup(id: string): Promise<InviteCodeResponse>;
|
|
143
174
|
updateGroupPicture(id: string, url: string): Promise<ApiResponse>;
|
|
144
175
|
removeGroupPicture(id: string): Promise<ApiResponse>;
|
|
@@ -172,6 +203,13 @@ export declare class WhatsApp {
|
|
|
172
203
|
data: GroupParticipant[];
|
|
173
204
|
}>;
|
|
174
205
|
updateCommunityRequestParticipants(id: string, data: GroupParticipantsAction): Promise<ApiResponse>;
|
|
206
|
+
acceptCommunityInvite(code: string): Promise<ApiResponse>;
|
|
207
|
+
getCommunityInviteInfo(code: string): Promise<ApiResponse>;
|
|
208
|
+
createCommunityGroup(id: string, data: CommunityGroupCreate): Promise<ApiResponse>;
|
|
209
|
+
setCommunityEphemeral(id: string, expiration: number): Promise<ApiResponse>;
|
|
210
|
+
updateCommunitySettings(id: string, setting: string): Promise<ApiResponse>;
|
|
211
|
+
setCommunityMemberAddMode(id: string, mode: string): Promise<ApiResponse>;
|
|
212
|
+
setCommunityJoinApproval(id: string, mode: string): Promise<ApiResponse>;
|
|
175
213
|
getCatalog(limit?: number, cursor?: string): Promise<CatalogResponse>;
|
|
176
214
|
createProduct(product: Product): Promise<ApiResponse>;
|
|
177
215
|
updateProduct(productId: string, product: Product): Promise<ApiResponse>;
|
package/dist/WhatsApp.js
CHANGED
|
@@ -12,6 +12,8 @@ const ContactService_1 = require("./services/ContactService");
|
|
|
12
12
|
const GroupService_1 = require("./services/GroupService");
|
|
13
13
|
const CommunityService_1 = require("./services/CommunityService");
|
|
14
14
|
const BusinessService_1 = require("./services/BusinessService");
|
|
15
|
+
const NewsletterService_1 = require("./services/NewsletterService");
|
|
16
|
+
const StatusService_1 = require("./services/StatusService");
|
|
15
17
|
class WhatsApp {
|
|
16
18
|
constructor(data, httpClient) {
|
|
17
19
|
const client = httpClient ?? new HttpClient_1.HttpClient(`${data.server}/${data.key}`);
|
|
@@ -25,6 +27,8 @@ class WhatsApp {
|
|
|
25
27
|
this.group = new GroupService_1.GroupService(client);
|
|
26
28
|
this.community = new CommunityService_1.CommunityService(client);
|
|
27
29
|
this.business = new BusinessService_1.BusinessService(client);
|
|
30
|
+
this.newsletter = new NewsletterService_1.NewsletterService(client);
|
|
31
|
+
this.status = new StatusService_1.StatusService(client);
|
|
28
32
|
}
|
|
29
33
|
// ==================== Backward Compatibility ====================
|
|
30
34
|
// These methods delegate to the corresponding services.
|
|
@@ -38,6 +42,7 @@ class WhatsApp {
|
|
|
38
42
|
pairingCode(phoneNumber) { return this.instance.pairingCode(phoneNumber); }
|
|
39
43
|
addMongoDb(uri, dbName) { return this.instance.addMongoDb(uri, dbName); }
|
|
40
44
|
setProxy(proxy) { return this.instance.setProxy(proxy); }
|
|
45
|
+
resync() { return this.instance.resync(); }
|
|
41
46
|
restart() { return this.instance.restart(); }
|
|
42
47
|
updateProfileStatus(text) { return this.instance.updateProfileStatus(text); }
|
|
43
48
|
updateProfilePicture(url) { return this.instance.updateProfilePicture(url); }
|
|
@@ -56,23 +61,38 @@ class WhatsApp {
|
|
|
56
61
|
sendPoll(to, name, values, selectableCount) { return this.message.sendPoll(to, name, values, selectableCount); }
|
|
57
62
|
sendEvent(data) { return this.message.sendEvent(data); }
|
|
58
63
|
pinMessage(id, duration) { return this.message.pin(id, duration); }
|
|
64
|
+
unpinMessage(id) { return this.message.unpin(id); }
|
|
59
65
|
sendCallLink(to, type, caption) { return this.message.sendCallLink(to, type, caption); }
|
|
60
66
|
sendImageBase64(to, base64, caption) { return this.message.sendImageBase64(to, base64, caption); }
|
|
61
67
|
sendAudioBase64(to, base64) { return this.message.sendAudioBase64(to, base64); }
|
|
62
68
|
sendDocumentBase64(to, base64, mimetype, fileName, caption) { return this.message.sendDocumentBase64(to, base64, mimetype, fileName, caption); }
|
|
69
|
+
sendContacts(data) { return this.message.sendContacts(data); }
|
|
70
|
+
sendLiveLocation(data) { return this.message.sendLiveLocation(data); }
|
|
71
|
+
getMessageDetails(messageId) { return this.message.getDetails(messageId); }
|
|
72
|
+
getMessageMedia(messageId, format) { return this.message.getMedia(messageId, format); }
|
|
73
|
+
sendProduct(data) { return this.message.sendProduct(data); }
|
|
74
|
+
sendGroupInvite(data) { return this.message.sendGroupInvite(data); }
|
|
75
|
+
requestPhone(to) { return this.message.requestPhone(to); }
|
|
76
|
+
createCallLink(type) { return this.message.createCallLink(type); }
|
|
63
77
|
// Chat
|
|
64
78
|
getChats() { return this.chat.list(); }
|
|
65
79
|
modifyChat(id, action, value) { return this.chat.modify(id, action, value); }
|
|
66
80
|
deleteChat(chatId) { return this.chat.delete(chatId); }
|
|
67
|
-
getChatMessages(chatId) { return this.chat.messages(chatId); }
|
|
81
|
+
getChatMessages(chatId, page, limit) { return this.chat.messages(chatId, page, limit); }
|
|
82
|
+
presenceSubscribe(jid) { return this.chat.presenceSubscribe(jid); }
|
|
83
|
+
setDisappearing(jid, expiration) { return this.chat.disappearing(jid, expiration); }
|
|
84
|
+
getPrivacy() { return this.chat.privacy(); }
|
|
68
85
|
// Call
|
|
69
86
|
makeCall(to, isVideo) { return this.call.call(to, isVideo); }
|
|
70
87
|
rejectCall(id, from) { return this.call.reject(id, from); }
|
|
88
|
+
acceptCall(callId, callFrom) { return this.call.accept(callId, callFrom); }
|
|
89
|
+
endCall(callId, peerJid) { return this.call.end(callId, peerJid); }
|
|
71
90
|
// Labels
|
|
72
91
|
getLabels() { return this.label.list(); }
|
|
73
92
|
createLabel(name, labelId) { return this.label.create(name, labelId); }
|
|
74
93
|
getChatLabel(labelId) { return this.label.getChats(labelId); }
|
|
75
94
|
addChatLabel(labelId, to) { return this.label.addToChat(labelId, to); }
|
|
95
|
+
deleteLabel(labelId) { return this.label.delete(labelId); }
|
|
76
96
|
removeChatLabel(labelId, to) { return this.label.removeFromChat(labelId, to); }
|
|
77
97
|
// Actions
|
|
78
98
|
checkRegisteredWhatsapp(number) { return this.action.checkRegistered(number); }
|
|
@@ -80,8 +100,14 @@ class WhatsApp {
|
|
|
80
100
|
deleteStorage() { return this.action.deleteStorage(); }
|
|
81
101
|
// Contacts
|
|
82
102
|
contacts() { return this.contact.list(); }
|
|
103
|
+
addContact(number, name) { return this.contact.add(number, name); }
|
|
83
104
|
contactProfile(id) { return this.contact.profile(id); }
|
|
105
|
+
removeContact(number) { return this.contact.remove(number); }
|
|
84
106
|
blockContact(number, action) { return this.contact.block(number, action); }
|
|
107
|
+
clearContactSession(number) { return this.contact.clearSession(number); }
|
|
108
|
+
getContactStatus(number) { return this.contact.getStatus(number); }
|
|
109
|
+
listBlockedContacts() { return this.contact.listBlocked(); }
|
|
110
|
+
resolveLids(lids) { return this.contact.resolveLids(lids); }
|
|
85
111
|
// Groups
|
|
86
112
|
groups() { return this.group.list(); }
|
|
87
113
|
infoGroup(id) { return this.group.info(id); }
|
|
@@ -89,6 +115,8 @@ class WhatsApp {
|
|
|
89
115
|
updateGroup(id, name, description) { return this.group.update(id, name, description); }
|
|
90
116
|
changeGroupSettings(id, setting) { return this.group.changeSettings(id, setting); }
|
|
91
117
|
leaveGroup(id) { return this.group.leave(id); }
|
|
118
|
+
getGroupMembers(id) { return this.group.getMembers(id); }
|
|
119
|
+
getGroupInviteInfo(code) { return this.group.getInviteInfo(code); }
|
|
92
120
|
getInviteGroup(id) { return this.group.getInviteCode(id); }
|
|
93
121
|
updateGroupPicture(id, url) { return this.group.updatePicture(id, url); }
|
|
94
122
|
removeGroupPicture(id) { return this.group.removePicture(id); }
|
|
@@ -108,6 +136,13 @@ class WhatsApp {
|
|
|
108
136
|
removeCommunityParticipants(id, participants) { return this.community.removeParticipants(id, participants); }
|
|
109
137
|
getCommunityRequestParticipants(id) { return this.community.getRequestParticipants(id); }
|
|
110
138
|
updateCommunityRequestParticipants(id, data) { return this.community.updateRequestParticipants(id, data); }
|
|
139
|
+
acceptCommunityInvite(code) { return this.community.acceptInvite(code); }
|
|
140
|
+
getCommunityInviteInfo(code) { return this.community.getInviteInfo(code); }
|
|
141
|
+
createCommunityGroup(id, data) { return this.community.createGroup(id, data); }
|
|
142
|
+
setCommunityEphemeral(id, expiration) { return this.community.ephemeral(id, expiration); }
|
|
143
|
+
updateCommunitySettings(id, setting) { return this.community.updateSettings(id, setting); }
|
|
144
|
+
setCommunityMemberAddMode(id, mode) { return this.community.memberAddMode(id, mode); }
|
|
145
|
+
setCommunityJoinApproval(id, mode) { return this.community.joinApproval(id, mode); }
|
|
111
146
|
// Business
|
|
112
147
|
getCatalog(limit, cursor) { return this.business.getCatalog(limit, cursor); }
|
|
113
148
|
createProduct(product) { return this.business.createProduct(product); }
|
package/dist/WhatsApp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"What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QAAQ,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;CAC1G;AA3ID,4BA2IC;AAED,kBAAe,QAAQ,CAAC","sourcesContent":["import {\n Init, WebhookBody, TypeMessage, StatusPresence, Contact, Section,\n Location, Buttons, Items, HeaderMedia, DownloadableMessage, Product,\n CommunityCreate, CommunityUpdate, GroupParticipantsAction,\n ApiResponse, PairingCodeResponse, MobileRegisterData, EventData,\n InfoInstance, SendMessageRoot, Connect, RegisteredResponse,\n ContactInfo, GroupInfo, InviteCodeResponse, ChatInfo, LabelInfo,\n CommunityInfo, CatalogResponse, WebhookStatistics, ListMessagesResponse,\n DownloadMediaResponse, CallResponse, MessageData, GroupParticipant,\n} from './types';\nimport { IHttpClient } from './client/IHttpClient';\nimport { HttpClient } from './client/HttpClient';\nimport { InstanceService } from './services/InstanceService';\nimport { MessageService } from './services/MessageService';\nimport { ChatService } from './services/ChatService';\nimport { CallService } from './services/CallService';\nimport { LabelService } from './services/LabelService';\nimport { ActionService } from './services/ActionService';\nimport { ContactService } from './services/ContactService';\nimport { GroupService } from './services/GroupService';\nimport { CommunityService } from './services/CommunityService';\nimport { BusinessService } from './services/BusinessService';\n\nexport class WhatsApp {\n readonly instance: InstanceService;\n readonly message: MessageService;\n readonly chat: ChatService;\n readonly call: CallService;\n readonly label: LabelService;\n readonly action: ActionService;\n readonly contact: ContactService;\n readonly group: GroupService;\n readonly community: CommunityService;\n readonly business: BusinessService;\n\n constructor(data: Init, httpClient?: IHttpClient) {\n const client = httpClient ?? new HttpClient(`${data.server}/${data.key}`);\n\n this.instance = new InstanceService(client);\n this.message = new MessageService(client);\n this.chat = new ChatService(client);\n this.call = new CallService(client);\n this.label = new LabelService(client);\n this.action = new ActionService(client);\n this.contact = new ContactService(client);\n this.group = new GroupService(client);\n this.community = new CommunityService(client);\n this.business = new BusinessService(client);\n }\n\n // ==================== Backward Compatibility ====================\n // These methods delegate to the corresponding services.\n // Use wa.instance.*, wa.message.*, wa.group.*, etc. for the new API.\n\n // Instance\n connect(): Promise<Connect> { return this.instance.connect(); }\n info(): Promise<InfoInstance> { return this.instance.info(); }\n logout(): Promise<ApiResponse> { return this.instance.logout(); }\n setting(data: { markMessageRead: boolean; saveMedia: boolean; receiveStatusMessage: boolean; receivePresence: boolean }): Promise<ApiResponse> { return this.instance.setting(data); }\n updateWebhook(body: WebhookBody): Promise<ApiResponse> { return this.instance.updateWebhook(body); }\n pairingCode(phoneNumber: string): Promise<PairingCodeResponse> { return this.instance.pairingCode(phoneNumber); }\n addMongoDb(uri: string, dbName: string): Promise<ApiResponse> { return this.instance.addMongoDb(uri, dbName); }\n setProxy(proxy: string): Promise<ApiResponse> { return this.instance.setProxy(proxy); }\n restart(): Promise<ApiResponse> { return this.instance.restart(); }\n updateProfileStatus(text: string): Promise<ApiResponse> { return this.instance.updateProfileStatus(text); }\n updateProfilePicture(url: string): Promise<ApiResponse> { return this.instance.updateProfilePicture(url); }\n removeProfilePicture(): Promise<ApiResponse> { return this.instance.removeProfilePicture(); }\n updateProfileName(name: string): Promise<ApiResponse> { return this.instance.updateProfileName(name); }\n mobileRegisterPrepare(data: MobileRegisterData): Promise<ApiResponse> { return this.instance.mobileRegisterPrepare(data); }\n mobileRequestCode(method: string): Promise<ApiResponse> { return this.instance.mobileRequestCode(method); }\n mobileVerifyCode(code: string): Promise<ApiResponse> { return this.instance.mobileVerifyCode(code); }\n webhookStatistics(): Promise<WebhookStatistics> { return this.instance.webhookStatistics(); }\n\n // Messages\n listMessages(phoneNumber: string, page?: number, limit?: number): Promise<ListMessagesResponse> { return this.message.list(phoneNumber, page, limit); }\n sendMessage(\n data: {\n type: TypeMessage;\n body: {\n to: string; msgId?: string; header?: HeaderMedia; status?: StatusPresence;\n text?: string; url?: string; caption?: string; mimetype?: string; fileName?: string;\n contact?: Contact; location?: Location; name?: string; options?: string[];\n sections?: Section[]; buttons?: Buttons[]; footer?: string; description?: string;\n title?: string; buttonText?: string; thumbnailUrl?: string; sourceUrl?: string;\n referenceId?: string; code?: string; key?: string; merchantName?: string;\n keyType?: \"CNPJ\" | \"CPF\" | \"EMAIL\" | \"PHONE\"; subtotal?: string;\n totalAmount?: string; items?: Items[];\n };\n },\n reply?: boolean,\n ): Promise<SendMessageRoot> { return this.message.send(data, reply); }\n forwardingMessage(to: string, msgId: string): Promise<SendMessageRoot> { return this.message.forward(to, msgId); }\n sendSticker(to: string, url: string): Promise<SendMessageRoot> { return this.message.sendSticker(to, url); }\n sendVideoNote(to: string, url: string): Promise<SendMessageRoot> { return this.message.sendVideoNote(to, url); }\n sendPoll(to: string, name: string, values: Array<string | number | boolean>, selectableCount?: number): Promise<SendMessageRoot> { return this.message.sendPoll(to, name, values, selectableCount); }\n sendEvent(data: EventData): Promise<SendMessageRoot> { return this.message.sendEvent(data); }\n pinMessage(id: string, duration?: number): Promise<ApiResponse> { return this.message.pin(id, duration); }\n sendCallLink(to: string, type: string, caption?: string): Promise<SendMessageRoot> { return this.message.sendCallLink(to, type, caption); }\n sendImageBase64(to: string, base64: string, caption?: string): Promise<SendMessageRoot> { return this.message.sendImageBase64(to, base64, caption); }\n sendAudioBase64(to: string, base64: string): Promise<SendMessageRoot> { return this.message.sendAudioBase64(to, base64); }\n sendDocumentBase64(to: string, base64: string, mimetype: string, fileName?: string, caption?: string): Promise<SendMessageRoot> { return this.message.sendDocumentBase64(to, base64, mimetype, fileName, caption); }\n\n // Chat\n getChats(): Promise<{ status: number; data: ChatInfo[] }> { return this.chat.list(); }\n modifyChat(id: string, action: 'markRead' | 'pin', value: boolean): Promise<ApiResponse> { return this.chat.modify(id, action, value); }\n deleteChat(chatId: string): Promise<ApiResponse> { return this.chat.delete(chatId); }\n getChatMessages(chatId: string): Promise<{ status: number; data: MessageData[] }> { return this.chat.messages(chatId); }\n\n // Call\n makeCall(to: string, isVideo?: boolean): Promise<CallResponse> { return this.call.call(to, isVideo); }\n rejectCall(id: string, from: string): Promise<ApiResponse> { return this.call.reject(id, from); }\n\n // Labels\n getLabels(): Promise<{ status: number; data: LabelInfo[] }> { return this.label.list(); }\n createLabel(name: string, labelId?: string): Promise<ApiResponse> { return this.label.create(name, labelId); }\n getChatLabel(labelId: string): Promise<{ status: number; data: ChatInfo[] }> { return this.label.getChats(labelId); }\n addChatLabel(labelId: string, to: string): Promise<ApiResponse> { return this.label.addToChat(labelId, to); }\n removeChatLabel(labelId: string, to: string): Promise<ApiResponse> { return this.label.removeFromChat(labelId, to); }\n\n // Actions\n checkRegisteredWhatsapp(number: string): Promise<RegisteredResponse> { return this.action.checkRegistered(number); }\n downloadMedia(type: 'image' | 'video' | 'sticker' | 'audio' | 'document', message: DownloadableMessage): Promise<DownloadMediaResponse> { return this.action.downloadMedia(type, message); }\n deleteStorage(): Promise<ApiResponse> { return this.action.deleteStorage(); }\n\n // Contacts\n contacts(): Promise<{ status: number; data: ContactInfo[] }> { return this.contact.list(); }\n contactProfile(id: string): Promise<{ status: number; data: ContactInfo }> { return this.contact.profile(id); }\n blockContact(number: string, action: 'block' | 'unblock'): Promise<ApiResponse> { return this.contact.block(number, action); }\n\n // Groups\n groups(): Promise<{ status: number; data: GroupInfo[] }> { return this.group.list(); }\n infoGroup(id: string): Promise<{ status: number; data: GroupInfo }> { return this.group.info(id); }\n createGroup(name: string, participants: string[]): Promise<{ status: number; data: GroupInfo }> { return this.group.create(name, participants); }\n updateGroup(id: string, name: string, description: string): Promise<ApiResponse> { return this.group.update(id, name, description); }\n changeGroupSettings(id: string, setting: 'announcement' | 'not_announcement' | 'locked' | 'unlocked'): Promise<ApiResponse> { return this.group.changeSettings(id, setting); }\n leaveGroup(id: string): Promise<ApiResponse> { return this.group.leave(id); }\n getInviteGroup(id: string): Promise<InviteCodeResponse> { return this.group.getInviteCode(id); }\n updateGroupPicture(id: string, url: string): Promise<ApiResponse> { return this.group.updatePicture(id, url); }\n removeGroupPicture(id: string): Promise<ApiResponse> { return this.group.removePicture(id); }\n addParticipantsGroup(id: string, participants: string[]): Promise<ApiResponse> { return this.group.addParticipants(id, participants); }\n removeParticipantsGroup(id: string, participants: string[]): Promise<ApiResponse> { return this.group.removeParticipants(id, participants); }\n updateGroupParticipantRole(id: string, action: 'promote' | 'demote', participants: string[]): Promise<ApiResponse> { return this.group.updateParticipantRole(id, action, participants); }\n getGroupRequestParticipants(id: string): Promise<{ status: number; data: GroupParticipant[] }> { return this.group.getRequestParticipants(id); }\n updateGroupRequestParticipants(id: string, data: GroupParticipantsAction): Promise<ApiResponse> { return this.group.updateRequestParticipants(id, data); }\n\n // Community\n listCommunities(): Promise<{ status: number; data: CommunityInfo[] }> { return this.community.list(); }\n createCommunity(data: CommunityCreate): Promise<{ status: number; data: CommunityInfo }> { return this.community.create(data); }\n infoCommunity(id: string): Promise<{ status: number; data: CommunityInfo }> { return this.community.info(id); }\n updateCommunity(id: string, data: CommunityUpdate): Promise<ApiResponse> { return this.community.update(id, data); }\n leaveCommunity(id: string): Promise<ApiResponse> { return this.community.leave(id); }\n updateCommunityPicture(id: string, url: string): Promise<ApiResponse> { return this.community.updatePicture(id, url); }\n getCommunityInviteCode(id: string): Promise<InviteCodeResponse> { return this.community.getInviteCode(id); }\n removeCommunityParticipants(id: string, participants: string[]): Promise<ApiResponse> { return this.community.removeParticipants(id, participants); }\n getCommunityRequestParticipants(id: string): Promise<{ status: number; data: GroupParticipant[] }> { return this.community.getRequestParticipants(id); }\n updateCommunityRequestParticipants(id: string, data: GroupParticipantsAction): Promise<ApiResponse> { return this.community.updateRequestParticipants(id, data); }\n\n // Business\n getCatalog(limit?: number, cursor?: string): Promise<CatalogResponse> { return this.business.getCatalog(limit, cursor); }\n createProduct(product: Product): Promise<ApiResponse> { return this.business.createProduct(product); }\n updateProduct(productId: string, product: Product): Promise<ApiResponse> { return this.business.updateProduct(productId, product); }\n deleteProduct(productId: string): Promise<ApiResponse> { return this.business.deleteProduct(productId); }\n}\n\nexport default WhatsApp;\n"]}
|
|
1
|
+
{"version":3,"file":"WhatsApp.js","sourceRoot":"","sources":["../src/WhatsApp.ts"],"names":[],"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e,QAAQ,CAAC","sourcesContent":["import {\n Init, WebhookBody, TypeMessage, StatusPresence, Contact, Section,\n Location, Buttons, Items, HeaderMedia, DownloadableMessage, Product,\n CommunityCreate, CommunityUpdate, GroupParticipantsAction,\n ApiResponse, PairingCodeResponse, MobileRegisterData, EventData,\n InfoInstance, SendMessageRoot, Connect, RegisteredResponse,\n ContactInfo, GroupInfo, InviteCodeResponse, ChatInfo, LabelInfo,\n CommunityInfo, CatalogResponse, WebhookStatistics, ListMessagesResponse,\n DownloadMediaResponse, CallResponse, MessageData, GroupParticipant,\n LiveLocationData, SendContactsData, ProductMessageData, GroupInviteMessageData,\n StatusTextData, StatusMediaData, StatusMentionData, CommunityGroupCreate,\n NewsletterInfo,\n} from './types';\nimport { IHttpClient } from './client/IHttpClient';\nimport { HttpClient } from './client/HttpClient';\nimport { InstanceService } from './services/InstanceService';\nimport { MessageService } from './services/MessageService';\nimport { ChatService } from './services/ChatService';\nimport { CallService } from './services/CallService';\nimport { LabelService } from './services/LabelService';\nimport { ActionService } from './services/ActionService';\nimport { ContactService } from './services/ContactService';\nimport { GroupService } from './services/GroupService';\nimport { CommunityService } from './services/CommunityService';\nimport { BusinessService } from './services/BusinessService';\nimport { NewsletterService } from './services/NewsletterService';\nimport { StatusService } from './services/StatusService';\n\nexport class WhatsApp {\n readonly instance: InstanceService;\n readonly message: MessageService;\n readonly chat: ChatService;\n readonly call: CallService;\n readonly label: LabelService;\n readonly action: ActionService;\n readonly contact: ContactService;\n readonly group: GroupService;\n readonly community: CommunityService;\n readonly business: BusinessService;\n readonly newsletter: NewsletterService;\n readonly status: StatusService;\n\n constructor(data: Init, httpClient?: IHttpClient) {\n const client = httpClient ?? new HttpClient(`${data.server}/${data.key}`);\n\n this.instance = new InstanceService(client);\n this.message = new MessageService(client);\n this.chat = new ChatService(client);\n this.call = new CallService(client);\n this.label = new LabelService(client);\n this.action = new ActionService(client);\n this.contact = new ContactService(client);\n this.group = new GroupService(client);\n this.community = new CommunityService(client);\n this.business = new BusinessService(client);\n this.newsletter = new NewsletterService(client);\n this.status = new StatusService(client);\n }\n\n // ==================== Backward Compatibility ====================\n // These methods delegate to the corresponding services.\n // Use wa.instance.*, wa.message.*, wa.group.*, etc. for the new API.\n\n // Instance\n connect(): Promise<Connect> { return this.instance.connect(); }\n info(): Promise<InfoInstance> { return this.instance.info(); }\n logout(): Promise<ApiResponse> { return this.instance.logout(); }\n setting(data: { markMessageRead: boolean; saveMedia: boolean; receiveStatusMessage: boolean; receivePresence: boolean }): Promise<ApiResponse> { return this.instance.setting(data); }\n updateWebhook(body: WebhookBody): Promise<ApiResponse> { return this.instance.updateWebhook(body); }\n pairingCode(phoneNumber: string): Promise<PairingCodeResponse> { return this.instance.pairingCode(phoneNumber); }\n addMongoDb(uri: string, dbName: string): Promise<ApiResponse> { return this.instance.addMongoDb(uri, dbName); }\n setProxy(proxy: string): Promise<ApiResponse> { return this.instance.setProxy(proxy); }\n resync(): Promise<ApiResponse> { return this.instance.resync(); }\n restart(): Promise<ApiResponse> { return this.instance.restart(); }\n updateProfileStatus(text: string): Promise<ApiResponse> { return this.instance.updateProfileStatus(text); }\n updateProfilePicture(url: string): Promise<ApiResponse> { return this.instance.updateProfilePicture(url); }\n removeProfilePicture(): Promise<ApiResponse> { return this.instance.removeProfilePicture(); }\n updateProfileName(name: string): Promise<ApiResponse> { return this.instance.updateProfileName(name); }\n mobileRegisterPrepare(data: MobileRegisterData): Promise<ApiResponse> { return this.instance.mobileRegisterPrepare(data); }\n mobileRequestCode(method: string): Promise<ApiResponse> { return this.instance.mobileRequestCode(method); }\n mobileVerifyCode(code: string): Promise<ApiResponse> { return this.instance.mobileVerifyCode(code); }\n webhookStatistics(): Promise<WebhookStatistics> { return this.instance.webhookStatistics(); }\n\n // Messages\n listMessages(phoneNumber: string, page?: number, limit?: number): Promise<ListMessagesResponse> { return this.message.list(phoneNumber, page, limit); }\n sendMessage(\n data: {\n type: TypeMessage;\n body: {\n to: string; msgId?: string; header?: HeaderMedia; status?: StatusPresence;\n text?: string; url?: string; caption?: string; mimetype?: string; fileName?: string;\n contact?: Contact; location?: Location; name?: string; options?: string[];\n sections?: Section[]; buttons?: Buttons[]; footer?: string; description?: string;\n title?: string; buttonText?: string; thumbnailUrl?: string; sourceUrl?: string;\n referenceId?: string; code?: string; key?: string; merchantName?: string;\n keyType?: \"CNPJ\" | \"CPF\" | \"EMAIL\" | \"PHONE\"; subtotal?: string;\n totalAmount?: string; items?: Items[];\n };\n },\n reply?: boolean,\n ): Promise<SendMessageRoot> { return this.message.send(data, reply); }\n forwardingMessage(to: string, msgId: string): Promise<SendMessageRoot> { return this.message.forward(to, msgId); }\n sendSticker(to: string, url: string): Promise<SendMessageRoot> { return this.message.sendSticker(to, url); }\n sendVideoNote(to: string, url: string): Promise<SendMessageRoot> { return this.message.sendVideoNote(to, url); }\n sendPoll(to: string, name: string, values: Array<string | number | boolean>, selectableCount?: number): Promise<SendMessageRoot> { return this.message.sendPoll(to, name, values, selectableCount); }\n sendEvent(data: EventData): Promise<SendMessageRoot> { return this.message.sendEvent(data); }\n pinMessage(id: string, duration?: number): Promise<ApiResponse> { return this.message.pin(id, duration); }\n unpinMessage(id: string): Promise<ApiResponse> { return this.message.unpin(id); }\n sendCallLink(to: string, type: string, caption?: string): Promise<SendMessageRoot> { return this.message.sendCallLink(to, type, caption); }\n sendImageBase64(to: string, base64: string, caption?: string): Promise<SendMessageRoot> { return this.message.sendImageBase64(to, base64, caption); }\n sendAudioBase64(to: string, base64: string): Promise<SendMessageRoot> { return this.message.sendAudioBase64(to, base64); }\n sendDocumentBase64(to: string, base64: string, mimetype: string, fileName?: string, caption?: string): Promise<SendMessageRoot> { return this.message.sendDocumentBase64(to, base64, mimetype, fileName, caption); }\n sendContacts(data: SendContactsData): Promise<SendMessageRoot> { return this.message.sendContacts(data); }\n sendLiveLocation(data: LiveLocationData): Promise<SendMessageRoot> { return this.message.sendLiveLocation(data); }\n getMessageDetails(messageId: string): Promise<ApiResponse> { return this.message.getDetails(messageId); }\n getMessageMedia(messageId: string, format?: string): Promise<ApiResponse> { return this.message.getMedia(messageId, format); }\n sendProduct(data: ProductMessageData): Promise<SendMessageRoot> { return this.message.sendProduct(data); }\n sendGroupInvite(data: GroupInviteMessageData): Promise<SendMessageRoot> { return this.message.sendGroupInvite(data); }\n requestPhone(to: string): Promise<ApiResponse> { return this.message.requestPhone(to); }\n createCallLink(type: string): Promise<ApiResponse> { return this.message.createCallLink(type); }\n\n // Chat\n getChats(): Promise<{ status: number; data: ChatInfo[] }> { return this.chat.list(); }\n modifyChat(id: string, action: 'markRead' | 'pin', value: boolean): Promise<ApiResponse> { return this.chat.modify(id, action, value); }\n deleteChat(chatId: string): Promise<ApiResponse> { return this.chat.delete(chatId); }\n getChatMessages(chatId: string, page?: number, limit?: number): Promise<{ status: number; data: MessageData[] }> { return this.chat.messages(chatId, page, limit); }\n presenceSubscribe(jid: string): Promise<ApiResponse> { return this.chat.presenceSubscribe(jid); }\n setDisappearing(jid: string, expiration: number): Promise<ApiResponse> { return this.chat.disappearing(jid, expiration); }\n getPrivacy(): Promise<ApiResponse> { return this.chat.privacy(); }\n\n // Call\n makeCall(to: string, isVideo?: boolean): Promise<CallResponse> { return this.call.call(to, isVideo); }\n rejectCall(id: string, from: string): Promise<ApiResponse> { return this.call.reject(id, from); }\n acceptCall(callId: string, callFrom: string): Promise<ApiResponse> { return this.call.accept(callId, callFrom); }\n endCall(callId: string, peerJid: string): Promise<ApiResponse> { return this.call.end(callId, peerJid); }\n\n // Labels\n getLabels(): Promise<{ status: number; data: LabelInfo[] }> { return this.label.list(); }\n createLabel(name: string, labelId?: string): Promise<ApiResponse> { return this.label.create(name, labelId); }\n getChatLabel(labelId: string): Promise<{ status: number; data: ChatInfo[] }> { return this.label.getChats(labelId); }\n addChatLabel(labelId: string, to: string): Promise<ApiResponse> { return this.label.addToChat(labelId, to); }\n deleteLabel(labelId: string): Promise<ApiResponse> { return this.label.delete(labelId); }\n removeChatLabel(labelId: string, to: string): Promise<ApiResponse> { return this.label.removeFromChat(labelId, to); }\n\n // Actions\n checkRegisteredWhatsapp(number: string): Promise<RegisteredResponse> { return this.action.checkRegistered(number); }\n downloadMedia(type: 'image' | 'video' | 'sticker' | 'audio' | 'document', message: DownloadableMessage): Promise<DownloadMediaResponse> { return this.action.downloadMedia(type, message); }\n deleteStorage(): Promise<ApiResponse> { return this.action.deleteStorage(); }\n\n // Contacts\n contacts(): Promise<{ status: number; data: ContactInfo[] }> { return this.contact.list(); }\n addContact(number: string, name: string): Promise<ApiResponse> { return this.contact.add(number, name); }\n contactProfile(id: string): Promise<{ status: number; data: ContactInfo }> { return this.contact.profile(id); }\n removeContact(number: string): Promise<ApiResponse> { return this.contact.remove(number); }\n blockContact(number: string, action: 'block' | 'unblock'): Promise<ApiResponse> { return this.contact.block(number, action); }\n clearContactSession(number: string): Promise<ApiResponse> { return this.contact.clearSession(number); }\n getContactStatus(number: string): Promise<ApiResponse> { return this.contact.getStatus(number); }\n listBlockedContacts(): Promise<ApiResponse> { return this.contact.listBlocked(); }\n resolveLids(lids: string[]): Promise<ApiResponse> { return this.contact.resolveLids(lids); }\n\n // Groups\n groups(): Promise<{ status: number; data: GroupInfo[] }> { return this.group.list(); }\n infoGroup(id: string): Promise<{ status: number; data: GroupInfo }> { return this.group.info(id); }\n createGroup(name: string, participants: string[]): Promise<{ status: number; data: GroupInfo }> { return this.group.create(name, participants); }\n updateGroup(id: string, name: string, description: string): Promise<ApiResponse> { return this.group.update(id, name, description); }\n changeGroupSettings(id: string, setting: 'announcement' | 'not_announcement' | 'locked' | 'unlocked'): Promise<ApiResponse> { return this.group.changeSettings(id, setting); }\n leaveGroup(id: string): Promise<ApiResponse> { return this.group.leave(id); }\n getGroupMembers(id: string): Promise<{ status: number; data: GroupParticipant[] }> { return this.group.getMembers(id); }\n getGroupInviteInfo(code: string): Promise<ApiResponse> { return this.group.getInviteInfo(code); }\n getInviteGroup(id: string): Promise<InviteCodeResponse> { return this.group.getInviteCode(id); }\n updateGroupPicture(id: string, url: string): Promise<ApiResponse> { return this.group.updatePicture(id, url); }\n removeGroupPicture(id: string): Promise<ApiResponse> { return this.group.removePicture(id); }\n addParticipantsGroup(id: string, participants: string[]): Promise<ApiResponse> { return this.group.addParticipants(id, participants); }\n removeParticipantsGroup(id: string, participants: string[]): Promise<ApiResponse> { return this.group.removeParticipants(id, participants); }\n updateGroupParticipantRole(id: string, action: 'promote' | 'demote', participants: string[]): Promise<ApiResponse> { return this.group.updateParticipantRole(id, action, participants); }\n getGroupRequestParticipants(id: string): Promise<{ status: number; data: GroupParticipant[] }> { return this.group.getRequestParticipants(id); }\n updateGroupRequestParticipants(id: string, data: GroupParticipantsAction): Promise<ApiResponse> { return this.group.updateRequestParticipants(id, data); }\n\n // Community\n listCommunities(): Promise<{ status: number; data: CommunityInfo[] }> { return this.community.list(); }\n createCommunity(data: CommunityCreate): Promise<{ status: number; data: CommunityInfo }> { return this.community.create(data); }\n infoCommunity(id: string): Promise<{ status: number; data: CommunityInfo }> { return this.community.info(id); }\n updateCommunity(id: string, data: CommunityUpdate): Promise<ApiResponse> { return this.community.update(id, data); }\n leaveCommunity(id: string): Promise<ApiResponse> { return this.community.leave(id); }\n updateCommunityPicture(id: string, url: string): Promise<ApiResponse> { return this.community.updatePicture(id, url); }\n getCommunityInviteCode(id: string): Promise<InviteCodeResponse> { return this.community.getInviteCode(id); }\n removeCommunityParticipants(id: string, participants: string[]): Promise<ApiResponse> { return this.community.removeParticipants(id, participants); }\n getCommunityRequestParticipants(id: string): Promise<{ status: number; data: GroupParticipant[] }> { return this.community.getRequestParticipants(id); }\n updateCommunityRequestParticipants(id: string, data: GroupParticipantsAction): Promise<ApiResponse> { return this.community.updateRequestParticipants(id, data); }\n acceptCommunityInvite(code: string): Promise<ApiResponse> { return this.community.acceptInvite(code); }\n getCommunityInviteInfo(code: string): Promise<ApiResponse> { return this.community.getInviteInfo(code); }\n createCommunityGroup(id: string, data: CommunityGroupCreate): Promise<ApiResponse> { return this.community.createGroup(id, data); }\n setCommunityEphemeral(id: string, expiration: number): Promise<ApiResponse> { return this.community.ephemeral(id, expiration); }\n updateCommunitySettings(id: string, setting: string): Promise<ApiResponse> { return this.community.updateSettings(id, setting); }\n setCommunityMemberAddMode(id: string, mode: string): Promise<ApiResponse> { return this.community.memberAddMode(id, mode); }\n setCommunityJoinApproval(id: string, mode: string): Promise<ApiResponse> { return this.community.joinApproval(id, mode); }\n\n // Business\n getCatalog(limit?: number, cursor?: string): Promise<CatalogResponse> { return this.business.getCatalog(limit, cursor); }\n createProduct(product: Product): Promise<ApiResponse> { return this.business.createProduct(product); }\n updateProduct(productId: string, product: Product): Promise<ApiResponse> { return this.business.updateProduct(productId, product); }\n deleteProduct(productId: string): Promise<ApiResponse> { return this.business.deleteProduct(productId); }\n}\n\nexport default WhatsApp;\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -12,4 +12,6 @@ export { ContactService } from './services/ContactService';
|
|
|
12
12
|
export { GroupService } from './services/GroupService';
|
|
13
13
|
export { CommunityService } from './services/CommunityService';
|
|
14
14
|
export { BusinessService } from './services/BusinessService';
|
|
15
|
-
export {
|
|
15
|
+
export { NewsletterService } from './services/NewsletterService';
|
|
16
|
+
export { StatusService } from './services/StatusService';
|
|
17
|
+
export { Init, HttpMethod, Routes, TypeMessage, StatusPresence, ApiResponse, WebhookBody, Contact, Location, Row, Section, Buttons, Items, HeaderMedia, DownloadableMessage, Product, CommunityCreate, CommunityUpdate, GroupParticipantsAction, InfoInstance, Instance, User, Webhook, BusinessProfile, SendMessageRoot, MessageData, MessageKey, MessageContent, ExtendedTextMessage, Connect, PairingCodeResponse, MobileRegisterData, EventData, RegisteredResponse, ContactInfo, GroupInfo, GroupParticipant, InviteCodeResponse, ChatInfo, LabelInfo, CommunityInfo, CatalogResponse, WebhookStatistics, ListMessagesResponse, DownloadMediaResponse, CallResponse, LiveLocationData, SendContactsData, ProductMessageData, GroupInviteMessageData, StatusTextData, StatusMediaData, StatusMentionData, NewsletterInfo, CommunityGroupCreate, } from './types';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StatusPresence = exports.TypeMessage = exports.Routes = exports.HttpMethod = exports.BusinessService = exports.CommunityService = exports.GroupService = exports.ContactService = exports.ActionService = exports.LabelService = exports.CallService = exports.ChatService = exports.MessageService = exports.InstanceService = exports.HttpClient = exports.WhatsAppError = exports.WhatsApp = void 0;
|
|
3
|
+
exports.StatusPresence = exports.TypeMessage = exports.Routes = exports.HttpMethod = exports.StatusService = exports.NewsletterService = exports.BusinessService = exports.CommunityService = exports.GroupService = exports.ContactService = exports.ActionService = exports.LabelService = exports.CallService = exports.ChatService = exports.MessageService = exports.InstanceService = exports.HttpClient = exports.WhatsAppError = exports.WhatsApp = void 0;
|
|
4
4
|
// Main class
|
|
5
5
|
var WhatsApp_1 = require("./WhatsApp");
|
|
6
6
|
Object.defineProperty(exports, "WhatsApp", { enumerable: true, get: function () { return WhatsApp_1.WhatsApp; } });
|
|
@@ -30,6 +30,10 @@ var CommunityService_1 = require("./services/CommunityService");
|
|
|
30
30
|
Object.defineProperty(exports, "CommunityService", { enumerable: true, get: function () { return CommunityService_1.CommunityService; } });
|
|
31
31
|
var BusinessService_1 = require("./services/BusinessService");
|
|
32
32
|
Object.defineProperty(exports, "BusinessService", { enumerable: true, get: function () { return BusinessService_1.BusinessService; } });
|
|
33
|
+
var NewsletterService_1 = require("./services/NewsletterService");
|
|
34
|
+
Object.defineProperty(exports, "NewsletterService", { enumerable: true, get: function () { return NewsletterService_1.NewsletterService; } });
|
|
35
|
+
var StatusService_1 = require("./services/StatusService");
|
|
36
|
+
Object.defineProperty(exports, "StatusService", { enumerable: true, get: function () { return StatusService_1.StatusService; } });
|
|
33
37
|
// Types
|
|
34
38
|
var types_1 = require("./types");
|
|
35
39
|
Object.defineProperty(exports, "HttpMethod", { enumerable: true, get: function () { return types_1.HttpMethod; } });
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,aAAa;AACb,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AAEjB,QAAQ;AACR,mCAAyC;AAAhC,uGAAA,aAAa,OAAA;AAItB,kDAAiD;AAAxC,wGAAA,UAAU,OAAA;AAEnB,WAAW;AACX,8DAA6D;AAApD,kHAAA,eAAe,OAAA;AACxB,4DAA2D;AAAlD,gHAAA,cAAc,OAAA;AACvB,sDAAqD;AAA5C,0GAAA,WAAW,OAAA;AACpB,sDAAqD;AAA5C,0GAAA,WAAW,OAAA;AACpB,wDAAuD;AAA9C,4GAAA,YAAY,OAAA;AACrB,0DAAyD;AAAhD,8GAAA,aAAa,OAAA;AACtB,4DAA2D;AAAlD,gHAAA,cAAc,OAAA;AACvB,wDAAuD;AAA9C,4GAAA,YAAY,OAAA;AACrB,gEAA+D;AAAtD,oHAAA,gBAAgB,OAAA;AACzB,8DAA6D;AAApD,kHAAA,eAAe,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,aAAa;AACb,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AAEjB,QAAQ;AACR,mCAAyC;AAAhC,uGAAA,aAAa,OAAA;AAItB,kDAAiD;AAAxC,wGAAA,UAAU,OAAA;AAEnB,WAAW;AACX,8DAA6D;AAApD,kHAAA,eAAe,OAAA;AACxB,4DAA2D;AAAlD,gHAAA,cAAc,OAAA;AACvB,sDAAqD;AAA5C,0GAAA,WAAW,OAAA;AACpB,sDAAqD;AAA5C,0GAAA,WAAW,OAAA;AACpB,wDAAuD;AAA9C,4GAAA,YAAY,OAAA;AACrB,0DAAyD;AAAhD,8GAAA,aAAa,OAAA;AACtB,4DAA2D;AAAlD,gHAAA,cAAc,OAAA;AACvB,wDAAuD;AAA9C,4GAAA,YAAY,OAAA;AACrB,gEAA+D;AAAtD,oHAAA,gBAAgB,OAAA;AACzB,8DAA6D;AAApD,kHAAA,eAAe,OAAA;AACxB,kEAAiE;AAAxD,sHAAA,iBAAiB,OAAA;AAC1B,0DAAyD;AAAhD,8GAAA,aAAa,OAAA;AAEtB,QAAQ;AACR,iCAeiB;AAdT,mGAAA,UAAU,OAAA;AAAE,+FAAA,MAAM,OAAA;AAAE,oGAAA,WAAW,OAAA;AAAE,uGAAA,cAAc,OAAA","sourcesContent":["// Main class\nexport { WhatsApp } from './WhatsApp';\n\n// Error\nexport { WhatsAppError } from './errors';\n\n// Client\nexport { IHttpClient, RequestOptions } from './client/IHttpClient';\nexport { HttpClient } from './client/HttpClient';\n\n// Services\nexport { InstanceService } from './services/InstanceService';\nexport { MessageService } from './services/MessageService';\nexport { ChatService } from './services/ChatService';\nexport { CallService } from './services/CallService';\nexport { LabelService } from './services/LabelService';\nexport { ActionService } from './services/ActionService';\nexport { ContactService } from './services/ContactService';\nexport { GroupService } from './services/GroupService';\nexport { CommunityService } from './services/CommunityService';\nexport { BusinessService } from './services/BusinessService';\nexport { NewsletterService } from './services/NewsletterService';\nexport { StatusService } from './services/StatusService';\n\n// Types\nexport {\n Init, HttpMethod, Routes, TypeMessage, StatusPresence,\n ApiResponse, WebhookBody, Contact, Location, Row, Section,\n Buttons, Items, HeaderMedia, DownloadableMessage, Product,\n CommunityCreate, CommunityUpdate, GroupParticipantsAction,\n InfoInstance, Instance, User, Webhook, BusinessProfile,\n SendMessageRoot, MessageData, MessageKey, MessageContent, ExtendedTextMessage,\n Connect, PairingCodeResponse, MobileRegisterData, EventData,\n RegisteredResponse, ContactInfo, GroupInfo, GroupParticipant,\n InviteCodeResponse, ChatInfo, LabelInfo, CommunityInfo,\n CatalogResponse, WebhookStatistics, ListMessagesResponse,\n DownloadMediaResponse, CallResponse,\n LiveLocationData, SendContactsData, ProductMessageData,\n GroupInviteMessageData, StatusTextData, StatusMediaData,\n StatusMentionData, NewsletterInfo, CommunityGroupCreate,\n} from './types';\n"]}
|
|
@@ -5,4 +5,6 @@ export declare class CallService {
|
|
|
5
5
|
constructor(http: IHttpClient);
|
|
6
6
|
call(to: string, isVideo?: boolean): Promise<CallResponse>;
|
|
7
7
|
reject(id: string, from: string): Promise<ApiResponse>;
|
|
8
|
+
accept(callId: string, callFrom: string): Promise<ApiResponse>;
|
|
9
|
+
end(callId: string, peerJid: string): Promise<ApiResponse>;
|
|
8
10
|
}
|
|
@@ -19,6 +19,20 @@ class CallService {
|
|
|
19
19
|
method: types_1.HttpMethod.DELETE,
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
|
+
async accept(callId, callFrom) {
|
|
23
|
+
return this.http.request({
|
|
24
|
+
route: `${types_1.Routes.CALL}/accept`,
|
|
25
|
+
method: types_1.HttpMethod.POST,
|
|
26
|
+
body: { callId, callFrom },
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
async end(callId, peerJid) {
|
|
30
|
+
return this.http.request({
|
|
31
|
+
route: `${types_1.Routes.CALL}/end`,
|
|
32
|
+
method: types_1.HttpMethod.POST,
|
|
33
|
+
body: { callId, peerJid },
|
|
34
|
+
});
|
|
35
|
+
}
|
|
22
36
|
}
|
|
23
37
|
exports.CallService = CallService;
|
|
24
38
|
//# sourceMappingURL=CallService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CallService.js","sourceRoot":"","sources":["../../src/services/CallService.ts"],"names":[],"mappings":";;;AACA,oCAAyE;AAEzE,MAAa,WAAW;IACtB,YAA6B,IAAiB;QAAjB,SAAI,GAAJ,IAAI,CAAa;IAAG,CAAC;IAElD,KAAK,CAAC,IAAI,CAAC,EAAU,EAAE,UAAmB,KAAK;QAC7C,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAe;YACrC,KAAK,EAAE,cAAM,CAAC,IAAI;YAClB,MAAM,EAAE,kBAAU,CAAC,IAAI;YACvB,IAAI,EAAE,EAAE,EA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CAAC,GAAG,CAAC,MAAc,EAAE,OAAe;QACvC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAc;YACpC,KAAK,EAAE,GAAG,cAAM,CAAC,IAAI,MAAM;YAC3B,MAAM,EAAE,kBAAU,CAAC,IAAI;YACvB,IAAI,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE;SAC1B,CAAC,CAAC;IACL,CAAC;CACF;AAjCD,kCAiCC","sourcesContent":["import { IHttpClient } from '../client/IHttpClient';\nimport { Routes, HttpMethod, ApiResponse, CallResponse } from '../types';\n\nexport class CallService {\n constructor(private readonly http: IHttpClient) {}\n\n async call(to: string, isVideo: boolean = false): Promise<CallResponse> {\n return this.http.request<CallResponse>({\n route: Routes.CALL,\n method: HttpMethod.POST,\n body: { to, isVideo },\n });\n }\n\n async reject(id: string, from: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.CALL}/${id}/${from}`,\n method: HttpMethod.DELETE,\n });\n }\n\n async accept(callId: string, callFrom: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.CALL}/accept`,\n method: HttpMethod.POST,\n body: { callId, callFrom },\n });\n }\n\n async end(callId: string, peerJid: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.CALL}/end`,\n method: HttpMethod.POST,\n body: { callId, peerJid },\n });\n }\n}\n"]}
|
|
@@ -9,8 +9,11 @@ export declare class ChatService {
|
|
|
9
9
|
}>;
|
|
10
10
|
modify(id: string, action: 'markRead' | 'pin', value: boolean): Promise<ApiResponse>;
|
|
11
11
|
delete(chatId: string): Promise<ApiResponse>;
|
|
12
|
-
messages(chatId: string): Promise<{
|
|
12
|
+
messages(chatId: string, page?: number, limit?: number): Promise<{
|
|
13
13
|
status: number;
|
|
14
14
|
data: MessageData[];
|
|
15
15
|
}>;
|
|
16
|
+
presenceSubscribe(jid: string): Promise<ApiResponse>;
|
|
17
|
+
disappearing(jid: string, expiration: number): Promise<ApiResponse>;
|
|
18
|
+
privacy(): Promise<ApiResponse>;
|
|
16
19
|
}
|
|
@@ -26,11 +26,36 @@ class ChatService {
|
|
|
26
26
|
params: { chatId },
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
|
-
async messages(chatId) {
|
|
29
|
+
async messages(chatId, page, limit) {
|
|
30
|
+
const params = { chatId };
|
|
31
|
+
if (page !== undefined)
|
|
32
|
+
params.page = page;
|
|
33
|
+
if (limit !== undefined)
|
|
34
|
+
params.limit = limit;
|
|
30
35
|
return this.http.request({
|
|
31
36
|
route: `${types_1.Routes.CHAT}/messages`,
|
|
32
37
|
method: types_1.HttpMethod.GET,
|
|
33
|
-
params
|
|
38
|
+
params,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
async presenceSubscribe(jid) {
|
|
42
|
+
return this.http.request({
|
|
43
|
+
route: `${types_1.Routes.CHAT}/presence/subscribe`,
|
|
44
|
+
method: types_1.HttpMethod.POST,
|
|
45
|
+
body: { jid },
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
async disappearing(jid, expiration) {
|
|
49
|
+
return this.http.request({
|
|
50
|
+
route: `${types_1.Routes.CHAT}/disappearing`,
|
|
51
|
+
method: types_1.HttpMethod.POST,
|
|
52
|
+
body: { jid, expiration },
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
async privacy() {
|
|
56
|
+
return this.http.request({
|
|
57
|
+
route: `${types_1.Routes.CHAT}/privacy`,
|
|
58
|
+
method: types_1.HttpMethod.GET,
|
|
34
59
|
});
|
|
35
60
|
}
|
|
36
61
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatService.js","sourceRoot":"","sources":["../../src/services/ChatService.ts"],"names":[],"mappings":";;;AACA,oCAAkF;AAElF,MAAa,WAAW;IACtB,YAA6B,IAAiB;QAAjB,SAAI,GAAJ,IAAI,CAAa;IAAG,CAAC;IAElD,KAAK,CAAC,IAAI;QACR,OAAO,IAAI,CAAC,IAAI,CAA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AI,CAAC,IAAI,CAAC,OAAO,CAAc;YACpC,KAAK,EAAE,GAAG,cAAM,CAAC,IAAI,UAAU;YAC/B,MAAM,EAAE,kBAAU,CAAC,GAAG;SACvB,CAAC,CAAC;IACL,CAAC;CACF;AA3DD,kCA2DC","sourcesContent":["import { IHttpClient } from '../client/IHttpClient';\nimport { Routes, HttpMethod, ApiResponse, ChatInfo, MessageData } from '../types';\n\nexport class ChatService {\n constructor(private readonly http: IHttpClient) {}\n\n async list(): Promise<{ status: number; data: ChatInfo[] }> {\n return this.http.request<{ status: number; data: ChatInfo[] }>({\n route: Routes.CHAT,\n method: HttpMethod.GET,\n });\n }\n\n async modify(id: string, action: 'markRead' | 'pin', value: boolean): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: Routes.CHAT,\n method: HttpMethod.PATCH,\n params: { id, action, value },\n });\n }\n\n async delete(chatId: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: Routes.CHAT,\n method: HttpMethod.DELETE,\n params: { chatId },\n });\n }\n\n async messages(chatId: string, page?: number, limit?: number): Promise<{ status: number; data: MessageData[] }> {\n const params: Record<string, string | number> = { chatId };\n if (page !== undefined) params.page = page;\n if (limit !== undefined) params.limit = limit;\n return this.http.request<{ status: number; data: MessageData[] }>({\n route: `${Routes.CHAT}/messages`,\n method: HttpMethod.GET,\n params,\n });\n }\n\n async presenceSubscribe(jid: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.CHAT}/presence/subscribe`,\n method: HttpMethod.POST,\n body: { jid },\n });\n }\n\n async disappearing(jid: string, expiration: number): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.CHAT}/disappearing`,\n method: HttpMethod.POST,\n body: { jid, expiration },\n });\n }\n\n async privacy(): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.CHAT}/privacy`,\n method: HttpMethod.GET,\n });\n }\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IHttpClient } from '../client/IHttpClient';
|
|
2
|
-
import { ApiResponse, CommunityInfo, InviteCodeResponse, CommunityCreate, CommunityUpdate, GroupParticipant, GroupParticipantsAction } from '../types';
|
|
2
|
+
import { ApiResponse, CommunityInfo, InviteCodeResponse, CommunityCreate, CommunityUpdate, GroupParticipant, GroupParticipantsAction, CommunityGroupCreate } from '../types';
|
|
3
3
|
export declare class CommunityService {
|
|
4
4
|
private readonly http;
|
|
5
5
|
constructor(http: IHttpClient);
|
|
@@ -25,4 +25,11 @@ export declare class CommunityService {
|
|
|
25
25
|
data: GroupParticipant[];
|
|
26
26
|
}>;
|
|
27
27
|
updateRequestParticipants(id: string, data: GroupParticipantsAction): Promise<ApiResponse>;
|
|
28
|
+
acceptInvite(code: string): Promise<ApiResponse>;
|
|
29
|
+
getInviteInfo(code: string): Promise<ApiResponse>;
|
|
30
|
+
createGroup(id: string, data: CommunityGroupCreate): Promise<ApiResponse>;
|
|
31
|
+
ephemeral(id: string, expiration: number): Promise<ApiResponse>;
|
|
32
|
+
updateSettings(id: string, setting: string): Promise<ApiResponse>;
|
|
33
|
+
memberAddMode(id: string, mode: string): Promise<ApiResponse>;
|
|
34
|
+
joinApproval(id: string, mode: string): Promise<ApiResponse>;
|
|
28
35
|
}
|
|
@@ -71,6 +71,55 @@ class CommunityService {
|
|
|
71
71
|
body: data,
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
|
+
async acceptInvite(code) {
|
|
75
|
+
return this.http.request({
|
|
76
|
+
route: `${types_1.Routes.COMMUNITY}/invite/accept`,
|
|
77
|
+
method: types_1.HttpMethod.POST,
|
|
78
|
+
body: { code },
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
async getInviteInfo(code) {
|
|
82
|
+
return this.http.request({
|
|
83
|
+
route: `${types_1.Routes.COMMUNITY}/invite/info`,
|
|
84
|
+
method: types_1.HttpMethod.GET,
|
|
85
|
+
params: { code },
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
async createGroup(id, data) {
|
|
89
|
+
return this.http.request({
|
|
90
|
+
route: `${types_1.Routes.COMMUNITY}/${id}/group`,
|
|
91
|
+
method: types_1.HttpMethod.POST,
|
|
92
|
+
body: data,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
async ephemeral(id, expiration) {
|
|
96
|
+
return this.http.request({
|
|
97
|
+
route: `${types_1.Routes.COMMUNITY}/${id}/ephemeral`,
|
|
98
|
+
method: types_1.HttpMethod.POST,
|
|
99
|
+
body: { expiration },
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
async updateSettings(id, setting) {
|
|
103
|
+
return this.http.request({
|
|
104
|
+
route: `${types_1.Routes.COMMUNITY}/${id}/settings`,
|
|
105
|
+
method: types_1.HttpMethod.PATCH,
|
|
106
|
+
body: { setting },
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
async memberAddMode(id, mode) {
|
|
110
|
+
return this.http.request({
|
|
111
|
+
route: `${types_1.Routes.COMMUNITY}/${id}/member-add-mode`,
|
|
112
|
+
method: types_1.HttpMethod.PATCH,
|
|
113
|
+
body: { mode },
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
async joinApproval(id, mode) {
|
|
117
|
+
return this.http.request({
|
|
118
|
+
route: `${types_1.Routes.COMMUNITY}/${id}/join-approval`,
|
|
119
|
+
method: types_1.HttpMethod.PATCH,
|
|
120
|
+
body: { mode },
|
|
121
|
+
});
|
|
122
|
+
}
|
|
74
123
|
}
|
|
75
124
|
exports.CommunityService = CommunityService;
|
|
76
125
|
//# sourceMappingURL=CommunityService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommunityService.js","sourceRoot":"","sources":["../../src/services/CommunityService.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"CommunityService.js","sourceRoot":"","sources":["../../src/services/CommunityService.ts"],"names":[],"mappings":";;;AACA,oCAIkB;AAElB,MAAa,gBAAgB;IAC3B,YA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AE,kBAAkB;YAClD,MAAM,EAAE,kBAAU,CAAC,KAAK;YACxB,IAAI,EAAE,EAAE,IAAI,EAAE;SACf,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,EAAU,EAAE,IAAY;QACzC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAc;YACpC,KAAK,EAAE,GAAG,cAAM,CAAC,SAAS,IAAI,EAAE,gBAAgB;YAChD,MAAM,EAAE,kBAAU,CAAC,KAAK;YACxB,IAAI,EAAE,EAAE,IAAI,EAAE;SACf,CAAC,CAAC;IACL,CAAC;CACF;AArID,4CAqIC","sourcesContent":["import { IHttpClient } from '../client/IHttpClient';\nimport {\n Routes, HttpMethod, ApiResponse, CommunityInfo, InviteCodeResponse,\n CommunityCreate, CommunityUpdate, GroupParticipant, GroupParticipantsAction,\n CommunityGroupCreate,\n} from '../types';\n\nexport class CommunityService {\n constructor(private readonly http: IHttpClient) {}\n\n async list(): Promise<{ status: number; data: CommunityInfo[] }> {\n return this.http.request<{ status: number; data: CommunityInfo[] }>({\n route: Routes.COMMUNITY,\n method: HttpMethod.GET,\n });\n }\n\n async create(data: CommunityCreate): Promise<{ status: number; data: CommunityInfo }> {\n return this.http.request<{ status: number; data: CommunityInfo }>({\n route: Routes.COMMUNITY,\n method: HttpMethod.POST,\n body: data,\n });\n }\n\n async info(id: string): Promise<{ status: number; data: CommunityInfo }> {\n return this.http.request<{ status: number; data: CommunityInfo }>({\n route: `${Routes.COMMUNITY}/${id}`,\n method: HttpMethod.GET,\n });\n }\n\n async update(id: string, data: CommunityUpdate): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.COMMUNITY}/${id}`,\n method: HttpMethod.PUT,\n body: data,\n });\n }\n\n async leave(id: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.COMMUNITY}/${id}`,\n method: HttpMethod.DELETE,\n });\n }\n\n async updatePicture(id: string, url: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.COMMUNITY}/${id}/picture`,\n method: HttpMethod.PUT,\n body: { url },\n });\n }\n\n async getInviteCode(id: string): Promise<InviteCodeResponse> {\n return this.http.request<InviteCodeResponse>({\n route: `${Routes.COMMUNITY}/${id}/invite`,\n method: HttpMethod.POST,\n });\n }\n\n async removeParticipants(id: string, participants: string[]): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.COMMUNITY}/${id}/participants`,\n method: HttpMethod.DELETE,\n body: { participants },\n });\n }\n\n async getRequestParticipants(id: string): Promise<{ status: number; data: GroupParticipant[] }> {\n return this.http.request<{ status: number; data: GroupParticipant[] }>({\n route: `${Routes.COMMUNITY}/${id}/request_participants_list`,\n method: HttpMethod.GET,\n });\n }\n\n async updateRequestParticipants(id: string, data: GroupParticipantsAction): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.COMMUNITY}/${id}/request_participants_list`,\n method: HttpMethod.PUT,\n body: data,\n });\n }\n\n async acceptInvite(code: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.COMMUNITY}/invite/accept`,\n method: HttpMethod.POST,\n body: { code },\n });\n }\n\n async getInviteInfo(code: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.COMMUNITY}/invite/info`,\n method: HttpMethod.GET,\n params: { code },\n });\n }\n\n async createGroup(id: string, data: CommunityGroupCreate): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.COMMUNITY}/${id}/group`,\n method: HttpMethod.POST,\n body: data,\n });\n }\n\n async ephemeral(id: string, expiration: number): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.COMMUNITY}/${id}/ephemeral`,\n method: HttpMethod.POST,\n body: { expiration },\n });\n }\n\n async updateSettings(id: string, setting: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.COMMUNITY}/${id}/settings`,\n method: HttpMethod.PATCH,\n body: { setting },\n });\n }\n\n async memberAddMode(id: string, mode: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.COMMUNITY}/${id}/member-add-mode`,\n method: HttpMethod.PATCH,\n body: { mode },\n });\n }\n\n async joinApproval(id: string, mode: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.COMMUNITY}/${id}/join-approval`,\n method: HttpMethod.PATCH,\n body: { mode },\n });\n }\n}\n"]}
|