Skip to content

Commit

Permalink
feat(v1p1beta1): add total_billed_time response field (#219)
Browse files Browse the repository at this point in the history
Committer: @cherba
PiperOrigin-RevId: 387131819

Source-Link: googleapis/googleapis@4fca877

Source-Link: googleapis/googleapis-gen@66600ac

fix(v1p1beta1): phrase_set_id is required field in CreatePhraseSetRequest
fix(v1p1beta1): custom_class_id is required field in CreateCustomClassRequest.
  • Loading branch information
gcf-owl-bot[bot] authored Jul 28, 2021
1 parent d592fda commit 9f3896e
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,9 @@ async def create_phrase_set(
on the ``request`` instance; if ``request`` is provided, this
should not be set.
phrase_set_id (:class:`str`):
The ID to use for the phrase set, which will become the
final component of the phrase set's resource name.
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]-/.
Expand Down Expand Up @@ -590,8 +591,9 @@ async def create_custom_class(
on the ``request`` instance; if ``request`` is provided, this
should not be set.
custom_class_id (:class:`str`):
The ID to use for the custom class, which will become
the final component of the custom class' resource name.
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]-/.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,9 @@ def create_phrase_set(
on the ``request`` instance; if ``request`` is provided, this
should not be set.
phrase_set_id (str):
The ID to use for the phrase set, which will become the
final component of the phrase set's resource name.
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]-/.
Expand Down Expand Up @@ -797,8 +798,9 @@ def create_custom_class(
on the ``request`` instance; if ``request`` is provided, this
should not be set.
custom_class_id (str):
The ID to use for the custom class, which will become
the final component of the custom class' resource name.
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]-/.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
from google.api_core import operation # type: ignore
from google.api_core import operation_async # type: ignore
from google.cloud.speech_v1p1beta1.types import cloud_speech
from google.protobuf import duration_pb2 # type: ignore
from google.rpc import status_pb2 # type: ignore
from .transports.base import SpeechTransport, DEFAULT_CLIENT_INFO
from .transports.grpc_asyncio import SpeechGrpcAsyncIOTransport
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
from google.api_core import operation # type: ignore
from google.api_core import operation_async # type: ignore
from google.cloud.speech_v1p1beta1.types import cloud_speech
from google.protobuf import duration_pb2 # type: ignore
from google.rpc import status_pb2 # type: ignore
from .transports.base import SpeechTransport, DEFAULT_CLIENT_INFO
from .transports.grpc import SpeechGrpcTransport
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -647,11 +647,17 @@ class RecognizeResponse(proto.Message):
results (Sequence[google.cloud.speech_v1p1beta1.types.SpeechRecognitionResult]):
Sequential list of transcription results
corresponding to sequential portions of audio.
total_billed_time (google.protobuf.duration_pb2.Duration):
When available, billed audio seconds for the
corresponding request.
"""

results = proto.RepeatedField(
proto.MESSAGE, number=2, message="SpeechRecognitionResult",
)
total_billed_time = proto.Field(
proto.MESSAGE, number=3, message=duration_pb2.Duration,
)


class LongRunningRecognizeResponse(proto.Message):
Expand All @@ -666,6 +672,9 @@ class LongRunningRecognizeResponse(proto.Message):
results (Sequence[google.cloud.speech_v1p1beta1.types.SpeechRecognitionResult]):
Sequential list of transcription results
corresponding to sequential portions of audio.
total_billed_time (google.protobuf.duration_pb2.Duration):
When available, billed audio seconds for the
corresponding request.
output_config (google.cloud.speech_v1p1beta1.types.TranscriptOutputConfig):
Original output config if present in the
request.
Expand All @@ -677,6 +686,9 @@ class LongRunningRecognizeResponse(proto.Message):
results = proto.RepeatedField(
proto.MESSAGE, number=2, message="SpeechRecognitionResult",
)
total_billed_time = proto.Field(
proto.MESSAGE, number=3, message=duration_pb2.Duration,
)
output_config = proto.Field(
proto.MESSAGE, number=6, message="TranscriptOutputConfig",
)
Expand Down Expand Up @@ -785,6 +797,10 @@ class StreamingRecognizeResponse(proto.Message):
``is_final=false`` results (the interim results).
speech_event_type (google.cloud.speech_v1p1beta1.types.StreamingRecognizeResponse.SpeechEventType):
Indicates the type of speech event.
total_billed_time (google.protobuf.duration_pb2.Duration):
When available, billed audio seconds for the
stream. Set only if this is the last response in
the stream.
"""

class SpeechEventType(proto.Enum):
Expand All @@ -797,6 +813,9 @@ class SpeechEventType(proto.Enum):
proto.MESSAGE, number=2, message="StreamingRecognitionResult",
)
speech_event_type = proto.Field(proto.ENUM, number=4, enum=SpeechEventType,)
total_billed_time = proto.Field(
proto.MESSAGE, number=5, message=duration_pb2.Duration,
)


class StreamingRecognitionResult(proto.Message):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ class CreatePhraseSetRequest(proto.Message):
created. Format:
{api_version}/projects/{project}/locations/{location}/phraseSets
phrase_set_id (str):
The ID to use for the phrase set, which will become the
final component of the phrase set's resource name.
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]-/.
Expand Down Expand Up @@ -157,8 +158,9 @@ class CreateCustomClassRequest(proto.Message):
be created. Format:
{api_version}/projects/{project}/locations/{location}/customClasses
custom_class_id (str):
The ID to use for the custom class, which will become the
final component of the custom class' resource name.
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]-/.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ def partition(
class speechCallTransformer(cst.CSTTransformer):
CTRL_PARAMS: Tuple[str] = ('retry', 'timeout', 'metadata')
METHOD_TO_PARAMS: Dict[str, Tuple[str]] = {
'create_custom_class': ('parent', 'custom_class', 'custom_class_id', ),
'create_phrase_set': ('parent', 'phrase_set', 'phrase_set_id', ),
'create_custom_class': ('parent', 'custom_class_id', 'custom_class', ),
'create_phrase_set': ('parent', 'phrase_set_id', 'phrase_set', ),
'delete_custom_class': ('name', ),
'delete_phrase_set': ('name', ),
'get_custom_class': ('name', ),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
from google.cloud.speech_v1p1beta1.types import resource
from google.longrunning import operations_pb2
from google.oauth2 import service_account
from google.protobuf import duration_pb2 # type: ignore
from google.protobuf import wrappers_pb2 # type: ignore
from google.rpc import status_pb2 # type: ignore
import google.auth
Expand Down

0 comments on commit 9f3896e

Please sign in to comment.