plugnmeet-sdk-js 1.2.6 → 1.3.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/README.md +18 -14
- package/dist/{PlugNmeet.cjs → PlugNmeet.cjs.js} +131 -66
- package/dist/PlugNmeet.cjs.js.map +1 -0
- package/dist/PlugNmeet.js +130 -65
- package/dist/PlugNmeet.js.map +1 -1
- package/dist/{PlugNmeet.mjs → PlugNmeet.mjs.js} +129 -66
- package/dist/PlugNmeet.mjs.js.map +1 -0
- package/dist/index.d.ts +200 -13
- package/dist/index.d.ts.map +1 -1
- package/package.json +18 -17
- package/dist/PlugNmeet.cjs.map +0 -1
- package/dist/PlugNmeet.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ npm install plugnmeet-sdk-js
|
|
|
12
12
|
|
|
13
13
|
**Import**
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
CommonJS:
|
|
16
16
|
|
|
17
17
|
```js
|
|
18
18
|
const plugNmeet = require('plugnmeet-sdk-js').PlugNmeet;
|
|
@@ -25,7 +25,7 @@ const pnm = new plugNmeet(
|
|
|
25
25
|
);
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
TypeScript:
|
|
28
|
+
ES Modules/TypeScript:
|
|
29
29
|
|
|
30
30
|
```js
|
|
31
31
|
import { PlugNmeet } from 'plugnmeet-sdk-js';
|
|
@@ -41,15 +41,19 @@ Please check `examples` directory to see some examples.
|
|
|
41
41
|
|
|
42
42
|
## Methods/API
|
|
43
43
|
|
|
44
|
-
| Methods | Description
|
|
45
|
-
| ---------------------------------------------------------------------------------------------------------------------------
|
|
46
|
-
| [createRoom](https://mynaparrot.github.io/plugNmeet-sdk-js/classes/PlugNmeet.html#createRoom) | To create new room
|
|
47
|
-
| [getJoinToken](https://mynaparrot.github.io/plugNmeet-sdk-js/classes/PlugNmeet.html#getJoinToken) | Generate join token
|
|
48
|
-
| [isRoomActive](https://mynaparrot.github.io/plugNmeet-sdk-js/classes/PlugNmeet.html#isRoomActive) | To check if room is active or not
|
|
49
|
-
| [getActiveRoomInfo](https://mynaparrot.github.io/plugNmeet-sdk-js/classes/PlugNmeet.html#getActiveRoomInfo) | Get active room information
|
|
50
|
-
| [getActiveRoomsInfo](https://mynaparrot.github.io/plugNmeet-sdk-js/classes/PlugNmeet.html#getActiveRoomsInfo) | Get all active rooms
|
|
51
|
-
| [
|
|
52
|
-
| [
|
|
53
|
-
| [
|
|
54
|
-
| [
|
|
55
|
-
| [
|
|
44
|
+
| Methods | Description |
|
|
45
|
+
| --------------------------------------------------------------------------------------------------------------------------- |-------------------------------------------|
|
|
46
|
+
| [createRoom](https://mynaparrot.github.io/plugNmeet-sdk-js/classes/PlugNmeet.html#createRoom) | To create new room |
|
|
47
|
+
| [getJoinToken](https://mynaparrot.github.io/plugNmeet-sdk-js/classes/PlugNmeet.html#getJoinToken) | Generate join token |
|
|
48
|
+
| [isRoomActive](https://mynaparrot.github.io/plugNmeet-sdk-js/classes/PlugNmeet.html#isRoomActive) | To check if room is active or not |
|
|
49
|
+
| [getActiveRoomInfo](https://mynaparrot.github.io/plugNmeet-sdk-js/classes/PlugNmeet.html#getActiveRoomInfo) | Get active room information |
|
|
50
|
+
| [getActiveRoomsInfo](https://mynaparrot.github.io/plugNmeet-sdk-js/classes/PlugNmeet.html#getActiveRoomsInfo) | Get all active rooms |
|
|
51
|
+
| [fetchPastRoomsInfo](https://mynaparrot.github.io/plugNmeet-sdk-js/classes/PlugNmeet.html#fetchPastRoomsInfo) | Get past rooms information |
|
|
52
|
+
| [endRoom](https://mynaparrot.github.io/plugNmeet-sdk-js/classes/PlugNmeet.html#endRoom) | End active room |
|
|
53
|
+
| [fetchAnalytics](https://mynaparrot.github.io/plugNmeet-sdk-js/classes/PlugNmeet.html#fetchAnalytics) | Fetch analytics |
|
|
54
|
+
| [deleteAnalytics](https://mynaparrot.github.io/plugNmeet-sdk-js/classes/PlugNmeet.html#deleteAnalytics) | Delete analytics |
|
|
55
|
+
| [getAnalyticsDownloadToken](https://mynaparrot.github.io/plugNmeet-sdk-js/classes/PlugNmeet.html#getAnalyticsDownloadToken) | Generate token to download analytics data |
|
|
56
|
+
| [fetchRecordings](https://mynaparrot.github.io/plugNmeet-sdk-js/classes/PlugNmeet.html#fetchRecordings) | Fetch recordings |
|
|
57
|
+
| [deleteRecordings](https://mynaparrot.github.io/plugNmeet-sdk-js/classes/PlugNmeet.html#deleteRecordings) | Delete recording |
|
|
58
|
+
| [getRecordingDownloadToken](https://mynaparrot.github.io/plugNmeet-sdk-js/classes/PlugNmeet.html#getRecordingDownloadToken) | Generate token to download recording |
|
|
59
|
+
| [getClientFiles](https://mynaparrot.github.io/plugNmeet-sdk-js/classes/PlugNmeet.html#getClientFiles) | Get client's files |
|
|
@@ -3,9 +3,11 @@ var $jMCoD$http = require("http");
|
|
|
3
3
|
var $jMCoD$https = require("https");
|
|
4
4
|
var $jMCoD$crypto = require("crypto");
|
|
5
5
|
|
|
6
|
+
|
|
6
7
|
function $parcel$export(e, n, v, s) {
|
|
7
8
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
8
9
|
}
|
|
10
|
+
|
|
9
11
|
function $parcel$interopDefault(a) {
|
|
10
12
|
return a && a.__esModule ? a.default : a;
|
|
11
13
|
}
|
|
@@ -17,9 +19,52 @@ $parcel$export(module.exports, "PlugNmeet", () => $405dcbf07186a1ff$export$1402d
|
|
|
17
19
|
|
|
18
20
|
var $e71a992b229cccd4$require$Buffer = $jMCoD$buffer.Buffer;
|
|
19
21
|
class $e71a992b229cccd4$export$5a82ec1641dd9681 {
|
|
20
|
-
isSecure = false;
|
|
21
|
-
mainOptions = {};
|
|
22
22
|
constructor(apiEndPointURL, apiKey, apiSecret){
|
|
23
|
+
this.isSecure = false;
|
|
24
|
+
this.mainOptions = {};
|
|
25
|
+
this.prepareHeader = (body)=>{
|
|
26
|
+
const signature = (0, $jMCoD$crypto.createHmac)("sha256", this.apiSecret).update(body).digest("hex");
|
|
27
|
+
return {
|
|
28
|
+
"Content-Type": "application/json",
|
|
29
|
+
"API-KEY": this.apiKey,
|
|
30
|
+
"HASH-SIGNATURE": signature
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
this.sendRequest = async (path, body)=>{
|
|
34
|
+
return new Promise((resolve)=>{
|
|
35
|
+
const output = {
|
|
36
|
+
status: false,
|
|
37
|
+
response: undefined
|
|
38
|
+
};
|
|
39
|
+
const chunk = JSON.stringify(body);
|
|
40
|
+
const options = {
|
|
41
|
+
...this.mainOptions
|
|
42
|
+
};
|
|
43
|
+
options.path += path;
|
|
44
|
+
options.headers = this.prepareHeader(chunk);
|
|
45
|
+
const req = (this.isSecure ? (0, ($parcel$interopDefault($jMCoD$https))) : (0, ($parcel$interopDefault($jMCoD$http)))).request(options, (res)=>{
|
|
46
|
+
const body = [];
|
|
47
|
+
res.on("data", (chunk)=>body.push(chunk));
|
|
48
|
+
res.on("end", ()=>{
|
|
49
|
+
const resString = $e71a992b229cccd4$require$Buffer.concat(body).toString();
|
|
50
|
+
try {
|
|
51
|
+
output.status = true;
|
|
52
|
+
output.response = JSON.parse(resString);
|
|
53
|
+
} catch (error) {
|
|
54
|
+
output.status = false;
|
|
55
|
+
output.response = error;
|
|
56
|
+
}
|
|
57
|
+
resolve(output);
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
req.on("error", (error)=>{
|
|
61
|
+
output.response = error.message;
|
|
62
|
+
resolve(output);
|
|
63
|
+
});
|
|
64
|
+
req.write(chunk);
|
|
65
|
+
req.end();
|
|
66
|
+
});
|
|
67
|
+
};
|
|
23
68
|
this.apiEndPointURL = apiEndPointURL;
|
|
24
69
|
this.apiKey = apiKey;
|
|
25
70
|
this.apiSecret = apiSecret;
|
|
@@ -35,65 +80,21 @@ class $e71a992b229cccd4$export$5a82ec1641dd9681 {
|
|
|
35
80
|
port: port
|
|
36
81
|
};
|
|
37
82
|
}
|
|
38
|
-
prepareHeader = (body)=>{
|
|
39
|
-
const signature = (0, $jMCoD$crypto.createHmac)("sha256", this.apiSecret).update(body).digest("hex");
|
|
40
|
-
const headers = {
|
|
41
|
-
"Content-Type": "application/json",
|
|
42
|
-
"API-KEY": this.apiKey,
|
|
43
|
-
"HASH-SIGNATURE": signature
|
|
44
|
-
};
|
|
45
|
-
return headers;
|
|
46
|
-
};
|
|
47
|
-
sendRequest = async (path, body)=>{
|
|
48
|
-
return new Promise((resolve)=>{
|
|
49
|
-
const output = {
|
|
50
|
-
status: false,
|
|
51
|
-
response: undefined
|
|
52
|
-
};
|
|
53
|
-
const chunk = JSON.stringify(body);
|
|
54
|
-
const options = {
|
|
55
|
-
...this.mainOptions
|
|
56
|
-
};
|
|
57
|
-
options.path += path;
|
|
58
|
-
options.headers = this.prepareHeader(chunk);
|
|
59
|
-
const req = (this.isSecure ? (0, ($parcel$interopDefault($jMCoD$https))) : (0, ($parcel$interopDefault($jMCoD$http)))).request(options, (res)=>{
|
|
60
|
-
const body = [];
|
|
61
|
-
res.on("data", (chunk)=>body.push(chunk));
|
|
62
|
-
res.on("end", ()=>{
|
|
63
|
-
const resString = $e71a992b229cccd4$require$Buffer.concat(body).toString();
|
|
64
|
-
try {
|
|
65
|
-
output.status = true;
|
|
66
|
-
output.response = JSON.parse(resString);
|
|
67
|
-
} catch (error) {
|
|
68
|
-
output.status = false;
|
|
69
|
-
output.response = error;
|
|
70
|
-
}
|
|
71
|
-
resolve(output);
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
req.on("error", (error)=>{
|
|
75
|
-
output.response = error.message;
|
|
76
|
-
resolve(output);
|
|
77
|
-
});
|
|
78
|
-
req.write(chunk);
|
|
79
|
-
req.end();
|
|
80
|
-
});
|
|
81
|
-
};
|
|
82
83
|
}
|
|
83
84
|
|
|
84
85
|
|
|
85
86
|
class $405dcbf07186a1ff$export$1402da7f2870faee {
|
|
86
|
-
defaultPath = "/auth";
|
|
87
87
|
/**
|
|
88
88
|
* @param serverUrl plugNmeet server URL
|
|
89
89
|
* @param apiKey plugNmeet API_Key
|
|
90
90
|
* @param apiSecret plugNmeet API_Secret
|
|
91
91
|
*/ constructor(serverUrl, apiKey, apiSecret){
|
|
92
|
+
this.defaultPath = "/auth";
|
|
92
93
|
this.apiTransport = new (0, $e71a992b229cccd4$export$5a82ec1641dd9681)(serverUrl + this.defaultPath, apiKey, apiSecret);
|
|
93
94
|
}
|
|
94
95
|
/**
|
|
95
96
|
* Create new room
|
|
96
|
-
* @param params
|
|
97
|
+
* @param params
|
|
97
98
|
* @returns Promise<CreateRoomResponse>
|
|
98
99
|
*/ async createRoom(params) {
|
|
99
100
|
const output = await this.apiTransport.sendRequest("/room/create", params);
|
|
@@ -109,7 +110,7 @@ class $405dcbf07186a1ff$export$1402da7f2870faee {
|
|
|
109
110
|
}
|
|
110
111
|
/**
|
|
111
112
|
* Generate join token
|
|
112
|
-
* @param params
|
|
113
|
+
* @param params
|
|
113
114
|
* @returns Promise<JoinTokenResponse>
|
|
114
115
|
*/ async getJoinToken(params) {
|
|
115
116
|
const output = await this.apiTransport.sendRequest("/room/getJoinToken", params);
|
|
@@ -125,7 +126,7 @@ class $405dcbf07186a1ff$export$1402da7f2870faee {
|
|
|
125
126
|
}
|
|
126
127
|
/**
|
|
127
128
|
* If room is active or not
|
|
128
|
-
* @param params
|
|
129
|
+
* @param params
|
|
129
130
|
* @returns Promise<IsRoomActiveResponse>
|
|
130
131
|
*/ async isRoomActive(params) {
|
|
131
132
|
const output = await this.apiTransport.sendRequest("/room/isRoomActive", params);
|
|
@@ -140,7 +141,7 @@ class $405dcbf07186a1ff$export$1402da7f2870faee {
|
|
|
140
141
|
}
|
|
141
142
|
/**
|
|
142
143
|
* Get active room information
|
|
143
|
-
* @param params
|
|
144
|
+
* @param params
|
|
144
145
|
* @returns Promise<ActiveRoomInfoResponse>
|
|
145
146
|
*/ async getActiveRoomInfo(params) {
|
|
146
147
|
const output = await this.apiTransport.sendRequest("/room/getActiveRoomInfo", params);
|
|
@@ -170,8 +171,24 @@ class $405dcbf07186a1ff$export$1402da7f2870faee {
|
|
|
170
171
|
};
|
|
171
172
|
}
|
|
172
173
|
/**
|
|
174
|
+
* Fetch info about past rooms
|
|
175
|
+
* @param params
|
|
176
|
+
* @returns Promise<FetchRoomsInfoResponse>
|
|
177
|
+
*/ async fetchPastRoomsInfo(params) {
|
|
178
|
+
const output = await this.apiTransport.sendRequest("/room/fetchPastRooms", params);
|
|
179
|
+
if (!output.status) return {
|
|
180
|
+
status: false,
|
|
181
|
+
msg: output.response
|
|
182
|
+
};
|
|
183
|
+
return {
|
|
184
|
+
status: output.response.status,
|
|
185
|
+
msg: output.response.msg,
|
|
186
|
+
result: output.response.result
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
173
190
|
* End active room
|
|
174
|
-
* @param params
|
|
191
|
+
* @param params
|
|
175
192
|
* @returns Promise<EndRoomResponse>
|
|
176
193
|
*/ async endRoom(params) {
|
|
177
194
|
const output = await this.apiTransport.sendRequest("/room/endRoom", params);
|
|
@@ -185,8 +202,55 @@ class $405dcbf07186a1ff$export$1402da7f2870faee {
|
|
|
185
202
|
};
|
|
186
203
|
}
|
|
187
204
|
/**
|
|
205
|
+
* Fetch analytics
|
|
206
|
+
* @param params
|
|
207
|
+
* @returns Promise<FetchAnalyticsResponse>
|
|
208
|
+
*/ async fetchAnalytics(params) {
|
|
209
|
+
const output = await this.apiTransport.sendRequest("/analytics/fetch", params);
|
|
210
|
+
if (!output.status) return {
|
|
211
|
+
status: false,
|
|
212
|
+
msg: output.response
|
|
213
|
+
};
|
|
214
|
+
return {
|
|
215
|
+
status: output.response.status,
|
|
216
|
+
msg: output.response.msg,
|
|
217
|
+
result: output.response.result
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Delete analytics
|
|
222
|
+
* @param params
|
|
223
|
+
* @returns Promise<DeleteAnalyticsResponse>
|
|
224
|
+
*/ async deleteAnalytics(params) {
|
|
225
|
+
const output = await this.apiTransport.sendRequest("/analytics/delete", params);
|
|
226
|
+
if (!output.status) return {
|
|
227
|
+
status: false,
|
|
228
|
+
msg: output.response
|
|
229
|
+
};
|
|
230
|
+
return {
|
|
231
|
+
status: output.response.status,
|
|
232
|
+
msg: output.response.msg
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Generate token to download recording
|
|
237
|
+
* @param params
|
|
238
|
+
* @returns Promise<AnalyticsDownloadTokenResponse>
|
|
239
|
+
*/ async getAnalyticsDownloadToken(params) {
|
|
240
|
+
const output = await this.apiTransport.sendRequest("/analytics/getDownloadToken", params);
|
|
241
|
+
if (!output.status) return {
|
|
242
|
+
status: false,
|
|
243
|
+
msg: output.response
|
|
244
|
+
};
|
|
245
|
+
return {
|
|
246
|
+
status: output.response.status,
|
|
247
|
+
msg: output.response.msg,
|
|
248
|
+
token: output.response.token
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
188
252
|
* Fetch recordings
|
|
189
|
-
* @param params
|
|
253
|
+
* @param params
|
|
190
254
|
* @returns Promise<FetchRecordingsResponse>
|
|
191
255
|
*/ async fetchRecordings(params) {
|
|
192
256
|
const output = await this.apiTransport.sendRequest("/recording/fetch", params);
|
|
@@ -202,7 +266,7 @@ class $405dcbf07186a1ff$export$1402da7f2870faee {
|
|
|
202
266
|
}
|
|
203
267
|
/**
|
|
204
268
|
* Delete recording
|
|
205
|
-
* @param params
|
|
269
|
+
* @param params
|
|
206
270
|
* @returns Promise<DeleteRecordingsResponse>
|
|
207
271
|
*/ async deleteRecordings(params) {
|
|
208
272
|
const output = await this.apiTransport.sendRequest("/recording/delete", params);
|
|
@@ -216,9 +280,11 @@ class $405dcbf07186a1ff$export$1402da7f2870faee {
|
|
|
216
280
|
};
|
|
217
281
|
}
|
|
218
282
|
/**
|
|
219
|
-
*
|
|
220
|
-
|
|
221
|
-
|
|
283
|
+
* Generate token to download recording
|
|
284
|
+
* @param params
|
|
285
|
+
* @returns Promise<RecordingDownloadTokenResponse>
|
|
286
|
+
*/ async getRecordingDownloadToken(params) {
|
|
287
|
+
const output = await this.apiTransport.sendRequest("/recording/getDownloadToken", params);
|
|
222
288
|
if (!output.status) return {
|
|
223
289
|
status: false,
|
|
224
290
|
msg: output.response
|
|
@@ -226,16 +292,14 @@ class $405dcbf07186a1ff$export$1402da7f2870faee {
|
|
|
226
292
|
return {
|
|
227
293
|
status: output.response.status,
|
|
228
294
|
msg: output.response.msg,
|
|
229
|
-
|
|
230
|
-
js: output.response.js
|
|
295
|
+
token: output.response.token
|
|
231
296
|
};
|
|
232
297
|
}
|
|
233
298
|
/**
|
|
234
|
-
*
|
|
235
|
-
* @
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
const output = await this.apiTransport.sendRequest("/recording/getDownloadToken", params);
|
|
299
|
+
* To get JS & CSS files to build interface
|
|
300
|
+
* @returns Promise<ClientFilesResponse>
|
|
301
|
+
*/ async getClientFiles() {
|
|
302
|
+
const output = await this.apiTransport.sendRequest("/getClientFiles", {});
|
|
239
303
|
if (!output.status) return {
|
|
240
304
|
status: false,
|
|
241
305
|
msg: output.response
|
|
@@ -243,10 +307,11 @@ class $405dcbf07186a1ff$export$1402da7f2870faee {
|
|
|
243
307
|
return {
|
|
244
308
|
status: output.response.status,
|
|
245
309
|
msg: output.response.msg,
|
|
246
|
-
|
|
310
|
+
css: output.response.css,
|
|
311
|
+
js: output.response.js
|
|
247
312
|
};
|
|
248
313
|
}
|
|
249
314
|
}
|
|
250
315
|
|
|
251
316
|
|
|
252
|
-
//# sourceMappingURL=PlugNmeet.cjs.map
|
|
317
|
+
//# sourceMappingURL=PlugNmeet.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;ACSO,MAAM;IAQX,YAAY,cAAsB,EAAE,MAAc,EAAE,SAAiB,CAAE;aAH/D,WAAW;aACX,cAA8B,CAAC;aAwB/B,gBAAgB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CAAC,MAAM;YAC9B,KAAK,OAAO,QAAQ,CAAC,GAAG;YACxB,KAAK,OAAO,QAAQ,CAAC,GAAG;YACxB,IAAI,OAAO,QAAQ,CAAC,EAAE;QACxB;IACF;AACF","sources":["src/PlugNmeet.ts","src/ApiTransport.ts"],"sourcesContent":["import { ApiTransport } from './ApiTransport';\nimport { CreateRoomParams, CreateRoomResponse } from './types/createRoom';\nimport { JoinTokenParams, JoinTokenResponse } from './types/joinToken';\nimport { IsRoomActiveParams, IsRoomActiveResponse } from './types/isRoomActive';\nimport {\n ActiveRoomInfoParams,\n ActiveRoomInfoResponse,\n} from './types/activeRoomInfo';\nimport { ActiveRoomsInfoResponse } from './types/activeRoomsInfo';\nimport { EndRoomParams, EndRoomResponse } from './types/endRoom';\nimport {\n FetchRecordingsParams,\n FetchRecordingsResponse,\n} from './types/fetchRecordings';\nimport {\n DeleteRecordingsParams,\n DeleteRecordingsResponse,\n} from './types/deleteRecordings';\nimport {\n RecordingDownloadTokenParams,\n RecordingDownloadTokenResponse,\n} from './types/recordingDownloadToken';\nimport { ClientFilesResponse } from './types/clientFiles';\nimport {\n FetchRoomsInfoResponse,\n FetchPastRoomsInfoParams,\n} from './types/fetchPastRoomsInfo';\nimport {\n FetchAnalyticsParams,\n FetchAnalyticsResponse,\n} from './types/fetchAnalytics';\nimport {\n DeleteAnalyticsParams,\n DeleteAnalyticsResponse,\n} from './types/deleteAnalytics';\nimport {\n AnalyticsDownloadTokenParams,\n AnalyticsDownloadTokenResponse,\n} from './types/analyticsDownloadToken';\nimport { PlugNmeetAPI } from './types/PlugNmeetAPI';\n\nexport class PlugNmeet implements PlugNmeetAPI {\n protected defaultPath = '/auth';\n private apiTransport: ApiTransport;\n\n /**\n * @param serverUrl plugNmeet server URL\n * @param apiKey plugNmeet API_Key\n * @param apiSecret plugNmeet API_Secret\n */\n constructor(serverUrl: string, apiKey: string, apiSecret: string) {\n this.apiTransport = new ApiTransport(\n serverUrl + this.defaultPath,\n apiKey,\n apiSecret,\n );\n }\n\n /**\n * Create new room\n * @param params\n * @returns Promise<CreateRoomResponse>\n */\n public async createRoom(\n params: CreateRoomParams,\n ): Promise<CreateRoomResponse> {\n const output = await this.apiTransport.sendRequest('/room/create', params);\n if (!output.status) {\n return {\n status: false,\n msg: output.response,\n };\n }\n\n return {\n status: output.response.status,\n msg: output.response.msg,\n roomInfo: output.response.roomInfo,\n };\n }\n\n /**\n * Generate join token\n * @param params\n * @returns Promise<JoinTokenResponse>\n */\n public async getJoinToken(\n params: JoinTokenParams,\n ): Promise<JoinTokenResponse> {\n const output = await this.apiTransport.sendRequest(\n '/room/getJoinToken',\n params,\n );\n if (!output.status) {\n return {\n status: false,\n msg: output.response,\n };\n }\n\n return {\n status: output.response.status,\n msg: output.response.msg,\n token: output.response.token,\n };\n }\n\n /**\n * If room is active or not\n * @param params\n * @returns Promise<IsRoomActiveResponse>\n */\n public async isRoomActive(\n params: IsRoomActiveParams,\n ): Promise<IsRoomActiveResponse> {\n const output = await this.apiTransport.sendRequest(\n '/room/isRoomActive',\n params,\n );\n if (!output.status) {\n return {\n status: false,\n msg: output.response,\n };\n }\n\n return {\n status: output.response.status,\n msg: output.response.msg,\n };\n }\n\n /**\n * Get active room information\n * @param params\n * @returns Promise<ActiveRoomInfoResponse>\n */\n public async getActiveRoomInfo(\n params: ActiveRoomInfoParams,\n ): Promise<ActiveRoomInfoResponse> {\n const output = await this.apiTransport.sendRequest(\n '/room/getActiveRoomInfo',\n params,\n );\n if (!output.status) {\n return {\n status: false,\n msg: output.response,\n };\n }\n\n return {\n status: output.response.status,\n msg: output.response.msg,\n room: output.response.room,\n };\n }\n\n /**\n * Get all active rooms\n * @returns Promise<ActiveRoomsInfoResponse>\n */\n public async getActiveRoomsInfo(): Promise<ActiveRoomsInfoResponse> {\n const output = await this.apiTransport.sendRequest(\n '/room/getActiveRoomsInfo',\n {},\n );\n if (!output.status) {\n return {\n status: false,\n msg: output.response,\n };\n }\n\n return {\n status: output.response.status,\n msg: output.response.msg,\n rooms: output.response.rooms,\n };\n }\n\n /**\n * Fetch info about past rooms\n * @param params\n * @returns Promise<FetchRoomsInfoResponse>\n */\n public async fetchPastRoomsInfo(\n params: FetchPastRoomsInfoParams,\n ): Promise<FetchRoomsInfoResponse> {\n const output = await this.apiTransport.sendRequest(\n '/room/fetchPastRooms',\n params,\n );\n if (!output.status) {\n return {\n status: false,\n msg: output.response,\n };\n }\n\n return {\n status: output.response.status,\n msg: output.response.msg,\n result: output.response.result,\n };\n }\n\n /**\n * End active room\n * @param params\n * @returns Promise<EndRoomResponse>\n */\n public async endRoom(params: EndRoomParams): Promise<EndRoomResponse> {\n const output = await this.apiTransport.sendRequest('/room/endRoom', params);\n if (!output.status) {\n return {\n status: false,\n msg: output.response,\n };\n }\n\n return {\n status: output.response.status,\n msg: output.response.msg,\n };\n }\n\n /**\n * Fetch analytics\n * @param params\n * @returns Promise<FetchAnalyticsResponse>\n */\n public async fetchAnalytics(\n params: FetchAnalyticsParams,\n ): Promise<FetchAnalyticsResponse> {\n const output = await this.apiTransport.sendRequest(\n '/analytics/fetch',\n params,\n );\n if (!output.status) {\n return {\n status: false,\n msg: output.response,\n };\n }\n\n return {\n status: output.response.status,\n msg: output.response.msg,\n result: output.response.result,\n };\n }\n\n /**\n * Delete analytics\n * @param params\n * @returns Promise<DeleteAnalyticsResponse>\n */\n public async deleteAnalytics(\n params: DeleteAnalyticsParams,\n ): Promise<DeleteAnalyticsResponse> {\n const output = await this.apiTransport.sendRequest(\n '/analytics/delete',\n params,\n );\n if (!output.status) {\n return {\n status: false,\n msg: output.response,\n };\n }\n\n return {\n status: output.response.status,\n msg: output.response.msg,\n };\n }\n\n /**\n * Generate token to download recording\n * @param params\n * @returns Promise<AnalyticsDownloadTokenResponse>\n */\n public async getAnalyticsDownloadToken(\n params: AnalyticsDownloadTokenParams,\n ): Promise<AnalyticsDownloadTokenResponse> {\n const output = await this.apiTransport.sendRequest(\n '/analytics/getDownloadToken',\n params,\n );\n if (!output.status) {\n return {\n status: false,\n msg: output.response,\n };\n }\n\n return {\n status: output.response.status,\n msg: output.response.msg,\n token: output.response.token,\n };\n }\n\n /**\n * Fetch recordings\n * @param params\n * @returns Promise<FetchRecordingsResponse>\n */\n public async fetchRecordings(\n params: FetchRecordingsParams,\n ): Promise<FetchRecordingsResponse> {\n const output = await this.apiTransport.sendRequest(\n '/recording/fetch',\n params,\n );\n if (!output.status) {\n return {\n status: false,\n msg: output.response,\n };\n }\n\n return {\n status: output.response.status,\n msg: output.response.msg,\n result: output.response.result,\n };\n }\n\n /**\n * Delete recording\n * @param params\n * @returns Promise<DeleteRecordingsResponse>\n */\n public async deleteRecordings(\n params: DeleteRecordingsParams,\n ): Promise<DeleteRecordingsResponse> {\n const output = await this.apiTransport.sendRequest(\n '/recording/delete',\n params,\n );\n if (!output.status) {\n return {\n status: false,\n msg: output.response,\n };\n }\n\n return {\n status: output.response.status,\n msg: output.response.msg,\n };\n }\n\n /**\n * Generate token to download recording\n * @param params\n * @returns Promise<RecordingDownloadTokenResponse>\n */\n public async getRecordingDownloadToken(\n params: RecordingDownloadTokenParams,\n ): Promise<RecordingDownloadTokenResponse> {\n const output = await this.apiTransport.sendRequest(\n '/recording/getDownloadToken',\n params,\n );\n if (!output.status) {\n return {\n status: false,\n msg: output.response,\n };\n }\n\n return {\n status: output.response.status,\n msg: output.response.msg,\n token: output.response.token,\n };\n }\n\n /**\n * To get JS & CSS files to build interface\n * @returns Promise<ClientFilesResponse>\n */\n public async getClientFiles(): Promise<ClientFilesResponse> {\n const output = await this.apiTransport.sendRequest('/getClientFiles', {});\n if (!output.status) {\n return {\n status: false,\n msg: output.response,\n };\n }\n\n return {\n status: output.response.status,\n msg: output.response.msg,\n css: output.response.css,\n js: output.response.js,\n };\n }\n}\n","import http from 'http';\nimport https, { RequestOptions } from 'https';\nimport { createHmac } from 'crypto';\n\nexport type APIResponse = {\n status: boolean;\n response: any;\n};\n\nexport class ApiTransport {\n protected apiEndPointURL: string;\n protected apiKey: string;\n protected apiSecret: string;\n\n private isSecure = false;\n private mainOptions: RequestOptions = {};\n\n constructor(apiEndPointURL: string, apiKey: string, apiSecret: string) {\n this.apiEndPointURL = apiEndPointURL;\n this.apiKey = apiKey;\n this.apiSecret = apiSecret;\n\n const url = new URL(apiEndPointURL);\n let port = url.protocol === 'https:' ? 443 : 80;\n this.isSecure = url.protocol === 'https:' ?? false;\n\n // use port if supplied with url\n if (url.port) {\n port = Number(url.port);\n }\n\n this.mainOptions = {\n hostname: url.hostname,\n path: url.pathname,\n method: 'POST',\n port,\n };\n }\n\n private prepareHeader = (body: string) => {\n const signature = createHmac('sha256', this.apiSecret)\n .update(body)\n .digest('hex');\n\n return {\n 'Content-Type': 'application/json',\n 'API-KEY': this.apiKey,\n 'HASH-SIGNATURE': signature,\n };\n };\n\n public sendRequest = async (path: string, body: any) => {\n return new Promise<APIResponse>((resolve) => {\n const output: APIResponse = {\n status: false,\n response: undefined,\n };\n\n const chunk = JSON.stringify(body);\n\n const options = { ...this.mainOptions };\n options.path += path;\n options.headers = this.prepareHeader(chunk);\n\n const req = (this.isSecure ? https : http).request(options, (res) => {\n const body: Array<Uint8Array> = [];\n res.on('data', (chunk) => body.push(chunk));\n\n res.on('end', () => {\n const resString = Buffer.concat(body).toString();\n\n try {\n output.status = true;\n output.response = JSON.parse(resString);\n } catch (error) {\n output.status = false;\n output.response = error;\n }\n\n resolve(output);\n });\n });\n\n req.on('error', (error) => {\n output.response = error.message;\n resolve(output);\n });\n\n req.write(chunk);\n req.end();\n });\n };\n}\n"],"names":[],"version":3,"file":"PlugNmeet.cjs.js.map"}
|