Class Document (4.47.0)

public final class Document extends GeneratedMessageV3 implements DocumentOrBuilder

A knowledge document to be used by a KnowledgeBase.

For more information, see the knowledge base guide.

Note: The projects.agent.knowledgeBases.documents resource is deprecated; only use projects.knowledgeBases.documents.

Protobuf type google.cloud.dialogflow.v2.Document

Implements

DocumentOrBuilder

Static Fields

CONTENT_URI_FIELD_NUMBER

public static final int CONTENT_URI_FIELD_NUMBER
Field Value
TypeDescription
int

DISPLAY_NAME_FIELD_NUMBER

public static final int DISPLAY_NAME_FIELD_NUMBER
Field Value
TypeDescription
int

ENABLE_AUTO_RELOAD_FIELD_NUMBER

public static final int ENABLE_AUTO_RELOAD_FIELD_NUMBER
Field Value
TypeDescription
int

KNOWLEDGE_TYPES_FIELD_NUMBER

public static final int KNOWLEDGE_TYPES_FIELD_NUMBER
Field Value
TypeDescription
int

LATEST_RELOAD_STATUS_FIELD_NUMBER

public static final int LATEST_RELOAD_STATUS_FIELD_NUMBER
Field Value
TypeDescription
int

METADATA_FIELD_NUMBER

public static final int METADATA_FIELD_NUMBER
Field Value
TypeDescription
int

MIME_TYPE_FIELD_NUMBER

public static final int MIME_TYPE_FIELD_NUMBER
Field Value
TypeDescription
int

NAME_FIELD_NUMBER

public static final int NAME_FIELD_NUMBER
Field Value
TypeDescription
int

RAW_CONTENT_FIELD_NUMBER

public static final int RAW_CONTENT_FIELD_NUMBER
Field Value
TypeDescription
int

STATE_FIELD_NUMBER

public static final int STATE_FIELD_NUMBER
Field Value
TypeDescription
int

Static Methods

getDefaultInstance()

public static Document getDefaultInstance()
Returns
TypeDescription
Document

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
TypeDescription
Descriptor

newBuilder()

public static Document.Builder newBuilder()
Returns
TypeDescription
Document.Builder

newBuilder(Document prototype)

public static Document.Builder newBuilder(Document prototype)
Parameter
NameDescription
prototypeDocument
Returns
TypeDescription
Document.Builder

parseDelimitedFrom(InputStream input)

public static Document parseDelimitedFrom(InputStream input)
Parameter
NameDescription
inputInputStream
Returns
TypeDescription
Document
Exceptions
TypeDescription
IOException

parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static Document parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
Document
Exceptions
TypeDescription
IOException

parseFrom(byte[] data)

public static Document parseFrom(byte[] data)
Parameter
NameDescription
databyte[]
Returns
TypeDescription
Document
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)

public static Document parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
databyte[]
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
Document
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(ByteString data)

public static Document parseFrom(ByteString data)
Parameter
NameDescription
dataByteString
Returns
TypeDescription
Document
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)

public static Document parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
dataByteString
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
Document
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(CodedInputStream input)

public static Document parseFrom(CodedInputStream input)
Parameter
NameDescription
inputCodedInputStream
Returns
TypeDescription
Document
Exceptions
TypeDescription
IOException

parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public static Document parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputCodedInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
Document
Exceptions
TypeDescription
IOException

parseFrom(InputStream input)

public static Document parseFrom(InputStream input)
Parameter
NameDescription
inputInputStream
Returns
TypeDescription
Document
Exceptions
TypeDescription
IOException

parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static Document parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
Document
Exceptions
TypeDescription
IOException

parseFrom(ByteBuffer data)

public static Document parseFrom(ByteBuffer data)
Parameter
NameDescription
dataByteBuffer
Returns
TypeDescription
Document
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)

public static Document parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
dataByteBuffer
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
Document
Exceptions
TypeDescription
InvalidProtocolBufferException

parser()

public static Parser<Document> parser()
Returns
TypeDescription
Parser<Document>

Methods

containsMetadata(String key)

