[e3d4e0a] | 1 | <?php
|
---|
| 2 | /*
|
---|
| 3 | * Copyright 2014 Google Inc.
|
---|
| 4 | *
|
---|
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
---|
| 6 | * use this file except in compliance with the License. You may obtain a copy of
|
---|
| 7 | * the License at
|
---|
| 8 | *
|
---|
| 9 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
| 10 | *
|
---|
| 11 | * Unless required by applicable law or agreed to in writing, software
|
---|
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
---|
| 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
---|
| 14 | * License for the specific language governing permissions and limitations under
|
---|
| 15 | * the License.
|
---|
| 16 | */
|
---|
| 17 |
|
---|
| 18 | namespace Google\Service\Firestore\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\Firestore\BatchGetDocumentsRequest;
|
---|
| 21 | use Google\Service\Firestore\BatchGetDocumentsResponse;
|
---|
| 22 | use Google\Service\Firestore\BatchWriteRequest;
|
---|
| 23 | use Google\Service\Firestore\BatchWriteResponse;
|
---|
| 24 | use Google\Service\Firestore\BeginTransactionRequest;
|
---|
| 25 | use Google\Service\Firestore\BeginTransactionResponse;
|
---|
| 26 | use Google\Service\Firestore\CommitRequest;
|
---|
| 27 | use Google\Service\Firestore\CommitResponse;
|
---|
| 28 | use Google\Service\Firestore\Document;
|
---|
| 29 | use Google\Service\Firestore\FirestoreEmpty;
|
---|
| 30 | use Google\Service\Firestore\ListCollectionIdsRequest;
|
---|
| 31 | use Google\Service\Firestore\ListCollectionIdsResponse;
|
---|
| 32 | use Google\Service\Firestore\ListDocumentsResponse;
|
---|
| 33 | use Google\Service\Firestore\ListenRequest;
|
---|
| 34 | use Google\Service\Firestore\ListenResponse;
|
---|
| 35 | use Google\Service\Firestore\PartitionQueryRequest;
|
---|
| 36 | use Google\Service\Firestore\PartitionQueryResponse;
|
---|
| 37 | use Google\Service\Firestore\RollbackRequest;
|
---|
| 38 | use Google\Service\Firestore\RunAggregationQueryRequest;
|
---|
| 39 | use Google\Service\Firestore\RunAggregationQueryResponse;
|
---|
| 40 | use Google\Service\Firestore\RunQueryRequest;
|
---|
| 41 | use Google\Service\Firestore\RunQueryResponse;
|
---|
| 42 | use Google\Service\Firestore\WriteRequest;
|
---|
| 43 | use Google\Service\Firestore\WriteResponse;
|
---|
| 44 |
|
---|
| 45 | /**
|
---|
| 46 | * The "documents" collection of methods.
|
---|
| 47 | * Typical usage is:
|
---|
| 48 | * <code>
|
---|
| 49 | * $firestoreService = new Google\Service\Firestore(...);
|
---|
| 50 | * $documents = $firestoreService->projects_databases_documents;
|
---|
| 51 | * </code>
|
---|
| 52 | */
|
---|
| 53 | class ProjectsDatabasesDocuments extends \Google\Service\Resource
|
---|
| 54 | {
|
---|
| 55 | /**
|
---|
| 56 | * Gets multiple documents. Documents returned by this method are not guaranteed
|
---|
| 57 | * to be returned in the same order that they were requested.
|
---|
| 58 | * (documents.batchGet)
|
---|
| 59 | *
|
---|
| 60 | * @param string $database Required. The database name. In the format:
|
---|
| 61 | * `projects/{project_id}/databases/{database_id}`.
|
---|
| 62 | * @param BatchGetDocumentsRequest $postBody
|
---|
| 63 | * @param array $optParams Optional parameters.
|
---|
| 64 | * @return BatchGetDocumentsResponse
|
---|
| 65 | * @throws \Google\Service\Exception
|
---|
| 66 | */
|
---|
| 67 | public function batchGet($database, BatchGetDocumentsRequest $postBody, $optParams = [])
|
---|
| 68 | {
|
---|
| 69 | $params = ['database' => $database, 'postBody' => $postBody];
|
---|
| 70 | $params = array_merge($params, $optParams);
|
---|
| 71 | return $this->call('batchGet', [$params], BatchGetDocumentsResponse::class);
|
---|
| 72 | }
|
---|
| 73 | /**
|
---|
| 74 | * Applies a batch of write operations. The BatchWrite method does not apply the
|
---|
| 75 | * write operations atomically and can apply them out of order. Method does not
|
---|
| 76 | * allow more than one write per document. Each write succeeds or fails
|
---|
| 77 | * independently. See the BatchWriteResponse for the success status of each
|
---|
| 78 | * write. If you require an atomically applied set of writes, use Commit
|
---|
| 79 | * instead. (documents.batchWrite)
|
---|
| 80 | *
|
---|
| 81 | * @param string $database Required. The database name. In the format:
|
---|
| 82 | * `projects/{project_id}/databases/{database_id}`.
|
---|
| 83 | * @param BatchWriteRequest $postBody
|
---|
| 84 | * @param array $optParams Optional parameters.
|
---|
| 85 | * @return BatchWriteResponse
|
---|
| 86 | * @throws \Google\Service\Exception
|
---|
| 87 | */
|
---|
| 88 | public function batchWrite($database, BatchWriteRequest $postBody, $optParams = [])
|
---|
| 89 | {
|
---|
| 90 | $params = ['database' => $database, 'postBody' => $postBody];
|
---|
| 91 | $params = array_merge($params, $optParams);
|
---|
| 92 | return $this->call('batchWrite', [$params], BatchWriteResponse::class);
|
---|
| 93 | }
|
---|
| 94 | /**
|
---|
| 95 | * Starts a new transaction. (documents.beginTransaction)
|
---|
| 96 | *
|
---|
| 97 | * @param string $database Required. The database name. In the format:
|
---|
| 98 | * `projects/{project_id}/databases/{database_id}`.
|
---|
| 99 | * @param BeginTransactionRequest $postBody
|
---|
| 100 | * @param array $optParams Optional parameters.
|
---|
| 101 | * @return BeginTransactionResponse
|
---|
| 102 | * @throws \Google\Service\Exception
|
---|
| 103 | */
|
---|
| 104 | public function beginTransaction($database, BeginTransactionRequest $postBody, $optParams = [])
|
---|
| 105 | {
|
---|
| 106 | $params = ['database' => $database, 'postBody' => $postBody];
|
---|
| 107 | $params = array_merge($params, $optParams);
|
---|
| 108 | return $this->call('beginTransaction', [$params], BeginTransactionResponse::class);
|
---|
| 109 | }
|
---|
| 110 | /**
|
---|
| 111 | * Commits a transaction, while optionally updating documents.
|
---|
| 112 | * (documents.commit)
|
---|
| 113 | *
|
---|
| 114 | * @param string $database Required. The database name. In the format:
|
---|
| 115 | * `projects/{project_id}/databases/{database_id}`.
|
---|
| 116 | * @param CommitRequest $postBody
|
---|
| 117 | * @param array $optParams Optional parameters.
|
---|
| 118 | * @return CommitResponse
|
---|
| 119 | * @throws \Google\Service\Exception
|
---|
| 120 | */
|
---|
| 121 | public function commit($database, CommitRequest $postBody, $optParams = [])
|
---|
| 122 | {
|
---|
| 123 | $params = ['database' => $database, 'postBody' => $postBody];
|
---|
| 124 | $params = array_merge($params, $optParams);
|
---|
| 125 | return $this->call('commit', [$params], CommitResponse::class);
|
---|
| 126 | }
|
---|
| 127 | /**
|
---|
| 128 | * Creates a new document. (documents.createDocument)
|
---|
| 129 | *
|
---|
| 130 | * @param string $parent Required. The parent resource. For example:
|
---|
| 131 | * `projects/{project_id}/databases/{database_id}/documents` or `projects/{proje
|
---|
| 132 | * ct_id}/databases/{database_id}/documents/chatrooms/{chatroom_id}`
|
---|
| 133 | * @param string $collectionId Required. The collection ID, relative to
|
---|
| 134 | * `parent`, to list. For example: `chatrooms`.
|
---|
| 135 | * @param Document $postBody
|
---|
| 136 | * @param array $optParams Optional parameters.
|
---|
| 137 | *
|
---|
| 138 | * @opt_param string documentId The client-assigned document ID to use for this
|
---|
| 139 | * document. Optional. If not specified, an ID will be assigned by the service.
|
---|
| 140 | * @opt_param string mask.fieldPaths The list of field paths in the mask. See
|
---|
| 141 | * Document.fields for a field path syntax reference.
|
---|
| 142 | * @return Document
|
---|
| 143 | * @throws \Google\Service\Exception
|
---|
| 144 | */
|
---|
| 145 | public function createDocument($parent, $collectionId, Document $postBody, $optParams = [])
|
---|
| 146 | {
|
---|
| 147 | $params = ['parent' => $parent, 'collectionId' => $collectionId, 'postBody' => $postBody];
|
---|
| 148 | $params = array_merge($params, $optParams);
|
---|
| 149 | return $this->call('createDocument', [$params], Document::class);
|
---|
| 150 | }
|
---|
| 151 | /**
|
---|
| 152 | * Deletes a document. (documents.delete)
|
---|
| 153 | *
|
---|
| 154 | * @param string $name Required. The resource name of the Document to delete. In
|
---|
| 155 | * the format:
|
---|
| 156 | * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
|
---|
| 157 | * @param array $optParams Optional parameters.
|
---|
| 158 | *
|
---|
| 159 | * @opt_param bool currentDocument.exists When set to `true`, the target
|
---|
| 160 | * document must exist. When set to `false`, the target document must not exist.
|
---|
| 161 | * @opt_param string currentDocument.updateTime When set, the target document
|
---|
| 162 | * must exist and have been last updated at that time. Timestamp must be
|
---|
| 163 | * microsecond aligned.
|
---|
| 164 | * @return FirestoreEmpty
|
---|
| 165 | * @throws \Google\Service\Exception
|
---|
| 166 | */
|
---|
| 167 | public function delete($name, $optParams = [])
|
---|
| 168 | {
|
---|
| 169 | $params = ['name' => $name];
|
---|
| 170 | $params = array_merge($params, $optParams);
|
---|
| 171 | return $this->call('delete', [$params], FirestoreEmpty::class);
|
---|
| 172 | }
|
---|
| 173 | /**
|
---|
| 174 | * Gets a single document. (documents.get)
|
---|
| 175 | *
|
---|
| 176 | * @param string $name Required. The resource name of the Document to get. In
|
---|
| 177 | * the format:
|
---|
| 178 | * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
|
---|
| 179 | * @param array $optParams Optional parameters.
|
---|
| 180 | *
|
---|
| 181 | * @opt_param string mask.fieldPaths The list of field paths in the mask. See
|
---|
| 182 | * Document.fields for a field path syntax reference.
|
---|
| 183 | * @opt_param string readTime Reads the version of the document at the given
|
---|
| 184 | * time. This must be a microsecond precision timestamp within the past one
|
---|
| 185 | * hour, or if Point-in-Time Recovery is enabled, can additionally be a whole
|
---|
| 186 | * minute timestamp within the past 7 days.
|
---|
| 187 | * @opt_param string transaction Reads the document in a transaction.
|
---|
| 188 | * @return Document
|
---|
| 189 | * @throws \Google\Service\Exception
|
---|
| 190 | */
|
---|
| 191 | public function get($name, $optParams = [])
|
---|
| 192 | {
|
---|
| 193 | $params = ['name' => $name];
|
---|
| 194 | $params = array_merge($params, $optParams);
|
---|
| 195 | return $this->call('get', [$params], Document::class);
|
---|
| 196 | }
|
---|
| 197 | /**
|
---|
| 198 | * Lists documents. (documents.listProjectsDatabasesDocuments)
|
---|
| 199 | *
|
---|
| 200 | * @param string $parent Required. The parent resource name. In the format:
|
---|
| 201 | * `projects/{project_id}/databases/{database_id}/documents` or
|
---|
| 202 | * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
|
---|
| 203 | * For example: `projects/my-project/databases/my-database/documents` or
|
---|
| 204 | * `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
|
---|
| 205 | * @param string $collectionId Optional. The collection ID, relative to
|
---|
| 206 | * `parent`, to list. For example: `chatrooms` or `messages`. This is optional,
|
---|
| 207 | * and when not provided, Firestore will list documents from all collections
|
---|
| 208 | * under the provided `parent`.
|
---|
| 209 | * @param array $optParams Optional parameters.
|
---|
| 210 | *
|
---|
| 211 | * @opt_param string mask.fieldPaths The list of field paths in the mask. See
|
---|
| 212 | * Document.fields for a field path syntax reference.
|
---|
| 213 | * @opt_param string orderBy Optional. The optional ordering of the documents to
|
---|
| 214 | * return. For example: `priority desc, __name__ desc`. This mirrors the `ORDER
|
---|
| 215 | * BY` used in Firestore queries but in a string representation. When absent,
|
---|
| 216 | * documents are ordered based on `__name__ ASC`.
|
---|
| 217 | * @opt_param int pageSize Optional. The maximum number of documents to return
|
---|
| 218 | * in a single response. Firestore may return fewer than this value.
|
---|
| 219 | * @opt_param string pageToken Optional. A page token, received from a previous
|
---|
| 220 | * `ListDocuments` response. Provide this to retrieve the subsequent page. When
|
---|
| 221 | * paginating, all other parameters (with the exception of `page_size`) must
|
---|
| 222 | * match the values set in the request that generated the page token.
|
---|
| 223 | * @opt_param string readTime Perform the read at the provided time. This must
|
---|
| 224 | * be a microsecond precision timestamp within the past one hour, or if Point-
|
---|
| 225 | * in-Time Recovery is enabled, can additionally be a whole minute timestamp
|
---|
| 226 | * within the past 7 days.
|
---|
| 227 | * @opt_param bool showMissing If the list should show missing documents. A
|
---|
| 228 | * document is missing if it does not exist, but there are sub-documents nested
|
---|
| 229 | * underneath it. When true, such missing documents will be returned with a key
|
---|
| 230 | * but will not have fields, `create_time`, or `update_time` set. Requests with
|
---|
| 231 | * `show_missing` may not specify `where` or `order_by`.
|
---|
| 232 | * @opt_param string transaction Perform the read as part of an already active
|
---|
| 233 | * transaction.
|
---|
| 234 | * @return ListDocumentsResponse
|
---|
| 235 | * @throws \Google\Service\Exception
|
---|
| 236 | */
|
---|
| 237 | public function listProjectsDatabasesDocuments($parent, $collectionId, $optParams = [])
|
---|
| 238 | {
|
---|
| 239 | $params = ['parent' => $parent, 'collectionId' => $collectionId];
|
---|
| 240 | $params = array_merge($params, $optParams);
|
---|
| 241 | return $this->call('list', [$params], ListDocumentsResponse::class);
|
---|
| 242 | }
|
---|
| 243 | /**
|
---|
| 244 | * Lists all the collection IDs underneath a document.
|
---|
| 245 | * (documents.listCollectionIds)
|
---|
| 246 | *
|
---|
| 247 | * @param string $parent Required. The parent document. In the format:
|
---|
| 248 | * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
|
---|
| 249 | * For example: `projects/my-project/databases/my-
|
---|
| 250 | * database/documents/chatrooms/my-chatroom`
|
---|
| 251 | * @param ListCollectionIdsRequest $postBody
|
---|
| 252 | * @param array $optParams Optional parameters.
|
---|
| 253 | * @return ListCollectionIdsResponse
|
---|
| 254 | * @throws \Google\Service\Exception
|
---|
| 255 | */
|
---|
| 256 | public function listCollectionIds($parent, ListCollectionIdsRequest $postBody, $optParams = [])
|
---|
| 257 | {
|
---|
| 258 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
| 259 | $params = array_merge($params, $optParams);
|
---|
| 260 | return $this->call('listCollectionIds', [$params], ListCollectionIdsResponse::class);
|
---|
| 261 | }
|
---|
| 262 | /**
|
---|
| 263 | * Lists documents. (documents.listDocuments)
|
---|
| 264 | *
|
---|
| 265 | * @param string $parent Required. The parent resource name. In the format:
|
---|
| 266 | * `projects/{project_id}/databases/{database_id}/documents` or
|
---|
| 267 | * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
|
---|
| 268 | * For example: `projects/my-project/databases/my-database/documents` or
|
---|
| 269 | * `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
|
---|
| 270 | * @param string $collectionId Optional. The collection ID, relative to
|
---|
| 271 | * `parent`, to list. For example: `chatrooms` or `messages`. This is optional,
|
---|
| 272 | * and when not provided, Firestore will list documents from all collections
|
---|
| 273 | * under the provided `parent`.
|
---|
| 274 | * @param array $optParams Optional parameters.
|
---|
| 275 | *
|
---|
| 276 | * @opt_param string mask.fieldPaths The list of field paths in the mask. See
|
---|
| 277 | * Document.fields for a field path syntax reference.
|
---|
| 278 | * @opt_param string orderBy Optional. The optional ordering of the documents to
|
---|
| 279 | * return. For example: `priority desc, __name__ desc`. This mirrors the `ORDER
|
---|
| 280 | * BY` used in Firestore queries but in a string representation. When absent,
|
---|
| 281 | * documents are ordered based on `__name__ ASC`.
|
---|
| 282 | * @opt_param int pageSize Optional. The maximum number of documents to return
|
---|
| 283 | * in a single response. Firestore may return fewer than this value.
|
---|
| 284 | * @opt_param string pageToken Optional. A page token, received from a previous
|
---|
| 285 | * `ListDocuments` response. Provide this to retrieve the subsequent page. When
|
---|
| 286 | * paginating, all other parameters (with the exception of `page_size`) must
|
---|
| 287 | * match the values set in the request that generated the page token.
|
---|
| 288 | * @opt_param string readTime Perform the read at the provided time. This must
|
---|
| 289 | * be a microsecond precision timestamp within the past one hour, or if Point-
|
---|
| 290 | * in-Time Recovery is enabled, can additionally be a whole minute timestamp
|
---|
| 291 | * within the past 7 days.
|
---|
| 292 | * @opt_param bool showMissing If the list should show missing documents. A
|
---|
| 293 | * document is missing if it does not exist, but there are sub-documents nested
|
---|
| 294 | * underneath it. When true, such missing documents will be returned with a key
|
---|
| 295 | * but will not have fields, `create_time`, or `update_time` set. Requests with
|
---|
| 296 | * `show_missing` may not specify `where` or `order_by`.
|
---|
| 297 | * @opt_param string transaction Perform the read as part of an already active
|
---|
| 298 | * transaction.
|
---|
| 299 | * @return ListDocumentsResponse
|
---|
| 300 | * @throws \Google\Service\Exception
|
---|
| 301 | */
|
---|
| 302 | public function listDocuments($parent, $collectionId, $optParams = [])
|
---|
| 303 | {
|
---|
| 304 | $params = ['parent' => $parent, 'collectionId' => $collectionId];
|
---|
| 305 | $params = array_merge($params, $optParams);
|
---|
| 306 | return $this->call('listDocuments', [$params], ListDocumentsResponse::class);
|
---|
| 307 | }
|
---|
| 308 | /**
|
---|
| 309 | * Listens to changes. This method is only available via gRPC or WebChannel (not
|
---|
| 310 | * REST). (documents.listen)
|
---|
| 311 | *
|
---|
| 312 | * @param string $database Required. The database name. In the format:
|
---|
| 313 | * `projects/{project_id}/databases/{database_id}`.
|
---|
| 314 | * @param ListenRequest $postBody
|
---|
| 315 | * @param array $optParams Optional parameters.
|
---|
| 316 | * @return ListenResponse
|
---|
| 317 | * @throws \Google\Service\Exception
|
---|
| 318 | */
|
---|
| 319 | public function listen($database, ListenRequest $postBody, $optParams = [])
|
---|
| 320 | {
|
---|
| 321 | $params = ['database' => $database, 'postBody' => $postBody];
|
---|
| 322 | $params = array_merge($params, $optParams);
|
---|
| 323 | return $this->call('listen', [$params], ListenResponse::class);
|
---|
| 324 | }
|
---|
| 325 | /**
|
---|
| 326 | * Partitions a query by returning partition cursors that can be used to run the
|
---|
| 327 | * query in parallel. The returned partition cursors are split points that can
|
---|
| 328 | * be used by RunQuery as starting/end points for the query results.
|
---|
| 329 | * (documents.partitionQuery)
|
---|
| 330 | *
|
---|
| 331 | * @param string $parent Required. The parent resource name. In the format:
|
---|
| 332 | * `projects/{project_id}/databases/{database_id}/documents`. Document resource
|
---|
| 333 | * names are not supported; only database resource names can be specified.
|
---|
| 334 | * @param PartitionQueryRequest $postBody
|
---|
| 335 | * @param array $optParams Optional parameters.
|
---|
| 336 | * @return PartitionQueryResponse
|
---|
| 337 | * @throws \Google\Service\Exception
|
---|
| 338 | */
|
---|
| 339 | public function partitionQuery($parent, PartitionQueryRequest $postBody, $optParams = [])
|
---|
| 340 | {
|
---|
| 341 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
| 342 | $params = array_merge($params, $optParams);
|
---|
| 343 | return $this->call('partitionQuery', [$params], PartitionQueryResponse::class);
|
---|
| 344 | }
|
---|
| 345 | /**
|
---|
| 346 | * Updates or inserts a document. (documents.patch)
|
---|
| 347 | *
|
---|
| 348 | * @param string $name The resource name of the document, for example
|
---|
| 349 | * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
|
---|
| 350 | * @param Document $postBody
|
---|
| 351 | * @param array $optParams Optional parameters.
|
---|
| 352 | *
|
---|
| 353 | * @opt_param bool currentDocument.exists When set to `true`, the target
|
---|
| 354 | * document must exist. When set to `false`, the target document must not exist.
|
---|
| 355 | * @opt_param string currentDocument.updateTime When set, the target document
|
---|
| 356 | * must exist and have been last updated at that time. Timestamp must be
|
---|
| 357 | * microsecond aligned.
|
---|
| 358 | * @opt_param string mask.fieldPaths The list of field paths in the mask. See
|
---|
| 359 | * Document.fields for a field path syntax reference.
|
---|
| 360 | * @opt_param string updateMask.fieldPaths The list of field paths in the mask.
|
---|
| 361 | * See Document.fields for a field path syntax reference.
|
---|
| 362 | * @return Document
|
---|
| 363 | * @throws \Google\Service\Exception
|
---|
| 364 | */
|
---|
| 365 | public function patch($name, Document $postBody, $optParams = [])
|
---|
| 366 | {
|
---|
| 367 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 368 | $params = array_merge($params, $optParams);
|
---|
| 369 | return $this->call('patch', [$params], Document::class);
|
---|
| 370 | }
|
---|
| 371 | /**
|
---|
| 372 | * Rolls back a transaction. (documents.rollback)
|
---|
| 373 | *
|
---|
| 374 | * @param string $database Required. The database name. In the format:
|
---|
| 375 | * `projects/{project_id}/databases/{database_id}`.
|
---|
| 376 | * @param RollbackRequest $postBody
|
---|
| 377 | * @param array $optParams Optional parameters.
|
---|
| 378 | * @return FirestoreEmpty
|
---|
| 379 | * @throws \Google\Service\Exception
|
---|
| 380 | */
|
---|
| 381 | public function rollback($database, RollbackRequest $postBody, $optParams = [])
|
---|
| 382 | {
|
---|
| 383 | $params = ['database' => $database, 'postBody' => $postBody];
|
---|
| 384 | $params = array_merge($params, $optParams);
|
---|
| 385 | return $this->call('rollback', [$params], FirestoreEmpty::class);
|
---|
| 386 | }
|
---|
| 387 | /**
|
---|
| 388 | * Runs an aggregation query. Rather than producing Document results like
|
---|
| 389 | * Firestore.RunQuery, this API allows running an aggregation to produce a
|
---|
| 390 | * series of AggregationResult server-side. High-Level Example: ``` -- Return
|
---|
| 391 | * the number of documents in table given a filter. SELECT COUNT(*) FROM (
|
---|
| 392 | * SELECT * FROM k where a = true ); ``` (documents.runAggregationQuery)
|
---|
| 393 | *
|
---|
| 394 | * @param string $parent Required. The parent resource name. In the format:
|
---|
| 395 | * `projects/{project_id}/databases/{database_id}/documents` or
|
---|
| 396 | * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
|
---|
| 397 | * For example: `projects/my-project/databases/my-database/documents` or
|
---|
| 398 | * `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
|
---|
| 399 | * @param RunAggregationQueryRequest $postBody
|
---|
| 400 | * @param array $optParams Optional parameters.
|
---|
| 401 | * @return RunAggregationQueryResponse
|
---|
| 402 | * @throws \Google\Service\Exception
|
---|
| 403 | */
|
---|
| 404 | public function runAggregationQuery($parent, RunAggregationQueryRequest $postBody, $optParams = [])
|
---|
| 405 | {
|
---|
| 406 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
| 407 | $params = array_merge($params, $optParams);
|
---|
| 408 | return $this->call('runAggregationQuery', [$params], RunAggregationQueryResponse::class);
|
---|
| 409 | }
|
---|
| 410 | /**
|
---|
| 411 | * Runs a query. (documents.runQuery)
|
---|
| 412 | *
|
---|
| 413 | * @param string $parent Required. The parent resource name. In the format:
|
---|
| 414 | * `projects/{project_id}/databases/{database_id}/documents` or
|
---|
| 415 | * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
|
---|
| 416 | * For example: `projects/my-project/databases/my-database/documents` or
|
---|
| 417 | * `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
|
---|
| 418 | * @param RunQueryRequest $postBody
|
---|
| 419 | * @param array $optParams Optional parameters.
|
---|
| 420 | * @return RunQueryResponse
|
---|
| 421 | * @throws \Google\Service\Exception
|
---|
| 422 | */
|
---|
| 423 | public function runQuery($parent, RunQueryRequest $postBody, $optParams = [])
|
---|
| 424 | {
|
---|
| 425 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
| 426 | $params = array_merge($params, $optParams);
|
---|
| 427 | return $this->call('runQuery', [$params], RunQueryResponse::class);
|
---|
| 428 | }
|
---|
| 429 | /**
|
---|
| 430 | * Streams batches of document updates and deletes, in order. This method is
|
---|
| 431 | * only available via gRPC or WebChannel (not REST). (documents.write)
|
---|
| 432 | *
|
---|
| 433 | * @param string $database Required. The database name. In the format:
|
---|
| 434 | * `projects/{project_id}/databases/{database_id}`. This is only required in the
|
---|
| 435 | * first message.
|
---|
| 436 | * @param WriteRequest $postBody
|
---|
| 437 | * @param array $optParams Optional parameters.
|
---|
| 438 | * @return WriteResponse
|
---|
| 439 | * @throws \Google\Service\Exception
|
---|
| 440 | */
|
---|
| 441 | public function write($database, WriteRequest $postBody, $optParams = [])
|
---|
| 442 | {
|
---|
| 443 | $params = ['database' => $database, 'postBody' => $postBody];
|
---|
| 444 | $params = array_merge($params, $optParams);
|
---|
| 445 | return $this->call('write', [$params], WriteResponse::class);
|
---|
| 446 | }
|
---|
| 447 | }
|
---|
| 448 |
|
---|
| 449 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 450 | class_alias(ProjectsDatabasesDocuments::class, 'Google_Service_Firestore_Resource_ProjectsDatabasesDocuments');
|
---|