@fonoster/sdk 0.7.43 → 0.7.45

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 CHANGED
@@ -15,19 +15,19 @@ This package provides a set of utilities for working with Fonoster services. It
15
15
  ## Installation
16
16
 
17
17
  ```sh-session
18
- $ npm install --save @fonoster/sdk@next
18
+ $ npm install --save @fonoster/sdk
19
19
  ```
20
20
 
21
21
  Or using yarn:
22
22
 
23
23
  ```sh-session
24
- $ yarn add @fonoster/sdk@next
24
+ $ yarn add @fonoster/sdk
25
25
  ```
26
26
 
27
27
  Or in the browser:
28
28
 
29
29
  ```html
30
- <script src="https://unpkg.com/@fonoster/sdk@next"></script>
30
+ <script src="https://unpkg.com/@fonoster/sdk"></script>
31
31
  ```
32
32
 
33
33
  ### Importing the library
@@ -47,7 +47,7 @@ import * as SDK from "@fonoster/sdk";
47
47
  Directly in the browser:
48
48
 
49
49
  ```html
50
- <script src="https://unpkg.com/@fonoster/sdk@next"></script>
50
+ <script src="https://unpkg.com/@fonoster/sdk"></script>
51
51
  <script>
52
52
  // You can now use the SDK
53
53
  </script>
@@ -1,4 +1,4 @@
1
- import { BaseApiObject, CreateAclRequest, ListAclsRequest, ListAclsResponse, UpdateAclRequest } from "@fonoster/types";
1
+ import { Acl, BaseApiObject, CreateAclRequest, ListAclsRequest, ListAclsResponse, UpdateAclRequest } from "@fonoster/types";
2
2
  import { FonosterClient } from "./client/types";
3
3
  /**
4
4
  * @classdesc Fonoster Acls, part of the Fonoster SIP Proxy subsystem,
@@ -79,7 +79,7 @@ declare class Acls {
79
79
  * .then(console.log) // successful response
80
80
  * .catch(console.error); // an error occurred
81
81
  */
82
- getAcl(ref: string): Promise<unknown>;
82
+ getAcl(ref: string): Promise<Acl>;
83
83
  /**
84
84
  * Updates an existing Acl in the Workspace.
85
85
  *
@@ -107,13 +107,22 @@ class Agents {
107
107
  */
108
108
  async getAgent(ref) {
109
109
  const client = this.client.getAgentsClient();
110
- return await (0, makeRpcRequest_1.makeRpcRequest)({
110
+ const response = await (0, makeRpcRequest_1.makeRpcRequest)({
111
111
  method: client.getAgent.bind(client),
112
112
  requestPBObjectConstructor: agents_pb_1.GetAgentRequest,
113
113
  metadata: this.client.getMetadata(),
114
114
  request: { ref },
115
115
  enumMapping: [["privacy", agents_pb_1.Privacy]]
116
116
  });
117
+ const credentials = response?.credentials?.toObject();
118
+ const domain = response?.domain?.toObject();
119
+ return response
120
+ ? {
121
+ ...response,
122
+ credentials,
123
+ domain
124
+ }
125
+ : null;
117
126
  }
118
127
  /**
119
128
  * Updates an existing Agent in the Workspace.
@@ -104,12 +104,19 @@ class Numbers {
104
104
  */
105
105
  async getNumber(ref) {
106
106
  const client = this.client.getNumbersClient();
107
- return await (0, makeRpcRequest_1.makeRpcRequest)({
107
+ const response = await (0, makeRpcRequest_1.makeRpcRequest)({
108
108
  method: client.getNumber.bind(client),
109
109
  requestPBObjectConstructor: numbers_pb_1.GetNumberRequest,
110
110
  metadata: this.client.getMetadata(),
111
111
  request: { ref }
112
112
  });
113
+ const trunk = response?.trunk?.toObject();
114
+ return response
115
+ ? {
116
+ ...response,
117
+ trunk
118
+ }
119
+ : null;
113
120
  }
114
121
  /**
115
122
  * Updates an existing Number in the Workspace.
@@ -1,4 +1,4 @@
1
- import { BaseApiObject, CreateTrunkRequest, ListTrunksRequest, ListTrunksResponse, UpdateTrunkRequest } from "@fonoster/types";
1
+ import { BaseApiObject, CreateTrunkRequest, ListTrunksRequest, ListTrunksResponse, Trunk, UpdateTrunkRequest } from "@fonoster/types";
2
2
  import { FonosterClient } from "./client/types";
3
3
  /**
4
4
  * @classdesc Fonoster Trunks, part of the Fonoster SIP Proxy subsystem,
@@ -102,7 +102,7 @@ declare class Trunks {
102
102
  * .then(console.log) // successful response
103
103
  * .catch(console.error); // an error occurred
104
104
  */
105
- getTrunk(ref: string): Promise<unknown>;
105
+ getTrunk(ref: string): Promise<Trunk>;
106
106
  /**
107
107
  * Updates an existing Trunk in the Workspace.
108
108
  *
@@ -149,12 +149,14 @@ class Trunks {
149
149
  const obj = response.toObject();
150
150
  const outObj = {
151
151
  ...obj,
152
+ accessControlListRef: obj.accessControlList?.ref,
153
+ inboundCredentialsRef: obj.inboundCredentials?.ref,
154
+ outboundCredentialsRef: obj.outboundCredentials?.ref,
152
155
  uris: obj.urisList,
153
156
  createdAt: new Date(obj.createdAt * 1000),
154
157
  updatedAt: new Date(obj.updatedAt * 1000)
155
158
  };
156
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
157
- const { urisList, ...rest } = outObj;
159
+ const { urisList, accessControlList, inboundCredentials, outboundCredentials, ...rest } = outObj;
158
160
  resolve(rest);
159
161
  });
160
162
  });