Skip to content

Commit

Permalink
test: address class ID error (#736)
Browse files Browse the repository at this point in the history
build: migrate to OwlBot
  • Loading branch information
b-loved-dreamer authored Apr 29, 2021
1 parent de4aa28 commit 65cc841
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 31 deletions.
25 changes: 25 additions & 0 deletions packages/google-cloud-speech/.github/.OwlBot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# 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.
docker:
image: gcr.io/repo-automation-bots/owlbot-nodejs:latest

deep-remove-regex:
- /owl-bot-staging

deep-copy-regex:
- source: /google/cloud/speech/(v.*)/.*-nodejs/(.*)
dest: /owl-bot-staging/$1/$2

begin-after-commit-hash: f43939eac6a0bb5998c1fa0f79063194e699230e

3 changes: 2 additions & 1 deletion packages/google-cloud-speech/.repo-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
"distribution_name": "@google-cloud/speech",
"api_id": "speech.googleapis.com",
"requires_billing": false,
"codeowner_team": "@googleapis/ml-apis"
"codeowner_team": "@googleapis/ml-apis",
"default_version": "v1"
}
1 change: 1 addition & 0 deletions packages/google-cloud-speech/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ Samples are in the [`samples/`](https://github.com/googleapis/nodejs-speech/tree
| Microphone stream | [source code](https://github.com/googleapis/nodejs-speech/blob/master/samples/MicrophoneStream.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-speech&page=editor&open_in_editor=samples/MicrophoneStream.js,samples/README.md) |
| Beta Features | [source code](https://github.com/googleapis/nodejs-speech/blob/master/samples/betaFeatures.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-speech&page=editor&open_in_editor=samples/betaFeatures.js,samples/README.md) |
| Infinite Streaming | [source code](https://github.com/googleapis/nodejs-speech/blob/master/samples/infiniteStreaming.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-speech&page=editor&open_in_editor=samples/infiniteStreaming.js,samples/README.md) |
| Model Adaptation | [source code](https://github.com/googleapis/nodejs-speech/blob/master/samples/modelAdaptation.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-speech&page=editor&open_in_editor=samples/modelAdaptation.js,samples/README.md) |
| Multi Region | [source code](https://github.com/googleapis/nodejs-speech/blob/master/samples/multiRegion.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-speech&page=editor&open_in_editor=samples/multiRegion.js,samples/README.md) |
| Profanity Filter | [source code](https://github.com/googleapis/nodejs-speech/blob/master/samples/profanityFilter.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-speech&page=editor&open_in_editor=samples/profanityFilter.js,samples/README.md) |
| Quickstart | [source code](https://github.com/googleapis/nodejs-speech/blob/master/samples/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-speech&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2018 Google LLC
# 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.
Expand All @@ -11,47 +11,28 @@
# 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 script is used to synthesize generated parts of this library."""

import os
import synthtool as s
import synthtool.gcp as gcp
import synthtool.languages.node as node
import json
import logging
from pathlib import Path

logging.basicConfig(level=logging.DEBUG)

AUTOSYNTH_MULTIPLE_COMMITS = True


gapic = gcp.GAPICBazel()
common_templates = gcp.CommonTemplates()

versions = ['v1p1beta1', 'v1']
name = 'speech'

for version in versions:
library = gapic.node_library(name, version)

# skip index, protos, package.json, and README.md
s.copy(
library,
excludes=['package.json', 'src/index.ts',]
)

def patch(library: Path):
version = library.parts[len(library.parts) - 1]
name = 'speech'
# Manual helper methods override the streaming API so that it
# accepts streamingConfig when calling streamingRecognize.
# Rename the generated methods to avoid confusion.
s.replace(f'src/{version}/{name}_client.ts', r'( +)streamingRecognize\(', '\\1_streamingRecognize(')
s.replace(f'test/gapic_{name}_{version}.ts', r'client\.streamingRecognize\(', 'client._streamingRecognize(')
s.replace(f'src/{version}/{name}_client.ts', r'\Z',
s.replace(f'owl-bot-staging/{version}/src/{version}/{name}_client.ts', r'( +)streamingRecognize\(', '\\1_streamingRecognize(')
s.replace(f'owl-bot-staging/{version}/test/gapic_{name}_{version}.ts', r'client\.streamingRecognize\(', 'client._streamingRecognize(')
s.replace(f'owl-bot-staging/{version}/src/{version}/{name}_client.ts', r'\Z',
'\n' +
"import {ImprovedStreamingClient} from '../helpers';\n" +
'// eslint-disable-next-line @typescript-eslint/no-empty-interface\n' +
'export interface SpeechClient extends ImprovedStreamingClient {}\n'
)

templates = common_templates.node_library(source_location='build/src')
s.copy(templates)

node.postprocess_gapic_library()
node.owlbot_main(templates_excludes=["src/index.ts"], patch_staging=patch)
18 changes: 18 additions & 0 deletions packages/google-cloud-speech/samples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* [Microphone stream](#microphone-stream)
* [Beta Features](#beta-features)
* [Infinite Streaming](#infinite-streaming)
* [Model Adaptation](#model-adaptation)
* [Multi Region](#multi-region)
* [Profanity Filter](#profanity-filter)
* [Quickstart](#quickstart)
Expand Down Expand Up @@ -92,6 +93,23 @@ __Usage:__



### Model Adaptation

View the [source code](https://github.com/googleapis/nodejs-speech/blob/master/samples/modelAdaptation.js).

[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-speech&page=editor&open_in_editor=samples/modelAdaptation.js,samples/README.md)

__Usage:__


`node samples/modelAdaptation.js`


-----




### Multi Region

View the [source code](https://github.com/googleapis/nodejs-speech/blob/master/samples/multiRegion.js).
Expand Down

0 comments on commit 65cc841

Please sign in to comment.