aws-sdk-cloudsearchdomain 1.93.0

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

/// <p>The collection of documents that match the search request.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Hits {
    /// <p>The total number of documents that match the search request.</p>
    pub found: i64,
    /// <p>The index of the first matching document.</p>
    pub start: i64,
    /// <p>A cursor that can be used to retrieve the next set of matching documents when you want to page through a large result set.</p>
    pub cursor: ::std::option::Option<::std::string::String>,
    /// <p>A document that matches the search request.</p>
    pub hit: ::std::option::Option<::std::vec::Vec<crate::types::Hit>>,
}
impl Hits {
    /// <p>The total number of documents that match the search request.</p>
    pub fn found(&self) -> i64 {
        self.found
    }
    /// <p>The index of the first matching document.</p>
    pub fn start(&self) -> i64 {
        self.start
    }
    /// <p>A cursor that can be used to retrieve the next set of matching documents when you want to page through a large result set.</p>
    pub fn cursor(&self) -> ::std::option::Option<&str> {
        self.cursor.as_deref()
    }
    /// <p>A document that matches the search request.</p>
    ///
    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.hit.is_none()`.
    pub fn hit(&self) -> &[crate::types::Hit] {
        self.hit.as_deref().unwrap_or_default()
    }
}
impl Hits {
    /// Creates a new builder-style object to manufacture [`Hits`](crate::types::Hits).
    pub fn builder() -> crate::types::builders::HitsBuilder {
        crate::types::builders::HitsBuilder::default()
    }
}

/// A builder for [`Hits`](crate::types::Hits).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct HitsBuilder {
    pub(crate) found: ::std::option::Option<i64>,
    pub(crate) start: ::std::option::Option<i64>,
    pub(crate) cursor: ::std::option::Option<::std::string::String>,
    pub(crate) hit: ::std::option::Option<::std::vec::Vec<crate::types::Hit>>,
}
impl HitsBuilder {
    /// <p>The total number of documents that match the search request.</p>
    pub fn found(mut self, input: i64) -> Self {
        self.found = ::std::option::Option::Some(input);
        self
    }
    /// <p>The total number of documents that match the search request.</p>
    pub fn set_found(mut self, input: ::std::option::Option<i64>) -> Self {
        self.found = input;
        self
    }
    /// <p>The total number of documents that match the search request.</p>
    pub fn get_found(&self) -> &::std::option::Option<i64> {
        &self.found
    }
    /// <p>The index of the first matching document.</p>
    pub fn start(mut self, input: i64) -> Self {
        self.start = ::std::option::Option::Some(input);
        self
    }
    /// <p>The index of the first matching document.</p>
    pub fn set_start(mut self, input: ::std::option::Option<i64>) -> Self {
        self.start = input;
        self
    }
    /// <p>The index of the first matching document.</p>
    pub fn get_start(&self) -> &::std::option::Option<i64> {
        &self.start
    }
    /// <p>A cursor that can be used to retrieve the next set of matching documents when you want to page through a large result set.</p>
    pub fn cursor(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.cursor = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>A cursor that can be used to retrieve the next set of matching documents when you want to page through a large result set.</p>
    pub fn set_cursor(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.cursor = input;
        self
    }
    /// <p>A cursor that can be used to retrieve the next set of matching documents when you want to page through a large result set.</p>
    pub fn get_cursor(&self) -> &::std::option::Option<::std::string::String> {
        &self.cursor
    }
    /// Appends an item to `hit`.
    ///
    /// To override the contents of this collection use [`set_hit`](Self::set_hit).
    ///
    /// <p>A document that matches the search request.</p>
    pub fn hit(mut self, input: crate::types::Hit) -> Self {
        let mut v = self.hit.unwrap_or_default();
        v.push(input);
        self.hit = ::std::option::Option::Some(v);
        self
    }
    /// <p>A document that matches the search request.</p>
    pub fn set_hit(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Hit>>) -> Self {
        self.hit = input;
        self
    }
    /// <p>A document that matches the search request.</p>
    pub fn get_hit(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Hit>> {
        &self.hit
    }
    /// Consumes the builder and constructs a [`Hits`](crate::types::Hits).
    pub fn build(self) -> crate::types::Hits {
        crate::types::Hits {
            found: self.found.unwrap_or_default(),
            start: self.start.unwrap_or_default(),
            cursor: self.cursor,
            hit: self.hit,
        }
    }
}