google-cloud-firestore 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +8 -0
  3. data/LICENSE +201 -0
  4. data/README.md +30 -0
  5. data/lib/google-cloud-firestore.rb +106 -0
  6. data/lib/google/cloud/firestore.rb +514 -0
  7. data/lib/google/cloud/firestore/batch.rb +462 -0
  8. data/lib/google/cloud/firestore/client.rb +449 -0
  9. data/lib/google/cloud/firestore/collection_reference.rb +249 -0
  10. data/lib/google/cloud/firestore/commit_response.rb +145 -0
  11. data/lib/google/cloud/firestore/convert.rb +561 -0
  12. data/lib/google/cloud/firestore/credentials.rb +35 -0
  13. data/lib/google/cloud/firestore/document_reference.rb +468 -0
  14. data/lib/google/cloud/firestore/document_snapshot.rb +324 -0
  15. data/lib/google/cloud/firestore/field_path.rb +216 -0
  16. data/lib/google/cloud/firestore/field_value.rb +113 -0
  17. data/lib/google/cloud/firestore/generate.rb +35 -0
  18. data/lib/google/cloud/firestore/query.rb +651 -0
  19. data/lib/google/cloud/firestore/service.rb +176 -0
  20. data/lib/google/cloud/firestore/transaction.rb +726 -0
  21. data/lib/google/cloud/firestore/v1beta1.rb +121 -0
  22. data/lib/google/cloud/firestore/v1beta1/doc/google/firestore/v1beta1/common.rb +63 -0
  23. data/lib/google/cloud/firestore/v1beta1/doc/google/firestore/v1beta1/document.rb +134 -0
  24. data/lib/google/cloud/firestore/v1beta1/doc/google/firestore/v1beta1/firestore.rb +584 -0
  25. data/lib/google/cloud/firestore/v1beta1/doc/google/firestore/v1beta1/query.rb +215 -0
  26. data/lib/google/cloud/firestore/v1beta1/doc/google/firestore/v1beta1/write.rb +167 -0
  27. data/lib/google/cloud/firestore/v1beta1/doc/google/protobuf/any.rb +124 -0
  28. data/lib/google/cloud/firestore/v1beta1/doc/google/protobuf/timestamp.rb +106 -0
  29. data/lib/google/cloud/firestore/v1beta1/doc/google/protobuf/wrappers.rb +89 -0
  30. data/lib/google/cloud/firestore/v1beta1/doc/google/rpc/status.rb +83 -0
  31. data/lib/google/cloud/firestore/v1beta1/doc/overview.rb +53 -0
  32. data/lib/google/cloud/firestore/v1beta1/firestore_client.rb +974 -0
  33. data/lib/google/cloud/firestore/v1beta1/firestore_client_config.json +100 -0
  34. data/lib/google/cloud/firestore/version.rb +22 -0
  35. data/lib/google/firestore/v1beta1/common_pb.rb +44 -0
  36. data/lib/google/firestore/v1beta1/document_pb.rb +49 -0
  37. data/lib/google/firestore/v1beta1/firestore_pb.rb +219 -0
  38. data/lib/google/firestore/v1beta1/firestore_services_pb.rb +87 -0
  39. data/lib/google/firestore/v1beta1/query_pb.rb +103 -0
  40. data/lib/google/firestore/v1beta1/write_pb.rb +73 -0
  41. metadata +251 -0
