Class Attachment.Builder (0.36.0)

publicstaticfinalclass Attachment.BuilderextendsGeneratedMessageV3.Builder<Attachment.Builder>implementsAttachmentOrBuilder

An attachment in Google Chat.

Protobuf type google.chat.v1.Attachment

Implements

AttachmentOrBuilder

Inherited Members

com.google.protobuf.GeneratedMessageV3.Builder.getUnknownFieldSetBuilder()
com.google.protobuf.GeneratedMessageV3.Builder.internalGetMapFieldReflection(int)
com.google.protobuf.GeneratedMessageV3.Builder.internalGetMutableMapFieldReflection(int)
com.google.protobuf.GeneratedMessageV3.Builder.mergeUnknownLengthDelimitedField(int,com.google.protobuf.ByteString)
com.google.protobuf.GeneratedMessageV3.Builder.mergeUnknownVarintField(int,int)
com.google.protobuf.GeneratedMessageV3.Builder.parseUnknownField(com.google.protobuf.CodedInputStream,com.google.protobuf.ExtensionRegistryLite,int)
com.google.protobuf.GeneratedMessageV3.Builder.setUnknownFieldSetBuilder(com.google.protobuf.UnknownFieldSet.Builder)

Static Methods

getDescriptor()

publicstaticfinalDescriptors.DescriptorgetDescriptor()
Returns
Type Description
Descriptor

Methods

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

publicAttachment.BuilderaddRepeatedField(Descriptors.FieldDescriptorfield,Objectvalue)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
Attachment.Builder
Overrides

build()

publicAttachmentbuild()
Returns
Type Description
Attachment

buildPartial()

publicAttachmentbuildPartial()
Returns
Type Description
Attachment

clear()

publicAttachment.Builderclear()
Returns
Type Description
Attachment.Builder
Overrides

clearAttachmentDataRef()

publicAttachment.BuilderclearAttachmentDataRef()

Optional. A reference to the attachment data. This field is used to create or update messages with attachments, or with the media API to download the attachment data.

.google.chat.v1.AttachmentDataRef attachment_data_ref = 4 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
Attachment.Builder

clearContentName()

publicAttachment.BuilderclearContentName()

Output only. The original file name for the content, not the full path.

string content_name = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
Attachment.Builder

This builder for chaining.

clearContentType()

publicAttachment.BuilderclearContentType()

Output only. The content type (MIME type) of the file.

string content_type = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
Attachment.Builder

This builder for chaining.

clearDataRef()

publicAttachment.BuilderclearDataRef()
Returns
Type Description
Attachment.Builder

clearDownloadUri()

publicAttachment.BuilderclearDownloadUri()

Output only. The download URL which should be used to allow a human user to download the attachment. Chat apps shouldn't use this URL to download attachment content.

string download_uri = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
Attachment.Builder

This builder for chaining.

clearDriveDataRef()

publicAttachment.BuilderclearDriveDataRef()

Output only. A reference to the Google Drive attachment. This field is used with the Google Drive API.

.google.chat.v1.DriveDataRef drive_data_ref = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
Attachment.Builder

clearField(Descriptors.FieldDescriptor field)

publicAttachment.BuilderclearField(Descriptors.FieldDescriptorfield)
Parameter
Name Description
field FieldDescriptor
Returns
Type Description
Attachment.Builder
Overrides

clearName()

publicAttachment.BuilderclearName()

Optional. Resource name of the attachment, in the form spaces/{space}/messages/{message}/attachments/{attachment}.

string name = 1 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
Attachment.Builder

This builder for chaining.

clearOneof(Descriptors.OneofDescriptor oneof)

publicAttachment.BuilderclearOneof(Descriptors.OneofDescriptoroneof)
Parameter
Name Description
oneof OneofDescriptor
Returns
Type Description
Attachment.Builder
Overrides

clearSource()

publicAttachment.BuilderclearSource()

Output only. The source of the attachment.

.google.chat.v1.Attachment.Source source = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
Attachment.Builder

This builder for chaining.

clearThumbnailUri()

publicAttachment.BuilderclearThumbnailUri()

Output only. The thumbnail URL which should be used to preview the attachment to a human user. Chat apps shouldn't use this URL to download attachment content.

string thumbnail_uri = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
Attachment.Builder

This builder for chaining.

clone()

publicAttachment.Builderclone()
Returns
Type Description
Attachment.Builder
Overrides

getAttachmentDataRef()

