@vonage/server-sdk
Advanced tools
Comparing version 3.0.10 to 3.0.11
@@ -1,5 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Vonage = void 0; | ||
var vonage_1 = require("./vonage"); | ||
Object.defineProperty(exports, "Vonage", { enumerable: true, get: function () { return vonage_1.Vonage; } }); | ||
export { Vonage } from './vonage'; | ||
//# sourceMappingURL=index.js.map |
@@ -1,33 +0,30 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Vonage = void 0; | ||
const accounts_1 = require("@vonage/accounts"); | ||
const applications_1 = require("@vonage/applications"); | ||
const auth_1 = require("@vonage/auth"); | ||
const messages_1 = require("@vonage/messages"); | ||
const number_insights_1 = require("@vonage/number-insights"); | ||
const numbers_1 = require("@vonage/numbers"); | ||
const pricing_1 = require("@vonage/pricing"); | ||
const sms_1 = require("@vonage/sms"); | ||
const verify_1 = require("@vonage/verify"); | ||
const voice_1 = require("@vonage/voice"); | ||
class Vonage { | ||
import { Accounts, Secrets } from '@vonage/accounts'; | ||
import { Applications } from '@vonage/applications'; | ||
import { Auth } from '@vonage/auth'; | ||
import { Messages } from '@vonage/messages'; | ||
import { NumberInsights } from '@vonage/number-insights'; | ||
import { Numbers } from '@vonage/numbers'; | ||
import { Pricing } from '@vonage/pricing'; | ||
import { SMS } from '@vonage/sms'; | ||
import { Verify } from '@vonage/verify'; | ||
import { Voice } from '@vonage/voice'; | ||
export class Vonage { | ||
constructor(credentials, options) { | ||
if (typeof credentials.getQueryParams === 'undefined') { | ||
credentials = new auth_1.Auth(credentials); | ||
credentials = new Auth(credentials); | ||
} | ||
this.credentials = credentials; | ||
this.options = options; | ||
this.accounts = new accounts_1.Accounts(this.credentials, this.options); | ||
this.applications = new applications_1.Applications(this.credentials, this.options); | ||
this.messages = new messages_1.Messages(this.credentials, this.options); | ||
this.numberInsights = new number_insights_1.NumberInsights(this.credentials, this.options); | ||
this.numbers = new numbers_1.Numbers(this.credentials, this.options); | ||
this.pricing = new pricing_1.Pricing(this.credentials, this.options); | ||
this.secrets = new accounts_1.Secrets(this.credentials, this.options); | ||
this.sms = new sms_1.SMS(this.credentials, this.options); | ||
this.verify = new verify_1.Verify(this.credentials, this.options); | ||
this.voice = new voice_1.Voice(this.credentials, this.options); | ||
this.accounts = new Accounts(this.credentials, this.options); | ||
this.applications = new Applications(this.credentials, this.options); | ||
this.messages = new Messages(this.credentials, this.options); | ||
this.numberInsights = new NumberInsights(this.credentials, this.options); | ||
this.numbers = new Numbers(this.credentials, this.options); | ||
this.pricing = new Pricing(this.credentials, this.options); | ||
this.secrets = new Secrets(this.credentials, this.options); | ||
this.sms = new SMS(this.credentials, this.options); | ||
this.verify = new Verify(this.credentials, this.options); | ||
this.voice = new Voice(this.credentials, this.options); | ||
} | ||
} | ||
exports.Vonage = Vonage; | ||
//# sourceMappingURL=vonage.js.map |
{ | ||
"name": "@vonage/server-sdk", | ||
"version": "3.0.10", | ||
"version": "3.0.11", | ||
"description": "Node.js Client for the Vonage API Platform", | ||
@@ -26,27 +26,22 @@ "homepage": "https://developer.vonage.com", | ||
"build": "npm run clean && npm run compile", | ||
"clean": "tsc -b --clean", | ||
"compile": "tsc -p tsconfig.json", | ||
"format": "prettier --write \"lib/**/*.ts\"", | ||
"lint": "tslint -p tsconfig.json", | ||
"prepublishOnly": "npm run build && npm run test && npm run lint", | ||
"test": "npx jest", | ||
"test-watch": "npx jest --watch", | ||
"preversion": "npm run lint", | ||
"version": "npm run format && git add -A lib" | ||
"clean": "npx shx rm -rf dist tsconfig.tsbuildinfo", | ||
"compile": "npx tsc --build --verbose" | ||
}, | ||
"dependencies": { | ||
"@vonage/accounts": "^1.0.6", | ||
"@vonage/applications": "^1.0.6", | ||
"@vonage/messages": "^1.0.7", | ||
"@vonage/number-insights": "^1.0.6", | ||
"@vonage/numbers": "^1.0.9", | ||
"@vonage/pricing": "^1.0.6", | ||
"@vonage/server-client": "^1.0.6", | ||
"@vonage/sms": "^1.0.7", | ||
"@vonage/verify": "^1.0.8", | ||
"@vonage/voice": "^1.0.7" | ||
"@vonage/accounts": "^1.0.7", | ||
"@vonage/applications": "^1.0.7", | ||
"@vonage/auth": "^1.0.4", | ||
"@vonage/messages": "^1.0.8", | ||
"@vonage/number-insights": "^1.0.7", | ||
"@vonage/numbers": "^1.0.10", | ||
"@vonage/pricing": "^1.0.7", | ||
"@vonage/sms": "^1.0.8", | ||
"@vonage/verify": "^1.0.9", | ||
"@vonage/vetch": "^1.0.5", | ||
"@vonage/voice": "^1.0.8" | ||
}, | ||
"publishConfig": { | ||
"directory": "dist" | ||
} | ||
}, | ||
"gitHead": "328f18e5c8a458cb4d06d7955ec2399a6ce6f5d8" | ||
} |
# Vonage Server SDK for Node.js | ||
![GitHub Workflow Status (branch)](https://img.shields.io/github/workflow/status/vonage/vonage-node-sdk/Vonage/3.x-wip?logo=github&style=flat-square&label=Workflow%20Build) [![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) ![Latest Release](https://img.shields.io/github/v/release/vonage/vonage-node-sdk?logo=npm&style=flat-square) | ||
![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) | ||
[![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) | ||
![Latest Release](https://img.shields.io/npm/v/@vonage/server-sdk) | ||
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg?style=flat-square)](../../CODE_OF_CONDUCT.md) | ||
[![License](https://img.shields.io/npm/l/@vonage/server-sdk?label=License&style=flat-square)][license] | ||
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg?style=flat-square)](CODE_OF_CONDUCT.md) [![License](https://img.shields.io/npm/l/@vonage/server-sdk?label=License&style=flat-square)][license] | ||
<img src="https://developer.nexmo.com/images/logos/vbc-logo.svg" height="48px" alt="Vonage" /> | ||
This is the Node.JS Server SDK for [Vonage APIs](https://www.vonage.com/). To use it you will need a Vonage account. Sign up [for free at vonage.com][signup]. | ||
This is the Node.JS Server SDK for [Vonage APIs](https://www.vonage.com/). To | ||
use it you will need a Vonage account. Sign up [for free at vonage.com][signup]. | ||
For full API documentation refer to [developer.nexmo.com](https://developer.nexmo.com/). | ||
For full API documentation refer to | ||
[developer.vonage.com](https://developer.vonage.com/). | ||
@@ -19,2 +23,3 @@ * [Installation](#installation) | ||
* [Supported APIs](#supported-apis) | ||
* [References](#references) | ||
@@ -26,3 +31,3 @@ ## Installation | ||
```bash | ||
npm install @vonage/server-sdk@next | ||
npm install @vonage/server-sdk | ||
``` | ||
@@ -33,3 +38,3 @@ | ||
```bash | ||
yarn add @vonage/server-sdk@next | ||
yarn add @vonage/server-sdk | ||
``` | ||
@@ -42,56 +47,19 @@ | ||
const vonage = new Vonage({ | ||
apiKey: API_KEY, | ||
apiSecret: API_SECRET, | ||
applicationId: APP_ID, | ||
privateKey: PRIVATE_KEY_PATH, | ||
signatureSecret: SIGNATURE_SECRET, | ||
signatureMethod: SIGNATURE_METHOD | ||
}, options); | ||
const vonage = new Vonage(credentials, options); | ||
``` | ||
* `apiKey` - API Key from Vonage API. If `applicationId` and `privateKey` are present, `apiKey` is optional. | ||
* `apiSecret` - API SECRET from Vonage API. If `applicationId` and `privateKey` are present, `apiSecret` is optional. | ||
* `applicationId` - (optional) The Vonage API Application ID to be used when creating JWTs. | ||
* `privateKey` - (optional) The Private Key to be used when creating JWTs. You can specify the key as any of the following: | ||
* A [Buffer](https://nodejs.org/api/buffer.html#buffer_class_method_buffer_from_string_encoding) containing the file contents. | ||
* A String containing the path to the key file on disk. | ||
* A String containing the key itself. | ||
* `signatureSecret` - (optional) API signature secret from Vonage API, used for signing SMS message requests | ||
* `signatureMethod` - (optional) signature method matching the one you gave Vonage API, used for signing SMS message requests. Must be one of "md5hash", "md5", "sha1", "sha256", or "sha512" | ||
* `options` - (optional) Additional options for the constructor. | ||
Where `credentials` is any option from [`@vonage/auth`](https://github.com/Vonage/vonage-node-sdk/tree/3.x/readme/packages/auth#options), | ||
and `options` is any option from [`@vonage/server-client`](https://github.com/Vonage/vonage-node-sdk/tree/3.x/readme/packages/server-client#options) | ||
Options are: | ||
```js | ||
{ | ||
// If true, log information to the console | ||
debug: true|false, | ||
// append info the the User-Agent sent to Nexmo | ||
// e.g. pass 'my-app' for /nexmo-node/1.0.0/4.2.7/my-app | ||
appendToUserAgent: string, | ||
// Set a custom logger | ||
logger: { | ||
log: function() {level, args...} | ||
info: function() {args...}, | ||
warn: function() {args...} | ||
}, | ||
// Set a custom timeout for requests to Vonage in milliseconds. Defaults to the standard for Node http requests, which is 120,000 ms. | ||
timeout: integer, | ||
// Set a custom host for requests instead of api.nexmo.com | ||
apiHost: string, | ||
// Set a custom host for requests instead of rest.nexmo.com | ||
restHost: string, | ||
// Set a custom host for requests instead of video.api.vonage.com | ||
videoHost: string, | ||
} | ||
``` | ||
## Promises | ||
Most methods that interact with the Vonage API uses Promises. You can either resolve these yourself, or use `await` to | ||
wait for a response. | ||
Most methods that interact with the Vonage API uses Promises. You can either | ||
resolve these yourself, or use `await` to wait for a response. | ||
```js | ||
const resp = await vonage.sms.send({to: '15552220000', from: '15559992222', 'This is a test'}); | ||
const resp = await vonage.sms.send({ | ||
to: '15552220000', | ||
from: '15559992222', | ||
'This is a test', | ||
}); | ||
``` | ||
@@ -121,4 +89,4 @@ | ||
| API | API Release Status | Supported? | ||
|----------|:---------:|:-------------:| | ||
| API | API Release Status | Supported?| | ||
|----------|---------|-------------| | ||
| Account API | General Availability |✅| | ||
@@ -142,3 +110,22 @@ | Alerts API | General Availability |✅| | ||
## References | ||
You can find more information for each product below: | ||
* [Accounts](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/accounts/README.md) | ||
* [Applications](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/applications/README.md) | ||
* [Auth](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/auth/README.md) | ||
* [JWT](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/jwt/README.md) | ||
* [Messages](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/messages/README.md) | ||
* [Number Insights](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/number-insights/README.md) | ||
* [Numbers](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/numbers/README.md) | ||
* [Pricing](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/pricing/README.md) | ||
* [Server Client](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/server-client/README.md) | ||
* [SMS](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/sms/README.md) | ||
* [Verify](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/verify/README.md) | ||
* [Vetch](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/vetch/README.md) | ||
* [Video](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/video/README.md) | ||
* [Voice](https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/voice/README.md) | ||
[signup]: https://dashboard.nexmo.com/sign-up?utm_source=DEV_REL&utm_medium=github&utm_campaign=node-server-sdk | ||
[license]: LICENSE.txt |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10378
8
11
63
126
+ Added@vonage/auth@^1.0.4
+ Added@vonage/vetch@^1.0.5
- Removed@vonage/server-client@^1.0.6
Updated@vonage/accounts@^1.0.7
Updated@vonage/applications@^1.0.7
Updated@vonage/messages@^1.0.8
Updated@vonage/numbers@^1.0.10
Updated@vonage/pricing@^1.0.7
Updated@vonage/sms@^1.0.8
Updated@vonage/verify@^1.0.9
Updated@vonage/voice@^1.0.8