@vonage/pricing
Advanced tools
Comparing version 1.9.0 to 1.10.0
@@ -0,5 +1,17 @@ | ||
/** | ||
* Enum representing different service types for pricing information. | ||
*/ | ||
export declare enum ServiceType { | ||
/** | ||
* SMS service. | ||
*/ | ||
SMS = "sms", | ||
/** | ||
* SMS Transit service. | ||
*/ | ||
SMS_TRANSIT = "sms-transit", | ||
/** | ||
* Voice service. | ||
*/ | ||
VOICE = "voice" | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ServiceType = void 0; | ||
/** | ||
* Enum representing different service types for pricing information. | ||
*/ | ||
var ServiceType; | ||
(function (ServiceType) { | ||
/** | ||
* SMS service. | ||
*/ | ||
ServiceType["SMS"] = "sms"; | ||
/** | ||
* SMS Transit service. | ||
*/ | ||
ServiceType["SMS_TRANSIT"] = "sms-transit"; | ||
/** | ||
* Voice service. | ||
*/ | ||
ServiceType["VOICE"] = "voice"; | ||
})(ServiceType || (exports.ServiceType = ServiceType = {})); | ||
//# sourceMappingURL=ServiceType.js.map |
@@ -1,1 +0,3 @@ | ||
export { Pricing } from './pricing'; | ||
export * from './pricing'; | ||
export * from './types'; | ||
export * from './enums'; |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
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; } }); | ||
//# sourceMappingURL=index.js.map | ||
__exportStar(require("./pricing"), exports); | ||
__exportStar(require("./types"), exports); | ||
__exportStar(require("./enums"), exports); |
import { AuthenticationType, Client } from '@vonage/server-client'; | ||
import { ServiceType } from './enums/ServiceType'; | ||
import { OutboundAllCountriesPricingResponse } from './interfaces/Response/OutboundAllCountriesPricingResponse'; | ||
import { OutboundCountryPricingResponse } from './interfaces/Response/OutboundCountryPricingResponse'; | ||
import { ServiceType } from './enums'; | ||
import { OutboundAllCountriesPricingResponse, OutboundCountryPricingResponse } from './types'; | ||
/** | ||
* The Pricing API allows you to retrieve pricing information for all countries | ||
* and a specific service type, for a specific country and service type, or for | ||
* a specific prefix and service type. | ||
* | ||
* @example | ||
* Create a standalone Pricing client | ||
* | ||
* ```ts | ||
* import { Pricing } from '@vonage/pricing'; | ||
* | ||
* const pricingClient = new Pricing({ | ||
* apiKey: VONAGE_API_KEY, | ||
* apiSecret: VONAGE_API_SECRET | ||
* }); | ||
* ``` | ||
* | ||
* @example | ||
* Create an Pricing client from the Vonage client | ||
* | ||
* ```ts | ||
* import { Vonage } from '@vonage/server-client'; | ||
* | ||
* const vonage = new Vonage({ | ||
* apiKey: VONAGE_API_KEY, | ||
* apiSecret: VONAGE_API_SECRET | ||
* }); | ||
* | ||
* const pricingClient = vonage.pricing; | ||
* ``` | ||
*/ | ||
export declare class Pricing extends Client { | ||
protected authType: AuthenticationType; | ||
/** | ||
* Retrieves pricing information for a specific country and service type. | ||
* | ||
* @param {ServiceType} type - The service type. | ||
* @param {string} country - The country for which pricing information is requested. | ||
* @return {Promise<OutboundCountryPricingResponse>} - Pricing information for the specified country. | ||
* @example | ||
* | ||
* ```ts | ||
* import { ServiceType } from '@vonage/pricing'; | ||
* | ||
* const pricing = await pricingClient.listCountryPricing(ServiceType.SMS, 'GB'); | ||
* console.log(`The current price for Great Britian is ${pricing.defaultPrice}`); | ||
* ``` | ||
*/ | ||
listCountryPricing(type: ServiceType, country: string): Promise<OutboundCountryPricingResponse>; | ||
/** | ||
* Retrieves pricing information for all countries and a specific service type. | ||
* @param {ServiceType} type - The service type. | ||
* @return {Promise<OutboundAllCountriesPricingResponse>} - Pricing information for all countries. | ||
* @example | ||
* ```ts | ||
* import { ServiceType } from '@vonage/pricing'; | ||
* | ||
* const pricing = await pricingClient.listAllCountriesPricing(ServiceType.SMS); | ||
* for (const country in pricing.countries) { | ||
* console.log(`The current price for ${country.countryName} is ${country.defaultPrice}`); | ||
* } | ||
* ``` | ||
*/ | ||
listAllCountriesPricing(type: ServiceType): Promise<OutboundAllCountriesPricingResponse>; | ||
/** | ||
* Retrieves pricing information for a specific prefix and service type. | ||
* @param {ServiceType} type - The service type. | ||
* @param {string} prefix - The prefix for which pricing information is requested. | ||
* @return {Promise<OutboundAllCountriesPricingResponse>} - Pricing information for the specified prefix. | ||
* | ||
* @example | ||
* ```ts | ||
* import { ServiceType } from '@vonage/pricing'; | ||
* | ||
* const pricing = await pricingClient.listPrefixPricing(ServiceType.SMS, '44'); | ||
* console.log(`The current price for Great Britian is ${pricing.defaultPrice}`); | ||
* ``` | ||
*/ | ||
listPrefixPricing(type: ServiceType, prefix: string): Promise<OutboundAllCountriesPricingResponse>; | ||
} |
@@ -5,4 +5,53 @@ "use strict"; | ||
const server_client_1 = require("@vonage/server-client"); | ||
/** | ||
* The Pricing API allows you to retrieve pricing information for all countries | ||
* and a specific service type, for a specific country and service type, or for | ||
* a specific prefix and service type. | ||
* | ||
* @example | ||
* Create a standalone Pricing client | ||
* | ||
* ```ts | ||
* import { Pricing } from '@vonage/pricing'; | ||
* | ||
* const pricingClient = new Pricing({ | ||
* apiKey: VONAGE_API_KEY, | ||
* apiSecret: VONAGE_API_SECRET | ||
* }); | ||
* ``` | ||
* | ||
* @example | ||
* Create an Pricing client from the Vonage client | ||
* | ||
* ```ts | ||
* import { Vonage } from '@vonage/server-client'; | ||
* | ||
* const vonage = new Vonage({ | ||
* apiKey: VONAGE_API_KEY, | ||
* apiSecret: VONAGE_API_SECRET | ||
* }); | ||
* | ||
* const pricingClient = vonage.pricing; | ||
* ``` | ||
*/ | ||
class Pricing extends server_client_1.Client { | ||
authType = server_client_1.AuthenticationType.QUERY_KEY_SECRET; | ||
constructor() { | ||
super(...arguments); | ||
this.authType = server_client_1.AuthenticationType.QUERY_KEY_SECRET; | ||
} | ||
/** | ||
* Retrieves pricing information for a specific country and service type. | ||
* | ||
* @param {ServiceType} type - The service type. | ||
* @param {string} country - The country for which pricing information is requested. | ||
* @return {Promise<OutboundCountryPricingResponse>} - Pricing information for the specified country. | ||
* @example | ||
* | ||
* ```ts | ||
* import { ServiceType } from '@vonage/pricing'; | ||
* | ||
* const pricing = await pricingClient.listCountryPricing(ServiceType.SMS, 'GB'); | ||
* console.log(`The current price for Great Britian is ${pricing.defaultPrice}`); | ||
* ``` | ||
*/ | ||
async listCountryPricing(type, country) { | ||
@@ -12,2 +61,16 @@ const resp = await this.sendGetRequest(`${this.config.restHost}/account/get-pricing/outbound/${type}`, { country }); | ||
} | ||
/** | ||
* Retrieves pricing information for all countries and a specific service type. | ||
* @param {ServiceType} type - The service type. | ||
* @return {Promise<OutboundAllCountriesPricingResponse>} - Pricing information for all countries. | ||
* @example | ||
* ```ts | ||
* import { ServiceType } from '@vonage/pricing'; | ||
* | ||
* const pricing = await pricingClient.listAllCountriesPricing(ServiceType.SMS); | ||
* for (const country in pricing.countries) { | ||
* console.log(`The current price for ${country.countryName} is ${country.defaultPrice}`); | ||
* } | ||
* ``` | ||
*/ | ||
async listAllCountriesPricing(type) { | ||
@@ -17,2 +80,16 @@ const resp = await this.sendGetRequest(`${this.config.restHost}/account/get-full-pricing/outbound/${type}`); | ||
} | ||
/** | ||
* Retrieves pricing information for a specific prefix and service type. | ||
* @param {ServiceType} type - The service type. | ||
* @param {string} prefix - The prefix for which pricing information is requested. | ||
* @return {Promise<OutboundAllCountriesPricingResponse>} - Pricing information for the specified prefix. | ||
* | ||
* @example | ||
* ```ts | ||
* import { ServiceType } from '@vonage/pricing'; | ||
* | ||
* const pricing = await pricingClient.listPrefixPricing(ServiceType.SMS, '44'); | ||
* console.log(`The current price for Great Britian is ${pricing.defaultPrice}`); | ||
* ``` | ||
*/ | ||
async listPrefixPricing(type, prefix) { | ||
@@ -24,2 +101,1 @@ const resp = await this.sendGetRequest(`${this.config.restHost}/account/get-prefix-pricing/outbound/${type}`, { prefix }); | ||
exports.Pricing = Pricing; | ||
//# sourceMappingURL=pricing.js.map |
@@ -1,5 +0,12 @@ | ||
import { AuthInterface, AuthOpts } from '@vonage/auth'; | ||
import { AuthInterface, AuthParams } from '@vonage/auth'; | ||
import { VetchOptions } from '@vonage/vetch'; | ||
export type PricingClassParameters = AuthOpts & VetchOptions & { | ||
/** | ||
* Type representing parameters for a pricing class, including authentication and Vetch options. | ||
*/ | ||
export type PricingClassParameters = AuthParams & VetchOptions & { | ||
/** | ||
* An optional authentication interface. | ||
* @return {AuthInterface|undefined} - The authentication interface if provided, otherwise undefined. | ||
*/ | ||
auth?: AuthInterface; | ||
}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=PricingClassParameters.js.map |
{ | ||
"$schema": "https://json.schemastore.org/package.json", | ||
"name": "@vonage/pricing", | ||
"version": "1.9.0", | ||
"version": "1.10.0", | ||
"description": "Vonage API for pricing", | ||
@@ -14,3 +15,12 @@ "homepage": "https://developer.vonage.com", | ||
"license": "Apache-2.0", | ||
"author": "Chris Tankersley <chris@ctankersley.com>", | ||
"contributors": [ | ||
{ | ||
"name": "Chris Tankersley", | ||
"url": "https://github.com/dragonmantank" | ||
}, | ||
{ | ||
"name": "Chuck \"MANCHUCK\" Reeves", | ||
"url": "https://github.com/manchuck" | ||
} | ||
], | ||
"main": "dist/index.js", | ||
@@ -28,8 +38,9 @@ "types": "dist/index.d.ts", | ||
"clean": "npx shx rm -rf dist tsconfig.tsbuildinfo", | ||
"compile": "npx tsc --build --verbose" | ||
"compile": "npx tsc --build --verbose", | ||
"prepublishOnly": "npm run build" | ||
}, | ||
"dependencies": { | ||
"@vonage/auth": "^1.7.0", | ||
"@vonage/server-client": "^1.9.0", | ||
"@vonage/vetch": "^1.6.0" | ||
"@vonage/auth": "^1.8.0", | ||
"@vonage/server-client": "^1.10.0", | ||
"@vonage/vetch": "^1.7.0" | ||
}, | ||
@@ -41,4 +52,3 @@ "devDependencies": { | ||
"directory": "dist" | ||
}, | ||
"gitHead": "328f18e5c8a458cb4d06d7955ec2399a6ce6f5d8" | ||
} | ||
} |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
19229
407
24
1
Updated@vonage/auth@^1.8.0
Updated@vonage/vetch@^1.7.0