Skip to main content

oxsearch_sql/generated/
clear_cursor.rs

1// Generated by `cargo run -p xtask -- generate` from elastic/elasticsearch-specification 9.5 at
2// 84bf510a907bae62ffe29af35f516af287a79eab. Don't edit it: change the generator.
3
4/// The request's body.
5#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6#[non_exhaustive]
7pub struct RequestBody {
8    /// Cursor to clear.
9    pub cursor: ::std::string::String,
10}
11
12impl RequestBody {
13    /// A `RequestBody` with its required properties set.
14    pub fn new(cursor: impl ::core::convert::Into<::std::string::String>) -> Self {
15        Self {
16            cursor: cursor.into(),
17        }
18    }
19}
20
21impl RequestBody {}
22
23/// Clear an SQL search cursor.
24#[derive(Clone, Debug, PartialEq)]
25#[non_exhaustive]
26pub struct Request {
27    /// The body.
28    pub body: ::core::option::Option<crate::clear_cursor::RequestBody>,
29}
30
31impl Request {
32    /// A `Request` with its required properties set.
33    pub fn new() -> Self {
34        Self {
35            body: ::core::option::Option::None,
36        }
37    }
38}
39
40impl Request {
41    /// Sets `body`.
42    pub fn body(
43        mut self,
44        value: impl ::core::convert::Into<crate::clear_cursor::RequestBody>,
45    ) -> Self {
46        self.body = ::core::option::Option::Some(value.into());
47        self
48    }
49}
50
51#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
52#[non_exhaustive]
53pub struct Response {
54    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
55    pub succeeded: ::core::option::Option<bool>,
56}
57
58impl Response {
59    /// A `Response` with its required properties set.
60    pub fn new(succeeded: bool) -> Self {
61        Self {
62            succeeded: ::core::option::Option::Some(succeeded.into()),
63        }
64    }
65}
66
67impl Response {}
68
69impl ::oxsearch_core::Endpoint for Request {
70    type Response = crate::clear_cursor::Response;
71
72    fn name(&self) -> &'static str {
73        "sql.clear_cursor"
74    }
75
76    fn route(&self) -> ::core::result::Result<::oxsearch_core::Route, ::oxsearch_core::Error> {
77        ::core::result::Result::Ok(::oxsearch_core::Route::new(
78            ::oxsearch_core::Method::Post,
79            "/_sql/close",
80        ))
81    }
82
83    fn query(
84        &self,
85    ) -> ::core::result::Result<
86        ::std::vec::Vec<(&'static str, ::std::string::String)>,
87        ::oxsearch_core::Error,
88    > {
89        ::core::result::Result::Ok(::std::vec::Vec::new())
90    }
91
92    fn body(
93        &self,
94    ) -> ::core::result::Result<::core::option::Option<::oxsearch_core::Body>, ::oxsearch_core::Error>
95    {
96        self.body
97            .as_ref()
98            .map(|body| ::oxsearch_core::__private::json_body(body))
99            .transpose()
100    }
101}