Added delete option to database storage.

This commit is contained in:
Batuhan Berk Başoğlu 2020-10-12 12:10:01 -04:00
parent 308604a33c
commit 963b5bc68b
1868 changed files with 192402 additions and 13278 deletions

View file

@ -0,0 +1,203 @@
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from google.cloud.firestore_v1beta1.proto.admin import (
firestore_admin_pb2 as google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_admin_dot_firestore__admin__pb2,
)
from google.cloud.firestore_v1beta1.proto.admin import (
index_pb2 as google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_admin_dot_index__pb2,
)
from google.longrunning import (
operations_pb2 as google_dot_longrunning_dot_operations__pb2,
)
from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2
class FirestoreAdminStub(object):
"""The Cloud Firestore Admin API.
This API provides several administrative services for Cloud Firestore.
# Concepts
Project, Database, Namespace, Collection, and Document are used as defined in
the Google Cloud Firestore API.
Operation: An Operation represents work being performed in the background.
# Services
## Index
The index service manages Cloud Firestore indexes.
Index creation is performed asynchronously.
An Operation resource is created for each such asynchronous operation.
The state of the operation (including any errors encountered)
may be queried via the Operation resource.
## Metadata
Provides metadata and statistical information about data in Cloud Firestore.
The data provided as part of this API may be stale.
## Operation
The Operations collection provides a record of actions performed for the
specified Project (including any Operations in progress). Operations are not
created directly but through calls on other collections or resources.
An Operation that is not yet done may be cancelled. The request to cancel is
asynchronous and the Operation may continue to run for some time after the
request to cancel is made.
An Operation that is done may be deleted so that it is no longer listed as
part of the Operation collection.
Operations are created by service `FirestoreAdmin`, but are accessed via
service `google.longrunning.Operations`.
"""
def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
"""
self.CreateIndex = channel.unary_unary(
"/google.firestore.admin.v1beta1.FirestoreAdmin/CreateIndex",
request_serializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_admin_dot_firestore__admin__pb2.CreateIndexRequest.SerializeToString,
response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString,
)
self.ListIndexes = channel.unary_unary(
"/google.firestore.admin.v1beta1.FirestoreAdmin/ListIndexes",
request_serializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_admin_dot_firestore__admin__pb2.ListIndexesRequest.SerializeToString,
response_deserializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_admin_dot_firestore__admin__pb2.ListIndexesResponse.FromString,
)
self.GetIndex = channel.unary_unary(
"/google.firestore.admin.v1beta1.FirestoreAdmin/GetIndex",
request_serializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_admin_dot_firestore__admin__pb2.GetIndexRequest.SerializeToString,
response_deserializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_admin_dot_index__pb2.Index.FromString,
)
self.DeleteIndex = channel.unary_unary(
"/google.firestore.admin.v1beta1.FirestoreAdmin/DeleteIndex",
request_serializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_admin_dot_firestore__admin__pb2.DeleteIndexRequest.SerializeToString,
response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
)
class FirestoreAdminServicer(object):
"""The Cloud Firestore Admin API.
This API provides several administrative services for Cloud Firestore.
# Concepts
Project, Database, Namespace, Collection, and Document are used as defined in
the Google Cloud Firestore API.
Operation: An Operation represents work being performed in the background.
# Services
## Index
The index service manages Cloud Firestore indexes.
Index creation is performed asynchronously.
An Operation resource is created for each such asynchronous operation.
The state of the operation (including any errors encountered)
may be queried via the Operation resource.
## Metadata
Provides metadata and statistical information about data in Cloud Firestore.
The data provided as part of this API may be stale.
## Operation
The Operations collection provides a record of actions performed for the
specified Project (including any Operations in progress). Operations are not
created directly but through calls on other collections or resources.
An Operation that is not yet done may be cancelled. The request to cancel is
asynchronous and the Operation may continue to run for some time after the
request to cancel is made.
An Operation that is done may be deleted so that it is no longer listed as
part of the Operation collection.
Operations are created by service `FirestoreAdmin`, but are accessed via
service `google.longrunning.Operations`.
"""
def CreateIndex(self, request, context):
"""Creates the specified index.
A newly created index's initial state is `CREATING`. On completion of the
returned [google.longrunning.Operation][google.longrunning.Operation], the state will be `READY`.
If the index already exists, the call will return an `ALREADY_EXISTS`
status.
During creation, the process could result in an error, in which case the
index will move to the `ERROR` state. The process can be recovered by
fixing the data that caused the error, removing the index with
[delete][google.firestore.admin.v1beta1.FirestoreAdmin.DeleteIndex], then re-creating the index with
[create][google.firestore.admin.v1beta1.FirestoreAdmin.CreateIndex].
Indexes with a single field cannot be created.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details("Method not implemented!")
raise NotImplementedError("Method not implemented!")
def ListIndexes(self, request, context):
"""Lists the indexes that match the specified filters.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details("Method not implemented!")
raise NotImplementedError("Method not implemented!")
def GetIndex(self, request, context):
"""Gets an index.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details("Method not implemented!")
raise NotImplementedError("Method not implemented!")
def DeleteIndex(self, request, context):
"""Deletes an index.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details("Method not implemented!")
raise NotImplementedError("Method not implemented!")
def add_FirestoreAdminServicer_to_server(servicer, server):
rpc_method_handlers = {
"CreateIndex": grpc.unary_unary_rpc_method_handler(
servicer.CreateIndex,
request_deserializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_admin_dot_firestore__admin__pb2.CreateIndexRequest.FromString,
response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString,
),
"ListIndexes": grpc.unary_unary_rpc_method_handler(
servicer.ListIndexes,
request_deserializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_admin_dot_firestore__admin__pb2.ListIndexesRequest.FromString,
response_serializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_admin_dot_firestore__admin__pb2.ListIndexesResponse.SerializeToString,
),
"GetIndex": grpc.unary_unary_rpc_method_handler(
servicer.GetIndex,
request_deserializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_admin_dot_firestore__admin__pb2.GetIndexRequest.FromString,
response_serializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_admin_dot_index__pb2.Index.SerializeToString,
),
"DeleteIndex": grpc.unary_unary_rpc_method_handler(
servicer.DeleteIndex,
request_deserializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_admin_dot_firestore__admin__pb2.DeleteIndexRequest.FromString,
response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
"google.firestore.admin.v1beta1.FirestoreAdmin", rpc_method_handlers
)
server.add_generic_rpc_handlers((generic_handler,))

View file

@ -0,0 +1,300 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/cloud/firestore_v1beta1/proto/admin/index.proto
import sys
_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1"))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name="google/cloud/firestore_v1beta1/proto/admin/index.proto",
package="google.firestore.admin.v1beta1",
syntax="proto3",
serialized_pb=_b(
'\n6google/cloud/firestore_v1beta1/proto/admin/index.proto\x12\x1egoogle.firestore.admin.v1beta1\x1a\x1cgoogle/api/annotations.proto"\x9c\x01\n\nIndexField\x12\x12\n\nfield_path\x18\x01 \x01(\t\x12=\n\x04mode\x18\x02 \x01(\x0e\x32/.google.firestore.admin.v1beta1.IndexField.Mode";\n\x04Mode\x12\x14\n\x10MODE_UNSPECIFIED\x10\x00\x12\r\n\tASCENDING\x10\x02\x12\x0e\n\nDESCENDING\x10\x03"\xe8\x01\n\x05Index\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x15\n\rcollection_id\x18\x02 \x01(\t\x12:\n\x06\x66ields\x18\x03 \x03(\x0b\x32*.google.firestore.admin.v1beta1.IndexField\x12:\n\x05state\x18\x06 \x01(\x0e\x32+.google.firestore.admin.v1beta1.Index.State"B\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x0c\n\x08\x43REATING\x10\x03\x12\t\n\x05READY\x10\x02\x12\t\n\x05\x45RROR\x10\x05\x42\xa5\x01\n"com.google.firestore.admin.v1beta1B\nIndexProtoP\x01ZCgoogle.golang.org/genproto/googleapis/firestore/admin/v1beta1;admin\xa2\x02\x04GCFS\xaa\x02$Google.Cloud.Firestore.Admin.V1Beta1b\x06proto3'
),
dependencies=[google_dot_api_dot_annotations__pb2.DESCRIPTOR],
)
_INDEXFIELD_MODE = _descriptor.EnumDescriptor(
name="Mode",
full_name="google.firestore.admin.v1beta1.IndexField.Mode",
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name="MODE_UNSPECIFIED", index=0, number=0, options=None, type=None
),
_descriptor.EnumValueDescriptor(
name="ASCENDING", index=1, number=2, options=None, type=None
),
_descriptor.EnumValueDescriptor(
name="DESCENDING", index=2, number=3, options=None, type=None
),
],
containing_type=None,
options=None,
serialized_start=218,
serialized_end=277,
)
_sym_db.RegisterEnumDescriptor(_INDEXFIELD_MODE)
_INDEX_STATE = _descriptor.EnumDescriptor(
name="State",
full_name="google.firestore.admin.v1beta1.Index.State",
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name="STATE_UNSPECIFIED", index=0, number=0, options=None, type=None
),
_descriptor.EnumValueDescriptor(
name="CREATING", index=1, number=3, options=None, type=None
),
_descriptor.EnumValueDescriptor(
name="READY", index=2, number=2, options=None, type=None
),
_descriptor.EnumValueDescriptor(
name="ERROR", index=3, number=5, options=None, type=None
),
],
containing_type=None,
options=None,
serialized_start=446,
serialized_end=512,
)
_sym_db.RegisterEnumDescriptor(_INDEX_STATE)
_INDEXFIELD = _descriptor.Descriptor(
name="IndexField",
full_name="google.firestore.admin.v1beta1.IndexField",
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name="field_path",
full_name="google.firestore.admin.v1beta1.IndexField.field_path",
index=0,
number=1,
type=9,
cpp_type=9,
label=1,
has_default_value=False,
default_value=_b("").decode("utf-8"),
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
options=None,
),
_descriptor.FieldDescriptor(
name="mode",
full_name="google.firestore.admin.v1beta1.IndexField.mode",
index=1,
number=2,
type=14,
cpp_type=8,
label=1,
has_default_value=False,
default_value=0,
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
options=None,
),
],
extensions=[],
nested_types=[],
enum_types=[_INDEXFIELD_MODE],
options=None,
is_extendable=False,
syntax="proto3",
extension_ranges=[],
oneofs=[],
serialized_start=121,
serialized_end=277,
)
_INDEX = _descriptor.Descriptor(
name="Index",
full_name="google.firestore.admin.v1beta1.Index",
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name="name",
full_name="google.firestore.admin.v1beta1.Index.name",
index=0,
number=1,
type=9,
cpp_type=9,
label=1,
has_default_value=False,
default_value=_b("").decode("utf-8"),
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
options=None,
),
_descriptor.FieldDescriptor(
name="collection_id",
full_name="google.firestore.admin.v1beta1.Index.collection_id",
index=1,
number=2,
type=9,
cpp_type=9,
label=1,
has_default_value=False,
default_value=_b("").decode("utf-8"),
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
options=None,
),
_descriptor.FieldDescriptor(
name="fields",
full_name="google.firestore.admin.v1beta1.Index.fields",
index=2,
number=3,
type=11,
cpp_type=10,
label=3,
has_default_value=False,
default_value=[],
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
options=None,
),
_descriptor.FieldDescriptor(
name="state",
full_name="google.firestore.admin.v1beta1.Index.state",
index=3,
number=6,
type=14,
cpp_type=8,
label=1,
has_default_value=False,
default_value=0,
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
options=None,
),
],
extensions=[],
nested_types=[],
enum_types=[_INDEX_STATE],
options=None,
is_extendable=False,
syntax="proto3",
extension_ranges=[],
oneofs=[],
serialized_start=280,
serialized_end=512,
)
_INDEXFIELD.fields_by_name["mode"].enum_type = _INDEXFIELD_MODE
_INDEXFIELD_MODE.containing_type = _INDEXFIELD
_INDEX.fields_by_name["fields"].message_type = _INDEXFIELD
_INDEX.fields_by_name["state"].enum_type = _INDEX_STATE
_INDEX_STATE.containing_type = _INDEX
DESCRIPTOR.message_types_by_name["IndexField"] = _INDEXFIELD
DESCRIPTOR.message_types_by_name["Index"] = _INDEX
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
IndexField = _reflection.GeneratedProtocolMessageType(
"IndexField",
(_message.Message,),
dict(
DESCRIPTOR=_INDEXFIELD,
__module__="google.cloud.firestore_v1beta1.proto.admin.index_pb2",
__doc__="""A field of an index.
Attributes:
field_path:
The path of the field. Must match the field path specification
described by
[google.firestore.v1beta1.Document.fields][fields]. Special
field path ``__name__`` may be used by itself or at the end of
a path. ``__type__`` may be used only at the end of path.
mode:
The field's mode.
""",
# @@protoc_insertion_point(class_scope:google.firestore.admin.v1beta1.IndexField)
),
)
_sym_db.RegisterMessage(IndexField)
Index = _reflection.GeneratedProtocolMessageType(
"Index",
(_message.Message,),
dict(
DESCRIPTOR=_INDEX,
__module__="google.cloud.firestore_v1beta1.proto.admin.index_pb2",
__doc__="""An index definition.
Attributes:
name:
The resource name of the index.
collection_id:
The collection ID to which this index applies. Required.
fields:
The fields to index.
state:
The state of the index. The state is read-only. @OutputOnly
""",
# @@protoc_insertion_point(class_scope:google.firestore.admin.v1beta1.Index)
),
)
_sym_db.RegisterMessage(Index)
DESCRIPTOR.has_options = True
DESCRIPTOR._options = _descriptor._ParseOptions(
descriptor_pb2.FileOptions(),
_b(
'\n"com.google.firestore.admin.v1beta1B\nIndexProtoP\001ZCgoogle.golang.org/genproto/googleapis/firestore/admin/v1beta1;admin\242\002\004GCFS\252\002$Google.Cloud.Firestore.Admin.V1Beta1'
),
)
try:
# THESE ELEMENTS WILL BE DEPRECATED.
# Please use the generated *_pb2_grpc.py files instead.
import grpc
from grpc.beta import implementations as beta_implementations
from grpc.beta import interfaces as beta_interfaces
from grpc.framework.common import cardinality
from grpc.framework.interfaces.face import utilities as face_utilities
except ImportError:
pass
# @@protoc_insertion_point(module_scope)

View file

@ -0,0 +1,2 @@
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc

View file

@ -0,0 +1,84 @@
// Copyright 2019 Google LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
syntax = "proto3";
package google.firestore.v1beta1;
import "google/protobuf/timestamp.proto";
import "google/api/annotations.proto";
option csharp_namespace = "Google.Cloud.Firestore.V1Beta1";
option go_package = "google.golang.org/genproto/googleapis/firestore/v1beta1;firestore";
option java_multiple_files = true;
option java_outer_classname = "CommonProto";
option java_package = "com.google.firestore.v1beta1";
option objc_class_prefix = "GCFS";
option php_namespace = "Google\\Cloud\\Firestore\\V1beta1";
option ruby_package = "Google::Cloud::Firestore::V1beta1";
// A set of field paths on a document.
// Used to restrict a get or update operation on a document to a subset of its
// fields.
// This is different from standard field masks, as this is always scoped to a
// [Document][google.firestore.v1beta1.Document], and takes in account the dynamic nature of [Value][google.firestore.v1beta1.Value].
message DocumentMask {
// The list of field paths in the mask. See [Document.fields][google.firestore.v1beta1.Document.fields] for a field
// path syntax reference.
repeated string field_paths = 1;
}
// A precondition on a document, used for conditional operations.
message Precondition {
// The type of precondition.
oneof condition_type {
// When set to `true`, the target document must exist.
// When set to `false`, the target document must not exist.
bool exists = 1;
// When set, the target document must exist and have been last updated at
// that time.
google.protobuf.Timestamp update_time = 2;
}
}
// Options for creating a new transaction.
message TransactionOptions {
// Options for a transaction that can be used to read and write documents.
message ReadWrite {
// An optional transaction to retry.
bytes retry_transaction = 1;
}
// Options for a transaction that can only be used to read documents.
message ReadOnly {
// The consistency mode for this transaction. If not set, defaults to strong
// consistency.
oneof consistency_selector {
// Reads documents at the given time.
// This may not be older than 60 seconds.
google.protobuf.Timestamp read_time = 2;
}
}
// The mode of the transaction.
oneof mode {
// The transaction can only be used for read operations.
ReadOnly read_only = 2;
// The transaction can be used for both read and write operations.
ReadWrite read_write = 3;
}
}

View file

@ -0,0 +1,456 @@
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/cloud/firestore_v1beta1/proto/common.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2
from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name="google/cloud/firestore_v1beta1/proto/common.proto",
package="google.firestore.v1beta1",
syntax="proto3",
serialized_options=b"\n\034com.google.firestore.v1beta1B\013CommonProtoP\001ZAgoogle.golang.org/genproto/googleapis/firestore/v1beta1;firestore\242\002\004GCFS\252\002\036Google.Cloud.Firestore.V1Beta1\312\002\036Google\\Cloud\\Firestore\\V1beta1\352\002!Google::Cloud::Firestore::V1beta1",
create_key=_descriptor._internal_create_key,
serialized_pb=b'\n1google/cloud/firestore_v1beta1/proto/common.proto\x12\x18google.firestore.v1beta1\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1cgoogle/api/annotations.proto"#\n\x0c\x44ocumentMask\x12\x13\n\x0b\x66ield_paths\x18\x01 \x03(\t"e\n\x0cPrecondition\x12\x10\n\x06\x65xists\x18\x01 \x01(\x08H\x00\x12\x31\n\x0bupdate_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.TimestampH\x00\x42\x10\n\x0e\x63ondition_type"\xb3\x02\n\x12TransactionOptions\x12J\n\tread_only\x18\x02 \x01(\x0b\x32\x35.google.firestore.v1beta1.TransactionOptions.ReadOnlyH\x00\x12L\n\nread_write\x18\x03 \x01(\x0b\x32\x36.google.firestore.v1beta1.TransactionOptions.ReadWriteH\x00\x1a&\n\tReadWrite\x12\x19\n\x11retry_transaction\x18\x01 \x01(\x0c\x1aS\n\x08ReadOnly\x12/\n\tread_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.TimestampH\x00\x42\x16\n\x14\x63onsistency_selectorB\x06\n\x04modeB\xdd\x01\n\x1c\x63om.google.firestore.v1beta1B\x0b\x43ommonProtoP\x01ZAgoogle.golang.org/genproto/googleapis/firestore/v1beta1;firestore\xa2\x02\x04GCFS\xaa\x02\x1eGoogle.Cloud.Firestore.V1Beta1\xca\x02\x1eGoogle\\Cloud\\Firestore\\V1beta1\xea\x02!Google::Cloud::Firestore::V1beta1b\x06proto3',
dependencies=[
google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR,
google_dot_api_dot_annotations__pb2.DESCRIPTOR,
],
)
_DOCUMENTMASK = _descriptor.Descriptor(
name="DocumentMask",
full_name="google.firestore.v1beta1.DocumentMask",
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name="field_paths",
full_name="google.firestore.v1beta1.DocumentMask.field_paths",
index=0,
number=1,
type=9,
cpp_type=9,
label=3,
has_default_value=False,
default_value=[],
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
),
],
extensions=[],
nested_types=[],
enum_types=[],
serialized_options=None,
is_extendable=False,
syntax="proto3",
extension_ranges=[],
oneofs=[],
serialized_start=142,
serialized_end=177,
)
_PRECONDITION = _descriptor.Descriptor(
name="Precondition",
full_name="google.firestore.v1beta1.Precondition",
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name="exists",
full_name="google.firestore.v1beta1.Precondition.exists",
index=0,
number=1,
type=8,
cpp_type=7,
label=1,
has_default_value=False,
default_value=False,
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
),
_descriptor.FieldDescriptor(
name="update_time",
full_name="google.firestore.v1beta1.Precondition.update_time",
index=1,
number=2,
type=11,
cpp_type=10,
label=1,
has_default_value=False,
default_value=None,
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
),
],
extensions=[],
nested_types=[],
enum_types=[],
serialized_options=None,
is_extendable=False,
syntax="proto3",
extension_ranges=[],
oneofs=[
_descriptor.OneofDescriptor(
name="condition_type",
full_name="google.firestore.v1beta1.Precondition.condition_type",
index=0,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[],
),
],
serialized_start=179,
serialized_end=280,
)
_TRANSACTIONOPTIONS_READWRITE = _descriptor.Descriptor(
name="ReadWrite",
full_name="google.firestore.v1beta1.TransactionOptions.ReadWrite",
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name="retry_transaction",
full_name="google.firestore.v1beta1.TransactionOptions.ReadWrite.retry_transaction",
index=0,
number=1,
type=12,
cpp_type=9,
label=1,
has_default_value=False,
default_value=b"",
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
),
],
extensions=[],
nested_types=[],
enum_types=[],
serialized_options=None,
is_extendable=False,
syntax="proto3",
extension_ranges=[],
oneofs=[],
serialized_start=459,
serialized_end=497,
)
_TRANSACTIONOPTIONS_READONLY = _descriptor.Descriptor(
name="ReadOnly",
full_name="google.firestore.v1beta1.TransactionOptions.ReadOnly",
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name="read_time",
full_name="google.firestore.v1beta1.TransactionOptions.ReadOnly.read_time",
index=0,
number=2,
type=11,
cpp_type=10,
label=1,
has_default_value=False,
default_value=None,
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
),
],
extensions=[],
nested_types=[],
enum_types=[],
serialized_options=None,
is_extendable=False,
syntax="proto3",
extension_ranges=[],
oneofs=[
_descriptor.OneofDescriptor(
name="consistency_selector",
full_name="google.firestore.v1beta1.TransactionOptions.ReadOnly.consistency_selector",
index=0,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[],
),
],
serialized_start=499,
serialized_end=582,
)
_TRANSACTIONOPTIONS = _descriptor.Descriptor(
name="TransactionOptions",
full_name="google.firestore.v1beta1.TransactionOptions",
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name="read_only",
full_name="google.firestore.v1beta1.TransactionOptions.read_only",
index=0,
number=2,
type=11,
cpp_type=10,
label=1,
has_default_value=False,
default_value=None,
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
),
_descriptor.FieldDescriptor(
name="read_write",
full_name="google.firestore.v1beta1.TransactionOptions.read_write",
index=1,
number=3,
type=11,
cpp_type=10,
label=1,
has_default_value=False,
default_value=None,
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
),
],
extensions=[],
nested_types=[_TRANSACTIONOPTIONS_READWRITE, _TRANSACTIONOPTIONS_READONLY,],
enum_types=[],
serialized_options=None,
is_extendable=False,
syntax="proto3",
extension_ranges=[],
oneofs=[
_descriptor.OneofDescriptor(
name="mode",
full_name="google.firestore.v1beta1.TransactionOptions.mode",
index=0,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[],
),
],
serialized_start=283,
serialized_end=590,
)
_PRECONDITION.fields_by_name[
"update_time"
].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP
_PRECONDITION.oneofs_by_name["condition_type"].fields.append(
_PRECONDITION.fields_by_name["exists"]
)
_PRECONDITION.fields_by_name["exists"].containing_oneof = _PRECONDITION.oneofs_by_name[
"condition_type"
]
_PRECONDITION.oneofs_by_name["condition_type"].fields.append(
_PRECONDITION.fields_by_name["update_time"]
)
_PRECONDITION.fields_by_name[
"update_time"
].containing_oneof = _PRECONDITION.oneofs_by_name["condition_type"]
_TRANSACTIONOPTIONS_READWRITE.containing_type = _TRANSACTIONOPTIONS
_TRANSACTIONOPTIONS_READONLY.fields_by_name[
"read_time"
].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP
_TRANSACTIONOPTIONS_READONLY.containing_type = _TRANSACTIONOPTIONS
_TRANSACTIONOPTIONS_READONLY.oneofs_by_name["consistency_selector"].fields.append(
_TRANSACTIONOPTIONS_READONLY.fields_by_name["read_time"]
)
_TRANSACTIONOPTIONS_READONLY.fields_by_name[
"read_time"
].containing_oneof = _TRANSACTIONOPTIONS_READONLY.oneofs_by_name["consistency_selector"]
_TRANSACTIONOPTIONS.fields_by_name[
"read_only"
].message_type = _TRANSACTIONOPTIONS_READONLY
_TRANSACTIONOPTIONS.fields_by_name[
"read_write"
].message_type = _TRANSACTIONOPTIONS_READWRITE
_TRANSACTIONOPTIONS.oneofs_by_name["mode"].fields.append(
_TRANSACTIONOPTIONS.fields_by_name["read_only"]
)
_TRANSACTIONOPTIONS.fields_by_name[
"read_only"
].containing_oneof = _TRANSACTIONOPTIONS.oneofs_by_name["mode"]
_TRANSACTIONOPTIONS.oneofs_by_name["mode"].fields.append(
_TRANSACTIONOPTIONS.fields_by_name["read_write"]
)
_TRANSACTIONOPTIONS.fields_by_name[
"read_write"
].containing_oneof = _TRANSACTIONOPTIONS.oneofs_by_name["mode"]
DESCRIPTOR.message_types_by_name["DocumentMask"] = _DOCUMENTMASK
DESCRIPTOR.message_types_by_name["Precondition"] = _PRECONDITION
DESCRIPTOR.message_types_by_name["TransactionOptions"] = _TRANSACTIONOPTIONS
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
DocumentMask = _reflection.GeneratedProtocolMessageType(
"DocumentMask",
(_message.Message,),
{
"DESCRIPTOR": _DOCUMENTMASK,
"__module__": "google.cloud.firestore_v1beta1.proto.common_pb2",
"__doc__": """A set of field paths on a document. Used to restrict a get or update
operation on a document to a subset of its fields. This is different
from standard field masks, as this is always scoped to a
[Document][google.firestore.v1beta1.Document], and takes in account
the dynamic nature of [Value][google.firestore.v1beta1.Value].
Attributes:
field_paths:
The list of field paths in the mask. See
[Document.fields][google.firestore.v1beta1.Document.fields]
for a field path syntax reference.
""",
# @@protoc_insertion_point(class_scope:google.firestore.v1beta1.DocumentMask)
},
)
_sym_db.RegisterMessage(DocumentMask)
Precondition = _reflection.GeneratedProtocolMessageType(
"Precondition",
(_message.Message,),
{
"DESCRIPTOR": _PRECONDITION,
"__module__": "google.cloud.firestore_v1beta1.proto.common_pb2",
"__doc__": """A precondition on a document, used for conditional operations.
Attributes:
condition_type:
The type of precondition.
exists:
When set to ``true``, the target document must exist. When set
to ``false``, the target document must not exist.
update_time:
When set, the target document must exist and have been last
updated at that time.
""",
# @@protoc_insertion_point(class_scope:google.firestore.v1beta1.Precondition)
},
)
_sym_db.RegisterMessage(Precondition)
TransactionOptions = _reflection.GeneratedProtocolMessageType(
"TransactionOptions",
(_message.Message,),
{
"ReadWrite": _reflection.GeneratedProtocolMessageType(
"ReadWrite",
(_message.Message,),
{
"DESCRIPTOR": _TRANSACTIONOPTIONS_READWRITE,
"__module__": "google.cloud.firestore_v1beta1.proto.common_pb2",
"__doc__": """Options for a transaction that can be used to read and write
documents.
Attributes:
retry_transaction:
An optional transaction to retry.
""",
# @@protoc_insertion_point(class_scope:google.firestore.v1beta1.TransactionOptions.ReadWrite)
},
),
"ReadOnly": _reflection.GeneratedProtocolMessageType(
"ReadOnly",
(_message.Message,),
{
"DESCRIPTOR": _TRANSACTIONOPTIONS_READONLY,
"__module__": "google.cloud.firestore_v1beta1.proto.common_pb2",
"__doc__": """Options for a transaction that can only be used to read documents.
Attributes:
consistency_selector:
The consistency mode for this transaction. If not set,
defaults to strong consistency.
read_time:
Reads documents at the given time. This may not be older than
60 seconds.
""",
# @@protoc_insertion_point(class_scope:google.firestore.v1beta1.TransactionOptions.ReadOnly)
},
),
"DESCRIPTOR": _TRANSACTIONOPTIONS,
"__module__": "google.cloud.firestore_v1beta1.proto.common_pb2",
"__doc__": """Options for creating a new transaction.
Attributes:
mode:
The mode of the transaction.
read_only:
The transaction can only be used for read operations.
read_write:
The transaction can be used for both read and write
operations.
""",
# @@protoc_insertion_point(class_scope:google.firestore.v1beta1.TransactionOptions)
},
)
_sym_db.RegisterMessage(TransactionOptions)
_sym_db.RegisterMessage(TransactionOptions.ReadWrite)
_sym_db.RegisterMessage(TransactionOptions.ReadOnly)
DESCRIPTOR._options = None
# @@protoc_insertion_point(module_scope)

View file

@ -0,0 +1,3 @@
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc

View file

@ -0,0 +1,151 @@
// Copyright 2019 Google LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
syntax = "proto3";
package google.firestore.v1beta1;
import "google/protobuf/struct.proto";
import "google/protobuf/timestamp.proto";
import "google/type/latlng.proto";
import "google/api/annotations.proto";
option csharp_namespace = "Google.Cloud.Firestore.V1Beta1";
option go_package = "google.golang.org/genproto/googleapis/firestore/v1beta1;firestore";
option java_multiple_files = true;
option java_outer_classname = "DocumentProto";
option java_package = "com.google.firestore.v1beta1";
option objc_class_prefix = "GCFS";
option php_namespace = "Google\\Cloud\\Firestore\\V1beta1";
option ruby_package = "Google::Cloud::Firestore::V1beta1";
// A Firestore document.
//
// Must not exceed 1 MiB - 4 bytes.
message Document {
// The resource name of the document, for example
// `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
string name = 1;
// The document's fields.
//
// The map keys represent field names.
//
// A simple field name contains only characters `a` to `z`, `A` to `Z`,
// `0` to `9`, or `_`, and must not start with `0` to `9`. For example,
// `foo_bar_17`.
//
// Field names matching the regular expression `__.*__` are reserved. Reserved
// field names are forbidden except in certain documented contexts. The map
// keys, represented as UTF-8, must not exceed 1,500 bytes and cannot be
// empty.
//
// Field paths may be used in other contexts to refer to structured fields
// defined here. For `map_value`, the field path is represented by the simple
// or quoted field names of the containing fields, delimited by `.`. For
// example, the structured field
// `"foo" : { map_value: { "x&y" : { string_value: "hello" }}}` would be
// represented by the field path `foo.x&y`.
//
// Within a field path, a quoted field name starts and ends with `` ` `` and
// may contain any character. Some characters, including `` ` ``, must be
// escaped using a `\`. For example, `` `x&y` `` represents `x&y` and
// `` `bak\`tik` `` represents `` bak`tik ``.
map<string, Value> fields = 2;
// Output only. The time at which the document was created.
//
// This value increases monotonically when a document is deleted then
// recreated. It can also be compared to values from other documents and
// the `read_time` of a query.
google.protobuf.Timestamp create_time = 3;
// Output only. The time at which the document was last changed.
//
// This value is initially set to the `create_time` then increases
// monotonically with each change to the document. It can also be
// compared to values from other documents and the `read_time` of a query.
google.protobuf.Timestamp update_time = 4;
}
// A message that can hold any of the supported value types.
message Value {
// Must have a value set.
oneof value_type {
// A null value.
google.protobuf.NullValue null_value = 11;
// A boolean value.
bool boolean_value = 1;
// An integer value.
int64 integer_value = 2;
// A double value.
double double_value = 3;
// A timestamp value.
//
// Precise only to microseconds. When stored, any additional precision is
// rounded down.
google.protobuf.Timestamp timestamp_value = 10;
// A string value.
//
// The string, represented as UTF-8, must not exceed 1 MiB - 89 bytes.
// Only the first 1,500 bytes of the UTF-8 representation are considered by
// queries.
string string_value = 17;
// A bytes value.
//
// Must not exceed 1 MiB - 89 bytes.
// Only the first 1,500 bytes are considered by queries.
bytes bytes_value = 18;
// A reference to a document. For example:
// `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
string reference_value = 5;
// A geo point value representing a point on the surface of Earth.
google.type.LatLng geo_point_value = 8;
// An array value.
//
// Cannot directly contain another array value, though can contain an
// map which contains another array.
ArrayValue array_value = 9;
// A map value.
MapValue map_value = 6;
}
}
// An array value.
message ArrayValue {
// Values in the array.
repeated Value values = 1;
}
// A map value.
message MapValue {
// The map's fields.
//
// The map keys represent field names. Field names matching the regular
// expression `__.*__` are reserved. Reserved field names are forbidden except
// in certain documented contexts. The map keys, represented as UTF-8, must
// not exceed 1,500 bytes and cannot be empty.
map<string, Value> fields = 1;
}

View file

@ -0,0 +1,815 @@
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/cloud/firestore_v1beta1/proto/document.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
from google.protobuf import struct_pb2 as google_dot_protobuf_dot_struct__pb2
from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2
from google.type import latlng_pb2 as google_dot_type_dot_latlng__pb2
from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name="google/cloud/firestore_v1beta1/proto/document.proto",
package="google.firestore.v1beta1",
syntax="proto3",
serialized_options=b"\n\034com.google.firestore.v1beta1B\rDocumentProtoP\001ZAgoogle.golang.org/genproto/googleapis/firestore/v1beta1;firestore\242\002\004GCFS\252\002\036Google.Cloud.Firestore.V1Beta1\312\002\036Google\\Cloud\\Firestore\\V1beta1\352\002!Google::Cloud::Firestore::V1beta1",
create_key=_descriptor._internal_create_key,
serialized_pb=b'\n3google/cloud/firestore_v1beta1/proto/document.proto\x12\x18google.firestore.v1beta1\x1a\x1cgoogle/protobuf/struct.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x18google/type/latlng.proto\x1a\x1cgoogle/api/annotations.proto"\x8a\x02\n\x08\x44ocument\x12\x0c\n\x04name\x18\x01 \x01(\t\x12>\n\x06\x66ields\x18\x02 \x03(\x0b\x32..google.firestore.v1beta1.Document.FieldsEntry\x12/\n\x0b\x63reate_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12/\n\x0bupdate_time\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x1aN\n\x0b\x46ieldsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12.\n\x05value\x18\x02 \x01(\x0b\x32\x1f.google.firestore.v1beta1.Value:\x02\x38\x01"\xb8\x03\n\x05Value\x12\x30\n\nnull_value\x18\x0b \x01(\x0e\x32\x1a.google.protobuf.NullValueH\x00\x12\x17\n\rboolean_value\x18\x01 \x01(\x08H\x00\x12\x17\n\rinteger_value\x18\x02 \x01(\x03H\x00\x12\x16\n\x0c\x64ouble_value\x18\x03 \x01(\x01H\x00\x12\x35\n\x0ftimestamp_value\x18\n \x01(\x0b\x32\x1a.google.protobuf.TimestampH\x00\x12\x16\n\x0cstring_value\x18\x11 \x01(\tH\x00\x12\x15\n\x0b\x62ytes_value\x18\x12 \x01(\x0cH\x00\x12\x19\n\x0freference_value\x18\x05 \x01(\tH\x00\x12.\n\x0fgeo_point_value\x18\x08 \x01(\x0b\x32\x13.google.type.LatLngH\x00\x12;\n\x0b\x61rray_value\x18\t \x01(\x0b\x32$.google.firestore.v1beta1.ArrayValueH\x00\x12\x37\n\tmap_value\x18\x06 \x01(\x0b\x32".google.firestore.v1beta1.MapValueH\x00\x42\x0c\n\nvalue_type"=\n\nArrayValue\x12/\n\x06values\x18\x01 \x03(\x0b\x32\x1f.google.firestore.v1beta1.Value"\x9a\x01\n\x08MapValue\x12>\n\x06\x66ields\x18\x01 \x03(\x0b\x32..google.firestore.v1beta1.MapValue.FieldsEntry\x1aN\n\x0b\x46ieldsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12.\n\x05value\x18\x02 \x01(\x0b\x32\x1f.google.firestore.v1beta1.Value:\x02\x38\x01\x42\xdf\x01\n\x1c\x63om.google.firestore.v1beta1B\rDocumentProtoP\x01ZAgoogle.golang.org/genproto/googleapis/firestore/v1beta1;firestore\xa2\x02\x04GCFS\xaa\x02\x1eGoogle.Cloud.Firestore.V1Beta1\xca\x02\x1eGoogle\\Cloud\\Firestore\\V1beta1\xea\x02!Google::Cloud::Firestore::V1beta1b\x06proto3',
dependencies=[
google_dot_protobuf_dot_struct__pb2.DESCRIPTOR,
google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR,
google_dot_type_dot_latlng__pb2.DESCRIPTOR,
google_dot_api_dot_annotations__pb2.DESCRIPTOR,
],
)
_DOCUMENT_FIELDSENTRY = _descriptor.Descriptor(
name="FieldsEntry",
full_name="google.firestore.v1beta1.Document.FieldsEntry",
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name="key",
full_name="google.firestore.v1beta1.Document.FieldsEntry.key",
index=0,
number=1,
type=9,
cpp_type=9,
label=1,
has_default_value=False,
default_value=b"".decode("utf-8"),
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
),
_descriptor.FieldDescriptor(
name="value",
full_name="google.firestore.v1beta1.Document.FieldsEntry.value",
index=1,
number=2,
type=11,
cpp_type=10,
label=1,
has_default_value=False,
default_value=None,
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
),
],
extensions=[],
nested_types=[],
enum_types=[],
serialized_options=b"8\001",
is_extendable=False,
syntax="proto3",
extension_ranges=[],
oneofs=[],
serialized_start=389,
serialized_end=467,
)
_DOCUMENT = _descriptor.Descriptor(
name="Document",
full_name="google.firestore.v1beta1.Document",
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name="name",
full_name="google.firestore.v1beta1.Document.name",
index=0,
number=1,
type=9,
cpp_type=9,
label=1,
has_default_value=False,
default_value=b"".decode("utf-8"),
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
),
_descriptor.FieldDescriptor(
name="fields",
full_name="google.firestore.v1beta1.Document.fields",
index=1,
number=2,
type=11,
cpp_type=10,
label=3,
has_default_value=False,
default_value=[],
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
),
_descriptor.FieldDescriptor(
name="create_time",
full_name="google.firestore.v1beta1.Document.create_time",
index=2,
number=3,
type=11,
cpp_type=10,
label=1,
has_default_value=False,
default_value=None,
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
),
_descriptor.FieldDescriptor(
name="update_time",
full_name="google.firestore.v1beta1.Document.update_time",
index=3,
number=4,
type=11,
cpp_type=10,
label=1,
has_default_value=False,
default_value=None,
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
),
],
extensions=[],
nested_types=[_DOCUMENT_FIELDSENTRY,],
enum_types=[],
serialized_options=None,
is_extendable=False,
syntax="proto3",
extension_ranges=[],
oneofs=[],
serialized_start=201,
serialized_end=467,
)
_VALUE = _descriptor.Descriptor(
name="Value",
full_name="google.firestore.v1beta1.Value",
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name="null_value",
full_name="google.firestore.v1beta1.Value.null_value",
index=0,
number=11,
type=14,
cpp_type=8,
label=1,
has_default_value=False,
default_value=0,
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
),
_descriptor.FieldDescriptor(
name="boolean_value",
full_name="google.firestore.v1beta1.Value.boolean_value",
index=1,
number=1,
type=8,
cpp_type=7,
label=1,
has_default_value=False,
default_value=False,
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
),
_descriptor.FieldDescriptor(
name="integer_value",
full_name="google.firestore.v1beta1.Value.integer_value",
index=2,
number=2,
type=3,
cpp_type=2,
label=1,
has_default_value=False,
default_value=0,
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
),
_descriptor.FieldDescriptor(
name="double_value",
full_name="google.firestore.v1beta1.Value.double_value",
index=3,
number=3,
type=1,
cpp_type=5,
label=1,
has_default_value=False,
default_value=float(0),
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
),
_descriptor.FieldDescriptor(
name="timestamp_value",
full_name="google.firestore.v1beta1.Value.timestamp_value",
index=4,
number=10,
type=11,
cpp_type=10,
label=1,
has_default_value=False,
default_value=None,
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
),
_descriptor.FieldDescriptor(
name="string_value",
full_name="google.firestore.v1beta1.Value.string_value",
index=5,
number=17,
type=9,
cpp_type=9,
label=1,
has_default_value=False,
default_value=b"".decode("utf-8"),
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
),
_descriptor.FieldDescriptor(
name="bytes_value",
full_name="google.firestore.v1beta1.Value.bytes_value",
index=6,
number=18,
type=12,
cpp_type=9,
label=1,
has_default_value=False,
default_value=b"",
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
),
_descriptor.FieldDescriptor(
name="reference_value",
full_name="google.firestore.v1beta1.Value.reference_value",
index=7,
number=5,
type=9,
cpp_type=9,
label=1,
has_default_value=False,
default_value=b"".decode("utf-8"),
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
),
_descriptor.FieldDescriptor(
name="geo_point_value",
full_name="google.firestore.v1beta1.Value.geo_point_value",
index=8,
number=8,
type=11,
cpp_type=10,
label=1,
has_default_value=False,
default_value=None,
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
),
_descriptor.FieldDescriptor(
name="array_value",
full_name="google.firestore.v1beta1.Value.array_value",
index=9,
number=9,
type=11,
cpp_type=10,
label=1,
has_default_value=False,
default_value=None,
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
),
_descriptor.FieldDescriptor(
name="map_value",
full_name="google.firestore.v1beta1.Value.map_value",
index=10,
number=6,
type=11,
cpp_type=10,
label=1,
has_default_value=False,
default_value=None,
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
),
],
extensions=[],
nested_types=[],
enum_types=[],
serialized_options=None,
is_extendable=False,
syntax="proto3",
extension_ranges=[],
oneofs=[
_descriptor.OneofDescriptor(
name="value_type",
full_name="google.firestore.v1beta1.Value.value_type",
index=0,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[],
),
],
serialized_start=470,
serialized_end=910,
)
_ARRAYVALUE = _descriptor.Descriptor(
name="ArrayValue",
full_name="google.firestore.v1beta1.ArrayValue",
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name="values",
full_name="google.firestore.v1beta1.ArrayValue.values",
index=0,
number=1,
type=11,
cpp_type=10,
label=3,
has_default_value=False,
default_value=[],
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
),
],
extensions=[],
nested_types=[],
enum_types=[],
serialized_options=None,
is_extendable=False,
syntax="proto3",
extension_ranges=[],
oneofs=[],
serialized_start=912,
serialized_end=973,
)
_MAPVALUE_FIELDSENTRY = _descriptor.Descriptor(
name="FieldsEntry",
full_name="google.firestore.v1beta1.MapValue.FieldsEntry",
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name="key",
full_name="google.firestore.v1beta1.MapValue.FieldsEntry.key",
index=0,
number=1,
type=9,
cpp_type=9,
label=1,
has_default_value=False,
default_value=b"".decode("utf-8"),
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
),
_descriptor.FieldDescriptor(
name="value",
full_name="google.firestore.v1beta1.MapValue.FieldsEntry.value",
index=1,
number=2,
type=11,
cpp_type=10,
label=1,
has_default_value=False,
default_value=None,
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
),
],
extensions=[],
nested_types=[],
enum_types=[],
serialized_options=b"8\001",
is_extendable=False,
syntax="proto3",
extension_ranges=[],
oneofs=[],
serialized_start=389,
serialized_end=467,
)
_MAPVALUE = _descriptor.Descriptor(
name="MapValue",
full_name="google.firestore.v1beta1.MapValue",
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name="fields",
full_name="google.firestore.v1beta1.MapValue.fields",
index=0,
number=1,
type=11,
cpp_type=10,
label=3,
has_default_value=False,
default_value=[],
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
serialized_options=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
),
],
extensions=[],
nested_types=[_MAPVALUE_FIELDSENTRY,],
enum_types=[],
serialized_options=None,
is_extendable=False,
syntax="proto3",
extension_ranges=[],
oneofs=[],
serialized_start=976,
serialized_end=1130,
)
_DOCUMENT_FIELDSENTRY.fields_by_name["value"].message_type = _VALUE
_DOCUMENT_FIELDSENTRY.containing_type = _DOCUMENT
_DOCUMENT.fields_by_name["fields"].message_type = _DOCUMENT_FIELDSENTRY
_DOCUMENT.fields_by_name[
"create_time"
].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP
_DOCUMENT.fields_by_name[
"update_time"
].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP
_VALUE.fields_by_name[
"null_value"
].enum_type = google_dot_protobuf_dot_struct__pb2._NULLVALUE
_VALUE.fields_by_name[
"timestamp_value"
].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP
_VALUE.fields_by_name[
"geo_point_value"
].message_type = google_dot_type_dot_latlng__pb2._LATLNG
_VALUE.fields_by_name["array_value"].message_type = _ARRAYVALUE
_VALUE.fields_by_name["map_value"].message_type = _MAPVALUE
_VALUE.oneofs_by_name["value_type"].fields.append(_VALUE.fields_by_name["null_value"])
_VALUE.fields_by_name["null_value"].containing_oneof = _VALUE.oneofs_by_name[
"value_type"
]
_VALUE.oneofs_by_name["value_type"].fields.append(
_VALUE.fields_by_name["boolean_value"]
)
_VALUE.fields_by_name["boolean_value"].containing_oneof = _VALUE.oneofs_by_name[
"value_type"
]
_VALUE.oneofs_by_name["value_type"].fields.append(
_VALUE.fields_by_name["integer_value"]
)
_VALUE.fields_by_name["integer_value"].containing_oneof = _VALUE.oneofs_by_name[
"value_type"
]
_VALUE.oneofs_by_name["value_type"].fields.append(_VALUE.fields_by_name["double_value"])
_VALUE.fields_by_name["double_value"].containing_oneof = _VALUE.oneofs_by_name[
"value_type"
]
_VALUE.oneofs_by_name["value_type"].fields.append(
_VALUE.fields_by_name["timestamp_value"]
)
_VALUE.fields_by_name["timestamp_value"].containing_oneof = _VALUE.oneofs_by_name[
"value_type"
]
_VALUE.oneofs_by_name["value_type"].fields.append(_VALUE.fields_by_name["string_value"])
_VALUE.fields_by_name["string_value"].containing_oneof = _VALUE.oneofs_by_name[
"value_type"
]
_VALUE.oneofs_by_name["value_type"].fields.append(_VALUE.fields_by_name["bytes_value"])
_VALUE.fields_by_name["bytes_value"].containing_oneof = _VALUE.oneofs_by_name[
"value_type"
]
_VALUE.oneofs_by_name["value_type"].fields.append(
_VALUE.fields_by_name["reference_value"]
)
_VALUE.fields_by_name["reference_value"].containing_oneof = _VALUE.oneofs_by_name[
"value_type"
]
_VALUE.oneofs_by_name["value_type"].fields.append(
_VALUE.fields_by_name["geo_point_value"]
)
_VALUE.fields_by_name["geo_point_value"].containing_oneof = _VALUE.oneofs_by_name[
"value_type"
]
_VALUE.oneofs_by_name["value_type"].fields.append(_VALUE.fields_by_name["array_value"])
_VALUE.fields_by_name["array_value"].containing_oneof = _VALUE.oneofs_by_name[
"value_type"
]
_VALUE.oneofs_by_name["value_type"].fields.append(_VALUE.fields_by_name["map_value"])
_VALUE.fields_by_name["map_value"].containing_oneof = _VALUE.oneofs_by_name[
"value_type"
]
_ARRAYVALUE.fields_by_name["values"].message_type = _VALUE
_MAPVALUE_FIELDSENTRY.fields_by_name["value"].message_type = _VALUE
_MAPVALUE_FIELDSENTRY.containing_type = _MAPVALUE
_MAPVALUE.fields_by_name["fields"].message_type = _MAPVALUE_FIELDSENTRY
DESCRIPTOR.message_types_by_name["Document"] = _DOCUMENT
DESCRIPTOR.message_types_by_name["Value"] = _VALUE
DESCRIPTOR.message_types_by_name["ArrayValue"] = _ARRAYVALUE
DESCRIPTOR.message_types_by_name["MapValue"] = _MAPVALUE
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
Document = _reflection.GeneratedProtocolMessageType(
"Document",
(_message.Message,),
{
"FieldsEntry": _reflection.GeneratedProtocolMessageType(
"FieldsEntry",
(_message.Message,),
{
"DESCRIPTOR": _DOCUMENT_FIELDSENTRY,
"__module__": "google.cloud.firestore_v1beta1.proto.document_pb2"
# @@protoc_insertion_point(class_scope:google.firestore.v1beta1.Document.FieldsEntry)
},
),
"DESCRIPTOR": _DOCUMENT,
"__module__": "google.cloud.firestore_v1beta1.proto.document_pb2",
"__doc__": """A Firestore document. Must not exceed 1 MiB - 4 bytes.
Attributes:
name:
The resource name of the document, for example ``projects/{pro
ject_id}/databases/{database_id}/documents/{document_path}``.
fields:
The documents fields. The map keys represent field names. A
simple field name contains only characters ``a`` to ``z``,
``A`` to ``Z``, ``0`` to ``9``, or ``_``, and must not start
with ``0`` to ``9``. For example, ``foo_bar_17``. Field names
matching the regular expression ``__.*__`` are reserved.
Reserved field names are forbidden except in certain
documented contexts. The map keys, represented as UTF-8, must
not exceed 1,500 bytes and cannot be empty. Field paths may
be used in other contexts to refer to structured fields
defined here. For ``map_value``, the field path is represented
by the simple or quoted field names of the containing fields,
delimited by ``.``. For example, the structured field ``"foo"
: { map_value: { "x&y" : { string_value: "hello" }}}`` would
be represented by the field path ``foo.x&y``. Within a field
path, a quoted field name starts and ends with :literal:`\``
and may contain any character. Some characters, including
:literal:`\``, must be escaped using a ``\``. For example,
:literal:`\`x&y\`` represents ``x&y`` and
:literal:`\`bak\`tik\`` represents :literal:`bak`tik`.
create_time:
Output only. The time at which the document was created. This
value increases monotonically when a document is deleted then
recreated. It can also be compared to values from other
documents and the ``read_time`` of a query.
update_time:
Output only. The time at which the document was last changed.
This value is initially set to the ``create_time`` then
increases monotonically with each change to the document. It
can also be compared to values from other documents and the
``read_time`` of a query.
""",
# @@protoc_insertion_point(class_scope:google.firestore.v1beta1.Document)
},
)
_sym_db.RegisterMessage(Document)
_sym_db.RegisterMessage(Document.FieldsEntry)
Value = _reflection.GeneratedProtocolMessageType(
"Value",
(_message.Message,),
{
"DESCRIPTOR": _VALUE,
"__module__": "google.cloud.firestore_v1beta1.proto.document_pb2",
"__doc__": """A message that can hold any of the supported value types.
Attributes:
value_type:
Must have a value set.
null_value:
A null value.
boolean_value:
A boolean value.
integer_value:
An integer value.
double_value:
A double value.
timestamp_value:
A timestamp value. Precise only to microseconds. When stored,
any additional precision is rounded down.
string_value:
A string value. The string, represented as UTF-8, must not
exceed 1 MiB - 89 bytes. Only the first 1,500 bytes of the
UTF-8 representation are considered by queries.
bytes_value:
A bytes value. Must not exceed 1 MiB - 89 bytes. Only the
first 1,500 bytes are considered by queries.
reference_value:
A reference to a document. For example: ``projects/{project_id
}/databases/{database_id}/documents/{document_path}``.
geo_point_value:
A geo point value representing a point on the surface of
Earth.
array_value:
An array value. Cannot directly contain another array value,
though can contain an map which contains another array.
map_value:
A map value.
""",
# @@protoc_insertion_point(class_scope:google.firestore.v1beta1.Value)
},
)
_sym_db.RegisterMessage(Value)
ArrayValue = _reflection.GeneratedProtocolMessageType(
"ArrayValue",
(_message.Message,),
{
"DESCRIPTOR": _ARRAYVALUE,
"__module__": "google.cloud.firestore_v1beta1.proto.document_pb2",
"__doc__": """An array value.
Attributes:
values:
Values in the array.
""",
# @@protoc_insertion_point(class_scope:google.firestore.v1beta1.ArrayValue)
},
)
_sym_db.RegisterMessage(ArrayValue)
MapValue = _reflection.GeneratedProtocolMessageType(
"MapValue",
(_message.Message,),
{
"FieldsEntry": _reflection.GeneratedProtocolMessageType(
"FieldsEntry",
(_message.Message,),
{
"DESCRIPTOR": _MAPVALUE_FIELDSENTRY,
"__module__": "google.cloud.firestore_v1beta1.proto.document_pb2"
# @@protoc_insertion_point(class_scope:google.firestore.v1beta1.MapValue.FieldsEntry)
},
),
"DESCRIPTOR": _MAPVALUE,
"__module__": "google.cloud.firestore_v1beta1.proto.document_pb2",
"__doc__": """A map value.
Attributes:
fields:
The maps fields. The map keys represent field names. Field
names matching the regular expression ``__.*__`` are reserved.
Reserved field names are forbidden except in certain
documented contexts. The map keys, represented as UTF-8, must
not exceed 1,500 bytes and cannot be empty.
""",
# @@protoc_insertion_point(class_scope:google.firestore.v1beta1.MapValue)
},
)
_sym_db.RegisterMessage(MapValue)
_sym_db.RegisterMessage(MapValue.FieldsEntry)
DESCRIPTOR._options = None
_DOCUMENT_FIELDSENTRY._options = None
_MAPVALUE_FIELDSENTRY._options = None
# @@protoc_insertion_point(module_scope)

View file

@ -0,0 +1,3 @@
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc

View file

@ -0,0 +1,62 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/cloud/firestore_v1beta1/proto/event_flow_document_change.proto
import sys
_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1"))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2
from google.cloud.firestore_v1beta1.proto import (
common_pb2 as google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_common__pb2,
)
from google.cloud.firestore_v1beta1.proto import (
document_pb2 as google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_document__pb2,
)
DESCRIPTOR = _descriptor.FileDescriptor(
name="google/cloud/firestore_v1beta1/proto/event_flow_document_change.proto",
package="google.firestore.v1beta1",
syntax="proto3",
serialized_pb=_b(
"\nEgoogle/cloud/firestore_v1beta1/proto/event_flow_document_change.proto\x12\x18google.firestore.v1beta1\x1a\x1cgoogle/api/annotations.proto\x1a\x31google/cloud/firestore_v1beta1/proto/common.proto\x1a\x33google/cloud/firestore_v1beta1/proto/document.protoB\xa2\x01\n\x1c\x63om.google.firestore.v1beta1B\x1c\x45ventFlowDocumentChangeProtoP\x01ZAgoogle.golang.org/genproto/googleapis/firestore/v1beta1;firestore\xaa\x02\x1eGoogle.Cloud.Firestore.V1Beta1b\x06proto3"
),
dependencies=[
google_dot_api_dot_annotations__pb2.DESCRIPTOR,
google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_common__pb2.DESCRIPTOR,
google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_document__pb2.DESCRIPTOR,
],
)
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
DESCRIPTOR.has_options = True
DESCRIPTOR._options = _descriptor._ParseOptions(
descriptor_pb2.FileOptions(),
_b(
"\n\034com.google.firestore.v1beta1B\034EventFlowDocumentChangeProtoP\001ZAgoogle.golang.org/genproto/googleapis/firestore/v1beta1;firestore\252\002\036Google.Cloud.Firestore.V1Beta1"
),
)
try:
# THESE ELEMENTS WILL BE DEPRECATED.
# Please use the generated *_pb2_grpc.py files instead.
import grpc
from grpc.beta import implementations as beta_implementations
from grpc.beta import interfaces as beta_interfaces
from grpc.framework.common import cardinality
from grpc.framework.interfaces.face import utilities as face_utilities
except ImportError:
pass
# @@protoc_insertion_point(module_scope)

View file

@ -0,0 +1,2 @@
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc

View file

@ -0,0 +1,95 @@
// Copyright 2018 Google LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
syntax = "proto3";
package google.firestore.admin.v1beta2;
import "google/api/annotations.proto";
import "google/firestore/admin/v1beta2/index.proto";
option csharp_namespace = "Google.Cloud.Firestore.Admin.V1Beta2";
option go_package = "google.golang.org/genproto/googleapis/firestore/admin/v1beta2;admin";
option java_multiple_files = true;
option java_outer_classname = "FieldProto";
option java_package = "com.google.firestore.admin.v1beta2";
option objc_class_prefix = "GCFS";
// Represents a single field in the database.
//
// Fields are grouped by their "Collection Group", which represent all
// collections in the database with the same id.
message Field {
// The index configuration for this field.
message IndexConfig {
// The indexes supported for this field.
repeated Index indexes = 1;
// Output only.
// When true, the `Field`'s index configuration is set from the
// configuration specified by the `ancestor_field`.
// When false, the `Field`'s index configuration is defined explicitly.
bool uses_ancestor_config = 2;
// Output only.
// Specifies the resource name of the `Field` from which this field's
// index configuration is set (when `uses_ancestor_config` is true),
// or from which it *would* be set if this field had no index configuration
// (when `uses_ancestor_config` is false).
string ancestor_field = 3;
// Output only
// When true, the `Field`'s index configuration is in the process of being
// reverted. Once complete, the index config will transition to the same
// state as the field specified by `ancestor_field`, at which point
// `uses_ancestor_config` will be `true` and `reverting` will be `false`.
bool reverting = 4;
}
// A field name of the form
// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_path}`
//
// A field path may be a simple field name, e.g. `address` or a path to fields
// within map_value , e.g. `address.city`,
// or a special field path. The only valid special field is `*`, which
// represents any field.
//
// Field paths may be quoted using ` (backtick). The only character that needs
// to be escaped within a quoted field path is the backtick character itself,
// escaped using a backslash. Special characters in field paths that
// must be quoted include: `*`, `.`,
// ``` (backtick), `[`, `]`, as well as any ascii symbolic characters.
//
// Examples:
// (Note: Comments here are written in markdown syntax, so there is an
// additional layer of backticks to represent a code block)
// `\`address.city\`` represents a field named `address.city`, not the map key
// `city` in the field `address`.
// `\`*\`` represents a field named `*`, not any field.
//
// A special `Field` contains the default indexing settings for all fields.
// This field's resource name is:
// `projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/*`
// Indexes defined on this `Field` will be applied to all fields which do not
// have their own `Field` index configuration.
string name = 1;
// The index configuration for this field. If unset, field indexing will
// revert to the configuration defined by the `ancestor_field`. To
// explicitly remove all indexes for this field, specify an index config
// with an empty list of indexes.
IndexConfig index_config = 2;
}

