Skip to content

Commit d64c06a

Browse files
committed
fix(speech-to-text): content_type is no longer a required parameter for recognize() or createJob() (it is now optional)
1 parent 663a70f commit d64c06a

File tree

4 files changed

+10
-11
lines changed

4 files changed

+10
-11
lines changed

speech-to-text/v1-generated.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ class SpeechToTextV1 extends BaseService {
206206
*
207207
* @param {Object} params - The parameters to send to the service.
208208
* @param {NodeJS.ReadableStream|FileObject|Buffer} params.audio - The audio to transcribe.
209-
* @param {string} params.content_type - The type of the input.
209+
* @param {string} [params.content_type] - The type of the input.
210210
* @param {string} [params.model] - The identifier of the model that is to be used for the recognition request.
211211
* @param {string} [params.language_customization_id] - The customization ID (GUID) of a custom language model that is
212212
* to be used with the recognition request. The base model of the specified custom language model must match the model
@@ -292,7 +292,7 @@ class SpeechToTextV1 extends BaseService {
292292
public recognize(params: SpeechToTextV1.RecognizeParams, callback?: SpeechToTextV1.Callback<SpeechToTextV1.SpeechRecognitionResults>): NodeJS.ReadableStream | void {
293293
const _params = extend({}, params);
294294
const _callback = (callback) ? callback : () => { /* noop */ };
295-
const requiredParams = ['audio', 'content_type'];
295+
const requiredParams = ['audio'];
296296

297297
const missingParams = getMissingParams(_params, requiredParams);
298298
if (missingParams) {
@@ -509,7 +509,7 @@ class SpeechToTextV1 extends BaseService {
509509
*
510510
* @param {Object} params - The parameters to send to the service.
511511
* @param {NodeJS.ReadableStream|FileObject|Buffer} params.audio - The audio to transcribe.
512-
* @param {string} params.content_type - The type of the input.
512+
* @param {string} [params.content_type] - The type of the input.
513513
* @param {string} [params.model] - The identifier of the model that is to be used for the recognition request.
514514
* @param {string} [params.callback_url] - A URL to which callback notifications are to be sent. The URL must already
515515
* be successfully white-listed by using the **Register a callback** method. You can include the same callback URL
@@ -623,7 +623,7 @@ class SpeechToTextV1 extends BaseService {
623623
public createJob(params: SpeechToTextV1.CreateJobParams, callback?: SpeechToTextV1.Callback<SpeechToTextV1.RecognitionJob>): NodeJS.ReadableStream | void {
624624
const _params = extend({}, params);
625625
const _callback = (callback) ? callback : () => { /* noop */ };
626-
const requiredParams = ['audio', 'content_type'];
626+
const requiredParams = ['audio'];
627627

628628
const missingParams = getMissingParams(_params, requiredParams);
629629
if (missingParams) {
@@ -2748,7 +2748,7 @@ namespace SpeechToTextV1 {
27482748
/** The audio to transcribe. */
27492749
audio: NodeJS.ReadableStream|FileObject|Buffer;
27502750
/** The type of the input. */
2751-
content_type: RecognizeConstants.ContentType | string;
2751+
content_type?: RecognizeConstants.ContentType | string;
27522752
/** The identifier of the model that is to be used for the recognition request. */
27532753
model?: RecognizeConstants.Model | string;
27542754
/** The customization ID (GUID) of a custom language model that is to be used with the recognition request. The base model of the specified custom language model must match the model specified with the `model` parameter. You must make the request with service credentials created for the instance of the service that owns the custom model. By default, no custom language model is used. See [Custom models](https://console.bluemix.net/docs/services/speech-to-text/input.html#custom). **Note:** Use this parameter instead of the deprecated `customization_id` parameter. */
@@ -2842,7 +2842,7 @@ namespace SpeechToTextV1 {
28422842
/** The audio to transcribe. */
28432843
audio: NodeJS.ReadableStream|FileObject|Buffer;
28442844
/** The type of the input. */
2845-
content_type: CreateJobConstants.ContentType | string;
2845+
content_type?: CreateJobConstants.ContentType | string;
28462846
/** The identifier of the model that is to be used for the recognition request. */
28472847
model?: CreateJobConstants.Model | string;
28482848
/** A URL to which callback notifications are to be sent. The URL must already be successfully white-listed by using the **Register a callback** method. You can include the same callback URL with any number of job creation requests. Omit the parameter to poll the service for job completion and results. Use the `user_token` parameter to specify a unique user-specified string with each job to differentiate the callback notifications for the jobs. */

speech-to-text/v1.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ class SpeechToTextV1 extends GeneratedSpeechToTextV1 {
488488
*
489489
* @param {Object} params The parameters
490490
* @param {Stream} params.audio - Audio to be recognized
491-
* @param {String} params.content_type - Content-type
491+
* @param {String} [params.content_type] - Content-type
492492
* @param {String} [params.base_model_version]
493493
* @param {Number} [params.max_alternatives]
494494
* @param {Boolean} [params.timestamps]
@@ -508,7 +508,7 @@ class SpeechToTextV1 extends GeneratedSpeechToTextV1 {
508508
* @param {function} callback
509509
*/
510510
recognize(params, callback) {
511-
const missingParams = getMissingParams(params, ['audio', 'content_type']);
511+
const missingParams = getMissingParams(params, ['audio']);
512512
if (missingParams) {
513513
callback(missingParams);
514514
return;

test/unit/speech-helpers.test.js

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ describe('speech_to_text', function() {
3434
it('should check no parameters provided', function() {
3535
speech_to_text.recognize({}, missingParameter);
3636
speech_to_text.recognize(null, missingParameter);
37-
speech_to_text.recognize({ audio: 'foo' }, missingParameter);
3837
speech_to_text.recognize({ content_type: 'bar' }, missingParameter);
3938
speech_to_text.recognize({ continuous: 'false' }, missingParameter);
4039
});

test/unit/speech-to-text.v1.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ describe('recognize', () => {
261261

262262
test('should enforce required parameters', done => {
263263
// required parameters for this method
264-
const requiredParams = ['audio', 'content_type'];
264+
const requiredParams = ['audio'];
265265

266266
speech_to_text.recognize({}, err => {
267267
checkRequiredParamsHandling(requiredParams, err, missingParamsMock, createRequestMock);
@@ -511,7 +511,7 @@ describe('createJob', () => {
511511

512512
test('should enforce required parameters', done => {
513513
// required parameters for this method
514-
const requiredParams = ['audio', 'content_type'];
514+
const requiredParams = ['audio'];
515515

516516
speech_to_text.createJob({}, err => {
517517
checkRequiredParamsHandling(requiredParams, err, missingParamsMock, createRequestMock);

0 commit comments

Comments
 (0)