#[derive(
    Debug,
    Clone,
    conjure_object::serde::Serialize,
    conjure_object::serde::Deserialize,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash
)]
#[serde(crate = "conjure_object::serde")]
#[conjure_object::private::staged_builder::staged_builder]
#[builder(crate = conjure_object::private::staged_builder, update, inline)]
pub struct SearchTemplatesRequest {
    #[builder(custom(type = super::SearchTemplatesQuery, convert = Box::new))]
    #[serde(rename = "query")]
    query: Box<super::SearchTemplatesQuery>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::SortBy>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(rename = "sortBy", skip_serializing_if = "Option::is_none", default)]
    sort_by: Option<Box<super::SortBy>>,
    #[builder(default, into)]
    #[serde(rename = "nextPageToken", skip_serializing_if = "Option::is_none", default)]
    next_page_token: Option<String>,
    #[builder(default, into)]
    #[serde(rename = "pageSize", skip_serializing_if = "Option::is_none", default)]
    page_size: Option<i32>,
}
impl SearchTemplatesRequest {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new(query: super::SearchTemplatesQuery) -> Self {
        Self::builder().query(query).build()
    }
    #[inline]
    pub fn query(&self) -> &super::SearchTemplatesQuery {
        &*self.query
    }
    /// EDITED_AT descending by default
    #[inline]
    pub fn sort_by(&self) -> Option<&super::SortBy> {
        self.sort_by.as_ref().map(|o| &**o)
    }
    #[inline]
    pub fn next_page_token(&self) -> Option<&str> {
        self.next_page_token.as_ref().map(|o| &**o)
    }
    /// Defaults to 100. Will throw if larger than 1_000.
    #[inline]
    pub fn page_size(&self) -> Option<i32> {
        self.page_size.as_ref().map(|o| *o)
    }
}
