oxsearch-sql 0.2.0

SQL for oxsearch, generated from the Elasticsearch specification: queries, cursors and their translation into search requests
Documentation
// Generated by `cargo run -p xtask -- generate` from elastic/elasticsearch-specification 9.5 at
// 84bf510a907bae62ffe29af35f516af287a79eab. Don't edit it: change the generator.

/// Delete an async SQL search.
///
/// Delete an async SQL search or a stored synchronous SQL search.
/// If the search is still running, the API cancels it.
///
/// If the Elasticsearch security features are enabled, only the following users can use this API to delete a search:
///
/// * Users with the `cancel_task` cluster privilege.
/// * The user who first submitted the search.
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub struct Request {
    // Path parameters.
    /// The identifier for the search.
    pub id: ::oxsearch_core::Id,
}

impl Request {
    /// A `Request` with its required properties set.
    pub fn new(id: impl ::core::convert::Into<::oxsearch_core::Id>) -> Self {
        Self { id: id.into() }
    }
}

impl Request {}

#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(transparent)]
pub struct Response(pub ::oxsearch_core::AcknowledgedResponseBase);

impl ::core::ops::Deref for Response {
    type Target = ::oxsearch_core::AcknowledgedResponseBase;
    fn deref(&self) -> &::oxsearch_core::AcknowledgedResponseBase {
        &self.0
    }
}

impl ::core::ops::DerefMut for Response {
    fn deref_mut(&mut self) -> &mut ::oxsearch_core::AcknowledgedResponseBase {
        &mut self.0
    }
}

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

    fn name(&self) -> &'static str {
        "sql.delete_async"
    }

    fn route(&self) -> ::core::result::Result<::oxsearch_core::Route, ::oxsearch_core::Error> {
        if let (::core::option::Option::Some(p0),) = (::core::option::Option::Some(&self.id),) {
            return ::core::result::Result::Ok(::oxsearch_core::Route::new(
                ::oxsearch_core::Method::Delete,
                format!(
                    "/_sql/async/delete/{}",
                    ::oxsearch_core::__private::path_param("id", p0)?
                ),
            ));
        }
        ::core::result::Result::Err(::oxsearch_core::__private::no_route(self.name()))
    }

    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)
    }
}