public boolean containsMetadata(String key)

Optional. Metadata for the document. The metadata supports arbitrary key-value pairs. Suggested use cases include storing a document's title, an external URL distinct from the document's content_uri, etc. The max size of a key or a value of the metadata is 1024 bytes.

map<string, string> metadata = 7 [(.google.api.field_behavior) = OPTIONAL];

Parameter
NameDescription
keyString
Returns
TypeDescription
boolean

equals(Object obj)

public boolean equals(Object obj)
Parameter
NameDescription
objObject
Returns
TypeDescription
boolean
Overrides

getContentUri()

public String getContentUri()

The URI where the file content is located.

For documents stored in Google Cloud Storage, these URIs must have the form gs://<bucket-name>/<object-name>.

NOTE: External URLs must correspond to public webpages, i.e., they must be indexed by Google Search. In particular, URLs for showing documents in Google Cloud Storage (i.e. the URL in your browser) are not supported. Instead use the gs:// format URI described above.

string content_uri = 5;

Returns
TypeDescription
String

The contentUri.

getContentUriBytes()

public ByteString getContentUriBytes()

The URI where the file content is located.

For documents stored in Google Cloud Storage, these URIs must have the form gs://<bucket-name>/<object-name>.

NOTE: External URLs must correspond to public webpages, i.e., they must be indexed by Google Search. In particular, URLs for showing documents in Google Cloud Storage (i.e. the URL in your browser) are not supported. Instead use the gs:// format URI described above.

string content_uri = 5;

Returns
TypeDescription
ByteString

The bytes for contentUri.

getDefaultInstanceForType()

public Document getDefaultInstanceForType()
Returns
TypeDescription
Document

getDisplayName()

public String getDisplayName()

Required. The display name of the document. The name must be 1024 bytes or less; otherwise, the creation request fails.

string display_name = 2 [(.google.api.field_behavior) = REQUIRED];

Returns
TypeDescription
String

The displayName.

getDisplayNameBytes()

public ByteString getDisplayNameBytes()

Required. The display name of the document. The name must be 1024 bytes or less; otherwise, the creation request fails.

string display_name = 2 [(.google.api.field_behavior) = REQUIRED];

Returns
TypeDescription
ByteString

The bytes for displayName.

getEnableAutoReload()

public boolean getEnableAutoReload()

Optional. If true, we try to automatically reload the document every day (at a time picked by the system). If false or unspecified, we don't try to automatically reload the document.

Currently you can only enable automatic reload for documents sourced from a public url, see source field for the source types.

Reload status can be tracked in latest_reload_status. If a reload fails, we will keep the document unchanged.

If a reload fails with internal errors, the system will try to reload the document on the next day. If a reload fails with non-retriable errors (e.g. PERMISSION_DENIED), the system will not try to reload the document anymore. You need to manually reload the document successfully by calling ReloadDocument and clear the errors.

bool enable_auto_reload = 11 [(.google.api.field_behavior) = OPTIONAL];

Returns
TypeDescription
boolean

The enableAutoReload.

getKnowledgeTypes(int index)

public Document.KnowledgeType getKnowledgeTypes(int index)

Required. The knowledge type of document content.

repeated .google.cloud.dialogflow.v2.Document.KnowledgeType knowledge_types = 4 [(.google.api.field_behavior) = REQUIRED];

Parameter
NameDescription
indexint

The index of the element to return.

Returns
TypeDescription
Document.KnowledgeType

The knowledgeTypes at the given index.

getKnowledgeTypesCount()

public int getKnowledgeTypesCount()

Required. The knowledge type of document content.

repeated .google.cloud.dialogflow.v2.Document.KnowledgeType knowledge_types = 4 [(.google.api.field_behavior) = REQUIRED];

Returns
TypeDescription
int

The count of knowledgeTypes.

getKnowledgeTypesList()

public List<Document.KnowledgeType> getKnowledgeTypesList()

Required. The knowledge type of document content.

repeated .google.cloud.dialogflow.v2.Document.KnowledgeType knowledge_types = 4 [(.google.api.field_behavior) = REQUIRED];

