@vonage/audit 1.0.1

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.
Files changed (2) hide show
  1. package/README.md +118 -0
  2. package/package.json +40 -0
package/README.md ADDED
@@ -0,0 +1,118 @@
1
+ # Vonage Audit SDK for Node.js
2
+
3
+ ![GitHub Workflow Status (branch)](https://img.shields.io/github/workflow/status/vonage/vonage-node-sdk/Vonage/3.x?logo=github&style=flat-square&label=Workflow%20Build)
4
+ [![Codecov](https://img.shields.io/codecov/c/github/vonage/vonage-node-sdk?label=Codecov&logo=codecov&style=flat-square)](https://codecov.io/gh/Vonage/vonage-server-sdk)
5
+ ![Latest Release](https://img.shields.io/npm/v/@vonage/number)
6
+ [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg?style=flat-square)](../../CODE_OF_CONDUCT.md)
7
+ [![License](https://img.shields.io/npm/l/@vonage/number?label=License&style=flat-square)][license]
8
+
9
+ <img src="https://developer.nexmo.com/images/logos/vbc-logo.svg" height="48px" alt="Vonage" />
10
+
11
+ This is the Vonage Audit SDK for Node.js for use with
12
+ [Vonage APIs](https://www.vonage.com/). To use it you will need a Vonage
13
+ account. Sign up [for free at vonage.com][signup].
14
+
15
+ We recommend using this package as part of the overall [
16
+ `@vonage/server-sdk` package](https://github.com/vonage/vonage-node-sdk).
17
+
18
+ For full API documentation refer to [developer.nexmo.com](https://developer.nexmo.com/).
19
+
20
+ * [Installation](#installation)
21
+ * [Usage](#using-the-vonage-number-sdk)
22
+ * [Promises](#promises)
23
+ * [Testing](#testing)
24
+
25
+ ## Installation
26
+
27
+ We recommend using this SDK as part of the overall [
28
+ `@vonage/server-sdk` package](https://github.com/vonage/vonage-node-sdk).
29
+ Please see the main package for installation.
30
+
31
+ You can also use this SDK standalone if you only need access to just the
32
+ Audit API.
33
+
34
+ ### With NPM
35
+
36
+ ```bash
37
+ npm install @vonage/audit
38
+ ```
39
+
40
+ ### With Yarn
41
+
42
+ ```bash
43
+ yarn add @vonage/audit
44
+ ```
45
+
46
+ ## Using the Vonage Audit SDK
47
+
48
+ ### As part of the Vonage Server SDK
49
+
50
+ If you are using this SDK as part of the Vonage Server SDK, you can access it
51
+ as the `audit` property off of the client that you instantiate.
52
+
53
+ ```js
54
+ const { Vonage, Auth } = require('@vonage/server-sdk');
55
+
56
+ const credentials = new Auth({
57
+ apiKey: API_KEY,
58
+ apiSecret: API_SECRET
59
+ });
60
+ const options = {};
61
+ const vonage = new Vonage(credentials, options);
62
+
63
+ (async () =>{
64
+ for await (const event of vonage.audit.getEvents()) {
65
+ console.log(event);
66
+ }
67
+ })();
68
+
69
+
70
+ ```
71
+
72
+ ### Standalone
73
+
74
+ The SDK can be used standalone from the main
75
+ [Vonage Server SDK for Node.js](https://github.com/vonage/vonage-node-sdk) if
76
+ you only need to use the Audit API. All you need to do is
77
+ `require('@vonage/audit')`, and use the returned object to create your own
78
+ client.
79
+
80
+ ```js
81
+ const { Auth } = require('@vonage/auth');
82
+ const { Audit } = require('@vonage/number');
83
+
84
+ const credentials = new Auth({
85
+ apiKey: API_KEY,
86
+ apiSecret: API_SECRET
87
+ });
88
+ const options = {};
89
+
90
+ const auditClient = new Audit(credentials, options);
91
+ ```
92
+
93
+ Where `credentials` is any option from [`@vonage/auth`](https://github.com/Vonage/vonage-node-sdk/tree/3.x/readme/packages/auth#options),
94
+ and `options` is any option from [`@vonage/server-client`](https://github.com/Vonage/vonage-node-sdk/tree/3.x/readme/packages/server-client#options)
95
+
96
+ ## Promises
97
+
98
+ Most methods that interact with the Vonage API uses Promises. You can either
99
+ resolve these yourself, or use `await` to wait for a response.
100
+
101
+ ```js
102
+ const resp = await vonage.audit.getEvent(eventId);
103
+
104
+ vonage.audit.getEvent(eventId)
105
+ .then(resp => console.log(resp))
106
+ .catch(err => console.error(err));
107
+ ```
108
+
109
+ ## Testing
110
+
111
+ Run:
112
+
113
+ ```bash
114
+ npm run test
115
+ ```
116
+
117
+ [signup]: https://dashboard.nexmo.com/sign-up?utm_source=DEV_REL&utm_medium=github&utm_campaign=node-server-sdk
118
+ [license]: ../../LICENSE.txt
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "@vonage/audit",
3
+ "version": "1.0.1",
4
+ "description": "Vonage Audit SDK Package",
5
+ "homepage": "https://github.com/vonage/vonage-node-sdk/tree/master/packages/audit#readme",
6
+ "bugs": {
7
+ "url": "https://github.com/Vonage/vonage-node-sdk/issues"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/Vonage/vonage-node-sdk.git"
12
+ },
13
+ "license": "Apache-2.0",
14
+ "author": "Chuck \"MANCHUCK\" Reeves",
15
+ "main": "dist/index.js",
16
+ "types": "dist/index.d.ts",
17
+ "directories": {
18
+ "lib": "dist",
19
+ "test": "__tests__"
20
+ },
21
+ "files": [
22
+ "/dist"
23
+ ],
24
+ "scripts": {
25
+ "build": "npm run clean && npm run compile",
26
+ "clean": "npx shx rm -rf dist tsconfig.tsbuildinfo",
27
+ "compile": "npx tsc --build --verbose"
28
+ },
29
+ "dependencies": {
30
+ "@vonage/auth": "^1.0.10",
31
+ "@vonage/server-client": "^1.0.16",
32
+ "@vonage/vetch": "^1.0.11"
33
+ },
34
+ "devDependencies": {
35
+ "nock": "^13.2.9"
36
+ },
37
+ "publishConfig": {
38
+ "directory": "dist"
39
+ }
40
+ }