Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add generated docs for Bundles #416

Merged
merged 3 commits into from Aug 9, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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