@vonage/applications
Advanced tools
Comparing version 1.0.6 to 1.0.7
@@ -1,49 +0,27 @@ | ||
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Applications = void 0; | ||
const server_client_1 = require("@vonage/server-client"); | ||
class Applications extends server_client_1.Client { | ||
import { AuthenticationType, Client } from '@vonage/server-client'; | ||
export class Applications extends Client { | ||
constructor() { | ||
super(...arguments); | ||
this.authType = server_client_1.AuthenticationType.BASIC; | ||
this.authType = AuthenticationType.BASIC; | ||
} | ||
createApplication(application) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const resp = yield this.sendPostRequest(`${this.config.apiHost}/v2/applications`, application); | ||
return resp.data; | ||
}); | ||
async createApplication(application) { | ||
const resp = await this.sendPostRequest(`${this.config.apiHost}/v2/applications`, application); | ||
return resp.data; | ||
} | ||
deleteApplication(applicationId) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield this.sendDeleteRequest(`${this.config.apiHost}/v2/applications/${applicationId}`); | ||
}); | ||
async deleteApplication(applicationId) { | ||
await this.sendDeleteRequest(`${this.config.apiHost}/v2/applications/${applicationId}`); | ||
} | ||
getApplication(applicationId) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const resp = yield this.sendGetRequest(`${this.config.apiHost}/v2/applications/${applicationId}`); | ||
return resp.data; | ||
}); | ||
async getApplication(applicationId) { | ||
const resp = await this.sendGetRequest(`${this.config.apiHost}/v2/applications/${applicationId}`); | ||
return resp.data; | ||
} | ||
listApplications(filter) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const resp = yield this.sendGetRequest(`${this.config.apiHost}/v2/applications`, filter); | ||
return resp.data; | ||
}); | ||
async listApplications(filter) { | ||
const resp = await this.sendGetRequest(`${this.config.apiHost}/v2/applications`, filter); | ||
return resp.data; | ||
} | ||
updateApplication(application) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const resp = yield this.sendPutRequest(`${this.config.apiHost}/v2/applications/${application.id}`, application); | ||
return resp.data; | ||
}); | ||
async updateApplication(application) { | ||
const resp = await this.sendPutRequest(`${this.config.apiHost}/v2/applications/${application.id}`, application); | ||
return resp.data; | ||
} | ||
} | ||
exports.Applications = Applications; | ||
//# sourceMappingURL=applications.js.map |
@@ -1,5 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Applications = void 0; | ||
var applications_1 = require("./applications"); | ||
Object.defineProperty(exports, "Applications", { enumerable: true, get: function () { return applications_1.Applications; } }); | ||
export { Applications } from './applications'; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
export {}; | ||
//# sourceMappingURL=Application.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
export {}; | ||
//# sourceMappingURL=ApplicationResponse.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
export {}; | ||
//# sourceMappingURL=MessagesCapabilities.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
export {}; | ||
//# sourceMappingURL=ListApplicationResponse.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
export {}; | ||
//# sourceMappingURL=RTCCapabilities.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
export {}; | ||
//# sourceMappingURL=VoiceCapabilities.js.map |
import { AuthOpts } from '@vonage/auth'; | ||
import { AuthInterface } from '@vonage/auth'; | ||
import { VetchOptions } from '@vonage/vetch'; | ||
export declare type ApplicationClassParameters = AuthOpts & VetchOptions & { | ||
export type ApplicationClassParameters = AuthOpts & VetchOptions & { | ||
auth?: AuthInterface; | ||
}; |
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
export {}; | ||
//# sourceMappingURL=ApplicationClassParameters.js.map |
{ | ||
"name": "@vonage/applications", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "Vonage Applications API", | ||
@@ -29,28 +29,17 @@ "keywords": [ | ||
"build": "npm run clean && npm run compile", | ||
"clean": "tsc -b --clean", | ||
"compile": "tsc -p tsconfig.json", | ||
"format": "prettier --write \"lib/**/*.ts\" \"__tests__/**/*.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/server-client": "^1.0.6" | ||
"@vonage/auth": "^1.0.4", | ||
"@vonage/server-client": "^1.0.7", | ||
"@vonage/vetch": "^1.0.5" | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "^28.1.6", | ||
"jsonwebtoken": "^8.5.1", | ||
"nock": "^13.2.9", | ||
"prettier": "^2.7.1", | ||
"ts-jest": "^28.0.7", | ||
"tslint": "^6.1.3", | ||
"tslint-config-prettier": "^1.18.0", | ||
"typescript": "^4.7.4" | ||
"nock": "^13.2.9" | ||
}, | ||
"publishConfig": { | ||
"directory": "dist" | ||
} | ||
}, | ||
"gitHead": "328f18e5c8a458cb4d06d7955ec2399a6ce6f5d8" | ||
} |
# Vonage Applications SDK for Node.js | ||
![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/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/applications) | ||
[![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/applications?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.TXT] | ||
<img src="https://developer.nexmo.com/images/logos/vbc-logo.svg" height="48px" alt="Vonage" /> | ||
This is the Vonage Applications SDK for Node.js for use with [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 Vonage Applications SDK for Node.js for use with | ||
[Vonage APIs](https://www.vonage.com/). To use it you will need a Vonage | ||
account. Sign up [for free at vonage.com][signup]. | ||
We recommend using this package as part of the overall [`@vonage/server-sdk` package](https://github.com/vonage/vonage-node-sdk). | ||
We recommend using this package as part of the overall | ||
[`@vonage/server-sdk` package](https://github.com/vonage/vonage-node-sdk). | ||
@@ -16,13 +21,15 @@ For full API documentation refer to [developer.nexmo.com](https://developer.nexmo.com/). | ||
* [Installation](#installation) | ||
* [Constructor](#constructor) | ||
* [Callbacks](#callbacks) | ||
* [Usage](#using-the-vonage-applications-sdk) | ||
* [Promises](#promises) | ||
* [Testing](#testing) | ||
* [Examples](#examples) | ||
* [Supported APIs](#supported-apis) | ||
## Installation | ||
We recommend using this SDK as part of the overall [`@vonage/server-sdk` package](https://github.com/vonage/vonage-node-sdk). Please see the main package for installation. | ||
We recommend using this SDK as part of the overall [ | ||
`@vonage/server-sdk` package](https://github.com/vonage/vonage-node-sdk). Please | ||
see the main package for installation. | ||
You can also use this SDK standalone if you only need access to just the Applications API. | ||
You can also use this SDK standalone if you only need access to just the | ||
Applications API. | ||
### With NPM | ||
@@ -44,3 +51,4 @@ | ||
If you are using this SDK as part of the Vonage Server SDK, you can access it as the `applications` property off of the client that you instantiate. | ||
If you are using this SDK as part of the Vonage Server SDK, you can access it | ||
as the `applications` property off of the client that you instantiate. | ||
@@ -53,6 +61,2 @@ ```js | ||
apiSecret: API_SECRET, | ||
applicationId: APP_ID, | ||
privateKey: PRIVATE_KEY_PATH, | ||
signatureSecret: SIGNATURE_SECRET, | ||
signatureMethod: SIGNATURE_METHOD | ||
}, options); | ||
@@ -65,3 +69,7 @@ | ||
The SDK can be used standalone from the main [Vonage Server SDK for Node.js](https://github.com/vonage/vonage-node-sdk) if you only need to use the Applications API. All you need to do is `require('@vonage/applications')`, and use the returned object to create your own client. | ||
The SDK can be used standalone from the main | ||
[Vonage Server SDK for Node.js](https://github.com/vonage/vonage-node-sdk) if | ||
you only need to use the Applications API. All you need to do is | ||
`require('@vonage/applications')`, and use the returned object to create your | ||
own client. | ||
@@ -72,38 +80,18 @@ ```js | ||
const applicationsClient = new Applications(new Auth({ | ||
const credentials = new Auth({ | ||
apiKey: API_KEY, | ||
apiSecret: API_SECRET, | ||
}), options); | ||
}); | ||
const options = { timeout: 1500 }; | ||
const applicationsClient = new Applications(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. | ||
* `options` is an object that can contain: | ||
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) | ||
```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 Nexmo 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 | ||
} | ||
``` | ||
## 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. | ||
@@ -110,0 +98,0 @@ ```js |
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
1
29
11693
3
138
111
+ Added@vonage/auth@^1.0.4
+ Added@vonage/vetch@^1.0.5
Updated@vonage/server-client@^1.0.7