publicAttachmentDataRefgetAttachmentDataRef()

Optional. A reference to the attachment data. This field is used to create or update messages with attachments, or with the media API to download the attachment data.

.google.chat.v1.AttachmentDataRef attachment_data_ref = 4 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
AttachmentDataRef

The attachmentDataRef.

getAttachmentDataRefBuilder()

publicAttachmentDataRef.BuildergetAttachmentDataRefBuilder()

Optional. A reference to the attachment data. This field is used to create or update messages with attachments, or with the media API to download the attachment data.

.google.chat.v1.AttachmentDataRef attachment_data_ref = 4 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
AttachmentDataRef.Builder

getAttachmentDataRefOrBuilder()

publicAttachmentDataRefOrBuildergetAttachmentDataRefOrBuilder()

Optional. A reference to the attachment data. This field is used to create or update messages with attachments, or with the media API to download the attachment data.

.google.chat.v1.AttachmentDataRef attachment_data_ref = 4 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
AttachmentDataRefOrBuilder

getContentName()

publicStringgetContentName()

Output only. The original file name for the content, not the full path.

string content_name = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
String

The contentName.

getContentNameBytes()

publicByteStringgetContentNameBytes()

Output only. The original file name for the content, not the full path.

string content_name = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
ByteString

The bytes for contentName.

getContentType()

publicStringgetContentType()

Output only. The content type (MIME type) of the file.

string content_type = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
String

The contentType.

getContentTypeBytes()

publicByteStringgetContentTypeBytes()

Output only. The content type (MIME type) of the file.

string content_type = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
ByteString

The bytes for contentType.

getDataRefCase()

publicAttachment.DataRefCasegetDataRefCase()
Returns
Type Description
Attachment.DataRefCase

getDefaultInstanceForType()

publicAttachmentgetDefaultInstanceForType()
Returns
Type Description
Attachment

getDescriptorForType()

publicDescriptors.DescriptorgetDescriptorForType()
Returns
Type Description
Descriptor
Overrides

getDownloadUri()

publicStringgetDownloadUri()

Output only. The download URL which should be used to allow a human user to download the attachment. Chat apps shouldn't use this URL to download attachment content.

string download_uri = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
String

The downloadUri.

getDownloadUriBytes()

publicByteStringgetDownloadUriBytes()

Output only. The download URL which should be used to allow a human user to download the attachment. Chat apps shouldn't use this URL to download attachment content.

string download_uri = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
ByteString

The bytes for downloadUri.

getDriveDataRef()

publicDriveDataRefgetDriveDataRef()

Output only. A reference to the Google Drive attachment. This field is used with the Google Drive API.

.google.chat.v1.DriveDataRef drive_data_ref = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
DriveDataRef

The driveDataRef.

getDriveDataRefBuilder()

publicDriveDataRef.BuildergetDriveDataRefBuilder()

Output only. A reference to the Google Drive attachment. This field is used with the Google Drive API.

.google.chat.v1.DriveDataRef drive_data_ref = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
DriveDataRef.Builder

getDriveDataRefOrBuilder()

publicDriveDataRefOrBuildergetDriveDataRefOrBuilder()

Output only. A reference to the Google Drive attachment. This field is used with the Google Drive API.

.google.chat.v1.DriveDataRef drive_data_ref = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
DriveDataRefOrBuilder

getName()

publicStringgetName()

Optional. Resource name of the attachment, in the form spaces/{space}/messages/{message}/attachments/{attachment}.

string name = 1 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
String

The name.

getNameBytes()

publicByteStringgetNameBytes()

Optional. Resource name of the attachment, in the form spaces/{space}/messages/{message}/attachments/{attachment}.

string name = 1 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
ByteString

The bytes for name.

getSource()

publicAttachment.SourcegetSource()

Output only. The source of the attachment.

.google.chat.v1.Attachment.Source source = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
Attachment.Source

The source.

getSourceValue()

publicintgetSourceValue()

Output only. The source of the attachment.

.google.chat.v1.Attachment.Source source = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
int

The enum numeric value on the wire for source.

getThumbnailUri()

publicStringgetThumbnailUri()

Output only. The thumbnail URL which should be used to preview the attachment to a human user. Chat apps shouldn't use this URL to download attachment content.

string thumbnail_uri = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
String

The thumbnailUri.

getThumbnailUriBytes()

publicByteStringgetThumbnailUriBytes()

