@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.
@@ -1,12 +1,148 @@
1
1
  import { BaseApiObject, CreateCredentialsRequest, Credentials as CredentialsType, ListCredentialsRequest, ListCredentialsResponse, UpdateCredentialsRequest } from "@fonoster/types";
2
2
  import { FonosterClient } from "./client/types";
3
+ /**
4
+ * @classdesc Fonoster Credentials, part of the Fonoster SIP Proxy subsystem,
5
+ * allows you to create, update, retrieve, and delete SIP Credentials 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 credentials = new SDK.Credentials(client);
21
+ * const response = await apiKeys.createCredentials(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
+ * name: "My Credentials",
31
+ * username: "myusername",
32
+ * password: "mysecret"
33
+ * };
34
+ *
35
+ * main(request).catch(console.error);
36
+ */
3
37
  declare class Credentials {
4
38
  private client;
39
+ /**
40
+ * Constructs a new Credentials object.
41
+ *
42
+ * @param {FonosterClient} client - Client object with underlying implementations to make requests to Fonoster's API
43
+ * @see AbstractClient
44
+ * @see FonosterClient
45
+ */
5
46
  constructor(client: FonosterClient);
47
+ /**
48
+ * Creates a new set of Credentials in the Workspace.
49
+ *
50
+ * @param {CreateCredentialsRequest} request - The request object that contains the necessary information to create a new set of Credentials
51
+ * @param {string} request.name - The name of the Credentials
52
+ * @param {string} request.username - The username of the Credentials
53
+ * @param {string} request.password - The password of the Credentials
54
+ * @return {Promise<BaseApiObject>} - The response object that contains the reference to the created Credentials
55
+ * @example
56
+ *
57
+ * const request = {
58
+ * name: "My Credentials",
59
+ * username: "myusername",
60
+ * password: "mysecret"
61
+ * };
62
+ *
63
+ * const credentials = new SDK.Credentials(client); // Existing client object
64
+ *
65
+ * credentials.createCredentials(request)
66
+ * .then(console.log) // successful response
67
+ * .catch(console.error); // an error occurred
68
+ */
6
69
  createCredentials(request: CreateCredentialsRequest): Promise<BaseApiObject>;
70
+ /**
71
+ * Retrieves an existing set of Credentials in the Workspace.
72
+ *
73
+ * @param {string} ref - The reference of the Credentials to retrieve
74
+ * @return {Promise<Acl>} - The response object that contains the Credentials
75
+ * @example
76
+ *
77
+ * const ref = "00000000-0000-0000-0000-000000000000"
78
+ *
79
+ * const credentials = new SDK.Credentials(client); // Existing client object
80
+ *
81
+ * credentials.getCredentials(ref)
82
+ * .then(console.log) // successful response
83
+ * .catch(console.error); // an error occurred
84
+ */
7
85
  getCredentials(ref: string): Promise<CredentialsType>;
86
+ /**
87
+ * Updates an existing set of Credentials in the Workspace.
88
+ *
89
+ * @param {UpdateCredentialsRequest} request - The request object that contains the necessary information to update an existing set of Credentials
90
+ * @param {string} request.ref - The reference of the Credentials to update
91
+ * @param {string} request.name - The name of the Credentials
92
+ * @param {string} request.password - The password of the Credentials
93
+ * @return {Promise<BaseApiObject>} - The response object that contains the reference to the updated Credentials
94
+ * @example
95
+ *
96
+ * const request = {
97
+ * ref: "00000000-0000-0000-0000-000000000000",
98
+ * name: "My Credentials",
99
+ * password: "mysecret"
100
+ * };
101
+ *
102
+ * const credentials = new SDK.Credentials(client); // Existing client object
103
+ *
104
+ * credentials.updateCredentials(request)
105
+ * .then(console.log) // successful response
106
+ * .catch(console.error); // an error occurred
107
+ */
8
108
  updateCredentials(request: UpdateCredentialsRequest): Promise<BaseApiObject>;
109
+ /**
110
+ * Retrieves a list of Credentials from a Workspace.
111
+ *
112
+ * @param {ListCredentialsRequest} request - The request object that contains the necessary information to retrieve a list of Credentials
113
+ * @param {number} request.pageSize - The number of Credentials to retrieve
114
+ * @param {string} request.pageToken - The token to retrieve the next page of Credentials
115
+ * @return {Promise<ListCredentialsResponse>} - The response object that contains the list of Credentials
116
+ * @example
117
+ *
118
+ * const request = {
119
+ * pageSize: 10,
120
+ * pageToken: "00000000-0000-0000-0000-000000000000"
121
+ * };
122
+ *
123
+ * const credentials = new SDK.Credentials(client); // Existing client object
124
+ *
125
+ * credentials.listCredentials(request)
126
+ * .then(console.log) // successful response
127
+ * .catch(console.error); // an error occurred
128
+ */
9
129
  listCredentials(request: ListCredentialsRequest): Promise<ListCredentialsResponse>;
130
+ /**
131
+ * Deletes an existing set of Credentials from Fonoster.
132
+ * Note that this operation is irreversible.
133
+ *
134
+ * @param {string} ref - The reference of the Credentials to delete
135
+ * @return {Promise<BaseApiObject>} - The response object that contains the reference to the deleted Credentials
136
+ * @example
137
+ *
138
+ * const ref = "00000000-0000-0000-0000-000000000000"
139
+ *
140
+ * const credentials = new SDK.Credentials(client); // Existing client object
141
+ *
142
+ * credentials.deleteCredentials(ref)
143
+ * .then(console.log) // successful response
144
+ * .catch(console.error); // an error occurred
145
+ */
10
146
  deleteCredentials(ref: string): Promise<BaseApiObject>;
11
147
  }
12
148
  export { Credentials };
@@ -3,11 +3,74 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Credentials = void 0;
4
4
  const makeRpcRequest_1 = require("./client/makeRpcRequest");
5
5
  const credentials_pb_1 = require("./generated/node/credentials_pb");
6
+ /**
7
+ * @classdesc Fonoster Credentials, part of the Fonoster SIP Proxy subsystem,
8
+ * allows you to create, update, retrieve, and delete SIP Credentials for your deployment.
9
+ * Note that an active Fonoster deployment is required.
10
+ *
11
+ * @example
12
+ *
13
+ * const SDK = require("@fonoster/sdk");
14
+ *
15
+ * async function main(request) {
16
+ * const apiKey = "your-api-key";
17
+ * const accessKeyId = "00000000-0000-0000-0000-000000000000";
18
+ *
19
+ * try {
20
+ * const client = SDK.Client({ accessKeyId });
21
+ * await client.loginWithApiKey(apiKey);
22
+ *
23
+ * const credentials = new SDK.Credentials(client);
24
+ * const response = await apiKeys.createCredentials(request);
25
+ *
26
+ * console.log(response); // successful response
27
+ * } catch (e) {
28
+ * console.error(e); // an error occurred
29
+ * }
30
+ * }
31
+ *
32
+ * const request = {
33
+ * name: "My Credentials",
34
+ * username: "myusername",
35
+ * password: "mysecret"
36
+ * };
37
+ *
38
+ * main(request).catch(console.error);
39
+ */
6
40
  class Credentials {
7
41
  client;
42
+ /**
43
+ * Constructs a new Credentials object.
44
+ *
45
+ * @param {FonosterClient} client - Client object with underlying implementations to make requests to Fonoster's API
46
+ * @see AbstractClient
47
+ * @see FonosterClient
48
+ */
8
49
  constructor(client) {
9
50
  this.client = client;
10
51
  }
52
+ /**
53
+ * Creates a new set of Credentials in the Workspace.
54
+ *
55
+ * @param {CreateCredentialsRequest} request - The request object that contains the necessary information to create a new set of Credentials
56
+ * @param {string} request.name - The name of the Credentials
57
+ * @param {string} request.username - The username of the Credentials
58
+ * @param {string} request.password - The password of the Credentials
59
+ * @return {Promise<BaseApiObject>} - The response object that contains the reference to the created Credentials
60
+ * @example
61
+ *
62
+ * const request = {
63
+ * name: "My Credentials",
64
+ * username: "myusername",
65
+ * password: "mysecret"
66
+ * };
67
+ *
68
+ * const credentials = new SDK.Credentials(client); // Existing client object
69
+ *
70
+ * credentials.createCredentials(request)
71
+ * .then(console.log) // successful response
72
+ * .catch(console.error); // an error occurred
73
+ */
11
74
  async createCredentials(request) {
12
75
  const client = this.client.getCredentialsClient();
13
76
  return await (0, makeRpcRequest_1.makeRpcRequest)({
@@ -17,6 +80,21 @@ class Credentials {
17
80
  request
18
81
  });
19
82
  }
83
+ /**
84
+ * Retrieves an existing set of Credentials in the Workspace.
85
+ *
86
+ * @param {string} ref - The reference of the Credentials to retrieve
87
+ * @return {Promise<Acl>} - The response object that contains the Credentials
88
+ * @example
89
+ *
90
+ * const ref = "00000000-0000-0000-0000-000000000000"
91
+ *
92
+ * const credentials = new SDK.Credentials(client); // Existing client object
93
+ *
94
+ * credentials.getCredentials(ref)
95
+ * .then(console.log) // successful response
96
+ * .catch(console.error); // an error occurred
97
+ */
20
98
  async getCredentials(ref) {
21
99
  const client = this.client.getCredentialsClient();
22
100
  return await (0, makeRpcRequest_1.makeRpcRequest)({
@@ -26,6 +104,28 @@ class Credentials {
26
104
  request: { ref }
27
105
  });
28
106
  }
107
+ /**
108
+ * Updates an existing set of Credentials in the Workspace.
109
+ *
110
+ * @param {UpdateCredentialsRequest} request - The request object that contains the necessary information to update an existing set of Credentials
111
+ * @param {string} request.ref - The reference of the Credentials to update
112
+ * @param {string} request.name - The name of the Credentials
113
+ * @param {string} request.password - The password of the Credentials
114
+ * @return {Promise<BaseApiObject>} - The response object that contains the reference to the updated Credentials
115
+ * @example
116
+ *
117
+ * const request = {
118
+ * ref: "00000000-0000-0000-0000-000000000000",
119
+ * name: "My Credentials",
120
+ * password: "mysecret"
121
+ * };
122
+ *
123
+ * const credentials = new SDK.Credentials(client); // Existing client object
124
+ *
125
+ * credentials.updateCredentials(request)
126
+ * .then(console.log) // successful response
127
+ * .catch(console.error); // an error occurred
128
+ */
29
129
  async updateCredentials(request) {
30
130
  const client = this.client.getCredentialsClient();
31
131
  return await (0, makeRpcRequest_1.makeRpcRequest)({
@@ -35,6 +135,26 @@ class Credentials {
35
135
  request
36
136
  });
37
137
  }
138
+ /**
139
+ * Retrieves a list of Credentials from a Workspace.
140
+ *
141
+ * @param {ListCredentialsRequest} request - The request object that contains the necessary information to retrieve a list of Credentials
142
+ * @param {number} request.pageSize - The number of Credentials to retrieve
143
+ * @param {string} request.pageToken - The token to retrieve the next page of Credentials
144
+ * @return {Promise<ListCredentialsResponse>} - The response object that contains the list of Credentials
145
+ * @example
146
+ *
147
+ * const request = {
148
+ * pageSize: 10,
149
+ * pageToken: "00000000-0000-0000-0000-000000000000"
150
+ * };
151
+ *
152
+ * const credentials = new SDK.Credentials(client); // Existing client object
153
+ *
154
+ * credentials.listCredentials(request)
155
+ * .then(console.log) // successful response
156
+ * .catch(console.error); // an error occurred
157
+ */
38
158
  async listCredentials(request) {
39
159
  const client = this.client.getCredentialsClient();
40
160
  return await (0, makeRpcRequest_1.makeRpcRequest)({
@@ -45,6 +165,22 @@ class Credentials {
45
165
  repeatableObjectMapping: [["itemsList", credentials_pb_1.Credentials]]
46
166
  });
47
167
  }
168
+ /**
169
+ * Deletes an existing set of Credentials from Fonoster.
170
+ * Note that this operation is irreversible.
171
+ *
172
+ * @param {string} ref - The reference of the Credentials to delete
173
+ * @return {Promise<BaseApiObject>} - The response object that contains the reference to the deleted Credentials
174
+ * @example
175
+ *
176
+ * const ref = "00000000-0000-0000-0000-000000000000"
177
+ *
178
+ * const credentials = new SDK.Credentials(client); // Existing client object
179
+ *
180
+ * credentials.deleteCredentials(ref)
181
+ * .then(console.log) // successful response
182
+ * .catch(console.error); // an error occurred
183
+ */
48
184
  async deleteCredentials(ref) {
49
185
  const applicationsClient = this.client.getCredentialsClient();
50
186
  return await (0, makeRpcRequest_1.makeRpcRequest)({
@@ -1,12 +1,152 @@
1
1
  import { BaseApiObject, CreateDomainRequest, Domain, ListDomainsRequest, ListDomainsResponse, UpdateDomainRequest } from "@fonoster/types";
2
2
  import { FonosterClient } from "./client/types";
3
+ /**
4
+ * @classdesc Fonoster Domains, part of the Fonoster SIP Proxy subsystem,
5
+ * allows you to create, update, retrieve, and delete SIP Domain 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 domains = new SDK.Domains(client);
21
+ * const response = await domains.createDomain(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
+ * name: "My Domain",
31
+ * domainUri: "sip.project.fonoster.io"
32
+ * };
33
+ *
34
+ * main(request).catch(console.error);
35
+ */
3
36
  declare class Domains {
4
37
  private client;
38
+ /**
39
+ * Constructs a new Domains object.
40
+ *
41
+ * @param {FonosterClient} client - Client object with underlying implementations to make requests to Fonoster's API
42
+ * @see AbstractClient
43
+ * @see FonosterClient
44
+ */
5
45
  constructor(client: FonosterClient);
46
+ /**
47
+ * Creates a new Domain in the Workspace.
48
+ *
49
+ * @param {CreateDomainRequest} request - The request object that contains the necessary information to create a new Domain
50
+ * @param {string} request.name - The name of the Domain
51
+ * @param {string} request.domainUri - The URI of the Domain
52
+ * @param {AccessControlListRef} request.accessControlListRef - The reference to the Access Control List (ACL) to associate with the Domain
53
+ * @param {EgressPolicy[]} request.egressPolicy - The egress policy of the Domain
54
+ * @param {string} request.egressPolicy[].rule - A regular expression that defines which calls to send to the PSTN
55
+ * @param {string} request.egressPolicy[].numberRef - The Number that will be used to send the call to the PSTN
56
+ * @return {Promise<BaseApiObject>} - The response object that contains the reference to the created Domain
57
+ * @example
58
+ *
59
+ * const request = {
60
+ * name: "My Domain",
61
+ * domainUri: "sip.project.fonoster.io"
62
+ * };
63
+ *
64
+ * const domains = new SDK.Domains(client); // Existing client object
65
+ *
66
+ * domains.createDomain(request)
67
+ * .then(console.log) // successful response
68
+ * .catch(console.error); // an error occurred
69
+ */
6
70
  createDomain(request: CreateDomainRequest): Promise<BaseApiObject>;
71
+ /**
72
+ * Retrieves an existing Domain in the Workspace.
73
+ *
74
+ * @param {string} ref - The reference of the Domain to retrieve
75
+ * @return {Promise<Acl>} - The response object that contains the Domain
76
+ * @example
77
+ *
78
+ * const ref = "00000000-0000-0000-0000-000000000000"
79
+ *
80
+ * const domains = new SDK.Domains(client); // Existing client object
81
+ *
82
+ * domains.getDomain(ref)
83
+ * .then(console.log) // successful response
84
+ * .catch(console.error); // an error occurred
85
+ */
7
86
  getDomain(ref: string): Promise<Domain>;
87
+ /**
88
+ * Updates an existing Domain in the Workspace.
89
+ *
90
+ * @param {UpdateDomainRequest} request - The request object that contains the necessary information to update an existing Domain
91
+ * @param {string} request.ref - The reference of the Domain to update
92
+ * @param {string} request.name - The name of the Domain
93
+ * @param {string} request.domainUri - The URI of the Domain
94
+ * @param {AccessControlListRef} request.accessControlListRef - The reference to the Access Control List (ACL) to associate with the Domain
95
+ * @param {EgressPolicy[]} request.egressPolicy - The egress policy of the Domain
96
+ * @param {string} request.egressPolicy[].rule - A regular expression that defines which calls to send to the PSTN
97
+ * @param {string} request.egressPolicy[].numberRef - The Number that will be used to send the call to the PSTN
98
+ * @return {Promise<BaseApiObject>} - The response object that contains the reference to the updated Domain
99
+ * @example
100
+ *
101
+ * const request = {
102
+ * ref: "00000000-0000-0000-0000-000000000000",
103
+ * accessControlListRef: "00000000-0000-0000-0000-000000000001"
104
+ * };
105
+ *
106
+ * const domains = new SDK.Domains(client); // Existing client object
107
+ *
108
+ * domains.updateDomain(request)
109
+ * .then(console.log) // successful response
110
+ * .catch(console.error); // an error occurred
111
+ */
8
112
  updateDomain(request: UpdateDomainRequest): Promise<BaseApiObject>;
113
+ /**
114
+ * Retrieves a list of Domains from a Workspace.
115
+ *
116
+ * @param {ListDomainsRequest} request - The request object that contains the necessary information to retrieve a list of Domains
117
+ * @param {number} request.pageSize - The number of Domains to retrieve
118
+ * @param {string} request.pageToken - The token to retrieve the next page of Domains
119
+ * @return {Promise<ListDomainsResponse>} - The response object that contains the list of Domains
120
+ * @example
121
+ *
122
+ * const request = {
123
+ * pageSize: 10,
124
+ * pageToken: "00000000-0000-0000-0000-000000000000"
125
+ * };
126
+ *
127
+ * const domains = new SDK.Domains(client); // Existing client object
128
+ *
129
+ * domains.listDomains(request)
130
+ * .then(console.log) // successful response
131
+ * .catch(console.error); // an error occurred
132
+ */
9
133
  listDomains(request: ListDomainsRequest): Promise<ListDomainsResponse>;
134
+ /**
135
+ * Deletes an existing Domain from Fonoster.
136
+ * Note that this operation is irreversible.
137
+ *
138
+ * @param {string} ref - The reference of the Domain to delete
139
+ * @return {Promise<BaseApiObject>} - The response object that contains the reference to the deleted Domain
140
+ * @example
141
+ *
142
+ * const ref = "00000000-0000-0000-0000-000000000000"
143
+ *
144
+ * const domains = new SDK.Domains(client); // Existing client object
145
+ *
146
+ * domains.deleteDomain(ref)
147
+ * .then(console.log) // successful response
148
+ * .catch(console.error); // an error occurred
149
+ */
10
150
  deleteDomain(ref: string): Promise<BaseApiObject>;
11
151
  }
12
152
  export { Domains };
@@ -3,11 +3,75 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Domains = void 0;
4
4
  const makeRpcRequest_1 = require("./client/makeRpcRequest");
5
5
  const domains_pb_1 = require("./generated/node/domains_pb");
6
+ /**
7
+ * @classdesc Fonoster Domains, part of the Fonoster SIP Proxy subsystem,
8
+ * allows you to create, update, retrieve, and delete SIP Domain for your deployment.
9
+ * Note that an active Fonoster deployment is required.
10
+ *
11
+ * @example
12
+ *
13
+ * const SDK = require("@fonoster/sdk");
14
+ *
15
+ * async function main(request) {
16
+ * const apiKey = "your-api-key";
17
+ * const accessKeyId = "00000000-0000-0000-0000-000000000000";
18
+ *
19
+ * try {
20
+ * const client = SDK.Client({ accessKeyId });
21
+ * await client.loginWithApiKey(apiKey);
22
+ *
23
+ * const domains = new SDK.Domains(client);
24
+ * const response = await domains.createDomain(request);
25
+ *
26
+ * console.log(response); // successful response
27
+ * } catch (e) {
28
+ * console.error(e); // an error occurred
29
+ * }
30
+ * }
31
+ *
32
+ * const request = {
33
+ * name: "My Domain",
34
+ * domainUri: "sip.project.fonoster.io"
35
+ * };
36
+ *
37
+ * main(request).catch(console.error);
38
+ */
6
39
  class Domains {
7
40
  client;
41
+ /**
42
+ * Constructs a new Domains object.
43
+ *
44
+ * @param {FonosterClient} client - Client object with underlying implementations to make requests to Fonoster's API
45
+ * @see AbstractClient
46
+ * @see FonosterClient
47
+ */
8
48
  constructor(client) {
9
49
  this.client = client;
10
50
  }
51
+ /**
52
+ * Creates a new Domain in the Workspace.
53
+ *
54
+ * @param {CreateDomainRequest} request - The request object that contains the necessary information to create a new Domain
55
+ * @param {string} request.name - The name of the Domain
56
+ * @param {string} request.domainUri - The URI of the Domain
57
+ * @param {AccessControlListRef} request.accessControlListRef - The reference to the Access Control List (ACL) to associate with the Domain
58
+ * @param {EgressPolicy[]} request.egressPolicy - The egress policy of the Domain
59
+ * @param {string} request.egressPolicy[].rule - A regular expression that defines which calls to send to the PSTN
60
+ * @param {string} request.egressPolicy[].numberRef - The Number that will be used to send the call to the PSTN
61
+ * @return {Promise<BaseApiObject>} - The response object that contains the reference to the created Domain
62
+ * @example
63
+ *
64
+ * const request = {
65
+ * name: "My Domain",
66
+ * domainUri: "sip.project.fonoster.io"
67
+ * };
68
+ *
69
+ * const domains = new SDK.Domains(client); // Existing client object
70
+ *
71
+ * domains.createDomain(request)
72
+ * .then(console.log) // successful response
73
+ * .catch(console.error); // an error occurred
74
+ */
11
75
  async createDomain(request) {
12
76
  const client = this.client.getDomainsClient();
13
77
  return await (0, makeRpcRequest_1.makeRpcRequest)({
@@ -17,6 +81,21 @@ class Domains {
17
81
  request
18
82
  });
19
83
  }
84
+ /**
85
+ * Retrieves an existing Domain in the Workspace.
86
+ *
87
+ * @param {string} ref - The reference of the Domain to retrieve
88
+ * @return {Promise<Acl>} - The response object that contains the Domain
89
+ * @example
90
+ *
91
+ * const ref = "00000000-0000-0000-0000-000000000000"
92
+ *
93
+ * const domains = new SDK.Domains(client); // Existing client object
94
+ *
95
+ * domains.getDomain(ref)
96
+ * .then(console.log) // successful response
97
+ * .catch(console.error); // an error occurred
98
+ */
20
99
  async getDomain(ref) {
21
100
  const client = this.client.getDomainsClient();
22
101
  return await (0, makeRpcRequest_1.makeRpcRequest)({
@@ -26,6 +105,31 @@ class Domains {
26
105
  request: { ref }
27
106
  });
28
107
  }
108
+ /**
109
+ * Updates an existing Domain in the Workspace.
110
+ *
111
+ * @param {UpdateDomainRequest} request - The request object that contains the necessary information to update an existing Domain
112
+ * @param {string} request.ref - The reference of the Domain to update
113
+ * @param {string} request.name - The name of the Domain
114
+ * @param {string} request.domainUri - The URI of the Domain
115
+ * @param {AccessControlListRef} request.accessControlListRef - The reference to the Access Control List (ACL) to associate with the Domain
116
+ * @param {EgressPolicy[]} request.egressPolicy - The egress policy of the Domain
117
+ * @param {string} request.egressPolicy[].rule - A regular expression that defines which calls to send to the PSTN
118
+ * @param {string} request.egressPolicy[].numberRef - The Number that will be used to send the call to the PSTN
119
+ * @return {Promise<BaseApiObject>} - The response object that contains the reference to the updated Domain
120
+ * @example
121
+ *
122
+ * const request = {
123
+ * ref: "00000000-0000-0000-0000-000000000000",
124
+ * accessControlListRef: "00000000-0000-0000-0000-000000000001"
125
+ * };
126
+ *
127
+ * const domains = new SDK.Domains(client); // Existing client object
128
+ *
129
+ * domains.updateDomain(request)
130
+ * .then(console.log) // successful response
131
+ * .catch(console.error); // an error occurred
132
+ */
29
133
  async updateDomain(request) {
30
134
  const client = this.client.getDomainsClient();
31
135
  return await (0, makeRpcRequest_1.makeRpcRequest)({
@@ -35,6 +139,26 @@ class Domains {
35
139
  request
36
140
  });
37
141
  }
142
+ /**
143
+ * Retrieves a list of Domains from a Workspace.
144
+ *
145
+ * @param {ListDomainsRequest} request - The request object that contains the necessary information to retrieve a list of Domains
146
+ * @param {number} request.pageSize - The number of Domains to retrieve
147
+ * @param {string} request.pageToken - The token to retrieve the next page of Domains
148
+ * @return {Promise<ListDomainsResponse>} - The response object that contains the list of Domains
149
+ * @example
150
+ *
151
+ * const request = {
152
+ * pageSize: 10,
153
+ * pageToken: "00000000-0000-0000-0000-000000000000"
154
+ * };
155
+ *
156
+ * const domains = new SDK.Domains(client); // Existing client object
157
+ *
158
+ * domains.listDomains(request)
159
+ * .then(console.log) // successful response
160
+ * .catch(console.error); // an error occurred
161
+ */
38
162
  async listDomains(request) {
39
163
  const client = this.client.getDomainsClient();
40
164
  return await (0, makeRpcRequest_1.makeRpcRequest)({
@@ -45,6 +169,22 @@ class Domains {
45
169
  repeatableObjectMapping: [["itemsList", domains_pb_1.Domain]]
46
170
  });
47
171
  }
172
+ /**
173
+ * Deletes an existing Domain from Fonoster.
174
+ * Note that this operation is irreversible.
175
+ *
176
+ * @param {string} ref - The reference of the Domain to delete
177
+ * @return {Promise<BaseApiObject>} - The response object that contains the reference to the deleted Domain
178
+ * @example
179
+ *
180
+ * const ref = "00000000-0000-0000-0000-000000000000"
181
+ *
182
+ * const domains = new SDK.Domains(client); // Existing client object
183
+ *
184
+ * domains.deleteDomain(ref)
185
+ * .then(console.log) // successful response
186
+ * .catch(console.error); // an error occurred
187
+ */
48
188
  async deleteDomain(ref) {
49
189
  const applicationsClient = this.client.getDomainsClient();
50
190
  return await (0, makeRpcRequest_1.makeRpcRequest)({