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

feat(v1p1beta1): add total_billed_time response field #219

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
10 changes: 6 additions & 4 deletions google/cloud/speech_v1p1beta1/services/adaptation/client.py
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
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
1 change: 1 addition & 0 deletions google/cloud/speech_v1p1beta1/services/speech/client.py
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
19 changes: 19 additions & 0 deletions google/cloud/speech_v1p1beta1/types/cloud_speech.py
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
10 changes: 6 additions & 4 deletions google/cloud/speech_v1p1beta1/types/cloud_speech_adaptation.py
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
4 changes: 2 additions & 2 deletions scripts/fixup_speech_v1p1beta1_keywords.py
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
1 change: 1 addition & 0 deletions tests/unit/gapic/speech_v1p1beta1/test_speech.py
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