Skip to content

Commit e6ebda2

Browse files
authored
Merge acc0b4f into 116436f
2 parents 116436f + acc0b4f commit e6ebda2

File tree

2 files changed

+37
-5
lines changed

2 files changed

+37
-5
lines changed

packages/speech/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"@google-cloud/common": "^0.7.0",
5858
"events-intercept": "^2.0.0",
5959
"extend": "^3.0.0",
60-
"google-gax": "^0.8.1",
60+
"google-gax": "^0.9.1",
6161
"google-proto-files": "^0.8.0",
6262
"is": "^3.1.0",
6363
"modelo": "^4.2.0",

packages/speech/src/v1beta1/speech_api.js

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ var DEFAULT_SERVICE_PORT = 443;
3737

3838
var CODE_GEN_NAME_VERSION = 'gapic/0.1.0';
3939

40+
var STREAM_DESCRIPTORS = {
41+
streamingRecognize: new gax.StreamDescriptor(gax.StreamType.BIDI_STREAMING)
42+
};
4043

4144
/**
4245
* The scopes needed to make gRPC calls to all of the methods defined in
@@ -80,8 +83,6 @@ function SpeechApi(gaxGrpc, grpcClients, opts) {
8083
'google.cloud.speech.v1beta1.Speech',
8184
configData,
8285
clientConfig,
83-
null,
84-
null,
8586
{'x-goog-api-client': googleApiClient});
8687

8788
var speechStub = gaxGrpc.createStub(
@@ -91,14 +92,16 @@ function SpeechApi(gaxGrpc, grpcClients, opts) {
9192
{sslCreds: sslCreds});
9293
var speechStubMethods = [
9394
'syncRecognize',
94-
'asyncRecognize'
95+
'asyncRecognize',
96+
'streamingRecognize'
9597
];
9698
speechStubMethods.forEach(function(methodName) {
9799
this['_' + methodName] = gax.createApiCall(
98100
speechStub.then(function(speechStub) {
99101
return speechStub[methodName].bind(speechStub);
100102
}),
101-
defaults[methodName]);
103+
defaults[methodName],
104+
STREAM_DESCRIPTORS[methodName]);
102105
}.bind(this));
103106
}
104107

@@ -208,6 +211,35 @@ SpeechApi.prototype.asyncRecognize = function(request, options, callback) {
208211
return this._asyncRecognize(request, options, callback);
209212
};
210213

214+
/**
215+
* Perform bidirectional streaming speech-recognition: receive results while
216+
* sending audio. This method is only available via the gRPC API (not REST).
217+
*
218+
* @param {Object=} options
219+
* Optional parameters. You can override the default settings for this call, e.g, timeout,
220+
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
221+
* @returns {Stream}
222+
* An object stream which is both readable and writable. It accepts objects
223+
* representing [StreamingRecognizeRequest]{@link StreamingRecognizeRequest} for write() method, and
224+
* will emit objects representing [StreamingRecognizeResponse]{@link StreamingRecognizeResponse} on 'data' event asynchronously.
225+
*
226+
* @example
227+
*
228+
* var api = speechV1beta1.speechApi();
229+
* var stream = api.streamingRecognize().on('data', function(response) {
230+
* // doThingsWith(response);
231+
* });
232+
* var request = {};
233+
* // Write request objects.
234+
* stream.write(request);
235+
*/
236+
SpeechApi.prototype.streamingRecognize = function(options) {
237+
if (options === undefined) {
238+
options = {};
239+
}
240+
return this._streamingRecognize(options);
241+
};
242+
211243
function SpeechApiBuilder(gaxGrpc) {
212244
if (!(this instanceof SpeechApiBuilder)) {
213245
return new SpeechApiBuilder(gaxGrpc);

0 commit comments

Comments
 (0)