@@ -90,6 +90,28 @@ SpeechToTextV1.prototype.name = 'speech_to_text';
90
90
SpeechToTextV1 . prototype . version = 'v1' ;
91
91
SpeechToTextV1 . URL = 'https://stream.watsonplatform.net/speech-to-text/api' ;
92
92
93
+ SpeechToTextV1 . prototype . registerCallbackUrl = function ( params , callback ) {
94
+ const missingParams = helper . getMissingParams ( params , [ 'callback_url' ] ) ;
95
+ if ( missingParams ) {
96
+ callback ( missingParams ) ;
97
+ return ;
98
+ }
99
+
100
+ const parameters = {
101
+ requiredParams : [ 'callback_url' ] ,
102
+ options : {
103
+ method : 'POST' ,
104
+ url : '/v1/register_callback' ,
105
+ qs : pick ( params , [ 'callback_url' , 'user_secret' ] ) ,
106
+ body : { } ,
107
+ json : true
108
+ } ,
109
+ defaultOptions : this . _options
110
+ } ;
111
+
112
+ return requestFactory ( parameters , callback ) ;
113
+ } ;
114
+
93
115
/**
94
116
* Speech recognition for given audio using default model.
95
117
*
@@ -405,14 +427,9 @@ SpeechToTextV1.prototype.createRecognizeStream = function(params) {
405
427
SpeechToTextV1 . prototype [ name ] = function deprecated ( params ) {
406
428
if ( ! ( params || { } ) . silent && ! this . _options . silent ) {
407
429
// eslint-disable-next-line no-console
408
- console . log (
409
- new Error (
410
- 'The ' +
411
- name +
412
- '() method is deprecated and will be removed from a future version of the watson-developer-cloud SDK. ' +
413
- 'Please use createRecognizeStream() instead.\n(Set {silent: true} to hide this message.)'
414
- )
415
- ) ;
430
+ console . log ( new Error (
431
+ `The ${ name } () method is deprecated and will be removed from a future version of the watson-developer-cloud SDK. Please use createRecognizeStream() instead.\n(Set {silent: true} to hide this message.)`
432
+ ) ) ;
416
433
}
417
434
return original . apply ( this , arguments ) ;
418
435
} ;
@@ -460,37 +477,37 @@ SpeechToTextV1.prototype.createCustomization = function(params, callback) {
460
477
* List all customizations
461
478
*
462
479
* Example response:
463
- ```json
464
- { customizations:
465
- [ { owner: '8a6f5bb1-5b2d-4a20-85a9-eaa421d25c88',
466
- base_model_name: 'en-US_BroadbandModel',
467
- customization_id: '6a7785a0-9665-11e6-a73a-0da9193a4475',
468
- created: '2016-10-20T01:35:00.346Z',
469
- name: 'IEEE-test',
470
- description: '',
471
- progress: 0,
472
- language: 'en-US',
473
- status: 'pending' },
474
- { owner: '8a6f5bb1-5b2d-4a20-85a9-eaa421d25c88',
475
- base_model_name: 'en-US_BroadbandModel',
476
- customization_id: '9e2f6bb0-9665-11e6-a73a-0da9193a4475',
477
- created: '2016-10-20T01:36:27.115Z',
478
- name: 'IEEE-test',
479
- description: '',
480
- progress: 0,
481
- language: 'en-US',
482
- status: 'ready' },
483
- { owner: '8a6f5bb1-5b2d-4a20-85a9-eaa421d25c88',
484
- base_model_name: 'en-US_BroadbandModel',
485
- customization_id: '6b194e70-9666-11e6-a73a-0da9193a4475',
486
- created: '2016-10-20T01:42:10.903Z',
487
- name: 'IEEE-test',
488
- description: '',
489
- progress: 100,
490
- language: 'en-US',
491
- status: 'available' } ] }
480
+ ```json
481
+ { customizations:
482
+ [ { owner: '8a6f5bb1-5b2d-4a20-85a9-eaa421d25c88',
483
+ base_model_name: 'en-US_BroadbandModel',
484
+ customization_id: '6a7785a0-9665-11e6-a73a-0da9193a4475',
485
+ created: '2016-10-20T01:35:00.346Z',
486
+ name: 'IEEE-test',
487
+ description: '',
488
+ progress: 0,
489
+ language: 'en-US',
490
+ status: 'pending' },
491
+ { owner: '8a6f5bb1-5b2d-4a20-85a9-eaa421d25c88',
492
+ base_model_name: 'en-US_BroadbandModel',
493
+ customization_id: '9e2f6bb0-9665-11e6-a73a-0da9193a4475',
494
+ created: '2016-10-20T01:36:27.115Z',
495
+ name: 'IEEE-test',
496
+ description: '',
497
+ progress: 0,
498
+ language: 'en-US',
499
+ status: 'ready' },
500
+ { owner: '8a6f5bb1-5b2d-4a20-85a9-eaa421d25c88',
501
+ base_model_name: 'en-US_BroadbandModel',
502
+ customization_id: '6b194e70-9666-11e6-a73a-0da9193a4475',
503
+ created: '2016-10-20T01:42:10.903Z',
504
+ name: 'IEEE-test',
505
+ description: '',
506
+ progress: 100,
507
+ language: 'en-US',
508
+ status: 'available' } ] }
492
509
493
- ```
510
+ ```
494
511
*
495
512
* @param {Object } params The parameters
496
513
* @param {String } [params.language] optional filter.
@@ -518,7 +535,7 @@ SpeechToTextV1.prototype.getCustomizations = function(params, callback) {
518
535
*
519
536
* Example response:
520
537
*
521
- ```json
538
+ ```json
522
539
{ owner: '8a6f5bb1-5b2d-4a20-85a9-eaa421d25c88',
523
540
base_model_name: 'en-US_BroadbandModel',
524
541
customization_id: 'e695ad30-97c1-11e6-be92-bb627d4684b9',
@@ -528,7 +545,7 @@ SpeechToTextV1.prototype.getCustomizations = function(params, callback) {
528
545
progress: 0,
529
546
language: 'en-US',
530
547
status: 'pending' }
531
- ```
548
+ ```
532
549
*
533
550
*
534
551
* @param {Object } params The parameters
@@ -686,14 +703,14 @@ SpeechToTextV1.prototype.getCorpora = function(params, callback) {
686
703
*
687
704
* Example response:
688
705
*
689
- ```json
690
- {
691
- "name": "corpus-1",
692
- "total_words": 100,
693
- "out_of_vocabulary_words": 5,
694
- "status": "analyzed"
695
- }
696
- ```
706
+ ```json
707
+ {
708
+ "name": "corpus-1",
709
+ "total_words": 100,
710
+ "out_of_vocabulary_words": 5,
711
+ "status": "analyzed"
712
+ }
713
+ ```
697
714
*
698
715
*
699
716
* @param {Object } params The parameters
@@ -960,36 +977,36 @@ SpeechToTextV1.prototype.addWord = function(params, callback) {
960
977
* You can list all words from the custom model's words resource, only custom words that were added or modified by the user, or only OOV words that were extracted from corpora.
961
978
*
962
979
* Example response:
963
- ```json
964
- {
965
- "words": [
966
- {
967
- "word": "hhonors",
968
- "sounds_like": ["hilton honors","h honors"],
969
- "display_as": "HHonors",
970
- "source": ["corpus1"]
971
- },
972
- {
973
- "word": "ieee",
974
- "sounds_like": ["i triple e"],
975
- "display_as": "IEEE",
976
- "source": ["corpus1","corpus2"]
977
- },
978
- {
979
- "word": "tomato",
980
- "sounds_like": ["tomatoh","tomayto"],
981
- "display_as": "",
982
- "source": ["user"]
983
- },
984
- {
985
- "word": "$75.00",
986
- "sounds_like": ["75 dollars"],
987
- "display_as": "",
988
- "source": ["user"],
989
- "error":" Numbers are not allowed in sounds-like"
990
- }
991
- ]
992
- }
980
+ ```json
981
+ {
982
+ "words": [
983
+ {
984
+ "word": "hhonors",
985
+ "sounds_like": ["hilton honors","h honors"],
986
+ "display_as": "HHonors",
987
+ "source": ["corpus1"]
988
+ },
989
+ {
990
+ "word": "ieee",
991
+ "sounds_like": ["i triple e"],
992
+ "display_as": "IEEE",
993
+ "source": ["corpus1","corpus2"]
994
+ },
995
+ {
996
+ "word": "tomato",
997
+ "sounds_like": ["tomatoh","tomayto"],
998
+ "display_as": "",
999
+ "source": ["user"]
1000
+ },
1001
+ {
1002
+ "word": "$75.00",
1003
+ "sounds_like": ["75 dollars"],
1004
+ "display_as": "",
1005
+ "source": ["user"],
1006
+ "error":" Numbers are not allowed in sounds-like"
1007
+ }
1008
+ ]
1009
+ }
993
1010
```
994
1011
*
995
1012
* @param {Object } params The parameters
0 commit comments