Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
crwilcox committed Jun 26, 2020
1 parent 1713764 commit 1b856e3
Show file tree
Hide file tree
Showing 9 changed files with 257 additions and 90 deletions.
9 changes: 7 additions & 2 deletions google/cloud/firestore_admin_v1/types/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,14 @@ class ArrayConfig(proto.Enum):
CONTAINS = 1

field_path = proto.Field(proto.STRING, number=1)
order = proto.Field(proto.ENUM, number=2, enum="Index.IndexField.Order",)
order = proto.Field(
proto.ENUM, number=2, enum="Index.IndexField.Order", oneof="value_mode"
)
array_config = proto.Field(
proto.ENUM, number=3, enum="Index.IndexField.ArrayConfig",
proto.ENUM,
number=3,
enum="Index.IndexField.ArrayConfig",
oneof="value_mode",
)

name = proto.Field(proto.STRING, number=1)
Expand Down
17 changes: 12 additions & 5 deletions google/cloud/firestore_v1/types/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ class Precondition(proto.Message):
have been last updated at that time.
"""

exists = proto.Field(proto.BOOL, number=1)
update_time = proto.Field(proto.MESSAGE, number=2, message=timestamp.Timestamp,)
exists = proto.Field(proto.BOOL, number=1, oneof="condition_type")
update_time = proto.Field(
proto.MESSAGE, number=2, message=timestamp.Timestamp, oneof="condition_type"
)


class TransactionOptions(proto.Message):
Expand Down Expand Up @@ -94,10 +96,15 @@ class ReadOnly(proto.Message):
This may not be older than 60 seconds.
"""

read_time = proto.Field(proto.MESSAGE, number=2, message=timestamp.Timestamp,)
read_time = proto.Field(
proto.MESSAGE,
number=2,
message=timestamp.Timestamp,
oneof="consistency_selector",
)

read_only = proto.Field(proto.MESSAGE, number=2, message=ReadOnly,)
read_write = proto.Field(proto.MESSAGE, number=3, message=ReadWrite,)
read_only = proto.Field(proto.MESSAGE, number=2, message=ReadOnly, oneof="mode")
read_write = proto.Field(proto.MESSAGE, number=3, message=ReadWrite, oneof="mode")


__all__ = tuple(sorted(__protobuf__.manifest))
97 changes: 70 additions & 27 deletions google/cloud/firestore_v1/types/firestore.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,15 @@ class GetDocumentRequest(proto.Message):
seconds.
"""

name = proto.Field(proto.STRING, number=1)
name = proto.Field(proto.STRING, number=1,)
mask = proto.Field(proto.MESSAGE, number=2, message=common.DocumentMask,)
transaction = proto.Field(proto.BYTES, number=3)
read_time = proto.Field(proto.MESSAGE, number=5, message=timestamp.Timestamp,)
transaction = proto.Field(proto.BYTES, number=3, oneof="consistency_selector")
read_time = proto.Field(
proto.MESSAGE,
number=5,
message=timestamp.Timestamp,
oneof="consistency_selector",
)


class ListDocumentsRequest(proto.Message):
Expand Down Expand Up @@ -144,8 +149,13 @@ class ListDocumentsRequest(proto.Message):
page_token = proto.Field(proto.STRING, number=4)
order_by = proto.Field(proto.STRING, number=6)
mask = proto.Field(proto.MESSAGE, number=7, message=common.DocumentMask,)
transaction = proto.Field(proto.BYTES, number=8)
read_time = proto.Field(proto.MESSAGE, number=10, message=timestamp.Timestamp,)
transaction = proto.Field(proto.BYTES, number=8, oneof="consistency_selector")
read_time = proto.Field(
proto.MESSAGE,
number=10,
message=timestamp.Timestamp,
oneof="consistency_selector",
)
show_missing = proto.Field(proto.BOOL, number=12)


Expand Down Expand Up @@ -300,11 +310,19 @@ class BatchGetDocumentsRequest(proto.Message):
database = proto.Field(proto.STRING, number=1)
documents = proto.RepeatedField(proto.STRING, number=2)
mask = proto.Field(proto.MESSAGE, number=3, message=common.DocumentMask,)
transaction = proto.Field(proto.BYTES, number=4)
transaction = proto.Field(proto.BYTES, number=4, oneof="consistency_selector")
new_transaction = proto.Field(
proto.MESSAGE, number=5, message=common.TransactionOptions,
proto.MESSAGE,
number=5,
message=common.TransactionOptions,
oneof="consistency_selector",
)
read_time = proto.Field(
proto.MESSAGE,
number=7,
message=timestamp.Timestamp,
oneof="consistency_selector",
)
read_time = proto.Field(proto.MESSAGE, number=7, message=timestamp.Timestamp,)


class BatchGetDocumentsResponse(proto.Message):
Expand All @@ -330,8 +348,10 @@ class BatchGetDocumentsResponse(proto.Message):
between their read_time and this one.
"""

found = proto.Field(proto.MESSAGE, number=1, message=gf_document.Document,)
missing = proto.Field(proto.STRING, number=2)
found = proto.Field(
proto.MESSAGE, number=1, message=gf_document.Document, oneof="result"
)
missing = proto.Field(proto.STRING, number=2, oneof="result")
transaction = proto.Field(proto.BYTES, number=3)
read_time = proto.Field(proto.MESSAGE, number=4, message=timestamp.Timestamp,)

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

parent = proto.Field(proto.STRING, number=1)
structured_query = proto.Field(
proto.MESSAGE, number=2, message=gf_query.StructuredQuery,
proto.MESSAGE, number=2, message=gf_query.StructuredQuery, oneof="query_type"
)
transaction = proto.Field(proto.BYTES, number=5)
transaction = proto.Field(proto.BYTES, number=5, oneof="consistency_selector")
new_transaction = proto.Field(
proto.MESSAGE, number=6, message=common.TransactionOptions,
proto.MESSAGE,
number=6,
message=common.TransactionOptions,
oneof="consistency_selector",
)
read_time = proto.Field(
proto.MESSAGE,
number=7,
message=timestamp.Timestamp,
oneof="consistency_selector",
)
read_time = proto.Field(proto.MESSAGE, number=7, message=timestamp.Timestamp,)


class RunQueryResponse(proto.Message):
Expand Down Expand Up @@ -553,7 +581,7 @@ class PartitionQueryRequest(proto.Message):

parent = proto.Field(proto.STRING, number=1)
structured_query = proto.Field(
proto.MESSAGE, number=2, message=gf_query.StructuredQuery,
proto.MESSAGE, number=2, message=gf_query.StructuredQuery, oneof="query_type"
)
partition_count = proto.Field(proto.INT64, number=3)
page_token = proto.Field(proto.STRING, number=4)
Expand Down Expand Up @@ -702,8 +730,10 @@ class ListenRequest(proto.Message):
"""

database = proto.Field(proto.STRING, number=1)
add_target = proto.Field(proto.MESSAGE, number=2, message="Target",)
remove_target = proto.Field(proto.INT32, number=3)
add_target = proto.Field(
proto.MESSAGE, number=2, message="Target", oneof="target_change"
)
remove_target = proto.Field(proto.INT32, number=3, oneof="target_change")
labels = proto.MapField(proto.STRING, proto.STRING, number=4)


Expand Down Expand Up @@ -731,17 +761,21 @@ class ListenResponse(proto.Message):
are unknown.
"""

target_change = proto.Field(proto.MESSAGE, number=2, message="TargetChange",)
target_change = proto.Field(
proto.MESSAGE, number=2, message="TargetChange", oneof="response_type"
)
document_change = proto.Field(
proto.MESSAGE, number=3, message=write.DocumentChange,
proto.MESSAGE, number=3, message=write.DocumentChange, oneof="response_type"
)
document_delete = proto.Field(
proto.MESSAGE, number=4, message=write.DocumentDelete,
proto.MESSAGE, number=4, message=write.DocumentDelete, oneof="response_type"
)
document_remove = proto.Field(
proto.MESSAGE, number=6, message=write.DocumentRemove,
proto.MESSAGE, number=6, message=write.DocumentRemove, oneof="response_type"
)
filter = proto.Field(
proto.MESSAGE, number=5, message=write.ExistenceFilter, oneof="response_type"
)
filter = proto.Field(proto.MESSAGE, number=5, message=write.ExistenceFilter,)


class Target(proto.Message):
Expand Down Expand Up @@ -806,13 +840,22 @@ class QueryTarget(proto.Message):

parent = proto.Field(proto.STRING, number=1)
structured_query = proto.Field(
proto.MESSAGE, number=2, message=gf_query.StructuredQuery,
proto.MESSAGE,
number=2,
message=gf_query.StructuredQuery,
oneof="query_type",
)

query = proto.Field(proto.MESSAGE, number=2, message=QueryTarget,)
documents = proto.Field(proto.MESSAGE, number=3, message=DocumentsTarget,)
resume_token = proto.Field(proto.BYTES, number=4)
read_time = proto.Field(proto.MESSAGE, number=11, message=timestamp.Timestamp,)
query = proto.Field(
proto.MESSAGE, number=2, message=QueryTarget, oneof="target_type"
)
documents = proto.Field(
proto.MESSAGE, number=3, message=DocumentsTarget, oneof="target_type"
)
resume_token = proto.Field(proto.BYTES, number=4, oneof="resume_type")
read_time = proto.Field(
proto.MESSAGE, number=11, message=timestamp.Timestamp, oneof="resume_type"
)
target_id = proto.Field(proto.INT32, number=5)
once = proto.Field(proto.BOOL, number=6)

Expand Down
20 changes: 16 additions & 4 deletions google/cloud/firestore_v1/types/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,22 @@ class Filter(proto.Message):
"""

composite_filter = proto.Field(
proto.MESSAGE, number=1, message="StructuredQuery.CompositeFilter",
proto.MESSAGE,
number=1,
message="StructuredQuery.CompositeFilter",
oneof="filter_type",
)
field_filter = proto.Field(
proto.MESSAGE, number=2, message="StructuredQuery.FieldFilter",
proto.MESSAGE,
number=2,
message="StructuredQuery.FieldFilter",
oneof="filter_type",
)
unary_filter = proto.Field(
proto.MESSAGE, number=3, message="StructuredQuery.UnaryFilter",
proto.MESSAGE,
number=3,
message="StructuredQuery.UnaryFilter",
oneof="filter_type",
)

class CompositeFilter(proto.Message):
Expand Down Expand Up @@ -194,7 +203,10 @@ class Operator(proto.Enum):
proto.ENUM, number=1, enum="StructuredQuery.UnaryFilter.Operator",
)
field = proto.Field(
proto.MESSAGE, number=2, message="StructuredQuery.FieldReference",
proto.MESSAGE,
number=2,
message="StructuredQuery.FieldReference",
oneof="operand_type",
)

class Order(proto.Message):
Expand Down
37 changes: 28 additions & 9 deletions google/cloud/firestore_v1/types/write.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,13 @@ class Write(proto.Message):
by the target document.
"""

update = proto.Field(proto.MESSAGE, number=1, message=gf_document.Document,)
delete = proto.Field(proto.STRING, number=2)
transform = proto.Field(proto.MESSAGE, number=6, message="DocumentTransform",)
update = proto.Field(
proto.MESSAGE, number=1, message=gf_document.Document, oneof="operation"
)
delete = proto.Field(proto.STRING, number=2, oneof="operation")
transform = proto.Field(
proto.MESSAGE, number=6, message="DocumentTransform", oneof="operation"
)
update_mask = proto.Field(proto.MESSAGE, number=3, message=common.DocumentMask,)
update_transforms = proto.RepeatedField(
proto.MESSAGE, number=7, message="DocumentTransform.FieldTransform",
Expand Down Expand Up @@ -188,16 +192,31 @@ class ServerValue(proto.Enum):

field_path = proto.Field(proto.STRING, number=1)
set_to_server_value = proto.Field(
proto.ENUM, number=2, enum="DocumentTransform.FieldTransform.ServerValue",
proto.ENUM,
number=2,
enum="DocumentTransform.FieldTransform.ServerValue",
oneof="transform_type",
)
increment = proto.Field(
proto.MESSAGE, number=3, message=gf_document.Value, oneof="transform_type"
)
maximum = proto.Field(
proto.MESSAGE, number=4, message=gf_document.Value, oneof="transform_type"
)
minimum = proto.Field(
proto.MESSAGE, number=5, message=gf_document.Value, oneof="transform_type"
)
increment = proto.Field(proto.MESSAGE, number=3, message=gf_document.Value,)
maximum = proto.Field(proto.MESSAGE, number=4, message=gf_document.Value,)
minimum = proto.Field(proto.MESSAGE, number=5, message=gf_document.Value,)
append_missing_elements = proto.Field(
proto.MESSAGE, number=6, message=gf_document.ArrayValue,
proto.MESSAGE,
number=6,
message=gf_document.ArrayValue,
oneof="transform_type",
)
remove_all_from_array = proto.Field(
proto.MESSAGE, number=7, message=gf_document.ArrayValue,
proto.MESSAGE,
number=7,
message=gf_document.ArrayValue,
oneof="transform_type",
)

document = proto.Field(proto.STRING, number=1)
Expand Down
17 changes: 12 additions & 5 deletions google/cloud/firestore_v1beta1/types/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ class Precondition(proto.Message):
have been last updated at that time.
"""

exists = proto.Field(proto.BOOL, number=1)
update_time = proto.Field(proto.MESSAGE, number=2, message=timestamp.Timestamp,)
exists = proto.Field(proto.BOOL, number=1, oneof="condition_type")
update_time = proto.Field(
proto.MESSAGE, number=2, message=timestamp.Timestamp, oneof="condition_type"
)


class TransactionOptions(proto.Message):
Expand Down Expand Up @@ -94,10 +96,15 @@ class ReadOnly(proto.Message):
This may not be older than 60 seconds.
"""

read_time = proto.Field(proto.MESSAGE, number=2, message=timestamp.Timestamp,)
read_time = proto.Field(
proto.MESSAGE,
number=2,
message=timestamp.Timestamp,
oneof="consistency_selector",
)

read_only = proto.Field(proto.MESSAGE, number=2, message=ReadOnly,)
read_write = proto.Field(proto.MESSAGE, number=3, message=ReadWrite,)
read_only = proto.Field(proto.MESSAGE, number=2, message=ReadOnly, oneof="mode")
read_write = proto.Field(proto.MESSAGE, number=3, message=ReadWrite, oneof="mode")


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

0 comments on commit 1b856e3

Please sign in to comment.