oxsearch_sql/generated/
get_async.rs1#[derive(Clone, Debug, PartialEq)]
10#[non_exhaustive]
11pub struct Request {
12 pub id: ::oxsearch_core::Id,
15 pub delimiter: ::core::option::Option<::std::string::String>,
19 pub format: ::core::option::Option<::std::string::String>,
23 pub keep_alive: ::core::option::Option<::oxsearch_core::Duration>,
26 pub wait_for_completion_timeout: ::core::option::Option<::oxsearch_core::Duration>,
29}
30
31impl Request {
32 pub fn new(id: impl ::core::convert::Into<::oxsearch_core::Id>) -> Self {
34 Self {
35 id: id.into(),
36 delimiter: ::core::option::Option::None,
37 format: ::core::option::Option::None,
38 keep_alive: ::core::option::Option::None,
39 wait_for_completion_timeout: ::core::option::Option::None,
40 }
41 }
42}
43
44impl Request {
45 pub fn delimiter(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
47 self.delimiter = ::core::option::Option::Some(value.into());
48 self
49 }
50 pub fn format(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
52 self.format = ::core::option::Option::Some(value.into());
53 self
54 }
55 pub fn keep_alive(
57 mut self,
58 value: impl ::core::convert::Into<::oxsearch_core::Duration>,
59 ) -> Self {
60 self.keep_alive = ::core::option::Option::Some(value.into());
61 self
62 }
63 pub fn wait_for_completion_timeout(
65 mut self,
66 value: impl ::core::convert::Into<::oxsearch_core::Duration>,
67 ) -> Self {
68 self.wait_for_completion_timeout = ::core::option::Option::Some(value.into());
69 self
70 }
71}
72
73#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
74#[non_exhaustive]
75pub struct Response {
76 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
80 pub id: ::core::option::Option<::oxsearch_core::Id>,
81 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
86 pub is_running: ::core::option::Option<bool>,
87 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
93 pub is_partial: ::core::option::Option<bool>,
94 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
96 pub columns: ::core::option::Option<::std::vec::Vec<crate::Column>>,
97 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
100 pub cursor: ::core::option::Option<::std::string::String>,
101 #[serde(default = "::core::default::Default::default")]
103 pub rows: ::std::vec::Vec<crate::Row>,
104}
105
106impl Response {
107 pub fn new(
109 id: impl ::core::convert::Into<::oxsearch_core::Id>,
110 is_running: bool,
111 is_partial: bool,
112 rows: impl ::core::convert::Into<::std::vec::Vec<crate::Row>>,
113 ) -> Self {
114 Self {
115 id: ::core::option::Option::Some(id.into()),
116 is_running: ::core::option::Option::Some(is_running.into()),
117 is_partial: ::core::option::Option::Some(is_partial.into()),
118 columns: ::core::option::Option::None,
119 cursor: ::core::option::Option::None,
120 rows: rows.into(),
121 }
122 }
123}
124
125impl Response {
126 pub fn columns(
128 mut self,
129 value: impl ::core::convert::Into<::std::vec::Vec<crate::Column>>,
130 ) -> Self {
131 self.columns = ::core::option::Option::Some(value.into());
132 self
133 }
134 pub fn cursor(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
136 self.cursor = ::core::option::Option::Some(value.into());
137 self
138 }
139}
140
141impl ::oxsearch_core::Endpoint for Request {
142 type Response = crate::get_async::Response;
143
144 fn name(&self) -> &'static str {
145 "sql.get_async"
146 }
147
148 fn route(&self) -> ::core::result::Result<::oxsearch_core::Route, ::oxsearch_core::Error> {
149 if let (::core::option::Option::Some(p0),) = (::core::option::Option::Some(&self.id),) {
150 return ::core::result::Result::Ok(::oxsearch_core::Route::new(
151 ::oxsearch_core::Method::Get,
152 format!(
153 "/_sql/async/{}",
154 ::oxsearch_core::__private::path_param("id", p0)?
155 ),
156 ));
157 }
158 ::core::result::Result::Err(::oxsearch_core::__private::no_route(self.name()))
159 }
160
161 fn query(
162 &self,
163 ) -> ::core::result::Result<
164 ::std::vec::Vec<(&'static str, ::std::string::String)>,
165 ::oxsearch_core::Error,
166 > {
167 let mut query = ::std::vec::Vec::new();
168 if let ::core::option::Option::Some(value) = &self.delimiter {
169 query.push((
170 "delimiter",
171 ::oxsearch_core::__private::query_param("delimiter", value)?,
172 ));
173 }
174 if let ::core::option::Option::Some(value) = &self.format {
175 query.push((
176 "format",
177 ::oxsearch_core::__private::query_param("format", value)?,
178 ));
179 }
180 if let ::core::option::Option::Some(value) = &self.keep_alive {
181 query.push((
182 "keep_alive",
183 ::oxsearch_core::__private::query_param("keep_alive", value)?,
184 ));
185 }
186 if let ::core::option::Option::Some(value) = &self.wait_for_completion_timeout {
187 query.push((
188 "wait_for_completion_timeout",
189 ::oxsearch_core::__private::query_param("wait_for_completion_timeout", value)?,
190 ));
191 }
192 ::core::result::Result::Ok(query)
193 }
194
195 fn body(
196 &self,
197 ) -> ::core::result::Result<::core::option::Option<::oxsearch_core::Body>, ::oxsearch_core::Error>
198 {
199 ::core::result::Result::Ok(::core::option::Option::None)
200 }
201}