@fonoster/sdk 0.6.4 → 0.6.6
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 +519 -454
- package/dist/node/Acls.d.ts +43 -44
- package/dist/node/Acls.js +62 -49
- package/dist/node/Agents.d.ts +44 -45
- package/dist/node/Agents.js +47 -46
- package/dist/node/ApiKeys.d.ts +29 -29
- package/dist/node/ApiKeys.js +29 -29
- package/dist/node/Applications.d.ts +39 -39
- package/dist/node/Applications.js +52 -40
- package/dist/node/Calls.d.ts +28 -29
- package/dist/node/Calls.js +32 -27
- package/dist/node/Credentials.d.ts +39 -39
- package/dist/node/Credentials.js +39 -39
- package/dist/node/Domains.d.ts +37 -37
- package/dist/node/Domains.js +37 -37
- package/dist/node/Numbers.d.ts +40 -40
- package/dist/node/Numbers.js +40 -40
- package/dist/node/Secrets.d.ts +37 -37
- package/dist/node/Secrets.js +37 -37
- package/dist/node/Trunks.d.ts +58 -52
- package/dist/node/Trunks.js +104 -70
- package/dist/node/Users.d.ts +34 -34
- package/dist/node/Users.js +34 -34
- package/dist/node/Workspaces.d.ts +55 -54
- package/dist/node/Workspaces.js +61 -54
- package/dist/node/client/jsonToObject.js +1 -1
- package/dist/node/client/makeRpcRequest.js +1 -1
- package/dist/node/client/objectToJson.d.ts +1 -1
- package/dist/node/client/objectToJson.js +12 -2
- package/dist/node/client/types/IdentityClient.d.ts +2 -2
- package/dist/node/client/utils.js +6 -3
- package/dist/node/generated/node/agents_grpc_pb.js +0 -2
- package/dist/node/generated/node/agents_pb.js +444 -24
- package/dist/node/generated/node/applications_pb.js +6 -6
- package/dist/node/generated/node/credentials_pb.js +11 -41
- package/dist/node/generated/node/domains_pb.js +30 -30
- package/dist/node/generated/node/identity_grpc_pb.js +14 -14
- package/dist/node/generated/node/identity_pb.js +37 -37
- package/dist/node/generated/node/numbers_grpc_pb.js +0 -1
- package/dist/node/generated/node/numbers_pb.js +191 -11
- package/dist/node/generated/node/trunks_grpc_pb.js +0 -2
- package/dist/node/generated/node/trunks_pb.js +526 -31
- package/dist/node/generated/web/IdentityServiceClientPb.ts +5 -5
- package/dist/node/generated/web/agents_pb.d.ts +62 -10
- package/dist/node/generated/web/agents_pb.js +444 -24
- package/dist/node/generated/web/applications_pb.js +6 -6
- package/dist/node/generated/web/credentials_pb.d.ts +0 -4
- package/dist/node/generated/web/credentials_pb.js +11 -41
- package/dist/node/generated/web/domains_pb.js +30 -30
- package/dist/node/generated/web/identity_pb.d.ts +13 -13
- package/dist/node/generated/web/identity_pb.js +37 -37
- package/dist/node/generated/web/numbers_pb.d.ts +26 -4
- package/dist/node/generated/web/numbers_pb.js +191 -11
- package/dist/node/generated/web/trunks_pb.d.ts +71 -11
- package/dist/node/generated/web/trunks_pb.js +526 -31
- package/dist/node/tsconfig.node.tsbuildinfo +1 -1
- package/dist/node/utils.d.ts +4 -3
- package/dist/node/utils.js +36 -0
- package/dist/web/fonoster.min.js +1 -1
- package/dist/web/index.esm.js +1 -1
- package/package.json +5 -4
package/dist/node/ApiKeys.d.ts
CHANGED
|
@@ -10,11 +10,11 @@ import { FonosterClient } from "./client/types";
|
|
|
10
10
|
* const SDK = require("@fonoster/sdk");
|
|
11
11
|
*
|
|
12
12
|
* async function main(request) {
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* const API_KEY = "your-api-key";
|
|
14
|
+
* const ACCESS_KEY_ID = "00000000-0000-0000-0000-000000000000";
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
* const client = SDK.Client({ accessKeyId });
|
|
16
|
+
* try {
|
|
17
|
+
* const client = SDK.Client({ accessKeyId: ACCESS_KEY_ID });
|
|
18
18
|
* await client.loginWithApiKey(apiKey);
|
|
19
19
|
*
|
|
20
20
|
* const apiKeys = new SDK.ApiKeys(client);
|
|
@@ -49,16 +49,16 @@ declare class ApiKeys {
|
|
|
49
49
|
* @param {ApiRoleEnum} request.role - The role of the ApiKey
|
|
50
50
|
* @return {Promise<CreateApiKeyResponse>} - The response object that contains the reference to the created ApiKey
|
|
51
51
|
* @example
|
|
52
|
+
* const apiKeys = new SDK.ApiKeys(client); // Existing client object
|
|
52
53
|
*
|
|
53
54
|
* const request = {
|
|
54
|
-
*
|
|
55
|
+
* role: "WORKSPACE_ADMIN"
|
|
55
56
|
* };
|
|
56
57
|
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
* .catch(console.error); // an error occurred
|
|
58
|
+
* apiKeys
|
|
59
|
+
* .createApiKey(request)
|
|
60
|
+
* .then(console.log) // successful response
|
|
61
|
+
* .catch(console.error); // an error occurred
|
|
62
62
|
*/
|
|
63
63
|
createApiKey(request: CreateApiKeyRequest): Promise<CreateApiKeyResponse>;
|
|
64
64
|
/**
|
|
@@ -68,14 +68,14 @@ declare class ApiKeys {
|
|
|
68
68
|
* @param {string} ref - The reference of the ApiKey to regenerate
|
|
69
69
|
* @return {Promise<CreateApiKeyResponse>} - The response object that contains the reference to the regenerated ApiKey
|
|
70
70
|
* @example
|
|
71
|
-
*
|
|
72
|
-
* const ref = "00000000-0000-0000-0000-000000000000"
|
|
73
|
-
*
|
|
74
71
|
* const apiKeys = new SDK.ApiKeys(client); // Existing client object
|
|
75
72
|
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
73
|
+
* const ref = "00000000-0000-0000-0000-000000000000";
|
|
74
|
+
*
|
|
75
|
+
* apiKeys
|
|
76
|
+
* .regenerateApiKey(ref)
|
|
77
|
+
* .then(console.log) // successful response
|
|
78
|
+
* .catch(console.error); // an error occurred
|
|
79
79
|
*/
|
|
80
80
|
regenerateApiKey(ref: string): Promise<CreateApiKeyResponse>;
|
|
81
81
|
/**
|
|
@@ -86,17 +86,17 @@ declare class ApiKeys {
|
|
|
86
86
|
* @param {string} request.pageToken - The token to retrieve the next page of ApiKeys
|
|
87
87
|
* @return {Promise<ListApiKeysResponse>} - The response object that contains the list of ApiKeys
|
|
88
88
|
* @example
|
|
89
|
+
* const apiKeys = new SDK.ApiKeys(client); // Existing client object
|
|
89
90
|
*
|
|
90
91
|
* const request = {
|
|
91
|
-
*
|
|
92
|
-
*
|
|
92
|
+
* pageSize: 10,
|
|
93
|
+
* pageToken: "00000000-0000-0000-0000-000000000000"
|
|
93
94
|
* };
|
|
94
95
|
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
* .catch(console.error); // an error occurred
|
|
96
|
+
* apiKeys
|
|
97
|
+
* .listApiKeys(request)
|
|
98
|
+
* .then(console.log) // successful response
|
|
99
|
+
* .catch(console.error); // an error occurred
|
|
100
100
|
*/
|
|
101
101
|
listApiKeys(request: ListApiKeysRequest): Promise<ListApiKeysResponse>;
|
|
102
102
|
/**
|
|
@@ -106,14 +106,14 @@ declare class ApiKeys {
|
|
|
106
106
|
* @param {string} ref - The reference of the ApiKey to delete
|
|
107
107
|
* @return {Promise<BaseApiObject>} - The response object that contains the reference to the deleted ApiKey
|
|
108
108
|
* @example
|
|
109
|
-
*
|
|
110
|
-
* const ref = "00000000-0000-0000-0000-000000000000"
|
|
111
|
-
*
|
|
112
109
|
* const apiKeys = new SDK.ApiKeys(client); // Existing client object
|
|
113
110
|
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
111
|
+
* const ref = "00000000-0000-0000-0000-000000000000";
|
|
112
|
+
*
|
|
113
|
+
* apiKeys
|
|
114
|
+
* .deleteApiKey(ref)
|
|
115
|
+
* .then(console.log) // successful response
|
|
116
|
+
* .catch(console.error); // an error occurred
|
|
117
117
|
*/
|
|
118
118
|
deleteApiKey(ref: string): Promise<BaseApiObject>;
|
|
119
119
|
}
|
package/dist/node/ApiKeys.js
CHANGED
|
@@ -32,11 +32,11 @@ const identity_pb_1 = require("./generated/node/identity_pb");
|
|
|
32
32
|
* const SDK = require("@fonoster/sdk");
|
|
33
33
|
*
|
|
34
34
|
* async function main(request) {
|
|
35
|
-
*
|
|
36
|
-
*
|
|
35
|
+
* const API_KEY = "your-api-key";
|
|
36
|
+
* const ACCESS_KEY_ID = "00000000-0000-0000-0000-000000000000";
|
|
37
37
|
*
|
|
38
|
-
*
|
|
39
|
-
* const client = SDK.Client({ accessKeyId });
|
|
38
|
+
* try {
|
|
39
|
+
* const client = SDK.Client({ accessKeyId: ACCESS_KEY_ID });
|
|
40
40
|
* await client.loginWithApiKey(apiKey);
|
|
41
41
|
*
|
|
42
42
|
* const apiKeys = new SDK.ApiKeys(client);
|
|
@@ -73,16 +73,16 @@ class ApiKeys {
|
|
|
73
73
|
* @param {ApiRoleEnum} request.role - The role of the ApiKey
|
|
74
74
|
* @return {Promise<CreateApiKeyResponse>} - The response object that contains the reference to the created ApiKey
|
|
75
75
|
* @example
|
|
76
|
+
* const apiKeys = new SDK.ApiKeys(client); // Existing client object
|
|
76
77
|
*
|
|
77
78
|
* const request = {
|
|
78
|
-
*
|
|
79
|
+
* role: "WORKSPACE_ADMIN"
|
|
79
80
|
* };
|
|
80
81
|
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
* .catch(console.error); // an error occurred
|
|
82
|
+
* apiKeys
|
|
83
|
+
* .createApiKey(request)
|
|
84
|
+
* .then(console.log) // successful response
|
|
85
|
+
* .catch(console.error); // an error occurred
|
|
86
86
|
*/
|
|
87
87
|
async createApiKey(request) {
|
|
88
88
|
const client = this.client.getIdentityClient();
|
|
@@ -101,14 +101,14 @@ class ApiKeys {
|
|
|
101
101
|
* @param {string} ref - The reference of the ApiKey to regenerate
|
|
102
102
|
* @return {Promise<CreateApiKeyResponse>} - The response object that contains the reference to the regenerated ApiKey
|
|
103
103
|
* @example
|
|
104
|
-
*
|
|
105
|
-
* const ref = "00000000-0000-0000-0000-000000000000"
|
|
106
|
-
*
|
|
107
104
|
* const apiKeys = new SDK.ApiKeys(client); // Existing client object
|
|
108
105
|
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
106
|
+
* const ref = "00000000-0000-0000-0000-000000000000";
|
|
107
|
+
*
|
|
108
|
+
* apiKeys
|
|
109
|
+
* .regenerateApiKey(ref)
|
|
110
|
+
* .then(console.log) // successful response
|
|
111
|
+
* .catch(console.error); // an error occurred
|
|
112
112
|
*/
|
|
113
113
|
async regenerateApiKey(ref) {
|
|
114
114
|
const client = this.client.getIdentityClient();
|
|
@@ -127,17 +127,17 @@ class ApiKeys {
|
|
|
127
127
|
* @param {string} request.pageToken - The token to retrieve the next page of ApiKeys
|
|
128
128
|
* @return {Promise<ListApiKeysResponse>} - The response object that contains the list of ApiKeys
|
|
129
129
|
* @example
|
|
130
|
+
* const apiKeys = new SDK.ApiKeys(client); // Existing client object
|
|
130
131
|
*
|
|
131
132
|
* const request = {
|
|
132
|
-
*
|
|
133
|
-
*
|
|
133
|
+
* pageSize: 10,
|
|
134
|
+
* pageToken: "00000000-0000-0000-0000-000000000000"
|
|
134
135
|
* };
|
|
135
136
|
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
* .catch(console.error); // an error occurred
|
|
137
|
+
* apiKeys
|
|
138
|
+
* .listApiKeys(request)
|
|
139
|
+
* .then(console.log) // successful response
|
|
140
|
+
* .catch(console.error); // an error occurred
|
|
141
141
|
*/
|
|
142
142
|
async listApiKeys(request) {
|
|
143
143
|
const applicationsClient = this.client.getIdentityClient();
|
|
@@ -156,14 +156,14 @@ class ApiKeys {
|
|
|
156
156
|
* @param {string} ref - The reference of the ApiKey to delete
|
|
157
157
|
* @return {Promise<BaseApiObject>} - The response object that contains the reference to the deleted ApiKey
|
|
158
158
|
* @example
|
|
159
|
-
*
|
|
160
|
-
* const ref = "00000000-0000-0000-0000-000000000000"
|
|
161
|
-
*
|
|
162
159
|
* const apiKeys = new SDK.ApiKeys(client); // Existing client object
|
|
163
160
|
*
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
*
|
|
161
|
+
* const ref = "00000000-0000-0000-0000-000000000000";
|
|
162
|
+
*
|
|
163
|
+
* apiKeys
|
|
164
|
+
* .deleteApiKey(ref)
|
|
165
|
+
* .then(console.log) // successful response
|
|
166
|
+
* .catch(console.error); // an error occurred
|
|
167
167
|
*/
|
|
168
168
|
async deleteApiKey(ref) {
|
|
169
169
|
const client = this.client.getIdentityClient();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Application, BaseApiObject, CreateApplicationRequest,
|
|
1
|
+
import { Application, BaseApiObject, CreateApplicationRequest, ListApplicationsRequest, ListApplicationsResponse, UpdateApplicationRequest } from "@fonoster/types";
|
|
2
2
|
import { FonosterClient } from "./client/types";
|
|
3
3
|
/**
|
|
4
4
|
* @classdesc Fonoster Applications, part of the Fonoster Voice Subsystem,
|
|
@@ -10,11 +10,11 @@ import { FonosterClient } from "./client/types";
|
|
|
10
10
|
* const SDK = require("@fonoster/sdk");
|
|
11
11
|
*
|
|
12
12
|
* async function main(request) {
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* const API_KEY = "your-api-key";
|
|
14
|
+
* const ACCESS_KEY_ID = "00000000-0000-0000-0000-000000000000";
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
* const client = SDK.Client({ accessKeyId });
|
|
16
|
+
* try {
|
|
17
|
+
* const client = SDK.Client({ accessKeyId: ACCESS_KEY_ID });
|
|
18
18
|
* await client.loginWithApiKey(apiKey);
|
|
19
19
|
*
|
|
20
20
|
* const apps = new SDK.Applications(client);
|
|
@@ -84,6 +84,7 @@ declare class Applications {
|
|
|
84
84
|
* @param {object} request.intelligence.config - The configuration object for the intelligence engine (e.g., { agentId: "your-agent-id" })
|
|
85
85
|
* @return {Promise<CreateAppResponse>} - The response object that contains the reference to the newly created application
|
|
86
86
|
* @example
|
|
87
|
+
* const apps = new SDK.Applications(client); // Existing client object
|
|
87
88
|
*
|
|
88
89
|
* const request = {
|
|
89
90
|
* name: "My application",
|
|
@@ -112,27 +113,26 @@ declare class Applications {
|
|
|
112
113
|
* }
|
|
113
114
|
* };
|
|
114
115
|
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
* .catch(console.error); // an error occurred
|
|
116
|
+
* apps
|
|
117
|
+
* .createApplication(request)
|
|
118
|
+
* .then(console.log) // successful response
|
|
119
|
+
* .catch(console.error); // an error occurred
|
|
120
120
|
*/
|
|
121
|
-
createApplication(request: CreateApplicationRequest): Promise<
|
|
121
|
+
createApplication(request: CreateApplicationRequest): Promise<BaseApiObject>;
|
|
122
122
|
/**
|
|
123
123
|
* Retrieves an existing Application in the Workspace.
|
|
124
124
|
*
|
|
125
125
|
* @param {string} ref - The reference of the Application to retrieve
|
|
126
126
|
* @return {Promise<Application>} - The response object that contains the Application information
|
|
127
127
|
* @example
|
|
128
|
-
*
|
|
129
|
-
* const ref = "00000000-0000-0000-0000-000000000000"
|
|
130
|
-
*
|
|
131
128
|
* const apps = new SDK.Applications(client); // Existing client object
|
|
132
129
|
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
130
|
+
* const ref = "00000000-0000-0000-0000-000000000000";
|
|
131
|
+
*
|
|
132
|
+
* apps
|
|
133
|
+
* .getApplication(ref)
|
|
134
|
+
* .then(console.log) // successful response
|
|
135
|
+
* .catch(console.error); // an error occurred
|
|
136
136
|
*/
|
|
137
137
|
getApplication(ref: string): Promise<Application>;
|
|
138
138
|
/**
|
|
@@ -154,18 +154,18 @@ declare class Applications {
|
|
|
154
154
|
* @param {object} request.intelligence.config - The configuration object for the intelligence engine (e.g., { agentId: "your-agent-id" })
|
|
155
155
|
* @return {Promise<BaseApiObject>} - The response object that contains the reference to the updated application
|
|
156
156
|
* @example
|
|
157
|
+
* const apps = new SDK.Applications(client); // Existing client object
|
|
157
158
|
*
|
|
158
159
|
* const request = {
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
* }
|
|
163
|
-
*
|
|
164
|
-
* const apps = new SDK.Applications(client); // Existing client object
|
|
160
|
+
* ref: "00000000-0000-0000-0000-000000000000",
|
|
161
|
+
* name: "My application",
|
|
162
|
+
* appEndpoint: "myapp.mydomain.com"
|
|
163
|
+
* };
|
|
165
164
|
*
|
|
166
|
-
* apps
|
|
167
|
-
*
|
|
168
|
-
*
|
|
165
|
+
* apps
|
|
166
|
+
* .updateApplication(request)
|
|
167
|
+
* .then(console.log) // successful response
|
|
168
|
+
* .catch(console.error); // an error occurred
|
|
169
169
|
*/
|
|
170
170
|
updateApplication(request: UpdateApplicationRequest): Promise<BaseApiObject>;
|
|
171
171
|
/**
|
|
@@ -176,17 +176,17 @@ declare class Applications {
|
|
|
176
176
|
* @param {string} request.pageToken - The token to retrieve the next page of Applications
|
|
177
177
|
* @return {Promise<ListApplicationsResponse>} - The response object that contains the list of Applications
|
|
178
178
|
* @example
|
|
179
|
+
* const apps = new SDK.Applications(client); // Existing client object
|
|
179
180
|
*
|
|
180
181
|
* const request = {
|
|
181
|
-
*
|
|
182
|
-
*
|
|
182
|
+
* pageSize: 10,
|
|
183
|
+
* pageToken: "00000000-0000-0000-0000-000000000000"
|
|
183
184
|
* };
|
|
184
185
|
*
|
|
185
|
-
*
|
|
186
|
-
*
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
* .catch(console.error); // an error occurred
|
|
186
|
+
* apps
|
|
187
|
+
* .listApplications(request)
|
|
188
|
+
* .then(console.log) // successful response
|
|
189
|
+
* .catch(console.error); // an error occurred
|
|
190
190
|
*/
|
|
191
191
|
listApplications(request: ListApplicationsRequest): Promise<ListApplicationsResponse>;
|
|
192
192
|
/**
|
|
@@ -196,14 +196,14 @@ declare class Applications {
|
|
|
196
196
|
* @param {string} ref - The reference of the Application to delete
|
|
197
197
|
* @return {Promise<BaseApiObject>} - The response object that contains the reference to the deleted application
|
|
198
198
|
* @example
|
|
199
|
-
*
|
|
200
|
-
* const ref = "00000000-0000-0000-0000-000000000000"
|
|
201
|
-
*
|
|
202
199
|
* const apps = new SDK.Applications(client); // Existing client object
|
|
203
200
|
*
|
|
204
|
-
*
|
|
205
|
-
*
|
|
206
|
-
*
|
|
201
|
+
* const ref = "00000000-0000-0000-0000-000000000000";
|
|
202
|
+
*
|
|
203
|
+
* apps
|
|
204
|
+
* .deleteApplication(ref)
|
|
205
|
+
* .then(console.log) // successful response
|
|
206
|
+
* .catch(console.error); // an error occurred
|
|
207
207
|
*/
|
|
208
208
|
deleteApplication(ref: string): Promise<BaseApiObject>;
|
|
209
209
|
}
|
|
@@ -14,11 +14,11 @@ const utils_1 = require("./utils");
|
|
|
14
14
|
* const SDK = require("@fonoster/sdk");
|
|
15
15
|
*
|
|
16
16
|
* async function main(request) {
|
|
17
|
-
*
|
|
18
|
-
*
|
|
17
|
+
* const API_KEY = "your-api-key";
|
|
18
|
+
* const ACCESS_KEY_ID = "00000000-0000-0000-0000-000000000000";
|
|
19
19
|
*
|
|
20
|
-
*
|
|
21
|
-
* const client = SDK.Client({ accessKeyId });
|
|
20
|
+
* try {
|
|
21
|
+
* const client = SDK.Client({ accessKeyId: ACCESS_KEY_ID });
|
|
22
22
|
* await client.loginWithApiKey(apiKey);
|
|
23
23
|
*
|
|
24
24
|
* const apps = new SDK.Applications(client);
|
|
@@ -90,6 +90,7 @@ class Applications {
|
|
|
90
90
|
* @param {object} request.intelligence.config - The configuration object for the intelligence engine (e.g., { agentId: "your-agent-id" })
|
|
91
91
|
* @return {Promise<CreateAppResponse>} - The response object that contains the reference to the newly created application
|
|
92
92
|
* @example
|
|
93
|
+
* const apps = new SDK.Applications(client); // Existing client object
|
|
93
94
|
*
|
|
94
95
|
* const request = {
|
|
95
96
|
* name: "My application",
|
|
@@ -118,11 +119,10 @@ class Applications {
|
|
|
118
119
|
* }
|
|
119
120
|
* };
|
|
120
121
|
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
* .catch(console.error); // an error occurred
|
|
122
|
+
* apps
|
|
123
|
+
* .createApplication(request)
|
|
124
|
+
* .then(console.log) // successful response
|
|
125
|
+
* .catch(console.error); // an error occurred
|
|
126
126
|
*/
|
|
127
127
|
async createApplication(request) {
|
|
128
128
|
const reqWithStructOverride = (0, utils_1.buildStructOverride)(request);
|
|
@@ -146,23 +146,30 @@ class Applications {
|
|
|
146
146
|
* @param {string} ref - The reference of the Application to retrieve
|
|
147
147
|
* @return {Promise<Application>} - The response object that contains the Application information
|
|
148
148
|
* @example
|
|
149
|
-
*
|
|
150
|
-
* const ref = "00000000-0000-0000-0000-000000000000"
|
|
151
|
-
*
|
|
152
149
|
* const apps = new SDK.Applications(client); // Existing client object
|
|
153
150
|
*
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
151
|
+
* const ref = "00000000-0000-0000-0000-000000000000";
|
|
152
|
+
*
|
|
153
|
+
* apps
|
|
154
|
+
* .getApplication(ref)
|
|
155
|
+
* .then(console.log) // successful response
|
|
156
|
+
* .catch(console.error); // an error occurred
|
|
157
157
|
*/
|
|
158
158
|
async getApplication(ref) {
|
|
159
159
|
const applicationsClient = this.client.getApplicationsClient();
|
|
160
|
-
|
|
160
|
+
const response = await (0, makeRpcRequest_1.makeRpcRequest)({
|
|
161
161
|
method: applicationsClient.getApplication.bind(applicationsClient),
|
|
162
162
|
requestPBObjectConstructor: applications_pb_1.GetApplicationRequest,
|
|
163
163
|
metadata: this.client.getMetadata(),
|
|
164
|
-
request: { ref }
|
|
164
|
+
request: { ref },
|
|
165
|
+
enumMapping: [["type", applications_pb_1.ApplicationType]],
|
|
166
|
+
objectMapping: [
|
|
167
|
+
["textToSpeech", applications_pb_1.ProductContainer],
|
|
168
|
+
["speechToText", applications_pb_1.ProductContainer],
|
|
169
|
+
["intelligence", applications_pb_1.ProductContainer]
|
|
170
|
+
]
|
|
165
171
|
});
|
|
172
|
+
return (0, utils_1.buildStructOverrideReverse)(response);
|
|
166
173
|
}
|
|
167
174
|
/**
|
|
168
175
|
* Updates an existing application in Fonoster.
|
|
@@ -183,18 +190,18 @@ class Applications {
|
|
|
183
190
|
* @param {object} request.intelligence.config - The configuration object for the intelligence engine (e.g., { agentId: "your-agent-id" })
|
|
184
191
|
* @return {Promise<BaseApiObject>} - The response object that contains the reference to the updated application
|
|
185
192
|
* @example
|
|
193
|
+
* const apps = new SDK.Applications(client); // Existing client object
|
|
186
194
|
*
|
|
187
195
|
* const request = {
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
* }
|
|
192
|
-
*
|
|
193
|
-
* const apps = new SDK.Applications(client); // Existing client object
|
|
196
|
+
* ref: "00000000-0000-0000-0000-000000000000",
|
|
197
|
+
* name: "My application",
|
|
198
|
+
* appEndpoint: "myapp.mydomain.com"
|
|
199
|
+
* };
|
|
194
200
|
*
|
|
195
|
-
* apps
|
|
196
|
-
*
|
|
197
|
-
*
|
|
201
|
+
* apps
|
|
202
|
+
* .updateApplication(request)
|
|
203
|
+
* .then(console.log) // successful response
|
|
204
|
+
* .catch(console.error); // an error occurred
|
|
198
205
|
*/
|
|
199
206
|
async updateApplication(request) {
|
|
200
207
|
const reqWithStructOverride = (0, utils_1.buildStructOverride)(request);
|
|
@@ -220,27 +227,32 @@ class Applications {
|
|
|
220
227
|
* @param {string} request.pageToken - The token to retrieve the next page of Applications
|
|
221
228
|
* @return {Promise<ListApplicationsResponse>} - The response object that contains the list of Applications
|
|
222
229
|
* @example
|
|
230
|
+
* const apps = new SDK.Applications(client); // Existing client object
|
|
223
231
|
*
|
|
224
232
|
* const request = {
|
|
225
|
-
*
|
|
226
|
-
*
|
|
233
|
+
* pageSize: 10,
|
|
234
|
+
* pageToken: "00000000-0000-0000-0000-000000000000"
|
|
227
235
|
* };
|
|
228
236
|
*
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
*
|
|
232
|
-
*
|
|
233
|
-
* .catch(console.error); // an error occurred
|
|
237
|
+
* apps
|
|
238
|
+
* .listApplications(request)
|
|
239
|
+
* .then(console.log) // successful response
|
|
240
|
+
* .catch(console.error); // an error occurred
|
|
234
241
|
*/
|
|
235
242
|
async listApplications(request) {
|
|
236
243
|
const applicationsClient = this.client.getApplicationsClient();
|
|
237
|
-
|
|
244
|
+
const response = await (0, makeRpcRequest_1.makeRpcRequest)({
|
|
238
245
|
method: applicationsClient.listApplications.bind(applicationsClient),
|
|
239
246
|
requestPBObjectConstructor: applications_pb_1.ListApplicationsRequest,
|
|
240
247
|
metadata: this.client.getMetadata(),
|
|
241
248
|
request,
|
|
249
|
+
enumMapping: [["type", applications_pb_1.ApplicationType]],
|
|
242
250
|
repeatableObjectMapping: [["itemsList", applications_pb_1.Application]]
|
|
243
251
|
});
|
|
252
|
+
return {
|
|
253
|
+
items: response.items.map(utils_1.buildStructOverrideReverse),
|
|
254
|
+
nextPageToken: response.nextPageToken
|
|
255
|
+
};
|
|
244
256
|
}
|
|
245
257
|
/**
|
|
246
258
|
* Deletes an existing Application from Fonoster.
|
|
@@ -249,14 +261,14 @@ class Applications {
|
|
|
249
261
|
* @param {string} ref - The reference of the Application to delete
|
|
250
262
|
* @return {Promise<BaseApiObject>} - The response object that contains the reference to the deleted application
|
|
251
263
|
* @example
|
|
252
|
-
*
|
|
253
|
-
* const ref = "00000000-0000-0000-0000-000000000000"
|
|
254
|
-
*
|
|
255
264
|
* const apps = new SDK.Applications(client); // Existing client object
|
|
256
265
|
*
|
|
257
|
-
*
|
|
258
|
-
*
|
|
259
|
-
*
|
|
266
|
+
* const ref = "00000000-0000-0000-0000-000000000000";
|
|
267
|
+
*
|
|
268
|
+
* apps
|
|
269
|
+
* .deleteApplication(ref)
|
|
270
|
+
* .then(console.log) // successful response
|
|
271
|
+
* .catch(console.error); // an error occurred
|
|
260
272
|
*/
|
|
261
273
|
async deleteApplication(ref) {
|
|
262
274
|
const applicationsClient = this.client.getApplicationsClient();
|
package/dist/node/Calls.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CallDetailRecord, CreateCallRequest,
|
|
1
|
+
import { BaseApiObject, CallDetailRecord, CreateCallRequest, ListCallsRequest, ListCallsResponse } from "@fonoster/types";
|
|
2
2
|
import { FonosterClient } from "./client/types";
|
|
3
3
|
/**
|
|
4
4
|
* @classdesc Fonoster Calls, part of the Fonoster Media subsystem,
|
|
@@ -10,13 +10,12 @@ import { FonosterClient } from "./client/types";
|
|
|
10
10
|
* const SDK = require("@fonoster/sdk");
|
|
11
11
|
*
|
|
12
12
|
* async function main(request) {
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* const accessKeyId = "00000000-0000-0000-0000-000000000000";
|
|
13
|
+
* const API_KEY = "your-api-key";
|
|
14
|
+
* const ACCESS_KEY_ID = "00000000-0000-0000-0000-000000000000";
|
|
16
15
|
*
|
|
17
|
-
*
|
|
18
|
-
* const client = SDK.Client({ accessKeyId });
|
|
19
|
-
* await client.
|
|
16
|
+
* try {
|
|
17
|
+
* const client = SDK.Client({ accessKeyId: ACCESS_KEY_ID });
|
|
18
|
+
* await client.loginWithApiKey(apiKey);
|
|
20
19
|
*
|
|
21
20
|
* const calls = new SDK.Calls(client);
|
|
22
21
|
* const response = await apiKeys.createCall(request);
|
|
@@ -54,34 +53,34 @@ declare class Calls {
|
|
|
54
53
|
* @param {string} request.appRef - The reference of the App that will handle the call
|
|
55
54
|
* @return {Promise<CreateCallResponse>} - The response object that contains the reference to the created Call
|
|
56
55
|
* @example
|
|
56
|
+
* const calls = new SDK.Calls(client); // Existing client object
|
|
57
57
|
*
|
|
58
58
|
* const request = {
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
59
|
+
* from: "8287854037",
|
|
60
|
+
* to: "+17853178070",
|
|
61
|
+
* appRef: "00000000-0000-0000-0000-000000000000"
|
|
62
62
|
* };
|
|
63
63
|
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
* .catch(console.error); // an error occurred
|
|
64
|
+
* calls
|
|
65
|
+
* .createCall(request)
|
|
66
|
+
* .then(console.log) // successful response
|
|
67
|
+
* .catch(console.error); // an error occurred
|
|
69
68
|
*/
|
|
70
|
-
createCall(request: CreateCallRequest): Promise<
|
|
69
|
+
createCall(request: CreateCallRequest): Promise<BaseApiObject>;
|
|
71
70
|
/**
|
|
72
71
|
* Retrieves an existing Call in the Workspace.
|
|
73
72
|
*
|
|
74
73
|
* @param {string} ref - The reference of the Call to retrieve
|
|
75
74
|
* @return {Promise<Acl>} - The response object that contains the Call detail
|
|
76
75
|
* @example
|
|
77
|
-
*
|
|
78
|
-
* const ref = "00000000-0000-0000-0000-000000000000"
|
|
79
|
-
*
|
|
80
76
|
* const calls = new SDK.Calls(client); // Existing client object
|
|
81
77
|
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
78
|
+
* const ref = "00000000-0000-0000-0000-000000000000";
|
|
79
|
+
*
|
|
80
|
+
* calls
|
|
81
|
+
* .getCall(ref)
|
|
82
|
+
* .then(console.log) // successful response
|
|
83
|
+
* .catch(console.error); // an error occurred
|
|
85
84
|
*/
|
|
86
85
|
getCall(ref: string): Promise<CallDetailRecord>;
|
|
87
86
|
/**
|
|
@@ -92,17 +91,17 @@ declare class Calls {
|
|
|
92
91
|
* @param {string} request.pageToken - The token to retrieve the next page of Calls
|
|
93
92
|
* @return {Promise<ListCallsResponse>} - The response object that contains the list of Calls
|
|
94
93
|
* @example
|
|
94
|
+
* const calls = new SDK.Calls(client); // Existing client object
|
|
95
95
|
*
|
|
96
96
|
* const request = {
|
|
97
|
-
*
|
|
98
|
-
*
|
|
97
|
+
* pageSize: 10,
|
|
98
|
+
* pageToken: "00000000-0000-0000-0000-000000000000"
|
|
99
99
|
* };
|
|
100
100
|
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
* .catch(console.error); // an error occurred
|
|
101
|
+
* calls
|
|
102
|
+
* .listCalls(request)
|
|
103
|
+
* .then(console.log) // successful response
|
|
104
|
+
* .catch(console.error); // an error occurred
|
|
106
105
|
*/
|
|
107
106
|
listCalls(request: ListCallsRequest): Promise<ListCallsResponse>;
|
|
108
107
|
}
|