@fonoster/sdk 0.6.2-alpha.0 → 0.6.3
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 +2301 -169
- package/dist/node/Acls.d.ts +138 -0
- package/dist/node/Acls.js +140 -2
- package/dist/node/Agents.d.ts +151 -0
- package/dist/node/Agents.js +151 -0
- package/dist/node/ApiKeys.d.ts +109 -0
- package/dist/node/ApiKeys.js +109 -0
- package/dist/node/Applications.d.ts +30 -26
- package/dist/node/Applications.js +30 -26
- package/dist/node/Calls.d.ts +99 -0
- package/dist/node/Calls.js +99 -0
- package/dist/node/Credentials.d.ts +136 -0
- package/dist/node/Credentials.js +136 -0
- package/dist/node/Domains.d.ts +140 -0
- package/dist/node/Domains.js +140 -0
- package/dist/node/Numbers.d.ts +140 -0
- package/dist/node/Numbers.js +140 -0
- package/dist/node/Secrets.d.ts +132 -0
- package/dist/node/Secrets.js +132 -0
- package/dist/node/Trunks.d.ts +169 -0
- package/dist/node/Trunks.js +170 -0
- package/dist/node/Users.d.ts +121 -0
- package/dist/node/Users.js +121 -0
- package/dist/node/Workspaces.d.ts +183 -3
- package/dist/node/Workspaces.js +184 -4
- package/dist/node/tsconfig.node.tsbuildinfo +1 -1
- package/dist/web/fonoster.min.js +1 -1
- package/dist/web/index.esm.js +1 -1
- package/package.json +4 -3
package/dist/node/ApiKeys.d.ts
CHANGED
|
@@ -1,11 +1,120 @@
|
|
|
1
1
|
import { BaseApiObject, CreateApiKeyRequest, CreateApiKeyResponse, ListApiKeysRequest, ListApiKeysResponse } from "@fonoster/types";
|
|
2
2
|
import { FonosterClient } from "./client/types";
|
|
3
|
+
/**
|
|
4
|
+
* @classdesc Fonoster ApiKeys, part of the Fonoster Identity subsystem,
|
|
5
|
+
* allows you to create, update, retrieve, and delete ApiKeys for your deployment.
|
|
6
|
+
* Note that an active Fonoster deployment is required.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
*
|
|
10
|
+
* const SDK = require("@fonoster/sdk");
|
|
11
|
+
*
|
|
12
|
+
* async function main(request) {
|
|
13
|
+
* const apiKey = "your-api-key";
|
|
14
|
+
* const accessKeyId = "00000000-0000-0000-0000-000000000000";
|
|
15
|
+
*
|
|
16
|
+
* try {
|
|
17
|
+
* const client = SDK.Client({ accessKeyId });
|
|
18
|
+
* await client.loginWithApiKey(apiKey);
|
|
19
|
+
*
|
|
20
|
+
* const apiKeys = new SDK.ApiKeys(client);
|
|
21
|
+
* const response = await apiKeys.createApiKey(request);
|
|
22
|
+
*
|
|
23
|
+
* console.log(response); // successful response
|
|
24
|
+
* } catch (e) {
|
|
25
|
+
* console.error(e); // an error occurred
|
|
26
|
+
* }
|
|
27
|
+
* }
|
|
28
|
+
*
|
|
29
|
+
* const request = {
|
|
30
|
+
* role: "WORKSPACE_ADMIN"
|
|
31
|
+
* };
|
|
32
|
+
*
|
|
33
|
+
* main(request).catch(console.error);
|
|
34
|
+
*/
|
|
3
35
|
declare class ApiKeys {
|
|
4
36
|
private client;
|
|
37
|
+
/**
|
|
38
|
+
* Constructs a new ApiKeys object.
|
|
39
|
+
*
|
|
40
|
+
* @param {FonosterClient} client - Client object with underlying implementations to make requests to Fonoster's API
|
|
41
|
+
* @see AbstractClient
|
|
42
|
+
* @see FonosterClient
|
|
43
|
+
*/
|
|
5
44
|
constructor(client: FonosterClient);
|
|
45
|
+
/**
|
|
46
|
+
* Creates a new ApiKey for a Workspace.
|
|
47
|
+
*
|
|
48
|
+
* @param {CreateApiKeyRequest} request - The request object that contains the necessary information to create a new ApiKey
|
|
49
|
+
* @param {ApiRoleEnum} request.role - The role of the ApiKey
|
|
50
|
+
* @return {Promise<CreateApiKeyResponse>} - The response object that contains the reference to the created ApiKey
|
|
51
|
+
* @example
|
|
52
|
+
*
|
|
53
|
+
* const request = {
|
|
54
|
+
* role: "WORKSPACE_ADMIN"
|
|
55
|
+
* };
|
|
56
|
+
*
|
|
57
|
+
* const apiKeys = new SDK.ApiKeys(client); // Existing client object
|
|
58
|
+
*
|
|
59
|
+
* apiKeys.createApiKey(request)
|
|
60
|
+
* .then(console.log) // successful response
|
|
61
|
+
* .catch(console.error); // an error occurred
|
|
62
|
+
*/
|
|
6
63
|
createApiKey(request: CreateApiKeyRequest): Promise<CreateApiKeyResponse>;
|
|
64
|
+
/**
|
|
65
|
+
* Regenerates an existing ApiKey for a Workspace.
|
|
66
|
+
* Note that this operation is irreversible.
|
|
67
|
+
*
|
|
68
|
+
* @param {string} ref - The reference of the ApiKey to regenerate
|
|
69
|
+
* @return {Promise<CreateApiKeyResponse>} - The response object that contains the reference to the regenerated ApiKey
|
|
70
|
+
* @example
|
|
71
|
+
*
|
|
72
|
+
* const ref = "00000000-0000-0000-0000-000000000000"
|
|
73
|
+
*
|
|
74
|
+
* const apiKeys = new SDK.ApiKeys(client); // Existing client object
|
|
75
|
+
*
|
|
76
|
+
* apiKeys.regenerateApiKey(ref)
|
|
77
|
+
* .then(console.log) // successful response
|
|
78
|
+
* .catch(console.error); // an error occurred
|
|
79
|
+
*/
|
|
7
80
|
regenerateApiKey(ref: string): Promise<CreateApiKeyResponse>;
|
|
81
|
+
/**
|
|
82
|
+
* Retrieves a list of ApiKeys from a Workspace.
|
|
83
|
+
*
|
|
84
|
+
* @param {ListApiKeysRequest} request - The request object that contains the necessary information to retrieve a list of ApiKeys
|
|
85
|
+
* @param {number} request.pageSize - The number of ApiKeys to retrieve
|
|
86
|
+
* @param {string} request.pageToken - The token to retrieve the next page of ApiKeys
|
|
87
|
+
* @return {Promise<ListApiKeysResponse>} - The response object that contains the list of ApiKeys
|
|
88
|
+
* @example
|
|
89
|
+
*
|
|
90
|
+
* const request = {
|
|
91
|
+
* pageSize: 10,
|
|
92
|
+
* pageToken: "00000000-0000-0000-0000-000000000000"
|
|
93
|
+
* };
|
|
94
|
+
*
|
|
95
|
+
* const apiKeys = new SDK.ApiKeys(client); // Existing client object
|
|
96
|
+
*
|
|
97
|
+
* apiKeys.listApiKeys(request)
|
|
98
|
+
* .then(console.log) // successful response
|
|
99
|
+
* .catch(console.error); // an error occurred
|
|
100
|
+
*/
|
|
8
101
|
listApiKeys(request: ListApiKeysRequest): Promise<ListApiKeysResponse>;
|
|
102
|
+
/**
|
|
103
|
+
* Deletes an existing ApiKey from Fonoster.
|
|
104
|
+
* Note that this operation is irreversible.
|
|
105
|
+
*
|
|
106
|
+
* @param {string} ref - The reference of the ApiKey to delete
|
|
107
|
+
* @return {Promise<BaseApiObject>} - The response object that contains the reference to the deleted ApiKey
|
|
108
|
+
* @example
|
|
109
|
+
*
|
|
110
|
+
* const ref = "00000000-0000-0000-0000-000000000000"
|
|
111
|
+
*
|
|
112
|
+
* const apiKeys = new SDK.ApiKeys(client); // Existing client object
|
|
113
|
+
*
|
|
114
|
+
* apiKeys.deleteApiKey(ref)
|
|
115
|
+
* .then(console.log) // successful response
|
|
116
|
+
* .catch(console.error); // an error occurred
|
|
117
|
+
*/
|
|
9
118
|
deleteApiKey(ref: string): Promise<BaseApiObject>;
|
|
10
119
|
}
|
|
11
120
|
export { ApiKeys };
|
package/dist/node/ApiKeys.js
CHANGED
|
@@ -22,11 +22,68 @@ exports.ApiKeys = void 0;
|
|
|
22
22
|
const types_1 = require("@fonoster/types");
|
|
23
23
|
const makeRpcRequest_1 = require("./client/makeRpcRequest");
|
|
24
24
|
const identity_pb_1 = require("./generated/node/identity_pb");
|
|
25
|
+
/**
|
|
26
|
+
* @classdesc Fonoster ApiKeys, part of the Fonoster Identity subsystem,
|
|
27
|
+
* allows you to create, update, retrieve, and delete ApiKeys for your deployment.
|
|
28
|
+
* Note that an active Fonoster deployment is required.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
*
|
|
32
|
+
* const SDK = require("@fonoster/sdk");
|
|
33
|
+
*
|
|
34
|
+
* async function main(request) {
|
|
35
|
+
* const apiKey = "your-api-key";
|
|
36
|
+
* const accessKeyId = "00000000-0000-0000-0000-000000000000";
|
|
37
|
+
*
|
|
38
|
+
* try {
|
|
39
|
+
* const client = SDK.Client({ accessKeyId });
|
|
40
|
+
* await client.loginWithApiKey(apiKey);
|
|
41
|
+
*
|
|
42
|
+
* const apiKeys = new SDK.ApiKeys(client);
|
|
43
|
+
* const response = await apiKeys.createApiKey(request);
|
|
44
|
+
*
|
|
45
|
+
* console.log(response); // successful response
|
|
46
|
+
* } catch (e) {
|
|
47
|
+
* console.error(e); // an error occurred
|
|
48
|
+
* }
|
|
49
|
+
* }
|
|
50
|
+
*
|
|
51
|
+
* const request = {
|
|
52
|
+
* role: "WORKSPACE_ADMIN"
|
|
53
|
+
* };
|
|
54
|
+
*
|
|
55
|
+
* main(request).catch(console.error);
|
|
56
|
+
*/
|
|
25
57
|
class ApiKeys {
|
|
26
58
|
client;
|
|
59
|
+
/**
|
|
60
|
+
* Constructs a new ApiKeys object.
|
|
61
|
+
*
|
|
62
|
+
* @param {FonosterClient} client - Client object with underlying implementations to make requests to Fonoster's API
|
|
63
|
+
* @see AbstractClient
|
|
64
|
+
* @see FonosterClient
|
|
65
|
+
*/
|
|
27
66
|
constructor(client) {
|
|
28
67
|
this.client = client;
|
|
29
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Creates a new ApiKey for a Workspace.
|
|
71
|
+
*
|
|
72
|
+
* @param {CreateApiKeyRequest} request - The request object that contains the necessary information to create a new ApiKey
|
|
73
|
+
* @param {ApiRoleEnum} request.role - The role of the ApiKey
|
|
74
|
+
* @return {Promise<CreateApiKeyResponse>} - The response object that contains the reference to the created ApiKey
|
|
75
|
+
* @example
|
|
76
|
+
*
|
|
77
|
+
* const request = {
|
|
78
|
+
* role: "WORKSPACE_ADMIN"
|
|
79
|
+
* };
|
|
80
|
+
*
|
|
81
|
+
* const apiKeys = new SDK.ApiKeys(client); // Existing client object
|
|
82
|
+
*
|
|
83
|
+
* apiKeys.createApiKey(request)
|
|
84
|
+
* .then(console.log) // successful response
|
|
85
|
+
* .catch(console.error); // an error occurred
|
|
86
|
+
*/
|
|
30
87
|
async createApiKey(request) {
|
|
31
88
|
const client = this.client.getIdentityClient();
|
|
32
89
|
return await (0, makeRpcRequest_1.makeRpcRequest)({
|
|
@@ -37,6 +94,22 @@ class ApiKeys {
|
|
|
37
94
|
enumMapping: [["role", types_1.ApiRoleEnum]]
|
|
38
95
|
});
|
|
39
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* Regenerates an existing ApiKey for a Workspace.
|
|
99
|
+
* Note that this operation is irreversible.
|
|
100
|
+
*
|
|
101
|
+
* @param {string} ref - The reference of the ApiKey to regenerate
|
|
102
|
+
* @return {Promise<CreateApiKeyResponse>} - The response object that contains the reference to the regenerated ApiKey
|
|
103
|
+
* @example
|
|
104
|
+
*
|
|
105
|
+
* const ref = "00000000-0000-0000-0000-000000000000"
|
|
106
|
+
*
|
|
107
|
+
* const apiKeys = new SDK.ApiKeys(client); // Existing client object
|
|
108
|
+
*
|
|
109
|
+
* apiKeys.regenerateApiKey(ref)
|
|
110
|
+
* .then(console.log) // successful response
|
|
111
|
+
* .catch(console.error); // an error occurred
|
|
112
|
+
*/
|
|
40
113
|
async regenerateApiKey(ref) {
|
|
41
114
|
const client = this.client.getIdentityClient();
|
|
42
115
|
return await (0, makeRpcRequest_1.makeRpcRequest)({
|
|
@@ -46,6 +119,26 @@ class ApiKeys {
|
|
|
46
119
|
request: { ref }
|
|
47
120
|
});
|
|
48
121
|
}
|
|
122
|
+
/**
|
|
123
|
+
* Retrieves a list of ApiKeys from a Workspace.
|
|
124
|
+
*
|
|
125
|
+
* @param {ListApiKeysRequest} request - The request object that contains the necessary information to retrieve a list of ApiKeys
|
|
126
|
+
* @param {number} request.pageSize - The number of ApiKeys to retrieve
|
|
127
|
+
* @param {string} request.pageToken - The token to retrieve the next page of ApiKeys
|
|
128
|
+
* @return {Promise<ListApiKeysResponse>} - The response object that contains the list of ApiKeys
|
|
129
|
+
* @example
|
|
130
|
+
*
|
|
131
|
+
* const request = {
|
|
132
|
+
* pageSize: 10,
|
|
133
|
+
* pageToken: "00000000-0000-0000-0000-000000000000"
|
|
134
|
+
* };
|
|
135
|
+
*
|
|
136
|
+
* const apiKeys = new SDK.ApiKeys(client); // Existing client object
|
|
137
|
+
*
|
|
138
|
+
* apiKeys.listApiKeys(request)
|
|
139
|
+
* .then(console.log) // successful response
|
|
140
|
+
* .catch(console.error); // an error occurred
|
|
141
|
+
*/
|
|
49
142
|
async listApiKeys(request) {
|
|
50
143
|
const applicationsClient = this.client.getIdentityClient();
|
|
51
144
|
return await (0, makeRpcRequest_1.makeRpcRequest)({
|
|
@@ -56,6 +149,22 @@ class ApiKeys {
|
|
|
56
149
|
repeatableObjectMapping: [["itemsList", identity_pb_1.ApiKey]]
|
|
57
150
|
});
|
|
58
151
|
}
|
|
152
|
+
/**
|
|
153
|
+
* Deletes an existing ApiKey from Fonoster.
|
|
154
|
+
* Note that this operation is irreversible.
|
|
155
|
+
*
|
|
156
|
+
* @param {string} ref - The reference of the ApiKey to delete
|
|
157
|
+
* @return {Promise<BaseApiObject>} - The response object that contains the reference to the deleted ApiKey
|
|
158
|
+
* @example
|
|
159
|
+
*
|
|
160
|
+
* const ref = "00000000-0000-0000-0000-000000000000"
|
|
161
|
+
*
|
|
162
|
+
* const apiKeys = new SDK.ApiKeys(client); // Existing client object
|
|
163
|
+
*
|
|
164
|
+
* apiKeys.deleteApiKey(ref)
|
|
165
|
+
* .then(console.log) // successful response
|
|
166
|
+
* .catch(console.error); // an error occurred
|
|
167
|
+
*/
|
|
59
168
|
async deleteApiKey(ref) {
|
|
60
169
|
const client = this.client.getIdentityClient();
|
|
61
170
|
return await (0, makeRpcRequest_1.makeRpcRequest)({
|
|
@@ -9,6 +9,23 @@ import { FonosterClient } from "./client/types";
|
|
|
9
9
|
*
|
|
10
10
|
* const SDK = require("@fonoster/sdk");
|
|
11
11
|
*
|
|
12
|
+
* async function main(request) {
|
|
13
|
+
* const apiKey = "your-api-key";
|
|
14
|
+
* const accessKeyId = "00000000-0000-0000-0000-000000000000";
|
|
15
|
+
*
|
|
16
|
+
* try {
|
|
17
|
+
* const client = SDK.Client({ accessKeyId });
|
|
18
|
+
* await client.loginWithApiKey(apiKey);
|
|
19
|
+
*
|
|
20
|
+
* const apps = new SDK.Applications(client);
|
|
21
|
+
* const response = await apps.createApplication(request);
|
|
22
|
+
*
|
|
23
|
+
* console.log(response); // successful response
|
|
24
|
+
* } catch (e) {
|
|
25
|
+
* console.error(e); // an error occurred
|
|
26
|
+
* }
|
|
27
|
+
* }
|
|
28
|
+
*
|
|
12
29
|
* const request = {
|
|
13
30
|
* name: "My application",
|
|
14
31
|
* type: "PROGRAMMABLE_VOICE",
|
|
@@ -36,18 +53,7 @@ import { FonosterClient } from "./client/types";
|
|
|
36
53
|
* }
|
|
37
54
|
* };
|
|
38
55
|
*
|
|
39
|
-
*
|
|
40
|
-
* const password = "changeme";
|
|
41
|
-
* const accessKeyId = "WO00000000000000000000000000000000";
|
|
42
|
-
*
|
|
43
|
-
* const client = new SDK.Client({ accessKeyId });
|
|
44
|
-
*
|
|
45
|
-
* client.login(username, password)
|
|
46
|
-
* .then(async () => {
|
|
47
|
-
* const apps = new SDK.Applications(client);
|
|
48
|
-
* const result = await apps.createApplication(request);
|
|
49
|
-
* console.log(result); // successful response
|
|
50
|
-
* }).catch(console.error); // an error occurred
|
|
56
|
+
* main(request).catch(console.error);
|
|
51
57
|
*/
|
|
52
58
|
declare class Applications {
|
|
53
59
|
private client;
|
|
@@ -114,19 +120,17 @@ declare class Applications {
|
|
|
114
120
|
*/
|
|
115
121
|
createApplication(request: CreateApplicationRequest): Promise<CreateApplicationResponse>;
|
|
116
122
|
/**
|
|
117
|
-
* Retrieves an existing
|
|
123
|
+
* Retrieves an existing Application in the Workspace.
|
|
118
124
|
*
|
|
119
|
-
* @param {string} ref - The reference of the
|
|
120
|
-
* @return {Promise<Application>} - The response object that contains the
|
|
125
|
+
* @param {string} ref - The reference of the Application to retrieve
|
|
126
|
+
* @return {Promise<Application>} - The response object that contains the Application information
|
|
121
127
|
* @example
|
|
122
128
|
*
|
|
123
|
-
* const
|
|
124
|
-
* ref: "00000000-0000-0000-0000-000000000000"
|
|
125
|
-
* };
|
|
129
|
+
* const ref = "00000000-0000-0000-0000-000000000000"
|
|
126
130
|
*
|
|
127
131
|
* const apps = new SDK.Applications(client); // Existing client object
|
|
128
132
|
*
|
|
129
|
-
* apps.getApplication(
|
|
133
|
+
* apps.getApplication(ref)
|
|
130
134
|
* .then(console.log) // successful response
|
|
131
135
|
* .catch(console.error); // an error occurred
|
|
132
136
|
*/
|
|
@@ -165,12 +169,12 @@ declare class Applications {
|
|
|
165
169
|
*/
|
|
166
170
|
updateApplication(request: UpdateApplicationRequest): Promise<BaseApiObject>;
|
|
167
171
|
/**
|
|
168
|
-
* Retrieves a list of
|
|
172
|
+
* Retrieves a list of Applications from Fonoster.
|
|
169
173
|
*
|
|
170
|
-
* @param {ListApplicationsRequest} request - The request object that contains the necessary information to retrieve a list of
|
|
171
|
-
* @param {number} request.pageSize - The number of
|
|
172
|
-
* @param {string} request.pageToken - The token to retrieve the next page of
|
|
173
|
-
* @return {Promise<ListApplicationsResponse>} - The response object that contains the list of
|
|
174
|
+
* @param {ListApplicationsRequest} request - The request object that contains the necessary information to retrieve a list of Applications
|
|
175
|
+
* @param {number} request.pageSize - The number of Applications to retrieve
|
|
176
|
+
* @param {string} request.pageToken - The token to retrieve the next page of Applications
|
|
177
|
+
* @return {Promise<ListApplicationsResponse>} - The response object that contains the list of Applications
|
|
174
178
|
* @example
|
|
175
179
|
*
|
|
176
180
|
* const request = {
|
|
@@ -186,10 +190,10 @@ declare class Applications {
|
|
|
186
190
|
*/
|
|
187
191
|
listApplications(request: ListApplicationsRequest): Promise<ListApplicationsResponse>;
|
|
188
192
|
/**
|
|
189
|
-
* Deletes an existing
|
|
193
|
+
* Deletes an existing Application from Fonoster.
|
|
190
194
|
* Note that this operation is irreversible.
|
|
191
195
|
*
|
|
192
|
-
* @param {string} ref - The reference of the
|
|
196
|
+
* @param {string} ref - The reference of the Application to delete
|
|
193
197
|
* @return {Promise<BaseApiObject>} - The response object that contains the reference to the deleted application
|
|
194
198
|
* @example
|
|
195
199
|
*
|
|
@@ -13,6 +13,23 @@ const utils_1 = require("./utils");
|
|
|
13
13
|
*
|
|
14
14
|
* const SDK = require("@fonoster/sdk");
|
|
15
15
|
*
|
|
16
|
+
* async function main(request) {
|
|
17
|
+
* const apiKey = "your-api-key";
|
|
18
|
+
* const accessKeyId = "00000000-0000-0000-0000-000000000000";
|
|
19
|
+
*
|
|
20
|
+
* try {
|
|
21
|
+
* const client = SDK.Client({ accessKeyId });
|
|
22
|
+
* await client.loginWithApiKey(apiKey);
|
|
23
|
+
*
|
|
24
|
+
* const apps = new SDK.Applications(client);
|
|
25
|
+
* const response = await apps.createApplication(request);
|
|
26
|
+
*
|
|
27
|
+
* console.log(response); // successful response
|
|
28
|
+
* } catch (e) {
|
|
29
|
+
* console.error(e); // an error occurred
|
|
30
|
+
* }
|
|
31
|
+
* }
|
|
32
|
+
*
|
|
16
33
|
* const request = {
|
|
17
34
|
* name: "My application",
|
|
18
35
|
* type: "PROGRAMMABLE_VOICE",
|
|
@@ -40,18 +57,7 @@ const utils_1 = require("./utils");
|
|
|
40
57
|
* }
|
|
41
58
|
* };
|
|
42
59
|
*
|
|
43
|
-
*
|
|
44
|
-
* const password = "changeme";
|
|
45
|
-
* const accessKeyId = "WO00000000000000000000000000000000";
|
|
46
|
-
*
|
|
47
|
-
* const client = new SDK.Client({ accessKeyId });
|
|
48
|
-
*
|
|
49
|
-
* client.login(username, password)
|
|
50
|
-
* .then(async () => {
|
|
51
|
-
* const apps = new SDK.Applications(client);
|
|
52
|
-
* const result = await apps.createApplication(request);
|
|
53
|
-
* console.log(result); // successful response
|
|
54
|
-
* }).catch(console.error); // an error occurred
|
|
60
|
+
* main(request).catch(console.error);
|
|
55
61
|
*/
|
|
56
62
|
class Applications {
|
|
57
63
|
client;
|
|
@@ -135,19 +141,17 @@ class Applications {
|
|
|
135
141
|
});
|
|
136
142
|
}
|
|
137
143
|
/**
|
|
138
|
-
* Retrieves an existing
|
|
144
|
+
* Retrieves an existing Application in the Workspace.
|
|
139
145
|
*
|
|
140
|
-
* @param {string} ref - The reference of the
|
|
141
|
-
* @return {Promise<Application>} - The response object that contains the
|
|
146
|
+
* @param {string} ref - The reference of the Application to retrieve
|
|
147
|
+
* @return {Promise<Application>} - The response object that contains the Application information
|
|
142
148
|
* @example
|
|
143
149
|
*
|
|
144
|
-
* const
|
|
145
|
-
* ref: "00000000-0000-0000-0000-000000000000"
|
|
146
|
-
* };
|
|
150
|
+
* const ref = "00000000-0000-0000-0000-000000000000"
|
|
147
151
|
*
|
|
148
152
|
* const apps = new SDK.Applications(client); // Existing client object
|
|
149
153
|
*
|
|
150
|
-
* apps.getApplication(
|
|
154
|
+
* apps.getApplication(ref)
|
|
151
155
|
* .then(console.log) // successful response
|
|
152
156
|
* .catch(console.error); // an error occurred
|
|
153
157
|
*/
|
|
@@ -209,12 +213,12 @@ class Applications {
|
|
|
209
213
|
});
|
|
210
214
|
}
|
|
211
215
|
/**
|
|
212
|
-
* Retrieves a list of
|
|
216
|
+
* Retrieves a list of Applications from Fonoster.
|
|
213
217
|
*
|
|
214
|
-
* @param {ListApplicationsRequest} request - The request object that contains the necessary information to retrieve a list of
|
|
215
|
-
* @param {number} request.pageSize - The number of
|
|
216
|
-
* @param {string} request.pageToken - The token to retrieve the next page of
|
|
217
|
-
* @return {Promise<ListApplicationsResponse>} - The response object that contains the list of
|
|
218
|
+
* @param {ListApplicationsRequest} request - The request object that contains the necessary information to retrieve a list of Applications
|
|
219
|
+
* @param {number} request.pageSize - The number of Applications to retrieve
|
|
220
|
+
* @param {string} request.pageToken - The token to retrieve the next page of Applications
|
|
221
|
+
* @return {Promise<ListApplicationsResponse>} - The response object that contains the list of Applications
|
|
218
222
|
* @example
|
|
219
223
|
*
|
|
220
224
|
* const request = {
|
|
@@ -239,10 +243,10 @@ class Applications {
|
|
|
239
243
|
});
|
|
240
244
|
}
|
|
241
245
|
/**
|
|
242
|
-
* Deletes an existing
|
|
246
|
+
* Deletes an existing Application from Fonoster.
|
|
243
247
|
* Note that this operation is irreversible.
|
|
244
248
|
*
|
|
245
|
-
* @param {string} ref - The reference of the
|
|
249
|
+
* @param {string} ref - The reference of the Application to delete
|
|
246
250
|
* @return {Promise<BaseApiObject>} - The response object that contains the reference to the deleted application
|
|
247
251
|
* @example
|
|
248
252
|
*
|
package/dist/node/Calls.d.ts
CHANGED
|
@@ -1,10 +1,109 @@
|
|
|
1
1
|
import { CallDetailRecord, CreateCallRequest, CreateCallResponse, ListCallsRequest, ListCallsResponse } from "@fonoster/types";
|
|
2
2
|
import { FonosterClient } from "./client/types";
|
|
3
|
+
/**
|
|
4
|
+
* @classdesc Fonoster Calls, part of the Fonoster Media subsystem,
|
|
5
|
+
* allows you to create, list, and track calls in your deployment.
|
|
6
|
+
* Note that an active Fonoster deployment is required.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
*
|
|
10
|
+
* const SDK = require("@fonoster/sdk");
|
|
11
|
+
*
|
|
12
|
+
* async function main(request) {
|
|
13
|
+
* const username = "admin";
|
|
14
|
+
* const password = "yourpassword";
|
|
15
|
+
* const accessKeyId = "00000000-0000-0000-0000-000000000000";
|
|
16
|
+
*
|
|
17
|
+
* try {
|
|
18
|
+
* const client = SDK.Client({ accessKeyId });
|
|
19
|
+
* await client.login({ username, password });
|
|
20
|
+
*
|
|
21
|
+
* const calls = new SDK.Calls(client);
|
|
22
|
+
* const response = await apiKeys.createCall(request);
|
|
23
|
+
*
|
|
24
|
+
* console.log(response); // successful response
|
|
25
|
+
* } catch (e) {
|
|
26
|
+
* console.error(e); // an error occurred
|
|
27
|
+
* }
|
|
28
|
+
* }
|
|
29
|
+
*
|
|
30
|
+
* const request = {
|
|
31
|
+
* from: "8287854037",
|
|
32
|
+
* to: "+17853178070",
|
|
33
|
+
* appRef: "00000000-0000-0000-0000-000000000000"
|
|
34
|
+
* };
|
|
35
|
+
*
|
|
36
|
+
* main(request).catch(console.error);
|
|
37
|
+
*/
|
|
3
38
|
declare class Calls {
|
|
4
39
|
private client;
|
|
40
|
+
/**
|
|
41
|
+
* Constructs a new Calls object.
|
|
42
|
+
*
|
|
43
|
+
* @param {FonosterClient} client - Client object with underlying implementations to make requests to Fonoster's API
|
|
44
|
+
* @see AbstractClient
|
|
45
|
+
* @see FonosterClient
|
|
46
|
+
*/
|
|
5
47
|
constructor(client: FonosterClient);
|
|
48
|
+
/**
|
|
49
|
+
* Creates a new Call in the Workspace.
|
|
50
|
+
*
|
|
51
|
+
* @param {CreateCallRequest} request - The request object that contains the necessary information to create a new Call
|
|
52
|
+
* @param {string} request.from - The number that originated the call
|
|
53
|
+
* @param {string} request.to - The number that received the call
|
|
54
|
+
* @param {string} request.appRef - The reference of the App that will handle the call
|
|
55
|
+
* @return {Promise<CreateCallResponse>} - The response object that contains the reference to the created Call
|
|
56
|
+
* @example
|
|
57
|
+
*
|
|
58
|
+
* const request = {
|
|
59
|
+
* from: "8287854037",
|
|
60
|
+
* to: "+17853178070",
|
|
61
|
+
* appRef: "00000000-0000-0000-0000-000000000000"
|
|
62
|
+
* };
|
|
63
|
+
*
|
|
64
|
+
* const calls = new SDK.Calls(client); // Existing client object
|
|
65
|
+
*
|
|
66
|
+
* calls.createCall(request)
|
|
67
|
+
* .then(console.log) // successful response
|
|
68
|
+
* .catch(console.error); // an error occurred
|
|
69
|
+
*/
|
|
6
70
|
createCall(request: CreateCallRequest): Promise<CreateCallResponse>;
|
|
71
|
+
/**
|
|
72
|
+
* Retrieves an existing Call in the Workspace.
|
|
73
|
+
*
|
|
74
|
+
* @param {string} ref - The reference of the Call to retrieve
|
|
75
|
+
* @return {Promise<Acl>} - The response object that contains the Call detail
|
|
76
|
+
* @example
|
|
77
|
+
*
|
|
78
|
+
* const ref = "00000000-0000-0000-0000-000000000000"
|
|
79
|
+
*
|
|
80
|
+
* const calls = new SDK.Calls(client); // Existing client object
|
|
81
|
+
*
|
|
82
|
+
* calls.getCall(ref)
|
|
83
|
+
* .then(console.log) // successful response
|
|
84
|
+
* .catch(console.error); // an error occurred
|
|
85
|
+
*/
|
|
7
86
|
getCall(ref: string): Promise<CallDetailRecord>;
|
|
87
|
+
/**
|
|
88
|
+
* Retrieves a list of Calls from a Workspace.
|
|
89
|
+
*
|
|
90
|
+
* @param {ListCallsRequest} request - The request object that contains the necessary information to retrieve a list of Calls
|
|
91
|
+
* @param {number} request.pageSize - The number of Calls to retrieve
|
|
92
|
+
* @param {string} request.pageToken - The token to retrieve the next page of Calls
|
|
93
|
+
* @return {Promise<ListCallsResponse>} - The response object that contains the list of Calls
|
|
94
|
+
* @example
|
|
95
|
+
*
|
|
96
|
+
* const request = {
|
|
97
|
+
* pageSize: 10,
|
|
98
|
+
* pageToken: "00000000-0000-0000-0000-000000000000"
|
|
99
|
+
* };
|
|
100
|
+
*
|
|
101
|
+
* const calls = new SDK.Calls(client); // Existing client object
|
|
102
|
+
*
|
|
103
|
+
* calls.listCalls(request)
|
|
104
|
+
* .then(console.log) // successful response
|
|
105
|
+
* .catch(console.error); // an error occurred
|
|
106
|
+
*/
|
|
8
107
|
listCalls(request: ListCallsRequest): Promise<ListCallsResponse>;
|
|
9
108
|
}
|
|
10
109
|
export { Calls };
|
package/dist/node/Calls.js
CHANGED
|
@@ -22,11 +22,75 @@ exports.Calls = void 0;
|
|
|
22
22
|
const types_1 = require("@fonoster/types");
|
|
23
23
|
const makeRpcRequest_1 = require("./client/makeRpcRequest");
|
|
24
24
|
const calls_pb_1 = require("./generated/node/calls_pb");
|
|
25
|
+
/**
|
|
26
|
+
* @classdesc Fonoster Calls, part of the Fonoster Media subsystem,
|
|
27
|
+
* allows you to create, list, and track calls in your deployment.
|
|
28
|
+
* Note that an active Fonoster deployment is required.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
*
|
|
32
|
+
* const SDK = require("@fonoster/sdk");
|
|
33
|
+
*
|
|
34
|
+
* async function main(request) {
|
|
35
|
+
* const username = "admin";
|
|
36
|
+
* const password = "yourpassword";
|
|
37
|
+
* const accessKeyId = "00000000-0000-0000-0000-000000000000";
|
|
38
|
+
*
|
|
39
|
+
* try {
|
|
40
|
+
* const client = SDK.Client({ accessKeyId });
|
|
41
|
+
* await client.login({ username, password });
|
|
42
|
+
*
|
|
43
|
+
* const calls = new SDK.Calls(client);
|
|
44
|
+
* const response = await apiKeys.createCall(request);
|
|
45
|
+
*
|
|
46
|
+
* console.log(response); // successful response
|
|
47
|
+
* } catch (e) {
|
|
48
|
+
* console.error(e); // an error occurred
|
|
49
|
+
* }
|
|
50
|
+
* }
|
|
51
|
+
*
|
|
52
|
+
* const request = {
|
|
53
|
+
* from: "8287854037",
|
|
54
|
+
* to: "+17853178070",
|
|
55
|
+
* appRef: "00000000-0000-0000-0000-000000000000"
|
|
56
|
+
* };
|
|
57
|
+
*
|
|
58
|
+
* main(request).catch(console.error);
|
|
59
|
+
*/
|
|
25
60
|
class Calls {
|
|
26
61
|
client;
|
|
62
|
+
/**
|
|
63
|
+
* Constructs a new Calls object.
|
|
64
|
+
*
|
|
65
|
+
* @param {FonosterClient} client - Client object with underlying implementations to make requests to Fonoster's API
|
|
66
|
+
* @see AbstractClient
|
|
67
|
+
* @see FonosterClient
|
|
68
|
+
*/
|
|
27
69
|
constructor(client) {
|
|
28
70
|
this.client = client;
|
|
29
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Creates a new Call in the Workspace.
|
|
74
|
+
*
|
|
75
|
+
* @param {CreateCallRequest} request - The request object that contains the necessary information to create a new Call
|
|
76
|
+
* @param {string} request.from - The number that originated the call
|
|
77
|
+
* @param {string} request.to - The number that received the call
|
|
78
|
+
* @param {string} request.appRef - The reference of the App that will handle the call
|
|
79
|
+
* @return {Promise<CreateCallResponse>} - The response object that contains the reference to the created Call
|
|
80
|
+
* @example
|
|
81
|
+
*
|
|
82
|
+
* const request = {
|
|
83
|
+
* from: "8287854037",
|
|
84
|
+
* to: "+17853178070",
|
|
85
|
+
* appRef: "00000000-0000-0000-0000-000000000000"
|
|
86
|
+
* };
|
|
87
|
+
*
|
|
88
|
+
* const calls = new SDK.Calls(client); // Existing client object
|
|
89
|
+
*
|
|
90
|
+
* calls.createCall(request)
|
|
91
|
+
* .then(console.log) // successful response
|
|
92
|
+
* .catch(console.error); // an error occurred
|
|
93
|
+
*/
|
|
30
94
|
async createCall(request) {
|
|
31
95
|
const client = this.client.getCallsClient();
|
|
32
96
|
return await (0, makeRpcRequest_1.makeRpcRequest)({
|
|
@@ -37,6 +101,21 @@ class Calls {
|
|
|
37
101
|
enumMapping: [["type", types_1.CallType]]
|
|
38
102
|
});
|
|
39
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* Retrieves an existing Call in the Workspace.
|
|
106
|
+
*
|
|
107
|
+
* @param {string} ref - The reference of the Call to retrieve
|
|
108
|
+
* @return {Promise<Acl>} - The response object that contains the Call detail
|
|
109
|
+
* @example
|
|
110
|
+
*
|
|
111
|
+
* const ref = "00000000-0000-0000-0000-000000000000"
|
|
112
|
+
*
|
|
113
|
+
* const calls = new SDK.Calls(client); // Existing client object
|
|
114
|
+
*
|
|
115
|
+
* calls.getCall(ref)
|
|
116
|
+
* .then(console.log) // successful response
|
|
117
|
+
* .catch(console.error); // an error occurred
|
|
118
|
+
*/
|
|
40
119
|
async getCall(ref) {
|
|
41
120
|
const client = this.client.getCallsClient();
|
|
42
121
|
return await (0, makeRpcRequest_1.makeRpcRequest)({
|
|
@@ -52,6 +131,26 @@ class Calls {
|
|
|
52
131
|
]
|
|
53
132
|
});
|
|
54
133
|
}
|
|
134
|
+
/**
|
|
135
|
+
* Retrieves a list of Calls from a Workspace.
|
|
136
|
+
*
|
|
137
|
+
* @param {ListCallsRequest} request - The request object that contains the necessary information to retrieve a list of Calls
|
|
138
|
+
* @param {number} request.pageSize - The number of Calls to retrieve
|
|
139
|
+
* @param {string} request.pageToken - The token to retrieve the next page of Calls
|
|
140
|
+
* @return {Promise<ListCallsResponse>} - The response object that contains the list of Calls
|
|
141
|
+
* @example
|
|
142
|
+
*
|
|
143
|
+
* const request = {
|
|
144
|
+
* pageSize: 10,
|
|
145
|
+
* pageToken: "00000000-0000-0000-0000-000000000000"
|
|
146
|
+
* };
|
|
147
|
+
*
|
|
148
|
+
* const calls = new SDK.Calls(client); // Existing client object
|
|
149
|
+
*
|
|
150
|
+
* calls.listCalls(request)
|
|
151
|
+
* .then(console.log) // successful response
|
|
152
|
+
* .catch(console.error); // an error occurred
|
|
153
|
+
*/
|
|
55
154
|
async listCalls(request) {
|
|
56
155
|
const client = this.client.getCallsClient();
|
|
57
156
|
return await (0, makeRpcRequest_1.makeRpcRequest)({
|