Skip to content

Commit

Permalink
docs: added generated docs for Bundles (#416)
Browse files Browse the repository at this point in the history
* docs: added generated docs for Bundles

* removed whitespace

Co-authored-by: Tres Seaver <tseaver@palladion.com>
  • Loading branch information
craiglabenz and tseaver committed Aug 9, 2021
1 parent 1adfc81 commit 0176cc7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
6 changes: 6 additions & 0 deletions docs/bundles.rst
@@ -0,0 +1,6 @@
Bundles
~~~~~~~

.. automodule:: google.cloud.firestore_bundle.bundle
:members:
:show-inheritance:
1 change: 1 addition & 0 deletions docs/index.rst
Expand Up @@ -14,6 +14,7 @@ API Reference
field_path
query
batch
bundles
transaction
transforms
types
Expand Down
16 changes: 12 additions & 4 deletions google/cloud/firestore_bundle/bundle.py
Expand Up @@ -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.
Expand All @@ -88,6 +90,8 @@ def add_document(self, snapshot: DocumentSnapshot) -> "FirestoreBundle":
Example:
.. code-block:: python
from google.cloud import firestore
db = firestore.Client()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -293,6 +299,8 @@ def build(self) -> str:
Example:
.. code-block:: python
from google.cloud import firestore
db = firestore.Client()
Expand Down

0 comments on commit 0176cc7

Please sign in to comment.