@vonage/pricing
Advanced tools
Comparing version 1.0.6 to 1.0.7
@@ -1,5 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ServiceType = void 0; | ||
var ServiceType; | ||
export var ServiceType; | ||
(function (ServiceType) { | ||
@@ -9,2 +6,3 @@ ServiceType["SMS"] = "sms"; | ||
ServiceType["VOICE"] = "voice,"; | ||
})(ServiceType = exports.ServiceType || (exports.ServiceType = {})); | ||
})(ServiceType || (ServiceType = {})); | ||
//# sourceMappingURL=ServiceType.js.map |
@@ -1,5 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Pricing = void 0; | ||
var pricing_1 = require("./pricing"); | ||
Object.defineProperty(exports, "Pricing", { enumerable: true, get: function () { return pricing_1.Pricing; } }); | ||
export { Pricing } from './pricing'; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
export {}; | ||
//# sourceMappingURL=Network.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
export {}; | ||
//# sourceMappingURL=PricingResponse.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
export {}; | ||
//# sourceMappingURL=OutboundAllCountriesPricingResponse.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
export {}; | ||
//# sourceMappingURL=OutboundCountryPricingResponse.js.map |
@@ -1,38 +0,20 @@ | ||
"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.Pricing = void 0; | ||
const server_client_1 = require("@vonage/server-client"); | ||
class Pricing extends server_client_1.Client { | ||
import { AuthenticationType, Client } from '@vonage/server-client'; | ||
export class Pricing extends Client { | ||
constructor() { | ||
super(...arguments); | ||
this.authType = server_client_1.AuthenticationType.QUERY_KEY_SECRET; | ||
this.authType = AuthenticationType.QUERY_KEY_SECRET; | ||
} | ||
listCountryPricing(type, country) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const resp = yield this.sendGetRequest(`${this.config.restHost}/account/get-pricing/outbound/${type}`, { country }); | ||
return resp.data; | ||
}); | ||
async listCountryPricing(type, country) { | ||
const resp = await this.sendGetRequest(`${this.config.restHost}/account/get-pricing/outbound/${type}`, { country }); | ||
return resp.data; | ||
} | ||
listAllCountriesPricing(type) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const resp = yield this.sendGetRequest(`${this.config.restHost}/account/get-full-pricing/outbound/${type}`); | ||
return resp.data; | ||
}); | ||
async listAllCountriesPricing(type) { | ||
const resp = await this.sendGetRequest(`${this.config.restHost}/account/get-full-pricing/outbound/${type}`); | ||
return resp.data; | ||
} | ||
listPrefixPricing(type, prefix) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const resp = yield this.sendGetRequest(`${this.config.restHost}/account/get-prefix-pricing/outbound/${type}`, { prefix }); | ||
return resp.data; | ||
}); | ||
async listPrefixPricing(type, prefix) { | ||
const resp = await this.sendGetRequest(`${this.config.restHost}/account/get-prefix-pricing/outbound/${type}`, { prefix }); | ||
return resp.data; | ||
} | ||
} | ||
exports.Pricing = Pricing; | ||
//# sourceMappingURL=pricing.js.map |
import { AuthInterface, AuthOpts } from '@vonage/auth'; | ||
import { VetchOptions } from '@vonage/vetch'; | ||
export declare type PricingClassParameters = AuthOpts & VetchOptions & { | ||
export type PricingClassParameters = AuthOpts & VetchOptions & { | ||
auth?: AuthInterface; | ||
}; |
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
export {}; | ||
//# sourceMappingURL=PricingClassParameters.js.map |
{ | ||
"name": "@vonage/pricing", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "Vonage API for pricing", | ||
@@ -26,18 +26,17 @@ "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\" \"__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": { | ||
"nock": "^13.2.9" | ||
}, | ||
"publishConfig": { | ||
"directory": "dist" | ||
} | ||
}, | ||
"gitHead": "328f18e5c8a458cb4d06d7955ec2399a6ce6f5d8" | ||
} |
113
README.md
@@ -1,11 +0,114 @@ | ||
# `@vonage/pricing` | ||
# Vonage Pricing SDK for Node.js | ||
> TODO: description | ||
![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/pricing) | ||
[![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/pricing?label=License&style=flat-square)][license] | ||
## Usage | ||
<img src="https://developer.nexmo.com/images/logos/vbc-logo.svg" height="48px" alt="Vonage" /> | ||
This is the Vonage Pricing 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). | ||
For full API documentation refer to [developer.nexmo.com](https://developer.nexmo.com/). | ||
* [Installation](#installation) | ||
* [Usage](#using-the-vonage-pricing-sdk) | ||
* [Promises](#promises) | ||
* [Testing](#testing) | ||
## 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 | ||
Pricing API. | ||
### With NPM | ||
```bash | ||
npm install @vonage/pricing | ||
``` | ||
const pricing = require('@vonage/pricing'); | ||
// TODO: DEMONSTRATE API | ||
### With Yarn | ||
```bash | ||
yarn add @vonage/pricing | ||
``` | ||
## Using the Vonage Pricing SDK | ||
### As part of the Vonage Server SDK | ||
If you are using this SDK as part of the Vonage Server SDK, you can access it | ||
as the `pricing` property off of the client that you instantiate. | ||
```js | ||
const { Vonage, Auth } = require('@vonage/server-sdk'); | ||
const credentials = new Auth({ | ||
apiKey: API_KEY, | ||
apiSecret: API_SECRET | ||
}); | ||
const options = {}; | ||
const vonage = new Vonage(credentials, options); | ||
vonage.pricing.listCountryPricing('sms') | ||
.then(resp => console.log(resp)) | ||
.catch(err => console.error(err)); | ||
``` | ||
### Standalone | ||
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 Pricing API. All you need to do is | ||
`require('@vonage/pricing')`, and use the returned object to create your own | ||
client. | ||
```js | ||
const { Auth } = require('@vonage/auth'); | ||
const { Pricing } = require('@vonage/pricing'); | ||
const credentials = new Auth({ | ||
apiKey: API_KEY, | ||
apiSecret: API_SECRET | ||
}); | ||
const options = {}; | ||
const pricingClient = new Pricing(credentials, options); | ||
``` | ||
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) | ||
## 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. | ||
```js | ||
const resp = await vonage.pricing.basicLookup(PHONE_NUMBER) | ||
vonage.pricing.getAvailablePricing() | ||
.then(resp => console.log(resp)) | ||
.catch(err => console.error(err)); | ||
``` | ||
## Testing | ||
Run: | ||
```bash | ||
npm run test | ||
``` | ||
[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
10038
26
115
3
1
79
+ Added@vonage/auth@^1.0.4
+ Added@vonage/vetch@^1.0.5
Updated@vonage/server-client@^1.0.7