@fonoster/sdk 0.6.1-alpha.0 → 0.6.2-alpha.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/dist/node/Acls.d.ts +12 -0
- package/dist/node/Acls.js +89 -0
- package/dist/node/Agents.d.ts +12 -0
- package/dist/node/Agents.js +60 -0
- package/dist/node/ApiKeys.d.ts +11 -0
- package/dist/node/ApiKeys.js +69 -0
- package/dist/node/Applications.d.ts +1 -1
- package/dist/node/Calls.d.ts +10 -0
- package/dist/node/Calls.js +66 -0
- package/dist/node/Credentials.d.ts +12 -0
- package/dist/node/Credentials.js +58 -0
- package/dist/node/Domains.d.ts +12 -0
- package/dist/node/Domains.js +58 -0
- package/dist/node/Numbers.d.ts +12 -0
- package/dist/node/Numbers.js +58 -0
- package/dist/node/Secrets.d.ts +12 -0
- package/dist/node/Secrets.js +58 -0
- package/dist/node/Trunks.d.ts +12 -0
- package/dist/node/Trunks.js +105 -0
- package/dist/node/Users.d.ts +11 -0
- package/dist/node/Users.js +48 -0
- package/dist/node/Workspaces.d.ts +15 -0
- package/dist/node/Workspaces.js +85 -0
- package/dist/node/client/AbstractClient.d.ts +16 -2
- package/dist/node/client/AbstractClient.js +0 -1
- package/dist/node/client/Client.d.ts +8 -0
- package/dist/node/client/Client.js +48 -0
- package/dist/node/client/isJwtExpired.js +1 -2
- package/dist/node/client/jsonToObject.js +1 -2
- package/dist/node/client/makeRpcRequest.js +1 -2
- package/dist/node/client/objectToJson.js +1 -2
- package/dist/node/client/types/AclsClient.d.ts +10 -0
- package/dist/node/client/types/AgentsClient.d.ts +10 -0
- package/dist/node/client/types/AgentsClient.js +2 -0
- package/dist/node/client/types/ApplicationsClient.d.ts +10 -0
- package/dist/node/client/types/ApplicationsClient.js +2 -0
- package/dist/node/client/types/CallsClient.d.ts +8 -0
- package/dist/node/client/types/CallsClient.js +2 -0
- package/dist/node/client/types/CredentialsClient.d.ts +10 -0
- package/dist/node/client/types/CredentialsClient.js +2 -0
- package/dist/node/client/types/DomainsClient.d.ts +10 -0
- package/dist/node/client/types/DomainsClient.js +2 -0
- package/dist/node/client/types/FonosterClient.d.ts +27 -0
- package/dist/node/client/types/FonosterClient.js +2 -0
- package/dist/node/client/types/IdentityClient.d.ts +24 -0
- package/dist/node/client/types/IdentityClient.js +2 -0
- package/dist/node/client/types/NumbersClient.d.ts +10 -0
- package/dist/node/client/types/NumbersClient.js +2 -0
- package/dist/node/client/types/SecretsClient.d.ts +10 -0
- package/dist/node/client/types/SecretsClient.js +2 -0
- package/dist/node/client/types/TrunksClient.d.ts +10 -0
- package/dist/node/client/types/TrunksClient.js +2 -0
- package/dist/node/client/types/common.d.ts +4 -0
- package/dist/node/client/types/common.js +2 -0
- package/dist/node/client/types/index.d.ts +6 -0
- package/dist/node/client/types/index.js +40 -0
- package/dist/node/client/utils.js +3 -4
- package/dist/node/generated/node/identity_pb.js +9 -9
- package/dist/node/generated/node/trunks_grpc_pb.js +8 -8
- package/dist/node/generated/node/trunks_pb.js +25 -25
- package/dist/node/generated/web/TrunksServiceClientPb.ts +5 -5
- package/dist/node/generated/web/identity_pb.d.ts +5 -5
- package/dist/node/generated/web/identity_pb.js +9 -9
- package/dist/node/generated/web/trunks_pb.d.ts +9 -9
- package/dist/node/generated/web/trunks_pb.js +25 -25
- package/dist/node/node.d.ts +11 -0
- package/dist/node/node.js +11 -0
- package/dist/node/tsconfig.node.tsbuildinfo +1 -1
- package/dist/node/utils.js +1 -2
- package/dist/web/fonoster.min.js +1 -1
- package/dist/web/index.esm.js +1 -1
- package/package.json +4 -4
- package/dist/node/client/types.d.ts +0 -26
- /package/dist/node/client/{types.js → types/AclsClient.js} +0 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Trunks = void 0;
|
|
4
|
+
const makeRpcRequest_1 = require("./client/makeRpcRequest");
|
|
5
|
+
const trunks_pb_1 = require("./generated/node/trunks_pb");
|
|
6
|
+
class Trunks {
|
|
7
|
+
client;
|
|
8
|
+
constructor(client) {
|
|
9
|
+
this.client = client;
|
|
10
|
+
}
|
|
11
|
+
async createTrunk(request) {
|
|
12
|
+
const client = this.client.getTrunksClient();
|
|
13
|
+
const createTrunkRequest = new trunks_pb_1.CreateTrunkRequest();
|
|
14
|
+
createTrunkRequest.setName(request.name);
|
|
15
|
+
createTrunkRequest.setInboundUri(request.inboundUri);
|
|
16
|
+
createTrunkRequest.setSendRegister(request.sendRegister);
|
|
17
|
+
// createAclRequest.setAccessControlListRef(?);
|
|
18
|
+
// createAclRequest.setInboundCredentialsRef(?);
|
|
19
|
+
// createAclRequest.setOutboundCredentialsRef(?);
|
|
20
|
+
// request.uris.forEach(uri => {
|
|
21
|
+
// const uri = new CreateTrunkRequestPB.Uris();
|
|
22
|
+
// createTrunkRequest.addUris(uri);
|
|
23
|
+
// }
|
|
24
|
+
return new Promise((resolve, reject) => {
|
|
25
|
+
client.createTrunk(createTrunkRequest, this.client.getMetadata(), (err, response) => {
|
|
26
|
+
if (err) {
|
|
27
|
+
reject(err);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
resolve(response.toObject());
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
async getTrunk(ref) {
|
|
35
|
+
const client = this.client.getTrunksClient();
|
|
36
|
+
const getTrunkRequest = new trunks_pb_1.GetTrunkRequest();
|
|
37
|
+
getTrunkRequest.setRef(ref);
|
|
38
|
+
return new Promise((resolve, reject) => {
|
|
39
|
+
client.getTrunk(getTrunkRequest, this.client.getMetadata(), (err, response) => {
|
|
40
|
+
if (err) {
|
|
41
|
+
reject(err);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
resolve(response.toObject());
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
async updateTrunk(request) {
|
|
49
|
+
const client = this.client.getTrunksClient();
|
|
50
|
+
const updateTrunkRequest = new trunks_pb_1.UpdateTrunkRequest();
|
|
51
|
+
updateTrunkRequest.setRef(request.ref);
|
|
52
|
+
updateTrunkRequest.setName(request.name);
|
|
53
|
+
updateTrunkRequest.setSendRegister(request.sendRegister);
|
|
54
|
+
// updateAclRequest.setAccessControlListRef(?);
|
|
55
|
+
// updateAclRequest.setInboundCredentialsRef(?);
|
|
56
|
+
// updateAclRequest.setOutboundCredentialsRef(?);
|
|
57
|
+
// request.uris.forEach(uri => {
|
|
58
|
+
// const uri = new UpdateTrunkRequestPB.Uris();
|
|
59
|
+
// updateTrunkRequest.addUris(uri);
|
|
60
|
+
// }
|
|
61
|
+
return new Promise((resolve, reject) => {
|
|
62
|
+
client.updateTrunk(updateTrunkRequest, this.client.getMetadata(), (err, response) => {
|
|
63
|
+
if (err) {
|
|
64
|
+
reject(err);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
resolve(response.toObject());
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
async listTrunks(request) {
|
|
72
|
+
const client = this.client.getTrunksClient();
|
|
73
|
+
const listTrunksRequest = new trunks_pb_1.ListTrunksRequest();
|
|
74
|
+
listTrunksRequest.setPageSize(request.pageSize);
|
|
75
|
+
listTrunksRequest.setPageToken(request.pageToken);
|
|
76
|
+
return new Promise((resolve, reject) => {
|
|
77
|
+
client.listTrunks(listTrunksRequest, this.client.getMetadata(), (err, response) => {
|
|
78
|
+
if (err) {
|
|
79
|
+
reject(err);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
const items = response.getItemsList().map((item) => {
|
|
83
|
+
const obj = item.toObject();
|
|
84
|
+
return {
|
|
85
|
+
...obj
|
|
86
|
+
};
|
|
87
|
+
});
|
|
88
|
+
resolve({
|
|
89
|
+
items: items,
|
|
90
|
+
nextPageToken: response.getNextPageToken()
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
async deleteTrunk(ref) {
|
|
96
|
+
const applicationsClient = this.client.getTrunksClient();
|
|
97
|
+
return await (0, makeRpcRequest_1.makeRpcRequest)({
|
|
98
|
+
method: applicationsClient.deleteTrunk.bind(applicationsClient),
|
|
99
|
+
requestPBObjectConstructor: trunks_pb_1.DeleteTrunkRequest,
|
|
100
|
+
metadata: this.client.getMetadata(),
|
|
101
|
+
request: { ref }
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
exports.Trunks = Trunks;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BaseApiObject, CreateUserRequest, UpdateUserRequest, User } from "@fonoster/types";
|
|
2
|
+
import { FonosterClient } from "./client/types";
|
|
3
|
+
declare class Users {
|
|
4
|
+
private client;
|
|
5
|
+
constructor(client: FonosterClient);
|
|
6
|
+
createUser(request: CreateUserRequest): Promise<BaseApiObject>;
|
|
7
|
+
getUser(ref: string): Promise<User>;
|
|
8
|
+
updateUser(request: UpdateUserRequest): Promise<BaseApiObject>;
|
|
9
|
+
deleteUser(ref: string): Promise<BaseApiObject>;
|
|
10
|
+
}
|
|
11
|
+
export { Users };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Users = void 0;
|
|
4
|
+
const makeRpcRequest_1 = require("./client/makeRpcRequest");
|
|
5
|
+
const identity_pb_1 = require("./generated/node/identity_pb");
|
|
6
|
+
class Users {
|
|
7
|
+
client;
|
|
8
|
+
constructor(client) {
|
|
9
|
+
this.client = client;
|
|
10
|
+
}
|
|
11
|
+
async createUser(request) {
|
|
12
|
+
const client = this.client.getIdentityClient();
|
|
13
|
+
return await (0, makeRpcRequest_1.makeRpcRequest)({
|
|
14
|
+
method: client.createUser.bind(client),
|
|
15
|
+
requestPBObjectConstructor: identity_pb_1.CreateUserRequest,
|
|
16
|
+
metadata: this.client.getMetadata(),
|
|
17
|
+
request
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
async getUser(ref) {
|
|
21
|
+
const client = this.client.getIdentityClient();
|
|
22
|
+
return await (0, makeRpcRequest_1.makeRpcRequest)({
|
|
23
|
+
method: client.getUser.bind(client),
|
|
24
|
+
requestPBObjectConstructor: identity_pb_1.GetUserRequest,
|
|
25
|
+
metadata: this.client.getMetadata(),
|
|
26
|
+
request: { ref }
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
async updateUser(request) {
|
|
30
|
+
const client = this.client.getIdentityClient();
|
|
31
|
+
return await (0, makeRpcRequest_1.makeRpcRequest)({
|
|
32
|
+
method: client.updateUser.bind(client),
|
|
33
|
+
requestPBObjectConstructor: identity_pb_1.UpdateUserRequest,
|
|
34
|
+
metadata: this.client.getMetadata(),
|
|
35
|
+
request
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
async deleteUser(ref) {
|
|
39
|
+
const client = this.client.getIdentityClient();
|
|
40
|
+
return await (0, makeRpcRequest_1.makeRpcRequest)({
|
|
41
|
+
method: client.deleteUser.bind(client),
|
|
42
|
+
requestPBObjectConstructor: identity_pb_1.DeleteUserRequest,
|
|
43
|
+
metadata: this.client.getMetadata(),
|
|
44
|
+
request: { ref }
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.Users = Users;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BaseApiObject, CreateWorkspaceRequest, InviteUserToWorkspaceRequest, ListWorkspacesResponse, RemoveUserFromWorkspaceRequest, RemoveUserFromWorkspaceResponse, ResendWorkspaceMembershipInvitationRequest, ResendWorkspaceMembershipInvitationResponse, UpdateWorkspaceRequest, Workspace } from "@fonoster/types";
|
|
2
|
+
import { FonosterClient } from "./client/types";
|
|
3
|
+
declare class Workspaces {
|
|
4
|
+
private client;
|
|
5
|
+
constructor(client: FonosterClient);
|
|
6
|
+
createWorkspace(request: CreateWorkspaceRequest): Promise<BaseApiObject>;
|
|
7
|
+
getWorkspace(ref: string): Promise<Workspace>;
|
|
8
|
+
updateWorkspace(request: UpdateWorkspaceRequest): Promise<BaseApiObject>;
|
|
9
|
+
deleteWorkspace(ref: string): Promise<BaseApiObject>;
|
|
10
|
+
listWorkspaces(): Promise<ListWorkspacesResponse>;
|
|
11
|
+
inviteUserToWorkspace(request: InviteUserToWorkspaceRequest): Promise<BaseApiObject>;
|
|
12
|
+
resendWorkspaceMembershipInvitation(request: ResendWorkspaceMembershipInvitationRequest): Promise<ResendWorkspaceMembershipInvitationResponse>;
|
|
13
|
+
removeUserFromWorkspace(request: RemoveUserFromWorkspaceRequest): Promise<RemoveUserFromWorkspaceResponse>;
|
|
14
|
+
}
|
|
15
|
+
export { Workspaces };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Workspaces = void 0;
|
|
4
|
+
const makeRpcRequest_1 = require("./client/makeRpcRequest");
|
|
5
|
+
const identity_pb_1 = require("./generated/node/identity_pb");
|
|
6
|
+
class Workspaces {
|
|
7
|
+
client;
|
|
8
|
+
constructor(client) {
|
|
9
|
+
this.client = client;
|
|
10
|
+
}
|
|
11
|
+
async createWorkspace(request) {
|
|
12
|
+
const client = this.client.getIdentityClient();
|
|
13
|
+
return await (0, makeRpcRequest_1.makeRpcRequest)({
|
|
14
|
+
method: client.createWorkspace.bind(client),
|
|
15
|
+
requestPBObjectConstructor: identity_pb_1.CreateWorkspaceRequest,
|
|
16
|
+
metadata: this.client.getMetadata(),
|
|
17
|
+
request
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
async getWorkspace(ref) {
|
|
21
|
+
const client = this.client.getIdentityClient();
|
|
22
|
+
return await (0, makeRpcRequest_1.makeRpcRequest)({
|
|
23
|
+
method: client.getWorkspace.bind(client),
|
|
24
|
+
requestPBObjectConstructor: identity_pb_1.GetWorkspaceRequest,
|
|
25
|
+
metadata: this.client.getMetadata(),
|
|
26
|
+
request: { ref }
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
async updateWorkspace(request) {
|
|
30
|
+
const client = this.client.getIdentityClient();
|
|
31
|
+
return await (0, makeRpcRequest_1.makeRpcRequest)({
|
|
32
|
+
method: client.updateWorkspace.bind(client),
|
|
33
|
+
requestPBObjectConstructor: identity_pb_1.UpdateWorkspaceRequest,
|
|
34
|
+
metadata: this.client.getMetadata(),
|
|
35
|
+
request
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
async deleteWorkspace(ref) {
|
|
39
|
+
const client = this.client.getIdentityClient();
|
|
40
|
+
return await (0, makeRpcRequest_1.makeRpcRequest)({
|
|
41
|
+
method: client.deleteWorkspace.bind(client),
|
|
42
|
+
requestPBObjectConstructor: identity_pb_1.DeleteWorkspaceRequest,
|
|
43
|
+
metadata: this.client.getMetadata(),
|
|
44
|
+
request: { ref }
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
async listWorkspaces() {
|
|
48
|
+
const applicationsClient = this.client.getIdentityClient();
|
|
49
|
+
return await (0, makeRpcRequest_1.makeRpcRequest)({
|
|
50
|
+
method: applicationsClient.listWorkspaces.bind(applicationsClient),
|
|
51
|
+
requestPBObjectConstructor: identity_pb_1.ListWorkspacesRequest,
|
|
52
|
+
metadata: this.client.getMetadata(),
|
|
53
|
+
request: {},
|
|
54
|
+
repeatableObjectMapping: [["itemsList", identity_pb_1.Workspace]]
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
async inviteUserToWorkspace(request) {
|
|
58
|
+
const client = this.client.getIdentityClient();
|
|
59
|
+
return await (0, makeRpcRequest_1.makeRpcRequest)({
|
|
60
|
+
method: client.inviteUserToWorkspace.bind(client),
|
|
61
|
+
requestPBObjectConstructor: identity_pb_1.InviteUserToWorkspaceRequest,
|
|
62
|
+
metadata: this.client.getMetadata(),
|
|
63
|
+
request
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
async resendWorkspaceMembershipInvitation(request) {
|
|
67
|
+
const client = this.client.getIdentityClient();
|
|
68
|
+
return await (0, makeRpcRequest_1.makeRpcRequest)({
|
|
69
|
+
method: client.resendWorkspaceMembershipInvitation.bind(client),
|
|
70
|
+
requestPBObjectConstructor: identity_pb_1.ResendWorkspaceMembershipInvitationRequest,
|
|
71
|
+
metadata: this.client.getMetadata(),
|
|
72
|
+
request
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
async removeUserFromWorkspace(request) {
|
|
76
|
+
const client = this.client.getIdentityClient();
|
|
77
|
+
return await (0, makeRpcRequest_1.makeRpcRequest)({
|
|
78
|
+
method: client.removeUserFromWorkspace.bind(client),
|
|
79
|
+
requestPBObjectConstructor: identity_pb_1.RemoveUserFromWorkspaceRequest,
|
|
80
|
+
metadata: this.client.getMetadata(),
|
|
81
|
+
request
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
exports.Workspaces = Workspaces;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import { ApplicationsClient, FonosterClient, IdentityClient } from "./types";
|
|
1
|
+
import { ApplicationsClient, CallsClient, FonosterClient, IdentityClient, SecretsClient } from "./types";
|
|
2
|
+
import { AclsClient } from "./types/AclsClient";
|
|
3
|
+
import { AgentsClient } from "./types/AgentsClient";
|
|
4
|
+
import { CredentialsClient } from "./types/CredentialsClient";
|
|
5
|
+
import { DomainsClient } from "./types/DomainsClient";
|
|
6
|
+
import { NumbersClient } from "./types/NumbersClient";
|
|
7
|
+
import { TrunksClient } from "./types/TrunksClient";
|
|
2
8
|
declare abstract class AbstractClient implements FonosterClient {
|
|
3
|
-
protected idToken: string;
|
|
4
9
|
protected accessKeyId: string;
|
|
5
10
|
protected _accessToken: string;
|
|
6
11
|
protected _refreshToken: string;
|
|
@@ -18,5 +23,14 @@ declare abstract class AbstractClient implements FonosterClient {
|
|
|
18
23
|
getRefreshToken(): string;
|
|
19
24
|
abstract getMetadata(): unknown;
|
|
20
25
|
abstract getApplicationsClient(): ApplicationsClient;
|
|
26
|
+
abstract getIdentityClient(): IdentityClient;
|
|
27
|
+
abstract getSecretsClient(): SecretsClient;
|
|
28
|
+
abstract getAgentsClient(): AgentsClient;
|
|
29
|
+
abstract getNumbersClient(): NumbersClient;
|
|
30
|
+
abstract getCredentialsClient(): CredentialsClient;
|
|
31
|
+
abstract getDomainsClient(): DomainsClient;
|
|
32
|
+
abstract getTrunksClient(): TrunksClient;
|
|
33
|
+
abstract getAclsClient(): AclsClient;
|
|
34
|
+
abstract getCallsClient(): CallsClient;
|
|
21
35
|
}
|
|
22
36
|
export { AbstractClient };
|
|
@@ -11,5 +11,13 @@ export declare class Client extends AbstractClient {
|
|
|
11
11
|
});
|
|
12
12
|
getMetadata(): Metadata;
|
|
13
13
|
getApplicationsClient(): any;
|
|
14
|
+
getCallsClient(): any;
|
|
14
15
|
getIdentityClient(): any;
|
|
16
|
+
getSecretsClient(): any;
|
|
17
|
+
getAgentsClient(): any;
|
|
18
|
+
getAclsClient(): any;
|
|
19
|
+
getDomainsClient(): any;
|
|
20
|
+
getTrunksClient(): any;
|
|
21
|
+
getNumbersClient(): any;
|
|
22
|
+
getCredentialsClient(): any;
|
|
15
23
|
}
|
|
@@ -22,8 +22,16 @@ exports.Client = void 0;
|
|
|
22
22
|
const grpc_js_1 = require("@grpc/grpc-js");
|
|
23
23
|
const AbstractClient_1 = require("./AbstractClient");
|
|
24
24
|
const TokenRefresherNode_1 = require("./TokenRefresherNode");
|
|
25
|
+
const acls_grpc_pb_1 = require("../generated/node/acls_grpc_pb");
|
|
26
|
+
const agents_grpc_pb_1 = require("../generated/node/agents_grpc_pb");
|
|
25
27
|
const applications_grpc_pb_1 = require("../generated/node/applications_grpc_pb");
|
|
28
|
+
const calls_grpc_pb_1 = require("../generated/node/calls_grpc_pb");
|
|
29
|
+
const credentials_grpc_pb_1 = require("../generated/node/credentials_grpc_pb");
|
|
30
|
+
const domains_grpc_pb_1 = require("../generated/node/domains_grpc_pb");
|
|
26
31
|
const identity_grpc_pb_1 = require("../generated/node/identity_grpc_pb");
|
|
32
|
+
const numbers_grpc_pb_1 = require("../generated/node/numbers_grpc_pb");
|
|
33
|
+
const secrets_grpc_pb_1 = require("../generated/node/secrets_grpc_pb");
|
|
34
|
+
const trunks_grpc_pb_1 = require("../generated/node/trunks_grpc_pb");
|
|
27
35
|
const DEFAULT_ENDPOINT = "api.fonoster.io:50051";
|
|
28
36
|
class Client extends AbstractClient_1.AbstractClient {
|
|
29
37
|
endpoint;
|
|
@@ -54,8 +62,48 @@ class Client extends AbstractClient_1.AbstractClient {
|
|
|
54
62
|
interceptors: [this.tokenRefresherInterceptor]
|
|
55
63
|
});
|
|
56
64
|
}
|
|
65
|
+
getCallsClient() {
|
|
66
|
+
return new calls_grpc_pb_1.CallsClient(this.endpoint, this.channelCredentials, {
|
|
67
|
+
interceptors: [this.tokenRefresherInterceptor]
|
|
68
|
+
});
|
|
69
|
+
}
|
|
57
70
|
getIdentityClient() {
|
|
58
71
|
return new identity_grpc_pb_1.IdentityClient(this.endpoint, this.channelCredentials);
|
|
59
72
|
}
|
|
73
|
+
getSecretsClient() {
|
|
74
|
+
return new secrets_grpc_pb_1.SecretsClient(this.endpoint, this.channelCredentials, {
|
|
75
|
+
interceptors: [this.tokenRefresherInterceptor]
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
getAgentsClient() {
|
|
79
|
+
return new agents_grpc_pb_1.AgentsClient(this.endpoint, this.channelCredentials, {
|
|
80
|
+
interceptors: [this.tokenRefresherInterceptor]
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
getAclsClient() {
|
|
84
|
+
return new acls_grpc_pb_1.AclsClient(this.endpoint, this.channelCredentials, {
|
|
85
|
+
interceptors: [this.tokenRefresherInterceptor]
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
getDomainsClient() {
|
|
89
|
+
return new domains_grpc_pb_1.DomainsClient(this.endpoint, this.channelCredentials, {
|
|
90
|
+
interceptors: [this.tokenRefresherInterceptor]
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
getTrunksClient() {
|
|
94
|
+
return new trunks_grpc_pb_1.TrunksClient(this.endpoint, this.channelCredentials, {
|
|
95
|
+
interceptors: [this.tokenRefresherInterceptor]
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
getNumbersClient() {
|
|
99
|
+
return new numbers_grpc_pb_1.NumbersClient(this.endpoint, this.channelCredentials, {
|
|
100
|
+
interceptors: [this.tokenRefresherInterceptor]
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
getCredentialsClient() {
|
|
104
|
+
return new credentials_grpc_pb_1.CredentialsServiceClient(this.endpoint, this.channelCredentials, {
|
|
105
|
+
interceptors: [this.tokenRefresherInterceptor]
|
|
106
|
+
});
|
|
107
|
+
}
|
|
60
108
|
}
|
|
61
109
|
exports.Client = Client;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isJwtExpired =
|
|
3
|
+
exports.isJwtExpired = isJwtExpired;
|
|
4
4
|
/*
|
|
5
5
|
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
6
6
|
* http://github.com/fonoster/fonoster
|
|
@@ -35,4 +35,3 @@ function isJwtExpired(token) {
|
|
|
35
35
|
return true;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
exports.isJwtExpired = isJwtExpired;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.jsonToObject =
|
|
3
|
+
exports.jsonToObject = jsonToObject;
|
|
4
4
|
const utils_1 = require("./utils");
|
|
5
5
|
function jsonToObject(params) {
|
|
6
6
|
const { json, objectConstructor: ObjectConstructor, enumMapping, objectMapping } = params;
|
|
@@ -29,4 +29,3 @@ function jsonToObject(params) {
|
|
|
29
29
|
});
|
|
30
30
|
return instance;
|
|
31
31
|
}
|
|
32
|
-
exports.jsonToObject = jsonToObject;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.makeRpcRequest =
|
|
3
|
+
exports.makeRpcRequest = makeRpcRequest;
|
|
4
4
|
/* eslint-disable no-loops/no-loops */
|
|
5
5
|
/*
|
|
6
6
|
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
@@ -42,4 +42,3 @@ function makeRpcRequest(params) {
|
|
|
42
42
|
});
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
|
-
exports.makeRpcRequest = makeRpcRequest;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.objectToJson =
|
|
3
|
+
exports.objectToJson = objectToJson;
|
|
4
4
|
const utils_1 = require("./utils");
|
|
5
5
|
function objectToJson(obj, enumMapping, repeatableObjectMapping) {
|
|
6
6
|
const json = {};
|
|
@@ -30,4 +30,3 @@ function objectToJson(obj, enumMapping, repeatableObjectMapping) {
|
|
|
30
30
|
});
|
|
31
31
|
return json;
|
|
32
32
|
}
|
|
33
|
-
exports.objectToJson = objectToJson;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ClientFunction } from "./common";
|
|
2
|
+
import { Acl, CreateAclRequest, CreateAclResponse, DeleteAclRequest, DeleteAclResponse, GetAclRequest, ListAclsRequest, ListAclsResponse, UpdateAclRequest, UpdateAclResponse } from "../../generated/web/acls_pb";
|
|
3
|
+
type AclsClient = {
|
|
4
|
+
createAcl: ClientFunction<CreateAclRequest, CreateAclResponse>;
|
|
5
|
+
getAcl: ClientFunction<GetAclRequest, Acl>;
|
|
6
|
+
updateAcl: ClientFunction<UpdateAclRequest, UpdateAclResponse>;
|
|
7
|
+
listAcls: ClientFunction<ListAclsRequest, ListAclsResponse>;
|
|
8
|
+
deleteAcl: ClientFunction<DeleteAclRequest, DeleteAclResponse>;
|
|
9
|
+
};
|
|
10
|
+
export { AclsClient };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ClientFunction } from "./common";
|
|
2
|
+
import { Agent, CreateAgentRequest, CreateAgentResponse, DeleteAgentRequest, DeleteAgentResponse, GetAgentRequest, ListAgentsRequest, ListAgentsResponse, UpdateAgentRequest, UpdateAgentResponse } from "../../generated/web/agents_pb";
|
|
3
|
+
type AgentsClient = {
|
|
4
|
+
createAgent: ClientFunction<CreateAgentRequest, CreateAgentResponse>;
|
|
5
|
+
getAgent: ClientFunction<GetAgentRequest, Agent>;
|
|
6
|
+
updateAgent: ClientFunction<UpdateAgentRequest, UpdateAgentResponse>;
|
|
7
|
+
listAgents: ClientFunction<ListAgentsRequest, ListAgentsResponse>;
|
|
8
|
+
deleteAgent: ClientFunction<DeleteAgentRequest, DeleteAgentResponse>;
|
|
9
|
+
};
|
|
10
|
+
export { AgentsClient };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ClientFunction } from "./common";
|
|
2
|
+
import { Application, CreateApplicationRequest, CreateApplicationResponse, DeleteApplicationRequest, DeleteApplicationResponse, GetApplicationRequest, ListApplicationsRequest, ListApplicationsResponse, UpdateApplicationRequest, UpdateApplicationResponse } from "../../generated/web/applications_pb";
|
|
3
|
+
type ApplicationsClient = {
|
|
4
|
+
createApplication: ClientFunction<CreateApplicationRequest, CreateApplicationResponse>;
|
|
5
|
+
getApplication: ClientFunction<GetApplicationRequest, Application>;
|
|
6
|
+
updateApplication: ClientFunction<UpdateApplicationRequest, UpdateApplicationResponse>;
|
|
7
|
+
listApplications: ClientFunction<ListApplicationsRequest, ListApplicationsResponse>;
|
|
8
|
+
deleteApplication: ClientFunction<DeleteApplicationRequest, DeleteApplicationResponse>;
|
|
9
|
+
};
|
|
10
|
+
export { ApplicationsClient };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ClientFunction } from "./common";
|
|
2
|
+
import { CallDetailRecord, CreateCallRequest, CreateCallResponse, GetCallRequest, ListCallsRequest, ListCallsResponse } from "../../generated/web/calls_pb";
|
|
3
|
+
type CallsClient = {
|
|
4
|
+
createCall: ClientFunction<CreateCallRequest, CreateCallResponse>;
|
|
5
|
+
getCall: ClientFunction<GetCallRequest, CallDetailRecord>;
|
|
6
|
+
listCalls: ClientFunction<ListCallsRequest, ListCallsResponse>;
|
|
7
|
+
};
|
|
8
|
+
export { CallsClient };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ClientFunction } from "./common";
|
|
2
|
+
import { CreateCredentialsRequest, CreateCredentialsResponse, Credentials, DeleteCredentialsRequest, DeleteCredentialsResponse, GetCredentialsRequest, ListCredentialsRequest, ListCredentialsResponse, UpdateCredentialsRequest, UpdateCredentialsResponse } from "../../generated/web/credentials_pb";
|
|
3
|
+
type CredentialsClient = {
|
|
4
|
+
createCredentials: ClientFunction<CreateCredentialsRequest, CreateCredentialsResponse>;
|
|
5
|
+
getCredentials: ClientFunction<GetCredentialsRequest, Credentials>;
|
|
6
|
+
updateCredentials: ClientFunction<UpdateCredentialsRequest, UpdateCredentialsResponse>;
|
|
7
|
+
listCredentials: ClientFunction<ListCredentialsRequest, ListCredentialsResponse>;
|
|
8
|
+
deleteCredentials: ClientFunction<DeleteCredentialsRequest, DeleteCredentialsResponse>;
|
|
9
|
+
};
|
|
10
|
+
export { CredentialsClient };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ClientFunction } from "./common";
|
|
2
|
+
import { CreateDomainRequest, CreateDomainResponse, DeleteDomainRequest, DeleteDomainResponse, Domain, GetDomainRequest, ListDomainsRequest, ListDomainsResponse, UpdateDomainRequest, UpdateDomainResponse } from "../../generated/web/domains_pb";
|
|
3
|
+
type DomainsClient = {
|
|
4
|
+
createDomain: ClientFunction<CreateDomainRequest, CreateDomainResponse>;
|
|
5
|
+
getDomain: ClientFunction<GetDomainRequest, Domain>;
|
|
6
|
+
updateDomain: ClientFunction<UpdateDomainRequest, UpdateDomainResponse>;
|
|
7
|
+
listDomains: ClientFunction<ListDomainsRequest, ListDomainsResponse>;
|
|
8
|
+
deleteDomain: ClientFunction<DeleteDomainRequest, DeleteDomainResponse>;
|
|
9
|
+
};
|
|
10
|
+
export { DomainsClient };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { AclsClient } from "./AclsClient";
|
|
2
|
+
import { AgentsClient } from "./AgentsClient";
|
|
3
|
+
import { ApplicationsClient } from "./ApplicationsClient";
|
|
4
|
+
import { CallsClient } from "./CallsClient";
|
|
5
|
+
import { CredentialsClient } from "./CredentialsClient";
|
|
6
|
+
import { DomainsClient } from "./DomainsClient";
|
|
7
|
+
import { IdentityClient } from "./IdentityClient";
|
|
8
|
+
import { NumbersClient } from "./NumbersClient";
|
|
9
|
+
import { SecretsClient } from "./SecretsClient";
|
|
10
|
+
import { TrunksClient } from "./TrunksClient";
|
|
11
|
+
interface FonosterClient {
|
|
12
|
+
getAccessToken(): string;
|
|
13
|
+
getAccessKeyId(): string;
|
|
14
|
+
getApplicationsClient(): ApplicationsClient;
|
|
15
|
+
getCallsClient(): CallsClient;
|
|
16
|
+
getIdentityClient(): IdentityClient;
|
|
17
|
+
getSecretsClient(): SecretsClient;
|
|
18
|
+
getAgentsClient(): AgentsClient;
|
|
19
|
+
getNumbersClient(): NumbersClient;
|
|
20
|
+
getCredentialsClient(): CredentialsClient;
|
|
21
|
+
getDomainsClient(): DomainsClient;
|
|
22
|
+
getTrunksClient(): TrunksClient;
|
|
23
|
+
getAclsClient(): AclsClient;
|
|
24
|
+
getMetadata(): unknown;
|
|
25
|
+
refreshToken(): Promise<void>;
|
|
26
|
+
}
|
|
27
|
+
export { FonosterClient };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { CreateApiKeyRequest, CreateApiKeyResponse, CreateUserRequest, CreateUserResponse, CreateWorkspaceRequest, DeleteApiKeyRequest, DeleteApiKeyResponse, DeleteUserRequest, DeleteUserResponse, DeleteWorkspaceRequest, DeleteWorkspaceResponse, ExchangeApiKeyRequest, ExchangeApiKeyResponse, ExchangeCredentialsRequest, ExchangeCredentialsResponse, ExchangeRefreshTokenRequest, ExchangeRefreshTokenResponse, GetUserRequest, GetUserResponse, GetWorkspaceRequest, InviteUserToWorkspaceRequest, InviteUserToWorkspaceResponse, ListApiKeysRequest, ListApiKeysResponse, ListWorkspacesRequest, ListWorkspacesResponse, RegenerateApiKeyRequest, RegenerateApiKeyResponse, RemoveUserFromWorkspaceRequest, RemoveUserFromWorkspaceResponse, ResendWorkspaceMembershipInvitationRequest, ResendWorkspaceMembershipInvitationResponse, UpdateUserRequest, UpdateWorkspaceRequest, UpdateWorkspaceResponse, Workspace } from "../../generated/web/identity_pb";
|
|
2
|
+
import { ClientFunction } from "../types";
|
|
3
|
+
type IdentityClient = {
|
|
4
|
+
createApiKey: ClientFunction<CreateApiKeyRequest, CreateApiKeyResponse>;
|
|
5
|
+
regenerateApiKey: ClientFunction<RegenerateApiKeyRequest, RegenerateApiKeyResponse>;
|
|
6
|
+
listApiKeys: ClientFunction<ListApiKeysRequest, ListApiKeysResponse>;
|
|
7
|
+
deleteApiKey: ClientFunction<DeleteApiKeyRequest, DeleteApiKeyResponse>;
|
|
8
|
+
exchangeApiKey: ClientFunction<ExchangeApiKeyRequest, ExchangeApiKeyResponse>;
|
|
9
|
+
exchangeCredentials: ClientFunction<ExchangeCredentialsRequest, ExchangeCredentialsResponse>;
|
|
10
|
+
exchangeRefreshToken: ClientFunction<ExchangeRefreshTokenRequest, ExchangeRefreshTokenResponse>;
|
|
11
|
+
createUser: ClientFunction<CreateUserRequest, CreateUserResponse>;
|
|
12
|
+
getUser: ClientFunction<GetUserRequest, GetUserResponse>;
|
|
13
|
+
updateUser: ClientFunction<UpdateUserRequest, CreateUserResponse>;
|
|
14
|
+
deleteUser: ClientFunction<DeleteUserRequest, DeleteUserResponse>;
|
|
15
|
+
createWorkspace: ClientFunction<CreateWorkspaceRequest, CreateUserResponse>;
|
|
16
|
+
getWorkspace: ClientFunction<GetWorkspaceRequest, Workspace>;
|
|
17
|
+
listWorkspaces: ClientFunction<ListWorkspacesRequest, ListWorkspacesResponse>;
|
|
18
|
+
updateWorkspace: ClientFunction<UpdateWorkspaceRequest, UpdateWorkspaceResponse>;
|
|
19
|
+
inviteUserToWorkspace: ClientFunction<InviteUserToWorkspaceRequest, InviteUserToWorkspaceResponse>;
|
|
20
|
+
resendWorkspaceMembershipInvitation: ClientFunction<ResendWorkspaceMembershipInvitationRequest, ResendWorkspaceMembershipInvitationResponse>;
|
|
21
|
+
removeUserFromWorkspace: ClientFunction<RemoveUserFromWorkspaceRequest, RemoveUserFromWorkspaceResponse>;
|
|
22
|
+
deleteWorkspace: ClientFunction<DeleteWorkspaceRequest, DeleteWorkspaceResponse>;
|
|
23
|
+
};
|
|
24
|
+
export { IdentityClient };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ClientFunction } from "./common";
|
|
2
|
+
import { CreateNumberRequest, CreateNumberResponse, DeleteNumberRequest, DeleteNumberResponse, GetNumberRequest, Number as INumber, ListNumbersRequest, ListNumbersResponse, UpdateNumberRequest, UpdateNumberResponse } from "../../generated/web/numbers_pb";
|
|
3
|
+
type NumbersClient = {
|
|
4
|
+
createNumber: ClientFunction<CreateNumberRequest, CreateNumberResponse>;
|
|
5
|
+
getNumber: ClientFunction<GetNumberRequest, INumber>;
|
|
6
|
+
updateNumber: ClientFunction<UpdateNumberRequest, UpdateNumberResponse>;
|
|
7
|
+
listNumbers: ClientFunction<ListNumbersRequest, ListNumbersResponse>;
|
|
8
|
+
deleteNumber: ClientFunction<DeleteNumberRequest, DeleteNumberResponse>;
|
|
9
|
+
};
|
|
10
|
+
export { NumbersClient };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ClientFunction } from "./common";
|
|
2
|
+
import { CreateSecretRequest, CreateSecretResponse, DeleteSecretRequest, DeleteSecretResponse, GetSecretRequest, ListSecretsRequest, ListSecretsResponse, Secret, UpdateSecretRequest, UpdateSecretResponse } from "../../generated/web/secrets_pb";
|
|
3
|
+
type SecretsClient = {
|
|
4
|
+
createSecret: ClientFunction<CreateSecretRequest, CreateSecretResponse>;
|
|
5
|
+
getSecret: ClientFunction<GetSecretRequest, Secret>;
|
|
6
|
+
updateSecret: ClientFunction<UpdateSecretRequest, UpdateSecretResponse>;
|
|
7
|
+
listSecrets: ClientFunction<ListSecretsRequest, ListSecretsResponse>;
|
|
8
|
+
deleteSecret: ClientFunction<DeleteSecretRequest, DeleteSecretResponse>;
|
|
9
|
+
};
|
|
10
|
+
export { SecretsClient };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ClientFunction } from "./common";
|
|
2
|
+
import { CreateTrunkRequest, CreateTrunkResponse, DeleteTrunkRequest, DeleteTrunkResponse, GetTrunkRequest, ListTrunksRequest, ListTrunksResponse, Trunk, UpdateTrunkRequest, UpdateTrunkResponse } from "../../generated/web/trunks_pb";
|
|
3
|
+
type TrunksClient = {
|
|
4
|
+
createTrunk: ClientFunction<CreateTrunkRequest, CreateTrunkResponse>;
|
|
5
|
+
getTrunk: ClientFunction<GetTrunkRequest, Trunk>;
|
|
6
|
+
updateTrunk: ClientFunction<UpdateTrunkRequest, UpdateTrunkResponse>;
|
|
7
|
+
listTrunks: ClientFunction<ListTrunksRequest, ListTrunksResponse>;
|
|
8
|
+
deleteTrunk: ClientFunction<DeleteTrunkRequest, DeleteTrunkResponse>;
|
|
9
|
+
};
|
|
10
|
+
export { TrunksClient };
|