Skip to content

Commit 1b856e3

Browse files
committed
1 parent 1713764 commit 1b856e3

9 files changed

Lines changed: 257 additions & 90 deletions

File tree

google/cloud/firestore_admin_v1/types/index.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,14 @@ class ArrayConfig(proto.Enum):
112112
CONTAINS = 1
113113

114114
field_path = proto.Field(proto.STRING, number=1)
115-
order = proto.Field(proto.ENUM, number=2, enum="Index.IndexField.Order",)
115+
order = proto.Field(
116+
proto.ENUM, number=2, enum="Index.IndexField.Order", oneof="value_mode"
117+
)
116118
array_config = proto.Field(
117-
proto.ENUM, number=3, enum="Index.IndexField.ArrayConfig",
119+
proto.ENUM,
120+
number=3,
121+
enum="Index.IndexField.ArrayConfig",
122+
oneof="value_mode",
118123
)
119124

120125
name = proto.Field(proto.STRING, number=1)

google/cloud/firestore_v1/types/common.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,10 @@ class Precondition(proto.Message):
5757
have been last updated at that time.
5858
"""
5959

60-
exists = proto.Field(proto.BOOL, number=1)
61-
update_time = proto.Field(proto.MESSAGE, number=2, message=timestamp.Timestamp,)
60+
exists = proto.Field(proto.BOOL, number=1, oneof="condition_type")
61+
update_time = proto.Field(
62+
proto.MESSAGE, number=2, message=timestamp.Timestamp, oneof="condition_type"
63+
)
6264

6365

6466
class TransactionOptions(proto.Message):
@@ -94,10 +96,15 @@ class ReadOnly(proto.Message):
9496
This may not be older than 60 seconds.
9597
"""
9698

97-
read_time = proto.Field(proto.MESSAGE, number=2, message=timestamp.Timestamp,)
99+
read_time = proto.Field(
100+
proto.MESSAGE,
101+
number=2,
102+
message=timestamp.Timestamp,
103+
oneof="consistency_selector",
104+
)
98105

99-
read_only = proto.Field(proto.MESSAGE, number=2, message=ReadOnly,)
100-
read_write = proto.Field(proto.MESSAGE, number=3, message=ReadWrite,)
106+
read_only = proto.Field(proto.MESSAGE, number=2, message=ReadOnly, oneof="mode")
107+
read_write = proto.Field(proto.MESSAGE, number=3, message=ReadWrite, oneof="mode")
101108

102109

103110
__all__ = tuple(sorted(__protobuf__.manifest))

google/cloud/firestore_v1/types/firestore.py

Lines changed: 70 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,15 @@ class GetDocumentRequest(proto.Message):
8383
seconds.
8484
"""
8585

86-
name = proto.Field(proto.STRING, number=1)
86+
name = proto.Field(proto.STRING, number=1,)
8787
mask = proto.Field(proto.MESSAGE, number=2, message=common.DocumentMask,)
88-
transaction = proto.Field(proto.BYTES, number=3)
89-
read_time = proto.Field(proto.MESSAGE, number=5, message=timestamp.Timestamp,)
88+
transaction = proto.Field(proto.BYTES, number=3, oneof="consistency_selector")
89+
read_time = proto.Field(
90+
proto.MESSAGE,
91+
number=5,
92+
message=timestamp.Timestamp,
93+
oneof="consistency_selector",
94+
)
9095

9196

9297
class ListDocumentsRequest(proto.Message):
@@ -144,8 +149,13 @@ class ListDocumentsRequest(proto.Message):
144149
page_token = proto.Field(proto.STRING, number=4)
145150
order_by = proto.Field(proto.STRING, number=6)
146151
mask = proto.Field(proto.MESSAGE, number=7, message=common.DocumentMask,)
147-
transaction = proto.Field(proto.BYTES, number=8)
148-
read_time = proto.Field(proto.MESSAGE, number=10, message=timestamp.Timestamp,)
152+
transaction = proto.Field(proto.BYTES, number=8, oneof="consistency_selector")
153+
read_time = proto.Field(
154+
proto.MESSAGE,
155+
number=10,
156+
message=timestamp.Timestamp,
157+
oneof="consistency_selector",
158+
)
149159
show_missing = proto.Field(proto.BOOL, number=12)
150160

151161

@@ -300,11 +310,19 @@ class BatchGetDocumentsRequest(proto.Message):
300310
database = proto.Field(proto.STRING, number=1)
301311
documents = proto.RepeatedField(proto.STRING, number=2)
302312
mask = proto.Field(proto.MESSAGE, number=3, message=common.DocumentMask,)
303-
transaction = proto.Field(proto.BYTES, number=4)
313+
transaction = proto.Field(proto.BYTES, number=4, oneof="consistency_selector")
304314
new_transaction = proto.Field(
305-
proto.MESSAGE, number=5, message=common.TransactionOptions,
315+
proto.MESSAGE,
316+
number=5,
317+
message=common.TransactionOptions,
318+
oneof="consistency_selector",
319+
)
320+
read_time = proto.Field(
321+
proto.MESSAGE,
322+
number=7,
323+
message=timestamp.Timestamp,
324+
oneof="consistency_selector",
306325
)
307-
read_time = proto.Field(proto.MESSAGE, number=7, message=timestamp.Timestamp,)
308326

309327

310328
class BatchGetDocumentsResponse(proto.Message):
@@ -330,8 +348,10 @@ class BatchGetDocumentsResponse(proto.Message):
330348
between their read_time and this one.
331349
"""
332350

333-
found = proto.Field(proto.MESSAGE, number=1, message=gf_document.Document,)
334-
missing = proto.Field(proto.STRING, number=2)
351+
found = proto.Field(
352+
proto.MESSAGE, number=1, message=gf_document.Document, oneof="result"
353+
)
354+
missing = proto.Field(proto.STRING, number=2, oneof="result")
335355
transaction = proto.Field(proto.BYTES, number=3)
336356
read_time = proto.Field(proto.MESSAGE, number=4, message=timestamp.Timestamp,)
337357

@@ -452,13 +472,21 @@ class RunQueryRequest(proto.Message):
452472

453473
parent = proto.Field(proto.STRING, number=1)
454474
structured_query = proto.Field(
455-
proto.MESSAGE, number=2, message=gf_query.StructuredQuery,
475+
proto.MESSAGE, number=2, message=gf_query.StructuredQuery, oneof="query_type"
456476
)
457-
transaction = proto.Field(proto.BYTES, number=5)
477+
transaction = proto.Field(proto.BYTES, number=5, oneof="consistency_selector")
458478
new_transaction = proto.Field(
459-
proto.MESSAGE, number=6, message=common.TransactionOptions,
479+
proto.MESSAGE,
480+
number=6,
481+
message=common.TransactionOptions,
482+
oneof="consistency_selector",
483+
)
484+
read_time = proto.Field(
485+
proto.MESSAGE,
486+
number=7,
487+
message=timestamp.Timestamp,
488+
oneof="consistency_selector",
460489
)
461-
read_time = proto.Field(proto.MESSAGE, number=7, message=timestamp.Timestamp,)
462490

463491

464492
class RunQueryResponse(proto.Message):
@@ -553,7 +581,7 @@ class PartitionQueryRequest(proto.Message):
553581

554582
parent = proto.Field(proto.STRING, number=1)
555583
structured_query = proto.Field(
556-
proto.MESSAGE, number=2, message=gf_query.StructuredQuery,
584+
proto.MESSAGE, number=2, message=gf_query.StructuredQuery, oneof="query_type"
557585
)
558586
partition_count = proto.Field(proto.INT64, number=3)
559587
page_token = proto.Field(proto.STRING, number=4)
@@ -702,8 +730,10 @@ class ListenRequest(proto.Message):
702730
"""
703731

704732
database = proto.Field(proto.STRING, number=1)
705-
add_target = proto.Field(proto.MESSAGE, number=2, message="Target",)
706-
remove_target = proto.Field(proto.INT32, number=3)
733+
add_target = proto.Field(
734+
proto.MESSAGE, number=2, message="Target", oneof="target_change"
735+
)
736+
remove_target = proto.Field(proto.INT32, number=3, oneof="target_change")
707737
labels = proto.MapField(proto.STRING, proto.STRING, number=4)
708738

709739

@@ -731,17 +761,21 @@ class ListenResponse(proto.Message):
731761
are unknown.
732762
"""
733763