Returns
TypeDescription
List<KnowledgeType>

A list containing the knowledgeTypes.

getKnowledgeTypesValue(int index)

public int getKnowledgeTypesValue(int index)

Required. The knowledge type of document content.

repeated .google.cloud.dialogflow.v2.Document.KnowledgeType knowledge_types = 4 [(.google.api.field_behavior) = REQUIRED];

Parameter
NameDescription
indexint

The index of the value to return.

Returns
TypeDescription
int

The enum numeric value on the wire of knowledgeTypes at the given index.

getKnowledgeTypesValueList()

public List<Integer> getKnowledgeTypesValueList()

Required. The knowledge type of document content.

repeated .google.cloud.dialogflow.v2.Document.KnowledgeType knowledge_types = 4 [(.google.api.field_behavior) = REQUIRED];

Returns
TypeDescription
List<Integer>

A list containing the enum numeric values on the wire for knowledgeTypes.

getLatestReloadStatus()

public Document.ReloadStatus getLatestReloadStatus()

Output only. The time and status of the latest reload. This reload may have been triggered automatically or manually and may not have succeeded.

.google.cloud.dialogflow.v2.Document.ReloadStatus latest_reload_status = 12 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
TypeDescription
Document.ReloadStatus

The latestReloadStatus.

getLatestReloadStatusOrBuilder()

public Document.ReloadStatusOrBuilder getLatestReloadStatusOrBuilder()

Output only. The time and status of the latest reload. This reload may have been triggered automatically or manually and may not have succeeded.

.google.cloud.dialogflow.v2.Document.ReloadStatus latest_reload_status = 12 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
TypeDescription
Document.ReloadStatusOrBuilder

getMetadata() (deprecated)

public Map<String,String> getMetadata()

Use #getMetadataMap() instead.

Returns
TypeDescription
Map<String,String>

getMetadataCount()

public int getMetadataCount()

Optional. Metadata for the document. The metadata supports arbitrary key-value pairs. Suggested use cases include storing a document's title, an external URL distinct from the document's content_uri, etc. The max size of a key or a value of the metadata is 1024 bytes.

map<string, string> metadata = 7 [(.google.api.field_behavior) = OPTIONAL];

Returns
TypeDescription
int

getMetadataMap()

public Map<String,String> getMetadataMap()

Optional. Metadata for the document. The metadata supports arbitrary key-value pairs. Suggested use cases include storing a document's title, an external URL distinct from the document's content_uri, etc. The max size of a key or a value of the metadata is 1024 bytes.

map<string, string> metadata = 7 [(.google.api.field_behavior) = OPTIONAL];

Returns
TypeDescription
Map<String,String>

getMetadataOrDefault(String key, String defaultValue)

public String getMetadataOrDefault(String key, String defaultValue)

Optional. Metadata for the document. The metadata supports arbitrary key-value pairs. Suggested use cases include storing a document's title, an external URL distinct from the document's content_uri, etc. The max size of a key or a value of the metadata is 1024 bytes.

map<string, string> metadata = 7 [(.google.api.field_behavior) = OPTIONAL];

Parameters
NameDescription
keyString
defaultValueString
Returns
TypeDescription
String

getMetadataOrThrow(String key)

public String getMetadataOrThrow(String key)

Optional. Metadata for the document. The metadata supports arbitrary key-value pairs. Suggested use cases include storing a document's title, an external URL distinct from the document's content_uri, etc. The max size of a key or a value of the metadata is 1024 bytes.

map<string, string> metadata = 7 [(.google.api.field_behavior) = OPTIONAL];

Parameter
NameDescription
keyString
Returns
TypeDescription
String

getMimeType()

public String getMimeType()

Required. The MIME type of this document.

string mime_type = 3 [(.google.api.field_behavior) = REQUIRED];

Returns
TypeDescription
String

The mimeType.

getMimeTypeBytes()

public ByteString getMimeTypeBytes()

Required. The MIME type of this document.

string mime_type = 3 [(.google.api.field_behavior) = REQUIRED];

Returns
TypeDescription
ByteString

