watson-developer-cloud
Advanced tools
Comparing version 3.7.0 to 3.7.1
@@ -37,2 +37,5 @@ "use strict"; | ||
} | ||
function hasIamCredentials(obj) { | ||
return obj && (obj.iam_apikey || obj.iam_access_token); | ||
} | ||
var BaseService = /** @class */ (function () { | ||
@@ -73,3 +76,3 @@ /** | ||
this._options = extend({ qs: {}, url: serviceClass.URL }, this.serviceDefaults, options, _options); | ||
if (_options.iam_apikey || _options.iam_access_token) { | ||
if (hasIamCredentials(_options)) { | ||
this.tokenManager = new v1_1.IamTokenManagerV1({ | ||
@@ -219,11 +222,13 @@ iamApikey: _options.iam_apikey, | ||
} | ||
if (hasBasicCredentials(_options)) { | ||
// Calculate and add Authorization header to base options | ||
var encodedCredentials = bufferFrom(_options.username + ":" + _options.password).toString('base64'); | ||
var authHeader = { Authorization: "Basic " + encodedCredentials }; | ||
_options.headers = extend(authHeader, _options.headers); | ||
if (!hasIamCredentials(_options) && _options.username !== 'apikey') { | ||
if (hasBasicCredentials(_options)) { | ||
// Calculate and add Authorization header to base options | ||
var encodedCredentials = bufferFrom(_options.username + ":" + _options.password).toString('base64'); | ||
var authHeader = { Authorization: "Basic " + encodedCredentials }; | ||
_options.headers = extend(authHeader, _options.headers); | ||
} | ||
else { | ||
_options.qs = extend({ api_key: _options.api_key }, _options.qs); | ||
} | ||
} | ||
else { | ||
_options.qs = extend({ api_key: _options.api_key }, _options.qs); | ||
} | ||
} | ||
@@ -230,0 +235,0 @@ return _options; |
@@ -60,5 +60,5 @@ /** | ||
* @param {Boolean} [options.interim_results=true] - Send back non-final previews of each "sentence" as it is being processed. These results are ignored in text mode. | ||
* @param {Boolean} [options.word_confidence=false] - include confidence scores with results. Defaults to true when in objectMode. | ||
* @param {Boolean} [options.timestamps=false] - include timestamps with results. Defaults to true when in objectMode. | ||
* @param {Number} [options.max_alternatives=1] - maximum number of alternative transcriptions to include. Defaults to 3 when in objectMode. | ||
* @param {Boolean} [options.word_confidence=false] - include confidence scores with results. | ||
* @param {Boolean} [options.timestamps=false] - include timestamps with results. | ||
* @param {Number} [options.max_alternatives=1] - maximum number of alternative transcriptions to include. | ||
* @param {Array<String>} [options.keywords] - a list of keywords to search for in the audio | ||
@@ -74,2 +74,3 @@ * @param {Number} [options.keywords_threshold] - Number between 0 and 1 representing the minimum confidence before including a keyword in the results. Required when options.keywords is set | ||
* @param {String} [options.customization_id] - Customization ID | ||
* @param {String} [options.acoustic_customization_id] - Acoustic customization ID | ||
* @param {IamTokenManagerV1} [options.token_manager] - Token manager for authenticating with IAM | ||
@@ -76,0 +77,0 @@ * @param {string} [options.base_model_version] - The version of the specified base model that is to be used with recognition request or, for the **Create a session** method, with the new session. |
@@ -52,3 +52,4 @@ "use strict"; | ||
'watson-token', | ||
'customization_id' | ||
'customization_id', | ||
'acoustic_customization_id' | ||
]; | ||
@@ -84,5 +85,5 @@ /** | ||
* @param {Boolean} [options.interim_results=true] - Send back non-final previews of each "sentence" as it is being processed. These results are ignored in text mode. | ||
* @param {Boolean} [options.word_confidence=false] - include confidence scores with results. Defaults to true when in objectMode. | ||
* @param {Boolean} [options.timestamps=false] - include timestamps with results. Defaults to true when in objectMode. | ||
* @param {Number} [options.max_alternatives=1] - maximum number of alternative transcriptions to include. Defaults to 3 when in objectMode. | ||
* @param {Boolean} [options.word_confidence=false] - include confidence scores with results. | ||
* @param {Boolean} [options.timestamps=false] - include timestamps with results. | ||
* @param {Number} [options.max_alternatives=1] - maximum number of alternative transcriptions to include. | ||
* @param {Array<String>} [options.keywords] - a list of keywords to search for in the audio | ||
@@ -98,2 +99,3 @@ * @param {Number} [options.keywords_threshold] - Number between 0 and 1 representing the minimum confidence before including a keyword in the results. Required when options.keywords is set | ||
* @param {String} [options.customization_id] - Customization ID | ||
* @param {String} [options.acoustic_customization_id] - Acoustic customization ID | ||
* @param {IamTokenManagerV1} [options.token_manager] - Token manager for authenticating with IAM | ||
@@ -100,0 +102,0 @@ * @param {string} [options.base_model_version] - The version of the specified base model that is to be used with recognition request or, for the **Create a session** method, with the new session. |
{ | ||
"name": "watson-developer-cloud", | ||
"version": "3.7.0", | ||
"version": "3.7.1", | ||
"description": "Client library to use the IBM Watson Services and AlchemyAPI", | ||
@@ -5,0 +5,0 @@ "main": "./index", |
@@ -92,2 +92,4 @@ /// <reference types="node" /> | ||
* @param {String} [params.customization_id] | ||
* @param {String} [params.acoustic_customization_id] | ||
* @param {Number} [params.customization_weight] | ||
* @param {Boolean} [params.speaker_labels] | ||
@@ -94,0 +96,0 @@ * @param {function} callback |
@@ -40,5 +40,5 @@ "use strict"; | ||
'customization_id', | ||
'acoustic_customization_id', | ||
'speaker_labels', | ||
'customization_weight', | ||
'acoustic_customization_id', | ||
'base_model_version' | ||
@@ -431,2 +431,4 @@ ]; | ||
* @param {String} [params.customization_id] | ||
* @param {String} [params.acoustic_customization_id] | ||
* @param {Number} [params.customization_weight] | ||
* @param {Boolean} [params.speaker_labels] | ||
@@ -433,0 +435,0 @@ * @param {function} callback |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
6889670
119470