watson-developer-cloud
Advanced tools
Comparing version 2.1.2 to 2.1.3
@@ -224,3 +224,3 @@ /** | ||
/** | ||
* Detects emotions (anger, digust, fear, joy, and sadness) | ||
* Detects emotions (anger, disgust, fear, joy, and sadness) | ||
* for text, HTML, or a URL. | ||
@@ -227,0 +227,0 @@ * @method |
@@ -0,1 +1,15 @@ | ||
# v2.1.3 | ||
* Deprecation warning for Dialog | ||
* Added TTS .voice() and .pronunciation() methods | ||
* Added support for `customization_id` to existing TTS methods | ||
* Typo and JSDoc fixes | ||
* Fixed bug with pulling api key from env properties for alchemy services | ||
# v2.1.2 | ||
* Added profanity_filter support to STT RecognizeStream | ||
# v2.1.1 | ||
* Corrected some examples to use - instead of _ | ||
* Renamed NLC folder to use - instead of _ | ||
# v2.1.0 | ||
@@ -2,0 +16,0 @@ * Updated AlchemyLanguageV1.emotion() to support new targeted_emotion parameter & endpoint |
@@ -34,2 +34,7 @@ /** | ||
BaseService.call(this, options); | ||
if (!options.silent) { | ||
//eslint-disable-next-line no-console | ||
console.warn('WARNING: The Dialog service was deprecated, existing instances of the service will continue to function until August 9, 2017. See https://www.ibm.com/watson/developercloud/doc/conversation/migration.shtml. Set {silent: true} to disable this message.'); | ||
} | ||
} | ||
@@ -36,0 +41,0 @@ util.inherits(DialogV1, BaseService); |
@@ -40,3 +40,3 @@ 'use strict'; | ||
/** | ||
* Pulls api_key from ALCHEMY_API_KEY env property | ||
* Pulls api_key from SERVICE_NAME_API_KEY env property | ||
* | ||
@@ -47,3 +47,3 @@ * @returns {{api_key: String|undefined}} | ||
return { | ||
api_key: process.env.ALCHEMY_API_KEY | ||
api_key: process.env[this.name.toUpperCase() + '_API_KEY'] | ||
} | ||
@@ -50,0 +50,0 @@ }; |
{ | ||
"name": "watson-developer-cloud", | ||
"version": "2.1.2", | ||
"version": "2.1.3", | ||
"description": "Client library to use the IBM Watson Services and AlchemyAPI", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index", |
@@ -50,40 +50,43 @@ Watson Developer Cloud Node.js SDK | ||
* **Breaking**: user-supplied credentials are now preferred over Bluemix-supplied credentials. | ||
The order of preference is now: | ||
### BREAKING: user-supplied credentials are now preferred over Bluemix-supplied credentials. | ||
1) User-supplied credentials passed to the service constructor | ||
The order of preference is now: | ||
2) `SERVICE_NAME_USERNAME` and `SERVICE_NAME_PASSWORD` environment properties (or `SERVICE_NAME_API_KEY` when appropriate) | ||
1. User-supplied credentials passed to the service constructor | ||
3) Bluemix-supplied credentials (via the `VCAP_SERVICES` JSON-encoded environment property) | ||
2. `SERVICE_NAME_USERNAME` and `SERVICE_NAME_PASSWORD` environment properties (or `SERVICE_NAME_API_KEY` when appropriate) | ||
* Client-side support via [Browserify](http://browserify.org/) | ||
3. Bluemix-supplied credentials (via the `VCAP_SERVICES` JSON-encoded environment property) | ||
`examples/browserify/` shows an example app that generates tokens server-side and uses the SDK client-side via browserify. | ||
This change also removes the `use_vcap_services` flag. | ||
Note: Not all services currently support CORS, and therefore not all services can be used client-side. | ||
Of those that do, most require an auth token to be generated server-side via the [Authorization Service](#authorization) | ||
### Client-side support via [Browserify](http://browserify.org/) | ||
* New recommended method for instantiating services: | ||
```js | ||
var ToneAnalyzerV3 = require('watson-developer-cloud/tone-analyzer/v3'); | ||
`examples/browserify/` shows an example app that generates tokens server-side and uses the SDK client-side via browserify. | ||
var toneAnalyzer = new ToneAnalyzerV3({/*...*/}); | ||
``` | ||
Note: not all services currently support CORS, and therefore not all services can be used client-side. | ||
Of those that do, most require an auth token to be generated server-side via the [Authorization Service](#authorization). | ||
This was primarily done to enable smaller bundles for client-side usage, but also gives a small performance boost for server-side usage by only loading the portion of the library that is actually needed. | ||
### New recommended method for instantiating services: | ||
The following methods will also work, but cause the entire library to be loaded: | ||
```js | ||
var ToneAnalyzerV3 = require('watson-developer-cloud/tone-analyzer/v3'); | ||
```js | ||
// Alternate methods of using the library. | ||
// Not recommended, especially for client-side JS. | ||
var watson = require('watson-developer-cloud'); | ||
var toneAnalyzer = new ToneAnalyzerV3({/*...*/}); | ||
``` | ||
var toneAnalyzer = new watson.ToneAnalyzerV3({/*...*/}); | ||
This was primarily done to enable smaller bundles for client-side usage, but also gives a small performance boost for server-side usage by only loading the portion of the library that is actually needed. | ||
var tone_analyzer = watson.tone_analyzer({version: 'v3', /*...*/}); | ||
``` | ||
The following methods will also work, but cause the entire library to be loaded: | ||
```js | ||
// Alternate methods of using the library. | ||
// Not recommended, especially for client-side JS. | ||
var watson = require('watson-developer-cloud'); | ||
var toneAnalyzer = new watson.ToneAnalyzerV3({/*...*/}); | ||
var tone_analyzer = watson.tone_analyzer({version: 'v3', /*...*/}); | ||
``` | ||
## Installation | ||
@@ -221,3 +224,3 @@ | ||
Tokens are valid for 1 hour and may be sent using the `X-Watson-Authorization-Token` header or the `watson-token` query param. | ||
Tokens are valid for 1 hour and may be sent using the `X-Watson-Authorization-Token` header or the `watson-token` query param. | ||
@@ -277,21 +280,4 @@ Note that the token is supplied URL-encoded, and will not be accepted if it is double-encoded in a querystring. | ||
### Dialog | ||
Use the Dialog service to list all the dialogs you have. | ||
The Dialog service was deprecated on August 15, 2016, existing instances of the service will continue to function until August 9, 2017. Users of the Dialog service should migrate their applications to use the Conversation service. See the [migration documentation][dialog_migration] to learn how to migrate your dialogs to the Conversation service. | ||
```javascript | ||
var DialogV1 = require('watson-developer-cloud/dialog/v1'); | ||
var dialog = new DialogV1({ | ||
username: '<username>', | ||
password: '<password>', | ||
version_date: '2015-12-01' | ||
}); | ||
dialog.getDialogs({}, function (err, dialogs) { | ||
if (err) | ||
console.log('error:', err); | ||
else | ||
console.log(JSON.stringify(dialogs, null, 2)); | ||
}); | ||
``` | ||
### Document Conversion | ||
@@ -674,2 +660,3 @@ | ||
[request_github]: https://github.com/request/request | ||
[dialog_migration]: https://www.ibm.com/watson/developercloud/doc/conversation/migration.shtml | ||
@@ -676,0 +663,0 @@ [examples]: https://github.com/watson-developer-cloud/node-sdk/tree/master/examples |
@@ -41,7 +41,8 @@ /** | ||
* | ||
* @param {Object} options | ||
* @param {String} options.text | ||
* @param {String} [options.voice] | ||
* @param {String} [options.accept] | ||
* @param {Boolean} [options.X-Watson-Learning-Opt-Out] | ||
* @param {Object} params | ||
* @param {String} params.text | ||
* @param {String} [params.voice=en-US_MichaelVoice] - Call .voices() for a complete list | ||
* @param {String} [params.accept=audio/ogg;codecs=opus] - Supported formats are audio/ogg;codecs=opus, audio/wav, audio/flac, audio/l16, audio/basic | ||
* @param {Boolean} [params.X-Watson-Learning-Opt-Out] | ||
* @param {String} [params.customization_id] | ||
* @param {Function} callback | ||
@@ -61,3 +62,3 @@ */ | ||
body: JSON.stringify(pick(params, ['text'])), | ||
qs: pick(params, ['accept', 'voice']), | ||
qs: pick(params, ['accept', 'voice', 'customization_id']), | ||
headers: extend({ | ||
@@ -73,4 +74,10 @@ 'content-type': 'application/json' | ||
// todo: add websocket support | ||
// http://www.ibm.com/watson/developercloud/text-to-speech/api/v1/?curl#www_synthesize12 | ||
/** | ||
* Retrieves the voices available for speech synthesis | ||
* @param {Object} params | ||
* @param {Function} callback | ||
*/ | ||
@@ -90,2 +97,48 @@ TextToSpeechV1.prototype.voices = function(params, callback) { | ||
/** | ||
* Retrieves information about the specified voice | ||
* | ||
* @param {Object} params | ||
* @param {String} params.voice | ||
* @param {String} [params.customization_id] | ||
*/ | ||
TextToSpeechV1.prototype.voice = function(params, callback) { | ||
var parameters = { | ||
requiredParams: ['voice'], | ||
options: { | ||
method: 'GET', | ||
url: '/v1/voices/{voice}', | ||
path: pick(params, ['voice']), | ||
qs: pick(params, ['customization_id']), | ||
json: true | ||
}, | ||
defaultOptions: this._options | ||
}; | ||
return requestFactory(parameters, callback); | ||
}; | ||
/** | ||
* Returns the phonetic pronunciation for the specified word. | ||
* | ||
* @param {Object} params | ||
* @param {String} params.text - a single word | ||
* @param {String} [params.format=ipa] - Supported formats are ipa, spr for US English, or spr for other languages | ||
* @param {String} [params.voice] - Defaults to en-US_MichaelVoice unless a customization_id is specified. Do not specify both a voice and a customization_id | ||
* @param {String} [params.customization_id] - do not specify both a voice and a customization_id | ||
*/ | ||
TextToSpeechV1.prototype.pronunciation = function(params, callback) { | ||
var parameters = { | ||
requiredParams: ['text'], | ||
options: { | ||
method: 'GET', | ||
url: '/v1/pronunciation', | ||
qs: pick(params, ['text', 'voice', 'format', 'customization_id']), | ||
json: true | ||
}, | ||
defaultOptions: this._options | ||
}; | ||
return requestFactory(parameters, callback); | ||
}; | ||
/** | ||
* new customization features | ||
@@ -116,2 +169,3 @@ | ||
Create Custom Voice Model | ||
@@ -118,0 +172,0 @@ |
@@ -116,13 +116,2 @@ /** | ||
/** | ||
* Pulls api_key from VISUAL_RECOGNITION_API_KEY env property | ||
* | ||
* @returns {{api_key: String|undefined}} | ||
*/ | ||
VisualRecognitionV3.prototype.getCredentialsFromEnvironment = function() { | ||
return { | ||
api_key: process.env.VISUAL_RECOGNITION_API_KEY | ||
} | ||
}; | ||
/** | ||
* Accepts either a url, a single image file, or a zip file with multiple | ||
@@ -163,3 +152,3 @@ * images (.jpeg, .png, .gif) and scores every available classifier | ||
* @param {Object} params | ||
* @param {ReadStream} [params.images_file] The image file (.jpg, .png, .gif) or compressed (.zip) file of images to classify. The total number of images is limited to 100. Either images_file or url must be specified. | ||
* @param {ReadStream} [params.images_file] The image file (.jpg, .png, .gif) or compressed (.zip) file of images to classify. The total number of images is limited to 20. Either images_file or url must be specified. | ||
* @param {String} [params.url] The URL of an image (.jpg, .png, .gif). Redirects are followed, so you can use shortened URLs. The resolved URL is returned in the response. Either images_file or url must be specified. | ||
@@ -262,3 +251,3 @@ * @param {Array} [params.classifier_ids=['default']] An array of classifier IDs to classify the images against. | ||
* @param {Object} params | ||
* @param {ReadStream} [params.images_file] The image file (.jpg, .png, .gif) or compressed (.zip) file of images to classify. The total number of images is limited to 100. Either images_file or url must be specified. | ||
* @param {ReadStream} [params.images_file] The image file (.jpg, .png, .gif) or compressed (.zip) file of images to classify. The total number of images is limited to 15. Either images_file or url must be specified. | ||
* @param {String} [params.url] The URL of an image (.jpg, .png, .gif). Redirects are followed, so you can use shortened URLs. The resolved URL is returned in the response. Either images_file or url must be specified. | ||
@@ -353,3 +342,3 @@ * @param {Function} callback | ||
* @param {Object} params | ||
* @param {ReadStream} [params.images_file] The image file (.jpg, .png, .gif) or compressed (.zip) file of images to classify. The total number of images is limited to 100. Either images_file or url must be specified. | ||
* @param {ReadStream} [params.images_file] The image file (.jpg, .png, .gif) or compressed (.zip) file of images to classify. The total number of images is limited to 10. Either images_file or url must be specified. | ||
* @param {String} [params.url] The URL of an image (.jpg, .png, .gif). Redirects are followed, so you can use shortened URLs. The resolved URL is returned in the response. Either images_file or url must be specified. | ||
@@ -356,0 +345,0 @@ * @param {Function} callback |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
232944
4831
5
664