async def get_document( self, request: firestore.GetDocumentRequest = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> document.Document: r"""Gets a single document. Args: request (:class:`google.cloud.firestore_v1.types.GetDocumentRequest`): The request object. The request for [Firestore.GetDocument][google.firestore.v1.Firestore.GetDocument]. 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: google.cloud.firestore_v1.types.Document: A Firestore document. Must not exceed 1 MiB - 4 bytes. """ # Create or coerce a protobuf request object. request = firestore.GetDocumentRequest(request) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( self._client._transport.get_document, default_retry=retries.Retry( initial=0.1, maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.InternalServerError, exceptions.ServiceUnavailable, ), ), default_timeout=60.0, 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 get_document( self, request: firestore.GetDocumentRequest = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> document.Document: r"""Gets a single document. Args: request (:class:`~.firestore.GetDocumentRequest`): The request object. The request for [Firestore.GetDocument][google.firestore.v1.Firestore.GetDocument]. 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: ~.document.Document: A Firestore document. Must not exceed 1 MiB - 4 bytes. """ # Create or coerce a protobuf request object. request = firestore.GetDocumentRequest(request) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( self._client._transport.get_document, default_timeout=None, client_info=_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