@muhammedaksam/waha-node 2025.12.1
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/LICENSE +21 -0
- package/README.md +141 -0
- package/dist/index.cjs.js +2 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +4451 -0
- package/dist/index.esm.js +2 -0
- package/dist/index.esm.js.map +1 -0
- package/package.json +87 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Muhammed Mustafa AKŞAM
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# @muhammedaksam/waha-node
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@muhammedaksam/waha-node)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
[](https://www.typescriptlang.org/)
|
|
6
|
+
[](https://nodejs.org/)
|
|
7
|
+
|
|
8
|
+
TypeScript SDK for [WAHA (WhatsApp HTTP API)](https://github.com/devlikeapro/waha) - auto-generated from OpenAPI spec with full type safety and axios-based client.
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @muhammedaksam/waha-node
|
|
14
|
+
# or
|
|
15
|
+
pnpm add @muhammedaksam/waha-node
|
|
16
|
+
# or
|
|
17
|
+
yarn add @muhammedaksam/waha-node
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
### Complete Client (Recommended)
|
|
23
|
+
|
|
24
|
+
The `WahaClient` aggregates all controllers for convenience:
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
import { WahaClient } from '@muhammedaksam/waha-node'
|
|
28
|
+
|
|
29
|
+
// Initialize with baseURL and optional API key
|
|
30
|
+
const client = new WahaClient('http://localhost:3000', 'your-api-key')
|
|
31
|
+
|
|
32
|
+
// Access controllers via properties
|
|
33
|
+
// Sessions
|
|
34
|
+
const { data: sessions } = await client.sessions.sessionsControllerList()
|
|
35
|
+
|
|
36
|
+
// Chatting
|
|
37
|
+
const { data: message } = await client.chatting.chattingControllerSendText('default', {
|
|
38
|
+
chatId: '1234567890@c.us',
|
|
39
|
+
text: 'Hello from waha-node!',
|
|
40
|
+
session: 'default',
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
// Auth
|
|
44
|
+
const { data: qr } = await client.auth.authControllerGetQr('default', {
|
|
45
|
+
format: 'raw',
|
|
46
|
+
})
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Modular Clients (Tree-shakable)
|
|
50
|
+
|
|
51
|
+
If you only need specific functionality, you can import individual controllers:
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
import { Chatting, HttpClient } from '@muhammedaksam/waha-node'
|
|
55
|
+
|
|
56
|
+
const http = new HttpClient({
|
|
57
|
+
baseUrl: 'http://localhost:3000',
|
|
58
|
+
securityWorker: () => ({ headers: { 'X-Api-Key': 'your-api-key' } }),
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
const chatting = new Chatting(http)
|
|
62
|
+
|
|
63
|
+
await chatting.chattingControllerSendText(...)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## API Methods
|
|
67
|
+
|
|
68
|
+
All endpoints are available through the client properties:
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
client.sessions.* // SessionsController
|
|
72
|
+
client.chatting.* // ChattingController
|
|
73
|
+
client.contacts.* // ContactsController
|
|
74
|
+
client.groups.* // GroupsController
|
|
75
|
+
client.auth.* // AuthController
|
|
76
|
+
// ...etc
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Types
|
|
80
|
+
|
|
81
|
+
All 200+ types are auto-generated from the WAHA OpenAPI specification:
|
|
82
|
+
|
|
83
|
+
```typescript
|
|
84
|
+
import {
|
|
85
|
+
SessionInfo,
|
|
86
|
+
MessageTextRequest,
|
|
87
|
+
WAMessage,
|
|
88
|
+
QRCodeValue,
|
|
89
|
+
// ... and many more
|
|
90
|
+
} from '@muhammedaksam/waha-node'
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## How It Works
|
|
94
|
+
|
|
95
|
+
This package is automatically kept in sync with WAHA:
|
|
96
|
+
|
|
97
|
+
1. **Daily** - GitHub Action spins up latest `devlikeapro/waha` container
|
|
98
|
+
2. **Fetches** OpenAPI spec from `/-json` endpoint
|
|
99
|
+
3. **Compares** SHA256 hash with committed `openapi.json`
|
|
100
|
+
4. **If changed** - Generates new types + client, bumps version, commits, and pushes tag
|
|
101
|
+
5. **Publishes** to npm via OIDC trusted publishing
|
|
102
|
+
|
|
103
|
+
The `openapi.json` is committed so you can see exactly what changed between versions.
|
|
104
|
+
|
|
105
|
+
## Development
|
|
106
|
+
|
|
107
|
+
### Prerequisites
|
|
108
|
+
|
|
109
|
+
- Node.js >= 18
|
|
110
|
+
- pnpm
|
|
111
|
+
- Running WAHA instance (for type generation)
|
|
112
|
+
|
|
113
|
+
### Generate Types Locally
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
# Start WAHA (credentials will be auto-generated in logs)
|
|
117
|
+
docker run -d -p 3000:3000 --name waha devlikeapro/waha:latest
|
|
118
|
+
|
|
119
|
+
# Get the generated password from logs
|
|
120
|
+
docker logs waha 2>&1 | grep WHATSAPP_SWAGGER_PASSWORD
|
|
121
|
+
|
|
122
|
+
# Set credentials and generate
|
|
123
|
+
export SWAGGER_USER=admin
|
|
124
|
+
export SWAGGER_PASSWORD=<password-from-logs>
|
|
125
|
+
pnpm run generate
|
|
126
|
+
|
|
127
|
+
# Build
|
|
128
|
+
pnpm run build
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Scripts
|
|
132
|
+
|
|
133
|
+
| Script | Description |
|
|
134
|
+
| ------------------- | ---------------------------------------------- |
|
|
135
|
+
| `pnpm run generate` | Fetch OpenAPI spec and generate types + client |
|
|
136
|
+
| `pnpm run build` | Build ESM/CJS bundles |
|
|
137
|
+
| `pnpm run clean` | Remove dist folder |
|
|
138
|
+
|
|
139
|
+
## License
|
|
140
|
+
|
|
141
|
+
MIT
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var e,t=require("axios");!function(e){e.Json="application/json",e.JsonApi="application/vnd.api+json",e.FormData="multipart/form-data",e.UrlEncoded="application/x-www-form-urlencoded",e.Text="text/plain"}(e||(e={}));class s{constructor({securityWorker:s,secure:o,format:r,...a}={}){this.securityData=null,this.setSecurityData=e=>{this.securityData=e},this.request=async({secure:t,path:s,type:o,query:r,format:a,body:h,...i})=>{const n=("boolean"==typeof t?t:this.secure)&&this.securityWorker&&await this.securityWorker(this.securityData)||{},p=this.mergeRequestParams(i,n),u=a||this.format||void 0;return o===e.FormData&&h&&null!==h&&"object"==typeof h&&(h=this.createFormData(h)),o===e.Text&&h&&null!==h&&"string"!=typeof h&&(h=JSON.stringify(h)),this.instance.request({...p,headers:{...p.headers||{},...o?{"Content-Type":o}:{}},params:r,responseType:u,data:h,url:s})},this.instance=t.create({...a,baseURL:a.baseURL||"{protocol}://{host}:{port}/{baseUrl}"}),this.secure=o,this.format=r,this.securityWorker=s}mergeRequestParams(e,t){const s=e.method||t&&t.method;return{...this.instance.defaults,...e,...t||{},headers:{...s&&this.instance.defaults.headers[s.toLowerCase()]||{},...e.headers||{},...t&&t.headers||{}}}}stringifyFormItem(e){return"object"==typeof e&&null!==e?JSON.stringify(e):`${e}`}createFormData(e){return e instanceof FormData?e:Object.keys(e||{}).reduce((t,s)=>{const o=e[s],r=o instanceof Array?o:[o];for(const e of r){const o=e instanceof Blob||e instanceof File;t.append(s,o?e:this.stringifyFormItem(e))}return t},new FormData)}}class o extends s{constructor(){super(...arguments),this.appsControllerList=(e,t={})=>this.request({path:"/api/apps",method:"GET",query:e,secure:!0,...t}),this.appsControllerCreate=(t,s={})=>this.request({path:"/api/apps",method:"POST",body:t,secure:!0,type:e.Json,...s}),this.appsControllerGet=(e,t={})=>this.request({path:`/api/apps/${e}`,method:"GET",secure:!0,...t}),this.appsControllerUpdate=(t,s,o={})=>this.request({path:`/api/apps/${t}`,method:"PUT",body:s,secure:!0,type:e.Json,...o}),this.appsControllerDelete=(e,t={})=>this.request({path:`/api/apps/${e}`,method:"DELETE",secure:!0,...t}),this.chatwootLocalesControllerGetLanguages=(e={})=>this.request({path:"/api/apps/chatwoot/locales",method:"GET",secure:!0,format:"json",...e})}}class r extends s{constructor(){super(...arguments),this.authControllerGetQr=(e,t,s={})=>this.request({path:`/api/${e}/auth/qr`,method:"GET",query:t,secure:!0,format:"json",...s}),this.authControllerRequestCode=(t,s,o={})=>this.request({path:`/api/${t}/auth/request-code`,method:"POST",body:s,secure:!0,type:e.Json,...o})}}class a extends s{constructor(){super(...arguments),this.callsControllerRejectCall=(t,s,o={})=>this.request({path:`/api/${t}/calls/reject`,method:"POST",body:s,secure:!0,type:e.Json,...o})}}class h extends s{constructor(){super(...arguments),this.channelsControllerList=(e,t,s={})=>this.request({path:`/api/${e}/channels`,method:"GET",query:t,secure:!0,format:"json",...s}),this.channelsControllerCreate=(t,s,o={})=>this.request({path:`/api/${t}/channels`,method:"POST",body:s,secure:!0,type:e.Json,format:"json",...o}),this.channelsControllerDelete=(e,t,s={})=>this.request({path:`/api/${e}/channels/${t}`,method:"DELETE",secure:!0,...s}),this.channelsControllerGet=(e,t,s={})=>this.request({path:`/api/${e}/channels/${t}`,method:"GET",secure:!0,format:"json",...s}),this.channelsControllerPreviewChannelMessages=(e,t,s,o={})=>this.request({path:`/api/${e}/channels/${t}/messages/preview`,method:"GET",query:s,secure:!0,format:"json",...o}),this.channelsControllerFollow=(e,t,s={})=>this.request({path:`/api/${e}/channels/${t}/follow`,method:"POST",secure:!0,...s}),this.channelsControllerUnfollow=(e,t,s={})=>this.request({path:`/api/${e}/channels/${t}/unfollow`,method:"POST",secure:!0,...s}),this.channelsControllerMute=(e,t,s={})=>this.request({path:`/api/${e}/channels/${t}/mute`,method:"POST",secure:!0,...s}),this.channelsControllerUnmute=(e,t,s={})=>this.request({path:`/api/${e}/channels/${t}/unmute`,method:"POST",secure:!0,...s}),this.channelsControllerSearchByView=(t,s,o={})=>this.request({path:`/api/${t}/channels/search/by-view`,method:"POST",body:s,secure:!0,type:e.Json,format:"json",...o}),this.channelsControllerSearchByText=(t,s,o={})=>this.request({path:`/api/${t}/channels/search/by-text`,method:"POST",body:s,secure:!0,type:e.Json,format:"json",...o}),this.channelsControllerGetSearchViews=(e,t={})=>this.request({path:`/api/${e}/channels/search/views`,method:"GET",secure:!0,format:"json",...t}),this.channelsControllerGetSearchCountries=(e,t={})=>this.request({path:`/api/${e}/channels/search/countries`,method:"GET",secure:!0,format:"json",...t}),this.channelsControllerGetSearchCategories=(e,t={})=>this.request({path:`/api/${e}/channels/search/categories`,method:"GET",secure:!0,format:"json",...t})}}class i extends s{constructor(){super(...arguments),this.chatsControllerGetChats=(e,t,s={})=>this.request({path:`/api/${e}/chats`,method:"GET",query:t,secure:!0,...s}),this.chatsControllerGetChatsOverview=(e,t,s={})=>this.request({path:`/api/${e}/chats/overview`,method:"GET",query:t,secure:!0,format:"json",...s}),this.chatsControllerPostChatsOverview=(t,s,o={})=>this.request({path:`/api/${t}/chats/overview`,method:"POST",body:s,secure:!0,type:e.Json,format:"json",...o}),this.chatsControllerDeleteChat=(e,t,s={})=>this.request({path:`/api/${e}/chats/${t}`,method:"DELETE",secure:!0,...s}),this.chatsControllerGetChatPicture=(e,t,s,o={})=>this.request({path:`/api/${e}/chats/${t}/picture`,method:"GET",query:s,secure:!0,format:"json",...o}),this.chatsControllerGetChatMessages=(e,t,s,o={})=>this.request({path:`/api/${e}/chats/${t}/messages`,method:"GET",query:s,secure:!0,format:"json",...o}),this.chatsControllerClearMessages=(e,t,s={})=>this.request({path:`/api/${e}/chats/${t}/messages`,method:"DELETE",secure:!0,...s}),this.chatsControllerReadChatMessages=(e,t,s,o={})=>this.request({path:`/api/${e}/chats/${t}/messages/read`,method:"POST",query:s,secure:!0,format:"json",...o}),this.chatsControllerGetChatMessage=(e,t,s,o,r={})=>this.request({path:`/api/${e}/chats/${t}/messages/${s}`,method:"GET",query:o,secure:!0,format:"json",...r}),this.chatsControllerDeleteMessage=(e,t,s,o={})=>this.request({path:`/api/${e}/chats/${t}/messages/${s}`,method:"DELETE",secure:!0,...o}),this.chatsControllerEditMessage=(t,s,o,r,a={})=>this.request({path:`/api/${t}/chats/${s}/messages/${o}`,method:"PUT",body:r,secure:!0,type:e.Json,...a}),this.chatsControllerPinMessage=(t,s,o,r,a={})=>this.request({path:`/api/${t}/chats/${s}/messages/${o}/pin`,method:"POST",body:r,secure:!0,type:e.Json,...a}),this.chatsControllerUnpinMessage=(e,t,s,o={})=>this.request({path:`/api/${e}/chats/${t}/messages/${s}/unpin`,method:"POST",secure:!0,...o}),this.chatsControllerArchiveChat=(e,t,s={})=>this.request({path:`/api/${e}/chats/${t}/archive`,method:"POST",secure:!0,format:"json",...s}),this.chatsControllerUnarchiveChat=(e,t,s={})=>this.request({path:`/api/${e}/chats/${t}/unarchive`,method:"POST",secure:!0,format:"json",...s}),this.chatsControllerUnreadChat=(e,t,s={})=>this.request({path:`/api/${e}/chats/${t}/unread`,method:"POST",secure:!0,format:"json",...s})}}class n extends s{constructor(){super(...arguments),this.chattingControllerSendText=(t,s={})=>this.request({path:"/api/sendText",method:"POST",body:t,secure:!0,type:e.Json,format:"json",...s}),this.chattingControllerSendTextGet=(e,t={})=>this.request({path:"/api/sendText",method:"GET",query:e,secure:!0,format:"json",...t}),this.chattingControllerSendImage=(t,s={})=>this.request({path:"/api/sendImage",method:"POST",body:t,secure:!0,type:e.Json,format:"json",...s}),this.chattingControllerSendFile=(t,s={})=>this.request({path:"/api/sendFile",method:"POST",body:t,secure:!0,type:e.Json,format:"json",...s}),this.chattingControllerSendVoice=(t,s={})=>this.request({path:"/api/sendVoice",method:"POST",body:t,secure:!0,type:e.Json,format:"json",...s}),this.chattingControllerSendVideo=(t,s={})=>this.request({path:"/api/sendVideo",method:"POST",body:t,secure:!0,type:e.Json,...s}),this.chattingControllerSendLinkCustomPreview=(t,s={})=>this.request({path:"/api/send/link-custom-preview",method:"POST",body:t,secure:!0,type:e.Json,format:"json",...s}),this.chattingControllerSendButtons=(t,s={})=>this.request({path:"/api/sendButtons",method:"POST",body:t,secure:!0,type:e.Json,...s}),this.chattingControllerSendList=(t,s={})=>this.request({path:"/api/sendList",method:"POST",body:t,secure:!0,type:e.Json,format:"json",...s}),this.chattingControllerForwardMessage=(t,s={})=>this.request({path:"/api/forwardMessage",method:"POST",body:t,secure:!0,type:e.Json,format:"json",...s}),this.chattingControllerSendSeen=(t,s={})=>this.request({path:"/api/sendSeen",method:"POST",body:t,secure:!0,type:e.Json,format:"json",...s}),this.chattingControllerStartTyping=(t,s={})=>this.request({path:"/api/startTyping",method:"POST",body:t,secure:!0,type:e.Json,...s}),this.chattingControllerStopTyping=(t,s={})=>this.request({path:"/api/stopTyping",method:"POST",body:t,secure:!0,type:e.Json,...s}),this.chattingControllerSetReaction=(t,s={})=>this.request({path:"/api/reaction",method:"PUT",body:t,secure:!0,type:e.Json,format:"json",...s}),this.chattingControllerSetStar=(t,s={})=>this.request({path:"/api/star",method:"PUT",body:t,secure:!0,type:e.Json,...s}),this.chattingControllerSendPoll=(t,s={})=>this.request({path:"/api/sendPoll",method:"POST",body:t,secure:!0,type:e.Json,...s}),this.chattingControllerSendPollVote=(t,s={})=>this.request({path:"/api/sendPollVote",method:"POST",body:t,secure:!0,type:e.Json,...s}),this.chattingControllerSendLocation=(t,s={})=>this.request({path:"/api/sendLocation",method:"POST",body:t,secure:!0,type:e.Json,format:"json",...s}),this.chattingControllerSendContactVcard=(t,s={})=>this.request({path:"/api/sendContactVcard",method:"POST",body:t,secure:!0,type:e.Json,...s}),this.chattingControllerSendButtonsReply=(t,s={})=>this.request({path:"/api/send/buttons/reply",method:"POST",body:t,secure:!0,type:e.Json,...s}),this.chattingControllerGetMessages=(e,t={})=>this.request({path:"/api/messages",method:"GET",query:e,secure:!0,format:"json",...t}),this.chattingControllerDeprecatedCheckNumberStatus=(e,t={})=>this.request({path:"/api/checkNumberStatus",method:"GET",query:e,secure:!0,format:"json",...t}),this.chattingControllerReply=(t,s={})=>this.request({path:"/api/reply",method:"POST",body:t,secure:!0,type:e.Json,format:"json",...s}),this.chattingControllerSendLinkPreviewDeprecated=(t,s={})=>this.request({path:"/api/sendLinkPreview",method:"POST",body:t,secure:!0,type:e.Json,...s})}}class p extends s{constructor(){super(...arguments),this.contactsControllerGetAll=(e,t={})=>this.request({path:"/api/contacts/all",method:"GET",query:e,secure:!0,...t}),this.contactsControllerGet=(e,t={})=>this.request({path:"/api/contacts",method:"GET",query:e,secure:!0,...t}),this.contactsControllerCheckExists=(e,t={})=>this.request({path:"/api/contacts/check-exists",method:"GET",query:e,secure:!0,format:"json",...t}),this.contactsControllerGetAbout=(e,t={})=>this.request({path:"/api/contacts/about",method:"GET",query:e,secure:!0,...t}),this.contactsControllerGetProfilePicture=(e,t={})=>this.request({path:"/api/contacts/profile-picture",method:"GET",query:e,secure:!0,...t}),this.contactsControllerBlock=(t,s={})=>this.request({path:"/api/contacts/block",method:"POST",body:t,secure:!0,type:e.Json,...s}),this.contactsControllerUnblock=(t,s={})=>this.request({path:"/api/contacts/unblock",method:"POST",body:t,secure:!0,type:e.Json,...s}),this.contactsSessionControllerPut=(t,s,o,r={})=>this.request({path:`/api/${t}/contacts/${s}`,method:"PUT",body:o,secure:!0,type:e.Json,format:"json",...r}),this.lidsControllerGetAll=(e,t,s={})=>this.request({path:`/api/${e}/lids`,method:"GET",query:t,secure:!0,format:"json",...s}),this.lidsControllerGetLidsCount=(e,t={})=>this.request({path:`/api/${e}/lids/count`,method:"GET",secure:!0,format:"json",...t}),this.lidsControllerFindPnByLid=(e,t,s={})=>this.request({path:`/api/${e}/lids/${t}`,method:"GET",secure:!0,format:"json",...s}),this.lidsControllerFindLidByPhoneNumber=(e,t,s={})=>this.request({path:`/api/${e}/lids/pn/${t}`,method:"GET",secure:!0,format:"json",...s})}}class u extends s{constructor(){super(...arguments),this.eventsControllerSendEvent=(t,s,o={})=>this.request({path:`/api/${t}/events`,method:"POST",body:s,secure:!0,type:e.Json,format:"json",...o})}}class l extends s{constructor(){super(...arguments),this.groupsControllerCreateGroup=(t,s,o={})=>this.request({path:`/api/${t}/groups`,method:"POST",body:s,secure:!0,type:e.Json,...o}),this.groupsControllerGetGroups=(e,t,s={})=>this.request({path:`/api/${e}/groups`,method:"GET",query:t,secure:!0,format:"json",...s}),this.groupsControllerJoinInfoGroup=(e,t,s={})=>this.request({path:`/api/${e}/groups/join-info`,method:"GET",query:t,secure:!0,format:"json",...s}),this.groupsControllerJoinGroup=(t,s,o={})=>this.request({path:`/api/${t}/groups/join`,method:"POST",body:s,secure:!0,type:e.Json,format:"json",...o}),this.groupsControllerGetGroupsCount=(e,t={})=>this.request({path:`/api/${e}/groups/count`,method:"GET",secure:!0,format:"json",...t}),this.groupsControllerRefreshGroups=(e,t={})=>this.request({path:`/api/${e}/groups/refresh`,method:"POST",secure:!0,...t}),this.groupsControllerGetGroup=(e,t,s={})=>this.request({path:`/api/${e}/groups/${t}`,method:"GET",secure:!0,...s}),this.groupsControllerDeleteGroup=(e,t,s={})=>this.request({path:`/api/${e}/groups/${t}`,method:"DELETE",secure:!0,...s}),this.groupsControllerLeaveGroup=(e,t,s={})=>this.request({path:`/api/${e}/groups/${t}/leave`,method:"POST",secure:!0,...s}),this.groupsControllerGetChatPicture=(e,t,s,o={})=>this.request({path:`/api/${e}/groups/${t}/picture`,method:"GET",query:s,secure:!0,format:"json",...o}),this.groupsControllerSetPicture=(t,s,o,r={})=>this.request({path:`/api/${s}/groups/${t}/picture`,method:"PUT",body:o,secure:!0,type:e.Json,format:"json",...r}),this.groupsControllerDeletePicture=(e,t,s={})=>this.request({path:`/api/${t}/groups/${e}/picture`,method:"DELETE",secure:!0,format:"json",...s}),this.groupsControllerSetDescription=(t,s,o,r={})=>this.request({path:`/api/${t}/groups/${s}/description`,method:"PUT",body:o,secure:!0,type:e.Json,...r}),this.groupsControllerSetSubject=(t,s,o,r={})=>this.request({path:`/api/${t}/groups/${s}/subject`,method:"PUT",body:o,secure:!0,type:e.Json,...r}),this.groupsControllerSetInfoAdminOnly=(t,s,o,r={})=>this.request({path:`/api/${t}/groups/${s}/settings/security/info-admin-only`,method:"PUT",body:o,secure:!0,type:e.Json,...r}),this.groupsControllerGetInfoAdminOnly=(e,t,s={})=>this.request({path:`/api/${e}/groups/${t}/settings/security/info-admin-only`,method:"GET",secure:!0,format:"json",...s}),this.groupsControllerSetMessagesAdminOnly=(t,s,o,r={})=>this.request({path:`/api/${t}/groups/${s}/settings/security/messages-admin-only`,method:"PUT",body:o,secure:!0,type:e.Json,...r}),this.groupsControllerGetMessagesAdminOnly=(e,t,s={})=>this.request({path:`/api/${e}/groups/${t}/settings/security/messages-admin-only`,method:"GET",secure:!0,format:"json",...s}),this.groupsControllerGetInviteCode=(e,t,s={})=>this.request({path:`/api/${e}/groups/${t}/invite-code`,method:"GET",secure:!0,format:"json",...s}),this.groupsControllerRevokeInviteCode=(e,t,s={})=>this.request({path:`/api/${e}/groups/${t}/invite-code/revoke`,method:"POST",secure:!0,format:"json",...s}),this.groupsControllerGetParticipants=(e,t,s={})=>this.request({path:`/api/${e}/groups/${t}/participants`,method:"GET",secure:!0,...s}),this.groupsControllerGetGroupParticipants=(e,t,s={})=>this.request({path:`/api/${e}/groups/${t}/participants/v2`,method:"GET",secure:!0,format:"json",...s}),this.groupsControllerAddParticipants=(t,s,o,r={})=>this.request({path:`/api/${t}/groups/${s}/participants/add`,method:"POST",body:o,secure:!0,type:e.Json,...r}),this.groupsControllerRemoveParticipants=(t,s,o,r={})=>this.request({path:`/api/${t}/groups/${s}/participants/remove`,method:"POST",body:o,secure:!0,type:e.Json,...r}),this.groupsControllerPromoteToAdmin=(t,s,o,r={})=>this.request({path:`/api/${t}/groups/${s}/admin/promote`,method:"POST",body:o,secure:!0,type:e.Json,...r}),this.groupsControllerDemoteToAdmin=(t,s,o,r={})=>this.request({path:`/api/${t}/groups/${s}/admin/demote`,method:"POST",body:o,secure:!0,type:e.Json,...r})}}class c extends s{constructor(){super(...arguments),this.labelsControllerGetAll=(e,t={})=>this.request({path:`/api/${e}/labels`,method:"GET",secure:!0,format:"json",...t}),this.labelsControllerCreate=(t,s,o={})=>this.request({path:`/api/${t}/labels`,method:"POST",body:s,secure:!0,type:e.Json,format:"json",...o}),this.labelsControllerUpdate=(t,s,o,r={})=>this.request({path:`/api/${t}/labels/${s}`,method:"PUT",body:o,secure:!0,type:e.Json,format:"json",...r}),this.labelsControllerDelete=(e,t,s={})=>this.request({path:`/api/${e}/labels/${t}`,method:"DELETE",secure:!0,format:"json",...s}),this.labelsControllerGetChatLabels=(e,t,s={})=>this.request({path:`/api/${e}/labels/chats/${t}`,method:"GET",secure:!0,format:"json",...s}),this.labelsControllerPutChatLabels=(t,s,o,r={})=>this.request({path:`/api/${t}/labels/chats/${s}`,method:"PUT",body:o,secure:!0,type:e.Json,...r}),this.labelsControllerGetChatsByLabel=(e,t,s={})=>this.request({path:`/api/${e}/labels/${t}/chats`,method:"GET",secure:!0,...s})}}class d extends s{constructor(){super(...arguments),this.mediaControllerConvertVoice=(t,s,o={})=>this.request({path:`/api/${t}/media/convert/voice`,method:"POST",body:s,secure:!0,type:e.Json,format:"json",...o}),this.mediaControllerConvertVideo=(t,s,o={})=>this.request({path:`/api/${t}/media/convert/video`,method:"POST",body:s,secure:!0,type:e.Json,format:"json",...o})}}class m extends s{constructor(){super(...arguments),this.pingControllerPing=(e={})=>this.request({path:"/ping",method:"GET",format:"json",...e}),this.healthControllerCheck=(e={})=>this.request({path:"/health",method:"GET",secure:!0,format:"json",...e}),this.serverControllerGet=(e={})=>this.request({path:"/api/server/version",method:"GET",secure:!0,format:"json",...e}),this.serverControllerEnvironment=(e,t={})=>this.request({path:"/api/server/environment",method:"GET",query:e,secure:!0,format:"json",...t}),this.serverControllerStatus=(e={})=>this.request({path:"/api/server/status",method:"GET",secure:!0,format:"json",...e}),this.serverControllerStop=(t,s={})=>this.request({path:"/api/server/stop",method:"POST",body:t,secure:!0,type:e.Json,format:"json",...s}),this.serverDebugControllerCpuProfile=(e,t={})=>this.request({path:"/api/server/debug/cpu",method:"GET",query:e,secure:!0,...t}),this.serverDebugControllerHeapsnapshot=(e={})=>this.request({path:"/api/server/debug/heapsnapshot",method:"GET",secure:!0,...e}),this.serverDebugControllerBrowserTrace=(e,t,s={})=>this.request({path:`/api/server/debug/browser/trace/${e}`,method:"GET",query:t,secure:!0,...s}),this.versionControllerGet=(e={})=>this.request({path:"/api/version",method:"GET",secure:!0,format:"json",...e})}}class y extends s{constructor(){super(...arguments),this.presenceControllerSetPresence=(t,s,o={})=>this.request({path:`/api/${t}/presence`,method:"POST",body:s,secure:!0,type:e.Json,...o}),this.presenceControllerGetPresenceAll=(e,t={})=>this.request({path:`/api/${e}/presence`,method:"GET",secure:!0,format:"json",...t}),this.presenceControllerGetPresence=(e,t,s={})=>this.request({path:`/api/${e}/presence/${t}`,method:"GET",secure:!0,format:"json",...s}),this.presenceControllerSubscribe=(e,t,s={})=>this.request({path:`/api/${e}/presence/${t}/subscribe`,method:"POST",secure:!0,...s})}}class C extends s{constructor(){super(...arguments),this.profileControllerGetMyProfile=(e,t={})=>this.request({path:`/api/${e}/profile`,method:"GET",secure:!0,format:"json",...t}),this.profileControllerSetProfileName=(t,s,o={})=>this.request({path:`/api/${t}/profile/name`,method:"PUT",body:s,secure:!0,type:e.Json,format:"json",...o}),this.profileControllerSetProfileStatus=(t,s,o={})=>this.request({path:`/api/${t}/profile/status`,method:"PUT",body:s,secure:!0,type:e.Json,format:"json",...o}),this.profileControllerSetProfilePicture=(t,s,o={})=>this.request({path:`/api/${t}/profile/picture`,method:"PUT",body:s,secure:!0,type:e.Json,format:"json",...o}),this.profileControllerDeleteProfilePicture=(e,t={})=>this.request({path:`/api/${e}/profile/picture`,method:"DELETE",secure:!0,format:"json",...t})}}class q extends s{constructor(){super(...arguments),this.screenshotControllerScreenshot=(e,t={})=>this.request({path:"/api/screenshot",method:"GET",query:e,secure:!0,format:"json",...t})}}class T extends s{constructor(){super(...arguments),this.sessionsControllerList=(e,t={})=>this.request({path:"/api/sessions",method:"GET",query:e,secure:!0,format:"json",...t}),this.sessionsControllerCreate=(t,s={})=>this.request({path:"/api/sessions",method:"POST",body:t,secure:!0,type:e.Json,format:"json",...s}),this.sessionsControllerGet=(e,t,s={})=>this.request({path:`/api/sessions/${e}`,method:"GET",query:t,secure:!0,format:"json",...s}),this.sessionsControllerUpdate=(t,s,o={})=>this.request({path:`/api/sessions/${t}`,method:"PUT",body:s,secure:!0,type:e.Json,format:"json",...o}),this.sessionsControllerDelete=(e,t={})=>this.request({path:`/api/sessions/${e}`,method:"DELETE",secure:!0,...t}),this.sessionsControllerGetMe=(e,t={})=>this.request({path:`/api/sessions/${e}/me`,method:"GET",secure:!0,format:"json",...t}),this.sessionsControllerStart=(e,t={})=>this.request({path:`/api/sessions/${e}/start`,method:"POST",secure:!0,format:"json",...t}),this.sessionsControllerStop=(e,t={})=>this.request({path:`/api/sessions/${e}/stop`,method:"POST",secure:!0,format:"json",...t}),this.sessionsControllerLogout=(e,t={})=>this.request({path:`/api/sessions/${e}/logout`,method:"POST",secure:!0,format:"json",...t}),this.sessionsControllerRestart=(e,t={})=>this.request({path:`/api/sessions/${e}/restart`,method:"POST",secure:!0,format:"json",...t}),this.sessionsControllerDepracatedStart=(t,s={})=>this.request({path:"/api/sessions/start",method:"POST",body:t,secure:!0,type:e.Json,format:"json",...s}),this.sessionsControllerDeprecatedStop=(t,s={})=>this.request({path:"/api/sessions/stop",method:"POST",body:t,secure:!0,type:e.Json,...s}),this.sessionsControllerDeprecatedLogout=(t,s={})=>this.request({path:"/api/sessions/logout",method:"POST",body:t,secure:!0,type:e.Json,...s})}}class $ extends s{constructor(){super(...arguments),this.statusControllerSendTextStatus=(t,s,o={})=>this.request({path:`/api/${t}/status/text`,method:"POST",body:s,secure:!0,type:e.Json,...o}),this.statusControllerSendImageStatus=(t,s,o={})=>this.request({path:`/api/${t}/status/image`,method:"POST",body:s,secure:!0,type:e.Json,...o}),this.statusControllerSendVoiceStatus=(t,s,o={})=>this.request({path:`/api/${t}/status/voice`,method:"POST",body:s,secure:!0,type:e.Json,...o}),this.statusControllerSendVideoStatus=(t,s,o={})=>this.request({path:`/api/${t}/status/video`,method:"POST",body:s,secure:!0,type:e.Json,...o}),this.statusControllerDeleteStatus=(t,s,o={})=>this.request({path:`/api/${t}/status/delete`,method:"POST",body:s,secure:!0,type:e.Json,...o}),this.statusControllerGetNewMessageId=(e,t={})=>this.request({path:`/api/${e}/status/new-message-id`,method:"GET",secure:!0,format:"json",...t})}}exports.Apps=o,exports.Auth=r,exports.Calls=a,exports.Channels=h,exports.Chats=i,exports.Chatting=n,exports.Contacts=p,exports.Events=u,exports.Groups=l,exports.HttpClient=s,exports.Labels=c,exports.Media=d,exports.Observability=m,exports.Presence=y,exports.Profile=C,exports.Screenshot=q,exports.Sessions=T,exports.Status=$,exports.WahaClient=class{constructor(e,t){let s;s="string"==typeof e?{baseURL:e,securityWorker:t?()=>({headers:{"X-Api-Key":t}}):void 0}:e,this.apps=new o(s),this.auth=new r(s),this.calls=new a(s),this.channels=new h(s),this.chats=new i(s),this.chatting=new n(s),this.contacts=new p(s),this.events=new u(s),this.groups=new l(s),this.labels=new c(s),this.media=new d(s),this.observability=new m(s),this.presence=new y(s),this.profile=new C(s),this.screenshot=new q(s),this.sessions=new T(s),this.status=new $(s)}};
|
|
2
|
+
//# sourceMappingURL=index.cjs.js.map
|