UNPKG

1.92 kBTypeScriptView Raw
1import * as pumpify from 'pumpify';
2import * as protosTypes from '../protos/protos';
3import * as gax from 'google-gax';
4export declare class ImprovedStreamingClient {
5 /**
6 * Performs bidirectional streaming speech recognition: receive results while
7 * sending audio. This method is only available via the gRPC API (not REST).
8 *
9 * @param {object} config The configuration for the stream. This is
10 * appropriately wrapped and sent as the first argument. It should be an
11 * object conforming to the [StreamingRecognitionConfig]{@link StreamingRecognitionConfig}
12 * structure.
13 * @param {object} [options] Optional parameters. You can override the default
14 * settings for this call, e.g, timeout, retries, paginations, etc. See
15 * [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions}
16 * for the details.
17 * @returns {stream} An object stream which is both readable and writable. It
18 * accepts raw audio for the `write()` method, and will emit objects
19 * representing [StreamingRecognizeResponse]{@link StreamingRecognizeResponse}
20 * on the 'data' event asynchronously.
21 *
22 * @example
23 * const speech = require('@google-cloud/speech');
24 * const client = new speech.SpeechClient();
25 *
26 * const stream = client.streamingRecognize({
27 * config: {
28 * encoding: 'LINEAR16',
29 * languageCode: 'en-us',
30 * sampleRateHertz: 44100,
31 * },
32 * }).on('data', function(response) {
33 * // doThingsWith(response);
34 * });
35 * const request = {};
36 * // Write request objects.
37 * stream.write(request);
38 */
39 streamingRecognize(streamingConfig?: protosTypes.google.cloud.speech.v1.IStreamingRecognitionConfig | protosTypes.google.cloud.speech.v1p1beta1.IStreamingRecognitionConfig, options?: gax.CallOptions): pumpify;
40}