View file

@ -0,0 +1,766 @@
// Copyright 2019 Google LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
syntax = "proto3";
package google.firestore.v1beta1;
import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/firestore/v1beta1/common.proto";
import "google/firestore/v1beta1/document.proto";
import "google/firestore/v1beta1/query.proto";
import "google/firestore/v1beta1/write.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto";
import "google/rpc/status.proto";
option csharp_namespace = "Google.Cloud.Firestore.V1Beta1";
option go_package = "google.golang.org/genproto/googleapis/firestore/v1beta1;firestore";
option java_multiple_files = true;
option java_outer_classname = "FirestoreProto";
option java_package = "com.google.firestore.v1beta1";
option objc_class_prefix = "GCFS";
option php_namespace = "Google\\Cloud\\Firestore\\V1beta1";
option ruby_package = "Google::Cloud::Firestore::V1beta1";
// Specification of the Firestore API.
// The Cloud Firestore service.
//
// This service exposes several types of comparable timestamps:
//
// * `create_time` - The time at which a document was created. Changes only
// when a document is deleted, then re-created. Increases in a strict
// monotonic fashion.
// * `update_time` - The time at which a document was last updated. Changes
// every time a document is modified. Does not change when a write results
// in no modifications. Increases in a strict monotonic fashion.
// * `read_time` - The time at which a particular state was observed. Used
// to denote a consistent snapshot of the database or the time at which a
// Document was observed to not exist.
// * `commit_time` - The time at which the writes in a transaction were
// committed. Any read with an equal or greater `read_time` is guaranteed
// to see the effects of the transaction.
service Firestore {
option (google.api.default_host) = "firestore.googleapis.com";
option (google.api.oauth_scopes) =
"https://www.googleapis.com/auth/cloud-platform,"
"https://www.googleapis.com/auth/datastore";
// Gets a single document.
rpc GetDocument(GetDocumentRequest) returns (Document) {
option (google.api.http) = {
get: "/v1beta1/{name=projects/*/databases/*/documents/*/**}"
};
}
// Lists documents.
rpc ListDocuments(ListDocumentsRequest) returns (ListDocumentsResponse) {
option (google.api.http) = {
get: "/v1beta1/{parent=projects/*/databases/*/documents/*/**}/{collection_id}"
};
}
// Creates a new document.
rpc CreateDocument(CreateDocumentRequest) returns (Document) {
option (google.api.http) = {
post: "/v1beta1/{parent=projects/*/databases/*/documents/**}/{collection_id}"
body: "document"
};
}
// Updates or inserts a document.
rpc UpdateDocument(UpdateDocumentRequest) returns (Document) {
option (google.api.http) = {
patch: "/v1beta1/{document.name=projects/*/databases/*/documents/*/**}"
body: "document"
};
option (google.api.method_signature) = "document,update_mask";
}
// Deletes a document.
rpc DeleteDocument(DeleteDocumentRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/v1beta1/{name=projects/*/databases/*/documents/*/**}"
};
option (google.api.method_signature) = "name";
}
// Gets multiple documents.
//
// Documents returned by this method are not guaranteed to be returned in the
// same order that they were requested.
rpc BatchGetDocuments(BatchGetDocumentsRequest) returns (stream BatchGetDocumentsResponse) {
option (google.api.http) = {
post: "/v1beta1/{database=projects/*/databases/*}/documents:batchGet"
body: "*"
};
}
// Starts a new transaction.
rpc BeginTransaction(BeginTransactionRequest) returns (BeginTransactionResponse) {
option (google.api.http) = {
post: "/v1beta1/{database=projects/*/databases/*}/documents:beginTransaction"
body: "*"
};
option (google.api.method_signature) = "database";
}
// Commits a transaction, while optionally updating documents.
rpc Commit(CommitRequest) returns (CommitResponse) {
option (google.api.http) = {
post: "/v1beta1/{database=projects/*/databases/*}/documents:commit"
body: "*"
};
option (google.api.method_signature) = "database,writes";
}
// Rolls back a transaction.
rpc Rollback(RollbackRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
post: "/v1beta1/{database=projects/*/databases/*}/documents:rollback"
body: "*"
};
option (google.api.method_signature) = "database,transaction";
}
// Runs a query.
rpc RunQuery(RunQueryRequest) returns (stream RunQueryResponse) {
option (google.api.http) = {
post: "/v1beta1/{parent=projects/*/databases/*/documents}:runQuery"
body: "*"
additional_bindings {
post: "/v1beta1/{parent=projects/*/databases/*/documents/*/**}:runQuery"
body: "*"
}
};
}
// Streams batches of document updates and deletes, in order.
rpc Write(stream WriteRequest) returns (stream WriteResponse) {
option (google.api.http) = {
post: "/v1beta1/{database=projects/*/databases/*}/documents:write"
body: "*"
};
}
// Listens to changes.
rpc Listen(stream ListenRequest) returns (stream ListenResponse) {
option (google.api.http) = {
post: "/v1beta1/{database=projects/*/databases/*}/documents:listen"
body: "*"
};
}
// Lists all the collection IDs underneath a document.
rpc ListCollectionIds(ListCollectionIdsRequest) returns (ListCollectionIdsResponse) {
option (google.api.http) = {
post: "/v1beta1/{parent=projects/*/databases/*/documents}:listCollectionIds"
body: "*"
additional_bindings {
post: "/v1beta1/{parent=projects/*/databases/*/documents/*/**}:listCollectionIds"
body: "*"
}
};
option (google.api.method_signature) = "parent";
}
}
// The request for [Firestore.GetDocument][google.firestore.v1beta1.Firestore.GetDocument].
message GetDocumentRequest {
// Required. The resource name of the Document to get. In the format:
// `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
string name = 1 [(google.api.field_behavior) = REQUIRED];
// The fields to return. If not set, returns all fields.
//
// If the document has a field that is not present in this mask, that field
// will not be returned in the response.
DocumentMask mask = 2;
// The consistency mode for this transaction.
// If not set, defaults to strong consistency.
oneof consistency_selector {
// Reads the document in a transaction.
bytes transaction = 3;
// Reads the version of the document at the given time.
// This may not be older than 60 seconds.
google.protobuf.Timestamp read_time = 5;
}
}
// The request for [Firestore.ListDocuments][google.firestore.v1beta1.Firestore.ListDocuments].
message ListDocumentsRequest {
// Required. The parent resource name. In the format:
// `projects/{project_id}/databases/{database_id}/documents` or
// `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
// For example:
// `projects/my-project/databases/my-database/documents` or
// `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
string parent = 1 [(google.api.field_behavior) = REQUIRED];
// Required. The collection ID, relative to `parent`, to list. For example: `chatrooms`
// or `messages`.
string collection_id = 2 [(google.api.field_behavior) = REQUIRED];
// The maximum number of documents to return.
int32 page_size = 3;
// The `next_page_token` value returned from a previous List request, if any.
string page_token = 4;
// The order to sort results by. For example: `priority desc, name`.
string order_by = 6;
// The fields to return. If not set, returns all fields.
//
// If a document has a field that is not present in this mask, that field
// will not be returned in the response.
DocumentMask mask = 7;
// The consistency mode for this transaction.
// If not set, defaults to strong consistency.
oneof consistency_selector {
// Reads documents in a transaction.
bytes transaction = 8;
// Reads documents as they were at the given time.
// This may not be older than 60 seconds.
google.protobuf.Timestamp read_time = 10;
}
// If the list should show missing documents. A missing document is a
// document that does not exist but has sub-documents. These documents will
// be returned with a key but will not have fields, [Document.create_time][google.firestore.v1beta1.Document.create_time],
// or [Document.update_time][google.firestore.v1beta1.Document.update_time] set.
//
// Requests with `show_missing` may not specify `where` or
// `order_by`.
bool show_missing = 12;
}
// The response for [Firestore.ListDocuments][google.firestore.v1beta1.Firestore.ListDocuments].
message ListDocumentsResponse {
// The Documents found.
repeated Document documents = 1;
// The next page token.
string next_page_token = 2;
}
// The request for [Firestore.CreateDocument][google.firestore.v1beta1.Firestore.CreateDocument].
message CreateDocumentRequest {
// Required. The parent resource. For example:
// `projects/{project_id}/databases/{database_id}/documents` or
// `projects/{project_id}/databases/{database_id}/documents/chatrooms/{chatroom_id}`
string parent = 1 [(google.api.field_behavior) = REQUIRED];
// Required. The collection ID, relative to `parent`, to list. For example: `chatrooms`.
string collection_id = 2 [(google.api.field_behavior) = REQUIRED];
// The client-assigned document ID to use for this document.
//
// Optional. If not specified, an ID will be assigned by the service.
string document_id = 3;
// Required. The document to create. `name` must not be set.
Document document = 4 [(google.api.field_behavior) = REQUIRED];
// The fields to return. If not set, returns all fields.
//
// If the document has a field that is not present in this mask, that field
// will not be returned in the response.
DocumentMask mask = 5;
}
// The request for [Firestore.UpdateDocument][google.firestore.v1beta1.Firestore.UpdateDocument].
message UpdateDocumentRequest {
// Required. The updated document.
// Creates the document if it does not already exist.
Document document = 1 [(google.api.field_behavior) = REQUIRED];
// The fields to update.
// None of the field paths in the mask may contain a reserved name.
//
// If the document exists on the server and has fields not referenced in the
// mask, they are left unchanged.
// Fields referenced in the mask, but not present in the input document, are
// deleted from the document on the server.
DocumentMask update_mask = 2;
// The fields to return. If not set, returns all fields.
//
// If the document has a field that is not present in this mask, that field
// will not be returned in the response.
DocumentMask mask = 3;
// An optional precondition on the document.
// The request will fail if this is set and not met by the target document.
Precondition current_document = 4;
}
// The request for [Firestore.DeleteDocument][google.firestore.v1beta1.Firestore.DeleteDocument].
message DeleteDocumentRequest {
// Required. The resource name of the Document to delete. In the format:
// `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
string name = 1 [(google.api.field_behavior) = REQUIRED];
// An optional precondition on the document.
// The request will fail if this is set and not met by the target document.
Precondition current_document = 2;
}
// The request for [Firestore.BatchGetDocuments][google.firestore.v1beta1.Firestore.BatchGetDocuments].
message BatchGetDocumentsRequest {
// Required. The database name. In the format:
// `projects/{project_id}/databases/{database_id}`.
string database = 1 [(google.api.field_behavior) = REQUIRED];
// The names of the documents to retrieve. In the format:
// `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
// The request will fail if any of the document is not a child resource of the
// given `database`. Duplicate names will be elided.
repeated string documents = 2;
// The fields to return. If not set, returns all fields.
//
// If a document has a field that is not present in this mask, that field will
// not be returned in the response.
DocumentMask mask = 3;
// The consistency mode for this transaction.
// If not set, defaults to strong consistency.
oneof consistency_selector {
// Reads documents in a transaction.
bytes transaction = 4;
// Starts a new transaction and reads the documents.
// Defaults to a read-only transaction.
// The new transaction ID will be returned as the first response in the
// stream.
TransactionOptions new_transaction = 5;
// Reads documents as they were at the given time.
// This may not be older than 60 seconds.
google.protobuf.Timestamp read_time = 7;
}
}
// The streamed response for [Firestore.BatchGetDocuments][google.firestore.v1beta1.Firestore.BatchGetDocuments].
message BatchGetDocumentsResponse {
// A single result.
// This can be empty if the server is just returning a transaction.
oneof result {
// A document that was requested.
Document found = 1;
// A document name that was requested but does not exist. In the format:
// `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
string missing = 2;
}
// The transaction that was started as part of this request.
// Will only be set in the first response, and only if
// [BatchGetDocumentsRequest.new_transaction][google.firestore.v1beta1.BatchGetDocumentsRequest.new_transaction] was set in the request.
bytes transaction = 3;
// The time at which the document was read.
// This may be monotically increasing, in this case the previous documents in
// the result stream are guaranteed not to have changed between their
// read_time and this one.
google.protobuf.Timestamp read_time = 4;
}
// The request for [Firestore.BeginTransaction][google.firestore.v1beta1.Firestore.BeginTransaction].
message BeginTransactionRequest {
// Required. The database name. In the format:
// `projects/{project_id}/databases/{database_id}`.
string database = 1 [(google.api.field_behavior) = REQUIRED];
// The options for the transaction.
// Defaults to a read-write transaction.
TransactionOptions options = 2;
}
// The response for [Firestore.BeginTransaction][google.firestore.v1beta1.Firestore.BeginTransaction].
message BeginTransactionResponse {
// The transaction that was started.
bytes transaction = 1;
}
// The request for [Firestore.Commit][google.firestore.v1beta1.Firestore.Commit].
message CommitRequest {
// Required. The database name. In the format:
// `projects/{project_id}/databases/{database_id}`.
string database = 1 [(google.api.field_behavior) = REQUIRED];
// The writes to apply.
//
// Always executed atomically and in order.
repeated Write writes = 2;
// If set, applies all writes in this transaction, and commits it.
bytes transaction = 3;
}
// The response for [Firestore.Commit][google.firestore.v1beta1.Firestore.Commit].
message CommitResponse {
// The result of applying the writes.
//
// This i-th write result corresponds to the i-th write in the
// request.
repeated WriteResult write_results = 1;
// The time at which the commit occurred.
google.protobuf.Timestamp commit_time = 2;
}
// The request for [Firestore.Rollback][google.firestore.v1beta1.Firestore.Rollback].
message RollbackRequest {
// Required. The database name. In the format:
// `projects/{project_id}/databases/{database_id}`.
string database = 1 [(google.api.field_behavior) = REQUIRED];
// Required. The transaction to roll back.
bytes transaction = 2 [(google.api.field_behavior) = REQUIRED];
}
// The request for [Firestore.RunQuery][google.firestore.v1beta1.Firestore.RunQuery].
message RunQueryRequest {
// Required. The parent resource name. In the format:
// `projects/{project_id}/databases/{database_id}/documents` or
// `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
// For example:
// `projects/my-project/databases/my-database/documents` or
// `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
string parent = 1 [(google.api.field_behavior) = REQUIRED];
// The query to run.
oneof query_type {
// A structured query.
StructuredQuery structured_query = 2;
}
// The consistency mode for this transaction.
// If not set, defaults to strong consistency.
oneof consistency_selector {
// Reads documents in a transaction.
bytes transaction = 5;
// Starts a new transaction and reads the documents.
// Defaults to a read-only transaction.
// The new transaction ID will be returned as the first response in the
// stream.
TransactionOptions new_transaction = 6;
// Reads documents as they were at the given time.
// This may not be older than 60 seconds.
google.protobuf.Timestamp read_time = 7;
}
}
// The response for [Firestore.RunQuery][google.firestore.v1beta1.Firestore.RunQuery].
message RunQueryResponse {
// The transaction that was started as part of this request.
// Can only be set in the first response, and only if
// [RunQueryRequest.new_transaction][google.firestore.v1beta1.RunQueryRequest.new_transaction] was set in the request.
// If set, no other fields will be set in this response.
bytes transaction = 2;
// A query result.
// Not set when reporting partial progress.
Document document = 1;
// The time at which the document was read. This may be monotonically
// increasing; in this case, the previous documents in the result stream are
// guaranteed not to have changed between their `read_time` and this one.
//
// If the query returns no results, a response with `read_time` and no
// `document` will be sent, and this represents the time at which the query
// was run.
google.protobuf.Timestamp read_time = 3;
// The number of results that have been skipped due to an offset between
// the last response and the current response.
int32 skipped_results = 4;
}
// The request for [Firestore.Write][google.firestore.v1beta1.Firestore.Write].
//
// The first request creates a stream, or resumes an existing one from a token.
//
// When creating a new stream, the server replies with a response containing
// only an ID and a token, to use in the next request.
//
// When resuming a stream, the server first streams any responses later than the
// given token, then a response containing only an up-to-date token, to use in
// the next request.
message WriteRequest {
// Required. The database name. In the format:
// `projects/{project_id}/databases/{database_id}`.
// This is only required in the first message.
string database = 1 [(google.api.field_behavior) = REQUIRED];
// The ID of the write stream to resume.
// This may only be set in the first message. When left empty, a new write
// stream will be created.
string stream_id = 2;
// The writes to apply.
//
// Always executed atomically and in order.
// This must be empty on the first request.
// This may be empty on the last request.
// This must not be empty on all other requests.
repeated Write writes = 3;
// A stream token that was previously sent by the server.
//
// The client should set this field to the token from the most recent
// [WriteResponse][google.firestore.v1beta1.WriteResponse] it has received. This acknowledges that the client has
// received responses up to this token. After sending this token, earlier
// tokens may not be used anymore.
//
// The server may close the stream if there are too many unacknowledged
// responses.
//
// Leave this field unset when creating a new stream. To resume a stream at
// a specific point, set this field and the `stream_id` field.
//
// Leave this field unset when creating a new stream.
bytes stream_token = 4;
// Labels associated with this write request.
map<string, string> labels = 5;
}
// The response for [Firestore.Write][google.firestore.v1beta1.Firestore.Write].
message WriteResponse {
// The ID of the stream.
// Only set on the first message, when a new stream was created.
string stream_id = 1;
// A token that represents the position of this response in the stream.
// This can be used by a client to resume the stream at this point.
//
// This field is always set.
bytes stream_token = 2;
// The result of applying the writes.
//
// This i-th write result corresponds to the i-th write in the
// request.
repeated WriteResult write_results = 3;
// The time at which the commit occurred.
google.protobuf.Timestamp commit_time = 4;
}
// A request for [Firestore.Listen][google.firestore.v1beta1.Firestore.Listen]
message ListenRequest {
// Required. The database name. In the format:
// `projects/{project_id}/databases/{database_id}`.
string database = 1 [(google.api.field_behavior) = REQUIRED];
// The supported target changes.
oneof target_change {
// A target to add to this stream.
Target add_target = 2;
// The ID of a target to remove from this stream.
int32 remove_target = 3;
}
// Labels associated with this target change.
map<string, string> labels = 4;
}
// The response for [Firestore.Listen][google.firestore.v1beta1.Firestore.Listen].
message ListenResponse {
// The supported responses.
oneof response_type {
// Targets have changed.
TargetChange target_change = 2;
// A [Document][google.firestore.v1beta1.Document] has changed.
DocumentChange document_change = 3;
// A [Document][google.firestore.v1beta1.Document] has been deleted.
DocumentDelete document_delete = 4;
// A [Document][google.firestore.v1beta1.Document] has been removed from a target (because it is no longer
// relevant to that target).
DocumentRemove document_remove = 6;
// A filter to apply to the set of documents previously returned for the
// given target.
//
// Returned when documents may have been removed from the given target, but
// the exact documents are unknown.
ExistenceFilter filter = 5;
}
}
// A specification of a set of documents to listen to.
message Target {
// A target specified by a set of documents names.
message DocumentsTarget {
// The names of the documents to retrieve. In the format:
// `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
// The request will fail if any of the document is not a child resource of
// the given `database`. Duplicate names will be elided.
repeated string documents = 2;
}
// A target specified by a query.
message QueryTarget {
// The parent resource name. In the format:
// `projects/{project_id}/databases/{database_id}/documents` or
// `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
// For example:
// `projects/my-project/databases/my-database/documents` or
// `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
string parent = 1;
// The query to run.
oneof query_type {
// A structured query.
StructuredQuery structured_query = 2;
}
}
// The type of target to listen to.
oneof target_type {
// A target specified by a query.
QueryTarget query = 2;
// A target specified by a set of document names.
DocumentsTarget documents = 3;
}
// When to start listening.
//
// If not specified, all matching Documents are returned before any
// subsequent changes.
oneof resume_type {
// A resume token from a prior [TargetChange][google.firestore.v1beta1.TargetChange] for an identical target.
//
// Using a resume token with a different target is unsupported and may fail.
bytes resume_token = 4;
// Start listening after a specific `read_time`.
//
// The client must know the state of matching documents at this time.
google.protobuf.Timestamp read_time = 11;
}
// The target ID that identifies the target on the stream. Must be a positive
// number and non-zero.
int32 target_id = 5;
// If the target should be removed once it is current and consistent.
bool once = 6;
}
// Targets being watched have changed.
message TargetChange {
// The type of change.
enum TargetChangeType {
// No change has occurred. Used only to send an updated `resume_token`.
NO_CHANGE = 0;
// The targets have been added.
ADD = 1;
// The targets have been removed.
REMOVE = 2;
// The targets reflect all changes committed before the targets were added
// to the stream.
//
// This will be sent after or with a `read_time` that is greater than or
// equal to the time at which the targets were added.
//
// Listeners can wait for this change if read-after-write semantics
// are desired.
CURRENT = 3;
// The targets have been reset, and a new initial state for the targets
// will be returned in subsequent changes.
//
// After the initial state is complete, `CURRENT` will be returned even
// if the target was previously indicated to be `CURRENT`.
RESET = 4;
}
// The type of change that occurred.
TargetChangeType target_change_type = 1;
// The target IDs of targets that have changed.
//
// If empty, the change applies to all targets.
//
// The order of the target IDs is not defined.
repeated int32 target_ids = 2;
// The error that resulted in this change, if applicable.
google.rpc.Status cause = 3;
// A token that can be used to resume the stream for the given `target_ids`,
// or all targets if `target_ids` is empty.
//
// Not set on every target change.
bytes resume_token = 4;
// The consistent `read_time` for the given `target_ids` (omitted when the
// target_ids are not at a consistent snapshot).
//
// The stream is guaranteed to send a `read_time` with `target_ids` empty
// whenever the entire stream reaches a new consistent snapshot. ADD,
// CURRENT, and RESET messages are guaranteed to (eventually) result in a
// new consistent snapshot (while NO_CHANGE and REMOVE messages are not).
//
// For a given stream, `read_time` is guaranteed to be monotonically
// increasing.
google.protobuf.Timestamp read_time = 6;
}
// The request for [Firestore.ListCollectionIds][google.firestore.v1beta1.Firestore.ListCollectionIds].
message ListCollectionIdsRequest {
// Required. The parent document. In the format:
// `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
// For example:
// `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
string parent = 1 [(google.api.field_behavior) = REQUIRED];
// The maximum number of results to return.
int32 page_size = 2;
// A page token. Must be a value from
// [ListCollectionIdsResponse][google.firestore.v1beta1.ListCollectionIdsResponse].
string page_token = 3;
}
// The response from [Firestore.ListCollectionIds][google.firestore.v1beta1.Firestore.ListCollectionIds].
message ListCollectionIdsResponse {
// The collection ids.
repeated string collection_ids = 1;
// A page token that may be used to continue the list.
string next_page_token = 2;
}

