#[non_exhaustive]pub struct Document {
pub name: String,
pub display_name: String,
pub mime_type: String,
pub knowledge_types: Vec<KnowledgeType>,
pub enable_auto_reload: bool,
pub latest_reload_status: Option<ReloadStatus>,
pub metadata: HashMap<String, String>,
pub state: State,
pub source: Option<Source>,
/* private fields */
}documents only.Expand description
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.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.name: StringOptional. 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>.
display_name: StringRequired. The display name of the document. The name must be 1024 bytes or less; otherwise, the creation request fails.
mime_type: StringRequired. The MIME type of this document.
knowledge_types: Vec<KnowledgeType>Required. The knowledge type of document content.
enable_auto_reload: boolOptional. 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.
latest_reload_status: Option<ReloadStatus>Output only. The time and status of the latest reload. This reload may have been triggered automatically or manually and may not have succeeded.
metadata: HashMap<String, String>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.
state: StateOutput only. The current state of the document.
source: Option<Source>Required. The source of this document.
Implementations§
Source§impl Document
impl Document
pub fn new() -> Self
Sourcepub fn set_display_name<T: Into<String>>(self, v: T) -> Self
pub fn set_display_name<T: Into<String>>(self, v: T) -> Self
Sourcepub fn set_mime_type<T: Into<String>>(self, v: T) -> Self
pub fn set_mime_type<T: Into<String>>(self, v: T) -> Self
Sourcepub fn set_knowledge_types<T, V>(self, v: T) -> Self
pub fn set_knowledge_types<T, V>(self, v: T) -> Self
Sets the value of knowledge_types.
§Example
use google_cloud_dialogflow_v2::model::document::KnowledgeType;
let x = Document::new().set_knowledge_types([
KnowledgeType::Faq,
KnowledgeType::ExtractiveQa,
KnowledgeType::ArticleSuggestion,
]);Sourcepub fn set_enable_auto_reload<T: Into<bool>>(self, v: T) -> Self
pub fn set_enable_auto_reload<T: Into<bool>>(self, v: T) -> Self
Sets the value of enable_auto_reload.
§Example
let x = Document::new().set_enable_auto_reload(true);Sourcepub fn set_latest_reload_status<T>(self, v: T) -> Selfwhere
T: Into<ReloadStatus>,
pub fn set_latest_reload_status<T>(self, v: T) -> Selfwhere
T: Into<ReloadStatus>,
Sets the value of latest_reload_status.
§Example
use google_cloud_dialogflow_v2::model::document::ReloadStatus;
let x = Document::new().set_latest_reload_status(ReloadStatus::default()/* use setters */);Sourcepub fn set_or_clear_latest_reload_status<T>(self, v: Option<T>) -> Selfwhere
T: Into<ReloadStatus>,
pub fn set_or_clear_latest_reload_status<T>(self, v: Option<T>) -> Selfwhere
T: Into<ReloadStatus>,
Sets or clears the value of latest_reload_status.
§Example
use google_cloud_dialogflow_v2::model::document::ReloadStatus;
let x = Document::new().set_or_clear_latest_reload_status(Some(ReloadStatus::default()/* use setters */));
let x = Document::new().set_or_clear_latest_reload_status(None::<ReloadStatus>);Sourcepub fn set_metadata<T, K, V>(self, v: T) -> Self
pub fn set_metadata<T, K, V>(self, v: T) -> Self
Sourcepub fn set_source<T: Into<Option<Source>>>(self, v: T) -> Self
pub fn set_source<T: Into<Option<Source>>>(self, v: T) -> Self
Sourcepub fn content_uri(&self) -> Option<&String>
pub fn content_uri(&self) -> Option<&String>
The value of source
if it holds a ContentUri, None if the field is not set or
holds a different branch.
Sourcepub fn set_content_uri<T: Into<String>>(self, v: T) -> Self
pub fn set_content_uri<T: Into<String>>(self, v: T) -> Self
Sourcepub fn raw_content(&self) -> Option<&Bytes>
pub fn raw_content(&self) -> Option<&Bytes>
The value of source
if it holds a RawContent, None if the field is not set or
holds a different branch.