oxsearch-core 0.1.0

The core of oxsearch: the transport and endpoint traits, errors, and the common types, query DSL, retrievers and kNN generated from the Elasticsearch specification
Documentation
// Generated by `cargo run -p xtask -- generate` from elastic/elasticsearch-specification 9.5 at
// 84bf510a907bae62ffe29af35f516af287a79eab. Don't edit it: change the generator.

/// Get cluster info.
///
/// Get basic build, version, and cluster information.
/// ::: In Serverless, `version.number` always reports the next target Elasticsearch release version at the time of the request. Serverless does not track to a traditional release versioning model; it is continuously updated. The version number is provided to maintain compatibility with existing clients, but it is not meaningful for assessing feature availability. Clients should detect a Serverless environment by checking for `build_flavor: serverless`.
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub struct Request {}

impl Request {
    /// A `Request` with its required properties set.
    pub fn new() -> Self {
        Self {}
    }
}

impl Request {}

#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct Response {
    /// The responding cluster's name.
    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
    pub cluster_name: ::core::option::Option<crate::Name>,
    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
    pub cluster_uuid: ::core::option::Option<crate::Uuid>,
    /// The responding node's name.
    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
    pub name: ::core::option::Option<crate::Name>,
    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
    pub tagline: ::core::option::Option<::std::string::String>,
    /// Version information for the Elasticsearch cluster. In Serverless, `version.number` always reports the next target Elasticsearch release version at the time of the request, not an actual deployed version. The version number is provided to maintain client compatibility but is not meaningful for assessing feature availability. Use `build_flavor: serverless` to detect a Serverless environment.
    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
    pub version: ::core::option::Option<crate::ElasticsearchVersionInfo>,
}

impl Response {
    /// A `Response` with its required properties set.
    pub fn new(
        cluster_name: impl ::core::convert::Into<crate::Name>,
        cluster_uuid: impl ::core::convert::Into<crate::Uuid>,
        name: impl ::core::convert::Into<crate::Name>,
        tagline: impl ::core::convert::Into<::std::string::String>,
        version: impl ::core::convert::Into<crate::ElasticsearchVersionInfo>,
    ) -> Self {
        Self {
            cluster_name: ::core::option::Option::Some(cluster_name.into()),
            cluster_uuid: ::core::option::Option::Some(cluster_uuid.into()),
            name: ::core::option::Option::Some(name.into()),
            tagline: ::core::option::Option::Some(tagline.into()),
            version: ::core::option::Option::Some(version.into()),
        }
    }
}

impl Response {}

impl ::oxsearch_core::Endpoint for Request {
    type Response = crate::info::Response;

    fn name(&self) -> &'static str {
        "info"
    }

    fn route(&self) -> ::core::result::Result<::oxsearch_core::Route, ::oxsearch_core::Error> {
        ::core::result::Result::Ok(::oxsearch_core::Route::new(
            ::oxsearch_core::Method::Get,
            "/",
        ))
    }

    fn query(
        &self,
    ) -> ::core::result::Result<
        ::std::vec::Vec<(&'static str, ::std::string::String)>,
        ::oxsearch_core::Error,
    > {
        ::core::result::Result::Ok(::std::vec::Vec::new())
    }

    fn body(
        &self,
    ) -> ::core::result::Result<::core::option::Option<::oxsearch_core::Body>, ::oxsearch_core::Error>
    {
        ::core::result::Result::Ok(::core::option::Option::None)
    }
}