wavix-sdk 0.0.4 → 0.0.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 CHANGED
@@ -1,47 +1,48 @@
1
- ## API
1
+ # Wavix Node.js SDK
2
2
 
3
- https://wavix.com/api
3
+ Wavix Node.js SDK provides convenient and easy-to-understand functions for interacting with the Wavix API. You can use this package to integrate your Node.js application or service with Wavix functionality.
4
4
 
5
- # Quick start
5
+ The current list of Wavix HTTP REST API can be found here: https://wavix.com/api
6
+
7
+ ## Installation and Usage
6
8
 
7
9
  ### pnpm:
8
- ```
10
+
11
+ ```sh
9
12
  pnpm install wavix-sdk
10
13
  ```
11
14
 
12
- ### yarn
13
- ```
15
+ ### yarn
16
+
17
+ ```sh
14
18
  yarn add wavix-sdk
15
19
  ```
16
20
 
17
21
  # Using
22
+
18
23
  ```typescript
19
24
  import Wavix from "wavix-sdk"
20
25
 
21
- const wavix = new Wavix({ appid: "<YOUR APPID>" })
26
+ const wavix = new Wavix({ appid: "<YOUR APPID>" })
22
27
 
23
28
  const cdrList = await wavix.cdr.list({
24
- from: "2023-06-01",
25
- to: "2023-12-31",
26
- type: "placed" as const,
27
- per_page: 1
28
- })
29
+ from: new Date("2023-01-01"),
30
+ to: new Date(),
31
+ type: "placed" as const,
32
+ per_page: 1
33
+ })
29
34
  ```
30
35
 
31
36
  You can also find examples in the "examples" directory.
32
37
 
33
- - API calls ✅
34
- - Number validator ✅
35
- - DID numbers
36
- - SIP trunks ✅
37
- - Call Detail Records (CDRs) ✅
38
- - Speech analytics ✅
39
- - Voice campaigns
40
- - SMS and MMS ✅
41
- - Link Shortener ✅
42
- - E911 ✅
43
- - Billing
44
- - Cart ✅
45
- - Buy ✅
46
- - Profile ✅
47
- - 2FA ✅
38
+ ## Contributing
39
+
40
+ We welcome contributions from the community. If you'd like to contribute, please fork the repository, make your changes, and submit a pull request. For major changes, please open an issue first to discuss what you would like to change.
41
+
42
+ ## Support and Contact
43
+
44
+ If you encounter any issues or have questions about the SDK, please create an issue on our GitHub repository. For direct support, you can contact us at support@wavix.com.
45
+
46
+ ## License
47
+
48
+ This SDK is distributed under the MIT License. See [LICENSE](./LICENSE) for more detailed information.
package/lib/cjs/http.js CHANGED
@@ -102,10 +102,11 @@ class Http {
102
102
  return `${this.baseURL}${path}${path.includes("?") ? "&" : "?"}appid=${this.appid}`;
103
103
  }
104
104
  errorHandler(error) {
105
+ var _a, _b;
105
106
  if (axios_1.default.isAxiosError(error)) {
106
107
  const serverError = error;
107
108
  if (serverError && serverError.response) {
108
- return serverError.response.data;
109
+ return { success: false, message: ((_b = (_a = serverError.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.message) || "" };
109
110
  }
110
111
  }
111
112
  return { success: false, message: "" };
@@ -21,5 +21,15 @@ class Cdr extends service_base_1.default {
21
21
  return yield this.http.get(`/v1/cdr?${queryString}`);
22
22
  });
23
23
  }
24
+ get(uuid) {
25
+ return __awaiter(this, void 0, void 0, function* () {
26
+ return yield this.http.get(`/v1/cdr/${uuid}`);
27
+ });
28
+ }
29
+ downloadRecording(uuid) {
30
+ return __awaiter(this, void 0, void 0, function* () {
31
+ return yield this.http.get(`/v1/recordings/${uuid}`);
32
+ });
33
+ }
24
34
  }
25
35
  exports.Cdr = Cdr;
@@ -12,6 +12,19 @@ export interface CdrResponse {
12
12
  to: string;
13
13
  uuid: string;
14
14
  }
