@mishkat/remnawave-sdk 1.2.2 → 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 +693 -3
- package/dist/config/config.d.ts +15 -3
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/config.js +2 -2
- package/dist/config/config.js.map +1 -1
- package/dist/controllers/external-squads.controller.d.ts +2 -1
- package/dist/controllers/external-squads.controller.d.ts.map +1 -1
- package/dist/controllers/external-squads.controller.js +8 -1
- package/dist/controllers/external-squads.controller.js.map +1 -1
- package/dist/controllers/hwid.controller.d.ts +2 -1
- package/dist/controllers/hwid.controller.d.ts.map +1 -1
- package/dist/controllers/hwid.controller.js +8 -1
- package/dist/controllers/hwid.controller.js.map +1 -1
- package/dist/controllers/index.d.ts +1 -0
- package/dist/controllers/index.d.ts.map +1 -1
- package/dist/controllers/index.js +1 -0
- package/dist/controllers/index.js.map +1 -1
- package/dist/controllers/infra-billing.controller.d.ts +4 -4
- package/dist/controllers/infra-billing.controller.d.ts.map +1 -1
- package/dist/controllers/infra-billing.controller.js +8 -12
- package/dist/controllers/infra-billing.controller.js.map +1 -1
- package/dist/controllers/internal-squads.controller.d.ts +2 -1
- package/dist/controllers/internal-squads.controller.d.ts.map +1 -1
- package/dist/controllers/internal-squads.controller.js +8 -1
- package/dist/controllers/internal-squads.controller.js.map +1 -1
- package/dist/controllers/nodes.controller.d.ts +5 -4
- package/dist/controllers/nodes.controller.d.ts.map +1 -1
- package/dist/controllers/nodes.controller.js +14 -7
- package/dist/controllers/nodes.controller.js.map +1 -1
- package/dist/controllers/subscription-page-configs.controller.d.ts +14 -0
- package/dist/controllers/subscription-page-configs.controller.d.ts.map +1 -0
- package/dist/controllers/subscription-page-configs.controller.js +53 -0
- package/dist/controllers/subscription-page-configs.controller.js.map +1 -0
- package/dist/controllers/subscription-template.controller.d.ts +5 -1
- package/dist/controllers/subscription-template.controller.d.ts.map +1 -1
- package/dist/controllers/subscription-template.controller.js +27 -1
- package/dist/controllers/subscription-template.controller.js.map +1 -1
- package/dist/controllers/subscriptions.controller.d.ts +3 -1
- package/dist/controllers/subscriptions.controller.d.ts.map +1 -1
- package/dist/controllers/subscriptions.controller.js +13 -1
- package/dist/controllers/subscriptions.controller.js.map +1 -1
- package/dist/controllers/system.controller.d.ts +3 -1
- package/dist/controllers/system.controller.d.ts.map +1 -1
- package/dist/controllers/system.controller.js +14 -1
- package/dist/controllers/system.controller.js.map +1 -1
- package/dist/controllers/user.controller.d.ts +3 -2
- package/dist/controllers/user.controller.d.ts.map +1 -1
- package/dist/controllers/user.controller.js +14 -8
- package/dist/controllers/user.controller.js.map +1 -1
- package/dist/remnawave.sdk.d.ts +2 -1
- package/dist/remnawave.sdk.d.ts.map +1 -1
- package/dist/remnawave.sdk.js +2 -1
- package/dist/remnawave.sdk.js.map +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -1,18 +1,708 @@
|
|
|
1
1
|
# Remnawave SDK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<div align="center">
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.org/package/@mishkat/remnawave-sdk)
|
|
6
|
+
[](https://www.npmjs.org/package/@mishkat/remnawave-sdk)
|
|
7
|
+
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## 📦 Installation
|
|
13
|
+
|
|
14
|
+
Choose your preferred package manager:
|
|
15
|
+
|
|
16
|
+
### bun
|
|
4
17
|
|
|
5
18
|
```bash
|
|
6
19
|
bun install @mishkat/remnawave-sdk
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### npm
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install @mishkat/remnawave-sdk
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### yarn
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
yarn add @mishkat/remnawave-sdk
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### pnpm
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pnpm add @mishkat/remnawave-sdk
|
|
41
|
+
|
|
7
42
|
```
|
|
8
43
|
|
|
9
|
-
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## 🚀 Quick Start
|
|
10
47
|
|
|
11
48
|
```typescript
|
|
12
49
|
import { RemnawaveSDK } from "@mishkat/remnawave-sdk";
|
|
13
50
|
|
|
14
51
|
const client = new RemnawaveSDK({
|
|
15
|
-
panelUrl: 'https://remna.st',
|
|
52
|
+
panelUrl: 'https://remna.st', // or 'http://remnawave:3000' for docker network
|
|
16
53
|
apiKey: "your-api-key",
|
|
54
|
+
|
|
55
|
+
// For Caddy reverse proxy authentication (Optional)
|
|
56
|
+
caddyAuthToken: "your-caddy-token",
|
|
57
|
+
|
|
58
|
+
// For Cloudflare Zero Trust (Optional)
|
|
59
|
+
cloudflareZeroTrustClientId: "your-cf-client-id",
|
|
60
|
+
cloudflareZeroTrustClientSecret: "your-cf-client-secret",
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## 📚 Usage Examples
|
|
68
|
+
|
|
69
|
+
### 🔐 Auth Controller
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
// Login
|
|
73
|
+
const loginResult = await client.auth.login({
|
|
74
|
+
username: "user@example.com",
|
|
75
|
+
password: "password123"
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
// Register
|
|
79
|
+
const registerResult = await client.auth.register({
|
|
80
|
+
username: "newuser",
|
|
81
|
+
email: "user@example.com",
|
|
82
|
+
password: "password123"
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
// Get Status
|
|
86
|
+
const status = await client.auth.getStatus();
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
### 👥 User Controller
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
95
|
+
// Create User
|
|
96
|
+
const user = await client.users.create({
|
|
97
|
+
username: "newuser",
|
|
98
|
+
email: "user@example.com",
|
|
99
|
+
// ... other fields
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
// Get All Users
|
|
103
|
+
const users = await client.users.getAll({ start: 0, size: 25 });
|
|
104
|
+
|
|
105
|
+
// Get User by UUID
|
|
106
|
+
const userByUuid = await client.users.getByUuid("user-uuid");
|
|
107
|
+
|
|
108
|
+
// Get User by Username
|
|
109
|
+
const userByUsername = await client.users.getByUsername("username");
|
|
110
|
+
|
|
111
|
+
// Get User by Email
|
|
112
|
+
const userByEmail = await client.users.getByEmail("user@example.com");
|
|
113
|
+
|
|
114
|
+
// Get User by Telegram ID
|
|
115
|
+
const userByTelegram = await client.users.getByTelegramId("123456789");
|
|
116
|
+
|
|
117
|
+
// Get User by Short UUID
|
|
118
|
+
const userByShortUuid = await client.users.getByShortUuid("short-uuid");
|
|
119
|
+
|
|
120
|
+
// Get User by Tag
|
|
121
|
+
const userByTag = await client.users.getByTag("premium");
|
|
122
|
+
|
|
123
|
+
// Update User
|
|
124
|
+
const updated = await client.users.updateByUuidOrUsername({
|
|
125
|
+
uuid: "user-uuid",
|
|
126
|
+
email: "newemail@example.com"
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
// Delete User
|
|
130
|
+
await client.users.delete("user-uuid");
|
|
131
|
+
|
|
132
|
+
// Enable User
|
|
133
|
+
await client.users.enable("user-uuid");
|
|
134
|
+
|
|
135
|
+
// Disable User
|
|
136
|
+
await client.users.disable("user-uuid");
|
|
137
|
+
|
|
138
|
+
// Reset User Traffic
|
|
139
|
+
await client.users.resetTraffic("user-uuid");
|
|
140
|
+
|
|
141
|
+
// Revoke User Subscription
|
|
142
|
+
await client.users.revoke("user-uuid");
|
|
143
|
+
|
|
144
|
+
// Get All Tags
|
|
145
|
+
const tags = await client.users.getAllExistingTags();
|
|
146
|
+
|
|
147
|
+
// Get User Accessible Nodes
|
|
148
|
+
const nodes = await client.users.getUserAccessibleNodes("user-uuid");
|
|
149
|
+
|
|
150
|
+
// Get Subscription Request History
|
|
151
|
+
const history = await client.users.getSubscriptionRequestHistory("user-uuid");
|
|
152
|
+
|
|
153
|
+
// Get User Usage by Range
|
|
154
|
+
const usage = await client.users.getUserUsageByRange("user-uuid", {
|
|
155
|
+
startDate: "2024-01-01",
|
|
156
|
+
endDate: "2024-01-31"
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
// Bulk Delete Users
|
|
160
|
+
await client.users.bulkDelete({
|
|
161
|
+
uuids: ["uuid1", "uuid2", "uuid3"]
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
// Bulk Delete Users by Status
|
|
165
|
+
await client.users.bulkDeleteByStatus({
|
|
166
|
+
status: "disabled"
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
// Bulk Reset Traffic
|
|
170
|
+
await client.users.bulkResetTraffic({
|
|
171
|
+
uuids: ["uuid1", "uuid2"]
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
// Bulk Revoke Subscription
|
|
175
|
+
await client.users.bulkRevokeSubscription({
|
|
176
|
+
uuids: ["uuid1", "uuid2"]
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
// Bulk Update Users
|
|
180
|
+
await client.users.bulkUpdate({
|
|
181
|
+
uuids: ["uuid1", "uuid2"],
|
|
182
|
+
updateData: {
|
|
183
|
+
tag: "premium"
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
// Bulk Update Squads
|
|
188
|
+
await client.users.bulkUpdateSquads({
|
|
189
|
+
uuids: ["uuid1", "uuid2"],
|
|
190
|
+
squadUuids: ["squad-uuid1", "squad-uuid2"]
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
// Bulk All Reset Traffic
|
|
194
|
+
await client.users.bulkAllResetTraffic();
|
|
195
|
+
|
|
196
|
+
// Bulk All Update
|
|
197
|
+
await client.users.bulkAllUpdate({
|
|
198
|
+
updateData: {
|
|
199
|
+
tag: "standard"
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
### 🖥️ Nodes Controller
|
|
208
|
+
|
|
209
|
+
```typescript
|
|
210
|
+
// Create Node
|
|
211
|
+
const node = await client.nodes.create({
|
|
212
|
+
name: "Node 1",
|
|
213
|
+
host: "node.example.com",
|
|
214
|
+
port: 443
|
|
215
|
+
// ... other fields
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
// Get All Nodes
|
|
219
|
+
const nodes = await client.nodes.getAll();
|
|
220
|
+
|
|
221
|
+
// Get One Node
|
|
222
|
+
const node = await client.nodes.getOne("node-uuid");
|
|
223
|
+
|
|
224
|
+
// Update Node
|
|
225
|
+
const updated = await client.nodes.update({
|
|
226
|
+
uuid: "node-uuid",
|
|
227
|
+
name: "Updated Node Name"
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
// Delete Node
|
|
231
|
+
await client.nodes.delete("node-uuid");
|
|
232
|
+
|
|
233
|
+
// Enable Node
|
|
234
|
+
await client.nodes.enable("node-uuid");
|
|
235
|
+
|
|
236
|
+
// Disable Node
|
|
237
|
+
await client.nodes.disable("node-uuid");
|
|
238
|
+
|
|
239
|
+
// Restart Node
|
|
240
|
+
await client.nodes.restart("node-uuid");
|
|
241
|
+
|
|
242
|
+
// Restart All Nodes
|
|
243
|
+
await client.nodes.restartAll();
|
|
244
|
+
|
|
245
|
+
// Reorder Nodes
|
|
246
|
+
await client.nodes.reorder({
|
|
247
|
+
uuids: ["uuid1", "uuid2", "uuid3"]
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
// Reset Node Traffic
|
|
251
|
+
await client.nodes.resetTraffic("node-uuid");
|
|
252
|
+
|
|
253
|
+
// Get Realtime Usage
|
|
254
|
+
const realtimeUsage = await client.nodes.getRealtimeUsage();
|
|
255
|
+
|
|
256
|
+
// Get Usage by Range
|
|
257
|
+
const usage = await client.nodes.getUsageByRange({
|
|
258
|
+
startDate: "2024-01-01",
|
|
259
|
+
endDate: "2024-01-31"
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
// Get Node User Usage by Range
|
|
263
|
+
const nodeUsage = await client.nodes.getNodeUserUsageByRange("node-uuid", {
|
|
264
|
+
startDate: "2024-01-01",
|
|
265
|
+
endDate: "2024-01-31"
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
---
|
|
271
|
+
|
|
272
|
+
### 🌐 Hosts Controller
|
|
273
|
+
|
|
274
|
+
```typescript
|
|
275
|
+
// Create Host
|
|
276
|
+
const host = await client.hosts.create({
|
|
277
|
+
name: "Host 1",
|
|
278
|
+
address: "host.example.com"
|
|
279
|
+
// ... other fields
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
// Get All Hosts
|
|
283
|
+
const hosts = await client.hosts.getAll();
|
|
284
|
+
|
|
285
|
+
// Get Host by UUID
|
|
286
|
+
const host = await client.hosts.getByUuid("host-uuid");
|
|
287
|
+
|
|
288
|
+
// Update Host
|
|
289
|
+
const updated = await client.hosts.update({
|
|
290
|
+
uuid: "host-uuid",
|
|
291
|
+
name: "Updated Host Name"
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
// Delete Host
|
|
295
|
+
await client.hosts.delete("host-uuid");
|
|
296
|
+
|
|
297
|
+
// Reorder Hosts
|
|
298
|
+
await client.hosts.reorder({
|
|
299
|
+
uuids: ["uuid1", "uuid2", "uuid3"]
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
// Get All Tags
|
|
303
|
+
const tags = await client.hosts.getAllTags();
|
|
304
|
+
|
|
305
|
+
// Bulk Delete Hosts
|
|
306
|
+
await client.hosts.deleteMany({
|
|
307
|
+
uuids: ["uuid1", "uuid2", "uuid3"]
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
// Bulk Enable Hosts
|
|
311
|
+
await client.hosts.enableMany({
|
|
312
|
+
uuids: ["uuid1", "uuid2"]
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
// Bulk Disable Hosts
|
|
316
|
+
await client.hosts.disableMany({
|
|
317
|
+
uuids: ["uuid1", "uuid2"]
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
// Set Inbound to Many Hosts
|
|
321
|
+
await client.hosts.setInboundToMany({
|
|
322
|
+
uuids: ["uuid1", "uuid2"],
|
|
323
|
+
inboundUuid: "inbound-uuid"
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
// Set Port to Many Hosts
|
|
327
|
+
await client.hosts.setPortToMany({
|
|
328
|
+
uuids: ["uuid1", "uuid2"],
|
|
329
|
+
port: 443
|
|
330
|
+
});
|
|
331
|
+
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
---
|
|
335
|
+
|
|
336
|
+
### ⚙️ System Controller
|
|
337
|
+
|
|
338
|
+
```typescript
|
|
339
|
+
// Get Stats
|
|
340
|
+
const stats = await client.system.getStats();
|
|
341
|
+
|
|
342
|
+
// Get Bandwidth Stats
|
|
343
|
+
const bandwidth = await client.system.getBandwidthStats();
|
|
344
|
+
|
|
345
|
+
// Get Nodes Metrics
|
|
346
|
+
const metrics = await client.system.getNodesMetrics();
|
|
347
|
+
|
|
348
|
+
// Get Nodes Statistics
|
|
349
|
+
const statistics = await client.system.getNodesStatistics();
|
|
350
|
+
|
|
351
|
+
// Get Remnawave Health
|
|
352
|
+
const health = await client.system.getRemnawaveHealth();
|
|
353
|
+
|
|
354
|
+
// Generate X25519
|
|
355
|
+
const keys = await client.system.generateX25519();
|
|
356
|
+
|
|
357
|
+
// Encrypt Happ Crypto Link
|
|
358
|
+
const encrypted = await client.system.encryptHappCryptoLink({
|
|
359
|
+
data: "data-to-encrypt"
|
|
360
|
+
});
|
|
361
|
+
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
---
|
|
365
|
+
|
|
366
|
+
### 📋 Subscription Controller
|
|
367
|
+
|
|
368
|
+
```typescript
|
|
369
|
+
// Get Subscription Info by Short UUID
|
|
370
|
+
const subscription = await client.subscription.getInfoByShortUuid("short-uuid");
|
|
371
|
+
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
---
|
|
375
|
+
|
|
376
|
+
### 📊 Subscriptions Controller
|
|
377
|
+
|
|
378
|
+
```typescript
|
|
379
|
+
// Get All Subscriptions
|
|
380
|
+
const subscriptions = await client.subscriptions.getAll({
|
|
381
|
+
start: 0,
|
|
382
|
+
size: 25
|
|
383
|
+
});
|
|
384
|
+
|
|
385
|
+
// Get Subscription by UUID
|
|
386
|
+
const subscription = await client.subscriptions.getByUuid("subscription-uuid");
|
|
387
|
+
|
|
388
|
+
// Get Subscription by Username
|
|
389
|
+
const subscription = await client.subscriptions.getByUsername("username");
|
|
390
|
+
|
|
391
|
+
// Get Subscription by Short UUID Protected
|
|
392
|
+
const subscription = await client.subscriptions.getByShortUuidProtected("short-uuid");
|
|
393
|
+
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
---
|
|
397
|
+
|
|
398
|
+
### 👨👩👧👦 Internal Squads Controller
|
|
399
|
+
|
|
400
|
+
```typescript
|
|
401
|
+
// Create Internal Squad
|
|
402
|
+
const squad = await client.internalSquads.create({
|
|
403
|
+
name: "Premium Squad",
|
|
404
|
+
// ... other fields
|
|
405
|
+
});
|
|
406
|
+
|
|
407
|
+
// Get All Internal Squads
|
|
408
|
+
const squads = await client.internalSquads.getAll();
|
|
409
|
+
|
|
410
|
+
// Get Internal Squad by UUID
|
|
411
|
+
const squad = await client.internalSquads.getByUuid("squad-uuid");
|
|
412
|
+
|
|
413
|
+
// Update Internal Squad
|
|
414
|
+
const updated = await client.internalSquads.update({
|
|
415
|
+
uuid: "squad-uuid",
|
|
416
|
+
name: "Updated Squad Name"
|
|
417
|
+
});
|
|
418
|
+
|
|
419
|
+
// Delete Internal Squad
|
|
420
|
+
await client.internalSquads.delete("squad-uuid");
|
|
421
|
+
|
|
422
|
+
// Get Accessible Nodes
|
|
423
|
+
const nodes = await client.internalSquads.getAccessibleNodes("squad-uuid");
|
|
424
|
+
|
|
425
|
+
// Add Users
|
|
426
|
+
await client.internalSquads.addUsers("squad-uuid");
|
|
427
|
+
|
|
428
|
+
// Delete Users
|
|
429
|
+
await client.internalSquads.deleteUsers("squad-uuid");
|
|
430
|
+
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
---
|
|
434
|
+
|
|
435
|
+
### 🌍 External Squads Controller
|
|
436
|
+
|
|
437
|
+
```typescript
|
|
438
|
+
// Get All External Squads
|
|
439
|
+
const squads = await client.externalSquads.getAll();
|
|
440
|
+
|
|
441
|
+
// Get External Squad by UUID
|
|
442
|
+
const squad = await client.externalSquads.getByUuid("squad-uuid");
|
|
443
|
+
|
|
444
|
+
// Create External Squad
|
|
445
|
+
const squad = await client.externalSquads.create({
|
|
446
|
+
name: "External Squad",
|
|
447
|
+
// ... other fields
|
|
448
|
+
});
|
|
449
|
+
|
|
450
|
+
// Update External Squad
|
|
451
|
+
const updated = await client.externalSquads.update({
|
|
452
|
+
uuid: "squad-uuid",
|
|
453
|
+
name: "Updated Squad Name"
|
|
454
|
+
});
|
|
455
|
+
|
|
456
|
+
// Delete External Squad
|
|
457
|
+
await client.externalSquads.delete("squad-uuid");
|
|
458
|
+
|
|
459
|
+
// Add Users
|
|
460
|
+
await client.externalSquads.addUsers("squad-uuid");
|
|
461
|
+
|
|
462
|
+
// Remove Users
|
|
463
|
+
await client.externalSquads.removeUsers("squad-uuid");
|
|
464
|
+
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
---
|
|
468
|
+
|
|
469
|
+
### ⚙️ Config Profiles Controller
|
|
470
|
+
|
|
471
|
+
```typescript
|
|
472
|
+
// Create Config Profile
|
|
473
|
+
const profile = await client.configProfiles.create({
|
|
474
|
+
name: "Profile 1",
|
|
475
|
+
// ... other fields
|
|
476
|
+
});
|
|
477
|
+
|
|
478
|
+
// Get All Config Profiles
|
|
479
|
+
const profiles = await client.configProfiles.getAll();
|
|
480
|
+
|
|
481
|
+
// Get Config Profile by UUID
|
|
482
|
+
const profile = await client.configProfiles.getByUuid({ uuid: "profile-uuid" });
|
|
483
|
+
|
|
484
|
+
// Update Config Profile
|
|
485
|
+
const updated = await client.configProfiles.update({
|
|
486
|
+
uuid: "profile-uuid",
|
|
487
|
+
name: "Updated Profile Name"
|
|
488
|
+
});
|
|
489
|
+
|
|
490
|
+
// Delete Config Profile
|
|
491
|
+
await client.configProfiles.delete({ uuid: "profile-uuid" });
|
|
492
|
+
|
|
493
|
+
// Get Computed Config Profile
|
|
494
|
+
const computed = await client.configProfiles.getComputedByProfileUuid("profile-uuid");
|
|
495
|
+
|
|
496
|
+
// Get All Inbounds
|
|
497
|
+
const inbounds = await client.configProfiles.getAllInbounds();
|
|
498
|
+
|
|
499
|
+
// Get Inbounds by Profile UUID
|
|
500
|
+
const inbounds = await client.configProfiles.getInboundsByProfileUuid({ uuid: "profile-uuid" });
|
|
501
|
+
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
---
|
|
505
|
+
|
|
506
|
+
### 🔑 Keygen Controller
|
|
507
|
+
|
|
508
|
+
```typescript
|
|
509
|
+
// Get Public Key
|
|
510
|
+
const pubkey = await client.keygen.getPubkey();
|
|
511
|
+
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
---
|
|
515
|
+
|
|
516
|
+
### 📝 Snippets Controller
|
|
517
|
+
|
|
518
|
+
```typescript
|
|
519
|
+
// Get All Snippets
|
|
520
|
+
const snippets = await client.snippets.getAll();
|
|
521
|
+
|
|
522
|
+
// Create Snippet
|
|
523
|
+
const snippet = await client.snippets.create({
|
|
524
|
+
name: "My Snippet",
|
|
525
|
+
content: "snippet content"
|
|
526
|
+
// ... other fields
|
|
527
|
+
});
|
|
528
|
+
|
|
529
|
+
// Update Snippet
|
|
530
|
+
const updated = await client.snippets.update({
|
|
531
|
+
uuid: "snippet-uuid",
|
|
532
|
+
content: "updated content"
|
|
533
|
+
});
|
|
534
|
+
|
|
535
|
+
// Delete Snippet
|
|
536
|
+
await client.snippets.delete({ uuid: "snippet-uuid" });
|
|
537
|
+
|
|
538
|
+
```
|
|
539
|
+
|
|
540
|
+
---
|
|
541
|
+
|
|
542
|
+
### 🖥️ HWID Controller
|
|
543
|
+
|
|
544
|
+
```typescript
|
|
545
|
+
// Create HWID Device
|
|
546
|
+
const device = await client.hwid.create({
|
|
547
|
+
userUuid: "user-uuid",
|
|
548
|
+
hwid: "device-hwid"
|
|
549
|
+
// ... other fields
|
|
550
|
+
});
|
|
551
|
+
|
|
552
|
+
// Get All HWID Devices
|
|
553
|
+
const devices = await client.hwid.getAll({ start: 0, size: 25 });
|
|
554
|
+
|
|
555
|
+
// Get HWID Devices by User
|
|
556
|
+
const devices = await client.hwid.getByUser({ userUuid: "user-uuid" });
|
|
557
|
+
|
|
558
|
+
// Delete HWID Device
|
|
559
|
+
await client.hwid.delete({ uuid: "device-uuid" });
|
|
560
|
+
|
|
561
|
+
// Delete All User HWID Devices
|
|
562
|
+
await client.hwid.deleteAllByUser({ userUuid: "user-uuid" });
|
|
563
|
+
|
|
564
|
+
// Get HWID Stats
|
|
565
|
+
const stats = await client.hwid.getStats();
|
|
566
|
+
|
|
567
|
+
```
|
|
568
|
+
|
|
569
|
+
---
|
|
570
|
+
|
|
571
|
+
### 📄 Subscription Template Controller
|
|
572
|
+
|
|
573
|
+
```typescript
|
|
574
|
+
// Get Subscription Template
|
|
575
|
+
const template = await client.subscriptionTemplate.getTemplate("template-uuid");
|
|
576
|
+
|
|
577
|
+
// Update Subscription Template
|
|
578
|
+
const updated = await client.subscriptionTemplate.updateTemplate({
|
|
579
|
+
uuid: "template-uuid",
|
|
580
|
+
// ... fields to update
|
|
581
|
+
});
|
|
582
|
+
|
|
583
|
+
```
|
|
584
|
+
|
|
585
|
+
---
|
|
586
|
+
|
|
587
|
+
### ⚙️ Subscription Settings Controller
|
|
588
|
+
|
|
589
|
+
```typescript
|
|
590
|
+
// Get Subscription Settings
|
|
591
|
+
const settings = await client.subscriptionSettings.getSettings();
|
|
592
|
+
|
|
593
|
+
// Update Subscription Settings
|
|
594
|
+
const updated = await client.subscriptionSettings.updateSettings({
|
|
595
|
+
// ... fields to update
|
|
596
|
+
});
|
|
597
|
+
|
|
598
|
+
```
|
|
599
|
+
|
|
600
|
+
---
|
|
601
|
+
|
|
602
|
+
### 📜 Subscription Request History Controller
|
|
603
|
+
|
|
604
|
+
```typescript
|
|
605
|
+
// Get Subscription Request History
|
|
606
|
+
const history = await client.subscriptionRequestHistory.getHistory({
|
|
607
|
+
start: 0,
|
|
608
|
+
size: 25
|
|
609
|
+
});
|
|
610
|
+
|
|
611
|
+
// Get Subscription Request History Stats
|
|
612
|
+
const stats = await client.subscriptionRequestHistory.getStats();
|
|
613
|
+
|
|
614
|
+
```
|
|
615
|
+
|
|
616
|
+
---
|
|
617
|
+
|
|
618
|
+
### 💰 Infra Billing Controller
|
|
619
|
+
|
|
620
|
+
```typescript
|
|
621
|
+
// Create Infra Provider
|
|
622
|
+
const provider = await client.infraBilling.createProvider({
|
|
623
|
+
name: "Provider 1",
|
|
624
|
+
// ... other fields
|
|
625
|
+
});
|
|
626
|
+
|
|
627
|
+
// Get All Infra Providers
|
|
628
|
+
const providers = await client.infraBilling.getProviders();
|
|
629
|
+
|
|
630
|
+
// Get Infra Provider by UUID
|
|
631
|
+
const provider = await client.infraBilling.getProviderByUuid({ uuid: "provider-uuid" });
|
|
632
|
+
|
|
633
|
+
// Update Infra Provider
|
|
634
|
+
const updated = await client.infraBilling.updateProvider({
|
|
635
|
+
uuid: "provider-uuid",
|
|
636
|
+
name: "Updated Provider Name"
|
|
637
|
+
});
|
|
638
|
+
|
|
639
|
+
// Delete Infra Provider
|
|
640
|
+
await client.infraBilling.deleteProvider({ uuid: "provider-uuid" });
|
|
641
|
+
|
|
642
|
+
// Create Billing Node
|
|
643
|
+
const node = await client.infraBilling.createBillingNode({
|
|
644
|
+
name: "Billing Node 1",
|
|
645
|
+
providerUuid: "provider-uuid"
|
|
646
|
+
// ... other fields
|
|
647
|
+
});
|
|
648
|
+
|
|
649
|
+
// Get All Billing Nodes
|
|
650
|
+
const nodes = await client.infraBilling.getBillingNodes();
|
|
651
|
+
|
|
652
|
+
// Update Billing Node
|
|
653
|
+
const updated = await client.infraBilling.updateBillingNode({
|
|
654
|
+
uuid: "node-uuid",
|
|
655
|
+
name: "Updated Node Name"
|
|
656
|
+
});
|
|
657
|
+
|
|
658
|
+
// Delete Billing Node
|
|
659
|
+
await client.infraBilling.deleteBillingNode({ uuid: "node-uuid" });
|
|
660
|
+
|
|
661
|
+
// Create Bill Record
|
|
662
|
+
const record = await client.infraBilling.createBillRecord({
|
|
663
|
+
nodeUuid: "node-uuid",
|
|
664
|
+
amount: 100.50,
|
|
665
|
+
date: "2024-01-01"
|
|
666
|
+
// ... other fields
|
|
17
667
|
});
|
|
668
|
+
|
|
669
|
+
// Get Bill Records
|
|
670
|
+
const records = await client.infraBilling.getBillRecords({
|
|
671
|
+
start: 0,
|
|
672
|
+
size: 25
|
|
673
|
+
});
|
|
674
|
+
|
|
675
|
+
// Delete Bill Record
|
|
676
|
+
await client.infraBilling.deleteBillRecord({ uuid: "record-uuid" });
|
|
677
|
+
|
|
678
|
+
```
|
|
679
|
+
|
|
680
|
+
---
|
|
681
|
+
|
|
682
|
+
## 🔧 Error Handling
|
|
683
|
+
|
|
684
|
+
```typescript
|
|
685
|
+
try {
|
|
686
|
+
const user = await client.users.getByUuid("user-uuid");
|
|
687
|
+
console.log(user);
|
|
688
|
+
} catch (error) {
|
|
689
|
+
if (error instanceof Error) {
|
|
690
|
+
console.error("API Error:", error.message);
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
|
|
18
694
|
```
|
|
695
|
+
|
|
696
|
+
---
|
|
697
|
+
|
|
698
|
+
## 🔗 Links
|
|
699
|
+
|
|
700
|
+
* **GitHub**: [mishkatik/remnawave-sdk](https://github.com/mishkatik/remnawave-sdk)
|
|
701
|
+
* **Issues**: [GitHub Issues](https://github.com/mishkatik/remnawave-sdk/issues)
|
|
702
|
+
* **NPM**: [@mishkat/remnawave-sdk](https://www.npmjs.org/package/@mishkat/remnawave-sdk)
|
|
703
|
+
|
|
704
|
+
---
|
|
705
|
+
|
|
706
|
+
## 👨💻 Author
|
|
707
|
+
|
|
708
|
+
**Mishkat** - [GitHub](https://github.com/mishkatik)
|