Output only. The thumbnail URL which should be used to preview the attachment to a human user. Chat apps shouldn't use this URL to download attachment content.

string thumbnail_uri = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
ByteString

The bytes for thumbnailUri.

hasAttachmentDataRef()

publicbooleanhasAttachmentDataRef()

Optional. A reference to the attachment data. This field is used to create or update messages with attachments, or with the media API to download the attachment data.

.google.chat.v1.AttachmentDataRef attachment_data_ref = 4 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
boolean

Whether the attachmentDataRef field is set.

hasDriveDataRef()

publicbooleanhasDriveDataRef()

Output only. A reference to the Google Drive attachment. This field is used with the Google Drive API.

.google.chat.v1.DriveDataRef drive_data_ref = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
boolean

Whether the driveDataRef field is set.

internalGetFieldAccessorTable()

protectedGeneratedMessageV3.FieldAccessorTableinternalGetFieldAccessorTable()
Returns
Type Description
FieldAccessorTable
Overrides

isInitialized()

publicfinalbooleanisInitialized()
Returns
Type Description
boolean
Overrides

mergeAttachmentDataRef(AttachmentDataRef value)

publicAttachment.BuildermergeAttachmentDataRef(AttachmentDataRefvalue)

Optional. A reference to the attachment data. This field is used to create or update messages with attachments, or with the media API to download the attachment data.

.google.chat.v1.AttachmentDataRef attachment_data_ref = 4 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value AttachmentDataRef
Returns
Type Description
Attachment.Builder

mergeDriveDataRef(DriveDataRef value)

publicAttachment.BuildermergeDriveDataRef(DriveDataRefvalue)

Output only. A reference to the Google Drive attachment. This field is used with the Google Drive API.

.google.chat.v1.DriveDataRef drive_data_ref = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
Name Description
value DriveDataRef
Returns
Type Description
Attachment.Builder

mergeFrom(Attachment other)

publicAttachment.BuildermergeFrom(Attachmentother)
Parameter
Name Description
other Attachment
Returns
Type Description
Attachment.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

publicAttachment.BuildermergeFrom(CodedInputStreaminput,ExtensionRegistryLiteextensionRegistry)
Parameters
Name Description
input CodedInputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Attachment.Builder
Overrides
Exceptions
Type Description
IOException

mergeFrom(Message other)

publicAttachment.BuildermergeFrom(Messageother)
Parameter
Name Description
other Message
Returns
Type Description
Attachment.Builder
Overrides

mergeUnknownFields(UnknownFieldSet unknownFields)