15
+ export interface CdrResponseDetails {
16
+ uuid: string;
17
+ charge: string;
18
+ date: Date;
19
+ destination: string;
20
+ disposition: string;
21
+ duration: number;
22
+ from: string;
23
+ per_minute: string;
24
+ recording_url: string | null;
25
+ sip_trunk: string;
26
+ to: string;
27
+ }
15
28
  export interface QueryParameters {
16
29
  from: Date;
17
30
  to: Date;
@@ -1 +1 @@
1
- {"version":3,"file":"cdr.interface.d.ts","sourceRoot":"","sources":["../../../../../src/services/cdr/cdr.interface.ts"],"names":[],"mappings":"AAAA,KAAK,OAAO,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WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,CAAA;IAClB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,IAAI,CAAA;IACV,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,SAAS,EAAE,MAAM,CAAA;IACjB,EAAE,EAAE,MAAM,CAAA;CACX;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,IAAI,CAAA;IACV,EAAE,EAAE,IAAI,CAAA;IACR,IAAI,EAAE,OAAO,CAAA;IACb,WAAW,CAAC,EAAE,kBAAkB,CAAA;IAChC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd"}
@@ -1,7 +1,9 @@
1
1
  import ServiceBase from "../service.base";
2
- import { CdrResponse, QueryParameters } from "./cdr.interface";
2
+ import { CdrResponse, QueryParameters, CdrResponseDetails } from "./cdr.interface";
3
3
  declare class Cdr extends ServiceBase {
4
- list(queryParameters: QueryParameters): Promise<PaginatedResponse<CdrResponse>>;
4
+ list(queryParameters: QueryParameters): Promise<PaginatedResponse<CdrResponse> | ErrorResponse>;
5
+ get(uuid: string): Promise<CdrResponseDetails | ErrorResponse>;
6
+ downloadRecording(uuid: string): Promise<ArrayBuffer | ErrorResponse>;
5
7
  }
6
8
  export { Cdr };
7
9
  //# sourceMappingURL=cdr.service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cdr.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/cdr/cdr.service.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,iBAAiB,CAAA;AACzC,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAE9D,cAAM,GAAI,SAAQ,WAAW;IACd,IAAI,CAAC,eAAe,EAAE,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;CAI7F;AAED,OAAO,EAAE,GAAG,EAAE,CAAA"}
1
+ {"version":3,"file":"cdr.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/cdr/cdr.service.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,iBAAiB,CAAA;AACzC,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAElF,cAAM,GAAI,SAAQ,WAAW;IACd,IAAI,CAAC,eAAe,EAAE,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC,WAAW,CAAC,GAAG,aAAa,CAAC;IAK/F,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,GAAG,aAAa,CAAC;IAI9D,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,aAAa,CAAC;CAGnF;AAED,OAAO,EAAE,GAAG,EAAE,CAAA"}
package/lib/esm/http.js CHANGED
@@ -84,7 +84,7 @@ class Http {
84
84
  if (axios.isAxiosError(error)) {
85
85
  const serverError = error;
86
86
  if (serverError && serverError.response) {
87
- return serverError.response.data;
87
+ return { success: false, message: serverError.response?.data?.message || "" };
88
88
  }
89
89
  }
90
90
  return { success: false, message: "" };
@@ -4,5 +4,11 @@ class Cdr extends ServiceBase {
4
4
  const queryString = this.http.paramsToQueryString(queryParameters);
5
5
  return await this.http.get(`/v1/cdr?${queryString}`);
6
6
  }
7
+ async get(uuid) {
8
+ return await this.http.get(`/v1/cdr/${uuid}`);
9
+ }
10
+ async downloadRecording(uuid) {
11
+ return await this.http.get(`/v1/recordings/${uuid}`);
12
+ }
7
13
  }
8
14
  export { Cdr };
@@ -12,6 +12,19 @@ export interface CdrResponse {
12
12
  to: string;
13
13
  uuid: string;
14
14
  }
15
+ export interface CdrResponseDetails {
16
+ uuid: string;
17
+ charge: string;
18
+ date: Date;
19
+ destination: string;
20
+ disposition: string;
21
+ duration: number;
22
+ from: string;
23
+ per_minute: string;
24
+ recording_url: string | null;
25
+ sip_trunk: string;
26
+ to: string;
27
+ }
15
28
  export interface QueryParameters {
16
29
  from: Date;
17
30
  to: Date;
@@ -1 +1 @@
1
- {"version":3,"file":"cdr.interface.d.ts","sourceRoot":"","sources":["../../../../../src/services/cdr/cdr.interface.ts"],"names":[],"mappings":"AAAA,KAAK,OAAO,GAAG,QAAQ,GAAG,UAAU,CAAA;AACpC,KAAK,kBAAkB,GAAG,UAAU,GAAG,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAA;AAE7E,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,CAAA;IAClB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,IAAI,CAAA;IACV,EAAE,EAAE,IAAI,CAAA;IACR,IAAI,EAAE,OAAO,CAAA;IACb,WAAW,CAAC,EAAE,kBAAkB,CAAA;IAChC,WAAW,CAAC,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AE,OAAO,CAAA;IACb,WAAW,CAAC,EAAE,kBAAkB,CAAA;IAChC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd"}
@@ -1,7 +1,9 @@
1
1
  import ServiceBase from "../service.base";
2
- import { CdrResponse, QueryParameters } from "./cdr.interface";
2
+ import { CdrResponse, QueryParameters, CdrResponseDetails } from "./cdr.interface";
3
3
  declare class Cdr extends ServiceBase {
4
- list(queryParameters: QueryParameters): Promise<PaginatedResponse<CdrResponse>>;
4
+ list(queryParameters: QueryParameters): Promise<PaginatedResponse<CdrResponse> | ErrorResponse>;
5
+ get(uuid: string): Promise<CdrResponseDetails | ErrorResponse>;
6
+ downloadRecording(uuid: string): Promise<ArrayBuffer | ErrorResponse>;
5
7
  }
6
8
  export { Cdr };
7
9
  //# sourceMappingURL=cdr.service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cdr.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/cdr/cdr.service.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,iBAAiB,CAAA;AACzC,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAE9D,cAAM,GAAI,SAAQ,WAAW;IACd,IAAI,CAAC,eAAe,EAAE,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;CAI7F;AAED,OAAO,EAAE,GAAG,EAAE,CAAA"}
1
+ {"version":3,"file":"cdr.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/cdr/cdr.service.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,iBAAiB,CAAA;AACzC,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAElF,cAAM,GAAI,SAAQ,WAAW;IACd,IAAI,CAAC,eAAe,EAAE,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC,WAAW,CAAC,GAAG,aAAa,CAAC;IAK/F,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,GAAG,aAAa,CAAC;IAI9D,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,aAAa,CAAC;CAGnF;AAED,OAAO,EAAE,GAAG,EAAE,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wavix-sdk",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "main": "./lib/cjs/index.js",
5
5
  "types": "./lib/cjs/types/index.d.ts",
6
6
  "type": "commonjs",