Skip to content

Commit

Permalink
docs: fix the resource name format in comment for CreatePhraseSetRequ…
Browse files Browse the repository at this point in the history
…est (#509)

* feat: Add support for BatchRecognize

Deprecate the `update_config_request` field in the `OperationMetadata` message, which was never used and is output only.

PiperOrigin-RevId: 517976288

Source-Link: googleapis/googleapis@7ee7867

Source-Link: googleapis/googleapis-gen@04050e1
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMDQwNTBlMTVlN2E0MDlmOWQ0MjFmNjNkYmZkZjM3ZWFjNzJhM2MxNCJ9

* 🦉 Updates from OwlBot post-processor

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

* docs: fix the resource name format in comment for CreatePhraseSetRequest

PiperOrigin-RevId: 518025142

Source-Link: googleapis/googleapis@e354eef

Source-Link: googleapis/googleapis-gen@f3e2685
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZjNlMjY4NTBlYjU0NWYzN2U0MWEzZGE3MTQyNmQxMzIwMmVhZTAxMyJ9

* 🦉 Updates from OwlBot post-processor

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

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] authored Mar 20, 2023
1 parent b30fdff commit 7f02b8f
Show file tree
Hide file tree
Showing 17 changed files with 1,148 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ async def sample_create_phrase_set():
Required. The parent resource where this phrase set will
be created. Format:
``projects/{project}/locations/{location}/phraseSets``
``projects/{project}/locations/{location}``
Speech-to-Text supports three locations: ``global``,
``us`` (US North America), and ``eu`` (Europe). If you
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ def sample_create_phrase_set():
Required. The parent resource where this phrase set will
be created. Format:
``projects/{project}/locations/{location}/phraseSets``
``projects/{project}/locations/{location}``
Speech-to-Text supports three locations: ``global``,
``us`` (US North America), and ``eu`` (Europe). If you
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class CreatePhraseSetRequest(proto.Message):
Required. The parent resource where this phrase set will be
created. Format:
``projects/{project}/locations/{location}/phraseSets``
``projects/{project}/locations/{location}``
Speech-to-Text supports three locations: ``global``, ``us``
(US North America), and ``eu`` (Europe). If you are calling
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ async def sample_create_phrase_set():
Required. The parent resource where this phrase set will
be created. Format:
``projects/{project}/locations/{location}/phraseSets``
``projects/{project}/locations/{location}``
Speech-to-Text supports three locations: ``global``,
``us`` (US North America), and ``eu`` (Europe). If you
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ def sample_create_phrase_set():
Required. The parent resource where this phrase set will
be created. Format:
``projects/{project}/locations/{location}/phraseSets``
``projects/{project}/locations/{location}``
Speech-to-Text supports three locations: ``global``,
``us`` (US North America), and ``eu`` (Europe). If you
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class CreatePhraseSetRequest(proto.Message):
Required. The parent resource where this phrase set will be
created. Format:
``projects/{project}/locations/{location}/phraseSets``
``projects/{project}/locations/{location}``
Speech-to-Text supports three locations: ``global``, ``us``
(US North America), and ``eu`` (Europe). If you are calling
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from .types.cloud_speech import BatchRecognizeMetadata
from .types.cloud_speech import BatchRecognizeRequest
from .types.cloud_speech import BatchRecognizeResponse
from .types.cloud_speech import BatchRecognizeResults
from .types.cloud_speech import BatchRecognizeTranscriptionMetadata
from .types.cloud_speech import Config
from .types.cloud_speech import CreateCustomClassRequest
Expand All @@ -37,10 +38,12 @@
from .types.cloud_speech import DeletePhraseSetRequest
from .types.cloud_speech import DeleteRecognizerRequest
from .types.cloud_speech import ExplicitDecodingConfig
from .types.cloud_speech import GcsOutputConfig
from .types.cloud_speech import GetConfigRequest
from .types.cloud_speech import GetCustomClassRequest
from .types.cloud_speech import GetPhraseSetRequest
from .types.cloud_speech import GetRecognizerRequest
from .types.cloud_speech import InlineOutputConfig
from .types.cloud_speech import ListCustomClassesRequest
from .types.cloud_speech import ListCustomClassesResponse
from .types.cloud_speech import ListPhraseSetsRequest
Expand All @@ -51,6 +54,7 @@
from .types.cloud_speech import PhraseSet
from .types.cloud_speech import RecognitionConfig
from .types.cloud_speech import RecognitionFeatures
from .types.cloud_speech import RecognitionOutputConfig
from .types.cloud_speech import RecognitionResponseMetadata
from .types.cloud_speech import Recognizer
from .types.cloud_speech import RecognizeRequest
Expand Down Expand Up @@ -81,6 +85,7 @@
"BatchRecognizeMetadata",
"BatchRecognizeRequest",
"BatchRecognizeResponse",
"BatchRecognizeResults",
"BatchRecognizeTranscriptionMetadata",
"Config",
"CreateCustomClassRequest",
Expand All @@ -91,10 +96,12 @@
"DeletePhraseSetRequest",
"DeleteRecognizerRequest",
"ExplicitDecodingConfig",
"GcsOutputConfig",
"GetConfigRequest",
"GetCustomClassRequest",
"GetPhraseSetRequest",
"GetRecognizerRequest",
"InlineOutputConfig",
"ListCustomClassesRequest",
"ListCustomClassesResponse",
"ListPhraseSetsRequest",
Expand All @@ -105,6 +112,7 @@
"PhraseSet",
"RecognitionConfig",
"RecognitionFeatures",
"RecognitionOutputConfig",
"RecognitionResponseMetadata",
"RecognizeRequest",
"RecognizeResponse",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@

