@raphaelvserafim/client-api-whatsapp 1.0.9 → 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/README.md +512 -297
- package/dist/WhatsApp.d.ts +177 -33
- package/dist/WhatsApp.js +146 -167
- package/dist/WhatsApp.js.map +1 -1
- package/dist/client/HttpClient.d.ts +6 -0
- package/dist/client/HttpClient.js +29 -0
- package/dist/client/HttpClient.js.map +1 -0
- package/dist/client/IHttpClient.d.ts +9 -0
- package/dist/client/IHttpClient.js +3 -0
- package/dist/client/IHttpClient.js.map +1 -0
- package/dist/errors.d.ts +5 -0
- package/dist/errors.js +13 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +16 -1
- package/dist/index.js +37 -3
- package/dist/index.js.map +1 -1
- package/dist/services/ActionService.d.ts +9 -0
- package/dist/services/ActionService.js +32 -0
- package/dist/services/ActionService.js.map +1 -0
- package/dist/services/BusinessService.d.ts +10 -0
- package/dist/services/BusinessService.js +43 -0
- package/dist/services/BusinessService.js.map +1 -0
- package/dist/services/CallService.d.ts +10 -0
- package/dist/services/CallService.js +38 -0
- package/dist/services/CallService.js.map +1 -0
- package/dist/services/ChatService.d.ts +19 -0
- package/dist/services/ChatService.js +63 -0
- package/dist/services/ChatService.js.map +1 -0
- package/dist/services/CommunityService.d.ts +35 -0
- package/dist/services/CommunityService.js +125 -0
- package/dist/services/CommunityService.js.map +1 -0
- package/dist/services/ContactService.d.ts +21 -0
- package/dist/services/ContactService.js +68 -0
- package/dist/services/ContactService.js.map +1 -0
- package/dist/services/GroupService.d.ts +37 -0
- package/dist/services/GroupService.js +117 -0
- package/dist/services/GroupService.js.map +1 -0
- package/dist/services/InstanceService.d.ts +29 -0
- package/dist/services/InstanceService.js +130 -0
- package/dist/services/InstanceService.js.map +1 -0
- package/dist/services/LabelService.d.ts +18 -0
- package/dist/services/LabelService.js +49 -0
- package/dist/services/LabelService.js.map +1 -0
- package/dist/services/MessageService.d.ts +60 -0
- package/dist/services/MessageService.js +171 -0
- package/dist/services/MessageService.js.map +1 -0
- 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 +206 -11
- package/dist/types/index.js +12 -0
- package/dist/types/index.js.map +1 -1
- package/package.json +6 -11
- package/.babelrc +0 -3
- package/dist/exemple.d.ts +0 -1
- package/dist/exemple.js +0 -264
- package/dist/exemple.js.map +0 -1
- package/src/WhatsApp.ts +0 -245
- package/src/exemple.ts +0 -312
- package/src/index.ts +0 -2
- package/src/types/index.ts +0 -190
- package/tsconfig.compile.json +0 -15
- package/tsconfig.json +0 -35
package/dist/WhatsApp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WhatsApp.js","sourceRoot":"","sources":["../src/WhatsApp.ts"],"names":[],"mappings":";;;;AAAA,0DAAiE;AACjE,mCAAiL;AAEjL,MAAa,QAAQ;IACF,MAAM,CAAS;IACf,GAAG,CAAS;IACrB,KAAK,CAAS;IACd,MAAM,GAAsB,IAAI,CAAC;IACjC,IAAI,GAAQ,IAAI,CAAC;IAEzB,YAAY,IAAU;QACpB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC1B,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;IACtB,CAAC;IAEO,KAAK,CAAC,OAAO;QACnB,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YAChC,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;QAC9E,CAAC;QACD,MAAM,OAAO,GAAuB;YAClC,GAAG,EAAE,GAAG,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,KAAK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AM,CAAC,MAAM,GAAG,GAAG,GAAG,EAAE,GAAG,eAAe,CAAC;QACxD,IAAI,CAAC,MAAM,GAAG,kBAAU,CAAC,IAAI,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG;YACV,YAAY;SACb,CAAA;QACD,OAAO,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;IAC9B,CAAC;CAEF;AA5OD,4BA4OC;AAGD,kBAAe,QAAQ,CAAC","sourcesContent":["import axios, { AxiosRequestConfig, AxiosResponse } from 'axios';\nimport { Init, HttpMethod, WebhookBody, Routes, TypeMessage, StatusPresence, Contact, Section, InfoInstance, SendMessageRoot, Connect, Location, Buttons, Items } from './types';\n\nexport class WhatsApp {\n private readonly server: string;\n private readonly key: string;\n private route: string;\n private method: HttpMethod | null = null;\n private body: any = null;\n\n constructor(data: Init) {\n this.server = data.server;\n this.key = data.key;\n }\n\n private async request(): Promise<any> {\n if (!this.route || !this.method) {\n throw new Error('Path and method must be defined before making a request.');\n }\n const options: AxiosRequestConfig = {\n url: `${this.server}/${this.key}/${this.route}`,\n method: this.method,\n headers: {\n 'Content-Type': 'application/json'\n }\n };\n if ((this.method === 'POST' || this.method === 'PUT') && this.body) {\n options.data = JSON.stringify(this.body);\n }\n try {\n const response = await axios(options);\n return response.data;\n } catch (error: any) {\n throw new Error(`HTTP Request Error: ${error.message} (status: ${error.response?.status})`);\n }\n }\n\n\n async connect(): Promise<Connect> {\n this.route = Routes.INSTANCES;\n this.method = HttpMethod.POST;\n return await this.request();\n }\n\n async info(): Promise<InfoInstance> {\n this.route = Routes.INSTANCES;\n this.method = HttpMethod.GET;\n return await this.request();\n }\n\n async logout(): Promise<any> {\n this.route = Routes.INSTANCES;\n this.method = HttpMethod.DELETE;\n return await this.request();\n }\n\n\n async setting({ markMessageRead, saveMedia, receiveStatusMessage, receivePresence }: { markMessageRead: boolean, receiveStatusMessage: boolean, receivePresence: boolean; saveMedia: boolean, }): Promise<{ status: number, message: string }> {\n this.route = Routes.INSTANCES + `/?markMessageRead=${markMessageRead}&saveMedia=${saveMedia}&receiveStatusMessage=${receiveStatusMessage}&receivePresence=${receivePresence}`;\n this.method = HttpMethod.PATCH;\n return await this.request();\n }\n\n\n async updateWebhook(body: WebhookBody): Promise<any> {\n this.route = Routes.INSTANCES;\n this.method = HttpMethod.PUT;\n this.body = body;\n return await this.request();\n }\n\n\n async sendMessage(\n data: {\n type: TypeMessage,\n body: {\n to: string,\n msgId?: string,\n header?: {\n title?: string,\n },\n status?: StatusPresence,\n text?: string,\n url?: string,\n caption?: string,\n mimetype?: string,\n fileName?: string,\n contact?: Contact,\n location?: Location,\n name?: string,\n options?: string[],\n sections?: Section[],\n buttons?: Buttons[],\n footer?: string,\n description?: string,\n title?: string,\n buttonText?: string,\n thumbnailUrl?: string,\n sourceUrl?: string,\n referenceId?: string,\n code?: string,\n key?: string,\n merchantName?: string,\n keyType?: \"CNPJ\" | \"CPF\" | \"EMAIL\" | \"PHONE\",\n subtotal?: string,\n totalAmount?: string,\n items?: Items[],\n }\n }, reply: boolean = false): Promise<SendMessageRoot> {\n\n if (data.type === TypeMessage.BUTTON_PIX) {\n const { key, keyType, merchantName, subtotal, totalAmount, items } = data.body;\n if (!key || !keyType || !merchantName || !subtotal || !totalAmount || !items || items.length === 0) {\n throw new Error(\"Campos obrigatórios para pagamento via PIX estão ausentes.\");\n }\n }\n\n if (reply) {\n this.route = Routes.MESSAGES + \"/\" + data.body.msgId + \"/\" + data.type;\n } else {\n this.route = Routes.MESSAGES + \"/\" + data.type;\n }\n\n this.method = HttpMethod.POST;\n this.body = data.body;\n return await this.request();\n }\n\n\n async forwardingMessage(to: string, msgId: string) {\n this.route = Routes.MESSAGES + \"/\" + msgId + \"/forwarding\";\n this.method = HttpMethod.POST;\n this.body = {\n to,\n }\n return await this.request();\n }\n\n async rejectCall(id: string, from: string) {\n this.route = Routes.CALL + `/${id}/${from}`;\n this.method = HttpMethod.DELETE;\n return await this.request();\n }\n\n async pairingCode(phoneNumber: string) {\n this.route = Routes.INSTANCES + \"/pairing-code\";\n this.body = {\n phoneNumber,\n }\n this.method = HttpMethod.POST;\n return await this.request();\n }\n\n async checkRegisteredWhatsapp(number: string) {\n this.route = Routes.ACTIONS + \"/registered?number=\" + number;\n this.method = HttpMethod.GET;\n return await this.request();\n }\n\n\n async contacts() {\n this.route = Routes.CONTACTS;\n this.method = HttpMethod.GET;\n return await this.request();\n }\n\n async contactProfile(id: string) {\n this.route = Routes.CONTACTS + \"/\" + id;\n this.method = HttpMethod.GET;\n return await this.request();\n }\n\n\n async groups() {\n this.route = Routes.GROUPS;\n this.method = HttpMethod.GET;\n return await this.request();\n }\n\n\n async infoGroup(id: string) {\n this.route = Routes.GROUPS + \"/\" + id;\n this.method = HttpMethod.GET;\n return await this.request();\n }\n\n async getInviteGroup(id: string) {\n this.route = Routes.GROUPS + \"/\" + id + \"/invite\";\n this.method = HttpMethod.GET;\n return await this.request();\n }\n\n\n\n async updateGroup(id: string, name: string, description: string) {\n this.route = Routes.GROUPS + \"/\" + id;\n this.method = HttpMethod.PUT;\n this.body = {\n name,\n description\n }\n return await this.request();\n }\n\n async updateGroupPicture(id: string, url: string) {\n this.route = Routes.GROUPS + \"/\" + id + \"/picture\";\n this.method = HttpMethod.PUT;\n this.body = {\n url\n }\n return await this.request();\n }\n\n async leaveGroup(id: string) {\n this.route = Routes.GROUPS + \"/\" + id;\n this.method = HttpMethod.DELETE;\n return await this.request();\n }\n\n async createGroup(name: string, participants: string[]) {\n this.route = Routes.GROUPS;\n this.method = HttpMethod.POST;\n this.body = {\n name,\n participants\n }\n return await this.request();\n }\n\n\n async addParticipantsGroup(id: string, participants: string[]) {\n this.route = Routes.GROUPS + \"/\" + id + \"/participants\";\n this.method = HttpMethod.POST;\n this.body = {\n participants\n }\n return await this.request();\n }\n\n}\n\n\nexport default WhatsApp;\n\n\n"]}
|
|
1
|
+
{"version":3,"file":"WhatsApp.js","sourceRoot":"","sources":["../src/WhatsApp.ts"],"names":[],"mappings":";;;AAcA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C","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"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HttpClient = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const axios_1 = tslib_1.__importDefault(require("axios"));
|
|
6
|
+
const errors_1 = require("../errors");
|
|
7
|
+
class HttpClient {
|
|
8
|
+
constructor(baseUrl) {
|
|
9
|
+
this.baseUrl = baseUrl;
|
|
10
|
+
}
|
|
11
|
+
async request(options) {
|
|
12
|
+
try {
|
|
13
|
+
const response = await (0, axios_1.default)({
|
|
14
|
+
url: `${this.baseUrl}/${options.route}`,
|
|
15
|
+
method: options.method,
|
|
16
|
+
headers: { 'Content-Type': 'application/json' },
|
|
17
|
+
data: options.body,
|
|
18
|
+
params: options.params,
|
|
19
|
+
});
|
|
20
|
+
return response.data;
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
const axiosError = error;
|
|
24
|
+
throw new errors_1.WhatsAppError(axiosError.message, axiosError.response?.status, axiosError.response?.data);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.HttpClient = HttpClient;
|
|
29
|
+
//# sourceMappingURL=HttpClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HttpClient.js","sourceRoot":"","sources":["../../src/client/HttpClient.ts"],"names":[],"mappings":";;;;AAAA,0DAA0C;AAC1C,sCAA0C;AAG1C,MAAa,UAAU;IACrB,YACmB,OAAe;QAAf,YAAO,GAAP,OAAO,CAAQ;IAC/B,CAAC;IAEJ,KAAK,CAAC,OAAO,CAAI,OAAuB;QACtC,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAA,eAAK,EAAC;gBAC3B,GAAG,EAAE,GAAG,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,KAAK,EAAE;gBACvC,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;gBAC/C,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,MAAM,EAAE,OAAO,CAAC,MAAM;aACvB,CAAC,CAAC;YACH,OAAO,QAAQ,CAAC,IAAS,CAAC;QAC5B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,UAAU,GAAG,KAAmB,CAAC;YACvC,MAAM,IAAI,sBAAa,CACrB,UAAU,CAAC,OAAO,EAClB,UAAU,CAAC,QAAQ,EAAE,MAAM,EAC3B,UAAU,CAAC,QAAQ,EAAE,IAAI,CAC1B,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AAxBD,gCAwBC","sourcesContent":["import axios, { AxiosError } from 'axios';\nimport { WhatsAppError } from '../errors';\nimport { IHttpClient, RequestOptions } from './IHttpClient';\n\nexport class HttpClient implements IHttpClient {\n constructor(\n private readonly baseUrl: string,\n ) {}\n\n async request<T>(options: RequestOptions): Promise<T> {\n try {\n const response = await axios({\n url: `${this.baseUrl}/${options.route}`,\n method: options.method,\n headers: { 'Content-Type': 'application/json' },\n data: options.body,\n params: options.params,\n });\n return response.data as T;\n } catch (error) {\n const axiosError = error as AxiosError;\n throw new WhatsAppError(\n axiosError.message,\n axiosError.response?.status,\n axiosError.response?.data,\n );\n }\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IHttpClient.js","sourceRoot":"","sources":["../../src/client/IHttpClient.ts"],"names":[],"mappings":"","sourcesContent":["export interface RequestOptions {\n route: string;\n method: string;\n body?: object;\n params?: Record<string, string | number | boolean>;\n}\n\nexport interface IHttpClient {\n request<T>(options: RequestOptions): Promise<T>;\n}\n"]}
|
package/dist/errors.d.ts
ADDED
package/dist/errors.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WhatsAppError = void 0;
|
|
4
|
+
class WhatsAppError extends Error {
|
|
5
|
+
constructor(message, statusCode, responseBody) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.name = 'WhatsAppError';
|
|
8
|
+
this.statusCode = statusCode;
|
|
9
|
+
this.responseBody = responseBody;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.WhatsAppError = WhatsAppError;
|
|
13
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";;;AAAA,MAAa,aAAc,SAAQ,KAAK;IAItC,YAAY,OAAe,EAAE,UAAmB,EAAE,YAAsB;QACtE,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;CACF;AAVD,sCAUC","sourcesContent":["export class WhatsAppError extends Error {\n readonly statusCode: number | undefined;\n readonly responseBody: unknown;\n\n constructor(message: string, statusCode?: number, responseBody?: unknown) {\n super(message);\n this.name = 'WhatsAppError';\n this.statusCode = statusCode;\n this.responseBody = responseBody;\n }\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,17 @@
|
|
|
1
|
-
export { TypeMessage, Init, StatusPresence, Contact, Location } from './types';
|
|
2
1
|
export { WhatsApp } from './WhatsApp';
|
|
2
|
+
export { WhatsAppError } from './errors';
|
|
3
|
+
export { IHttpClient, RequestOptions } from './client/IHttpClient';
|
|
4
|
+
export { HttpClient } from './client/HttpClient';
|
|
5
|
+
export { InstanceService } from './services/InstanceService';
|
|
6
|
+
export { MessageService } from './services/MessageService';
|
|
7
|
+
export { ChatService } from './services/ChatService';
|
|
8
|
+
export { CallService } from './services/CallService';
|
|
9
|
+
export { LabelService } from './services/LabelService';
|
|
10
|
+
export { ActionService } from './services/ActionService';
|
|
11
|
+
export { ContactService } from './services/ContactService';
|
|
12
|
+
export { GroupService } from './services/GroupService';
|
|
13
|
+
export { CommunityService } from './services/CommunityService';
|
|
14
|
+
export { BusinessService } from './services/BusinessService';
|
|
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,9 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
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
|
+
// Main class
|
|
5
|
+
var WhatsApp_1 = require("./WhatsApp");
|
|
6
|
+
Object.defineProperty(exports, "WhatsApp", { enumerable: true, get: function () { return WhatsApp_1.WhatsApp; } });
|
|
7
|
+
// Error
|
|
8
|
+
var errors_1 = require("./errors");
|
|
9
|
+
Object.defineProperty(exports, "WhatsAppError", { enumerable: true, get: function () { return errors_1.WhatsAppError; } });
|
|
10
|
+
var HttpClient_1 = require("./client/HttpClient");
|
|
11
|
+
Object.defineProperty(exports, "HttpClient", { enumerable: true, get: function () { return HttpClient_1.HttpClient; } });
|
|
12
|
+
// Services
|
|
13
|
+
var InstanceService_1 = require("./services/InstanceService");
|
|
14
|
+
Object.defineProperty(exports, "InstanceService", { enumerable: true, get: function () { return InstanceService_1.InstanceService; } });
|
|
15
|
+
var MessageService_1 = require("./services/MessageService");
|
|
16
|
+
Object.defineProperty(exports, "MessageService", { enumerable: true, get: function () { return MessageService_1.MessageService; } });
|
|
17
|
+
var ChatService_1 = require("./services/ChatService");
|
|
18
|
+
Object.defineProperty(exports, "ChatService", { enumerable: true, get: function () { return ChatService_1.ChatService; } });
|
|
19
|
+
var CallService_1 = require("./services/CallService");
|
|
20
|
+
Object.defineProperty(exports, "CallService", { enumerable: true, get: function () { return CallService_1.CallService; } });
|
|
21
|
+
var LabelService_1 = require("./services/LabelService");
|
|
22
|
+
Object.defineProperty(exports, "LabelService", { enumerable: true, get: function () { return LabelService_1.LabelService; } });
|
|
23
|
+
var ActionService_1 = require("./services/ActionService");
|
|
24
|
+
Object.defineProperty(exports, "ActionService", { enumerable: true, get: function () { return ActionService_1.ActionService; } });
|
|
25
|
+
var ContactService_1 = require("./services/ContactService");
|
|
26
|
+
Object.defineProperty(exports, "ContactService", { enumerable: true, get: function () { return ContactService_1.ContactService; } });
|
|
27
|
+
var GroupService_1 = require("./services/GroupService");
|
|
28
|
+
Object.defineProperty(exports, "GroupService", { enumerable: true, get: function () { return GroupService_1.GroupService; } });
|
|
29
|
+
var CommunityService_1 = require("./services/CommunityService");
|
|
30
|
+
Object.defineProperty(exports, "CommunityService", { enumerable: true, get: function () { return CommunityService_1.CommunityService; } });
|
|
31
|
+
var BusinessService_1 = require("./services/BusinessService");
|
|
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; } });
|
|
37
|
+
// Types
|
|
4
38
|
var types_1 = require("./types");
|
|
39
|
+
Object.defineProperty(exports, "HttpMethod", { enumerable: true, get: function () { return types_1.HttpMethod; } });
|
|
40
|
+
Object.defineProperty(exports, "Routes", { enumerable: true, get: function () { return types_1.Routes; } });
|
|
5
41
|
Object.defineProperty(exports, "TypeMessage", { enumerable: true, get: function () { return types_1.TypeMessage; } });
|
|
6
42
|
Object.defineProperty(exports, "StatusPresence", { enumerable: true, get: function () { return types_1.StatusPresence; } });
|
|
7
|
-
var WhatsApp_1 = require("./WhatsApp");
|
|
8
|
-
Object.defineProperty(exports, "WhatsApp", { enumerable: true, get: function () { return WhatsApp_1.WhatsApp; } });
|
|
9
43
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
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"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IHttpClient } from '../client/IHttpClient';
|
|
2
|
+
import { ApiResponse, RegisteredResponse, DownloadableMessage, DownloadMediaResponse } from '../types';
|
|
3
|
+
export declare class ActionService {
|
|
4
|
+
private readonly http;
|
|
5
|
+
constructor(http: IHttpClient);
|
|
6
|
+
checkRegistered(number: string): Promise<RegisteredResponse>;
|
|
7
|
+
downloadMedia(type: 'image' | 'video' | 'sticker' | 'audio' | 'document', message: DownloadableMessage): Promise<DownloadMediaResponse>;
|
|
8
|
+
deleteStorage(): Promise<ApiResponse>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ActionService = void 0;
|
|
4
|
+
const types_1 = require("../types");
|
|
5
|
+
class ActionService {
|
|
6
|
+
constructor(http) {
|
|
7
|
+
this.http = http;
|
|
8
|
+
}
|
|
9
|
+
async checkRegistered(number) {
|
|
10
|
+
return this.http.request({
|
|
11
|
+
route: `${types_1.Routes.ACTIONS}/registered`,
|
|
12
|
+
method: types_1.HttpMethod.GET,
|
|
13
|
+
params: { number },
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
async downloadMedia(type, message) {
|
|
17
|
+
return this.http.request({
|
|
18
|
+
route: `${types_1.Routes.ACTIONS}/download/media`,
|
|
19
|
+
method: types_1.HttpMethod.POST,
|
|
20
|
+
body: message,
|
|
21
|
+
params: { type },
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
async deleteStorage() {
|
|
25
|
+
return this.http.request({
|
|
26
|
+
route: `${types_1.Routes.ACTIONS}/storage`,
|
|
27
|
+
method: types_1.HttpMethod.DELETE,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.ActionService = ActionService;
|
|
32
|
+
//# sourceMappingURL=ActionService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActionService.js","sourceRoot":"","sources":["../../src/services/ActionService.ts"],"names":[],"mappings":";;;AACA,oCAGkB;AAElB,MAAa,aAAa;IACxB,YAA6B,IAAiB;QAAjB,SAAI,GAAJ,IAAI,CAAa;IAAG,CAAC;IAElD,KAAK,CAAC,eAAe,CAAC,MAAc;QAClC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAqB;YAC3C,KAAK,EAAE,GAAG,cAAM,CAAC,OAAO,aAAa;YACrC,MAAM,EAAE,kBAAU,CAAC,GAAG;YACtB,MAAM,EAAE,EAAE,MAAM,EAAE;SACnB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,IAA0D,EAAE,OAA4B;QAC1G,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAwB;YAC9C,KAAK,EAAE,GAAG,cAAM,CAAC,OAAO,iBAAiB;YACzC,MAAM,EAAE,kBAAU,CAAC,IAAI;YACvB,IAAI,EAAE,OAAO;YACb,MAAM,EAAE,EAAE,IAAI,EAAE;SACjB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,aAAa;QACjB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAc;YACpC,KAAK,EAAE,GAAG,cAAM,CAAC,OAAO,UAAU;YAClC,MAAM,EAAE,kBAAU,CAAC,MAAM;SAC1B,CAAC,CAAC;IACL,CAAC;CACF;AA1BD,sCA0BC","sourcesContent":["import { IHttpClient } from '../client/IHttpClient';\nimport {\n Routes, HttpMethod, ApiResponse, RegisteredResponse,\n DownloadableMessage, DownloadMediaResponse,\n} from '../types';\n\nexport class ActionService {\n constructor(private readonly http: IHttpClient) {}\n\n async checkRegistered(number: string): Promise<RegisteredResponse> {\n return this.http.request<RegisteredResponse>({\n route: `${Routes.ACTIONS}/registered`,\n method: HttpMethod.GET,\n params: { number },\n });\n }\n\n async downloadMedia(type: 'image' | 'video' | 'sticker' | 'audio' | 'document', message: DownloadableMessage): Promise<DownloadMediaResponse> {\n return this.http.request<DownloadMediaResponse>({\n route: `${Routes.ACTIONS}/download/media`,\n method: HttpMethod.POST,\n body: message,\n params: { type },\n });\n }\n\n async deleteStorage(): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.ACTIONS}/storage`,\n method: HttpMethod.DELETE,\n });\n }\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IHttpClient } from '../client/IHttpClient';
|
|
2
|
+
import { ApiResponse, Product, CatalogResponse } from '../types';
|
|
3
|
+
export declare class BusinessService {
|
|
4
|
+
private readonly http;
|
|
5
|
+
constructor(http: IHttpClient);
|
|
6
|
+
getCatalog(limit?: number, cursor?: string): Promise<CatalogResponse>;
|
|
7
|
+
createProduct(product: Product): Promise<ApiResponse>;
|
|
8
|
+
updateProduct(productId: string, product: Product): Promise<ApiResponse>;
|
|
9
|
+
deleteProduct(productId: string): Promise<ApiResponse>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BusinessService = void 0;
|
|
4
|
+
const types_1 = require("../types");
|
|
5
|
+
class BusinessService {
|
|
6
|
+
constructor(http) {
|
|
7
|
+
this.http = http;
|
|
8
|
+
}
|
|
9
|
+
async getCatalog(limit, cursor) {
|
|
10
|
+
const params = {};
|
|
11
|
+
if (limit !== undefined)
|
|
12
|
+
params.limit = limit;
|
|
13
|
+
if (cursor !== undefined)
|
|
14
|
+
params.cursor = cursor;
|
|
15
|
+
return this.http.request({
|
|
16
|
+
route: `${types_1.Routes.BUSINESS}/catalog`,
|
|
17
|
+
method: types_1.HttpMethod.GET,
|
|
18
|
+
params,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
async createProduct(product) {
|
|
22
|
+
return this.http.request({
|
|
23
|
+
route: `${types_1.Routes.BUSINESS}/catalog/product`,
|
|
24
|
+
method: types_1.HttpMethod.POST,
|
|
25
|
+
body: product,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
async updateProduct(productId, product) {
|
|
29
|
+
return this.http.request({
|
|
30
|
+
route: `${types_1.Routes.BUSINESS}/catalog/product/${productId}`,
|
|
31
|
+
method: types_1.HttpMethod.PUT,
|
|
32
|
+
body: product,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
async deleteProduct(productId) {
|
|
36
|
+
return this.http.request({
|
|
37
|
+
route: `${types_1.Routes.BUSINESS}/catalog/product/${productId}`,
|
|
38
|
+
method: types_1.HttpMethod.DELETE,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.BusinessService = BusinessService;
|
|
43
|
+
//# sourceMappingURL=BusinessService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BusinessService.js","sourceRoot":"","sources":["../../src/services/BusinessService.ts"],"names":[],"m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["import { IHttpClient } from '../client/IHttpClient';\nimport { Routes, HttpMethod, ApiResponse, Product, CatalogResponse } from '../types';\n\nexport class BusinessService {\n constructor(private readonly http: IHttpClient) {}\n\n async getCatalog(limit?: number, cursor?: string): Promise<CatalogResponse> {\n const params: Record<string, string | number> = {};\n if (limit !== undefined) params.limit = limit;\n if (cursor !== undefined) params.cursor = cursor;\n return this.http.request<CatalogResponse>({\n route: `${Routes.BUSINESS}/catalog`,\n method: HttpMethod.GET,\n params,\n });\n }\n\n async createProduct(product: Product): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.BUSINESS}/catalog/product`,\n method: HttpMethod.POST,\n body: product,\n });\n }\n\n async updateProduct(productId: string, product: Product): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.BUSINESS}/catalog/product/${productId}`,\n method: HttpMethod.PUT,\n body: product,\n });\n }\n\n async deleteProduct(productId: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.BUSINESS}/catalog/product/${productId}`,\n method: HttpMethod.DELETE,\n });\n }\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IHttpClient } from '../client/IHttpClient';
|
|
2
|
+
import { ApiResponse, CallResponse } from '../types';
|
|
3
|
+
export declare class CallService {
|
|
4
|
+
private readonly http;
|
|
5
|
+
constructor(http: IHttpClient);
|
|
6
|
+
call(to: string, isVideo?: boolean): Promise<CallResponse>;
|
|
7
|
+
reject(id: string, from: string): Promise<ApiResponse>;
|
|
8
|
+
accept(callId: string, callFrom: string): Promise<ApiResponse>;
|
|
9
|
+
end(callId: string, peerJid: string): Promise<ApiResponse>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CallService = void 0;
|
|
4
|
+
const types_1 = require("../types");
|
|
5
|
+
class CallService {
|
|
6
|
+
constructor(http) {
|
|
7
|
+
this.http = http;
|
|
8
|
+
}
|
|
9
|
+
async call(to, isVideo = false) {
|
|
10
|
+
return this.http.request({
|
|
11
|
+
route: types_1.Routes.CALL,
|
|
12
|
+
method: types_1.HttpMethod.POST,
|
|
13
|
+
body: { to, isVideo },
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
async reject(id, from) {
|
|
17
|
+
return this.http.request({
|
|
18
|
+
route: `${types_1.Routes.CALL}/${id}/${from}`,
|
|
19
|
+
method: types_1.HttpMethod.DELETE,
|
|
20
|
+
});
|
|
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
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.CallService = CallService;
|
|
38
|
+
//# sourceMappingURL=CallService.js.map
|
|
@@ -0,0 +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,EAAE,EAAE,OAAO,EAAE;SACtB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAU,EAAE,IAAY;QACnC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAc;YACpC,KAAK,EAAE,GAAG,cAAM,CAAC,IAAI,IAAI,EAAE,IAAI,IAAI,EAAE;YACrC,MAAM,EAAE,kBAAU,CAAC,MAAM;SAC1B,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,MAAc,EAAE,QAAgB;QAC3C,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAc;YACpC,KAAK,EAAE,GAAG,cAAM,CAAC,IAAI,SAAS;YAC9B,MAAM,EAAE,kBAAU,CAAC,IAAI;YACvB,IAAI,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE;SAC3B,CAAC,CAAC;IACL,CAAC;IAED,KAAK,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"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IHttpClient } from '../client/IHttpClient';
|
|
2
|
+
import { ApiResponse, ChatInfo, MessageData } from '../types';
|
|
3
|
+
export declare class ChatService {
|
|
4
|
+
private readonly http;
|
|
5
|
+
constructor(http: IHttpClient);
|
|
6
|
+
list(): Promise<{
|
|
7
|
+
status: number;
|
|
8
|
+
data: ChatInfo[];
|
|
9
|
+
}>;
|
|
10
|
+
modify(id: string, action: 'markRead' | 'pin', value: boolean): Promise<ApiResponse>;
|
|
11
|
+
delete(chatId: string): Promise<ApiResponse>;
|
|
12
|
+
messages(chatId: string, page?: number, limit?: number): Promise<{
|
|
13
|
+
status: number;
|
|
14
|
+
data: MessageData[];
|
|
15
|
+
}>;
|
|
16
|
+
presenceSubscribe(jid: string): Promise<ApiResponse>;
|
|
17
|
+
disappearing(jid: string, expiration: number): Promise<ApiResponse>;
|
|
18
|
+
privacy(): Promise<ApiResponse>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChatService = void 0;
|
|
4
|
+
const types_1 = require("../types");
|
|
5
|
+
class ChatService {
|
|
6
|
+
constructor(http) {
|
|
7
|
+
this.http = http;
|
|
8
|
+
}
|
|
9
|
+
async list() {
|
|
10
|
+
return this.http.request({
|
|
11
|
+
route: types_1.Routes.CHAT,
|
|
12
|
+
method: types_1.HttpMethod.GET,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
async modify(id, action, value) {
|
|
16
|
+
return this.http.request({
|
|
17
|
+
route: types_1.Routes.CHAT,
|
|
18
|
+
method: types_1.HttpMethod.PATCH,
|
|
19
|
+
params: { id, action, value },
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
async delete(chatId) {
|
|
23
|
+
return this.http.request({
|
|
24
|
+
route: types_1.Routes.CHAT,
|
|
25
|
+
method: types_1.HttpMethod.DELETE,
|
|
26
|
+
params: { chatId },
|
|
27
|
+
});
|
|
28
|
+
}
|
|
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;
|
|
35
|
+
return this.http.request({
|
|
36
|
+
route: `${types_1.Routes.CHAT}/messages`,
|
|
37
|
+
method: types_1.HttpMethod.GET,
|
|
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,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.ChatService = ChatService;
|
|
63
|
+
//# sourceMappingURL=ChatService.js.map
|
|
@@ -0,0 +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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GAAG,cAAM,CAAC,IAAI,qBAAqB;YAC1C,MAAM,EAAE,kBAAU,CAAC,IAAI;YACvB,IAAI,EAAE,EAAE,GAAG,EAAE;SACd,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,GAAW,EAAE,UAAkB;QAChD,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAc;YACpC,KAAK,EAAE,GAAG,cAAM,CAAC,IAAI,eAAe;YACpC,MAAM,EAAE,kBAAU,CAAC,IAAI;YACvB,IAAI,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE;SAC1B,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,OAAO;QACX,OAAO,IAAI,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"]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { IHttpClient } from '../client/IHttpClient';
|
|
2
|
+
import { ApiResponse, CommunityInfo, InviteCodeResponse, CommunityCreate, CommunityUpdate, GroupParticipant, GroupParticipantsAction, CommunityGroupCreate } from '../types';
|
|
3
|
+
export declare class CommunityService {
|
|
4
|
+
private readonly http;
|
|
5
|
+
constructor(http: IHttpClient);
|
|
6
|
+
list(): Promise<{
|
|
7
|
+
status: number;
|
|
8
|
+
data: CommunityInfo[];
|
|
9
|
+
}>;
|
|
10
|
+
create(data: CommunityCreate): Promise<{
|
|
11
|
+
status: number;
|
|
12
|
+
data: CommunityInfo;
|
|
13
|
+
}>;
|
|
14
|
+
info(id: string): Promise<{
|
|
15
|
+
status: number;
|
|
16
|
+
data: CommunityInfo;
|
|
17
|
+
}>;
|
|
18
|
+
update(id: string, data: CommunityUpdate): Promise<ApiResponse>;
|
|
19
|
+
leave(id: string): Promise<ApiResponse>;
|
|
20
|
+
updatePicture(id: string, url: string): Promise<ApiResponse>;
|
|
21
|
+
getInviteCode(id: string): Promise<InviteCodeResponse>;
|
|
22
|
+
removeParticipants(id: string, participants: string[]): Promise<ApiResponse>;
|
|
23
|
+
getRequestParticipants(id: string): Promise<{
|
|
24
|
+
status: number;
|
|
25
|
+
data: GroupParticipant[];
|
|
26
|
+
}>;
|
|
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>;
|
|
35
|
+
}
|