@@ -0,0 +1,121 @@
1
+ # Copyright 2017 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require "google/cloud/firestore/v1beta1/firestore_client"
16
+
17
+ module Google
18
+ module Cloud
19
+ # rubocop:disable LineLength
20
+
21
+ ##
22
+ # # Ruby Client for Google Cloud Firestore API ([Beta](https://github.com/GoogleCloudPlatform/google-cloud-ruby#versioning))
23
+ #
24
+ # [Google Cloud Firestore API][Product Documentation]:
25
+ #
26
+ # - [Product Documentation][]
27
+ #
28
+ # ## Quick Start
29
+ # In order to use this library, you first need to go through the following
30
+ # steps:
31
+ #
32
+ # 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
33
+ # 2. [Enable the Google Cloud Firestore API.](https://console.cloud.google.com/apis/api/firestore)
34
+ # 3. [Setup Authentication.](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
35
+ #
36
+ # ### Next Steps
37
+ # - Read the [Google Cloud Firestore API Product documentation][Product Documentation]
38
+ # to learn more about the product and see How-to Guides.
39
+ # - View this [repository's main README](https://github.com/GoogleCloudPlatform/google-cloud-ruby/blob/master/README.md)
40
+ # to see the full list of Cloud APIs that we cover.
41
+ #
42
+ # [Product Documentation]: https://cloud.google.com/firestore
43
+ #
44
+ #
45
+ module Firestore
46
+ module V1beta1
47
+ # rubocop:enable LineLength
48
+
49
+ ##
50
+ # The Cloud Firestore service.
51
+ #
52
+ # This service exposes several types of comparable timestamps:
53
+ #
54
+ # * +create_time+ - The time at which a document was created. Changes only
55
+ # when a document is deleted, then re-created. Increases in a strict
56
+ # monotonic fashion.
57
+ # * +update_time+ - The time at which a document was last updated. Changes
58
+ # every time a document is modified. Does not change when a write results
59
+ # in no modifications. Increases in a strict monotonic fashion.
60
+ # * +read_time+ - The time at which a particular state was observed. Used
61
+ # to denote a consistent snapshot of the database or the time at which a
62
+ # Document was observed to not exist.
63
+ # * +commit_time+ - The time at which the writes in a transaction were
64
+ # committed. Any read with an equal or greater +read_time+ is guaranteed
65
+ # to see the effects of the transaction.
66
+ #
67
+ # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
68
+ # Provides the means for authenticating requests made by the client. This parameter can
69
+ # be many types.
70
+ # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
71
+ # authenticating requests made by this client.
72
+ # A `String` will be treated as the path to the keyfile to be used for the construction of
73
+ # credentials for this client.
74
+ # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
75
+ # credentials for this client.
76
+ # A `GRPC::Core::Channel` will be used to make calls through.
77
+ # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
78
+ # should already be composed with a `GRPC::Core::CallCredentials` object.
79
+ # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
80
+ # metadata for requests, generally, to give OAuth credentials.
81
+ # @param scopes [Array<String>]
82
+ # The OAuth scopes for this service. This parameter is ignored if
83
+ # an updater_proc is supplied.
84
+ # @param client_config [Hash]
85
+ # A Hash for call options for each method. See
86
+ # Google::Gax#construct_settings for the structure of
87
+ # this data. Falls back to the default config if not specified
88
+ # or the specified config is missing data points.
89
+ # @param timeout [Numeric]
90
+ # The default timeout, in seconds, for calls made through this client.
91
+ def self.new \
92
+ service_path: nil,
93
+ port: nil,
94
+ channel: nil,
95
+ chan_creds: nil,
96
+ updater_proc: nil,
97
+ credentials: nil,
98
+ scopes: nil,
99
+ client_config: nil,
100
+ timeout: nil,
101
+ lib_name: nil,
102
+ lib_version: nil
103
+ kwargs = {
104
+ service_path: service_path,
105
+ port: port,
106
+ channel: channel,
107
+ chan_creds: chan_creds,
108
+ updater_proc: updater_proc,
109
+ credentials: credentials,
110
+ scopes: scopes,
111
+ client_config: client_config,
112
+ timeout: timeout,
113
+ lib_name: lib_name,
114
+ lib_version: lib_version
115
+ }.select { |_, v| v != nil }
116
+ Google::Cloud::Firestore::V1beta1::FirestoreClient.new(**kwargs)
117
+ end
118
+ end
119
+ end
120
+ end
121
+ end
@@ -0,0 +1,63 @@
1
+ # Copyright 2017 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ module Google
16
+ module Firestore
17
+ module V1beta1
18
+ # A set of field paths on a document.
19
+ # Used to restrict a get or update operation on a document to a subset of its
20
+ # fields.
21
+ # This is different from standard field masks, as this is always scoped to a
22
+ # {Google::Firestore::V1beta1::Document Document}, and takes in account the dynamic nature of {Google::Firestore::V1beta1::Value Value}.
23
+ # @!attribute [rw] field_paths
24
+ # @return [Array<String>]
25
+ # The list of field paths in the mask. See {Google::Firestore::V1beta1::Document#fields Document#fields} for a field
26
+ # path syntax reference.
27
+ class DocumentMask; end
28
+
29
+ # A precondition on a document, used for conditional operations.
30
+ # @!attribute [rw] exists
31
+ # @return [true, false]
32
+ # When set to +true+, the target document must exist.
33
+ # When set to +false+, the target document must not exist.
34
+ # @!attribute [rw] update_time
35
+ # @return [Google::Protobuf::Timestamp]
36
+ # When set, the target document must exist and have been last updated at
37
+ # that time.
38
+ class Precondition; end
39
+
40
+ # Options for creating a new transaction.
41
+ # @!attribute [rw] read_only
42
+ # @return [Google::Firestore::V1beta1::TransactionOptions::ReadOnly]
43
+ # The transaction can only be used for read operations.
44
+ # @!attribute [rw] read_write
45
+ # @return [Google::Firestore::V1beta1::TransactionOptions::ReadWrite]
46
+ # The transaction can be used for both read and write operations.
47
+ class TransactionOptions
48
+ # Options for a transaction that can be used to read and write documents.
49
+ # @!attribute [rw] retry_transaction
50
+ # @return [String]
51
+ # An optional transaction to retry.
52
+ class ReadWrite; end
53
+
54
+ # Options for a transaction that can only be used to read documents.
55
+ # @!attribute [rw] read_time
56
+ # @return [Google::Protobuf::Timestamp]
57
+ # Reads documents at the given time.
58
+ # This may not be older than 60 seconds.
59
+ class ReadOnly; end
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,134 @@
1
+ # Copyright 2017 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ module Google
16
+ module Firestore
17
+ module V1beta1
18
+ # A Firestore document.
19
+ #
20
+ # Must not exceed 1 MiB - 4 bytes.
21
+ # @!attribute [rw] name
22
+ # @return [String]
23
+ # The resource name of the document, for example
24
+ # +projects/{project_id}/databases/{database_id}/documents/{document_path}+.
25
+ # @!attribute [rw] fields
26
+ # @return [Hash{String => Google::Firestore::V1beta1::Value}]
27
+ # The document's fields.
28
+ #
29
+ # The map keys represent field names.
30
+ #
31
+ # A simple field name contains only characters +a+ to +z+, +A+ to +Z+,
32
+ # +0+ to +9+, or +_+, and must not start with +0+ to +9+ or +_+. For example,
33
+ # +foo_bar_17+.
34
+ #
35
+ # Field names matching the regular expression +__.*__+ are reserved. Reserved
36
+ # field names are forbidden except in certain documented contexts. The map
37
+ # keys, represented as UTF-8, must not exceed 1,500 bytes and cannot be
38
+ # empty.
39
+ #
40
+ # Field paths may be used in other contexts to refer to structured fields
41
+ # defined here. For +map_value+, the field path is represented by the simple
42
+ # or quoted field names of the containing fields, delimited by +.+. For
43
+ # example, the structured field
44
+ # +"foo" : { map_value: { "x&y" : { string_value: "hello" }}}+ would be
45
+ # represented by the field path +foo.x&y+.
46
+ #
47
+ # Within a field path, a quoted field name starts and ends with + + + and
48
+ # may contain any character. Some characters, including + + +, must be
49
+ # escaped using a +\+. For example, + +x&y+ + represents +x&y+ and
50
+ # + +bak\+tik+ + represents + bak+tik +.
51
+ # @!attribute [rw] create_time
52
+ # @return [Google::Protobuf::Timestamp]
53
+ # Output only. The time at which the document was created.
54
+ #
55
+ # This value increases monotonically when a document is deleted then
56
+ # recreated. It can also be compared to values from other documents and
57
+ # the +read_time+ of a query.
58
+ # @!attribute [rw] update_time
59
+ # @return [Google::Protobuf::Timestamp]
60
+ # Output only. The time at which the document was last changed.
61
+ #
62
+ # This value is initally set to the +create_time+ then increases
63
+ # monotonically with each change to the document. It can also be
64
+ # compared to values from other documents and the +read_time+ of a query.
65
+ class Document; end
66
+
67
+ # A message that can hold any of the supported value types.
68
+ # @!attribute [rw] null_value
69
+ # @return [Google::Protobuf::NullValue]
70
+ # A null value.
71
+ # @!attribute [rw] boolean_value
72
+ # @return [true, false]
73
+ # A boolean value.
74
+ # @!attribute [rw] integer_value
75
+ # @return [Integer]
76
+ # An integer value.
77
+ # @!attribute [rw] double_value
78
+ # @return [Float]
79
+ # A double value.
80
+ # @!attribute [rw] timestamp_value
81
+ # @return [Google::Protobuf::Timestamp]
82
+ # A timestamp value.
83
+ #
84
+ # Precise only to microseconds. When stored, any additional precision is
85
+ # rounded down.
86
+ # @!attribute [rw] string_value
87
+ # @return [String]
88
+ # A string value.
89
+ #
90
+ # The string, represented as UTF-8, must not exceed 1 MiB - 89 bytes.
91
+ # Only the first 1,500 bytes of the UTF-8 representation are considered by
92
+ # queries.
93
+ # @!attribute [rw] bytes_value
94
+ # @return [String]
95
+ # A bytes value.
96
+ #
97
+ # Must not exceed 1 MiB - 89 bytes.
98
+ # Only the first 1,500 bytes are considered by queries.
99
+ # @!attribute [rw] reference_value
100
+ # @return [String]
101
+ # A reference to a document. For example:
102
+ # +projects/{project_id}/databases/{database_id}/documents/{document_path}+.
103
+ # @!attribute [rw] geo_point_value
104
+ # @return [Google::Type::LatLng]
105
+ # A geo point value representing a point on the surface of Earth.
106
+ # @!attribute [rw] array_value
107
+ # @return [Google::Firestore::V1beta1::ArrayValue]
108
+ # An array value.
109
+ #
110
+ # Cannot contain another array value.
111
+ # @!attribute [rw] map_value
112
+ # @return [Google::Firestore::V1beta1::MapValue]
113
+ # A map value.
114
+ class Value; end
115
+
116
+ # An array value.
117
+ # @!attribute [rw] values
118
+ # @return [Array<Google::Firestore::V1beta1::Value>]
119
+ # Values in the array.
120
+ class ArrayValue; end
121
+
122
+ # A map value.
123
+ # @!attribute [rw] fields
124
+ # @return [Hash{String => Google::Firestore::V1beta1::Value}]
125
+ # The map's fields.
126
+ #
127
+ # The map keys represent field names. Field names matching the regular
128
+ # expression +__.*__+ are reserved. Reserved field names are forbidden except
129
+ # in certain documented contexts. The map keys, represented as UTF-8, must
130
+ # not exceed 1,500 bytes and cannot be empty.
131
+ class MapValue; end
132
+ end
133
+ end
134
+ end
@@ -0,0 +1,584 @@
1
+ # Copyright 2017 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ module Google
16
+ module Firestore
17
+ ##
18
+ # # Google Cloud Firestore API Contents
19
+ #
20
+ # | Class | Description |
21
+ # | ----- | ----------- |
22
+ # | [FirestoreClient][] | |
23
+ # | [Data Types][] | Data types for Google::Cloud::Firestore::V1beta1 |
24
+ #
25
+ # [FirestoreClient]: https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-firestore/latest/google/firestore/v1beta1/v1beta1/firestoreclient
26
+ # [Data Types]: https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-firestore/latest/google/firestore/v1beta1/v1beta1/datatypes
27
+ #
28
+ module V1beta1
29
+ # The request for {Google::Firestore::V1beta1::Firestore::GetDocument Firestore::GetDocument}.
30
+ # @!attribute [rw] name
31
+ # @return [String]
32
+ # The resource name of the Document to get. In the format:
33
+ # +projects/{project_id}/databases/{database_id}/documents/{document_path}+.
34
+ # @!attribute [rw] mask
35
+ # @return [Google::Firestore::V1beta1::DocumentMask]
36
+ # The fields to return. If not set, returns all fields.
37
+ #
38
+ # If the document has a field that is not present in this mask, that field
39
+ # will not be returned in the response.
40
+ # @!attribute [rw] transaction
41
+ # @return [String]
42
+ # Reads the document in a transaction.
43
+ # @!attribute [rw] read_time
44
+ # @return [Google::Protobuf::Timestamp]
45
+ # Reads the version of the document at the given time.
46
+ # This may not be older than 60 seconds.
47
+ class GetDocumentRequest; end
48
+
49
+ # The request for {Google::Firestore::V1beta1::Firestore::ListDocuments Firestore::ListDocuments}.
50
+ # @!attribute [rw] parent
51
+ # @return [String]
52
+ # The parent resource name. In the format:
53
+ # +projects/{project_id}/databases/{database_id}/documents+ or
54
+ # +projects/{project_id}/databases/{database_id}/documents/{document_path}+.
55
+ # For example:
56
+ # +projects/my-project/databases/my-database/documents+ or
57
+ # +projects/my-project/databases/my-database/documents/chatrooms/my-chatroom+
58
+ # @!attribute [rw] collection_id
59
+ # @return [String]
60
+ # The collection ID, relative to +parent+, to list. For example: +chatrooms+
61
+ # or +messages+.
62
+ # @!attribute [rw] page_size
63
+ # @return [Integer]
64
+ # The maximum number of documents to return.
65
+ # @!attribute [rw] page_token
66
+ # @return [String]
67
+ # The +next_page_token+ value returned from a previous List request, if any.
68
+ # @!attribute [rw] order_by
69
+ # @return [String]
70
+ # The order to sort results by. For example: +priority desc, name+.
71
+ # @!attribute [rw] mask
72
+ # @return [Google::Firestore::V1beta1::DocumentMask]
73
+ # The fields to return. If not set, returns all fields.
74
+ #
75
+ # If a document has a field that is not present in this mask, that field
76
+ # will not be returned in the response.
77
+ # @!attribute [rw] transaction
78
+ # @return [String]
79
+ # Reads documents in a transaction.
80
+ # @!attribute [rw] read_time
81
+ # @return [Google::Protobuf::Timestamp]
82
+ # Reads documents as they were at the given time.
83
+ # This may not be older than 60 seconds.
84
+ # @!attribute [rw] show_missing
85
+ # @return [true, false]
86
+ # If the list should show missing documents. A missing document is a
87
+ # document that does not exist but has sub-documents. These documents will
88
+ # be returned with a key but will not have fields, {Google::Firestore::V1beta1::Document#create_time Document#create_time},
89
+ # or {Google::Firestore::V1beta1::Document#update_time Document#update_time} set.
90
+ #
91
+ # Requests with +show_missing+ may not specify +where+ or
92
+ # +order_by+.
93
+ class ListDocumentsRequest; end
94
+
95
+ # The response for {Google::Firestore::V1beta1::Firestore::ListDocuments Firestore::ListDocuments}.
96
+ # @!attribute [rw] documents
97
+ # @return [Array<Google::Firestore::V1beta1::Document>]
98
+ # The Documents found.
99
+ # @!attribute [rw] next_page_token
100
+ # @return [String]
101
+ # The next page token.
102
+ class ListDocumentsResponse; end
103
+
104
+ # The request for {Google::Firestore::V1beta1::Firestore::CreateDocument Firestore::CreateDocument}.
105
+ # @!attribute [rw] parent
106
+ # @return [String]
107
+ # The parent resource. For example:
108
+ # +projects/{project_id}/databases/{database_id}/documents+ or
109
+ # +projects/{project_id}/databases/{database_id}/documents/chatrooms/{chatroom_id}+
110
+ # @!attribute [rw] collection_id
111
+ # @return [String]
112
+ # The collection ID, relative to +parent+, to list. For example: +chatrooms+.
113
+ # @!attribute [rw] document_id
114
+ # @return [String]
115
+ # The client-assigned document ID to use for this document.
116
+ #
117
+ # Optional. If not specified, an ID will be assigned by the service.
118
+ # @!attribute [rw] document
119
+ # @return [Google::Firestore::V1beta1::Document]
120
+ # The document to create. +name+ must not be set.
121
+ # @!attribute [rw] mask
122
+ # @return [Google::Firestore::V1beta1::DocumentMask]
123
+ # The fields to return. If not set, returns all fields.
124
+ #
125
+ # If the document has a field that is not present in this mask, that field
126
+ # will not be returned in the response.
127
+ class CreateDocumentRequest; end
128
+
129
+ # The request for {Google::Firestore::V1beta1::Firestore::UpdateDocument Firestore::UpdateDocument}.
130
+ # @!attribute [rw] document
131
+ # @return [Google::Firestore::V1beta1::Document]
132
+ # The updated document.
133
+ # Creates the document if it does not already exist.
134
+ # @!attribute [rw] update_mask
135
+ # @return [Google::Firestore::V1beta1::DocumentMask]
136
+ # The fields to update.
137
+ # None of the field paths in the mask may contain a reserved name.
138
+ #
139
+ # If the document exists on the server and has fields not referenced in the
140
+ # mask, they are left unchanged.
141
+ # Fields referenced in the mask, but not present in the input document, are
142
+ # deleted from the document on the server.
143
+ # @!attribute [rw] mask
144
+ # @return [Google::Firestore::V1beta1::DocumentMask]
145
+ # The fields to return. If not set, returns all fields.
146
+ #
147
+ # If the document has a field that is not present in this mask, that field
148
+ # will not be returned in the response.
149
+ # @!attribute [rw] current_document
150
+ # @return [Google::Firestore::V1beta1::Precondition]
151
+ # An optional precondition on the document.
152
+ # The request will fail if this is set and not met by the target document.
153
+ class UpdateDocumentRequest; end
154
+
155
+ # The request for {Google::Firestore::V1beta1::Firestore::DeleteDocument Firestore::DeleteDocument}.
156
+ # @!attribute [rw] name
157
+ # @return [String]
158
+ # The resource name of the Document to delete. In the format:
159
+ # +projects/{project_id}/databases/{database_id}/documents/{document_path}+.
160
+ # @!attribute [rw] current_document
161
+ # @return [Google::Firestore::V1beta1::Precondition]
162
+ # An optional precondition on the document.
163
+ # The request will fail if this is set and not met by the target document.
164
+ class DeleteDocumentRequest; end
165
+
166
+ # The request for {Google::Firestore::V1beta1::Firestore::BatchGetDocuments Firestore::BatchGetDocuments}.
167
+ # @!attribute [rw] database
168
+ # @return [String]
169
+ # The database name. In the format:
170
+ # +projects/{project_id}/databases/{database_id}+.
171
+ # @!attribute [rw] documents
172
+ # @return [Array<String>]
173
+ # The names of the documents to retrieve. In the format:
174
+ # +projects/{project_id}/databases/{database_id}/documents/{document_path}+.
175
+ # The request will fail if any of the document is not a child resource of the
176
+ # given +database+. Duplicate names will be elided.
177
+ # @!attribute [rw] mask
178
+ # @return [Google::Firestore::V1beta1::DocumentMask]
179
+ # The fields to return. If not set, returns all fields.
180
+ #
181
+ # If a document has a field that is not present in this mask, that field will
182
+ # not be returned in the response.
183
+ # @!attribute [rw] transaction
184
+ # @return [String]
185
+ # Reads documents in a transaction.
186
+ # @!attribute [rw] new_transaction
187
+ # @return [Google::Firestore::V1beta1::TransactionOptions]
188
+ # Starts a new transaction and reads the documents.
189
+ # Defaults to a read-only transaction.
190
+ # The new transaction ID will be returned as the first response in the
191
+ # stream.
192
+ # @!attribute [rw] read_time
193
+ # @return [Google::Protobuf::Timestamp]
194
+ # Reads documents as they were at the given time.
195
+ # This may not be older than 60 seconds.
196
+ class BatchGetDocumentsRequest; end
197
+
198
+ # The streamed response for {Google::Firestore::V1beta1::Firestore::BatchGetDocuments Firestore::BatchGetDocuments}.
199
+ # @!attribute [rw] found
200
+ # @return [Google::Firestore::V1beta1::Document]
201
+ # A document that was requested.
202
+ # @!attribute [rw] missing
203
+ # @return [String]
204
+ # A document name that was requested but does not exist. In the format:
205
+ # +projects/{project_id}/databases/{database_id}/documents/{document_path}+.
206
+ # @!attribute [rw] transaction
207
+ # @return [String]
208
+ # The transaction that was started as part of this request.
209
+ # Will only be set in the first response, and only if
210
+ # {Google::Firestore::V1beta1::BatchGetDocumentsRequest#new_transaction BatchGetDocumentsRequest#new_transaction} was set in the request.
211
+ # @!attribute [rw] read_time
212
+ # @return [Google::Protobuf::Timestamp]
213
+ # The time at which the document was read.
214
+ # This may be monotically increasing, in this case the previous documents in
215
+ # the result stream are guaranteed not to have changed between their
216
+ # read_time and this one.
217
+ class BatchGetDocumentsResponse; end
218
+
219
+ # The request for {Google::Firestore::V1beta1::Firestore::BeginTransaction Firestore::BeginTransaction}.
220
+ # @!attribute [rw] database
221
+ # @return [String]
222
+ # The database name. In the format:
223
+ # +projects/{project_id}/databases/{database_id}+.
224
+ # @!attribute [rw] options
225
+ # @return [Google::Firestore::V1beta1::TransactionOptions]
226
+ # The options for the transaction.
227
+ # Defaults to a read-write transaction.
228
+ class BeginTransactionRequest; end
229
+
230
+ # The response for {Google::Firestore::V1beta1::Firestore::BeginTransaction Firestore::BeginTransaction}.
231
+ # @!attribute [rw] transaction
232
+ # @return [String]
233
+ # The transaction that was started.
234
+ class BeginTransactionResponse; end
235
+
236
+ # The request for {Google::Firestore::V1beta1::Firestore::Commit Firestore::Commit}.
237
+ # @!attribute [rw] database
238
+ # @return [String]
239
+ # The database name. In the format:
240
+ # +projects/{project_id}/databases/{database_id}+.
241
+ # @!attribute [rw] writes
242
+ # @return [Array<Google::Firestore::V1beta1::Write>]
243
+ # The writes to apply.
244
+ #
245
+ # Always executed atomically and in order.
246
+ # @!attribute [rw] transaction
247
+ # @return [String]
248
+ # If set, applies all writes in this transaction, and commits it.
249
+ class CommitRequest; end
250
+
251
+ # The response for {Google::Firestore::V1beta1::Firestore::Commit Firestore::Commit}.
252
+ # @!attribute [rw] write_results
253
+ # @return [Array<Google::Firestore::V1beta1::WriteResult>]
254
+ # The result of applying the writes.
255
+ #
256
+ # This i-th write result corresponds to the i-th write in the
257
+ # request.
258
+ # @!attribute [rw] commit_time
259
+ # @return [Google::Protobuf::Timestamp]
260
+ # The time at which the commit occurred.
261
+ class CommitResponse; end
262
+
263
+ # The request for {Google::Firestore::V1beta1::Firestore::Rollback Firestore::Rollback}.
264
+ # @!attribute [rw] database
265
+ # @return [String]
266
+ # The database name. In the format:
267
+ # +projects/{project_id}/databases/{database_id}+.
268
+ # @!attribute [rw] transaction
269
+ # @return [String]
270
+ # The transaction to roll back.
271
+ class RollbackRequest; end
272
+
273
+ # The request for {Google::Firestore::V1beta1::Firestore::RunQuery Firestore::RunQuery}.
274
+ # @!attribute [rw] parent
275
+ # @return [String]
276
+ # The parent resource name. In the format:
277
+ # +projects/{project_id}/databases/{database_id}/documents+ or
278
+ # +projects/{project_id}/databases/{database_id}/documents/{document_path}+.
279
+ # For example:
280
+ # +projects/my-project/databases/my-database/documents+ or
281
+ # +projects/my-project/databases/my-database/documents/chatrooms/my-chatroom+
282
+ # @!attribute [rw] structured_query
283
+ # @return [Google::Firestore::V1beta1::StructuredQuery]
284
+ # A structured query.
285
+ # @!attribute [rw] transaction
286
+ # @return [String]
287
+ # Reads documents in a transaction.
288
+ # @!attribute [rw] new_transaction
289
+ # @return [Google::Firestore::V1beta1::TransactionOptions]
290
+ # Starts a new transaction and reads the documents.
291
+ # Defaults to a read-only transaction.
292
+ # The new transaction ID will be returned as the first response in the
293
+ # stream.
294
+ # @!attribute [rw] read_time
295
+ # @return [Google::Protobuf::Timestamp]
296
+ # Reads documents as they were at the given time.
297
+ # This may not be older than 60 seconds.
298
+ class RunQueryRequest; end
299
+
300
+ # The response for {Google::Firestore::V1beta1::Firestore::RunQuery Firestore::RunQuery}.
301
+ # @!attribute [rw] transaction
302
+ # @return [String]
303
+ # The transaction that was started as part of this request.
304
+ # Can only be set in the first response, and only if
305
+ # {Google::Firestore::V1beta1::RunQueryRequest#new_transaction RunQueryRequest#new_transaction} was set in the request.
306
+ # If set, no other fields will be set in this response.
307
+ # @!attribute [rw] document
308
+ # @return [Google::Firestore::V1beta1::Document]
309
+ # A query result.
310
+ # Not set when reporting partial progress.
311
+ # @!attribute [rw] read_time
312
+ # @return [Google::Protobuf::Timestamp]
313
+ # The time at which the document was read. This may be monotonically
314
+ # increasing; in this case, the previous documents in the result stream are
315
+ # guaranteed not to have changed between their +read_time+ and this one.
316
+ #
317
+ # If the query returns no results, a response with +read_time+ and no
318
+ # +document+ will be sent, and this represents the time at which the query
319
+ # was run.
320
+ # @!attribute [rw] skipped_results
321
+ # @return [Integer]
322
+ # The number of results that have been skipped due to an offset between
323
+ # the last response and the current response.
324
+ class RunQueryResponse; end
325
+
326
+ # The request for {Google::Firestore::V1beta1::Firestore::Write Firestore::Write}.
327
+ #
328
+ # The first request creates a stream, or resumes an existing one from a token.
329
+ #
330
+ # When creating a new stream, the server replies with a response containing
331
+ # only an ID and a token, to use in the next request.
332
+ #
333
+ # When resuming a stream, the server first streams any responses later than the
334
+ # given token, then a response containing only an up-to-date token, to use in
335
+ # the next request.
336
+ # @!attribute [rw] database
337
+ # @return [String]
338
+ # The database name. In the format:
339
+ # +projects/{project_id}/databases/{database_id}+.
340
+ # This is only required in the first message.
341
+ # @!attribute [rw] stream_id
342
+ # @return [String]
343
+ # The ID of the write stream to resume.
344
+ # This may only be set in the first message. When left empty, a new write
345
+ # stream will be created.
346
+ # @!attribute [rw] writes
347
+ # @return [Array<Google::Firestore::V1beta1::Write>]
348
+ # The writes to apply.
349
+ #
350
+ # Always executed atomically and in order.
351
+ # This must be empty on the first request.
352
+ # This may be empty on the last request.
353
+ # This must not be empty on all other requests.
354
+ # @!attribute [rw] stream_token
355
+ # @return [String]
356
+ # A stream token that was previously sent by the server.
357
+ #
358
+ # The client should set this field to the token from the most recent
359
+ # {Google::Firestore::V1beta1::WriteResponse WriteResponse} it has received. This acknowledges that the client has
360
+ # received responses up to this token. After sending this token, earlier
361
+ # tokens may not be used anymore.
362
+ #
363
+ # The server may close the stream if there are too many unacknowledged
364
+ # responses.
365
+ #
366
+ # Leave this field unset when creating a new stream. To resume a stream at
367
+ # a specific point, set this field and the +stream_id+ field.
368
+ #
369
+ # Leave this field unset when creating a new stream.
370
+ # @!attribute [rw] labels
371
+ # @return [Hash{String => String}]
372
+ # Labels associated with this write request.
373
+ class WriteRequest; end
374
+
375
+ # The response for {Google::Firestore::V1beta1::Firestore::Write Firestore::Write}.
376
+ # @!attribute [rw] stream_id
377
+ # @return [String]
378
+ # The ID of the stream.
379
+ # Only set on the first message, when a new stream was created.
380
+ # @!attribute [rw] stream_token
381
+ # @return [String]
382
+ # A token that represents the position of this response in the stream.
383
+ # This can be used by a client to resume the stream at this point.
384
+ #
385
+ # This field is always set.
386
+ # @!attribute [rw] write_results
387
+ # @return [Array<Google::Firestore::V1beta1::WriteResult>]
388
+ # The result of applying the writes.
389
+ #
390
+ # This i-th write result corresponds to the i-th write in the
391
+ # request.
392
+ # @!attribute [rw] commit_time
393
+ # @return [Google::Protobuf::Timestamp]
394
+ # The time at which the commit occurred.
395
+ class WriteResponse; end
396
+
397
+ # A request for {Google::Firestore::V1beta1::Firestore::Listen Firestore::Listen}
398
+ # @!attribute [rw] database
399
+ # @return [String]
400
+ # The database name. In the format:
401
+ # +projects/{project_id}/databases/{database_id}+.
402
+ # @!attribute [rw] add_target
403
+ # @return [Google::Firestore::V1beta1::Target]
404
+ # A target to add to this stream.
405
+ # @!attribute [rw] remove_target
406
+ # @return [Integer]
407
+ # The ID of a target to remove from this stream.
408
+ # @!attribute [rw] labels
409
+ # @return [Hash{String => String}]
410
+ # Labels associated with this target change.
411
+ class ListenRequest; end
412
+
413
+ # The response for {Google::Firestore::V1beta1::Firestore::Listen Firestore::Listen}.
414
+ # @!attribute [rw] target_change
415
+ # @return [Google::Firestore::V1beta1::TargetChange]
416
+ # Targets have changed.
417
+ # @!attribute [rw] document_change
418
+ # @return [Google::Firestore::V1beta1::DocumentChange]
419
+ # A {Google::Firestore::V1beta1::Document Document} has changed.
420
+ # @!attribute [rw] document_delete
421
+ # @return [Google::Firestore::V1beta1::DocumentDelete]
422
+ # A {Google::Firestore::V1beta1::Document Document} has been deleted.
423
+ # @!attribute [rw] document_remove
424
+ # @return [Google::Firestore::V1beta1::DocumentRemove]
425
+ # A {Google::Firestore::V1beta1::Document Document} has been removed from a target (because it is no longer
426
+ # relevant to that target).
427
+ # @!attribute [rw] filter
428
+ # @return [Google::Firestore::V1beta1::ExistenceFilter]
429
+ # A filter to apply to the set of documents previously returned for the
430
+ # given target.
431
+ #
432
+ # Returned when documents may have been removed from the given target, but
433
+ # the exact documents are unknown.
434
+ class ListenResponse; end
435
+
436
+ # A specification of a set of documents to listen to.
437
+ # @!attribute [rw] query
438
+ # @return [Google::Firestore::V1beta1::Target::QueryTarget]
439
+ # A target specified by a query.
440
+ # @!attribute [rw] documents
441
+ # @return [Google::Firestore::V1beta1::Target::DocumentsTarget]
442
+ # A target specified by a set of document names.
443
+ # @!attribute [rw] resume_token
444
+ # @return [String]
445
+ # A resume token from a prior {Google::Firestore::V1beta1::TargetChange TargetChange} for an identical target.
446
+ #
447
+ # Using a resume token with a different target is unsupported and may fail.
448
+ # @!attribute [rw] read_time
449
+ # @return [Google::Protobuf::Timestamp]
450
+ # Start listening after a specific +read_time+.
451
+ #
452
+ # The client must know the state of matching documents at this time.
453
+ # @!attribute [rw] target_id
454
+ # @return [Integer]
455
+ # A client provided target ID.
456
+ #
457
+ # If not set, the server will assign an ID for the target.
458
+ #
459
+ # Used for resuming a target without changing IDs. The IDs can either be
460
+ # client-assigned or be server-assigned in a previous stream. All targets
461
+ # with client provided IDs must be added before adding a target that needs
462
+ # a server-assigned id.
463
+ # @!attribute [rw] once
464
+ # @return [true, false]
465
+ # If the target should be removed once it is current and consistent.
466
+ class Target
467
+ # A target specified by a set of documents names.
468
+ # @!attribute [rw] documents
469
+ # @return [Array<String>]
470
+ # The names of the documents to retrieve. In the format:
471
+ # +projects/{project_id}/databases/{database_id}/documents/{document_path}+.
472
+ # The request will fail if any of the document is not a child resource of
473
+ # the given +database+. Duplicate names will be elided.
474
+ class DocumentsTarget; end
475
+
476
+ # A target specified by a query.
477
+ # @!attribute [rw] parent
478
+ # @return [String]
479
+ # The parent resource name. In the format:
480
+ # +projects/{project_id}/databases/{database_id}/documents+ or
481
+ # +projects/{project_id}/databases/{database_id}/documents/{document_path}+.
482
+ # For example:
483
+ # +projects/my-project/databases/my-database/documents+ or
484
+ # +projects/my-project/databases/my-database/documents/chatrooms/my-chatroom+
485
+ # @!attribute [rw] structured_query
486
+ # @return [Google::Firestore::V1beta1::StructuredQuery]
487
+ # A structured query.
488
+ class QueryTarget; end
489
+ end
490
+
491
+ # Targets being watched have changed.
492
+ # @!attribute [rw] target_change_type
493
+ # @return [Google::Firestore::V1beta1::TargetChange::TargetChangeType]
494
+ # The type of change that occurred.
495
+ # @!attribute [rw] target_ids
496
+ # @return [Array<Integer>]
497
+ # The target IDs of targets that have changed.
498
+ #
499
+ # If empty, the change applies to all targets.
500
+ #
501
+ # For +target_change_type=ADD+, the order of the target IDs matches the order
502
+ # of the requests to add the targets. This allows clients to unambiguously
503
+ # associate server-assigned target IDs with added targets.
504
+ #
505
+ # For other states, the order of the target IDs is not defined.
506
+ # @!attribute [rw] cause
507
+ # @return [Google::Rpc::Status]
508
+ # The error that resulted in this change, if applicable.
509
+ # @!attribute [rw] resume_token
510
+ # @return [String]
511
+ # A token that can be used to resume the stream for the given +target_ids+,
512
+ # or all targets if +target_ids+ is empty.
513
+ #
514
+ # Not set on every target change.
515
+ # @!attribute [rw] read_time
516
+ # @return [Google::Protobuf::Timestamp]
517
+ # The consistent +read_time+ for the given +target_ids+ (omitted when the
518
+ # target_ids are not at a consistent snapshot).
519
+ #
520
+ # The stream is guaranteed to send a +read_time+ with +target_ids+ empty
521
+ # whenever the entire stream reaches a new consistent snapshot. ADD,
522
+ # CURRENT, and RESET messages are guaranteed to (eventually) result in a
523
+ # new consistent snapshot (while NO_CHANGE and REMOVE messages are not).
524
+ #
525
+ # For a given stream, +read_time+ is guaranteed to be monotonically
526
+ # increasing.
527
+ class TargetChange
528
+ # The type of change.
529
+ module TargetChangeType
530
+ # No change has occurred. Used only to send an updated +resume_token+.
531
+ NO_CHANGE = 0
532
+
533
+ # The targets have been added.
534
+ ADD = 1
535
+
536
+ # The targets have been removed.
537
+ REMOVE = 2
538
+
539
+ # The targets reflect all changes committed before the targets were added
540
+ # to the stream.
541
+ #
542
+ # This will be sent after or with a +read_time+ that is greater than or
543
+ # equal to the time at which the targets were added.
544
+ #
545
+ # Listeners can wait for this change if read-after-write semantics
546
+ # are desired.
547
+ CURRENT = 3
548
+
549
+ # The targets have been reset, and a new initial state for the targets
550
+ # will be returned in subsequent changes.
551
+ #
552
+ # After the initial state is complete, +CURRENT+ will be returned even
553
+ # if the target was previously indicated to be +CURRENT+.
554
+ RESET = 4
555
+ end
556
+ end
557
+
558
+ # The request for {Google::Firestore::V1beta1::Firestore::ListCollectionIds Firestore::ListCollectionIds}.
559
+ # @!attribute [rw] parent
560
+ # @return [String]
561
+ # The parent document. In the format:
562
+ # +projects/{project_id}/databases/{database_id}/documents/{document_path}+.
563
+ # For example:
564
+ # +projects/my-project/databases/my-database/documents/chatrooms/my-chatroom+
565
+ # @!attribute [rw] page_size
566
+ # @return [Integer]
567
+ # The maximum number of results to return.
568
+ # @!attribute [rw] page_token
569
+ # @return [String]
570
+ # A page token. Must be a value from
571
+ # {Google::Firestore::V1beta1::ListCollectionIdsResponse ListCollectionIdsResponse}.
572
+ class ListCollectionIdsRequest; end
573
+
574
+ # The response from {Google::Firestore::V1beta1::Firestore::ListCollectionIds Firestore::ListCollectionIds}.
575
+ # @!attribute [rw] collection_ids
576
+ # @return [Array<String>]
577
+ # The collection ids.
578
+ # @!attribute [rw] next_page_token
579
+ # @return [String]
580
+ # A page token that may be used to continue the list.
581
+ class ListCollectionIdsResponse; end
582
+ end
583
+ end
584
+ end