diff --git a/java-chat/google-cloud-chat/src/main/resources/META-INF/native-image/com.google.chat.v1/reflect-config.json b/java-chat/google-cloud-chat/src/main/resources/META-INF/native-image/com.google.chat.v1/reflect-config.json index e6eab3f877c5..67ec7fa1b797 100644 --- a/java-chat/google-cloud-chat/src/main/resources/META-INF/native-image/com.google.chat.v1/reflect-config.json +++ b/java-chat/google-cloud-chat/src/main/resources/META-INF/native-image/com.google.chat.v1/reflect-config.json @@ -1817,6 +1817,78 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.chat.v1.Citation", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.chat.v1.Citation$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.chat.v1.CitedSource", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.chat.v1.CitedSource$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.chat.v1.CitedSource$Footer", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.chat.v1.CitedSource$Footer$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.chat.v1.CitedSource$Snippet", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.chat.v1.CitedSource$Snippet$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.chat.v1.CompleteImportSpaceRequest", "queryAllDeclaredConstructors": true, @@ -2429,6 +2501,42 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.chat.v1.Elements", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.chat.v1.Elements$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.chat.v1.ElementsImage", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.chat.v1.ElementsImage$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.chat.v1.Emoji", "queryAllDeclaredConstructors": true, diff --git a/java-chat/google-cloud-chat/src/test/java/com/google/chat/v1/ChatServiceClientHttpJsonTest.java b/java-chat/google-cloud-chat/src/test/java/com/google/chat/v1/ChatServiceClientHttpJsonTest.java index 656ecb019c9f..ce6d11915a9e 100644 --- a/java-chat/google-cloud-chat/src/test/java/com/google/chat/v1/ChatServiceClientHttpJsonTest.java +++ b/java-chat/google-cloud-chat/src/test/java/com/google/chat/v1/ChatServiceClientHttpJsonTest.java @@ -121,6 +121,7 @@ public void createMessageTest() throws Exception { .setQuotedMessageMetadata(QuotedMessageMetadata.newBuilder().build()) .addAllAttachedGifs(new ArrayList()) .addAllAccessoryWidgets(new ArrayList()) + .setElements(Elements.newBuilder().build()) .setMarkupSyntax(MarkupSyntax.forNumber(0)) .build(); mockService.addResponse(expectedResponse); @@ -196,6 +197,7 @@ public void createMessageTest2() throws Exception { .setQuotedMessageMetadata(QuotedMessageMetadata.newBuilder().build()) .addAllAttachedGifs(new ArrayList()) .addAllAccessoryWidgets(new ArrayList()) + .setElements(Elements.newBuilder().build()) .setMarkupSyntax(MarkupSyntax.forNumber(0)) .build(); mockService.addResponse(expectedResponse); @@ -563,6 +565,7 @@ public void getMessageTest() throws Exception { .setQuotedMessageMetadata(QuotedMessageMetadata.newBuilder().build()) .addAllAttachedGifs(new ArrayList()) .addAllAccessoryWidgets(new ArrayList()) + .setElements(Elements.newBuilder().build()) .setMarkupSyntax(MarkupSyntax.forNumber(0)) .build(); mockService.addResponse(expectedResponse); @@ -634,6 +637,7 @@ public void getMessageTest2() throws Exception { .setQuotedMessageMetadata(QuotedMessageMetadata.newBuilder().build()) .addAllAttachedGifs(new ArrayList()) .addAllAccessoryWidgets(new ArrayList()) + .setElements(Elements.newBuilder().build()) .setMarkupSyntax(MarkupSyntax.forNumber(0)) .build(); mockService.addResponse(expectedResponse); @@ -705,6 +709,7 @@ public void updateMessageTest() throws Exception { .setQuotedMessageMetadata(QuotedMessageMetadata.newBuilder().build()) .addAllAttachedGifs(new ArrayList()) .addAllAccessoryWidgets(new ArrayList()) + .setElements(Elements.newBuilder().build()) .setMarkupSyntax(MarkupSyntax.forNumber(0)) .build(); mockService.addResponse(expectedResponse); @@ -738,6 +743,7 @@ public void updateMessageTest() throws Exception { .setQuotedMessageMetadata(QuotedMessageMetadata.newBuilder().build()) .addAllAttachedGifs(new ArrayList()) .addAllAccessoryWidgets(new ArrayList()) + .setElements(Elements.newBuilder().build()) .setMarkupSyntax(MarkupSyntax.forNumber(0)) .build(); FieldMask updateMask = FieldMask.newBuilder().build(); @@ -797,6 +803,7 @@ public void updateMessageExceptionTest() throws Exception { .setQuotedMessageMetadata(QuotedMessageMetadata.newBuilder().build()) .addAllAttachedGifs(new ArrayList()) .addAllAccessoryWidgets(new ArrayList()) + .setElements(Elements.newBuilder().build()) .setMarkupSyntax(MarkupSyntax.forNumber(0)) .build(); FieldMask updateMask = FieldMask.newBuilder().build(); diff --git a/java-chat/google-cloud-chat/src/test/java/com/google/chat/v1/ChatServiceClientTest.java b/java-chat/google-cloud-chat/src/test/java/com/google/chat/v1/ChatServiceClientTest.java index 6e24a8cd21cb..9f8ed58440a2 100644 --- a/java-chat/google-cloud-chat/src/test/java/com/google/chat/v1/ChatServiceClientTest.java +++ b/java-chat/google-cloud-chat/src/test/java/com/google/chat/v1/ChatServiceClientTest.java @@ -124,6 +124,7 @@ public void createMessageTest() throws Exception { .setQuotedMessageMetadata(QuotedMessageMetadata.newBuilder().build()) .addAllAttachedGifs(new ArrayList()) .addAllAccessoryWidgets(new ArrayList()) + .setElements(Elements.newBuilder().build()) .setMarkupSyntax(MarkupSyntax.forNumber(0)) .build(); mockChatService.addResponse(expectedResponse); @@ -195,6 +196,7 @@ public void createMessageTest2() throws Exception { .setQuotedMessageMetadata(QuotedMessageMetadata.newBuilder().build()) .addAllAttachedGifs(new ArrayList()) .addAllAccessoryWidgets(new ArrayList()) + .setElements(Elements.newBuilder().build()) .setMarkupSyntax(MarkupSyntax.forNumber(0)) .build(); mockChatService.addResponse(expectedResponse); @@ -522,6 +524,7 @@ public void getMessageTest() throws Exception { .setQuotedMessageMetadata(QuotedMessageMetadata.newBuilder().build()) .addAllAttachedGifs(new ArrayList()) .addAllAccessoryWidgets(new ArrayList()) + .setElements(Elements.newBuilder().build()) .setMarkupSyntax(MarkupSyntax.forNumber(0)) .build(); mockChatService.addResponse(expectedResponse); @@ -587,6 +590,7 @@ public void getMessageTest2() throws Exception { .setQuotedMessageMetadata(QuotedMessageMetadata.newBuilder().build()) .addAllAttachedGifs(new ArrayList()) .addAllAccessoryWidgets(new ArrayList()) + .setElements(Elements.newBuilder().build()) .setMarkupSyntax(MarkupSyntax.forNumber(0)) .build(); mockChatService.addResponse(expectedResponse); @@ -652,6 +656,7 @@ public void updateMessageTest() throws Exception { .setQuotedMessageMetadata(QuotedMessageMetadata.newBuilder().build()) .addAllAttachedGifs(new ArrayList()) .addAllAccessoryWidgets(new ArrayList()) + .setElements(Elements.newBuilder().build()) .setMarkupSyntax(MarkupSyntax.forNumber(0)) .build(); mockChatService.addResponse(expectedResponse); diff --git a/java-chat/proto-google-cloud-chat-v1/src/main/java/com/google/chat/v1/ActionStatusProto.java b/java-chat/proto-google-cloud-chat-v1/src/main/java/com/google/chat/v1/ActionStatusProto.java index e0c068bba98d..fc61de2c548a 100644 --- a/java-chat/proto-google-cloud-chat-v1/src/main/java/com/google/chat/v1/ActionStatusProto.java +++ b/java-chat/proto-google-cloud-chat-v1/src/main/java/com/google/chat/v1/ActionStatusProto.java @@ -54,19 +54,21 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { static { java.lang.String[] descriptorData = { "\n\"google/chat/v1/action_status.proto\022\016go" - + "ogle.chat.v1\032\025google/rpc/code.proto\"R\n\014A" - + "ctionStatus\022%\n\013status_code\030\001 \001(\0162\020.googl" - + "e.rpc.Code\022\033\n\023user_facing_message\030\002 \001(\tB" - + "\252\001\n\022com.google.chat.v1B\021ActionStatusProt" - + "oP\001Z,cloud.google.com/go/chat/apiv1/chat" - + "pb;chatpb\242\002\013DYNAPIProto\252\002\023Google.Apps.Ch" - + "at.V1\312\002\023Google\\Apps\\Chat\\V1\352\002\026Google::Ap" - + "ps::Chat::V1b\006proto3" + + "ogle.chat.v1\032\037google/api/field_behavior." + + "proto\032\025google/rpc/code.proto\"R\n\014ActionSt" + + "atus\022%\n\013status_code\030\001 \001(\0162\020.google.rpc.C" + + "ode\022\033\n\023user_facing_message\030\002 \001(\tB\252\001\n\022com" + + ".google.chat.v1B\021ActionStatusProtoP\001Z,cl" + + "oud.google.com/go/chat/apiv1/chatpb;chat" + + "pb\242\002\013DYNAPIProto\252\002\023Google.Apps.Chat.V1\312\002" + + "\023Google\\Apps\\Chat\\V1\352\002\026Google::Apps::Cha" + + "t::V1b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.api.FieldBehaviorProto.getDescriptor(), com.google.rpc.CodeProto.getDescriptor(), }); internal_static_google_chat_v1_ActionStatus_descriptor = getDescriptor().getMessageType(0); @@ -77,6 +79,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "StatusCode", "UserFacingMessage", }); descriptor.resolveAllFeaturesImmutable(); + com.google.api.FieldBehaviorProto.getDescriptor(); com.google.rpc.CodeProto.getDescriptor(); } diff --git a/java-chat/proto-google-cloud-chat-v1/src/main/java/com/google/chat/v1/Citation.java b/java-chat/proto-google-cloud-chat-v1/src/main/java/com/google/chat/v1/Citation.java new file mode 100644 index 000000000000..55a709babf03 --- /dev/null +++ b/java-chat/proto-google-cloud-chat-v1/src/main/java/com/google/chat/v1/Citation.java @@ -0,0 +1,1205 @@ +/* + * Copyright 2026 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! +// NO CHECKED-IN PROTOBUF GENCODE +// source: google/chat/v1/citation.proto +// Protobuf Java Version: 4.33.6 + +package com.google.chat.v1; + +/** + * + * + *
+ * Citations are inline references that can provide users more detailed
+ * information about the inline reference. Corresponding inline citations
+ * should be present in the message text in a markup format of
+ * `<chat-citation data-id="{id}">{text}</chat-citation>`. Citations are
+ * only supported when the message's `markup_syntax` is set to `MARKDOWN`.
+ *
+ * Unreferenced citations in `Elements.citations` (those without a matching
+ * `<chat-citation>` tag in the message text) are ignored and do not cause the
+ * message to be rejected.
+ * 
+ * + * Protobuf type {@code google.chat.v1.Citation} + */ +@com.google.protobuf.Generated +public final class Citation extends com.google.protobuf.GeneratedMessage + implements + // @@protoc_insertion_point(message_implements:google.chat.v1.Citation) + CitationOrBuilder { + private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 6, + /* suffix= */ "", + "Citation"); + } + + // Use Citation.newBuilder() to construct. + private Citation(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + + private Citation() { + id_ = ""; + citedSources_ = java.util.Collections.emptyList(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.chat.v1.CitationProto.internal_static_google_chat_v1_Citation_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.chat.v1.CitationProto + .internal_static_google_chat_v1_Citation_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.chat.v1.Citation.class, com.google.chat.v1.Citation.Builder.class); + } + + public static final int ID_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object id_ = ""; + + /** + * + * + *
+   * Required. The ID of the citation. This ID is defined by the app creating
+   * the citation and must match the `data-id` attribute of the
+   * `<chat-citation>` tag in the message text. Must contain only ASCII letters
+   * and numbers, and less than 63 characters.
+   * 
+ * + * string id = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The id. + */ + @java.lang.Override + public java.lang.String getId() { + java.lang.Object ref = id_; + 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(); + id_ = s; + return s; + } + } + + /** + * + * + *
+   * Required. The ID of the citation. This ID is defined by the app creating
+   * the citation and must match the `data-id` attribute of the
+   * `<chat-citation>` tag in the message text. Must contain only ASCII letters
+   * and numbers, and less than 63 characters.
+   * 
+ * + * string id = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for id. + */ + @java.lang.Override + public com.google.protobuf.ByteString getIdBytes() { + java.lang.Object ref = id_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + id_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CITED_SOURCES_FIELD_NUMBER = 3; + + @SuppressWarnings("serial") + private java.util.List citedSources_; + + /** + * + * + *
+   * Optional. A list of sources that are relevant to the citation. Sources are
+   * displayed in the citation hover card.
+   * 
+ * + * + * repeated .google.chat.v1.CitedSource cited_sources = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public java.util.List getCitedSourcesList() { + return citedSources_; + } + + /** + * + * + *
+   * Optional. A list of sources that are relevant to the citation. Sources are
+   * displayed in the citation hover card.
+   * 
+ * + * + * repeated .google.chat.v1.CitedSource cited_sources = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public java.util.List + getCitedSourcesOrBuilderList() { + return citedSources_; + } + + /** + * + * + *
+   * Optional. A list of sources that are relevant to the citation. Sources are
+   * displayed in the citation hover card.
+   * 
+ * + * + * repeated .google.chat.v1.CitedSource cited_sources = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public int getCitedSourcesCount() { + return citedSources_.size(); + } + + /** + * + * + *
+   * Optional. A list of sources that are relevant to the citation. Sources are
+   * displayed in the citation hover card.
+   * 
+ * + * + * repeated .google.chat.v1.CitedSource cited_sources = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.chat.v1.CitedSource getCitedSources(int index) { + return citedSources_.get(index); + } + + /** + * + * + *
+   * Optional. A list of sources that are relevant to the citation. Sources are
+   * displayed in the citation hover card.
+   * 
+ * + * + * repeated .google.chat.v1.CitedSource cited_sources = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.chat.v1.CitedSourceOrBuilder getCitedSourcesOrBuilder(int index) { + return citedSources_.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 { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(id_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, id_); + } + for (int i = 0; i < citedSources_.size(); i++) { + output.writeMessage(3, citedSources_.get(i)); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(id_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, id_); + } + for (int i = 0; i < citedSources_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, citedSources_.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.chat.v1.Citation)) { + return super.equals(obj); + } + com.google.chat.v1.Citation other = (com.google.chat.v1.Citation) obj; + + if (!getId().equals(other.getId())) return false; + if (!getCitedSourcesList().equals(other.getCitedSourcesList())) 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) + ID_FIELD_NUMBER; + hash = (53 * hash) + getId().hashCode(); + if (getCitedSourcesCount() > 0) { + hash = (37 * hash) + CITED_SOURCES_FIELD_NUMBER; + hash = (53 * hash) + getCitedSourcesList().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.chat.v1.Citation parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.chat.v1.Citation parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.chat.v1.Citation parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.chat.v1.Citation 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.chat.v1.Citation parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.chat.v1.Citation parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.chat.v1.Citation parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.chat.v1.Citation parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.chat.v1.Citation parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.chat.v1.Citation parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.chat.v1.Citation parseFrom(com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.chat.v1.Citation parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.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.chat.v1.Citation 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.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * + * + *
+   * Citations are inline references that can provide users more detailed
+   * information about the inline reference. Corresponding inline citations
+   * should be present in the message text in a markup format of
+   * `<chat-citation data-id="{id}">{text}</chat-citation>`. Citations are
+   * only supported when the message's `markup_syntax` is set to `MARKDOWN`.
+   *
+   * Unreferenced citations in `Elements.citations` (those without a matching
+   * `<chat-citation>` tag in the message text) are ignored and do not cause the
+   * message to be rejected.
+   * 
+ * + * Protobuf type {@code google.chat.v1.Citation} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder + implements + // @@protoc_insertion_point(builder_implements:google.chat.v1.Citation) + com.google.chat.v1.CitationOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.chat.v1.CitationProto.internal_static_google_chat_v1_Citation_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.chat.v1.CitationProto + .internal_static_google_chat_v1_Citation_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.chat.v1.Citation.class, com.google.chat.v1.Citation.Builder.class); + } + + // Construct using com.google.chat.v1.Citation.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + id_ = ""; + if (citedSourcesBuilder_ == null) { + citedSources_ = java.util.Collections.emptyList(); + } else { + citedSources_ = null; + citedSourcesBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.chat.v1.CitationProto.internal_static_google_chat_v1_Citation_descriptor; + } + + @java.lang.Override + public com.google.chat.v1.Citation getDefaultInstanceForType() { + return com.google.chat.v1.Citation.getDefaultInstance(); + } + + @java.lang.Override + public com.google.chat.v1.Citation build() { + com.google.chat.v1.Citation result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.chat.v1.Citation buildPartial() { + com.google.chat.v1.Citation result = new com.google.chat.v1.Citation(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields(com.google.chat.v1.Citation result) { + if (citedSourcesBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0)) { + citedSources_ = java.util.Collections.unmodifiableList(citedSources_); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.citedSources_ = citedSources_; + } else { + result.citedSources_ = citedSourcesBuilder_.build(); + } + } + + private void buildPartial0(com.google.chat.v1.Citation result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.id_ = id_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.chat.v1.Citation) { + return mergeFrom((com.google.chat.v1.Citation) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.chat.v1.Citation other) { + if (other == com.google.chat.v1.Citation.getDefaultInstance()) return this; + if (!other.getId().isEmpty()) { + id_ = other.id_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (citedSourcesBuilder_ == null) { + if (!other.citedSources_.isEmpty()) { + if (citedSources_.isEmpty()) { + citedSources_ = other.citedSources_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureCitedSourcesIsMutable(); + citedSources_.addAll(other.citedSources_); + } + onChanged(); + } + } else { + if (!other.citedSources_.isEmpty()) { + if (citedSourcesBuilder_.isEmpty()) { + citedSourcesBuilder_.dispose(); + citedSourcesBuilder_ = null; + citedSources_ = other.citedSources_; + bitField0_ = (bitField0_ & ~0x00000002); + citedSourcesBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders + ? internalGetCitedSourcesFieldBuilder() + : null; + } else { + citedSourcesBuilder_.addAllMessages(other.citedSources_); + } + } + } + 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: + { + id_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 26: + { + com.google.chat.v1.CitedSource m = + input.readMessage(com.google.chat.v1.CitedSource.parser(), extensionRegistry); + if (citedSourcesBuilder_ == null) { + ensureCitedSourcesIsMutable(); + citedSources_.add(m); + } else { + citedSourcesBuilder_.addMessage(m); + } + 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 id_ = ""; + + /** + * + * + *
+     * Required. The ID of the citation. This ID is defined by the app creating
+     * the citation and must match the `data-id` attribute of the
+     * `<chat-citation>` tag in the message text. Must contain only ASCII letters
+     * and numbers, and less than 63 characters.
+     * 
+ * + * string id = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The id. + */ + public java.lang.String getId() { + java.lang.Object ref = id_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + id_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
+     * Required. The ID of the citation. This ID is defined by the app creating
+     * the citation and must match the `data-id` attribute of the
+     * `<chat-citation>` tag in the message text. Must contain only ASCII letters
+     * and numbers, and less than 63 characters.
+     * 
+ * + * string id = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for id. + */ + public com.google.protobuf.ByteString getIdBytes() { + java.lang.Object ref = id_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + id_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
+     * Required. The ID of the citation. This ID is defined by the app creating
+     * the citation and must match the `data-id` attribute of the
+     * `<chat-citation>` tag in the message text. Must contain only ASCII letters
+     * and numbers, and less than 63 characters.
+     * 
+ * + * string id = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The id to set. + * @return This builder for chaining. + */ + public Builder setId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + id_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + /** + * + * + *
+     * Required. The ID of the citation. This ID is defined by the app creating
+     * the citation and must match the `data-id` attribute of the
+     * `<chat-citation>` tag in the message text. Must contain only ASCII letters
+     * and numbers, and less than 63 characters.
+     * 
+ * + * string id = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearId() { + id_ = getDefaultInstance().getId(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + + /** + * + * + *
+     * Required. The ID of the citation. This ID is defined by the app creating
+     * the citation and must match the `data-id` attribute of the
+     * `<chat-citation>` tag in the message text. Must contain only ASCII letters
+     * and numbers, and less than 63 characters.
+     * 
+ * + * string id = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for id to set. + * @return This builder for chaining. + */ + public Builder setIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + id_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.util.List citedSources_ = + java.util.Collections.emptyList(); + + private void ensureCitedSourcesIsMutable() { + if (!((bitField0_ & 0x00000002) != 0)) { + citedSources_ = new java.util.ArrayList(citedSources_); + bitField0_ |= 0x00000002; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.google.chat.v1.CitedSource, + com.google.chat.v1.CitedSource.Builder, + com.google.chat.v1.CitedSourceOrBuilder> + citedSourcesBuilder_; + + /** + * + * + *
+     * Optional. A list of sources that are relevant to the citation. Sources are
+     * displayed in the citation hover card.
+     * 
+ * + * + * repeated .google.chat.v1.CitedSource cited_sources = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public java.util.List getCitedSourcesList() { + if (citedSourcesBuilder_ == null) { + return java.util.Collections.unmodifiableList(citedSources_); + } else { + return citedSourcesBuilder_.getMessageList(); + } + } + + /** + * + * + *
+     * Optional. A list of sources that are relevant to the citation. Sources are
+     * displayed in the citation hover card.
+     * 
+ * + * + * repeated .google.chat.v1.CitedSource cited_sources = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public int getCitedSourcesCount() { + if (citedSourcesBuilder_ == null) { + return citedSources_.size(); + } else { + return citedSourcesBuilder_.getCount(); + } + } + + /** + * + * + *
+     * Optional. A list of sources that are relevant to the citation. Sources are
+     * displayed in the citation hover card.
+     * 
+ * + * + * repeated .google.chat.v1.CitedSource cited_sources = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.chat.v1.CitedSource getCitedSources(int index) { + if (citedSourcesBuilder_ == null) { + return citedSources_.get(index); + } else { + return citedSourcesBuilder_.getMessage(index); + } + } + + /** + * + * + *
+     * Optional. A list of sources that are relevant to the citation. Sources are
+     * displayed in the citation hover card.
+     * 
+ * + * + * repeated .google.chat.v1.CitedSource cited_sources = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setCitedSources(int index, com.google.chat.v1.CitedSource value) { + if (citedSourcesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureCitedSourcesIsMutable(); + citedSources_.set(index, value); + onChanged(); + } else { + citedSourcesBuilder_.setMessage(index, value); + } + return this; + } + + /** + * + * + *
+     * Optional. A list of sources that are relevant to the citation. Sources are
+     * displayed in the citation hover card.
+     * 
+ * + * + * repeated .google.chat.v1.CitedSource cited_sources = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setCitedSources( + int index, com.google.chat.v1.CitedSource.Builder builderForValue) { + if (citedSourcesBuilder_ == null) { + ensureCitedSourcesIsMutable(); + citedSources_.set(index, builderForValue.build()); + onChanged(); + } else { + citedSourcesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + + /** + * + * + *
+     * Optional. A list of sources that are relevant to the citation. Sources are
+     * displayed in the citation hover card.
+     * 
+ * + * + * repeated .google.chat.v1.CitedSource cited_sources = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder addCitedSources(com.google.chat.v1.CitedSource value) { + if (citedSourcesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureCitedSourcesIsMutable(); + citedSources_.add(value); + onChanged(); + } else { + citedSourcesBuilder_.addMessage(value); + } + return this; + } + + /** + * + * + *
+     * Optional. A list of sources that are relevant to the citation. Sources are
+     * displayed in the citation hover card.
+     * 
+ * + * + * repeated .google.chat.v1.CitedSource cited_sources = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder addCitedSources(int index, com.google.chat.v1.CitedSource value) { + if (citedSourcesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureCitedSourcesIsMutable(); + citedSources_.add(index, value); + onChanged(); + } else { + citedSourcesBuilder_.addMessage(index, value); + } + return this; + } + + /** + * + * + *
+     * Optional. A list of sources that are relevant to the citation. Sources are
+     * displayed in the citation hover card.
+     * 
+ * + * + * repeated .google.chat.v1.CitedSource cited_sources = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder addCitedSources(com.google.chat.v1.CitedSource.Builder builderForValue) { + if (citedSourcesBuilder_ == null) { + ensureCitedSourcesIsMutable(); + citedSources_.add(builderForValue.build()); + onChanged(); + } else { + citedSourcesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + + /** + * + * + *
+     * Optional. A list of sources that are relevant to the citation. Sources are
+     * displayed in the citation hover card.
+     * 
+ * + * + * repeated .google.chat.v1.CitedSource cited_sources = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder addCitedSources( + int index, com.google.chat.v1.CitedSource.Builder builderForValue) { + if (citedSourcesBuilder_ == null) { + ensureCitedSourcesIsMutable(); + citedSources_.add(index, builderForValue.build()); + onChanged(); + } else { + citedSourcesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + + /** + * + * + *
+     * Optional. A list of sources that are relevant to the citation. Sources are
+     * displayed in the citation hover card.
+     * 
+ * + * + * repeated .google.chat.v1.CitedSource cited_sources = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder addAllCitedSources( + java.lang.Iterable values) { + if (citedSourcesBuilder_ == null) { + ensureCitedSourcesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, citedSources_); + onChanged(); + } else { + citedSourcesBuilder_.addAllMessages(values); + } + return this; + } + + /** + * + * + *
+     * Optional. A list of sources that are relevant to the citation. Sources are
+     * displayed in the citation hover card.
+     * 
+ * + * + * repeated .google.chat.v1.CitedSource cited_sources = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearCitedSources() { + if (citedSourcesBuilder_ == null) { + citedSources_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + } else { + citedSourcesBuilder_.clear(); + } + return this; + } + + /** + * + * + *
+     * Optional. A list of sources that are relevant to the citation. Sources are
+     * displayed in the citation hover card.
+     * 
+ * + * + * repeated .google.chat.v1.CitedSource cited_sources = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder removeCitedSources(int index) { + if (citedSourcesBuilder_ == null) { + ensureCitedSourcesIsMutable(); + citedSources_.remove(index); + onChanged(); + } else { + citedSourcesBuilder_.remove(index); + } + return this; + } + + /** + * + * + *
+     * Optional. A list of sources that are relevant to the citation. Sources are
+     * displayed in the citation hover card.
+     * 
+ * + * + * repeated .google.chat.v1.CitedSource cited_sources = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.chat.v1.CitedSource.Builder getCitedSourcesBuilder(int index) { + return internalGetCitedSourcesFieldBuilder().getBuilder(index); + } + + /** + * + * + *
+     * Optional. A list of sources that are relevant to the citation. Sources are
+     * displayed in the citation hover card.
+     * 
+ * + * + * repeated .google.chat.v1.CitedSource cited_sources = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.chat.v1.CitedSourceOrBuilder getCitedSourcesOrBuilder(int index) { + if (citedSourcesBuilder_ == null) { + return citedSources_.get(index); + } else { + return citedSourcesBuilder_.getMessageOrBuilder(index); + } + } + + /** + * + * + *
+     * Optional. A list of sources that are relevant to the citation. Sources are
+     * displayed in the citation hover card.
+     * 
+ * + * + * repeated .google.chat.v1.CitedSource cited_sources = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public java.util.List + getCitedSourcesOrBuilderList() { + if (citedSourcesBuilder_ != null) { + return citedSourcesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(citedSources_); + } + } + + /** + * + * + *
+     * Optional. A list of sources that are relevant to the citation. Sources are
+     * displayed in the citation hover card.
+     * 
+ * + * + * repeated .google.chat.v1.CitedSource cited_sources = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.chat.v1.CitedSource.Builder addCitedSourcesBuilder() { + return internalGetCitedSourcesFieldBuilder() + .addBuilder(com.google.chat.v1.CitedSource.getDefaultInstance()); + } + + /** + * + * + *
+     * Optional. A list of sources that are relevant to the citation. Sources are
+     * displayed in the citation hover card.
+     * 
+ * + * + * repeated .google.chat.v1.CitedSource cited_sources = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.chat.v1.CitedSource.Builder addCitedSourcesBuilder(int index) { + return internalGetCitedSourcesFieldBuilder() + .addBuilder(index, com.google.chat.v1.CitedSource.getDefaultInstance()); + } + + /** + * + * + *
+     * Optional. A list of sources that are relevant to the citation. Sources are
+     * displayed in the citation hover card.
+     * 
+ * + * + * repeated .google.chat.v1.CitedSource cited_sources = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public java.util.List getCitedSourcesBuilderList() { + return internalGetCitedSourcesFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.google.chat.v1.CitedSource, + com.google.chat.v1.CitedSource.Builder, + com.google.chat.v1.CitedSourceOrBuilder> + internalGetCitedSourcesFieldBuilder() { + if (citedSourcesBuilder_ == null) { + citedSourcesBuilder_ = + new com.google.protobuf.RepeatedFieldBuilder< + com.google.chat.v1.CitedSource, + com.google.chat.v1.CitedSource.Builder, + com.google.chat.v1.CitedSourceOrBuilder>( + citedSources_, ((bitField0_ & 0x00000002) != 0), getParentForChildren(), isClean()); + citedSources_ = null; + } + return citedSourcesBuilder_; + } + + // @@protoc_insertion_point(builder_scope:google.chat.v1.Citation) + } + + // @@protoc_insertion_point(class_scope:google.chat.v1.Citation) + private static final com.google.chat.v1.Citation DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.chat.v1.Citation(); + } + + public static com.google.chat.v1.Citation getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Citation 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.chat.v1.Citation getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-chat/proto-google-cloud-chat-v1/src/main/java/com/google/chat/v1/CitationOrBuilder.java b/java-chat/proto-google-cloud-chat-v1/src/main/java/com/google/chat/v1/CitationOrBuilder.java new file mode 100644 index 000000000000..35287bc57fd1 --- /dev/null +++ b/java-chat/proto-google-cloud-chat-v1/src/main/java/com/google/chat/v1/CitationOrBuilder.java @@ -0,0 +1,130 @@ +/* + * Copyright 2026 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! +// NO CHECKED-IN PROTOBUF GENCODE +// source: google/chat/v1/citation.proto +// Protobuf Java Version: 4.33.6 + +package com.google.chat.v1; + +@com.google.protobuf.Generated +public interface CitationOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.chat.v1.Citation) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The ID of the citation. This ID is defined by the app creating
+   * the citation and must match the `data-id` attribute of the
+   * `<chat-citation>` tag in the message text. Must contain only ASCII letters
+   * and numbers, and less than 63 characters.
+   * 
+ * + * string id = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The id. + */ + java.lang.String getId(); + + /** + * + * + *
+   * Required. The ID of the citation. This ID is defined by the app creating
+   * the citation and must match the `data-id` attribute of the
+   * `<chat-citation>` tag in the message text. Must contain only ASCII letters
+   * and numbers, and less than 63 characters.
+   * 
+ * + * string id = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for id. + */ + com.google.protobuf.ByteString getIdBytes(); + + /** + * + * + *
+   * Optional. A list of sources that are relevant to the citation. Sources are
+   * displayed in the citation hover card.
+   * 
+ * + * + * repeated .google.chat.v1.CitedSource cited_sources = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + java.util.List getCitedSourcesList(); + + /** + * + * + *
+   * Optional. A list of sources that are relevant to the citation. Sources are
+   * displayed in the citation hover card.
+   * 
+ * + * + * repeated .google.chat.v1.CitedSource cited_sources = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.chat.v1.CitedSource getCitedSources(int index); + + /** + * + * + *
+   * Optional. A list of sources that are relevant to the citation. Sources are
+   * displayed in the citation hover card.
+   * 
+ * + * + * repeated .google.chat.v1.CitedSource cited_sources = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + int getCitedSourcesCount(); + + /** + * + * + *
+   * Optional. A list of sources that are relevant to the citation. Sources are
+   * displayed in the citation hover card.
+   * 
+ * + * + * repeated .google.chat.v1.CitedSource cited_sources = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + java.util.List getCitedSourcesOrBuilderList(); + + /** + * + * + *
+   * Optional. A list of sources that are relevant to the citation. Sources are
+   * displayed in the citation hover card.
+   * 
+ * + * + * repeated .google.chat.v1.CitedSource cited_sources = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.chat.v1.CitedSourceOrBuilder getCitedSourcesOrBuilder(int index); +} diff --git a/java-chat/proto-google-cloud-chat-v1/src/main/java/com/google/chat/v1/CitationProto.java b/java-chat/proto-google-cloud-chat-v1/src/main/java/com/google/chat/v1/CitationProto.java new file mode 100644 index 000000000000..c066978a1c14 --- /dev/null +++ b/java-chat/proto-google-cloud-chat-v1/src/main/java/com/google/chat/v1/CitationProto.java @@ -0,0 +1,92 @@ +/* + * Copyright 2026 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! +// NO CHECKED-IN PROTOBUF GENCODE +// source: google/chat/v1/citation.proto +// Protobuf Java Version: 4.33.6 + +package com.google.chat.v1; + +@com.google.protobuf.Generated +public final class CitationProto extends com.google.protobuf.GeneratedFile { + private CitationProto() {} + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 6, + /* suffix= */ "", + "CitationProto"); + } + + 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_chat_v1_Citation_descriptor; + static final com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_google_chat_v1_Citation_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\035google/chat/v1/citation.proto\022\016google." + + "chat.v1\032\037google/api/field_behavior.proto" + + "\032!google/chat/v1/cited_source.proto\"V\n\010C" + + "itation\022\020\n\002id\030\001 \001(\tB\004\342A\001\002\0228\n\rcited_sourc" + + "es\030\003 \003(\0132\033.google.chat.v1.CitedSourceB\004\342" + + "A\001\001B\230\001\n\022com.google.chat.v1B\rCitationProt" + + "oP\001Z,cloud.google.com/go/chat/apiv1/chat" + + "pb;chatpb\252\002\023Google.Apps.Chat.V1\312\002\023Google" + + "\\Apps\\Chat\\V1\352\002\026Google::Apps::Chat::V1b\006" + + "proto3" + }; + descriptor = + com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( + descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.api.FieldBehaviorProto.getDescriptor(), + com.google.chat.v1.CitedSourceProto.getDescriptor(), + }); + internal_static_google_chat_v1_Citation_descriptor = getDescriptor().getMessageType(0); + internal_static_google_chat_v1_Citation_fieldAccessorTable = + new com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_google_chat_v1_Citation_descriptor, + new java.lang.String[] { + "Id", "CitedSources", + }); + descriptor.resolveAllFeaturesImmutable(); + com.google.api.FieldBehaviorProto.getDescriptor(); + com.google.chat.v1.CitedSourceProto.getDescriptor(); + com.google.protobuf.ExtensionRegistry registry = + com.google.protobuf.ExtensionRegistry.newInstance(); + registry.add(com.google.api.FieldBehaviorProto.fieldBehavior); + com.google.protobuf.Descriptors.FileDescriptor.internalUpdateFileDescriptor( + descriptor, registry); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/java-chat/proto-google-cloud-chat-v1/src/main/java/com/google/chat/v1/CitedSource.java b/java-chat/proto-google-cloud-chat-v1/src/main/java/com/google/chat/v1/CitedSource.java new file mode 100644 index 000000000000..07ae24ae7579 --- /dev/null +++ b/java-chat/proto-google-cloud-chat-v1/src/main/java/com/google/chat/v1/CitedSource.java @@ -0,0 +1,3056 @@ +/* + * Copyright 2026 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! +// NO CHECKED-IN PROTOBUF GENCODE +// source: google/chat/v1/cited_source.proto +// Protobuf Java Version: 4.33.6 + +package com.google.chat.v1; + +/** + * + * + *
+ * A reference to a source of information.
+ * 
+ * + * Protobuf type {@code google.chat.v1.CitedSource} + */ +@com.google.protobuf.Generated +public final class CitedSource extends com.google.protobuf.GeneratedMessage + implements + // @@protoc_insertion_point(message_implements:google.chat.v1.CitedSource) + CitedSourceOrBuilder { + private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 6, + /* suffix= */ "", + "CitedSource"); + } + + // Use CitedSource.newBuilder() to construct. + private CitedSource(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + + private CitedSource() { + title_ = ""; + uri_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.chat.v1.CitedSourceProto + .internal_static_google_chat_v1_CitedSource_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.chat.v1.CitedSourceProto + .internal_static_google_chat_v1_CitedSource_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.chat.v1.CitedSource.class, com.google.chat.v1.CitedSource.Builder.class); + } + + public interface SnippetOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.chat.v1.CitedSource.Snippet) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+     * Optional. A short plaintext excerpt directly from the corpus that is
+     * rendered in the citation hover card or source preview. When footer
+     * sources are automatically populated from inline `citations` (because
+     * `Elements.cited_sources` is not set), snippets are omitted from the
+     * deduplicated footer sources. Does not support markdown format, and must
+     * not exceed 1,000 characters.
+     * 
+ * + * string text = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The text. + */ + java.lang.String getText(); + + /** + * + * + *
+     * Optional. A short plaintext excerpt directly from the corpus that is
+     * rendered in the citation hover card or source preview. When footer
+     * sources are automatically populated from inline `citations` (because
+     * `Elements.cited_sources` is not set), snippets are omitted from the
+     * deduplicated footer sources. Does not support markdown format, and must
+     * not exceed 1,000 characters.
+     * 
+ * + * string text = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for text. + */ + com.google.protobuf.ByteString getTextBytes(); + + /** + * + * + *
+     * Optional. Image preview of the snippet provided as an input when creating
+     * the citation.
+     * 
+ * + * + * .google.chat.v1.ElementsImage image_preview = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the imagePreview field is set. + */ + boolean hasImagePreview(); + + /** + * + * + *
+     * Optional. Image preview of the snippet provided as an input when creating
+     * the citation.
+     * 
+ * + * + * .google.chat.v1.ElementsImage image_preview = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The imagePreview. + */ + com.google.chat.v1.ElementsImage getImagePreview(); + + /** + * + * + *
+     * Optional. Image preview of the snippet provided as an input when creating
+     * the citation.
+     * 
+ * + * + * .google.chat.v1.ElementsImage image_preview = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.chat.v1.ElementsImageOrBuilder getImagePreviewOrBuilder(); + } + + /** + * + * + *
+   * A snippet object representing an excerpt from a larger corpus.
+   * 
+ * + * Protobuf type {@code google.chat.v1.CitedSource.Snippet} + */ + public static final class Snippet extends com.google.protobuf.GeneratedMessage + implements + // @@protoc_insertion_point(message_implements:google.chat.v1.CitedSource.Snippet) + SnippetOrBuilder { + private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 6, + /* suffix= */ "", + "Snippet"); + } + + // Use Snippet.newBuilder() to construct. + private Snippet(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + + private Snippet() { + text_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.chat.v1.CitedSourceProto + .internal_static_google_chat_v1_CitedSource_Snippet_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.chat.v1.CitedSourceProto + .internal_static_google_chat_v1_CitedSource_Snippet_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.chat.v1.CitedSource.Snippet.class, + com.google.chat.v1.CitedSource.Snippet.Builder.class); + } + + private int bitField0_; + public static final int TEXT_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object text_ = ""; + + /** + * + * + *
+     * Optional. A short plaintext excerpt directly from the corpus that is
+     * rendered in the citation hover card or source preview. When footer
+     * sources are automatically populated from inline `citations` (because
+     * `Elements.cited_sources` is not set), snippets are omitted from the
+     * deduplicated footer sources. Does not support markdown format, and must
+     * not exceed 1,000 characters.
+     * 
+ * + * string text = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The text. + */ + @java.lang.Override + public java.lang.String getText() { + java.lang.Object ref = text_; + 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(); + text_ = s; + return s; + } + } + + /** + * + * + *
+     * Optional. A short plaintext excerpt directly from the corpus that is
+     * rendered in the citation hover card or source preview. When footer
+     * sources are automatically populated from inline `citations` (because
+     * `Elements.cited_sources` is not set), snippets are omitted from the
+     * deduplicated footer sources. Does not support markdown format, and must
+     * not exceed 1,000 characters.
+     * 
+ * + * string text = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for text. + */ + @java.lang.Override + public com.google.protobuf.ByteString getTextBytes() { + java.lang.Object ref = text_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + text_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int IMAGE_PREVIEW_FIELD_NUMBER = 2; + private com.google.chat.v1.ElementsImage imagePreview_; + + /** + * + * + *
+     * Optional. Image preview of the snippet provided as an input when creating
+     * the citation.
+     * 
+ * + * + * .google.chat.v1.ElementsImage image_preview = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the imagePreview field is set. + */ + @java.lang.Override + public boolean hasImagePreview() { + return ((bitField0_ & 0x00000001) != 0); + } + + /** + * + * + *
+     * Optional. Image preview of the snippet provided as an input when creating
+     * the citation.
+     * 
+ * + * + * .google.chat.v1.ElementsImage image_preview = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The imagePreview. + */ + @java.lang.Override + public com.google.chat.v1.ElementsImage getImagePreview() { + return imagePreview_ == null + ? com.google.chat.v1.ElementsImage.getDefaultInstance() + : imagePreview_; + } + + /** + * + * + *
+     * Optional. Image preview of the snippet provided as an input when creating
+     * the citation.
+     * 
+ * + * + * .google.chat.v1.ElementsImage image_preview = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.chat.v1.ElementsImageOrBuilder getImagePreviewOrBuilder() { + return imagePreview_ == null + ? com.google.chat.v1.ElementsImage.getDefaultInstance() + : imagePreview_; + } + + 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.GeneratedMessage.isStringEmpty(text_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, text_); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(2, getImagePreview()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(text_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, text_); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getImagePreview()); + } + 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.chat.v1.CitedSource.Snippet)) { + return super.equals(obj); + } + com.google.chat.v1.CitedSource.Snippet other = (com.google.chat.v1.CitedSource.Snippet) obj; + + if (!getText().equals(other.getText())) return false; + if (hasImagePreview() != other.hasImagePreview()) return false; + if (hasImagePreview()) { + if (!getImagePreview().equals(other.getImagePreview())) 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) + TEXT_FIELD_NUMBER; + hash = (53 * hash) + getText().hashCode(); + if (hasImagePreview()) { + hash = (37 * hash) + IMAGE_PREVIEW_FIELD_NUMBER; + hash = (53 * hash) + getImagePreview().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.chat.v1.CitedSource.Snippet parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.chat.v1.CitedSource.Snippet parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.chat.v1.CitedSource.Snippet parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.chat.v1.CitedSource.Snippet 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.chat.v1.CitedSource.Snippet parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.chat.v1.CitedSource.Snippet parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.chat.v1.CitedSource.Snippet parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.chat.v1.CitedSource.Snippet parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.chat.v1.CitedSource.Snippet parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.chat.v1.CitedSource.Snippet parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.chat.v1.CitedSource.Snippet parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.chat.v1.CitedSource.Snippet parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.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.chat.v1.CitedSource.Snippet 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.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * + * + *
+     * A snippet object representing an excerpt from a larger corpus.
+     * 
+ * + * Protobuf type {@code google.chat.v1.CitedSource.Snippet} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder + implements + // @@protoc_insertion_point(builder_implements:google.chat.v1.CitedSource.Snippet) + com.google.chat.v1.CitedSource.SnippetOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.chat.v1.CitedSourceProto + .internal_static_google_chat_v1_CitedSource_Snippet_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.chat.v1.CitedSourceProto + .internal_static_google_chat_v1_CitedSource_Snippet_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.chat.v1.CitedSource.Snippet.class, + com.google.chat.v1.CitedSource.Snippet.Builder.class); + } + + // Construct using com.google.chat.v1.CitedSource.Snippet.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + internalGetImagePreviewFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + text_ = ""; + imagePreview_ = null; + if (imagePreviewBuilder_ != null) { + imagePreviewBuilder_.dispose(); + imagePreviewBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.chat.v1.CitedSourceProto + .internal_static_google_chat_v1_CitedSource_Snippet_descriptor; + } + + @java.lang.Override + public com.google.chat.v1.CitedSource.Snippet getDefaultInstanceForType() { + return com.google.chat.v1.CitedSource.Snippet.getDefaultInstance(); + } + + @java.lang.Override + public com.google.chat.v1.CitedSource.Snippet build() { + com.google.chat.v1.CitedSource.Snippet result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.chat.v1.CitedSource.Snippet buildPartial() { + com.google.chat.v1.CitedSource.Snippet result = + new com.google.chat.v1.CitedSource.Snippet(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.chat.v1.CitedSource.Snippet result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.text_ = text_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000002) != 0)) { + result.imagePreview_ = + imagePreviewBuilder_ == null ? imagePreview_ : imagePreviewBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.chat.v1.CitedSource.Snippet) { + return mergeFrom((com.google.chat.v1.CitedSource.Snippet) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.chat.v1.CitedSource.Snippet other) { + if (other == com.google.chat.v1.CitedSource.Snippet.getDefaultInstance()) return this; + if (!other.getText().isEmpty()) { + text_ = other.text_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (other.hasImagePreview()) { + mergeImagePreview(other.getImagePreview()); + } + 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: + { + text_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + input.readMessage( + internalGetImagePreviewFieldBuilder().getBuilder(), extensionRegistry); + 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 java.lang.Object text_ = ""; + + /** + * + * + *
+       * Optional. A short plaintext excerpt directly from the corpus that is
+       * rendered in the citation hover card or source preview. When footer
+       * sources are automatically populated from inline `citations` (because
+       * `Elements.cited_sources` is not set), snippets are omitted from the
+       * deduplicated footer sources. Does not support markdown format, and must
+       * not exceed 1,000 characters.
+       * 
+ * + * string text = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The text. + */ + public java.lang.String getText() { + java.lang.Object ref = text_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + text_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
+       * Optional. A short plaintext excerpt directly from the corpus that is
+       * rendered in the citation hover card or source preview. When footer
+       * sources are automatically populated from inline `citations` (because
+       * `Elements.cited_sources` is not set), snippets are omitted from the
+       * deduplicated footer sources. Does not support markdown format, and must
+       * not exceed 1,000 characters.
+       * 
+ * + * string text = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for text. + */ + public com.google.protobuf.ByteString getTextBytes() { + java.lang.Object ref = text_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + text_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
+       * Optional. A short plaintext excerpt directly from the corpus that is
+       * rendered in the citation hover card or source preview. When footer
+       * sources are automatically populated from inline `citations` (because
+       * `Elements.cited_sources` is not set), snippets are omitted from the
+       * deduplicated footer sources. Does not support markdown format, and must
+       * not exceed 1,000 characters.
+       * 
+ * + * string text = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The text to set. + * @return This builder for chaining. + */ + public Builder setText(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + text_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + /** + * + * + *
+       * Optional. A short plaintext excerpt directly from the corpus that is
+       * rendered in the citation hover card or source preview. When footer
+       * sources are automatically populated from inline `citations` (because
+       * `Elements.cited_sources` is not set), snippets are omitted from the
+       * deduplicated footer sources. Does not support markdown format, and must
+       * not exceed 1,000 characters.
+       * 
+ * + * string text = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearText() { + text_ = getDefaultInstance().getText(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + + /** + * + * + *
+       * Optional. A short plaintext excerpt directly from the corpus that is
+       * rendered in the citation hover card or source preview. When footer
+       * sources are automatically populated from inline `citations` (because
+       * `Elements.cited_sources` is not set), snippets are omitted from the
+       * deduplicated footer sources. Does not support markdown format, and must
+       * not exceed 1,000 characters.
+       * 
+ * + * string text = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for text to set. + * @return This builder for chaining. + */ + public Builder setTextBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + text_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private com.google.chat.v1.ElementsImage imagePreview_; + private com.google.protobuf.SingleFieldBuilder< + com.google.chat.v1.ElementsImage, + com.google.chat.v1.ElementsImage.Builder, + com.google.chat.v1.ElementsImageOrBuilder> + imagePreviewBuilder_; + + /** + * + * + *
+       * Optional. Image preview of the snippet provided as an input when creating
+       * the citation.
+       * 
+ * + * + * .google.chat.v1.ElementsImage image_preview = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the imagePreview field is set. + */ + public boolean hasImagePreview() { + return ((bitField0_ & 0x00000002) != 0); + } + + /** + * + * + *
+       * Optional. Image preview of the snippet provided as an input when creating
+       * the citation.
+       * 
+ * + * + * .google.chat.v1.ElementsImage image_preview = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The imagePreview. + */ + public com.google.chat.v1.ElementsImage getImagePreview() { + if (imagePreviewBuilder_ == null) { + return imagePreview_ == null + ? com.google.chat.v1.ElementsImage.getDefaultInstance() + : imagePreview_; + } else { + return imagePreviewBuilder_.getMessage(); + } + } + + /** + * + * + *
+       * Optional. Image preview of the snippet provided as an input when creating
+       * the citation.
+       * 
+ * + * + * .google.chat.v1.ElementsImage image_preview = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setImagePreview(com.google.chat.v1.ElementsImage value) { + if (imagePreviewBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + imagePreview_ = value; + } else { + imagePreviewBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + /** + * + * + *
+       * Optional. Image preview of the snippet provided as an input when creating
+       * the citation.
+       * 
+ * + * + * .google.chat.v1.ElementsImage image_preview = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setImagePreview(com.google.chat.v1.ElementsImage.Builder builderForValue) { + if (imagePreviewBuilder_ == null) { + imagePreview_ = builderForValue.build(); + } else { + imagePreviewBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + /** + * + * + *
+       * Optional. Image preview of the snippet provided as an input when creating
+       * the citation.
+       * 
+ * + * + * .google.chat.v1.ElementsImage image_preview = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeImagePreview(com.google.chat.v1.ElementsImage value) { + if (imagePreviewBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0) + && imagePreview_ != null + && imagePreview_ != com.google.chat.v1.ElementsImage.getDefaultInstance()) { + getImagePreviewBuilder().mergeFrom(value); + } else { + imagePreview_ = value; + } + } else { + imagePreviewBuilder_.mergeFrom(value); + } + if (imagePreview_ != null) { + bitField0_ |= 0x00000002; + onChanged(); + } + return this; + } + + /** + * + * + *
+       * Optional. Image preview of the snippet provided as an input when creating
+       * the citation.
+       * 
+ * + * + * .google.chat.v1.ElementsImage image_preview = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearImagePreview() { + bitField0_ = (bitField0_ & ~0x00000002); + imagePreview_ = null; + if (imagePreviewBuilder_ != null) { + imagePreviewBuilder_.dispose(); + imagePreviewBuilder_ = null; + } + onChanged(); + return this; + } + + /** + * + * + *
+       * Optional. Image preview of the snippet provided as an input when creating
+       * the citation.
+       * 
+ * + * + * .google.chat.v1.ElementsImage image_preview = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.chat.v1.ElementsImage.Builder getImagePreviewBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return internalGetImagePreviewFieldBuilder().getBuilder(); + } + + /** + * + * + *
+       * Optional. Image preview of the snippet provided as an input when creating
+       * the citation.
+       * 
+ * + * + * .google.chat.v1.ElementsImage image_preview = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.chat.v1.ElementsImageOrBuilder getImagePreviewOrBuilder() { + if (imagePreviewBuilder_ != null) { + return imagePreviewBuilder_.getMessageOrBuilder(); + } else { + return imagePreview_ == null + ? com.google.chat.v1.ElementsImage.getDefaultInstance() + : imagePreview_; + } + } + + /** + * + * + *
+       * Optional. Image preview of the snippet provided as an input when creating
+       * the citation.
+       * 
+ * + * + * .google.chat.v1.ElementsImage image_preview = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.chat.v1.ElementsImage, + com.google.chat.v1.ElementsImage.Builder, + com.google.chat.v1.ElementsImageOrBuilder> + internalGetImagePreviewFieldBuilder() { + if (imagePreviewBuilder_ == null) { + imagePreviewBuilder_ = + new com.google.protobuf.SingleFieldBuilder< + com.google.chat.v1.ElementsImage, + com.google.chat.v1.ElementsImage.Builder, + com.google.chat.v1.ElementsImageOrBuilder>( + getImagePreview(), getParentForChildren(), isClean()); + imagePreview_ = null; + } + return imagePreviewBuilder_; + } + + // @@protoc_insertion_point(builder_scope:google.chat.v1.CitedSource.Snippet) + } + + // @@protoc_insertion_point(class_scope:google.chat.v1.CitedSource.Snippet) + private static final com.google.chat.v1.CitedSource.Snippet DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.chat.v1.CitedSource.Snippet(); + } + + public static com.google.chat.v1.CitedSource.Snippet getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Snippet 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.chat.v1.CitedSource.Snippet getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public interface FooterOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.chat.v1.CitedSource.Footer) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+     * Optional. The plaintext to display in the footer. Does not support
+     * markdown format.
+     * 
+ * + * string text = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The text. + */ + java.lang.String getText(); + + /** + * + * + *
+     * Optional. The plaintext to display in the footer. Does not support
+     * markdown format.
+     * 
+ * + * string text = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for text. + */ + com.google.protobuf.ByteString getTextBytes(); + } + + /** + * + * + *
+   * A footer for a source, used for attribution.
+   * 
+ * + * Protobuf type {@code google.chat.v1.CitedSource.Footer} + */ + public static final class Footer extends com.google.protobuf.GeneratedMessage + implements + // @@protoc_insertion_point(message_implements:google.chat.v1.CitedSource.Footer) + FooterOrBuilder { + private static final long serialVersionUID = 0L; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 6, + /* suffix= */ "", + "Footer"); + } + + // Use Footer.newBuilder() to construct. + private Footer(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + + private Footer() { + text_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.chat.v1.CitedSourceProto + .internal_static_google_chat_v1_CitedSource_Footer_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.chat.v1.CitedSourceProto + .internal_static_google_chat_v1_CitedSource_Footer_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.chat.v1.CitedSource.Footer.class, + com.google.chat.v1.CitedSource.Footer.Builder.class); + } + + public static final int TEXT_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object text_ = ""; + + /** + * + * + *
+     * Optional. The plaintext to display in the footer. Does not support
+     * markdown format.
+     * 
+ * + * string text = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The text. + */ + @java.lang.Override + public java.lang.String getText() { + java.lang.Object ref = text_; + 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(); + text_ = s; + return s; + } + } + + /** + * + * + *
+     * Optional. The plaintext to display in the footer. Does not support
+     * markdown format.
+     * 
+ * + * string text = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for text. + */ + @java.lang.Override + public com.google.protobuf.ByteString getTextBytes() { + java.lang.Object ref = text_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + text_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + 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.GeneratedMessage.isStringEmpty(text_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, text_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(text_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, text_); + } + 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.chat.v1.CitedSource.Footer)) { + return super.equals(obj); + } + com.google.chat.v1.CitedSource.Footer other = (com.google.chat.v1.CitedSource.Footer) obj; + + if (!getText().equals(other.getText())) 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) + TEXT_FIELD_NUMBER; + hash = (53 * hash) + getText().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.chat.v1.CitedSource.Footer parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.chat.v1.CitedSource.Footer parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.chat.v1.CitedSource.Footer parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.chat.v1.CitedSource.Footer 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.chat.v1.CitedSource.Footer parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.chat.v1.CitedSource.Footer parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.chat.v1.CitedSource.Footer parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.chat.v1.CitedSource.Footer parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.chat.v1.CitedSource.Footer parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.chat.v1.CitedSource.Footer parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.chat.v1.CitedSource.Footer parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input); + } + + public static com.google.chat.v1.CitedSource.Footer parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage.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.chat.v1.CitedSource.Footer 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.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * + * + *
+     * A footer for a source, used for attribution.
+     * 
+ * + * Protobuf type {@code google.chat.v1.CitedSource.Footer} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder + implements + // @@protoc_insertion_point(builder_implements:google.chat.v1.CitedSource.Footer) + com.google.chat.v1.CitedSource.FooterOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.chat.v1.CitedSourceProto + .internal_static_google_chat_v1_CitedSource_Footer_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.chat.v1.CitedSourceProto + .internal_static_google_chat_v1_CitedSource_Footer_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.chat.v1.CitedSource.Footer.class, + com.google.chat.v1.CitedSource.Footer.Builder.class); + } + + // Construct using com.google.chat.v1.CitedSource.Footer.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + text_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.chat.v1.CitedSourceProto + .internal_static_google_chat_v1_CitedSource_Footer_descriptor; + } + + @java.lang.Override + public com.google.chat.v1.CitedSource.Footer getDefaultInstanceForType() { + return com.google.chat.v1.CitedSource.Footer.getDefaultInstance(); + } + + @java.lang.Override + public com.google.chat.v1.CitedSource.Footer build() { + com.google.chat.v1.CitedSource.Footer result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.chat.v1.CitedSource.Footer buildPartial() { + com.google.chat.v1.CitedSource.Footer result = + new com.google.chat.v1.CitedSource.Footer(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.chat.v1.CitedSource.Footer result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.text_ = text_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.chat.v1.CitedSource.Footer) { + return mergeFrom((com.google.chat.v1.CitedSource.Footer) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.chat.v1.CitedSource.Footer other) { + if (other == com.google.chat.v1.CitedSource.Footer.getDefaultInstance()) return this; + if (!other.getText().isEmpty()) { + text_ = other.text_; + bitField0_ |= 0x00000001; + onChanged(); + } + 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: + { + text_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + 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.lang.Object text_ = ""; + + /** + * + * + *
+       * Optional. The plaintext to display in the footer. Does not support
+       * markdown format.
+       * 
+ * + * string text = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The text. + */ + public java.lang.String getText() { + java.lang.Object ref = text_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + text_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * + * + *
+       * Optional. The plaintext to display in the footer. Does not support
+       * markdown format.
+       * 
+ * + * string text = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for text. + */ + public com.google.protobuf.ByteString getTextBytes() { + java.lang.Object ref = text_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + text_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * + * + *
+       * Optional. The plaintext to display in the footer. Does not support
+       * markdown format.
+       * 
+ * + * string text = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The text to set. + * @return This builder for chaining. + */ + public Builder setText(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + text_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + /** + * + * + *
+       * Optional. The plaintext to display in the footer. Does not support
+       * markdown format.
+       * 
+ * + * string text = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearText() { + text_ = getDefaultInstance().getText(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + + /** + * + * + *
+       * Optional. The plaintext to display in the footer. Does not support
+       * markdown format.
+       * 
+ * + * string text = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for text to set. + * @return This builder for chaining. + */ + public Builder setTextBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + text_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:google.chat.v1.CitedSource.Footer) + } + + // @@protoc_insertion_point(class_scope:google.chat.v1.CitedSource.Footer) + private static final com.google.chat.v1.CitedSource.Footer DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.chat.v1.CitedSource.Footer(); + } + + public static com.google.chat.v1.CitedSource.Footer getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser