Class v2.SpeechClient (6.0.1)

Enables speech transcription and resource management. v2

Package

@google-cloud/speech

Constructors

(constructor)(opts, gaxInstance)

constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);

Construct an instance of SpeechClient.

Parameters
NameDescription
opts ClientOptions
gaxInstance typeof gax | typeof fallback

: loaded instance of google-gax. Useful if you need to avoid loading the default gRPC version and want to use the fallback HTTP implementation. Load only fallback version and pass it to the constructor: ``` const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC const client = new SpeechClient({fallback: 'rest'}, gax); ```

Properties

apiEndpoint

static get apiEndpoint(): string;

The DNS address for this API service - same as servicePath(), exists for compatibility reasons.

auth

auth: gax.GoogleAuth;

descriptors

descriptors: Descriptors;

innerApiCalls

innerApiCalls: {
        [name: string]: Function;
    };

locationsClient

locationsClient: LocationsClient;

operationsClient

operationsClient: gax.OperationsClient;

pathTemplates

pathTemplates: {
        [name: string]: gax.PathTemplate;
    };

port

static get port(): number;

The port for this API service.

scopes

static get scopes(): string[];

The scopes needed to make gRPC calls for every method defined in this service.

servicePath

static get servicePath(): string;

The DNS address for this API service.

speechStub

speechStub?: Promise<{
        [name: string]: Function;
    }>;

warn

warn: (code: string, message: string, warnType?: string) => void;

Methods

_streamingRecognize(options)

_streamingRecognize(options?: CallOptions): gax.CancellableStream;

Performs bidirectional streaming speech recognition: receive results while sending audio. This method is only available via the gRPC API (not REST).

Parameter
NameDescription
options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
gax.CancellableStream

{Stream} An object stream which is both readable and writable. It accepts objects representing StreamingRecognizeRequest for write() method, and will emit objects representing on 'data' event asynchronously. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the Recognizer to use during recognition. The
   *  expected format is
   *  `projects/{project}/locations/{location}/recognizers/{recognizer}`. The
   *  {recognizer} segment may be set to `_` to use an empty implicit Recognizer.
   */
  // const recognizer = 'abc123'
  /**
   *  StreamingRecognitionConfig to be used in this recognition attempt.
   *  If provided, it will override the default RecognitionConfig stored in the
   *  Recognizer.
   */
  // const streamingConfig = {}
  /**
   *  Inline audio bytes to be Recognized.
   *  Maximum size for this field is 15 KB per request.
   */
  // const audio = Buffer.from('string')

  // Imports the Speech library
  const {SpeechClient} = require('@google-cloud/speech').v2;

  // Instantiates a client
  const speechClient = new SpeechClient();

  async function callStreamingRecognize() {
    // Construct request
    const request = {
      recognizer,
    };

    // Run request
    const stream = await speechClient.streamingRecognize();
    stream.on('data', (response) => { console.log(response) });
    stream.on('error', (err) => { throw(err) });
    stream.on('end', () => { /* API call completed */ });
    stream.write(request);
    stream.end(); 
  }

  callStreamingRecognize();

batchRecognize(request, options)

batchRecognize(request?: protos.google.cloud.speech.v2.IBatchRecognizeRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.speech.v2.IBatchRecognizeResponse, protos.google.cloud.speech.v2.IOperationMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Performs batch asynchronous speech recognition: send a request with N audio files and receive a long running operation that can be polled to see when the transcriptions are finished.

Parameters
NameDescription
request IBatchRecognizeRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.speech.v2.IBatchRecognizeResponse, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise() method returns a promise you can await for. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the Recognizer to use during recognition. The
   *  expected format is
   *  `projects/{project}/locations/{location}/recognizers/{recognizer}`. The
   *  {recognizer} segment may be set to `_` to use an empty implicit Recognizer.
   */
  // const recognizer = 'abc123'
  /**
   *  Features and audio metadata to use for the Automatic Speech Recognition.
   *  This field in combination with the
   *  config_mask google.cloud.speech.v2.BatchRecognizeRequest.config_mask 
   *  field can be used to override parts of the
   *  default_recognition_config google.cloud.speech.v2.Recognizer.default_recognition_config 
   *  of the Recognizer resource.
   */
  // const config = {}
  /**
   *  The list of fields in
   *  config google.cloud.speech.v2.BatchRecognizeRequest.config  that override
   *  the values in the
   *  default_recognition_config google.cloud.speech.v2.Recognizer.default_recognition_config 
   *  of the recognizer during this recognition request. If no mask is provided,
   *  all given fields in
   *  config google.cloud.speech.v2.BatchRecognizeRequest.config  override the
   *  values in the recognizer for this recognition request. If a mask is
   *  provided, only the fields listed in the mask override the config in the
   *  recognizer for this recognition request. If a wildcard (`*`) is provided,
   *  config google.cloud.speech.v2.BatchRecognizeRequest.config  completely
   *  overrides and replaces the config in the recognizer for this recognition
   *  request.
   */
  // const configMask = {}
  /**
   *  Audio files with file metadata for ASR.
   *  The maximum number of files allowed to be specified is 5.
   */
  // const files = [1,2,3,4]
  /**
   *  Configuration options for where to output the transcripts of each file.
   */
  // const recognitionOutputConfig = {}
  /**
   *  Processing strategy to use for this request.
   */
  // const processingStrategy = {}

  // Imports the Speech library
  const {SpeechClient} = require('@google-cloud/speech').v2;

  // Instantiates a client
  const speechClient = new SpeechClient();

  async function callBatchRecognize() {
    // Construct request
    const request = {
      recognizer,
    };

    // Run request
    const [operation] = await speechClient.batchRecognize(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callBatchRecognize();

batchRecognize(request, options, callback)

batchRecognize(request: protos.google.cloud.speech.v2.IBatchRecognizeRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.speech.v2.IBatchRecognizeResponse, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IBatchRecognizeRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.speech.v2.IBatchRecognizeResponse, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

batchRecognize(request, callback)

batchRecognize(request: protos.google.cloud.speech.v2.IBatchRecognizeRequest, callback: Callback<LROperation<protos.google.cloud.speech.v2.IBatchRecognizeResponse, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IBatchRecognizeRequest
callback Callback<LROperation<protos.google.cloud.speech.v2.IBatchRecognizeResponse, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

cancelOperation(request, options, callback)

cancelOperation(request: protos.google.longrunning.CancelOperationRequest, options?: gax.CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.CancelOperationRequest, {} | undefined | null>, callback?: Callback<protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null>): Promise<protos.google.protobuf.Empty>;

Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED. Clients can use or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an value with a of 1, corresponding to Code.CANCELLED.

Parameters
NameDescription
request CancelOperationRequest

The request object that will be sent.

options CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.CancelOperationRequest, {} | undefined | null>

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback Callback<protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null>

The function which will be called with the result of the API call. {Promise} - The promise which resolves when API call finishes. The promise has a method named "cancel" which cancels the ongoing API call.

Returns
TypeDescription
Promise<protos.google.protobuf.Empty>
Example

const client = longrunning.operationsClient();
await client.cancelOperation({name: ''});

checkBatchRecognizeProgress(name)

checkBatchRecognizeProgress(name: string): Promise<LROperation<protos.google.cloud.speech.v2.BatchRecognizeResponse, protos.google.cloud.speech.v2.OperationMetadata>>;

Check the status of the long running operation returned by batchRecognize().

Parameter
NameDescription
name string

The operation name that will be passed.

Returns
TypeDescription
Promise<LROperation<protos.google.cloud.speech.v2.BatchRecognizeResponse, protos.google.cloud.speech.v2.OperationMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the Recognizer to use during recognition. The
   *  expected format is
   *  `projects/{project}/locations/{location}/recognizers/{recognizer}`. The
   *  {recognizer} segment may be set to `_` to use an empty implicit Recognizer.
   */
  // const recognizer = 'abc123'
  /**
   *  Features and audio metadata to use for the Automatic Speech Recognition.
   *  This field in combination with the
   *  config_mask google.cloud.speech.v2.BatchRecognizeRequest.config_mask 
   *  field can be used to override parts of the
   *  default_recognition_config google.cloud.speech.v2.Recognizer.default_recognition_config 
   *  of the Recognizer resource.
   */
  // const config = {}
  /**
   *  The list of fields in
   *  config google.cloud.speech.v2.BatchRecognizeRequest.config  that override
   *  the values in the
   *  default_recognition_config google.cloud.speech.v2.Recognizer.default_recognition_config 
   *  of the recognizer during this recognition request. If no mask is provided,
   *  all given fields in
   *  config google.cloud.speech.v2.BatchRecognizeRequest.config  override the
   *  values in the recognizer for this recognition request. If a mask is
   *  provided, only the fields listed in the mask override the config in the
   *  recognizer for this recognition request. If a wildcard (`*`) is provided,
   *  config google.cloud.speech.v2.BatchRecognizeRequest.config  completely
   *  overrides and replaces the config in the recognizer for this recognition
   *  request.
   */
  // const configMask = {}
  /**
   *  Audio files with file metadata for ASR.
   *  The maximum number of files allowed to be specified is 5.
   */
  // const files = [1,2,3,4]
  /**
   *  Configuration options for where to output the transcripts of each file.
   */
  // const recognitionOutputConfig = {}
  /**
   *  Processing strategy to use for this request.
   */
  // const processingStrategy = {}

  // Imports the Speech library
  const {SpeechClient} = require('@google-cloud/speech').v2;

  // Instantiates a client
  const speechClient = new SpeechClient();

  async function callBatchRecognize() {
    // Construct request
    const request = {
      recognizer,
    };

    // Run request
    const [operation] = await speechClient.batchRecognize(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callBatchRecognize();

checkCreateCustomClassProgress(name)

checkCreateCustomClassProgress(name: string): Promise<LROperation<protos.google.cloud.speech.v2.CustomClass, protos.google.cloud.speech.v2.OperationMetadata>>;

Check the status of the long running operation returned by createCustomClass().

Parameter
NameDescription
name string

The operation name that will be passed.

Returns
TypeDescription
Promise<LROperation<protos.google.cloud.speech.v2.CustomClass, protos.google.cloud.speech.v2.OperationMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The CustomClass to create.
   */
  // const customClass = {}
  /**
   *  If set, validate the request and preview the CustomClass, but do not
   *  actually create it.
   */
  // const validateOnly = true
  /**
   *  The ID to use for the CustomClass, which will become the final component of
   *  the CustomClass's resource name.
   *  This value should be 4-63 characters, and valid characters
   *  are /[a-z][0-9]-/.
   */
  // const customClassId = 'abc123'
  /**
   *  Required. The project and location where this CustomClass will be created.
   *  The expected format is `projects/{project}/locations/{location}`.
   */
  // const parent = 'abc123'

  // Imports the Speech library
  const {SpeechClient} = require('@google-cloud/speech').v2;

  // Instantiates a client
  const speechClient = new SpeechClient();

  async function callCreateCustomClass() {
    // Construct request
    const request = {
      customClass,
      parent,
    };

    // Run request
    const [operation] = await speechClient.createCustomClass(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callCreateCustomClass();

checkCreatePhraseSetProgress(name)

checkCreatePhraseSetProgress(name: string): Promise<LROperation<protos.google.cloud.speech.v2.PhraseSet, protos.google.cloud.speech.v2.OperationMetadata>>;

Check the status of the long running operation returned by createPhraseSet().

Parameter
NameDescription
name string

The operation name that will be passed.

Returns
TypeDescription
Promise<LROperation<protos.google.cloud.speech.v2.PhraseSet, protos.google.cloud.speech.v2.OperationMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The PhraseSet to create.
   */
  // const phraseSet = {}
  /**
   *  If set, validate the request and preview the PhraseSet, but do not
   *  actually create it.
   */
  // const validateOnly = true
  /**
   *  The ID to use for the PhraseSet, which will become the final component of
   *  the PhraseSet's resource name.
   *  This value should be 4-63 characters, and valid characters
   *  are /[a-z][0-9]-/.
   */
  // const phraseSetId = 'abc123'
  /**
   *  Required. The project and location where this PhraseSet will be created.
   *  The expected format is `projects/{project}/locations/{location}`.
   */
  // const parent = 'abc123'

  // Imports the Speech library
  const {SpeechClient} = require('@google-cloud/speech').v2;

  // Instantiates a client
  const speechClient = new SpeechClient();

  async function callCreatePhraseSet() {
    // Construct request
    const request = {
      phraseSet,
      parent,
    };

    // Run request
    const [operation] = await speechClient.createPhraseSet(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callCreatePhraseSet();

checkCreateRecognizerProgress(name)

checkCreateRecognizerProgress(name: string): Promise<LROperation<protos.google.cloud.speech.v2.Recognizer, protos.google.cloud.speech.v2.OperationMetadata>>;

Check the status of the long running operation returned by createRecognizer().

Parameter
NameDescription
name string

The operation name that will be passed.

Returns
TypeDescription
Promise<LROperation<protos.google.cloud.speech.v2.Recognizer, protos.google.cloud.speech.v2.OperationMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The Recognizer to create.
   */
  // const recognizer = {}
  /**
   *  If set, validate the request and preview the Recognizer, but do not
   *  actually create it.
   */
  // const validateOnly = true
  /**
   *  The ID to use for the Recognizer, which will become the final component of
   *  the Recognizer's resource name.
   *  This value should be 4-63 characters, and valid characters
   *  are /[a-z][0-9]-/.
   */
  // const recognizerId = 'abc123'
  /**
   *  Required. The project and location where this Recognizer will be created.
   *  The expected format is `projects/{project}/locations/{location}`.
   */
  // const parent = 'abc123'

  // Imports the Speech library
  const {SpeechClient} = require('@google-cloud/speech').v2;

  // Instantiates a client
  const speechClient = new SpeechClient();

  async function callCreateRecognizer() {
    // Construct request
    const request = {
      recognizer,
      parent,
    };

    // Run request
    const [operation] = await speechClient.createRecognizer(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callCreateRecognizer();

checkDeleteCustomClassProgress(name)

checkDeleteCustomClassProgress(name: string): Promise<LROperation<protos.google.cloud.speech.v2.CustomClass, protos.google.cloud.speech.v2.OperationMetadata>>;

Check the status of the long running operation returned by deleteCustomClass().

Parameter
NameDescription
name string

The operation name that will be passed.

Returns
TypeDescription
Promise<LROperation<protos.google.cloud.speech.v2.CustomClass, protos.google.cloud.speech.v2.OperationMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the CustomClass to delete.
   *  Format:
   *  `projects/{project}/locations/{location}/customClasses/{custom_class}`
   */
  // const name = 'abc123'
  /**
   *  If set, validate the request and preview the deleted CustomClass, but do
   *  not actually delete it.
   */
  // const validateOnly = true
  /**
   *  If set to true, and the CustomClass is not found, the request will succeed
   *  and  be a no-op (no Operation is recorded in this case).
   */
  // const allowMissing = true
  /**
   *  This checksum is computed by the server based on the value of other
   *  fields. This may be sent on update, undelete, and delete requests to ensure
   *  the client has an up-to-date value before proceeding.
   */
  // const etag = 'abc123'

  // Imports the Speech library
  const {SpeechClient} = require('@google-cloud/speech').v2;

  // Instantiates a client
  const speechClient = new SpeechClient();

  async function callDeleteCustomClass() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const [operation] = await speechClient.deleteCustomClass(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callDeleteCustomClass();

checkDeletePhraseSetProgress(name)

checkDeletePhraseSetProgress(name: string): Promise<LROperation<protos.google.cloud.speech.v2.PhraseSet, protos.google.cloud.speech.v2.OperationMetadata>>;

Check the status of the long running operation returned by deletePhraseSet().

Parameter
NameDescription
name string

The operation name that will be passed.

Returns
TypeDescription
Promise<LROperation<protos.google.cloud.speech.v2.PhraseSet, protos.google.cloud.speech.v2.OperationMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the PhraseSet to delete.
   *  Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`
   */
  // const name = 'abc123'
  /**
   *  If set, validate the request and preview the deleted PhraseSet, but do not
   *  actually delete it.
   */
  // const validateOnly = true
  /**
   *  If set to true, and the PhraseSet is not found, the request will succeed
   *  and  be a no-op (no Operation is recorded in this case).
   */
  // const allowMissing = true
  /**
   *  This checksum is computed by the server based on the value of other
   *  fields. This may be sent on update, undelete, and delete requests to ensure
   *  the client has an up-to-date value before proceeding.
   */
  // const etag = 'abc123'

  // Imports the Speech library
  const {SpeechClient} = require('@google-cloud/speech').v2;

  // Instantiates a client
  const speechClient = new SpeechClient();

  async function callDeletePhraseSet() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const [operation] = await speechClient.deletePhraseSet(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callDeletePhraseSet();

checkDeleteRecognizerProgress(name)

checkDeleteRecognizerProgress(name: string): Promise<LROperation<protos.google.cloud.speech.v2.Recognizer, protos.google.cloud.speech.v2.OperationMetadata>>;

Check the status of the long running operation returned by deleteRecognizer().

Parameter
NameDescription
name string

The operation name that will be passed.

Returns
TypeDescription
Promise<LROperation<protos.google.cloud.speech.v2.Recognizer, protos.google.cloud.speech.v2.OperationMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the Recognizer to delete.
   *  Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`
   */
  // const name = 'abc123'
  /**
   *  If set, validate the request and preview the deleted Recognizer, but do not
   *  actually delete it.
   */
  // const validateOnly = true
  /**
   *  If set to true, and the Recognizer is not found, the request will succeed
   *  and  be a no-op (no Operation is recorded in this case).
   */
  // const allowMissing = true
  /**
   *  This checksum is computed by the server based on the value of other
   *  fields. This may be sent on update, undelete, and delete requests to ensure
   *  the client has an up-to-date value before proceeding.
   */
  // const etag = 'abc123'

  // Imports the Speech library
  const {SpeechClient} = require('@google-cloud/speech').v2;

  // Instantiates a client
  const speechClient = new SpeechClient();

  async function callDeleteRecognizer() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const [operation] = await speechClient.deleteRecognizer(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callDeleteRecognizer();

checkUndeleteCustomClassProgress(name)

checkUndeleteCustomClassProgress(name: string): Promise<LROperation<protos.google.cloud.speech.v2.CustomClass, protos.google.cloud.speech.v2.OperationMetadata>>;

Check the status of the long running operation returned by undeleteCustomClass().

Parameter
NameDescription
name string

The operation name that will be passed.

Returns
TypeDescription
Promise<LROperation<protos.google.cloud.speech.v2.CustomClass, protos.google.cloud.speech.v2.OperationMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the CustomClass to undelete.
   *  Format:
   *  `projects/{project}/locations/{location}/customClasses/{custom_class}`
   */
  // const name = 'abc123'
  /**
   *  If set, validate the request and preview the undeleted CustomClass, but do
   *  not actually undelete it.
   */
  // const validateOnly = true
  /**
   *  This checksum is computed by the server based on the value of other
   *  fields. This may be sent on update, undelete, and delete requests to ensure
   *  the client has an up-to-date value before proceeding.
   */
  // const etag = 'abc123'

  // Imports the Speech library
  const {SpeechClient} = require('@google-cloud/speech').v2;

  // Instantiates a client
  const speechClient = new SpeechClient();

  async function callUndeleteCustomClass() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const [operation] = await speechClient.undeleteCustomClass(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callUndeleteCustomClass();

checkUndeletePhraseSetProgress(name)

checkUndeletePhraseSetProgress(name: string): Promise<LROperation<protos.google.cloud.speech.v2.PhraseSet, protos.google.cloud.speech.v2.OperationMetadata>>;

Check the status of the long running operation returned by undeletePhraseSet().

Parameter
NameDescription
name string

The operation name that will be passed.

Returns
TypeDescription
Promise<LROperation<protos.google.cloud.speech.v2.PhraseSet, protos.google.cloud.speech.v2.OperationMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the PhraseSet to undelete.
   *  Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`
   */
  // const name = 'abc123'
  /**
   *  If set, validate the request and preview the undeleted PhraseSet, but do
   *  not actually undelete it.
   */
  // const validateOnly = true
  /**
   *  This checksum is computed by the server based on the value of other
   *  fields. This may be sent on update, undelete, and delete requests to ensure
   *  the client has an up-to-date value before proceeding.
   */
  // const etag = 'abc123'

  // Imports the Speech library
  const {SpeechClient} = require('@google-cloud/speech').v2;

  // Instantiates a client
  const speechClient = new SpeechClient();

  async function callUndeletePhraseSet() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const [operation] = await speechClient.undeletePhraseSet(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callUndeletePhraseSet();

checkUndeleteRecognizerProgress(name)

checkUndeleteRecognizerProgress(name: string): Promise<LROperation<protos.google.cloud.speech.v2.Recognizer, protos.google.cloud.speech.v2.OperationMetadata>>;

Check the status of the long running operation returned by undeleteRecognizer().

Parameter
NameDescription
name string

The operation name that will be passed.

Returns
TypeDescription
Promise<LROperation<protos.google.cloud.speech.v2.Recognizer, protos.google.cloud.speech.v2.OperationMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the Recognizer to undelete.
   *  Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`
   */
  // const name = 'abc123'
  /**
   *  If set, validate the request and preview the undeleted Recognizer, but do
   *  not actually undelete it.
   */
  // const validateOnly = true
  /**
   *  This checksum is computed by the server based on the value of other
   *  fields. This may be sent on update, undelete, and delete requests to ensure
   *  the client has an up-to-date value before proceeding.
   */
  // const etag = 'abc123'

  // Imports the Speech library
  const {SpeechClient} = require('@google-cloud/speech').v2;

  // Instantiates a client
  const speechClient = new SpeechClient();

  async function callUndeleteRecognizer() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const [operation] = await speechClient.undeleteRecognizer(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callUndeleteRecognizer();

checkUpdateCustomClassProgress(name)

checkUpdateCustomClassProgress(name: string): Promise<LROperation<protos.google.cloud.speech.v2.CustomClass, protos.google.cloud.speech.v2.OperationMetadata>>;

Check the status of the long running operation returned by updateCustomClass().

Parameter
NameDescription
name string

The operation name that will be passed.

Returns
TypeDescription
Promise<LROperation<protos.google.cloud.speech.v2.CustomClass, protos.google.cloud.speech.v2.OperationMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The CustomClass to update.
   *  The CustomClass's `name` field is used to identify the CustomClass to
   *  update. Format:
   *  `projects/{project}/locations/{location}/customClasses/{custom_class}`.
   */
  // const customClass = {}
  /**
   *  The list of fields to be updated. If empty, all fields are considered for
   *  update.
   */
  // const updateMask = {}
  /**
   *  If set, validate the request and preview the updated CustomClass, but do
   *  not actually update it.
   */
  // const validateOnly = true

  // Imports the Speech library
  const {SpeechClient} = require('@google-cloud/speech').v2;

  // Instantiates a client
  const speechClient = new SpeechClient();

  async function callUpdateCustomClass() {
    // Construct request
    const request = {
      customClass,
    };

    // Run request
    const [operation] = await speechClient.updateCustomClass(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callUpdateCustomClass();

checkUpdatePhraseSetProgress(name)

checkUpdatePhraseSetProgress(name: string): Promise<LROperation<protos.google.cloud.speech.v2.PhraseSet, protos.google.cloud.speech.v2.OperationMetadata>>;

Check the status of the long running operation returned by updatePhraseSet().

Parameter
NameDescription
name string

The operation name that will be passed.

Returns
TypeDescription
Promise<LROperation<protos.google.cloud.speech.v2.PhraseSet, protos.google.cloud.speech.v2.OperationMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The PhraseSet to update.
   *  The PhraseSet's `name` field is used to identify the PhraseSet to update.
   *  Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
   */
  // const phraseSet = {}
  /**
   *  The list of fields to update. If empty, all non-default valued fields are
   *  considered for update. Use `*` to update the entire PhraseSet resource.
   */
  // const updateMask = {}
  /**
   *  If set, validate the request and preview the updated PhraseSet, but do not
   *  actually update it.
   */
  // const validateOnly = true

  // Imports the Speech library
  const {SpeechClient} = require('@google-cloud/speech').v2;

  // Instantiates a client
  const speechClient = new SpeechClient();

  async function callUpdatePhraseSet() {
    // Construct request
    const request = {
      phraseSet,
    };

    // Run request
    const [operation] = await speechClient.updatePhraseSet(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callUpdatePhraseSet();

checkUpdateRecognizerProgress(name)

checkUpdateRecognizerProgress(name: string): Promise<LROperation<protos.google.cloud.speech.v2.Recognizer, protos.google.cloud.speech.v2.OperationMetadata>>;

Check the status of the long running operation returned by updateRecognizer().

Parameter
NameDescription
name string

The operation name that will be passed.

Returns
TypeDescription
Promise<LROperation<protos.google.cloud.speech.v2.Recognizer, protos.google.cloud.speech.v2.OperationMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The Recognizer to update.
   *  The Recognizer's `name` field is used to identify the Recognizer to update.
   *  Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`.
   */
  // const recognizer = {}
  /**
   *  The list of fields to update. If empty, all non-default valued fields are
   *  considered for update. Use `*` to update the entire Recognizer resource.
   */
  // const updateMask = {}
  /**
   *  If set, validate the request and preview the updated Recognizer, but do not
   *  actually update it.
   */
  // const validateOnly = true

  // Imports the Speech library
  const {SpeechClient} = require('@google-cloud/speech').v2;

  // Instantiates a client
  const speechClient = new SpeechClient();

  async function callUpdateRecognizer() {
    // Construct request
    const request = {
      recognizer,
    };

    // Run request
    const [operation] = await speechClient.updateRecognizer(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callUpdateRecognizer();

close()

close(): Promise<void>;

Terminate the gRPC channel and close the client.

The client will no longer be usable and all future behavior is undefined.

Returns
TypeDescription
Promise<void>

{Promise} A promise that resolves when the client is closed.

configPath(project, location)

configPath(project: string, location: string): string;

Return a fully-qualified config resource name string.

Parameters
NameDescription
project string
location string
Returns
TypeDescription
string

{string} Resource name string.

createCustomClass(request, options)

createCustomClass(request?: protos.google.cloud.speech.v2.ICreateCustomClassRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IOperationMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Creates a .

Parameters
NameDescription
request ICreateCustomClassRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise() method returns a promise you can await for. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The CustomClass to create.
   */
  // const customClass = {}
  /**
   *  If set, validate the request and preview the CustomClass, but do not
   *  actually create it.
   */
  // const validateOnly = true
  /**
   *  The ID to use for the CustomClass, which will become the final component of
   *  the CustomClass's resource name.
   *  This value should be 4-63 characters, and valid characters
   *  are /[a-z][0-9]-/.
   */
  // const customClassId = 'abc123'
  /**
   *  Required. The project and location where this CustomClass will be created.
   *  The expected format is `projects/{project}/locations/{location}`.
   */
  // const parent = 'abc123'

  // Imports the Speech library
  const {SpeechClient} = require('@google-cloud/speech').v2;

  // Instantiates a client
  const speechClient = new SpeechClient();

  async function callCreateCustomClass() {
    // Construct request
    const request = {
      customClass,
      parent,
    };

    // Run request
    const [operation] = await speechClient.createCustomClass(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callCreateCustomClass();

createCustomClass(request, options, callback)

createCustomClass(request: protos.google.cloud.speech.v2.ICreateCustomClassRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request ICreateCustomClassRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

createCustomClass(request, callback)

createCustomClass(request: protos.google.cloud.speech.v2.ICreateCustomClassRequest, callback: Callback<LROperation<protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request ICreateCustomClassRequest
callback Callback<LROperation<protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

createPhraseSet(request, options)

createPhraseSet(request?: protos.google.cloud.speech.v2.ICreatePhraseSetRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IOperationMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Creates a .

Parameters
NameDescription
request ICreatePhraseSetRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise() method returns a promise you can await for. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The PhraseSet to create.
   */
  // const phraseSet = {}
  /**
   *  If set, validate the request and preview the PhraseSet, but do not
   *  actually create it.
   */
  // const validateOnly = true
  /**
   *  The ID to use for the PhraseSet, which will become the final component of
   *  the PhraseSet's resource name.
   *  This value should be 4-63 characters, and valid characters
   *  are /[a-z][0-9]-/.
   */
  // const phraseSetId = 'abc123'
  /**
   *  Required. The project and location where this PhraseSet will be created.
   *  The expected format is `projects/{project}/locations/{location}`.
   */
  // const parent = 'abc123'

  // Imports the Speech library
  const {SpeechClient} = require('@google-cloud/speech').v2;

  // Instantiates a client
  const speechClient = new SpeechClient();

  async function callCreatePhraseSet() {
    // Construct request
    const request = {
      phraseSet,
      parent,
    };

    // Run request
    const [operation] = await speechClient.createPhraseSet(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callCreatePhraseSet();

createPhraseSet(request, options, callback)

createPhraseSet(request: protos.google.cloud.speech.v2.ICreatePhraseSetRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request ICreatePhraseSetRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

createPhraseSet(request, callback)

createPhraseSet(request: protos.google.cloud.speech.v2.ICreatePhraseSetRequest, callback: Callback<LROperation<protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request ICreatePhraseSetRequest
callback Callback<LROperation<protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

createRecognizer(request, options)

createRecognizer(request?: protos.google.cloud.speech.v2.ICreateRecognizerRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IOperationMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Creates a .

Parameters
NameDescription
request ICreateRecognizerRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise() method returns a promise you can await for. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The Recognizer to create.
   */
  // const recognizer = {}
  /**
   *  If set, validate the request and preview the Recognizer, but do not
   *  actually create it.
   */
  // const validateOnly = true
  /**
   *  The ID to use for the Recognizer, which will become the final component of
   *  the Recognizer's resource name.
   *  This value should be 4-63 characters, and valid characters
   *  are /[a-z][0-9]-/.
   */
  // const recognizerId = 'abc123'
  /**
   *  Required. The project and location where this Recognizer will be created.
   *  The expected format is `projects/{project}/locations/{location}`.
   */
  // const parent = 'abc123'

  // Imports the Speech library
  const {SpeechClient} = require('@google-cloud/speech').v2;

  // Instantiates a client
  const speechClient = new SpeechClient();

  async function callCreateRecognizer() {
    // Construct request
    const request = {
      recognizer,
      parent,
    };

    // Run request
    const [operation] = await speechClient.createRecognizer(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callCreateRecognizer();

createRecognizer(request, options, callback)

createRecognizer(request: protos.google.cloud.speech.v2.ICreateRecognizerRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request ICreateRecognizerRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

createRecognizer(request, callback)

createRecognizer(request: protos.google.cloud.speech.v2.ICreateRecognizerRequest, callback: Callback<LROperation<protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request ICreateRecognizerRequest
callback Callback<LROperation<protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

cryptoKeyPath(project, location, keyRing, cryptoKey)

cryptoKeyPath(project: string, location: string, keyRing: string, cryptoKey: string): string;

Return a fully-qualified cryptoKey resource name string.

Parameters
NameDescription
project string
location string
keyRing string
cryptoKey string
Returns
TypeDescription
string

{string} Resource name string.

cryptoKeyVersionPath(project, location, keyRing, cryptoKey, cryptoKeyVersion)

cryptoKeyVersionPath(project: string, location: string, keyRing: string, cryptoKey: string, cryptoKeyVersion: string): string;

Return a fully-qualified cryptoKeyVersion resource name string.

Parameters
NameDescription
project string
location string
keyRing string
cryptoKey string
cryptoKeyVersion string
Returns
TypeDescription
string

{string} Resource name string.

customClassPath(project, location, customClass)

customClassPath(project: string, location: string, customClass: string): string;

Return a fully-qualified customClass resource name string.

Parameters
NameDescription
project string
location string
customClass string
Returns
TypeDescription
string

{string} Resource name string.

deleteCustomClass(request, options)

deleteCustomClass(request?: protos.google.cloud.speech.v2.IDeleteCustomClassRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IOperationMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Deletes the .

Parameters
NameDescription
request IDeleteCustomClassRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise() method returns a promise you can await for. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the CustomClass to delete.
   *  Format:
   *  `projects/{project}/locations/{location}/customClasses/{custom_class}`
   */
  // const name = 'abc123'
  /**
   *  If set, validate the request and preview the deleted CustomClass, but do
   *  not actually delete it.
   */
  // const validateOnly = true
  /**
   *  If set to true, and the CustomClass is not found, the request will succeed
   *  and  be a no-op (no Operation is recorded in this case).
   */
  // const allowMissing = true
  /**
   *  This checksum is computed by the server based on the value of other
   *  fields. This may be sent on update, undelete, and delete requests to ensure
   *  the client has an up-to-date value before proceeding.
   */
  // const etag = 'abc123'

  // Imports the Speech library
  const {SpeechClient} = require('@google-cloud/speech').v2;

  // Instantiates a client
  const speechClient = new SpeechClient();

  async function callDeleteCustomClass() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const [operation] = await speechClient.deleteCustomClass(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callDeleteCustomClass();

deleteCustomClass(request, options, callback)

deleteCustomClass(request: protos.google.cloud.speech.v2.IDeleteCustomClassRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IDeleteCustomClassRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

deleteCustomClass(request, callback)

deleteCustomClass(request: protos.google.cloud.speech.v2.IDeleteCustomClassRequest, callback: Callback<LROperation<protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IDeleteCustomClassRequest
callback Callback<LROperation<protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

deleteOperation(request, options, callback)

deleteOperation(request: protos.google.longrunning.DeleteOperationRequest, options?: gax.CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>, callback?: Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>): Promise<protos.google.protobuf.Empty>;

Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED.

Parameters
NameDescription
request DeleteOperationRequest

The request object that will be sent.

options CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>

The function which will be called with the result of the API call. {Promise} - The promise which resolves when API call finishes. The promise has a method named "cancel" which cancels the ongoing API call.

Returns
TypeDescription
Promise<protos.google.protobuf.Empty>
Example

const client = longrunning.operationsClient();
await client.deleteOperation({name: ''});

deletePhraseSet(request, options)

deletePhraseSet(request?: protos.google.cloud.speech.v2.IDeletePhraseSetRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IOperationMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Deletes the .

Parameters
NameDescription
request IDeletePhraseSetRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise() method returns a promise you can await for. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the PhraseSet to delete.
   *  Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`
   */
  // const name = 'abc123'
  /**
   *  If set, validate the request and preview the deleted PhraseSet, but do not
   *  actually delete it.
   */
  // const validateOnly = true
  /**
   *  If set to true, and the PhraseSet is not found, the request will succeed
   *  and  be a no-op (no Operation is recorded in this case).
   */
  // const allowMissing = true
  /**
   *  This checksum is computed by the server based on the value of other
   *  fields. This may be sent on update, undelete, and delete requests to ensure
   *  the client has an up-to-date value before proceeding.
   */
  // const etag = 'abc123'

  // Imports the Speech library
  const {SpeechClient} = require('@google-cloud/speech').v2;

  // Instantiates a client
  const speechClient = new SpeechClient();

  async function callDeletePhraseSet() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const [operation] = await speechClient.deletePhraseSet(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callDeletePhraseSet();

deletePhraseSet(request, options, callback)

deletePhraseSet(request: protos.google.cloud.speech.v2.IDeletePhraseSetRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IDeletePhraseSetRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

deletePhraseSet(request, callback)

deletePhraseSet(request: protos.google.cloud.speech.v2.IDeletePhraseSetRequest, callback: Callback<LROperation<protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IDeletePhraseSetRequest
callback Callback<LROperation<protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

deleteRecognizer(request, options)

deleteRecognizer(request?: protos.google.cloud.speech.v2.IDeleteRecognizerRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IOperationMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Deletes the .

Parameters
NameDescription
request IDeleteRecognizerRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise() method returns a promise you can await for. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the Recognizer to delete.
   *  Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`
   */
  // const name = 'abc123'
  /**
   *  If set, validate the request and preview the deleted Recognizer, but do not
   *  actually delete it.
   */
  // const validateOnly = true
  /**
   *  If set to true, and the Recognizer is not found, the request will succeed
   *  and  be a no-op (no Operation is recorded in this case).
   */
  // const allowMissing = true
  /**
   *  This checksum is computed by the server based on the value of other
   *  fields. This may be sent on update, undelete, and delete requests to ensure
   *  the client has an up-to-date value before proceeding.
   */
  // const etag = 'abc123'

  // Imports the Speech library
  const {SpeechClient} = require('@google-cloud/speech').v2;

  // Instantiates a client
  const speechClient = new SpeechClient();

  async function callDeleteRecognizer() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const [operation] = await speechClient.deleteRecognizer(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callDeleteRecognizer();

deleteRecognizer(request, options, callback)

deleteRecognizer(request: protos.google.cloud.speech.v2.IDeleteRecognizerRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IDeleteRecognizerRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

deleteRecognizer(request, callback)

deleteRecognizer(request: protos.google.cloud.speech.v2.IDeleteRecognizerRequest, callback: Callback<LROperation<protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IDeleteRecognizerRequest
callback Callback<LROperation<protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getConfig(request, options)

getConfig(request?: protos.google.cloud.speech.v2.IGetConfigRequest, options?: CallOptions): Promise<[
        protos.google.cloud.speech.v2.IConfig,
        protos.google.cloud.speech.v2.IGetConfigRequest | undefined,
        {} | undefined
    ]>;

Returns the requested Config.

Parameters
NameDescription
request IGetConfigRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.speech.v2.IConfig, protos.google.cloud.speech.v2.IGetConfigRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing Config. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the config to retrieve. There is exactly one config
   *  resource per project per location. The expected format is
   *  `projects/{project}/locations/{location}/config`.
   */
  // const name = 'abc123'

  // Imports the Speech library
  const {SpeechClient} = require('@google-cloud/speech').v2;

  // Instantiates a client
  const speechClient = new SpeechClient();

  async function callGetConfig() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await speechClient.getConfig(request);
    console.log(response);
  }

  callGetConfig();

getConfig(request, options, callback)

getConfig(request: protos.google.cloud.speech.v2.IGetConfigRequest, options: CallOptions, callback: Callback<protos.google.cloud.speech.v2.IConfig, protos.google.cloud.speech.v2.IGetConfigRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IGetConfigRequest
options CallOptions
callback Callback<protos.google.cloud.speech.v2.IConfig, protos.google.cloud.speech.v2.IGetConfigRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getConfig(request, callback)

getConfig(request: protos.google.cloud.speech.v2.IGetConfigRequest, callback: Callback<protos.google.cloud.speech.v2.IConfig, protos.google.cloud.speech.v2.IGetConfigRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IGetConfigRequest
callback Callback<protos.google.cloud.speech.v2.IConfig, protos.google.cloud.speech.v2.IGetConfigRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getCustomClass(request, options)

getCustomClass(request?: protos.google.cloud.speech.v2.IGetCustomClassRequest, options?: CallOptions): Promise<[
        protos.google.cloud.speech.v2.ICustomClass,
        protos.google.cloud.speech.v2.IGetCustomClassRequest | undefined,
        {} | undefined
    ]>;

Returns the requested .

Parameters
NameDescription
request IGetCustomClassRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IGetCustomClassRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the CustomClass to retrieve. The expected format is
   *  `projects/{project}/locations/{location}/customClasses/{custom_class}`.
   */
  // const name = 'abc123'

  // Imports the Speech library
  const {SpeechClient} = require('@google-cloud/speech').v2;

  // Instantiates a client
  const speechClient = new SpeechClient();

  async function callGetCustomClass() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await speechClient.getCustomClass(request);
    console.log(response);
  }

  callGetCustomClass();

getCustomClass(request, options, callback)

getCustomClass(request: protos.google.cloud.speech.v2.IGetCustomClassRequest, options: CallOptions, callback: Callback<protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IGetCustomClassRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IGetCustomClassRequest
options CallOptions
callback Callback<protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IGetCustomClassRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getCustomClass(request, callback)

getCustomClass(request: protos.google.cloud.speech.v2.IGetCustomClassRequest, callback: Callback<protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IGetCustomClassRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IGetCustomClassRequest
callback Callback<protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IGetCustomClassRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getLocation(request, options, callback)

getLocation(request: LocationProtos.google.cloud.location.IGetLocationRequest, options?: gax.CallOptions | Callback<LocationProtos.google.cloud.location.ILocation, LocationProtos.google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>, callback?: Callback<LocationProtos.google.cloud.location.ILocation, LocationProtos.google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>): Promise<LocationProtos.google.cloud.location.ILocation>;

Gets information about a location.

Parameters
NameDescription
request LocationProtos.google.cloud.location.IGetLocationRequest

The request object that will be sent.

options CallOptions | Callback<google.cloud.location.ILocation, google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>

Call options. See CallOptions for more details.

callback Callback<google.cloud.location.ILocation, google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
Promise<google.cloud.location.ILocation>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

const [response] = await client.getLocation(request);

getOperation(request, options, callback)

getOperation(request: protos.google.longrunning.GetOperationRequest, options?: gax.CallOptions | Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>, callback?: Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>): Promise<[protos.google.longrunning.Operation]>;

Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.

Parameters
NameDescription
request GetOperationRequest

The request object that will be sent.

options CallOptions | Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>

The function which will be called with the result of the API call.

The second parameter to the callback is an object representing . {Promise} - The promise which resolves to an array. The first element of the array is an object representing . The promise has a method named "cancel" which cancels the ongoing API call.

Returns
TypeDescription
Promise<[protos.google.longrunning.Operation]>
Example

const client = longrunning.operationsClient();
const name = '';
const [response] = await client.getOperation({name});
// doThingsWith(response)

getPhraseSet(request, options)

getPhraseSet(request?: protos.google.cloud.speech.v2.IGetPhraseSetRequest, options?: CallOptions): Promise<[
        protos.google.cloud.speech.v2.IPhraseSet,
        protos.google.cloud.speech.v2.IGetPhraseSetRequest | undefined,
        {} | undefined
    ]>;

Returns the requested .

Parameters
NameDescription
request IGetPhraseSetRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IGetPhraseSetRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the PhraseSet to retrieve. The expected format is
   *  `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
   */
  // const name = 'abc123'

  // Imports the Speech library
  const {SpeechClient} = require('@google-cloud/speech').v2;

  // Instantiates a client
  const speechClient = new SpeechClient();

  async function callGetPhraseSet() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await speechClient.getPhraseSet(request);
    console.log(response);
  }

  callGetPhraseSet();

getPhraseSet(request, options, callback)

getPhraseSet(request: protos.google.cloud.speech.v2.IGetPhraseSetRequest, options: CallOptions, callback: Callback<protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IGetPhraseSetRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IGetPhraseSetRequest
options CallOptions
callback Callback<protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IGetPhraseSetRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getPhraseSet(request, callback)

getPhraseSet(request: protos.google.cloud.speech.v2.IGetPhraseSetRequest, callback: Callback<protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IGetPhraseSetRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IGetPhraseSetRequest
callback Callback<protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IGetPhraseSetRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getProjectId()

getProjectId(): Promise<string>;
Returns
TypeDescription
Promise<string>

getProjectId(callback)

getProjectId(callback: Callback<string, undefined, undefined>): void;
Parameter
NameDescription
callback Callback<string, undefined, undefined>
Returns
TypeDescription
void

getRecognizer(request, options)

getRecognizer(request?: protos.google.cloud.speech.v2.IGetRecognizerRequest, options?: CallOptions): Promise<[
        protos.google.cloud.speech.v2.IRecognizer,
        protos.google.cloud.speech.v2.IGetRecognizerRequest | undefined,
        {} | undefined
    ]>;

Returns the requested . Fails with if the requested Recognizer doesn't exist.

Parameters
NameDescription
request IGetRecognizerRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IGetRecognizerRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the Recognizer to retrieve. The expected format is
   *  `projects/{project}/locations/{location}/recognizers/{recognizer}`.
   */
  // const name = 'abc123'

  // Imports the Speech library
  const {SpeechClient} = require('@google-cloud/speech').v2;

  // Instantiates a client
  const speechClient = new SpeechClient();

  async function callGetRecognizer() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await speechClient.getRecognizer(request);
    console.log(response);
  }

  callGetRecognizer();

getRecognizer(request, options, callback)

getRecognizer(request: protos.google.cloud.speech.v2.IGetRecognizerRequest, options: CallOptions, callback: Callback<protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IGetRecognizerRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IGetRecognizerRequest
options CallOptions
callback Callback<protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IGetRecognizerRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getRecognizer(request, callback)

getRecognizer(request: protos.google.cloud.speech.v2.IGetRecognizerRequest, callback: Callback<protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IGetRecognizerRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IGetRecognizerRequest
callback Callback<protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IGetRecognizerRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

initialize()

initialize(): Promise<{
        [name: string]: Function;
    }>;

Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.

You can await on this method if you want to make sure the client is initialized.

Returns
TypeDescription
Promise<{ [name: string]: Function; }>

{Promise} A promise that resolves to an authenticated service stub.

listCustomClasses(request, options)

listCustomClasses(request?: protos.google.cloud.speech.v2.IListCustomClassesRequest, options?: CallOptions): Promise<[
        protos.google.cloud.speech.v2.ICustomClass[],
        protos.google.cloud.speech.v2.IListCustomClassesRequest | null,
        protos.google.cloud.speech.v2.IListCustomClassesResponse
    ]>;

Lists CustomClasses.

Parameters
NameDescription
request IListCustomClassesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.speech.v2.ICustomClass[], protos.google.cloud.speech.v2.IListCustomClassesRequest | null, protos.google.cloud.speech.v2.IListCustomClassesResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of . The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using listCustomClassesAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listCustomClasses(request, options, callback)

listCustomClasses(request: protos.google.cloud.speech.v2.IListCustomClassesRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.speech.v2.IListCustomClassesRequest, protos.google.cloud.speech.v2.IListCustomClassesResponse | null | undefined, protos.google.cloud.speech.v2.ICustomClass>): void;
Parameters
NameDescription
request IListCustomClassesRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.speech.v2.IListCustomClassesRequest, protos.google.cloud.speech.v2.IListCustomClassesResponse | null | undefined, protos.google.cloud.speech.v2.ICustomClass>
Returns
TypeDescription
void

listCustomClasses(request, callback)

listCustomClasses(request: protos.google.cloud.speech.v2.IListCustomClassesRequest, callback: PaginationCallback<protos.google.cloud.speech.v2.IListCustomClassesRequest, protos.google.cloud.speech.v2.IListCustomClassesResponse | null | undefined, protos.google.cloud.speech.v2.ICustomClass>): void;
Parameters
NameDescription
request IListCustomClassesRequest
callback PaginationCallback<protos.google.cloud.speech.v2.IListCustomClassesRequest, protos.google.cloud.speech.v2.IListCustomClassesResponse | null | undefined, protos.google.cloud.speech.v2.ICustomClass>
Returns
TypeDescription
void

listCustomClassesAsync(request, options)

listCustomClassesAsync(request?: protos.google.cloud.speech.v2.IListCustomClassesRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.speech.v2.ICustomClass>;

Equivalent to listCustomClasses, but returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters
NameDescription
request IListCustomClassesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
AsyncIterable<protos.google.cloud.speech.v2.ICustomClass>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing . The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The project and location of CustomClass resources to list. The
   *  expected format is `projects/{project}/locations/{location}`.
   */
  // const parent = 'abc123'
  /**
   *  Number of results per requests. A valid page_size ranges from 0 to 100
   *  inclusive. If the page_size is zero or unspecified, a page size of 5 will
   *  be chosen. If the page size exceeds 100, it will be coerced down to 100.
   *  Note that a call might return fewer results than the requested page size.
   */
  // const pageSize = 1234
  /**
   *  A page token, received from a previous
   *  ListCustomClasses google.cloud.speech.v2.Speech.ListCustomClasses  call.
   *  Provide this to retrieve the subsequent page.
   *  When paginating, all other parameters provided to
   *  ListCustomClasses google.cloud.speech.v2.Speech.ListCustomClasses  must
   *  match the call that provided the page token.
   */
  // const pageToken = 'abc123'
  /**
   *  Whether, or not, to show resources that have been deleted.
   */
  // const showDeleted = true

  // Imports the Speech library
  const {SpeechClient} = require('@google-cloud/speech').v2;

  // Instantiates a client
  const speechClient = new SpeechClient();

  async function callListCustomClasses() {
    // Construct request
    const request = {
      parent,
    };

    // Run request
    const iterable = await speechClient.listCustomClassesAsync(request);
    for await (const response of iterable) {
        console.log(response);
    }
  }

  callListCustomClasses();

listCustomClassesStream(request, options)

listCustomClassesStream(request?: protos.google.cloud.speech.v2.IListCustomClassesRequest, options?: CallOptions): Transform;

Equivalent to method.name.toCamelCase(), but returns a NodeJS Stream object.

Parameters
NameDescription
request IListCustomClassesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Transform

{Stream} An object stream which emits an object representing on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using listCustomClassesAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listLocationsAsync(request, options)

listLocationsAsync(request: LocationProtos.google.cloud.location.IListLocationsRequest, options?: CallOptions): AsyncIterable<LocationProtos.google.cloud.location.ILocation>;

Lists information about the supported locations for this service. Returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters
NameDescription
request LocationProtos.google.cloud.location.IListLocationsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
AsyncIterable<google.cloud.location.ILocation>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing . The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples.

Example

const iterable = client.listLocationsAsync(request);
for await (const response of iterable) {
  // process response
}

listOperationsAsync(request, options)

listOperationsAsync(request: protos.google.longrunning.ListOperationsRequest, options?: gax.CallOptions): AsyncIterable<protos.google.longrunning.ListOperationsResponse>;

Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED. Returns an iterable object.

For-await-of syntax is used with the iterable to recursively get response element on-demand.

Parameters
NameDescription
request ListOperationsRequest

The request object that will be sent.

options CallOptions

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

Returns
TypeDescription
AsyncIterable<protos.google.longrunning.ListOperationsResponse>

{Object} An iterable Object that conforms to iteration protocols.

Example

const client = longrunning.operationsClient();
for await (const response of client.listOperationsAsync(request));
// doThingsWith(response)

listPhraseSets(request, options)

listPhraseSets(request?: protos.google.cloud.speech.v2.IListPhraseSetsRequest, options?: CallOptions): Promise<[
        protos.google.cloud.speech.v2.IPhraseSet[],
        protos.google.cloud.speech.v2.IListPhraseSetsRequest | null,
        protos.google.cloud.speech.v2.IListPhraseSetsResponse
    ]>;

Lists PhraseSets.

Parameters
NameDescription
request IListPhraseSetsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.speech.v2.IPhraseSet[], protos.google.cloud.speech.v2.IListPhraseSetsRequest | null, protos.google.cloud.speech.v2.IListPhraseSetsResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of . The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using listPhraseSetsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listPhraseSets(request, options, callback)

listPhraseSets(request: protos.google.cloud.speech.v2.IListPhraseSetsRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.speech.v2.IListPhraseSetsRequest, protos.google.cloud.speech.v2.IListPhraseSetsResponse | null | undefined, protos.google.cloud.speech.v2.IPhraseSet>): void;
Parameters
NameDescription
request IListPhraseSetsRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.speech.v2.IListPhraseSetsRequest, protos.google.cloud.speech.v2.IListPhraseSetsResponse | null | undefined, protos.google.cloud.speech.v2.IPhraseSet>
Returns
TypeDescription
void

listPhraseSets(request, callback)

listPhraseSets(request: protos.google.cloud.speech.v2.IListPhraseSetsRequest, callback: PaginationCallback<protos.google.cloud.speech.v2.IListPhraseSetsRequest, protos.google.cloud.speech.v2.IListPhraseSetsResponse | null | undefined, protos.google.cloud.speech.v2.IPhraseSet>): void;
Parameters
NameDescription
request IListPhraseSetsRequest
callback PaginationCallback<protos.google.cloud.speech.v2.IListPhraseSetsRequest, protos.google.cloud.speech.v2.IListPhraseSetsResponse | null | undefined, protos.google.cloud.speech.v2.IPhraseSet>
Returns
TypeDescription
void

listPhraseSetsAsync(request, options)

listPhraseSetsAsync(request?: protos.google.cloud.speech.v2.IListPhraseSetsRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.speech.v2.IPhraseSet>;

Equivalent to listPhraseSets, but returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters
NameDescription
request IListPhraseSetsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
AsyncIterable<protos.google.cloud.speech.v2.IPhraseSet>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing . The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The project and location of PhraseSet resources to list. The
   *  expected format is `projects/{project}/locations/{location}`.
   */
  // const parent = 'abc123'
  /**
   *  The maximum number of PhraseSets to return. The service may return fewer
   *  than this value. If unspecified, at most 5 PhraseSets will be returned.
   *  The maximum value is 100; values above 100 will be coerced to 100.
   */
  // const pageSize = 1234
  /**
   *  A page token, received from a previous
   *  ListPhraseSets google.cloud.speech.v2.Speech.ListPhraseSets  call.
   *  Provide this to retrieve the subsequent page.
   *  When paginating, all other parameters provided to
   *  ListPhraseSets google.cloud.speech.v2.Speech.ListPhraseSets  must match
   *  the call that provided the page token.
   */
  // const pageToken = 'abc123'
  /**
   *  Whether, or not, to show resources that have been deleted.
   */
  // const showDeleted = true

  // Imports the Speech library
  const {SpeechClient} = require('@google-cloud/speech').v2;

  // Instantiates a client
  const speechClient = new SpeechClient();

  async function callListPhraseSets() {
    // Construct request
    const request = {
      parent,
    };

    // Run request
    const iterable = await speechClient.listPhraseSetsAsync(request);
    for await (const response of iterable) {
        console.log(response);
    }
  }

  callListPhraseSets();

listPhraseSetsStream(request, options)

listPhraseSetsStream(request?: protos.google.cloud.speech.v2.IListPhraseSetsRequest, options?: CallOptions): Transform;

Equivalent to method.name.toCamelCase(), but returns a NodeJS Stream object.

Parameters
NameDescription
request IListPhraseSetsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Transform

{Stream} An object stream which emits an object representing on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using listPhraseSetsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listRecognizers(request, options)

listRecognizers(request?: protos.google.cloud.speech.v2.IListRecognizersRequest, options?: CallOptions): Promise<[
        protos.google.cloud.speech.v2.IRecognizer[],
        protos.google.cloud.speech.v2.IListRecognizersRequest | null,
        protos.google.cloud.speech.v2.IListRecognizersResponse
    ]>;

Lists Recognizers.

Parameters
NameDescription
request IListRecognizersRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.speech.v2.IRecognizer[], protos.google.cloud.speech.v2.IListRecognizersRequest | null, protos.google.cloud.speech.v2.IListRecognizersResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of . The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using listRecognizersAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listRecognizers(request, options, callback)

listRecognizers(request: protos.google.cloud.speech.v2.IListRecognizersRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.speech.v2.IListRecognizersRequest, protos.google.cloud.speech.v2.IListRecognizersResponse | null | undefined, protos.google.cloud.speech.v2.IRecognizer>): void;
Parameters
NameDescription
request IListRecognizersRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.speech.v2.IListRecognizersRequest, protos.google.cloud.speech.v2.IListRecognizersResponse | null | undefined, protos.google.cloud.speech.v2.IRecognizer>
Returns
TypeDescription
void

listRecognizers(request, callback)

listRecognizers(request: protos.google.cloud.speech.v2.IListRecognizersRequest, callback: PaginationCallback<protos.google.cloud.speech.v2.IListRecognizersRequest, protos.google.cloud.speech.v2.IListRecognizersResponse | null | undefined, protos.google.cloud.speech.v2.IRecognizer>): void;
Parameters
NameDescription
request IListRecognizersRequest
callback PaginationCallback<protos.google.cloud.speech.v2.IListRecognizersRequest, protos.google.cloud.speech.v2.IListRecognizersResponse | null | undefined, protos.google.cloud.speech.v2.IRecognizer>
Returns
TypeDescription
void

listRecognizersAsync(request, options)

listRecognizersAsync(request?: protos.google.cloud.speech.v2.IListRecognizersRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.speech.v2.IRecognizer>;

Equivalent to listRecognizers, but returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters
NameDescription
request IListRecognizersRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
AsyncIterable<protos.google.cloud.speech.v2.IRecognizer>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing . The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The project and location of Recognizers to list. The expected
   *  format is `projects/{project}/locations/{location}`.
   */
  // const parent = 'abc123'
  /**
   *  The maximum number of Recognizers to return. The service may return fewer
   *  than this value. If unspecified, at most 5 Recognizers will be returned.
   *  The maximum value is 100; values above 100 will be coerced to 100.
   */
  // const pageSize = 1234
  /**
   *  A page token, received from a previous
   *  ListRecognizers google.cloud.speech.v2.Speech.ListRecognizers  call.
   *  Provide this to retrieve the subsequent page.
   *  When paginating, all other parameters provided to
   *  ListRecognizers google.cloud.speech.v2.Speech.ListRecognizers  must match
   *  the call that provided the page token.
   */
  // const pageToken = 'abc123'
  /**
   *  Whether, or not, to show resources that have been deleted.
   */
  // const showDeleted = true

  // Imports the Speech library
  const {SpeechClient} = require('@google-cloud/speech').v2;

  // Instantiates a client
  const speechClient = new SpeechClient();

  async function callListRecognizers() {
    // Construct request
    const request = {
      parent,
    };

    // Run request
    const iterable = await speechClient.listRecognizersAsync(request);
    for await (const response of iterable) {
        console.log(response);
    }
  }

  callListRecognizers();

listRecognizersStream(request, options)

listRecognizersStream(request?: protos.google.cloud.speech.v2.IListRecognizersRequest, options?: CallOptions): Transform;

Equivalent to method.name.toCamelCase(), but returns a NodeJS Stream object.

Parameters
NameDescription
request IListRecognizersRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Transform

{Stream} An object stream which emits an object representing on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using listRecognizersAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

locationPath(project, location)

locationPath(project: string, location: string): string;

Return a fully-qualified location resource name string.

Parameters
NameDescription
project string
location string
Returns
TypeDescription
string

{string} Resource name string.

matchCryptoKeyFromCryptoKeyName(cryptoKeyName)

matchCryptoKeyFromCryptoKeyName(cryptoKeyName: string): string | number;

Parse the crypto_key from CryptoKey resource.

Parameter
NameDescription
cryptoKeyName string

A fully-qualified path representing CryptoKey resource.

Returns
TypeDescription
string | number

{string} A string representing the crypto_key.

matchCryptoKeyFromCryptoKeyVersionName(cryptoKeyVersionName)

matchCryptoKeyFromCryptoKeyVersionName(cryptoKeyVersionName: string): string | number;

Parse the crypto_key from CryptoKeyVersion resource.

Parameter
NameDescription
cryptoKeyVersionName string

A fully-qualified path representing CryptoKeyVersion resource.

Returns
TypeDescription
string | number

{string} A string representing the crypto_key.

matchCryptoKeyVersionFromCryptoKeyVersionName(cryptoKeyVersionName)

matchCryptoKeyVersionFromCryptoKeyVersionName(cryptoKeyVersionName: string): string | number;

Parse the crypto_key_version from CryptoKeyVersion resource.

Parameter
NameDescription
cryptoKeyVersionName string

A fully-qualified path representing CryptoKeyVersion resource.

Returns
TypeDescription
string | number

{string} A string representing the crypto_key_version.

matchCustomClassFromCustomClassName(customClassName)

matchCustomClassFromCustomClassName(customClassName: string): string | number;

Parse the custom_class from CustomClass resource.

Parameter
NameDescription
customClassName string

A fully-qualified path representing CustomClass resource.

Returns
TypeDescription
string | number

{string} A string representing the custom_class.

matchKeyRingFromCryptoKeyName(cryptoKeyName)

matchKeyRingFromCryptoKeyName(cryptoKeyName: string): string | number;

Parse the key_ring from CryptoKey resource.

Parameter
NameDescription
cryptoKeyName string

A fully-qualified path representing CryptoKey resource.

Returns
TypeDescription
string | number

{string} A string representing the key_ring.

matchKeyRingFromCryptoKeyVersionName(cryptoKeyVersionName)

matchKeyRingFromCryptoKeyVersionName(cryptoKeyVersionName: string): string | number;

Parse the key_ring from CryptoKeyVersion resource.

Parameter
NameDescription
cryptoKeyVersionName string

A fully-qualified path representing CryptoKeyVersion resource.

Returns
TypeDescription
string | number

{string} A string representing the key_ring.

matchLocationFromConfigName(configName)

matchLocationFromConfigName(configName: string): string | number;

Parse the location from Config resource.

Parameter
NameDescription
configName string

A fully-qualified path representing Config resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchLocationFromCryptoKeyName(cryptoKeyName)

matchLocationFromCryptoKeyName(cryptoKeyName: string): string | number;

Parse the location from CryptoKey resource.

Parameter
NameDescription
cryptoKeyName string

A fully-qualified path representing CryptoKey resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchLocationFromCryptoKeyVersionName(cryptoKeyVersionName)

matchLocationFromCryptoKeyVersionName(cryptoKeyVersionName: string): string | number;

Parse the location from CryptoKeyVersion resource.

Parameter
NameDescription
cryptoKeyVersionName string

A fully-qualified path representing CryptoKeyVersion resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchLocationFromCustomClassName(customClassName)

matchLocationFromCustomClassName(customClassName: string): string | number;

Parse the location from CustomClass resource.

Parameter
NameDescription
customClassName string

A fully-qualified path representing CustomClass resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchLocationFromLocationName(locationName)

matchLocationFromLocationName(locationName: string): string | number;

Parse the location from Location resource.

Parameter
NameDescription
locationName string

A fully-qualified path representing Location resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchLocationFromPhraseSetName(phraseSetName)

matchLocationFromPhraseSetName(phraseSetName: string): string | number;

Parse the location from PhraseSet resource.

Parameter
NameDescription
phraseSetName string

A fully-qualified path representing PhraseSet resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchLocationFromRecognizerName(recognizerName)

matchLocationFromRecognizerName(recognizerName: string): string | number;

Parse the location from Recognizer resource.

Parameter
NameDescription
recognizerName string

A fully-qualified path representing Recognizer resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchPhraseSetFromPhraseSetName(phraseSetName)

matchPhraseSetFromPhraseSetName(phraseSetName: string): string | number;

Parse the phrase_set from PhraseSet resource.

Parameter
NameDescription
phraseSetName string

A fully-qualified path representing PhraseSet resource.

Returns
TypeDescription
string | number

{string} A string representing the phrase_set.

matchProjectFromConfigName(configName)

matchProjectFromConfigName(configName: string): string | number;

Parse the project from Config resource.

Parameter
NameDescription
configName string

A fully-qualified path representing Config resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromCryptoKeyName(cryptoKeyName)

matchProjectFromCryptoKeyName(cryptoKeyName: string): string | number;

Parse the project from CryptoKey resource.

Parameter
NameDescription
cryptoKeyName string

A fully-qualified path representing CryptoKey resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromCryptoKeyVersionName(cryptoKeyVersionName)

matchProjectFromCryptoKeyVersionName(cryptoKeyVersionName: string): string | number;

Parse the project from CryptoKeyVersion resource.

Parameter
NameDescription
cryptoKeyVersionName string

A fully-qualified path representing CryptoKeyVersion resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromCustomClassName(customClassName)

matchProjectFromCustomClassName(customClassName: string): string | number;

Parse the project from CustomClass resource.

Parameter
NameDescription
customClassName string

A fully-qualified path representing CustomClass resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromLocationName(locationName)

matchProjectFromLocationName(locationName: string): string | number;

Parse the project from Location resource.

Parameter
NameDescription
locationName string

A fully-qualified path representing Location resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromPhraseSetName(phraseSetName)

matchProjectFromPhraseSetName(phraseSetName: string): string | number;

Parse the project from PhraseSet resource.

Parameter
NameDescription
phraseSetName string

A fully-qualified path representing PhraseSet resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromProjectName(projectName)

matchProjectFromProjectName(projectName: string): string | number;

Parse the project from Project resource.

Parameter
NameDescription
projectName string

A fully-qualified path representing Project resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromRecognizerName(recognizerName)

matchProjectFromRecognizerName(recognizerName: string): string | number;

Parse the project from Recognizer resource.

Parameter
NameDescription
recognizerName string

A fully-qualified path representing Recognizer resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchRecognizerFromRecognizerName(recognizerName)

matchRecognizerFromRecognizerName(recognizerName: string): string | number;

Parse the recognizer from Recognizer resource.

Parameter
NameDescription
recognizerName string

A fully-qualified path representing Recognizer resource.

Returns
TypeDescription
string | number

{string} A string representing the recognizer.

phraseSetPath(project, location, phraseSet)

phraseSetPath(project: string, location: string, phraseSet: string): string;

Return a fully-qualified phraseSet resource name string.

Parameters
NameDescription
project string
location string
phraseSet string
Returns
TypeDescription
string

{string} Resource name string.

projectPath(project)

projectPath(project: string): string;

Return a fully-qualified project resource name string.

Parameter
NameDescription
project string
Returns
TypeDescription
string

{string} Resource name string.

recognize(request, options)

recognize(request?: protos.google.cloud.speech.v2.IRecognizeRequest, options?: CallOptions): Promise<[
        protos.google.cloud.speech.v2.IRecognizeResponse,
        protos.google.cloud.speech.v2.IRecognizeRequest | undefined,
        {} | undefined
    ]>;

Performs synchronous Speech recognition: receive results after all audio has been sent and processed.

Parameters
NameDescription
request IRecognizeRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.speech.v2.IRecognizeResponse, protos.google.cloud.speech.v2.IRecognizeRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing RecognizeResponse. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the Recognizer to use during recognition. The
   *  expected format is
   *  `projects/{project}/locations/{location}/recognizers/{recognizer}`. The
   *  {recognizer} segment may be set to `_` to use an empty implicit Recognizer.
   */
  // const recognizer = 'abc123'
  /**
   *  Features and audio metadata to use for the Automatic Speech Recognition.
   *  This field in combination with the
   *  config_mask google.cloud.speech.v2.RecognizeRequest.config_mask  field
   *  can be used to override parts of the
   *  default_recognition_config google.cloud.speech.v2.Recognizer.default_recognition_config 
   *  of the Recognizer resource.
   */
  // const config = {}
  /**
   *  The list of fields in
   *  config google.cloud.speech.v2.RecognizeRequest.config  that override the
   *  values in the
   *  default_recognition_config google.cloud.speech.v2.Recognizer.default_recognition_config 
   *  of the recognizer during this recognition request. If no mask is provided,
   *  all non-default valued fields in
   *  config google.cloud.speech.v2.RecognizeRequest.config  override the
   *  values in the recognizer for this recognition request. If a mask is
   *  provided, only the fields listed in the mask override the config in the
   *  recognizer for this recognition request. If a wildcard (`*`) is provided,
   *  config google.cloud.speech.v2.RecognizeRequest.config  completely
   *  overrides and replaces the config in the recognizer for this recognition
   *  request.
   */
  // const configMask = {}
  /**
   *  The audio data bytes encoded as specified in
   *  RecognitionConfig google.cloud.speech.v2.RecognitionConfig. As
   *  with all bytes fields, proto buffers use a pure binary representation,
   *  whereas JSON representations use base64.
   */
  // const content = Buffer.from('string')
  /**
   *  URI that points to a file that contains audio data bytes as specified in
   *  RecognitionConfig google.cloud.speech.v2.RecognitionConfig. The file
   *  must not be compressed (for example, gzip). Currently, only Google Cloud
   *  Storage URIs are supported, which must be specified in the following
   *  format: `gs://bucket_name/object_name` (other URI formats return
   *  INVALID_ARGUMENT google.rpc.Code.INVALID_ARGUMENT). For more
   *  information, see Request
   *  URIs (https://cloud.google.com/storage/docs/reference-uris).
   */
  // const uri = 'abc123'

  // Imports the Speech library
  const {SpeechClient} = require('@google-cloud/speech').v2;

  // Instantiates a client
  const speechClient = new SpeechClient();

  async function callRecognize() {
    // Construct request
    const request = {
      recognizer,
    };

    // Run request
    const response = await speechClient.recognize(request);
    console.log(response);
  }

  callRecognize();

recognize(request, options, callback)

recognize(request: protos.google.cloud.speech.v2.IRecognizeRequest, options: CallOptions, callback: Callback<protos.google.cloud.speech.v2.IRecognizeResponse, protos.google.cloud.speech.v2.IRecognizeRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IRecognizeRequest
options CallOptions
callback Callback<protos.google.cloud.speech.v2.IRecognizeResponse, protos.google.cloud.speech.v2.IRecognizeRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

recognize(request, callback)

recognize(request: protos.google.cloud.speech.v2.IRecognizeRequest, callback: Callback<protos.google.cloud.speech.v2.IRecognizeResponse, protos.google.cloud.speech.v2.IRecognizeRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IRecognizeRequest
callback Callback<protos.google.cloud.speech.v2.IRecognizeResponse, protos.google.cloud.speech.v2.IRecognizeRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

recognizerPath(project, location, recognizer)

recognizerPath(project: string, location: string, recognizer: string): string;

Return a fully-qualified recognizer resource name string.

Parameters
NameDescription
project string
location string
recognizer string
Returns
TypeDescription
string

{string} Resource name string.

undeleteCustomClass(request, options)

undeleteCustomClass(request?: protos.google.cloud.speech.v2.IUndeleteCustomClassRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IOperationMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Undeletes the .

Parameters
NameDescription
request IUndeleteCustomClassRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise() method returns a promise you can await for. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the CustomClass to undelete.
   *  Format:
   *  `projects/{project}/locations/{location}/customClasses/{custom_class}`
   */
  // const name = 'abc123'
  /**
   *  If set, validate the request and preview the undeleted CustomClass, but do
   *  not actually undelete it.
   */
  // const validateOnly = true
  /**
   *  This checksum is computed by the server based on the value of other
   *  fields. This may be sent on update, undelete, and delete requests to ensure
   *  the client has an up-to-date value before proceeding.
   */
  // const etag = 'abc123'

  // Imports the Speech library
  const {SpeechClient} = require('@google-cloud/speech').v2;

  // Instantiates a client
  const speechClient = new SpeechClient();

  async function callUndeleteCustomClass() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const [operation] = await speechClient.undeleteCustomClass(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callUndeleteCustomClass();

undeleteCustomClass(request, options, callback)

undeleteCustomClass(request: protos.google.cloud.speech.v2.IUndeleteCustomClassRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IUndeleteCustomClassRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

undeleteCustomClass(request, callback)

undeleteCustomClass(request: protos.google.cloud.speech.v2.IUndeleteCustomClassRequest, callback: Callback<LROperation<protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IUndeleteCustomClassRequest
callback Callback<LROperation<protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

undeletePhraseSet(request, options)

undeletePhraseSet(request?: protos.google.cloud.speech.v2.IUndeletePhraseSetRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IOperationMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Undeletes the .

Parameters
NameDescription
request IUndeletePhraseSetRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise() method returns a promise you can await for. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the PhraseSet to undelete.
   *  Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`
   */
  // const name = 'abc123'
  /**
   *  If set, validate the request and preview the undeleted PhraseSet, but do
   *  not actually undelete it.
   */
  // const validateOnly = true
  /**
   *  This checksum is computed by the server based on the value of other
   *  fields. This may be sent on update, undelete, and delete requests to ensure
   *  the client has an up-to-date value before proceeding.
   */
  // const etag = 'abc123'

  // Imports the Speech library
  const {SpeechClient} = require('@google-cloud/speech').v2;

  // Instantiates a client
  const speechClient = new SpeechClient();

  async function callUndeletePhraseSet() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const [operation] = await speechClient.undeletePhraseSet(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callUndeletePhraseSet();

undeletePhraseSet(request, options, callback)

undeletePhraseSet(request: protos.google.cloud.speech.v2.IUndeletePhraseSetRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IUndeletePhraseSetRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

undeletePhraseSet(request, callback)

undeletePhraseSet(request: protos.google.cloud.speech.v2.IUndeletePhraseSetRequest, callback: Callback<LROperation<protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IUndeletePhraseSetRequest
callback Callback<LROperation<protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

undeleteRecognizer(request, options)

undeleteRecognizer(request?: protos.google.cloud.speech.v2.IUndeleteRecognizerRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IOperationMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Undeletes the .

Parameters
NameDescription
request IUndeleteRecognizerRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise() method returns a promise you can await for. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the Recognizer to undelete.
   *  Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`
   */
  // const name = 'abc123'
  /**
   *  If set, validate the request and preview the undeleted Recognizer, but do
   *  not actually undelete it.
   */
  // const validateOnly = true
  /**
   *  This checksum is computed by the server based on the value of other
   *  fields. This may be sent on update, undelete, and delete requests to ensure
   *  the client has an up-to-date value before proceeding.
   */
  // const etag = 'abc123'

  // Imports the Speech library
  const {SpeechClient} = require('@google-cloud/speech').v2;

  // Instantiates a client
  const speechClient = new SpeechClient();

  async function callUndeleteRecognizer() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const [operation] = await speechClient.undeleteRecognizer(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callUndeleteRecognizer();

undeleteRecognizer(request, options, callback)

undeleteRecognizer(request: protos.google.cloud.speech.v2.IUndeleteRecognizerRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IUndeleteRecognizerRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

undeleteRecognizer(request, callback)

undeleteRecognizer(request: protos.google.cloud.speech.v2.IUndeleteRecognizerRequest, callback: Callback<LROperation<protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IUndeleteRecognizerRequest
callback Callback<LROperation<protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

updateConfig(request, options)

updateConfig(request?: protos.google.cloud.speech.v2.IUpdateConfigRequest, options?: CallOptions): Promise<[
        protos.google.cloud.speech.v2.IConfig,
        protos.google.cloud.speech.v2.IUpdateConfigRequest | undefined,
        {} | undefined
    ]>;

Updates the Config.

Parameters
NameDescription
request IUpdateConfigRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.speech.v2.IConfig, protos.google.cloud.speech.v2.IUpdateConfigRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing Config. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The config to update.
   *  The config's `name` field is used to identify the config to be updated.
   *  The expected format is `projects/{project}/locations/{location}/config`.
   */
  // const config = {}
  /**
   *  The list of fields to be updated.
   */
  // const updateMask = {}

  // Imports the Speech library
  const {SpeechClient} = require('@google-cloud/speech').v2;

  // Instantiates a client
  const speechClient = new SpeechClient();

  async function callUpdateConfig() {
    // Construct request
    const request = {
      config,
    };

    // Run request
    const response = await speechClient.updateConfig(request);
    console.log(response);
  }

  callUpdateConfig();

updateConfig(request, options, callback)

updateConfig(request: protos.google.cloud.speech.v2.IUpdateConfigRequest, options: CallOptions, callback: Callback<protos.google.cloud.speech.v2.IConfig, protos.google.cloud.speech.v2.IUpdateConfigRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IUpdateConfigRequest
options CallOptions
callback Callback<protos.google.cloud.speech.v2.IConfig, protos.google.cloud.speech.v2.IUpdateConfigRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

updateConfig(request, callback)

updateConfig(request: protos.google.cloud.speech.v2.IUpdateConfigRequest, callback: Callback<protos.google.cloud.speech.v2.IConfig, protos.google.cloud.speech.v2.IUpdateConfigRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IUpdateConfigRequest
callback Callback<protos.google.cloud.speech.v2.IConfig, protos.google.cloud.speech.v2.IUpdateConfigRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

updateCustomClass(request, options)

updateCustomClass(request?: protos.google.cloud.speech.v2.IUpdateCustomClassRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IOperationMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Updates the .

Parameters
NameDescription
request IUpdateCustomClassRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise() method returns a promise you can await for. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The CustomClass to update.
   *  The CustomClass's `name` field is used to identify the CustomClass to
   *  update. Format:
   *  `projects/{project}/locations/{location}/customClasses/{custom_class}`.
   */
  // const customClass = {}
  /**
   *  The list of fields to be updated. If empty, all fields are considered for
   *  update.
   */
  // const updateMask = {}
  /**
   *  If set, validate the request and preview the updated CustomClass, but do
   *  not actually update it.
   */
  // const validateOnly = true

  // Imports the Speech library
  const {SpeechClient} = require('@google-cloud/speech').v2;

  // Instantiates a client
  const speechClient = new SpeechClient();

  async function callUpdateCustomClass() {
    // Construct request
    const request = {
      customClass,
    };

    // Run request
    const [operation] = await speechClient.updateCustomClass(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callUpdateCustomClass();

updateCustomClass(request, options, callback)

updateCustomClass(request: protos.google.cloud.speech.v2.IUpdateCustomClassRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IUpdateCustomClassRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

updateCustomClass(request, callback)

updateCustomClass(request: protos.google.cloud.speech.v2.IUpdateCustomClassRequest, callback: Callback<LROperation<protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IUpdateCustomClassRequest
callback Callback<LROperation<protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

updatePhraseSet(request, options)

updatePhraseSet(request?: protos.google.cloud.speech.v2.IUpdatePhraseSetRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IOperationMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Updates the .

Parameters
NameDescription
request IUpdatePhraseSetRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise() method returns a promise you can await for. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The PhraseSet to update.
   *  The PhraseSet's `name` field is used to identify the PhraseSet to update.
   *  Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
   */
  // const phraseSet = {}
  /**
   *  The list of fields to update. If empty, all non-default valued fields are
   *  considered for update. Use `*` to update the entire PhraseSet resource.
   */
  // const updateMask = {}
  /**
   *  If set, validate the request and preview the updated PhraseSet, but do not
   *  actually update it.
   */
  // const validateOnly = true

  // Imports the Speech library
  const {SpeechClient} = require('@google-cloud/speech').v2;

  // Instantiates a client
  const speechClient = new SpeechClient();

  async function callUpdatePhraseSet() {
    // Construct request
    const request = {
      phraseSet,
    };

    // Run request
    const [operation] = await speechClient.updatePhraseSet(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callUpdatePhraseSet();

updatePhraseSet(request, options, callback)

updatePhraseSet(request: protos.google.cloud.speech.v2.IUpdatePhraseSetRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IUpdatePhraseSetRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

updatePhraseSet(request, callback)

updatePhraseSet(request: protos.google.cloud.speech.v2.IUpdatePhraseSetRequest, callback: Callback<LROperation<protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IUpdatePhraseSetRequest
callback Callback<LROperation<protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

updateRecognizer(request, options)

updateRecognizer(request?: protos.google.cloud.speech.v2.IUpdateRecognizerRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IOperationMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Updates the .

Parameters
NameDescription
request IUpdateRecognizerRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise() method returns a promise you can await for. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The Recognizer to update.
   *  The Recognizer's `name` field is used to identify the Recognizer to update.
   *  Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`.
   */
  // const recognizer = {}
  /**
   *  The list of fields to update. If empty, all non-default valued fields are
   *  considered for update. Use `*` to update the entire Recognizer resource.
   */
  // const updateMask = {}
  /**
   *  If set, validate the request and preview the updated Recognizer, but do not
   *  actually update it.
   */
  // const validateOnly = true

  // Imports the Speech library
  const {SpeechClient} = require('@google-cloud/speech').v2;

  // Instantiates a client
  const speechClient = new SpeechClient();

  async function callUpdateRecognizer() {
    // Construct request
    const request = {
      recognizer,
    };

    // Run request
    const [operation] = await speechClient.updateRecognizer(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callUpdateRecognizer();

updateRecognizer(request, options, callback)

updateRecognizer(request: protos.google.cloud.speech.v2.IUpdateRecognizerRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IUpdateRecognizerRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

updateRecognizer(request, callback)

updateRecognizer(request: protos.google.cloud.speech.v2.IUpdateRecognizerRequest, callback: Callback<LROperation<protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IUpdateRecognizerRequest
callback Callback<LROperation<protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IOperationMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void