Class v1.AdaptationClient (6.6.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
Name
Description
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 AdaptationClient({fallback: true}, gax); ```

Properties

adaptationStub

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

apiEndpoint

  get 
  
 apiEndpoint 
 () 
 : 
  
 string 
 ; 
 

The DNS address for this API service.

apiEndpoint

  static 
  
 get 
  
 apiEndpoint 
 () 
 : 
  
 string 
 ; 
 

The DNS address for this API service - same as servicePath.

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.

universeDomain

  get 
  
 universeDomain 
 () 
 : 
  
 string 
 ; 
 

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
Type
Description
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
Name
Description
request
ICreateCustomClassRequest

The request object that will be sent.

options
CallOptions

Call options. See CallOptions for more details.

Returns
Type
Description

{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 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
Name
Description
options
CallOptions
callback
Returns
Type
Description
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
Name
Description
callback
Returns
Type
Description
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
Name
Description
request
ICreatePhraseSetRequest

The request object that will be sent.

options
CallOptions

Call options. See CallOptions for more details.

Returns
Type
Description

{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 parent resource where this phrase set will be created. 
 *  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' 
  
 /** 
 *  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
Name
Description
options
CallOptions
callback
Returns
Type
Description
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
Name
Description
callback
Returns
Type
Description
void

customClassPath(project, location, customClass)

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

Return a fully-qualified customClass resource name string.

Parameters
Name
Description
project
string
location
string
customClass
string
Returns
Type
Description
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
Name
Description
request
IDeleteCustomClassRequest

The request object that will be sent.

options
CallOptions

Call options. See CallOptions for more details.

Returns
Type
Description

{Promise} - The promise which resolves to an array. The first element of the array is an object representing Empty . 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 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
Name
Description
options
CallOptions
callback
Callback < protos.google.protobuf.IEmpty , protos.google.cloud.speech.v1.IDeleteCustomClassRequest | null | undefined, {} | null | undefined>
Returns
Type
Description
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
Name
Description
callback
Callback < protos.google.protobuf.IEmpty , protos.google.cloud.speech.v1.IDeleteCustomClassRequest | null | undefined, {} | null | undefined>
Returns
Type
Description
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
Name
Description
request
IDeletePhraseSetRequest

The request object that will be sent.

options
CallOptions

Call options. See CallOptions for more details.

Returns
Type
Description

{Promise} - The promise which resolves to an array. The first element of the array is an object representing Empty . 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 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
Name
Description
options
CallOptions
callback
Callback < protos.google.protobuf.IEmpty , protos.google.cloud.speech.v1.IDeletePhraseSetRequest | null | undefined, {} | null | undefined>
Returns
Type
Description
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
Name
Description
callback
Callback < protos.google.protobuf.IEmpty , protos.google.cloud.speech.v1.IDeletePhraseSetRequest | null | undefined, {} | null | undefined>
Returns
Type
Description
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
Name
Description
request
IGetCustomClassRequest

The request object that will be sent.

options
CallOptions

Call options. See CallOptions for more details.

Returns
Type
Description

{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 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
Name
Description
options
CallOptions
callback
Returns
Type
Description
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
Name
Description
callback
Returns
Type
Description
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
Name
Description
request
IGetPhraseSetRequest

The request object that will be sent.

options
CallOptions

Call options. See CallOptions for more details.

Returns
Type
Description

{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 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
Name
Description
options
CallOptions
callback
Returns
Type
Description
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
Name
Description
callback
Returns
Type
Description
void

getProjectId()

  getProjectId 
 () 
 : 
  
 Promise<string> 
 ; 
 
Returns
Type
Description
Promise <string>

getProjectId(callback)

  getProjectId 
 ( 
 callback 
 : 
  
 Callback<string 
 , 
  
 undefined 
 , 
  
 undefined 
> ) 
 : 
  
 void 
 ; 
 
Parameter
Name
Description
callback
Callback <string, undefined, undefined>
Returns
Type
Description
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
Type
Description
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
Name
Description
request
IListCustomClassesRequest

The request object that will be sent.

options
CallOptions

Call options. See CallOptions for more details.

Returns
Type
Description

{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 
 . 
 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 
 ; 
 
Returns
Type
Description
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 
 ; 
 
Returns
Type
Description
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
Name
Description
request
IListCustomClassesRequest

The request object that will be sent.

options
CallOptions

Call options. See CallOptions for more details.

Returns
Type
Description

{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 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 
  
 = 
  
 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
Name
Description
request
IListCustomClassesRequest

The request object that will be sent.

options
CallOptions

Call options. See CallOptions for more details.

Returns
Type
Description
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.

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
Name
Description
request
IListPhraseSetRequest

The request object that will be sent.

options
CallOptions

Call options. See CallOptions for more details.

Returns
Type
Description

{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 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
Name
Description
options
CallOptions
Returns
Type
Description
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 
 ; 
 
Returns
Type
Description
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
Name
Description
request
IListPhraseSetRequest

The request object that will be sent.

options
CallOptions

Call options. See CallOptions for more details.

Returns
Type
Description

{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 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 
  
 = 
  
 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
Name
Description
request
IListPhraseSetRequest

The request object that will be sent.

options
CallOptions

Call options. See CallOptions for more details.

Returns
Type
Description
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 for more details and examples.

locationPath(project, location)

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

Return a fully-qualified location resource name string.

Parameters
Name
Description
project
string
location
string
Returns
Type
Description
string

{string} Resource name string.

matchCustomClassFromCustomClassName(customClassName)

  matchCustomClassFromCustomClassName 
 ( 
 customClassName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the custom_class from CustomClass resource.

Parameter
Name
Description
customClassName
string

A fully-qualified path representing CustomClass resource.

Returns
Type
Description
string | number

{string} A string representing the custom_class.

matchLocationFromCustomClassName(customClassName)

  matchLocationFromCustomClassName 
 ( 
 customClassName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the location from CustomClass resource.

Parameter
Name
Description
customClassName
string

A fully-qualified path representing CustomClass resource.

Returns
Type
Description
string | number

{string} A string representing the location.

matchLocationFromLocationName(locationName)

  matchLocationFromLocationName 
 ( 
 locationName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the location from Location resource.

Parameter
Name
Description
locationName
string

A fully-qualified path representing Location resource.

Returns
Type
Description
string | number

{string} A string representing the location.

matchLocationFromPhraseSetName(phraseSetName)

  matchLocationFromPhraseSetName 
 ( 
 phraseSetName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the location from PhraseSet resource.

Parameter
Name
Description
phraseSetName
string

A fully-qualified path representing PhraseSet resource.

Returns
Type
Description
string | number

{string} A string representing the location.

matchPhraseSetFromPhraseSetName(phraseSetName)

  matchPhraseSetFromPhraseSetName 
 ( 
 phraseSetName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the phrase_set from PhraseSet resource.

Parameter
Name
Description
phraseSetName
string

A fully-qualified path representing PhraseSet resource.

Returns
Type
Description
string | number

{string} A string representing the phrase_set.

matchProjectFromCustomClassName(customClassName)

  matchProjectFromCustomClassName 
 ( 
 customClassName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the project from CustomClass resource.

Parameter
Name
Description
customClassName
string

A fully-qualified path representing CustomClass resource.

Returns
Type
Description
string | number

{string} A string representing the project.

matchProjectFromLocationName(locationName)

  matchProjectFromLocationName 
 ( 
 locationName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the project from Location resource.

Parameter
Name
Description
locationName
string

A fully-qualified path representing Location resource.

Returns
Type
Description
string | number

{string} A string representing the project.

matchProjectFromPhraseSetName(phraseSetName)

  matchProjectFromPhraseSetName 
 ( 
 phraseSetName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the project from PhraseSet resource.

Parameter
Name
Description
phraseSetName
string

A fully-qualified path representing PhraseSet resource.

Returns
Type
Description
string | number

{string} A string representing the project.

matchProjectFromProjectName(projectName)

  matchProjectFromProjectName 
 ( 
 projectName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the project from Project resource.

Parameter
Name
Description
projectName
string

A fully-qualified path representing Project resource.

Returns
Type
Description
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
Name
Description
project
string
location
string
phraseSet
string
Returns
Type
Description
string

{string} Resource name string.

projectPath(project)

  projectPath 
 ( 
 project 
 : 
  
 string 
 ) 
 : 
  
 string 
 ; 
 

Return a fully-qualified project resource name string.

Parameter
Name
Description
project
string
Returns
Type
Description
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
Name
Description
request
IUpdateCustomClassRequest

The request object that will be sent.

options
CallOptions

Call options. See CallOptions for more details.

Returns
Type
Description

{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 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
Name
Description
options
CallOptions
callback
Returns
Type
Description
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
Name
Description
callback
Returns
Type
Description
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
Name
Description
request
IUpdatePhraseSetRequest

The request object that will be sent.

options
CallOptions

Call options. See CallOptions for more details.

Returns
Type
Description

{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 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
Name
Description
options
CallOptions
callback
Returns
Type
Description
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
Name
Description
callback
Returns
Type
Description
void
Design a Mobile Site
View Site in Mobile | Classic
Share by: