|
47 | 47 |
|
48 | 48 | from google.api_core import operation # type: ignore
|
49 | 49 | from google.api_core import operation_async # type: ignore
|
| 50 | +from google.cloud.location import locations_pb2 # type: ignore |
50 | 51 | from google.cloud.speech_v2.services.speech import pagers
|
51 | 52 | from google.cloud.speech_v2.types import cloud_speech
|
52 | 53 | from google.longrunning import operations_pb2
|
@@ -500,7 +501,7 @@ async def get_recognizer(
|
500 | 501 | r"""Returns the requested
|
501 | 502 | [Recognizer][google.cloud.speech.v2.Recognizer]. Fails with
|
502 | 503 | [NOT_FOUND][google.rpc.Code.NOT_FOUND] if the requested
|
503 |
| - recognizer doesn't exist. |
| 504 | + Recognizer doesn't exist. |
504 | 505 |
|
505 | 506 | .. code-block:: python
|
506 | 507 |
|
@@ -1405,7 +1406,8 @@ async def sample_batch_recognize():
|
1405 | 1406 | should not be set.
|
1406 | 1407 | files (:class:`MutableSequence[google.cloud.speech_v2.types.BatchRecognizeFileMetadata]`):
|
1407 | 1408 | Audio files with file metadata for
|
1408 |
| - ASR. |
| 1409 | + ASR. The maximum number of files allowed |
| 1410 | + to be specified is 5. |
1409 | 1411 |
|
1410 | 1412 | This corresponds to the ``files`` field
|
1411 | 1413 | on the ``request`` instance; if ``request`` is provided, this
|
@@ -3401,6 +3403,114 @@ async def cancel_operation(
|
3401 | 3403 | metadata=metadata,
|
3402 | 3404 | )
|
3403 | 3405 |
|
| 3406 | + async def get_location( |
| 3407 | + self, |
| 3408 | + request: Optional[locations_pb2.GetLocationRequest] = None, |
| 3409 | + *, |
| 3410 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 3411 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
| 3412 | + metadata: Sequence[Tuple[str, str]] = (), |
| 3413 | + ) -> locations_pb2.Location: |
| 3414 | + r"""Gets information about a location. |
| 3415 | +
|
| 3416 | + Args: |
| 3417 | + request (:class:`~.location_pb2.GetLocationRequest`): |
| 3418 | + The request object. Request message for |
| 3419 | + `GetLocation` method. |
| 3420 | + retry (google.api_core.retry.Retry): Designation of what errors, |
| 3421 | + if any, should be retried. |
| 3422 | + timeout (float): The timeout for this request. |
| 3423 | + metadata (Sequence[Tuple[str, str]]): Strings which should be |
| 3424 | + sent along with the request as metadata. |
| 3425 | + Returns: |
| 3426 | + ~.location_pb2.Location: |
| 3427 | + Location object. |
| 3428 | + """ |
| 3429 | + # Create or coerce a protobuf request object. |
| 3430 | + # The request isn't a proto-plus wrapped type, |
| 3431 | + # so it must be constructed via keyword expansion. |
| 3432 | + if isinstance(request, dict): |
| 3433 | + request = locations_pb2.GetLocationRequest(**request) |
| 3434 | + |
| 3435 | + # Wrap the RPC method; this adds retry and timeout information, |
| 3436 | + # and friendly error handling. |
| 3437 | + rpc = gapic_v1.method.wrap_method( |
| 3438 | + self._client._transport.get_location, |
| 3439 | + default_timeout=None, |
| 3440 | + client_info=DEFAULT_CLIENT_INFO, |
| 3441 | + ) |
| 3442 | + |
| 3443 | + # Certain fields should be provided within the metadata header; |
| 3444 | + # add these here. |
| 3445 | + metadata = tuple(metadata) + ( |
| 3446 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 3447 | + ) |
| 3448 | + |
| 3449 | + # Send the request. |
| 3450 | + response = await rpc( |
| 3451 | + request, |
| 3452 | + retry=retry, |
| 3453 | + timeout=timeout, |
| 3454 | + metadata=metadata, |
| 3455 | + ) |
| 3456 | + |
| 3457 | + # Done; return the response. |
| 3458 | + return response |
| 3459 | + |
| 3460 | + async def list_locations( |
| 3461 | + self, |
| 3462 | + request: Optional[locations_pb2.ListLocationsRequest] = None, |
| 3463 | + *, |
| 3464 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 3465 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
| 3466 | + metadata: Sequence[Tuple[str, str]] = (), |
| 3467 | + ) -> locations_pb2.ListLocationsResponse: |
| 3468 | + r"""Lists information about the supported locations for this service. |
| 3469 | +
|
| 3470 | + Args: |
| 3471 | + request (:class:`~.location_pb2.ListLocationsRequest`): |
| 3472 | + The request object. Request message for |
| 3473 | + `ListLocations` method. |
| 3474 | + retry (google.api_core.retry.Retry): Designation of what errors, |
| 3475 | + if any, should be retried. |
| 3476 | + timeout (float): The timeout for this request. |
| 3477 | + metadata (Sequence[Tuple[str, str]]): Strings which should be |
| 3478 | + sent along with the request as metadata. |
| 3479 | + Returns: |
| 3480 | + ~.location_pb2.ListLocationsResponse: |
| 3481 | + Response message for ``ListLocations`` method. |
| 3482 | + """ |
| 3483 | + # Create or coerce a protobuf request object. |
| 3484 | + # The request isn't a proto-plus wrapped type, |
| 3485 | + # so it must be constructed via keyword expansion. |
| 3486 | + if isinstance(request, dict): |
| 3487 | + request = locations_pb2.ListLocationsRequest(**request) |
| 3488 | + |
| 3489 | + # Wrap the RPC method; this adds retry and timeout information, |
| 3490 | + # and friendly error handling. |
| 3491 | + rpc = gapic_v1.method.wrap_method( |
| 3492 | + self._client._transport.list_locations, |
| 3493 | + default_timeout=None, |
| 3494 | + client_info=DEFAULT_CLIENT_INFO, |
| 3495 | + ) |
| 3496 | + |
| 3497 | + # Certain fields should be provided within the metadata header; |
| 3498 | + # add these here. |
| 3499 | + metadata = tuple(metadata) + ( |
| 3500 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 3501 | + ) |
| 3502 | + |
| 3503 | + # Send the request. |
| 3504 | + response = await rpc( |
| 3505 | + request, |
| 3506 | + retry=retry, |
| 3507 | + timeout=timeout, |
| 3508 | + metadata=metadata, |
| 3509 | + ) |
| 3510 | + |
| 3511 | + # Done; return the response. |
| 3512 | + return response |
| 3513 | + |
3404 | 3514 | async def __aenter__(self):
|
3405 | 3515 | return self
|
3406 | 3516 |
|
|
0 commit comments