Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
feat: Speech v2 API (#967)
Browse files Browse the repository at this point in the history
* build: enable Speech v2 client library generation

PiperOrigin-RevId: 477910378

Source-Link: googleapis/googleapis@3fde7ab

Source-Link: https://github.com/googleapis/googleapis-gen/commit/636957906cc7868065a50cef61f5e995a75ae3e6
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNjM2OTU3OTA2Y2M3ODY4MDY1YTUwY2VmNjFmNWU5OTVhNzVhZTNlNiJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* fix: make v2 compile

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Alexander Fenster <[email protected]>
  • Loading branch information
3 people authored Sep 30, 2022
1 parent e55d256 commit a3989b0
Show file tree
Hide file tree
Showing 35 changed files with 41,021 additions and 2 deletions.
1,965 changes: 1,965 additions & 0 deletions protos/google/cloud/speech/v2/cloud_speech.proto

Large diffs are not rendered by default.

6,900 changes: 6,900 additions & 0 deletions protos/protos.d.ts

Large diffs are not rendered by default.

17,023 changes: 17,023 additions & 0 deletions protos/protos.js

Large diffs are not rendered by default.

2,042 changes: 2,042 additions & 0 deletions protos/protos.json

Large diffs are not rendered by default.

1,131 changes: 1,131 additions & 0 deletions samples/generated/v2/snippet_metadata.google.cloud.speech.v2.json

Large diffs are not rendered by default.

91 changes: 91 additions & 0 deletions samples/generated/v2/speech.batch_recognize.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
// Copyright 2022 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
//
// https://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.
//
// ** This file is automatically generated by gapic-generator-typescript. **
// ** https://github.com/googleapis/gapic-generator-typescript **
// ** All changes to this file may be overwritten. **



'use strict';

function main(recognizer) {
// [START speech_v2_generated_Speech_BatchRecognize_async]
/**
* 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. Resource name of the recognizer to be used for ASR.
*/
// 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.
*/
// const files = 1234

// 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();
// [END speech_v2_generated_Speech_BatchRecognize_async]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
80 changes: 80 additions & 0 deletions samples/generated/v2/speech.create_custom_class.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
// Copyright 2022 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
//
// https://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.
//
// ** This file is automatically generated by gapic-generator-typescript. **
// ** https://github.com/googleapis/gapic-generator-typescript **
// ** All changes to this file may be overwritten. **



'use strict';

function main(customClass, parent) {
// [START speech_v2_generated_Speech_CreateCustomClass_async]
/**
* 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();
// [END speech_v2_generated_Speech_CreateCustomClass_async]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
80 changes: 80 additions & 0 deletions samples/generated/v2/speech.create_phrase_set.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
// Copyright 2022 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
//
// https://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.
//
// ** This file is automatically generated by gapic-generator-typescript. **
// ** https://github.com/googleapis/gapic-generator-typescript **
// ** All changes to this file may be overwritten. **



'use strict';

function main(phraseSet, parent) {
// [START speech_v2_generated_Speech_CreatePhraseSet_async]
/**
* 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();
// [END speech_v2_generated_Speech_CreatePhraseSet_async]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
80 changes: 80 additions & 0 deletions samples/generated/v2/speech.create_recognizer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
// Copyright 2022 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
//
// https://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.
//
// ** This file is automatically generated by gapic-generator-typescript. **
// ** https://github.com/googleapis/gapic-generator-typescript **
// ** All changes to this file may be overwritten. **



'use strict';

function main(recognizer, parent) {
// [START speech_v2_generated_Speech_CreateRecognizer_async]
/**
* 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();
// [END speech_v2_generated_Speech_CreateRecognizer_async]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
Loading

0 comments on commit a3989b0

Please sign in to comment.