def list_documents( self, request: firestore.ListDocumentsRequest = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListDocumentsPager: r"""Lists documents. Args: request (:class:`~.firestore.ListDocumentsRequest`): The request object. The request for [Firestore.ListDocuments][google.firestore.v1.Firestore.ListDocuments]. 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: ~.pagers.ListDocumentsPager: The response for [Firestore.ListDocuments][google.firestore.v1.Firestore.ListDocuments]. Iterating over this object will yield results and resolve additional pages automatically. """ # Create or coerce a protobuf request object. request = firestore.ListDocumentsRequest(request) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method.wrap_method( self._transport.list_documents, 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((("parent", request.parent),)), ) # Send the request. response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListDocumentsPager( method=rpc, request=request, response=response, metadata=metadata, ) # Done; return the response. return response
def __init__(self, method: Callable[..., firestore.ListDocumentsResponse], request: firestore.ListDocumentsRequest, response: firestore.ListDocumentsResponse, *, metadata: Sequence[Tuple[str, str]] = ()): """Instantiate the pager. Args: method (Callable): The method that was originally called, and which instantiated this pager. request (google.cloud.firestore_v1.types.ListDocumentsRequest): The initial request object. response (google.cloud.firestore_v1.types.ListDocumentsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. """ self._method = method self._request = firestore.ListDocumentsRequest(request) self._response = response self._metadata = metadata
async def list_documents( self, request: firestore.ListDocumentsRequest = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListDocumentsAsyncPager: r"""Lists documents. Args: request (:class:`google.cloud.firestore_v1.types.ListDocumentsRequest`): The request object. The request for [Firestore.ListDocuments][google.firestore.v1.Firestore.ListDocuments]. 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.services.firestore.pagers.ListDocumentsAsyncPager: The response for [Firestore.ListDocuments][google.firestore.v1.Firestore.ListDocuments]. Iterating over this object will yield results and resolve additional pages automatically. """ # Create or coerce a protobuf request object. request = firestore.ListDocumentsRequest(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.list_documents, 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((("parent", request.parent),)), ) # Send the request. response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListDocumentsAsyncPager( method=rpc, request=request, response=response, metadata=metadata, ) # Done; return the response. return response