Constructor
new SpeechClient(optionsopt, gaxInstanceopt)
Construct an instance of SpeechClient.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
<optional> |
The configuration object. The options accepted by the constructor are described in detail in this document. The common options are: Properties
|
||||||||||||||||||||||||||||||||||||||||||||||||
gaxInstance |
gax |
<optional> |
loaded instance of |
Members
apiEndpoint
The DNS address for this API service.
apiEndpoint
The DNS address for this API service - same as servicePath.
port
The port for this API service.
scopes
The scopes needed to make gRPC calls for every method defined in this service.
servicePath
The DNS address for this API service.
Methods
_streamingRecognize(optionsopt) → {Stream}
Performs bidirectional streaming speech recognition: receive results while sending audio. This method is only available via the gRPC API (not REST).
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
options |
object |
<optional> |
Call options. See CallOptions for more details. |
Returns:
Type | Description |
---|---|
Stream |
An object stream which is both readable and writable. It accepts objects representing StreamingRecognizeRequest for write() method, and will emit objects representing StreamingRecognizeResponse on 'data' event asynchronously. Please see the documentation for more details and examples. |
Example
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The name of the Recognizer to use during recognition. The
* expected format is
* `projects/{project}/locations/{location}/recognizers/{recognizer}`. The
* {recognizer} segment may be set to `_` to use an empty implicit Recognizer.
*/
// const recognizer = 'abc123'
/**
* StreamingRecognitionConfig to be used in this recognition attempt.
* If provided, it will override the default RecognitionConfig stored in the
* Recognizer.
*/
// const streamingConfig = {}
/**
* Inline audio bytes to be Recognized.
* Maximum size for this field is 15 KB per request.
*/
// const audio = Buffer.from('string')
// Imports the Speech library
const {SpeechClient} = require('@google-cloud/speech').v2;
// Instantiates a client
const speechClient = new SpeechClient();
async function callStreamingRecognize() {
// Construct request
const request = {
recognizer,
};
// Run request
const stream = await speechClient.streamingRecognize();
stream.on('data', (response) => { console.log(response) });
stream.on('error', (err) => { throw(err) });
stream.on('end', () => { /* API call completed */ });
stream.write(request);
stream.end();
}
callStreamingRecognize();
cancelOperation(request, optionsopt, callbackopt) → {Promise}
Starts asynchronous cancellation on a long-running operation. The server
makes a best effort to cancel the operation, but success is not
guaranteed. If the server doesn't support this method, it returns
google.rpc.Code.UNIMPLEMENTED
. Clients can use
Operations.GetOperation or
other methods to check whether the cancellation succeeded or whether the
operation completed despite cancellation. On successful cancellation,
the operation is not deleted; instead, it becomes an operation with
an Operation.error value with a google.rpc.Status.code of
1, corresponding to Code.CANCELLED
.
Parameters:
Name | Type | Attributes | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||
options |
Object |
<optional> |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||
callback |
function |
<optional> |
The function which will be called with the result of the API call. |
Returns:
Type | Description |
---|---|
Promise |
|
Example
```
const client = longrunning.operationsClient();
await client.cancelOperation({name: ''});
```
(async) checkBatchRecognizeProgress(name) → {Promise}
Check the status of the long running operation returned by batchRecognize()
.
Parameters:
Name | Type | Description |
---|---|---|
name |
String |
The operation name that will be passed. |
Returns:
Type | Description |
---|---|
Promise |
|
Example
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The name of the Recognizer to use during recognition. The
* expected format is
* `projects/{project}/locations/{location}/recognizers/{recognizer}`. The
* {recognizer} segment may be set to `_` to use an empty implicit Recognizer.
*/
// const recognizer = 'abc123'
/**
* Features and audio metadata to use for the Automatic Speech Recognition.
* This field in combination with the
* config_mask google.cloud.speech.v2.BatchRecognizeRequest.config_mask
* field can be used to override parts of the
* default_recognition_config google.cloud.speech.v2.Recognizer.default_recognition_config
* of the Recognizer resource.
*/
// const config = {}
/**
* The list of fields in
* config google.cloud.speech.v2.BatchRecognizeRequest.config that override
* the values in the
* default_recognition_config google.cloud.speech.v2.Recognizer.default_recognition_config
* of the recognizer during this recognition request. If no mask is provided,
* all given fields in
* config google.cloud.speech.v2.BatchRecognizeRequest.config override the
* values in the recognizer for this recognition request. If a mask is
* provided, only the fields listed in the mask override the config in the
* recognizer for this recognition request. If a wildcard (`*`) is provided,
* config google.cloud.speech.v2.BatchRecognizeRequest.config completely
* overrides and replaces the config in the recognizer for this recognition
* request.
*/
// const configMask = {}
/**
* Audio files with file metadata for ASR.
* The maximum number of files allowed to be specified is 5.
*/
// const files = [1,2,3,4]
/**
* Configuration options for where to output the transcripts of each file.
*/
// const recognitionOutputConfig = {}
/**
* Processing strategy to use for this request.
*/
// const processingStrategy = {}
// Imports the Speech library
const {SpeechClient} = require('@google-cloud/speech').v2;
// Instantiates a client
const speechClient = new SpeechClient();
async function callBatchRecognize() {
// Construct request
const request = {
recognizer,
};
// Run request
const [operation] = await speechClient.batchRecognize(request);
const [response] = await operation.promise();
console.log(response);
}
callBatchRecognize();
(async) checkCreateCustomClassProgress(name) → {Promise}
Check the status of the long running operation returned by createCustomClass()
.
Parameters:
Name | Type | Description |
---|---|---|
name |
String |
The operation name that will be passed. |
Returns:
Type | Description |
---|---|
Promise |
|
Example
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The CustomClass to create.
*/
// const customClass = {}
/**
* If set, validate the request and preview the CustomClass, but do not
* actually create it.
*/
// const validateOnly = true
/**
* The ID to use for the CustomClass, which will become the final component of
* the CustomClass's resource name.
* This value should be 4-63 characters, and valid characters
* are /[a-z][0-9]-/.
*/
// const customClassId = 'abc123'
/**
* Required. The project and location where this CustomClass will be created.
* The expected format is `projects/{project}/locations/{location}`.
*/
// const parent = 'abc123'
// Imports the Speech library
const {SpeechClient} = require('@google-cloud/speech').v2;
// Instantiates a client
const speechClient = new SpeechClient();
async function callCreateCustomClass() {
// Construct request
const request = {
customClass,
parent,
};
// Run request
const [operation] = await speechClient.createCustomClass(request);
const [response] = await operation.promise();
console.log(response);
}
callCreateCustomClass();
(async) checkCreatePhraseSetProgress(name) → {Promise}
Check the status of the long running operation returned by createPhraseSet()
.
Parameters:
Name | Type | Description |
---|---|---|
name |
String |
The operation name that will be passed. |
Returns:
Type | Description |
---|---|
Promise |
|
Example
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The PhraseSet to create.
*/
// const phraseSet = {}
/**
* If set, validate the request and preview the PhraseSet, but do not
* actually create it.
*/
// const validateOnly = true
/**
* The ID to use for the PhraseSet, which will become the final component of
* the PhraseSet's resource name.
* This value should be 4-63 characters, and valid characters
* are /[a-z][0-9]-/.
*/
// const phraseSetId = 'abc123'
/**
* Required. The project and location where this PhraseSet will be created.
* The expected format is `projects/{project}/locations/{location}`.
*/
// const parent = 'abc123'
// Imports the Speech library
const {SpeechClient} = require('@google-cloud/speech').v2;
// Instantiates a client
const speechClient = new SpeechClient();
async function callCreatePhraseSet() {
// Construct request
const request = {
phraseSet,
parent,
};
// Run request
const [operation] = await speechClient.createPhraseSet(request);
const [response] = await operation.promise();
console.log(response);
}
callCreatePhraseSet();
(async) checkCreateRecognizerProgress(name) → {Promise}
Check the status of the long running operation returned by createRecognizer()
.
Parameters:
Name | Type | Description |
---|---|---|
name |
String |
The operation name that will be passed. |
Returns:
Type | Description |
---|---|
Promise |
|
Example
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The Recognizer to create.
*/
// const recognizer = {}
/**
* If set, validate the request and preview the Recognizer, but do not
* actually create it.
*/
// const validateOnly = true
/**
* The ID to use for the Recognizer, which will become the final component of
* the Recognizer's resource name.
* This value should be 4-63 characters, and valid characters
* are /[a-z][0-9]-/.
*/
// const recognizerId = 'abc123'
/**
* Required. The project and location where this Recognizer will be created.
* The expected format is `projects/{project}/locations/{location}`.
*/
// const parent = 'abc123'
// Imports the Speech library
const {SpeechClient} = require('@google-cloud/speech').v2;
// Instantiates a client
const speechClient = new SpeechClient();
async function callCreateRecognizer() {
// Construct request
const request = {
recognizer,
parent,
};
// Run request
const [operation] = await speechClient.createRecognizer(request);
const [response] = await operation.promise();
console.log(response);
}
callCreateRecognizer();
(async) checkDeleteCustomClassProgress(name) → {Promise}
Check the status of the long running operation returned by deleteCustomClass()
.
Parameters:
Name | Type | Description |
---|---|---|
name |
String |
The operation name that will be passed. |
Returns:
Type | Description |
---|---|
Promise |
|
Example
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The name of the CustomClass to delete.
* Format:
* `projects/{project}/locations/{location}/customClasses/{custom_class}`
*/
// const name = 'abc123'
/**
* If set, validate the request and preview the deleted CustomClass, but do
* not actually delete it.
*/
// const validateOnly = true
/**
* If set to true, and the CustomClass is not found, the request will succeed
* and be a no-op (no Operation is recorded in this case).
*/
// const allowMissing = true
/**
* This checksum is computed by the server based on the value of other
* fields. This may be sent on update, undelete, and delete requests to ensure
* the client has an up-to-date value before proceeding.
*/
// const etag = 'abc123'
// Imports the Speech library
const {SpeechClient} = require('@google-cloud/speech').v2;
// Instantiates a client
const speechClient = new SpeechClient();
async function callDeleteCustomClass() {
// Construct request
const request = {
name,
};
// Run request
const [operation] = await speechClient.deleteCustomClass(request);
const [response] = await operation.promise();
console.log(response);
}
callDeleteCustomClass();
(async) checkDeletePhraseSetProgress(name) → {Promise}
Check the status of the long running operation returned by deletePhraseSet()
.
Parameters:
Name | Type | Description |
---|---|---|
name |
String |
The operation name that will be passed. |
Returns:
Type | Description |
---|---|
Promise |
|
Example
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The name of the PhraseSet to delete.
* Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`
*/
// const name = 'abc123'
/**
* If set, validate the request and preview the deleted PhraseSet, but do not
* actually delete it.
*/
// const validateOnly = true
/**
* If set to true, and the PhraseSet is not found, the request will succeed
* and be a no-op (no Operation is recorded in this case).
*/
// const allowMissing = true
/**
* This checksum is computed by the server based on the value of other
* fields. This may be sent on update, undelete, and delete requests to ensure
* the client has an up-to-date value before proceeding.
*/
// const etag = 'abc123'
// Imports the Speech library
const {SpeechClient} = require('@google-cloud/speech').v2;
// Instantiates a client
const speechClient = new SpeechClient();
async function callDeletePhraseSet() {
// Construct request
const request = {
name,
};
// Run request
const [operation] = await speechClient.deletePhraseSet(request);
const [response] = await operation.promise();
console.log(response);
}
callDeletePhraseSet();
(async) checkDeleteRecognizerProgress(name) → {Promise}
Check the status of the long running operation returned by deleteRecognizer()
.
Parameters:
Name | Type | Description |
---|---|---|
name |
String |
The operation name that will be passed. |
Returns:
Type | Description |
---|---|
Promise |
|
Example
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The name of the Recognizer to delete.
* Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`
*/
// const name = 'abc123'
/**
* If set, validate the request and preview the deleted Recognizer, but do not
* actually delete it.
*/
// const validateOnly = true
/**
* If set to true, and the Recognizer is not found, the request will succeed
* and be a no-op (no Operation is recorded in this case).
*/
// const allowMissing = true
/**
* This checksum is computed by the server based on the value of other
* fields. This may be sent on update, undelete, and delete requests to ensure
* the client has an up-to-date value before proceeding.
*/
// const etag = 'abc123'
// Imports the Speech library
const {SpeechClient} = require('@google-cloud/speech').v2;
// Instantiates a client
const speechClient = new SpeechClient();
async function callDeleteRecognizer() {
// Construct request
const request = {
name,
};
// Run request
const [operation] = await speechClient.deleteRecognizer(request);
const [response] = await operation.promise();
console.log(response);
}
callDeleteRecognizer();
(async) checkUndeleteCustomClassProgress(name) → {Promise}
Check the status of the long running operation returned by undeleteCustomClass()
.
Parameters:
Name | Type | Description |
---|---|---|
name |
String |
The operation name that will be passed. |
Returns:
Type | Description |
---|---|
Promise |
|
Example
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The name of the CustomClass to undelete.
* Format:
* `projects/{project}/locations/{location}/customClasses/{custom_class}`
*/
// const name = 'abc123'
/**
* If set, validate the request and preview the undeleted CustomClass, but do
* not actually undelete it.
*/
// const validateOnly = true
/**
* This checksum is computed by the server based on the value of other
* fields. This may be sent on update, undelete, and delete requests to ensure
* the client has an up-to-date value before proceeding.
*/
// const etag = 'abc123'
// Imports the Speech library
const {SpeechClient} = require('@google-cloud/speech').v2;
// Instantiates a client
const speechClient = new SpeechClient();
async function callUndeleteCustomClass() {
// Construct request
const request = {
name,
};
// Run request
const [operation] = await speechClient.undeleteCustomClass(request);
const [response] = await operation.promise();
console.log(response);
}
callUndeleteCustomClass();
(async) checkUndeletePhraseSetProgress(name) → {Promise}
Check the status of the long running operation returned by undeletePhraseSet()
.
Parameters:
Name | Type | Description |
---|---|---|
name |
String |
The operation name that will be passed. |
Returns:
Type | Description |
---|---|
Promise |
|
Example
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The name of the PhraseSet to undelete.
* Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`
*/
// const name = 'abc123'
/**
* If set, validate the request and preview the undeleted PhraseSet, but do
* not actually undelete it.
*/
// const validateOnly = true
/**
* This checksum is computed by the server based on the value of other
* fields. This may be sent on update, undelete, and delete requests to ensure
* the client has an up-to-date value before proceeding.
*/
// const etag = 'abc123'
// Imports the Speech library
const {SpeechClient} = require('@google-cloud/speech').v2;
// Instantiates a client
const speechClient = new SpeechClient();
async function callUndeletePhraseSet() {
// Construct request
const request = {
name,
};
// Run request
const [operation] = await speechClient.undeletePhraseSet(request);
const [response] = await operation.promise();
console.log(response);
}
callUndeletePhraseSet();
(async) checkUndeleteRecognizerProgress(name) → {Promise}
Check the status of the long running operation returned by undeleteRecognizer()
.
Parameters:
Name | Type | Description |
---|---|---|
name |
String |
The operation name that will be passed. |
Returns:
Type | Description |
---|---|
Promise |
|
Example
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The name of the Recognizer to undelete.
* Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`
*/
// const name = 'abc123'
/**
* If set, validate the request and preview the undeleted Recognizer, but do
* not actually undelete it.
*/
// const validateOnly = true
/**
* This checksum is computed by the server based on the value of other
* fields. This may be sent on update, undelete, and delete requests to ensure
* the client has an up-to-date value before proceeding.
*/
// const etag = 'abc123'
// Imports the Speech library
const {SpeechClient} = require('@google-cloud/speech').v2;
// Instantiates a client
const speechClient = new SpeechClient();
async function callUndeleteRecognizer() {
// Construct request
const request = {
name,
};
// Run request
const [operation] = await speechClient.undeleteRecognizer(request);
const [response] = await operation.promise();
console.log(response);
}
callUndeleteRecognizer();
(async) checkUpdateCustomClassProgress(name) → {Promise}
Check the status of the long running operation returned by updateCustomClass()
.
Parameters:
Name | Type | Description |
---|---|---|
name |
String |
The operation name that will be passed. |
Returns:
Type | Description |
---|---|
Promise |
|
Example
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The CustomClass to update.
* The CustomClass's `name` field is used to identify the CustomClass to
* update. Format:
* `projects/{project}/locations/{location}/customClasses/{custom_class}`.
*/
// const customClass = {}
/**
* The list of fields to be updated. If empty, all fields are considered for
* update.
*/
// const updateMask = {}
/**
* If set, validate the request and preview the updated CustomClass, but do
* not actually update it.
*/
// const validateOnly = true
// Imports the Speech library
const {SpeechClient} = require('@google-cloud/speech').v2;
// Instantiates a client
const speechClient = new SpeechClient();
async function callUpdateCustomClass() {
// Construct request
const request = {
customClass,
};
// Run request
const [operation] = await speechClient.updateCustomClass(request);
const [response] = await operation.promise();
console.log(response);
}
callUpdateCustomClass();
(async) checkUpdatePhraseSetProgress(name) → {Promise}
Check the status of the long running operation returned by updatePhraseSet()
.
Parameters:
Name | Type | Description |
---|---|---|
name |
String |
The operation name that will be passed. |
Returns:
Type | Description |
---|---|
Promise |
|
Example
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The PhraseSet to update.
* The PhraseSet's `name` field is used to identify the PhraseSet to update.
* Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
*/
// const phraseSet = {}
/**
* The list of fields to update. If empty, all non-default valued fields are
* considered for update. Use `*` to update the entire PhraseSet resource.
*/
// const updateMask = {}
/**
* If set, validate the request and preview the updated PhraseSet, but do not
* actually update it.
*/
// const validateOnly = true
// Imports the Speech library
const {SpeechClient} = require('@google-cloud/speech').v2;
// Instantiates a client
const speechClient = new SpeechClient();
async function callUpdatePhraseSet() {
// Construct request
const request = {
phraseSet,
};
// Run request
const [operation] = await speechClient.updatePhraseSet(request);
const [response] = await operation.promise();
console.log(response);
}
callUpdatePhraseSet();
(async) checkUpdateRecognizerProgress(name) → {Promise}
Check the status of the long running operation returned by updateRecognizer()
.
Parameters:
Name | Type | Description |
---|---|---|
name |
String |
The operation name that will be passed. |
Returns:
Type | Description |
---|---|
Promise |
|
Example
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The Recognizer to update.
* The Recognizer's `name` field is used to identify the Recognizer to update.
* Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`.
*/
// const recognizer = {}
/**
* The list of fields to update. If empty, all non-default valued fields are
* considered for update. Use `*` to update the entire Recognizer resource.
*/
// const updateMask = {}
/**
* If set, validate the request and preview the updated Recognizer, but do not
* actually update it.
*/
// const validateOnly = true
// Imports the Speech library
const {SpeechClient} = require('@google-cloud/speech').v2;
// Instantiates a client
const speechClient = new SpeechClient();
async function callUpdateRecognizer() {
// Construct request
const request = {
recognizer,
};
// Run request
const [operation] = await speechClient.updateRecognizer(request);
const [response] = await operation.promise();
console.log(response);
}
callUpdateRecognizer();
close() → {Promise}
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 |
A promise that resolves when the client is closed. |
configPath(project, location) → {string}
Return a fully-qualified config resource name string.
Parameters:
Name | Type | Description |
---|---|---|
project |
string | |
location |
string |
Returns:
Type | Description |
---|---|
string |
Resource name string. |
cryptoKeyPath(project, location, key_ring, crypto_key) → {string}
Return a fully-qualified cryptoKey resource name string.
Parameters:
Name | Type | Description |
---|---|---|
project |
string | |
location |
string | |
key_ring |
string | |
crypto_key |
string |
Returns:
Type | Description |
---|---|
string |
Resource name string. |
cryptoKeyVersionPath(project, location, key_ring, crypto_key, crypto_key_version) → {string}
Return a fully-qualified cryptoKeyVersion resource name string.
Parameters:
Name | Type | Description |
---|---|---|
project |
string | |
location |
string | |
key_ring |
string | |
crypto_key |
string | |
crypto_key_version |
string |
Returns:
Type | Description |
---|---|
string |
Resource name string. |
customClassPath(project, location, custom_class) → {string}
Return a fully-qualified customClass resource name string.
Parameters:
Name | Type | Description |
---|---|---|
project |
string | |
location |
string | |
custom_class |
string |
Returns:
Type | Description |
---|---|
string |
Resource name string. |
deleteOperation(request, optionsopt, callbackopt) → {Promise}
Deletes a long-running operation. This method indicates that the client is
no longer interested in the operation result. It does not cancel the
operation. If the server doesn't support this method, it returns
google.rpc.Code.UNIMPLEMENTED
.
Parameters:
Name | Type | Attributes | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||
options |
Object |
<optional> |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||
callback |
function |
<optional> |
The function which will be called with the result of the API call. |
Returns:
Type | Description |
---|---|
Promise |
|
Example
```
const client = longrunning.operationsClient();
await client.deleteOperation({name: ''});
```
getLocation(request, optionsopt) → {Promise}
Gets information about a location.
Parameters:
Name | Type | Attributes | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
Returns:
Type | Description |
---|---|
Promise |
|
getOperation(request, optionsopt, callbackopt) → {Promise}
Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
Parameters:
Name | Type | Attributes | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||
options |
Object |
<optional> |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
||||||
callback |
function |
<optional> |
The function which will be called with the result of the API call. The second parameter to the callback is an object representing google.longrunning.Operation. |
Returns:
Type | Description |
---|---|
Promise |
|
Example
```
const client = longrunning.operationsClient();
const name = '';
const [response] = await client.getOperation({name});
// doThingsWith(response)
```
getProjectId() → {Promise}
Return the project ID used by this class.
Returns:
Type | Description |
---|---|
Promise |
A promise that resolves to string containing the project ID. |
initialize() → {Promise}
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 |
A promise that resolves to an authenticated service stub. |
listCustomClassesAsync(request, optionsopt) → {Object}
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 | Type | Attributes | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
||||||||||||||||
options |
object |
<optional> |
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 CustomClass. The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples. |
Example
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The project and location of CustomClass resources to list. The
* expected format is `projects/{project}/locations/{location}`.
*/
// const parent = 'abc123'
/**
* Number of results per requests. A valid page_size ranges from 0 to 100
* inclusive. If the page_size is zero or unspecified, a page size of 5 will
* be chosen. If the page size exceeds 100, it will be coerced down to 100.
* Note that a call might return fewer results than the requested page size.
*/
// const pageSize = 1234
/**
* A page token, received from a previous
* ListCustomClasses google.cloud.speech.v2.Speech.ListCustomClasses call.
* Provide this to retrieve the subsequent page.
* When paginating, all other parameters provided to
* ListCustomClasses google.cloud.speech.v2.Speech.ListCustomClasses must
* match the call that provided the page token.
*/
// const pageToken = 'abc123'
/**
* Whether, or not, to show resources that have been deleted.
*/
// const showDeleted = true
// Imports the Speech library
const {SpeechClient} = require('@google-cloud/speech').v2;
// Instantiates a client
const speechClient = new SpeechClient();
async function callListCustomClasses() {
// Construct request
const request = {
parent,
};
// Run request
const iterable = speechClient.listCustomClassesAsync(request);
for await (const response of iterable) {
console.log(response);
}
}
callListCustomClasses();
listCustomClassesStream(request, optionsopt) → {Stream}
Equivalent to method.name.toCamelCase()
, but returns a NodeJS Stream object.
Parameters:
Name | Type | Attributes | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
||||||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
Returns:
Type | Description |
---|---|
Stream |
An object stream which emits an object representing CustomClass 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 |
listLocationsAsync(request, optionsopt) → {Object}
Lists information about the supported locations for this service. Returns an iterable object.
for
-await
-of
syntax is used with the iterable to get response elements on-demand.
Parameters:
Name | Type | Attributes | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
||||||||||||||||
options |
object |
<optional> |
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 Location. The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples. |
Example
```
const iterable = client.listLocationsAsync(request);
for await (const response of iterable) {
// process response
}
```
listOperationsAsync(request, optionsopt) → {Object}
Lists operations that match the specified filter in the request. If the
server doesn't support this method, it returns UNIMPLEMENTED
. Returns an iterable object.
For-await-of syntax is used with the iterable to recursively get response element on-demand.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||||||||||||
options |
Object |
<optional> |
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
Returns:
Type | Description |
---|---|
Object |
An iterable Object that conforms to iteration protocols. |
Example
```
const client = longrunning.operationsClient();
for await (const response of client.listOperationsAsync(request));
// doThingsWith(response)
```
listPhraseSetsAsync(request, optionsopt) → {Object}
Equivalent to listPhraseSets
, but returns an iterable object.
for
-await
-of
syntax is used with the iterable to get response elements on-demand.
Parameters:
Name | Type | Attributes | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
||||||||||||||||
options |
object |
<optional> |
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 PhraseSet. The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples. |
Example
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The project and location of PhraseSet resources to list. The
* expected format is `projects/{project}/locations/{location}`.
*/
// const parent = 'abc123'
/**
* The maximum number of PhraseSets to return. The service may return fewer
* than this value. If unspecified, at most 5 PhraseSets will be returned.
* The maximum value is 100; values above 100 will be coerced to 100.
*/
// const pageSize = 1234
/**
* A page token, received from a previous
* ListPhraseSets google.cloud.speech.v2.Speech.ListPhraseSets call.
* Provide this to retrieve the subsequent page.
* When paginating, all other parameters provided to
* ListPhraseSets google.cloud.speech.v2.Speech.ListPhraseSets must match
* the call that provided the page token.
*/
// const pageToken = 'abc123'
/**
* Whether, or not, to show resources that have been deleted.
*/
// const showDeleted = true
// Imports the Speech library
const {SpeechClient} = require('@google-cloud/speech').v2;
// Instantiates a client
const speechClient = new SpeechClient();
async function callListPhraseSets() {
// Construct request
const request = {
parent,
};
// Run request
const iterable = speechClient.listPhraseSetsAsync(request);
for await (const response of iterable) {
console.log(response);
}
}
callListPhraseSets();
listPhraseSetsStream(request, optionsopt) → {Stream}
Equivalent to method.name.toCamelCase()
, but returns a NodeJS Stream object.
Parameters:
Name | Type | Attributes | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
||||||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
Returns:
Type | Description |
---|---|
Stream |
An object stream which emits an object representing PhraseSet on 'data' event.
The client library will perform auto-pagination by default: it will call the API as many
times as needed. Note that it can affect your quota.
We recommend using |
listRecognizersAsync(request, optionsopt) → {Object}
Equivalent to listRecognizers
, but returns an iterable object.
for
-await
-of
syntax is used with the iterable to get response elements on-demand.
Parameters:
Name | Type | Attributes | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
||||||||||||||||
options |
object |
<optional> |
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 Recognizer. The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples. |
Example
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The project and location of Recognizers to list. The expected
* format is `projects/{project}/locations/{location}`.
*/
// const parent = 'abc123'
/**
* The maximum number of Recognizers to return. The service may return fewer
* than this value. If unspecified, at most 5 Recognizers will be returned.
* The maximum value is 100; values above 100 will be coerced to 100.
*/
// const pageSize = 1234
/**
* A page token, received from a previous
* ListRecognizers google.cloud.speech.v2.Speech.ListRecognizers call.
* Provide this to retrieve the subsequent page.
* When paginating, all other parameters provided to
* ListRecognizers google.cloud.speech.v2.Speech.ListRecognizers must match
* the call that provided the page token.
*/
// const pageToken = 'abc123'
/**
* Whether, or not, to show resources that have been deleted.
*/
// const showDeleted = true
// Imports the Speech library
const {SpeechClient} = require('@google-cloud/speech').v2;
// Instantiates a client
const speechClient = new SpeechClient();
async function callListRecognizers() {
// Construct request
const request = {
parent,
};
// Run request
const iterable = speechClient.listRecognizersAsync(request);
for await (const response of iterable) {
console.log(response);
}
}
callListRecognizers();
listRecognizersStream(request, optionsopt) → {Stream}
Equivalent to method.name.toCamelCase()
, but returns a NodeJS Stream object.
Parameters:
Name | Type | Attributes | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
||||||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
Returns:
Type | Description |
---|---|
Stream |
An object stream which emits an object representing Recognizer 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 |
locationPath(project, location) → {string}
Return a fully-qualified location resource name string.
Parameters:
Name | Type | Description |
---|---|---|
project |
string | |
location |
string |
Returns:
Type | Description |
---|---|
string |
Resource name string. |
matchCryptoKeyFromCryptoKeyName(cryptoKeyName) → {string}
Parse the crypto_key from CryptoKey resource.
Parameters:
Name | Type | Description |
---|---|---|
cryptoKeyName |
string |
A fully-qualified path representing CryptoKey resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the crypto_key. |
matchCryptoKeyFromCryptoKeyVersionName(cryptoKeyVersionName) → {string}
Parse the crypto_key from CryptoKeyVersion resource.
Parameters:
Name | Type | Description |
---|---|---|
cryptoKeyVersionName |
string |
A fully-qualified path representing CryptoKeyVersion resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the crypto_key. |
matchCryptoKeyVersionFromCryptoKeyVersionName(cryptoKeyVersionName) → {string}
Parse the crypto_key_version from CryptoKeyVersion resource.
Parameters:
Name | Type | Description |
---|---|---|
cryptoKeyVersionName |
string |
A fully-qualified path representing CryptoKeyVersion resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the crypto_key_version. |
matchCustomClassFromCustomClassName(customClassName) → {string}
Parse the custom_class from CustomClass resource.
Parameters:
Name | Type | Description |
---|---|---|
customClassName |
string |
A fully-qualified path representing CustomClass resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the custom_class. |
matchKeyRingFromCryptoKeyName(cryptoKeyName) → {string}
Parse the key_ring from CryptoKey resource.
Parameters:
Name | Type | Description |
---|---|---|
cryptoKeyName |
string |
A fully-qualified path representing CryptoKey resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the key_ring. |
matchKeyRingFromCryptoKeyVersionName(cryptoKeyVersionName) → {string}
Parse the key_ring from CryptoKeyVersion resource.
Parameters:
Name | Type | Description |
---|---|---|
cryptoKeyVersionName |
string |
A fully-qualified path representing CryptoKeyVersion resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the key_ring. |
matchLocationFromConfigName(configName) → {string}
Parse the location from Config resource.
Parameters:
Name | Type | Description |
---|---|---|
configName |
string |
A fully-qualified path representing Config resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the location. |
matchLocationFromCryptoKeyName(cryptoKeyName) → {string}
Parse the location from CryptoKey resource.
Parameters:
Name | Type | Description |
---|---|---|
cryptoKeyName |
string |
A fully-qualified path representing CryptoKey resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the location. |
matchLocationFromCryptoKeyVersionName(cryptoKeyVersionName) → {string}
Parse the location from CryptoKeyVersion resource.
Parameters:
Name | Type | Description |
---|---|---|
cryptoKeyVersionName |
string |
A fully-qualified path representing CryptoKeyVersion resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the location. |
matchLocationFromCustomClassName(customClassName) → {string}
Parse the location from CustomClass resource.
Parameters:
Name | Type | Description |
---|---|---|
customClassName |
string |
A fully-qualified path representing CustomClass resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the location. |
matchLocationFromLocationName(locationName) → {string}
Parse the location from Location resource.
Parameters:
Name | Type | Description |
---|---|---|
locationName |
string |
A fully-qualified path representing Location resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the location. |
matchLocationFromPhraseSetName(phraseSetName) → {string}
Parse the location from PhraseSet resource.
Parameters:
Name | Type | Description |
---|---|---|
phraseSetName |
string |
A fully-qualified path representing PhraseSet resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the location. |
matchLocationFromRecognizerName(recognizerName) → {string}
Parse the location from Recognizer resource.
Parameters:
Name | Type | Description |
---|---|---|
recognizerName |
string |
A fully-qualified path representing Recognizer resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the location. |
matchPhraseSetFromPhraseSetName(phraseSetName) → {string}
Parse the phrase_set from PhraseSet resource.
Parameters:
Name | Type | Description |
---|---|---|
phraseSetName |
string |
A fully-qualified path representing PhraseSet resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the phrase_set. |
matchProjectFromConfigName(configName) → {string}
Parse the project from Config resource.
Parameters:
Name | Type | Description |
---|---|---|
configName |
string |
A fully-qualified path representing Config resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the project. |
matchProjectFromCryptoKeyName(cryptoKeyName) → {string}
Parse the project from CryptoKey resource.
Parameters:
Name | Type | Description |
---|---|---|
cryptoKeyName |
string |
A fully-qualified path representing CryptoKey resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the project. |
matchProjectFromCryptoKeyVersionName(cryptoKeyVersionName) → {string}
Parse the project from CryptoKeyVersion resource.
Parameters:
Name | Type | Description |
---|---|---|
cryptoKeyVersionName |
string |
A fully-qualified path representing CryptoKeyVersion resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the project. |
matchProjectFromCustomClassName(customClassName) → {string}
Parse the project from CustomClass resource.
Parameters:
Name | Type | Description |
---|---|---|
customClassName |
string |
A fully-qualified path representing CustomClass resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the project. |
matchProjectFromLocationName(locationName) → {string}
Parse the project from Location resource.
Parameters:
Name | Type | Description |
---|---|---|
locationName |
string |
A fully-qualified path representing Location resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the project. |
matchProjectFromPhraseSetName(phraseSetName) → {string}
Parse the project from PhraseSet resource.
Parameters:
Name | Type | Description |
---|---|---|
phraseSetName |
string |
A fully-qualified path representing PhraseSet resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the project. |
matchProjectFromProjectName(projectName) → {string}
Parse the project from Project resource.
Parameters:
Name | Type | Description |
---|---|---|
projectName |
string |
A fully-qualified path representing Project resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the project. |
matchProjectFromRecognizerName(recognizerName) → {string}
Parse the project from Recognizer resource.
Parameters:
Name | Type | Description |
---|---|---|
recognizerName |
string |
A fully-qualified path representing Recognizer resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the project. |
matchRecognizerFromRecognizerName(recognizerName) → {string}
Parse the recognizer from Recognizer resource.
Parameters:
Name | Type | Description |
---|---|---|
recognizerName |
string |
A fully-qualified path representing Recognizer resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the recognizer. |
phraseSetPath(project, location, phrase_set) → {string}
Return a fully-qualified phraseSet resource name string.
Parameters:
Name | Type | Description |
---|---|---|
project |
string | |
location |
string | |
phrase_set |
string |
Returns:
Type | Description |
---|---|
string |
Resource name string. |
projectPath(project) → {string}
Return a fully-qualified project resource name string.
Parameters:
Name | Type | Description |
---|---|---|
project |
string |
Returns:
Type | Description |
---|---|
string |
Resource name string. |
recognizerPath(project, location, recognizer) → {string}
Return a fully-qualified recognizer resource name string.
Parameters:
Name | Type | Description |
---|---|---|
project |
string | |
location |
string | |
recognizer |
string |
Returns:
Type | Description |
---|---|
string |
Resource name string. |