View file

@ -0,0 +1,365 @@
// Copyright 2018 Google LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
syntax = "proto3";
package google.firestore.admin.v1beta1;
import "google/api/annotations.proto";
import "google/firestore/admin/v1beta1/index.proto";
import "google/longrunning/operations.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto";
option csharp_namespace = "Google.Cloud.Firestore.Admin.V1Beta1";
option go_package = "google.golang.org/genproto/googleapis/firestore/admin/v1beta1;admin";
option java_multiple_files = true;
option java_outer_classname = "FirestoreAdminProto";
option java_package = "com.google.firestore.admin.v1beta1";
option objc_class_prefix = "GCFS";
// The Cloud Firestore Admin API.
//
// This API provides several administrative services for Cloud Firestore.
//
// # Concepts
//
// Project, Database, Namespace, Collection, and Document are used as defined in
// the Google Cloud Firestore API.
//
// Operation: An Operation represents work being performed in the background.
//
//
// # Services
//
// ## Index
//
// The index service manages Cloud Firestore indexes.
//
// Index creation is performed asynchronously.
// An Operation resource is created for each such asynchronous operation.
// The state of the operation (including any errors encountered)
// may be queried via the Operation resource.
//
// ## Metadata
//
// Provides metadata and statistical information about data in Cloud Firestore.
// The data provided as part of this API may be stale.
//
// ## Operation
//
// The Operations collection provides a record of actions performed for the
// specified Project (including any Operations in progress). Operations are not
// created directly but through calls on other collections or resources.
//
// An Operation that is not yet done may be cancelled. The request to cancel is
// asynchronous and the Operation may continue to run for some time after the
// request to cancel is made.
//
// An Operation that is done may be deleted so that it is no longer listed as
// part of the Operation collection.
//
// Operations are created by service `FirestoreAdmin`, but are accessed via
// service `google.longrunning.Operations`.
service FirestoreAdmin {
// Creates the specified index.
// A newly created index's initial state is `CREATING`. On completion of the
// returned [google.longrunning.Operation][google.longrunning.Operation], the state will be `READY`.
// If the index already exists, the call will return an `ALREADY_EXISTS`
// status.
//
// During creation, the process could result in an error, in which case the
// index will move to the `ERROR` state. The process can be recovered by
// fixing the data that caused the error, removing the index with
// [delete][google.firestore.admin.v1beta1.FirestoreAdmin.DeleteIndex], then re-creating the index with
// [create][google.firestore.admin.v1beta1.FirestoreAdmin.CreateIndex].
//
// Indexes with a single field cannot be created.
rpc CreateIndex(CreateIndexRequest) returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1beta1/{parent=projects/*/databases/*}/indexes"
body: "index"
};
}
// Lists the indexes that match the specified filters.
rpc ListIndexes(ListIndexesRequest) returns (ListIndexesResponse) {
option (google.api.http) = {
get: "/v1beta1/{parent=projects/*/databases/*}/indexes"
};
}
// Gets an index.
rpc GetIndex(GetIndexRequest) returns (Index) {
option (google.api.http) = {
get: "/v1beta1/{name=projects/*/databases/*/indexes/*}"
};
}
// Deletes an index.
rpc DeleteIndex(DeleteIndexRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/v1beta1/{name=projects/*/databases/*/indexes/*}"
};
}
// Exports a copy of all or a subset of documents from Google Cloud Firestore
// to another storage system, such as Google Cloud Storage. Recent updates to
// documents may not be reflected in the export. The export occurs in the
// background and its progress can be monitored and managed via the
// Operation resource that is created. The output of an export may only be
// used once the associated operation is done. If an export operation is
// cancelled before completion it may leave partial data behind in Google
// Cloud Storage.
rpc ExportDocuments(ExportDocumentsRequest) returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1beta1/{name=projects/*/databases/*}:exportDocuments"
body: "*"
};
}
// Imports documents into Google Cloud Firestore. Existing documents with the
// same name are overwritten. The import occurs in the background and its
// progress can be monitored and managed via the Operation resource that is
// created. If an ImportDocuments operation is cancelled, it is possible
// that a subset of the data has already been imported to Cloud Firestore.
rpc ImportDocuments(ImportDocumentsRequest) returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1beta1/{name=projects/*/databases/*}:importDocuments"
body: "*"
};
}
}
// Metadata for index operations. This metadata populates
// the metadata field of [google.longrunning.Operation][google.longrunning.Operation].
message IndexOperationMetadata {
// The type of index operation.
enum OperationType {
// Unspecified. Never set by server.
OPERATION_TYPE_UNSPECIFIED = 0;
// The operation is creating the index. Initiated by a `CreateIndex` call.
CREATING_INDEX = 1;
}
// The time that work began on the operation.
google.protobuf.Timestamp start_time = 1;
// The time the operation ended, either successfully or otherwise. Unset if
// the operation is still active.
google.protobuf.Timestamp end_time = 2;
// The index resource that this operation is acting on. For example:
// `projects/{project_id}/databases/{database_id}/indexes/{index_id}`
string index = 3;
// The type of index operation.
OperationType operation_type = 4;
// True if the [google.longrunning.Operation] was cancelled. If the
// cancellation is in progress, cancelled will be true but
// [google.longrunning.Operation.done][google.longrunning.Operation.done] will be false.
bool cancelled = 5;
// Progress of the existing operation, measured in number of documents.
Progress document_progress = 6;
}
// Measures the progress of a particular metric.
message Progress {
// An estimate of how much work has been completed. Note that this may be
// greater than `work_estimated`.
int64 work_completed = 1;
// An estimate of how much work needs to be performed. Zero if the
// work estimate is unavailable. May change as work progresses.
int64 work_estimated = 2;
}
// The request for [FirestoreAdmin.CreateIndex][google.firestore.admin.v1beta1.FirestoreAdmin.CreateIndex].
message CreateIndexRequest {
// The name of the database this index will apply to. For example:
// `projects/{project_id}/databases/{database_id}`
string parent = 1;
// The index to create. The name and state fields are output only and will be
// ignored. Certain single field indexes cannot be created or deleted.
Index index = 2;
}
// The request for [FirestoreAdmin.GetIndex][google.firestore.admin.v1beta1.FirestoreAdmin.GetIndex].
message GetIndexRequest {
// The name of the index. For example:
// `projects/{project_id}/databases/{database_id}/indexes/{index_id}`
string name = 1;
}
// The request for [FirestoreAdmin.ListIndexes][google.firestore.admin.v1beta1.FirestoreAdmin.ListIndexes].
message ListIndexesRequest {
// The database name. For example:
// `projects/{project_id}/databases/{database_id}`
string parent = 1;
string filter = 2;
// The standard List page size.
int32 page_size = 3;
// The standard List page token.
string page_token = 4;
}
// The request for [FirestoreAdmin.DeleteIndex][google.firestore.admin.v1beta1.FirestoreAdmin.DeleteIndex].
message DeleteIndexRequest {
// The index name. For example:
// `projects/{project_id}/databases/{database_id}/indexes/{index_id}`
string name = 1;
}
// The response for [FirestoreAdmin.ListIndexes][google.firestore.admin.v1beta1.FirestoreAdmin.ListIndexes].
message ListIndexesResponse {
// The indexes.
repeated Index indexes = 1;
// The standard List next-page token.
string next_page_token = 2;
}
// The request for [FirestoreAdmin.ExportDocuments][google.firestore.admin.v1beta1.FirestoreAdmin.ExportDocuments].
message ExportDocumentsRequest {
// Database to export. Should be of the form:
// `projects/{project_id}/databases/{database_id}`.
string name = 1;
// Which collection ids to export. Unspecified means all collections.
repeated string collection_ids = 3;
// The output URI. Currently only supports Google Cloud Storage URIs of the
// form: `gs://BUCKET_NAME[/NAMESPACE_PATH]`, where `BUCKET_NAME` is the name
// of the Google Cloud Storage bucket and `NAMESPACE_PATH` is an optional
// Google Cloud Storage namespace path. When
// choosing a name, be sure to consider Google Cloud Storage naming
// guidelines: https://cloud.google.com/storage/docs/naming.
// If the URI is a bucket (without a namespace path), a prefix will be
// generated based on the start time.
string output_uri_prefix = 4;
}
// The request for [FirestoreAdmin.ImportDocuments][google.firestore.admin.v1beta1.FirestoreAdmin.ImportDocuments].
message ImportDocumentsRequest {
// Database to import into. Should be of the form:
// `projects/{project_id}/databases/{database_id}`.
string name = 1;
// Which collection ids to import. Unspecified means all collections included
// in the import.
repeated string collection_ids = 3;
// Location of the exported files.
// This must match the output_uri_prefix of an ExportDocumentsResponse from
// an export that has completed successfully.
// See:
// [google.firestore.admin.v1beta1.ExportDocumentsResponse.output_uri_prefix][google.firestore.admin.v1beta1.ExportDocumentsResponse.output_uri_prefix].
string input_uri_prefix = 4;
}
// Returned in the [google.longrunning.Operation][google.longrunning.Operation] response field.
message ExportDocumentsResponse {
// Location of the output files. This can be used to begin an import
// into Cloud Firestore (this project or another project) after the operation
// completes successfully.
string output_uri_prefix = 1;
}
// Metadata for ExportDocuments operations.
message ExportDocumentsMetadata {
// The time that work began on the operation.
google.protobuf.Timestamp start_time = 1;
// The time the operation ended, either successfully or otherwise. Unset if
// the operation is still active.
google.protobuf.Timestamp end_time = 2;
// The state of the export operation.
OperationState operation_state = 3;
// An estimate of the number of documents processed.
Progress progress_documents = 4;
// An estimate of the number of bytes processed.
Progress progress_bytes = 5;
// Which collection ids are being exported.
repeated string collection_ids = 6;
// Where the entities are being exported to.
string output_uri_prefix = 7;
}
// Metadata for ImportDocuments operations.
message ImportDocumentsMetadata {
// The time that work began on the operation.
google.protobuf.Timestamp start_time = 1;
// The time the operation ended, either successfully or otherwise. Unset if
// the operation is still active.
google.protobuf.Timestamp end_time = 2;
// The state of the import operation.
OperationState operation_state = 3;
// An estimate of the number of documents processed.
Progress progress_documents = 4;
// An estimate of the number of bytes processed.
Progress progress_bytes = 5;
// Which collection ids are being imported.
repeated string collection_ids = 6;
// The location of the documents being imported.
string input_uri_prefix = 7;
}
// The various possible states for an ongoing Operation.
enum OperationState {
// Unspecified.
STATE_UNSPECIFIED = 0;
// Request is being prepared for processing.
INITIALIZING = 1;
// Request is actively being processed.
PROCESSING = 2;
// Request is in the process of being cancelled after user called
// google.longrunning.Operations.CancelOperation on the operation.
CANCELLING = 3;
// Request has been processed and is in its finalization stage.
FINALIZING = 4;
// Request has completed successfully.
SUCCESSFUL = 5;
// Request has finished being processed, but encountered an error.
FAILED = 6;
// Request has finished being cancelled after user called
// google.longrunning.Operations.CancelOperation.
CANCELLED = 7;
}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,669 @@
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
from google.cloud.firestore_v1beta1.proto import (
document_pb2 as google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_document__pb2,
)
from google.cloud.firestore_v1beta1.proto import (
firestore_pb2 as google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2,
)
from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2
class FirestoreStub(object):
"""Specification of the Firestore API.
The Cloud Firestore service.
This service exposes several types of comparable timestamps:
* `create_time` - The time at which a document was created. Changes only
when a document is deleted, then re-created. Increases in a strict
monotonic fashion.
* `update_time` - The time at which a document was last updated. Changes
every time a document is modified. Does not change when a write results
in no modifications. Increases in a strict monotonic fashion.
* `read_time` - The time at which a particular state was observed. Used
to denote a consistent snapshot of the database or the time at which a
Document was observed to not exist.
* `commit_time` - The time at which the writes in a transaction were
committed. Any read with an equal or greater `read_time` is guaranteed
to see the effects of the transaction.
"""
def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
"""
self.GetDocument = channel.unary_unary(
"/google.firestore.v1beta1.Firestore/GetDocument",
request_serializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.GetDocumentRequest.SerializeToString,
response_deserializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_document__pb2.Document.FromString,
)
self.ListDocuments = channel.unary_unary(
"/google.firestore.v1beta1.Firestore/ListDocuments",
request_serializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.ListDocumentsRequest.SerializeToString,
response_deserializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.ListDocumentsResponse.FromString,
)
self.CreateDocument = channel.unary_unary(
"/google.firestore.v1beta1.Firestore/CreateDocument",
request_serializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.CreateDocumentRequest.SerializeToString,
response_deserializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_document__pb2.Document.FromString,
)
self.UpdateDocument = channel.unary_unary(
"/google.firestore.v1beta1.Firestore/UpdateDocument",
request_serializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.UpdateDocumentRequest.SerializeToString,
response_deserializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_document__pb2.Document.FromString,
)
self.DeleteDocument = channel.unary_unary(
"/google.firestore.v1beta1.Firestore/DeleteDocument",
request_serializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.DeleteDocumentRequest.SerializeToString,
response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
)
self.BatchGetDocuments = channel.unary_stream(
"/google.firestore.v1beta1.Firestore/BatchGetDocuments",
request_serializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.BatchGetDocumentsRequest.SerializeToString,
response_deserializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.BatchGetDocumentsResponse.FromString,
)
self.BeginTransaction = channel.unary_unary(
"/google.firestore.v1beta1.Firestore/BeginTransaction",
request_serializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.BeginTransactionRequest.SerializeToString,
response_deserializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.BeginTransactionResponse.FromString,
)
self.Commit = channel.unary_unary(
"/google.firestore.v1beta1.Firestore/Commit",
request_serializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.CommitRequest.SerializeToString,
response_deserializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.CommitResponse.FromString,
)
self.Rollback = channel.unary_unary(
"/google.firestore.v1beta1.Firestore/Rollback",
request_serializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.RollbackRequest.SerializeToString,
response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
)
self.RunQuery = channel.unary_stream(
"/google.firestore.v1beta1.Firestore/RunQuery",
request_serializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.RunQueryRequest.SerializeToString,
response_deserializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.RunQueryResponse.FromString,
)
self.Write = channel.stream_stream(
"/google.firestore.v1beta1.Firestore/Write",
request_serializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.WriteRequest.SerializeToString,
response_deserializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.WriteResponse.FromString,
)
self.Listen = channel.stream_stream(
"/google.firestore.v1beta1.Firestore/Listen",
request_serializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.ListenRequest.SerializeToString,
response_deserializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.ListenResponse.FromString,
)
self.ListCollectionIds = channel.unary_unary(
"/google.firestore.v1beta1.Firestore/ListCollectionIds",
request_serializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.ListCollectionIdsRequest.SerializeToString,
response_deserializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.ListCollectionIdsResponse.FromString,
)
class FirestoreServicer(object):
"""Specification of the Firestore API.
The Cloud Firestore service.
This service exposes several types of comparable timestamps:
* `create_time` - The time at which a document was created. Changes only
when a document is deleted, then re-created. Increases in a strict
monotonic fashion.
* `update_time` - The time at which a document was last updated. Changes
every time a document is modified. Does not change when a write results
in no modifications. Increases in a strict monotonic fashion.
* `read_time` - The time at which a particular state was observed. Used
to denote a consistent snapshot of the database or the time at which a
Document was observed to not exist.
* `commit_time` - The time at which the writes in a transaction were
committed. Any read with an equal or greater `read_time` is guaranteed
to see the effects of the transaction.
"""
def GetDocument(self, request, context):
"""Gets a single document.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details("Method not implemented!")
raise NotImplementedError("Method not implemented!")
def ListDocuments(self, request, context):
"""Lists documents.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details("Method not implemented!")
raise NotImplementedError("Method not implemented!")
def CreateDocument(self, request, context):
"""Creates a new document.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details("Method not implemented!")
raise NotImplementedError("Method not implemented!")
def UpdateDocument(self, request, context):
"""Updates or inserts a document.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details("Method not implemented!")
raise NotImplementedError("Method not implemented!")
def DeleteDocument(self, request, context):
"""Deletes a document.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details("Method not implemented!")
raise NotImplementedError("Method not implemented!")
def BatchGetDocuments(self, request, context):
"""Gets multiple documents.
Documents returned by this method are not guaranteed to be returned in the
same order that they were requested.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details("Method not implemented!")
raise NotImplementedError("Method not implemented!")
def BeginTransaction(self, request, context):
"""Starts a new transaction.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details("Method not implemented!")
raise NotImplementedError("Method not implemented!")
def Commit(self, request, context):
"""Commits a transaction, while optionally updating documents.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details("Method not implemented!")
raise NotImplementedError("Method not implemented!")
def Rollback(self, request, context):
"""Rolls back a transaction.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details("Method not implemented!")
raise NotImplementedError("Method not implemented!")
def RunQuery(self, request, context):
"""Runs a query.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details("Method not implemented!")
raise NotImplementedError("Method not implemented!")
def Write(self, request_iterator, context):
"""Streams batches of document updates and deletes, in order.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details("Method not implemented!")
raise NotImplementedError("Method not implemented!")
def Listen(self, request_iterator, context):
"""Listens to changes.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details("Method not implemented!")
raise NotImplementedError("Method not implemented!")
def ListCollectionIds(self, request, context):
"""Lists all the collection IDs underneath a document.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details("Method not implemented!")
raise NotImplementedError("Method not implemented!")
def add_FirestoreServicer_to_server(servicer, server):
rpc_method_handlers = {
"GetDocument": grpc.unary_unary_rpc_method_handler(
servicer.GetDocument,
request_deserializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.GetDocumentRequest.FromString,
response_serializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_document__pb2.Document.SerializeToString,
),
"ListDocuments": grpc.unary_unary_rpc_method_handler(
servicer.ListDocuments,
request_deserializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.ListDocumentsRequest.FromString,
response_serializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.ListDocumentsResponse.SerializeToString,
),
"CreateDocument": grpc.unary_unary_rpc_method_handler(
servicer.CreateDocument,
request_deserializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.CreateDocumentRequest.FromString,
response_serializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_document__pb2.Document.SerializeToString,
),
"UpdateDocument": grpc.unary_unary_rpc_method_handler(
servicer.UpdateDocument,
request_deserializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.UpdateDocumentRequest.FromString,
response_serializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_document__pb2.Document.SerializeToString,
),
"DeleteDocument": grpc.unary_unary_rpc_method_handler(
servicer.DeleteDocument,
request_deserializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.DeleteDocumentRequest.FromString,
response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
),
"BatchGetDocuments": grpc.unary_stream_rpc_method_handler(
servicer.BatchGetDocuments,
request_deserializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.BatchGetDocumentsRequest.FromString,
response_serializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.BatchGetDocumentsResponse.SerializeToString,
),
"BeginTransaction": grpc.unary_unary_rpc_method_handler(
servicer.BeginTransaction,
request_deserializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.BeginTransactionRequest.FromString,
response_serializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.BeginTransactionResponse.SerializeToString,
),
"Commit": grpc.unary_unary_rpc_method_handler(
servicer.Commit,
request_deserializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.CommitRequest.FromString,
response_serializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.CommitResponse.SerializeToString,
),
"Rollback": grpc.unary_unary_rpc_method_handler(
servicer.Rollback,
request_deserializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.RollbackRequest.FromString,
response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
),
"RunQuery": grpc.unary_stream_rpc_method_handler(
servicer.RunQuery,
request_deserializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.RunQueryRequest.FromString,
response_serializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.RunQueryResponse.SerializeToString,
),
"Write": grpc.stream_stream_rpc_method_handler(
servicer.Write,
request_deserializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.WriteRequest.FromString,
response_serializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.WriteResponse.SerializeToString,
),
"Listen": grpc.stream_stream_rpc_method_handler(
servicer.Listen,
request_deserializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.ListenRequest.FromString,
response_serializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.ListenResponse.SerializeToString,
),
"ListCollectionIds": grpc.unary_unary_rpc_method_handler(
servicer.ListCollectionIds,
request_deserializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.ListCollectionIdsRequest.FromString,
response_serializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.ListCollectionIdsResponse.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
"google.firestore.v1beta1.Firestore", rpc_method_handlers
)
server.add_generic_rpc_handlers((generic_handler,))
# This class is part of an EXPERIMENTAL API.
class Firestore(object):
"""Specification of the Firestore API.
The Cloud Firestore service.
This service exposes several types of comparable timestamps:
* `create_time` - The time at which a document was created. Changes only
when a document is deleted, then re-created. Increases in a strict
monotonic fashion.
* `update_time` - The time at which a document was last updated. Changes
every time a document is modified. Does not change when a write results
in no modifications. Increases in a strict monotonic fashion.
* `read_time` - The time at which a particular state was observed. Used
to denote a consistent snapshot of the database or the time at which a
Document was observed to not exist.
* `commit_time` - The time at which the writes in a transaction were
committed. Any read with an equal or greater `read_time` is guaranteed
to see the effects of the transaction.
"""
@staticmethod
def GetDocument(
request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None,
):
return grpc.experimental.unary_unary(
request,
target,
"/google.firestore.v1beta1.Firestore/GetDocument",
google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.GetDocumentRequest.SerializeToString,
google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_document__pb2.Document.FromString,
options,
channel_credentials,
call_credentials,
compression,
wait_for_ready,
timeout,
metadata,
)
@staticmethod
def ListDocuments(
request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None,
):
return grpc.experimental.unary_unary(
request,
target,
"/google.firestore.v1beta1.Firestore/ListDocuments",
google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.ListDocumentsRequest.SerializeToString,
google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.ListDocumentsResponse.FromString,
options,
channel_credentials,
call_credentials,
compression,
wait_for_ready,
timeout,
metadata,
)
@staticmethod
def CreateDocument(
request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None,
):
return grpc.experimental.unary_unary(
request,
target,
"/google.firestore.v1beta1.Firestore/CreateDocument",
google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.CreateDocumentRequest.SerializeToString,
google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_document__pb2.Document.FromString,
options,
channel_credentials,
call_credentials,
compression,
wait_for_ready,
timeout,
metadata,
)
@staticmethod
def UpdateDocument(
request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None,
):
return grpc.experimental.unary_unary(
request,
target,
"/google.firestore.v1beta1.Firestore/UpdateDocument",
google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.UpdateDocumentRequest.SerializeToString,
google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_document__pb2.Document.FromString,
options,
channel_credentials,
call_credentials,
compression,
wait_for_ready,
timeout,
metadata,
)
@staticmethod
def DeleteDocument(
request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None,
):
return grpc.experimental.unary_unary(
request,
target,
"/google.firestore.v1beta1.Firestore/DeleteDocument",
google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.DeleteDocumentRequest.SerializeToString,
google_dot_protobuf_dot_empty__pb2.Empty.FromString,
options,
channel_credentials,
call_credentials,
compression,
wait_for_ready,
timeout,
metadata,
)
@staticmethod
def BatchGetDocuments(
request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None,
):
return grpc.experimental.unary_stream(
request,
target,
"/google.firestore.v1beta1.Firestore/BatchGetDocuments",
google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.BatchGetDocumentsRequest.SerializeToString,
google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.BatchGetDocumentsResponse.FromString,
options,
channel_credentials,
call_credentials,
compression,
wait_for_ready,
timeout,
metadata,
)
@staticmethod
def BeginTransaction(
request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None,
):
return grpc.experimental.unary_unary(
request,
target,
"/google.firestore.v1beta1.Firestore/BeginTransaction",
google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.BeginTransactionRequest.SerializeToString,
google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.BeginTransactionResponse.FromString,
options,
channel_credentials,
call_credentials,
compression,
wait_for_ready,
timeout,
metadata,
)
@staticmethod
def Commit(
request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None,
):
return grpc.experimental.unary_unary(
request,
target,
"/google.firestore.v1beta1.Firestore/Commit",
google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.CommitRequest.SerializeToString,
google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.CommitResponse.FromString,
options,
channel_credentials,
call_credentials,
compression,
wait_for_ready,
timeout,
metadata,
)
@staticmethod
def Rollback(
request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None,
):
return grpc.experimental.unary_unary(
request,
target,
"/google.firestore.v1beta1.Firestore/Rollback",
google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.RollbackRequest.SerializeToString,
google_dot_protobuf_dot_empty__pb2.Empty.FromString,
options,
channel_credentials,
call_credentials,
compression,
wait_for_ready,
timeout,
metadata,
)
@staticmethod
def RunQuery(
request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None,
):
return grpc.experimental.unary_stream(
request,
target,
"/google.firestore.v1beta1.Firestore/RunQuery",
google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.RunQueryRequest.SerializeToString,
google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.RunQueryResponse.FromString,
options,
channel_credentials,
call_credentials,
compression,
wait_for_ready,
timeout,
metadata,
)
@staticmethod
def Write(
request_iterator,
target,
options=(),
channel_credentials=None,
call_credentials=None,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None,
):
return grpc.experimental.stream_stream(
request_iterator,
target,
"/google.firestore.v1beta1.Firestore/Write",
google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.WriteRequest.SerializeToString,
google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.WriteResponse.FromString,
options,
channel_credentials,
call_credentials,
compression,
wait_for_ready,
timeout,
metadata,
)
@staticmethod
def Listen(
request_iterator,
target,
options=(),
channel_credentials=None,
call_credentials=None,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None,
):
return grpc.experimental.stream_stream(
request_iterator,
target,
"/google.firestore.v1beta1.Firestore/Listen",
google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.ListenRequest.SerializeToString,
google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.ListenResponse.FromString,
options,
channel_credentials,
call_credentials,
compression,
wait_for_ready,
timeout,
metadata,
)
@staticmethod
def ListCollectionIds(
request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None,
):
return grpc.experimental.unary_unary(
request,
target,
"/google.firestore.v1beta1.Firestore/ListCollectionIds",
google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.ListCollectionIdsRequest.SerializeToString,
google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_firestore__pb2.ListCollectionIdsResponse.FromString,
options,
channel_credentials,
call_credentials,
compression,
wait_for_ready,
timeout,
metadata,
)

View file

@ -0,0 +1,102 @@
// Copyright 2018 Google LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
syntax = "proto3";
package google.firestore.admin.v1beta1;
import "google/api/annotations.proto";
option csharp_namespace = "Google.Cloud.Firestore.Admin.V1Beta1";
option go_package = "google.golang.org/genproto/googleapis/firestore/admin/v1beta1;admin";
option java_multiple_files = true;
option java_outer_classname = "IndexProto";
option java_package = "com.google.firestore.admin.v1beta1";
option objc_class_prefix = "GCFS";
// A field of an index.
message IndexField {
// The mode determines how a field is indexed.
enum Mode {
// The mode is unspecified.
MODE_UNSPECIFIED = 0;
// The field's values are indexed so as to support sequencing in
// ascending order and also query by <, >, <=, >=, and =.
ASCENDING = 2;
// The field's values are indexed so as to support sequencing in
// descending order and also query by <, >, <=, >=, and =.
DESCENDING = 3;
// The field's array values are indexed so as to support membership using
// ARRAY_CONTAINS queries.
ARRAY_CONTAINS = 4;
}
// The path of the field. Must match the field path specification described
// by [google.firestore.v1beta1.Document.fields][fields].
// Special field path `__name__` may be used by itself or at the end of a
// path. `__type__` may be used only at the end of path.
string field_path = 1;
// The field's mode.
Mode mode = 2;
}
// An index definition.
message Index {
// The state of an index. During index creation, an index will be in the
// `CREATING` state. If the index is created successfully, it will transition
// to the `READY` state. If the index is not able to be created, it will
// transition to the `ERROR` state.
enum State {
// The state is unspecified.
STATE_UNSPECIFIED = 0;
// The index is being created.
// There is an active long-running operation for the index.
// The index is updated when writing a document.
// Some index data may exist.
CREATING = 3;
// The index is ready to be used.
// The index is updated when writing a document.
// The index is fully populated from all stored documents it applies to.
READY = 2;
// The index was being created, but something went wrong.
// There is no active long-running operation for the index,
// and the most recently finished long-running operation failed.
// The index is not updated when writing a document.
// Some index data may exist.
ERROR = 5;
}
// The resource name of the index.
// Output only.
string name = 1;
// The collection ID to which this index applies. Required.
string collection_id = 2;
// The fields to index.
repeated IndexField fields = 3;
// The state of the index.
// Output only.
State state = 6;
}

View file

@ -0,0 +1,34 @@
// Copyright 2018 Google LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
syntax = "proto3";
package google.firestore.admin.v1beta1;
import "google/api/annotations.proto";
import "google/type/latlng.proto";
option csharp_namespace = "Google.Cloud.Firestore.Admin.V1Beta1";
option go_package = "google.golang.org/genproto/googleapis/firestore/admin/v1beta1;admin";
option java_multiple_files = true;
option java_outer_classname = "LocationProto";
option java_package = "com.google.firestore.admin.v1beta1";
option objc_class_prefix = "GCFS";
// The metadata message for [google.cloud.location.Location.metadata][google.cloud.location.Location.metadata].
message LocationMetadata {
}

View file

@ -0,0 +1,203 @@
// Copyright 2018 Google LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
syntax = "proto3";
package google.firestore.admin.v1beta2;
import "google/api/annotations.proto";
import "google/firestore/admin/v1beta2/index.proto";
import "google/protobuf/timestamp.proto";
option csharp_namespace = "Google.Cloud.Firestore.Admin.V1Beta2";
option go_package = "google.golang.org/genproto/googleapis/firestore/admin/v1beta2;admin";
option java_multiple_files = true;
option java_outer_classname = "OperationProto";
option java_package = "com.google.firestore.admin.v1beta2";
option objc_class_prefix = "GCFS";
// Metadata for [google.longrunning.Operation][google.longrunning.Operation] results from
// [FirestoreAdmin.CreateIndex][google.firestore.admin.v1beta2.FirestoreAdmin.CreateIndex].
message IndexOperationMetadata {
// The time this operation started.
google.protobuf.Timestamp start_time = 1;
// The time this operation completed. Will be unset if operation still in
// progress.
google.protobuf.Timestamp end_time = 2;
// The index resource that this operation is acting on. For example:
// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}`
string index = 3;
// The state of the operation.
OperationState state = 4;
// The progress, in documents, of this operation.
Progress progress_documents = 5;
// The progress, in bytes, of this operation.
Progress progress_bytes = 6;
}
// Metadata for [google.longrunning.Operation][google.longrunning.Operation] results from
// [FirestoreAdmin.UpdateField][google.firestore.admin.v1beta2.FirestoreAdmin.UpdateField].
message FieldOperationMetadata {
// Information about an index configuration change.
message IndexConfigDelta {
// Specifies how the index is changing.
enum ChangeType {
// The type of change is not specified or known.
CHANGE_TYPE_UNSPECIFIED = 0;
// The single field index is being added.
ADD = 1;
// The single field index is being removed.
REMOVE = 2;
}
// Specifies how the index is changing.
ChangeType change_type = 1;
// The index being changed.
Index index = 2;
}
// The time this operation started.
google.protobuf.Timestamp start_time = 1;
// The time this operation completed. Will be unset if operation still in
// progress.
google.protobuf.Timestamp end_time = 2;
// The field resource that this operation is acting on. For example:
// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_path}`
string field = 3;
// A list of [IndexConfigDelta][google.firestore.admin.v1beta2.FieldOperationMetadata.IndexConfigDelta], which describe the intent of this
// operation.
repeated IndexConfigDelta index_config_deltas = 4;
// The state of the operation.
OperationState state = 5;
// The progress, in documents, of this operation.
Progress document_progress = 6;
// The progress, in bytes, of this operation.
Progress bytes_progress = 7;
}
// Metadata for [google.longrunning.Operation][google.longrunning.Operation] results from
// [FirestoreAdmin.ExportDocuments][google.firestore.admin.v1beta2.FirestoreAdmin.ExportDocuments].
message ExportDocumentsMetadata {
// The time this operation started.
google.protobuf.Timestamp start_time = 1;
// The time this operation completed. Will be unset if operation still in
// progress.
google.protobuf.Timestamp end_time = 2;
// The state of the export operation.
OperationState operation_state = 3;
// The progress, in documents, of this operation.
Progress progress_documents = 4;
// The progress, in bytes, of this operation.
Progress progress_bytes = 5;
// Which collection ids are being exported.
repeated string collection_ids = 6;
// Where the entities are being exported to.
string output_uri_prefix = 7;
}
// Metadata for [google.longrunning.Operation][google.longrunning.Operation] results from
// [FirestoreAdmin.ImportDocuments][google.firestore.admin.v1beta2.FirestoreAdmin.ImportDocuments].
message ImportDocumentsMetadata {
// The time this operation started.
google.protobuf.Timestamp start_time = 1;
// The time this operation completed. Will be unset if operation still in
// progress.
google.protobuf.Timestamp end_time = 2;
// The state of the import operation.
OperationState operation_state = 3;
// The progress, in documents, of this operation.
Progress progress_documents = 4;
// The progress, in bytes, of this operation.
Progress progress_bytes = 5;
// Which collection ids are being imported.
repeated string collection_ids = 6;
// The location of the documents being imported.
string input_uri_prefix = 7;
}
// Returned in the [google.longrunning.Operation][google.longrunning.Operation] response field.
message ExportDocumentsResponse {
// Location of the output files. This can be used to begin an import
// into Cloud Firestore (this project or another project) after the operation
// completes successfully.
string output_uri_prefix = 1;
}
// Describes the progress of the operation.
// Unit of work is generic and must be interpreted based on where [Progress][google.firestore.admin.v1beta2.Progress]
// is used.
message Progress {
// The amount of work estimated.
int64 estimated_work = 1;
// The amount of work completed.
int64 completed_work = 2;
}
// Describes the state of the operation.
enum OperationState {
// Unspecified.
OPERATION_STATE_UNSPECIFIED = 0;
// Request is being prepared for processing.
INITIALIZING = 1;
// Request is actively being processed.
PROCESSING = 2;
// Request is in the process of being cancelled after user called
// google.longrunning.Operations.CancelOperation on the operation.
CANCELLING = 3;
// Request has been processed and is in its finalization stage.
FINALIZING = 4;
// Request has completed successfully.
SUCCESSFUL = 5;
// Request has finished being processed, but encountered an error.
FAILED = 6;
// Request has finished being cancelled after user called
// google.longrunning.Operations.CancelOperation.
CANCELLED = 7;
}

View file

@ -0,0 +1,244 @@
// Copyright 2019 Google LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
syntax = "proto3";
package google.firestore.v1beta1;
import "google/firestore/v1beta1/document.proto";
import "google/protobuf/wrappers.proto";
import "google/api/annotations.proto";
option csharp_namespace = "Google.Cloud.Firestore.V1Beta1";
option go_package = "google.golang.org/genproto/googleapis/firestore/v1beta1;firestore";
option java_multiple_files = true;
option java_outer_classname = "QueryProto";
option java_package = "com.google.firestore.v1beta1";
option objc_class_prefix = "GCFS";
option php_namespace = "Google\\Cloud\\Firestore\\V1beta1";
option ruby_package = "Google::Cloud::Firestore::V1beta1";
// A Firestore query.
message StructuredQuery {
// A selection of a collection, such as `messages as m1`.
message CollectionSelector {
// The collection ID.
// When set, selects only collections with this ID.
string collection_id = 2;
// When false, selects only collections that are immediate children of
// the `parent` specified in the containing `RunQueryRequest`.
// When true, selects all descendant collections.
bool all_descendants = 3;
}
// A filter.
message Filter {
// The type of filter.
oneof filter_type {
// A composite filter.
CompositeFilter composite_filter = 1;
// A filter on a document field.
FieldFilter field_filter = 2;
// A filter that takes exactly one argument.
UnaryFilter unary_filter = 3;
}
}
// A filter that merges multiple other filters using the given operator.
message CompositeFilter {
// A composite filter operator.
enum Operator {
// Unspecified. This value must not be used.
OPERATOR_UNSPECIFIED = 0;
// The results are required to satisfy each of the combined filters.
AND = 1;
}
// The operator for combining multiple filters.
Operator op = 1;
// The list of filters to combine.
// Must contain at least one filter.
repeated Filter filters = 2;
}
// A filter on a specific field.
message FieldFilter {
// A field filter operator.
enum Operator {
// Unspecified. This value must not be used.
OPERATOR_UNSPECIFIED = 0;
// Less than. Requires that the field come first in `order_by`.
LESS_THAN = 1;
// Less than or equal. Requires that the field come first in `order_by`.
LESS_THAN_OR_EQUAL = 2;
// Greater than. Requires that the field come first in `order_by`.
GREATER_THAN = 3;
// Greater than or equal. Requires that the field come first in
// `order_by`.
GREATER_THAN_OR_EQUAL = 4;
// Equal.
EQUAL = 5;
// Contains. Requires that the field is an array.
ARRAY_CONTAINS = 7;
// In. Requires that `value` is a non-empty ArrayValue with at most 10
// values.
IN = 8;
// Contains any. Requires that the field is an array and
// `value` is a non-empty ArrayValue with at most 10 values.
ARRAY_CONTAINS_ANY = 9;
}
// The field to filter by.
FieldReference field = 1;
// The operator to filter by.
Operator op = 2;
// The value to compare to.
Value value = 3;
}
// A filter with a single operand.
message UnaryFilter {
// A unary operator.
enum Operator {
// Unspecified. This value must not be used.
OPERATOR_UNSPECIFIED = 0;
// Test if a field is equal to NaN.
IS_NAN = 2;
// Test if an expression evaluates to Null.
IS_NULL = 3;
}
// The unary operator to apply.
Operator op = 1;
// The argument to the filter.
oneof operand_type {
// The field to which to apply the operator.
FieldReference field = 2;
}
}
// An order on a field.
message Order {
// The field to order by.
FieldReference field = 1;
// The direction to order by. Defaults to `ASCENDING`.
Direction direction = 2;
}
// A reference to a field, such as `max(messages.time) as max_time`.
message FieldReference {
string field_path = 2;
}
// The projection of document's fields to return.
message Projection {
// The fields to return.
//
// If empty, all fields are returned. To only return the name
// of the document, use `['__name__']`.
repeated FieldReference fields = 2;
}
// A sort direction.
enum Direction {
// Unspecified.
DIRECTION_UNSPECIFIED = 0;
// Ascending.
ASCENDING = 1;
// Descending.
DESCENDING = 2;
}
// The projection to return.
Projection select = 1;
// The collections to query.
repeated CollectionSelector from = 2;
// The filter to apply.
Filter where = 3;
// The order to apply to the query results.
//
// Firestore guarantees a stable ordering through the following rules:
//
// * Any field required to appear in `order_by`, that is not already
// specified in `order_by`, is appended to the order in field name order
// by default.
// * If an order on `__name__` is not specified, it is appended by default.
//
// Fields are appended with the same sort direction as the last order
// specified, or 'ASCENDING' if no order was specified. For example:
//
// * `SELECT * FROM Foo ORDER BY A` becomes
// `SELECT * FROM Foo ORDER BY A, __name__`
// * `SELECT * FROM Foo ORDER BY A DESC` becomes
// `SELECT * FROM Foo ORDER BY A DESC, __name__ DESC`
// * `SELECT * FROM Foo WHERE A > 1` becomes
// `SELECT * FROM Foo WHERE A > 1 ORDER BY A, __name__`
repeated Order order_by = 4;
// A starting point for the query results.
Cursor start_at = 7;
// A end point for the query results.
Cursor end_at = 8;
// The number of results to skip.
//
// Applies before limit, but after all other constraints. Must be >= 0 if
// specified.
int32 offset = 6;
// The maximum number of results to return.
//
// Applies after all other constraints.
// Must be >= 0 if specified.
google.protobuf.Int32Value limit = 5;
}
// A position in a query result set.
message Cursor {
// The values that represent a position, in the order they appear in
// the order by clause of a query.
//
// Can contain fewer values than specified in the order by clause.
repeated Value values = 1;
// If the position is just before or just after the given values, relative
// to the sort order defined by the query.
bool before = 2;
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,3 @@
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,255 @@
// Copyright 2019 Google LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
syntax = "proto3";
package google.firestore.v1beta1;
import "google/firestore/v1beta1/common.proto";
import "google/firestore/v1beta1/document.proto";
import "google/protobuf/timestamp.proto";
import "google/api/annotations.proto";
option csharp_namespace = "Google.Cloud.Firestore.V1Beta1";
option go_package = "google.golang.org/genproto/googleapis/firestore/v1beta1;firestore";
option java_multiple_files = true;
option java_outer_classname = "WriteProto";
option java_package = "com.google.firestore.v1beta1";
option objc_class_prefix = "GCFS";
option php_namespace = "Google\\Cloud\\Firestore\\V1beta1";
option ruby_package = "Google::Cloud::Firestore::V1beta1";
// A write on a document.
message Write {
// The operation to execute.
oneof operation {
// A document to write.
Document update = 1;
// A document name to delete. In the format:
// `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
string delete = 2;
// Applies a transformation to a document.
// At most one `transform` per document is allowed in a given request.
// An `update` cannot follow a `transform` on the same document in a given
// request.
DocumentTransform transform = 6;
}
// The fields to update in this write.
//
// This field can be set only when the operation is `update`.
// If the mask is not set for an `update` and the document exists, any
// existing data will be overwritten.
// If the mask is set and the document on the server has fields not covered by
// the mask, they are left unchanged.
// Fields referenced in the mask, but not present in the input document, are
// deleted from the document on the server.
// The field paths in this mask must not contain a reserved field name.
DocumentMask update_mask = 3;
// An optional precondition on the document.
//
// The write will fail if this is set and not met by the target document.
Precondition current_document = 4;
}
// A transformation of a document.
message DocumentTransform {
// A transformation of a field of the document.
message FieldTransform {
// A value that is calculated by the server.
enum ServerValue {
// Unspecified. This value must not be used.
SERVER_VALUE_UNSPECIFIED = 0;
// The time at which the server processed the request, with millisecond
// precision.
REQUEST_TIME = 1;
}
// The path of the field. See [Document.fields][google.firestore.v1beta1.Document.fields] for the field path syntax
// reference.
string field_path = 1;
// The transformation to apply on the field.
oneof transform_type {
// Sets the field to the given server value.
ServerValue set_to_server_value = 2;
// Adds the given value to the field's current value.
//
// This must be an integer or a double value.
// If the field is not an integer or double, or if the field does not yet
// exist, the transformation will set the field to the given value.
// If either of the given value or the current field value are doubles,
// both values will be interpreted as doubles. Double arithmetic and
// representation of double values follow IEEE 754 semantics.
// If there is positive/negative integer overflow, the field is resolved
// to the largest magnitude positive/negative integer.
Value increment = 3;
// Sets the field to the maximum of its current value and the given value.
//
// This must be an integer or a double value.
// If the field is not an integer or double, or if the field does not yet
// exist, the transformation will set the field to the given value.
// If a maximum operation is applied where the field and the input value
// are of mixed types (that is - one is an integer and one is a double)
// the field takes on the type of the larger operand. If the operands are
// equivalent (e.g. 3 and 3.0), the field does not change.
// 0, 0.0, and -0.0 are all zero. The maximum of a zero stored value and
// zero input value is always the stored value.
// The maximum of any numeric value x and NaN is NaN.
Value maximum = 4;
// Sets the field to the minimum of its current value and the given value.
//
// This must be an integer or a double value.
// If the field is not an integer or double, or if the field does not yet
// exist, the transformation will set the field to the input value.
// If a minimum operation is applied where the field and the input value
// are of mixed types (that is - one is an integer and one is a double)
// the field takes on the type of the smaller operand. If the operands are
// equivalent (e.g. 3 and 3.0), the field does not change.
// 0, 0.0, and -0.0 are all zero. The minimum of a zero stored value and
// zero input value is always the stored value.
// The minimum of any numeric value x and NaN is NaN.
Value minimum = 5;
// Append the given elements in order if they are not already present in
// the current field value.
// If the field is not an array, or if the field does not yet exist, it is
// first set to the empty array.
//
// Equivalent numbers of different types (e.g. 3L and 3.0) are
// considered equal when checking if a value is missing.
// NaN is equal to NaN, and Null is equal to Null.
// If the input contains multiple equivalent values, only the first will
// be considered.
//
// The corresponding transform_result will be the null value.
ArrayValue append_missing_elements = 6;
// Remove all of the given elements from the array in the field.
// If the field is not an array, or if the field does not yet exist, it is
// set to the empty array.
//
// Equivalent numbers of the different types (e.g. 3L and 3.0) are
// considered equal when deciding whether an element should be removed.
// NaN is equal to NaN, and Null is equal to Null.
// This will remove all equivalent values if there are duplicates.
//
// The corresponding transform_result will be the null value.
ArrayValue remove_all_from_array = 7;
}
}
// The name of the document to transform.
string document = 1;
// The list of transformations to apply to the fields of the document, in
// order.
// This must not be empty.
repeated FieldTransform field_transforms = 2;
}
// The result of applying a write.
message WriteResult {
// The last update time of the document after applying the write. Not set
// after a `delete`.
//
// If the write did not actually change the document, this will be the
// previous update_time.
google.protobuf.Timestamp update_time = 1;
// The results of applying each [DocumentTransform.FieldTransform][google.firestore.v1beta1.DocumentTransform.FieldTransform], in the
// same order.
repeated Value transform_results = 2;
}
// A [Document][google.firestore.v1beta1.Document] has changed.
//
// May be the result of multiple [writes][google.firestore.v1beta1.Write], including deletes, that
// ultimately resulted in a new value for the [Document][google.firestore.v1beta1.Document].
//
// Multiple [DocumentChange][google.firestore.v1beta1.DocumentChange] messages may be returned for the same logical
// change, if multiple targets are affected.
message DocumentChange {
// The new state of the [Document][google.firestore.v1beta1.Document].
//
// If `mask` is set, contains only fields that were updated or added.
Document document = 1;
// A set of target IDs of targets that match this document.
repeated int32 target_ids = 5;
// A set of target IDs for targets that no longer match this document.
repeated int32 removed_target_ids = 6;
}
// A [Document][google.firestore.v1beta1.Document] has been deleted.
//
// May be the result of multiple [writes][google.firestore.v1beta1.Write], including updates, the
// last of which deleted the [Document][google.firestore.v1beta1.Document].
//
// Multiple [DocumentDelete][google.firestore.v1beta1.DocumentDelete] messages may be returned for the same logical
// delete, if multiple targets are affected.
message DocumentDelete {
// The resource name of the [Document][google.firestore.v1beta1.Document] that was deleted.
string document = 1;
// A set of target IDs for targets that previously matched this entity.
repeated int32 removed_target_ids = 6;
// The read timestamp at which the delete was observed.
//
// Greater or equal to the `commit_time` of the delete.
google.protobuf.Timestamp read_time = 4;
}
// A [Document][google.firestore.v1beta1.Document] has been removed from the view of the targets.
//
// Sent if the document is no longer relevant to a target and is out of view.
// Can be sent instead of a DocumentDelete or a DocumentChange if the server
// can not send the new value of the document.
//
// Multiple [DocumentRemove][google.firestore.v1beta1.DocumentRemove] messages may be returned for the same logical
// write or delete, if multiple targets are affected.
message DocumentRemove {
// The resource name of the [Document][google.firestore.v1beta1.Document] that has gone out of view.
string document = 1;
// A set of target IDs for targets that previously matched this document.
repeated int32 removed_target_ids = 2;
// The read timestamp at which the remove was observed.
//
// Greater or equal to the `commit_time` of the change/delete/remove.
google.protobuf.Timestamp read_time = 4;
}
// A digest of all the documents that match a given target.
message ExistenceFilter {
// The target ID to which this filter applies.
int32 target_id = 1;
// The total count of documents that match [target_id][google.firestore.v1beta1.ExistenceFilter.target_id].
//
// If different from the count of documents in the client that match, the
// client must manually determine which documents no longer match the target.
int32 count = 2;
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,3 @@
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc