-
Notifications
You must be signed in to change notification settings - Fork 602
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(samples): add example tags to generated samples (#819)
- [ ] Regenerate this pull request now. PiperOrigin-RevId: 408439482 Source-Link: googleapis/googleapis@b9f6184 Source-Link: googleapis/googleapis-gen@eb888bc Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZWI4ODhiYzIxNGVmYzdiZjQzYmY0NjM0YjQ3MDI1NDU2NWE2NTlhNSJ9
- Loading branch information
1 parent
9e7243e
commit 5285b14
Showing
22 changed files
with
1,379 additions
and
395 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,5 +6,5 @@ | |
"img.shields.io" | ||
], | ||
"silent": true, | ||
"concurrency": 10 | ||
"concurrency": 5 | ||
} |
63 changes: 63 additions & 0 deletions
63
packages/google-cloud-speech/samples/generated/v1/speech.long_running_recognize.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// Copyright 2021 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
'use strict'; | ||
|
||
function main(config, audio) { | ||
// [START speech_v1_generated_Speech_LongRunningRecognize_async] | ||
/** | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
/** | ||
* Required. Provides information to the recognizer that specifies how to | ||
* process the request. | ||
*/ | ||
// const config = {} | ||
/** | ||
* Required. The audio data to be recognized. | ||
*/ | ||
// const audio = {} | ||
/** | ||
* Optional. Specifies an optional destination for the recognition results. | ||
*/ | ||
// const outputConfig = {} | ||
|
||
// Imports the Speech library | ||
const {SpeechClient} = require('@google-cloud/speech').v1; | ||
|
||
// Instantiates a client | ||
const speechClient = new SpeechClient(); | ||
|
||
async function callLongRunningRecognize() { | ||
// Construct request | ||
const request = { | ||
config, | ||
audio, | ||
}; | ||
|
||
// Run request | ||
const [operation] = await speechClient.longRunningRecognize(request); | ||
const [response] = await operation.promise(); | ||
console.log(response); | ||
} | ||
|
||
callLongRunningRecognize(); | ||
// [END speech_v1_generated_Speech_LongRunningRecognize_async] | ||
} | ||
|
||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
58 changes: 58 additions & 0 deletions
58
packages/google-cloud-speech/samples/generated/v1/speech.recognize.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// Copyright 2021 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
'use strict'; | ||
|
||
function main(config, audio) { | ||
// [START speech_v1_generated_Speech_Recognize_async] | ||
/** | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
/** | ||
* Required. Provides information to the recognizer that specifies how to | ||
* process the request. | ||
*/ | ||
// const config = {} | ||
/** | ||
* Required. The audio data to be recognized. | ||
*/ | ||
// const audio = {} | ||
|
||
// Imports the Speech library | ||
const {SpeechClient} = require('@google-cloud/speech').v1; | ||
|
||
// Instantiates a client | ||
const speechClient = new SpeechClient(); | ||
|
||
async function callRecognize() { | ||
// Construct request | ||
const request = { | ||
config, | ||
audio, | ||
}; | ||
|
||
// Run request | ||
const response = await speechClient.recognize(request); | ||
console.log(response); | ||
} | ||
|
||
callRecognize(); | ||
// [END speech_v1_generated_Speech_Recognize_async] | ||
} | ||
|
||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
73 changes: 73 additions & 0 deletions
73
packages/google-cloud-speech/samples/generated/v1/speech.streaming_recognize.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// Copyright 2021 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
'use strict'; | ||
|
||
function main() { | ||
// [START speech_v1_generated_Speech_StreamingRecognize_async] | ||
/** | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
/** | ||
* Provides information to the recognizer that specifies how to process the | ||
* request. The first `StreamingRecognizeRequest` message must contain a | ||
* `streaming_config` message. | ||
*/ | ||
// const streamingConfig = {} | ||
/** | ||
* The audio data to be recognized. Sequential chunks of audio data are sent | ||
* in sequential `StreamingRecognizeRequest` messages. The first | ||
* `StreamingRecognizeRequest` message must not contain `audio_content` data | ||
* and all subsequent `StreamingRecognizeRequest` messages must contain | ||
* `audio_content` data. The audio bytes must be encoded as specified in | ||
* `RecognitionConfig`. Note: as with all bytes fields, proto buffers use a | ||
* pure binary representation (not base64). See | ||
* content limits (https://cloud.google.com/speech-to-text/quotas#content). | ||
*/ | ||
// const audioContent = 'Buffer.from('string')' | ||
|
||
// Imports the Speech library | ||
const {SpeechClient} = require('@google-cloud/speech').v1; | ||
|
||
// Instantiates a client | ||
const speechClient = new SpeechClient(); | ||
|
||
async function callStreamingRecognize() { | ||
// Construct request | ||
const request = {}; | ||
|
||
// 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(); | ||
// [END speech_v1_generated_Speech_StreamingRecognize_async] | ||
} | ||
|
||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
67 changes: 67 additions & 0 deletions
67
packages/google-cloud-speech/samples/generated/v1p1beta1/adaptation.create_custom_class.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// Copyright 2021 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
'use strict'; | ||
|
||
function main(parent, customClassId, customClass) { | ||
// [START speech_v1p1beta1_generated_Adaptation_CreateCustomClass_async] | ||
/** | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
/** | ||
* Required. The parent resource where this custom class will be created. | ||
* Format: | ||
* {api_version}/projects/{project}/locations/{location}/customClasses | ||
*/ | ||
// 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 be 4-63 characters, and valid characters | ||
* are /[a-z][0-9]-/. | ||
*/ | ||
// const customClassId = 'abc123' | ||
/** | ||
* Required. The custom class to create. | ||
*/ | ||
// const customClass = {} | ||
|
||
// Imports the Speech library | ||
const {AdaptationClient} = require('@google-cloud/speech').v1p1beta1; | ||
|
||
// 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(); | ||
// [END speech_v1p1beta1_generated_Adaptation_CreateCustomClass_async] | ||
} | ||
|
||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
67 changes: 67 additions & 0 deletions
67
packages/google-cloud-speech/samples/generated/v1p1beta1/adaptation.create_phrase_set.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// Copyright 2021 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
'use strict'; | ||
|
||
function main(parent, phraseSetId, phraseSet) { | ||
// [START speech_v1p1beta1_generated_Adaptation_CreatePhraseSet_async] | ||
/** | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
/** | ||
* Required. The parent resource where this phrase set will be created. | ||
* Format: | ||
* {api_version}/projects/{project}/locations/{location}/phraseSets | ||
*/ | ||
// 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 be 4-63 characters, and valid characters | ||
* are /[a-z][0-9]-/. | ||
*/ | ||
// const phraseSetId = 'abc123' | ||
/** | ||
* Required. The phrase set to create. | ||
*/ | ||
// const phraseSet = {} | ||
|
||
// Imports the Speech library | ||
const {AdaptationClient} = require('@google-cloud/speech').v1p1beta1; | ||
|
||
// 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(); | ||
// [END speech_v1p1beta1_generated_Adaptation_CreatePhraseSet_async] | ||
} | ||
|
||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
54 changes: 54 additions & 0 deletions
54
packages/google-cloud-speech/samples/generated/v1p1beta1/adaptation.delete_custom_class.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// Copyright 2021 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
'use strict'; | ||
|
||
function main(name) { | ||
// [START speech_v1p1beta1_generated_Adaptation_DeleteCustomClass_async] | ||
/** | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
/** | ||
* Required. The name of the custom class to delete. | ||
* Format: | ||
* {api_version}/projects/{project}/locations/{location}/customClasses/{custom_class} | ||
*/ | ||
// const name = 'abc123' | ||
|
||
// Imports the Speech library | ||
const {AdaptationClient} = require('@google-cloud/speech').v1p1beta1; | ||
|
||
// 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(); | ||
// [END speech_v1p1beta1_generated_Adaptation_DeleteCustomClass_async] | ||
} | ||
|
||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
Oops, something went wrong.