1use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum DeleteIndexIndexesByUidError {
22 UnknownValue(serde_json::Value),
23}
24
25#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum DeleteIndexIndexesByUidDocumentsByIdError {
29 UnknownValue(serde_json::Value),
30}
31
32#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum GetIndexHealthError {
36 Status503(models::IndexHealth),
37 UnknownValue(serde_json::Value),
38}
39
40#[derive(Debug, Clone, Serialize, Deserialize)]
42#[serde(untagged)]
43pub enum GetIndexIndexesError {
44 UnknownValue(serde_json::Value),
45}
46
47#[derive(Debug, Clone, Serialize, Deserialize)]
49#[serde(untagged)]
50pub enum GetIndexIndexesByUidError {
51 UnknownValue(serde_json::Value),
52}
53
54#[derive(Debug, Clone, Serialize, Deserialize)]
56#[serde(untagged)]
57pub enum GetIndexIndexesByUidDocumentsError {
58 UnknownValue(serde_json::Value),
59}
60
61#[derive(Debug, Clone, Serialize, Deserialize)]
63#[serde(untagged)]
64pub enum GetIndexIndexesByUidDocumentsByIdError {
65 UnknownValue(serde_json::Value),
66}
67
68#[derive(Debug, Clone, Serialize, Deserialize)]
70#[serde(untagged)]
71pub enum GetIndexIndexesByUidSettingsError {
72 UnknownValue(serde_json::Value),
73}
74
75#[derive(Debug, Clone, Serialize, Deserialize)]
77#[serde(untagged)]
78pub enum GetIndexStatsError {
79 UnknownValue(serde_json::Value),
80}
81
82#[derive(Debug, Clone, Serialize, Deserialize)]
84#[serde(untagged)]
85pub enum GetIndexTasksByUidError {
86 UnknownValue(serde_json::Value),
87}
88
89#[derive(Debug, Clone, Serialize, Deserialize)]
91#[serde(untagged)]
92pub enum GetIndexVersionError {
93 UnknownValue(serde_json::Value),
94}
95
96#[derive(Debug, Clone, Serialize, Deserialize)]
98#[serde(untagged)]
99pub enum PatchIndexIndexesByUidSettingsError {
100 UnknownValue(serde_json::Value),
101}
102
103#[derive(Debug, Clone, Serialize, Deserialize)]
105#[serde(untagged)]
106pub enum PostIndexIndexesError {
107 UnknownValue(serde_json::Value),
108}
109
110#[derive(Debug, Clone, Serialize, Deserialize)]
112#[serde(untagged)]
113pub enum PostIndexIndexesByUidDocumentsError {
114 UnknownValue(serde_json::Value),
115}
116
117#[derive(Debug, Clone, Serialize, Deserialize)]
119#[serde(untagged)]
120pub enum PostIndexIndexesByUidDocumentsDeleteBatchError {
121 UnknownValue(serde_json::Value),
122}
123
124#[derive(Debug, Clone, Serialize, Deserialize)]
126#[serde(untagged)]
127pub enum PostIndexIndexesByUidSearchError {
128 UnknownValue(serde_json::Value),
129}
130
131#[derive(Debug, Clone, Serialize, Deserialize)]
133#[serde(untagged)]
134pub enum PutIndexIndexesByUidDocumentsError {
135 UnknownValue(serde_json::Value),
136}
137
138
139pub async fn delete_index_indexes_by_uid(configuration: &configuration::Configuration, uid: &str) -> Result<models::IndexEnqueued, Error<DeleteIndexIndexesByUidError>> {
141 let p_uid = uid;
143
144 let uri_str = format!("{}/v1/index/indexes/{uid}", configuration.base_path, uid=crate::apis::urlencode(p_uid));
145 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
146
147 if let Some(ref user_agent) = configuration.user_agent {
148 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
149 }
150 if let Some(ref token) = configuration.bearer_access_token {
151 req_builder = req_builder.bearer_auth(token.to_owned());
152 };
153
154 let req = req_builder.build()?;
155 let resp = configuration.client.execute(req).await?;
156
157 let status = resp.status();
158 let content_type = resp
159 .headers()
160 .get("content-type")
161 .and_then(|v| v.to_str().ok())
162 .unwrap_or("application/octet-stream");
163 let content_type = super::ContentType::from(content_type);
164
165 if !status.is_client_error() && !status.is_server_error() {
166 let content = resp.text().await?;
167 match content_type {
168 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
169 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::IndexEnqueued`"))),
170 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::IndexEnqueued`")))),
171 }
172 } else {
173 let content = resp.text().await?;
174 let entity: Option<DeleteIndexIndexesByUidError> = serde_json::from_str(&content).ok();
175 Err(Error::ResponseError(ResponseContent { status, content, entity }))
176 }
177}
178
179pub async fn delete_index_indexes_by_uid_documents_by_id(configuration: &configuration::Configuration, uid: &str, id: &str) -> Result<models::IndexEnqueued, Error<DeleteIndexIndexesByUidDocumentsByIdError>> {
181 let p_uid = uid;
183 let p_id = id;
184
185 let uri_str = format!("{}/v1/index/indexes/{uid}/documents/{id}", configuration.base_path, uid=crate::apis::urlencode(p_uid), id=crate::apis::urlencode(p_id));
186 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
187
188 if let Some(ref user_agent) = configuration.user_agent {
189 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
190 }
191 if let Some(ref token) = configuration.bearer_access_token {
192 req_builder = req_builder.bearer_auth(token.to_owned());
193 };
194
195 let req = req_builder.build()?;
196 let resp = configuration.client.execute(req).await?;
197
198 let status = resp.status();
199 let content_type = resp
200 .headers()
201 .get("content-type")
202 .and_then(|v| v.to_str().ok())
203 .unwrap_or("application/octet-stream");
204 let content_type = super::ContentType::from(content_type);
205
206 if !status.is_client_error() && !status.is_server_error() {
207 let content = resp.text().await?;
208 match content_type {
209 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
210 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::IndexEnqueued`"))),
211 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::IndexEnqueued`")))),
212 }
213 } else {
214 let content = resp.text().await?;
215 let entity: Option<DeleteIndexIndexesByUidDocumentsByIdError> = serde_json::from_str(&content).ok();
216 Err(Error::ResponseError(ResponseContent { status, content, entity }))
217 }
218}
219
220pub async fn get_index_health(configuration: &configuration::Configuration, ) -> Result<models::IndexHealth, Error<GetIndexHealthError>> {
222
223 let uri_str = format!("{}/v1/index/health", configuration.base_path);
224 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
225
226 if let Some(ref user_agent) = configuration.user_agent {
227 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
228 }
229 if let Some(ref token) = configuration.bearer_access_token {
230 req_builder = req_builder.bearer_auth(token.to_owned());
231 };
232
233 let req = req_builder.build()?;
234 let resp = configuration.client.execute(req).await?;
235
236 let status = resp.status();
237 let content_type = resp
238 .headers()
239 .get("content-type")
240 .and_then(|v| v.to_str().ok())
241 .unwrap_or("application/octet-stream");
242 let content_type = super::ContentType::from(content_type);
243
244 if !status.is_client_error() && !status.is_server_error() {
245 let content = resp.text().await?;
246 match content_type {
247 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
248 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::IndexHealth`"))),
249 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::IndexHealth`")))),
250 }
251 } else {
252 let content = resp.text().await?;
253 let entity: Option<GetIndexHealthError> = serde_json::from_str(&content).ok();
254 Err(Error::ResponseError(ResponseContent { status, content, entity }))
255 }
256}
257
258pub async fn get_index_indexes(configuration: &configuration::Configuration, ) -> Result<models::IndexList, Error<GetIndexIndexesError>> {
260
261 let uri_str = format!("{}/v1/index/indexes", configuration.base_path);
262 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
263
264 if let Some(ref user_agent) = configuration.user_agent {
265 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
266 }
267 if let Some(ref token) = configuration.bearer_access_token {
268 req_builder = req_builder.bearer_auth(token.to_owned());
269 };
270
271 let req = req_builder.build()?;
272 let resp = configuration.client.execute(req).await?;
273
274 let status = resp.status();
275 let content_type = resp
276 .headers()
277 .get("content-type")
278 .and_then(|v| v.to_str().ok())
279 .unwrap_or("application/octet-stream");
280 let content_type = super::ContentType::from(content_type);
281
282 if !status.is_client_error() && !status.is_server_error() {
283 let content = resp.text().await?;
284 match content_type {
285 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
286 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::IndexList`"))),
287 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::IndexList`")))),
288 }
289 } else {
290 let content = resp.text().await?;
291 let entity: Option<GetIndexIndexesError> = serde_json::from_str(&content).ok();
292 Err(Error::ResponseError(ResponseContent { status, content, entity }))
293 }
294}
295
296pub async fn get_index_indexes_by_uid(configuration: &configuration::Configuration, uid: &str) -> Result<models::IndexView, Error<GetIndexIndexesByUidError>> {
298 let p_uid = uid;
300
301 let uri_str = format!("{}/v1/index/indexes/{uid}", configuration.base_path, uid=crate::apis::urlencode(p_uid));
302 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
303
304 if let Some(ref user_agent) = configuration.user_agent {
305 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
306 }
307 if let Some(ref token) = configuration.bearer_access_token {
308 req_builder = req_builder.bearer_auth(token.to_owned());
309 };
310
311 let req = req_builder.build()?;
312 let resp = configuration.client.execute(req).await?;
313
314 let status = resp.status();
315 let content_type = resp
316 .headers()
317 .get("content-type")
318 .and_then(|v| v.to_str().ok())
319 .unwrap_or("application/octet-stream");
320 let content_type = super::ContentType::from(content_type);
321
322 if !status.is_client_error() && !status.is_server_error() {
323 let content = resp.text().await?;
324 match content_type {
325 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
326 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::IndexView`"))),
327 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::IndexView`")))),
328 }
329 } else {
330 let content = resp.text().await?;
331 let entity: Option<GetIndexIndexesByUidError> = serde_json::from_str(&content).ok();
332 Err(Error::ResponseError(ResponseContent { status, content, entity }))
333 }
334}
335
336pub async fn get_index_indexes_by_uid_documents(configuration: &configuration::Configuration, uid: &str, limit: Option<&str>, offset: Option<&str>) -> Result<models::IndexDocuments, Error<GetIndexIndexesByUidDocumentsError>> {
338 let p_uid = uid;
340 let p_limit = limit;
341 let p_offset = offset;
342
343 let uri_str = format!("{}/v1/index/indexes/{uid}/documents", configuration.base_path, uid=crate::apis::urlencode(p_uid));
344 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
345
346 if let Some(ref param_value) = p_limit {
347 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
348 }
349 if let Some(ref param_value) = p_offset {
350 req_builder = req_builder.query(&[("offset", ¶m_value.to_string())]);
351 }
352 if let Some(ref user_agent) = configuration.user_agent {
353 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
354 }
355 if let Some(ref token) = configuration.bearer_access_token {
356 req_builder = req_builder.bearer_auth(token.to_owned());
357 };
358
359 let req = req_builder.build()?;
360 let resp = configuration.client.execute(req).await?;
361
362 let status = resp.status();
363 let content_type = resp
364 .headers()
365 .get("content-type")
366 .and_then(|v| v.to_str().ok())
367 .unwrap_or("application/octet-stream");
368 let content_type = super::ContentType::from(content_type);
369
370 if !status.is_client_error() && !status.is_server_error() {
371 let content = resp.text().await?;
372 match content_type {
373 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
374 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::IndexDocuments`"))),
375 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::IndexDocuments`")))),
376 }
377 } else {
378 let content = resp.text().await?;
379 let entity: Option<GetIndexIndexesByUidDocumentsError> = serde_json::from_str(&content).ok();
380 Err(Error::ResponseError(ResponseContent { status, content, entity }))
381 }
382}
383
384pub async fn get_index_indexes_by_uid_documents_by_id(configuration: &configuration::Configuration, uid: &str, id: &str) -> Result<serde_json::Value, Error<GetIndexIndexesByUidDocumentsByIdError>> {
386 let p_uid = uid;
388 let p_id = id;
389
390 let uri_str = format!("{}/v1/index/indexes/{uid}/documents/{id}", configuration.base_path, uid=crate::apis::urlencode(p_uid), id=crate::apis::urlencode(p_id));
391 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
392
393 if let Some(ref user_agent) = configuration.user_agent {
394 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
395 }
396 if let Some(ref token) = configuration.bearer_access_token {
397 req_builder = req_builder.bearer_auth(token.to_owned());
398 };
399
400 let req = req_builder.build()?;
401 let resp = configuration.client.execute(req).await?;
402
403 let status = resp.status();
404 let content_type = resp
405 .headers()
406 .get("content-type")
407 .and_then(|v| v.to_str().ok())
408 .unwrap_or("application/octet-stream");
409 let content_type = super::ContentType::from(content_type);
410
411 if !status.is_client_error() && !status.is_server_error() {
412 let content = resp.text().await?;
413 match content_type {
414 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
415 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
416 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
417 }
418 } else {
419 let content = resp.text().await?;
420 let entity: Option<GetIndexIndexesByUidDocumentsByIdError> = serde_json::from_str(&content).ok();
421 Err(Error::ResponseError(ResponseContent { status, content, entity }))
422 }
423}
424
425pub async fn get_index_indexes_by_uid_settings(configuration: &configuration::Configuration, uid: &str) -> Result<models::IndexSettings, Error<GetIndexIndexesByUidSettingsError>> {
427 let p_uid = uid;
429
430 let uri_str = format!("{}/v1/index/indexes/{uid}/settings", configuration.base_path, uid=crate::apis::urlencode(p_uid));
431 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
432
433 if let Some(ref user_agent) = configuration.user_agent {
434 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
435 }
436 if let Some(ref token) = configuration.bearer_access_token {
437 req_builder = req_builder.bearer_auth(token.to_owned());
438 };
439
440 let req = req_builder.build()?;
441 let resp = configuration.client.execute(req).await?;
442
443 let status = resp.status();
444 let content_type = resp
445 .headers()
446 .get("content-type")
447 .and_then(|v| v.to_str().ok())
448 .unwrap_or("application/octet-stream");
449 let content_type = super::ContentType::from(content_type);
450
451 if !status.is_client_error() && !status.is_server_error() {
452 let content = resp.text().await?;
453 match content_type {
454 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
455 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::IndexSettings`"))),
456 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::IndexSettings`")))),
457 }
458 } else {
459 let content = resp.text().await?;
460 let entity: Option<GetIndexIndexesByUidSettingsError> = serde_json::from_str(&content).ok();
461 Err(Error::ResponseError(ResponseContent { status, content, entity }))
462 }
463}
464
465pub async fn get_index_stats(configuration: &configuration::Configuration, ) -> Result<models::IndexStats, Error<GetIndexStatsError>> {
467
468 let uri_str = format!("{}/v1/index/stats", configuration.base_path);
469 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
470
471 if let Some(ref user_agent) = configuration.user_agent {
472 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
473 }
474 if let Some(ref token) = configuration.bearer_access_token {
475 req_builder = req_builder.bearer_auth(token.to_owned());
476 };
477
478 let req = req_builder.build()?;
479 let resp = configuration.client.execute(req).await?;
480
481 let status = resp.status();
482 let content_type = resp
483 .headers()
484 .get("content-type")
485 .and_then(|v| v.to_str().ok())
486 .unwrap_or("application/octet-stream");
487 let content_type = super::ContentType::from(content_type);
488
489 if !status.is_client_error() && !status.is_server_error() {
490 let content = resp.text().await?;
491 match content_type {
492 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
493 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::IndexStats`"))),
494 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::IndexStats`")))),
495 }
496 } else {
497 let content = resp.text().await?;
498 let entity: Option<GetIndexStatsError> = serde_json::from_str(&content).ok();
499 Err(Error::ResponseError(ResponseContent { status, content, entity }))
500 }
501}
502
503pub async fn get_index_tasks_by_uid(configuration: &configuration::Configuration, uid: i32) -> Result<models::IndexTask, Error<GetIndexTasksByUidError>> {
505 let p_uid = uid;
507
508 let uri_str = format!("{}/v1/index/tasks/{uid}", configuration.base_path, uid=p_uid);
509 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
510
511 if let Some(ref user_agent) = configuration.user_agent {
512 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
513 }
514 if let Some(ref token) = configuration.bearer_access_token {
515 req_builder = req_builder.bearer_auth(token.to_owned());
516 };
517
518 let req = req_builder.build()?;
519 let resp = configuration.client.execute(req).await?;
520
521 let status = resp.status();
522 let content_type = resp
523 .headers()
524 .get("content-type")
525 .and_then(|v| v.to_str().ok())
526 .unwrap_or("application/octet-stream");
527 let content_type = super::ContentType::from(content_type);
528
529 if !status.is_client_error() && !status.is_server_error() {
530 let content = resp.text().await?;
531 match content_type {
532 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
533 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::IndexTask`"))),
534 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::IndexTask`")))),
535 }
536 } else {
537 let content = resp.text().await?;
538 let entity: Option<GetIndexTasksByUidError> = serde_json::from_str(&content).ok();
539 Err(Error::ResponseError(ResponseContent { status, content, entity }))
540 }
541}
542
543pub async fn get_index_version(configuration: &configuration::Configuration, ) -> Result<models::IndexVersion, Error<GetIndexVersionError>> {
545
546 let uri_str = format!("{}/v1/index/version", configuration.base_path);
547 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
548
549 if let Some(ref user_agent) = configuration.user_agent {
550 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
551 }
552 if let Some(ref token) = configuration.bearer_access_token {
553 req_builder = req_builder.bearer_auth(token.to_owned());
554 };
555
556 let req = req_builder.build()?;
557 let resp = configuration.client.execute(req).await?;
558
559 let status = resp.status();
560 let content_type = resp
561 .headers()
562 .get("content-type")
563 .and_then(|v| v.to_str().ok())
564 .unwrap_or("application/octet-stream");
565 let content_type = super::ContentType::from(content_type);
566
567 if !status.is_client_error() && !status.is_server_error() {
568 let content = resp.text().await?;
569 match content_type {
570 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
571 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::IndexVersion`"))),
572 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::IndexVersion`")))),
573 }
574 } else {
575 let content = resp.text().await?;
576 let entity: Option<GetIndexVersionError> = serde_json::from_str(&content).ok();
577 Err(Error::ResponseError(ResponseContent { status, content, entity }))
578 }
579}
580
581pub async fn patch_index_indexes_by_uid_settings(configuration: &configuration::Configuration, uid: &str, index_filter: models::IndexFilter) -> Result<models::IndexEnqueued, Error<PatchIndexIndexesByUidSettingsError>> {
583 let p_uid = uid;
585 let p_index_filter = index_filter;
586
587 let uri_str = format!("{}/v1/index/indexes/{uid}/settings", configuration.base_path, uid=crate::apis::urlencode(p_uid));
588 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
589
590 if let Some(ref user_agent) = configuration.user_agent {
591 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
592 }
593 if let Some(ref token) = configuration.bearer_access_token {
594 req_builder = req_builder.bearer_auth(token.to_owned());
595 };
596 req_builder = req_builder.json(&p_index_filter);
597
598 let req = req_builder.build()?;
599 let resp = configuration.client.execute(req).await?;
600
601 let status = resp.status();
602 let content_type = resp
603 .headers()
604 .get("content-type")
605 .and_then(|v| v.to_str().ok())
606 .unwrap_or("application/octet-stream");
607 let content_type = super::ContentType::from(content_type);
608
609 if !status.is_client_error() && !status.is_server_error() {
610 let content = resp.text().await?;
611 match content_type {
612 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
613 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::IndexEnqueued`"))),
614 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::IndexEnqueued`")))),
615 }
616 } else {
617 let content = resp.text().await?;
618 let entity: Option<PatchIndexIndexesByUidSettingsError> = serde_json::from_str(&content).ok();
619 Err(Error::ResponseError(ResponseContent { status, content, entity }))
620 }
621}
622
623pub async fn post_index_indexes(configuration: &configuration::Configuration, index_new: models::IndexNew) -> Result<models::IndexEnqueued, Error<PostIndexIndexesError>> {
625 let p_index_new = index_new;
627
628 let uri_str = format!("{}/v1/index/indexes", configuration.base_path);
629 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
630
631 if let Some(ref user_agent) = configuration.user_agent {
632 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
633 }
634 if let Some(ref token) = configuration.bearer_access_token {
635 req_builder = req_builder.bearer_auth(token.to_owned());
636 };
637 req_builder = req_builder.json(&p_index_new);
638
639 let req = req_builder.build()?;
640 let resp = configuration.client.execute(req).await?;
641
642 let status = resp.status();
643 let content_type = resp
644 .headers()
645 .get("content-type")
646 .and_then(|v| v.to_str().ok())
647 .unwrap_or("application/octet-stream");
648 let content_type = super::ContentType::from(content_type);
649
650 if !status.is_client_error() && !status.is_server_error() {
651 let content = resp.text().await?;
652 match content_type {
653 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
654 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::IndexEnqueued`"))),
655 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::IndexEnqueued`")))),
656 }
657 } else {
658 let content = resp.text().await?;
659 let entity: Option<PostIndexIndexesError> = serde_json::from_str(&content).ok();
660 Err(Error::ResponseError(ResponseContent { status, content, entity }))
661 }
662}
663
664pub async fn post_index_indexes_by_uid_documents(configuration: &configuration::Configuration, uid: &str, request_body: Option<Vec<serde_json::Value>>) -> Result<models::IndexEnqueued, Error<PostIndexIndexesByUidDocumentsError>> {
666 let p_uid = uid;
668 let p_request_body = request_body;
669
670 let uri_str = format!("{}/v1/index/indexes/{uid}/documents", configuration.base_path, uid=crate::apis::urlencode(p_uid));
671 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
672
673 if let Some(ref user_agent) = configuration.user_agent {
674 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
675 }
676 if let Some(ref token) = configuration.bearer_access_token {
677 req_builder = req_builder.bearer_auth(token.to_owned());
678 };
679 req_builder = req_builder.json(&p_request_body);
680
681 let req = req_builder.build()?;
682 let resp = configuration.client.execute(req).await?;
683
684 let status = resp.status();
685 let content_type = resp
686 .headers()
687 .get("content-type")
688 .and_then(|v| v.to_str().ok())
689 .unwrap_or("application/octet-stream");
690 let content_type = super::ContentType::from(content_type);
691
692 if !status.is_client_error() && !status.is_server_error() {
693 let content = resp.text().await?;
694 match content_type {
695 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
696 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::IndexEnqueued`"))),
697 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::IndexEnqueued`")))),
698 }
699 } else {
700 let content = resp.text().await?;
701 let entity: Option<PostIndexIndexesByUidDocumentsError> = serde_json::from_str(&content).ok();
702 Err(Error::ResponseError(ResponseContent { status, content, entity }))
703 }
704}
705
706pub async fn post_index_indexes_by_uid_documents_delete_batch(configuration: &configuration::Configuration, uid: &str, request_body: Option<Vec<serde_json::Value>>) -> Result<models::IndexEnqueued, Error<PostIndexIndexesByUidDocumentsDeleteBatchError>> {
708 let p_uid = uid;
710 let p_request_body = request_body;
711
712 let uri_str = format!("{}/v1/index/indexes/{uid}/documents/delete-batch", configuration.base_path, uid=crate::apis::urlencode(p_uid));
713 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
714
715 if let Some(ref user_agent) = configuration.user_agent {
716 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
717 }
718 if let Some(ref token) = configuration.bearer_access_token {
719 req_builder = req_builder.bearer_auth(token.to_owned());
720 };
721 req_builder = req_builder.json(&p_request_body);
722
723 let req = req_builder.build()?;
724 let resp = configuration.client.execute(req).await?;
725
726 let status = resp.status();
727 let content_type = resp
728 .headers()
729 .get("content-type")
730 .and_then(|v| v.to_str().ok())
731 .unwrap_or("application/octet-stream");
732 let content_type = super::ContentType::from(content_type);
733
734 if !status.is_client_error() && !status.is_server_error() {
735 let content = resp.text().await?;
736 match content_type {
737 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
738 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::IndexEnqueued`"))),
739 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::IndexEnqueued`")))),
740 }
741 } else {
742 let content = resp.text().await?;
743 let entity: Option<PostIndexIndexesByUidDocumentsDeleteBatchError> = serde_json::from_str(&content).ok();
744 Err(Error::ResponseError(ResponseContent { status, content, entity }))
745 }
746}
747
748pub async fn post_index_indexes_by_uid_search(configuration: &configuration::Configuration, uid: &str, index_query: models::IndexQuery) -> Result<models::IndexHits, Error<PostIndexIndexesByUidSearchError>> {
750 let p_uid = uid;
752 let p_index_query = index_query;
753
754 let uri_str = format!("{}/v1/index/indexes/{uid}/search", configuration.base_path, uid=crate::apis::urlencode(p_uid));
755 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
756
757 if let Some(ref user_agent) = configuration.user_agent {
758 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
759 }
760 if let Some(ref token) = configuration.bearer_access_token {
761 req_builder = req_builder.bearer_auth(token.to_owned());
762 };
763 req_builder = req_builder.json(&p_index_query);
764
765 let req = req_builder.build()?;
766 let resp = configuration.client.execute(req).await?;
767
768 let status = resp.status();
769 let content_type = resp
770 .headers()
771 .get("content-type")
772 .and_then(|v| v.to_str().ok())
773 .unwrap_or("application/octet-stream");
774 let content_type = super::ContentType::from(content_type);
775
776 if !status.is_client_error() && !status.is_server_error() {
777 let content = resp.text().await?;
778 match content_type {
779 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
780 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::IndexHits`"))),
781 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::IndexHits`")))),
782 }
783 } else {
784 let content = resp.text().await?;
785 let entity: Option<PostIndexIndexesByUidSearchError> = serde_json::from_str(&content).ok();
786 Err(Error::ResponseError(ResponseContent { status, content, entity }))
787 }
788}
789
790pub async fn put_index_indexes_by_uid_documents(configuration: &configuration::Configuration, uid: &str, request_body: Option<Vec<serde_json::Value>>) -> Result<models::IndexEnqueued, Error<PutIndexIndexesByUidDocumentsError>> {
792 let p_uid = uid;
794 let p_request_body = request_body;
795
796 let uri_str = format!("{}/v1/index/indexes/{uid}/documents", configuration.base_path, uid=crate::apis::urlencode(p_uid));
797 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
798
799 if let Some(ref user_agent) = configuration.user_agent {
800 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
801 }
802 if let Some(ref token) = configuration.bearer_access_token {
803 req_builder = req_builder.bearer_auth(token.to_owned());
804 };
805 req_builder = req_builder.json(&p_request_body);
806
807 let req = req_builder.build()?;
808 let resp = configuration.client.execute(req).await?;
809
810 let status = resp.status();
811 let content_type = resp
812 .headers()
813 .get("content-type")
814 .and_then(|v| v.to_str().ok())
815 .unwrap_or("application/octet-stream");
816 let content_type = super::ContentType::from(content_type);
817
818 if !status.is_client_error() && !status.is_server_error() {
819 let content = resp.text().await?;
820 match content_type {
821 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
822 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::IndexEnqueued`"))),
823 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::IndexEnqueued`")))),
824 }
825 } else {
826 let content = resp.text().await?;
827 let entity: Option<PutIndexIndexesByUidDocumentsError> = serde_json::from_str(&content).ok();
828 Err(Error::ResponseError(ResponseContent { status, content, entity }))
829 }
830}
831