plugnmeet-sdk-js 1.0.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/LICENSE +21 -0
- package/PlugNmeet.d.ts +71 -0
- package/PlugNmeet.js +210 -0
- package/README.md +54 -0
- package/api.d.ts +6 -0
- package/api.js +74 -0
- package/index.d.ts +10 -0
- package/index.js +5 -0
- package/package.json +26 -0
- package/types/RecordingDownloadToken.d.ts +8 -0
- package/types/RecordingDownloadToken.js +2 -0
- package/types/activeRoomInfo.d.ts +34 -0
- package/types/activeRoomInfo.js +2 -0
- package/types/activeRoomsInfo.d.ts +6 -0
- package/types/activeRoomsInfo.js +2 -0
- package/types/createRoom.d.ts +63 -0
- package/types/createRoom.js +2 -0
- package/types/deleteRecordings.d.ts +7 -0
- package/types/deleteRecordings.js +2 -0
- package/types/endRoom.d.ts +7 -0
- package/types/endRoom.js +2 -0
- package/types/fetchRecordings.d.ts +27 -0
- package/types/fetchRecordings.js +2 -0
- package/types/isRoomActive.d.ts +7 -0
- package/types/isRoomActive.js +2 -0
- package/types/joinToken.d.ts +21 -0
- package/types/joinToken.js +2 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 MynaParrot
|
|
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/PlugNmeet.d.ts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { CreateRoomParams, CreateRoomResponse } from './types/createRoom';
|
|
2
|
+
import { JoinTokenParams, JoinTokenResponse } from './types/joinToken';
|
|
3
|
+
import { IsRoomActiveParams, IsRoomActiveResponse } from './types/isRoomActive';
|
|
4
|
+
import { ActiveRoomInfoParams, ActiveRoomInfoResponse } from './types/activeRoomInfo';
|
|
5
|
+
import { ActiveRoomsInfoResponse } from './types/activeRoomsInfo';
|
|
6
|
+
import { EndRoomParams, EndRoomResponse } from './types/endRoom';
|
|
7
|
+
import { FetchRecordingsParams, FetchRecordingsResponse } from './types/fetchRecordings';
|
|
8
|
+
import { DeleteRecordingsParams, DeleteRecordingsResponse } from './types/deleteRecordings';
|
|
9
|
+
import { RecordingDownloadTokenParams, RecordingDownloadTokenResponse } from './types/RecordingDownloadToken';
|
|
10
|
+
export declare class PlugNmeet {
|
|
11
|
+
protected defaultPath: string;
|
|
12
|
+
/**
|
|
13
|
+
* @param serverUrl plugNmeet server URL
|
|
14
|
+
* @param apiKey plugNmeet API_Key
|
|
15
|
+
* @param apiSecret plugNmeet API_Secret
|
|
16
|
+
*/
|
|
17
|
+
constructor(serverUrl: string, apiKey: string, apiSecret: string);
|
|
18
|
+
/**
|
|
19
|
+
* Create new room
|
|
20
|
+
* @param params: CreateRoomParams
|
|
21
|
+
* @returns Promise<CreateRoomResponse>
|
|
22
|
+
*/
|
|
23
|
+
createRoom(params: CreateRoomParams): Promise<CreateRoomResponse>;
|
|
24
|
+
/**
|
|
25
|
+
* Generate join token
|
|
26
|
+
* @param params: JoinTokenParams
|
|
27
|
+
* @returns Promise<JoinTokenResponse>
|
|
28
|
+
*/
|
|
29
|
+
getJoinToken(params: JoinTokenParams): Promise<JoinTokenResponse>;
|
|
30
|
+
/**
|
|
31
|
+
* If room is active or not
|
|
32
|
+
* @param params: IsRoomActiveParams
|
|
33
|
+
* @returns Promise<IsRoomActiveResponse>
|
|
34
|
+
*/
|
|
35
|
+
isRoomActive(params: IsRoomActiveParams): Promise<IsRoomActiveResponse>;
|
|
36
|
+
/**
|
|
37
|
+
* Get active room information
|
|
38
|
+
* @param params: ActiveRoomInfoParams
|
|
39
|
+
* @returns Promise<ActiveRoomInfoResponse>
|
|
40
|
+
*/
|
|
41
|
+
getActiveRoomInfo(params: ActiveRoomInfoParams): Promise<ActiveRoomInfoResponse>;
|
|
42
|
+
/**
|
|
43
|
+
* Get all active rooms
|
|
44
|
+
* @returns Promise<ActiveRoomsInfoResponse>
|
|
45
|
+
*/
|
|
46
|
+
getActiveRoomsInfo(): Promise<ActiveRoomsInfoResponse>;
|
|
47
|
+
/**
|
|
48
|
+
* End active room
|
|
49
|
+
* @param params: EndRoomParams
|
|
50
|
+
* @returns Promise<EndRoomResponse>
|
|
51
|
+
*/
|
|
52
|
+
endRoom(params: EndRoomParams): Promise<EndRoomResponse>;
|
|
53
|
+
/**
|
|
54
|
+
* Fetch recordings
|
|
55
|
+
* @param params: FetchRecordingsParams
|
|
56
|
+
* @returns Promise<FetchRecordingsResponse>
|
|
57
|
+
*/
|
|
58
|
+
fetchRecordings(params: FetchRecordingsParams): Promise<FetchRecordingsResponse>;
|
|
59
|
+
/**
|
|
60
|
+
* Delete recording
|
|
61
|
+
* @param params: DeleteRecordingsParams
|
|
62
|
+
* @returns Promise<DeleteRecordingsResponse>
|
|
63
|
+
*/
|
|
64
|
+
deleteRecordings(params: DeleteRecordingsParams): Promise<DeleteRecordingsResponse>;
|
|
65
|
+
/**
|
|
66
|
+
* Generate token to download recording
|
|
67
|
+
* @param params: RecordingDownloadTokenParams
|
|
68
|
+
* @returns Promise<RecordingDownloadTokenResponse>
|
|
69
|
+
*/
|
|
70
|
+
getRecordingDownloadToken(params: RecordingDownloadTokenParams): Promise<RecordingDownloadTokenResponse>;
|
|
71
|
+
}
|
package/PlugNmeet.js
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.PlugNmeet = void 0;
|
|
13
|
+
const api_1 = require("./api");
|
|
14
|
+
class PlugNmeet {
|
|
15
|
+
/**
|
|
16
|
+
* @param serverUrl plugNmeet server URL
|
|
17
|
+
* @param apiKey plugNmeet API_Key
|
|
18
|
+
* @param apiSecret plugNmeet API_Secret
|
|
19
|
+
*/
|
|
20
|
+
constructor(serverUrl, apiKey, apiSecret) {
|
|
21
|
+
this.defaultPath = '/auth';
|
|
22
|
+
(0, api_1.prepareAPI)(serverUrl + this.defaultPath, apiKey, apiSecret);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Create new room
|
|
26
|
+
* @param params: CreateRoomParams
|
|
27
|
+
* @returns Promise<CreateRoomResponse>
|
|
28
|
+
*/
|
|
29
|
+
createRoom(params) {
|
|
30
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
const output = yield (0, api_1.sendRequest)('/room/create', params);
|
|
32
|
+
if (!output.status) {
|
|
33
|
+
return {
|
|
34
|
+
status: false,
|
|
35
|
+
msg: output.response,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
status: output.response.status,
|
|
40
|
+
msg: output.response.msg,
|
|
41
|
+
roomInfo: output.response.roomInfo,
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Generate join token
|
|
47
|
+
* @param params: JoinTokenParams
|
|
48
|
+
* @returns Promise<JoinTokenResponse>
|
|
49
|
+
*/
|
|
50
|
+
getJoinToken(params) {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
const output = yield (0, api_1.sendRequest)('/room/getJoinToken', params);
|
|
53
|
+
if (!output.status) {
|
|
54
|
+
return {
|
|
55
|
+
status: false,
|
|
56
|
+
msg: output.response,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
status: output.response.status,
|
|
61
|
+
msg: output.response.msg,
|
|
62
|
+
token: output.response.token,
|
|
63
|
+
};
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* If room is active or not
|
|
68
|
+
* @param params: IsRoomActiveParams
|
|
69
|
+
* @returns Promise<IsRoomActiveResponse>
|
|
70
|
+
*/
|
|
71
|
+
isRoomActive(params) {
|
|
72
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
const output = yield (0, api_1.sendRequest)('/room/isRoomActive', params);
|
|
74
|
+
if (!output.status) {
|
|
75
|
+
return {
|
|
76
|
+
status: false,
|
|
77
|
+
msg: output.response,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
status: output.response.status,
|
|
82
|
+
msg: output.response.msg,
|
|
83
|
+
};
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Get active room information
|
|
88
|
+
* @param params: ActiveRoomInfoParams
|
|
89
|
+
* @returns Promise<ActiveRoomInfoResponse>
|
|
90
|
+
*/
|
|
91
|
+
getActiveRoomInfo(params) {
|
|
92
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
93
|
+
const output = yield (0, api_1.sendRequest)('/room/getActiveRoomInfo', params);
|
|
94
|
+
if (!output.status) {
|
|
95
|
+
return {
|
|
96
|
+
status: false,
|
|
97
|
+
msg: output.response,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
status: output.response.status,
|
|
102
|
+
msg: output.response.msg,
|
|
103
|
+
room: output.response.room,
|
|
104
|
+
};
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Get all active rooms
|
|
109
|
+
* @returns Promise<ActiveRoomsInfoResponse>
|
|
110
|
+
*/
|
|
111
|
+
getActiveRoomsInfo() {
|
|
112
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
113
|
+
const output = yield (0, api_1.sendRequest)('/room/getActiveRoomsInfo', {});
|
|
114
|
+
if (!output.status) {
|
|
115
|
+
return {
|
|
116
|
+
status: false,
|
|
117
|
+
msg: output.response,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
return {
|
|
121
|
+
status: output.response.status,
|
|
122
|
+
msg: output.response.msg,
|
|
123
|
+
rooms: output.response.rooms,
|
|
124
|
+
};
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* End active room
|
|
129
|
+
* @param params: EndRoomParams
|
|
130
|
+
* @returns Promise<EndRoomResponse>
|
|
131
|
+
*/
|
|
132
|
+
endRoom(params) {
|
|
133
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
134
|
+
const output = yield (0, api_1.sendRequest)('/room/endRoom', params);
|
|
135
|
+
if (!output.status) {
|
|
136
|
+
return {
|
|
137
|
+
status: false,
|
|
138
|
+
msg: output.response,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
return {
|
|
142
|
+
status: output.response.status,
|
|
143
|
+
msg: output.response.msg,
|
|
144
|
+
};
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Fetch recordings
|
|
149
|
+
* @param params: FetchRecordingsParams
|
|
150
|
+
* @returns Promise<FetchRecordingsResponse>
|
|
151
|
+
*/
|
|
152
|
+
fetchRecordings(params) {
|
|
153
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
154
|
+
const output = yield (0, api_1.sendRequest)('/recording/fetch', params);
|
|
155
|
+
if (!output.status) {
|
|
156
|
+
return {
|
|
157
|
+
status: false,
|
|
158
|
+
msg: output.response,
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
return {
|
|
162
|
+
status: output.response.status,
|
|
163
|
+
msg: output.response.msg,
|
|
164
|
+
result: output.response.result,
|
|
165
|
+
};
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Delete recording
|
|
170
|
+
* @param params: DeleteRecordingsParams
|
|
171
|
+
* @returns Promise<DeleteRecordingsResponse>
|
|
172
|
+
*/
|
|
173
|
+
deleteRecordings(params) {
|
|
174
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
175
|
+
const output = yield (0, api_1.sendRequest)('/recording/delete', params);
|
|
176
|
+
if (!output.status) {
|
|
177
|
+
return {
|
|
178
|
+
status: false,
|
|
179
|
+
msg: output.response,
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
return {
|
|
183
|
+
status: output.response.status,
|
|
184
|
+
msg: output.response.msg,
|
|
185
|
+
};
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Generate token to download recording
|
|
190
|
+
* @param params: RecordingDownloadTokenParams
|
|
191
|
+
* @returns Promise<RecordingDownloadTokenResponse>
|
|
192
|
+
*/
|
|
193
|
+
getRecordingDownloadToken(params) {
|
|
194
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
195
|
+
const output = yield (0, api_1.sendRequest)('/recording/getDownloadToken', params);
|
|
196
|
+
if (!output.status) {
|
|
197
|
+
return {
|
|
198
|
+
status: false,
|
|
199
|
+
msg: output.response,
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
return {
|
|
203
|
+
status: output.response.status,
|
|
204
|
+
msg: output.response.msg,
|
|
205
|
+
token: output.response.token,
|
|
206
|
+
};
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
exports.PlugNmeet = PlugNmeet;
|
package/README.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# plugNmeet-sdk-js
|
|
2
|
+
|
|
3
|
+
Plug-N-Meet JS SDK for NodeJS. You can use this SDK to make API requests to the Plug-N-Meet server from your backend application.
|
|
4
|
+
|
|
5
|
+
## Installation:
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
npm install plugnmeet-sdk-js
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
**Import**
|
|
14
|
+
|
|
15
|
+
JavaScript:
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
const plugNmeet = require('../dist').PlugNmeet;
|
|
19
|
+
|
|
20
|
+
// now
|
|
21
|
+
const pnm = new plugNmeet(
|
|
22
|
+
'http://localhost:8080',
|
|
23
|
+
'plugnmeet',
|
|
24
|
+
'zumyyYWqv7KR2kUqvYdq4z4sXg7XTBD2ljT6',
|
|
25
|
+
);
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
TypeScript:
|
|
29
|
+
|
|
30
|
+
```js
|
|
31
|
+
import { PlugNmeet } from 'plugnmeet-sdk-js';
|
|
32
|
+
|
|
33
|
+
const pnm = new PlugNmeet(
|
|
34
|
+
'http://localhost:8080',
|
|
35
|
+
'plugnmeet',
|
|
36
|
+
'zumyyYWqv7KR2kUqvYdq4z4sXg7XTBD2ljT6',
|
|
37
|
+
);
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Please check `examples` directory to see some examples.
|
|
41
|
+
|
|
42
|
+
## Methods/API
|
|
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
|
+
| [endRoom](https://mynaparrot.github.io/plugNmeet-sdk-js/classes/PlugNmeet.html#endRoom) | End active room |
|
|
52
|
+
| [fetchRecordings](https://mynaparrot.github.io/plugNmeet-sdk-js/classes/PlugNmeet.html#fetchRecordings) | Fetch recordings |
|
|
53
|
+
| [deleteRecordings](https://mynaparrot.github.io/plugNmeet-sdk-js/classes/PlugNmeet.html#deleteRecordings) | Delete recording |
|
|
54
|
+
| [getRecordingDownloadToken](https://mynaparrot.github.io/plugNmeet-sdk-js/classes/PlugNmeet.html#getRecordingDownloadToken) | Generate token to download recording |
|
package/api.d.ts
ADDED
package/api.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.sendRequest = exports.prepareAPI = void 0;
|
|
16
|
+
const http_1 = __importDefault(require("http"));
|
|
17
|
+
const https_1 = __importDefault(require("https"));
|
|
18
|
+
let mainOptions, isSecure = true;
|
|
19
|
+
const prepareAPI = (apiEndPointURL, apiKey, apiSecret) => {
|
|
20
|
+
var _a;
|
|
21
|
+
const headers = {
|
|
22
|
+
'Content-Type': 'application/json',
|
|
23
|
+
'API-KEY': apiKey,
|
|
24
|
+
'API-SECRET': apiSecret,
|
|
25
|
+
};
|
|
26
|
+
const url = new URL(apiEndPointURL);
|
|
27
|
+
let port = url.protocol === 'https:' ? 443 : 80;
|
|
28
|
+
isSecure = (_a = url.protocol === 'https:') !== null && _a !== void 0 ? _a : false;
|
|
29
|
+
// use port if supplied with url
|
|
30
|
+
if (url.port) {
|
|
31
|
+
port = Number(url.port);
|
|
32
|
+
}
|
|
33
|
+
mainOptions = {
|
|
34
|
+
hostname: url.hostname,
|
|
35
|
+
path: url.pathname,
|
|
36
|
+
method: 'POST',
|
|
37
|
+
port,
|
|
38
|
+
headers,
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
exports.prepareAPI = prepareAPI;
|
|
42
|
+
const sendRequest = (path, body) => __awaiter(void 0, void 0, void 0, function* () {
|
|
43
|
+
return new Promise((resolve) => {
|
|
44
|
+
const output = {
|
|
45
|
+
status: false,
|
|
46
|
+
response: undefined,
|
|
47
|
+
};
|
|
48
|
+
const options = Object.assign({}, mainOptions);
|
|
49
|
+
options.path += path;
|
|
50
|
+
const req = (isSecure ? https_1.default : http_1.default).request(options, (res) => {
|
|
51
|
+
const body = [];
|
|
52
|
+
res.on('data', (chunk) => body.push(chunk));
|
|
53
|
+
res.on('end', () => {
|
|
54
|
+
const resString = Buffer.concat(body).toString();
|
|
55
|
+
try {
|
|
56
|
+
output.status = true;
|
|
57
|
+
output.response = JSON.parse(resString);
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
output.status = false;
|
|
61
|
+
output.response = error;
|
|
62
|
+
}
|
|
63
|
+
resolve(output);
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
req.on('error', (error) => {
|
|
67
|
+
output.response = error.message;
|
|
68
|
+
resolve(output);
|
|
69
|
+
});
|
|
70
|
+
req.write(JSON.stringify(body));
|
|
71
|
+
req.end();
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
exports.sendRequest = sendRequest;
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { RooMetadata, CreateRoomParams, CreateRoomResponse, CreateRoomResponseRoomInfo, LockSettingsParams, RoomFeaturesParams, ChatFeaturesParams, SharedNotePadFeaturesParams, WhiteboardFeaturesParams, } from './types/createRoom';
|
|
2
|
+
export { JoinTokenParams, JoinTokenResponse, JoinTokenUserMetadata, JoinTokenUserInfo, } from './types/joinToken';
|
|
3
|
+
export { IsRoomActiveParams, IsRoomActiveResponse } from './types/isRoomActive';
|
|
4
|
+
export { Room, ActiveRoomInfoParams, ActiveRoomInfoResponse, ParticipantInfo, ActiveRoomInfo, } from './types/activeRoomInfo';
|
|
5
|
+
export { ActiveRoomsInfoResponse } from './types/activeRoomsInfo';
|
|
6
|
+
export { EndRoomParams, EndRoomResponse } from './types/endRoom';
|
|
7
|
+
export { FetchRecordingsParams, FetchRecordingsResponse, FetchRecordingsResult, RecordingInfo, } from './types/fetchRecordings';
|
|
8
|
+
export { DeleteRecordingsParams, DeleteRecordingsResponse, } from './types/deleteRecordings';
|
|
9
|
+
export { RecordingDownloadTokenParams, RecordingDownloadTokenResponse, } from './types/RecordingDownloadToken';
|
|
10
|
+
export { PlugNmeet } from './PlugNmeet';
|
package/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PlugNmeet = void 0;
|
|
4
|
+
var PlugNmeet_1 = require("./PlugNmeet");
|
|
5
|
+
Object.defineProperty(exports, "PlugNmeet", { enumerable: true, get: function () { return PlugNmeet_1.PlugNmeet; } });
|
package/package.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "plugnmeet-sdk-js",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "plugNmeet JS SDK",
|
|
5
|
+
"main": "src/index.ts",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"start": "rm -rf ./dist && concurrently -c \"red,green\" --kill-others \"tsc --watch -p . --outDir ./dist && esw -w --ext '.ts','.js' --fix\"",
|
|
8
|
+
"build": "rm -rf ./dist && tsc -p . --outDir ./dist",
|
|
9
|
+
"build-docs": "typedoc --sort source-order"
|
|
10
|
+
},
|
|
11
|
+
"author": "Jibon L. Costa",
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"@types/node": "^17.0.23",
|
|
15
|
+
"@typescript-eslint/eslint-plugin": "^5.17.0",
|
|
16
|
+
"@typescript-eslint/parser": "^5.17.0",
|
|
17
|
+
"concurrently": "^7.1.0",
|
|
18
|
+
"eslint": "^8.12.0",
|
|
19
|
+
"eslint-config-prettier": "^8.5.0",
|
|
20
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
21
|
+
"eslint-watch": "^8.0.0",
|
|
22
|
+
"prettier": "^2.6.2",
|
|
23
|
+
"typedoc": "^0.22.14",
|
|
24
|
+
"typescript": "^4.6.3"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare type ActiveRoomInfoParams = {
|
|
2
|
+
room_id: string;
|
|
3
|
+
};
|
|
4
|
+
export declare type ActiveRoomInfoResponse = {
|
|
5
|
+
status: boolean;
|
|
6
|
+
msg: string;
|
|
7
|
+
room?: Room;
|
|
8
|
+
};
|
|
9
|
+
export declare type Room = {
|
|
10
|
+
room_info: ActiveRoomInfo;
|
|
11
|
+
participants_info: Array<ParticipantInfo>;
|
|
12
|
+
};
|
|
13
|
+
export declare type ActiveRoomInfo = {
|
|
14
|
+
room_title: string;
|
|
15
|
+
room_id: string;
|
|
16
|
+
sid: string;
|
|
17
|
+
joined_participants: number;
|
|
18
|
+
is_running: boolean;
|
|
19
|
+
is_recording: boolean;
|
|
20
|
+
is_active_rtmp: boolean;
|
|
21
|
+
webhook_url: string;
|
|
22
|
+
creation_time: number;
|
|
23
|
+
metadata: string;
|
|
24
|
+
};
|
|
25
|
+
export declare type ParticipantInfo = {
|
|
26
|
+
sid: string;
|
|
27
|
+
identity: string;
|
|
28
|
+
state: string;
|
|
29
|
+
metadata: string;
|
|
30
|
+
joined_at: number;
|
|
31
|
+
name: string;
|
|
32
|
+
version: number;
|
|
33
|
+
permission: any;
|
|
34
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export declare type CreateRoomParams = {
|
|
2
|
+
room_id: string;
|
|
3
|
+
max_participants?: number;
|
|
4
|
+
empty_timeout?: number;
|
|
5
|
+
metadata: RooMetadata;
|
|
6
|
+
};
|
|
7
|
+
export declare type RooMetadata = {
|
|
8
|
+
room_title: string;
|
|
9
|
+
welcome_message?: string;
|
|
10
|
+
webhook_url?: string;
|
|
11
|
+
room_features: RoomFeaturesParams;
|
|
12
|
+
default_lock_settings?: LockSettingsParams;
|
|
13
|
+
};
|
|
14
|
+
export declare type RoomFeaturesParams = {
|
|
15
|
+
allow_webcams: boolean;
|
|
16
|
+
mute_on_start: boolean;
|
|
17
|
+
allow_screen_share: boolean;
|
|
18
|
+
allow_recording: boolean;
|
|
19
|
+
allow_rtmp: boolean;
|
|
20
|
+
admin_only_webcams: boolean;
|
|
21
|
+
allow_view_other_webcams: boolean;
|
|
22
|
+
allow_view_other_users_list: boolean;
|
|
23
|
+
chat_features: ChatFeaturesParams;
|
|
24
|
+
shared_note_pad_features: SharedNotePadFeaturesParams;
|
|
25
|
+
whiteboard_features: WhiteboardFeaturesParams;
|
|
26
|
+
};
|
|
27
|
+
export declare type ChatFeaturesParams = {
|
|
28
|
+
allow_chat: boolean;
|
|
29
|
+
allow_file_upload: boolean;
|
|
30
|
+
allowed_file_types: Array<string>;
|
|
31
|
+
max_file_size: number;
|
|
32
|
+
};
|
|
33
|
+
export declare type SharedNotePadFeaturesParams = {
|
|
34
|
+
allowed_shared_note_pad: boolean;
|
|
35
|
+
};
|
|
36
|
+
export declare type WhiteboardFeaturesParams = {
|
|
37
|
+
allowed_whiteboard: boolean;
|
|
38
|
+
};
|
|
39
|
+
export declare type LockSettingsParams = {
|
|
40
|
+
lock_microphone?: boolean;
|
|
41
|
+
lock_webcam?: boolean;
|
|
42
|
+
lock_screen_sharing?: boolean;
|
|
43
|
+
lock_whiteboard?: boolean;
|
|
44
|
+
lock_shared_notepad?: boolean;
|
|
45
|
+
lock_chat?: boolean;
|
|
46
|
+
lock_chat_send_message?: boolean;
|
|
47
|
+
lock_chat_file_share?: boolean;
|
|
48
|
+
};
|
|
49
|
+
export declare type CreateRoomResponse = {
|
|
50
|
+
status: boolean;
|
|
51
|
+
msg: string;
|
|
52
|
+
roomInfo?: CreateRoomResponseRoomInfo;
|
|
53
|
+
};
|
|
54
|
+
export declare type CreateRoomResponseRoomInfo = {
|
|
55
|
+
sid: string;
|
|
56
|
+
name: string;
|
|
57
|
+
max_participants: number;
|
|
58
|
+
empty_timeout: number;
|
|
59
|
+
creation_time: number;
|
|
60
|
+
turn_password: string;
|
|
61
|
+
enabled_codecs: Array<any>;
|
|
62
|
+
metadata: string;
|
|
63
|
+
};
|
package/types/endRoom.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare type FetchRecordingsParams = {
|
|
2
|
+
room_ids: Array<string>;
|
|
3
|
+
from?: number;
|
|
4
|
+
limit?: number;
|
|
5
|
+
order_by?: 'ASC' | 'DESC';
|
|
6
|
+
};
|
|
7
|
+
export declare type FetchRecordingsResponse = {
|
|
8
|
+
status: boolean;
|
|
9
|
+
msg: string;
|
|
10
|
+
result?: FetchRecordingsResult;
|
|
11
|
+
};
|
|
12
|
+
export declare type FetchRecordingsResult = {
|
|
13
|
+
total_recordings: number;
|
|
14
|
+
from: number;
|
|
15
|
+
limit: number;
|
|
16
|
+
order_by: string;
|
|
17
|
+
recordings_list: Array<RecordingInfo>;
|
|
18
|
+
};
|
|
19
|
+
export declare type RecordingInfo = {
|
|
20
|
+
record_id: string;
|
|
21
|
+
room_id: string;
|
|
22
|
+
room_sid: string;
|
|
23
|
+
file_path: string;
|
|
24
|
+
file_size: number;
|
|
25
|
+
creation_time: number;
|
|
26
|
+
room_creation_time: number;
|
|
27
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { LockSettingsParams } from './createRoom';
|
|
2
|
+
export declare type JoinTokenParams = {
|
|
3
|
+
room_id: string;
|
|
4
|
+
user_info: JoinTokenUserInfo;
|
|
5
|
+
};
|
|
6
|
+
export declare type JoinTokenUserInfo = {
|
|
7
|
+
name: string;
|
|
8
|
+
user_id: string;
|
|
9
|
+
is_admin: boolean;
|
|
10
|
+
is_hidden: boolean;
|
|
11
|
+
user_metadata?: JoinTokenUserMetadata;
|
|
12
|
+
};
|
|
13
|
+
export declare type JoinTokenUserMetadata = {
|
|
14
|
+
profile_pic?: string;
|
|
15
|
+
lock_settings?: LockSettingsParams;
|
|
16
|
+
};
|
|
17
|
+
export declare type JoinTokenResponse = {
|
|
18
|
+
status: boolean;
|
|
19
|
+
msg: string;
|
|
20
|
+
token?: string;
|
|
21
|
+
};
|