from google.api_core import operation # type: ignore
from google.api_core import operation_async # type: ignore
from google.cloud.location import locations_pb2 # type: ignore
from google.cloud.speech_v2.services.speech import pagers
from google.cloud.speech_v2.types import cloud_speech
from google.longrunning import operations_pb2
Expand Down Expand Up @@ -500,7 +501,7 @@ async def get_recognizer(
r"""Returns the requested
[Recognizer][google.cloud.speech.v2.Recognizer]. Fails with
[NOT_FOUND][google.rpc.Code.NOT_FOUND] if the requested
recognizer doesn't exist.
Recognizer doesn't exist.
.. code-block:: python
Expand Down Expand Up @@ -1405,7 +1406,8 @@ async def sample_batch_recognize():
should not be set.
files (:class:`MutableSequence[google.cloud.speech_v2.types.BatchRecognizeFileMetadata]`):
Audio files with file metadata for
ASR.
ASR. The maximum number of files allowed
to be specified is 5.
This corresponds to the ``files`` field
on the ``request`` instance; if ``request`` is provided, this
Expand Down Expand Up @@ -3401,6 +3403,114 @@ async def cancel_operation(
metadata=metadata,
)

async def get_location(
self,
request: Optional[locations_pb2.GetLocationRequest] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> locations_pb2.Location:
r"""Gets information about a location.
Args:
request (:class:`~.location_pb2.GetLocationRequest`):
The request object. Request message for
`GetLocation` method.
retry (google.api_core.retry.Retry): Designation of what errors,
if any, should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
sent along with the request as metadata.
Returns:
~.location_pb2.Location:
Location object.
"""
# Create or coerce a protobuf request object.
# The request isn't a proto-plus wrapped type,
# so it must be constructed via keyword expansion.
if isinstance(request, dict):
request = locations_pb2.GetLocationRequest(**request)

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = gapic_v1.method.wrap_method(
self._client._transport.get_location,
default_timeout=None,
client_info=DEFAULT_CLIENT_INFO,
)

# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
)

# Send the request.
response = await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)

# Done; return the response.
return response

async def list_locations(
self,
request: Optional[locations_pb2.ListLocationsRequest] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> locations_pb2.ListLocationsResponse:
r"""Lists information about the supported locations for this service.
Args:
request (:class:`~.location_pb2.ListLocationsRequest`):
The request object. Request message for
`ListLocations` method.
retry (google.api_core.retry.Retry): Designation of what errors,
if any, should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
sent along with the request as metadata.
Returns:
~.location_pb2.ListLocationsResponse:
Response message for ``ListLocations`` method.
"""
# Create or coerce a protobuf request object.
# The request isn't a proto-plus wrapped type,
# so it must be constructed via keyword expansion.
if isinstance(request, dict):
request = locations_pb2.ListLocationsRequest(**request)

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = gapic_v1.method.wrap_method(
self._client._transport.list_locations,
default_timeout=None,
client_info=DEFAULT_CLIENT_INFO,
)

# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
)

# Send the request.
response = await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)

# Done; return the response.
return response

async def __aenter__(self):
return self

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@

from google.api_core import operation # type: ignore
from google.api_core import operation_async # type: ignore
from google.cloud.location import locations_pb2 # type: ignore
from google.cloud.speech_v2.services.speech import pagers
from google.cloud.speech_v2.types import cloud_speech
from google.longrunning import operations_pb2
Expand Down Expand Up @@ -839,7 +840,7 @@ def get_recognizer(
r"""Returns the requested
[Recognizer][google.cloud.speech.v2.Recognizer]. Fails with
[NOT_FOUND][google.rpc.Code.NOT_FOUND] if the requested
recognizer doesn't exist.
Recognizer doesn't exist.
.. code-block:: python
Expand Down Expand Up @@ -1738,7 +1739,8 @@ def sample_batch_recognize():
should not be set.
files (MutableSequence[google.cloud.speech_v2.types.BatchRecognizeFileMetadata]):
Audio files with file metadata for
ASR.
ASR. The maximum number of files allowed
to be specified is 5.
This corresponds to the ``files`` field
on the ``request`` instance; if ``request`` is provided, this
Expand Down Expand Up @@ -3747,6 +3749,114 @@ def cancel_operation(
metadata=metadata,
)

def get_location(
self,
request: Optional[locations_pb2.GetLocationRequest] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> locations_pb2.Location:
r"""Gets information about a location.
Args:
request (:class:`~.location_pb2.GetLocationRequest`):
The request object. Request message for
`GetLocation` method.
retry (google.api_core.retry.Retry): Designation of what errors,
if any, should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
sent along with the request as metadata.
Returns:
~.location_pb2.Location:
Location object.
"""
# Create or coerce a protobuf request object.
# The request isn't a proto-plus wrapped type,
# so it must be constructed via keyword expansion.
if isinstance(request, dict):
request = locations_pb2.GetLocationRequest(**request)

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = gapic_v1.method.wrap_method(
self._transport.get_location,
default_timeout=None,
client_info=DEFAULT_CLIENT_INFO,
)

# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
)

# Send the request.
response = rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)

# Done; return the response.
return response

def list_locations(
self,
request: Optional[locations_pb2.ListLocationsRequest] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> locations_pb2.ListLocationsResponse:
r"""Lists information about the supported locations for this service.
Args:
request (:class:`~.location_pb2.ListLocationsRequest`):
The request object. Request message for
`ListLocations` method.
retry (google.api_core.retry.Retry): Designation of what errors,
if any, should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
sent along with the request as metadata.
Returns:
~.location_pb2.ListLocationsResponse:
Response message for ``ListLocations`` method.
"""
# Create or coerce a protobuf request object.
# The request isn't a proto-plus wrapped type,
# so it must be constructed via keyword expansion.
if isinstance(request, dict):
request = locations_pb2.ListLocationsRequest(**request)

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = gapic_v1.method.wrap_method(
self._transport.list_locations,
default_timeout=None,
client_info=DEFAULT_CLIENT_INFO,
)

# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
)

# Send the request.
response = rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)

# Done; return the response.
return response


DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=package_version.__version__
Expand Down
Loading

0 comments on commit 7f02b8f

Please sign in to comment.