Class v1.AdaptationClient (5.3.1)

Service that implements Google Cloud Speech Adaptation API. v1

Package

@google-cloud/speech

Constructors

(constructor)(opts, gaxInstance)

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

Construct an instance of AdaptationClient.

Parameters
NameDescription
opts ClientOptions
gaxInstance typeof gax | typeof gax.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 AdaptationClient({fallback: 'rest'}, gax); ```

Properties

adaptationStub

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

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;
    };

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.

warn

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

Methods

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.

createCustomClass(request, options)

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

Create a custom class.

Parameters
NameDescription
request protos.google.cloud.speech.v1.ICreateCustomClassRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

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

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) 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 parent resource where this custom class will be created.
   *  Format:
   *  `projects/{project}/locations/{location}/customClasses`
   *  Speech-to-Text supports three locations: `global`, `us` (US North America),
   *  and `eu` (Europe). If you are calling the `speech.googleapis.com`
   *  endpoint, use the `global` location. To specify a region, use a
   *  regional endpoint (https://cloud.google.com/speech-to-text/docs/endpoints)
   *  with matching `us` or `eu` location value.
   */
  // const parent = 'abc123'
  /**
   *  Required. The ID to use for the custom class, which will become the final
   *  component of the custom class' resource name.
   *  This value should restrict to letters, numbers, and hyphens, with the first
   *  character a letter, the last a letter or a number, and be 4-63 characters.
   */
  // const customClassId = 'abc123'
  /**
   *  Required. The custom class to create.
   */
  // const customClass = {}

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

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

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

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

  callCreateCustomClass();

createCustomClass(request, options, callback)

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

createCustomClass(request, callback)

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

createPhraseSet(request, options)

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

Create a set of phrase hints. Each item in the set can be a single word or a multi-word phrase. The items in the PhraseSet are favored by the recognition model when you send a call that includes the PhraseSet.

Parameters
NameDescription
request protos.google.cloud.speech.v1.ICreatePhraseSetRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

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

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) 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 parent resource where this phrase set will be created.
   *  Format:
   *  `projects/{project}/locations/{location}/phraseSets`
   *  Speech-to-Text supports three locations: `global`, `us` (US North America),
   *  and `eu` (Europe). If you are calling the `speech.googleapis.com`
   *  endpoint, use the `global` location. To specify a region, use a
   *  regional endpoint (https://cloud.google.com/speech-to-text/docs/endpoints)
   *  with matching `us` or `eu` location value.
   */
  // const parent = 'abc123'
  /**
   *  Required. The ID to use for the phrase set, which will become the final
   *  component of the phrase set's resource name.
   *  This value should restrict to letters, numbers, and hyphens, with the first
   *  character a letter, the last a letter or a number, and be 4-63 characters.
   */
  // const phraseSetId = 'abc123'
  /**
   *  Required. The phrase set to create.
   */
  // const phraseSet = {}

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

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

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

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

  callCreatePhraseSet();

createPhraseSet(request, options, callback)

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

createPhraseSet(request, callback)

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

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.v1.IDeleteCustomClassRequest, options?: CallOptions): Promise<[
        protos.google.protobuf.IEmpty,
        protos.google.cloud.speech.v1.IDeleteCustomClassRequest | undefined,
        {} | undefined
    ]>;

Delete a custom class.

Parameters
NameDescription
request protos.google.cloud.speech.v1.IDeleteCustomClassRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.protobuf.IEmpty, protos.google.cloud.speech.v1.IDeleteCustomClassRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) 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 custom class to delete. Format:
   *  `projects/{project}/locations/{location}/customClasses/{custom_class}`
   *  Speech-to-Text supports three locations: `global`, `us` (US North America),
   *  and `eu` (Europe). If you are calling the `speech.googleapis.com`
   *  endpoint, use the `global` location. To specify a region, use a
   *  regional endpoint (https://cloud.google.com/speech-to-text/docs/endpoints)
   *  with matching `us` or `eu` location value.
   */
  // const name = 'abc123'

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

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

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

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

  callDeleteCustomClass();

deleteCustomClass(request, options, callback)

deleteCustomClass(request: protos.google.cloud.speech.v1.IDeleteCustomClassRequest, options: CallOptions, callback: Callback<protos.google.protobuf.IEmpty, protos.google.cloud.speech.v1.IDeleteCustomClassRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.speech.v1.IDeleteCustomClassRequest
options CallOptions
callback Callback<protos.google.protobuf.IEmpty, protos.google.cloud.speech.v1.IDeleteCustomClassRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

deleteCustomClass(request, callback)

deleteCustomClass(request: protos.google.cloud.speech.v1.IDeleteCustomClassRequest, callback: Callback<protos.google.protobuf.IEmpty, protos.google.cloud.speech.v1.IDeleteCustomClassRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.speech.v1.IDeleteCustomClassRequest
callback Callback<protos.google.protobuf.IEmpty, protos.google.cloud.speech.v1.IDeleteCustomClassRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

deletePhraseSet(request, options)

deletePhraseSet(request?: protos.google.cloud.speech.v1.IDeletePhraseSetRequest, options?: CallOptions): Promise<[
        protos.google.protobuf.IEmpty,
        protos.google.cloud.speech.v1.IDeletePhraseSetRequest | undefined,
        {} | undefined
    ]>;

Delete a phrase set.

Parameters
NameDescription
request protos.google.cloud.speech.v1.IDeletePhraseSetRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.protobuf.IEmpty, protos.google.cloud.speech.v1.IDeletePhraseSetRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) 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 phrase set to delete. Format:
   *  `projects/{project}/locations/{location}/phraseSets/{phrase_set}`
   */
  // const name = 'abc123'

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

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

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

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

  callDeletePhraseSet();

deletePhraseSet(request, options, callback)

deletePhraseSet(request: protos.google.cloud.speech.v1.IDeletePhraseSetRequest, options: CallOptions, callback: Callback<protos.google.protobuf.IEmpty, protos.google.cloud.speech.v1.IDeletePhraseSetRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.speech.v1.IDeletePhraseSetRequest
options CallOptions
callback Callback<protos.google.protobuf.IEmpty, protos.google.cloud.speech.v1.IDeletePhraseSetRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

deletePhraseSet(request, callback)

deletePhraseSet(request: protos.google.cloud.speech.v1.IDeletePhraseSetRequest, callback: Callback<protos.google.protobuf.IEmpty, protos.google.cloud.speech.v1.IDeletePhraseSetRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.speech.v1.IDeletePhraseSetRequest
callback Callback<protos.google.protobuf.IEmpty, protos.google.cloud.speech.v1.IDeletePhraseSetRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getCustomClass(request, options)

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

Get a custom class.

Parameters
NameDescription
request protos.google.cloud.speech.v1.IGetCustomClassRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.speech.v1.ICustomClass, protos.google.cloud.speech.v1.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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) 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 custom class to retrieve. Format:
   *  `projects/{project}/locations/{location}/customClasses/{custom_class}`
   */
  // const name = 'abc123'

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

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

  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.v1.IGetCustomClassRequest, options: CallOptions, callback: Callback<protos.google.cloud.speech.v1.ICustomClass, protos.google.cloud.speech.v1.IGetCustomClassRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.speech.v1.IGetCustomClassRequest
options CallOptions
callback Callback<protos.google.cloud.speech.v1.ICustomClass, protos.google.cloud.speech.v1.IGetCustomClassRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getCustomClass(request, callback)

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

getPhraseSet(request, options)

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

Get a phrase set.

Parameters
NameDescription
request protos.google.cloud.speech.v1.IGetPhraseSetRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.speech.v1.IPhraseSet, protos.google.cloud.speech.v1.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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) 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 phrase set to retrieve. Format:
   *  `projects/{project}/locations/{location}/phraseSets/{phrase_set}`
   *  Speech-to-Text supports three locations: `global`, `us` (US North America),
   *  and `eu` (Europe). If you are calling the `speech.googleapis.com`
   *  endpoint, use the `global` location. To specify a region, use a
   *  regional endpoint (https://cloud.google.com/speech-to-text/docs/endpoints)
   *  with matching `us` or `eu` location value.
   */
  // const name = 'abc123'

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

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

  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.v1.IGetPhraseSetRequest, options: CallOptions, callback: Callback<protos.google.cloud.speech.v1.IPhraseSet, protos.google.cloud.speech.v1.IGetPhraseSetRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.speech.v1.IGetPhraseSetRequest
options CallOptions
callback Callback<protos.google.cloud.speech.v1.IPhraseSet, protos.google.cloud.speech.v1.IGetPhraseSetRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getPhraseSet(request, callback)

getPhraseSet(request: protos.google.cloud.speech.v1.IGetPhraseSetRequest, callback: Callback<protos.google.cloud.speech.v1.IPhraseSet, protos.google.cloud.speech.v1.IGetPhraseSetRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.speech.v1.IGetPhraseSetRequest
callback Callback<protos.google.cloud.speech.v1.IPhraseSet, protos.google.cloud.speech.v1.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

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.v1.IListCustomClassesRequest, options?: CallOptions): Promise<[
        protos.google.cloud.speech.v1.ICustomClass[],
        protos.google.cloud.speech.v1.IListCustomClassesRequest | null,
        protos.google.cloud.speech.v1.IListCustomClassesResponse
    ]>;

List custom classes.

Parameters
NameDescription
request protos.google.cloud.speech.v1.IListCustomClassesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.speech.v1.ICustomClass[], protos.google.cloud.speech.v1.IListCustomClassesRequest | null, protos.google.cloud.speech.v1.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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

listCustomClasses(request, options, callback)

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

listCustomClasses(request, callback)

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

listCustomClassesAsync(request, options)

listCustomClassesAsync(request?: protos.google.cloud.speech.v1.IListCustomClassesRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.speech.v1.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 protos.google.cloud.speech.v1.IListCustomClassesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

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

{Object} An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). 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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) 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 parent, which owns this collection of custom classes. Format:
   *  `projects/{project}/locations/{location}/customClasses`
   *  Speech-to-Text supports three locations: `global`, `us` (US North America),
   *  and `eu` (Europe). If you are calling the `speech.googleapis.com`
   *  endpoint, use the `global` location. To specify a region, use a
   *  regional endpoint (https://cloud.google.com/speech-to-text/docs/endpoints)
   *  with matching `us` or `eu` location value.
   */
  // const parent = 'abc123'
  /**
   *  The maximum number of custom classes to return. The service may return
   *  fewer than this value. If unspecified, at most 50 custom classes will be
   *  returned. The maximum value is 1000; values above 1000 will be coerced to
   *  1000.
   */
  // const pageSize = 1234
  /**
   *  A page token, received from a previous `ListCustomClass` call.
   *  Provide this to retrieve the subsequent page.
   *  When paginating, all other parameters provided to `ListCustomClass` must
   *  match the call that provided the page token.
   */
  // const pageToken = 'abc123'

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

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

  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.v1.IListCustomClassesRequest, options?: CallOptions): Transform;

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

Parameters
NameDescription
request protos.google.cloud.speech.v1.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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

listPhraseSet(request, options)

listPhraseSet(request?: protos.google.cloud.speech.v1.IListPhraseSetRequest, options?: CallOptions): Promise<[
        protos.google.cloud.speech.v1.IPhraseSet[],
        protos.google.cloud.speech.v1.IListPhraseSetRequest | null,
        protos.google.cloud.speech.v1.IListPhraseSetResponse
    ]>;

List phrase sets.

Parameters
NameDescription
request protos.google.cloud.speech.v1.IListPhraseSetRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.speech.v1.IPhraseSet[], protos.google.cloud.speech.v1.IListPhraseSetRequest | null, protos.google.cloud.speech.v1.IListPhraseSetResponse ]>

{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 listPhraseSetAsync() method described below for async iteration which you can stop as needed. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

listPhraseSet(request, options, callback)

listPhraseSet(request: protos.google.cloud.speech.v1.IListPhraseSetRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.speech.v1.IListPhraseSetRequest, protos.google.cloud.speech.v1.IListPhraseSetResponse | null | undefined, protos.google.cloud.speech.v1.IPhraseSet>): void;
Parameters
NameDescription
request protos.google.cloud.speech.v1.IListPhraseSetRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.speech.v1.IListPhraseSetRequest, protos.google.cloud.speech.v1.IListPhraseSetResponse | null | undefined, protos.google.cloud.speech.v1.IPhraseSet>
Returns
TypeDescription
void

listPhraseSet(request, callback)

listPhraseSet(request: protos.google.cloud.speech.v1.IListPhraseSetRequest, callback: PaginationCallback<protos.google.cloud.speech.v1.IListPhraseSetRequest, protos.google.cloud.speech.v1.IListPhraseSetResponse | null | undefined, protos.google.cloud.speech.v1.IPhraseSet>): void;
Parameters
NameDescription
request protos.google.cloud.speech.v1.IListPhraseSetRequest
callback PaginationCallback<protos.google.cloud.speech.v1.IListPhraseSetRequest, protos.google.cloud.speech.v1.IListPhraseSetResponse | null | undefined, protos.google.cloud.speech.v1.IPhraseSet>
Returns
TypeDescription
void

listPhraseSetAsync(request, options)

listPhraseSetAsync(request?: protos.google.cloud.speech.v1.IListPhraseSetRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.speech.v1.IPhraseSet>;

Equivalent to listPhraseSet, but returns an iterable object.

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

Parameters
NameDescription
request protos.google.cloud.speech.v1.IListPhraseSetRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

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

{Object} An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). 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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) 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 parent, which owns this collection of phrase set. Format:
   *  `projects/{project}/locations/{location}`
   *  Speech-to-Text supports three locations: `global`, `us` (US North America),
   *  and `eu` (Europe). If you are calling the `speech.googleapis.com`
   *  endpoint, use the `global` location. To specify a region, use a
   *  regional endpoint (https://cloud.google.com/speech-to-text/docs/endpoints)
   *  with matching `us` or `eu` location value.
   */
  // const parent = 'abc123'
  /**
   *  The maximum number of phrase sets to return. The service may return
   *  fewer than this value. If unspecified, at most 50 phrase sets will be
   *  returned. The maximum value is 1000; values above 1000 will be coerced to
   *  1000.
   */
  // const pageSize = 1234
  /**
   *  A page token, received from a previous `ListPhraseSet` call.
   *  Provide this to retrieve the subsequent page.
   *  When paginating, all other parameters provided to `ListPhraseSet` must
   *  match the call that provided the page token.
   */
  // const pageToken = 'abc123'

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

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

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

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

  callListPhraseSet();

listPhraseSetStream(request, options)

listPhraseSetStream(request?: protos.google.cloud.speech.v1.IListPhraseSetRequest, options?: CallOptions): Transform;

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

Parameters
NameDescription
request protos.google.cloud.speech.v1.IListPhraseSetRequest

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 listPhraseSetAsync() method described below for async iteration which you can stop as needed. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) 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.

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.

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.

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.

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.

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.

updateCustomClass(request, options)

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

Update a custom class.

Parameters
NameDescription
request protos.google.cloud.speech.v1.IUpdateCustomClassRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

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

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) 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 custom class to update.
   *  The custom class's `name` field is used to identify the custom class to be
   *  updated. Format:
   *  `projects/{project}/locations/{location}/customClasses/{custom_class}`
   *  Speech-to-Text supports three locations: `global`, `us` (US North America),
   *  and `eu` (Europe). If you are calling the `speech.googleapis.com`
   *  endpoint, use the `global` location. To specify a region, use a
   *  regional endpoint (https://cloud.google.com/speech-to-text/docs/endpoints)
   *  with matching `us` or `eu` location value.
   */
  // const customClass = {}
  /**
   *  The list of fields to be updated.
   */
  // const updateMask = {}

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

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

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

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

  callUpdateCustomClass();

updateCustomClass(request, options, callback)

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

updateCustomClass(request, callback)

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

updatePhraseSet(request, options)

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

Update a phrase set.

Parameters
NameDescription
request protos.google.cloud.speech.v1.IUpdatePhraseSetRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

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

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) 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 phrase set to update.
   *  The phrase set's `name` field is used to identify the set to be
   *  updated. Format:
   *  `projects/{project}/locations/{location}/phraseSets/{phrase_set}`
   *  Speech-to-Text supports three locations: `global`, `us` (US North America),
   *  and `eu` (Europe). If you are calling the `speech.googleapis.com`
   *  endpoint, use the `global` location. To specify a region, use a
   *  regional endpoint (https://cloud.google.com/speech-to-text/docs/endpoints)
   *  with matching `us` or `eu` location value.
   */
  // const phraseSet = {}
  /**
   *  The list of fields to be updated.
   */
  // const updateMask = {}

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

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

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

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

  callUpdatePhraseSet();

updatePhraseSet(request, options, callback)

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

updatePhraseSet(request, callback)

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