aws-sdk-qconnect 1.109.0

AWS SDK for Amazon Q Connect
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>A citation that references source content.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
pub struct Citation {
    /// <p>The identifier of the content being cited.</p>
    pub content_id: ::std::option::Option<::std::string::String>,
    /// <p>The title of the cited content.</p>
    pub title: ::std::option::Option<::std::string::String>,
    /// <p>The identifier of the knowledge base containing the cited content.</p>
    pub knowledge_base_id: ::std::option::Option<::std::string::String>,
    /// <p>Contains information about where the text with a citation begins and ends in the generated output.</p>
    pub citation_span: ::std::option::Option<crate::types::CitationSpan>,
    /// <p>The source URL for the citation.</p>
    pub source_url: ::std::option::Option<::std::string::String>,
    /// <p>A type to define the KB origin of a cited content</p>
    pub reference_type: crate::types::ReferenceType,
}
impl Citation {
    /// <p>The identifier of the content being cited.</p>
    pub fn content_id(&self) -> ::std::option::Option<&str> {
        self.content_id.as_deref()
    }
    /// <p>The title of the cited content.</p>
    pub fn title(&self) -> ::std::option::Option<&str> {
        self.title.as_deref()
    }
    /// <p>The identifier of the knowledge base containing the cited content.</p>
    pub fn knowledge_base_id(&self) -> ::std::option::Option<&str> {
        self.knowledge_base_id.as_deref()
    }
    /// <p>Contains information about where the text with a citation begins and ends in the generated output.</p>
    pub fn citation_span(&self) -> ::std::option::Option<&crate::types::CitationSpan> {
        self.citation_span.as_ref()
    }
    /// <p>The source URL for the citation.</p>
    pub fn source_url(&self) -> ::std::option::Option<&str> {
        self.source_url.as_deref()
    }
    /// <p>A type to define the KB origin of a cited content</p>
    pub fn reference_type(&self) -> &crate::types::ReferenceType {
        &self.reference_type
    }
}
impl ::std::fmt::Debug for Citation {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        let mut formatter = f.debug_struct("Citation");
        formatter.field("content_id", &self.content_id);
        formatter.field("title", &"*** Sensitive Data Redacted ***");
        formatter.field("knowledge_base_id", &self.knowledge_base_id);
        formatter.field("citation_span", &self.citation_span);
        formatter.field("source_url", &"*** Sensitive Data Redacted ***");
        formatter.field("reference_type", &self.reference_type);
        formatter.finish()
    }
}
impl Citation {
    /// Creates a new builder-style object to manufacture [`Citation`](crate::types::Citation).
    pub fn builder() -> crate::types::builders::CitationBuilder {
        crate::types::builders::CitationBuilder::default()
    }
}

/// A builder for [`Citation`](crate::types::Citation).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
#[non_exhaustive]
pub struct CitationBuilder {
    pub(crate) content_id: ::std::option::Option<::std::string::String>,
    pub(crate) title: ::std::option::Option<::std::string::String>,
    pub(crate) knowledge_base_id: ::std::option::Option<::std::string::String>,
    pub(crate) citation_span: ::std::option::Option<crate::types::CitationSpan>,
    pub(crate) source_url: ::std::option::Option<::std::string::String>,
    pub(crate) reference_type: ::std::option::Option<crate::types::ReferenceType>,
}
impl CitationBuilder {
    /// <p>The identifier of the content being cited.</p>
    pub fn content_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.content_id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The identifier of the content being cited.</p>
    pub fn set_content_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.content_id = input;
        self
    }
    /// <p>The identifier of the content being cited.</p>
    pub fn get_content_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.content_id
    }
    /// <p>The title of the cited content.</p>
    pub fn title(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.title = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The title of the cited content.</p>
    pub fn set_title(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.title = input;
        self
    }
    /// <p>The title of the cited content.</p>
    pub fn get_title(&self) -> &::std::option::Option<::std::string::String> {
        &self.title
    }
    /// <p>The identifier of the knowledge base containing the cited content.</p>
    pub fn knowledge_base_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.knowledge_base_id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The identifier of the knowledge base containing the cited content.</p>
    pub fn set_knowledge_base_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.knowledge_base_id = input;
        self
    }
    /// <p>The identifier of the knowledge base containing the cited content.</p>
    pub fn get_knowledge_base_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.knowledge_base_id
    }
    /// <p>Contains information about where the text with a citation begins and ends in the generated output.</p>
    /// This field is required.
    pub fn citation_span(mut self, input: crate::types::CitationSpan) -> Self {
        self.citation_span = ::std::option::Option::Some(input);
        self
    }
    /// <p>Contains information about where the text with a citation begins and ends in the generated output.</p>
    pub fn set_citation_span(mut self, input: ::std::option::Option<crate::types::CitationSpan>) -> Self {
        self.citation_span = input;
        self
    }
    /// <p>Contains information about where the text with a citation begins and ends in the generated output.</p>
    pub fn get_citation_span(&self) -> &::std::option::Option<crate::types::CitationSpan> {
        &self.citation_span
    }
    /// <p>The source URL for the citation.</p>
    pub fn source_url(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.source_url = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The source URL for the citation.</p>
    pub fn set_source_url(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.source_url = input;
        self
    }
    /// <p>The source URL for the citation.</p>
    pub fn get_source_url(&self) -> &::std::option::Option<::std::string::String> {
        &self.source_url
    }
    /// <p>A type to define the KB origin of a cited content</p>
    /// This field is required.
    pub fn reference_type(mut self, input: crate::types::ReferenceType) -> Self {
        self.reference_type = ::std::option::Option::Some(input);
        self
    }
    /// <p>A type to define the KB origin of a cited content</p>
    pub fn set_reference_type(mut self, input: ::std::option::Option<crate::types::ReferenceType>) -> Self {
        self.reference_type = input;
        self
    }
    /// <p>A type to define the KB origin of a cited content</p>
    pub fn get_reference_type(&self) -> &::std::option::Option<crate::types::ReferenceType> {
        &self.reference_type
    }
    /// Consumes the builder and constructs a [`Citation`](crate::types::Citation).
    /// This method will fail if any of the following fields are not set:
    /// - [`reference_type`](crate::types::builders::CitationBuilder::reference_type)
    pub fn build(self) -> ::std::result::Result<crate::types::Citation, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::Citation {
            content_id: self.content_id,
            title: self.title,
            knowledge_base_id: self.knowledge_base_id,
            citation_span: self.citation_span,
            source_url: self.source_url,
            reference_type: self.reference_type.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "reference_type",
                    "reference_type was not specified but it is required when building Citation",
                )
            })?,
        })
    }
}
impl ::std::fmt::Debug for CitationBuilder {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        let mut formatter = f.debug_struct("CitationBuilder");
        formatter.field("content_id", &self.content_id);
        formatter.field("title", &"*** Sensitive Data Redacted ***");
        formatter.field("knowledge_base_id", &self.knowledge_base_id);
        formatter.field("citation_span", &self.citation_span);
        formatter.field("source_url", &"*** Sensitive Data Redacted ***");
        formatter.field("reference_type", &self.reference_type);
        formatter.finish()
    }
}