@unboundcx/sdk-internal 1.0.8 → 1.0.9
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/index.js +3 -0
- package/package.json +1 -1
- package/services/masterAuth.js +35 -0
package/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import { InternalEmailService } from './services/email.js';
|
|
|
6
6
|
import { InternalProgrammableVoiceService } from './services/programmableVoice.js';
|
|
7
7
|
import { InternalServersService } from './services/servers.js';
|
|
8
8
|
import { InternalSocketService } from './services/socket.js';
|
|
9
|
+
import { InternalMasterAuthService } from './services/masterAuth.js';
|
|
9
10
|
|
|
10
11
|
export class InternalSDK {
|
|
11
12
|
constructor(sdk, buildMasterApiAuthFn) {
|
|
@@ -18,6 +19,7 @@ export class InternalSDK {
|
|
|
18
19
|
this.programmableVoice = new InternalProgrammableVoiceService(sdk);
|
|
19
20
|
this.servers = new InternalServersService(sdk);
|
|
20
21
|
this.socket = new InternalSocketService(sdk);
|
|
22
|
+
this.masterAuth = new InternalMasterAuthService(sdk);
|
|
21
23
|
|
|
22
24
|
// Proxy all base SDK properties and methods
|
|
23
25
|
this._proxyBaseSDK();
|
|
@@ -117,3 +119,4 @@ export {
|
|
|
117
119
|
AwsServersService,
|
|
118
120
|
} from './services/servers.js';
|
|
119
121
|
export { InternalSocketService } from './services/socket.js';
|
|
122
|
+
export { InternalMasterAuthService } from './services/masterAuth.js';
|
package/package.json
CHANGED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export class InternalMasterAuthService {
|
|
2
|
+
constructor(sdk) {
|
|
3
|
+
this.sdk = sdk;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
async create({ namespace, accountId, userId, expiresIn = 30 }) {
|
|
7
|
+
this.sdk.validateParams(
|
|
8
|
+
{ namespace, accountId, userId, expiresIn },
|
|
9
|
+
{
|
|
10
|
+
namespace: { type: 'string', required: true },
|
|
11
|
+
accountId: { type: 'string', required: true },
|
|
12
|
+
userId: { type: 'string', required: false },
|
|
13
|
+
expiresIn: { type: 'number', required: false },
|
|
14
|
+
},
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
const params = {
|
|
18
|
+
body: {
|
|
19
|
+
namespace,
|
|
20
|
+
accountId,
|
|
21
|
+
userId,
|
|
22
|
+
},
|
|
23
|
+
query: {
|
|
24
|
+
expiresIn,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const result = await this.sdk._fetch(
|
|
29
|
+
'/internal/masterAuth/',
|
|
30
|
+
'POST',
|
|
31
|
+
params,
|
|
32
|
+
);
|
|
33
|
+
return result;
|
|
34
|
+
}
|
|
35
|
+
}
|