publicfinalAttachment.BuildermergeUnknownFields(UnknownFieldSetunknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
Attachment.Builder
Overrides

setAttachmentDataRef(AttachmentDataRef value)

publicAttachment.BuildersetAttachmentDataRef(AttachmentDataRefvalue)

Optional. A reference to the attachment data. This field is used to create or update messages with attachments, or with the media API to download the attachment data.

.google.chat.v1.AttachmentDataRef attachment_data_ref = 4 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value AttachmentDataRef
Returns
Type Description
Attachment.Builder

setAttachmentDataRef(AttachmentDataRef.Builder builderForValue)

publicAttachment.BuildersetAttachmentDataRef(AttachmentDataRef.BuilderbuilderForValue)

Optional. A reference to the attachment data. This field is used to create or update messages with attachments, or with the media API to download the attachment data.

.google.chat.v1.AttachmentDataRef attachment_data_ref = 4 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
builderForValue AttachmentDataRef.Builder
Returns
Type Description
Attachment.Builder

setContentName(String value)

publicAttachment.BuildersetContentName(Stringvalue)

Output only. The original file name for the content, not the full path.

string content_name = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
Name Description
value String

The contentName to set.

Returns
Type Description
Attachment.Builder

This builder for chaining.

setContentNameBytes(ByteString value)

publicAttachment.BuildersetContentNameBytes(ByteStringvalue)

Output only. The original file name for the content, not the full path.

string content_name = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
Name Description
value ByteString

The bytes for contentName to set.

Returns
Type Description
Attachment.Builder

This builder for chaining.

setContentType(String value)

publicAttachment.BuildersetContentType(Stringvalue)

Output only. The content type (MIME type) of the file.

string content_type = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
Name Description
value String

The contentType to set.

Returns
Type Description
Attachment.Builder

This builder for chaining.

setContentTypeBytes(ByteString value)

publicAttachment.BuildersetContentTypeBytes(ByteStringvalue)

Output only. The content type (MIME type) of the file.

string content_type = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
Name Description
value ByteString

The bytes for contentType to set.

Returns
Type Description
Attachment.Builder

This builder for chaining.

setDownloadUri(String value)

publicAttachment.BuildersetDownloadUri(Stringvalue)

Output only. The download URL which should be used to allow a human user to download the attachment. Chat apps shouldn't use this URL to download attachment content.

string download_uri = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
Name Description
value String

The downloadUri to set.

Returns
Type Description
Attachment.Builder

This builder for chaining.

setDownloadUriBytes(ByteString value)

publicAttachment.BuildersetDownloadUriBytes(ByteStringvalue)

Output only. The download URL which should be used to allow a human user to download the attachment. Chat apps shouldn't use this URL to download attachment content.

string download_uri = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
Name Description
value ByteString

The bytes for downloadUri to set.

Returns
Type Description
Attachment.Builder

This builder for chaining.

setDriveDataRef(DriveDataRef value)

publicAttachment.BuildersetDriveDataRef(DriveDataRefvalue)

Output only. A reference to the Google Drive attachment. This field is used with the Google Drive API.

.google.chat.v1.DriveDataRef drive_data_ref = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
Name Description
value DriveDataRef
Returns
Type Description
Attachment.Builder

setDriveDataRef(DriveDataRef.Builder builderForValue)

publicAttachment.BuildersetDriveDataRef(DriveDataRef.BuilderbuilderForValue)

Output only. A reference to the Google Drive attachment. This field is used with the Google Drive API.

.google.chat.v1.DriveDataRef drive_data_ref = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
Name Description
builderForValue DriveDataRef.Builder
Returns
Type Description
Attachment.Builder

setField(Descriptors.FieldDescriptor field, Object value)

publicAttachment.BuildersetField(Descriptors.FieldDescriptorfield,Objectvalue)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
Attachment.Builder
Overrides

setName(String value)

publicAttachment.BuildersetName(Stringvalue)

Optional. Resource name of the attachment, in the form spaces/{space}/messages/{message}/attachments/{attachment}.

string name = 1 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value String

The name to set.

Returns
Type Description
Attachment.Builder

This builder for chaining.

setNameBytes(ByteString value)

publicAttachment.BuildersetNameBytes(ByteStringvalue)

Optional. Resource name of the attachment, in the form spaces/{space}/messages/{message}/attachments/{attachment}.

string name = 1 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value ByteString

The bytes for name to set.

Returns
Type Description
Attachment.Builder

This builder for chaining.

setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)

publicAttachment.BuildersetRepeatedField(Descriptors.FieldDescriptorfield,intindex,Objectvalue)
Parameters
Name Description
field FieldDescriptor
index int
value Object
Returns
Type Description
Attachment.Builder
Overrides

setSource(Attachment.Source value)

publicAttachment.BuildersetSource(Attachment.Sourcevalue)

Output only. The source of the attachment.

.google.chat.v1.Attachment.Source source = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
Name Description
value Attachment.Source

The source to set.

Returns
Type Description
Attachment.Builder

This builder for chaining.

setSourceValue(int value)

publicAttachment.BuildersetSourceValue(intvalue)

Output only. The source of the attachment.

.google.chat.v1.Attachment.Source source = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
Name Description
value int

The enum numeric value on the wire for source to set.

Returns
Type Description
Attachment.Builder

This builder for chaining.

setThumbnailUri(String value)

publicAttachment.BuildersetThumbnailUri(Stringvalue)

Output only. The thumbnail URL which should be used to preview the attachment to a human user. Chat apps shouldn't use this URL to download attachment content.

string thumbnail_uri = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
Name Description
value String

The thumbnailUri to set.

Returns
Type Description
Attachment.Builder

This builder for chaining.

setThumbnailUriBytes(ByteString value)

publicAttachment.BuildersetThumbnailUriBytes(ByteStringvalue)

Output only. The thumbnail URL which should be used to preview the attachment to a human user. Chat apps shouldn't use this URL to download attachment content.

string thumbnail_uri = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
Name Description
value ByteString

The bytes for thumbnailUri to set.

Returns
Type Description
Attachment.Builder

This builder for chaining.

setUnknownFields(UnknownFieldSet unknownFields)

publicfinalAttachment.BuildersetUnknownFields(UnknownFieldSetunknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
Attachment.Builder
Overrides

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年10月30日 UTC.