734-
target_change = proto.Field(proto.MESSAGE, number=2, message="TargetChange",)
764+
target_change = proto.Field(
765+
proto.MESSAGE, number=2, message="TargetChange", oneof="response_type"
766+
)
735767
document_change = proto.Field(
736-
proto.MESSAGE, number=3, message=write.DocumentChange,
768+
proto.MESSAGE, number=3, message=write.DocumentChange, oneof="response_type"
737769
)
738770
document_delete = proto.Field(
739-
proto.MESSAGE, number=4, message=write.DocumentDelete,
771+
proto.MESSAGE, number=4, message=write.DocumentDelete, oneof="response_type"
740772
)
741773
document_remove = proto.Field(
742-
proto.MESSAGE, number=6, message=write.DocumentRemove,
774+
proto.MESSAGE, number=6, message=write.DocumentRemove, oneof="response_type"
775+
)
776+
filter = proto.Field(
777+
proto.MESSAGE, number=5, message=write.ExistenceFilter, oneof="response_type"
743778
)
744-
filter = proto.Field(proto.MESSAGE, number=5, message=write.ExistenceFilter,)
745779

746780

747781
class Target(proto.Message):
@@ -806,13 +840,22 @@ class QueryTarget(proto.Message):
806840

807841
parent = proto.Field(proto.STRING, number=1)
808842
structured_query = proto.Field(
809-
proto.MESSAGE, number=2, message=gf_query.StructuredQuery,
843+
proto.MESSAGE,
844+
number=2,
845+
message=gf_query.StructuredQuery,
846+
oneof="query_type",
810847
)
811848

812-
query = proto.Field(proto.MESSAGE, number=2, message=QueryTarget,)
813-
documents = proto.Field(proto.MESSAGE, number=3, message=DocumentsTarget,)
814-
resume_token = proto.Field(proto.BYTES, number=4)
815-
read_time = proto.Field(proto.MESSAGE, number=11, message=timestamp.Timestamp,)
849+
query = proto.Field(
850+
proto.MESSAGE, number=2, message=QueryTarget, oneof="target_type"
851+
)
852+
documents = proto.Field(
853+
proto.MESSAGE, number=3, message=DocumentsTarget, oneof="target_type"
854+
)
855+
resume_token = proto.Field(proto.BYTES, number=4, oneof="resume_type")
856+
read_time = proto.Field(
857+
proto.MESSAGE, number=11, message=timestamp.Timestamp, oneof="resume_type"
858+
)
816859
target_id = proto.Field(proto.INT32, number=5)
817860
once = proto.Field(proto.BOOL, number=6)
818861

google/cloud/firestore_v1/types/query.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,22 @@ class Filter(proto.Message):
109109
"""
110110

111111
composite_filter = proto.Field(
112-
proto.MESSAGE, number=1, message="StructuredQuery.CompositeFilter",
112+
proto.MESSAGE,
113+
number=1,
114+
message="StructuredQuery.CompositeFilter",
115+
oneof="filter_type",
113116
)
114117
field_filter = proto.Field(
115-
proto.MESSAGE, number=2, message="StructuredQuery.FieldFilter",
118+
proto.MESSAGE,
119+
number=2,
120+
message="StructuredQuery.FieldFilter",
121+
oneof="filter_type",
116122
)
117123
unary_filter = proto.Field(
118-
proto.MESSAGE, number=3, message="StructuredQuery.UnaryFilter",
124+
proto.MESSAGE,
125+
number=3,
126+
message="StructuredQuery.UnaryFilter",
127+
oneof="filter_type",
119128
)
120129

121130
class CompositeFilter(proto.Message):
@@ -194,7 +203,10 @@ class Operator(proto.Enum):
194203
proto.ENUM, number=1, enum="StructuredQuery.UnaryFilter.Operator",
195204
)
196205
field = proto.Field(
197-
proto.MESSAGE, number=2, message="StructuredQuery.FieldReference",
206+
proto.MESSAGE,
207+
number=2,
208+
message="StructuredQuery.FieldReference",
209+
oneof="operand_type",
198210
)
199211

200212
class Order(proto.Message):

google/cloud/firestore_v1/types/write.py

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,13 @@ class Write(proto.Message):
7272
by the target document.
7373
"""
7474

75-
update = proto.Field(proto.MESSAGE, number=1, message=gf_document.Document,)
76-
delete = proto.Field(proto.STRING, number=2)
77-
transform = proto.Field(proto.MESSAGE, number=6, message="DocumentTransform",)
75+
update = proto.Field(
76+
proto.MESSAGE, number=1, message=gf_document.Document, oneof="operation"
77+
)
78+
delete = proto.Field(proto.STRING, number=2, oneof="operation")
79+
transform = proto.Field(
80+
proto.MESSAGE, number=6, message="DocumentTransform", oneof="operation"
81+
)
7882
update_mask = proto.Field(proto.MESSAGE, number=3, message=common.DocumentMask,)
7983
update_transforms = proto.RepeatedField(
8084
proto.MESSAGE, number=7, message="DocumentTransform.FieldTransform",
@@ -188,16 +192,31 @@ class ServerValue(proto.Enum):
188192

189193
field_path = proto.Field(proto.STRING, number=1)
190194
set_to_server_value = proto.Field(
191-
proto.ENUM, number=2, enum="DocumentTransform.FieldTransform.ServerValue",
195+
proto.ENUM,
196+
number=2,
197+
enum="DocumentTransform.FieldTransform.ServerValue",
198+
oneof="transform_type",
199+
)
200+
increment = proto.Field(
201+
proto.MESSAGE, number=3, message=gf_document.Value, oneof="transform_type"
202+
)
203+
maximum = proto.Field(
204+
proto.MESSAGE, number=4, message=gf_document.Value, oneof="transform_type"
205+
)
206+
minimum = proto.Field(
207+
proto.MESSAGE, number=5, message=gf_document.Value, oneof="transform_type"
192208
)
193-
increment = proto.Field(proto.MESSAGE, number=3, message=gf_document.Value,)
194-
maximum = proto.Field(proto.MESSAGE, number=4, message=gf_document.Value,)
195-
minimum = proto.Field(proto.MESSAGE, number=5, message=gf_document.Value,)
196209
append_missing_elements = proto.Field(
197-
proto.MESSAGE, number=6, message=gf_document.ArrayValue,
210+
proto.MESSAGE,
211+
number=6,
212+
message=gf_document.ArrayValue,
213+
oneof="transform_type",
198214
)
199215
remove_all_from_array = proto.Field(
200-
proto.MESSAGE, number=7, message=gf_document.ArrayValue,
216+
proto.MESSAGE,
217+
number=7,
218+
message=gf_document.ArrayValue,
219+
oneof="transform_type",
201220
)
202221

203222
document = proto.Field(proto.STRING, number=1)

google/cloud/firestore_v1beta1/types/common.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,10 @@ class Precondition(proto.Message):
5757
have been last updated at that time.
5858
"""
5959

60-
exists = proto.Field(proto.BOOL, number=1)
61-
update_time = proto.Field(proto.MESSAGE, number=2, message=timestamp.Timestamp,)
60+
exists = proto.Field(proto.BOOL, number=1, oneof="condition_type")
61+
update_time = proto.Field(
62+
proto.MESSAGE, number=2, message=timestamp.Timestamp, oneof="condition_type"
63+
)
6264

6365

6466
class TransactionOptions(proto.Message):
@@ -94,10 +96,15 @@ class ReadOnly(proto.Message):
9496
This may not be older than 60 seconds.
9597
"""
9698

97-
read_time = proto.Field(proto.MESSAGE, number=2, message=timestamp.Timestamp,)
99+
read_time = proto.Field(
100+
proto.MESSAGE,
101+
number=2,
102+
message=timestamp.Timestamp,
103+
oneof="consistency_selector",
104+
)
98105

99-
read_only = proto.Field(proto.MESSAGE, number=2, message=ReadOnly,)
100-
read_write = proto.Field(proto.MESSAGE, number=3, message=ReadWrite,)
106+
read_only = proto.Field(proto.MESSAGE, number=2, message=ReadOnly, oneof="mode")
107+
read_write = proto.Field(proto.MESSAGE, number=3, message=ReadWrite, oneof="mode")
101108

102109

103110
__all__ = tuple(sorted(__protobuf__.manifest))

0 commit comments

Comments
 (0)