Skip to content

Commit 54395ff

Browse files
committed
fix typo that would throw errors
1 parent b855436 commit 54395ff

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

speech-to-text/get-models.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
* @return {Promise.<T>}
4343
*/
4444
module.exports = function getModels(options) {
45-
if (!options || !options.token || !options.access_token) {
45+
if (!options || (!options.token && !options.access_token)) {
4646
throw new Error('Watson SpeechToText: missing required auth parameter: options.token (CF) or options.access_token (RC)');
4747
}
4848
var reqOpts = {

speech-to-text/recognize-file.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ var fetch = require('nodeify-fetch'); // like regular fetch, but with an extra m
5050
*/
5151
module.exports = function recognizeFile(options) {
5252
// eslint-disable-line complexity
53-
if (!options || !options.token || !options.access_token) {
53+
if (!options || (!options.token && !options.access_token)) {
5454
throw new Error('WatsonSpeechToText: missing required parameter: opts.token (CF) or opts.access_token (RC)');
5555
}
5656

speech-to-text/recognize-microphone.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ var bitBucket = new Writable({
5656
* @return {RecognizeStream|SpeakerStream|FormatStream|ResultStream}
5757
*/
5858
module.exports = function recognizeMicrophone(options) {
59-
if (!options || !options.token || !options.access_token) {
59+
if (!options || (!options.token && !options.access_token)) {
6060
throw new Error('WatsonSpeechToText: missing required parameter: opts.token (CF) or opts.access_token (RC)');
6161
}
6262

text-to-speech/get-voices.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
* @return {Promise.<T>}
4444
*/
4545
module.exports = function getVoices(options) {
46-
if (!options || !options.token || !options.access_token) {
46+
if (!options || (!options.token && !options.access_token)) {
4747
throw new Error('Watson TextToSpeech: missing required auth parameter: options.token (CF) or options.access_token (RC)');
4848
}
4949
var reqOpts = {

text-to-speech/synthesize.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ var QUERY_PARAMS_ALLOWED = ['voice', 'X-WDC-PL-OPT-OUT', 'X-Watson-Learning-Opt-
4242
* @see module:watson-speech/text-to-speech/get-voices
4343
*/
4444
module.exports = function synthesize(options) {
45-
if (!options || !options.token) {
45+
if (!options || (!options.token && !options.access_token)) {
4646
throw new Error('Watson TextToSpeech: missing required parameter: options.token (CF) or options.access_token (RC)');
4747
}
4848
options['watson-token'] = options.token;

0 commit comments

Comments
 (0)