From cf3bac85fc4b0eceec559b4842215f3036736597 Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Thu, 28 Jul 2022 12:07:43 -0700 Subject: [PATCH 1/3] owlbot changes to firestore --- .../src/Admin/V1/ExportDocumentsMetadata.php | 4 +- .../src/Admin/V1/ExportDocumentsRequest.php | 4 +- Firestore/src/Admin/V1/Field/IndexConfig.php | 4 +- .../src/Admin/V1/FieldOperationMetadata.php | 4 +- .../src/Admin/V1/ImportDocumentsMetadata.php | 4 +- .../src/Admin/V1/ImportDocumentsRequest.php | 4 +- Firestore/src/Admin/V1/Index.php | 4 +- .../src/Admin/V1/ListDatabasesResponse.php | 4 +- Firestore/src/Admin/V1/ListFieldsResponse.php | 4 +- .../src/Admin/V1/ListIndexesResponse.php | 4 +- Firestore/src/V1/ArrayValue.php | 4 +- Firestore/src/V1/BatchGetDocumentsRequest.php | 4 +- Firestore/src/V1/BatchWriteRequest.php | 4 +- Firestore/src/V1/BatchWriteResponse.php | 8 +- Firestore/src/V1/CommitRequest.php | 4 +- Firestore/src/V1/CommitResponse.php | 4 +- Firestore/src/V1/Cursor.php | 4 +- Firestore/src/V1/DocumentChange.php | 8 +- Firestore/src/V1/DocumentDelete.php | 4 +- Firestore/src/V1/DocumentMask.php | 4 +- Firestore/src/V1/DocumentRemove.php | 4 +- Firestore/src/V1/DocumentTransform.php | 4 +- .../src/V1/ListCollectionIdsResponse.php | 4 +- Firestore/src/V1/ListDocumentsResponse.php | 4 +- Firestore/src/V1/PartitionQueryResponse.php | 4 +- Firestore/src/V1/StructuredQuery.php | 8 +- .../V1/StructuredQuery/CompositeFilter.php | 4 +- .../CompositeFilter/Operator.php | 10 +- .../src/V1/StructuredQuery/Projection.php | 4 +- Firestore/src/V1/Target/DocumentsTarget.php | 4 +- Firestore/src/V1/TargetChange.php | 4 +- Firestore/src/V1/TransactionOptions.php | 8 +- .../src/V1/TransactionOptions/PBReadOnly.php | 84 ++++++++++ .../src/V1/TransactionOptions_ReadOnly.php | 6 +- Firestore/src/V1/Write.php | 4 +- Firestore/src/V1/WriteRequest.php | 4 +- Firestore/src/V1/WriteResponse.php | 4 +- Firestore/src/V1/WriteResult.php | 4 +- .../Admin/V1/FirestoreAdminClientTest.php | 150 +++++++++--------- .../tests/Unit/V1/FirestoreClientTest.php | 142 ++++++++--------- 40 files changed, 318 insertions(+), 230 deletions(-) create mode 100644 Firestore/src/V1/TransactionOptions/PBReadOnly.php diff --git a/Firestore/src/Admin/V1/ExportDocumentsMetadata.php b/Firestore/src/Admin/V1/ExportDocumentsMetadata.php index 8133824dfd77..b09636f6bf5b 100644 --- a/Firestore/src/Admin/V1/ExportDocumentsMetadata.php +++ b/Firestore/src/Admin/V1/ExportDocumentsMetadata.php @@ -77,7 +77,7 @@ class ExportDocumentsMetadata extends \Google\Protobuf\Internal\Message * The progress, in documents, of this operation. * @type \Google\Cloud\Firestore\Admin\V1\Progress $progress_bytes * The progress, in bytes, of this operation. - * @type string[]|\Google\Protobuf\Internal\RepeatedField $collection_ids + * @type array|\Google\Protobuf\Internal\RepeatedField $collection_ids * Which collection ids are being exported. * @type string $output_uri_prefix * Where the entities are being exported to. @@ -275,7 +275,7 @@ public function getCollectionIds() * Which collection ids are being exported. * * Generated from protobuf field repeated string collection_ids = 6; - * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setCollectionIds($var) diff --git a/Firestore/src/Admin/V1/ExportDocumentsRequest.php b/Firestore/src/Admin/V1/ExportDocumentsRequest.php index c9eaec70e4af..0192227efe1f 100644 --- a/Firestore/src/Admin/V1/ExportDocumentsRequest.php +++ b/Firestore/src/Admin/V1/ExportDocumentsRequest.php @@ -51,7 +51,7 @@ class ExportDocumentsRequest extends \Google\Protobuf\Internal\Message * @type string $name * Required. Database to export. Should be of the form: * `projects/{project_id}/databases/{database_id}`. - * @type string[]|\Google\Protobuf\Internal\RepeatedField $collection_ids + * @type array|\Google\Protobuf\Internal\RepeatedField $collection_ids * Which collection ids to export. Unspecified means all collections. * @type string $output_uri_prefix * The output URI. Currently only supports Google Cloud Storage URIs of the @@ -112,7 +112,7 @@ public function getCollectionIds() * Which collection ids to export. Unspecified means all collections. * * Generated from protobuf field repeated string collection_ids = 2; - * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setCollectionIds($var) diff --git a/Firestore/src/Admin/V1/Field/IndexConfig.php b/Firestore/src/Admin/V1/Field/IndexConfig.php index 9f1ec0b36987..e4a2d6d3ca44 100644 --- a/Firestore/src/Admin/V1/Field/IndexConfig.php +++ b/Firestore/src/Admin/V1/Field/IndexConfig.php @@ -55,7 +55,7 @@ class IndexConfig extends \Google\Protobuf\Internal\Message * @param array $data { * Optional. Data for populating the Message object. * - * @type \Google\Cloud\Firestore\Admin\V1\Index[]|\Google\Protobuf\Internal\RepeatedField $indexes + * @type array<\Google\Cloud\Firestore\Admin\V1\Index>|\Google\Protobuf\Internal\RepeatedField $indexes * The indexes supported for this field. * @type bool $uses_ancestor_config * Output only. When true, the `Field`'s index configuration is set from the @@ -94,7 +94,7 @@ public function getIndexes() * The indexes supported for this field. * * Generated from protobuf field repeated .google.firestore.admin.v1.Index indexes = 1; - * @param \Google\Cloud\Firestore\Admin\V1\Index[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array<\Google\Cloud\Firestore\Admin\V1\Index>|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setIndexes($var) diff --git a/Firestore/src/Admin/V1/FieldOperationMetadata.php b/Firestore/src/Admin/V1/FieldOperationMetadata.php index c567c55a98e2..9d11d603f533 100644 --- a/Firestore/src/Admin/V1/FieldOperationMetadata.php +++ b/Firestore/src/Admin/V1/FieldOperationMetadata.php @@ -82,7 +82,7 @@ class FieldOperationMetadata extends \Google\Protobuf\Internal\Message * @type string $field * The field resource that this operation is acting on. For example: * `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_path}` - * @type \Google\Cloud\Firestore\Admin\V1\FieldOperationMetadata\IndexConfigDelta[]|\Google\Protobuf\Internal\RepeatedField $index_config_deltas + * @type array<\Google\Cloud\Firestore\Admin\V1\FieldOperationMetadata\IndexConfigDelta>|\Google\Protobuf\Internal\RepeatedField $index_config_deltas * A list of [IndexConfigDelta][google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta], which describe the intent of this * operation. * @type int $state @@ -219,7 +219,7 @@ public function getIndexConfigDeltas() * operation. * * Generated from protobuf field repeated .google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta index_config_deltas = 4; - * @param \Google\Cloud\Firestore\Admin\V1\FieldOperationMetadata\IndexConfigDelta[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array<\Google\Cloud\Firestore\Admin\V1\FieldOperationMetadata\IndexConfigDelta>|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setIndexConfigDeltas($var) diff --git a/Firestore/src/Admin/V1/ImportDocumentsMetadata.php b/Firestore/src/Admin/V1/ImportDocumentsMetadata.php index 8bd59ba2117b..89de31d55b33 100644 --- a/Firestore/src/Admin/V1/ImportDocumentsMetadata.php +++ b/Firestore/src/Admin/V1/ImportDocumentsMetadata.php @@ -77,7 +77,7 @@ class ImportDocumentsMetadata extends \Google\Protobuf\Internal\Message * The progress, in documents, of this operation. * @type \Google\Cloud\Firestore\Admin\V1\Progress $progress_bytes * The progress, in bytes, of this operation. - * @type string[]|\Google\Protobuf\Internal\RepeatedField $collection_ids + * @type array|\Google\Protobuf\Internal\RepeatedField $collection_ids * Which collection ids are being imported. * @type string $input_uri_prefix * The location of the documents being imported. @@ -275,7 +275,7 @@ public function getCollectionIds() * Which collection ids are being imported. * * Generated from protobuf field repeated string collection_ids = 6; - * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setCollectionIds($var) diff --git a/Firestore/src/Admin/V1/ImportDocumentsRequest.php b/Firestore/src/Admin/V1/ImportDocumentsRequest.php index c7698a294bc5..f292e45754aa 100644 --- a/Firestore/src/Admin/V1/ImportDocumentsRequest.php +++ b/Firestore/src/Admin/V1/ImportDocumentsRequest.php @@ -49,7 +49,7 @@ class ImportDocumentsRequest extends \Google\Protobuf\Internal\Message * @type string $name * Required. Database to import into. Should be of the form: * `projects/{project_id}/databases/{database_id}`. - * @type string[]|\Google\Protobuf\Internal\RepeatedField $collection_ids + * @type array|\Google\Protobuf\Internal\RepeatedField $collection_ids * Which collection ids to import. Unspecified means all collections included * in the import. * @type string $input_uri_prefix @@ -110,7 +110,7 @@ public function getCollectionIds() * in the import. * * Generated from protobuf field repeated string collection_ids = 2; - * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setCollectionIds($var) diff --git a/Firestore/src/Admin/V1/Index.php b/Firestore/src/Admin/V1/Index.php index d3e7a5e5a78d..c85d623f5de7 100644 --- a/Firestore/src/Admin/V1/Index.php +++ b/Firestore/src/Admin/V1/Index.php @@ -75,7 +75,7 @@ class Index extends \Google\Protobuf\Internal\Message * Indexes with a collection group query scope specified allow queries against * all collections descended from a specific document, specified at query * time, and that have the same collection id as this index. - * @type \Google\Cloud\Firestore\Admin\V1\Index\IndexField[]|\Google\Protobuf\Internal\RepeatedField $fields + * @type array<\Google\Cloud\Firestore\Admin\V1\Index\IndexField>|\Google\Protobuf\Internal\RepeatedField $fields * The fields supported by this index. * For composite indexes, this is always 2 or more fields. * The last field entry is always for the field path `__name__`. If, on @@ -193,7 +193,7 @@ public function getFields() * field path equal to the field path of the associated field. * * Generated from protobuf field repeated .google.firestore.admin.v1.Index.IndexField fields = 3; - * @param \Google\Cloud\Firestore\Admin\V1\Index\IndexField[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array<\Google\Cloud\Firestore\Admin\V1\Index\IndexField>|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setFields($var) diff --git a/Firestore/src/Admin/V1/ListDatabasesResponse.php b/Firestore/src/Admin/V1/ListDatabasesResponse.php index dd8b9749422a..33aef88989c6 100644 --- a/Firestore/src/Admin/V1/ListDatabasesResponse.php +++ b/Firestore/src/Admin/V1/ListDatabasesResponse.php @@ -28,7 +28,7 @@ class ListDatabasesResponse extends \Google\Protobuf\Internal\Message * @param array $data { * Optional. Data for populating the Message object. * - * @type \Google\Cloud\Firestore\Admin\V1\Database[]|\Google\Protobuf\Internal\RepeatedField $databases + * @type array<\Google\Cloud\Firestore\Admin\V1\Database>|\Google\Protobuf\Internal\RepeatedField $databases * The databases in the project. * } */ @@ -52,7 +52,7 @@ public function getDatabases() * The databases in the project. * * Generated from protobuf field repeated .google.firestore.admin.v1.Database databases = 1; - * @param \Google\Cloud\Firestore\Admin\V1\Database[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array<\Google\Cloud\Firestore\Admin\V1\Database>|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setDatabases($var) diff --git a/Firestore/src/Admin/V1/ListFieldsResponse.php b/Firestore/src/Admin/V1/ListFieldsResponse.php index 906c00e48bb8..bcee6d6230a5 100644 --- a/Firestore/src/Admin/V1/ListFieldsResponse.php +++ b/Firestore/src/Admin/V1/ListFieldsResponse.php @@ -35,7 +35,7 @@ class ListFieldsResponse extends \Google\Protobuf\Internal\Message * @param array $data { * Optional. Data for populating the Message object. * - * @type \Google\Cloud\Firestore\Admin\V1\Field[]|\Google\Protobuf\Internal\RepeatedField $fields + * @type array<\Google\Cloud\Firestore\Admin\V1\Field>|\Google\Protobuf\Internal\RepeatedField $fields * The requested fields. * @type string $next_page_token * A page token that may be used to request another page of results. If blank, @@ -62,7 +62,7 @@ public function getFields() * The requested fields. * * Generated from protobuf field repeated .google.firestore.admin.v1.Field fields = 1; - * @param \Google\Cloud\Firestore\Admin\V1\Field[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array<\Google\Cloud\Firestore\Admin\V1\Field>|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setFields($var) diff --git a/Firestore/src/Admin/V1/ListIndexesResponse.php b/Firestore/src/Admin/V1/ListIndexesResponse.php index a10d92ef8114..2eb06c68a731 100644 --- a/Firestore/src/Admin/V1/ListIndexesResponse.php +++ b/Firestore/src/Admin/V1/ListIndexesResponse.php @@ -35,7 +35,7 @@ class ListIndexesResponse extends \Google\Protobuf\Internal\Message * @param array $data { * Optional. Data for populating the Message object. * - * @type \Google\Cloud\Firestore\Admin\V1\Index[]|\Google\Protobuf\Internal\RepeatedField $indexes + * @type array<\Google\Cloud\Firestore\Admin\V1\Index>|\Google\Protobuf\Internal\RepeatedField $indexes * The requested indexes. * @type string $next_page_token * A page token that may be used to request another page of results. If blank, @@ -62,7 +62,7 @@ public function getIndexes() * The requested indexes. * * Generated from protobuf field repeated .google.firestore.admin.v1.Index indexes = 1; - * @param \Google\Cloud\Firestore\Admin\V1\Index[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array<\Google\Cloud\Firestore\Admin\V1\Index>|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setIndexes($var) diff --git a/Firestore/src/V1/ArrayValue.php b/Firestore/src/V1/ArrayValue.php index 1b6d013166af..a5e67239f7a8 100644 --- a/Firestore/src/V1/ArrayValue.php +++ b/Firestore/src/V1/ArrayValue.php @@ -28,7 +28,7 @@ class ArrayValue extends \Google\Protobuf\Internal\Message * @param array $data { * Optional. Data for populating the Message object. * - * @type \Google\Cloud\Firestore\V1\Value[]|\Google\Protobuf\Internal\RepeatedField $values + * @type array<\Google\Cloud\Firestore\V1\Value>|\Google\Protobuf\Internal\RepeatedField $values * Values in the array. * } */ @@ -52,7 +52,7 @@ public function getValues() * Values in the array. * * Generated from protobuf field repeated .google.firestore.v1.Value values = 1; - * @param \Google\Cloud\Firestore\V1\Value[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array<\Google\Cloud\Firestore\V1\Value>|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setValues($var) diff --git a/Firestore/src/V1/BatchGetDocumentsRequest.php b/Firestore/src/V1/BatchGetDocumentsRequest.php index 40eddc278adf..a79137744015 100644 --- a/Firestore/src/V1/BatchGetDocumentsRequest.php +++ b/Firestore/src/V1/BatchGetDocumentsRequest.php @@ -50,7 +50,7 @@ class BatchGetDocumentsRequest extends \Google\Protobuf\Internal\Message * @type string $database * Required. The database name. In the format: * `projects/{project_id}/databases/{database_id}`. - * @type string[]|\Google\Protobuf\Internal\RepeatedField $documents + * @type array|\Google\Protobuf\Internal\RepeatedField $documents * 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 @@ -125,7 +125,7 @@ public function getDocuments() * given `database`. Duplicate names will be elided. * * Generated from protobuf field repeated string documents = 2; - * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setDocuments($var) diff --git a/Firestore/src/V1/BatchWriteRequest.php b/Firestore/src/V1/BatchWriteRequest.php index 3bdef1a977a1..c6827fe38b3a 100644 --- a/Firestore/src/V1/BatchWriteRequest.php +++ b/Firestore/src/V1/BatchWriteRequest.php @@ -47,7 +47,7 @@ class BatchWriteRequest extends \Google\Protobuf\Internal\Message * @type string $database * Required. The database name. In the format: * `projects/{project_id}/databases/{database_id}`. - * @type \Google\Cloud\Firestore\V1\Write[]|\Google\Protobuf\Internal\RepeatedField $writes + * @type array<\Google\Cloud\Firestore\V1\Write>|\Google\Protobuf\Internal\RepeatedField $writes * The writes to apply. * Method does not apply writes atomically and does not guarantee ordering. * Each write succeeds or fails independently. You cannot write to the same @@ -110,7 +110,7 @@ public function getWrites() * document more than once per request. * * Generated from protobuf field repeated .google.firestore.v1.Write writes = 2; - * @param \Google\Cloud\Firestore\V1\Write[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array<\Google\Cloud\Firestore\V1\Write>|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setWrites($var) diff --git a/Firestore/src/V1/BatchWriteResponse.php b/Firestore/src/V1/BatchWriteResponse.php index c759b7e6f6e3..36d81e370b90 100644 --- a/Firestore/src/V1/BatchWriteResponse.php +++ b/Firestore/src/V1/BatchWriteResponse.php @@ -38,11 +38,11 @@ class BatchWriteResponse extends \Google\Protobuf\Internal\Message * @param array $data { * Optional. Data for populating the Message object. * - * @type \Google\Cloud\Firestore\V1\WriteResult[]|\Google\Protobuf\Internal\RepeatedField $write_results + * @type array<\Google\Cloud\Firestore\V1\WriteResult>|\Google\Protobuf\Internal\RepeatedField $write_results * The result of applying the writes. * This i-th write result corresponds to the i-th write in the * request. - * @type \Google\Rpc\Status[]|\Google\Protobuf\Internal\RepeatedField $status + * @type array<\Google\Rpc\Status>|\Google\Protobuf\Internal\RepeatedField $status * The status of applying the writes. * This i-th write status corresponds to the i-th write in the * request. @@ -72,7 +72,7 @@ public function getWriteResults() * request. * * Generated from protobuf field repeated .google.firestore.v1.WriteResult write_results = 1; - * @param \Google\Cloud\Firestore\V1\WriteResult[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array<\Google\Cloud\Firestore\V1\WriteResult>|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setWriteResults($var) @@ -102,7 +102,7 @@ public function getStatus() * request. * * Generated from protobuf field repeated .google.rpc.Status status = 2; - * @param \Google\Rpc\Status[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array<\Google\Rpc\Status>|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setStatus($var) diff --git a/Firestore/src/V1/CommitRequest.php b/Firestore/src/V1/CommitRequest.php index 430284dd3798..4ce987f1c429 100644 --- a/Firestore/src/V1/CommitRequest.php +++ b/Firestore/src/V1/CommitRequest.php @@ -45,7 +45,7 @@ class CommitRequest extends \Google\Protobuf\Internal\Message * @type string $database * Required. The database name. In the format: * `projects/{project_id}/databases/{database_id}`. - * @type \Google\Cloud\Firestore\V1\Write[]|\Google\Protobuf\Internal\RepeatedField $writes + * @type array<\Google\Cloud\Firestore\V1\Write>|\Google\Protobuf\Internal\RepeatedField $writes * The writes to apply. * Always executed atomically and in order. * @type string $transaction @@ -102,7 +102,7 @@ public function getWrites() * Always executed atomically and in order. * * Generated from protobuf field repeated .google.firestore.v1.Write writes = 2; - * @param \Google\Cloud\Firestore\V1\Write[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array<\Google\Cloud\Firestore\V1\Write>|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setWrites($var) diff --git a/Firestore/src/V1/CommitResponse.php b/Firestore/src/V1/CommitResponse.php index a26a6f23e1f5..af66801a40e7 100644 --- a/Firestore/src/V1/CommitResponse.php +++ b/Firestore/src/V1/CommitResponse.php @@ -37,7 +37,7 @@ class CommitResponse extends \Google\Protobuf\Internal\Message * @param array $data { * Optional. Data for populating the Message object. * - * @type \Google\Cloud\Firestore\V1\WriteResult[]|\Google\Protobuf\Internal\RepeatedField $write_results + * @type array<\Google\Cloud\Firestore\V1\WriteResult>|\Google\Protobuf\Internal\RepeatedField $write_results * The result of applying the writes. * This i-th write result corresponds to the i-th write in the * request. @@ -70,7 +70,7 @@ public function getWriteResults() * request. * * Generated from protobuf field repeated .google.firestore.v1.WriteResult write_results = 1; - * @param \Google\Cloud\Firestore\V1\WriteResult[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array<\Google\Cloud\Firestore\V1\WriteResult>|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setWriteResults($var) diff --git a/Firestore/src/V1/Cursor.php b/Firestore/src/V1/Cursor.php index 2a4679feede2..b41af18ec0b3 100644 --- a/Firestore/src/V1/Cursor.php +++ b/Firestore/src/V1/Cursor.php @@ -37,7 +37,7 @@ class Cursor extends \Google\Protobuf\Internal\Message * @param array $data { * Optional. Data for populating the Message object. * - * @type \Google\Cloud\Firestore\V1\Value[]|\Google\Protobuf\Internal\RepeatedField $values + * @type array<\Google\Cloud\Firestore\V1\Value>|\Google\Protobuf\Internal\RepeatedField $values * 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. @@ -70,7 +70,7 @@ public function getValues() * Can contain fewer values than specified in the order by clause. * * Generated from protobuf field repeated .google.firestore.v1.Value values = 1; - * @param \Google\Cloud\Firestore\V1\Value[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array<\Google\Cloud\Firestore\V1\Value>|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setValues($var) diff --git a/Firestore/src/V1/DocumentChange.php b/Firestore/src/V1/DocumentChange.php index 6f274f50cae5..669bbe822d27 100644 --- a/Firestore/src/V1/DocumentChange.php +++ b/Firestore/src/V1/DocumentChange.php @@ -48,9 +48,9 @@ class DocumentChange extends \Google\Protobuf\Internal\Message * @type \Google\Cloud\Firestore\V1\Document $document * The new state of the [Document][google.firestore.v1.Document]. * If `mask` is set, contains only fields that were updated or added. - * @type int[]|\Google\Protobuf\Internal\RepeatedField $target_ids + * @type array|\Google\Protobuf\Internal\RepeatedField $target_ids * A set of target IDs of targets that match this document. - * @type int[]|\Google\Protobuf\Internal\RepeatedField $removed_target_ids + * @type array|\Google\Protobuf\Internal\RepeatedField $removed_target_ids * A set of target IDs for targets that no longer match this document. * } */ @@ -112,7 +112,7 @@ public function getTargetIds() * A set of target IDs of targets that match this document. * * Generated from protobuf field repeated int32 target_ids = 5; - * @param int[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setTargetIds($var) @@ -138,7 +138,7 @@ public function getRemovedTargetIds() * A set of target IDs for targets that no longer match this document. * * Generated from protobuf field repeated int32 removed_target_ids = 6; - * @param int[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setRemovedTargetIds($var) diff --git a/Firestore/src/V1/DocumentDelete.php b/Firestore/src/V1/DocumentDelete.php index 06c17a0fb35e..e156482faa9c 100644 --- a/Firestore/src/V1/DocumentDelete.php +++ b/Firestore/src/V1/DocumentDelete.php @@ -47,7 +47,7 @@ class DocumentDelete extends \Google\Protobuf\Internal\Message * * @type string $document * The resource name of the [Document][google.firestore.v1.Document] that was deleted. - * @type int[]|\Google\Protobuf\Internal\RepeatedField $removed_target_ids + * @type array|\Google\Protobuf\Internal\RepeatedField $removed_target_ids * A set of target IDs for targets that previously matched this entity. * @type \Google\Protobuf\Timestamp $read_time * The read timestamp at which the delete was observed. @@ -100,7 +100,7 @@ public function getRemovedTargetIds() * A set of target IDs for targets that previously matched this entity. * * Generated from protobuf field repeated int32 removed_target_ids = 6; - * @param int[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setRemovedTargetIds($var) diff --git a/Firestore/src/V1/DocumentMask.php b/Firestore/src/V1/DocumentMask.php index c23c41020111..94c260c4f2db 100644 --- a/Firestore/src/V1/DocumentMask.php +++ b/Firestore/src/V1/DocumentMask.php @@ -33,7 +33,7 @@ class DocumentMask extends \Google\Protobuf\Internal\Message * @param array $data { * Optional. Data for populating the Message object. * - * @type string[]|\Google\Protobuf\Internal\RepeatedField $field_paths + * @type array|\Google\Protobuf\Internal\RepeatedField $field_paths * The list of field paths in the mask. See [Document.fields][google.firestore.v1.Document.fields] for a field * path syntax reference. * } @@ -60,7 +60,7 @@ public function getFieldPaths() * path syntax reference. * * Generated from protobuf field repeated string field_paths = 1; - * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setFieldPaths($var) diff --git a/Firestore/src/V1/DocumentRemove.php b/Firestore/src/V1/DocumentRemove.php index 3be0e9e1870e..93d589dfcff7 100644 --- a/Firestore/src/V1/DocumentRemove.php +++ b/Firestore/src/V1/DocumentRemove.php @@ -48,7 +48,7 @@ class DocumentRemove extends \Google\Protobuf\Internal\Message * * @type string $document * The resource name of the [Document][google.firestore.v1.Document] that has gone out of view. - * @type int[]|\Google\Protobuf\Internal\RepeatedField $removed_target_ids + * @type array|\Google\Protobuf\Internal\RepeatedField $removed_target_ids * A set of target IDs for targets that previously matched this document. * @type \Google\Protobuf\Timestamp $read_time * The read timestamp at which the remove was observed. @@ -101,7 +101,7 @@ public function getRemovedTargetIds() * A set of target IDs for targets that previously matched this document. * * Generated from protobuf field repeated int32 removed_target_ids = 2; - * @param int[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setRemovedTargetIds($var) diff --git a/Firestore/src/V1/DocumentTransform.php b/Firestore/src/V1/DocumentTransform.php index 44a8efb3e237..efcc7199fde2 100644 --- a/Firestore/src/V1/DocumentTransform.php +++ b/Firestore/src/V1/DocumentTransform.php @@ -38,7 +38,7 @@ class DocumentTransform extends \Google\Protobuf\Internal\Message * * @type string $document * The name of the document to transform. - * @type \Google\Cloud\Firestore\V1\DocumentTransform\FieldTransform[]|\Google\Protobuf\Internal\RepeatedField $field_transforms + * @type array<\Google\Cloud\Firestore\V1\DocumentTransform\FieldTransform>|\Google\Protobuf\Internal\RepeatedField $field_transforms * The list of transformations to apply to the fields of the document, in * order. * This must not be empty. @@ -94,7 +94,7 @@ public function getFieldTransforms() * This must not be empty. * * Generated from protobuf field repeated .google.firestore.v1.DocumentTransform.FieldTransform field_transforms = 2; - * @param \Google\Cloud\Firestore\V1\DocumentTransform\FieldTransform[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array<\Google\Cloud\Firestore\V1\DocumentTransform\FieldTransform>|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setFieldTransforms($var) diff --git a/Firestore/src/V1/ListCollectionIdsResponse.php b/Firestore/src/V1/ListCollectionIdsResponse.php index 554401013af8..ef3029a60c62 100644 --- a/Firestore/src/V1/ListCollectionIdsResponse.php +++ b/Firestore/src/V1/ListCollectionIdsResponse.php @@ -34,7 +34,7 @@ class ListCollectionIdsResponse extends \Google\Protobuf\Internal\Message * @param array $data { * Optional. Data for populating the Message object. * - * @type string[]|\Google\Protobuf\Internal\RepeatedField $collection_ids + * @type array|\Google\Protobuf\Internal\RepeatedField $collection_ids * The collection ids. * @type string $next_page_token * A page token that may be used to continue the list. @@ -60,7 +60,7 @@ public function getCollectionIds() * The collection ids. * * Generated from protobuf field repeated string collection_ids = 1; - * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setCollectionIds($var) diff --git a/Firestore/src/V1/ListDocumentsResponse.php b/Firestore/src/V1/ListDocumentsResponse.php index 7e66be61b2e0..f5d6b45a6d62 100644 --- a/Firestore/src/V1/ListDocumentsResponse.php +++ b/Firestore/src/V1/ListDocumentsResponse.php @@ -34,7 +34,7 @@ class ListDocumentsResponse extends \Google\Protobuf\Internal\Message * @param array $data { * Optional. Data for populating the Message object. * - * @type \Google\Cloud\Firestore\V1\Document[]|\Google\Protobuf\Internal\RepeatedField $documents + * @type array<\Google\Cloud\Firestore\V1\Document>|\Google\Protobuf\Internal\RepeatedField $documents * The Documents found. * @type string $next_page_token * The next page token. @@ -60,7 +60,7 @@ public function getDocuments() * The Documents found. * * Generated from protobuf field repeated .google.firestore.v1.Document documents = 1; - * @param \Google\Cloud\Firestore\V1\Document[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array<\Google\Cloud\Firestore\V1\Document>|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setDocuments($var) diff --git a/Firestore/src/V1/PartitionQueryResponse.php b/Firestore/src/V1/PartitionQueryResponse.php index 9f6bcd7f4a25..4ecd49821fb2 100644 --- a/Firestore/src/V1/PartitionQueryResponse.php +++ b/Firestore/src/V1/PartitionQueryResponse.php @@ -49,7 +49,7 @@ class PartitionQueryResponse extends \Google\Protobuf\Internal\Message * @param array $data { * Optional. Data for populating the Message object. * - * @type \Google\Cloud\Firestore\V1\Cursor[]|\Google\Protobuf\Internal\RepeatedField $partitions + * @type array<\Google\Cloud\Firestore\V1\Cursor>|\Google\Protobuf\Internal\RepeatedField $partitions * Partition results. * Each partition is a split point that can be used by RunQuery as a starting * or end point for the query results. The RunQuery requests must be made with @@ -116,7 +116,7 @@ public function getPartitions() * partitioned. * * Generated from protobuf field repeated .google.firestore.v1.Cursor partitions = 1; - * @param \Google\Cloud\Firestore\V1\Cursor[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array<\Google\Cloud\Firestore\V1\Cursor>|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setPartitions($var) diff --git a/Firestore/src/V1/StructuredQuery.php b/Firestore/src/V1/StructuredQuery.php index 748f9fbcc90d..2f416425e558 100644 --- a/Firestore/src/V1/StructuredQuery.php +++ b/Firestore/src/V1/StructuredQuery.php @@ -89,11 +89,11 @@ class StructuredQuery extends \Google\Protobuf\Internal\Message * * @type \Google\Cloud\Firestore\V1\StructuredQuery\Projection $select * The projection to return. - * @type \Google\Cloud\Firestore\V1\StructuredQuery\CollectionSelector[]|\Google\Protobuf\Internal\RepeatedField $from + * @type array<\Google\Cloud\Firestore\V1\StructuredQuery\CollectionSelector>|\Google\Protobuf\Internal\RepeatedField $from * The collections to query. * @type \Google\Cloud\Firestore\V1\StructuredQuery\Filter $where * The filter to apply. - * @type \Google\Cloud\Firestore\V1\StructuredQuery\Order[]|\Google\Protobuf\Internal\RepeatedField $order_by + * @type array<\Google\Cloud\Firestore\V1\StructuredQuery\Order>|\Google\Protobuf\Internal\RepeatedField $order_by * 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 @@ -178,7 +178,7 @@ public function getFrom() * The collections to query. * * Generated from protobuf field repeated .google.firestore.v1.StructuredQuery.CollectionSelector from = 2; - * @param \Google\Cloud\Firestore\V1\StructuredQuery\CollectionSelector[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array<\Google\Cloud\Firestore\V1\StructuredQuery\CollectionSelector>|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setFrom($var) @@ -266,7 +266,7 @@ public function getOrderBy() * `SELECT * FROM Foo WHERE A > 1 ORDER BY A, __name__` * * Generated from protobuf field repeated .google.firestore.v1.StructuredQuery.Order order_by = 4; - * @param \Google\Cloud\Firestore\V1\StructuredQuery\Order[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array<\Google\Cloud\Firestore\V1\StructuredQuery\Order>|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setOrderBy($var) diff --git a/Firestore/src/V1/StructuredQuery/CompositeFilter.php b/Firestore/src/V1/StructuredQuery/CompositeFilter.php index 444e977a4a79..c6544362d36b 100644 --- a/Firestore/src/V1/StructuredQuery/CompositeFilter.php +++ b/Firestore/src/V1/StructuredQuery/CompositeFilter.php @@ -38,7 +38,7 @@ class CompositeFilter extends \Google\Protobuf\Internal\Message * * @type int $op * The operator for combining multiple filters. - * @type \Google\Cloud\Firestore\V1\StructuredQuery\Filter[]|\Google\Protobuf\Internal\RepeatedField $filters + * @type array<\Google\Cloud\Firestore\V1\StructuredQuery\Filter>|\Google\Protobuf\Internal\RepeatedField $filters * The list of filters to combine. * Requires: * * At least one filter is present. @@ -94,7 +94,7 @@ public function getFilters() * * At least one filter is present. * * Generated from protobuf field repeated .google.firestore.v1.StructuredQuery.Filter filters = 2; - * @param \Google\Cloud\Firestore\V1\StructuredQuery\Filter[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array<\Google\Cloud\Firestore\V1\StructuredQuery\Filter>|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setFilters($var) diff --git a/Firestore/src/V1/StructuredQuery/CompositeFilter/Operator.php b/Firestore/src/V1/StructuredQuery/CompositeFilter/Operator.php index 13dde00c9212..ec17fb748d0f 100644 --- a/Firestore/src/V1/StructuredQuery/CompositeFilter/Operator.php +++ b/Firestore/src/V1/StructuredQuery/CompositeFilter/Operator.php @@ -28,7 +28,7 @@ class Operator private static $valueToName = [ self::OPERATOR_UNSPECIFIED => 'OPERATOR_UNSPECIFIED', - self::PBAND => 'PBAND', + self::PBAND => 'AND', ]; public static function name($value) @@ -45,8 +45,12 @@ public static function value($name) { $const = __CLASS__ . '::' . strtoupper($name); if (!defined($const)) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no value defined for name %s', __CLASS__, $name)); + $pbconst = __CLASS__. '::PB' . strtoupper($name); + if (!defined($pbconst)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($pbconst); } return constant($const); } diff --git a/Firestore/src/V1/StructuredQuery/Projection.php b/Firestore/src/V1/StructuredQuery/Projection.php index 1383b8218f51..36909ca38947 100644 --- a/Firestore/src/V1/StructuredQuery/Projection.php +++ b/Firestore/src/V1/StructuredQuery/Projection.php @@ -30,7 +30,7 @@ class Projection extends \Google\Protobuf\Internal\Message * @param array $data { * Optional. Data for populating the Message object. * - * @type \Google\Cloud\Firestore\V1\StructuredQuery\FieldReference[]|\Google\Protobuf\Internal\RepeatedField $fields + * @type array<\Google\Cloud\Firestore\V1\StructuredQuery\FieldReference>|\Google\Protobuf\Internal\RepeatedField $fields * The fields to return. * If empty, all fields are returned. To only return the name * of the document, use `['__name__']`. @@ -60,7 +60,7 @@ public function getFields() * of the document, use `['__name__']`. * * Generated from protobuf field repeated .google.firestore.v1.StructuredQuery.FieldReference fields = 2; - * @param \Google\Cloud\Firestore\V1\StructuredQuery\FieldReference[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array<\Google\Cloud\Firestore\V1\StructuredQuery\FieldReference>|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setFields($var) diff --git a/Firestore/src/V1/Target/DocumentsTarget.php b/Firestore/src/V1/Target/DocumentsTarget.php index 38ac0c9b89cf..b96562c648cf 100644 --- a/Firestore/src/V1/Target/DocumentsTarget.php +++ b/Firestore/src/V1/Target/DocumentsTarget.php @@ -31,7 +31,7 @@ class DocumentsTarget extends \Google\Protobuf\Internal\Message * @param array $data { * Optional. Data for populating the Message object. * - * @type string[]|\Google\Protobuf\Internal\RepeatedField $documents + * @type array|\Google\Protobuf\Internal\RepeatedField $documents * 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 @@ -64,7 +64,7 @@ public function getDocuments() * the given `database`. Duplicate names will be elided. * * Generated from protobuf field repeated string documents = 2; - * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setDocuments($var) diff --git a/Firestore/src/V1/TargetChange.php b/Firestore/src/V1/TargetChange.php index fd93c1703d39..8ae1857db80a 100644 --- a/Firestore/src/V1/TargetChange.php +++ b/Firestore/src/V1/TargetChange.php @@ -65,7 +65,7 @@ class TargetChange extends \Google\Protobuf\Internal\Message * * @type int $target_change_type * The type of change that occurred. - * @type int[]|\Google\Protobuf\Internal\RepeatedField $target_ids + * @type array|\Google\Protobuf\Internal\RepeatedField $target_ids * 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. @@ -136,7 +136,7 @@ public function getTargetIds() * The order of the target IDs is not defined. * * Generated from protobuf field repeated int32 target_ids = 2; - * @param int[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setTargetIds($var) diff --git a/Firestore/src/V1/TransactionOptions.php b/Firestore/src/V1/TransactionOptions.php index 2b2160e974de..07498e58f517 100644 --- a/Firestore/src/V1/TransactionOptions.php +++ b/Firestore/src/V1/TransactionOptions.php @@ -23,7 +23,7 @@ class TransactionOptions extends \Google\Protobuf\Internal\Message * @param array $data { * Optional. Data for populating the Message object. * - * @type \Google\Cloud\Firestore\V1\TransactionOptions\ReadOnly $read_only + * @type \Google\Cloud\Firestore\V1\TransactionOptions\PBReadOnly $read_only * The transaction can only be used for read operations. * @type \Google\Cloud\Firestore\V1\TransactionOptions\ReadWrite $read_write * The transaction can be used for both read and write operations. @@ -38,7 +38,7 @@ public function __construct($data = NULL) { * The transaction can only be used for read operations. * * Generated from protobuf field .google.firestore.v1.TransactionOptions.ReadOnly read_only = 2; - * @return \Google\Cloud\Firestore\V1\TransactionOptions\ReadOnly|null + * @return \Google\Cloud\Firestore\V1\TransactionOptions\PBReadOnly|null */ public function getReadOnly() { @@ -54,12 +54,12 @@ public function hasReadOnly() * The transaction can only be used for read operations. * * Generated from protobuf field .google.firestore.v1.TransactionOptions.ReadOnly read_only = 2; - * @param \Google\Cloud\Firestore\V1\TransactionOptions\ReadOnly $var + * @param \Google\Cloud\Firestore\V1\TransactionOptions\PBReadOnly $var * @return $this */ public function setReadOnly($var) { - GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\TransactionOptions\ReadOnly::class); + GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\TransactionOptions\PBReadOnly::class); $this->writeOneof(2, $var); return $this; diff --git a/Firestore/src/V1/TransactionOptions/PBReadOnly.php b/Firestore/src/V1/TransactionOptions/PBReadOnly.php new file mode 100644 index 000000000000..4e2cb53c02a2 --- /dev/null +++ b/Firestore/src/V1/TransactionOptions/PBReadOnly.php @@ -0,0 +1,84 @@ +google.firestore.v1.TransactionOptions.ReadOnly + */ +class PBReadOnly extends \Google\Protobuf\Internal\Message +{ + protected $consistency_selector; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $read_time + * Reads documents at the given time. + * This may not be older than 60 seconds. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Firestore\V1\Common::initOnce(); + parent::__construct($data); + } + + /** + * Reads documents at the given time. + * This may not be older than 60 seconds. + * + * Generated from protobuf field .google.protobuf.Timestamp read_time = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getReadTime() + { + return $this->readOneof(2); + } + + public function hasReadTime() + { + return $this->hasOneof(2); + } + + /** + * Reads documents at the given time. + * This may not be older than 60 seconds. + * + * Generated from protobuf field .google.protobuf.Timestamp read_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setReadTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getConsistencySelector() + { + return $this->whichOneof("consistency_selector"); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(PBReadOnly::class, \Google\Cloud\Firestore\V1\TransactionOptions_ReadOnly::class); + +// Adding a class alias for backwards compatibility with the "readonly" keyword. +class_alias(PBReadOnly::class, __NAMESPACE__ . '\ReadOnly'); + diff --git a/Firestore/src/V1/TransactionOptions_ReadOnly.php b/Firestore/src/V1/TransactionOptions_ReadOnly.php index 9d30839ab38a..94a78fa27201 100644 --- a/Firestore/src/V1/TransactionOptions_ReadOnly.php +++ b/Firestore/src/V1/TransactionOptions_ReadOnly.php @@ -6,11 +6,11 @@ if (false) { /** - * This class is deprecated. Use Google\Cloud\Firestore\V1\TransactionOptions\ReadOnly instead. + * This class is deprecated. Use Google\Cloud\Firestore\V1\TransactionOptions\PBReadOnly instead. * @deprecated */ class TransactionOptions_ReadOnly {} } -class_exists(TransactionOptions\ReadOnly::class); -@trigger_error('Google\Cloud\Firestore\V1\TransactionOptions_ReadOnly is deprecated and will be removed in the next major release. Use Google\Cloud\Firestore\V1\TransactionOptions\ReadOnly instead', E_USER_DEPRECATED); +class_exists(TransactionOptions\PBReadOnly::class); +@trigger_error('Google\Cloud\Firestore\V1\TransactionOptions_ReadOnly is deprecated and will be removed in the next major release. Use Google\Cloud\Firestore\V1\TransactionOptions\PBReadOnly instead', E_USER_DEPRECATED); diff --git a/Firestore/src/V1/Write.php b/Firestore/src/V1/Write.php index 0839ec80bf5d..42dd6545d1f4 100644 --- a/Firestore/src/V1/Write.php +++ b/Firestore/src/V1/Write.php @@ -70,7 +70,7 @@ class Write extends \Google\Protobuf\Internal\Message * 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. - * @type \Google\Cloud\Firestore\V1\DocumentTransform\FieldTransform[]|\Google\Protobuf\Internal\RepeatedField $update_transforms + * @type array<\Google\Cloud\Firestore\V1\DocumentTransform\FieldTransform>|\Google\Protobuf\Internal\RepeatedField $update_transforms * The transforms to perform after update. * This field can be set only when the operation is `update`. If present, this * write is equivalent to performing `update` and `transform` to the same @@ -253,7 +253,7 @@ public function getUpdateTransforms() * document atomically and in order. * * Generated from protobuf field repeated .google.firestore.v1.DocumentTransform.FieldTransform update_transforms = 7; - * @param \Google\Cloud\Firestore\V1\DocumentTransform\FieldTransform[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array<\Google\Cloud\Firestore\V1\DocumentTransform\FieldTransform>|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setUpdateTransforms($var) diff --git a/Firestore/src/V1/WriteRequest.php b/Firestore/src/V1/WriteRequest.php index 95284103b249..58f671c69936 100644 --- a/Firestore/src/V1/WriteRequest.php +++ b/Firestore/src/V1/WriteRequest.php @@ -83,7 +83,7 @@ class WriteRequest extends \Google\Protobuf\Internal\Message * 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. - * @type \Google\Cloud\Firestore\V1\Write[]|\Google\Protobuf\Internal\RepeatedField $writes + * @type array<\Google\Cloud\Firestore\V1\Write>|\Google\Protobuf\Internal\RepeatedField $writes * The writes to apply. * Always executed atomically and in order. * This must be empty on the first request. @@ -192,7 +192,7 @@ public function getWrites() * This must not be empty on all other requests. * * Generated from protobuf field repeated .google.firestore.v1.Write writes = 3; - * @param \Google\Cloud\Firestore\V1\Write[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array<\Google\Cloud\Firestore\V1\Write>|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setWrites($var) diff --git a/Firestore/src/V1/WriteResponse.php b/Firestore/src/V1/WriteResponse.php index 01edaa8ed884..21af5f955b85 100644 --- a/Firestore/src/V1/WriteResponse.php +++ b/Firestore/src/V1/WriteResponse.php @@ -59,7 +59,7 @@ class WriteResponse extends \Google\Protobuf\Internal\Message * 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. - * @type \Google\Cloud\Firestore\V1\WriteResult[]|\Google\Protobuf\Internal\RepeatedField $write_results + * @type array<\Google\Cloud\Firestore\V1\WriteResult>|\Google\Protobuf\Internal\RepeatedField $write_results * The result of applying the writes. * This i-th write result corresponds to the i-th write in the * request. @@ -150,7 +150,7 @@ public function getWriteResults() * request. * * Generated from protobuf field repeated .google.firestore.v1.WriteResult write_results = 3; - * @param \Google\Cloud\Firestore\V1\WriteResult[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array<\Google\Cloud\Firestore\V1\WriteResult>|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setWriteResults($var) diff --git a/Firestore/src/V1/WriteResult.php b/Firestore/src/V1/WriteResult.php index b285b7c50e97..781c88778461 100644 --- a/Firestore/src/V1/WriteResult.php +++ b/Firestore/src/V1/WriteResult.php @@ -43,7 +43,7 @@ class WriteResult extends \Google\Protobuf\Internal\Message * after a `delete`. * If the write did not actually change the document, this will be the * previous update_time. - * @type \Google\Cloud\Firestore\V1\Value[]|\Google\Protobuf\Internal\RepeatedField $transform_results + * @type array<\Google\Cloud\Firestore\V1\Value>|\Google\Protobuf\Internal\RepeatedField $transform_results * The results of applying each [DocumentTransform.FieldTransform][google.firestore.v1.DocumentTransform.FieldTransform], in the * same order. * } @@ -112,7 +112,7 @@ public function getTransformResults() * same order. * * Generated from protobuf field repeated .google.firestore.v1.Value transform_results = 2; - * @param \Google\Cloud\Firestore\V1\Value[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array<\Google\Cloud\Firestore\V1\Value>|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setTransformResults($var) diff --git a/Firestore/tests/Unit/Admin/V1/FirestoreAdminClientTest.php b/Firestore/tests/Unit/Admin/V1/FirestoreAdminClientTest.php index edf3f9043830..b62806cc95f9 100644 --- a/Firestore/tests/Unit/Admin/V1/FirestoreAdminClientTest.php +++ b/Firestore/tests/Unit/Admin/V1/FirestoreAdminClientTest.php @@ -91,7 +91,7 @@ public function createIndexTest() 'credentials' => $this->createCredentials(), ]); $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, 'operationsClient' => $operationsClient, ]); @@ -113,9 +113,9 @@ public function createIndexTest() $completeOperation->setResponse($anyResponse); $operationsTransport->addResponse($completeOperation); // Mock request - $formattedParent = $client->collectionGroupName('[PROJECT]', '[DATABASE]', '[COLLECTION]'); + $formattedParent = $gapicClient->collectionGroupName('[PROJECT]', '[DATABASE]', '[COLLECTION]'); $index = new Index(); - $response = $client->createIndexLRO($formattedParent, $index); + $response = $gapicClient->createIndexLRO($formattedParent, $index); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); $apiRequests = $transport->popReceivedCalls(); @@ -160,7 +160,7 @@ public function createIndexExceptionTest() 'credentials' => $this->createCredentials(), ]); $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, 'operationsClient' => $operationsClient, ]); @@ -182,9 +182,9 @@ public function createIndexExceptionTest() ], JSON_PRETTY_PRINT); $operationsTransport->addResponse(null, $status); // Mock request - $formattedParent = $client->collectionGroupName('[PROJECT]', '[DATABASE]', '[COLLECTION]'); + $formattedParent = $gapicClient->collectionGroupName('[PROJECT]', '[DATABASE]', '[COLLECTION]'); $index = new Index(); - $response = $client->createIndexLRO($formattedParent, $index); + $response = $gapicClient->createIndexLRO($formattedParent, $index); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); $expectedOperationsRequestObject = new GetOperationRequest(); @@ -212,7 +212,7 @@ public function createIndexExceptionTest() public function deleteIndexTest() { $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, ]); $this->assertTrue($transport->isExhausted()); @@ -220,8 +220,8 @@ public function deleteIndexTest() $expectedResponse = new GPBEmpty(); $transport->addResponse($expectedResponse); // Mock request - $formattedName = $client->indexName('[PROJECT]', '[DATABASE]', '[COLLECTION]', '[INDEX]'); - $client->deleteIndex($formattedName); + $formattedName = $gapicClient->indexName('[PROJECT]', '[DATABASE]', '[COLLECTION]', '[INDEX]'); + $gapicClient->deleteIndex($formattedName); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); @@ -238,7 +238,7 @@ public function deleteIndexTest() public function deleteIndexExceptionTest() { $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, ]); $this->assertTrue($transport->isExhausted()); @@ -253,10 +253,10 @@ public function deleteIndexExceptionTest() ], JSON_PRETTY_PRINT); $transport->addResponse(null, $status); // Mock request - $formattedName = $client->indexName('[PROJECT]', '[DATABASE]', '[COLLECTION]', '[INDEX]'); + $formattedName = $gapicClient->indexName('[PROJECT]', '[DATABASE]', '[COLLECTION]', '[INDEX]'); try { - $client->deleteIndex($formattedName); - // If the $client method call did not throw, fail the test + $gapicClient->deleteIndex($formattedName); + // If the $gapicClient method call did not throw, fail the test $this->fail('Expected an ApiException, but no exception was thrown.'); } catch (ApiException $ex) { $this->assertEquals($status->code, $ex->getCode()); @@ -279,7 +279,7 @@ public function exportDocumentsTest() 'credentials' => $this->createCredentials(), ]); $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, 'operationsClient' => $operationsClient, ]); @@ -301,8 +301,8 @@ public function exportDocumentsTest() $completeOperation->setResponse($anyResponse); $operationsTransport->addResponse($completeOperation); // Mock request - $formattedName = $client->databaseName('[PROJECT]', '[DATABASE]'); - $response = $client->exportDocumentsLRO($formattedName); + $formattedName = $gapicClient->databaseName('[PROJECT]', '[DATABASE]'); + $response = $gapicClient->exportDocumentsLRO($formattedName); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); $apiRequests = $transport->popReceivedCalls(); @@ -345,7 +345,7 @@ public function exportDocumentsExceptionTest() 'credentials' => $this->createCredentials(), ]); $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, 'operationsClient' => $operationsClient, ]); @@ -367,8 +367,8 @@ public function exportDocumentsExceptionTest() ], JSON_PRETTY_PRINT); $operationsTransport->addResponse(null, $status); // Mock request - $formattedName = $client->databaseName('[PROJECT]', '[DATABASE]'); - $response = $client->exportDocumentsLRO($formattedName); + $formattedName = $gapicClient->databaseName('[PROJECT]', '[DATABASE]'); + $response = $gapicClient->exportDocumentsLRO($formattedName); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); $expectedOperationsRequestObject = new GetOperationRequest(); @@ -396,7 +396,7 @@ public function exportDocumentsExceptionTest() public function getDatabaseTest() { $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, ]); $this->assertTrue($transport->isExhausted()); @@ -412,8 +412,8 @@ public function getDatabaseTest() $expectedResponse->setEtag($etag); $transport->addResponse($expectedResponse); // Mock request - $formattedName = $client->databaseName('[PROJECT]', '[DATABASE]'); - $response = $client->getDatabase($formattedName); + $formattedName = $gapicClient->databaseName('[PROJECT]', '[DATABASE]'); + $response = $gapicClient->getDatabase($formattedName); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); @@ -431,7 +431,7 @@ public function getDatabaseTest() public function getDatabaseExceptionTest() { $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, ]); $this->assertTrue($transport->isExhausted()); @@ -446,10 +446,10 @@ public function getDatabaseExceptionTest() ], JSON_PRETTY_PRINT); $transport->addResponse(null, $status); // Mock request - $formattedName = $client->databaseName('[PROJECT]', '[DATABASE]'); + $formattedName = $gapicClient->databaseName('[PROJECT]', '[DATABASE]'); try { - $client->getDatabase($formattedName); - // If the $client method call did not throw, fail the test + $gapicClient->getDatabase($formattedName); + // If the $gapicClient method call did not throw, fail the test $this->fail('Expected an ApiException, but no exception was thrown.'); } catch (ApiException $ex) { $this->assertEquals($status->code, $ex->getCode()); @@ -466,7 +466,7 @@ public function getDatabaseExceptionTest() public function getFieldTest() { $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, ]); $this->assertTrue($transport->isExhausted()); @@ -476,8 +476,8 @@ public function getFieldTest() $expectedResponse->setName($name2); $transport->addResponse($expectedResponse); // Mock request - $formattedName = $client->fieldName('[PROJECT]', '[DATABASE]', '[COLLECTION]', '[FIELD]'); - $response = $client->getField($formattedName); + $formattedName = $gapicClient->fieldName('[PROJECT]', '[DATABASE]', '[COLLECTION]', '[FIELD]'); + $response = $gapicClient->getField($formattedName); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); @@ -495,7 +495,7 @@ public function getFieldTest() public function getFieldExceptionTest() { $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, ]); $this->assertTrue($transport->isExhausted()); @@ -510,10 +510,10 @@ public function getFieldExceptionTest() ], JSON_PRETTY_PRINT); $transport->addResponse(null, $status); // Mock request - $formattedName = $client->fieldName('[PROJECT]', '[DATABASE]', '[COLLECTION]', '[FIELD]'); + $formattedName = $gapicClient->fieldName('[PROJECT]', '[DATABASE]', '[COLLECTION]', '[FIELD]'); try { - $client->getField($formattedName); - // If the $client method call did not throw, fail the test + $gapicClient->getField($formattedName); + // If the $gapicClient method call did not throw, fail the test $this->fail('Expected an ApiException, but no exception was thrown.'); } catch (ApiException $ex) { $this->assertEquals($status->code, $ex->getCode()); @@ -530,7 +530,7 @@ public function getFieldExceptionTest() public function getIndexTest() { $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, ]); $this->assertTrue($transport->isExhausted()); @@ -540,8 +540,8 @@ public function getIndexTest() $expectedResponse->setName($name2); $transport->addResponse($expectedResponse); // Mock request - $formattedName = $client->indexName('[PROJECT]', '[DATABASE]', '[COLLECTION]', '[INDEX]'); - $response = $client->getIndex($formattedName); + $formattedName = $gapicClient->indexName('[PROJECT]', '[DATABASE]', '[COLLECTION]', '[INDEX]'); + $response = $gapicClient->getIndex($formattedName); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); @@ -559,7 +559,7 @@ public function getIndexTest() public function getIndexExceptionTest() { $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, ]); $this->assertTrue($transport->isExhausted()); @@ -574,10 +574,10 @@ public function getIndexExceptionTest() ], JSON_PRETTY_PRINT); $transport->addResponse(null, $status); // Mock request - $formattedName = $client->indexName('[PROJECT]', '[DATABASE]', '[COLLECTION]', '[INDEX]'); + $formattedName = $gapicClient->indexName('[PROJECT]', '[DATABASE]', '[COLLECTION]', '[INDEX]'); try { - $client->getIndex($formattedName); - // If the $client method call did not throw, fail the test + $gapicClient->getIndex($formattedName); + // If the $gapicClient method call did not throw, fail the test $this->fail('Expected an ApiException, but no exception was thrown.'); } catch (ApiException $ex) { $this->assertEquals($status->code, $ex->getCode()); @@ -600,7 +600,7 @@ public function importDocumentsTest() 'credentials' => $this->createCredentials(), ]); $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, 'operationsClient' => $operationsClient, ]); @@ -620,8 +620,8 @@ public function importDocumentsTest() $completeOperation->setResponse($anyResponse); $operationsTransport->addResponse($completeOperation); // Mock request - $formattedName = $client->databaseName('[PROJECT]', '[DATABASE]'); - $response = $client->importDocumentsLRO($formattedName); + $formattedName = $gapicClient->databaseName('[PROJECT]', '[DATABASE]'); + $response = $gapicClient->importDocumentsLRO($formattedName); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); $apiRequests = $transport->popReceivedCalls(); @@ -664,7 +664,7 @@ public function importDocumentsExceptionTest() 'credentials' => $this->createCredentials(), ]); $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, 'operationsClient' => $operationsClient, ]); @@ -686,8 +686,8 @@ public function importDocumentsExceptionTest() ], JSON_PRETTY_PRINT); $operationsTransport->addResponse(null, $status); // Mock request - $formattedName = $client->databaseName('[PROJECT]', '[DATABASE]'); - $response = $client->importDocumentsLRO($formattedName); + $formattedName = $gapicClient->databaseName('[PROJECT]', '[DATABASE]'); + $response = $gapicClient->importDocumentsLRO($formattedName); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); $expectedOperationsRequestObject = new GetOperationRequest(); @@ -715,7 +715,7 @@ public function importDocumentsExceptionTest() public function listDatabasesTest() { $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, ]); $this->assertTrue($transport->isExhausted()); @@ -723,8 +723,8 @@ public function listDatabasesTest() $expectedResponse = new ListDatabasesResponse(); $transport->addResponse($expectedResponse); // Mock request - $formattedParent = $client->projectName('[PROJECT]'); - $response = $client->listDatabases($formattedParent); + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $response = $gapicClient->listDatabases($formattedParent); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); @@ -742,7 +742,7 @@ public function listDatabasesTest() public function listDatabasesExceptionTest() { $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, ]); $this->assertTrue($transport->isExhausted()); @@ -757,10 +757,10 @@ public function listDatabasesExceptionTest() ], JSON_PRETTY_PRINT); $transport->addResponse(null, $status); // Mock request - $formattedParent = $client->projectName('[PROJECT]'); + $formattedParent = $gapicClient->projectName('[PROJECT]'); try { - $client->listDatabases($formattedParent); - // If the $client method call did not throw, fail the test + $gapicClient->listDatabases($formattedParent); + // If the $gapicClient method call did not throw, fail the test $this->fail('Expected an ApiException, but no exception was thrown.'); } catch (ApiException $ex) { $this->assertEquals($status->code, $ex->getCode()); @@ -777,7 +777,7 @@ public function listDatabasesExceptionTest() public function listFieldsTest() { $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, ]); $this->assertTrue($transport->isExhausted()); @@ -792,8 +792,8 @@ public function listFieldsTest() $expectedResponse->setFields($fields); $transport->addResponse($expectedResponse); // Mock request - $formattedParent = $client->collectionGroupName('[PROJECT]', '[DATABASE]', '[COLLECTION]'); - $response = $client->listFields($formattedParent); + $formattedParent = $gapicClient->collectionGroupName('[PROJECT]', '[DATABASE]', '[COLLECTION]'); + $response = $gapicClient->listFields($formattedParent); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); $this->assertSame(1, count($resources)); @@ -814,7 +814,7 @@ public function listFieldsTest() public function listFieldsExceptionTest() { $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, ]); $this->assertTrue($transport->isExhausted()); @@ -829,10 +829,10 @@ public function listFieldsExceptionTest() ], JSON_PRETTY_PRINT); $transport->addResponse(null, $status); // Mock request - $formattedParent = $client->collectionGroupName('[PROJECT]', '[DATABASE]', '[COLLECTION]'); + $formattedParent = $gapicClient->collectionGroupName('[PROJECT]', '[DATABASE]', '[COLLECTION]'); try { - $client->listFields($formattedParent); - // If the $client method call did not throw, fail the test + $gapicClient->listFields($formattedParent); + // If the $gapicClient method call did not throw, fail the test $this->fail('Expected an ApiException, but no exception was thrown.'); } catch (ApiException $ex) { $this->assertEquals($status->code, $ex->getCode()); @@ -849,7 +849,7 @@ public function listFieldsExceptionTest() public function listIndexesTest() { $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, ]); $this->assertTrue($transport->isExhausted()); @@ -864,8 +864,8 @@ public function listIndexesTest() $expectedResponse->setIndexes($indexes); $transport->addResponse($expectedResponse); // Mock request - $formattedParent = $client->collectionGroupName('[PROJECT]', '[DATABASE]', '[COLLECTION]'); - $response = $client->listIndexes($formattedParent); + $formattedParent = $gapicClient->collectionGroupName('[PROJECT]', '[DATABASE]', '[COLLECTION]'); + $response = $gapicClient->listIndexes($formattedParent); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); $this->assertSame(1, count($resources)); @@ -886,7 +886,7 @@ public function listIndexesTest() public function listIndexesExceptionTest() { $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, ]); $this->assertTrue($transport->isExhausted()); @@ -901,10 +901,10 @@ public function listIndexesExceptionTest() ], JSON_PRETTY_PRINT); $transport->addResponse(null, $status); // Mock request - $formattedParent = $client->collectionGroupName('[PROJECT]', '[DATABASE]', '[COLLECTION]'); + $formattedParent = $gapicClient->collectionGroupName('[PROJECT]', '[DATABASE]', '[COLLECTION]'); try { - $client->listIndexes($formattedParent); - // If the $client method call did not throw, fail the test + $gapicClient->listIndexes($formattedParent); + // If the $gapicClient method call did not throw, fail the test $this->fail('Expected an ApiException, but no exception was thrown.'); } catch (ApiException $ex) { $this->assertEquals($status->code, $ex->getCode()); @@ -927,7 +927,7 @@ public function updateDatabaseTest() 'credentials' => $this->createCredentials(), ]); $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, 'operationsClient' => $operationsClient, ]); @@ -956,7 +956,7 @@ public function updateDatabaseTest() $operationsTransport->addResponse($completeOperation); // Mock request $database = new Database(); - $response = $client->updateDatabase($database); + $response = $gapicClient->updateDatabase($database); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); $apiRequests = $transport->popReceivedCalls(); @@ -999,7 +999,7 @@ public function updateDatabaseExceptionTest() 'credentials' => $this->createCredentials(), ]); $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, 'operationsClient' => $operationsClient, ]); @@ -1022,7 +1022,7 @@ public function updateDatabaseExceptionTest() $operationsTransport->addResponse(null, $status); // Mock request $database = new Database(); - $response = $client->updateDatabase($database); + $response = $gapicClient->updateDatabase($database); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); $expectedOperationsRequestObject = new GetOperationRequest(); @@ -1056,7 +1056,7 @@ public function updateFieldTest() 'credentials' => $this->createCredentials(), ]); $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, 'operationsClient' => $operationsClient, ]); @@ -1081,7 +1081,7 @@ public function updateFieldTest() $field = new Field(); $fieldName = 'fieldName1265009317'; $field->setName($fieldName); - $response = $client->updateFieldLRO($field); + $response = $gapicClient->updateFieldLRO($field); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); $apiRequests = $transport->popReceivedCalls(); @@ -1124,7 +1124,7 @@ public function updateFieldExceptionTest() 'credentials' => $this->createCredentials(), ]); $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, 'operationsClient' => $operationsClient, ]); @@ -1149,7 +1149,7 @@ public function updateFieldExceptionTest() $field = new Field(); $fieldName = 'fieldName1265009317'; $field->setName($fieldName); - $response = $client->updateFieldLRO($field); + $response = $gapicClient->updateFieldLRO($field); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); $expectedOperationsRequestObject = new GetOperationRequest(); diff --git a/Firestore/tests/Unit/V1/FirestoreClientTest.php b/Firestore/tests/Unit/V1/FirestoreClientTest.php index a1f75e3aec81..7a3f474d8bd4 100644 --- a/Firestore/tests/Unit/V1/FirestoreClientTest.php +++ b/Firestore/tests/Unit/V1/FirestoreClientTest.php @@ -94,7 +94,7 @@ private function createClient(array $options = []) public function batchGetDocumentsTest() { $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, ]); $this->assertTrue($transport->isExhausted()); @@ -120,7 +120,7 @@ public function batchGetDocumentsTest() // Mock request $database = 'database1789464955'; $documents = []; - $serverStream = $client->batchGetDocuments($database, $documents); + $serverStream = $gapicClient->batchGetDocuments($database, $documents); $this->assertInstanceOf(ServerStream::class, $serverStream); $responses = iterator_to_array($serverStream->readAll()); $expectedResponses = []; @@ -146,7 +146,7 @@ public function batchGetDocumentsTest() public function batchGetDocumentsExceptionTest() { $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, ]); $status = new stdClass(); @@ -163,7 +163,7 @@ public function batchGetDocumentsExceptionTest() // Mock request $database = 'database1789464955'; $documents = []; - $serverStream = $client->batchGetDocuments($database, $documents); + $serverStream = $gapicClient->batchGetDocuments($database, $documents); $results = $serverStream->readAll(); try { iterator_to_array($results); @@ -184,14 +184,14 @@ public function batchGetDocumentsExceptionTest() public function batchWriteTest() { $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, ]); $this->assertTrue($transport->isExhausted()); // Mock response $expectedResponse = new BatchWriteResponse(); $transport->addResponse($expectedResponse); - $response = $client->batchWrite(); + $response = $gapicClient->batchWrite(); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); @@ -207,7 +207,7 @@ public function batchWriteTest() public function batchWriteExceptionTest() { $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, ]); $this->assertTrue($transport->isExhausted()); @@ -222,8 +222,8 @@ public function batchWriteExceptionTest() ], JSON_PRETTY_PRINT); $transport->addResponse(null, $status); try { - $client->batchWrite(); - // If the $client method call did not throw, fail the test + $gapicClient->batchWrite(); + // If the $gapicClient method call did not throw, fail the test $this->fail('Expected an ApiException, but no exception was thrown.'); } catch (ApiException $ex) { $this->assertEquals($status->code, $ex->getCode()); @@ -240,7 +240,7 @@ public function batchWriteExceptionTest() public function beginTransactionTest() { $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, ]); $this->assertTrue($transport->isExhausted()); @@ -251,7 +251,7 @@ public function beginTransactionTest() $transport->addResponse($expectedResponse); // Mock request $database = 'database1789464955'; - $response = $client->beginTransaction($database); + $response = $gapicClient->beginTransaction($database); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); @@ -269,7 +269,7 @@ public function beginTransactionTest() public function beginTransactionExceptionTest() { $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, ]); $this->assertTrue($transport->isExhausted()); @@ -286,8 +286,8 @@ public function beginTransactionExceptionTest() // Mock request $database = 'database1789464955'; try { - $client->beginTransaction($database); - // If the $client method call did not throw, fail the test + $gapicClient->beginTransaction($database); + // If the $gapicClient method call did not throw, fail the test $this->fail('Expected an ApiException, but no exception was thrown.'); } catch (ApiException $ex) { $this->assertEquals($status->code, $ex->getCode()); @@ -304,7 +304,7 @@ public function beginTransactionExceptionTest() public function commitTest() { $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, ]); $this->assertTrue($transport->isExhausted()); @@ -314,7 +314,7 @@ public function commitTest() // Mock request $database = 'database1789464955'; $writes = []; - $response = $client->commit($database, $writes); + $response = $gapicClient->commit($database, $writes); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); @@ -334,7 +334,7 @@ public function commitTest() public function commitExceptionTest() { $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, ]); $this->assertTrue($transport->isExhausted()); @@ -352,8 +352,8 @@ public function commitExceptionTest() $database = 'database1789464955'; $writes = []; try { - $client->commit($database, $writes); - // If the $client method call did not throw, fail the test + $gapicClient->commit($database, $writes); + // If the $gapicClient method call did not throw, fail the test $this->fail('Expected an ApiException, but no exception was thrown.'); } catch (ApiException $ex) { $this->assertEquals($status->code, $ex->getCode()); @@ -370,7 +370,7 @@ public function commitExceptionTest() public function createDocumentTest() { $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, ]); $this->assertTrue($transport->isExhausted()); @@ -384,7 +384,7 @@ public function createDocumentTest() $collectionId = 'collectionId-821242276'; $documentId = 'documentId506676927'; $document = new Document(); - $response = $client->createDocument($parent, $collectionId, $documentId, $document); + $response = $gapicClient->createDocument($parent, $collectionId, $documentId, $document); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); @@ -408,7 +408,7 @@ public function createDocumentTest() public function createDocumentExceptionTest() { $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, ]); $this->assertTrue($transport->isExhausted()); @@ -428,8 +428,8 @@ public function createDocumentExceptionTest() $documentId = 'documentId506676927'; $document = new Document(); try { - $client->createDocument($parent, $collectionId, $documentId, $document); - // If the $client method call did not throw, fail the test + $gapicClient->createDocument($parent, $collectionId, $documentId, $document); + // If the $gapicClient method call did not throw, fail the test $this->fail('Expected an ApiException, but no exception was thrown.'); } catch (ApiException $ex) { $this->assertEquals($status->code, $ex->getCode()); @@ -446,7 +446,7 @@ public function createDocumentExceptionTest() public function deleteDocumentTest() { $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, ]); $this->assertTrue($transport->isExhausted()); @@ -455,7 +455,7 @@ public function deleteDocumentTest() $transport->addResponse($expectedResponse); // Mock request $name = 'name3373707'; - $client->deleteDocument($name); + $gapicClient->deleteDocument($name); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); @@ -472,7 +472,7 @@ public function deleteDocumentTest() public function deleteDocumentExceptionTest() { $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, ]); $this->assertTrue($transport->isExhausted()); @@ -489,8 +489,8 @@ public function deleteDocumentExceptionTest() // Mock request $name = 'name3373707'; try { - $client->deleteDocument($name); - // If the $client method call did not throw, fail the test + $gapicClient->deleteDocument($name); + // If the $gapicClient method call did not throw, fail the test $this->fail('Expected an ApiException, but no exception was thrown.'); } catch (ApiException $ex) { $this->assertEquals($status->code, $ex->getCode()); @@ -507,7 +507,7 @@ public function deleteDocumentExceptionTest() public function getDocumentTest() { $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, ]); $this->assertTrue($transport->isExhausted()); @@ -518,7 +518,7 @@ public function getDocumentTest() $transport->addResponse($expectedResponse); // Mock request $name = 'name3373707'; - $response = $client->getDocument($name); + $response = $gapicClient->getDocument($name); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); @@ -536,7 +536,7 @@ public function getDocumentTest() public function getDocumentExceptionTest() { $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, ]); $this->assertTrue($transport->isExhausted()); @@ -553,8 +553,8 @@ public function getDocumentExceptionTest() // Mock request $name = 'name3373707'; try { - $client->getDocument($name); - // If the $client method call did not throw, fail the test + $gapicClient->getDocument($name); + // If the $gapicClient method call did not throw, fail the test $this->fail('Expected an ApiException, but no exception was thrown.'); } catch (ApiException $ex) { $this->assertEquals($status->code, $ex->getCode()); @@ -571,7 +571,7 @@ public function getDocumentExceptionTest() public function listCollectionIdsTest() { $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, ]); $this->assertTrue($transport->isExhausted()); @@ -587,7 +587,7 @@ public function listCollectionIdsTest() $transport->addResponse($expectedResponse); // Mock request $parent = 'parent-995424086'; - $response = $client->listCollectionIds($parent); + $response = $gapicClient->listCollectionIds($parent); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); $this->assertSame(1, count($resources)); @@ -608,7 +608,7 @@ public function listCollectionIdsTest() public function listCollectionIdsExceptionTest() { $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, ]); $this->assertTrue($transport->isExhausted()); @@ -625,8 +625,8 @@ public function listCollectionIdsExceptionTest() // Mock request $parent = 'parent-995424086'; try { - $client->listCollectionIds($parent); - // If the $client method call did not throw, fail the test + $gapicClient->listCollectionIds($parent); + // If the $gapicClient method call did not throw, fail the test $this->fail('Expected an ApiException, but no exception was thrown.'); } catch (ApiException $ex) { $this->assertEquals($status->code, $ex->getCode()); @@ -643,7 +643,7 @@ public function listCollectionIdsExceptionTest() public function listDocumentsTest() { $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, ]); $this->assertTrue($transport->isExhausted()); @@ -660,7 +660,7 @@ public function listDocumentsTest() // Mock request $parent = 'parent-995424086'; $collectionId = 'collectionId-821242276'; - $response = $client->listDocuments($parent, $collectionId); + $response = $gapicClient->listDocuments($parent, $collectionId); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); $this->assertSame(1, count($resources)); @@ -683,7 +683,7 @@ public function listDocumentsTest() public function listDocumentsExceptionTest() { $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, ]); $this->assertTrue($transport->isExhausted()); @@ -701,8 +701,8 @@ public function listDocumentsExceptionTest() $parent = 'parent-995424086'; $collectionId = 'collectionId-821242276'; try { - $client->listDocuments($parent, $collectionId); - // If the $client method call did not throw, fail the test + $gapicClient->listDocuments($parent, $collectionId); + // If the $gapicClient method call did not throw, fail the test $this->fail('Expected an ApiException, but no exception was thrown.'); } catch (ApiException $ex) { $this->assertEquals($status->code, $ex->getCode()); @@ -719,7 +719,7 @@ public function listDocumentsExceptionTest() public function listenTest() { $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, ]); $this->assertTrue($transport->isExhausted()); @@ -740,7 +740,7 @@ public function listenTest() $database3 = 'database31688906351'; $request3 = new ListenRequest(); $request3->setDatabase($database3); - $bidi = $client->listen(); + $bidi = $gapicClient->listen(); $this->assertInstanceOf(BidiStream::class, $bidi); $bidi->write($request); $responses = []; @@ -782,7 +782,7 @@ public function listenTest() public function listenExceptionTest() { $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, ]); $status = new stdClass(); @@ -796,7 +796,7 @@ public function listenExceptionTest() ], JSON_PRETTY_PRINT); $transport->setStreamingStatus($status); $this->assertTrue($transport->isExhausted()); - $bidi = $client->listen(); + $bidi = $gapicClient->listen(); $results = $bidi->closeWriteAndReadAll(); try { iterator_to_array($results); @@ -817,7 +817,7 @@ public function listenExceptionTest() public function partitionQueryTest() { $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, ]); $this->assertTrue($transport->isExhausted()); @@ -831,7 +831,7 @@ public function partitionQueryTest() $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setPartitions($partitions); $transport->addResponse($expectedResponse); - $response = $client->partitionQueryPaginated(); + $response = $gapicClient->partitionQueryPaginated(); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); $this->assertSame(1, count($resources)); @@ -850,7 +850,7 @@ public function partitionQueryTest() public function partitionQueryExceptionTest() { $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, ]); $this->assertTrue($transport->isExhausted()); @@ -865,8 +865,8 @@ public function partitionQueryExceptionTest() ], JSON_PRETTY_PRINT); $transport->addResponse(null, $status); try { - $client->partitionQueryPaginated(); - // If the $client method call did not throw, fail the test + $gapicClient->partitionQueryPaginated(); + // If the $gapicClient method call did not throw, fail the test $this->fail('Expected an ApiException, but no exception was thrown.'); } catch (ApiException $ex) { $this->assertEquals($status->code, $ex->getCode()); @@ -883,7 +883,7 @@ public function partitionQueryExceptionTest() public function rollbackTest() { $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, ]); $this->assertTrue($transport->isExhausted()); @@ -893,7 +893,7 @@ public function rollbackTest() // Mock request $database = 'database1789464955'; $transaction = '-34'; - $client->rollback($database, $transaction); + $gapicClient->rollback($database, $transaction); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); @@ -912,7 +912,7 @@ public function rollbackTest() public function rollbackExceptionTest() { $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, ]); $this->assertTrue($transport->isExhausted()); @@ -930,8 +930,8 @@ public function rollbackExceptionTest() $database = 'database1789464955'; $transaction = '-34'; try { - $client->rollback($database, $transaction); - // If the $client method call did not throw, fail the test + $gapicClient->rollback($database, $transaction); + // If the $gapicClient method call did not throw, fail the test $this->fail('Expected an ApiException, but no exception was thrown.'); } catch (ApiException $ex) { $this->assertEquals($status->code, $ex->getCode()); @@ -948,7 +948,7 @@ public function rollbackExceptionTest() public function runQueryTest() { $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, ]); $this->assertTrue($transport->isExhausted()); @@ -979,7 +979,7 @@ public function runQueryTest() $transport->addResponse($expectedResponse3); // Mock request $parent = 'parent-995424086'; - $serverStream = $client->runQuery($parent); + $serverStream = $gapicClient->runQuery($parent); $this->assertInstanceOf(ServerStream::class, $serverStream); $responses = iterator_to_array($serverStream->readAll()); $expectedResponses = []; @@ -1003,7 +1003,7 @@ public function runQueryTest() public function runQueryExceptionTest() { $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, ]); $status = new stdClass(); @@ -1019,7 +1019,7 @@ public function runQueryExceptionTest() $this->assertTrue($transport->isExhausted()); // Mock request $parent = 'parent-995424086'; - $serverStream = $client->runQuery($parent); + $serverStream = $gapicClient->runQuery($parent); $results = $serverStream->readAll(); try { iterator_to_array($results); @@ -1040,7 +1040,7 @@ public function runQueryExceptionTest() public function updateDocumentTest() { $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, ]); $this->assertTrue($transport->isExhausted()); @@ -1052,7 +1052,7 @@ public function updateDocumentTest() // Mock request $document = new Document(); $updateMask = new DocumentMask(); - $response = $client->updateDocument($document, $updateMask); + $response = $gapicClient->updateDocument($document, $updateMask); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); @@ -1072,7 +1072,7 @@ public function updateDocumentTest() public function updateDocumentExceptionTest() { $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, ]); $this->assertTrue($transport->isExhausted()); @@ -1090,8 +1090,8 @@ public function updateDocumentExceptionTest() $document = new Document(); $updateMask = new DocumentMask(); try { - $client->updateDocument($document, $updateMask); - // If the $client method call did not throw, fail the test + $gapicClient->updateDocument($document, $updateMask); + // If the $gapicClient method call did not throw, fail the test $this->fail('Expected an ApiException, but no exception was thrown.'); } catch (ApiException $ex) { $this->assertEquals($status->code, $ex->getCode()); @@ -1108,7 +1108,7 @@ public function updateDocumentExceptionTest() public function writeTest() { $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, ]); $this->assertTrue($transport->isExhausted()); @@ -1141,7 +1141,7 @@ public function writeTest() $database3 = 'database31688906351'; $request3 = new WriteRequest(); $request3->setDatabase($database3); - $bidi = $client->write(); + $bidi = $gapicClient->write(); $this->assertInstanceOf(BidiStream::class, $bidi); $bidi->write($request); $responses = []; @@ -1183,7 +1183,7 @@ public function writeTest() public function writeExceptionTest() { $transport = $this->createTransport(); - $client = $this->createClient([ + $gapicClient = $this->createClient([ 'transport' => $transport, ]); $status = new stdClass(); @@ -1197,7 +1197,7 @@ public function writeExceptionTest() ], JSON_PRETTY_PRINT); $transport->setStreamingStatus($status); $this->assertTrue($transport->isExhausted()); - $bidi = $client->write(); + $bidi = $gapicClient->write(); $results = $bidi->closeWriteAndReadAll(); try { iterator_to_array($results); From 5e1d1d3024a131bc962004d1acb5a835c531daaf Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Thu, 28 Jul 2022 12:13:39 -0700 Subject: [PATCH 2/3] manual ReadOnly fix --- .../src/V1/TransactionOptions/PBReadOnly.php | 3 - .../src/V1/TransactionOptions/ReadOnly.php | 73 +------------------ 2 files changed, 3 insertions(+), 73 deletions(-) diff --git a/Firestore/src/V1/TransactionOptions/PBReadOnly.php b/Firestore/src/V1/TransactionOptions/PBReadOnly.php index 4e2cb53c02a2..777bcb01db1c 100644 --- a/Firestore/src/V1/TransactionOptions/PBReadOnly.php +++ b/Firestore/src/V1/TransactionOptions/PBReadOnly.php @@ -79,6 +79,3 @@ public function getConsistencySelector() // Adding a class alias for backwards compatibility with the previous class name. class_alias(PBReadOnly::class, \Google\Cloud\Firestore\V1\TransactionOptions_ReadOnly::class); -// Adding a class alias for backwards compatibility with the "readonly" keyword. -class_alias(PBReadOnly::class, __NAMESPACE__ . '\ReadOnly'); - diff --git a/Firestore/src/V1/TransactionOptions/ReadOnly.php b/Firestore/src/V1/TransactionOptions/ReadOnly.php index 615b9fce7ab0..f959087ffb78 100644 --- a/Firestore/src/V1/TransactionOptions/ReadOnly.php +++ b/Firestore/src/V1/TransactionOptions/ReadOnly.php @@ -4,78 +4,11 @@ namespace Google\Cloud\Firestore\V1\TransactionOptions; -use Google\Protobuf\Internal\GPBType; -use Google\Protobuf\Internal\RepeatedField; -use Google\Protobuf\Internal\GPBUtil; - /** - * Options for a transaction that can only be used to read documents. - * - * Generated from protobuf message google.firestore.v1.TransactionOptions.ReadOnly + * @deprecated */ -class ReadOnly extends \Google\Protobuf\Internal\Message +class ReadOnly extends PBReadOnly { - protected $consistency_selector; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Protobuf\Timestamp $read_time - * Reads documents at the given time. - * This may not be older than 60 seconds. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Firestore\V1\Common::initOnce(); - parent::__construct($data); - } - - /** - * Reads documents at the given time. - * This may not be older than 60 seconds. - * - * Generated from protobuf field .google.protobuf.Timestamp read_time = 2; - * @return \Google\Protobuf\Timestamp|null - */ - public function getReadTime() - { - return $this->readOneof(2); - } - - public function hasReadTime() - { - return $this->hasOneof(2); - } - - /** - * Reads documents at the given time. - * This may not be older than 60 seconds. - * - * Generated from protobuf field .google.protobuf.Timestamp read_time = 2; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setReadTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->writeOneof(2, $var); - - return $this; - } - - /** - * @return string - */ - public function getConsistencySelector() - { - return $this->whichOneof("consistency_selector"); - } - } -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(ReadOnly::class, \Google\Cloud\Firestore\V1\TransactionOptions_ReadOnly::class); - +@trigger_error(__NAMESPACE__ . '\ReadOnly is deprecated and will be removed in the next major release. Use PBReadOnly instead', E_USER_DEPRECATED); From 80853ad51c0aece978cb8501e464f18931602c7d Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Thu, 28 Jul 2022 19:42:20 +0000 Subject: [PATCH 3/3] update GAPICs --- .../V1/Gapic/FirestoreAdminGapicClient.php | 84 ++++++++----------- .../src/V1/Gapic/FirestoreGapicClient.php | 77 ++++++++--------- 2 files changed, 69 insertions(+), 92 deletions(-) diff --git a/Firestore/src/Admin/V1/Gapic/FirestoreAdminGapicClient.php b/Firestore/src/Admin/V1/Gapic/FirestoreAdminGapicClient.php index 73137ce8ad2c..d5304c8b4085 100644 --- a/Firestore/src/Admin/V1/Gapic/FirestoreAdminGapicClient.php +++ b/Firestore/src/Admin/V1/Gapic/FirestoreAdminGapicClient.php @@ -543,10 +543,9 @@ public function __construct(array $options = []) * Optional. * * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a - * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry - * settings parameters. See the documentation on - * {@see Google\ApiCore\RetrySettings} for example usage. + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. * } * * @return \Google\ApiCore\OperationResponse @@ -585,10 +584,9 @@ public function createIndexLRO($parent, $index, array $optionalArgs = []) * Optional. * * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a - * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry - * settings parameters. See the documentation on - * {@see Google\ApiCore\RetrySettings} for example usage. + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. * } * * @throws ApiException if the remote call fails @@ -670,10 +668,9 @@ public function deleteIndex($name, array $optionalArgs = []) * If the URI is a bucket (without a namespace path), a prefix will be * generated based on the start time. * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a - * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry - * settings parameters. See the documentation on - * {@see Google\ApiCore\RetrySettings} for example usage. + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. * } * * @return \Google\ApiCore\OperationResponse @@ -719,10 +716,9 @@ public function exportDocumentsLRO($name, array $optionalArgs = []) * Optional. * * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a - * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry - * settings parameters. See the documentation on - * {@see Google\ApiCore\RetrySettings} for example usage. + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. * } * * @return \Google\Cloud\Firestore\Admin\V1\Database @@ -760,10 +756,9 @@ public function getDatabase($name, array $optionalArgs = []) * Optional. * * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a - * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry - * settings parameters. See the documentation on - * {@see Google\ApiCore\RetrySettings} for example usage. + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. * } * * @return \Google\Cloud\Firestore\Admin\V1\Field @@ -801,10 +796,9 @@ public function getField($name, array $optionalArgs = []) * Optional. * * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a - * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry - * settings parameters. See the documentation on - * {@see Google\ApiCore\RetrySettings} for example usage. + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. * } * * @return \Google\Cloud\Firestore\Admin\V1\Index @@ -878,10 +872,9 @@ public function getIndex($name, array $optionalArgs = []) * See: * [google.firestore.admin.v1.ExportDocumentsResponse.output_uri_prefix][google.firestore.admin.v1.ExportDocumentsResponse.output_uri_prefix]. * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a - * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry - * settings parameters. See the documentation on - * {@see Google\ApiCore\RetrySettings} for example usage. + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. * } * * @return \Google\ApiCore\OperationResponse @@ -927,10 +920,9 @@ public function importDocumentsLRO($name, array $optionalArgs = []) * Optional. * * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a - * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry - * settings parameters. See the documentation on - * {@see Google\ApiCore\RetrySettings} for example usage. + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. * } * * @return \Google\Cloud\Firestore\Admin\V1\ListDatabasesResponse @@ -1000,10 +992,9 @@ public function listDatabases($parent, array $optionalArgs = []) * of values will be returned. Any page token used here must have * been generated by a previous call to the API. * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a - * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry - * settings parameters. See the documentation on - * {@see Google\ApiCore\RetrySettings} for example usage. + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. * } * * @return \Google\ApiCore\PagedListResponse @@ -1076,10 +1067,9 @@ public function listFields($parent, array $optionalArgs = []) * of values will be returned. Any page token used here must have * been generated by a previous call to the API. * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a - * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry - * settings parameters. See the documentation on - * {@see Google\ApiCore\RetrySettings} for example usage. + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. * } * * @return \Google\ApiCore\PagedListResponse @@ -1155,10 +1145,9 @@ public function listIndexes($parent, array $optionalArgs = []) * @type FieldMask $updateMask * The list of fields to be updated. * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a - * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry - * settings parameters. See the documentation on - * {@see Google\ApiCore\RetrySettings} for example usage. + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. * } * * @return \Google\ApiCore\OperationResponse @@ -1239,10 +1228,9 @@ public function updateDatabase($database, array $optionalArgs = []) * A mask, relative to the field. If specified, only configuration specified * by this field_mask will be updated in the field. * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a - * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry - * settings parameters. See the documentation on - * {@see Google\ApiCore\RetrySettings} for example usage. + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. * } * * @return \Google\ApiCore\OperationResponse diff --git a/Firestore/src/V1/Gapic/FirestoreGapicClient.php b/Firestore/src/V1/Gapic/FirestoreGapicClient.php index 2e141510c557..bab0fc313ce3 100644 --- a/Firestore/src/V1/Gapic/FirestoreGapicClient.php +++ b/Firestore/src/V1/Gapic/FirestoreGapicClient.php @@ -329,10 +329,9 @@ public function batchGetDocuments($database, $documents, array $optionalArgs = [ * @type array $labels * Labels associated with this batch write. * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a - * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry - * settings parameters. See the documentation on - * {@see Google\ApiCore\RetrySettings} for example usage. + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. * } * * @return \Google\Cloud\Firestore\V1\BatchWriteResponse @@ -384,10 +383,9 @@ public function batchWrite(array $optionalArgs = []) * The options for the transaction. * Defaults to a read-write transaction. * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a - * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry - * settings parameters. See the documentation on - * {@see Google\ApiCore\RetrySettings} for example usage. + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. * } * * @return \Google\Cloud\Firestore\V1\BeginTransactionResponse @@ -435,10 +433,9 @@ public function beginTransaction($database, array $optionalArgs = []) * @type string $transaction * If set, applies all writes in this transaction, and commits it. * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a - * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry - * settings parameters. See the documentation on - * {@see Google\ApiCore\RetrySettings} for example usage. + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. * } * * @return \Google\Cloud\Firestore\V1\CommitResponse @@ -495,10 +492,9 @@ public function commit($database, $writes, array $optionalArgs = []) * If the document has a field that is not present in this mask, that field * will not be returned in the response. * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a - * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry - * settings parameters. See the documentation on - * {@see Google\ApiCore\RetrySettings} for example usage. + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. * } * * @return \Google\Cloud\Firestore\V1\Document @@ -547,10 +543,9 @@ public function createDocument($parent, $collectionId, $documentId, $document, a * An optional precondition on the document. * The request will fail if this is set and not met by the target document. * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a - * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry - * settings parameters. See the documentation on - * {@see Google\ApiCore\RetrySettings} for example usage. + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. * } * * @throws ApiException if the remote call fails @@ -600,10 +595,9 @@ public function deleteDocument($name, array $optionalArgs = []) * Reads the version of the document at the given time. * This may not be older than 270 seconds. * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a - * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry - * settings parameters. See the documentation on - * {@see Google\ApiCore\RetrySettings} for example usage. + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. * } * * @return \Google\Cloud\Firestore\V1\Document @@ -679,10 +673,9 @@ public function getDocument($name, array $optionalArgs = []) * Reads documents as they were at the given time. * This may not be older than 270 seconds. * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a - * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry - * settings parameters. See the documentation on - * {@see Google\ApiCore\RetrySettings} for example usage. + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. * } * * @return \Google\ApiCore\PagedListResponse @@ -780,10 +773,9 @@ public function listCollectionIds($parent, array $optionalArgs = []) * Requests with `show_missing` may not specify `where` or * `order_by`. * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a - * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry - * settings parameters. See the documentation on - * {@see Google\ApiCore\RetrySettings} for example usage. + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. * } * * @return \Google\ApiCore\PagedListResponse @@ -954,10 +946,9 @@ public function listen(array $optionalArgs = []) * Reads documents as they were at the given time. * This may not be older than 270 seconds. * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a - * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry - * settings parameters. See the documentation on - * {@see Google\ApiCore\RetrySettings} for example usage. + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. * } * * @return \Google\ApiCore\PagedListResponse @@ -1020,10 +1011,9 @@ public function partitionQueryPaginated(array $optionalArgs = []) * Optional. * * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a - * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry - * settings parameters. See the documentation on - * {@see Google\ApiCore\RetrySettings} for example usage. + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. * } * * @throws ApiException if the remote call fails @@ -1152,10 +1142,9 @@ public function runQuery($parent, array $optionalArgs = []) * An optional precondition on the document. * The request will fail if this is set and not met by the target document. * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a - * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry - * settings parameters. See the documentation on - * {@see Google\ApiCore\RetrySettings} for example usage. + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. * } * * @return \Google\Cloud\Firestore\V1\Document