@@ -51,26 +51,19 @@ class FirestoreClient(object):
5151
5252 This service exposes several types of comparable timestamps:
5353
54- * ``create_time`` - The time at which a document was created. Changes only
55- ::
56-
57- when a document is deleted, then re-created. Increases in a strict
58- monotonic fashion.
59- * ``update_time`` - The time at which a document was last updated. Changes
60- ::
61-
62- every time a document is modified. Does not change when a write results
63- in no modifications. Increases in a strict monotonic fashion.
64- * ``read_time`` - The time at which a particular state was observed. Used
65- ::
66-
67- to denote a consistent snapshot of the database or the time at which a
68- Document was observed to not exist.
69- * ``commit_time`` - The time at which the writes in a transaction were
70- ::
71-
72- committed. Any read with an equal or greater `read_time` is guaranteed
73- to see the effects of the transaction.
54+ - ``create_time`` - The time at which a document was created. Changes
55+ only when a document is deleted, then re-created. Increases in a
56+ strict monotonic fashion.
57+ - ``update_time`` - The time at which a document was last updated.
58+ Changes every time a document is modified. Does not change when a
59+ write results in no modifications. Increases in a strict monotonic
60+ fashion.
61+ - ``read_time`` - The time at which a particular state was observed.
62+ Used to denote a consistent snapshot of the database or the time at
63+ which a Document was observed to not exist.
64+ - ``commit_time`` - The time at which the writes in a transaction were
65+ committed. Any read with an equal or greater ``read_time`` is
66+ guaranteed to see the effects of the transaction.
7467 """
7568
7669 SERVICE_ADDRESS = 'firestore.googleapis.com:443'
@@ -209,9 +202,10 @@ def __init__(self,
209202 )
210203
211204 if client_info is None :
212- client_info = (
213- google .api_core .gapic_v1 .client_info .DEFAULT_CLIENT_INFO )
214- client_info .gapic_version = _GAPIC_LIBRARY_VERSION
205+ client_info = google .api_core .gapic_v1 .client_info .ClientInfo (
206+ gapic_version = _GAPIC_LIBRARY_VERSION , )
207+ else :
208+ client_info .gapic_version = _GAPIC_LIBRARY_VERSION
215209 self ._client_info = client_info
216210
217211 # Parse out the default settings for retry and timeout for each RPC
@@ -255,11 +249,13 @@ def get_document(self,
255249
256250 If the document has a field that is not present in this mask, that field
257251 will not be returned in the response.
252+
258253 If a dict is provided, it must be of the same form as the protobuf
259254 message :class:`~google.cloud.firestore_v1beta1.types.DocumentMask`
260255 transaction (bytes): Reads the document in a transaction.
261256 read_time (Union[dict, ~google.cloud.firestore_v1beta1.types.Timestamp]): Reads the version of the document at the given time.
262257 This may not be older than 60 seconds.
258+
263259 If a dict is provided, it must be of the same form as the protobuf
264260 message :class:`~google.cloud.firestore_v1beta1.types.Timestamp`
265261 retry (Optional[google.api_core.retry.Retry]): A retry object used
@@ -330,7 +326,7 @@ def list_documents(self,
330326 >>>
331327 >>> parent = client.any_path_path('[PROJECT]', '[DATABASE]', '[DOCUMENT]', '[ANY_PATH]')
332328 >>>
333- >>> # TODO: Initialize `` collection_id` `:
329+ >>> # TODO: Initialize `collection_id`:
334330 >>> collection_id = ''
335331 >>>
336332 >>> # Iterate over all results
@@ -342,7 +338,7 @@ def list_documents(self,
342338 >>> # Alternatively:
343339 >>>
344340 >>> # Iterate over results one page at a time
345- >>> for page in client.list_documents(parent, collection_id, options=CallOptions(page_token=INITIAL_PAGE)) :
341+ >>> for page in client.list_documents(parent, collection_id).pages :
346342 ... for element in page:
347343 ... # process element
348344 ... pass
@@ -351,11 +347,10 @@ def list_documents(self,
351347 parent (str): The parent resource name. In the format:
352348 ``projects/{project_id}/databases/{database_id}/documents`` or
353349 ``projects/{project_id}/databases/{database_id}/documents/{document_path}``.
354- For example:
355- ``projects/my-project/databases/my-database/documents`` or
350+ For example: ``projects/my-project/databases/my-database/documents`` or
356351 ``projects/my-project/databases/my-database/documents/chatrooms/my-chatroom``
357- collection_id (str): The collection ID, relative to ``parent``, to list. For example: ``chatrooms``
358- or ``messages``.
352+ collection_id (str): The collection ID, relative to ``parent``, to list. For example:
353+ ``chatrooms`` or ``messages``.
359354 page_size (int): The maximum number of resources contained in the
360355 underlying API response. If page streaming is performed per-
361356 resource, this parameter does not affect the return value. If page
@@ -366,17 +361,19 @@ def list_documents(self,
366361
367362 If a document has a field that is not present in this mask, that field
368363 will not be returned in the response.
364+
369365 If a dict is provided, it must be of the same form as the protobuf
370366 message :class:`~google.cloud.firestore_v1beta1.types.DocumentMask`
371367 transaction (bytes): Reads documents in a transaction.
372368 read_time (Union[dict, ~google.cloud.firestore_v1beta1.types.Timestamp]): Reads documents as they were at the given time.
373369 This may not be older than 60 seconds.
370+
374371 If a dict is provided, it must be of the same form as the protobuf
375372 message :class:`~google.cloud.firestore_v1beta1.types.Timestamp`
376373 show_missing (bool): If the list should show missing documents. A missing document is a
377374 document that does not exist but has sub-documents. These documents will
378- be returned with a key but will not have fields, ``Document.create_time``,
379- or ``Document.update_time`` set.
375+ be returned with a key but will not have fields,
376+ ``Document.create_time``, or ``Document.update_time`` set.
380377
381378 Requests with ``show_missing`` may not specify ``where`` or
382379 ``order_by``.
@@ -463,13 +460,13 @@ def create_document(self,
463460 >>>
464461 >>> parent = client.any_path_path('[PROJECT]', '[DATABASE]', '[DOCUMENT]', '[ANY_PATH]')
465462 >>>
466- >>> # TODO: Initialize `` collection_id` `:
463+ >>> # TODO: Initialize `collection_id`:
467464 >>> collection_id = ''
468465 >>>
469- >>> # TODO: Initialize `` document_id` `:
466+ >>> # TODO: Initialize `document_id`:
470467 >>> document_id = ''
471468 >>>
472- >>> # TODO: Initialize `` document` `:
469+ >>> # TODO: Initialize `document`:
473470 >>> document = {}
474471 >>>
475472 >>> response = client.create_document(parent, collection_id, document_id, document)
@@ -478,17 +475,20 @@ def create_document(self,
478475 parent (str): The parent resource. For example:
479476 ``projects/{project_id}/databases/{database_id}/documents`` or
480477 ``projects/{project_id}/databases/{database_id}/documents/chatrooms/{chatroom_id}``
481- collection_id (str): The collection ID, relative to ``parent``, to list. For example: ``chatrooms``.
478+ collection_id (str): The collection ID, relative to ``parent``, to list. For example:
479+ ``chatrooms``.
482480 document_id (str): The client-assigned document ID to use for this document.
483481
484482 Optional. If not specified, an ID will be assigned by the service.
485483 document (Union[dict, ~google.cloud.firestore_v1beta1.types.Document]): The document to create. ``name`` must not be set.
484+
486485 If a dict is provided, it must be of the same form as the protobuf
487486 message :class:`~google.cloud.firestore_v1beta1.types.Document`
488487 mask (Union[dict, ~google.cloud.firestore_v1beta1.types.DocumentMask]): The fields to return. If not set, returns all fields.
489488
490489 If the document has a field that is not present in this mask, that field
491490 will not be returned in the response.
491+
492492 If a dict is provided, it must be of the same form as the protobuf
493493 message :class:`~google.cloud.firestore_v1beta1.types.DocumentMask`
494494 retry (Optional[google.api_core.retry.Retry]): A retry object used
@@ -547,17 +547,18 @@ def update_document(self,
547547 >>>
548548 >>> client = firestore_v1beta1.FirestoreClient()
549549 >>>
550- >>> # TODO: Initialize `` document` `:
550+ >>> # TODO: Initialize `document`:
551551 >>> document = {}
552552 >>>
553- >>> # TODO: Initialize `` update_mask` `:
553+ >>> # TODO: Initialize `update_mask`:
554554 >>> update_mask = {}
555555 >>>
556556 >>> response = client.update_document(document, update_mask)
557557
558558 Args:
559559 document (Union[dict, ~google.cloud.firestore_v1beta1.types.Document]): The updated document.
560560 Creates the document if it does not already exist.
561+
561562 If a dict is provided, it must be of the same form as the protobuf
562563 message :class:`~google.cloud.firestore_v1beta1.types.Document`
563564 update_mask (Union[dict, ~google.cloud.firestore_v1beta1.types.DocumentMask]): The fields to update.
@@ -567,16 +568,19 @@ def update_document(self,
567568 mask, they are left unchanged.
568569 Fields referenced in the mask, but not present in the input document, are
569570 deleted from the document on the server.
571+
570572 If a dict is provided, it must be of the same form as the protobuf
571573 message :class:`~google.cloud.firestore_v1beta1.types.DocumentMask`
572574 mask (Union[dict, ~google.cloud.firestore_v1beta1.types.DocumentMask]): The fields to return. If not set, returns all fields.
573575
574576 If the document has a field that is not present in this mask, that field
575577 will not be returned in the response.
578+
576579 If a dict is provided, it must be of the same form as the protobuf
577580 message :class:`~google.cloud.firestore_v1beta1.types.DocumentMask`
578581 current_document (Union[dict, ~google.cloud.firestore_v1beta1.types.Precondition]): An optional precondition on the document.
579582 The request will fail if this is set and not met by the target document.
583+
580584 If a dict is provided, it must be of the same form as the protobuf
581585 message :class:`~google.cloud.firestore_v1beta1.types.Precondition`
582586 retry (Optional[google.api_core.retry.Retry]): A retry object used
@@ -641,6 +645,7 @@ def delete_document(self,
641645 ``projects/{project_id}/databases/{database_id}/documents/{document_path}``.
642646 current_document (Union[dict, ~google.cloud.firestore_v1beta1.types.Precondition]): An optional precondition on the document.
643647 The request will fail if this is set and not met by the target document.
648+
644649 If a dict is provided, it must be of the same form as the protobuf
645650 message :class:`~google.cloud.firestore_v1beta1.types.Precondition`
646651 retry (Optional[google.api_core.retry.Retry]): A retry object used
@@ -700,7 +705,7 @@ def batch_get_documents(self,
700705 >>>
701706 >>> database = client.database_root_path('[PROJECT]', '[DATABASE]')
702707 >>>
703- >>> # TODO: Initialize `` documents` `:
708+ >>> # TODO: Initialize `documents`:
704709 >>> documents = []
705710 >>>
706711 >>> for element in client.batch_get_documents(database, documents):
@@ -712,23 +717,26 @@ def batch_get_documents(self,
712717 ``projects/{project_id}/databases/{database_id}``.
713718 documents (list[str]): The names of the documents to retrieve. In the format:
714719 ``projects/{project_id}/databases/{database_id}/documents/{document_path}``.
715- The request will fail if any of the document is not a child resource of the
716- given ``database``. Duplicate names will be elided.
720+ The request will fail if any of the document is not a child resource of
721+ the given ``database``. Duplicate names will be elided.
717722 mask (Union[dict, ~google.cloud.firestore_v1beta1.types.DocumentMask]): The fields to return. If not set, returns all fields.
718723
719724 If a document has a field that is not present in this mask, that field will
720725 not be returned in the response.
726+
721727 If a dict is provided, it must be of the same form as the protobuf
722728 message :class:`~google.cloud.firestore_v1beta1.types.DocumentMask`
723729 transaction (bytes): Reads documents in a transaction.
724730 new_transaction (Union[dict, ~google.cloud.firestore_v1beta1.types.TransactionOptions]): Starts a new transaction and reads the documents.
725731 Defaults to a read-only transaction.
726732 The new transaction ID will be returned as the first response in the
727733 stream.
734+
728735 If a dict is provided, it must be of the same form as the protobuf
729736 message :class:`~google.cloud.firestore_v1beta1.types.TransactionOptions`
730737 read_time (Union[dict, ~google.cloud.firestore_v1beta1.types.Timestamp]): Reads documents as they were at the given time.
731738 This may not be older than 60 seconds.
739+
732740 If a dict is provided, it must be of the same form as the protobuf
733741 message :class:`~google.cloud.firestore_v1beta1.types.Timestamp`
734742 retry (Optional[google.api_core.retry.Retry]): A retry object used
@@ -804,6 +812,7 @@ def begin_transaction(self,
804812 ``projects/{project_id}/databases/{database_id}``.
805813 options_ (Union[dict, ~google.cloud.firestore_v1beta1.types.TransactionOptions]): The options for the transaction.
806814 Defaults to a read-write transaction.
815+
807816 If a dict is provided, it must be of the same form as the protobuf
808817 message :class:`~google.cloud.firestore_v1beta1.types.TransactionOptions`
809818 retry (Optional[google.api_core.retry.Retry]): A retry object used
@@ -861,7 +870,7 @@ def commit(self,
861870 >>>
862871 >>> database = client.database_root_path('[PROJECT]', '[DATABASE]')
863872 >>>
864- >>> # TODO: Initialize `` writes` `:
873+ >>> # TODO: Initialize `writes`:
865874 >>> writes = []
866875 >>>
867876 >>> response = client.commit(database, writes)
@@ -872,6 +881,7 @@ def commit(self,
872881 writes (list[Union[dict, ~google.cloud.firestore_v1beta1.types.Write]]): The writes to apply.
873882
874883 Always executed atomically and in order.
884+
875885 If a dict is provided, it must be of the same form as the protobuf
876886 message :class:`~google.cloud.firestore_v1beta1.types.Write`
877887 transaction (bytes): If set, applies all writes in this transaction, and commits it.
@@ -928,7 +938,7 @@ def rollback(self,
928938 >>>
929939 >>> database = client.database_root_path('[PROJECT]', '[DATABASE]')
930940 >>>
931- >>> # TODO: Initialize `` transaction` `:
941+ >>> # TODO: Initialize `transaction`:
932942 >>> transaction = b''
933943 >>>
934944 >>> client.rollback(database, transaction)
@@ -997,21 +1007,23 @@ def run_query(self,
9971007 parent (str): The parent resource name. In the format:
9981008 ``projects/{project_id}/databases/{database_id}/documents`` or
9991009 ``projects/{project_id}/databases/{database_id}/documents/{document_path}``.
1000- For example:
1001- ``projects/my-project/databases/my-database/documents`` or
1010+ For example: ``projects/my-project/databases/my-database/documents`` or
10021011 ``projects/my-project/databases/my-database/documents/chatrooms/my-chatroom``
10031012 structured_query (Union[dict, ~google.cloud.firestore_v1beta1.types.StructuredQuery]): A structured query.
1013+
10041014 If a dict is provided, it must be of the same form as the protobuf
10051015 message :class:`~google.cloud.firestore_v1beta1.types.StructuredQuery`
10061016 transaction (bytes): Reads documents in a transaction.
10071017 new_transaction (Union[dict, ~google.cloud.firestore_v1beta1.types.TransactionOptions]): Starts a new transaction and reads the documents.
10081018 Defaults to a read-only transaction.
10091019 The new transaction ID will be returned as the first response in the
10101020 stream.
1021+
10111022 If a dict is provided, it must be of the same form as the protobuf
10121023 message :class:`~google.cloud.firestore_v1beta1.types.TransactionOptions`
10131024 read_time (Union[dict, ~google.cloud.firestore_v1beta1.types.Timestamp]): Reads documents as they were at the given time.
10141025 This may not be older than 60 seconds.
1026+
10151027 If a dict is provided, it must be of the same form as the protobuf
10161028 message :class:`~google.cloud.firestore_v1beta1.types.Timestamp`
10171029 retry (Optional[google.api_core.retry.Retry]): A retry object used
@@ -1207,7 +1219,7 @@ def list_collection_ids(self,
12071219 >>> # Alternatively:
12081220 >>>
12091221 >>> # Iterate over results one page at a time
1210- >>> for page in client.list_collection_ids(parent, options=CallOptions(page_token=INITIAL_PAGE)) :
1222+ >>> for page in client.list_collection_ids(parent).pages :
12111223 ... for element in page:
12121224 ... # process element
12131225 ... pass
0 commit comments