diff --git a/.idx/.gitignore b/.idx/.gitignore new file mode 100644 index 000000000..96be05fb6 --- /dev/null +++ b/.idx/.gitignore @@ -0,0 +1,2 @@ + +gc/ diff --git a/.idx/dev.nix b/.idx/dev.nix new file mode 100644 index 000000000..90de3c080 --- /dev/null +++ b/.idx/dev.nix @@ -0,0 +1,17 @@ +{ pkgs, ... }: { + + # Which nixpkgs channel to use. + channel = "stable-23.11"; # or "unstable" + + # Use https://search.nixos.org/packages to find packages + packages = [ + pkgs.jdk11 # Or jdk8, jdk17, etc. - match your project's requirements + pkgs.maven + pkgs.kotlin + ]; + + # Sets environment variables in the workspace + env = { + SOME_ENV_VAR = "hello"; + }; +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..7b016a89f --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "java.compile.nullAnalysis.mode": "automatic" +} \ No newline at end of file diff --git a/README.md b/README.md index 816c2e789..a185d65f9 100644 --- a/README.md +++ b/README.md @@ -50,20 +50,20 @@ If you are using Maven without the BOM, add this to your dependencies: If you are using Gradle 5.x or later, add this to your dependencies: ```Groovy -implementation platform('com.google.cloud:libraries-bom:26.39.0') +implementation platform('com.google.cloud:libraries-bom:26.40.0') implementation 'com.google.cloud:google-cloud-firestore' ``` If you are using Gradle without BOM, add this to your dependencies: ```Groovy -implementation 'com.google.cloud:google-cloud-firestore:3.21.1' +implementation 'com.google.cloud:google-cloud-firestore:3.21.3' ``` If you are using SBT, add this to your dependencies: ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-firestore" % "3.21.1" +libraryDependencies += "com.google.cloud" % "google-cloud-firestore" % "3.21.3" ``` @@ -222,7 +222,7 @@ Java is a registered trademark of Oracle and/or its affiliates. [kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-firestore/java11.html [stability-image]: https://img.shields.io/badge/stability-stable-green [maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-firestore.svg -[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-firestore/3.21.1 +[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-firestore/3.21.3 [authentication]: https://github.com/googleapis/google-cloud-java#authentication [auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes [predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles diff --git a/google-cloud-firestore-admin/src/main/java/com/google/cloud/firestore/v1/stub/FirestoreAdminStubSettings.java b/google-cloud-firestore-admin/src/main/java/com/google/cloud/firestore/v1/stub/FirestoreAdminStubSettings.java index 6b445dcf5..fbcf2bc14 100644 --- a/google-cloud-firestore-admin/src/main/java/com/google/cloud/firestore/v1/stub/FirestoreAdminStubSettings.java +++ b/google-cloud-firestore-admin/src/main/java/com/google/cloud/firestore/v1/stub/FirestoreAdminStubSettings.java @@ -486,6 +486,15 @@ public FirestoreAdminStub createStub() throws IOException { "Transport not supported: %s", getTransportChannelProvider().getTransportName())); } + /** Returns the endpoint set by the user or the the service's default endpoint. */ + @Override + public String getEndpoint() { + if (super.getEndpoint() != null) { + return super.getEndpoint(); + } + return getDefaultEndpoint(); + } + /** Returns the default service name. */ @Override public String getServiceName() { @@ -1377,6 +1386,15 @@ public UnaryCallSettings.Builder restoreDatab return deleteBackupScheduleSettings; } + /** Returns the endpoint set by the user or the the service's default endpoint. */ + @Override + public String getEndpoint() { + if (super.getEndpoint() != null) { + return super.getEndpoint(); + } + return getDefaultEndpoint(); + } + @Override public FirestoreAdminStubSettings build() throws IOException { return new FirestoreAdminStubSettings(this); diff --git a/google-cloud-firestore/pom.xml b/google-cloud-firestore/pom.xml index 2cb088ef5..670b93535 100644 --- a/google-cloud-firestore/pom.xml +++ b/google-cloud-firestore/pom.xml @@ -16,6 +16,7 @@ google-cloud-firestore + 1.9.22 @@ -173,6 +174,17 @@ 3.14.0 test + + org.jetbrains.kotlin + kotlin-stdlib-jdk8 + ${kotlin.version} + + + org.jetbrains.kotlin + kotlin-test + ${kotlin.version} + test + @@ -214,6 +226,78 @@ org.codehaus.mojo flatten-maven-plugin + + org.jetbrains.kotlin + kotlin-maven-plugin + ${kotlin.version} + + + compile + compile + + compile + + + + src/main/java + target/generated-sources/annotations + + + + + test-compile + test-compile + + test-compile + + + + src/test/java + target/generated-test-sources/test-annotations + + + + + + 1.8 + + + + maven-assembly-plugin + + + jar-with-dependencies + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + default-compile + none + + + default-testCompile + none + + + compile + compile + + compile + + + + testCompile + test-compile + + testCompile + + + + diff --git a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/AggregateQuery.java b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/AggregateQuery.java index 4e00e5f3c..5e2c5f673 100644 --- a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/AggregateQuery.java +++ b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/AggregateQuery.java @@ -24,6 +24,7 @@ import com.google.api.gax.rpc.StatusCode; import com.google.api.gax.rpc.StreamController; import com.google.cloud.Timestamp; +import com.google.cloud.firestore.pipeline.AggregatorTarget; import com.google.cloud.firestore.v1.FirestoreSettings; import com.google.common.collect.ImmutableMap; import com.google.firestore.v1.RunAggregationQueryRequest; @@ -65,6 +66,16 @@ public Query getQuery() { return query; } + @Nonnull + public Pipeline toPipeline() { + return getQuery() + .toPipeline() + .aggregate( + this.aggregateFieldList.stream() + .map(PipelineUtils::toPipelineAggregatorTarget) + .toArray(AggregatorTarget[]::new)); + } + /** * Executes this query. * diff --git a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/FirestoreImpl.java b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/FirestoreImpl.java index 82dfc5176..03e3cf891 100644 --- a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/FirestoreImpl.java +++ b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/FirestoreImpl.java @@ -29,6 +29,8 @@ import com.google.api.gax.rpc.StreamController; import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.Timestamp; +import com.google.cloud.firestore.Transaction.AsyncFunction; +import com.google.cloud.firestore.Transaction.Function; import com.google.cloud.firestore.spi.v1.FirestoreRpc; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Preconditions; @@ -385,7 +387,7 @@ public CollectionGroup collectionGroup(@Nonnull final String collectionId) { @Nonnull @Override - public ApiFuture runTransaction(@Nonnull final Transaction.Function updateFunction) { + public ApiFuture runTransaction(@Nonnull final Function updateFunction) { return runAsyncTransaction( new TransactionAsyncAdapter<>(updateFunction), TransactionOptions.create()); } @@ -393,22 +395,20 @@ public ApiFuture runTransaction(@Nonnull final Transaction.Function up @Nonnull @Override public ApiFuture runTransaction( - @Nonnull final Transaction.Function updateFunction, - @Nonnull TransactionOptions transactionOptions) { + @Nonnull final Function updateFunction, @Nonnull TransactionOptions transactionOptions) { return runAsyncTransaction(new TransactionAsyncAdapter<>(updateFunction), transactionOptions); } @Nonnull @Override - public ApiFuture runAsyncTransaction( - @Nonnull final Transaction.AsyncFunction updateFunction) { + public ApiFuture runAsyncTransaction(@Nonnull final AsyncFunction updateFunction) { return runAsyncTransaction(updateFunction, TransactionOptions.create()); } @Nonnull @Override public ApiFuture runAsyncTransaction( - @Nonnull final Transaction.AsyncFunction updateFunction, + @Nonnull final AsyncFunction updateFunction, @Nonnull TransactionOptions transactionOptions) { if (transactionOptions.getReadTime() != null) { @@ -519,10 +519,10 @@ public void shutdownNow() { closed = true; } - private static class TransactionAsyncAdapter implements Transaction.AsyncFunction { - private final Transaction.Function syncFunction; + private static class TransactionAsyncAdapter implements AsyncFunction { + private final Function syncFunction; - public TransactionAsyncAdapter(Transaction.Function syncFunction) { + public TransactionAsyncAdapter(Function syncFunction) { this.syncFunction = syncFunction; } diff --git a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/PipelineResult.kt b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/PipelineResult.kt new file mode 100644 index 000000000..6df882e09 --- /dev/null +++ b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/PipelineResult.kt @@ -0,0 +1,192 @@ +package com.google.cloud.firestore + +import com.google.cloud.Timestamp +import com.google.cloud.firestore.pipeline.Field +import com.google.firestore.v1.Document +import com.google.firestore.v1.Value +import java.util.Date +import javax.annotation.Nonnull + +/** + * Result from a {@code Pipeline} execution. + */ +class PipelineResult +internal constructor( + private val rpcContext: FirestoreRpcContext<*>?, + val reference: DocumentReference?, + val protoFields: Map, + val readTime: Timestamp, + val updateTime: Timestamp?, + val createTime: Timestamp?, +) { + val id: String? + get() = reference?.id + + fun valid(): Boolean { + return protoFields != null + } + + val data: Map? + /** + * Returns the fields of the document as a Map or null if the document doesn't exist. Field + * values will be converted to their native Java representation. + * + * @return The fields of the document as a Map or null if the document doesn't exist. + */ + get() { + if (protoFields == null) { + return null + } + + val decodedFields: MutableMap = HashMap() + for ((key, value) in protoFields) { + val decodedValue = UserDataConverter.decodeValue(rpcContext, value) + decodedFields[key] = decodedValue + } + return decodedFields + } + + /** + * Returns the contents of the result converted to a POJO or null if the document doesn't exist. + * + * @param valueType The Java class to create + * @return The contents of the result in an object of type T or null if the document doesn't + * exist. + */ + fun toObject(@Nonnull valueType: Class): T? { + val data = data + return if (data == null) null + else CustomClassMapper.convertToCustomClass(data, valueType, reference) + } + + /** + * Returns whether or not the field exists in the result. Returns false if the result does not + * exist. + * + * @param field the path to the field. + * @return true iff the field exists. + */ + fun contains(field: String): Boolean { + return contains(FieldPath.fromDotSeparatedString(field)) + } + + /** + * Returns whether or not the field exists in the result. Returns false if the result is invalid. + * + * @param fieldPath the path to the field. + * @return true iff the field exists. + */ + fun contains(fieldPath: FieldPath): Boolean { + return this.extractField(fieldPath) != null + } + + fun contains(field: Field): Boolean { + return this.extractField(field.path) != null + } + + fun get(field: String): Any? { + return get(FieldPath.fromDotSeparatedString(field)) + } + + fun get(field: String?, valueType: Class): T? { + return get(FieldPath.fromDotSeparatedString(field), valueType) + } + + fun get(fieldPath: FieldPath): Any? { + val value = extractField(fieldPath) ?: return null + + return UserDataConverter.decodeValue(rpcContext, value) + } + + fun get(field: Field): Any? { + return get(field.path) + } + + fun get(fieldPath: FieldPath, valueType: Class): T? { + val data = get(fieldPath) + return if (data == null) null + else CustomClassMapper.convertToCustomClass(data, valueType, reference) + } + + fun get(field: Field, valueType: Class): T? { + return get(field.path, valueType) + } + + fun extractField(fieldPath: FieldPath): Value? { + var value: Value? = null + + if (protoFields != null) { + val components: Iterator = fieldPath.segments.iterator() + value = protoFields[components.next()] + + while (value != null && components.hasNext()) { + if (value.valueTypeCase != Value.ValueTypeCase.MAP_VALUE) { + return null + } + value = value.mapValue.getFieldsOrDefault(components.next(), null) + } + } + + return value + } + + fun extractField(field: Field): Value? { + return extractField(field.path) + } + + fun getBoolean(field: String): Boolean? { + return get(field) as Boolean? + } + + fun getDouble(field: String): Double? { + val number = get(field) as Number? + return number?.toDouble() + } + + fun getString(field: String): String? { + return get(field) as String? + } + + fun getLong(field: String): Long? { + val number = get(field) as Number? + return number?.toLong() + } + + fun getDate(field: String): Date? { + val timestamp = getTimestamp(field) + return timestamp?.toDate() + } + + fun getTimestamp(field: String): Timestamp? { + return get(field) as Timestamp? + } + + fun getBlob(field: String): Blob? { + return get(field) as Blob? + } + + fun getGeoPoint(field: String): GeoPoint? { + return get(field) as GeoPoint? + } + + val isEmpty: Boolean + get() = protoFields.isEmpty() + + companion object { + @JvmStatic + internal fun fromDocument( + rpcContext: FirestoreRpcContext<*>?, + readTime: com.google.protobuf.Timestamp, + document: Document, + ): PipelineResult { + return PipelineResult( + rpcContext, + document.name?.let { DocumentReference(rpcContext, ResourcePath.create(it)) }, + document.fieldsMap, + Timestamp.fromProto(readTime), + document.updateTime?.let { Timestamp.fromProto(it) }, + document.createTime?.let { Timestamp.fromProto(it) }, + ) + } + } +} diff --git a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/PipelineUtils.kt b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/PipelineUtils.kt new file mode 100644 index 000000000..e0023f041 --- /dev/null +++ b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/PipelineUtils.kt @@ -0,0 +1,141 @@ +@file:JvmName("PipelineUtils") +package com.google.cloud.firestore + +import com.google.cloud.firestore.Query.ComparisonFilterInternal +import com.google.cloud.firestore.Query.CompositeFilterInternal +import com.google.cloud.firestore.Query.FilterInternal +import com.google.cloud.firestore.Query.LimitType +import com.google.cloud.firestore.Query.UnaryFilterInternal +import com.google.cloud.firestore.pipeline.AggregatorTarget +import com.google.cloud.firestore.pipeline.Constant +import com.google.cloud.firestore.pipeline.Field +import com.google.cloud.firestore.pipeline.Function +import com.google.cloud.firestore.pipeline.Function.Companion.countAll +import com.google.cloud.firestore.pipeline.Function.Companion.not +import com.google.firestore.v1.Cursor +import com.google.firestore.v1.StructuredQuery + +internal fun toPipelineFilterCondition(f: FilterInternal): Function.FilterCondition { + return when (f) { + is ComparisonFilterInternal -> { + when (f.operator) { + StructuredQuery.FieldFilter.Operator.OPERATOR_UNSPECIFIED -> { + TODO() + } + StructuredQuery.FieldFilter.Operator.LESS_THAN -> { + Field.of(f.fieldReference.fieldPath).lessThan(f.value) + } + StructuredQuery.FieldFilter.Operator.LESS_THAN_OR_EQUAL -> { + Field.of(f.fieldReference.fieldPath).lessThanOrEqual(f.value) + } + StructuredQuery.FieldFilter.Operator.GREATER_THAN -> { + Field.of(f.fieldReference.fieldPath).greaterThan(f.value) + } + StructuredQuery.FieldFilter.Operator.GREATER_THAN_OR_EQUAL -> { + Field.of(f.fieldReference.fieldPath).greaterThanOrEqual(f.value) + } + StructuredQuery.FieldFilter.Operator.EQUAL -> { + Field.of(f.fieldReference.fieldPath).equal(f.value) + } + StructuredQuery.FieldFilter.Operator.NOT_EQUAL -> { + not(Field.of(f.fieldReference.fieldPath).equal(f.value)) + } + StructuredQuery.FieldFilter.Operator.ARRAY_CONTAINS -> { + Field.of(f.fieldReference.fieldPath).arrayContains(f.value) + } + StructuredQuery.FieldFilter.Operator.IN -> { + Function.In( + Field.of(f.fieldReference.fieldPath), + f.value?.arrayValue?.valuesList?.map { Constant.of(it) } ?: emptyList(), + ) + } + StructuredQuery.FieldFilter.Operator.ARRAY_CONTAINS_ANY -> { + Function.ArrayContainsAny( + Field.of(f.fieldReference.fieldPath), + f.value?.arrayValue?.valuesList?.map { Constant.of(it) } ?: emptyList(), + ) + } + StructuredQuery.FieldFilter.Operator.NOT_IN -> { + not( + Function.In( + Field.of(f.fieldReference.fieldPath), + f.value?.arrayValue?.valuesList?.map { Constant.of(it) } ?: emptyList(), + ) + ) + } + StructuredQuery.FieldFilter.Operator.UNRECOGNIZED -> { + TODO() + } + } + } + is CompositeFilterInternal -> { + when (f.operator) { + StructuredQuery.CompositeFilter.Operator.OPERATOR_UNSPECIFIED -> { + TODO() + } + StructuredQuery.CompositeFilter.Operator.AND -> { + Function.And(f.filters.map { toPipelineFilterCondition(it) }) + } + StructuredQuery.CompositeFilter.Operator.OR -> { + Function.Or(f.filters.map { toPipelineFilterCondition(it) }) + } + StructuredQuery.CompositeFilter.Operator.UNRECOGNIZED -> { + TODO() + } + } + } + is UnaryFilterInternal -> { + when (f.operator) { + StructuredQuery.UnaryFilter.Operator.IS_NAN -> Field.of(f.fieldReference.fieldPath).isNaN() + StructuredQuery.UnaryFilter.Operator.IS_NULL -> + Field.of(f.fieldReference.fieldPath).isNull() + StructuredQuery.UnaryFilter.Operator.IS_NOT_NAN -> + not(Field.of(f.fieldReference.fieldPath).isNaN()) + StructuredQuery.UnaryFilter.Operator.IS_NOT_NULL -> + not(Field.of(f.fieldReference.fieldPath).isNull()) + StructuredQuery.UnaryFilter.Operator.OPERATOR_UNSPECIFIED -> TODO() + StructuredQuery.UnaryFilter.Operator.UNRECOGNIZED -> TODO() + } + } + else -> { + TODO() + } + } +} + +internal fun toPaginatedPipeline( + pipeline: Pipeline, + start: Cursor?, + end: Cursor?, + limit: Int?, + limitType: LimitType?, + offset: Int?, +): Pipeline { + var paginate: PaginatingPipeline = pipeline.paginate(limit ?: Int.MAX_VALUE) + + start?.let { paginate = setStartCursor(paginate, it) } + end?.let { paginate = setEndCursor(paginate, it) } + offset?.let { paginate = paginate.offset(it) } + + return limitType?.let { + when (it) { + LimitType.First -> paginate.firstPage() + LimitType.Last -> paginate.lastPage() + } + } ?: paginate.firstPage() +} + +internal fun toPipelineAggregatorTarget(f: AggregateField): AggregatorTarget { + return when (f.operator) { + "sum" -> { + Field.of(f.getFieldPath()).sum().toField(f.alias) + } + "count" -> { + countAll().toField(f.alias) + } + "avg" -> { + Field.of(f.getFieldPath()).avg().toField(f.alias) + } + else -> TODO() + } +} diff --git a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Pipelines.kt b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Pipelines.kt new file mode 100644 index 000000000..6d4ef8341 --- /dev/null +++ b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Pipelines.kt @@ -0,0 +1,420 @@ +@file:JvmName("Pipelines") +package com.google.cloud.firestore + +import com.google.api.core.ApiFuture +import com.google.api.core.SettableApiFuture +import com.google.api.gax.rpc.ApiStreamObserver +import com.google.api.gax.rpc.ResponseObserver +import com.google.api.gax.rpc.StreamController +import com.google.cloud.Timestamp +import com.google.cloud.firestore.pipeline.AddFields +import com.google.cloud.firestore.pipeline.Aggregate +import com.google.cloud.firestore.pipeline.AggregatorTarget +import com.google.cloud.firestore.pipeline.Collection +import com.google.cloud.firestore.pipeline.CollectionGroup +import com.google.cloud.firestore.pipeline.Database +import com.google.cloud.firestore.pipeline.Documents +import com.google.cloud.firestore.pipeline.Expr +import com.google.cloud.firestore.pipeline.Field +import com.google.cloud.firestore.pipeline.Fields +import com.google.cloud.firestore.pipeline.Filter +import com.google.cloud.firestore.pipeline.FindNearest +import com.google.cloud.firestore.pipeline.Function +import com.google.cloud.firestore.pipeline.Limit +import com.google.cloud.firestore.pipeline.Offset +import com.google.cloud.firestore.pipeline.Select +import com.google.cloud.firestore.pipeline.Selectable +import com.google.cloud.firestore.pipeline.Sort +import com.google.cloud.firestore.pipeline.Sort.Ordering +import com.google.cloud.firestore.pipeline.Stage +import com.google.cloud.firestore.pipeline.toStageProto +import com.google.common.base.Preconditions +import com.google.common.collect.ImmutableMap +import com.google.firestore.v1.Cursor +import com.google.firestore.v1.Document +import com.google.firestore.v1.ExecutePipelineRequest +import com.google.firestore.v1.ExecutePipelineResponse +import com.google.firestore.v1.StructuredPipeline +import com.google.firestore.v1.Value +import io.opencensus.trace.AttributeValue +import io.opencensus.trace.Tracing +import java.util.logging.Level +import java.util.logging.Logger + +internal fun setStartCursor(pipeline: PaginatingPipeline, cursor: Cursor): PaginatingPipeline { + return pipeline +} + +internal fun setEndCursor(pipeline: PaginatingPipeline, cursor: Cursor): PaginatingPipeline { + return pipeline +} + +class PaginatingPipeline +internal constructor( + internal val p: Pipeline, + internal val pageSize: Int, + internal val orders: List, + private val offset: Int? = null, + private val startCursor: Cursor? = null, + private val endCursor: Cursor? = null, +) { + fun firstPage(): Pipeline { + return this.p + } + + fun lastPage(): Pipeline { + return this.p + } + + fun startAt(result: PipelineResult): PaginatingPipeline { + return this + } + + fun startAfter(result: PipelineResult): PaginatingPipeline { + return this + } + + fun endAt(result: PipelineResult): PaginatingPipeline { + return this + } + + fun endBefore(result: PipelineResult): PaginatingPipeline { + return this + } + + // Internal as this is only potentially used when converting Query to Pipeline. + internal fun offset(offset: Int): PaginatingPipeline { + return this + } +} + +/** + * The Pipeline class provides a flexible and expressive framework for building complex data + * transformation and query pipelines for Firestore. + * + * A pipeline takes data sources such as Firestore collections, collection groups, or even in-memory + * data, and applies a series of operations that are chained together, each operation takes the + * output from the last operation (or the data source) and produces an output for the next operation + * (or as the final output of the pipeline). + * + * NOTE: the chained operations are not a prescription of exactly how Firestore will execute the + * pipeline, instead Firestore only guarantee the result is the same as if the chained operations + * are executed in order. + * + * Usage Examples: + * + * **1. Projecting Specific Fields and Renaming:** + * + * ```java + * Pipeline pipeline = Pipeline.fromCollection("users") + * // Select 'name' and 'email' fields, create 'userAge' which is renamed from field 'age'. + * .project(Fields.of("name", "email"), Field.of("age").asAlias("userAge")) + * ``` + * + * **2. Filtering and Sorting:** + * + * ```java + * Pipeline pipeline = Pipeline.fromCollectionGroup("reviews") + * .filter(Field.of("rating").greaterThan(Expr.Constant.of(3))) // High ratings + * .sort(Ordering.of("timestamp").descending()); + * ``` + * + * **3. Aggregation with Grouping:** + * + * ```java + * Pipeline pipeline = Pipeline.fromCollection("orders") + * .group(Field.of("customerId")) + * .aggregate(count(Field.of("orderId")).asAlias("orderCount")); + * ``` + */ +class Pipeline private constructor(private val stages: List, private val name: String) { + + private constructor(collection: Collection) : this(listOf(collection), collection.relativePath) + + private constructor(group: CollectionGroup) : this(listOf(group), group.collectionId) + + private constructor(db: Database) : this(listOf(db), db.name) + + private constructor(docs: Documents) : this(listOf(docs), docs.name) + + companion object { + @JvmStatic + fun from(source: CollectionReference): Pipeline { + return Pipeline(Collection(source.path)) + } + + @JvmStatic + fun from(source: com.google.cloud.firestore.CollectionGroup): Pipeline { + return Pipeline(CollectionGroup(source.options.collectionId)) + } + + @JvmStatic + fun fromCollection(collectionName: String): Pipeline { + return Pipeline(Collection(collectionName)) + } + + @JvmStatic + fun fromCollectionGroup(collectionId: String): Pipeline { + Preconditions.checkArgument( + !collectionId.contains("/"), + "Invalid collectionId '%s'. Collection IDs must not contain '/'.", + collectionId, + ) + return Pipeline(CollectionGroup(collectionId)) + } + + @JvmStatic + fun fromDatabase(): Pipeline { + return Pipeline(Database()) + } + + @JvmStatic + fun fromDocuments(vararg docs: DocumentReference): Pipeline { + return Pipeline(Documents.of(*docs)) + } + } + + private fun projectablesToMap(vararg selectables: Selectable): Map { + val projMap = mutableMapOf() + for (proj in selectables) { + when (proj) { + is Field -> projMap[proj.path.encodedPath] = proj + is AggregatorTarget -> projMap[proj.fieldName] = proj.accumulator + is Fields -> proj.fs?.forEach { projMap[it.path.encodedPath] = it } + } + } + return projMap + } + + private fun fieldNamesToMap(vararg fields: String): Map { + val projMap = mutableMapOf() + for (field in fields) { + projMap[field] = Field.of(field) + } + return projMap + } + + fun addFields(vararg fields: Selectable): Pipeline { + return Pipeline(stages.plus(AddFields(projectablesToMap(*fields))), name) + } + + fun select(vararg projections: Selectable): Pipeline { + return Pipeline(stages.plus(Select(projectablesToMap(*projections))), name) + } + + fun select(vararg fields: String): Pipeline { + return Pipeline(stages.plus(Select(fieldNamesToMap(*fields))), name) + } + + fun filter(condition: T): Pipeline where T : Expr, T : Function.FilterCondition { + return Pipeline(stages.plus(Filter(condition)), name) + } + + fun offset(offset: Int): Pipeline { + return Pipeline(stages.plus(Offset(offset)), name) + } + + fun limit(limit: Int): Pipeline { + return Pipeline(stages.plus(Limit(limit)), name) + } + + fun aggregate(vararg aggregators: AggregatorTarget): Pipeline { + return Pipeline(stages.plus(Aggregate(*aggregators)), name) + } + + fun findNearest( + property: Field, + vector: DoubleArray, + options: FindNearest.FindNearestOptions, + ): Pipeline { + return this + } + + fun sort( + orders: List, + density: Sort.Density = Sort.Density.UNSPECIFIED, + truncation: Sort.Truncation = Sort.Truncation.UNSPECIFIED, + ): Pipeline { + return Pipeline(stages.plus(Sort(orders, density, truncation)), name) + } + + // Sugar + fun sort(vararg orders: Ordering): Pipeline { + return this.sort(orders.toList()) + } + + fun paginate(pageSize: Int, vararg orders: Ordering): PaginatingPipeline { + return PaginatingPipeline(this, pageSize, orders.toList()) + } + + fun genericStage(name: String, params: Map? = null): Pipeline { + return this + } + + fun execute(db: Firestore): ApiFuture> { + when (db) { + is FirestoreImpl -> { + val pipelineValue = toProto() + val request = + ExecutePipelineRequest.newBuilder() + .setDatabase(db.resourcePath.databaseName.toString()) + .setStructuredPipeline( + StructuredPipeline.newBuilder().setPipeline(pipelineValue.pipelineValue).build() + ) + .build() + + val futureResult = SettableApiFuture.create>() + pipelineInternalStream( + db, + request, + object : PipelineResultObserver() { + val results = mutableListOf() + + override fun onCompleted() { + futureResult.set(results) + } + + override fun onNext(result: PipelineResult?) { + results.add(result!!) + } + + override fun onError(t: Throwable?) { + futureResult.setException(t) + } + }, + ) + + return futureResult + } + else -> { + TODO() + } + } + } + + fun execute(db: Firestore, observer: ApiStreamObserver): Unit { + when (db) { + is FirestoreImpl -> { + val pipelineValue = toProto() + val request = + ExecutePipelineRequest.newBuilder() + .setDatabase(db.resourcePath.databaseName.toString()) + .setStructuredPipeline( + StructuredPipeline.newBuilder().setPipeline(pipelineValue.pipelineValue).build() + ) + .build() + + pipelineInternalStream( + db, + request, + object : PipelineResultObserver() { + override fun onCompleted() { + observer.onCompleted() + } + + override fun onNext(result: PipelineResult?) { + observer.onNext(result) + } + + override fun onError(t: Throwable?) { + observer.onError(t) + } + }, + ) + } + else -> { + TODO() + } + } + } + + internal fun toProto(): Value { + return Value.newBuilder() + .setPipelineValue( + com.google.firestore.v1.Pipeline.newBuilder().addAllStages(stages.map { toStageProto(it) }) + ) + .build() + } +} + +internal fun encodeValue(value: Any?): Value? { + return UserDataConverter.encodeValue(FieldPath.empty(), value, UserDataConverter.ARGUMENT) +} + +private abstract class PipelineResultObserver : ApiStreamObserver { + var executionTime: Timestamp? = null + private set + + fun onCompleted(executionTime: Timestamp?) { + this.executionTime = executionTime + this.onCompleted() + } +} + +private fun pipelineInternalStream( + rpcContext: FirestoreImpl, + request: ExecutePipelineRequest, + resultObserver: PipelineResultObserver, +) { + val observer: ResponseObserver = + object : ResponseObserver { + var executionTime: Timestamp? = null + var firstResponse: Boolean = false + var numDocuments: Int = 0 + + // The stream's `onComplete()` could be called more than once, + // this flag makes sure only the first one is actually processed. + var hasCompleted: Boolean = false + + override fun onStart(streamController: StreamController) {} + + override fun onResponse(response: ExecutePipelineResponse) { + if (!firstResponse) { + firstResponse = true + Tracing.getTracer().currentSpan.addAnnotation("Firestore.Query: First response") + } + if (response.resultsCount > 0) { + numDocuments += response.resultsCount + if (numDocuments % 100 == 0) { + Tracing.getTracer().currentSpan.addAnnotation("Firestore.Query: Received 100 documents") + } + response.resultsList.forEach { doc: Document -> + resultObserver.onNext( + PipelineResult.fromDocument(rpcContext, response.executionTime, doc) + ) + } + } + + if (executionTime == null) { + executionTime = Timestamp.fromProto(response.executionTime) + } + } + + override fun onError(throwable: Throwable) { + Tracing.getTracer().currentSpan.addAnnotation("Firestore.Query: Error") + resultObserver.onError(throwable) + } + + override fun onComplete() { + if (hasCompleted) { + return + } + hasCompleted = true + + Tracing.getTracer() + .currentSpan + .addAnnotation( + "Firestore.Query: Completed", + ImmutableMap.of( + "numDocuments", + AttributeValue.longAttributeValue(numDocuments.toLong()), + ), + ) + resultObserver.onCompleted(executionTime) + } + } + + Logger.getLogger("Pipeline").log(Level.WARNING, "Sending request: $request") + + rpcContext.streamRequest(request, observer, rpcContext.client.executePipelineCallable()) +} diff --git a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Query.java b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Query.java index d71bc5a30..15ed4cf65 100644 --- a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Query.java +++ b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Query.java @@ -16,6 +16,8 @@ package com.google.cloud.firestore; +import static com.google.cloud.firestore.PipelineUtils.toPaginatedPipeline; +import static com.google.cloud.firestore.PipelineUtils.toPipelineFilterCondition; import static com.google.common.collect.Lists.reverse; import static com.google.firestore.v1.StructuredQuery.FieldFilter.Operator.ARRAY_CONTAINS; import static com.google.firestore.v1.StructuredQuery.FieldFilter.Operator.ARRAY_CONTAINS_ANY; @@ -38,6 +40,11 @@ import com.google.auto.value.AutoValue; import com.google.cloud.Timestamp; import com.google.cloud.firestore.Query.QueryOptions.Builder; +import com.google.cloud.firestore.pipeline.Field; +import com.google.cloud.firestore.pipeline.Selectable; +import com.google.cloud.firestore.pipeline.Sort.Density; +import com.google.cloud.firestore.pipeline.Sort.Ordering; +import com.google.cloud.firestore.pipeline.Sort.Truncation; import com.google.cloud.firestore.v1.FirestoreSettings; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; @@ -54,6 +61,7 @@ import com.google.firestore.v1.StructuredQuery.FieldReference; import com.google.firestore.v1.StructuredQuery.Filter; import com.google.firestore.v1.StructuredQuery.Order; +import com.google.firestore.v1.StructuredQuery.UnaryFilter; import com.google.firestore.v1.Value; import com.google.protobuf.ByteString; import com.google.protobuf.Int32Value; @@ -74,6 +82,7 @@ import java.util.concurrent.Executor; import java.util.concurrent.atomic.AtomicReference; import java.util.logging.Logger; +import java.util.stream.Collectors; import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.threeten.bp.Duration; @@ -172,6 +181,11 @@ public List getFilters() { return filters; } + @Nonnull + CompositeFilter.Operator getOperator() { + return this.operator; + } + @Nullable @Override public FieldReference getFirstInequalityField() { @@ -237,7 +251,7 @@ public List getFlattenedFilters() { } } - private static class UnaryFilterInternal extends FieldFilterInternal { + static class UnaryFilterInternal extends FieldFilterInternal { private final StructuredQuery.UnaryFilter.Operator operator; @@ -264,6 +278,11 @@ Filter toProto() { return result.build(); } + @Nonnull + UnaryFilter.Operator getOperator() { + return this.operator; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -2100,6 +2119,66 @@ public AggregateQuery aggregate( return new AggregateQuery(this, aggregateFieldList); } + @Nonnull + public Pipeline toPipeline() { + // From + Pipeline ppl = + Pipeline.fromCollection( + this.options.getParentPath().append(this.options.getCollectionId()).getPath()); + + // Filters + for (FilterInternal f : this.options.getFilters()) { + ppl = ppl.filter(toPipelineFilterCondition(f)); + } + + // Projections + if (this.options.getFieldProjections() != null + && !this.options.getFieldProjections().isEmpty()) { + ppl = + ppl.select( + this.options.getFieldProjections().stream() + .map(fieldReference -> Field.of(fieldReference.getFieldPath())) + .toArray(Selectable[]::new)); + } + + // Orders + List normalizedOrderbys = this.createImplicitOrderBy(); + if (normalizedOrderbys != null && !normalizedOrderbys.isEmpty()) { + List orders = + normalizedOrderbys.stream() + .map( + fieldOrder -> + Ordering.of( + Field.of(fieldOrder.fieldReference.getFieldPath()), + fieldOrder.direction == Direction.ASCENDING + ? Ordering.Direction.ASCENDING + : Ordering.Direction.DESCENDING)) + .collect(Collectors.toList()); + ppl = ppl.sort(orders, Density.REQUIRED, Truncation.UNSPECIFIED); + } + + // Cursors, Limit and Offset + if (this.options.getStartCursor() != null || this.options.getEndCursor() != null) { + ppl = + toPaginatedPipeline( + ppl, + options.getStartCursor(), + options.getEndCursor(), + options.getLimit(), + options.getLimitType(), + options.getOffset()); + } else { // Limit & Offset without cursors + if (this.options.getOffset() != null) { + ppl = ppl.offset(this.options.getOffset()); + } + if (this.options.getLimit() != null) { + ppl = ppl.limit(this.options.getLimit()); + } + } + + return ppl; + } + /** * Returns true if this Query is equal to the provided object. * diff --git a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/UserDataConverter.java b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/UserDataConverter.java index e1fec41af..1f077f756 100644 --- a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/UserDataConverter.java +++ b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/UserDataConverter.java @@ -16,7 +16,10 @@ package com.google.cloud.firestore; +import static com.google.cloud.firestore.pipeline.Expressions.exprToValue; + import com.google.cloud.Timestamp; +import com.google.cloud.firestore.pipeline.Expr; import com.google.common.base.Preconditions; import com.google.common.collect.Lists; import com.google.common.collect.Maps; @@ -156,6 +159,8 @@ static Value encodeValue( } else if (sanitizedObject instanceof Blob) { Blob blob = (Blob) sanitizedObject; return Value.newBuilder().setBytesValue(blob.toByteString()).build(); + } else if (sanitizedObject instanceof Expr) { + return exprToValue((Expr) sanitizedObject); } else if (sanitizedObject instanceof Value) { return (Value) sanitizedObject; } else if (sanitizedObject instanceof DocumentReference) { diff --git a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/pipeline/Expressions.kt b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/pipeline/Expressions.kt new file mode 100644 index 000000000..b4f6ce449 --- /dev/null +++ b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/pipeline/Expressions.kt @@ -0,0 +1,643 @@ +@file:JvmName("Expressions") +package com.google.cloud.firestore.pipeline + +import com.google.cloud.Timestamp +import com.google.cloud.firestore.Blob +import com.google.cloud.firestore.DocumentReference +import com.google.cloud.firestore.FieldPath +import com.google.cloud.firestore.GeoPoint +import com.google.cloud.firestore.Pipeline +import com.google.cloud.firestore.encodeValue +import com.google.cloud.firestore.pipeline.Function.ArrayContains +import com.google.cloud.firestore.pipeline.Function.ArrayContainsAny +import com.google.cloud.firestore.pipeline.Function.Avg +import com.google.cloud.firestore.pipeline.Function.CosineDistance +import com.google.cloud.firestore.pipeline.Function.Count +import com.google.cloud.firestore.pipeline.Function.DotProductDistance +import com.google.cloud.firestore.pipeline.Function.Equal +import com.google.cloud.firestore.pipeline.Function.EuclideanDistance +import com.google.cloud.firestore.pipeline.Function.GreaterThan +import com.google.cloud.firestore.pipeline.Function.GreaterThanOrEqual +import com.google.cloud.firestore.pipeline.Function.In +import com.google.cloud.firestore.pipeline.Function.IsNaN +import com.google.cloud.firestore.pipeline.Function.IsNull +import com.google.cloud.firestore.pipeline.Function.LessThan +import com.google.cloud.firestore.pipeline.Function.LessThanOrEqual +import com.google.cloud.firestore.pipeline.Function.NotEqual +import com.google.cloud.firestore.pipeline.Function.Sum +import com.google.cloud.firestore.pipeline.Sort.Ordering +import com.google.cloud.firestore.pipeline.Sort.Ordering.Direction +import com.google.firestore.v1.ArrayValue +import com.google.firestore.v1.Value +import java.util.Date + +internal fun exprToValue(expr: Expr): Value { + return when (expr) { + is Constant -> expr.toProto() + is Field -> expr.toProto() + is Function -> expr.toProto() + is ListOfExprs -> { + Value.newBuilder() + .setArrayValue( + ArrayValue.newBuilder().addAllValues(expr.conditions.map { exprToValue(it) }) + ) + .build() + } + else -> { + TODO() + } + } +} + +interface Selectable + +internal class ExprWithAlias internal constructor(val alias: String, val expr: Expr) : Selectable + +interface Expr { + // Infix functions returning Function subclasses + infix fun equal(other: Expr) = Equal(this, other) + + infix fun equal(other: Any) = Equal(this, Constant.of(other)) + + infix fun notEqual(other: Expr) = NotEqual(this, other) + + infix fun notEqual(other: Any) = NotEqual(this, Constant.of(other)) + + infix fun greaterThan(other: Expr) = GreaterThan(this, other) + + infix fun greaterThan(other: Any) = GreaterThan(this, Constant.of(other)) + + infix fun greaterThanOrEqual(other: Expr) = GreaterThanOrEqual(this, other) + + infix fun greaterThanOrEqual(other: Any) = GreaterThanOrEqual(this, Constant.of(other)) + + infix fun lessThan(other: Expr) = LessThan(this, other) + + infix fun lessThan(other: Any) = LessThan(this, Constant.of(other)) + + infix fun lessThanOrEqual(other: Expr) = LessThanOrEqual(this, other) + + infix fun lessThanOrEqual(other: Any) = LessThanOrEqual(this, Constant.of(other)) + + fun inAny(vararg other: Any) = + In( + this, + other.toList().map { + when (it) { + is Expr -> it + else -> Constant.of(it) + } + }, + ) + + fun notInAny(vararg other: Any) = + Function.Not( + In( + this, + other.toList().map { + when (it) { + is Expr -> it + else -> Constant.of(it) + } + }, + ) + ) + + infix fun arrayContains(element: Expr) = ArrayContains(this, element) + + infix fun arrayContains(element: Any) = ArrayContains(this, Constant.of(element)) + + fun arrayContainsAny(vararg elements: Expr) = ArrayContainsAny(this, elements.toList()) + + fun arrayContainsAny(vararg elements: Any) = + ArrayContainsAny(this, elements.toList().map { Constant.of(it) }) + + fun isNaN() = IsNaN(this) + + fun isNull() = IsNull(this) + + fun sum() = Sum(this, false) + + fun avg() = Avg(this, false) + + fun count() = Count(this, false) + + fun min() = Function.Min(this, false) + + fun max() = Function.Max(this, false) + + infix fun cosineDistance(other: Expr) = CosineDistance(this, other) + + infix fun cosineDistance(other: DoubleArray) = CosineDistance(this, Constant.ofVector(other)) + + infix fun euclideanDistance(other: Expr) = EuclideanDistance(this, other) + + infix fun euclideanDistance(other: DoubleArray) = + EuclideanDistance(this, Constant.ofVector(other)) + + infix fun dotProductDistance(other: Expr) = DotProductDistance(this, other) + + infix fun dotProductDistance(other: DoubleArray) = + DotProductDistance(this, Constant.ofVector(other)) + + fun ascending(): Ordering { + return Ordering(this, Direction.ASCENDING) + } + + fun descending(): Ordering { + return Ordering(this, Direction.DESCENDING) + } + + fun asAlias(alias: String): Selectable { + return ExprWithAlias(alias, this) + } +} + +// Convenient class for internal usage +internal data class ListOfExprs(val conditions: List) : Expr + +data class Constant internal constructor(private val value: Any?) : Expr { + companion object { + @JvmStatic + fun of(value: String?): Constant { + return Constant(value) + } + + @JvmStatic + fun of(value: Number?): Constant { + return Constant(value) + } + + @JvmStatic + fun of(value: Date?): Constant { + return Constant(value) + } + + @JvmStatic + fun of(value: Timestamp?): Constant { + return Constant(value) + } + + @JvmStatic + fun of(value: Boolean?): Constant { + return Constant(value) + } + + @JvmStatic + fun of(value: GeoPoint?): Constant { + return Constant(value) + } + + @JvmStatic + fun of(value: Blob?): Constant { + return Constant(value) + } + + @JvmStatic + fun of(value: DocumentReference?): Constant { + return Constant(value) + } + + @JvmStatic + fun of(value: Value?): Constant { + return Constant(value) + } + + @JvmStatic + internal fun of(value: Any?): Constant { + if (value == null) { + return Constant(null) + } + + return when (value) { + is String -> of(value) + is Number -> of(value) + is Date -> of(value) + is Timestamp -> of(value) + is Boolean -> of(value) + is GeoPoint -> of(value) + is Blob -> of(value) + is DocumentReference -> of(value) + is Value -> of(value) + else -> TODO("Unknown type: $value") + } + } + + @JvmStatic + fun ofArray(value: Iterable): Constant { + return Constant(value) + } + + @JvmStatic + fun ofArray(value: Array): Constant { + return Constant(value) + } + + @JvmStatic + fun ofMap(value: Map): Constant { + return Constant(value) + } + + @JvmStatic + fun ofVector(value: DoubleArray): Constant { + // TODO: Vector is really a map, not a list + return Constant(value.asList()) + } + } + + internal fun toProto(): Value { + return encodeValue(value)!! + } +} + +data class Field internal constructor( + internal val path: FieldPath, + private var pipeline: Pipeline? = null +) : + Expr, Selectable { + companion object { + const val DOCUMENT_ID: String = "__name__" + + @JvmStatic + fun of(path: String): Field { + return Field(FieldPath.of(path)) + } + + @JvmStatic + fun ofAll(): Field { + return Field(FieldPath.of("")) + } + } + + internal fun toProto(): Value { + return Value.newBuilder().setFieldReferenceValue(path.toString()).build() + } +} + +data class Fields internal constructor(internal val fs: List? = null) : Expr, Selectable { + companion object { + @JvmStatic + fun of(f1: String, vararg f: String): Fields { + return Fields(listOf(Field.of(f1)) + f.map(Field.Companion::of)) + } + + @JvmStatic + fun ofAll(): Fields { + return Fields(listOf(Field.of(""))) + } + } +} + +data class AggregatorTarget +internal constructor( + internal val accumulator: Function.Accumulator, + internal val fieldName: String, + override var distinct: Boolean, +) : Selectable, Function.Accumulator + +open class Function(val name: String, val params: List) : Expr { + interface FilterCondition : Expr + + interface Accumulator : Expr { + var distinct: Boolean + + fun distinct(on: Boolean): Accumulator { + this.distinct = on + return this + } + + fun toField(target: String) = AggregatorTarget(this, target, this.distinct) + } + + internal fun toProto(): Value { + return Value.newBuilder() + .setFunctionValue( + com.google.firestore.v1.Function.newBuilder() + .setName(name) + .addAllArgs(params.map { exprToValue(it) }) + ) + .build() + } + + data class Equal internal constructor(private val left: Expr, private val right: Expr) : + Function("eq", listOf(left, right)), FilterCondition + + data class NotEqual internal constructor(private val left: Expr, private val right: Expr) : + Function("neq", listOf(left, right)), FilterCondition + + data class GreaterThan internal constructor(private val left: Expr, private val right: Expr) : + Function("gt", listOf(left, right)), FilterCondition + + data class GreaterThanOrEqual internal constructor( + private val left: Expr, + private val right: Expr + ) : + Function("gte", listOf(left, right)), FilterCondition + + data class LessThan internal constructor(private val left: Expr, private val right: Expr) : + Function("lt", listOf(left, right)), FilterCondition + + data class LessThanOrEqual internal constructor(private val left: Expr, private val right: Expr) : + Function("lte", listOf(left, right)), FilterCondition + + data class In internal constructor(private val left: Expr, private val others: List) : + Function("in", listOf(left, ListOfExprs(others))), FilterCondition // For 'in' + + data class And internal constructor(private val conditions: List) : + Function("and", conditions), + FilterCondition where + T : FilterCondition + + data class Or internal constructor(private val conditions: List) : + Function("or", conditions), + FilterCondition where + T : FilterCondition + + data class Not internal constructor(private val condition: Expr) : + Function("not", listOf(condition)), FilterCondition + + data class ArrayContains internal constructor( + private val array: Expr, + private val element: Expr + ) : + Function("array_contains", listOf(array, element)), FilterCondition + + data class ArrayContainsAny internal constructor( + private val array: Expr, + private val elements: List + ) : + Function("array_contains_any", listOf(array, ListOfExprs(elements))), FilterCondition + + data class IsNaN internal constructor(private val value: Expr) : + Function("is_nan", listOf(value)), FilterCondition + + data class IsNull internal constructor(private val value: Expr) : + Function("is_null", listOf(value)), FilterCondition + + data class Sum internal constructor(private val value: Expr, override var distinct: Boolean) : + Function("sum", listOf(value)), Accumulator + + data class Avg internal constructor(private val value: Expr, override var distinct: Boolean) : + Function("avg", listOf(value)), Accumulator + + data class Count internal constructor(private val value: Expr?, override var distinct: Boolean) : + Function("count", value?.let { listOf(it) } ?: emptyList()), Accumulator + + data class Min internal constructor(private val value: Expr, override var distinct: Boolean) : + Function("min", listOf(value)), Accumulator + + data class Max internal constructor(private val value: Expr, override var distinct: Boolean) : + Function("max", listOf(value)), Accumulator + + data class CosineDistance internal constructor( + private val vector1: Expr, + private val vector2: Expr + ) : + Function("cosine_distance", listOf(vector1, vector2)) + + data class DotProductDistance internal constructor( + private val vector1: Expr, + private val vector2: Expr + ) : + Function("dot_product", listOf(vector1, vector2)) + + data class EuclideanDistance internal constructor( + private val vector1: Expr, + private val vector2: Expr + ) : + Function("euclidean_distance", listOf(vector1, vector2)) + + data class Generic internal constructor(private val n: String, private val ps: List) : + Function(n, ps) + + companion object { + @JvmStatic fun equal(left: Expr, right: Expr) = Equal(left, right) + + @JvmStatic fun equal(left: Expr, right: Any) = Equal(left, Constant.of(right)) + + @JvmStatic + fun equal(left: String, right: Expr) = Equal(Field.of(left), right) + + @JvmStatic + fun equal(left: String, right: Any) = Equal(Field.of(left), Constant.of(right)) + + @JvmStatic fun notEqual(left: Expr, right: Expr) = NotEqual(left, right) + + @JvmStatic fun notEqual(left: Expr, right: Any) = NotEqual(left, Constant.of(right)) + + @JvmStatic fun notEqual(left: String, right: Expr) = NotEqual(Field.of(left), right) + + @JvmStatic fun notEqual(left: String, right: Any) = NotEqual(Field.of(left), Constant.of(right)) + + @JvmStatic fun greaterThan(left: Expr, right: Expr) = GreaterThan(left, right) + + @JvmStatic fun greaterThan(left: Expr, right: Any) = GreaterThan(left, Constant.of(right)) + + @JvmStatic fun greaterThan(left: String, right: Expr) = GreaterThan(Field.of(left), right) + + @JvmStatic fun greaterThan(left: String, right: Any) = GreaterThan(Field.of(left), Constant.of(right)) + + @JvmStatic fun greaterThanOrEqual(left: Expr, right: Expr) = GreaterThanOrEqual(left, right) + + @JvmStatic + fun greaterThanOrEqual(left: Expr, right: Any) = GreaterThanOrEqual(left, Constant.of(right)) + + @JvmStatic fun greaterThanOrEqual(left: String, right: Expr) = GreaterThanOrEqual(Field.of(left), right) + + @JvmStatic + fun greaterThanOrEqual(left: String, right: Any) = GreaterThanOrEqual(Field.of(left), Constant.of(right)) + + @JvmStatic fun lessThan(left: Expr, right: Expr) = LessThan(left, right) + + @JvmStatic fun lessThan(left: Expr, right: Any) = LessThan(left, Constant.of(right)) + + @JvmStatic fun lessThan(left: String, right: Expr) = LessThan(Field.of(left), right) + + @JvmStatic fun lessThan(left: String, right: Any) = LessThan(Field.of(left), Constant.of(right)) + + @JvmStatic fun lessThanOrEqual(left: Expr, right: Expr) = LessThanOrEqual(left, right) + + @JvmStatic + fun lessThanOrEqual(left: Expr, right: Any) = LessThanOrEqual(left, Constant.of(right)) + + @JvmStatic fun lessThanOrEqual(left: String, right: Expr) = LessThanOrEqual(Field.of(left), right) + + @JvmStatic + fun lessThanOrEqual(left: String, right: Any) = LessThanOrEqual(Field.of(left), Constant.of(right)) + + @JvmStatic + fun inAny(left: Expr, values: List) = + In( + left, + values.map { + when (it) { + is Expr -> it + else -> Constant.of(it) + } + }, + ) + + @JvmStatic + fun inAny(left: String, values: List) = + In( + Field.of(left), + values.map { + when (it) { + is Expr -> it + else -> Constant.of(it) + } + }, + ) + + @JvmStatic + fun notInAny(left: Expr, values: List) = + Not( + In( + left, + values.map { + when (it) { + is Expr -> it + else -> Constant.of(it) + } + }, + ) + ) + + @JvmStatic + fun notInAny(left: String, values: List) = + Not( + In( + Field.of(left), + values.map { + when (it) { + is Expr -> it + else -> Constant.of(it) + } + }, + ) + ) + + + @JvmStatic + fun and(left: T, right: T) where T : FilterCondition, T : Expr = And(listOf(left, right)) + + @JvmStatic + fun and(left: T, vararg other: T) where T : FilterCondition, T : Expr = + And(listOf(left) + other.toList()) + + @JvmStatic + fun or(left: T, right: T) where T : FilterCondition, T : Expr = Or(listOf(left, right)) + + @JvmStatic + fun or(left: T, vararg other: T) where T : FilterCondition, T : Expr = + Or(listOf(left) + other.toList()) + + @JvmStatic fun arrayContains(expr: Expr, element: Expr) = ArrayContains(expr, element) + + @JvmStatic + fun arrayContains(field: String, element: Expr) = ArrayContains(Field.of(field), element) + + @JvmStatic + fun arrayContains(expr: Expr, element: Any) = ArrayContains(expr, Constant.of(element)) + + @JvmStatic + fun arrayContains(field: String, element: Any) = + ArrayContains(Field.of(field), Constant.of(element)) + + @JvmStatic + fun arrayContainsAny(expr: Expr, vararg elements: Expr) = + ArrayContainsAny(expr, elements.toList()) + + @JvmStatic + fun arrayContainsAny(expr: Expr, vararg elements: Any) = + ArrayContainsAny(expr, elements.toList().map { Constant.of(it) }) + + @JvmStatic + fun arrayContainsAny(field: String, vararg elements: Expr) = + ArrayContainsAny(Field.of(field), elements.toList()) + + @JvmStatic + fun arrayContainsAny(field: String, vararg elements: Any) = + ArrayContainsAny(Field.of(field), elements.toList().map { Constant.of(it) }) + + @JvmStatic fun isNaN(expr: Expr) = IsNaN(expr) + + @JvmStatic + fun isNaN(field: String) = IsNaN(Field.of(field)) + + @JvmStatic fun isNull(expr: Expr) = IsNull(expr) + + @JvmStatic + fun isNull(field: String) = IsNull(Field.of(field)) + + @JvmStatic fun not(expr: Expr) = Not(expr) + + @JvmStatic fun sum(expr: Expr) = Sum(expr, false) + + @JvmStatic + fun sum(field: String) = Sum(Field.of(field), false) + + @JvmStatic fun avg(expr: Expr) = Avg(expr, false) + + @JvmStatic + fun avg(field: String) = Avg(Field.of(field), false) + + @JvmStatic fun min(expr: Expr) = Sum(expr, false) + + @JvmStatic + fun min(field: String) = Sum(Field.of(field), false) + + @JvmStatic fun max(expr: Expr) = Avg(expr, false) + + @JvmStatic + fun max(field: String) = Avg(Field.of(field), false) + + @JvmStatic fun count(expr: Expr) = Count(expr, false) + + @JvmStatic + fun count(field: String) = Count(Field.of(field), false) + + @JvmStatic fun countAll() = Count(null, false) + + @JvmStatic fun cosineDistance(expr: Expr, other: Expr) = CosineDistance(expr, other) + + @JvmStatic + fun cosineDistance(expr: Expr, other: DoubleArray) = + CosineDistance(expr, Constant.ofVector(other)) + + @JvmStatic + fun cosineDistance(field: String, other: Expr) = CosineDistance(Field.of(field), other) + + @JvmStatic + fun cosineDistance(field: String, other: DoubleArray) = + CosineDistance(Field.of(field), Constant.ofVector(other)) + + @JvmStatic fun dotProductDistance(expr: Expr, other: Expr) = CosineDistance(expr, other) + + @JvmStatic + fun dotProductDistance(expr: Expr, other: DoubleArray) = + CosineDistance(expr, Constant.ofVector(other)) + + @JvmStatic + fun dotProductDistance(field: String, other: Expr) = CosineDistance(Field.of(field), other) + + @JvmStatic + fun dotProductDistance(field: String, other: DoubleArray) = + CosineDistance(Field.of(field), Constant.ofVector(other)) + + @JvmStatic fun euclideanDistance(expr: Expr, other: Expr) = EuclideanDistance(expr, other) + + @JvmStatic + fun euclideanDistance(expr: Expr, other: DoubleArray) = + EuclideanDistance(expr, Constant.ofVector(other)) + + @JvmStatic + fun euclideanDistance(field: String, other: Expr) = EuclideanDistance(Field.of(field), other) + + @JvmStatic + fun euclideanDistance(field: String, other: DoubleArray) = + EuclideanDistance(Field.of(field), Constant.ofVector(other)) + + @JvmStatic fun function(name: String, params: List) = Generic(name, params) + } +} diff --git a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/pipeline/Stages.kt b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/pipeline/Stages.kt new file mode 100644 index 000000000..b415b94f6 --- /dev/null +++ b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/pipeline/Stages.kt @@ -0,0 +1,265 @@ +@file:JvmName("Stages") +package com.google.cloud.firestore.pipeline + +import com.google.cloud.firestore.DocumentReference +import com.google.cloud.firestore.encodeValue +import com.google.firestore.v1.MapValue +import com.google.firestore.v1.Value +import java.util.Locale + +internal interface Stage + +internal data class Collection(internal val relativePath: String) : Stage { + val name = "collection" +} + +internal data class CollectionGroup(internal val collectionId: String) : Stage { + val name = "collection_group" +} + +internal class Database : Stage { + val name = "database" +} + +internal data class Documents(internal val documents: List) : Stage { + val name = "documents" + + companion object { + @JvmStatic + fun of(vararg documents: DocumentReference): Documents { + return Documents(documents.map { "/" + it.path }) + } + } +} + +internal data class Select(internal val projections: Map) : Stage { + val name = "select" +} + +internal data class AddFields(internal val fields: Map) : Stage { + val name = "add_fields" +} + +internal data class Filter(internal val condition: T) : Stage where +T : Function.FilterCondition, +T : Expr { + val name = "filter" +} + +internal class Offset(internal val offset: Int) : Stage { + val name = "offset" +} + +internal class Limit(internal val limit: Int) : Stage { + val name = "limit" +} + +class Aggregate +internal constructor( + internal val groups: Map, + internal val accumulators: Map, +) : Stage { + val name = "aggregate" + + internal constructor( + vararg aggregators: AggregatorTarget + ) : this(emptyMap(), aggregators.associate { it.fieldName to it.accumulator }) +} + +class FindNearest +internal constructor( + internal val property: Field, + internal val vector: DoubleArray, + internal val distanceMeasure: DistanceMeasure, + internal val options: FindNearestOptions, +) : Stage { + val name = "find_nearest" + + interface DistanceMeasure { + data object Euclidean : DistanceMeasure + + data object Cosine : DistanceMeasure + + data object DotProduct : DistanceMeasure + + class GenericDistanceMeasure(val name: String) : DistanceMeasure + + fun toProtoString(): String { + return when (this) { + is Euclidean -> "euclidean" + is Cosine -> "cosine" + is DotProduct -> "dot_product" + is GenericDistanceMeasure -> name + else -> throw IllegalArgumentException("Unknown distance measure") + } + } + + companion object { + @JvmStatic fun euclidean() = Euclidean + + @JvmStatic fun cosine() = Cosine + + @JvmStatic fun dotProduct() = DotProduct + + @JvmStatic fun generic(name: String) = GenericDistanceMeasure(name) + } + } + + class FindNearestOptions internal constructor( + val limit: Long, + val distanceMeasure: DistanceMeasure, + val output: Field? = null + ) { + companion object { + @JvmStatic + fun newInstance(limit: Long, distanceMeasure: DistanceMeasure, output: Field? = null) = + FindNearestOptions(limit, distanceMeasure, output) + } + } +} + +class Sort +internal constructor( + internal val orders: List, + internal val density: Density = Density.UNSPECIFIED, + internal val truncation: Truncation = Truncation.UNSPECIFIED, +) : Stage { + val name = "sort" + + enum class Density { + UNSPECIFIED, + REQUIRED; + + override fun toString(): String = name.lowercase(Locale.getDefault()) + } + + enum class Truncation { + UNSPECIFIED, + DISABLED; + + override fun toString(): String = name.lowercase(Locale.getDefault()) + } + + class Ordering + internal constructor(private val expr: Expr, private val dir: Direction = Direction.ASCENDING) { + enum class Direction { + ASCENDING, + DESCENDING; + + override fun toString(): String = name.lowercase(Locale.getDefault()) + } + + internal fun toProto(): Value { + return Value.newBuilder() + .setMapValue( + MapValue.newBuilder() + .putFields("direction", encodeValue(dir.toString())) + .putFields("expression", encodeValue(expr)) + .build() + ) + .build() + } + + companion object { + @JvmStatic + fun of(expr: Expr, dir: Direction = Direction.ASCENDING): Ordering { + return Ordering(expr, dir) + } + + @JvmStatic + fun of(expr: Expr): Ordering { + return Ordering(expr, Direction.ASCENDING) + } + + @JvmStatic + fun ascending(expr: Expr): Ordering { + return Ordering(expr, Direction.ASCENDING) + } + + @JvmStatic + fun descending(expr: Expr): Ordering { + return Ordering(expr, Direction.DESCENDING) + } + } + } +} + +internal class GenericStage(internal val name: String, internal val params: List) : Stage {} + +internal fun toStageProto(stage: Stage): com.google.firestore.v1.Pipeline.Stage { + return when (stage) { + is Collection -> + com.google.firestore.v1.Pipeline.Stage.newBuilder() + .setName(stage.name) + .addArgs(Value.newBuilder().setReferenceValue("").build()) + .addArgs(Value.newBuilder().setStringValue(stage.relativePath).build()) + .build() + is CollectionGroup -> + com.google.firestore.v1.Pipeline.Stage.newBuilder() + .setName(stage.name) + .addArgs(Value.newBuilder().setReferenceValue("").build()) + .addArgs(encodeValue(stage.collectionId)) + .build() + is Database -> com.google.firestore.v1.Pipeline.Stage.newBuilder().setName(stage.name).build() + is Documents -> + com.google.firestore.v1.Pipeline.Stage.newBuilder() + .setName(stage.name) + .addAllArgs(stage.documents.map { Value.newBuilder().setReferenceValue(it).build() }) + .build() + is Select -> + com.google.firestore.v1.Pipeline.Stage.newBuilder() + .setName(stage.name) + .addArgs(encodeValue(stage.projections)) + .build() + is AddFields -> + com.google.firestore.v1.Pipeline.Stage.newBuilder() + .setName(stage.name) + .addArgs(encodeValue(stage.fields)) + .build() + is Filter<*> -> + com.google.firestore.v1.Pipeline.Stage.newBuilder() + .setName(stage.name) + .addArgs(encodeValue(stage.condition)) + .build() + is Sort -> + com.google.firestore.v1.Pipeline.Stage.newBuilder() + .setName(stage.name) + .addAllArgs(stage.orders.map { it.toProto() }) + .putOptions("density", encodeValue(stage.density.toString())) + .putOptions("truncation", encodeValue(stage.truncation.toString())) + .build() + is Offset -> + com.google.firestore.v1.Pipeline.Stage.newBuilder() + .setName(stage.name) + .addArgs(encodeValue(stage.offset)) + .build() + is Limit -> + com.google.firestore.v1.Pipeline.Stage.newBuilder() + .setName(stage.name) + .addArgs(encodeValue(stage.limit)) + .build() + is Aggregate -> + com.google.firestore.v1.Pipeline.Stage.newBuilder() + .setName(stage.name) + .addArgs(encodeValue(stage.groups)) + .addArgs(encodeValue(stage.accumulators)) + .build() + is FindNearest -> + com.google.firestore.v1.Pipeline.Stage.newBuilder() + .setName(stage.name) + .addArgs(encodeValue(stage.property)) + .addArgs(encodeValue(stage.vector)) + .addArgs(encodeValue(stage.distanceMeasure.toProtoString())) + .putOptions("limit", encodeValue(stage.options.limit)) + .putOptions("distance_field", encodeValue(stage.options.output)) + .build() + is GenericStage -> + com.google.firestore.v1.Pipeline.Stage.newBuilder() + .setName(stage.name) + .addAllArgs(stage.params.map { encodeValue(it) }) + .build() + else -> { + TODO() + } + } +} diff --git a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/spi/v1/FirestoreRpc.java b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/spi/v1/FirestoreRpc.java index c2172fafb..5c8dd4572 100644 --- a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/spi/v1/FirestoreRpc.java +++ b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/spi/v1/FirestoreRpc.java @@ -31,6 +31,8 @@ import com.google.firestore.v1.BeginTransactionResponse; import com.google.firestore.v1.CommitRequest; import com.google.firestore.v1.CommitResponse; +import com.google.firestore.v1.ExecutePipelineRequest; +import com.google.firestore.v1.ExecutePipelineResponse; import com.google.firestore.v1.ListCollectionIdsRequest; import com.google.firestore.v1.ListDocumentsRequest; import com.google.firestore.v1.ListenRequest; @@ -62,6 +64,10 @@ public interface FirestoreRpc extends AutoCloseable, ServiceRpc { /** Runs a query. */ ServerStreamingCallable runQueryCallable(); + /** Executes a pipeline. */ + ServerStreamingCallable + executePipelineCallable(); + /** Runs an aggregation query. */ ServerStreamingCallable runAggregationQueryCallable(); diff --git a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/spi/v1/GrpcFirestoreRpc.java b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/spi/v1/GrpcFirestoreRpc.java index c391e9b80..3eee842e6 100644 --- a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/spi/v1/GrpcFirestoreRpc.java +++ b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/spi/v1/GrpcFirestoreRpc.java @@ -49,6 +49,8 @@ import com.google.firestore.v1.CommitRequest; import com.google.firestore.v1.CommitResponse; import com.google.firestore.v1.DatabaseRootName; +import com.google.firestore.v1.ExecutePipelineRequest; +import com.google.firestore.v1.ExecutePipelineResponse; import com.google.firestore.v1.ListCollectionIdsRequest; import com.google.firestore.v1.ListDocumentsRequest; import com.google.firestore.v1.ListenRequest; @@ -230,6 +232,12 @@ public ServerStreamingCallable runQueryCallab return firestoreStub.runQueryCallable(); } + @Override + public ServerStreamingCallable + executePipelineCallable() { + return firestoreStub.executePipelineCallable(); + } + @Override public ServerStreamingCallable runAggregationQueryCallable() { diff --git a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/FirestoreClient.java b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/FirestoreClient.java index 95130776c..0aded0b0a 100644 --- a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/FirestoreClient.java +++ b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/FirestoreClient.java @@ -42,6 +42,8 @@ import com.google.firestore.v1.DeleteDocumentRequest; import com.google.firestore.v1.Document; import com.google.firestore.v1.DocumentMask; +import com.google.firestore.v1.ExecutePipelineRequest; +import com.google.firestore.v1.ExecutePipelineResponse; import com.google.firestore.v1.GetDocumentRequest; import com.google.firestore.v1.ListCollectionIdsRequest; import com.google.firestore.v1.ListCollectionIdsResponse; @@ -247,6 +249,16 @@ * * * + *

ExecutePipeline + *

Executes a pipeline query. + * + *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ *
    + *
  • executePipelineCallable() + *

+ * + * + * *

RunAggregationQuery *

Runs an aggregation query. *

Rather than producing [Document][google.firestore.v1.Document] results like [Firestore.RunQuery][google.firestore.v1.Firestore.RunQuery], this API allows running an aggregation to produce a series of [AggregationResult][google.firestore.v1.AggregationResult] server-side. @@ -1123,6 +1135,34 @@ public final ServerStreamingCallable runQuery return stub.runQueryCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Executes a pipeline query. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (FirestoreClient firestoreClient = FirestoreClient.create()) {
+   *   ExecutePipelineRequest request =
+   *       ExecutePipelineRequest.newBuilder().setDatabase("database1789464955").build();
+   *   ServerStream stream =
+   *       firestoreClient.executePipelineCallable().call(request);
+   *   for (ExecutePipelineResponse response : stream) {
+   *     // Do something when a response is received.
+   *   }
+   * }
+   * }
+ */ + public final ServerStreamingCallable + executePipelineCallable() { + return stub.executePipelineCallable(); + } + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Runs an aggregation query. diff --git a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/FirestoreSettings.java b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/FirestoreSettings.java index cd14ac440..687b81a60 100644 --- a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/FirestoreSettings.java +++ b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/FirestoreSettings.java @@ -46,6 +46,8 @@ import com.google.firestore.v1.CreateDocumentRequest; import com.google.firestore.v1.DeleteDocumentRequest; import com.google.firestore.v1.Document; +import com.google.firestore.v1.ExecutePipelineRequest; +import com.google.firestore.v1.ExecutePipelineResponse; import com.google.firestore.v1.GetDocumentRequest; import com.google.firestore.v1.ListCollectionIdsRequest; import com.google.firestore.v1.ListCollectionIdsResponse; @@ -155,6 +157,12 @@ public ServerStreamingCallSettings runQuerySe return ((FirestoreStubSettings) getStubSettings()).runQuerySettings(); } + /** Returns the object with the settings used for calls to executePipeline. */ + public ServerStreamingCallSettings + executePipelineSettings() { + return ((FirestoreStubSettings) getStubSettings()).executePipelineSettings(); + } + /** Returns the object with the settings used for calls to runAggregationQuery. */ public ServerStreamingCallSettings runAggregationQuerySettings() { @@ -356,6 +364,12 @@ public UnaryCallSettings.Builder rollbackSettings() { return getStubSettingsBuilder().runQuerySettings(); } + /** Returns the builder for the settings used for calls to executePipeline. */ + public ServerStreamingCallSettings.Builder + executePipelineSettings() { + return getStubSettingsBuilder().executePipelineSettings(); + } + /** Returns the builder for the settings used for calls to runAggregationQuery. */ public ServerStreamingCallSettings.Builder< RunAggregationQueryRequest, RunAggregationQueryResponse> diff --git a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/gapic_metadata.json b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/gapic_metadata.json index 05f7e5a5f..44b5ecb1d 100644 --- a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/gapic_metadata.json +++ b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/gapic_metadata.json @@ -28,6 +28,9 @@ "DeleteDocument": { "methods": ["deleteDocument", "deleteDocument", "deleteDocumentCallable"] }, + "ExecutePipeline": { + "methods": ["executePipelineCallable"] + }, "GetDocument": { "methods": ["getDocument", "getDocumentCallable"] }, diff --git a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/stub/FirestoreStub.java b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/stub/FirestoreStub.java index cd1576688..f79ecb994 100644 --- a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/stub/FirestoreStub.java +++ b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/stub/FirestoreStub.java @@ -35,6 +35,8 @@ import com.google.firestore.v1.CreateDocumentRequest; import com.google.firestore.v1.DeleteDocumentRequest; import com.google.firestore.v1.Document; +import com.google.firestore.v1.ExecutePipelineRequest; +import com.google.firestore.v1.ExecutePipelineResponse; import com.google.firestore.v1.GetDocumentRequest; import com.google.firestore.v1.ListCollectionIdsRequest; import com.google.firestore.v1.ListCollectionIdsResponse; @@ -107,6 +109,11 @@ public ServerStreamingCallable runQueryCallab throw new UnsupportedOperationException("Not implemented: runQueryCallable()"); } + public ServerStreamingCallable + executePipelineCallable() { + throw new UnsupportedOperationException("Not implemented: executePipelineCallable()"); + } + public ServerStreamingCallable runAggregationQueryCallable() { throw new UnsupportedOperationException("Not implemented: runAggregationQueryCallable()"); diff --git a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/stub/FirestoreStubSettings.java b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/stub/FirestoreStubSettings.java index 76215deaa..f4b0baacc 100644 --- a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/stub/FirestoreStubSettings.java +++ b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/stub/FirestoreStubSettings.java @@ -63,6 +63,8 @@ import com.google.firestore.v1.Cursor; import com.google.firestore.v1.DeleteDocumentRequest; import com.google.firestore.v1.Document; +import com.google.firestore.v1.ExecutePipelineRequest; +import com.google.firestore.v1.ExecutePipelineResponse; import com.google.firestore.v1.GetDocumentRequest; import com.google.firestore.v1.ListCollectionIdsRequest; import com.google.firestore.v1.ListCollectionIdsResponse; @@ -144,6 +146,8 @@ public class FirestoreStubSettings extends StubSettings { private final UnaryCallSettings commitSettings; private final UnaryCallSettings rollbackSettings; private final ServerStreamingCallSettings runQuerySettings; + private final ServerStreamingCallSettings + executePipelineSettings; private final ServerStreamingCallSettings runAggregationQuerySettings; private final PagedCallSettings< @@ -370,6 +374,12 @@ public ServerStreamingCallSettings runQuerySe return runQuerySettings; } + /** Returns the object with the settings used for calls to executePipeline. */ + public ServerStreamingCallSettings + executePipelineSettings() { + return executePipelineSettings; + } + /** Returns the object with the settings used for calls to runAggregationQuery. */ public ServerStreamingCallSettings runAggregationQuerySettings() { @@ -527,6 +537,7 @@ protected FirestoreStubSettings(Builder settingsBuilder) throws IOException { commitSettings = settingsBuilder.commitSettings().build(); rollbackSettings = settingsBuilder.rollbackSettings().build(); runQuerySettings = settingsBuilder.runQuerySettings().build(); + executePipelineSettings = settingsBuilder.executePipelineSettings().build(); runAggregationQuerySettings = settingsBuilder.runAggregationQuerySettings().build(); partitionQuerySettings = settingsBuilder.partitionQuerySettings().build(); writeSettings = settingsBuilder.writeSettings().build(); @@ -554,6 +565,9 @@ public static class Builder extends StubSettings.Builder rollbackSettings; private final ServerStreamingCallSettings.Builder runQuerySettings; + private final ServerStreamingCallSettings.Builder< + ExecutePipelineRequest, ExecutePipelineResponse> + executePipelineSettings; private final ServerStreamingCallSettings.Builder< RunAggregationQueryRequest, RunAggregationQueryResponse> runAggregationQuerySettings; @@ -595,6 +609,7 @@ public static class Builder extends StubSettings.BuildernewArrayList())); definitions.put( "no_retry_3_codes", ImmutableSet.copyOf(Lists.newArrayList())); definitions.put( @@ -653,6 +668,8 @@ public static class Builder extends StubSettings.Builder rollbackSettings() { return runQuerySettings; } + /** Returns the builder for the settings used for calls to executePipeline. */ + public ServerStreamingCallSettings.Builder + executePipelineSettings() { + return executePipelineSettings; + } + /** Returns the builder for the settings used for calls to runAggregationQuery. */ public ServerStreamingCallSettings.Builder< RunAggregationQueryRequest, RunAggregationQueryResponse> diff --git a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/stub/GrpcFirestoreStub.java b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/stub/GrpcFirestoreStub.java index a92d4a5e5..03808fdb0 100644 --- a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/stub/GrpcFirestoreStub.java +++ b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/stub/GrpcFirestoreStub.java @@ -40,6 +40,8 @@ import com.google.firestore.v1.CreateDocumentRequest; import com.google.firestore.v1.DeleteDocumentRequest; import com.google.firestore.v1.Document; +import com.google.firestore.v1.ExecutePipelineRequest; +import com.google.firestore.v1.ExecutePipelineResponse; import com.google.firestore.v1.GetDocumentRequest; import com.google.firestore.v1.ListCollectionIdsRequest; import com.google.firestore.v1.ListCollectionIdsResponse; @@ -159,6 +161,17 @@ public class GrpcFirestoreStub extends FirestoreStub { .setResponseMarshaller(ProtoUtils.marshaller(RunQueryResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor + executePipelineMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.SERVER_STREAMING) + .setFullMethodName("google.firestore.v1.Firestore/ExecutePipeline") + .setRequestMarshaller( + ProtoUtils.marshaller(ExecutePipelineRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ExecutePipelineResponse.getDefaultInstance())) + .build(); + private static final MethodDescriptor runAggregationQueryMethodDescriptor = MethodDescriptor.newBuilder() @@ -240,6 +253,8 @@ public class GrpcFirestoreStub extends FirestoreStub { private final UnaryCallable commitCallable; private final UnaryCallable rollbackCallable; private final ServerStreamingCallable runQueryCallable; + private final ServerStreamingCallable + executePipelineCallable; private final ServerStreamingCallable runAggregationQueryCallable; private final UnaryCallable partitionQueryCallable; @@ -388,6 +403,17 @@ protected GrpcFirestoreStub( return builder.build(); }) .build(); + GrpcCallSettings + executePipelineTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(executePipelineMethodDescriptor) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("database", String.valueOf(request.getDatabase())); + return builder.build(); + }) + .build(); GrpcCallSettings runAggregationQueryTransportSettings = GrpcCallSettings.newBuilder() @@ -495,6 +521,9 @@ protected GrpcFirestoreStub( this.runQueryCallable = callableFactory.createServerStreamingCallable( runQueryTransportSettings, settings.runQuerySettings(), clientContext); + this.executePipelineCallable = + callableFactory.createServerStreamingCallable( + executePipelineTransportSettings, settings.executePipelineSettings(), clientContext); this.runAggregationQueryCallable = callableFactory.createServerStreamingCallable( runAggregationQueryTransportSettings, @@ -590,6 +619,12 @@ public ServerStreamingCallable runQueryCallab return runQueryCallable; } + @Override + public ServerStreamingCallable + executePipelineCallable() { + return executePipelineCallable; + } + @Override public ServerStreamingCallable runAggregationQueryCallable() { diff --git a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/stub/HttpJsonFirestoreStub.java b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/stub/HttpJsonFirestoreStub.java index badc0f7e8..9b7ebafe8 100644 --- a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/stub/HttpJsonFirestoreStub.java +++ b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/stub/HttpJsonFirestoreStub.java @@ -45,6 +45,8 @@ import com.google.firestore.v1.CreateDocumentRequest; import com.google.firestore.v1.DeleteDocumentRequest; import com.google.firestore.v1.Document; +import com.google.firestore.v1.ExecutePipelineRequest; +import com.google.firestore.v1.ExecutePipelineResponse; import com.google.firestore.v1.GetDocumentRequest; import com.google.firestore.v1.ListCollectionIdsRequest; import com.google.firestore.v1.ListCollectionIdsResponse; @@ -430,6 +432,43 @@ public class HttpJsonFirestoreStub extends FirestoreStub { .build()) .build(); + private static final ApiMethodDescriptor + executePipelineMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.firestore.v1.Firestore/ExecutePipeline") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.SERVER_STREAMING) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{database=projects/*/databases/*}:executePipeline", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "database", request.getDatabase()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearDatabase().build(), true)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ExecutePipelineResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + private static final ApiMethodDescriptor runAggregationQueryMethodDescriptor = ApiMethodDescriptor.newBuilder() @@ -638,6 +677,8 @@ public class HttpJsonFirestoreStub extends FirestoreStub { private final UnaryCallable commitCallable; private final UnaryCallable rollbackCallable; private final ServerStreamingCallable runQueryCallable; + private final ServerStreamingCallable + executePipelineCallable; private final ServerStreamingCallable runAggregationQueryCallable; private final UnaryCallable partitionQueryCallable; @@ -794,6 +835,18 @@ protected HttpJsonFirestoreStub( return builder.build(); }) .build(); + HttpJsonCallSettings + executePipelineTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(executePipelineMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("database", String.valueOf(request.getDatabase())); + return builder.build(); + }) + .build(); HttpJsonCallSettings runAggregationQueryTransportSettings = HttpJsonCallSettings @@ -887,6 +940,9 @@ protected HttpJsonFirestoreStub( this.runQueryCallable = callableFactory.createServerStreamingCallable( runQueryTransportSettings, settings.runQuerySettings(), clientContext); + this.executePipelineCallable = + callableFactory.createServerStreamingCallable( + executePipelineTransportSettings, settings.executePipelineSettings(), clientContext); this.runAggregationQueryCallable = callableFactory.createServerStreamingCallable( runAggregationQueryTransportSettings, @@ -931,6 +987,7 @@ public static List getMethodDescriptors() { methodDescriptors.add(commitMethodDescriptor); methodDescriptors.add(rollbackMethodDescriptor); methodDescriptors.add(runQueryMethodDescriptor); + methodDescriptors.add(executePipelineMethodDescriptor); methodDescriptors.add(runAggregationQueryMethodDescriptor); methodDescriptors.add(partitionQueryMethodDescriptor); methodDescriptors.add(listCollectionIdsMethodDescriptor); @@ -992,6 +1049,12 @@ public ServerStreamingCallable runQueryCallab return runQueryCallable; } + @Override + public ServerStreamingCallable + executePipelineCallable() { + return executePipelineCallable; + } + @Override public ServerStreamingCallable runAggregationQueryCallable() { diff --git a/google-cloud-firestore/src/main/resources/META-INF/native-image/com.google.cloud.firestore.v1/reflect-config.json b/google-cloud-firestore/src/main/resources/META-INF/native-image/com.google.cloud.firestore.v1/reflect-config.json index 6d979acf6..d7f0fd007 100644 --- a/google-cloud-firestore/src/main/resources/META-INF/native-image/com.google.cloud.firestore.v1/reflect-config.json +++ b/google-cloud-firestore/src/main/resources/META-INF/native-image/com.google.cloud.firestore.v1/reflect-config.json @@ -854,6 +854,42 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.firestore.v1.ExecutePipelineRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.firestore.v1.ExecutePipelineRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.firestore.v1.ExecutePipelineResponse", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.firestore.v1.ExecutePipelineResponse$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.firestore.v1.ExecutionStats", "queryAllDeclaredConstructors": true, @@ -926,6 +962,24 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.firestore.v1.Function", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.firestore.v1.Function$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.firestore.v1.GetDocumentRequest", "queryAllDeclaredConstructors": true, @@ -1106,6 +1160,42 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.firestore.v1.Pipeline", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.firestore.v1.Pipeline$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.firestore.v1.Pipeline$Stage", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.firestore.v1.Pipeline$Stage$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.firestore.v1.PlanSummary", "queryAllDeclaredConstructors": true, @@ -1322,6 +1412,24 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.firestore.v1.StructuredPipeline", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.firestore.v1.StructuredPipeline$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.firestore.v1.StructuredQuery", "queryAllDeclaredConstructors": true, diff --git a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/it/ITPipelineTest.java b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/it/ITPipelineTest.java new file mode 100644 index 000000000..53b3f2bc7 --- /dev/null +++ b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/it/ITPipelineTest.java @@ -0,0 +1,167 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.firestore.it; + +import static com.google.cloud.firestore.it.ITQueryTest.map; +import static com.google.cloud.firestore.pipeline.Function.avg; +import static com.google.cloud.firestore.pipeline.Function.cosineDistance; +import static com.google.cloud.firestore.pipeline.Function.equal; +import static com.google.cloud.firestore.pipeline.Function.lessThan; +import static com.google.cloud.firestore.pipeline.Function.not; +import static com.google.cloud.firestore.pipeline.Function.or; +import static com.google.cloud.firestore.pipeline.Sort.Ordering.ascending; +import static com.google.cloud.firestore.pipeline.Sort.Ordering.descending; + +import com.google.cloud.firestore.CollectionReference; +import com.google.cloud.firestore.LocalFirestoreHelper; +import com.google.cloud.firestore.PaginatingPipeline; +import com.google.cloud.firestore.Pipeline; +import com.google.cloud.firestore.PipelineResult; +import com.google.cloud.firestore.pipeline.Constant; +import com.google.cloud.firestore.pipeline.Field; +import com.google.cloud.firestore.pipeline.Fields; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +@RunWith(JUnit4.class) +public class ITPipelineTest extends ITBaseTest { + public CollectionReference testCollectionWithDocs(Map> docs) + throws ExecutionException, InterruptedException, TimeoutException { + CollectionReference collection = firestore.collection(LocalFirestoreHelper.autoId()); + for (Map.Entry> doc : docs.entrySet()) { + collection.document(doc.getKey()).set(doc.getValue()).get(5, TimeUnit.SECONDS); + } + return collection; + } + + @Test + public void fromSources() throws Exception { + Map> testDocs = + map( + "doc1", map("a", 1, "b", 0), + "doc2", map("a", 2, "b", 1), + "doc3", map("a", 3, "b", 2), + "doc4", map("a", 1, "b", 3), + "doc5", map("a", 1, "b", 1)); + + CollectionReference collection = testCollectionWithDocs(testDocs); + + Pipeline p = Pipeline.fromCollectionGroup(collection.getId()); + List results = p.execute(firestore).get(); + System.out.println(results.size()); + } + + @Test + public void projections() throws Exception { + Pipeline p = Pipeline.fromCollectionGroup("coll1").select(Field.of("foo")); + List results = p.execute(firestore).get(); + System.out.println(results.size()); + + p = Pipeline.fromCollectionGroup("coll1").select(Fields.of("foo", "bar", "baz")); + results = p.execute(firestore).get(); + } + + @Test + public void filters() throws Exception { + Pipeline p = + Pipeline.fromCollectionGroup("coll1") + .filter(Field.of("foo").equal(42)) + .filter(or(Field.of("bar").lessThan(100), Constant.of("value").equal(Field.of("key")))) + .filter(not(Constant.of(128).inAny("f1", "f2"))); + List results = p.execute(firestore).get(); + + p = + Pipeline.fromCollectionGroup("coll1") + .filter(equal(Field.of("foo"), 42)) + .filter( + or(lessThan(Field.of("bar"), 100), equal(Field.of("key"), Constant.of("value")))) + .filter(not(Constant.of(128).inAny("f1", "f2"))); + results = p.execute(firestore).get(); + } + + @Test + public void inFilters() throws Exception { + Pipeline p = Pipeline.fromCollectionGroup("coll1").filter(Field.of("foo").inAny(42, "42")); + List results = p.execute(firestore).get(); + } + + @Test + public void aggregateWithoutGrouping() throws Exception { + Pipeline p = + Pipeline.fromDatabase() + .filter(Field.of("foo").inAny(42, "bar")) + .aggregate(avg(Field.of("score")).toField("avg_score_1")); + List results = p.execute(firestore).get(); + } + + @Test + public void sorts() throws Exception { + Pipeline p = + Pipeline.fromCollection("coll1") + .filter(Field.of("foo").inAny(42, "42")) + .sort( + Field.of("rank").ascending(), + cosineDistance(Field.of("embedding1"), Field.of("embedding2")).descending()) + .limit(100); + List results = p.execute(firestore).get(); + + // equivalent but more concise. + p = + Pipeline.fromCollection("coll1") + .filter(Field.of("foo").inAny(42, false)) + .sort( + ascending(Field.of("rank")), + descending(cosineDistance(Field.of("embedding1"), Field.of("embedding2")))) + .limit(100); + results = p.execute(firestore).get(); + } + + @Test + public void pagination() throws Exception { + PaginatingPipeline p = + Pipeline.fromCollection("coll1") + .filter(Field.of("foo").inAny(42, "bar")) + .paginate( + 100, cosineDistance(Field.of("embedding1"), Field.of("embedding2")).descending()); + + List results = p.firstPage().execute(firestore).get(); + List secondPage = + p.startAfter(results.get(results.size() - 1)).firstPage().execute(firestore).get(); + } + + @Test + public void limit() throws Exception { + Pipeline p = Pipeline.fromDatabase().filter(Field.of("foo").inAny(42, "bar")).limit(10); + + List result = p.execute(firestore).get(); + } + + @Test + public void offset() throws Exception { + Pipeline p = + Pipeline.fromDocuments(firestore.document("foo/bar1"), firestore.document("foo/bar2")) + .offset(1); + + List result = p.execute(firestore).get(); + } +} diff --git a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/it/ITQueryTest.java b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/it/ITQueryTest.java index 6125d24f4..f3ac2cc5e 100644 --- a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/it/ITQueryTest.java +++ b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/it/ITQueryTest.java @@ -19,26 +19,21 @@ import static com.google.cloud.firestore.it.TestHelper.isRunningAgainstFirestoreEmulator; import static com.google.common.primitives.Ints.asList; import static com.google.common.truth.Truth.assertThat; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; -import static org.junit.Assume.assumeTrue; -import com.google.api.core.ApiFuture; -import com.google.api.gax.rpc.ApiStreamObserver; import com.google.cloud.firestore.*; import com.google.cloud.firestore.Query.Direction; -import java.time.Duration; +import com.google.common.collect.Sets; import java.util.Arrays; import java.util.Collections; -import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.Objects; +import java.util.Set; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import java.util.stream.Collectors; -import javax.annotation.Nullable; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TestName; @@ -73,16 +68,50 @@ public CollectionReference testCollectionWithDocs(Map result = + snapshot.getDocuments().stream() + .map(queryDocumentSnapshot -> queryDocumentSnapshot.getReference().getId()) + .collect(Collectors.toList()); + assertThat(result).isEqualTo(Arrays.asList(docs)); + } + + List pipelineResults = query.toPipeline().execute(query.getFirestore()).get(); List result = - snapshot.getDocuments().stream() - .map(queryDocumentSnapshot -> queryDocumentSnapshot.getReference().getId()) + pipelineResults.stream() + .map(pipelineResult -> Objects.requireNonNull(pipelineResult.getReference()).getId()) .collect(Collectors.toList()); assertThat(result).isEqualTo(Arrays.asList(docs)); } + public static void checkResultContainsDocuments(Query query, boolean pipelineOnly, String... docs) + throws ExecutionException, InterruptedException { + if (!pipelineOnly) { + QuerySnapshot snapshot = query.get().get(); + Set result = + snapshot.getDocuments().stream() + .map(queryDocumentSnapshot -> queryDocumentSnapshot.getReference().getId()) + .collect(Collectors.toSet()); + assertThat(result).isEqualTo(Sets.newHashSet(docs)); + } + + List pipelineResults = query.toPipeline().execute(query.getFirestore()).get(); + Set result = + pipelineResults.stream() + .map(pipelineResult -> Objects.requireNonNull(pipelineResult.getReference()).getId()) + .collect(Collectors.toSet()); + assertThat(result).isEqualTo(Sets.newHashSet(docs)); + } + @Test public void orQueries() throws Exception { Map> testDocs = @@ -96,7 +125,7 @@ public void orQueries() throws Exception { CollectionReference collection = testCollectionWithDocs(testDocs); // Two equalities: a==1 || b==1. - checkQuerySnapshotContainsDocuments( + checkResultContainsDocumentsInOrder( collection.where(Filter.or(Filter.equalTo("a", 1), Filter.equalTo("b", 1))), "doc1", "doc2", @@ -104,7 +133,7 @@ public void orQueries() throws Exception { "doc5"); // (a==1 && b==0) || (a==3 && b==2) - checkQuerySnapshotContainsDocuments( + checkResultContainsDocumentsInOrder( collection.where( Filter.or( Filter.and(Filter.equalTo("a", 1), Filter.equalTo("b", 0)), @@ -113,7 +142,7 @@ public void orQueries() throws Exception { "doc3"); // a==1 && (b==0 || b==3). - checkQuerySnapshotContainsDocuments( + checkResultContainsDocumentsInOrder( collection.where( Filter.and( Filter.equalTo("a", 1), Filter.or(Filter.equalTo("b", 0), Filter.equalTo("b", 3)))), @@ -121,7 +150,7 @@ public void orQueries() throws Exception { "doc4"); // (a==2 || b==2) && (a==3 || b==3) - checkQuerySnapshotContainsDocuments( + checkResultContainsDocumentsInOrder( collection.where( Filter.and( Filter.or(Filter.equalTo("a", 2), Filter.equalTo("b", 2)), @@ -129,16 +158,13 @@ public void orQueries() throws Exception { "doc3"); // Test with limits without orderBy (the __name__ ordering is the tiebreaker). - checkQuerySnapshotContainsDocuments( + checkResultContainsDocumentsInOrder( collection.where(Filter.or(Filter.equalTo("a", 2), Filter.equalTo("b", 1))).limit(1), "doc2"); } @Test public void orQueriesWithCompositeIndexes() throws Exception { - assumeTrue( - "Skip this test when running against production because these queries require a composite index.", - isRunningAgainstFirestoreEmulator(firestore)); Map> testDocs = map( "doc1", map("a", 1, "b", 0), @@ -150,50 +176,56 @@ public void orQueriesWithCompositeIndexes() throws Exception { CollectionReference collection = testCollectionWithDocs(testDocs); // with one inequality: a>2 || b==1. - checkQuerySnapshotContainsDocuments( + checkResultContainsDocuments( collection.where(Filter.or(Filter.greaterThan("a", 2), Filter.equalTo("b", 1))), + /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), "doc5", "doc2", "doc3"); // Test with limits (implicit order by ASC): (a==1) || (b > 0) LIMIT 2 - checkQuerySnapshotContainsDocuments( + checkResultContainsDocumentsInOrder( collection.where(Filter.or(Filter.equalTo("a", 1), Filter.greaterThan("b", 0))).limit(2), + /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), "doc1", "doc2"); // Test with limits (explicit order by): (a==1) || (b > 0) LIMIT_TO_LAST 2 // Note: The public query API does not allow implicit ordering when limitToLast is used. - checkQuerySnapshotContainsDocuments( + checkResultContainsDocumentsInOrder( collection .where(Filter.or(Filter.equalTo("a", 1), Filter.greaterThan("b", 0))) .limitToLast(2) .orderBy("b"), + /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), "doc3", "doc4"); // Test with limits (explicit order by ASC): (a==2) || (b == 1) ORDER BY a LIMIT 1 - checkQuerySnapshotContainsDocuments( + checkResultContainsDocumentsInOrder( collection .where(Filter.or(Filter.equalTo("a", 2), Filter.equalTo("b", 1))) .limit(1) .orderBy("a"), + /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), "doc5"); // Test with limits (explicit order by DESC): (a==2) || (b == 1) ORDER BY a LIMIT_TO_LAST 1 - checkQuerySnapshotContainsDocuments( + checkResultContainsDocumentsInOrder( collection .where(Filter.or(Filter.equalTo("a", 2), Filter.equalTo("b", 1))) .limitToLast(1) .orderBy("a"), + /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), "doc2"); // Test with limits (explicit order by DESC): (a==2) || (b == 1) ORDER BY a DESC LIMIT 1 - checkQuerySnapshotContainsDocuments( + checkResultContainsDocumentsInOrder( collection .where(Filter.or(Filter.equalTo("a", 2), Filter.equalTo("b", 1))) .limit(1) .orderBy("a", Direction.DESCENDING), + /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), "doc2"); } @@ -214,14 +246,11 @@ public void orQueryDoesNotIncludeDocumentsWithMissingFields() throws Exception { // There's no explicit nor implicit orderBy. Documents with missing 'a' or missing 'b' should be // allowed if the document matches at least one disjunction term. Query query = collection.where(Filter.or(Filter.equalTo("a", 1), Filter.equalTo("b", 1))); - checkQuerySnapshotContainsDocuments(query, "doc1", "doc2", "doc4", "doc5"); + checkResultContainsDocumentsInOrder(query, "doc1", "doc2", "doc4", "doc5"); } @Test public void orQueryDoesNotIncludeDocumentsWithMissingFields2() throws Exception { - assumeTrue( - "Skip this test when running against production because these queries require a composite index.", - isRunningAgainstFirestoreEmulator(firestore)); Map> testDocs = map( "doc1", map("a", 1, "b", 0), @@ -237,19 +266,30 @@ public void orQueryDoesNotIncludeDocumentsWithMissingFields2() throws Exception // doc2 should not be included because it's missing the field 'a', and we have "orderBy a". Query query1 = collection.where(Filter.or(Filter.equalTo("a", 1), Filter.equalTo("b", 1))).orderBy("a"); - checkQuerySnapshotContainsDocuments(query1, "doc1", "doc4", "doc5"); + checkResultContainsDocumentsInOrder( + query1, + /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), + "doc1", + "doc4", + "doc5"); // Query: a==1 || b==1 order by b. // doc5 should not be included because it's missing the field 'b', and we have "orderBy b". Query query2 = collection.where(Filter.or(Filter.equalTo("a", 1), Filter.equalTo("b", 1))).orderBy("b"); - checkQuerySnapshotContainsDocuments(query2, "doc1", "doc2", "doc4"); + checkResultContainsDocumentsInOrder( + query2, + /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), + "doc1", + "doc2", + "doc4"); // Query: a>2 || b==1. // This query has an implicit 'order by a'. // doc2 should not be included because it's missing the field 'a'. Query query3 = collection.where(Filter.or(Filter.greaterThan("a", 2), Filter.equalTo("b", 1))); - checkQuerySnapshotContainsDocuments(query3, "doc3"); + checkResultContainsDocumentsInOrder( + query3, /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), "doc3"); // Query: a>1 || b==1 order by a order by b. // doc6 should not be included because it's missing the field 'b'. @@ -259,7 +299,8 @@ public void orQueryDoesNotIncludeDocumentsWithMissingFields2() throws Exception .where(Filter.or(Filter.greaterThan("a", 1), Filter.equalTo("b", 1))) .orderBy("a") .orderBy("b"); - checkQuerySnapshotContainsDocuments(query4, "doc3"); + checkResultContainsDocumentsInOrder( + query4, /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), "doc3"); } @Test @@ -275,7 +316,7 @@ public void orQueriesWithIn() throws ExecutionException, InterruptedException, T CollectionReference collection = testCollectionWithDocs(testDocs); // a==2 || b in [2,3] - checkQuerySnapshotContainsDocuments( + checkResultContainsDocumentsInOrder( collection.where(Filter.or(Filter.equalTo("a", 2), Filter.inArray("b", asList(2, 3)))), "doc3", "doc4", @@ -285,9 +326,6 @@ public void orQueriesWithIn() throws ExecutionException, InterruptedException, T @Test public void orQueriesWithNotIn() throws ExecutionException, InterruptedException, TimeoutException { - assumeTrue( - "Skip this test when running against production because it is currently not supported.", - isRunningAgainstFirestoreEmulator(firestore)); Map> testDocs = map( "doc1", map("a", 1, "b", 0), @@ -300,8 +338,9 @@ public void orQueriesWithNotIn() // a==2 || b not-in [2,3] // Has implicit orderBy b. - checkQuerySnapshotContainsDocuments( + checkResultContainsDocumentsInOrder( collection.where(Filter.or(Filter.equalTo("a", 2), Filter.notInArray("b", asList(2, 3)))), + /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), "doc1", "doc2"); } @@ -320,14 +359,14 @@ public void orQueriesWithArrayMembership() CollectionReference collection = testCollectionWithDocs(testDocs); // a==2 || b array-contains 7 - checkQuerySnapshotContainsDocuments( + checkResultContainsDocumentsInOrder( collection.where(Filter.or(Filter.equalTo("a", 2), Filter.arrayContains("b", 7))), "doc3", "doc4", "doc6"); // a==2 || b array-contains-any [0, 3] - checkQuerySnapshotContainsDocuments( + checkResultContainsDocumentsInOrder( collection.where( Filter.or(Filter.equalTo("a", 2), Filter.arrayContainsAny("b", asList(0, 3)))), "doc1", @@ -351,35 +390,31 @@ public void testUsingInWithArrayContains() Query query1 = collection.where( Filter.or(Filter.inArray("a", asList(2, 3)), Filter.arrayContains("b", 3))); - checkQuerySnapshotContainsDocuments(query1, "doc3", "doc4", "doc6"); + checkResultContainsDocumentsInOrder(query1, "doc3", "doc4", "doc6"); Query query2 = collection.where( Filter.and(Filter.inArray("a", asList(2, 3)), Filter.arrayContains("b", 7))); - checkQuerySnapshotContainsDocuments(query2, "doc3"); + checkResultContainsDocumentsInOrder(query2, "doc3"); Query query3 = collection.where( Filter.or( Filter.inArray("a", asList(2, 3)), Filter.and(Filter.arrayContains("b", 3), Filter.equalTo("a", 1)))); - checkQuerySnapshotContainsDocuments(query3, "doc3", "doc4", "doc6"); + checkResultContainsDocumentsInOrder(query3, "doc3", "doc4", "doc6"); Query query4 = collection.where( Filter.and( Filter.inArray("a", asList(2, 3)), Filter.or(Filter.arrayContains("b", 7), Filter.equalTo("a", 1)))); - checkQuerySnapshotContainsDocuments(query4, "doc3"); + checkResultContainsDocumentsInOrder(query4, "doc3"); } @Test public void testOrderByEquality() throws ExecutionException, InterruptedException, TimeoutException { - assumeTrue( - "Skip this test if running against production because order-by-equality is " - + "not supported yet.", - isRunningAgainstFirestoreEmulator(firestore)); Map> testDocs = map( "doc1", map("a", 1, "b", asList(0)), @@ -391,21 +426,21 @@ public void testOrderByEquality() CollectionReference collection = testCollectionWithDocs(testDocs); Query query1 = collection.where(Filter.equalTo("a", 1)).orderBy("a"); - checkQuerySnapshotContainsDocuments(query1, "doc1", "doc4", "doc5"); + checkResultContainsDocumentsInOrder( + query1, + /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), + "doc1", + "doc4", + "doc5"); Query query2 = collection.where(Filter.inArray("a", asList(2, 3))).orderBy("a"); - checkQuerySnapshotContainsDocuments(query2, "doc6", "doc3"); + checkResultContainsDocumentsInOrder( + query2, /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), "doc6", "doc3"); } /** Multiple Inequality */ @Test public void multipleInequalityOnDifferentFields() throws Exception { - // TODO(MIEQ): Enable this test against production when possible. - assumeTrue( - "Skip this test if running against production because multiple inequality is " - + "not supported yet.", - isRunningAgainstFirestoreEmulator(firestore)); - CollectionReference collection = testCollectionWithDocs( map( @@ -419,7 +454,8 @@ public void multipleInequalityOnDifferentFields() throws Exception { .whereNotEqualTo("key", "a") .whereLessThanOrEqualTo("sort", 2) .whereGreaterThan("v", 2); - checkQuerySnapshotContainsDocuments(query1, "doc3"); + checkResultContainsDocumentsInOrder( + query1, /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), "doc3"); // Duplicate inequality fields Query query2 = @@ -427,7 +463,8 @@ public void multipleInequalityOnDifferentFields() throws Exception { .whereNotEqualTo("key", "a") .whereLessThanOrEqualTo("sort", 2) .whereGreaterThan("sort", 1); - checkQuerySnapshotContainsDocuments(query2, "doc4"); + checkResultContainsDocumentsInOrder( + query2, /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), "doc4"); // With multiple IN Query query3 = @@ -436,7 +473,8 @@ public void multipleInequalityOnDifferentFields() throws Exception { .whereLessThanOrEqualTo("sort", 2) .whereIn("v", asList(2, 3, 4)) .whereIn("sort", asList(2, 3)); - checkQuerySnapshotContainsDocuments(query3, "doc4"); + checkResultContainsDocumentsInOrder( + query3, /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), "doc4"); // With NOT-IN Query query4 = @@ -444,7 +482,8 @@ public void multipleInequalityOnDifferentFields() throws Exception { .whereGreaterThanOrEqualTo("key", "a") .whereLessThanOrEqualTo("sort", 2) .whereNotIn("v", asList(2, 4, 5)); - checkQuerySnapshotContainsDocuments(query4, "doc1", "doc3"); + checkResultContainsDocumentsInOrder( + query4, /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), "doc1", "doc3"); // With orderby Query query5 = @@ -452,7 +491,12 @@ public void multipleInequalityOnDifferentFields() throws Exception { .whereGreaterThanOrEqualTo("key", "a") .whereLessThanOrEqualTo("sort", 2) .orderBy("v", Direction.DESCENDING); - checkQuerySnapshotContainsDocuments(query5, "doc3", "doc4", "doc1"); + checkResultContainsDocumentsInOrder( + query5, + /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), + "doc3", + "doc4", + "doc1"); // With limit Query query6 = @@ -461,7 +505,8 @@ public void multipleInequalityOnDifferentFields() throws Exception { .whereLessThanOrEqualTo("sort", 2) .orderBy("v", Direction.DESCENDING) .limit(2); - checkQuerySnapshotContainsDocuments(query6, "doc3", "doc4"); + checkResultContainsDocumentsInOrder( + query6, /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), "doc3", "doc4"); // With limitToLast Query query7 = @@ -470,17 +515,12 @@ public void multipleInequalityOnDifferentFields() throws Exception { .whereLessThanOrEqualTo("sort", 2) .orderBy("v", Direction.DESCENDING) .limitToLast(2); - checkQuerySnapshotContainsDocuments(query7, "doc4", "doc1"); + checkResultContainsDocumentsInOrder( + query7, /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), "doc4", "doc1"); } @Test public void multipleInequalityOnSpecialValues() throws Exception { - // TODO(MIEQ): Enable this test against production when possible. - assumeTrue( - "Skip this test if running against production because multiple inequality is " - + "not supported yet.", - isRunningAgainstFirestoreEmulator(firestore)); - CollectionReference collection = testCollectionWithDocs( map( @@ -492,24 +532,20 @@ public void multipleInequalityOnSpecialValues() throws Exception { "doc6", map("key", "f", "sort", 1, "v", 1))); Query query1 = collection.whereNotEqualTo("key", "a").whereLessThanOrEqualTo("sort", 2); - checkQuerySnapshotContainsDocuments(query1, "doc5", "doc6"); + checkResultContainsDocumentsInOrder( + query1, /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), "doc5", "doc6"); Query query2 = collection .whereNotEqualTo("key", "a") .whereLessThanOrEqualTo("sort", 2) .whereLessThanOrEqualTo("v", 1); - checkQuerySnapshotContainsDocuments(query2, "doc6"); + checkResultContainsDocumentsInOrder( + query2, /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), "doc6"); } @Test public void multipleInequalityWithArrayMembership() throws Exception { - // TODO(MIEQ): Enable this test against production when possible. - assumeTrue( - "Skip this test if running against production because multiple inequality is " - + "not supported yet.", - isRunningAgainstFirestoreEmulator(firestore)); - CollectionReference collection = testCollectionWithDocs( map( @@ -533,14 +569,16 @@ public void multipleInequalityWithArrayMembership() throws Exception { .whereNotEqualTo("key", "a") .whereGreaterThanOrEqualTo("sort", 1) .whereArrayContains("v", 0); - checkQuerySnapshotContainsDocuments(query1, "doc2"); + checkResultContainsDocumentsInOrder( + query1, /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), "doc2"); Query query2 = collection .whereNotEqualTo("key", "a") .whereGreaterThanOrEqualTo("sort", 1) .whereArrayContainsAny("v", asList(0, 1)); - checkQuerySnapshotContainsDocuments(query2, "doc2", "doc4"); + checkResultContainsDocumentsInOrder( + query2, /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), "doc2", "doc4"); } private static Map nestedObject(int number) { @@ -561,12 +599,6 @@ private static Map nestedObject(int number) { // result with the query fields normalized in the server. @Test public void multipleInequalityWithNestedField() throws Exception { - // TODO(MIEQ): Enable this test against production when possible. - assumeTrue( - "Skip this test if running against production because multiple inequality is " - + "not supported yet.", - isRunningAgainstFirestoreEmulator(firestore)); - CollectionReference collection = testCollectionWithDocs( map( @@ -584,8 +616,13 @@ public void multipleInequalityWithNestedField() throws Exception { .orderBy("name"); DocumentSnapshot docSnap = collection.document("doc4").get().get(); Query query1WithCursor = query1.startAt(docSnap); - checkQuerySnapshotContainsDocuments(query1, "doc4", "doc1"); - checkQuerySnapshotContainsDocuments(query1WithCursor, "doc4", "doc1"); + checkResultContainsDocumentsInOrder( + query1, /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), "doc4", "doc1"); + checkResultContainsDocumentsInOrder( + query1WithCursor, + /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), + "doc4", + "doc1"); // ordered by: name desc, field desc, field.dot desc, field\\slash desc, __name__ desc Query query2 = @@ -596,18 +633,13 @@ public void multipleInequalityWithNestedField() throws Exception { .orderBy("name", Direction.DESCENDING); docSnap = collection.document("doc2").get().get(); Query query2WithCursor = query2.startAt(docSnap); - checkQuerySnapshotContainsDocuments(query2, "doc2", "doc3"); - checkQuerySnapshotContainsDocuments(query2WithCursor, "doc2", "doc3"); + checkResultContainsDocumentsInOrder( + query2, /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), "doc2", "doc3"); + checkResultContainsDocumentsInOrder(query2WithCursor, "doc2", "doc3"); } @Test public void multipleInequalityWithCompositeFilters() throws Exception { - // TODO(MIEQ): Enable this test against production when possible. - assumeTrue( - "Skip this test if running against production because multiple inequality is " - + "not supported yet.", - isRunningAgainstFirestoreEmulator(firestore)); - CollectionReference collection = testCollectionWithDocs( map( @@ -632,8 +664,20 @@ public void multipleInequalityWithCompositeFilters() throws Exception { Filter.and(Filter.notEqualTo("key", "b"), Filter.greaterThan("v", 4)))); DocumentSnapshot docSnap = collection.document("doc1").get().get(); Query query1WithCursor = query1.startAt(docSnap); - checkQuerySnapshotContainsDocuments(query1, "doc1", "doc6", "doc5", "doc4"); - checkQuerySnapshotContainsDocuments(query1WithCursor, "doc1", "doc6", "doc5", "doc4"); + checkResultContainsDocumentsInOrder( + query1, + /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), + "doc1", + "doc6", + "doc5", + "doc4"); + checkResultContainsDocumentsInOrder( + query1WithCursor, + /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), + "doc1", + "doc6", + "doc5", + "doc4"); // Ordered by: 'sort' desc, 'key' asc, 'v' asc, __name__ asc Query query2 = @@ -646,8 +690,20 @@ public void multipleInequalityWithCompositeFilters() throws Exception { .orderBy("key"); docSnap = collection.document("doc5").get().get(); Query query2WithCursor = query2.startAt(docSnap); - checkQuerySnapshotContainsDocuments(query2, "doc5", "doc4", "doc1", "doc6"); - checkQuerySnapshotContainsDocuments(query2WithCursor, "doc5", "doc4", "doc1", "doc6"); + checkResultContainsDocumentsInOrder( + query2, + /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), + "doc5", + "doc4", + "doc1", + "doc6"); + checkResultContainsDocumentsInOrder( + query2WithCursor, + /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), + "doc5", + "doc4", + "doc1", + "doc6"); // Implicitly ordered by: 'key' asc, 'sort' asc, 'v' asc, __name__ asc Query query3 = @@ -662,19 +718,18 @@ public void multipleInequalityWithCompositeFilters() throws Exception { Filter.and(Filter.lessThan("key", "b"), Filter.greaterThan("v", 0))))); docSnap = collection.document("doc1").get().get(); Query query3WithCursor = query3.startAt(docSnap); - checkQuerySnapshotContainsDocuments(query3, "doc1", "doc2"); - checkQuerySnapshotContainsDocuments(query3WithCursor, "doc1", "doc2"); + checkResultContainsDocumentsInOrder( + query3, /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), "doc1", "doc2"); + checkResultContainsDocumentsInOrder( + query3WithCursor, + /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), + "doc1", + "doc2"); } @Test public void multipleInequalityFieldsWillBeImplicitlyOrderedLexicographicallyByServer() throws Exception { - // TODO(MIEQ): Enable this test against production when possible. - assumeTrue( - "Skip this test if running against production because multiple inequality is " - + "not supported yet.", - isRunningAgainstFirestoreEmulator(firestore)); - CollectionReference collection = testCollectionWithDocs( map( @@ -700,8 +755,20 @@ public void multipleInequalityFieldsWillBeImplicitlyOrderedLexicographicallyBySe .whereGreaterThan("sort", 1) .whereIn("v", asList(1, 2, 3, 4)); Query query1WithCursor = query1.startAt(docSnap); - checkQuerySnapshotContainsDocuments(query1, "doc2", "doc4", "doc5", "doc3"); - checkQuerySnapshotContainsDocuments(query1WithCursor, "doc2", "doc4", "doc5", "doc3"); + checkResultContainsDocumentsInOrder( + query1, + /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), + "doc2", + "doc4", + "doc5", + "doc3"); + checkResultContainsDocumentsInOrder( + query1WithCursor, + /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), + "doc2", + "doc4", + "doc5", + "doc3"); // Implicitly ordered by: 'key' asc, 'sort' asc, __name__ asc Query query2 = @@ -710,18 +777,24 @@ public void multipleInequalityFieldsWillBeImplicitlyOrderedLexicographicallyBySe .whereNotEqualTo("key", "a") .whereIn("v", asList(1, 2, 3, 4)); Query query2WithCursor = query2.startAt(docSnap); - checkQuerySnapshotContainsDocuments(query2, "doc2", "doc4", "doc5", "doc3"); - checkQuerySnapshotContainsDocuments(query2WithCursor, "doc2", "doc4", "doc5", "doc3"); + checkResultContainsDocumentsInOrder( + query2, + /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), + "doc2", + "doc4", + "doc5", + "doc3"); + checkResultContainsDocumentsInOrder( + query2WithCursor, + /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), + "doc2", + "doc4", + "doc5", + "doc3"); } @Test public void multipleInequalityWithMultipleExplicitOrderBy() throws Exception { - // TODO(MIEQ): Enable this test against production when possible. - assumeTrue( - "Skip this test if running against production because multiple inequality is " - + "not supported yet.", - isRunningAgainstFirestoreEmulator(firestore)); - CollectionReference collection = testCollectionWithDocs( map( @@ -744,8 +817,20 @@ public void multipleInequalityWithMultipleExplicitOrderBy() throws Exception { Query query1 = collection.whereGreaterThan("key", "a").whereGreaterThanOrEqualTo("sort", 1).orderBy("v"); Query query1WithCursor = query1.startAt(docSnap); - checkQuerySnapshotContainsDocuments(query1, "doc2", "doc4", "doc3", "doc5"); - checkQuerySnapshotContainsDocuments(query1WithCursor, "doc2", "doc4", "doc3", "doc5"); + checkResultContainsDocumentsInOrder( + query1, + /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), + "doc2", + "doc4", + "doc3", + "doc5"); + checkResultContainsDocumentsInOrder( + query1WithCursor, + /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), + "doc2", + "doc4", + "doc3", + "doc5"); // Ordered by: 'v asc, 'sort' asc, 'key' asc, __name__ asc Query query2 = @@ -755,8 +840,20 @@ public void multipleInequalityWithMultipleExplicitOrderBy() throws Exception { .orderBy("v") .orderBy("sort"); Query query2WithCursor = query2.startAt(docSnap); - checkQuerySnapshotContainsDocuments(query2, "doc2", "doc5", "doc4", "doc3"); - checkQuerySnapshotContainsDocuments(query2WithCursor, "doc2", "doc5", "doc4", "doc3"); + checkResultContainsDocumentsInOrder( + query2, + /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), + "doc2", + "doc5", + "doc4", + "doc3"); + checkResultContainsDocumentsInOrder( + query2WithCursor, + /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), + "doc2", + "doc5", + "doc4", + "doc3"); docSnap = collection.document("doc5").get().get(); @@ -768,8 +865,20 @@ public void multipleInequalityWithMultipleExplicitOrderBy() throws Exception { .whereGreaterThanOrEqualTo("sort", 1) .orderBy("v", Direction.DESCENDING); Query query3WithCursor = query3.startAt(docSnap); - checkQuerySnapshotContainsDocuments(query3, "doc5", "doc3", "doc4", "doc2"); - checkQuerySnapshotContainsDocuments(query3WithCursor, "doc5", "doc3", "doc4", "doc2"); + checkResultContainsDocumentsInOrder( + query3, + /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), + "doc5", + "doc3", + "doc4", + "doc2"); + checkResultContainsDocumentsInOrder( + query3WithCursor, + /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), + "doc5", + "doc3", + "doc4", + "doc2"); // Ordered by: 'v desc, 'sort' asc, 'key' asc, __name__ asc Query query4 = @@ -779,18 +888,24 @@ public void multipleInequalityWithMultipleExplicitOrderBy() throws Exception { .orderBy("v", Direction.DESCENDING) .orderBy("sort"); Query query4WithCursor = query4.startAt(docSnap); - checkQuerySnapshotContainsDocuments(query4, "doc5", "doc4", "doc3", "doc2"); - checkQuerySnapshotContainsDocuments(query4WithCursor, "doc5", "doc4", "doc3", "doc2"); + checkResultContainsDocumentsInOrder( + query4, + /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), + "doc5", + "doc4", + "doc3", + "doc2"); + checkResultContainsDocumentsInOrder( + query4WithCursor, + /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), + "doc5", + "doc4", + "doc3", + "doc2"); } @Test public void multipleInequalityFieldsInAggregateQuery() throws Exception { - // TODO(MIEQ): Enable this test against production when possible. - assumeTrue( - "Skip this test if running against production because multiple inequality is " - + "not supported yet.", - isRunningAgainstFirestoreEmulator(firestore)); - CollectionReference collection = testCollectionWithDocs( map( @@ -811,18 +926,15 @@ public void multipleInequalityFieldsInAggregateQuery() throws Exception { .whereGreaterThanOrEqualTo("sort", 1) .orderBy("v") .count(); - assertThat(query.get().get().getCount()).isEqualTo(4); + if (isRunningAgainstFirestoreEmulator(firestore)) { + assertThat(query.get().get().getCount()).isEqualTo(4); + } + assertThat(query.toPipeline().execute(query.getQuery().getFirestore()).get()).isNotEmpty(); // TODO(MIEQ): Add sum and average when they are public. } @Test public void multipleInequalityFieldsWithDocumentKey() throws Exception { - // TODO(MIEQ): Enable this test against production when possible. - assumeTrue( - "Skip this test if running against production because multiple inequality is " - + "not supported yet.", - isRunningAgainstFirestoreEmulator(firestore)); - CollectionReference collection = testCollectionWithDocs( map( @@ -847,8 +959,18 @@ public void multipleInequalityFieldsWithDocumentKey() throws Exception { .whereNotEqualTo("key", "a") .whereLessThan(FieldPath.documentId(), "doc5"); Query query1WithCursor = query1.startAt(docSnap); - checkQuerySnapshotContainsDocuments(query1, "doc2", "doc4", "doc3"); - checkQuerySnapshotContainsDocuments(query1WithCursor, "doc2", "doc4", "doc3"); + checkResultContainsDocumentsInOrder( + query1, + /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), + "doc2", + "doc4", + "doc3"); + checkResultContainsDocumentsInOrder( + query1WithCursor, + /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), + "doc2", + "doc4", + "doc3"); // Changing filters order will not affect implicit order. // Implicitly ordered by: 'key' asc, 'sort' asc, __name__ asc @@ -858,8 +980,18 @@ public void multipleInequalityFieldsWithDocumentKey() throws Exception { .whereGreaterThan("sort", 1) .whereNotEqualTo("key", "a"); Query query2WithCursor = query2.startAt(docSnap); - checkQuerySnapshotContainsDocuments(query2, "doc2", "doc4", "doc3"); - checkQuerySnapshotContainsDocuments(query2WithCursor, "doc2", "doc4", "doc3"); + checkResultContainsDocumentsInOrder( + query2, + /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), + "doc2", + "doc4", + "doc3"); + checkResultContainsDocumentsInOrder( + query2WithCursor, + /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), + "doc2", + "doc4", + "doc3"); // Ordered by: 'sort' desc, 'key' desc, __name__ desc Query query3 = @@ -869,248 +1001,17 @@ public void multipleInequalityFieldsWithDocumentKey() throws Exception { .whereNotEqualTo("key", "a") .orderBy("sort", Direction.DESCENDING); Query query3WithCursor = query3.startAt(docSnap); - checkQuerySnapshotContainsDocuments(query3, "doc2", "doc3", "doc4"); - checkQuerySnapshotContainsDocuments(query3WithCursor, "doc2", "doc3", "doc4"); - } - - @Test - public void testQueryPlan() throws Exception { - Map> testDocs = - map( - "doc1", map("a", 1, "b", asList(0)), - "doc2", map("b", asList(1)), - "doc3", map("a", 3, "b", asList(2, 7), "c", 10), - "doc4", map("a", 1, "b", asList(3, 7)), - "doc5", map("a", 1), - "doc6", map("a", 2, "c", 20)); - CollectionReference collection = testCollectionWithDocs(testDocs); - - Query query = collection.where(Filter.equalTo("a", 1)).orderBy("a"); - ExplainResults explainResults = - query.explain(ExplainOptions.builder().setAnalyze(false).build()).get(); - - @Nullable QuerySnapshot snapshot = explainResults.getSnapshot(); - assertThat(snapshot).isNull(); - - ExplainMetrics metrics = explainResults.getMetrics(); - assertThat(metrics).isNotNull(); - - PlanSummary planSummary = metrics.getPlanSummary(); - assertThat(planSummary).isNotNull(); - assertThat(planSummary.getIndexesUsed()).isNotEmpty(); - - ExecutionStats stats = metrics.getExecutionStats(); - assertThat(stats).isNull(); - } - - @Test - public void testQueryProfile() throws Exception { - Map> testDocs = - map( - "doc1", map("a", 1, "b", asList(0)), - "doc2", map("b", asList(1)), - "doc3", map("a", 3, "b", asList(2, 7), "c", 10), - "doc4", map("a", 1, "b", asList(3, 7)), - "doc5", map("a", 1), - "doc6", map("a", 2, "c", 20)); - CollectionReference collection = testCollectionWithDocs(testDocs); - - Query query = collection.where(Filter.equalTo("a", 1)).orderBy("a"); - ExplainResults explainResults = - query.explain(ExplainOptions.builder().setAnalyze(true).build()).get(); - - @Nullable QuerySnapshot snapshot = explainResults.getSnapshot(); - assertThat(snapshot).isNotNull(); - assertThat(snapshot.size()).isEqualTo(3); - - ExplainMetrics metrics = explainResults.getMetrics(); - assertThat(metrics).isNotNull(); - - PlanSummary planSummary = metrics.getPlanSummary(); - assertThat(planSummary).isNotNull(); - assertThat(planSummary.getIndexesUsed()).isNotEmpty(); - - ExecutionStats stats = metrics.getExecutionStats(); - assertThat(stats).isNotNull(); - assertThat(stats.getDebugStats()).isNotEmpty(); - assertThat(stats.getReadOperations()).isEqualTo(3); - assertThat(stats.getResultsReturned()).isEqualTo(3); - assertThat(stats.getExecutionDuration()).isGreaterThan(Duration.ZERO); - } - - @Test - public void testQueryProfileForQueryWithNoResultSet() throws Exception { - Map> testDocs = - map( - "doc1", map("a", 1, "b", asList(0)), - "doc2", map("b", asList(1)), - "doc3", map("a", 3, "b", asList(2, 7), "c", 10), - "doc4", map("a", 1, "b", asList(3, 7)), - "doc5", map("a", 1), - "doc6", map("a", 2, "c", 20)); - CollectionReference collection = testCollectionWithDocs(testDocs); - - Query query = collection.where(Filter.equalTo("a", 100)).orderBy("a"); - - // Regular query execution (get). - QuerySnapshot getSnapshot = query.get().get(); - assertThat(getSnapshot.size()).isEqualTo(0); - - // Explain. - ExplainResults explainResults = - query.explain(ExplainOptions.builder().setAnalyze(true).build()).get(); - - @Nullable QuerySnapshot snapshot = explainResults.getSnapshot(); - assertThat(snapshot).isNotNull(); - assertThat(snapshot.size()).isEqualTo(0); - - ExplainMetrics metrics = explainResults.getMetrics(); - assertThat(metrics).isNotNull(); - - PlanSummary planSummary = metrics.getPlanSummary(); - assertThat(planSummary).isNotNull(); - assertThat(planSummary.getIndexesUsed()).isNotEmpty(); - - ExecutionStats stats = metrics.getExecutionStats(); - assertThat(stats).isNotNull(); - assertThat(stats.getDebugStats()).isNotEmpty(); - assertThat(stats.getReadOperations()).isGreaterThan(0); - assertThat(stats.getResultsReturned()).isEqualTo(0); - assertThat(stats.getExecutionDuration()).isGreaterThan(Duration.ZERO); - } - - @Test - public void testExplainStreamWithoutAnalyze() throws Exception { - CollectionReference collection = testCollectionWithDocs(Collections.emptyMap()); - Query query = collection.where(Filter.equalTo("a", 1)).orderBy("a"); - - ApiFuture metricsFuture = - query.explainStream( - ExplainOptions.builder().setAnalyze(false).build(), - new ApiStreamObserver() { - @Override - public void onNext(DocumentSnapshot documentSnapshot) { - fail("No DocumentSnapshot should be received because analyze option was disabled."); - } - - @Override - public void onError(Throwable throwable) { - fail(throwable.getMessage()); - } - - @Override - public void onCompleted() {} - }); - - ExplainMetrics metrics = metricsFuture.get(); - assertThat(metrics.getPlanSummary().getIndexesUsed().size()).isGreaterThan(0); - assertThat(metrics.getExecutionStats()).isNull(); - } - - @Test - public void testExplainStreamWithAnalyze() throws Exception { - Map> testDocs = - map( - "doc1", map("a", 1, "b", asList(0)), - "doc2", map("b", asList(1)), - "doc3", map("a", 3, "b", asList(2, 7), "c", 10), - "doc4", map("a", 1, "b", asList(3, 7)), - "doc5", map("a", 1), - "doc6", map("a", 2, "c", 20)); - CollectionReference collection = testCollectionWithDocs(testDocs); - - Query query = collection.where(Filter.equalTo("a", 1)).orderBy("a"); - - final Iterator iterator = Arrays.asList("doc1", "doc4", "doc5").iterator(); - - ApiFuture metricsFuture = - query.explainStream( - ExplainOptions.builder().setAnalyze(true).build(), - new ApiStreamObserver() { - @Override - public void onNext(DocumentSnapshot documentSnapshot) { - assertEquals(iterator.next(), documentSnapshot.getId()); - } - - @Override - public void onError(Throwable throwable) { - fail(throwable.getMessage()); - } - - @Override - public void onCompleted() {} - }); - - ExplainMetrics metrics = metricsFuture.get(); - assertThat(metrics.getPlanSummary().getIndexesUsed().size()).isGreaterThan(0); - assertThat(metrics.getExecutionStats()).isNotNull(); - assertThat(metrics.getExecutionStats().getResultsReturned()).isEqualTo(3); - } - - @Test - public void testAggregateQueryPlan() throws Exception { - Map> testDocs = - map( - "doc1", map("a", 1, "b", asList(0)), - "doc2", map("b", asList(1)), - "doc3", map("a", 3, "b", asList(2, 7), "c", 10), - "doc4", map("a", 1, "b", asList(3, 7)), - "doc5", map("a", 1), - "doc6", map("a", 2, "c", 20)); - CollectionReference collection = testCollectionWithDocs(testDocs); - - AggregateQuery query = collection.where(Filter.equalTo("a", 1)).orderBy("a").count(); - - ExplainResults explainResults = - query.explain(ExplainOptions.builder().setAnalyze(false).build()).get(); - - @Nullable AggregateQuerySnapshot snapshot = explainResults.getSnapshot(); - assertThat(snapshot).isNull(); - - ExplainMetrics metrics = explainResults.getMetrics(); - assertThat(metrics).isNotNull(); - - PlanSummary planSummary = metrics.getPlanSummary(); - assertThat(planSummary).isNotNull(); - assertThat(planSummary.getIndexesUsed()).isNotEmpty(); - - ExecutionStats stats = metrics.getExecutionStats(); - assertThat(stats).isNull(); - } - - @Test - public void testAggregateQueryProfile() throws Exception { - Map> testDocs = - map( - "doc1", map("a", 1, "b", asList(0)), - "doc2", map("b", asList(1)), - "doc3", map("a", 3, "b", asList(2, 7), "c", 10), - "doc4", map("a", 1, "b", asList(3, 7)), - "doc5", map("a", 1), - "doc6", map("a", 2, "c", 20)); - CollectionReference collection = testCollectionWithDocs(testDocs); - - AggregateQuery query = collection.where(Filter.equalTo("a", 1)).orderBy("a").count(); - - ExplainResults explainResults = - query.explain(ExplainOptions.builder().setAnalyze(true).build()).get(); - - @Nullable AggregateQuerySnapshot snapshot = explainResults.getSnapshot(); - assertThat(snapshot).isNotNull(); - assertThat(snapshot.getCount()).isEqualTo(3); - - ExplainMetrics metrics = explainResults.getMetrics(); - assertThat(metrics).isNotNull(); - - PlanSummary planSummary = metrics.getPlanSummary(); - assertThat(planSummary).isNotNull(); - assertThat(planSummary.getIndexesUsed()).isNotEmpty(); - - ExecutionStats stats = metrics.getExecutionStats(); - assertThat(stats).isNotNull(); - assertThat(stats.getDebugStats()).isNotEmpty(); - assertThat(stats.getReadOperations()).isEqualTo(1); - assertThat(stats.getResultsReturned()).isEqualTo(1); - assertThat(stats.getExecutionDuration()).isGreaterThan(Duration.ZERO); + checkResultContainsDocumentsInOrder( + query3, + /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), + "doc2", + "doc3", + "doc4"); + checkResultContainsDocumentsInOrder( + query3WithCursor, + /*pipelineOnly*/ !isRunningAgainstFirestoreEmulator(firestore), + "doc2", + "doc3", + "doc4"); } } diff --git a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/v1/FirestoreClientHttpJsonTest.java b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/v1/FirestoreClientHttpJsonTest.java index 86e0c966a..605cf0663 100644 --- a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/v1/FirestoreClientHttpJsonTest.java +++ b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/v1/FirestoreClientHttpJsonTest.java @@ -483,6 +483,17 @@ public void runQueryExceptionTest() throws Exception { mockService.addException(exception); } + @Test + public void executePipelineTest() throws Exception {} + + @Test + public void executePipelineExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + } + @Test public void runAggregationQueryTest() throws Exception {} diff --git a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/v1/FirestoreClientTest.java b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/v1/FirestoreClientTest.java index 885ebc7b9..97400f5ad 100644 --- a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/v1/FirestoreClientTest.java +++ b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/v1/FirestoreClientTest.java @@ -47,8 +47,8 @@ import com.google.firestore.v1.DeleteDocumentRequest; import com.google.firestore.v1.Document; import com.google.firestore.v1.DocumentMask; -import com.google.firestore.v1.ExplainMetrics; -import com.google.firestore.v1.ExplainOptions; +import com.google.firestore.v1.ExecutePipelineRequest; +import com.google.firestore.v1.ExecutePipelineResponse; import com.google.firestore.v1.GetDocumentRequest; import com.google.firestore.v1.ListCollectionIdsRequest; import com.google.firestore.v1.ListCollectionIdsResponse; @@ -507,14 +507,9 @@ public void runQueryTest() throws Exception { .setDocument(Document.newBuilder().build()) .setReadTime(Timestamp.newBuilder().build()) .setSkippedResults(880286183) - .setExplainMetrics(ExplainMetrics.newBuilder().build()) .build(); mockFirestore.addResponse(expectedResponse); - RunQueryRequest request = - RunQueryRequest.newBuilder() - .setParent("parent-995424086") - .setExplainOptions(ExplainOptions.newBuilder().build()) - .build(); + RunQueryRequest request = RunQueryRequest.newBuilder().setParent("parent-995424086").build(); MockStreamObserver responseObserver = new MockStreamObserver<>(); @@ -530,11 +525,7 @@ public void runQueryTest() throws Exception { public void runQueryExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockFirestore.addException(exception); - RunQueryRequest request = - RunQueryRequest.newBuilder() - .setParent("parent-995424086") - .setExplainOptions(ExplainOptions.newBuilder().build()) - .build(); + RunQueryRequest request = RunQueryRequest.newBuilder().setParent("parent-995424086").build(); MockStreamObserver responseObserver = new MockStreamObserver<>(); @@ -551,6 +542,52 @@ public void runQueryExceptionTest() throws Exception { } } + @Test + public void executePipelineTest() throws Exception { + ExecutePipelineResponse expectedResponse = + ExecutePipelineResponse.newBuilder() + .setTransaction(ByteString.EMPTY) + .addAllResults(new ArrayList()) + .setExecutionTime(Timestamp.newBuilder().build()) + .build(); + mockFirestore.addResponse(expectedResponse); + ExecutePipelineRequest request = + ExecutePipelineRequest.newBuilder().setDatabase("database1789464955").build(); + + MockStreamObserver responseObserver = new MockStreamObserver<>(); + + ServerStreamingCallable callable = + client.executePipelineCallable(); + callable.serverStreamingCall(request, responseObserver); + + List actualResponses = responseObserver.future().get(); + Assert.assertEquals(1, actualResponses.size()); + Assert.assertEquals(expectedResponse, actualResponses.get(0)); + } + + @Test + public void executePipelineExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockFirestore.addException(exception); + ExecutePipelineRequest request = + ExecutePipelineRequest.newBuilder().setDatabase("database1789464955").build(); + + MockStreamObserver responseObserver = new MockStreamObserver<>(); + + ServerStreamingCallable callable = + client.executePipelineCallable(); + callable.serverStreamingCall(request, responseObserver); + + try { + List actualResponses = responseObserver.future().get(); + Assert.fail("No exception thrown"); + } catch (ExecutionException e) { + Assert.assertTrue(e.getCause() instanceof InvalidArgumentException); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + @Test public void runAggregationQueryTest() throws Exception { RunAggregationQueryResponse expectedResponse = @@ -558,14 +595,10 @@ public void runAggregationQueryTest() throws Exception { .setResult(AggregationResult.newBuilder().build()) .setTransaction(ByteString.EMPTY) .setReadTime(Timestamp.newBuilder().build()) - .setExplainMetrics(ExplainMetrics.newBuilder().build()) .build(); mockFirestore.addResponse(expectedResponse); RunAggregationQueryRequest request = - RunAggregationQueryRequest.newBuilder() - .setParent("parent-995424086") - .setExplainOptions(ExplainOptions.newBuilder().build()) - .build(); + RunAggregationQueryRequest.newBuilder().setParent("parent-995424086").build(); MockStreamObserver responseObserver = new MockStreamObserver<>(); @@ -583,10 +616,7 @@ public void runAggregationQueryExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockFirestore.addException(exception); RunAggregationQueryRequest request = - RunAggregationQueryRequest.newBuilder() - .setParent("parent-995424086") - .setExplainOptions(ExplainOptions.newBuilder().build()) - .build(); + RunAggregationQueryRequest.newBuilder().setParent("parent-995424086").build(); MockStreamObserver responseObserver = new MockStreamObserver<>(); diff --git a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/v1/MockFirestoreImpl.java b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/v1/MockFirestoreImpl.java index 7de1495d4..31eba7263 100644 --- a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/v1/MockFirestoreImpl.java +++ b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/v1/MockFirestoreImpl.java @@ -28,6 +28,8 @@ import com.google.firestore.v1.CreateDocumentRequest; import com.google.firestore.v1.DeleteDocumentRequest; import com.google.firestore.v1.Document; +import com.google.firestore.v1.ExecutePipelineRequest; +import com.google.firestore.v1.ExecutePipelineResponse; import com.google.firestore.v1.FirestoreGrpc.FirestoreImplBase; import com.google.firestore.v1.GetDocumentRequest; import com.google.firestore.v1.ListCollectionIdsRequest; @@ -273,6 +275,27 @@ public void runQuery(RunQueryRequest request, StreamObserver r } } + @Override + public void executePipeline( + ExecutePipelineRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof ExecutePipelineResponse) { + requests.add(request); + responseObserver.onNext(((ExecutePipelineResponse) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method ExecutePipeline, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + ExecutePipelineResponse.class.getName(), + Exception.class.getName()))); + } + } + @Override public void runAggregationQuery( RunAggregationQueryRequest request, diff --git a/grpc-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/FirestoreGrpc.java b/grpc-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/FirestoreGrpc.java index 24bd52f05..ecdbe1c13 100644 --- a/grpc-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/FirestoreGrpc.java +++ b/grpc-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/FirestoreGrpc.java @@ -421,6 +421,50 @@ private FirestoreGrpc() {} return getRunQueryMethod; } + private static volatile io.grpc.MethodDescriptor< + com.google.firestore.v1.ExecutePipelineRequest, + com.google.firestore.v1.ExecutePipelineResponse> + getExecutePipelineMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ExecutePipeline", + requestType = com.google.firestore.v1.ExecutePipelineRequest.class, + responseType = com.google.firestore.v1.ExecutePipelineResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING) + public static io.grpc.MethodDescriptor< + com.google.firestore.v1.ExecutePipelineRequest, + com.google.firestore.v1.ExecutePipelineResponse> + getExecutePipelineMethod() { + io.grpc.MethodDescriptor< + com.google.firestore.v1.ExecutePipelineRequest, + com.google.firestore.v1.ExecutePipelineResponse> + getExecutePipelineMethod; + if ((getExecutePipelineMethod = FirestoreGrpc.getExecutePipelineMethod) == null) { + synchronized (FirestoreGrpc.class) { + if ((getExecutePipelineMethod = FirestoreGrpc.getExecutePipelineMethod) == null) { + FirestoreGrpc.getExecutePipelineMethod = + getExecutePipelineMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ExecutePipeline")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.firestore.v1.ExecutePipelineRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.firestore.v1.ExecutePipelineResponse.getDefaultInstance())) + .setSchemaDescriptor(new FirestoreMethodDescriptorSupplier("ExecutePipeline")) + .build(); + } + } + } + return getExecutePipelineMethod; + } + private static volatile io.grpc.MethodDescriptor< com.google.firestore.v1.RunAggregationQueryRequest, com.google.firestore.v1.RunAggregationQueryResponse> @@ -906,6 +950,21 @@ default void runQuery( io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getRunQueryMethod(), responseObserver); } + /** + * + * + *
+     * Executes a pipeline query.
+     * 
+ */ + default void executePipeline( + com.google.firestore.v1.ExecutePipelineRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getExecutePipelineMethod(), responseObserver); + } + /** * * @@ -1212,6 +1271,23 @@ public void runQuery( getChannel().newCall(getRunQueryMethod(), getCallOptions()), request, responseObserver); } + /** + * + * + *
+     * Executes a pipeline query.
+     * 
+ */ + public void executePipeline( + com.google.firestore.v1.ExecutePipelineRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ClientCalls.asyncServerStreamingCall( + getChannel().newCall(getExecutePipelineMethod(), getCallOptions()), + request, + responseObserver); + } + /** * * @@ -1483,6 +1559,19 @@ public java.util.Iterator runQuery( getChannel(), getRunQueryMethod(), getCallOptions(), request); } + /** + * + * + *
+     * Executes a pipeline query.
+     * 
+ */ + public java.util.Iterator executePipeline( + com.google.firestore.v1.ExecutePipelineRequest request) { + return io.grpc.stub.ClientCalls.blockingServerStreamingCall( + getChannel(), getExecutePipelineMethod(), getCallOptions(), request); + } + /** * * @@ -1759,13 +1848,14 @@ public com.google.common.util.concurrent.ListenableFuture implements io.grpc.stub.ServerCalls.UnaryMethod, @@ -1834,6 +1924,12 @@ public void invoke(Req request, io.grpc.stub.StreamObserver responseObserv (io.grpc.stub.StreamObserver) responseObserver); break; + case METHODID_EXECUTE_PIPELINE: + serviceImpl.executePipeline( + (com.google.firestore.v1.ExecutePipelineRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; case METHODID_RUN_AGGREGATION_QUERY: serviceImpl.runAggregationQuery( (com.google.firestore.v1.RunAggregationQueryRequest) request, @@ -1948,6 +2044,13 @@ public static final io.grpc.ServerServiceDefinition bindService(AsyncService ser new MethodHandlers< com.google.firestore.v1.RunQueryRequest, com.google.firestore.v1.RunQueryResponse>(service, METHODID_RUN_QUERY))) + .addMethod( + getExecutePipelineMethod(), + io.grpc.stub.ServerCalls.asyncServerStreamingCall( + new MethodHandlers< + com.google.firestore.v1.ExecutePipelineRequest, + com.google.firestore.v1.ExecutePipelineResponse>( + service, METHODID_EXECUTE_PIPELINE))) .addMethod( getRunAggregationQueryMethod(), io.grpc.stub.ServerCalls.asyncServerStreamingCall( @@ -2053,6 +2156,7 @@ public static io.grpc.ServiceDescriptor getServiceDescriptor() { .addMethod(getCommitMethod()) .addMethod(getRollbackMethod()) .addMethod(getRunQueryMethod()) + .addMethod(getExecutePipelineMethod()) .addMethod(getRunAggregationQueryMethod()) .addMethod(getPartitionQueryMethod()) .addMethod(getWriteMethod()) diff --git a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/Backup.java b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/Backup.java index aa61d5aa3..25a0b809b 100644 --- a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/Backup.java +++ b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/Backup.java @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/firestore/admin/v1/backup.proto -// Protobuf Java Version: 3.25.3 +// Protobuf Java Version: 3.25.2 package com.google.firestore.admin.v1; /** diff --git a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/BackupOrBuilder.java b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/BackupOrBuilder.java index dd9af1b2c..8da642d41 100644 --- a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/BackupOrBuilder.java +++ b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/BackupOrBuilder.java @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/firestore/admin/v1/backup.proto -// Protobuf Java Version: 3.25.3 +// Protobuf Java Version: 3.25.2 package com.google.firestore.admin.v1; public interface BackupOrBuilder diff --git a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/BackupProto.java b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/BackupProto.java index 6f0a802ae..deab8154c 100644 --- a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/BackupProto.java +++ b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/BackupProto.java @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/firestore/admin/v1/backup.proto -// Protobuf Java Version: 3.25.3 +// Protobuf Java Version: 3.25.2 package com.google.firestore.admin.v1; public final class BackupProto { diff --git a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/BackupSchedule.java b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/BackupSchedule.java index cb1074ec2..7c549cea5 100644 --- a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/BackupSchedule.java +++ b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/BackupSchedule.java @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/firestore/admin/v1/schedule.proto -// Protobuf Java Version: 3.25.3 +// Protobuf Java Version: 3.25.2 package com.google.firestore.admin.v1; /** diff --git a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/BackupScheduleOrBuilder.java b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/BackupScheduleOrBuilder.java index 723400cee..d31b3c5c2 100644 --- a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/BackupScheduleOrBuilder.java +++ b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/BackupScheduleOrBuilder.java @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/firestore/admin/v1/schedule.proto -// Protobuf Java Version: 3.25.3 +// Protobuf Java Version: 3.25.2 package com.google.firestore.admin.v1; public interface BackupScheduleOrBuilder diff --git a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/CreateBackupScheduleRequest.java b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/CreateBackupScheduleRequest.java index b30470fa7..63dbeb830 100644 --- a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/CreateBackupScheduleRequest.java +++ b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/CreateBackupScheduleRequest.java @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/firestore/admin/v1/firestore_admin.proto -// Protobuf Java Version: 3.25.3 +// Protobuf Java Version: 3.25.2 package com.google.firestore.admin.v1; /** diff --git a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/CreateBackupScheduleRequestOrBuilder.java b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/CreateBackupScheduleRequestOrBuilder.java index 53131c507..d5402d0e4 100644 --- a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/CreateBackupScheduleRequestOrBuilder.java +++ b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/CreateBackupScheduleRequestOrBuilder.java @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/firestore/admin/v1/firestore_admin.proto -// Protobuf Java Version: 3.25.3 +// Protobuf Java Version: 3.25.2 package com.google.firestore.admin.v1; public interface CreateBackupScheduleRequestOrBuilder diff --git a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/DailyRecurrence.java b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/DailyRecurrence.java index 353b9464e..8b21cbc67 100644 --- a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/DailyRecurrence.java +++ b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/DailyRecurrence.java @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/firestore/admin/v1/schedule.proto -// Protobuf Java Version: 3.25.3 +// Protobuf Java Version: 3.25.2 package com.google.firestore.admin.v1; /** diff --git a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/DailyRecurrenceOrBuilder.java b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/DailyRecurrenceOrBuilder.java index 6ee832b1f..750956a9b 100644 --- a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/DailyRecurrenceOrBuilder.java +++ b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/DailyRecurrenceOrBuilder.java @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/firestore/admin/v1/schedule.proto -// Protobuf Java Version: 3.25.3 +// Protobuf Java Version: 3.25.2 package com.google.firestore.admin.v1; public interface DailyRecurrenceOrBuilder diff --git a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/DeleteBackupRequest.java b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/DeleteBackupRequest.java index 112572a0d..e4643bb90 100644 --- a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/DeleteBackupRequest.java +++ b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/DeleteBackupRequest.java @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/firestore/admin/v1/firestore_admin.proto -// Protobuf Java Version: 3.25.3 +// Protobuf Java Version: 3.25.2 package com.google.firestore.admin.v1; /** diff --git a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/DeleteBackupRequestOrBuilder.java b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/DeleteBackupRequestOrBuilder.java index 790ba2bb2..40dcbef62 100644 --- a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/DeleteBackupRequestOrBuilder.java +++ b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/DeleteBackupRequestOrBuilder.java @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/firestore/admin/v1/firestore_admin.proto -// Protobuf Java Version: 3.25.3 +// Protobuf Java Version: 3.25.2 package com.google.firestore.admin.v1; public interface DeleteBackupRequestOrBuilder diff --git a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/DeleteBackupScheduleRequest.java b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/DeleteBackupScheduleRequest.java index 5fc48b2a0..b17dc9415 100644 --- a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/DeleteBackupScheduleRequest.java +++ b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/DeleteBackupScheduleRequest.java @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/firestore/admin/v1/firestore_admin.proto -// Protobuf Java Version: 3.25.3 +// Protobuf Java Version: 3.25.2 package com.google.firestore.admin.v1; /** diff --git a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/DeleteBackupScheduleRequestOrBuilder.java b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/DeleteBackupScheduleRequestOrBuilder.java index 4bff0493b..3844da9fd 100644 --- a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/DeleteBackupScheduleRequestOrBuilder.java +++ b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/DeleteBackupScheduleRequestOrBuilder.java @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/firestore/admin/v1/firestore_admin.proto -// Protobuf Java Version: 3.25.3 +// Protobuf Java Version: 3.25.2 package com.google.firestore.admin.v1; public interface DeleteBackupScheduleRequestOrBuilder diff --git a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/GetBackupRequest.java b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/GetBackupRequest.java index e9be92d06..bc3a04431 100644 --- a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/GetBackupRequest.java +++ b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/GetBackupRequest.java @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/firestore/admin/v1/firestore_admin.proto -// Protobuf Java Version: 3.25.3 +// Protobuf Java Version: 3.25.2 package com.google.firestore.admin.v1; /** diff --git a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/GetBackupRequestOrBuilder.java b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/GetBackupRequestOrBuilder.java index a475a5173..541b353aa 100644 --- a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/GetBackupRequestOrBuilder.java +++ b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/GetBackupRequestOrBuilder.java @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/firestore/admin/v1/firestore_admin.proto -// Protobuf Java Version: 3.25.3 +// Protobuf Java Version: 3.25.2 package com.google.firestore.admin.v1; public interface GetBackupRequestOrBuilder diff --git a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/GetBackupScheduleRequest.java b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/GetBackupScheduleRequest.java index 18a4ad0ee..466569f11 100644 --- a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/GetBackupScheduleRequest.java +++ b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/GetBackupScheduleRequest.java @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/firestore/admin/v1/firestore_admin.proto -// Protobuf Java Version: 3.25.3 +// Protobuf Java Version: 3.25.2 package com.google.firestore.admin.v1; /** diff --git a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/GetBackupScheduleRequestOrBuilder.java b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/GetBackupScheduleRequestOrBuilder.java index 6c33e1e67..d75c69e10 100644 --- a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/GetBackupScheduleRequestOrBuilder.java +++ b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/GetBackupScheduleRequestOrBuilder.java @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/firestore/admin/v1/firestore_admin.proto -// Protobuf Java Version: 3.25.3 +// Protobuf Java Version: 3.25.2 package com.google.firestore.admin.v1; public interface GetBackupScheduleRequestOrBuilder diff --git a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/ListBackupSchedulesRequest.java b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/ListBackupSchedulesRequest.java index 441f55ac8..c8f38c04c 100644 --- a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/ListBackupSchedulesRequest.java +++ b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/ListBackupSchedulesRequest.java @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/firestore/admin/v1/firestore_admin.proto -// Protobuf Java Version: 3.25.3 +// Protobuf Java Version: 3.25.2 package com.google.firestore.admin.v1; /** diff --git a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/ListBackupSchedulesRequestOrBuilder.java b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/ListBackupSchedulesRequestOrBuilder.java index 2c4bba0b5..c2d083160 100644 --- a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/ListBackupSchedulesRequestOrBuilder.java +++ b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/ListBackupSchedulesRequestOrBuilder.java @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/firestore/admin/v1/firestore_admin.proto -// Protobuf Java Version: 3.25.3 +// Protobuf Java Version: 3.25.2 package com.google.firestore.admin.v1; public interface ListBackupSchedulesRequestOrBuilder diff --git a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/ListBackupSchedulesResponse.java b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/ListBackupSchedulesResponse.java index 07fbfebda..ea2ac8418 100644 --- a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/ListBackupSchedulesResponse.java +++ b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/ListBackupSchedulesResponse.java @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/firestore/admin/v1/firestore_admin.proto -// Protobuf Java Version: 3.25.3 +// Protobuf Java Version: 3.25.2 package com.google.firestore.admin.v1; /** diff --git a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/ListBackupSchedulesResponseOrBuilder.java b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/ListBackupSchedulesResponseOrBuilder.java index b2b4cc77c..eea1e95de 100644 --- a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/ListBackupSchedulesResponseOrBuilder.java +++ b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/ListBackupSchedulesResponseOrBuilder.java @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/firestore/admin/v1/firestore_admin.proto -// Protobuf Java Version: 3.25.3 +// Protobuf Java Version: 3.25.2 package com.google.firestore.admin.v1; public interface ListBackupSchedulesResponseOrBuilder diff --git a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/ListBackupsRequest.java b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/ListBackupsRequest.java index fd2bc58c4..63727c091 100644 --- a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/ListBackupsRequest.java +++ b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/ListBackupsRequest.java @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/firestore/admin/v1/firestore_admin.proto -// Protobuf Java Version: 3.25.3 +// Protobuf Java Version: 3.25.2 package com.google.firestore.admin.v1; /** diff --git a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/ListBackupsRequestOrBuilder.java b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/ListBackupsRequestOrBuilder.java index ab2541756..2945d5c15 100644 --- a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/ListBackupsRequestOrBuilder.java +++ b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/ListBackupsRequestOrBuilder.java @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/firestore/admin/v1/firestore_admin.proto -// Protobuf Java Version: 3.25.3 +// Protobuf Java Version: 3.25.2 package com.google.firestore.admin.v1; public interface ListBackupsRequestOrBuilder diff --git a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/ListBackupsResponse.java b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/ListBackupsResponse.java index 444e6d34d..728d020c9 100644 --- a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/ListBackupsResponse.java +++ b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/ListBackupsResponse.java @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/firestore/admin/v1/firestore_admin.proto -// Protobuf Java Version: 3.25.3 +// Protobuf Java Version: 3.25.2 package com.google.firestore.admin.v1; /** diff --git a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/ListBackupsResponseOrBuilder.java b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/ListBackupsResponseOrBuilder.java index 6d36e5016..9cbfc18a4 100644 --- a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/ListBackupsResponseOrBuilder.java +++ b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/ListBackupsResponseOrBuilder.java @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/firestore/admin/v1/firestore_admin.proto -// Protobuf Java Version: 3.25.3 +// Protobuf Java Version: 3.25.2 package com.google.firestore.admin.v1; public interface ListBackupsResponseOrBuilder diff --git a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/RestoreDatabaseMetadata.java b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/RestoreDatabaseMetadata.java index d34f928c7..00716f960 100644 --- a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/RestoreDatabaseMetadata.java +++ b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/RestoreDatabaseMetadata.java @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/firestore/admin/v1/operation.proto -// Protobuf Java Version: 3.25.3 +// Protobuf Java Version: 3.25.2 package com.google.firestore.admin.v1; /** diff --git a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/RestoreDatabaseMetadataOrBuilder.java b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/RestoreDatabaseMetadataOrBuilder.java index 607e33338..10131af08 100644 --- a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/RestoreDatabaseMetadataOrBuilder.java +++ b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/RestoreDatabaseMetadataOrBuilder.java @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/firestore/admin/v1/operation.proto -// Protobuf Java Version: 3.25.3 +// Protobuf Java Version: 3.25.2 package com.google.firestore.admin.v1; public interface RestoreDatabaseMetadataOrBuilder diff --git a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/RestoreDatabaseRequest.java b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/RestoreDatabaseRequest.java index 4afad3b7e..1f88b08d7 100644 --- a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/RestoreDatabaseRequest.java +++ b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/RestoreDatabaseRequest.java @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/firestore/admin/v1/firestore_admin.proto -// Protobuf Java Version: 3.25.3 +// Protobuf Java Version: 3.25.2 package com.google.firestore.admin.v1; /** diff --git a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/RestoreDatabaseRequestOrBuilder.java b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/RestoreDatabaseRequestOrBuilder.java index a1b317b9f..33d7b0110 100644 --- a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/RestoreDatabaseRequestOrBuilder.java +++ b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/RestoreDatabaseRequestOrBuilder.java @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/firestore/admin/v1/firestore_admin.proto -// Protobuf Java Version: 3.25.3 +// Protobuf Java Version: 3.25.2 package com.google.firestore.admin.v1; public interface RestoreDatabaseRequestOrBuilder diff --git a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/ScheduleProto.java b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/ScheduleProto.java index 8bcd70222..ddec765b9 100644 --- a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/ScheduleProto.java +++ b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/ScheduleProto.java @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/firestore/admin/v1/schedule.proto -// Protobuf Java Version: 3.25.3 +// Protobuf Java Version: 3.25.2 package com.google.firestore.admin.v1; public final class ScheduleProto { diff --git a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/UpdateBackupScheduleRequest.java b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/UpdateBackupScheduleRequest.java index 50704d968..e0ef6097a 100644 --- a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/UpdateBackupScheduleRequest.java +++ b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/UpdateBackupScheduleRequest.java @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/firestore/admin/v1/firestore_admin.proto -// Protobuf Java Version: 3.25.3 +// Protobuf Java Version: 3.25.2 package com.google.firestore.admin.v1; /** diff --git a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/UpdateBackupScheduleRequestOrBuilder.java b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/UpdateBackupScheduleRequestOrBuilder.java index 347c89d92..07e4d0cb7 100644 --- a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/UpdateBackupScheduleRequestOrBuilder.java +++ b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/UpdateBackupScheduleRequestOrBuilder.java @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/firestore/admin/v1/firestore_admin.proto -// Protobuf Java Version: 3.25.3 +// Protobuf Java Version: 3.25.2 package com.google.firestore.admin.v1; public interface UpdateBackupScheduleRequestOrBuilder diff --git a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/WeeklyRecurrence.java b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/WeeklyRecurrence.java index 256e57f0c..58dcabbaf 100644 --- a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/WeeklyRecurrence.java +++ b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/WeeklyRecurrence.java @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/firestore/admin/v1/schedule.proto -// Protobuf Java Version: 3.25.3 +// Protobuf Java Version: 3.25.2 package com.google.firestore.admin.v1; /** diff --git a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/WeeklyRecurrenceOrBuilder.java b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/WeeklyRecurrenceOrBuilder.java index 6c265b99d..668210ab6 100644 --- a/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/WeeklyRecurrenceOrBuilder.java +++ b/proto-google-cloud-firestore-admin-v1/src/main/java/com/google/firestore/admin/v1/WeeklyRecurrenceOrBuilder.java @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/firestore/admin/v1/schedule.proto -// Protobuf Java Version: 3.25.3 +// Protobuf Java Version: 3.25.2 package com.google.firestore.admin.v1; public interface WeeklyRecurrenceOrBuilder diff --git a/proto-google-cloud-firestore-admin-v1/src/main/proto/google/firestore/admin/v1/backup.proto b/proto-google-cloud-firestore-admin-v1/src/main/proto/google/firestore/admin/v1/backup.proto index 45f3adc8e..e01f81ff8 100644 --- a/proto-google-cloud-firestore-admin-v1/src/main/proto/google/firestore/admin/v1/backup.proto +++ b/proto-google-cloud-firestore-admin-v1/src/main/proto/google/firestore/admin/v1/backup.proto @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2023 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-firestore-admin-v1/src/main/proto/google/firestore/admin/v1/schedule.proto b/proto-google-cloud-firestore-admin-v1/src/main/proto/google/firestore/admin/v1/schedule.proto index 52200e8e5..7a45238f0 100644 --- a/proto-google-cloud-firestore-admin-v1/src/main/proto/google/firestore/admin/v1/schedule.proto +++ b/proto-google-cloud-firestore-admin-v1/src/main/proto/google/firestore/admin/v1/schedule.proto @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2023 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/DocumentProto.java b/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/DocumentProto.java index 350f1f50b..49ed13f86 100644 --- a/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/DocumentProto.java +++ b/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/DocumentProto.java @@ -52,6 +52,26 @@ public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry r internal_static_google_firestore_v1_MapValue_FieldsEntry_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_firestore_v1_MapValue_FieldsEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_firestore_v1_Function_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_firestore_v1_Function_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_firestore_v1_Function_OptionsEntry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_firestore_v1_Function_OptionsEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_firestore_v1_Pipeline_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_firestore_v1_Pipeline_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_firestore_v1_Pipeline_Stage_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_firestore_v1_Pipeline_Stage_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_firestore_v1_Pipeline_Stage_OptionsEntry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_firestore_v1_Pipeline_Stage_OptionsEntry_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { return descriptor; @@ -71,7 +91,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "p\022/\n\013update_time\030\004 \001(\0132\032.google.protobuf" + ".Timestamp\032I\n\013FieldsEntry\022\013\n\003key\030\001 \001(\t\022)" + "\n\005value\030\002 \001(\0132\032.google.firestore.v1.Valu" - + "e:\0028\001\"\256\003\n\005Value\0220\n\nnull_value\030\013 \001(\0162\032.go" + + "e:\0028\001\"\301\004\n\005Value\0220\n\nnull_value\030\013 \001(\0162\032.go" + "ogle.protobuf.NullValueH\000\022\027\n\rboolean_val" + "ue\030\001 \001(\010H\000\022\027\n\rinteger_value\030\002 \001(\003H\000\022\026\n\014d" + "ouble_value\030\003 \001(\001H\000\0225\n\017timestamp_value\030\n" @@ -81,18 +101,33 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "t_value\030\010 \001(\0132\023.google.type.LatLngH\000\0226\n\013" + "array_value\030\t \001(\0132\037.google.firestore.v1." + "ArrayValueH\000\0222\n\tmap_value\030\006 \001(\0132\035.google" - + ".firestore.v1.MapValueH\000B\014\n\nvalue_type\"8" - + "\n\nArrayValue\022*\n\006values\030\001 \003(\0132\032.google.fi" - + "restore.v1.Value\"\220\001\n\010MapValue\0229\n\006fields\030" - + "\001 \003(\0132).google.firestore.v1.MapValue.Fie" - + "ldsEntry\032I\n\013FieldsEntry\022\013\n\003key\030\001 \001(\t\022)\n\005" - + "value\030\002 \001(\0132\032.google.firestore.v1.Value:" - + "\0028\001B\305\001\n\027com.google.firestore.v1B\rDocumen" - + "tProtoP\001Z;cloud.google.com/go/firestore/" - + "apiv1/firestorepb;firestorepb\242\002\004GCFS\252\002\031G" - + "oogle.Cloud.Firestore.V1\312\002\031Google\\Cloud\\" - + "Firestore\\V1\352\002\034Google::Cloud::Firestore:" - + ":V1b\006proto3" + + ".firestore.v1.MapValueH\000\022\037\n\025field_refere" + + "nce_value\030\023 \001(\tH\000\0227\n\016function_value\030\024 \001(" + + "\0132\035.google.firestore.v1.FunctionH\000\0227\n\016pi" + + "peline_value\030\025 \001(\0132\035.google.firestore.v1" + + ".PipelineH\000B\014\n\nvalue_type\"8\n\nArrayValue\022" + + "*\n\006values\030\001 \003(\0132\032.google.firestore.v1.Va" + + "lue\"\220\001\n\010MapValue\0229\n\006fields\030\001 \003(\0132).googl" + + "e.firestore.v1.MapValue.FieldsEntry\032I\n\013F" + + "ieldsEntry\022\013\n\003key\030\001 \001(\t\022)\n\005value\030\002 \001(\0132\032" + + ".google.firestore.v1.Value:\0028\001\"\313\001\n\010Funct" + + "ion\022\014\n\004name\030\001 \001(\t\022(\n\004args\030\002 \003(\0132\032.google" + + ".firestore.v1.Value\022;\n\007options\030\003 \003(\0132*.g" + + "oogle.firestore.v1.Function.OptionsEntry" + + "\032J\n\014OptionsEntry\022\013\n\003key\030\001 \001(\t\022)\n\005value\030\002" + + " \001(\0132\032.google.firestore.v1.Value:\0028\001\"\220\002\n" + + "\010Pipeline\0223\n\006stages\030\001 \003(\0132#.google.fires" + + "tore.v1.Pipeline.Stage\032\316\001\n\005Stage\022\014\n\004name" + + "\030\001 \001(\t\022(\n\004args\030\002 \003(\0132\032.google.firestore." + + "v1.Value\022A\n\007options\030\003 \003(\01320.google.fires" + + "tore.v1.Pipeline.Stage.OptionsEntry\032J\n\014O" + + "ptionsEntry\022\013\n\003key\030\001 \001(\t\022)\n\005value\030\002 \001(\0132" + + "\032.google.firestore.v1.Value:\0028\001B\305\001\n\027com." + + "google.firestore.v1B\rDocumentProtoP\001Z;cl" + + "oud.google.com/go/firestore/apiv1/firest" + + "orepb;firestorepb\242\002\004GCFS\252\002\031Google.Cloud." + + "Firestore.V1\312\002\031Google\\Cloud\\Firestore\\V1" + + "\352\002\034Google::Cloud::Firestore::V1b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( @@ -134,6 +169,9 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "GeoPointValue", "ArrayValue", "MapValue", + "FieldReferenceValue", + "FunctionValue", + "PipelineValue", "ValueType", }); internal_static_google_firestore_v1_ArrayValue_descriptor = @@ -160,6 +198,46 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new java.lang.String[] { "Key", "Value", }); + internal_static_google_firestore_v1_Function_descriptor = + getDescriptor().getMessageTypes().get(4); + internal_static_google_firestore_v1_Function_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_firestore_v1_Function_descriptor, + new java.lang.String[] { + "Name", "Args", "Options", + }); + internal_static_google_firestore_v1_Function_OptionsEntry_descriptor = + internal_static_google_firestore_v1_Function_descriptor.getNestedTypes().get(0); + internal_static_google_firestore_v1_Function_OptionsEntry_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_firestore_v1_Function_OptionsEntry_descriptor, + new java.lang.String[] { + "Key", "Value", + }); + internal_static_google_firestore_v1_Pipeline_descriptor = + getDescriptor().getMessageTypes().get(5); + internal_static_google_firestore_v1_Pipeline_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_firestore_v1_Pipeline_descriptor, + new java.lang.String[] { + "Stages", + }); + internal_static_google_firestore_v1_Pipeline_Stage_descriptor = + internal_static_google_firestore_v1_Pipeline_descriptor.getNestedTypes().get(0); + internal_static_google_firestore_v1_Pipeline_Stage_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_firestore_v1_Pipeline_Stage_descriptor, + new java.lang.String[] { + "Name", "Args", "Options", + }); + internal_static_google_firestore_v1_Pipeline_Stage_OptionsEntry_descriptor = + internal_static_google_firestore_v1_Pipeline_Stage_descriptor.getNestedTypes().get(0); + internal_static_google_firestore_v1_Pipeline_Stage_OptionsEntry_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_firestore_v1_Pipeline_Stage_OptionsEntry_descriptor, + new java.lang.String[] { + "Key", "Value", + }); com.google.protobuf.StructProto.getDescriptor(); com.google.protobuf.TimestampProto.getDescriptor(); com.google.type.LatLngProto.getDescriptor(); diff --git a/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/ExecutePipelineRequest.java b/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/ExecutePipelineRequest.java new file mode 100644 index 000000000..544c520ff --- /dev/null +++ b/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/ExecutePipelineRequest.java @@ -0,0 +1,1898 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/firestore/v1/firestore.proto + +// Protobuf Java Version: 3.25.2 +package com.google.firestore.v1; + +/** + * + * + *
+ * The request for [Firestore.ExecutePipeline][].
+ * 
+ * + * Protobuf type {@code google.firestore.v1.ExecutePipelineRequest} + */ +public final class ExecutePipelineRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.firestore.v1.ExecutePipelineRequest) + ExecutePipelineRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use ExecutePipelineRequest.newBuilder() to construct. + private ExecutePipelineRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ExecutePipelineRequest() { + database_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ExecutePipelineRequest(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.firestore.v1.FirestoreProto + .internal_static_google_firestore_v1_ExecutePipelineRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.firestore.v1.FirestoreProto + .internal_static_google_firestore_v1_ExecutePipelineRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.firestore.v1.ExecutePipelineRequest.class, + com.google.firestore.v1.ExecutePipelineRequest.Builder.class); + } + + private int pipelineTypeCase_ = 0; + + @SuppressWarnings("serial") + private java.lang.Object pipelineType_; + + public enum PipelineTypeCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + STRUCTURED_PIPELINE(2), + PIPELINETYPE_NOT_SET(0); + private final int value; + + private PipelineTypeCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static PipelineTypeCase valueOf(int value) { + return forNumber(value); + } + + public static PipelineTypeCase forNumber(int value) { + switch (value) { + case 2: + return STRUCTURED_PIPELINE; + case 0: + return PIPELINETYPE_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public PipelineTypeCase getPipelineTypeCase() { + return PipelineTypeCase.forNumber(pipelineTypeCase_); + } + + private int consistencySelectorCase_ = 0; + + @SuppressWarnings("serial") + private java.lang.Object consistencySelector_; + + public enum ConsistencySelectorCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + TRANSACTION(5), + NEW_TRANSACTION(6), + READ_TIME(7), + CONSISTENCYSELECTOR_NOT_SET(0); + private final int value; + + private ConsistencySelectorCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static ConsistencySelectorCase valueOf(int value) { + return forNumber(value); + } + + public static ConsistencySelectorCase forNumber(int value) { + switch (value) { + case 5: + return TRANSACTION; + case 6: + return NEW_TRANSACTION; + case 7: + return READ_TIME; + case 0: + return CONSISTENCYSELECTOR_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public ConsistencySelectorCase getConsistencySelectorCase() { + return ConsistencySelectorCase.forNumber(consistencySelectorCase_); + } + + public static final int DATABASE_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object database_ = ""; + /** + * + * + *
+   * Database identifier, in the form `projects/{project}/databases/{database}`.
+   * 
+ * + * string database = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The database. + */ + @java.lang.Override + public java.lang.String getDatabase() { + java.lang.Object ref = database_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + database_ = s; + return s; + } + } + /** + * + * + *
+   * Database identifier, in the form `projects/{project}/databases/{database}`.
+   * 
+ * + * string database = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for database. + */ + @java.lang.Override + public com.google.protobuf.ByteString getDatabaseBytes() { + java.lang.Object ref = database_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + database_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int STRUCTURED_PIPELINE_FIELD_NUMBER = 2; + /** + * + * + *
+   * A pipelined operation.
+   * 
+ * + * .google.firestore.v1.StructuredPipeline structured_pipeline = 2; + * + * @return Whether the structuredPipeline field is set. + */ + @java.lang.Override + public boolean hasStructuredPipeline() { + return pipelineTypeCase_ == 2; + } + /** + * + * + *
+   * A pipelined operation.
+   * 
+ * + * .google.firestore.v1.StructuredPipeline structured_pipeline = 2; + * + * @return The structuredPipeline. + */ + @java.lang.Override + public com.google.firestore.v1.StructuredPipeline getStructuredPipeline() { + if (pipelineTypeCase_ == 2) { + return (com.google.firestore.v1.StructuredPipeline) pipelineType_; + } + return com.google.firestore.v1.StructuredPipeline.getDefaultInstance(); + } + /** + * + * + *
+   * A pipelined operation.
+   * 
+ * + * .google.firestore.v1.StructuredPipeline structured_pipeline = 2; + */ + @java.lang.Override + public com.google.firestore.v1.StructuredPipelineOrBuilder getStructuredPipelineOrBuilder() { + if (pipelineTypeCase_ == 2) { + return (com.google.firestore.v1.StructuredPipeline) pipelineType_; + } + return com.google.firestore.v1.StructuredPipeline.getDefaultInstance(); + } + + public static final int TRANSACTION_FIELD_NUMBER = 5; + /** + * + * + *
+   * Run the query within an already active transaction.
+   *
+   * The value here is the opaque transaction ID to execute the query in.
+   * 
+ * + * bytes transaction = 5; + * + * @return Whether the transaction field is set. + */ + @java.lang.Override + public boolean hasTransaction() { + return consistencySelectorCase_ == 5; + } + /** + * + * + *
+   * Run the query within an already active transaction.
+   *
+   * The value here is the opaque transaction ID to execute the query in.
+   * 
+ * + * bytes transaction = 5; + * + * @return The transaction. + */ + @java.lang.Override + public com.google.protobuf.ByteString getTransaction() { + if (consistencySelectorCase_ == 5) { + return (com.google.protobuf.ByteString) consistencySelector_; + } + return com.google.protobuf.ByteString.EMPTY; + } + + public static final int NEW_TRANSACTION_FIELD_NUMBER = 6; + /** + * + * + *
+   * Execute the pipeline in a new transaction.
+   *
+   * The identifier of the newly created transaction will be returned in the
+   * first response on the stream. This defaults to a read-only transaction.
+   * 
+ * + * .google.firestore.v1.TransactionOptions new_transaction = 6; + * + * @return Whether the newTransaction field is set. + */ + @java.lang.Override + public boolean hasNewTransaction() { + return consistencySelectorCase_ == 6; + } + /** + * + * + *
+   * Execute the pipeline in a new transaction.
+   *
+   * The identifier of the newly created transaction will be returned in the
+   * first response on the stream. This defaults to a read-only transaction.
+   * 
+ * + * .google.firestore.v1.TransactionOptions new_transaction = 6; + * + * @return The newTransaction. + */ + @java.lang.Override + public com.google.firestore.v1.TransactionOptions getNewTransaction() { + if (consistencySelectorCase_ == 6) { + return (com.google.firestore.v1.TransactionOptions) consistencySelector_; + } + return com.google.firestore.v1.TransactionOptions.getDefaultInstance(); + } + /** + * + * + *
+   * Execute the pipeline in a new transaction.
+   *
+   * The identifier of the newly created transaction will be returned in the
+   * first response on the stream. This defaults to a read-only transaction.
+   * 
+ * + * .google.firestore.v1.TransactionOptions new_transaction = 6; + */ + @java.lang.Override + public com.google.firestore.v1.TransactionOptionsOrBuilder getNewTransactionOrBuilder() { + if (consistencySelectorCase_ == 6) { + return (com.google.firestore.v1.TransactionOptions) consistencySelector_; + } + return com.google.firestore.v1.TransactionOptions.getDefaultInstance(); + } + + public static final int READ_TIME_FIELD_NUMBER = 7; + /** + * + * + *
+   * Execute the pipeline in a snapshot transaction at the given time.
+   *
+   * This must be a microsecond precision timestamp within the past one hour,
+   * or if Point-in-Time Recovery is enabled, can additionally be a whole
+   * minute timestamp within the past 7 days.
+   * 
+ * + * .google.protobuf.Timestamp read_time = 7; + * + * @return Whether the readTime field is set. + */ + @java.lang.Override + public boolean hasReadTime() { + return consistencySelectorCase_ == 7; + } + /** + * + * + *
+   * Execute the pipeline in a snapshot transaction at the given time.
+   *
+   * This must be a microsecond precision timestamp within the past one hour,
+   * or if Point-in-Time Recovery is enabled, can additionally be a whole
+   * minute timestamp within the past 7 days.
+   * 
+ * + * .google.protobuf.Timestamp read_time = 7; + * + * @return The readTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getReadTime() { + if (consistencySelectorCase_ == 7) { + return (com.google.protobuf.Timestamp) consistencySelector_; + } + return com.google.protobuf.Timestamp.getDefaultInstance(); + } + /** + * + * + *
+   * Execute the pipeline in a snapshot transaction at the given time.
+   *
+   * This must be a microsecond precision timestamp within the past one hour,
+   * or if Point-in-Time Recovery is enabled, can additionally be a whole
+   * minute timestamp within the past 7 days.
+   * 
+ * + * .google.protobuf.Timestamp read_time = 7; + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getReadTimeOrBuilder() { + if (consistencySelectorCase_ == 7) { + return (com.google.protobuf.Timestamp) consistencySelector_; + } + return com.google.protobuf.Timestamp.getDefaultInstance(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(database_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, database_); + } + if (pipelineTypeCase_ == 2) { + output.writeMessage(2, (com.google.firestore.v1.StructuredPipeline) pipelineType_); + } + if (consistencySelectorCase_ == 5) { + output.writeBytes(5, (com.google.protobuf.ByteString) consistencySelector_); + } + if (consistencySelectorCase_ == 6) { + output.writeMessage(6, (com.google.firestore.v1.TransactionOptions) consistencySelector_); + } + if (consistencySelectorCase_ == 7) { + output.writeMessage(7, (com.google.protobuf.Timestamp) consistencySelector_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(database_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, database_); + } + if (pipelineTypeCase_ == 2) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 2, (com.google.firestore.v1.StructuredPipeline) pipelineType_); + } + if (consistencySelectorCase_ == 5) { + size += + com.google.protobuf.CodedOutputStream.computeBytesSize( + 5, (com.google.protobuf.ByteString) consistencySelector_); + } + if (consistencySelectorCase_ == 6) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 6, (com.google.firestore.v1.TransactionOptions) consistencySelector_); + } + if (consistencySelectorCase_ == 7) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 7, (com.google.protobuf.Timestamp) consistencySelector_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.firestore.v1.ExecutePipelineRequest)) { + return super.equals(obj); + } + com.google.firestore.v1.ExecutePipelineRequest other = + (com.google.firestore.v1.ExecutePipelineRequest) obj; + + if (!getDatabase().equals(other.getDatabase())) return false; + if (!getPipelineTypeCase().equals(other.getPipelineTypeCase())) return false; + switch (pipelineTypeCase_) { + case 2: + if (!getStructuredPipeline().equals(other.getStructuredPipeline())) return false; + break; + case 0: + default: + } + if (!getConsistencySelectorCase().equals(other.getConsistencySelectorCase())) return false; + switch (consistencySelectorCase_) { + case 5: + if (!getTransaction().equals(other.getTransaction())) return false; + break; + case 6: + if (!getNewTransaction().equals(other.getNewTransaction())) return false; + break; + case 7: + if (!getReadTime().equals(other.getReadTime())) return false; + break; + case 0: + default: + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + DATABASE_FIELD_NUMBER; + hash = (53 * hash) + getDatabase().hashCode(); + switch (pipelineTypeCase_) { + case 2: + hash = (37 * hash) + STRUCTURED_PIPELINE_FIELD_NUMBER; + hash = (53 * hash) + getStructuredPipeline().hashCode(); + break; + case 0: + default: + } + switch (consistencySelectorCase_) { + case 5: + hash = (37 * hash) + TRANSACTION_FIELD_NUMBER; + hash = (53 * hash) + getTransaction().hashCode(); + break; + case 6: + hash = (37 * hash) + NEW_TRANSACTION_FIELD_NUMBER; + hash = (53 * hash) + getNewTransaction().hashCode(); + break; + case 7: + hash = (37 * hash) + READ_TIME_FIELD_NUMBER; + hash = (53 * hash) + getReadTime().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.firestore.v1.ExecutePipelineRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.firestore.v1.ExecutePipelineRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.firestore.v1.ExecutePipelineRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.firestore.v1.ExecutePipelineRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.firestore.v1.ExecutePipelineRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.firestore.v1.ExecutePipelineRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.firestore.v1.ExecutePipelineRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.firestore.v1.ExecutePipelineRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.firestore.v1.ExecutePipelineRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.firestore.v1.ExecutePipelineRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.firestore.v1.ExecutePipelineRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.firestore.v1.ExecutePipelineRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.firestore.v1.ExecutePipelineRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * The request for [Firestore.ExecutePipeline][].
+   * 
+ * + * Protobuf type {@code google.firestore.v1.ExecutePipelineRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.firestore.v1.ExecutePipelineRequest) + com.google.firestore.v1.ExecutePipelineRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.firestore.v1.FirestoreProto + .internal_static_google_firestore_v1_ExecutePipelineRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.firestore.v1.FirestoreProto + .internal_static_google_firestore_v1_ExecutePipelineRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.firestore.v1.ExecutePipelineRequest.class, + com.google.firestore.v1.ExecutePipelineRequest.Builder.class); + } + + // Construct using com.google.firestore.v1.ExecutePipelineRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + database_ = ""; + if (structuredPipelineBuilder_ != null) { + structuredPipelineBuilder_.clear(); + } + if (newTransactionBuilder_ != null) { + newTransactionBuilder_.clear(); + } + if (readTimeBuilder_ != null) { + readTimeBuilder_.clear(); + } + pipelineTypeCase_ = 0; + pipelineType_ = null; + consistencySelectorCase_ = 0; + consistencySelector_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.firestore.v1.FirestoreProto + .internal_static_google_firestore_v1_ExecutePipelineRequest_descriptor; + } + + @java.lang.Override + public com.google.firestore.v1.ExecutePipelineRequest getDefaultInstanceForType() { + return com.google.firestore.v1.ExecutePipelineRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.firestore.v1.ExecutePipelineRequest build() { + com.google.firestore.v1.ExecutePipelineRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.firestore.v1.ExecutePipelineRequest buildPartial() { + com.google.firestore.v1.ExecutePipelineRequest result = + new com.google.firestore.v1.ExecutePipelineRequest(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + buildPartialOneofs(result); + onBuilt(); + return result; + } + + private void buildPartial0(com.google.firestore.v1.ExecutePipelineRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.database_ = database_; + } + } + + private void buildPartialOneofs(com.google.firestore.v1.ExecutePipelineRequest result) { + result.pipelineTypeCase_ = pipelineTypeCase_; + result.pipelineType_ = this.pipelineType_; + if (pipelineTypeCase_ == 2 && structuredPipelineBuilder_ != null) { + result.pipelineType_ = structuredPipelineBuilder_.build(); + } + result.consistencySelectorCase_ = consistencySelectorCase_; + result.consistencySelector_ = this.consistencySelector_; + if (consistencySelectorCase_ == 6 && newTransactionBuilder_ != null) { + result.consistencySelector_ = newTransactionBuilder_.build(); + } + if (consistencySelectorCase_ == 7 && readTimeBuilder_ != null) { + result.consistencySelector_ = readTimeBuilder_.build(); + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.firestore.v1.ExecutePipelineRequest) { + return mergeFrom((com.google.firestore.v1.ExecutePipelineRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.firestore.v1.ExecutePipelineRequest other) { + if (other == com.google.firestore.v1.ExecutePipelineRequest.getDefaultInstance()) return this; + if (!other.getDatabase().isEmpty()) { + database_ = other.database_; + bitField0_ |= 0x00000001; + onChanged(); + } + switch (other.getPipelineTypeCase()) { + case STRUCTURED_PIPELINE: + { + mergeStructuredPipeline(other.getStructuredPipeline()); + break; + } + case PIPELINETYPE_NOT_SET: + { + break; + } + } + switch (other.getConsistencySelectorCase()) { + case TRANSACTION: + { + setTransaction(other.getTransaction()); + break; + } + case NEW_TRANSACTION: + { + mergeNewTransaction(other.getNewTransaction()); + break; + } + case READ_TIME: + { + mergeReadTime(other.getReadTime()); + break; + } + case CONSISTENCYSELECTOR_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + database_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + input.readMessage( + getStructuredPipelineFieldBuilder().getBuilder(), extensionRegistry); + pipelineTypeCase_ = 2; + break; + } // case 18 + case 42: + { + consistencySelector_ = input.readBytes(); + consistencySelectorCase_ = 5; + break; + } // case 42 + case 50: + { + input.readMessage(getNewTransactionFieldBuilder().getBuilder(), extensionRegistry); + consistencySelectorCase_ = 6; + break; + } // case 50 + case 58: + { + input.readMessage(getReadTimeFieldBuilder().getBuilder(), extensionRegistry); + consistencySelectorCase_ = 7; + break; + } // case 58 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int pipelineTypeCase_ = 0; + private java.lang.Object pipelineType_; + + public PipelineTypeCase getPipelineTypeCase() { + return PipelineTypeCase.forNumber(pipelineTypeCase_); + } + + public Builder clearPipelineType() { + pipelineTypeCase_ = 0; + pipelineType_ = null; + onChanged(); + return this; + } + + private int consistencySelectorCase_ = 0; + private java.lang.Object consistencySelector_; + + public ConsistencySelectorCase getConsistencySelectorCase() { + return ConsistencySelectorCase.forNumber(consistencySelectorCase_); + } + + public Builder clearConsistencySelector() { + consistencySelectorCase_ = 0; + consistencySelector_ = null; + onChanged(); + return this; + } + + private int bitField0_; + + private java.lang.Object database_ = ""; + /** + * + * + *
+     * Database identifier, in the form `projects/{project}/databases/{database}`.
+     * 
+ * + * string database = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The database. + */ + public java.lang.String getDatabase() { + java.lang.Object ref = database_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + database_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Database identifier, in the form `projects/{project}/databases/{database}`.
+     * 
+ * + * string database = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for database. + */ + public com.google.protobuf.ByteString getDatabaseBytes() { + java.lang.Object ref = database_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + database_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Database identifier, in the form `projects/{project}/databases/{database}`.
+     * 
+ * + * string database = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The database to set. + * @return This builder for chaining. + */ + public Builder setDatabase(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + database_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Database identifier, in the form `projects/{project}/databases/{database}`.
+     * 
+ * + * string database = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearDatabase() { + database_ = getDefaultInstance().getDatabase(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Database identifier, in the form `projects/{project}/databases/{database}`.
+     * 
+ * + * string database = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for database to set. + * @return This builder for chaining. + */ + public Builder setDatabaseBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + database_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.firestore.v1.StructuredPipeline, + com.google.firestore.v1.StructuredPipeline.Builder, + com.google.firestore.v1.StructuredPipelineOrBuilder> + structuredPipelineBuilder_; + /** + * + * + *
+     * A pipelined operation.
+     * 
+ * + * .google.firestore.v1.StructuredPipeline structured_pipeline = 2; + * + * @return Whether the structuredPipeline field is set. + */ + @java.lang.Override + public boolean hasStructuredPipeline() { + return pipelineTypeCase_ == 2; + } + /** + * + * + *
+     * A pipelined operation.
+     * 
+ * + * .google.firestore.v1.StructuredPipeline structured_pipeline = 2; + * + * @return The structuredPipeline. + */ + @java.lang.Override + public com.google.firestore.v1.StructuredPipeline getStructuredPipeline() { + if (structuredPipelineBuilder_ == null) { + if (pipelineTypeCase_ == 2) { + return (com.google.firestore.v1.StructuredPipeline) pipelineType_; + } + return com.google.firestore.v1.StructuredPipeline.getDefaultInstance(); + } else { + if (pipelineTypeCase_ == 2) { + return structuredPipelineBuilder_.getMessage(); + } + return com.google.firestore.v1.StructuredPipeline.getDefaultInstance(); + } + } + /** + * + * + *
+     * A pipelined operation.
+     * 
+ * + * .google.firestore.v1.StructuredPipeline structured_pipeline = 2; + */ + public Builder setStructuredPipeline(com.google.firestore.v1.StructuredPipeline value) { + if (structuredPipelineBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + pipelineType_ = value; + onChanged(); + } else { + structuredPipelineBuilder_.setMessage(value); + } + pipelineTypeCase_ = 2; + return this; + } + /** + * + * + *
+     * A pipelined operation.
+     * 
+ * + * .google.firestore.v1.StructuredPipeline structured_pipeline = 2; + */ + public Builder setStructuredPipeline( + com.google.firestore.v1.StructuredPipeline.Builder builderForValue) { + if (structuredPipelineBuilder_ == null) { + pipelineType_ = builderForValue.build(); + onChanged(); + } else { + structuredPipelineBuilder_.setMessage(builderForValue.build()); + } + pipelineTypeCase_ = 2; + return this; + } + /** + * + * + *
+     * A pipelined operation.
+     * 
+ * + * .google.firestore.v1.StructuredPipeline structured_pipeline = 2; + */ + public Builder mergeStructuredPipeline(com.google.firestore.v1.StructuredPipeline value) { + if (structuredPipelineBuilder_ == null) { + if (pipelineTypeCase_ == 2 + && pipelineType_ != com.google.firestore.v1.StructuredPipeline.getDefaultInstance()) { + pipelineType_ = + com.google.firestore.v1.StructuredPipeline.newBuilder( + (com.google.firestore.v1.StructuredPipeline) pipelineType_) + .mergeFrom(value) + .buildPartial(); + } else { + pipelineType_ = value; + } + onChanged(); + } else { + if (pipelineTypeCase_ == 2) { + structuredPipelineBuilder_.mergeFrom(value); + } else { + structuredPipelineBuilder_.setMessage(value); + } + } + pipelineTypeCase_ = 2; + return this; + } + /** + * + * + *
+     * A pipelined operation.
+     * 
+ * + * .google.firestore.v1.StructuredPipeline structured_pipeline = 2; + */ + public Builder clearStructuredPipeline() { + if (structuredPipelineBuilder_ == null) { + if (pipelineTypeCase_ == 2) { + pipelineTypeCase_ = 0; + pipelineType_ = null; + onChanged(); + } + } else { + if (pipelineTypeCase_ == 2) { + pipelineTypeCase_ = 0; + pipelineType_ = null; + } + structuredPipelineBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * A pipelined operation.
+     * 
+ * + * .google.firestore.v1.StructuredPipeline structured_pipeline = 2; + */ + public com.google.firestore.v1.StructuredPipeline.Builder getStructuredPipelineBuilder() { + return getStructuredPipelineFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * A pipelined operation.
+     * 
+ * + * .google.firestore.v1.StructuredPipeline structured_pipeline = 2; + */ + @java.lang.Override + public com.google.firestore.v1.StructuredPipelineOrBuilder getStructuredPipelineOrBuilder() { + if ((pipelineTypeCase_ == 2) && (structuredPipelineBuilder_ != null)) { + return structuredPipelineBuilder_.getMessageOrBuilder(); + } else { + if (pipelineTypeCase_ == 2) { + return (com.google.firestore.v1.StructuredPipeline) pipelineType_; + } + return com.google.firestore.v1.StructuredPipeline.getDefaultInstance(); + } + } + /** + * + * + *
+     * A pipelined operation.
+     * 
+ * + * .google.firestore.v1.StructuredPipeline structured_pipeline = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.firestore.v1.StructuredPipeline, + com.google.firestore.v1.StructuredPipeline.Builder, + com.google.firestore.v1.StructuredPipelineOrBuilder> + getStructuredPipelineFieldBuilder() { + if (structuredPipelineBuilder_ == null) { + if (!(pipelineTypeCase_ == 2)) { + pipelineType_ = com.google.firestore.v1.StructuredPipeline.getDefaultInstance(); + } + structuredPipelineBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.firestore.v1.StructuredPipeline, + com.google.firestore.v1.StructuredPipeline.Builder, + com.google.firestore.v1.StructuredPipelineOrBuilder>( + (com.google.firestore.v1.StructuredPipeline) pipelineType_, + getParentForChildren(), + isClean()); + pipelineType_ = null; + } + pipelineTypeCase_ = 2; + onChanged(); + return structuredPipelineBuilder_; + } + + /** + * + * + *
+     * Run the query within an already active transaction.
+     *
+     * The value here is the opaque transaction ID to execute the query in.
+     * 
+ * + * bytes transaction = 5; + * + * @return Whether the transaction field is set. + */ + public boolean hasTransaction() { + return consistencySelectorCase_ == 5; + } + /** + * + * + *
+     * Run the query within an already active transaction.
+     *
+     * The value here is the opaque transaction ID to execute the query in.
+     * 
+ * + * bytes transaction = 5; + * + * @return The transaction. + */ + public com.google.protobuf.ByteString getTransaction() { + if (consistencySelectorCase_ == 5) { + return (com.google.protobuf.ByteString) consistencySelector_; + } + return com.google.protobuf.ByteString.EMPTY; + } + /** + * + * + *
+     * Run the query within an already active transaction.
+     *
+     * The value here is the opaque transaction ID to execute the query in.
+     * 
+ * + * bytes transaction = 5; + * + * @param value The transaction to set. + * @return This builder for chaining. + */ + public Builder setTransaction(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + consistencySelectorCase_ = 5; + consistencySelector_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Run the query within an already active transaction.
+     *
+     * The value here is the opaque transaction ID to execute the query in.
+     * 
+ * + * bytes transaction = 5; + * + * @return This builder for chaining. + */ + public Builder clearTransaction() { + if (consistencySelectorCase_ == 5) { + consistencySelectorCase_ = 0; + consistencySelector_ = null; + onChanged(); + } + return this; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.firestore.v1.TransactionOptions, + com.google.firestore.v1.TransactionOptions.Builder, + com.google.firestore.v1.TransactionOptionsOrBuilder> + newTransactionBuilder_; + /** + * + * + *
+     * Execute the pipeline in a new transaction.
+     *
+     * The identifier of the newly created transaction will be returned in the
+     * first response on the stream. This defaults to a read-only transaction.
+     * 
+ * + * .google.firestore.v1.TransactionOptions new_transaction = 6; + * + * @return Whether the newTransaction field is set. + */ + @java.lang.Override + public boolean hasNewTransaction() { + return consistencySelectorCase_ == 6; + } + /** + * + * + *
+     * Execute the pipeline in a new transaction.
+     *
+     * The identifier of the newly created transaction will be returned in the
+     * first response on the stream. This defaults to a read-only transaction.
+     * 
+ * + * .google.firestore.v1.TransactionOptions new_transaction = 6; + * + * @return The newTransaction. + */ + @java.lang.Override + public com.google.firestore.v1.TransactionOptions getNewTransaction() { + if (newTransactionBuilder_ == null) { + if (consistencySelectorCase_ == 6) { + return (com.google.firestore.v1.TransactionOptions) consistencySelector_; + } + return com.google.firestore.v1.TransactionOptions.getDefaultInstance(); + } else { + if (consistencySelectorCase_ == 6) { + return newTransactionBuilder_.getMessage(); + } + return com.google.firestore.v1.TransactionOptions.getDefaultInstance(); + } + } + /** + * + * + *
+     * Execute the pipeline in a new transaction.
+     *
+     * The identifier of the newly created transaction will be returned in the
+     * first response on the stream. This defaults to a read-only transaction.
+     * 
+ * + * .google.firestore.v1.TransactionOptions new_transaction = 6; + */ + public Builder setNewTransaction(com.google.firestore.v1.TransactionOptions value) { + if (newTransactionBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + consistencySelector_ = value; + onChanged(); + } else { + newTransactionBuilder_.setMessage(value); + } + consistencySelectorCase_ = 6; + return this; + } + /** + * + * + *
+     * Execute the pipeline in a new transaction.
+     *
+     * The identifier of the newly created transaction will be returned in the
+     * first response on the stream. This defaults to a read-only transaction.
+     * 
+ * + * .google.firestore.v1.TransactionOptions new_transaction = 6; + */ + public Builder setNewTransaction( + com.google.firestore.v1.TransactionOptions.Builder builderForValue) { + if (newTransactionBuilder_ == null) { + consistencySelector_ = builderForValue.build(); + onChanged(); + } else { + newTransactionBuilder_.setMessage(builderForValue.build()); + } + consistencySelectorCase_ = 6; + return this; + } + /** + * + * + *
+     * Execute the pipeline in a new transaction.
+     *
+     * The identifier of the newly created transaction will be returned in the
+     * first response on the stream. This defaults to a read-only transaction.
+     * 
+ * + * .google.firestore.v1.TransactionOptions new_transaction = 6; + */ + public Builder mergeNewTransaction(com.google.firestore.v1.TransactionOptions value) { + if (newTransactionBuilder_ == null) { + if (consistencySelectorCase_ == 6 + && consistencySelector_ + != com.google.firestore.v1.TransactionOptions.getDefaultInstance()) { + consistencySelector_ = + com.google.firestore.v1.TransactionOptions.newBuilder( + (com.google.firestore.v1.TransactionOptions) consistencySelector_) + .mergeFrom(value) + .buildPartial(); + } else { + consistencySelector_ = value; + } + onChanged(); + } else { + if (consistencySelectorCase_ == 6) { + newTransactionBuilder_.mergeFrom(value); + } else { + newTransactionBuilder_.setMessage(value); + } + } + consistencySelectorCase_ = 6; + return this; + } + /** + * + * + *
+     * Execute the pipeline in a new transaction.
+     *
+     * The identifier of the newly created transaction will be returned in the
+     * first response on the stream. This defaults to a read-only transaction.
+     * 
+ * + * .google.firestore.v1.TransactionOptions new_transaction = 6; + */ + public Builder clearNewTransaction() { + if (newTransactionBuilder_ == null) { + if (consistencySelectorCase_ == 6) { + consistencySelectorCase_ = 0; + consistencySelector_ = null; + onChanged(); + } + } else { + if (consistencySelectorCase_ == 6) { + consistencySelectorCase_ = 0; + consistencySelector_ = null; + } + newTransactionBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Execute the pipeline in a new transaction.
+     *
+     * The identifier of the newly created transaction will be returned in the
+     * first response on the stream. This defaults to a read-only transaction.
+     * 
+ * + * .google.firestore.v1.TransactionOptions new_transaction = 6; + */ + public com.google.firestore.v1.TransactionOptions.Builder getNewTransactionBuilder() { + return getNewTransactionFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Execute the pipeline in a new transaction.
+     *
+     * The identifier of the newly created transaction will be returned in the
+     * first response on the stream. This defaults to a read-only transaction.
+     * 
+ * + * .google.firestore.v1.TransactionOptions new_transaction = 6; + */ + @java.lang.Override + public com.google.firestore.v1.TransactionOptionsOrBuilder getNewTransactionOrBuilder() { + if ((consistencySelectorCase_ == 6) && (newTransactionBuilder_ != null)) { + return newTransactionBuilder_.getMessageOrBuilder(); + } else { + if (consistencySelectorCase_ == 6) { + return (com.google.firestore.v1.TransactionOptions) consistencySelector_; + } + return com.google.firestore.v1.TransactionOptions.getDefaultInstance(); + } + } + /** + * + * + *
+     * Execute the pipeline in a new transaction.
+     *
+     * The identifier of the newly created transaction will be returned in the
+     * first response on the stream. This defaults to a read-only transaction.
+     * 
+ * + * .google.firestore.v1.TransactionOptions new_transaction = 6; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.firestore.v1.TransactionOptions, + com.google.firestore.v1.TransactionOptions.Builder, + com.google.firestore.v1.TransactionOptionsOrBuilder> + getNewTransactionFieldBuilder() { + if (newTransactionBuilder_ == null) { + if (!(consistencySelectorCase_ == 6)) { + consistencySelector_ = com.google.firestore.v1.TransactionOptions.getDefaultInstance(); + } + newTransactionBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.firestore.v1.TransactionOptions, + com.google.firestore.v1.TransactionOptions.Builder, + com.google.firestore.v1.TransactionOptionsOrBuilder>( + (com.google.firestore.v1.TransactionOptions) consistencySelector_, + getParentForChildren(), + isClean()); + consistencySelector_ = null; + } + consistencySelectorCase_ = 6; + onChanged(); + return newTransactionBuilder_; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + readTimeBuilder_; + /** + * + * + *
+     * Execute the pipeline in a snapshot transaction at the given time.
+     *
+     * This must be a microsecond precision timestamp within the past one hour,
+     * or if Point-in-Time Recovery is enabled, can additionally be a whole
+     * minute timestamp within the past 7 days.
+     * 
+ * + * .google.protobuf.Timestamp read_time = 7; + * + * @return Whether the readTime field is set. + */ + @java.lang.Override + public boolean hasReadTime() { + return consistencySelectorCase_ == 7; + } + /** + * + * + *
+     * Execute the pipeline in a snapshot transaction at the given time.
+     *
+     * This must be a microsecond precision timestamp within the past one hour,
+     * or if Point-in-Time Recovery is enabled, can additionally be a whole
+     * minute timestamp within the past 7 days.
+     * 
+ * + * .google.protobuf.Timestamp read_time = 7; + * + * @return The readTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getReadTime() { + if (readTimeBuilder_ == null) { + if (consistencySelectorCase_ == 7) { + return (com.google.protobuf.Timestamp) consistencySelector_; + } + return com.google.protobuf.Timestamp.getDefaultInstance(); + } else { + if (consistencySelectorCase_ == 7) { + return readTimeBuilder_.getMessage(); + } + return com.google.protobuf.Timestamp.getDefaultInstance(); + } + } + /** + * + * + *
+     * Execute the pipeline in a snapshot transaction at the given time.
+     *
+     * This must be a microsecond precision timestamp within the past one hour,
+     * or if Point-in-Time Recovery is enabled, can additionally be a whole
+     * minute timestamp within the past 7 days.
+     * 
+ * + * .google.protobuf.Timestamp read_time = 7; + */ + public Builder setReadTime(com.google.protobuf.Timestamp value) { + if (readTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + consistencySelector_ = value; + onChanged(); + } else { + readTimeBuilder_.setMessage(value); + } + consistencySelectorCase_ = 7; + return this; + } + /** + * + * + *
+     * Execute the pipeline in a snapshot transaction at the given time.
+     *
+     * This must be a microsecond precision timestamp within the past one hour,
+     * or if Point-in-Time Recovery is enabled, can additionally be a whole
+     * minute timestamp within the past 7 days.
+     * 
+ * + * .google.protobuf.Timestamp read_time = 7; + */ + public Builder setReadTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (readTimeBuilder_ == null) { + consistencySelector_ = builderForValue.build(); + onChanged(); + } else { + readTimeBuilder_.setMessage(builderForValue.build()); + } + consistencySelectorCase_ = 7; + return this; + } + /** + * + * + *
+     * Execute the pipeline in a snapshot transaction at the given time.
+     *
+     * This must be a microsecond precision timestamp within the past one hour,
+     * or if Point-in-Time Recovery is enabled, can additionally be a whole
+     * minute timestamp within the past 7 days.
+     * 
+ * + * .google.protobuf.Timestamp read_time = 7; + */ + public Builder mergeReadTime(com.google.protobuf.Timestamp value) { + if (readTimeBuilder_ == null) { + if (consistencySelectorCase_ == 7 + && consistencySelector_ != com.google.protobuf.Timestamp.getDefaultInstance()) { + consistencySelector_ = + com.google.protobuf.Timestamp.newBuilder( + (com.google.protobuf.Timestamp) consistencySelector_) + .mergeFrom(value) + .buildPartial(); + } else { + consistencySelector_ = value; + } + onChanged(); + } else { + if (consistencySelectorCase_ == 7) { + readTimeBuilder_.mergeFrom(value); + } else { + readTimeBuilder_.setMessage(value); + } + } + consistencySelectorCase_ = 7; + return this; + } + /** + * + * + *
+     * Execute the pipeline in a snapshot transaction at the given time.
+     *
+     * This must be a microsecond precision timestamp within the past one hour,
+     * or if Point-in-Time Recovery is enabled, can additionally be a whole
+     * minute timestamp within the past 7 days.
+     * 
+ * + * .google.protobuf.Timestamp read_time = 7; + */ + public Builder clearReadTime() { + if (readTimeBuilder_ == null) { + if (consistencySelectorCase_ == 7) { + consistencySelectorCase_ = 0; + consistencySelector_ = null; + onChanged(); + } + } else { + if (consistencySelectorCase_ == 7) { + consistencySelectorCase_ = 0; + consistencySelector_ = null; + } + readTimeBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Execute the pipeline in a snapshot transaction at the given time.
+     *
+     * This must be a microsecond precision timestamp within the past one hour,
+     * or if Point-in-Time Recovery is enabled, can additionally be a whole
+     * minute timestamp within the past 7 days.
+     * 
+ * + * .google.protobuf.Timestamp read_time = 7; + */ + public com.google.protobuf.Timestamp.Builder getReadTimeBuilder() { + return getReadTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Execute the pipeline in a snapshot transaction at the given time.
+     *
+     * This must be a microsecond precision timestamp within the past one hour,
+     * or if Point-in-Time Recovery is enabled, can additionally be a whole
+     * minute timestamp within the past 7 days.
+     * 
+ * + * .google.protobuf.Timestamp read_time = 7; + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getReadTimeOrBuilder() { + if ((consistencySelectorCase_ == 7) && (readTimeBuilder_ != null)) { + return readTimeBuilder_.getMessageOrBuilder(); + } else { + if (consistencySelectorCase_ == 7) { + return (com.google.protobuf.Timestamp) consistencySelector_; + } + return com.google.protobuf.Timestamp.getDefaultInstance(); + } + } + /** + * + * + *
+     * Execute the pipeline in a snapshot transaction at the given time.
+     *
+     * This must be a microsecond precision timestamp within the past one hour,
+     * or if Point-in-Time Recovery is enabled, can additionally be a whole
+     * minute timestamp within the past 7 days.
+     * 
+ * + * .google.protobuf.Timestamp read_time = 7; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getReadTimeFieldBuilder() { + if (readTimeBuilder_ == null) { + if (!(consistencySelectorCase_ == 7)) { + consistencySelector_ = com.google.protobuf.Timestamp.getDefaultInstance(); + } + readTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + (com.google.protobuf.Timestamp) consistencySelector_, + getParentForChildren(), + isClean()); + consistencySelector_ = null; + } + consistencySelectorCase_ = 7; + onChanged(); + return readTimeBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.firestore.v1.ExecutePipelineRequest) + } + + // @@protoc_insertion_point(class_scope:google.firestore.v1.ExecutePipelineRequest) + private static final com.google.firestore.v1.ExecutePipelineRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.firestore.v1.ExecutePipelineRequest(); + } + + public static com.google.firestore.v1.ExecutePipelineRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ExecutePipelineRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.firestore.v1.ExecutePipelineRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/ExecutePipelineRequestOrBuilder.java b/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/ExecutePipelineRequestOrBuilder.java new file mode 100644 index 000000000..95a65826b --- /dev/null +++ b/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/ExecutePipelineRequestOrBuilder.java @@ -0,0 +1,211 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/firestore/v1/firestore.proto + +// Protobuf Java Version: 3.25.2 +package com.google.firestore.v1; + +public interface ExecutePipelineRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.firestore.v1.ExecutePipelineRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Database identifier, in the form `projects/{project}/databases/{database}`.
+   * 
+ * + * string database = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The database. + */ + java.lang.String getDatabase(); + /** + * + * + *
+   * Database identifier, in the form `projects/{project}/databases/{database}`.
+   * 
+ * + * string database = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for database. + */ + com.google.protobuf.ByteString getDatabaseBytes(); + + /** + * + * + *
+   * A pipelined operation.
+   * 
+ * + * .google.firestore.v1.StructuredPipeline structured_pipeline = 2; + * + * @return Whether the structuredPipeline field is set. + */ + boolean hasStructuredPipeline(); + /** + * + * + *
+   * A pipelined operation.
+   * 
+ * + * .google.firestore.v1.StructuredPipeline structured_pipeline = 2; + * + * @return The structuredPipeline. + */ + com.google.firestore.v1.StructuredPipeline getStructuredPipeline(); + /** + * + * + *
+   * A pipelined operation.
+   * 
+ * + * .google.firestore.v1.StructuredPipeline structured_pipeline = 2; + */ + com.google.firestore.v1.StructuredPipelineOrBuilder getStructuredPipelineOrBuilder(); + + /** + * + * + *
+   * Run the query within an already active transaction.
+   *
+   * The value here is the opaque transaction ID to execute the query in.
+   * 
+ * + * bytes transaction = 5; + * + * @return Whether the transaction field is set. + */ + boolean hasTransaction(); + /** + * + * + *
+   * Run the query within an already active transaction.
+   *
+   * The value here is the opaque transaction ID to execute the query in.
+   * 
+ * + * bytes transaction = 5; + * + * @return The transaction. + */ + com.google.protobuf.ByteString getTransaction(); + + /** + * + * + *
+   * Execute the pipeline in a new transaction.
+   *
+   * The identifier of the newly created transaction will be returned in the
+   * first response on the stream. This defaults to a read-only transaction.
+   * 
+ * + * .google.firestore.v1.TransactionOptions new_transaction = 6; + * + * @return Whether the newTransaction field is set. + */ + boolean hasNewTransaction(); + /** + * + * + *
+   * Execute the pipeline in a new transaction.
+   *
+   * The identifier of the newly created transaction will be returned in the
+   * first response on the stream. This defaults to a read-only transaction.
+   * 
+ * + * .google.firestore.v1.TransactionOptions new_transaction = 6; + * + * @return The newTransaction. + */ + com.google.firestore.v1.TransactionOptions getNewTransaction(); + /** + * + * + *
+   * Execute the pipeline in a new transaction.
+   *
+   * The identifier of the newly created transaction will be returned in the
+   * first response on the stream. This defaults to a read-only transaction.
+   * 
+ * + * .google.firestore.v1.TransactionOptions new_transaction = 6; + */ + com.google.firestore.v1.TransactionOptionsOrBuilder getNewTransactionOrBuilder(); + + /** + * + * + *
+   * Execute the pipeline in a snapshot transaction at the given time.
+   *
+   * This must be a microsecond precision timestamp within the past one hour,
+   * or if Point-in-Time Recovery is enabled, can additionally be a whole
+   * minute timestamp within the past 7 days.
+   * 
+ * + * .google.protobuf.Timestamp read_time = 7; + * + * @return Whether the readTime field is set. + */ + boolean hasReadTime(); + /** + * + * + *
+   * Execute the pipeline in a snapshot transaction at the given time.
+   *
+   * This must be a microsecond precision timestamp within the past one hour,
+   * or if Point-in-Time Recovery is enabled, can additionally be a whole
+   * minute timestamp within the past 7 days.
+   * 
+ * + * .google.protobuf.Timestamp read_time = 7; + * + * @return The readTime. + */ + com.google.protobuf.Timestamp getReadTime(); + /** + * + * + *
+   * Execute the pipeline in a snapshot transaction at the given time.
+   *
+   * This must be a microsecond precision timestamp within the past one hour,
+   * or if Point-in-Time Recovery is enabled, can additionally be a whole
+   * minute timestamp within the past 7 days.
+   * 
+ * + * .google.protobuf.Timestamp read_time = 7; + */ + com.google.protobuf.TimestampOrBuilder getReadTimeOrBuilder(); + + com.google.firestore.v1.ExecutePipelineRequest.PipelineTypeCase getPipelineTypeCase(); + + com.google.firestore.v1.ExecutePipelineRequest.ConsistencySelectorCase + getConsistencySelectorCase(); +} diff --git a/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/ExecutePipelineResponse.java b/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/ExecutePipelineResponse.java new file mode 100644 index 000000000..a8408e14e --- /dev/null +++ b/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/ExecutePipelineResponse.java @@ -0,0 +1,1647 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/firestore/v1/firestore.proto + +// Protobuf Java Version: 3.25.2 +package com.google.firestore.v1; + +/** + * + * + *
+ * The response for [Firestore.Execute][].
+ * 
+ * + * Protobuf type {@code google.firestore.v1.ExecutePipelineResponse} + */ +public final class ExecutePipelineResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.firestore.v1.ExecutePipelineResponse) + ExecutePipelineResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use ExecutePipelineResponse.newBuilder() to construct. + private ExecutePipelineResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ExecutePipelineResponse() { + transaction_ = com.google.protobuf.ByteString.EMPTY; + results_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ExecutePipelineResponse(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.firestore.v1.FirestoreProto + .internal_static_google_firestore_v1_ExecutePipelineResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.firestore.v1.FirestoreProto + .internal_static_google_firestore_v1_ExecutePipelineResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.firestore.v1.ExecutePipelineResponse.class, + com.google.firestore.v1.ExecutePipelineResponse.Builder.class); + } + + private int bitField0_; + public static final int TRANSACTION_FIELD_NUMBER = 1; + private com.google.protobuf.ByteString transaction_ = com.google.protobuf.ByteString.EMPTY; + /** + * + * + *
+   * Newly created transaction identifier.
+   *
+   * This field is only specified on the first response from the server when
+   * the request specified [ExecuteRequest.new_transaction][].
+   * 
+ * + * bytes transaction = 1; + * + * @return The transaction. + */ + @java.lang.Override + public com.google.protobuf.ByteString getTransaction() { + return transaction_; + } + + public static final int RESULTS_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private java.util.List results_; + /** + * + * + *
+   * An ordered batch of results returned executing a pipeline.
+   *
+   * The batch size is variable, and can even be zero for when only a partial
+   * progress message is returned.
+   *
+   * The fields present in the returned documents are only those that were
+   * explicitly requested in the pipeline, this include those like
+   * [`__name__`][Document.name] & [`__update_time__`][Document.update_time].
+   * This is explicitly a divergence from `Firestore.RunQuery` /
+   * `Firestore.GetDocument` RPCs which always return such fields even when they
+   * are not specified in the [`mask`][DocumentMask].
+   * 
+ * + * repeated .google.firestore.v1.Document results = 2; + */ + @java.lang.Override + public java.util.List getResultsList() { + return results_; + } + /** + * + * + *
+   * An ordered batch of results returned executing a pipeline.
+   *
+   * The batch size is variable, and can even be zero for when only a partial
+   * progress message is returned.
+   *
+   * The fields present in the returned documents are only those that were
+   * explicitly requested in the pipeline, this include those like
+   * [`__name__`][Document.name] & [`__update_time__`][Document.update_time].
+   * This is explicitly a divergence from `Firestore.RunQuery` /
+   * `Firestore.GetDocument` RPCs which always return such fields even when they
+   * are not specified in the [`mask`][DocumentMask].
+   * 
+ * + * repeated .google.firestore.v1.Document results = 2; + */ + @java.lang.Override + public java.util.List + getResultsOrBuilderList() { + return results_; + } + /** + * + * + *
+   * An ordered batch of results returned executing a pipeline.
+   *
+   * The batch size is variable, and can even be zero for when only a partial
+   * progress message is returned.
+   *
+   * The fields present in the returned documents are only those that were
+   * explicitly requested in the pipeline, this include those like
+   * [`__name__`][Document.name] & [`__update_time__`][Document.update_time].
+   * This is explicitly a divergence from `Firestore.RunQuery` /
+   * `Firestore.GetDocument` RPCs which always return such fields even when they
+   * are not specified in the [`mask`][DocumentMask].
+   * 
+ * + * repeated .google.firestore.v1.Document results = 2; + */ + @java.lang.Override + public int getResultsCount() { + return results_.size(); + } + /** + * + * + *
+   * An ordered batch of results returned executing a pipeline.
+   *
+   * The batch size is variable, and can even be zero for when only a partial
+   * progress message is returned.
+   *
+   * The fields present in the returned documents are only those that were
+   * explicitly requested in the pipeline, this include those like
+   * [`__name__`][Document.name] & [`__update_time__`][Document.update_time].
+   * This is explicitly a divergence from `Firestore.RunQuery` /
+   * `Firestore.GetDocument` RPCs which always return such fields even when they
+   * are not specified in the [`mask`][DocumentMask].
+   * 
+ * + * repeated .google.firestore.v1.Document results = 2; + */ + @java.lang.Override + public com.google.firestore.v1.Document getResults(int index) { + return results_.get(index); + } + /** + * + * + *
+   * An ordered batch of results returned executing a pipeline.
+   *
+   * The batch size is variable, and can even be zero for when only a partial
+   * progress message is returned.
+   *
+   * The fields present in the returned documents are only those that were
+   * explicitly requested in the pipeline, this include those like
+   * [`__name__`][Document.name] & [`__update_time__`][Document.update_time].
+   * This is explicitly a divergence from `Firestore.RunQuery` /
+   * `Firestore.GetDocument` RPCs which always return such fields even when they
+   * are not specified in the [`mask`][DocumentMask].
+   * 
+ * + * repeated .google.firestore.v1.Document results = 2; + */ + @java.lang.Override + public com.google.firestore.v1.DocumentOrBuilder getResultsOrBuilder(int index) { + return results_.get(index); + } + + public static final int EXECUTION_TIME_FIELD_NUMBER = 3; + private com.google.protobuf.Timestamp executionTime_; + /** + * + * + *
+   * The time at which the document(s) were read.
+   *
+   * This may be monotonically increasing; in this case, the previous documents
+   * in the result stream are guaranteed not to have changed between their
+   * `execution_time` and this one.
+   *
+   * If the query returns no results, a response with `execution_time` and no
+   * `results` will be sent, and this represents the time at which the operation
+   * was run.
+   * 
+ * + * .google.protobuf.Timestamp execution_time = 3; + * + * @return Whether the executionTime field is set. + */ + @java.lang.Override + public boolean hasExecutionTime() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+   * The time at which the document(s) were read.
+   *
+   * This may be monotonically increasing; in this case, the previous documents
+   * in the result stream are guaranteed not to have changed between their
+   * `execution_time` and this one.
+   *
+   * If the query returns no results, a response with `execution_time` and no
+   * `results` will be sent, and this represents the time at which the operation
+   * was run.
+   * 
+ * + * .google.protobuf.Timestamp execution_time = 3; + * + * @return The executionTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getExecutionTime() { + return executionTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : executionTime_; + } + /** + * + * + *
+   * The time at which the document(s) were read.
+   *
+   * This may be monotonically increasing; in this case, the previous documents
+   * in the result stream are guaranteed not to have changed between their
+   * `execution_time` and this one.
+   *
+   * If the query returns no results, a response with `execution_time` and no
+   * `results` will be sent, and this represents the time at which the operation
+   * was run.
+   * 
+ * + * .google.protobuf.Timestamp execution_time = 3; + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getExecutionTimeOrBuilder() { + return executionTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : executionTime_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!transaction_.isEmpty()) { + output.writeBytes(1, transaction_); + } + for (int i = 0; i < results_.size(); i++) { + output.writeMessage(2, results_.get(i)); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(3, getExecutionTime()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!transaction_.isEmpty()) { + size += com.google.protobuf.CodedOutputStream.computeBytesSize(1, transaction_); + } + for (int i = 0; i < results_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, results_.get(i)); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getExecutionTime()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.firestore.v1.ExecutePipelineResponse)) { + return super.equals(obj); + } + com.google.firestore.v1.ExecutePipelineResponse other = + (com.google.firestore.v1.ExecutePipelineResponse) obj; + + if (!getTransaction().equals(other.getTransaction())) return false; + if (!getResultsList().equals(other.getResultsList())) return false; + if (hasExecutionTime() != other.hasExecutionTime()) return false; + if (hasExecutionTime()) { + if (!getExecutionTime().equals(other.getExecutionTime())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + TRANSACTION_FIELD_NUMBER; + hash = (53 * hash) + getTransaction().hashCode(); + if (getResultsCount() > 0) { + hash = (37 * hash) + RESULTS_FIELD_NUMBER; + hash = (53 * hash) + getResultsList().hashCode(); + } + if (hasExecutionTime()) { + hash = (37 * hash) + EXECUTION_TIME_FIELD_NUMBER; + hash = (53 * hash) + getExecutionTime().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.firestore.v1.ExecutePipelineResponse parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.firestore.v1.ExecutePipelineResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.firestore.v1.ExecutePipelineResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.firestore.v1.ExecutePipelineResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.firestore.v1.ExecutePipelineResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.firestore.v1.ExecutePipelineResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.firestore.v1.ExecutePipelineResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.firestore.v1.ExecutePipelineResponse parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.firestore.v1.ExecutePipelineResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.firestore.v1.ExecutePipelineResponse parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.firestore.v1.ExecutePipelineResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.firestore.v1.ExecutePipelineResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.firestore.v1.ExecutePipelineResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * The response for [Firestore.Execute][].
+   * 
+ * + * Protobuf type {@code google.firestore.v1.ExecutePipelineResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.firestore.v1.ExecutePipelineResponse) + com.google.firestore.v1.ExecutePipelineResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.firestore.v1.FirestoreProto + .internal_static_google_firestore_v1_ExecutePipelineResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.firestore.v1.FirestoreProto + .internal_static_google_firestore_v1_ExecutePipelineResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.firestore.v1.ExecutePipelineResponse.class, + com.google.firestore.v1.ExecutePipelineResponse.Builder.class); + } + + // Construct using com.google.firestore.v1.ExecutePipelineResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getResultsFieldBuilder(); + getExecutionTimeFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + transaction_ = com.google.protobuf.ByteString.EMPTY; + if (resultsBuilder_ == null) { + results_ = java.util.Collections.emptyList(); + } else { + results_ = null; + resultsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + executionTime_ = null; + if (executionTimeBuilder_ != null) { + executionTimeBuilder_.dispose(); + executionTimeBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.firestore.v1.FirestoreProto + .internal_static_google_firestore_v1_ExecutePipelineResponse_descriptor; + } + + @java.lang.Override + public com.google.firestore.v1.ExecutePipelineResponse getDefaultInstanceForType() { + return com.google.firestore.v1.ExecutePipelineResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.firestore.v1.ExecutePipelineResponse build() { + com.google.firestore.v1.ExecutePipelineResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.firestore.v1.ExecutePipelineResponse buildPartial() { + com.google.firestore.v1.ExecutePipelineResponse result = + new com.google.firestore.v1.ExecutePipelineResponse(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields( + com.google.firestore.v1.ExecutePipelineResponse result) { + if (resultsBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0)) { + results_ = java.util.Collections.unmodifiableList(results_); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.results_ = results_; + } else { + result.results_ = resultsBuilder_.build(); + } + } + + private void buildPartial0(com.google.firestore.v1.ExecutePipelineResponse result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.transaction_ = transaction_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000004) != 0)) { + result.executionTime_ = + executionTimeBuilder_ == null ? executionTime_ : executionTimeBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.firestore.v1.ExecutePipelineResponse) { + return mergeFrom((com.google.firestore.v1.ExecutePipelineResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.firestore.v1.ExecutePipelineResponse other) { + if (other == com.google.firestore.v1.ExecutePipelineResponse.getDefaultInstance()) + return this; + if (other.getTransaction() != com.google.protobuf.ByteString.EMPTY) { + setTransaction(other.getTransaction()); + } + if (resultsBuilder_ == null) { + if (!other.results_.isEmpty()) { + if (results_.isEmpty()) { + results_ = other.results_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureResultsIsMutable(); + results_.addAll(other.results_); + } + onChanged(); + } + } else { + if (!other.results_.isEmpty()) { + if (resultsBuilder_.isEmpty()) { + resultsBuilder_.dispose(); + resultsBuilder_ = null; + results_ = other.results_; + bitField0_ = (bitField0_ & ~0x00000002); + resultsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getResultsFieldBuilder() + : null; + } else { + resultsBuilder_.addAllMessages(other.results_); + } + } + } + if (other.hasExecutionTime()) { + mergeExecutionTime(other.getExecutionTime()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + transaction_ = input.readBytes(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + com.google.firestore.v1.Document m = + input.readMessage(com.google.firestore.v1.Document.parser(), extensionRegistry); + if (resultsBuilder_ == null) { + ensureResultsIsMutable(); + results_.add(m); + } else { + resultsBuilder_.addMessage(m); + } + break; + } // case 18 + case 26: + { + input.readMessage(getExecutionTimeFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private com.google.protobuf.ByteString transaction_ = com.google.protobuf.ByteString.EMPTY; + /** + * + * + *
+     * Newly created transaction identifier.
+     *
+     * This field is only specified on the first response from the server when
+     * the request specified [ExecuteRequest.new_transaction][].
+     * 
+ * + * bytes transaction = 1; + * + * @return The transaction. + */ + @java.lang.Override + public com.google.protobuf.ByteString getTransaction() { + return transaction_; + } + /** + * + * + *
+     * Newly created transaction identifier.
+     *
+     * This field is only specified on the first response from the server when
+     * the request specified [ExecuteRequest.new_transaction][].
+     * 
+ * + * bytes transaction = 1; + * + * @param value The transaction to set. + * @return This builder for chaining. + */ + public Builder setTransaction(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + transaction_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Newly created transaction identifier.
+     *
+     * This field is only specified on the first response from the server when
+     * the request specified [ExecuteRequest.new_transaction][].
+     * 
+ * + * bytes transaction = 1; + * + * @return This builder for chaining. + */ + public Builder clearTransaction() { + bitField0_ = (bitField0_ & ~0x00000001); + transaction_ = getDefaultInstance().getTransaction(); + onChanged(); + return this; + } + + private java.util.List results_ = + java.util.Collections.emptyList(); + + private void ensureResultsIsMutable() { + if (!((bitField0_ & 0x00000002) != 0)) { + results_ = new java.util.ArrayList(results_); + bitField0_ |= 0x00000002; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.firestore.v1.Document, + com.google.firestore.v1.Document.Builder, + com.google.firestore.v1.DocumentOrBuilder> + resultsBuilder_; + + /** + * + * + *
+     * An ordered batch of results returned executing a pipeline.
+     *
+     * The batch size is variable, and can even be zero for when only a partial
+     * progress message is returned.
+     *
+     * The fields present in the returned documents are only those that were
+     * explicitly requested in the pipeline, this include those like
+     * [`__name__`][Document.name] & [`__update_time__`][Document.update_time].
+     * This is explicitly a divergence from `Firestore.RunQuery` /
+     * `Firestore.GetDocument` RPCs which always return such fields even when they
+     * are not specified in the [`mask`][DocumentMask].
+     * 
+ * + * repeated .google.firestore.v1.Document results = 2; + */ + public java.util.List getResultsList() { + if (resultsBuilder_ == null) { + return java.util.Collections.unmodifiableList(results_); + } else { + return resultsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * An ordered batch of results returned executing a pipeline.
+     *
+     * The batch size is variable, and can even be zero for when only a partial
+     * progress message is returned.
+     *
+     * The fields present in the returned documents are only those that were
+     * explicitly requested in the pipeline, this include those like
+     * [`__name__`][Document.name] & [`__update_time__`][Document.update_time].
+     * This is explicitly a divergence from `Firestore.RunQuery` /
+     * `Firestore.GetDocument` RPCs which always return such fields even when they
+     * are not specified in the [`mask`][DocumentMask].
+     * 
+ * + * repeated .google.firestore.v1.Document results = 2; + */ + public int getResultsCount() { + if (resultsBuilder_ == null) { + return results_.size(); + } else { + return resultsBuilder_.getCount(); + } + } + /** + * + * + *
+     * An ordered batch of results returned executing a pipeline.
+     *
+     * The batch size is variable, and can even be zero for when only a partial
+     * progress message is returned.
+     *
+     * The fields present in the returned documents are only those that were
+     * explicitly requested in the pipeline, this include those like
+     * [`__name__`][Document.name] & [`__update_time__`][Document.update_time].
+     * This is explicitly a divergence from `Firestore.RunQuery` /
+     * `Firestore.GetDocument` RPCs which always return such fields even when they
+     * are not specified in the [`mask`][DocumentMask].
+     * 
+ * + * repeated .google.firestore.v1.Document results = 2; + */ + public com.google.firestore.v1.Document getResults(int index) { + if (resultsBuilder_ == null) { + return results_.get(index); + } else { + return resultsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * An ordered batch of results returned executing a pipeline.
+     *
+     * The batch size is variable, and can even be zero for when only a partial
+     * progress message is returned.
+     *
+     * The fields present in the returned documents are only those that were
+     * explicitly requested in the pipeline, this include those like
+     * [`__name__`][Document.name] & [`__update_time__`][Document.update_time].
+     * This is explicitly a divergence from `Firestore.RunQuery` /
+     * `Firestore.GetDocument` RPCs which always return such fields even when they
+     * are not specified in the [`mask`][DocumentMask].
+     * 
+ * + * repeated .google.firestore.v1.Document results = 2; + */ + public Builder setResults(int index, com.google.firestore.v1.Document value) { + if (resultsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureResultsIsMutable(); + results_.set(index, value); + onChanged(); + } else { + resultsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * An ordered batch of results returned executing a pipeline.
+     *
+     * The batch size is variable, and can even be zero for when only a partial
+     * progress message is returned.
+     *
+     * The fields present in the returned documents are only those that were
+     * explicitly requested in the pipeline, this include those like
+     * [`__name__`][Document.name] & [`__update_time__`][Document.update_time].
+     * This is explicitly a divergence from `Firestore.RunQuery` /
+     * `Firestore.GetDocument` RPCs which always return such fields even when they
+     * are not specified in the [`mask`][DocumentMask].
+     * 
+ * + * repeated .google.firestore.v1.Document results = 2; + */ + public Builder setResults(int index, com.google.firestore.v1.Document.Builder builderForValue) { + if (resultsBuilder_ == null) { + ensureResultsIsMutable(); + results_.set(index, builderForValue.build()); + onChanged(); + } else { + resultsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * An ordered batch of results returned executing a pipeline.
+     *
+     * The batch size is variable, and can even be zero for when only a partial
+     * progress message is returned.
+     *
+     * The fields present in the returned documents are only those that were
+     * explicitly requested in the pipeline, this include those like
+     * [`__name__`][Document.name] & [`__update_time__`][Document.update_time].
+     * This is explicitly a divergence from `Firestore.RunQuery` /
+     * `Firestore.GetDocument` RPCs which always return such fields even when they
+     * are not specified in the [`mask`][DocumentMask].
+     * 
+ * + * repeated .google.firestore.v1.Document results = 2; + */ + public Builder addResults(com.google.firestore.v1.Document value) { + if (resultsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureResultsIsMutable(); + results_.add(value); + onChanged(); + } else { + resultsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * An ordered batch of results returned executing a pipeline.
+     *
+     * The batch size is variable, and can even be zero for when only a partial
+     * progress message is returned.
+     *
+     * The fields present in the returned documents are only those that were
+     * explicitly requested in the pipeline, this include those like
+     * [`__name__`][Document.name] & [`__update_time__`][Document.update_time].
+     * This is explicitly a divergence from `Firestore.RunQuery` /
+     * `Firestore.GetDocument` RPCs which always return such fields even when they
+     * are not specified in the [`mask`][DocumentMask].
+     * 
+ * + * repeated .google.firestore.v1.Document results = 2; + */ + public Builder addResults(int index, com.google.firestore.v1.Document value) { + if (resultsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureResultsIsMutable(); + results_.add(index, value); + onChanged(); + } else { + resultsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * An ordered batch of results returned executing a pipeline.
+     *
+     * The batch size is variable, and can even be zero for when only a partial
+     * progress message is returned.
+     *
+     * The fields present in the returned documents are only those that were
+     * explicitly requested in the pipeline, this include those like
+     * [`__name__`][Document.name] & [`__update_time__`][Document.update_time].
+     * This is explicitly a divergence from `Firestore.RunQuery` /
+     * `Firestore.GetDocument` RPCs which always return such fields even when they
+     * are not specified in the [`mask`][DocumentMask].
+     * 
+ * + * repeated .google.firestore.v1.Document results = 2; + */ + public Builder addResults(com.google.firestore.v1.Document.Builder builderForValue) { + if (resultsBuilder_ == null) { + ensureResultsIsMutable(); + results_.add(builderForValue.build()); + onChanged(); + } else { + resultsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * An ordered batch of results returned executing a pipeline.
+     *
+     * The batch size is variable, and can even be zero for when only a partial
+     * progress message is returned.
+     *
+     * The fields present in the returned documents are only those that were
+     * explicitly requested in the pipeline, this include those like
+     * [`__name__`][Document.name] & [`__update_time__`][Document.update_time].
+     * This is explicitly a divergence from `Firestore.RunQuery` /
+     * `Firestore.GetDocument` RPCs which always return such fields even when they
+     * are not specified in the [`mask`][DocumentMask].
+     * 
+ * + * repeated .google.firestore.v1.Document results = 2; + */ + public Builder addResults(int index, com.google.firestore.v1.Document.Builder builderForValue) { + if (resultsBuilder_ == null) { + ensureResultsIsMutable(); + results_.add(index, builderForValue.build()); + onChanged(); + } else { + resultsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * An ordered batch of results returned executing a pipeline.
+     *
+     * The batch size is variable, and can even be zero for when only a partial
+     * progress message is returned.
+     *
+     * The fields present in the returned documents are only those that were
+     * explicitly requested in the pipeline, this include those like
+     * [`__name__`][Document.name] & [`__update_time__`][Document.update_time].
+     * This is explicitly a divergence from `Firestore.RunQuery` /
+     * `Firestore.GetDocument` RPCs which always return such fields even when they
+     * are not specified in the [`mask`][DocumentMask].
+     * 
+ * + * repeated .google.firestore.v1.Document results = 2; + */ + public Builder addAllResults( + java.lang.Iterable values) { + if (resultsBuilder_ == null) { + ensureResultsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, results_); + onChanged(); + } else { + resultsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * An ordered batch of results returned executing a pipeline.
+     *
+     * The batch size is variable, and can even be zero for when only a partial
+     * progress message is returned.
+     *
+     * The fields present in the returned documents are only those that were
+     * explicitly requested in the pipeline, this include those like
+     * [`__name__`][Document.name] & [`__update_time__`][Document.update_time].
+     * This is explicitly a divergence from `Firestore.RunQuery` /
+     * `Firestore.GetDocument` RPCs which always return such fields even when they
+     * are not specified in the [`mask`][DocumentMask].
+     * 
+ * + * repeated .google.firestore.v1.Document results = 2; + */ + public Builder clearResults() { + if (resultsBuilder_ == null) { + results_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + } else { + resultsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * An ordered batch of results returned executing a pipeline.
+     *
+     * The batch size is variable, and can even be zero for when only a partial
+     * progress message is returned.
+     *
+     * The fields present in the returned documents are only those that were
+     * explicitly requested in the pipeline, this include those like
+     * [`__name__`][Document.name] & [`__update_time__`][Document.update_time].
+     * This is explicitly a divergence from `Firestore.RunQuery` /
+     * `Firestore.GetDocument` RPCs which always return such fields even when they
+     * are not specified in the [`mask`][DocumentMask].
+     * 
+ * + * repeated .google.firestore.v1.Document results = 2; + */ + public Builder removeResults(int index) { + if (resultsBuilder_ == null) { + ensureResultsIsMutable(); + results_.remove(index); + onChanged(); + } else { + resultsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * An ordered batch of results returned executing a pipeline.
+     *
+     * The batch size is variable, and can even be zero for when only a partial
+     * progress message is returned.
+     *
+     * The fields present in the returned documents are only those that were
+     * explicitly requested in the pipeline, this include those like
+     * [`__name__`][Document.name] & [`__update_time__`][Document.update_time].
+     * This is explicitly a divergence from `Firestore.RunQuery` /
+     * `Firestore.GetDocument` RPCs which always return such fields even when they
+     * are not specified in the [`mask`][DocumentMask].
+     * 
+ * + * repeated .google.firestore.v1.Document results = 2; + */ + public com.google.firestore.v1.Document.Builder getResultsBuilder(int index) { + return getResultsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * An ordered batch of results returned executing a pipeline.
+     *
+     * The batch size is variable, and can even be zero for when only a partial
+     * progress message is returned.
+     *
+     * The fields present in the returned documents are only those that were
+     * explicitly requested in the pipeline, this include those like
+     * [`__name__`][Document.name] & [`__update_time__`][Document.update_time].
+     * This is explicitly a divergence from `Firestore.RunQuery` /
+     * `Firestore.GetDocument` RPCs which always return such fields even when they
+     * are not specified in the [`mask`][DocumentMask].
+     * 
+ * + * repeated .google.firestore.v1.Document results = 2; + */ + public com.google.firestore.v1.DocumentOrBuilder getResultsOrBuilder(int index) { + if (resultsBuilder_ == null) { + return results_.get(index); + } else { + return resultsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * An ordered batch of results returned executing a pipeline.
+     *
+     * The batch size is variable, and can even be zero for when only a partial
+     * progress message is returned.
+     *
+     * The fields present in the returned documents are only those that were
+     * explicitly requested in the pipeline, this include those like
+     * [`__name__`][Document.name] & [`__update_time__`][Document.update_time].
+     * This is explicitly a divergence from `Firestore.RunQuery` /
+     * `Firestore.GetDocument` RPCs which always return such fields even when they
+     * are not specified in the [`mask`][DocumentMask].
+     * 
+ * + * repeated .google.firestore.v1.Document results = 2; + */ + public java.util.List + getResultsOrBuilderList() { + if (resultsBuilder_ != null) { + return resultsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(results_); + } + } + /** + * + * + *
+     * An ordered batch of results returned executing a pipeline.
+     *
+     * The batch size is variable, and can even be zero for when only a partial
+     * progress message is returned.
+     *
+     * The fields present in the returned documents are only those that were
+     * explicitly requested in the pipeline, this include those like
+     * [`__name__`][Document.name] & [`__update_time__`][Document.update_time].
+     * This is explicitly a divergence from `Firestore.RunQuery` /
+     * `Firestore.GetDocument` RPCs which always return such fields even when they
+     * are not specified in the [`mask`][DocumentMask].
+     * 
+ * + * repeated .google.firestore.v1.Document results = 2; + */ + public com.google.firestore.v1.Document.Builder addResultsBuilder() { + return getResultsFieldBuilder() + .addBuilder(com.google.firestore.v1.Document.getDefaultInstance()); + } + /** + * + * + *
+     * An ordered batch of results returned executing a pipeline.
+     *
+     * The batch size is variable, and can even be zero for when only a partial
+     * progress message is returned.
+     *
+     * The fields present in the returned documents are only those that were
+     * explicitly requested in the pipeline, this include those like
+     * [`__name__`][Document.name] & [`__update_time__`][Document.update_time].
+     * This is explicitly a divergence from `Firestore.RunQuery` /
+     * `Firestore.GetDocument` RPCs which always return such fields even when they
+     * are not specified in the [`mask`][DocumentMask].
+     * 
+ * + * repeated .google.firestore.v1.Document results = 2; + */ + public com.google.firestore.v1.Document.Builder addResultsBuilder(int index) { + return getResultsFieldBuilder() + .addBuilder(index, com.google.firestore.v1.Document.getDefaultInstance()); + } + /** + * + * + *
+     * An ordered batch of results returned executing a pipeline.
+     *
+     * The batch size is variable, and can even be zero for when only a partial
+     * progress message is returned.
+     *
+     * The fields present in the returned documents are only those that were
+     * explicitly requested in the pipeline, this include those like
+     * [`__name__`][Document.name] & [`__update_time__`][Document.update_time].
+     * This is explicitly a divergence from `Firestore.RunQuery` /
+     * `Firestore.GetDocument` RPCs which always return such fields even when they
+     * are not specified in the [`mask`][DocumentMask].
+     * 
+ * + * repeated .google.firestore.v1.Document results = 2; + */ + public java.util.List getResultsBuilderList() { + return getResultsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.firestore.v1.Document, + com.google.firestore.v1.Document.Builder, + com.google.firestore.v1.DocumentOrBuilder> + getResultsFieldBuilder() { + if (resultsBuilder_ == null) { + resultsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.firestore.v1.Document, + com.google.firestore.v1.Document.Builder, + com.google.firestore.v1.DocumentOrBuilder>( + results_, ((bitField0_ & 0x00000002) != 0), getParentForChildren(), isClean()); + results_ = null; + } + return resultsBuilder_; + } + + private com.google.protobuf.Timestamp executionTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + executionTimeBuilder_; + /** + * + * + *
+     * The time at which the document(s) were read.
+     *
+     * This may be monotonically increasing; in this case, the previous documents
+     * in the result stream are guaranteed not to have changed between their
+     * `execution_time` and this one.
+     *
+     * If the query returns no results, a response with `execution_time` and no
+     * `results` will be sent, and this represents the time at which the operation
+     * was run.
+     * 
+ * + * .google.protobuf.Timestamp execution_time = 3; + * + * @return Whether the executionTime field is set. + */ + public boolean hasExecutionTime() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + * + * + *
+     * The time at which the document(s) were read.
+     *
+     * This may be monotonically increasing; in this case, the previous documents
+     * in the result stream are guaranteed not to have changed between their
+     * `execution_time` and this one.
+     *
+     * If the query returns no results, a response with `execution_time` and no
+     * `results` will be sent, and this represents the time at which the operation
+     * was run.
+     * 
+ * + * .google.protobuf.Timestamp execution_time = 3; + * + * @return The executionTime. + */ + public com.google.protobuf.Timestamp getExecutionTime() { + if (executionTimeBuilder_ == null) { + return executionTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : executionTime_; + } else { + return executionTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The time at which the document(s) were read.
+     *
+     * This may be monotonically increasing; in this case, the previous documents
+     * in the result stream are guaranteed not to have changed between their
+     * `execution_time` and this one.
+     *
+     * If the query returns no results, a response with `execution_time` and no
+     * `results` will be sent, and this represents the time at which the operation
+     * was run.
+     * 
+ * + * .google.protobuf.Timestamp execution_time = 3; + */ + public Builder setExecutionTime(com.google.protobuf.Timestamp value) { + if (executionTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + executionTime_ = value; + } else { + executionTimeBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * The time at which the document(s) were read.
+     *
+     * This may be monotonically increasing; in this case, the previous documents
+     * in the result stream are guaranteed not to have changed between their
+     * `execution_time` and this one.
+     *
+     * If the query returns no results, a response with `execution_time` and no
+     * `results` will be sent, and this represents the time at which the operation
+     * was run.
+     * 
+ * + * .google.protobuf.Timestamp execution_time = 3; + */ + public Builder setExecutionTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (executionTimeBuilder_ == null) { + executionTime_ = builderForValue.build(); + } else { + executionTimeBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * The time at which the document(s) were read.
+     *
+     * This may be monotonically increasing; in this case, the previous documents
+     * in the result stream are guaranteed not to have changed between their
+     * `execution_time` and this one.
+     *
+     * If the query returns no results, a response with `execution_time` and no
+     * `results` will be sent, and this represents the time at which the operation
+     * was run.
+     * 
+ * + * .google.protobuf.Timestamp execution_time = 3; + */ + public Builder mergeExecutionTime(com.google.protobuf.Timestamp value) { + if (executionTimeBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0) + && executionTime_ != null + && executionTime_ != com.google.protobuf.Timestamp.getDefaultInstance()) { + getExecutionTimeBuilder().mergeFrom(value); + } else { + executionTime_ = value; + } + } else { + executionTimeBuilder_.mergeFrom(value); + } + if (executionTime_ != null) { + bitField0_ |= 0x00000004; + onChanged(); + } + return this; + } + /** + * + * + *
+     * The time at which the document(s) were read.
+     *
+     * This may be monotonically increasing; in this case, the previous documents
+     * in the result stream are guaranteed not to have changed between their
+     * `execution_time` and this one.
+     *
+     * If the query returns no results, a response with `execution_time` and no
+     * `results` will be sent, and this represents the time at which the operation
+     * was run.
+     * 
+ * + * .google.protobuf.Timestamp execution_time = 3; + */ + public Builder clearExecutionTime() { + bitField0_ = (bitField0_ & ~0x00000004); + executionTime_ = null; + if (executionTimeBuilder_ != null) { + executionTimeBuilder_.dispose(); + executionTimeBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * The time at which the document(s) were read.
+     *
+     * This may be monotonically increasing; in this case, the previous documents
+     * in the result stream are guaranteed not to have changed between their
+     * `execution_time` and this one.
+     *
+     * If the query returns no results, a response with `execution_time` and no
+     * `results` will be sent, and this represents the time at which the operation
+     * was run.
+     * 
+ * + * .google.protobuf.Timestamp execution_time = 3; + */ + public com.google.protobuf.Timestamp.Builder getExecutionTimeBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return getExecutionTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The time at which the document(s) were read.
+     *
+     * This may be monotonically increasing; in this case, the previous documents
+     * in the result stream are guaranteed not to have changed between their
+     * `execution_time` and this one.
+     *
+     * If the query returns no results, a response with `execution_time` and no
+     * `results` will be sent, and this represents the time at which the operation
+     * was run.
+     * 
+ * + * .google.protobuf.Timestamp execution_time = 3; + */ + public com.google.protobuf.TimestampOrBuilder getExecutionTimeOrBuilder() { + if (executionTimeBuilder_ != null) { + return executionTimeBuilder_.getMessageOrBuilder(); + } else { + return executionTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : executionTime_; + } + } + /** + * + * + *
+     * The time at which the document(s) were read.
+     *
+     * This may be monotonically increasing; in this case, the previous documents
+     * in the result stream are guaranteed not to have changed between their
+     * `execution_time` and this one.
+     *
+     * If the query returns no results, a response with `execution_time` and no
+     * `results` will be sent, and this represents the time at which the operation
+     * was run.
+     * 
+ * + * .google.protobuf.Timestamp execution_time = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getExecutionTimeFieldBuilder() { + if (executionTimeBuilder_ == null) { + executionTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getExecutionTime(), getParentForChildren(), isClean()); + executionTime_ = null; + } + return executionTimeBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.firestore.v1.ExecutePipelineResponse) + } + + // @@protoc_insertion_point(class_scope:google.firestore.v1.ExecutePipelineResponse) + private static final com.google.firestore.v1.ExecutePipelineResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.firestore.v1.ExecutePipelineResponse(); + } + + public static com.google.firestore.v1.ExecutePipelineResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ExecutePipelineResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.firestore.v1.ExecutePipelineResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/ExecutePipelineResponseOrBuilder.java b/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/ExecutePipelineResponseOrBuilder.java new file mode 100644 index 000000000..9aec28083 --- /dev/null +++ b/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/ExecutePipelineResponseOrBuilder.java @@ -0,0 +1,202 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/firestore/v1/firestore.proto + +// Protobuf Java Version: 3.25.2 +package com.google.firestore.v1; + +public interface ExecutePipelineResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.firestore.v1.ExecutePipelineResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Newly created transaction identifier.
+   *
+   * This field is only specified on the first response from the server when
+   * the request specified [ExecuteRequest.new_transaction][].
+   * 
+ * + * bytes transaction = 1; + * + * @return The transaction. + */ + com.google.protobuf.ByteString getTransaction(); + + /** + * + * + *
+   * An ordered batch of results returned executing a pipeline.
+   *
+   * The batch size is variable, and can even be zero for when only a partial
+   * progress message is returned.
+   *
+   * The fields present in the returned documents are only those that were
+   * explicitly requested in the pipeline, this include those like
+   * [`__name__`][Document.name] & [`__update_time__`][Document.update_time].
+   * This is explicitly a divergence from `Firestore.RunQuery` /
+   * `Firestore.GetDocument` RPCs which always return such fields even when they
+   * are not specified in the [`mask`][DocumentMask].
+   * 
+ * + * repeated .google.firestore.v1.Document results = 2; + */ + java.util.List getResultsList(); + /** + * + * + *
+   * An ordered batch of results returned executing a pipeline.
+   *
+   * The batch size is variable, and can even be zero for when only a partial
+   * progress message is returned.
+   *
+   * The fields present in the returned documents are only those that were
+   * explicitly requested in the pipeline, this include those like
+   * [`__name__`][Document.name] & [`__update_time__`][Document.update_time].
+   * This is explicitly a divergence from `Firestore.RunQuery` /
+   * `Firestore.GetDocument` RPCs which always return such fields even when they
+   * are not specified in the [`mask`][DocumentMask].
+   * 
+ * + * repeated .google.firestore.v1.Document results = 2; + */ + com.google.firestore.v1.Document getResults(int index); + /** + * + * + *
+   * An ordered batch of results returned executing a pipeline.
+   *
+   * The batch size is variable, and can even be zero for when only a partial
+   * progress message is returned.
+   *
+   * The fields present in the returned documents are only those that were
+   * explicitly requested in the pipeline, this include those like
+   * [`__name__`][Document.name] & [`__update_time__`][Document.update_time].
+   * This is explicitly a divergence from `Firestore.RunQuery` /
+   * `Firestore.GetDocument` RPCs which always return such fields even when they
+   * are not specified in the [`mask`][DocumentMask].
+   * 
+ * + * repeated .google.firestore.v1.Document results = 2; + */ + int getResultsCount(); + /** + * + * + *
+   * An ordered batch of results returned executing a pipeline.
+   *
+   * The batch size is variable, and can even be zero for when only a partial
+   * progress message is returned.
+   *
+   * The fields present in the returned documents are only those that were
+   * explicitly requested in the pipeline, this include those like
+   * [`__name__`][Document.name] & [`__update_time__`][Document.update_time].
+   * This is explicitly a divergence from `Firestore.RunQuery` /
+   * `Firestore.GetDocument` RPCs which always return such fields even when they
+   * are not specified in the [`mask`][DocumentMask].
+   * 
+ * + * repeated .google.firestore.v1.Document results = 2; + */ + java.util.List getResultsOrBuilderList(); + /** + * + * + *
+   * An ordered batch of results returned executing a pipeline.
+   *
+   * The batch size is variable, and can even be zero for when only a partial
+   * progress message is returned.
+   *
+   * The fields present in the returned documents are only those that were
+   * explicitly requested in the pipeline, this include those like
+   * [`__name__`][Document.name] & [`__update_time__`][Document.update_time].
+   * This is explicitly a divergence from `Firestore.RunQuery` /
+   * `Firestore.GetDocument` RPCs which always return such fields even when they
+   * are not specified in the [`mask`][DocumentMask].
+   * 
+ * + * repeated .google.firestore.v1.Document results = 2; + */ + com.google.firestore.v1.DocumentOrBuilder getResultsOrBuilder(int index); + + /** + * + * + *
+   * The time at which the document(s) were read.
+   *
+   * This may be monotonically increasing; in this case, the previous documents
+   * in the result stream are guaranteed not to have changed between their
+   * `execution_time` and this one.
+   *
+   * If the query returns no results, a response with `execution_time` and no
+   * `results` will be sent, and this represents the time at which the operation
+   * was run.
+   * 
+ * + * .google.protobuf.Timestamp execution_time = 3; + * + * @return Whether the executionTime field is set. + */ + boolean hasExecutionTime(); + /** + * + * + *
+   * The time at which the document(s) were read.
+   *
+   * This may be monotonically increasing; in this case, the previous documents
+   * in the result stream are guaranteed not to have changed between their
+   * `execution_time` and this one.
+   *
+   * If the query returns no results, a response with `execution_time` and no
+   * `results` will be sent, and this represents the time at which the operation
+   * was run.
+   * 
+ * + * .google.protobuf.Timestamp execution_time = 3; + * + * @return The executionTime. + */ + com.google.protobuf.Timestamp getExecutionTime(); + /** + * + * + *
+   * The time at which the document(s) were read.
+   *
+   * This may be monotonically increasing; in this case, the previous documents
+   * in the result stream are guaranteed not to have changed between their
+   * `execution_time` and this one.
+   *
+   * If the query returns no results, a response with `execution_time` and no
+   * `results` will be sent, and this represents the time at which the operation
+   * was run.
+   * 
+ * + * .google.protobuf.Timestamp execution_time = 3; + */ + com.google.protobuf.TimestampOrBuilder getExecutionTimeOrBuilder(); +} diff --git a/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/ExecutionStats.java b/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/ExecutionStats.java index 0453944ab..3c3fd0a97 100644 --- a/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/ExecutionStats.java +++ b/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/ExecutionStats.java @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/firestore/v1/query_profile.proto -// Protobuf Java Version: 3.25.3 +// Protobuf Java Version: 3.25.2 package com.google.firestore.v1; /** diff --git a/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/ExecutionStatsOrBuilder.java b/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/ExecutionStatsOrBuilder.java index ec86aab5e..1694bea5f 100644 --- a/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/ExecutionStatsOrBuilder.java +++ b/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/ExecutionStatsOrBuilder.java @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/firestore/v1/query_profile.proto -// Protobuf Java Version: 3.25.3 +// Protobuf Java Version: 3.25.2 package com.google.firestore.v1; public interface ExecutionStatsOrBuilder diff --git a/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/ExplainMetrics.java b/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/ExplainMetrics.java index 4507ad57f..9f862e933 100644 --- a/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/ExplainMetrics.java +++ b/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/ExplainMetrics.java @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/firestore/v1/query_profile.proto -// Protobuf Java Version: 3.25.3 +// Protobuf Java Version: 3.25.2 package com.google.firestore.v1; /** diff --git a/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/ExplainMetricsOrBuilder.java b/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/ExplainMetricsOrBuilder.java index b66033555..ba5a87f0f 100644 --- a/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/ExplainMetricsOrBuilder.java +++ b/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/ExplainMetricsOrBuilder.java @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/firestore/v1/query_profile.proto -// Protobuf Java Version: 3.25.3 +// Protobuf Java Version: 3.25.2 package com.google.firestore.v1; public interface ExplainMetricsOrBuilder diff --git a/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/ExplainOptions.java b/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/ExplainOptions.java index 6e18d6a65..82c242b89 100644 --- a/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/ExplainOptions.java +++ b/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/ExplainOptions.java @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/firestore/v1/query_profile.proto -// Protobuf Java Version: 3.25.3 +// Protobuf Java Version: 3.25.2 package com.google.firestore.v1; /** diff --git a/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/ExplainOptionsOrBuilder.java b/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/ExplainOptionsOrBuilder.java index 80a82dee4..2acb95c56 100644 --- a/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/ExplainOptionsOrBuilder.java +++ b/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/ExplainOptionsOrBuilder.java @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/firestore/v1/query_profile.proto -// Protobuf Java Version: 3.25.3 +// Protobuf Java Version: 3.25.2 package com.google.firestore.v1; public interface ExplainOptionsOrBuilder diff --git a/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/FirestoreProto.java b/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/FirestoreProto.java index dcc7ca8de..cb7375ccc 100644 --- a/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/FirestoreProto.java +++ b/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/FirestoreProto.java @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/firestore/v1/firestore.proto -// Protobuf Java Version: 3.25.3 +// Protobuf Java Version: 3.25.2 package com.google.firestore.v1; public final class FirestoreProto { @@ -88,6 +88,14 @@ public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry r internal_static_google_firestore_v1_RunQueryResponse_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_firestore_v1_RunQueryResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_firestore_v1_ExecutePipelineRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_firestore_v1_ExecutePipelineRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_firestore_v1_ExecutePipelineResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_firestore_v1_ExecutePipelineResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_firestore_v1_RunAggregationQueryRequest_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable @@ -179,249 +187,259 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "e/api/field_behavior.proto\032,google/fires" + "tore/v1/aggregation_result.proto\032 google" + "/firestore/v1/common.proto\032\"google/fires" - + "tore/v1/document.proto\032\037google/firestore" - + "/v1/query.proto\032\'google/firestore/v1/que" - + "ry_profile.proto\032\037google/firestore/v1/wr" - + "ite.proto\032\033google/protobuf/empty.proto\032\037" - + "google/protobuf/timestamp.proto\032\036google/" - + "protobuf/wrappers.proto\032\027google/rpc/stat" - + "us.proto\"\270\001\n\022GetDocumentRequest\022\021\n\004name\030" - + "\001 \001(\tB\003\340A\002\022/\n\004mask\030\002 \001(\0132!.google.firest" - + "ore.v1.DocumentMask\022\025\n\013transaction\030\003 \001(\014" - + "H\000\022/\n\tread_time\030\005 \001(\0132\032.google.protobuf." - + "TimestampH\000B\026\n\024consistency_selector\"\273\002\n\024" - + "ListDocumentsRequest\022\023\n\006parent\030\001 \001(\tB\003\340A" - + "\002\022\032\n\rcollection_id\030\002 \001(\tB\003\340A\001\022\026\n\tpage_si" - + "ze\030\003 \001(\005B\003\340A\001\022\027\n\npage_token\030\004 \001(\tB\003\340A\001\022\025" - + "\n\010order_by\030\006 \001(\tB\003\340A\001\0224\n\004mask\030\007 \001(\0132!.go" - + "ogle.firestore.v1.DocumentMaskB\003\340A\001\022\025\n\013t" - + "ransaction\030\010 \001(\014H\000\022/\n\tread_time\030\n \001(\0132\032." - + "google.protobuf.TimestampH\000\022\024\n\014show_miss" - + "ing\030\014 \001(\010B\026\n\024consistency_selector\"b\n\025Lis" - + "tDocumentsResponse\0220\n\tdocuments\030\001 \003(\0132\035." - + "google.firestore.v1.Document\022\027\n\017next_pag" - + "e_token\030\002 \001(\t\"\304\001\n\025CreateDocumentRequest\022" - + "\023\n\006parent\030\001 \001(\tB\003\340A\002\022\032\n\rcollection_id\030\002 " - + "\001(\tB\003\340A\002\022\023\n\013document_id\030\003 \001(\t\0224\n\010documen" - + "t\030\004 \001(\0132\035.google.firestore.v1.DocumentB\003" - + "\340A\002\022/\n\004mask\030\005 \001(\0132!.google.firestore.v1." - + "DocumentMask\"\363\001\n\025UpdateDocumentRequest\0224" + + "tore/v1/document.proto\032\"google/firestore" + + "/v1/pipeline.proto\032\037google/firestore/v1/" + + "query.proto\032\037google/firestore/v1/write.p" + + "roto\032\033google/protobuf/empty.proto\032\037googl" + + "e/protobuf/timestamp.proto\032\036google/proto" + + "buf/wrappers.proto\032\027google/rpc/status.pr" + + "oto\"\270\001\n\022GetDocumentRequest\022\021\n\004name\030\001 \001(\t" + + "B\003\340A\002\022/\n\004mask\030\002 \001(\0132!.google.firestore.v" + + "1.DocumentMask\022\025\n\013transaction\030\003 \001(\014H\000\022/\n" + + "\tread_time\030\005 \001(\0132\032.google.protobuf.Times" + + "tampH\000B\026\n\024consistency_selector\"\273\002\n\024ListD" + + "ocumentsRequest\022\023\n\006parent\030\001 \001(\tB\003\340A\002\022\032\n\r" + + "collection_id\030\002 \001(\tB\003\340A\001\022\026\n\tpage_size\030\003 " + + "\001(\005B\003\340A\001\022\027\n\npage_token\030\004 \001(\tB\003\340A\001\022\025\n\010ord" + + "er_by\030\006 \001(\tB\003\340A\001\0224\n\004mask\030\007 \001(\0132!.google." + + "firestore.v1.DocumentMaskB\003\340A\001\022\025\n\013transa" + + "ction\030\010 \001(\014H\000\022/\n\tread_time\030\n \001(\0132\032.googl" + + "e.protobuf.TimestampH\000\022\024\n\014show_missing\030\014" + + " \001(\010B\026\n\024consistency_selector\"b\n\025ListDocu" + + "mentsResponse\0220\n\tdocuments\030\001 \003(\0132\035.googl" + + "e.firestore.v1.Document\022\027\n\017next_page_tok" + + "en\030\002 \001(\t\"\304\001\n\025CreateDocumentRequest\022\023\n\006pa" + + "rent\030\001 \001(\tB\003\340A\002\022\032\n\rcollection_id\030\002 \001(\tB\003" + + "\340A\002\022\023\n\013document_id\030\003 \001(\t\0224\n\010document\030\004 \001" + + "(\0132\035.google.firestore.v1.DocumentB\003\340A\002\022/" + + "\n\004mask\030\005 \001(\0132!.google.firestore.v1.Docum" + + "entMask\"\363\001\n\025UpdateDocumentRequest\0224\n\010doc" + + "ument\030\001 \001(\0132\035.google.firestore.v1.Docume" + + "ntB\003\340A\002\0226\n\013update_mask\030\002 \001(\0132!.google.fi" + + "restore.v1.DocumentMask\022/\n\004mask\030\003 \001(\0132!." + + "google.firestore.v1.DocumentMask\022;\n\020curr" + + "ent_document\030\004 \001(\0132!.google.firestore.v1" + + ".Precondition\"g\n\025DeleteDocumentRequest\022\021" + + "\n\004name\030\001 \001(\tB\003\340A\002\022;\n\020current_document\030\002 " + + "\001(\0132!.google.firestore.v1.Precondition\"\231" + + "\002\n\030BatchGetDocumentsRequest\022\025\n\010database\030" + + "\001 \001(\tB\003\340A\002\022\021\n\tdocuments\030\002 \003(\t\022/\n\004mask\030\003 " + + "\001(\0132!.google.firestore.v1.DocumentMask\022\025" + + "\n\013transaction\030\004 \001(\014H\000\022B\n\017new_transaction" + + "\030\005 \001(\0132\'.google.firestore.v1.Transaction" + + "OptionsH\000\022/\n\tread_time\030\007 \001(\0132\032.google.pr" + + "otobuf.TimestampH\000B\026\n\024consistency_select" + + "or\"\254\001\n\031BatchGetDocumentsResponse\022.\n\005foun" + + "d\030\001 \001(\0132\035.google.firestore.v1.DocumentH\000" + + "\022\021\n\007missing\030\002 \001(\tH\000\022\023\n\013transaction\030\003 \001(\014" + + "\022-\n\tread_time\030\004 \001(\0132\032.google.protobuf.Ti" + + "mestampB\010\n\006result\"j\n\027BeginTransactionReq" + + "uest\022\025\n\010database\030\001 \001(\tB\003\340A\002\0228\n\007options\030\002" + + " \001(\0132\'.google.firestore.v1.TransactionOp" + + "tions\"/\n\030BeginTransactionResponse\022\023\n\013tra" + + "nsaction\030\001 \001(\014\"g\n\rCommitRequest\022\025\n\010datab" + + "ase\030\001 \001(\tB\003\340A\002\022*\n\006writes\030\002 \003(\0132\032.google." + + "firestore.v1.Write\022\023\n\013transaction\030\003 \001(\014\"" + + "z\n\016CommitResponse\0227\n\rwrite_results\030\001 \003(\013" + + "2 .google.firestore.v1.WriteResult\022/\n\013co" + + "mmit_time\030\002 \001(\0132\032.google.protobuf.Timest" + + "amp\"B\n\017RollbackRequest\022\025\n\010database\030\001 \001(\t" + + "B\003\340A\002\022\030\n\013transaction\030\002 \001(\014B\003\340A\002\"\232\002\n\017RunQ" + + "ueryRequest\022\023\n\006parent\030\001 \001(\tB\003\340A\002\022@\n\020stru" + + "ctured_query\030\002 \001(\0132$.google.firestore.v1" + + ".StructuredQueryH\000\022\025\n\013transaction\030\005 \001(\014H" + + "\001\022B\n\017new_transaction\030\006 \001(\0132\'.google.fire" + + "store.v1.TransactionOptionsH\001\022/\n\tread_ti" + + "me\030\007 \001(\0132\032.google.protobuf.TimestampH\001B\014" + + "\n\nquery_typeB\026\n\024consistency_selector\"\311\001\n" + + "\020RunQueryResponse\022\023\n\013transaction\030\002 \001(\014\022/" + "\n\010document\030\001 \001(\0132\035.google.firestore.v1.D" - + "ocumentB\003\340A\002\0226\n\013update_mask\030\002 \001(\0132!.goog" - + "le.firestore.v1.DocumentMask\022/\n\004mask\030\003 \001" - + "(\0132!.google.firestore.v1.DocumentMask\022;\n" - + "\020current_document\030\004 \001(\0132!.google.firesto" - + "re.v1.Precondition\"g\n\025DeleteDocumentRequ" - + "est\022\021\n\004name\030\001 \001(\tB\003\340A\002\022;\n\020current_docume" - + "nt\030\002 \001(\0132!.google.firestore.v1.Precondit" - + "ion\"\231\002\n\030BatchGetDocumentsRequest\022\025\n\010data" - + "base\030\001 \001(\tB\003\340A\002\022\021\n\tdocuments\030\002 \003(\t\022/\n\004ma" - + "sk\030\003 \001(\0132!.google.firestore.v1.DocumentM" - + "ask\022\025\n\013transaction\030\004 \001(\014H\000\022B\n\017new_transa" - + "ction\030\005 \001(\0132\'.google.firestore.v1.Transa" - + "ctionOptionsH\000\022/\n\tread_time\030\007 \001(\0132\032.goog" - + "le.protobuf.TimestampH\000B\026\n\024consistency_s" - + "elector\"\254\001\n\031BatchGetDocumentsResponse\022.\n" - + "\005found\030\001 \001(\0132\035.google.firestore.v1.Docum" - + "entH\000\022\021\n\007missing\030\002 \001(\tH\000\022\023\n\013transaction\030" - + "\003 \001(\014\022-\n\tread_time\030\004 \001(\0132\032.google.protob" - + "uf.TimestampB\010\n\006result\"j\n\027BeginTransacti" - + "onRequest\022\025\n\010database\030\001 \001(\tB\003\340A\002\0228\n\007opti" - + "ons\030\002 \001(\0132\'.google.firestore.v1.Transact" - + "ionOptions\"/\n\030BeginTransactionResponse\022\023" - + "\n\013transaction\030\001 \001(\014\"g\n\rCommitRequest\022\025\n\010" - + "database\030\001 \001(\tB\003\340A\002\022*\n\006writes\030\002 \003(\0132\032.go" - + "ogle.firestore.v1.Write\022\023\n\013transaction\030\003" - + " \001(\014\"z\n\016CommitResponse\0227\n\rwrite_results\030" - + "\001 \003(\0132 .google.firestore.v1.WriteResult\022" - + "/\n\013commit_time\030\002 \001(\0132\032.google.protobuf.T" - + "imestamp\"B\n\017RollbackRequest\022\025\n\010database\030" - + "\001 \001(\tB\003\340A\002\022\030\n\013transaction\030\002 \001(\014B\003\340A\002\"\335\002\n" - + "\017RunQueryRequest\022\023\n\006parent\030\001 \001(\tB\003\340A\002\022@\n" - + "\020structured_query\030\002 \001(\0132$.google.firesto" - + "re.v1.StructuredQueryH\000\022\025\n\013transaction\030\005" - + " \001(\014H\001\022B\n\017new_transaction\030\006 \001(\0132\'.google" - + ".firestore.v1.TransactionOptionsH\001\022/\n\tre" - + "ad_time\030\007 \001(\0132\032.google.protobuf.Timestam" - + "pH\001\022A\n\017explain_options\030\n \001(\0132#.google.fi" - + "restore.v1.ExplainOptionsB\003\340A\001B\014\n\nquery_" - + "typeB\026\n\024consistency_selector\"\207\002\n\020RunQuer" - + "yResponse\022\023\n\013transaction\030\002 \001(\014\022/\n\010docume" - + "nt\030\001 \001(\0132\035.google.firestore.v1.Document\022" - + "-\n\tread_time\030\003 \001(\0132\032.google.protobuf.Tim" - + "estamp\022\027\n\017skipped_results\030\004 \001(\005\022\016\n\004done\030" - + "\006 \001(\010H\000\022<\n\017explain_metrics\030\013 \001(\0132#.googl" - + "e.firestore.v1.ExplainMetricsB\027\n\025continu" - + "ation_selector\"\377\002\n\032RunAggregationQueryRe" - + "quest\022\023\n\006parent\030\001 \001(\tB\003\340A\002\022W\n\034structured" - + "_aggregation_query\030\002 \001(\0132/.google.firest" - + "ore.v1.StructuredAggregationQueryH\000\022\025\n\013t" - + "ransaction\030\004 \001(\014H\001\022B\n\017new_transaction\030\005 " - + "\001(\0132\'.google.firestore.v1.TransactionOpt" - + "ionsH\001\022/\n\tread_time\030\006 \001(\0132\032.google.proto" - + "buf.TimestampH\001\022A\n\017explain_options\030\010 \001(\013" - + "2#.google.firestore.v1.ExplainOptionsB\003\340" - + "A\001B\014\n\nquery_typeB\026\n\024consistency_selector" - + "\"\327\001\n\033RunAggregationQueryResponse\0226\n\006resu" - + "lt\030\001 \001(\0132&.google.firestore.v1.Aggregati" - + "onResult\022\023\n\013transaction\030\002 \001(\014\022-\n\tread_ti" - + "me\030\003 \001(\0132\032.google.protobuf.Timestamp\022<\n\017" - + "explain_metrics\030\n \001(\0132#.google.firestore" - + ".v1.ExplainMetrics\"\205\002\n\025PartitionQueryReq" - + "uest\022\023\n\006parent\030\001 \001(\tB\003\340A\002\022@\n\020structured_" - + "query\030\002 \001(\0132$.google.firestore.v1.Struct" - + "uredQueryH\000\022\027\n\017partition_count\030\003 \001(\003\022\022\n\n" - + "page_token\030\004 \001(\t\022\021\n\tpage_size\030\005 \001(\005\022/\n\tr" - + "ead_time\030\006 \001(\0132\032.google.protobuf.Timesta" - + "mpH\001B\014\n\nquery_typeB\026\n\024consistency_select" - + "or\"b\n\026PartitionQueryResponse\022/\n\npartitio" - + "ns\030\001 \003(\0132\033.google.firestore.v1.Cursor\022\027\n" - + "\017next_page_token\030\002 \001(\t\"\350\001\n\014WriteRequest\022" - + "\025\n\010database\030\001 \001(\tB\003\340A\002\022\021\n\tstream_id\030\002 \001(" - + "\t\022*\n\006writes\030\003 \003(\0132\032.google.firestore.v1." - + "Write\022\024\n\014stream_token\030\004 \001(\014\022=\n\006labels\030\005 " - + "\003(\0132-.google.firestore.v1.WriteRequest.L" - + "abelsEntry\032-\n\013LabelsEntry\022\013\n\003key\030\001 \001(\t\022\r" - + "\n\005value\030\002 \001(\t:\0028\001\"\242\001\n\rWriteResponse\022\021\n\ts" - + "tream_id\030\001 \001(\t\022\024\n\014stream_token\030\002 \001(\014\0227\n\r" - + "write_results\030\003 \003(\0132 .google.firestore.v" - + "1.WriteResult\022/\n\013commit_time\030\004 \001(\0132\032.goo" - + "gle.protobuf.Timestamp\"\362\001\n\rListenRequest" - + "\022\025\n\010database\030\001 \001(\tB\003\340A\002\0221\n\nadd_target\030\002 " - + "\001(\0132\033.google.firestore.v1.TargetH\000\022\027\n\rre" - + "move_target\030\003 \001(\005H\000\022>\n\006labels\030\004 \003(\0132..go" - + "ogle.firestore.v1.ListenRequest.LabelsEn" - + "try\032-\n\013LabelsEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value" - + "\030\002 \001(\t:\0028\001B\017\n\rtarget_change\"\325\002\n\016ListenRe" - + "sponse\022:\n\rtarget_change\030\002 \001(\0132!.google.f" - + "irestore.v1.TargetChangeH\000\022>\n\017document_c" - + "hange\030\003 \001(\0132#.google.firestore.v1.Docume" - + "ntChangeH\000\022>\n\017document_delete\030\004 \001(\0132#.go" - + "ogle.firestore.v1.DocumentDeleteH\000\022>\n\017do" - + "cument_remove\030\006 \001(\0132#.google.firestore.v" - + "1.DocumentRemoveH\000\0226\n\006filter\030\005 \001(\0132$.goo" - + "gle.firestore.v1.ExistenceFilterH\000B\017\n\rre" - + "sponse_type\"\326\003\n\006Target\0228\n\005query\030\002 \001(\0132\'." - + "google.firestore.v1.Target.QueryTargetH\000" - + "\022@\n\tdocuments\030\003 \001(\0132+.google.firestore.v" - + "1.Target.DocumentsTargetH\000\022\026\n\014resume_tok" - + "en\030\004 \001(\014H\001\022/\n\tread_time\030\013 \001(\0132\032.google.p" - + "rotobuf.TimestampH\001\022\021\n\ttarget_id\030\005 \001(\005\022\014" - + "\n\004once\030\006 \001(\010\0223\n\016expected_count\030\014 \001(\0132\033.g" - + "oogle.protobuf.Int32Value\032$\n\017DocumentsTa" - + "rget\022\021\n\tdocuments\030\002 \003(\t\032m\n\013QueryTarget\022\016" - + "\n\006parent\030\001 \001(\t\022@\n\020structured_query\030\002 \001(\013" + + "ocument\022-\n\tread_time\030\003 \001(\0132\032.google.prot" + + "obuf.Timestamp\022\027\n\017skipped_results\030\004 \001(\005\022" + + "\016\n\004done\030\006 \001(\010H\000B\027\n\025continuation_selector" + + "\"\254\002\n\026ExecutePipelineRequest\022\025\n\010database\030" + + "\001 \001(\tB\003\340A\002\022F\n\023structured_pipeline\030\002 \001(\0132" + + "\'.google.firestore.v1.StructuredPipeline" + + "H\000\022\025\n\013transaction\030\005 \001(\014H\001\022B\n\017new_transac" + + "tion\030\006 \001(\0132\'.google.firestore.v1.Transac" + + "tionOptionsH\001\022/\n\tread_time\030\007 \001(\0132\032.googl" + + "e.protobuf.TimestampH\001B\017\n\rpipeline_typeB" + + "\026\n\024consistency_selector\"\222\001\n\027ExecutePipel" + + "ineResponse\022\023\n\013transaction\030\001 \001(\014\022.\n\007resu" + + "lts\030\002 \003(\0132\035.google.firestore.v1.Document" + + "\0222\n\016execution_time\030\003 \001(\0132\032.google.protob" + + "uf.Timestamp\"\274\002\n\032RunAggregationQueryRequ" + + "est\022\023\n\006parent\030\001 \001(\tB\003\340A\002\022W\n\034structured_a" + + "ggregation_query\030\002 \001(\0132/.google.firestor" + + "e.v1.StructuredAggregationQueryH\000\022\025\n\013tra" + + "nsaction\030\004 \001(\014H\001\022B\n\017new_transaction\030\005 \001(" + + "\0132\'.google.firestore.v1.TransactionOptio" + + "nsH\001\022/\n\tread_time\030\006 \001(\0132\032.google.protobu" + + "f.TimestampH\001B\014\n\nquery_typeB\026\n\024consisten" + + "cy_selector\"\231\001\n\033RunAggregationQueryRespo" + + "nse\0226\n\006result\030\001 \001(\0132&.google.firestore.v" + + "1.AggregationResult\022\023\n\013transaction\030\002 \001(\014" + + "\022-\n\tread_time\030\003 \001(\0132\032.google.protobuf.Ti" + + "mestamp\"\205\002\n\025PartitionQueryRequest\022\023\n\006par" + + "ent\030\001 \001(\tB\003\340A\002\022@\n\020structured_query\030\002 \001(\013" + "2$.google.firestore.v1.StructuredQueryH\000" - + "B\014\n\nquery_typeB\r\n\013target_typeB\r\n\013resume_" - + "type\"\252\002\n\014TargetChange\022N\n\022target_change_t" - + "ype\030\001 \001(\01622.google.firestore.v1.TargetCh" - + "ange.TargetChangeType\022\022\n\ntarget_ids\030\002 \003(" - + "\005\022!\n\005cause\030\003 \001(\0132\022.google.rpc.Status\022\024\n\014" - + "resume_token\030\004 \001(\014\022-\n\tread_time\030\006 \001(\0132\032." - + "google.protobuf.Timestamp\"N\n\020TargetChang" - + "eType\022\r\n\tNO_CHANGE\020\000\022\007\n\003ADD\020\001\022\n\n\006REMOVE\020" - + "\002\022\013\n\007CURRENT\020\003\022\t\n\005RESET\020\004\"\237\001\n\030ListCollec" - + "tionIdsRequest\022\023\n\006parent\030\001 \001(\tB\003\340A\002\022\021\n\tp" - + "age_size\030\002 \001(\005\022\022\n\npage_token\030\003 \001(\t\022/\n\tre" - + "ad_time\030\004 \001(\0132\032.google.protobuf.Timestam" - + "pH\000B\026\n\024consistency_selector\"L\n\031ListColle" - + "ctionIdsResponse\022\026\n\016collection_ids\030\001 \003(\t" - + "\022\027\n\017next_page_token\030\002 \001(\t\"\311\001\n\021BatchWrite" - + "Request\022\025\n\010database\030\001 \001(\tB\003\340A\002\022*\n\006writes" - + "\030\002 \003(\0132\032.google.firestore.v1.Write\022B\n\006la" - + "bels\030\003 \003(\01322.google.firestore.v1.BatchWr" - + "iteRequest.LabelsEntry\032-\n\013LabelsEntry\022\013\n" - + "\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001\"q\n\022BatchWr" - + "iteResponse\0227\n\rwrite_results\030\001 \003(\0132 .goo" - + "gle.firestore.v1.WriteResult\022\"\n\006status\030\002" - + " \003(\0132\022.google.rpc.Status2\332\031\n\tFirestore\022\217" - + "\001\n\013GetDocument\022\'.google.firestore.v1.Get" - + "DocumentRequest\032\035.google.firestore.v1.Do" - + "cument\"8\202\323\344\223\0022\0220/v1/{name=projects/*/dat" - + "abases/*/documents/*/**}\022\365\001\n\rListDocumen" - + "ts\022).google.firestore.v1.ListDocumentsRe" - + "quest\032*.google.firestore.v1.ListDocument" - + "sResponse\"\214\001\202\323\344\223\002\205\001\022B/v1/{parent=project" - + "s/*/databases/*/documents/*/**}/{collect" - + "ion_id}Z?\022=/v1/{parent=projects/*/databa" - + "ses/*/documents}/{collection_id}\022\277\001\n\016Upd" - + "ateDocument\022*.google.firestore.v1.Update" + + "\022\027\n\017partition_count\030\003 \001(\003\022\022\n\npage_token\030" + + "\004 \001(\t\022\021\n\tpage_size\030\005 \001(\005\022/\n\tread_time\030\006 " + + "\001(\0132\032.google.protobuf.TimestampH\001B\014\n\nque" + + "ry_typeB\026\n\024consistency_selector\"b\n\026Parti" + + "tionQueryResponse\022/\n\npartitions\030\001 \003(\0132\033." + + "google.firestore.v1.Cursor\022\027\n\017next_page_" + + "token\030\002 \001(\t\"\350\001\n\014WriteRequest\022\025\n\010database" + + "\030\001 \001(\tB\003\340A\002\022\021\n\tstream_id\030\002 \001(\t\022*\n\006writes" + + "\030\003 \003(\0132\032.google.firestore.v1.Write\022\024\n\014st" + + "ream_token\030\004 \001(\014\022=\n\006labels\030\005 \003(\0132-.googl" + + "e.firestore.v1.WriteRequest.LabelsEntry\032" + + "-\n\013LabelsEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001" + + "(\t:\0028\001\"\242\001\n\rWriteResponse\022\021\n\tstream_id\030\001 " + + "\001(\t\022\024\n\014stream_token\030\002 \001(\014\0227\n\rwrite_resul" + + "ts\030\003 \003(\0132 .google.firestore.v1.WriteResu" + + "lt\022/\n\013commit_time\030\004 \001(\0132\032.google.protobu" + + "f.Timestamp\"\362\001\n\rListenRequest\022\025\n\010databas" + + "e\030\001 \001(\tB\003\340A\002\0221\n\nadd_target\030\002 \001(\0132\033.googl" + + "e.firestore.v1.TargetH\000\022\027\n\rremove_target" + + "\030\003 \001(\005H\000\022>\n\006labels\030\004 \003(\0132..google.firest" + + "ore.v1.ListenRequest.LabelsEntry\032-\n\013Labe" + + "lsEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001B" + + "\017\n\rtarget_change\"\325\002\n\016ListenResponse\022:\n\rt" + + "arget_change\030\002 \001(\0132!.google.firestore.v1" + + ".TargetChangeH\000\022>\n\017document_change\030\003 \001(\013" + + "2#.google.firestore.v1.DocumentChangeH\000\022" + + ">\n\017document_delete\030\004 \001(\0132#.google.firest" + + "ore.v1.DocumentDeleteH\000\022>\n\017document_remo" + + "ve\030\006 \001(\0132#.google.firestore.v1.DocumentR" + + "emoveH\000\0226\n\006filter\030\005 \001(\0132$.google.firesto" + + "re.v1.ExistenceFilterH\000B\017\n\rresponse_type" + + "\"\326\003\n\006Target\0228\n\005query\030\002 \001(\0132\'.google.fire" + + "store.v1.Target.QueryTargetH\000\022@\n\tdocumen" + + "ts\030\003 \001(\0132+.google.firestore.v1.Target.Do" + + "cumentsTargetH\000\022\026\n\014resume_token\030\004 \001(\014H\001\022" + + "/\n\tread_time\030\013 \001(\0132\032.google.protobuf.Tim" + + "estampH\001\022\021\n\ttarget_id\030\005 \001(\005\022\014\n\004once\030\006 \001(" + + "\010\0223\n\016expected_count\030\014 \001(\0132\033.google.proto" + + "buf.Int32Value\032$\n\017DocumentsTarget\022\021\n\tdoc" + + "uments\030\002 \003(\t\032m\n\013QueryTarget\022\016\n\006parent\030\001 " + + "\001(\t\022@\n\020structured_query\030\002 \001(\0132$.google.f" + + "irestore.v1.StructuredQueryH\000B\014\n\nquery_t" + + "ypeB\r\n\013target_typeB\r\n\013resume_type\"\252\002\n\014Ta" + + "rgetChange\022N\n\022target_change_type\030\001 \001(\01622" + + ".google.firestore.v1.TargetChange.Target" + + "ChangeType\022\022\n\ntarget_ids\030\002 \003(\005\022!\n\005cause\030" + + "\003 \001(\0132\022.google.rpc.Status\022\024\n\014resume_toke" + + "n\030\004 \001(\014\022-\n\tread_time\030\006 \001(\0132\032.google.prot" + + "obuf.Timestamp\"N\n\020TargetChangeType\022\r\n\tNO" + + "_CHANGE\020\000\022\007\n\003ADD\020\001\022\n\n\006REMOVE\020\002\022\013\n\007CURREN" + + "T\020\003\022\t\n\005RESET\020\004\"\237\001\n\030ListCollectionIdsRequ" + + "est\022\023\n\006parent\030\001 \001(\tB\003\340A\002\022\021\n\tpage_size\030\002 " + + "\001(\005\022\022\n\npage_token\030\003 \001(\t\022/\n\tread_time\030\004 \001" + + "(\0132\032.google.protobuf.TimestampH\000B\026\n\024cons" + + "istency_selector\"L\n\031ListCollectionIdsRes" + + "ponse\022\026\n\016collection_ids\030\001 \003(\t\022\027\n\017next_pa" + + "ge_token\030\002 \001(\t\"\311\001\n\021BatchWriteRequest\022\025\n\010" + + "database\030\001 \001(\tB\003\340A\002\022*\n\006writes\030\002 \003(\0132\032.go" + + "ogle.firestore.v1.Write\022B\n\006labels\030\003 \003(\0132" + + "2.google.firestore.v1.BatchWriteRequest." + + "LabelsEntry\032-\n\013LabelsEntry\022\013\n\003key\030\001 \001(\t\022" + + "\r\n\005value\030\002 \001(\t:\0028\001\"q\n\022BatchWriteResponse" + + "\0227\n\rwrite_results\030\001 \003(\0132 .google.firesto" + + "re.v1.WriteResult\022\"\n\006status\030\002 \003(\0132\022.goog" + + "le.rpc.Status2\222\033\n\tFirestore\022\217\001\n\013GetDocum" + + "ent\022\'.google.firestore.v1.GetDocumentReq" + + "uest\032\035.google.firestore.v1.Document\"8\202\323\344" + + "\223\0022\0220/v1/{name=projects/*/databases/*/do" + + "cuments/*/**}\022\365\001\n\rListDocuments\022).google" + + ".firestore.v1.ListDocumentsRequest\032*.goo" + + "gle.firestore.v1.ListDocumentsResponse\"\214" + + "\001\202\323\344\223\002\205\001\022B/v1/{parent=projects/*/databas" + + "es/*/documents/*/**}/{collection_id}Z?\022=" + + "/v1/{parent=projects/*/databases/*/docum" + + "ents}/{collection_id}\022\277\001\n\016UpdateDocument" + + "\022*.google.firestore.v1.UpdateDocumentReq" + + "uest\032\035.google.firestore.v1.Document\"b\332A\024" + + "document,update_mask\202\323\344\223\002E29/v1/{documen" + + "t.name=projects/*/databases/*/documents/" + + "*/**}:\010document\022\225\001\n\016DeleteDocument\022*.goo" + + "gle.firestore.v1.DeleteDocumentRequest\032\026" + + ".google.protobuf.Empty\"?\332A\004name\202\323\344\223\0022*0/" + + "v1/{name=projects/*/databases/*/document" + + "s/*/**}\022\271\001\n\021BatchGetDocuments\022-.google.f" + + "irestore.v1.BatchGetDocumentsRequest\032..g" + + "oogle.firestore.v1.BatchGetDocumentsResp" + + "onse\"C\202\323\344\223\002=\"8/v1/{database=projects/*/d" + + "atabases/*}/documents:batchGet:\001*0\001\022\307\001\n\020" + + "BeginTransaction\022,.google.firestore.v1.B" + + "eginTransactionRequest\032-.google.firestor" + + "e.v1.BeginTransactionResponse\"V\332A\010databa" + + "se\202\323\344\223\002E\"@/v1/{database=projects/*/datab" + + "ases/*}/documents:beginTransaction:\001*\022\246\001" + + "\n\006Commit\022\".google.firestore.v1.CommitReq" + + "uest\032#.google.firestore.v1.CommitRespons" + + "e\"S\332A\017database,writes\202\323\344\223\002;\"6/v1/{databa" + + "se=projects/*/databases/*}/documents:com" + + "mit:\001*\022\244\001\n\010Rollback\022$.google.firestore.v" + + "1.RollbackRequest\032\026.google.protobuf.Empt" + + "y\"Z\332A\024database,transaction\202\323\344\223\002=\"8/v1/{d" + + "atabase=projects/*/databases/*}/document" + + "s:rollback:\001*\022\337\001\n\010RunQuery\022$.google.fire" + + "store.v1.RunQueryRequest\032%.google.firest" + + "ore.v1.RunQueryResponse\"\203\001\202\323\344\223\002}\"6/v1/{p" + + "arent=projects/*/databases/*/documents}:" + + "runQuery:\001*Z@\";/v1/{parent=projects/*/da" + + "tabases/*/documents/*/**}:runQuery:\001*0\001\022" + + "\265\001\n\017ExecutePipeline\022+.google.firestore.v" + + "1.ExecutePipelineRequest\032,.google.firest" + + "ore.v1.ExecutePipelineResponse\"E\202\323\344\223\002?\":" + + "/v1beta1/{database=projects/*/databases/" + + "*}:executePipeline:\001*0\001\022\227\002\n\023RunAggregati" + + "onQuery\022/.google.firestore.v1.RunAggrega" + + "tionQueryRequest\0320.google.firestore.v1.R" + + "unAggregationQueryResponse\"\232\001\202\323\344\223\002\223\001\"A/v" + + "1/{parent=projects/*/databases/*/documen" + + "ts}:runAggregationQuery:\001*ZK\"F/v1/{paren" + + "t=projects/*/databases/*/documents/*/**}" + + ":runAggregationQuery:\001*0\001\022\374\001\n\016PartitionQ" + + "uery\022*.google.firestore.v1.PartitionQuer" + + "yRequest\032+.google.firestore.v1.Partition" + + "QueryResponse\"\220\001\202\323\344\223\002\211\001\" + * Represents an unevaluated scalar expression. + * + * For example, the expression `like(user_name, "%alice%")` is represented as: + * + * ``` + * name: "like" + * args { field_reference: "user_name" } + * args { string_value: "%alice%" } + * ``` + * + * (-- api-linter: core::0123::resource-annotation=disabled + * aip.dev/not-precedent: this is not a One Platform API resource. --) + * + * + * Protobuf type {@code google.firestore.v1.Function} + */ +public final class Function extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.firestore.v1.Function) + FunctionOrBuilder { + private static final long serialVersionUID = 0L; + // Use Function.newBuilder() to construct. + private Function(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Function() { + name_ = ""; + args_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Function(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.firestore.v1.DocumentProto + .internal_static_google_firestore_v1_Function_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection( + int number) { + switch (number) { + case 3: + return internalGetOptions(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.firestore.v1.DocumentProto + .internal_static_google_firestore_v1_Function_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.firestore.v1.Function.class, com.google.firestore.v1.Function.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** + * + * + *
+   * The name of the function to evaluate.
+   *
+   * **Requires:**
+   *
+   * * must be in snake case (lower case with underscore separator).
+   * 
+ * + * string name = 1; + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * The name of the function to evaluate.
+   *
+   * **Requires:**
+   *
+   * * must be in snake case (lower case with underscore separator).
+   * 
+ * + * string name = 1; + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int ARGS_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private java.util.List args_; + /** + * + * + *
+   * Ordered list of arguments the given function expects.
+   * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + @java.lang.Override + public java.util.List getArgsList() { + return args_; + } + /** + * + * + *
+   * Ordered list of arguments the given function expects.
+   * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + @java.lang.Override + public java.util.List getArgsOrBuilderList() { + return args_; + } + /** + * + * + *
+   * Ordered list of arguments the given function expects.
+   * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + @java.lang.Override + public int getArgsCount() { + return args_.size(); + } + /** + * + * + *
+   * Ordered list of arguments the given function expects.
+   * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + @java.lang.Override + public com.google.firestore.v1.Value getArgs(int index) { + return args_.get(index); + } + /** + * + * + *
+   * Ordered list of arguments the given function expects.
+   * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + @java.lang.Override + public com.google.firestore.v1.ValueOrBuilder getArgsOrBuilder(int index) { + return args_.get(index); + } + + public static final int OPTIONS_FIELD_NUMBER = 3; + + private static final class OptionsDefaultEntryHolder { + static final com.google.protobuf.MapEntry + defaultEntry = + com.google.protobuf.MapEntry + .newDefaultInstance( + com.google.firestore.v1.DocumentProto + .internal_static_google_firestore_v1_Function_OptionsEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.MESSAGE, + com.google.firestore.v1.Value.getDefaultInstance()); + } + + @SuppressWarnings("serial") + private com.google.protobuf.MapField options_; + + private com.google.protobuf.MapField + internalGetOptions() { + if (options_ == null) { + return com.google.protobuf.MapField.emptyMapField(OptionsDefaultEntryHolder.defaultEntry); + } + return options_; + } + + public int getOptionsCount() { + return internalGetOptions().getMap().size(); + } + /** + * + * + *
+   * Optional named arguments that certain functions may support.
+   * 
+ * + * map<string, .google.firestore.v1.Value> options = 3; + */ + @java.lang.Override + public boolean containsOptions(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetOptions().getMap().containsKey(key); + } + /** Use {@link #getOptionsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getOptions() { + return getOptionsMap(); + } + /** + * + * + *
+   * Optional named arguments that certain functions may support.
+   * 
+ * + * map<string, .google.firestore.v1.Value> options = 3; + */ + @java.lang.Override + public java.util.Map getOptionsMap() { + return internalGetOptions().getMap(); + } + /** + * + * + *
+   * Optional named arguments that certain functions may support.
+   * 
+ * + * map<string, .google.firestore.v1.Value> options = 3; + */ + @java.lang.Override + public /* nullable */ com.google.firestore.v1.Value getOptionsOrDefault( + java.lang.String key, + /* nullable */ + com.google.firestore.v1.Value defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = + internalGetOptions().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+   * Optional named arguments that certain functions may support.
+   * 
+ * + * map<string, .google.firestore.v1.Value> options = 3; + */ + @java.lang.Override + public com.google.firestore.v1.Value getOptionsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = + internalGetOptions().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + for (int i = 0; i < args_.size(); i++) { + output.writeMessage(2, args_.get(i)); + } + com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + output, internalGetOptions(), OptionsDefaultEntryHolder.defaultEntry, 3); + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + for (int i = 0; i < args_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, args_.get(i)); + } + for (java.util.Map.Entry entry : + internalGetOptions().getMap().entrySet()) { + com.google.protobuf.MapEntry options__ = + OptionsDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, options__); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.firestore.v1.Function)) { + return super.equals(obj); + } + com.google.firestore.v1.Function other = (com.google.firestore.v1.Function) obj; + + if (!getName().equals(other.getName())) return false; + if (!getArgsList().equals(other.getArgsList())) return false; + if (!internalGetOptions().equals(other.internalGetOptions())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + if (getArgsCount() > 0) { + hash = (37 * hash) + ARGS_FIELD_NUMBER; + hash = (53 * hash) + getArgsList().hashCode(); + } + if (!internalGetOptions().getMap().isEmpty()) { + hash = (37 * hash) + OPTIONS_FIELD_NUMBER; + hash = (53 * hash) + internalGetOptions().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.firestore.v1.Function parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.firestore.v1.Function parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.firestore.v1.Function parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.firestore.v1.Function parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.firestore.v1.Function parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.firestore.v1.Function parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.firestore.v1.Function parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.firestore.v1.Function parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.firestore.v1.Function parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.firestore.v1.Function parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.firestore.v1.Function parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.firestore.v1.Function parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.firestore.v1.Function prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Represents an unevaluated scalar expression.
+   *
+   * For example, the expression `like(user_name, "%alice%")` is represented as:
+   *
+   * ```
+   * name: "like"
+   * args { field_reference: "user_name" }
+   * args { string_value: "%alice%" }
+   * ```
+   *
+   * (-- api-linter: core::0123::resource-annotation=disabled
+   *     aip.dev/not-precedent: this is not a One Platform API resource. --)
+   * 
+ * + * Protobuf type {@code google.firestore.v1.Function} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.firestore.v1.Function) + com.google.firestore.v1.FunctionOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.firestore.v1.DocumentProto + .internal_static_google_firestore_v1_Function_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection( + int number) { + switch (number) { + case 3: + return internalGetOptions(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMutableMapFieldReflection( + int number) { + switch (number) { + case 3: + return internalGetMutableOptions(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.firestore.v1.DocumentProto + .internal_static_google_firestore_v1_Function_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.firestore.v1.Function.class, + com.google.firestore.v1.Function.Builder.class); + } + + // Construct using com.google.firestore.v1.Function.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + name_ = ""; + if (argsBuilder_ == null) { + args_ = java.util.Collections.emptyList(); + } else { + args_ = null; + argsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + internalGetMutableOptions().clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.firestore.v1.DocumentProto + .internal_static_google_firestore_v1_Function_descriptor; + } + + @java.lang.Override + public com.google.firestore.v1.Function getDefaultInstanceForType() { + return com.google.firestore.v1.Function.getDefaultInstance(); + } + + @java.lang.Override + public com.google.firestore.v1.Function build() { + com.google.firestore.v1.Function result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.firestore.v1.Function buildPartial() { + com.google.firestore.v1.Function result = new com.google.firestore.v1.Function(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields(com.google.firestore.v1.Function result) { + if (argsBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0)) { + args_ = java.util.Collections.unmodifiableList(args_); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.args_ = args_; + } else { + result.args_ = argsBuilder_.build(); + } + } + + private void buildPartial0(com.google.firestore.v1.Function result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.name_ = name_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.options_ = internalGetOptions().build(OptionsDefaultEntryHolder.defaultEntry); + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.firestore.v1.Function) { + return mergeFrom((com.google.firestore.v1.Function) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.firestore.v1.Function other) { + if (other == com.google.firestore.v1.Function.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (argsBuilder_ == null) { + if (!other.args_.isEmpty()) { + if (args_.isEmpty()) { + args_ = other.args_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureArgsIsMutable(); + args_.addAll(other.args_); + } + onChanged(); + } + } else { + if (!other.args_.isEmpty()) { + if (argsBuilder_.isEmpty()) { + argsBuilder_.dispose(); + argsBuilder_ = null; + args_ = other.args_; + bitField0_ = (bitField0_ & ~0x00000002); + argsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getArgsFieldBuilder() + : null; + } else { + argsBuilder_.addAllMessages(other.args_); + } + } + } + internalGetMutableOptions().mergeFrom(other.internalGetOptions()); + bitField0_ |= 0x00000004; + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + com.google.firestore.v1.Value m = + input.readMessage(com.google.firestore.v1.Value.parser(), extensionRegistry); + if (argsBuilder_ == null) { + ensureArgsIsMutable(); + args_.add(m); + } else { + argsBuilder_.addMessage(m); + } + break; + } // case 18 + case 26: + { + com.google.protobuf.MapEntry + options__ = + input.readMessage( + OptionsDefaultEntryHolder.defaultEntry.getParserForType(), + extensionRegistry); + internalGetMutableOptions() + .ensureBuilderMap() + .put(options__.getKey(), options__.getValue()); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * The name of the function to evaluate.
+     *
+     * **Requires:**
+     *
+     * * must be in snake case (lower case with underscore separator).
+     * 
+ * + * string name = 1; + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The name of the function to evaluate.
+     *
+     * **Requires:**
+     *
+     * * must be in snake case (lower case with underscore separator).
+     * 
+ * + * string name = 1; + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The name of the function to evaluate.
+     *
+     * **Requires:**
+     *
+     * * must be in snake case (lower case with underscore separator).
+     * 
+ * + * string name = 1; + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * The name of the function to evaluate.
+     *
+     * **Requires:**
+     *
+     * * must be in snake case (lower case with underscore separator).
+     * 
+ * + * string name = 1; + * + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * The name of the function to evaluate.
+     *
+     * **Requires:**
+     *
+     * * must be in snake case (lower case with underscore separator).
+     * 
+ * + * string name = 1; + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.util.List args_ = java.util.Collections.emptyList(); + + private void ensureArgsIsMutable() { + if (!((bitField0_ & 0x00000002) != 0)) { + args_ = new java.util.ArrayList(args_); + bitField0_ |= 0x00000002; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.firestore.v1.Value, + com.google.firestore.v1.Value.Builder, + com.google.firestore.v1.ValueOrBuilder> + argsBuilder_; + + /** + * + * + *
+     * Ordered list of arguments the given function expects.
+     * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + public java.util.List getArgsList() { + if (argsBuilder_ == null) { + return java.util.Collections.unmodifiableList(args_); + } else { + return argsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * Ordered list of arguments the given function expects.
+     * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + public int getArgsCount() { + if (argsBuilder_ == null) { + return args_.size(); + } else { + return argsBuilder_.getCount(); + } + } + /** + * + * + *
+     * Ordered list of arguments the given function expects.
+     * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + public com.google.firestore.v1.Value getArgs(int index) { + if (argsBuilder_ == null) { + return args_.get(index); + } else { + return argsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * Ordered list of arguments the given function expects.
+     * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + public Builder setArgs(int index, com.google.firestore.v1.Value value) { + if (argsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureArgsIsMutable(); + args_.set(index, value); + onChanged(); + } else { + argsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Ordered list of arguments the given function expects.
+     * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + public Builder setArgs(int index, com.google.firestore.v1.Value.Builder builderForValue) { + if (argsBuilder_ == null) { + ensureArgsIsMutable(); + args_.set(index, builderForValue.build()); + onChanged(); + } else { + argsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Ordered list of arguments the given function expects.
+     * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + public Builder addArgs(com.google.firestore.v1.Value value) { + if (argsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureArgsIsMutable(); + args_.add(value); + onChanged(); + } else { + argsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * Ordered list of arguments the given function expects.
+     * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + public Builder addArgs(int index, com.google.firestore.v1.Value value) { + if (argsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureArgsIsMutable(); + args_.add(index, value); + onChanged(); + } else { + argsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Ordered list of arguments the given function expects.
+     * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + public Builder addArgs(com.google.firestore.v1.Value.Builder builderForValue) { + if (argsBuilder_ == null) { + ensureArgsIsMutable(); + args_.add(builderForValue.build()); + onChanged(); + } else { + argsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Ordered list of arguments the given function expects.
+     * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + public Builder addArgs(int index, com.google.firestore.v1.Value.Builder builderForValue) { + if (argsBuilder_ == null) { + ensureArgsIsMutable(); + args_.add(index, builderForValue.build()); + onChanged(); + } else { + argsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Ordered list of arguments the given function expects.
+     * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + public Builder addAllArgs(java.lang.Iterable values) { + if (argsBuilder_ == null) { + ensureArgsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, args_); + onChanged(); + } else { + argsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * Ordered list of arguments the given function expects.
+     * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + public Builder clearArgs() { + if (argsBuilder_ == null) { + args_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + } else { + argsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Ordered list of arguments the given function expects.
+     * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + public Builder removeArgs(int index) { + if (argsBuilder_ == null) { + ensureArgsIsMutable(); + args_.remove(index); + onChanged(); + } else { + argsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * Ordered list of arguments the given function expects.
+     * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + public com.google.firestore.v1.Value.Builder getArgsBuilder(int index) { + return getArgsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * Ordered list of arguments the given function expects.
+     * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + public com.google.firestore.v1.ValueOrBuilder getArgsOrBuilder(int index) { + if (argsBuilder_ == null) { + return args_.get(index); + } else { + return argsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * Ordered list of arguments the given function expects.
+     * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + public java.util.List getArgsOrBuilderList() { + if (argsBuilder_ != null) { + return argsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(args_); + } + } + /** + * + * + *
+     * Ordered list of arguments the given function expects.
+     * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + public com.google.firestore.v1.Value.Builder addArgsBuilder() { + return getArgsFieldBuilder().addBuilder(com.google.firestore.v1.Value.getDefaultInstance()); + } + /** + * + * + *
+     * Ordered list of arguments the given function expects.
+     * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + public com.google.firestore.v1.Value.Builder addArgsBuilder(int index) { + return getArgsFieldBuilder() + .addBuilder(index, com.google.firestore.v1.Value.getDefaultInstance()); + } + /** + * + * + *
+     * Ordered list of arguments the given function expects.
+     * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + public java.util.List getArgsBuilderList() { + return getArgsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.firestore.v1.Value, + com.google.firestore.v1.Value.Builder, + com.google.firestore.v1.ValueOrBuilder> + getArgsFieldBuilder() { + if (argsBuilder_ == null) { + argsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.firestore.v1.Value, + com.google.firestore.v1.Value.Builder, + com.google.firestore.v1.ValueOrBuilder>( + args_, ((bitField0_ & 0x00000002) != 0), getParentForChildren(), isClean()); + args_ = null; + } + return argsBuilder_; + } + + private static final class OptionsConverter + implements com.google.protobuf.MapFieldBuilder.Converter< + java.lang.String, + com.google.firestore.v1.ValueOrBuilder, + com.google.firestore.v1.Value> { + @java.lang.Override + public com.google.firestore.v1.Value build(com.google.firestore.v1.ValueOrBuilder val) { + if (val instanceof com.google.firestore.v1.Value) { + return (com.google.firestore.v1.Value) val; + } + return ((com.google.firestore.v1.Value.Builder) val).build(); + } + + @java.lang.Override + public com.google.protobuf.MapEntry + defaultEntry() { + return OptionsDefaultEntryHolder.defaultEntry; + } + }; + + private static final OptionsConverter optionsConverter = new OptionsConverter(); + + private com.google.protobuf.MapFieldBuilder< + java.lang.String, + com.google.firestore.v1.ValueOrBuilder, + com.google.firestore.v1.Value, + com.google.firestore.v1.Value.Builder> + options_; + + private com.google.protobuf.MapFieldBuilder< + java.lang.String, + com.google.firestore.v1.ValueOrBuilder, + com.google.firestore.v1.Value, + com.google.firestore.v1.Value.Builder> + internalGetOptions() { + if (options_ == null) { + return new com.google.protobuf.MapFieldBuilder<>(optionsConverter); + } + return options_; + } + + private com.google.protobuf.MapFieldBuilder< + java.lang.String, + com.google.firestore.v1.ValueOrBuilder, + com.google.firestore.v1.Value, + com.google.firestore.v1.Value.Builder> + internalGetMutableOptions() { + if (options_ == null) { + options_ = new com.google.protobuf.MapFieldBuilder<>(optionsConverter); + } + bitField0_ |= 0x00000004; + onChanged(); + return options_; + } + + public int getOptionsCount() { + return internalGetOptions().ensureBuilderMap().size(); + } + /** + * + * + *
+     * Optional named arguments that certain functions may support.
+     * 
+ * + * map<string, .google.firestore.v1.Value> options = 3; + */ + @java.lang.Override + public boolean containsOptions(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetOptions().ensureBuilderMap().containsKey(key); + } + /** Use {@link #getOptionsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getOptions() { + return getOptionsMap(); + } + /** + * + * + *
+     * Optional named arguments that certain functions may support.
+     * 
+ * + * map<string, .google.firestore.v1.Value> options = 3; + */ + @java.lang.Override + public java.util.Map getOptionsMap() { + return internalGetOptions().getImmutableMap(); + } + /** + * + * + *
+     * Optional named arguments that certain functions may support.
+     * 
+ * + * map<string, .google.firestore.v1.Value> options = 3; + */ + @java.lang.Override + public /* nullable */ com.google.firestore.v1.Value getOptionsOrDefault( + java.lang.String key, + /* nullable */ + com.google.firestore.v1.Value defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = + internalGetMutableOptions().ensureBuilderMap(); + return map.containsKey(key) ? optionsConverter.build(map.get(key)) : defaultValue; + } + /** + * + * + *
+     * Optional named arguments that certain functions may support.
+     * 
+ * + * map<string, .google.firestore.v1.Value> options = 3; + */ + @java.lang.Override + public com.google.firestore.v1.Value getOptionsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = + internalGetMutableOptions().ensureBuilderMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return optionsConverter.build(map.get(key)); + } + + public Builder clearOptions() { + bitField0_ = (bitField0_ & ~0x00000004); + internalGetMutableOptions().clear(); + return this; + } + /** + * + * + *
+     * Optional named arguments that certain functions may support.
+     * 
+ * + * map<string, .google.firestore.v1.Value> options = 3; + */ + public Builder removeOptions(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + internalGetMutableOptions().ensureBuilderMap().remove(key); + return this; + } + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map getMutableOptions() { + bitField0_ |= 0x00000004; + return internalGetMutableOptions().ensureMessageMap(); + } + /** + * + * + *
+     * Optional named arguments that certain functions may support.
+     * 
+ * + * map<string, .google.firestore.v1.Value> options = 3; + */ + public Builder putOptions(java.lang.String key, com.google.firestore.v1.Value value) { + if (key == null) { + throw new NullPointerException("map key"); + } + if (value == null) { + throw new NullPointerException("map value"); + } + internalGetMutableOptions().ensureBuilderMap().put(key, value); + bitField0_ |= 0x00000004; + return this; + } + /** + * + * + *
+     * Optional named arguments that certain functions may support.
+     * 
+ * + * map<string, .google.firestore.v1.Value> options = 3; + */ + public Builder putAllOptions( + java.util.Map values) { + for (java.util.Map.Entry e : + values.entrySet()) { + if (e.getKey() == null || e.getValue() == null) { + throw new NullPointerException(); + } + } + internalGetMutableOptions().ensureBuilderMap().putAll(values); + bitField0_ |= 0x00000004; + return this; + } + /** + * + * + *
+     * Optional named arguments that certain functions may support.
+     * 
+ * + * map<string, .google.firestore.v1.Value> options = 3; + */ + public com.google.firestore.v1.Value.Builder putOptionsBuilderIfAbsent(java.lang.String key) { + java.util.Map builderMap = + internalGetMutableOptions().ensureBuilderMap(); + com.google.firestore.v1.ValueOrBuilder entry = builderMap.get(key); + if (entry == null) { + entry = com.google.firestore.v1.Value.newBuilder(); + builderMap.put(key, entry); + } + if (entry instanceof com.google.firestore.v1.Value) { + entry = ((com.google.firestore.v1.Value) entry).toBuilder(); + builderMap.put(key, entry); + } + return (com.google.firestore.v1.Value.Builder) entry; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.firestore.v1.Function) + } + + // @@protoc_insertion_point(class_scope:google.firestore.v1.Function) + private static final com.google.firestore.v1.Function DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.firestore.v1.Function(); + } + + public static com.google.firestore.v1.Function getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Function parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.firestore.v1.Function getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/FunctionOrBuilder.java b/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/FunctionOrBuilder.java new file mode 100644 index 000000000..e1ca51940 --- /dev/null +++ b/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/FunctionOrBuilder.java @@ -0,0 +1,168 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/firestore/v1/document.proto + +// Protobuf Java Version: 3.25.2 +package com.google.firestore.v1; + +public interface FunctionOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.firestore.v1.Function) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The name of the function to evaluate.
+   *
+   * **Requires:**
+   *
+   * * must be in snake case (lower case with underscore separator).
+   * 
+ * + * string name = 1; + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * The name of the function to evaluate.
+   *
+   * **Requires:**
+   *
+   * * must be in snake case (lower case with underscore separator).
+   * 
+ * + * string name = 1; + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * Ordered list of arguments the given function expects.
+   * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + java.util.List getArgsList(); + /** + * + * + *
+   * Ordered list of arguments the given function expects.
+   * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + com.google.firestore.v1.Value getArgs(int index); + /** + * + * + *
+   * Ordered list of arguments the given function expects.
+   * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + int getArgsCount(); + /** + * + * + *
+   * Ordered list of arguments the given function expects.
+   * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + java.util.List getArgsOrBuilderList(); + /** + * + * + *
+   * Ordered list of arguments the given function expects.
+   * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + com.google.firestore.v1.ValueOrBuilder getArgsOrBuilder(int index); + + /** + * + * + *
+   * Optional named arguments that certain functions may support.
+   * 
+ * + * map<string, .google.firestore.v1.Value> options = 3; + */ + int getOptionsCount(); + /** + * + * + *
+   * Optional named arguments that certain functions may support.
+   * 
+ * + * map<string, .google.firestore.v1.Value> options = 3; + */ + boolean containsOptions(java.lang.String key); + /** Use {@link #getOptionsMap()} instead. */ + @java.lang.Deprecated + java.util.Map getOptions(); + /** + * + * + *
+   * Optional named arguments that certain functions may support.
+   * 
+ * + * map<string, .google.firestore.v1.Value> options = 3; + */ + java.util.Map getOptionsMap(); + /** + * + * + *
+   * Optional named arguments that certain functions may support.
+   * 
+ * + * map<string, .google.firestore.v1.Value> options = 3; + */ + /* nullable */ + com.google.firestore.v1.Value getOptionsOrDefault( + java.lang.String key, + /* nullable */ + com.google.firestore.v1.Value defaultValue); + /** + * + * + *
+   * Optional named arguments that certain functions may support.
+   * 
+ * + * map<string, .google.firestore.v1.Value> options = 3; + */ + com.google.firestore.v1.Value getOptionsOrThrow(java.lang.String key); +} diff --git a/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/Pipeline.java b/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/Pipeline.java new file mode 100644 index 000000000..5be2143a0 --- /dev/null +++ b/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/Pipeline.java @@ -0,0 +1,2640 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/firestore/v1/document.proto + +// Protobuf Java Version: 3.25.2 +package com.google.firestore.v1; + +/** + * + * + *
+ * A Firestore query represented as an ordered list of operations / stages.
+ * 
+ * + * Protobuf type {@code google.firestore.v1.Pipeline} + */ +public final class Pipeline extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.firestore.v1.Pipeline) + PipelineOrBuilder { + private static final long serialVersionUID = 0L; + // Use Pipeline.newBuilder() to construct. + private Pipeline(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Pipeline() { + stages_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Pipeline(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.firestore.v1.DocumentProto + .internal_static_google_firestore_v1_Pipeline_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.firestore.v1.DocumentProto + .internal_static_google_firestore_v1_Pipeline_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.firestore.v1.Pipeline.class, com.google.firestore.v1.Pipeline.Builder.class); + } + + public interface StageOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.firestore.v1.Pipeline.Stage) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+     * The name of the stage to evaluate.
+     *
+     * **Requires:**
+     *
+     * * must be in snake case (lower case with underscore separator).
+     * 
+ * + * string name = 1; + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+     * The name of the stage to evaluate.
+     *
+     * **Requires:**
+     *
+     * * must be in snake case (lower case with underscore separator).
+     * 
+ * + * string name = 1; + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+     * Ordered list of arguments the given stage expects.
+     * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + java.util.List getArgsList(); + /** + * + * + *
+     * Ordered list of arguments the given stage expects.
+     * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + com.google.firestore.v1.Value getArgs(int index); + /** + * + * + *
+     * Ordered list of arguments the given stage expects.
+     * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + int getArgsCount(); + /** + * + * + *
+     * Ordered list of arguments the given stage expects.
+     * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + java.util.List getArgsOrBuilderList(); + /** + * + * + *
+     * Ordered list of arguments the given stage expects.
+     * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + com.google.firestore.v1.ValueOrBuilder getArgsOrBuilder(int index); + + /** + * + * + *
+     * Optional named arguments that certain functions may support.
+     * 
+ * + * map<string, .google.firestore.v1.Value> options = 3; + */ + int getOptionsCount(); + /** + * + * + *
+     * Optional named arguments that certain functions may support.
+     * 
+ * + * map<string, .google.firestore.v1.Value> options = 3; + */ + boolean containsOptions(java.lang.String key); + /** Use {@link #getOptionsMap()} instead. */ + @java.lang.Deprecated + java.util.Map getOptions(); + /** + * + * + *
+     * Optional named arguments that certain functions may support.
+     * 
+ * + * map<string, .google.firestore.v1.Value> options = 3; + */ + java.util.Map getOptionsMap(); + /** + * + * + *
+     * Optional named arguments that certain functions may support.
+     * 
+ * + * map<string, .google.firestore.v1.Value> options = 3; + */ + /* nullable */ + com.google.firestore.v1.Value getOptionsOrDefault( + java.lang.String key, + /* nullable */ + com.google.firestore.v1.Value defaultValue); + /** + * + * + *
+     * Optional named arguments that certain functions may support.
+     * 
+ * + * map<string, .google.firestore.v1.Value> options = 3; + */ + com.google.firestore.v1.Value getOptionsOrThrow(java.lang.String key); + } + /** + * + * + *
+   * A single operation within a pipeline.
+   *
+   * A stage is made up of a unique name, and a list of arguments. The exact
+   * number of arguments & types is dependent on the stage type.
+   *
+   * To give an example, the stage `filter(state = "MD")` would be encoded as:
+   *
+   * ```
+   * name: "filter"
+   * args {
+   *   function_value {
+   *     name: "eq"
+   *     args { field_reference_value: "state" }
+   *     args { string_value: "MD" }
+   *   }
+   * }
+   * ```
+   *
+   * See public documentation for the full list.
+   * 
+ * + * Protobuf type {@code google.firestore.v1.Pipeline.Stage} + */ + public static final class Stage extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.firestore.v1.Pipeline.Stage) + StageOrBuilder { + private static final long serialVersionUID = 0L; + // Use Stage.newBuilder() to construct. + private Stage(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Stage() { + name_ = ""; + args_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Stage(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.firestore.v1.DocumentProto + .internal_static_google_firestore_v1_Pipeline_Stage_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection( + int number) { + switch (number) { + case 3: + return internalGetOptions(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.firestore.v1.DocumentProto + .internal_static_google_firestore_v1_Pipeline_Stage_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.firestore.v1.Pipeline.Stage.class, + com.google.firestore.v1.Pipeline.Stage.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** + * + * + *
+     * The name of the stage to evaluate.
+     *
+     * **Requires:**
+     *
+     * * must be in snake case (lower case with underscore separator).
+     * 
+ * + * string name = 1; + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+     * The name of the stage to evaluate.
+     *
+     * **Requires:**
+     *
+     * * must be in snake case (lower case with underscore separator).
+     * 
+ * + * string name = 1; + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int ARGS_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private java.util.List args_; + /** + * + * + *
+     * Ordered list of arguments the given stage expects.
+     * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + @java.lang.Override + public java.util.List getArgsList() { + return args_; + } + /** + * + * + *
+     * Ordered list of arguments the given stage expects.
+     * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + @java.lang.Override + public java.util.List getArgsOrBuilderList() { + return args_; + } + /** + * + * + *
+     * Ordered list of arguments the given stage expects.
+     * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + @java.lang.Override + public int getArgsCount() { + return args_.size(); + } + /** + * + * + *
+     * Ordered list of arguments the given stage expects.
+     * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + @java.lang.Override + public com.google.firestore.v1.Value getArgs(int index) { + return args_.get(index); + } + /** + * + * + *
+     * Ordered list of arguments the given stage expects.
+     * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + @java.lang.Override + public com.google.firestore.v1.ValueOrBuilder getArgsOrBuilder(int index) { + return args_.get(index); + } + + public static final int OPTIONS_FIELD_NUMBER = 3; + + private static final class OptionsDefaultEntryHolder { + static final com.google.protobuf.MapEntry + defaultEntry = + com.google.protobuf.MapEntry + .newDefaultInstance( + com.google.firestore.v1.DocumentProto + .internal_static_google_firestore_v1_Pipeline_Stage_OptionsEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.MESSAGE, + com.google.firestore.v1.Value.getDefaultInstance()); + } + + @SuppressWarnings("serial") + private com.google.protobuf.MapField options_; + + private com.google.protobuf.MapField + internalGetOptions() { + if (options_ == null) { + return com.google.protobuf.MapField.emptyMapField(OptionsDefaultEntryHolder.defaultEntry); + } + return options_; + } + + public int getOptionsCount() { + return internalGetOptions().getMap().size(); + } + /** + * + * + *
+     * Optional named arguments that certain functions may support.
+     * 
+ * + * map<string, .google.firestore.v1.Value> options = 3; + */ + @java.lang.Override + public boolean containsOptions(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetOptions().getMap().containsKey(key); + } + /** Use {@link #getOptionsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getOptions() { + return getOptionsMap(); + } + /** + * + * + *
+     * Optional named arguments that certain functions may support.
+     * 
+ * + * map<string, .google.firestore.v1.Value> options = 3; + */ + @java.lang.Override + public java.util.Map getOptionsMap() { + return internalGetOptions().getMap(); + } + /** + * + * + *
+     * Optional named arguments that certain functions may support.
+     * 
+ * + * map<string, .google.firestore.v1.Value> options = 3; + */ + @java.lang.Override + public /* nullable */ com.google.firestore.v1.Value getOptionsOrDefault( + java.lang.String key, + /* nullable */ + com.google.firestore.v1.Value defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = + internalGetOptions().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+     * Optional named arguments that certain functions may support.
+     * 
+ * + * map<string, .google.firestore.v1.Value> options = 3; + */ + @java.lang.Override + public com.google.firestore.v1.Value getOptionsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = + internalGetOptions().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + for (int i = 0; i < args_.size(); i++) { + output.writeMessage(2, args_.get(i)); + } + com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + output, internalGetOptions(), OptionsDefaultEntryHolder.defaultEntry, 3); + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + for (int i = 0; i < args_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, args_.get(i)); + } + for (java.util.Map.Entry entry : + internalGetOptions().getMap().entrySet()) { + com.google.protobuf.MapEntry options__ = + OptionsDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, options__); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.firestore.v1.Pipeline.Stage)) { + return super.equals(obj); + } + com.google.firestore.v1.Pipeline.Stage other = (com.google.firestore.v1.Pipeline.Stage) obj; + + if (!getName().equals(other.getName())) return false; + if (!getArgsList().equals(other.getArgsList())) return false; + if (!internalGetOptions().equals(other.internalGetOptions())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + if (getArgsCount() > 0) { + hash = (37 * hash) + ARGS_FIELD_NUMBER; + hash = (53 * hash) + getArgsList().hashCode(); + } + if (!internalGetOptions().getMap().isEmpty()) { + hash = (37 * hash) + OPTIONS_FIELD_NUMBER; + hash = (53 * hash) + internalGetOptions().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.firestore.v1.Pipeline.Stage parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.firestore.v1.Pipeline.Stage parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.firestore.v1.Pipeline.Stage parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.firestore.v1.Pipeline.Stage parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.firestore.v1.Pipeline.Stage parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.firestore.v1.Pipeline.Stage parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.firestore.v1.Pipeline.Stage parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.firestore.v1.Pipeline.Stage parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.firestore.v1.Pipeline.Stage parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.firestore.v1.Pipeline.Stage parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.firestore.v1.Pipeline.Stage parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.firestore.v1.Pipeline.Stage parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.firestore.v1.Pipeline.Stage prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+     * A single operation within a pipeline.
+     *
+     * A stage is made up of a unique name, and a list of arguments. The exact
+     * number of arguments & types is dependent on the stage type.
+     *
+     * To give an example, the stage `filter(state = "MD")` would be encoded as:
+     *
+     * ```
+     * name: "filter"
+     * args {
+     *   function_value {
+     *     name: "eq"
+     *     args { field_reference_value: "state" }
+     *     args { string_value: "MD" }
+     *   }
+     * }
+     * ```
+     *
+     * See public documentation for the full list.
+     * 
+ * + * Protobuf type {@code google.firestore.v1.Pipeline.Stage} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.firestore.v1.Pipeline.Stage) + com.google.firestore.v1.Pipeline.StageOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.firestore.v1.DocumentProto + .internal_static_google_firestore_v1_Pipeline_Stage_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection( + int number) { + switch (number) { + case 3: + return internalGetOptions(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMutableMapFieldReflection( + int number) { + switch (number) { + case 3: + return internalGetMutableOptions(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.firestore.v1.DocumentProto + .internal_static_google_firestore_v1_Pipeline_Stage_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.firestore.v1.Pipeline.Stage.class, + com.google.firestore.v1.Pipeline.Stage.Builder.class); + } + + // Construct using com.google.firestore.v1.Pipeline.Stage.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + name_ = ""; + if (argsBuilder_ == null) { + args_ = java.util.Collections.emptyList(); + } else { + args_ = null; + argsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + internalGetMutableOptions().clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.firestore.v1.DocumentProto + .internal_static_google_firestore_v1_Pipeline_Stage_descriptor; + } + + @java.lang.Override + public com.google.firestore.v1.Pipeline.Stage getDefaultInstanceForType() { + return com.google.firestore.v1.Pipeline.Stage.getDefaultInstance(); + } + + @java.lang.Override + public com.google.firestore.v1.Pipeline.Stage build() { + com.google.firestore.v1.Pipeline.Stage result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.firestore.v1.Pipeline.Stage buildPartial() { + com.google.firestore.v1.Pipeline.Stage result = + new com.google.firestore.v1.Pipeline.Stage(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields(com.google.firestore.v1.Pipeline.Stage result) { + if (argsBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0)) { + args_ = java.util.Collections.unmodifiableList(args_); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.args_ = args_; + } else { + result.args_ = argsBuilder_.build(); + } + } + + private void buildPartial0(com.google.firestore.v1.Pipeline.Stage result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.name_ = name_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.options_ = internalGetOptions().build(OptionsDefaultEntryHolder.defaultEntry); + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.firestore.v1.Pipeline.Stage) { + return mergeFrom((com.google.firestore.v1.Pipeline.Stage) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.firestore.v1.Pipeline.Stage other) { + if (other == com.google.firestore.v1.Pipeline.Stage.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (argsBuilder_ == null) { + if (!other.args_.isEmpty()) { + if (args_.isEmpty()) { + args_ = other.args_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureArgsIsMutable(); + args_.addAll(other.args_); + } + onChanged(); + } + } else { + if (!other.args_.isEmpty()) { + if (argsBuilder_.isEmpty()) { + argsBuilder_.dispose(); + argsBuilder_ = null; + args_ = other.args_; + bitField0_ = (bitField0_ & ~0x00000002); + argsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getArgsFieldBuilder() + : null; + } else { + argsBuilder_.addAllMessages(other.args_); + } + } + } + internalGetMutableOptions().mergeFrom(other.internalGetOptions()); + bitField0_ |= 0x00000004; + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + com.google.firestore.v1.Value m = + input.readMessage(com.google.firestore.v1.Value.parser(), extensionRegistry); + if (argsBuilder_ == null) { + ensureArgsIsMutable(); + args_.add(m); + } else { + argsBuilder_.addMessage(m); + } + break; + } // case 18 + case 26: + { + com.google.protobuf.MapEntry + options__ = + input.readMessage( + OptionsDefaultEntryHolder.defaultEntry.getParserForType(), + extensionRegistry); + internalGetMutableOptions() + .ensureBuilderMap() + .put(options__.getKey(), options__.getValue()); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + * + * + *
+       * The name of the stage to evaluate.
+       *
+       * **Requires:**
+       *
+       * * must be in snake case (lower case with underscore separator).
+       * 
+ * + * string name = 1; + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+       * The name of the stage to evaluate.
+       *
+       * **Requires:**
+       *
+       * * must be in snake case (lower case with underscore separator).
+       * 
+ * + * string name = 1; + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+       * The name of the stage to evaluate.
+       *
+       * **Requires:**
+       *
+       * * must be in snake case (lower case with underscore separator).
+       * 
+ * + * string name = 1; + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+       * The name of the stage to evaluate.
+       *
+       * **Requires:**
+       *
+       * * must be in snake case (lower case with underscore separator).
+       * 
+ * + * string name = 1; + * + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+       * The name of the stage to evaluate.
+       *
+       * **Requires:**
+       *
+       * * must be in snake case (lower case with underscore separator).
+       * 
+ * + * string name = 1; + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.util.List args_ = + java.util.Collections.emptyList(); + + private void ensureArgsIsMutable() { + if (!((bitField0_ & 0x00000002) != 0)) { + args_ = new java.util.ArrayList(args_); + bitField0_ |= 0x00000002; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.firestore.v1.Value, + com.google.firestore.v1.Value.Builder, + com.google.firestore.v1.ValueOrBuilder> + argsBuilder_; + + /** + * + * + *
+       * Ordered list of arguments the given stage expects.
+       * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + public java.util.List getArgsList() { + if (argsBuilder_ == null) { + return java.util.Collections.unmodifiableList(args_); + } else { + return argsBuilder_.getMessageList(); + } + } + /** + * + * + *
+       * Ordered list of arguments the given stage expects.
+       * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + public int getArgsCount() { + if (argsBuilder_ == null) { + return args_.size(); + } else { + return argsBuilder_.getCount(); + } + } + /** + * + * + *
+       * Ordered list of arguments the given stage expects.
+       * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + public com.google.firestore.v1.Value getArgs(int index) { + if (argsBuilder_ == null) { + return args_.get(index); + } else { + return argsBuilder_.getMessage(index); + } + } + /** + * + * + *
+       * Ordered list of arguments the given stage expects.
+       * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + public Builder setArgs(int index, com.google.firestore.v1.Value value) { + if (argsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureArgsIsMutable(); + args_.set(index, value); + onChanged(); + } else { + argsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+       * Ordered list of arguments the given stage expects.
+       * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + public Builder setArgs(int index, com.google.firestore.v1.Value.Builder builderForValue) { + if (argsBuilder_ == null) { + ensureArgsIsMutable(); + args_.set(index, builderForValue.build()); + onChanged(); + } else { + argsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+       * Ordered list of arguments the given stage expects.
+       * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + public Builder addArgs(com.google.firestore.v1.Value value) { + if (argsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureArgsIsMutable(); + args_.add(value); + onChanged(); + } else { + argsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+       * Ordered list of arguments the given stage expects.
+       * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + public Builder addArgs(int index, com.google.firestore.v1.Value value) { + if (argsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureArgsIsMutable(); + args_.add(index, value); + onChanged(); + } else { + argsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+       * Ordered list of arguments the given stage expects.
+       * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + public Builder addArgs(com.google.firestore.v1.Value.Builder builderForValue) { + if (argsBuilder_ == null) { + ensureArgsIsMutable(); + args_.add(builderForValue.build()); + onChanged(); + } else { + argsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+       * Ordered list of arguments the given stage expects.
+       * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + public Builder addArgs(int index, com.google.firestore.v1.Value.Builder builderForValue) { + if (argsBuilder_ == null) { + ensureArgsIsMutable(); + args_.add(index, builderForValue.build()); + onChanged(); + } else { + argsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+       * Ordered list of arguments the given stage expects.
+       * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + public Builder addAllArgs( + java.lang.Iterable values) { + if (argsBuilder_ == null) { + ensureArgsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, args_); + onChanged(); + } else { + argsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+       * Ordered list of arguments the given stage expects.
+       * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + public Builder clearArgs() { + if (argsBuilder_ == null) { + args_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + } else { + argsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+       * Ordered list of arguments the given stage expects.
+       * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + public Builder removeArgs(int index) { + if (argsBuilder_ == null) { + ensureArgsIsMutable(); + args_.remove(index); + onChanged(); + } else { + argsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+       * Ordered list of arguments the given stage expects.
+       * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + public com.google.firestore.v1.Value.Builder getArgsBuilder(int index) { + return getArgsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+       * Ordered list of arguments the given stage expects.
+       * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + public com.google.firestore.v1.ValueOrBuilder getArgsOrBuilder(int index) { + if (argsBuilder_ == null) { + return args_.get(index); + } else { + return argsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+       * Ordered list of arguments the given stage expects.
+       * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + public java.util.List + getArgsOrBuilderList() { + if (argsBuilder_ != null) { + return argsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(args_); + } + } + /** + * + * + *
+       * Ordered list of arguments the given stage expects.
+       * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + public com.google.firestore.v1.Value.Builder addArgsBuilder() { + return getArgsFieldBuilder().addBuilder(com.google.firestore.v1.Value.getDefaultInstance()); + } + /** + * + * + *
+       * Ordered list of arguments the given stage expects.
+       * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + public com.google.firestore.v1.Value.Builder addArgsBuilder(int index) { + return getArgsFieldBuilder() + .addBuilder(index, com.google.firestore.v1.Value.getDefaultInstance()); + } + /** + * + * + *
+       * Ordered list of arguments the given stage expects.
+       * 
+ * + * repeated .google.firestore.v1.Value args = 2; + */ + public java.util.List getArgsBuilderList() { + return getArgsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.firestore.v1.Value, + com.google.firestore.v1.Value.Builder, + com.google.firestore.v1.ValueOrBuilder> + getArgsFieldBuilder() { + if (argsBuilder_ == null) { + argsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.firestore.v1.Value, + com.google.firestore.v1.Value.Builder, + com.google.firestore.v1.ValueOrBuilder>( + args_, ((bitField0_ & 0x00000002) != 0), getParentForChildren(), isClean()); + args_ = null; + } + return argsBuilder_; + } + + private static final class OptionsConverter + implements com.google.protobuf.MapFieldBuilder.Converter< + java.lang.String, + com.google.firestore.v1.ValueOrBuilder, + com.google.firestore.v1.Value> { + @java.lang.Override + public com.google.firestore.v1.Value build(com.google.firestore.v1.ValueOrBuilder val) { + if (val instanceof com.google.firestore.v1.Value) { + return (com.google.firestore.v1.Value) val; + } + return ((com.google.firestore.v1.Value.Builder) val).build(); + } + + @java.lang.Override + public com.google.protobuf.MapEntry + defaultEntry() { + return OptionsDefaultEntryHolder.defaultEntry; + } + }; + + private static final OptionsConverter optionsConverter = new OptionsConverter(); + + private com.google.protobuf.MapFieldBuilder< + java.lang.String, + com.google.firestore.v1.ValueOrBuilder, + com.google.firestore.v1.Value, + com.google.firestore.v1.Value.Builder> + options_; + + private com.google.protobuf.MapFieldBuilder< + java.lang.String, + com.google.firestore.v1.ValueOrBuilder, + com.google.firestore.v1.Value, + com.google.firestore.v1.Value.Builder> + internalGetOptions() { + if (options_ == null) { + return new com.google.protobuf.MapFieldBuilder<>(optionsConverter); + } + return options_; + } + + private com.google.protobuf.MapFieldBuilder< + java.lang.String, + com.google.firestore.v1.ValueOrBuilder, + com.google.firestore.v1.Value, + com.google.firestore.v1.Value.Builder> + internalGetMutableOptions() { + if (options_ == null) { + options_ = new com.google.protobuf.MapFieldBuilder<>(optionsConverter); + } + bitField0_ |= 0x00000004; + onChanged(); + return options_; + } + + public int getOptionsCount() { + return internalGetOptions().ensureBuilderMap().size(); + } + /** + * + * + *
+       * Optional named arguments that certain functions may support.
+       * 
+ * + * map<string, .google.firestore.v1.Value> options = 3; + */ + @java.lang.Override + public boolean containsOptions(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetOptions().ensureBuilderMap().containsKey(key); + } + /** Use {@link #getOptionsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getOptions() { + return getOptionsMap(); + } + /** + * + * + *
+       * Optional named arguments that certain functions may support.
+       * 
+ * + * map<string, .google.firestore.v1.Value> options = 3; + */ + @java.lang.Override + public java.util.Map getOptionsMap() { + return internalGetOptions().getImmutableMap(); + } + /** + * + * + *
+       * Optional named arguments that certain functions may support.
+       * 
+ * + * map<string, .google.firestore.v1.Value> options = 3; + */ + @java.lang.Override + public /* nullable */ com.google.firestore.v1.Value getOptionsOrDefault( + java.lang.String key, + /* nullable */ + com.google.firestore.v1.Value defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = + internalGetMutableOptions().ensureBuilderMap(); + return map.containsKey(key) ? optionsConverter.build(map.get(key)) : defaultValue; + } + /** + * + * + *
+       * Optional named arguments that certain functions may support.
+       * 
+ * + * map<string, .google.firestore.v1.Value> options = 3; + */ + @java.lang.Override + public com.google.firestore.v1.Value getOptionsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = + internalGetMutableOptions().ensureBuilderMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return optionsConverter.build(map.get(key)); + } + + public Builder clearOptions() { + bitField0_ = (bitField0_ & ~0x00000004); + internalGetMutableOptions().clear(); + return this; + } + /** + * + * + *
+       * Optional named arguments that certain functions may support.
+       * 
+ * + * map<string, .google.firestore.v1.Value> options = 3; + */ + public Builder removeOptions(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + internalGetMutableOptions().ensureBuilderMap().remove(key); + return this; + } + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map getMutableOptions() { + bitField0_ |= 0x00000004; + return internalGetMutableOptions().ensureMessageMap(); + } + /** + * + * + *
+       * Optional named arguments that certain functions may support.
+       * 
+ * + * map<string, .google.firestore.v1.Value> options = 3; + */ + public Builder putOptions(java.lang.String key, com.google.firestore.v1.Value value) { + if (key == null) { + throw new NullPointerException("map key"); + } + if (value == null) { + throw new NullPointerException("map value"); + } + internalGetMutableOptions().ensureBuilderMap().put(key, value); + bitField0_ |= 0x00000004; + return this; + } + /** + * + * + *
+       * Optional named arguments that certain functions may support.
+       * 
+ * + * map<string, .google.firestore.v1.Value> options = 3; + */ + public Builder putAllOptions( + java.util.Map values) { + for (java.util.Map.Entry e : + values.entrySet()) { + if (e.getKey() == null || e.getValue() == null) { + throw new NullPointerException(); + } + } + internalGetMutableOptions().ensureBuilderMap().putAll(values); + bitField0_ |= 0x00000004; + return this; + } + /** + * + * + *
+       * Optional named arguments that certain functions may support.
+       * 
+ * + * map<string, .google.firestore.v1.Value> options = 3; + */ + public com.google.firestore.v1.Value.Builder putOptionsBuilderIfAbsent(java.lang.String key) { + java.util.Map builderMap = + internalGetMutableOptions().ensureBuilderMap(); + com.google.firestore.v1.ValueOrBuilder entry = builderMap.get(key); + if (entry == null) { + entry = com.google.firestore.v1.Value.newBuilder(); + builderMap.put(key, entry); + } + if (entry instanceof com.google.firestore.v1.Value) { + entry = ((com.google.firestore.v1.Value) entry).toBuilder(); + builderMap.put(key, entry); + } + return (com.google.firestore.v1.Value.Builder) entry; + } + + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.firestore.v1.Pipeline.Stage) + } + + // @@protoc_insertion_point(class_scope:google.firestore.v1.Pipeline.Stage) + private static final com.google.firestore.v1.Pipeline.Stage DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.firestore.v1.Pipeline.Stage(); + } + + public static com.google.firestore.v1.Pipeline.Stage getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Stage parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException() + .setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.firestore.v1.Pipeline.Stage getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public static final int STAGES_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private java.util.List stages_; + /** + * + * + *
+   * Ordered list of stages to evaluate.
+   * 
+ * + * repeated .google.firestore.v1.Pipeline.Stage stages = 1; + */ + @java.lang.Override + public java.util.List getStagesList() { + return stages_; + } + /** + * + * + *
+   * Ordered list of stages to evaluate.
+   * 
+ * + * repeated .google.firestore.v1.Pipeline.Stage stages = 1; + */ + @java.lang.Override + public java.util.List + getStagesOrBuilderList() { + return stages_; + } + /** + * + * + *
+   * Ordered list of stages to evaluate.
+   * 
+ * + * repeated .google.firestore.v1.Pipeline.Stage stages = 1; + */ + @java.lang.Override + public int getStagesCount() { + return stages_.size(); + } + /** + * + * + *
+   * Ordered list of stages to evaluate.
+   * 
+ * + * repeated .google.firestore.v1.Pipeline.Stage stages = 1; + */ + @java.lang.Override + public com.google.firestore.v1.Pipeline.Stage getStages(int index) { + return stages_.get(index); + } + /** + * + * + *
+   * Ordered list of stages to evaluate.
+   * 
+ * + * repeated .google.firestore.v1.Pipeline.Stage stages = 1; + */ + @java.lang.Override + public com.google.firestore.v1.Pipeline.StageOrBuilder getStagesOrBuilder(int index) { + return stages_.get(index); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < stages_.size(); i++) { + output.writeMessage(1, stages_.get(i)); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < stages_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, stages_.get(i)); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.firestore.v1.Pipeline)) { + return super.equals(obj); + } + com.google.firestore.v1.Pipeline other = (com.google.firestore.v1.Pipeline) obj; + + if (!getStagesList().equals(other.getStagesList())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getStagesCount() > 0) { + hash = (37 * hash) + STAGES_FIELD_NUMBER; + hash = (53 * hash) + getStagesList().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.firestore.v1.Pipeline parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.firestore.v1.Pipeline parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.firestore.v1.Pipeline parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.firestore.v1.Pipeline parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.firestore.v1.Pipeline parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.firestore.v1.Pipeline parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.firestore.v1.Pipeline parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.firestore.v1.Pipeline parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.firestore.v1.Pipeline parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.firestore.v1.Pipeline parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.firestore.v1.Pipeline parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.firestore.v1.Pipeline parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.firestore.v1.Pipeline prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * A Firestore query represented as an ordered list of operations / stages.
+   * 
+ * + * Protobuf type {@code google.firestore.v1.Pipeline} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.firestore.v1.Pipeline) + com.google.firestore.v1.PipelineOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.firestore.v1.DocumentProto + .internal_static_google_firestore_v1_Pipeline_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.firestore.v1.DocumentProto + .internal_static_google_firestore_v1_Pipeline_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.firestore.v1.Pipeline.class, + com.google.firestore.v1.Pipeline.Builder.class); + } + + // Construct using com.google.firestore.v1.Pipeline.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + if (stagesBuilder_ == null) { + stages_ = java.util.Collections.emptyList(); + } else { + stages_ = null; + stagesBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.firestore.v1.DocumentProto + .internal_static_google_firestore_v1_Pipeline_descriptor; + } + + @java.lang.Override + public com.google.firestore.v1.Pipeline getDefaultInstanceForType() { + return com.google.firestore.v1.Pipeline.getDefaultInstance(); + } + + @java.lang.Override + public com.google.firestore.v1.Pipeline build() { + com.google.firestore.v1.Pipeline result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.firestore.v1.Pipeline buildPartial() { + com.google.firestore.v1.Pipeline result = new com.google.firestore.v1.Pipeline(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields(com.google.firestore.v1.Pipeline result) { + if (stagesBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + stages_ = java.util.Collections.unmodifiableList(stages_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.stages_ = stages_; + } else { + result.stages_ = stagesBuilder_.build(); + } + } + + private void buildPartial0(com.google.firestore.v1.Pipeline result) { + int from_bitField0_ = bitField0_; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.firestore.v1.Pipeline) { + return mergeFrom((com.google.firestore.v1.Pipeline) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.firestore.v1.Pipeline other) { + if (other == com.google.firestore.v1.Pipeline.getDefaultInstance()) return this; + if (stagesBuilder_ == null) { + if (!other.stages_.isEmpty()) { + if (stages_.isEmpty()) { + stages_ = other.stages_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureStagesIsMutable(); + stages_.addAll(other.stages_); + } + onChanged(); + } + } else { + if (!other.stages_.isEmpty()) { + if (stagesBuilder_.isEmpty()) { + stagesBuilder_.dispose(); + stagesBuilder_ = null; + stages_ = other.stages_; + bitField0_ = (bitField0_ & ~0x00000001); + stagesBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getStagesFieldBuilder() + : null; + } else { + stagesBuilder_.addAllMessages(other.stages_); + } + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.firestore.v1.Pipeline.Stage m = + input.readMessage( + com.google.firestore.v1.Pipeline.Stage.parser(), extensionRegistry); + if (stagesBuilder_ == null) { + ensureStagesIsMutable(); + stages_.add(m); + } else { + stagesBuilder_.addMessage(m); + } + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.util.List stages_ = + java.util.Collections.emptyList(); + + private void ensureStagesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + stages_ = new java.util.ArrayList(stages_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.firestore.v1.Pipeline.Stage, + com.google.firestore.v1.Pipeline.Stage.Builder, + com.google.firestore.v1.Pipeline.StageOrBuilder> + stagesBuilder_; + + /** + * + * + *
+     * Ordered list of stages to evaluate.
+     * 
+ * + * repeated .google.firestore.v1.Pipeline.Stage stages = 1; + */ + public java.util.List getStagesList() { + if (stagesBuilder_ == null) { + return java.util.Collections.unmodifiableList(stages_); + } else { + return stagesBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * Ordered list of stages to evaluate.
+     * 
+ * + * repeated .google.firestore.v1.Pipeline.Stage stages = 1; + */ + public int getStagesCount() { + if (stagesBuilder_ == null) { + return stages_.size(); + } else { + return stagesBuilder_.getCount(); + } + } + /** + * + * + *
+     * Ordered list of stages to evaluate.
+     * 
+ * + * repeated .google.firestore.v1.Pipeline.Stage stages = 1; + */ + public com.google.firestore.v1.Pipeline.Stage getStages(int index) { + if (stagesBuilder_ == null) { + return stages_.get(index); + } else { + return stagesBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * Ordered list of stages to evaluate.
+     * 
+ * + * repeated .google.firestore.v1.Pipeline.Stage stages = 1; + */ + public Builder setStages(int index, com.google.firestore.v1.Pipeline.Stage value) { + if (stagesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureStagesIsMutable(); + stages_.set(index, value); + onChanged(); + } else { + stagesBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Ordered list of stages to evaluate.
+     * 
+ * + * repeated .google.firestore.v1.Pipeline.Stage stages = 1; + */ + public Builder setStages( + int index, com.google.firestore.v1.Pipeline.Stage.Builder builderForValue) { + if (stagesBuilder_ == null) { + ensureStagesIsMutable(); + stages_.set(index, builderForValue.build()); + onChanged(); + } else { + stagesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Ordered list of stages to evaluate.
+     * 
+ * + * repeated .google.firestore.v1.Pipeline.Stage stages = 1; + */ + public Builder addStages(com.google.firestore.v1.Pipeline.Stage value) { + if (stagesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureStagesIsMutable(); + stages_.add(value); + onChanged(); + } else { + stagesBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * Ordered list of stages to evaluate.
+     * 
+ * + * repeated .google.firestore.v1.Pipeline.Stage stages = 1; + */ + public Builder addStages(int index, com.google.firestore.v1.Pipeline.Stage value) { + if (stagesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureStagesIsMutable(); + stages_.add(index, value); + onChanged(); + } else { + stagesBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Ordered list of stages to evaluate.
+     * 
+ * + * repeated .google.firestore.v1.Pipeline.Stage stages = 1; + */ + public Builder addStages(com.google.firestore.v1.Pipeline.Stage.Builder builderForValue) { + if (stagesBuilder_ == null) { + ensureStagesIsMutable(); + stages_.add(builderForValue.build()); + onChanged(); + } else { + stagesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Ordered list of stages to evaluate.
+     * 
+ * + * repeated .google.firestore.v1.Pipeline.Stage stages = 1; + */ + public Builder addStages( + int index, com.google.firestore.v1.Pipeline.Stage.Builder builderForValue) { + if (stagesBuilder_ == null) { + ensureStagesIsMutable(); + stages_.add(index, builderForValue.build()); + onChanged(); + } else { + stagesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Ordered list of stages to evaluate.
+     * 
+ * + * repeated .google.firestore.v1.Pipeline.Stage stages = 1; + */ + public Builder addAllStages( + java.lang.Iterable values) { + if (stagesBuilder_ == null) { + ensureStagesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, stages_); + onChanged(); + } else { + stagesBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * Ordered list of stages to evaluate.
+     * 
+ * + * repeated .google.firestore.v1.Pipeline.Stage stages = 1; + */ + public Builder clearStages() { + if (stagesBuilder_ == null) { + stages_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + stagesBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Ordered list of stages to evaluate.
+     * 
+ * + * repeated .google.firestore.v1.Pipeline.Stage stages = 1; + */ + public Builder removeStages(int index) { + if (stagesBuilder_ == null) { + ensureStagesIsMutable(); + stages_.remove(index); + onChanged(); + } else { + stagesBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * Ordered list of stages to evaluate.
+     * 
+ * + * repeated .google.firestore.v1.Pipeline.Stage stages = 1; + */ + public com.google.firestore.v1.Pipeline.Stage.Builder getStagesBuilder(int index) { + return getStagesFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * Ordered list of stages to evaluate.
+     * 
+ * + * repeated .google.firestore.v1.Pipeline.Stage stages = 1; + */ + public com.google.firestore.v1.Pipeline.StageOrBuilder getStagesOrBuilder(int index) { + if (stagesBuilder_ == null) { + return stages_.get(index); + } else { + return stagesBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * Ordered list of stages to evaluate.
+     * 
+ * + * repeated .google.firestore.v1.Pipeline.Stage stages = 1; + */ + public java.util.List + getStagesOrBuilderList() { + if (stagesBuilder_ != null) { + return stagesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(stages_); + } + } + /** + * + * + *
+     * Ordered list of stages to evaluate.
+     * 
+ * + * repeated .google.firestore.v1.Pipeline.Stage stages = 1; + */ + public com.google.firestore.v1.Pipeline.Stage.Builder addStagesBuilder() { + return getStagesFieldBuilder() + .addBuilder(com.google.firestore.v1.Pipeline.Stage.getDefaultInstance()); + } + /** + * + * + *
+     * Ordered list of stages to evaluate.
+     * 
+ * + * repeated .google.firestore.v1.Pipeline.Stage stages = 1; + */ + public com.google.firestore.v1.Pipeline.Stage.Builder addStagesBuilder(int index) { + return getStagesFieldBuilder() + .addBuilder(index, com.google.firestore.v1.Pipeline.Stage.getDefaultInstance()); + } + /** + * + * + *
+     * Ordered list of stages to evaluate.
+     * 
+ * + * repeated .google.firestore.v1.Pipeline.Stage stages = 1; + */ + public java.util.List getStagesBuilderList() { + return getStagesFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.firestore.v1.Pipeline.Stage, + com.google.firestore.v1.Pipeline.Stage.Builder, + com.google.firestore.v1.Pipeline.StageOrBuilder> + getStagesFieldBuilder() { + if (stagesBuilder_ == null) { + stagesBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.firestore.v1.Pipeline.Stage, + com.google.firestore.v1.Pipeline.Stage.Builder, + com.google.firestore.v1.Pipeline.StageOrBuilder>( + stages_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + stages_ = null; + } + return stagesBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.firestore.v1.Pipeline) + } + + // @@protoc_insertion_point(class_scope:google.firestore.v1.Pipeline) + private static final com.google.firestore.v1.Pipeline DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.firestore.v1.Pipeline(); + } + + public static com.google.firestore.v1.Pipeline getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Pipeline parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.firestore.v1.Pipeline getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/PipelineOrBuilder.java b/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/PipelineOrBuilder.java new file mode 100644 index 000000000..3373b5e73 --- /dev/null +++ b/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/PipelineOrBuilder.java @@ -0,0 +1,78 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/firestore/v1/document.proto + +// Protobuf Java Version: 3.25.2 +package com.google.firestore.v1; + +public interface PipelineOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.firestore.v1.Pipeline) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Ordered list of stages to evaluate.
+   * 
+ * + * repeated .google.firestore.v1.Pipeline.Stage stages = 1; + */ + java.util.List getStagesList(); + /** + * + * + *
+   * Ordered list of stages to evaluate.
+   * 
+ * + * repeated .google.firestore.v1.Pipeline.Stage stages = 1; + */ + com.google.firestore.v1.Pipeline.Stage getStages(int index); + /** + * + * + *
+   * Ordered list of stages to evaluate.
+   * 
+ * + * repeated .google.firestore.v1.Pipeline.Stage stages = 1; + */ + int getStagesCount(); + /** + * + * + *
+   * Ordered list of stages to evaluate.
+   * 
+ * + * repeated .google.firestore.v1.Pipeline.Stage stages = 1; + */ + java.util.List + getStagesOrBuilderList(); + /** + * + * + *
+   * Ordered list of stages to evaluate.
+   * 
+ * + * repeated .google.firestore.v1.Pipeline.Stage stages = 1; + */ + com.google.firestore.v1.Pipeline.StageOrBuilder getStagesOrBuilder(int index); +} diff --git a/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/PipelineProto.java b/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/PipelineProto.java new file mode 100644 index 000000000..816d3fe3f --- /dev/null +++ b/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/PipelineProto.java @@ -0,0 +1,87 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/firestore/v1/pipeline.proto + +// Protobuf Java Version: 3.25.2 +package com.google.firestore.v1; + +public final class PipelineProto { + private PipelineProto() {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); + } + + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_firestore_v1_StructuredPipeline_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_firestore_v1_StructuredPipeline_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_firestore_v1_StructuredPipeline_OptionsEntry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_firestore_v1_StructuredPipeline_OptionsEntry_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + return descriptor; + } + + private static com.google.protobuf.Descriptors.FileDescriptor descriptor; + + static { + java.lang.String[] descriptorData = { + "\n\"google/firestore/v1/pipeline.proto\022\023go" + + "ogle.firestore.v1\032\"google/firestore/v1/d" + + "ocument.proto\"\330\001\n\022StructuredPipeline\022/\n\010" + + "pipeline\030\001 \001(\0132\035.google.firestore.v1.Pip" + + "eline\022E\n\007options\030\002 \003(\01324.google.firestor" + + "e.v1.StructuredPipeline.OptionsEntry\032J\n\014" + + "OptionsEntry\022\013\n\003key\030\001 \001(\t\022)\n\005value\030\002 \001(\013" + + "2\032.google.firestore.v1.Value:\0028\001B\210\001\n\027com" + + ".google.firestore.v1B\rPipelineProtoP\001\242\002\004" + + "GCFS\252\002\031Google.Cloud.Firestore.V1\312\002\031Googl" + + "e\\Cloud\\Firestore\\V1\352\002\034Google::Cloud::Fi" + + "restore::V1b\006proto3" + }; + descriptor = + com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( + descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.firestore.v1.DocumentProto.getDescriptor(), + }); + internal_static_google_firestore_v1_StructuredPipeline_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_google_firestore_v1_StructuredPipeline_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_firestore_v1_StructuredPipeline_descriptor, + new java.lang.String[] { + "Pipeline", "Options", + }); + internal_static_google_firestore_v1_StructuredPipeline_OptionsEntry_descriptor = + internal_static_google_firestore_v1_StructuredPipeline_descriptor.getNestedTypes().get(0); + internal_static_google_firestore_v1_StructuredPipeline_OptionsEntry_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_firestore_v1_StructuredPipeline_OptionsEntry_descriptor, + new java.lang.String[] { + "Key", "Value", + }); + com.google.firestore.v1.DocumentProto.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/PlanSummary.java b/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/PlanSummary.java index 0c7bf4202..43bafcd6f 100644 --- a/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/PlanSummary.java +++ b/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/PlanSummary.java @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/firestore/v1/query_profile.proto -// Protobuf Java Version: 3.25.3 +// Protobuf Java Version: 3.25.2 package com.google.firestore.v1; /** diff --git a/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/PlanSummaryOrBuilder.java b/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/PlanSummaryOrBuilder.java index 9bdf339a9..4f3c0d8f3 100644 --- a/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/PlanSummaryOrBuilder.java +++ b/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/PlanSummaryOrBuilder.java @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/firestore/v1/query_profile.proto -// Protobuf Java Version: 3.25.3 +// Protobuf Java Version: 3.25.2 package com.google.firestore.v1; public interface PlanSummaryOrBuilder diff --git a/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/QueryProfileProto.java b/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/QueryProfileProto.java index a58b1aa00..e1195e5d7 100644 --- a/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/QueryProfileProto.java +++ b/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/QueryProfileProto.java @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/firestore/v1/query_profile.proto -// Protobuf Java Version: 3.25.3 +// Protobuf Java Version: 3.25.2 package com.google.firestore.v1; public final class QueryProfileProto { diff --git a/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/StructuredPipeline.java b/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/StructuredPipeline.java new file mode 100644 index 000000000..860bd4e1c --- /dev/null +++ b/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/StructuredPipeline.java @@ -0,0 +1,1177 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/firestore/v1/pipeline.proto + +// Protobuf Java Version: 3.25.2 +package com.google.firestore.v1; + +/** + * + * + *
+ * A Firestore query represented as an ordered list of operations / stages.
+ *
+ * This is considered the top-level function which plans & executes a query.
+ * It is logically equivalent to `query(stages, options)`, but prevents the
+ * client from having to build a function wrapper.
+ * 
+ * + * Protobuf type {@code google.firestore.v1.StructuredPipeline} + */ +public final class StructuredPipeline extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.firestore.v1.StructuredPipeline) + StructuredPipelineOrBuilder { + private static final long serialVersionUID = 0L; + // Use StructuredPipeline.newBuilder() to construct. + private StructuredPipeline(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private StructuredPipeline() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new StructuredPipeline(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.firestore.v1.PipelineProto + .internal_static_google_firestore_v1_StructuredPipeline_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection( + int number) { + switch (number) { + case 2: + return internalGetOptions(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.firestore.v1.PipelineProto + .internal_static_google_firestore_v1_StructuredPipeline_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.firestore.v1.StructuredPipeline.class, + com.google.firestore.v1.StructuredPipeline.Builder.class); + } + + private int bitField0_; + public static final int PIPELINE_FIELD_NUMBER = 1; + private com.google.firestore.v1.Pipeline pipeline_; + /** + * + * + *
+   * The pipeline query to execute.
+   * 
+ * + * .google.firestore.v1.Pipeline pipeline = 1; + * + * @return Whether the pipeline field is set. + */ + @java.lang.Override + public boolean hasPipeline() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+   * The pipeline query to execute.
+   * 
+ * + * .google.firestore.v1.Pipeline pipeline = 1; + * + * @return The pipeline. + */ + @java.lang.Override + public com.google.firestore.v1.Pipeline getPipeline() { + return pipeline_ == null ? com.google.firestore.v1.Pipeline.getDefaultInstance() : pipeline_; + } + /** + * + * + *
+   * The pipeline query to execute.
+   * 
+ * + * .google.firestore.v1.Pipeline pipeline = 1; + */ + @java.lang.Override + public com.google.firestore.v1.PipelineOrBuilder getPipelineOrBuilder() { + return pipeline_ == null ? com.google.firestore.v1.Pipeline.getDefaultInstance() : pipeline_; + } + + public static final int OPTIONS_FIELD_NUMBER = 2; + + private static final class OptionsDefaultEntryHolder { + static final com.google.protobuf.MapEntry + defaultEntry = + com.google.protobuf.MapEntry + .newDefaultInstance( + com.google.firestore.v1.PipelineProto + .internal_static_google_firestore_v1_StructuredPipeline_OptionsEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.MESSAGE, + com.google.firestore.v1.Value.getDefaultInstance()); + } + + @SuppressWarnings("serial") + private com.google.protobuf.MapField options_; + + private com.google.protobuf.MapField + internalGetOptions() { + if (options_ == null) { + return com.google.protobuf.MapField.emptyMapField(OptionsDefaultEntryHolder.defaultEntry); + } + return options_; + } + + public int getOptionsCount() { + return internalGetOptions().getMap().size(); + } + /** + * + * + *
+   * Optional query-level arguments.
+   *
+   * (-- Think query statement hints. --)
+   *
+   * (-- TODO(batchik): define the api contract of using an unsupported hint --)
+   * 
+ * + * map<string, .google.firestore.v1.Value> options = 2; + */ + @java.lang.Override + public boolean containsOptions(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetOptions().getMap().containsKey(key); + } + /** Use {@link #getOptionsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getOptions() { + return getOptionsMap(); + } + /** + * + * + *
+   * Optional query-level arguments.
+   *
+   * (-- Think query statement hints. --)
+   *
+   * (-- TODO(batchik): define the api contract of using an unsupported hint --)
+   * 
+ * + * map<string, .google.firestore.v1.Value> options = 2; + */ + @java.lang.Override + public java.util.Map getOptionsMap() { + return internalGetOptions().getMap(); + } + /** + * + * + *
+   * Optional query-level arguments.
+   *
+   * (-- Think query statement hints. --)
+   *
+   * (-- TODO(batchik): define the api contract of using an unsupported hint --)
+   * 
+ * + * map<string, .google.firestore.v1.Value> options = 2; + */ + @java.lang.Override + public /* nullable */ com.google.firestore.v1.Value getOptionsOrDefault( + java.lang.String key, + /* nullable */ + com.google.firestore.v1.Value defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = + internalGetOptions().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+   * Optional query-level arguments.
+   *
+   * (-- Think query statement hints. --)
+   *
+   * (-- TODO(batchik): define the api contract of using an unsupported hint --)
+   * 
+ * + * map<string, .google.firestore.v1.Value> options = 2; + */ + @java.lang.Override + public com.google.firestore.v1.Value getOptionsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = + internalGetOptions().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(1, getPipeline()); + } + com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + output, internalGetOptions(), OptionsDefaultEntryHolder.defaultEntry, 2); + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getPipeline()); + } + for (java.util.Map.Entry entry : + internalGetOptions().getMap().entrySet()) { + com.google.protobuf.MapEntry options__ = + OptionsDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, options__); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.firestore.v1.StructuredPipeline)) { + return super.equals(obj); + } + com.google.firestore.v1.StructuredPipeline other = + (com.google.firestore.v1.StructuredPipeline) obj; + + if (hasPipeline() != other.hasPipeline()) return false; + if (hasPipeline()) { + if (!getPipeline().equals(other.getPipeline())) return false; + } + if (!internalGetOptions().equals(other.internalGetOptions())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasPipeline()) { + hash = (37 * hash) + PIPELINE_FIELD_NUMBER; + hash = (53 * hash) + getPipeline().hashCode(); + } + if (!internalGetOptions().getMap().isEmpty()) { + hash = (37 * hash) + OPTIONS_FIELD_NUMBER; + hash = (53 * hash) + internalGetOptions().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.firestore.v1.StructuredPipeline parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.firestore.v1.StructuredPipeline parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.firestore.v1.StructuredPipeline parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.firestore.v1.StructuredPipeline parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.firestore.v1.StructuredPipeline parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.firestore.v1.StructuredPipeline parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.firestore.v1.StructuredPipeline parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.firestore.v1.StructuredPipeline parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.firestore.v1.StructuredPipeline parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.firestore.v1.StructuredPipeline parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.firestore.v1.StructuredPipeline parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.firestore.v1.StructuredPipeline parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.firestore.v1.StructuredPipeline prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * A Firestore query represented as an ordered list of operations / stages.
+   *
+   * This is considered the top-level function which plans & executes a query.
+   * It is logically equivalent to `query(stages, options)`, but prevents the
+   * client from having to build a function wrapper.
+   * 
+ * + * Protobuf type {@code google.firestore.v1.StructuredPipeline} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.firestore.v1.StructuredPipeline) + com.google.firestore.v1.StructuredPipelineOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.firestore.v1.PipelineProto + .internal_static_google_firestore_v1_StructuredPipeline_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection( + int number) { + switch (number) { + case 2: + return internalGetOptions(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMutableMapFieldReflection( + int number) { + switch (number) { + case 2: + return internalGetMutableOptions(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.firestore.v1.PipelineProto + .internal_static_google_firestore_v1_StructuredPipeline_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.firestore.v1.StructuredPipeline.class, + com.google.firestore.v1.StructuredPipeline.Builder.class); + } + + // Construct using com.google.firestore.v1.StructuredPipeline.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getPipelineFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + pipeline_ = null; + if (pipelineBuilder_ != null) { + pipelineBuilder_.dispose(); + pipelineBuilder_ = null; + } + internalGetMutableOptions().clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.firestore.v1.PipelineProto + .internal_static_google_firestore_v1_StructuredPipeline_descriptor; + } + + @java.lang.Override + public com.google.firestore.v1.StructuredPipeline getDefaultInstanceForType() { + return com.google.firestore.v1.StructuredPipeline.getDefaultInstance(); + } + + @java.lang.Override + public com.google.firestore.v1.StructuredPipeline build() { + com.google.firestore.v1.StructuredPipeline result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.firestore.v1.StructuredPipeline buildPartial() { + com.google.firestore.v1.StructuredPipeline result = + new com.google.firestore.v1.StructuredPipeline(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.firestore.v1.StructuredPipeline result) { + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.pipeline_ = pipelineBuilder_ == null ? pipeline_ : pipelineBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.options_ = internalGetOptions().build(OptionsDefaultEntryHolder.defaultEntry); + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.firestore.v1.StructuredPipeline) { + return mergeFrom((com.google.firestore.v1.StructuredPipeline) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.firestore.v1.StructuredPipeline other) { + if (other == com.google.firestore.v1.StructuredPipeline.getDefaultInstance()) return this; + if (other.hasPipeline()) { + mergePipeline(other.getPipeline()); + } + internalGetMutableOptions().mergeFrom(other.internalGetOptions()); + bitField0_ |= 0x00000002; + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + input.readMessage(getPipelineFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + com.google.protobuf.MapEntry + options__ = + input.readMessage( + OptionsDefaultEntryHolder.defaultEntry.getParserForType(), + extensionRegistry); + internalGetMutableOptions() + .ensureBuilderMap() + .put(options__.getKey(), options__.getValue()); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private com.google.firestore.v1.Pipeline pipeline_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.firestore.v1.Pipeline, + com.google.firestore.v1.Pipeline.Builder, + com.google.firestore.v1.PipelineOrBuilder> + pipelineBuilder_; + /** + * + * + *
+     * The pipeline query to execute.
+     * 
+ * + * .google.firestore.v1.Pipeline pipeline = 1; + * + * @return Whether the pipeline field is set. + */ + public boolean hasPipeline() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+     * The pipeline query to execute.
+     * 
+ * + * .google.firestore.v1.Pipeline pipeline = 1; + * + * @return The pipeline. + */ + public com.google.firestore.v1.Pipeline getPipeline() { + if (pipelineBuilder_ == null) { + return pipeline_ == null + ? com.google.firestore.v1.Pipeline.getDefaultInstance() + : pipeline_; + } else { + return pipelineBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The pipeline query to execute.
+     * 
+ * + * .google.firestore.v1.Pipeline pipeline = 1; + */ + public Builder setPipeline(com.google.firestore.v1.Pipeline value) { + if (pipelineBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + pipeline_ = value; + } else { + pipelineBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * The pipeline query to execute.
+     * 
+ * + * .google.firestore.v1.Pipeline pipeline = 1; + */ + public Builder setPipeline(com.google.firestore.v1.Pipeline.Builder builderForValue) { + if (pipelineBuilder_ == null) { + pipeline_ = builderForValue.build(); + } else { + pipelineBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * The pipeline query to execute.
+     * 
+ * + * .google.firestore.v1.Pipeline pipeline = 1; + */ + public Builder mergePipeline(com.google.firestore.v1.Pipeline value) { + if (pipelineBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0) + && pipeline_ != null + && pipeline_ != com.google.firestore.v1.Pipeline.getDefaultInstance()) { + getPipelineBuilder().mergeFrom(value); + } else { + pipeline_ = value; + } + } else { + pipelineBuilder_.mergeFrom(value); + } + if (pipeline_ != null) { + bitField0_ |= 0x00000001; + onChanged(); + } + return this; + } + /** + * + * + *
+     * The pipeline query to execute.
+     * 
+ * + * .google.firestore.v1.Pipeline pipeline = 1; + */ + public Builder clearPipeline() { + bitField0_ = (bitField0_ & ~0x00000001); + pipeline_ = null; + if (pipelineBuilder_ != null) { + pipelineBuilder_.dispose(); + pipelineBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * The pipeline query to execute.
+     * 
+ * + * .google.firestore.v1.Pipeline pipeline = 1; + */ + public com.google.firestore.v1.Pipeline.Builder getPipelineBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return getPipelineFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The pipeline query to execute.
+     * 
+ * + * .google.firestore.v1.Pipeline pipeline = 1; + */ + public com.google.firestore.v1.PipelineOrBuilder getPipelineOrBuilder() { + if (pipelineBuilder_ != null) { + return pipelineBuilder_.getMessageOrBuilder(); + } else { + return pipeline_ == null + ? com.google.firestore.v1.Pipeline.getDefaultInstance() + : pipeline_; + } + } + /** + * + * + *
+     * The pipeline query to execute.
+     * 
+ * + * .google.firestore.v1.Pipeline pipeline = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.firestore.v1.Pipeline, + com.google.firestore.v1.Pipeline.Builder, + com.google.firestore.v1.PipelineOrBuilder> + getPipelineFieldBuilder() { + if (pipelineBuilder_ == null) { + pipelineBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.firestore.v1.Pipeline, + com.google.firestore.v1.Pipeline.Builder, + com.google.firestore.v1.PipelineOrBuilder>( + getPipeline(), getParentForChildren(), isClean()); + pipeline_ = null; + } + return pipelineBuilder_; + } + + private static final class OptionsConverter + implements com.google.protobuf.MapFieldBuilder.Converter< + java.lang.String, + com.google.firestore.v1.ValueOrBuilder, + com.google.firestore.v1.Value> { + @java.lang.Override + public com.google.firestore.v1.Value build(com.google.firestore.v1.ValueOrBuilder val) { + if (val instanceof com.google.firestore.v1.Value) { + return (com.google.firestore.v1.Value) val; + } + return ((com.google.firestore.v1.Value.Builder) val).build(); + } + + @java.lang.Override + public com.google.protobuf.MapEntry + defaultEntry() { + return OptionsDefaultEntryHolder.defaultEntry; + } + }; + + private static final OptionsConverter optionsConverter = new OptionsConverter(); + + private com.google.protobuf.MapFieldBuilder< + java.lang.String, + com.google.firestore.v1.ValueOrBuilder, + com.google.firestore.v1.Value, + com.google.firestore.v1.Value.Builder> + options_; + + private com.google.protobuf.MapFieldBuilder< + java.lang.String, + com.google.firestore.v1.ValueOrBuilder, + com.google.firestore.v1.Value, + com.google.firestore.v1.Value.Builder> + internalGetOptions() { + if (options_ == null) { + return new com.google.protobuf.MapFieldBuilder<>(optionsConverter); + } + return options_; + } + + private com.google.protobuf.MapFieldBuilder< + java.lang.String, + com.google.firestore.v1.ValueOrBuilder, + com.google.firestore.v1.Value, + com.google.firestore.v1.Value.Builder> + internalGetMutableOptions() { + if (options_ == null) { + options_ = new com.google.protobuf.MapFieldBuilder<>(optionsConverter); + } + bitField0_ |= 0x00000002; + onChanged(); + return options_; + } + + public int getOptionsCount() { + return internalGetOptions().ensureBuilderMap().size(); + } + /** + * + * + *
+     * Optional query-level arguments.
+     *
+     * (-- Think query statement hints. --)
+     *
+     * (-- TODO(batchik): define the api contract of using an unsupported hint --)
+     * 
+ * + * map<string, .google.firestore.v1.Value> options = 2; + */ + @java.lang.Override + public boolean containsOptions(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetOptions().ensureBuilderMap().containsKey(key); + } + /** Use {@link #getOptionsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getOptions() { + return getOptionsMap(); + } + /** + * + * + *
+     * Optional query-level arguments.
+     *
+     * (-- Think query statement hints. --)
+     *
+     * (-- TODO(batchik): define the api contract of using an unsupported hint --)
+     * 
+ * + * map<string, .google.firestore.v1.Value> options = 2; + */ + @java.lang.Override + public java.util.Map getOptionsMap() { + return internalGetOptions().getImmutableMap(); + } + /** + * + * + *
+     * Optional query-level arguments.
+     *
+     * (-- Think query statement hints. --)
+     *
+     * (-- TODO(batchik): define the api contract of using an unsupported hint --)
+     * 
+ * + * map<string, .google.firestore.v1.Value> options = 2; + */ + @java.lang.Override + public /* nullable */ com.google.firestore.v1.Value getOptionsOrDefault( + java.lang.String key, + /* nullable */ + com.google.firestore.v1.Value defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = + internalGetMutableOptions().ensureBuilderMap(); + return map.containsKey(key) ? optionsConverter.build(map.get(key)) : defaultValue; + } + /** + * + * + *
+     * Optional query-level arguments.
+     *
+     * (-- Think query statement hints. --)
+     *
+     * (-- TODO(batchik): define the api contract of using an unsupported hint --)
+     * 
+ * + * map<string, .google.firestore.v1.Value> options = 2; + */ + @java.lang.Override + public com.google.firestore.v1.Value getOptionsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = + internalGetMutableOptions().ensureBuilderMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return optionsConverter.build(map.get(key)); + } + + public Builder clearOptions() { + bitField0_ = (bitField0_ & ~0x00000002); + internalGetMutableOptions().clear(); + return this; + } + /** + * + * + *
+     * Optional query-level arguments.
+     *
+     * (-- Think query statement hints. --)
+     *
+     * (-- TODO(batchik): define the api contract of using an unsupported hint --)
+     * 
+ * + * map<string, .google.firestore.v1.Value> options = 2; + */ + public Builder removeOptions(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + internalGetMutableOptions().ensureBuilderMap().remove(key); + return this; + } + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map getMutableOptions() { + bitField0_ |= 0x00000002; + return internalGetMutableOptions().ensureMessageMap(); + } + /** + * + * + *
+     * Optional query-level arguments.
+     *
+     * (-- Think query statement hints. --)
+     *
+     * (-- TODO(batchik): define the api contract of using an unsupported hint --)
+     * 
+ * + * map<string, .google.firestore.v1.Value> options = 2; + */ + public Builder putOptions(java.lang.String key, com.google.firestore.v1.Value value) { + if (key == null) { + throw new NullPointerException("map key"); + } + if (value == null) { + throw new NullPointerException("map value"); + } + internalGetMutableOptions().ensureBuilderMap().put(key, value); + bitField0_ |= 0x00000002; + return this; + } + /** + * + * + *
+     * Optional query-level arguments.
+     *
+     * (-- Think query statement hints. --)
+     *
+     * (-- TODO(batchik): define the api contract of using an unsupported hint --)
+     * 
+ * + * map<string, .google.firestore.v1.Value> options = 2; + */ + public Builder putAllOptions( + java.util.Map values) { + for (java.util.Map.Entry e : + values.entrySet()) { + if (e.getKey() == null || e.getValue() == null) { + throw new NullPointerException(); + } + } + internalGetMutableOptions().ensureBuilderMap().putAll(values); + bitField0_ |= 0x00000002; + return this; + } + /** + * + * + *
+     * Optional query-level arguments.
+     *
+     * (-- Think query statement hints. --)
+     *
+     * (-- TODO(batchik): define the api contract of using an unsupported hint --)
+     * 
+ * + * map<string, .google.firestore.v1.Value> options = 2; + */ + public com.google.firestore.v1.Value.Builder putOptionsBuilderIfAbsent(java.lang.String key) { + java.util.Map builderMap = + internalGetMutableOptions().ensureBuilderMap(); + com.google.firestore.v1.ValueOrBuilder entry = builderMap.get(key); + if (entry == null) { + entry = com.google.firestore.v1.Value.newBuilder(); + builderMap.put(key, entry); + } + if (entry instanceof com.google.firestore.v1.Value) { + entry = ((com.google.firestore.v1.Value) entry).toBuilder(); + builderMap.put(key, entry); + } + return (com.google.firestore.v1.Value.Builder) entry; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.firestore.v1.StructuredPipeline) + } + + // @@protoc_insertion_point(class_scope:google.firestore.v1.StructuredPipeline) + private static final com.google.firestore.v1.StructuredPipeline DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.firestore.v1.StructuredPipeline(); + } + + public static com.google.firestore.v1.StructuredPipeline getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public StructuredPipeline parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.firestore.v1.StructuredPipeline getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/StructuredPipelineOrBuilder.java b/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/StructuredPipelineOrBuilder.java new file mode 100644 index 000000000..b6e1c59c1 --- /dev/null +++ b/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/StructuredPipelineOrBuilder.java @@ -0,0 +1,139 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/firestore/v1/pipeline.proto + +// Protobuf Java Version: 3.25.2 +package com.google.firestore.v1; + +public interface StructuredPipelineOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.firestore.v1.StructuredPipeline) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The pipeline query to execute.
+   * 
+ * + * .google.firestore.v1.Pipeline pipeline = 1; + * + * @return Whether the pipeline field is set. + */ + boolean hasPipeline(); + /** + * + * + *
+   * The pipeline query to execute.
+   * 
+ * + * .google.firestore.v1.Pipeline pipeline = 1; + * + * @return The pipeline. + */ + com.google.firestore.v1.Pipeline getPipeline(); + /** + * + * + *
+   * The pipeline query to execute.
+   * 
+ * + * .google.firestore.v1.Pipeline pipeline = 1; + */ + com.google.firestore.v1.PipelineOrBuilder getPipelineOrBuilder(); + + /** + * + * + *
+   * Optional query-level arguments.
+   *
+   * (-- Think query statement hints. --)
+   *
+   * (-- TODO(batchik): define the api contract of using an unsupported hint --)
+   * 
+ * + * map<string, .google.firestore.v1.Value> options = 2; + */ + int getOptionsCount(); + /** + * + * + *
+   * Optional query-level arguments.
+   *
+   * (-- Think query statement hints. --)
+   *
+   * (-- TODO(batchik): define the api contract of using an unsupported hint --)
+   * 
+ * + * map<string, .google.firestore.v1.Value> options = 2; + */ + boolean containsOptions(java.lang.String key); + /** Use {@link #getOptionsMap()} instead. */ + @java.lang.Deprecated + java.util.Map getOptions(); + /** + * + * + *
+   * Optional query-level arguments.
+   *
+   * (-- Think query statement hints. --)
+   *
+   * (-- TODO(batchik): define the api contract of using an unsupported hint --)
+   * 
+ * + * map<string, .google.firestore.v1.Value> options = 2; + */ + java.util.Map getOptionsMap(); + /** + * + * + *
+   * Optional query-level arguments.
+   *
+   * (-- Think query statement hints. --)
+   *
+   * (-- TODO(batchik): define the api contract of using an unsupported hint --)
+   * 
+ * + * map<string, .google.firestore.v1.Value> options = 2; + */ + /* nullable */ + com.google.firestore.v1.Value getOptionsOrDefault( + java.lang.String key, + /* nullable */ + com.google.firestore.v1.Value defaultValue); + /** + * + * + *
+   * Optional query-level arguments.
+   *
+   * (-- Think query statement hints. --)
+   *
+   * (-- TODO(batchik): define the api contract of using an unsupported hint --)
+   * 
+ * + * map<string, .google.firestore.v1.Value> options = 2; + */ + com.google.firestore.v1.Value getOptionsOrThrow(java.lang.String key); +} diff --git a/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/Value.java b/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/Value.java index 378e89748..1e7f93b7b 100644 --- a/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/Value.java +++ b/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/Value.java @@ -80,6 +80,9 @@ public enum ValueTypeCase GEO_POINT_VALUE(8), ARRAY_VALUE(9), MAP_VALUE(6), + FIELD_REFERENCE_VALUE(19), + FUNCTION_VALUE(20), + PIPELINE_VALUE(21), VALUETYPE_NOT_SET(0); private final int value; @@ -120,6 +123,12 @@ public static ValueTypeCase forNumber(int value) { return ARRAY_VALUE; case 6: return MAP_VALUE; + case 19: + return FIELD_REFERENCE_VALUE; + case 20: + return FUNCTION_VALUE; + case 21: + return PIPELINE_VALUE; case 0: return VALUETYPE_NOT_SET; default: @@ -711,6 +720,280 @@ public com.google.firestore.v1.MapValueOrBuilder getMapValueOrBuilder() { return com.google.firestore.v1.MapValue.getDefaultInstance(); } + public static final int FIELD_REFERENCE_VALUE_FIELD_NUMBER = 19; + /** + * + * + *
+   * Value which references a field.
+   *
+   * This is considered relative (vs absolute) since it only refers to a field
+   * and not a field within a particular document.
+   *
+   * **Requires:**
+   *
+   * * Must follow [field reference][FieldReference.field_path] limitations.
+   *
+   * * Not allowed to be used when writing documents.
+   *
+   * (-- NOTE(batchik): long term, there is no reason this type should not be
+   *     allowed to be used on the write path. --)
+   * 
+ * + * string field_reference_value = 19; + * + * @return Whether the fieldReferenceValue field is set. + */ + public boolean hasFieldReferenceValue() { + return valueTypeCase_ == 19; + } + /** + * + * + *
+   * Value which references a field.
+   *
+   * This is considered relative (vs absolute) since it only refers to a field
+   * and not a field within a particular document.
+   *
+   * **Requires:**
+   *
+   * * Must follow [field reference][FieldReference.field_path] limitations.
+   *
+   * * Not allowed to be used when writing documents.
+   *
+   * (-- NOTE(batchik): long term, there is no reason this type should not be
+   *     allowed to be used on the write path. --)
+   * 
+ * + * string field_reference_value = 19; + * + * @return The fieldReferenceValue. + */ + public java.lang.String getFieldReferenceValue() { + java.lang.Object ref = ""; + if (valueTypeCase_ == 19) { + ref = valueType_; + } + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (valueTypeCase_ == 19) { + valueType_ = s; + } + return s; + } + } + /** + * + * + *
+   * Value which references a field.
+   *
+   * This is considered relative (vs absolute) since it only refers to a field
+   * and not a field within a particular document.
+   *
+   * **Requires:**
+   *
+   * * Must follow [field reference][FieldReference.field_path] limitations.
+   *
+   * * Not allowed to be used when writing documents.
+   *
+   * (-- NOTE(batchik): long term, there is no reason this type should not be
+   *     allowed to be used on the write path. --)
+   * 
+ * + * string field_reference_value = 19; + * + * @return The bytes for fieldReferenceValue. + */ + public com.google.protobuf.ByteString getFieldReferenceValueBytes() { + java.lang.Object ref = ""; + if (valueTypeCase_ == 19) { + ref = valueType_; + } + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + if (valueTypeCase_ == 19) { + valueType_ = b; + } + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int FUNCTION_VALUE_FIELD_NUMBER = 20; + /** + * + * + *
+   * A value that represents an unevaluated expression.
+   *
+   * **Requires:**
+   *
+   * * Not allowed to be used when writing documents.
+   *
+   * (-- NOTE(batchik): similar to above, there is no reason to not allow
+   *     storing expressions into the database, just no plan to support in
+   *     the near term.
+   *
+   *     This would actually be an interesting way to represent user-defined
+   *     functions or more expressive rules-based systems. --)
+   * 
+ * + * .google.firestore.v1.Function function_value = 20; + * + * @return Whether the functionValue field is set. + */ + @java.lang.Override + public boolean hasFunctionValue() { + return valueTypeCase_ == 20; + } + /** + * + * + *
+   * A value that represents an unevaluated expression.
+   *
+   * **Requires:**
+   *
+   * * Not allowed to be used when writing documents.
+   *
+   * (-- NOTE(batchik): similar to above, there is no reason to not allow
+   *     storing expressions into the database, just no plan to support in
+   *     the near term.
+   *
+   *     This would actually be an interesting way to represent user-defined
+   *     functions or more expressive rules-based systems. --)
+   * 
+ * + * .google.firestore.v1.Function function_value = 20; + * + * @return The functionValue. + */ + @java.lang.Override + public com.google.firestore.v1.Function getFunctionValue() { + if (valueTypeCase_ == 20) { + return (com.google.firestore.v1.Function) valueType_; + } + return com.google.firestore.v1.Function.getDefaultInstance(); + } + /** + * + * + *
+   * A value that represents an unevaluated expression.
+   *
+   * **Requires:**
+   *
+   * * Not allowed to be used when writing documents.
+   *
+   * (-- NOTE(batchik): similar to above, there is no reason to not allow
+   *     storing expressions into the database, just no plan to support in
+   *     the near term.
+   *
+   *     This would actually be an interesting way to represent user-defined
+   *     functions or more expressive rules-based systems. --)
+   * 
+ * + * .google.firestore.v1.Function function_value = 20; + */ + @java.lang.Override + public com.google.firestore.v1.FunctionOrBuilder getFunctionValueOrBuilder() { + if (valueTypeCase_ == 20) { + return (com.google.firestore.v1.Function) valueType_; + } + return com.google.firestore.v1.Function.getDefaultInstance(); + } + + public static final int PIPELINE_VALUE_FIELD_NUMBER = 21; + /** + * + * + *
+   * A value that represents an unevaluated pipeline.
+   *
+   * **Requires:**
+   *
+   * * Not allowed to be used when writing documents.
+   *
+   * (-- NOTE(batchik): similar to above, there is no reason to not allow
+   *     storing expressions into the database, just no plan to support in
+   *     the near term.
+   *
+   *     This would actually be an interesting way to represent user-defined
+   *     functions or more expressive rules-based systems. --)
+   * 
+ * + * .google.firestore.v1.Pipeline pipeline_value = 21; + * + * @return Whether the pipelineValue field is set. + */ + @java.lang.Override + public boolean hasPipelineValue() { + return valueTypeCase_ == 21; + } + /** + * + * + *
+   * A value that represents an unevaluated pipeline.
+   *
+   * **Requires:**
+   *
+   * * Not allowed to be used when writing documents.
+   *
+   * (-- NOTE(batchik): similar to above, there is no reason to not allow
+   *     storing expressions into the database, just no plan to support in
+   *     the near term.
+   *
+   *     This would actually be an interesting way to represent user-defined
+   *     functions or more expressive rules-based systems. --)
+   * 
+ * + * .google.firestore.v1.Pipeline pipeline_value = 21; + * + * @return The pipelineValue. + */ + @java.lang.Override + public com.google.firestore.v1.Pipeline getPipelineValue() { + if (valueTypeCase_ == 21) { + return (com.google.firestore.v1.Pipeline) valueType_; + } + return com.google.firestore.v1.Pipeline.getDefaultInstance(); + } + /** + * + * + *
+   * A value that represents an unevaluated pipeline.
+   *
+   * **Requires:**
+   *
+   * * Not allowed to be used when writing documents.
+   *
+   * (-- NOTE(batchik): similar to above, there is no reason to not allow
+   *     storing expressions into the database, just no plan to support in
+   *     the near term.
+   *
+   *     This would actually be an interesting way to represent user-defined
+   *     functions or more expressive rules-based systems. --)
+   * 
+ * + * .google.firestore.v1.Pipeline pipeline_value = 21; + */ + @java.lang.Override + public com.google.firestore.v1.PipelineOrBuilder getPipelineValueOrBuilder() { + if (valueTypeCase_ == 21) { + return (com.google.firestore.v1.Pipeline) valueType_; + } + return com.google.firestore.v1.Pipeline.getDefaultInstance(); + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -758,6 +1041,15 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (valueTypeCase_ == 18) { output.writeBytes(18, (com.google.protobuf.ByteString) valueType_); } + if (valueTypeCase_ == 19) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 19, valueType_); + } + if (valueTypeCase_ == 20) { + output.writeMessage(20, (com.google.firestore.v1.Function) valueType_); + } + if (valueTypeCase_ == 21) { + output.writeMessage(21, (com.google.firestore.v1.Pipeline) valueType_); + } getUnknownFields().writeTo(output); } @@ -818,6 +1110,19 @@ public int getSerializedSize() { com.google.protobuf.CodedOutputStream.computeBytesSize( 18, (com.google.protobuf.ByteString) valueType_); } + if (valueTypeCase_ == 19) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(19, valueType_); + } + if (valueTypeCase_ == 20) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 20, (com.google.firestore.v1.Function) valueType_); + } + if (valueTypeCase_ == 21) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 21, (com.google.firestore.v1.Pipeline) valueType_); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -869,6 +1174,15 @@ public boolean equals(final java.lang.Object obj) { case 6: if (!getMapValue().equals(other.getMapValue())) return false; break; + case 19: + if (!getFieldReferenceValue().equals(other.getFieldReferenceValue())) return false; + break; + case 20: + if (!getFunctionValue().equals(other.getFunctionValue())) return false; + break; + case 21: + if (!getPipelineValue().equals(other.getPipelineValue())) return false; + break; case 0: default: } @@ -931,6 +1245,18 @@ public int hashCode() { hash = (37 * hash) + MAP_VALUE_FIELD_NUMBER; hash = (53 * hash) + getMapValue().hashCode(); break; + case 19: + hash = (37 * hash) + FIELD_REFERENCE_VALUE_FIELD_NUMBER; + hash = (53 * hash) + getFieldReferenceValue().hashCode(); + break; + case 20: + hash = (37 * hash) + FUNCTION_VALUE_FIELD_NUMBER; + hash = (53 * hash) + getFunctionValue().hashCode(); + break; + case 21: + hash = (37 * hash) + PIPELINE_VALUE_FIELD_NUMBER; + hash = (53 * hash) + getPipelineValue().hashCode(); + break; case 0: default: } @@ -1083,6 +1409,12 @@ public Builder clear() { if (mapValueBuilder_ != null) { mapValueBuilder_.clear(); } + if (functionValueBuilder_ != null) { + functionValueBuilder_.clear(); + } + if (pipelineValueBuilder_ != null) { + pipelineValueBuilder_.clear(); + } valueTypeCase_ = 0; valueType_ = null; return this; @@ -1138,6 +1470,12 @@ private void buildPartialOneofs(com.google.firestore.v1.Value result) { if (valueTypeCase_ == 6 && mapValueBuilder_ != null) { result.valueType_ = mapValueBuilder_.build(); } + if (valueTypeCase_ == 20 && functionValueBuilder_ != null) { + result.valueType_ = functionValueBuilder_.build(); + } + if (valueTypeCase_ == 21 && pipelineValueBuilder_ != null) { + result.valueType_ = pipelineValueBuilder_.build(); + } } @java.lang.Override @@ -1245,6 +1583,23 @@ public Builder mergeFrom(com.google.firestore.v1.Value other) { mergeMapValue(other.getMapValue()); break; } + case FIELD_REFERENCE_VALUE: + { + valueTypeCase_ = 19; + valueType_ = other.valueType_; + onChanged(); + break; + } + case FUNCTION_VALUE: + { + mergeFunctionValue(other.getFunctionValue()); + break; + } + case PIPELINE_VALUE: + { + mergePipelineValue(other.getPipelineValue()); + break; + } case VALUETYPE_NOT_SET: { break; @@ -1345,6 +1700,25 @@ public Builder mergeFrom( valueTypeCase_ = 18; break; } // case 146 + case 154: + { + java.lang.String s = input.readStringRequireUtf8(); + valueTypeCase_ = 19; + valueType_ = s; + break; + } // case 154 + case 162: + { + input.readMessage(getFunctionValueFieldBuilder().getBuilder(), extensionRegistry); + valueTypeCase_ = 20; + break; + } // case 162 + case 170: + { + input.readMessage(getPipelineValueFieldBuilder().getBuilder(), extensionRegistry); + valueTypeCase_ = 21; + break; + } // case 170 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { @@ -2953,6 +3327,822 @@ public com.google.firestore.v1.MapValueOrBuilder getMapValueOrBuilder() { return mapValueBuilder_; } + /** + * + * + *
+     * Value which references a field.
+     *
+     * This is considered relative (vs absolute) since it only refers to a field
+     * and not a field within a particular document.
+     *
+     * **Requires:**
+     *
+     * * Must follow [field reference][FieldReference.field_path] limitations.
+     *
+     * * Not allowed to be used when writing documents.
+     *
+     * (-- NOTE(batchik): long term, there is no reason this type should not be
+     *     allowed to be used on the write path. --)
+     * 
+ * + * string field_reference_value = 19; + * + * @return Whether the fieldReferenceValue field is set. + */ + @java.lang.Override + public boolean hasFieldReferenceValue() { + return valueTypeCase_ == 19; + } + /** + * + * + *
+     * Value which references a field.
+     *
+     * This is considered relative (vs absolute) since it only refers to a field
+     * and not a field within a particular document.
+     *
+     * **Requires:**
+     *
+     * * Must follow [field reference][FieldReference.field_path] limitations.
+     *
+     * * Not allowed to be used when writing documents.
+     *
+     * (-- NOTE(batchik): long term, there is no reason this type should not be
+     *     allowed to be used on the write path. --)
+     * 
+ * + * string field_reference_value = 19; + * + * @return The fieldReferenceValue. + */ + @java.lang.Override + public java.lang.String getFieldReferenceValue() { + java.lang.Object ref = ""; + if (valueTypeCase_ == 19) { + ref = valueType_; + } + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (valueTypeCase_ == 19) { + valueType_ = s; + } + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Value which references a field.
+     *
+     * This is considered relative (vs absolute) since it only refers to a field
+     * and not a field within a particular document.
+     *
+     * **Requires:**
+     *
+     * * Must follow [field reference][FieldReference.field_path] limitations.
+     *
+     * * Not allowed to be used when writing documents.
+     *
+     * (-- NOTE(batchik): long term, there is no reason this type should not be
+     *     allowed to be used on the write path. --)
+     * 
+ * + * string field_reference_value = 19; + * + * @return The bytes for fieldReferenceValue. + */ + @java.lang.Override + public com.google.protobuf.ByteString getFieldReferenceValueBytes() { + java.lang.Object ref = ""; + if (valueTypeCase_ == 19) { + ref = valueType_; + } + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + if (valueTypeCase_ == 19) { + valueType_ = b; + } + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Value which references a field.
+     *
+     * This is considered relative (vs absolute) since it only refers to a field
+     * and not a field within a particular document.
+     *
+     * **Requires:**
+     *
+     * * Must follow [field reference][FieldReference.field_path] limitations.
+     *
+     * * Not allowed to be used when writing documents.
+     *
+     * (-- NOTE(batchik): long term, there is no reason this type should not be
+     *     allowed to be used on the write path. --)
+     * 
+ * + * string field_reference_value = 19; + * + * @param value The fieldReferenceValue to set. + * @return This builder for chaining. + */ + public Builder setFieldReferenceValue(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + valueTypeCase_ = 19; + valueType_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Value which references a field.
+     *
+     * This is considered relative (vs absolute) since it only refers to a field
+     * and not a field within a particular document.
+     *
+     * **Requires:**
+     *
+     * * Must follow [field reference][FieldReference.field_path] limitations.
+     *
+     * * Not allowed to be used when writing documents.
+     *
+     * (-- NOTE(batchik): long term, there is no reason this type should not be
+     *     allowed to be used on the write path. --)
+     * 
+ * + * string field_reference_value = 19; + * + * @return This builder for chaining. + */ + public Builder clearFieldReferenceValue() { + if (valueTypeCase_ == 19) { + valueTypeCase_ = 0; + valueType_ = null; + onChanged(); + } + return this; + } + /** + * + * + *
+     * Value which references a field.
+     *
+     * This is considered relative (vs absolute) since it only refers to a field
+     * and not a field within a particular document.
+     *
+     * **Requires:**
+     *
+     * * Must follow [field reference][FieldReference.field_path] limitations.
+     *
+     * * Not allowed to be used when writing documents.
+     *
+     * (-- NOTE(batchik): long term, there is no reason this type should not be
+     *     allowed to be used on the write path. --)
+     * 
+ * + * string field_reference_value = 19; + * + * @param value The bytes for fieldReferenceValue to set. + * @return This builder for chaining. + */ + public Builder setFieldReferenceValueBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + valueTypeCase_ = 19; + valueType_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.firestore.v1.Function, + com.google.firestore.v1.Function.Builder, + com.google.firestore.v1.FunctionOrBuilder> + functionValueBuilder_; + /** + * + * + *
+     * A value that represents an unevaluated expression.
+     *
+     * **Requires:**
+     *
+     * * Not allowed to be used when writing documents.
+     *
+     * (-- NOTE(batchik): similar to above, there is no reason to not allow
+     *     storing expressions into the database, just no plan to support in
+     *     the near term.
+     *
+     *     This would actually be an interesting way to represent user-defined
+     *     functions or more expressive rules-based systems. --)
+     * 
+ * + * .google.firestore.v1.Function function_value = 20; + * + * @return Whether the functionValue field is set. + */ + @java.lang.Override + public boolean hasFunctionValue() { + return valueTypeCase_ == 20; + } + /** + * + * + *
+     * A value that represents an unevaluated expression.
+     *
+     * **Requires:**
+     *
+     * * Not allowed to be used when writing documents.
+     *
+     * (-- NOTE(batchik): similar to above, there is no reason to not allow
+     *     storing expressions into the database, just no plan to support in
+     *     the near term.
+     *
+     *     This would actually be an interesting way to represent user-defined
+     *     functions or more expressive rules-based systems. --)
+     * 
+ * + * .google.firestore.v1.Function function_value = 20; + * + * @return The functionValue. + */ + @java.lang.Override + public com.google.firestore.v1.Function getFunctionValue() { + if (functionValueBuilder_ == null) { + if (valueTypeCase_ == 20) { + return (com.google.firestore.v1.Function) valueType_; + } + return com.google.firestore.v1.Function.getDefaultInstance(); + } else { + if (valueTypeCase_ == 20) { + return functionValueBuilder_.getMessage(); + } + return com.google.firestore.v1.Function.getDefaultInstance(); + } + } + /** + * + * + *
+     * A value that represents an unevaluated expression.
+     *
+     * **Requires:**
+     *
+     * * Not allowed to be used when writing documents.
+     *
+     * (-- NOTE(batchik): similar to above, there is no reason to not allow
+     *     storing expressions into the database, just no plan to support in
+     *     the near term.
+     *
+     *     This would actually be an interesting way to represent user-defined
+     *     functions or more expressive rules-based systems. --)
+     * 
+ * + * .google.firestore.v1.Function function_value = 20; + */ + public Builder setFunctionValue(com.google.firestore.v1.Function value) { + if (functionValueBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + valueType_ = value; + onChanged(); + } else { + functionValueBuilder_.setMessage(value); + } + valueTypeCase_ = 20; + return this; + } + /** + * + * + *
+     * A value that represents an unevaluated expression.
+     *
+     * **Requires:**
+     *
+     * * Not allowed to be used when writing documents.
+     *
+     * (-- NOTE(batchik): similar to above, there is no reason to not allow
+     *     storing expressions into the database, just no plan to support in
+     *     the near term.
+     *
+     *     This would actually be an interesting way to represent user-defined
+     *     functions or more expressive rules-based systems. --)
+     * 
+ * + * .google.firestore.v1.Function function_value = 20; + */ + public Builder setFunctionValue(com.google.firestore.v1.Function.Builder builderForValue) { + if (functionValueBuilder_ == null) { + valueType_ = builderForValue.build(); + onChanged(); + } else { + functionValueBuilder_.setMessage(builderForValue.build()); + } + valueTypeCase_ = 20; + return this; + } + /** + * + * + *
+     * A value that represents an unevaluated expression.
+     *
+     * **Requires:**
+     *
+     * * Not allowed to be used when writing documents.
+     *
+     * (-- NOTE(batchik): similar to above, there is no reason to not allow
+     *     storing expressions into the database, just no plan to support in
+     *     the near term.
+     *
+     *     This would actually be an interesting way to represent user-defined
+     *     functions or more expressive rules-based systems. --)
+     * 
+ * + * .google.firestore.v1.Function function_value = 20; + */ + public Builder mergeFunctionValue(com.google.firestore.v1.Function value) { + if (functionValueBuilder_ == null) { + if (valueTypeCase_ == 20 + && valueType_ != com.google.firestore.v1.Function.getDefaultInstance()) { + valueType_ = + com.google.firestore.v1.Function.newBuilder( + (com.google.firestore.v1.Function) valueType_) + .mergeFrom(value) + .buildPartial(); + } else { + valueType_ = value; + } + onChanged(); + } else { + if (valueTypeCase_ == 20) { + functionValueBuilder_.mergeFrom(value); + } else { + functionValueBuilder_.setMessage(value); + } + } + valueTypeCase_ = 20; + return this; + } + /** + * + * + *
+     * A value that represents an unevaluated expression.
+     *
+     * **Requires:**
+     *
+     * * Not allowed to be used when writing documents.
+     *
+     * (-- NOTE(batchik): similar to above, there is no reason to not allow
+     *     storing expressions into the database, just no plan to support in
+     *     the near term.
+     *
+     *     This would actually be an interesting way to represent user-defined
+     *     functions or more expressive rules-based systems. --)
+     * 
+ * + * .google.firestore.v1.Function function_value = 20; + */ + public Builder clearFunctionValue() { + if (functionValueBuilder_ == null) { + if (valueTypeCase_ == 20) { + valueTypeCase_ = 0; + valueType_ = null; + onChanged(); + } + } else { + if (valueTypeCase_ == 20) { + valueTypeCase_ = 0; + valueType_ = null; + } + functionValueBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * A value that represents an unevaluated expression.
+     *
+     * **Requires:**
+     *
+     * * Not allowed to be used when writing documents.
+     *
+     * (-- NOTE(batchik): similar to above, there is no reason to not allow
+     *     storing expressions into the database, just no plan to support in
+     *     the near term.
+     *
+     *     This would actually be an interesting way to represent user-defined
+     *     functions or more expressive rules-based systems. --)
+     * 
+ * + * .google.firestore.v1.Function function_value = 20; + */ + public com.google.firestore.v1.Function.Builder getFunctionValueBuilder() { + return getFunctionValueFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * A value that represents an unevaluated expression.
+     *
+     * **Requires:**
+     *
+     * * Not allowed to be used when writing documents.
+     *
+     * (-- NOTE(batchik): similar to above, there is no reason to not allow
+     *     storing expressions into the database, just no plan to support in
+     *     the near term.
+     *
+     *     This would actually be an interesting way to represent user-defined
+     *     functions or more expressive rules-based systems. --)
+     * 
+ * + * .google.firestore.v1.Function function_value = 20; + */ + @java.lang.Override + public com.google.firestore.v1.FunctionOrBuilder getFunctionValueOrBuilder() { + if ((valueTypeCase_ == 20) && (functionValueBuilder_ != null)) { + return functionValueBuilder_.getMessageOrBuilder(); + } else { + if (valueTypeCase_ == 20) { + return (com.google.firestore.v1.Function) valueType_; + } + return com.google.firestore.v1.Function.getDefaultInstance(); + } + } + /** + * + * + *
+     * A value that represents an unevaluated expression.
+     *
+     * **Requires:**
+     *
+     * * Not allowed to be used when writing documents.
+     *
+     * (-- NOTE(batchik): similar to above, there is no reason to not allow
+     *     storing expressions into the database, just no plan to support in
+     *     the near term.
+     *
+     *     This would actually be an interesting way to represent user-defined
+     *     functions or more expressive rules-based systems. --)
+     * 
+ * + * .google.firestore.v1.Function function_value = 20; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.firestore.v1.Function, + com.google.firestore.v1.Function.Builder, + com.google.firestore.v1.FunctionOrBuilder> + getFunctionValueFieldBuilder() { + if (functionValueBuilder_ == null) { + if (!(valueTypeCase_ == 20)) { + valueType_ = com.google.firestore.v1.Function.getDefaultInstance(); + } + functionValueBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.firestore.v1.Function, + com.google.firestore.v1.Function.Builder, + com.google.firestore.v1.FunctionOrBuilder>( + (com.google.firestore.v1.Function) valueType_, getParentForChildren(), isClean()); + valueType_ = null; + } + valueTypeCase_ = 20; + onChanged(); + return functionValueBuilder_; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.firestore.v1.Pipeline, + com.google.firestore.v1.Pipeline.Builder, + com.google.firestore.v1.PipelineOrBuilder> + pipelineValueBuilder_; + /** + * + * + *
+     * A value that represents an unevaluated pipeline.
+     *
+     * **Requires:**
+     *
+     * * Not allowed to be used when writing documents.
+     *
+     * (-- NOTE(batchik): similar to above, there is no reason to not allow
+     *     storing expressions into the database, just no plan to support in
+     *     the near term.
+     *
+     *     This would actually be an interesting way to represent user-defined
+     *     functions or more expressive rules-based systems. --)
+     * 
+ * + * .google.firestore.v1.Pipeline pipeline_value = 21; + * + * @return Whether the pipelineValue field is set. + */ + @java.lang.Override + public boolean hasPipelineValue() { + return valueTypeCase_ == 21; + } + /** + * + * + *
+     * A value that represents an unevaluated pipeline.
+     *
+     * **Requires:**
+     *
+     * * Not allowed to be used when writing documents.
+     *
+     * (-- NOTE(batchik): similar to above, there is no reason to not allow
+     *     storing expressions into the database, just no plan to support in
+     *     the near term.
+     *
+     *     This would actually be an interesting way to represent user-defined
+     *     functions or more expressive rules-based systems. --)
+     * 
+ * + * .google.firestore.v1.Pipeline pipeline_value = 21; + * + * @return The pipelineValue. + */ + @java.lang.Override + public com.google.firestore.v1.Pipeline getPipelineValue() { + if (pipelineValueBuilder_ == null) { + if (valueTypeCase_ == 21) { + return (com.google.firestore.v1.Pipeline) valueType_; + } + return com.google.firestore.v1.Pipeline.getDefaultInstance(); + } else { + if (valueTypeCase_ == 21) { + return pipelineValueBuilder_.getMessage(); + } + return com.google.firestore.v1.Pipeline.getDefaultInstance(); + } + } + /** + * + * + *
+     * A value that represents an unevaluated pipeline.
+     *
+     * **Requires:**
+     *
+     * * Not allowed to be used when writing documents.
+     *
+     * (-- NOTE(batchik): similar to above, there is no reason to not allow
+     *     storing expressions into the database, just no plan to support in
+     *     the near term.
+     *
+     *     This would actually be an interesting way to represent user-defined
+     *     functions or more expressive rules-based systems. --)
+     * 
+ * + * .google.firestore.v1.Pipeline pipeline_value = 21; + */ + public Builder setPipelineValue(com.google.firestore.v1.Pipeline value) { + if (pipelineValueBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + valueType_ = value; + onChanged(); + } else { + pipelineValueBuilder_.setMessage(value); + } + valueTypeCase_ = 21; + return this; + } + /** + * + * + *
+     * A value that represents an unevaluated pipeline.
+     *
+     * **Requires:**
+     *
+     * * Not allowed to be used when writing documents.
+     *
+     * (-- NOTE(batchik): similar to above, there is no reason to not allow
+     *     storing expressions into the database, just no plan to support in
+     *     the near term.
+     *
+     *     This would actually be an interesting way to represent user-defined
+     *     functions or more expressive rules-based systems. --)
+     * 
+ * + * .google.firestore.v1.Pipeline pipeline_value = 21; + */ + public Builder setPipelineValue(com.google.firestore.v1.Pipeline.Builder builderForValue) { + if (pipelineValueBuilder_ == null) { + valueType_ = builderForValue.build(); + onChanged(); + } else { + pipelineValueBuilder_.setMessage(builderForValue.build()); + } + valueTypeCase_ = 21; + return this; + } + /** + * + * + *
+     * A value that represents an unevaluated pipeline.
+     *
+     * **Requires:**
+     *
+     * * Not allowed to be used when writing documents.
+     *
+     * (-- NOTE(batchik): similar to above, there is no reason to not allow
+     *     storing expressions into the database, just no plan to support in
+     *     the near term.
+     *
+     *     This would actually be an interesting way to represent user-defined
+     *     functions or more expressive rules-based systems. --)
+     * 
+ * + * .google.firestore.v1.Pipeline pipeline_value = 21; + */ + public Builder mergePipelineValue(com.google.firestore.v1.Pipeline value) { + if (pipelineValueBuilder_ == null) { + if (valueTypeCase_ == 21 + && valueType_ != com.google.firestore.v1.Pipeline.getDefaultInstance()) { + valueType_ = + com.google.firestore.v1.Pipeline.newBuilder( + (com.google.firestore.v1.Pipeline) valueType_) + .mergeFrom(value) + .buildPartial(); + } else { + valueType_ = value; + } + onChanged(); + } else { + if (valueTypeCase_ == 21) { + pipelineValueBuilder_.mergeFrom(value); + } else { + pipelineValueBuilder_.setMessage(value); + } + } + valueTypeCase_ = 21; + return this; + } + /** + * + * + *
+     * A value that represents an unevaluated pipeline.
+     *
+     * **Requires:**
+     *
+     * * Not allowed to be used when writing documents.
+     *
+     * (-- NOTE(batchik): similar to above, there is no reason to not allow
+     *     storing expressions into the database, just no plan to support in
+     *     the near term.
+     *
+     *     This would actually be an interesting way to represent user-defined
+     *     functions or more expressive rules-based systems. --)
+     * 
+ * + * .google.firestore.v1.Pipeline pipeline_value = 21; + */ + public Builder clearPipelineValue() { + if (pipelineValueBuilder_ == null) { + if (valueTypeCase_ == 21) { + valueTypeCase_ = 0; + valueType_ = null; + onChanged(); + } + } else { + if (valueTypeCase_ == 21) { + valueTypeCase_ = 0; + valueType_ = null; + } + pipelineValueBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * A value that represents an unevaluated pipeline.
+     *
+     * **Requires:**
+     *
+     * * Not allowed to be used when writing documents.
+     *
+     * (-- NOTE(batchik): similar to above, there is no reason to not allow
+     *     storing expressions into the database, just no plan to support in
+     *     the near term.
+     *
+     *     This would actually be an interesting way to represent user-defined
+     *     functions or more expressive rules-based systems. --)
+     * 
+ * + * .google.firestore.v1.Pipeline pipeline_value = 21; + */ + public com.google.firestore.v1.Pipeline.Builder getPipelineValueBuilder() { + return getPipelineValueFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * A value that represents an unevaluated pipeline.
+     *
+     * **Requires:**
+     *
+     * * Not allowed to be used when writing documents.
+     *
+     * (-- NOTE(batchik): similar to above, there is no reason to not allow
+     *     storing expressions into the database, just no plan to support in
+     *     the near term.
+     *
+     *     This would actually be an interesting way to represent user-defined
+     *     functions or more expressive rules-based systems. --)
+     * 
+ * + * .google.firestore.v1.Pipeline pipeline_value = 21; + */ + @java.lang.Override + public com.google.firestore.v1.PipelineOrBuilder getPipelineValueOrBuilder() { + if ((valueTypeCase_ == 21) && (pipelineValueBuilder_ != null)) { + return pipelineValueBuilder_.getMessageOrBuilder(); + } else { + if (valueTypeCase_ == 21) { + return (com.google.firestore.v1.Pipeline) valueType_; + } + return com.google.firestore.v1.Pipeline.getDefaultInstance(); + } + } + /** + * + * + *
+     * A value that represents an unevaluated pipeline.
+     *
+     * **Requires:**
+     *
+     * * Not allowed to be used when writing documents.
+     *
+     * (-- NOTE(batchik): similar to above, there is no reason to not allow
+     *     storing expressions into the database, just no plan to support in
+     *     the near term.
+     *
+     *     This would actually be an interesting way to represent user-defined
+     *     functions or more expressive rules-based systems. --)
+     * 
+ * + * .google.firestore.v1.Pipeline pipeline_value = 21; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.firestore.v1.Pipeline, + com.google.firestore.v1.Pipeline.Builder, + com.google.firestore.v1.PipelineOrBuilder> + getPipelineValueFieldBuilder() { + if (pipelineValueBuilder_ == null) { + if (!(valueTypeCase_ == 21)) { + valueType_ = com.google.firestore.v1.Pipeline.getDefaultInstance(); + } + pipelineValueBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.firestore.v1.Pipeline, + com.google.firestore.v1.Pipeline.Builder, + com.google.firestore.v1.PipelineOrBuilder>( + (com.google.firestore.v1.Pipeline) valueType_, getParentForChildren(), isClean()); + valueType_ = null; + } + valueTypeCase_ = 21; + onChanged(); + return pipelineValueBuilder_; + } + @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); diff --git a/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/ValueOrBuilder.java b/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/ValueOrBuilder.java index 560bfba7c..7d492ab7d 100644 --- a/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/ValueOrBuilder.java +++ b/proto-google-cloud-firestore-v1/src/main/java/com/google/firestore/v1/ValueOrBuilder.java @@ -414,5 +414,214 @@ public interface ValueOrBuilder */ com.google.firestore.v1.MapValueOrBuilder getMapValueOrBuilder(); + /** + * + * + *
+   * Value which references a field.
+   *
+   * This is considered relative (vs absolute) since it only refers to a field
+   * and not a field within a particular document.
+   *
+   * **Requires:**
+   *
+   * * Must follow [field reference][FieldReference.field_path] limitations.
+   *
+   * * Not allowed to be used when writing documents.
+   *
+   * (-- NOTE(batchik): long term, there is no reason this type should not be
+   *     allowed to be used on the write path. --)
+   * 
+ * + * string field_reference_value = 19; + * + * @return Whether the fieldReferenceValue field is set. + */ + boolean hasFieldReferenceValue(); + /** + * + * + *
+   * Value which references a field.
+   *
+   * This is considered relative (vs absolute) since it only refers to a field
+   * and not a field within a particular document.
+   *
+   * **Requires:**
+   *
+   * * Must follow [field reference][FieldReference.field_path] limitations.
+   *
+   * * Not allowed to be used when writing documents.
+   *
+   * (-- NOTE(batchik): long term, there is no reason this type should not be
+   *     allowed to be used on the write path. --)
+   * 
+ * + * string field_reference_value = 19; + * + * @return The fieldReferenceValue. + */ + java.lang.String getFieldReferenceValue(); + /** + * + * + *
+   * Value which references a field.
+   *
+   * This is considered relative (vs absolute) since it only refers to a field
+   * and not a field within a particular document.
+   *
+   * **Requires:**
+   *
+   * * Must follow [field reference][FieldReference.field_path] limitations.
+   *
+   * * Not allowed to be used when writing documents.
+   *
+   * (-- NOTE(batchik): long term, there is no reason this type should not be
+   *     allowed to be used on the write path. --)
+   * 
+ * + * string field_reference_value = 19; + * + * @return The bytes for fieldReferenceValue. + */ + com.google.protobuf.ByteString getFieldReferenceValueBytes(); + + /** + * + * + *
+   * A value that represents an unevaluated expression.
+   *
+   * **Requires:**
+   *
+   * * Not allowed to be used when writing documents.
+   *
+   * (-- NOTE(batchik): similar to above, there is no reason to not allow
+   *     storing expressions into the database, just no plan to support in
+   *     the near term.
+   *
+   *     This would actually be an interesting way to represent user-defined
+   *     functions or more expressive rules-based systems. --)
+   * 
+ * + * .google.firestore.v1.Function function_value = 20; + * + * @return Whether the functionValue field is set. + */ + boolean hasFunctionValue(); + /** + * + * + *
+   * A value that represents an unevaluated expression.
+   *
+   * **Requires:**
+   *
+   * * Not allowed to be used when writing documents.
+   *
+   * (-- NOTE(batchik): similar to above, there is no reason to not allow
+   *     storing expressions into the database, just no plan to support in
+   *     the near term.
+   *
+   *     This would actually be an interesting way to represent user-defined
+   *     functions or more expressive rules-based systems. --)
+   * 
+ * + * .google.firestore.v1.Function function_value = 20; + * + * @return The functionValue. + */ + com.google.firestore.v1.Function getFunctionValue(); + /** + * + * + *
+   * A value that represents an unevaluated expression.
+   *
+   * **Requires:**
+   *
+   * * Not allowed to be used when writing documents.
+   *
+   * (-- NOTE(batchik): similar to above, there is no reason to not allow
+   *     storing expressions into the database, just no plan to support in
+   *     the near term.
+   *
+   *     This would actually be an interesting way to represent user-defined
+   *     functions or more expressive rules-based systems. --)
+   * 
+ * + * .google.firestore.v1.Function function_value = 20; + */ + com.google.firestore.v1.FunctionOrBuilder getFunctionValueOrBuilder(); + + /** + * + * + *
+   * A value that represents an unevaluated pipeline.
+   *
+   * **Requires:**
+   *
+   * * Not allowed to be used when writing documents.
+   *
+   * (-- NOTE(batchik): similar to above, there is no reason to not allow
+   *     storing expressions into the database, just no plan to support in
+   *     the near term.
+   *
+   *     This would actually be an interesting way to represent user-defined
+   *     functions or more expressive rules-based systems. --)
+   * 
+ * + * .google.firestore.v1.Pipeline pipeline_value = 21; + * + * @return Whether the pipelineValue field is set. + */ + boolean hasPipelineValue(); + /** + * + * + *
+   * A value that represents an unevaluated pipeline.
+   *
+   * **Requires:**
+   *
+   * * Not allowed to be used when writing documents.
+   *
+   * (-- NOTE(batchik): similar to above, there is no reason to not allow
+   *     storing expressions into the database, just no plan to support in
+   *     the near term.
+   *
+   *     This would actually be an interesting way to represent user-defined
+   *     functions or more expressive rules-based systems. --)
+   * 
+ * + * .google.firestore.v1.Pipeline pipeline_value = 21; + * + * @return The pipelineValue. + */ + com.google.firestore.v1.Pipeline getPipelineValue(); + /** + * + * + *
+   * A value that represents an unevaluated pipeline.
+   *
+   * **Requires:**
+   *
+   * * Not allowed to be used when writing documents.
+   *
+   * (-- NOTE(batchik): similar to above, there is no reason to not allow
+   *     storing expressions into the database, just no plan to support in
+   *     the near term.
+   *
+   *     This would actually be an interesting way to represent user-defined
+   *     functions or more expressive rules-based systems. --)
+   * 
+ * + * .google.firestore.v1.Pipeline pipeline_value = 21; + */ + com.google.firestore.v1.PipelineOrBuilder getPipelineValueOrBuilder(); + com.google.firestore.v1.Value.ValueTypeCase getValueTypeCase(); } diff --git a/proto-google-cloud-firestore-v1/src/main/proto/google/firestore/v1/document.proto b/proto-google-cloud-firestore-v1/src/main/proto/google/firestore/v1/document.proto index 5ad6752aa..5348fe643 100644 --- a/proto-google-cloud-firestore-v1/src/main/proto/google/firestore/v1/document.proto +++ b/proto-google-cloud-firestore-v1/src/main/proto/google/firestore/v1/document.proto @@ -128,6 +128,50 @@ message Value { // A map value. MapValue map_value = 6; + + + // Value which references a field. + // + // This is considered relative (vs absolute) since it only refers to a field + // and not a field within a particular document. + // + // **Requires:** + // + // * Must follow [field reference][FieldReference.field_path] limitations. + // + // * Not allowed to be used when writing documents. + // + // (-- NOTE(batchik): long term, there is no reason this type should not be + // allowed to be used on the write path. --) + string field_reference_value = 19; + + // A value that represents an unevaluated expression. + // + // **Requires:** + // + // * Not allowed to be used when writing documents. + // + // (-- NOTE(batchik): similar to above, there is no reason to not allow + // storing expressions into the database, just no plan to support in + // the near term. + // + // This would actually be an interesting way to represent user-defined + // functions or more expressive rules-based systems. --) + Function function_value = 20; + + // A value that represents an unevaluated pipeline. + // + // **Requires:** + // + // * Not allowed to be used when writing documents. + // + // (-- NOTE(batchik): similar to above, there is no reason to not allow + // storing expressions into the database, just no plan to support in + // the near term. + // + // This would actually be an interesting way to represent user-defined + // functions or more expressive rules-based systems. --) + Pipeline pipeline_value = 21; } } @@ -147,3 +191,73 @@ message MapValue { // not exceed 1,500 bytes and cannot be empty. map fields = 1; } + +// Represents an unevaluated scalar expression. +// +// For example, the expression `like(user_name, "%alice%")` is represented as: +// +// ``` +// name: "like" +// args { field_reference: "user_name" } +// args { string_value: "%alice%" } +// ``` +// +// (-- api-linter: core::0123::resource-annotation=disabled +// aip.dev/not-precedent: this is not a One Platform API resource. --) +message Function { + // The name of the function to evaluate. + // + // **Requires:** + // + // * must be in snake case (lower case with underscore separator). + // + string name = 1; + + // Ordered list of arguments the given function expects. + repeated Value args = 2; + + // Optional named arguments that certain functions may support. + map options = 3; +} + +// A Firestore query represented as an ordered list of operations / stages. +message Pipeline { + // A single operation within a pipeline. + // + // A stage is made up of a unique name, and a list of arguments. The exact + // number of arguments & types is dependent on the stage type. + // + // To give an example, the stage `filter(state = "MD")` would be encoded as: + // + // ``` + // name: "filter" + // args { + // function_value { + // name: "eq" + // args { field_reference_value: "state" } + // args { string_value: "MD" } + // } + // } + // ``` + // + // See public documentation for the full list. + message Stage { + // The name of the stage to evaluate. + // + // **Requires:** + // + // * must be in snake case (lower case with underscore separator). + // + string name = 1; + + // Ordered list of arguments the given stage expects. + repeated Value args = 2; + + // Optional named arguments that certain functions may support. + map options = 3; + } + + // Ordered list of stages to evaluate. + repeated Stage stages = 1; +} + diff --git a/proto-google-cloud-firestore-v1/src/main/proto/google/firestore/v1/firestore.proto b/proto-google-cloud-firestore-v1/src/main/proto/google/firestore/v1/firestore.proto index 2ed6bf070..f8718bb67 100644 --- a/proto-google-cloud-firestore-v1/src/main/proto/google/firestore/v1/firestore.proto +++ b/proto-google-cloud-firestore-v1/src/main/proto/google/firestore/v1/firestore.proto @@ -22,6 +22,7 @@ import "google/api/field_behavior.proto"; import "google/firestore/v1/aggregation_result.proto"; import "google/firestore/v1/common.proto"; import "google/firestore/v1/document.proto"; +import "google/firestore/v1/pipeline.proto"; import "google/firestore/v1/query.proto"; import "google/firestore/v1/query_profile.proto"; import "google/firestore/v1/write.proto"; @@ -140,6 +141,15 @@ service Firestore { }; } + // Executes a pipeline query. + rpc ExecutePipeline(ExecutePipelineRequest) + returns (stream ExecutePipelineResponse) { + option (google.api.http) = { + post: "/v1beta1/{database=projects/*/databases/*}:executePipeline" + body: "*" + }; + } + // Runs an aggregation query. // // Rather than producing [Document][google.firestore.v1.Document] results like @@ -624,6 +634,82 @@ message RunQueryResponse { ExplainMetrics explain_metrics = 11; } +// The request for [Firestore.ExecutePipeline][]. +message ExecutePipelineRequest { + // Database identifier, in the form `projects/{project}/databases/{database}`. + string database = 1 [ + (google.api.field_behavior) = REQUIRED + ]; + + oneof pipeline_type { + // A pipelined operation. + StructuredPipeline structured_pipeline = 2; + } + + // Optional consistency arguments, defaults to strong consistency. + oneof consistency_selector { + // Run the query within an already active transaction. + // + // The value here is the opaque transaction ID to execute the query in. + bytes transaction = 5; + + // Execute the pipeline in a new transaction. + // + // The identifier of the newly created transaction will be returned in the + // first response on the stream. This defaults to a read-only transaction. + TransactionOptions new_transaction = 6; + + // Execute the pipeline in a snapshot transaction at the given time. + // + // This must be a microsecond precision timestamp within the past one hour, + // or if Point-in-Time Recovery is enabled, can additionally be a whole + // minute timestamp within the past 7 days. + google.protobuf.Timestamp read_time = 7; + } + + // Explain / analyze options for the pipeline. + // ExplainOptions explain_options = 8 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response for [Firestore.Execute][]. +message ExecutePipelineResponse { + // Newly created transaction identifier. + // + // This field is only specified on the first response from the server when + // the request specified [ExecuteRequest.new_transaction][]. + bytes transaction = 1; + + // An ordered batch of results returned executing a pipeline. + // + // The batch size is variable, and can even be zero for when only a partial + // progress message is returned. + // + // The fields present in the returned documents are only those that were + // explicitly requested in the pipeline, this include those like + // [`__name__`][Document.name] & [`__update_time__`][Document.update_time]. + // This is explicitly a divergence from `Firestore.RunQuery` / + // `Firestore.GetDocument` RPCs which always return such fields even when they + // are not specified in the [`mask`][DocumentMask]. + repeated Document results = 2; + + // The time at which the document(s) were read. + // + // This may be monotonically increasing; in this case, the previous documents + // in the result stream are guaranteed not to have changed between their + // `execution_time` and this one. + // + // If the query returns no results, a response with `execution_time` and no + // `results` will be sent, and this represents the time at which the operation + // was run. + google.protobuf.Timestamp execution_time = 3; + + // Query explain metrics. + // + // Set on the last response when [ExecutePipelineRequest.explain_options][] + // was specified on the request. + // ExplainMetrics explain_metrics = 4; +} + // The request for // [Firestore.RunAggregationQuery][google.firestore.v1.Firestore.RunAggregationQuery]. message RunAggregationQueryRequest { diff --git a/proto-google-cloud-firestore-v1/src/main/proto/google/firestore/v1/pipeline.proto b/proto-google-cloud-firestore-v1/src/main/proto/google/firestore/v1/pipeline.proto new file mode 100644 index 000000000..0a198cd6e --- /dev/null +++ b/proto-google-cloud-firestore-v1/src/main/proto/google/firestore/v1/pipeline.proto @@ -0,0 +1,27 @@ + +syntax = "proto3"; +package google.firestore.v1; +import "google/firestore/v1/document.proto"; +option csharp_namespace = "Google.Cloud.Firestore.V1"; +option php_namespace = "Google\\Cloud\\Firestore\\V1"; +option ruby_package = "Google::Cloud::Firestore::V1"; +option java_multiple_files = true; +option java_package = "com.google.firestore.v1"; +option java_outer_classname = "PipelineProto"; +option objc_class_prefix = "GCFS"; +// A Firestore query represented as an ordered list of operations / stages. +// +// This is considered the top-level function which plans & executes a query. +// It is logically equivalent to `query(stages, options)`, but prevents the +// client from having to build a function wrapper. +message StructuredPipeline { + // The pipeline query to execute. + Pipeline pipeline = 1; + // Optional query-level arguments. + // + // (-- Think query statement hints. --) + // + // (-- TODO(batchik): define the api contract of using an unsupported hint --) + map options = 2; +} + diff --git a/proto-google-cloud-firestore-v1/src/main/proto/google/firestore/v1/query_profile.proto b/proto-google-cloud-firestore-v1/src/main/proto/google/firestore/v1/query_profile.proto index de27144a0..931e083b0 100644 --- a/proto-google-cloud-firestore-v1/src/main/proto/google/firestore/v1/query_profile.proto +++ b/proto-google-cloud-firestore-v1/src/main/proto/google/firestore/v1/query_profile.proto @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2023 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License.