diff --git a/google/cloud/firestore_v1/client.py b/google/cloud/firestore_v1/client.py index 6ad5f76e64..9c4890b383 100644 --- a/google/cloud/firestore_v1/client.py +++ b/google/cloud/firestore_v1/client.py @@ -44,7 +44,7 @@ from google.cloud.firestore_v1.services.firestore.transports import ( grpc as firestore_grpc_transport, ) -from typing import Any, Generator, Iterable, Tuple +from typing import Any, Generator, Iterable, Tuple, Union # Types needed only for Type Hints from google.cloud.firestore_v1.base_document import DocumentSnapshot @@ -117,7 +117,7 @@ def _target(self): """ return self._target_helper(firestore_client.FirestoreClient) - def collection(self, *collection_path: Tuple[str]) -> CollectionReference: + def collection(self, *collection_path: Union[Tuple[str], str]) -> CollectionReference: """Get a reference to a collection. For a top-level collection: @@ -137,7 +137,7 @@ def collection(self, *collection_path: Tuple[str]) -> CollectionReference: Sub-collections can be nested deeper in a similar fashion. Args: - collection_path (Tuple[str, ...]): Can either be + collection_path (Union[Tuple[str, ...], str]): Can either be * A single ``/``-delimited path to a collection * A tuple of collection path segments @@ -170,7 +170,7 @@ def collection_group(self, collection_id: str) -> CollectionGroup: """ return CollectionGroup(self._get_collection_reference(collection_id)) - def document(self, *document_path: Tuple[str]) -> DocumentReference: + def document(self, *document_path: Union[Tuple[str], str]) -> DocumentReference: """Get a reference to a document in a collection. For a top-level document: @@ -192,7 +192,7 @@ def document(self, *document_path: Tuple[str]) -> DocumentReference: Documents in sub-collections can be nested deeper in a similar fashion. Args: - document_path (Tuple[str, ...]): Can either be + document_path (Union[Tuple[str, ...], str]): Can either be * A single ``/``-delimited path to a document * A tuple of document path segments