From 0176cc7fef8752433b5c2496046d3a56557eb824 Mon Sep 17 00:00:00 2001 From: Craig Labenz Date: Mon, 9 Aug 2021 13:26:15 -0400 Subject: [PATCH] docs: added generated docs for Bundles (#416) * docs: added generated docs for Bundles * removed whitespace Co-authored-by: Tres Seaver --- docs/bundles.rst | 6 ++++++ docs/index.rst | 1 + google/cloud/firestore_bundle/bundle.py | 16 ++++++++++++---- 3 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 docs/bundles.rst diff --git a/docs/bundles.rst b/docs/bundles.rst new file mode 100644 index 000000000..92724a3b6 --- /dev/null +++ b/docs/bundles.rst @@ -0,0 +1,6 @@ +Bundles +~~~~~~~ + +.. automodule:: google.cloud.firestore_bundle.bundle + :members: + :show-inheritance: diff --git a/docs/index.rst b/docs/index.rst index 34002786f..3fce768ab 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -14,6 +14,7 @@ API Reference field_path query batch + bundles transaction transforms types diff --git a/google/cloud/firestore_bundle/bundle.py b/google/cloud/firestore_bundle/bundle.py index eae1fa3f4..73a53aadb 100644 --- a/google/cloud/firestore_bundle/bundle.py +++ b/google/cloud/firestore_bundle/bundle.py @@ -51,20 +51,22 @@ class FirestoreBundle: Usage: - from google.cloud.firestore import Client + .. code-block:: python + + from google.cloud.firestore import Client, _helpers from google.cloud.firestore_bundle import FirestoreBundle - from google.cloud.firestore import _helpers db = Client() bundle = FirestoreBundle('my-bundle') bundle.add_named_query('all-users', db.collection('users')._query()) bundle.add_named_query( 'top-ten-hamburgers', - db.collection('hamburgers').limit(limit=10)._query(), + db.collection('hamburgers').limit(limit=10), ) serialized: str = bundle.build() - # Store somewhere like your GCS for retrieval by a client SDK. + # Store somewhere like a Google Cloud Storage bucket for retrieval by + # a client SDK. Args: name (str): The Id of the bundle. @@ -88,6 +90,8 @@ def add_document(self, snapshot: DocumentSnapshot) -> "FirestoreBundle": Example: + .. code-block:: python + from google.cloud import firestore db = firestore.Client() @@ -142,6 +146,8 @@ def add_named_query(self, name: str, query: BaseQuery) -> "FirestoreBundle": Example: + .. code-block:: python + from google.cloud import firestore db = firestore.Client() @@ -293,6 +299,8 @@ def build(self) -> str: Example: + .. code-block:: python + from google.cloud import firestore db = firestore.Client()