The bytes for mimeType.

getName()

public String getName()

Optional. The document resource name. The name must be empty when creating a document. Format: projects/<Project ID>/locations/<Location ID>/knowledgeBases/<Knowledge Base ID>/documents/<Document ID>.

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

Returns
TypeDescription
String

The name.

getNameBytes()

public ByteString getNameBytes()

Optional. The document resource name. The name must be empty when creating a document. Format: projects/<Project ID>/locations/<Location ID>/knowledgeBases/<Knowledge Base ID>/documents/<Document ID>.

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

Returns
TypeDescription
ByteString

The bytes for name.

getParserForType()

public Parser<Document> getParserForType()
Returns
TypeDescription
Parser<Document>
Overrides

getRawContent()

public ByteString getRawContent()

The raw content of the document. This field is only permitted for EXTRACTIVE_QA and FAQ knowledge types.

bytes raw_content = 9;

Returns
TypeDescription
ByteString

The rawContent.

getSerializedSize()

public int getSerializedSize()
Returns
TypeDescription
int
Overrides

getSourceCase()

public Document.SourceCase getSourceCase()
Returns
TypeDescription
Document.SourceCase

getState()

public Document.State getState()

Output only. The current state of the document.

.google.cloud.dialogflow.v2.Document.State state = 13 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
TypeDescription
Document.State

The state.

getStateValue()

public int getStateValue()

Output only. The current state of the document.

.google.cloud.dialogflow.v2.Document.State state = 13 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
TypeDescription
int

The enum numeric value on the wire for state.

hasContentUri()

public boolean hasContentUri()

The URI where the file content is located.

For documents stored in Google Cloud Storage, these URIs must have the form gs://<bucket-name>/<object-name>.

NOTE: External URLs must correspond to public webpages, i.e., they must be indexed by Google Search. In particular, URLs for showing documents in Google Cloud Storage (i.e. the URL in your browser) are not supported. Instead use the gs:// format URI described above.

string content_uri = 5;

Returns
TypeDescription
boolean

Whether the contentUri field is set.

hasLatestReloadStatus()

public boolean hasLatestReloadStatus()

Output only. The time and status of the latest reload. This reload may have been triggered automatically or manually and may not have succeeded.

.google.cloud.dialogflow.v2.Document.ReloadStatus latest_reload_status = 12 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
TypeDescription
boolean

Whether the latestReloadStatus field is set.

hasRawContent()

public boolean hasRawContent()

The raw content of the document. This field is only permitted for EXTRACTIVE_QA and FAQ knowledge types.

bytes raw_content = 9;

Returns
TypeDescription
boolean

Whether the rawContent field is set.

hashCode()

public int hashCode()
Returns
TypeDescription
int
Overrides

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
TypeDescription
FieldAccessorTable
Overrides

internalGetMapFieldReflection(int number)

protected MapFieldReflectionAccessor internalGetMapFieldReflection(int number)
Parameter
NameDescription
numberint
Returns
TypeDescription
com.google.protobuf.MapFieldReflectionAccessor
Overrides
com.google.protobuf.GeneratedMessageV3.internalGetMapFieldReflection(int)

isInitialized()

public final boolean isInitialized()
Returns
TypeDescription
boolean
Overrides

newBuilderForType()

public Document.Builder newBuilderForType()
Returns
TypeDescription
Document.Builder

newBuilderForType(GeneratedMessageV3.BuilderParent parent)

protected Document.Builder newBuilderForType(GeneratedMessageV3.BuilderParent parent)
Parameter
NameDescription
parentBuilderParent
Returns
TypeDescription
Document.Builder
Overrides

newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)

protected Object newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)
Parameter
NameDescription
unusedUnusedPrivateParameter
Returns
TypeDescription
Object
Overrides

toBuilder()

public Document.Builder toBuilder()
Returns
TypeDescription
Document.Builder

writeTo(CodedOutputStream output)

public void writeTo(CodedOutputStream output)
Parameter
NameDescription
outputCodedOutputStream
Overrides
Exceptions
TypeDescription
IOException