1use super::{ContentType, Error, UploadFile, configuration};
12use crate::{apis::ResponseContent, models};
13use reqwest;
14use serde::{Deserialize, Serialize, de::Error as _};
15
16#[derive(Debug, Clone, Serialize, Deserialize)]
18#[serde(untagged)]
19pub enum CountAssistantsAssistantsCountPostError {
20 Status404(String),
21 Status422(String),
22 UnknownValue(serde_json::Value),
23}
24
25#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum CreateAssistantAssistantsPostError {
29 Status404(String),
30 Status409(String),
31 Status422(String),
32 UnknownValue(serde_json::Value),
33}
34
35#[derive(Debug, Clone, Serialize, Deserialize)]
37#[serde(untagged)]
38pub enum DeleteAssistantAssistantsAssistantIdDeleteError {
39 Status404(String),
40 Status422(String),
41 UnknownValue(serde_json::Value),
42}
43
44#[derive(Debug, Clone, Serialize, Deserialize)]
46#[serde(untagged)]
47pub enum GetAssistantAssistantsAssistantIdGetError {
48 Status404(String),
49 UnknownValue(serde_json::Value),
50}
51
52#[derive(Debug, Clone, Serialize, Deserialize)]
54#[serde(untagged)]
55pub enum GetAssistantGraphAssistantsAssistantIdGraphGetError {
56 Status404(String),
57 Status422(String),
58 UnknownValue(serde_json::Value),
59}
60
61#[derive(Debug, Clone, Serialize, Deserialize)]
63#[serde(untagged)]
64pub enum GetAssistantSchemasAssistantsAssistantIdSchemasGetError {
65 Status404(String),
66 Status422(String),
67 UnknownValue(serde_json::Value),
68}
69
70#[derive(Debug, Clone, Serialize, Deserialize)]
72#[serde(untagged)]
73pub enum GetAssistantSubgraphsAssistantsAssistantIdSubgraphsGetError {
74 Status404(String),
75 Status422(String),
76 UnknownValue(serde_json::Value),
77}
78
79#[derive(Debug, Clone, Serialize, Deserialize)]
81#[serde(untagged)]
82pub enum GetAssistantSubgraphsAssistantsAssistantIdSubgraphsNamespaceGetError {
83 Status422(String),
84 UnknownValue(serde_json::Value),
85}
86
87#[derive(Debug, Clone, Serialize, Deserialize)]
89#[serde(untagged)]
90pub enum GetAssistantVersionsAssistantsAssistantIdVersionsGetError {
91 Status422(String),
92 UnknownValue(serde_json::Value),
93}
94
95#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum PatchAssistantAssistantsAssistantIdPatchError {
99 Status404(String),
100 Status422(String),
101 UnknownValue(serde_json::Value),
102}
103
104#[derive(Debug, Clone, Serialize, Deserialize)]
106#[serde(untagged)]
107pub enum SearchAssistantsAssistantsSearchPostError {
108 Status404(String),
109 Status422(String),
110 UnknownValue(serde_json::Value),
111}
112
113#[derive(Debug, Clone, Serialize, Deserialize)]
115#[serde(untagged)]
116pub enum SetLatestAssistantVersionAssistantsAssistantIdVersionsPostError {
117 Status404(String),
118 Status422(String),
119 UnknownValue(serde_json::Value),
120}
121
122pub fn count_assistants_assistants_count_post_request_builder(
124 configuration: &configuration::Configuration,
125 assistant_count_request: models::AssistantCountRequest,
126) -> Result<reqwest::RequestBuilder, Error<serde_json::Error>> {
127 let p_body_assistant_count_request = assistant_count_request;
129
130 let uri_str = format!("{}/assistants/count", configuration.base_path);
131 let mut req_builder = configuration
132 .client
133 .request(reqwest::Method::POST, &uri_str);
134
135 if let Some(ref user_agent) = configuration.user_agent {
136 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
137 }
138 req_builder = req_builder.json(&p_body_assistant_count_request);
139
140 Ok(req_builder)
141}
142
143pub async fn count_assistants_assistants_count_post(
144 configuration: &configuration::Configuration,
145 assistant_count_request: models::AssistantCountRequest,
146) -> Result<i32, Error<CountAssistantsAssistantsCountPostError>> {
147 let req_builder = count_assistants_assistants_count_post_request_builder(
148 configuration,
149 assistant_count_request,
150 )
151 .map_err(super::map_request_builder_error)?;
152 let req = req_builder.build()?;
153 let resp = configuration.client.execute(req).await?;
154
155 let status = resp.status();
156 let content_type = resp
157 .headers()
158 .get("content-type")
159 .and_then(|v| v.to_str().ok())
160 .unwrap_or("application/octet-stream");
161 let content_type = super::ContentType::from(content_type);
162
163 if !status.is_client_error() && !status.is_server_error() {
164 let content = resp.text().await?;
165 match content_type {
166 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
167 ContentType::Text => Err(Error::from(serde_json::Error::custom(
168 "Received `text/plain` content type response that cannot be converted to `i32`",
169 ))),
170 ContentType::Unsupported(unknown_type) => {
171 Err(Error::from(serde_json::Error::custom(format!(
172 "Received `{unknown_type}` content type response that cannot be converted to `i32`"
173 ))))
174 }
175 }
176 } else {
177 let content = resp.text().await?;
178 let entity: Option<CountAssistantsAssistantsCountPostError> =
179 serde_json::from_str(&content).ok();
180 Err(Error::ResponseError(ResponseContent {
181 status,
182 content,
183 entity,
184 }))
185 }
186}
187
188pub fn create_assistant_assistants_post_request_builder(
190 configuration: &configuration::Configuration,
191 assistant_create: models::AssistantCreate,
192) -> Result<reqwest::RequestBuilder, Error<serde_json::Error>> {
193 let p_body_assistant_create = assistant_create;
195
196 let uri_str = format!("{}/assistants", configuration.base_path);
197 let mut req_builder = configuration
198 .client
199 .request(reqwest::Method::POST, &uri_str);
200
201 if let Some(ref user_agent) = configuration.user_agent {
202 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
203 }
204 req_builder = req_builder.json(&p_body_assistant_create);
205
206 Ok(req_builder)
207}
208
209pub async fn create_assistant_assistants_post(
210 configuration: &configuration::Configuration,
211 assistant_create: models::AssistantCreate,
212) -> Result<models::Assistant, Error<CreateAssistantAssistantsPostError>> {
213 let req_builder =
214 create_assistant_assistants_post_request_builder(configuration, assistant_create)
215 .map_err(super::map_request_builder_error)?;
216 let req = req_builder.build()?;
217 let resp = configuration.client.execute(req).await?;
218
219 let status = resp.status();
220 let content_type = resp
221 .headers()
222 .get("content-type")
223 .and_then(|v| v.to_str().ok())
224 .unwrap_or("application/octet-stream");
225 let content_type = super::ContentType::from(content_type);
226
227 if !status.is_client_error() && !status.is_server_error() {
228 let content = resp.text().await?;
229 match content_type {
230 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
231 ContentType::Text => Err(Error::from(serde_json::Error::custom(
232 "Received `text/plain` content type response that cannot be converted to `models::Assistant`",
233 ))),
234 ContentType::Unsupported(unknown_type) => {
235 Err(Error::from(serde_json::Error::custom(format!(
236 "Received `{unknown_type}` content type response that cannot be converted to `models::Assistant`"
237 ))))
238 }
239 }
240 } else {
241 let content = resp.text().await?;
242 let entity: Option<CreateAssistantAssistantsPostError> =
243 serde_json::from_str(&content).ok();
244 Err(Error::ResponseError(ResponseContent {
245 status,
246 content,
247 entity,
248 }))
249 }
250}
251
252pub fn delete_assistant_assistants_assistant_id_delete_request_builder(
254 configuration: &configuration::Configuration,
255 assistant_id: &str,
256) -> Result<reqwest::RequestBuilder, Error<serde_json::Error>> {
257 let p_path_assistant_id = assistant_id;
259
260 let uri_str = format!(
261 "{}/assistants/{assistant_id}",
262 configuration.base_path,
263 assistant_id = crate::apis::urlencode(p_path_assistant_id)
264 );
265 let mut req_builder = configuration
266 .client
267 .request(reqwest::Method::DELETE, &uri_str);
268
269 if let Some(ref user_agent) = configuration.user_agent {
270 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
271 }
272
273 Ok(req_builder)
274}
275
276pub async fn delete_assistant_assistants_assistant_id_delete(
277 configuration: &configuration::Configuration,
278 assistant_id: &str,
279) -> Result<serde_json::Value, Error<DeleteAssistantAssistantsAssistantIdDeleteError>> {
280 let req_builder = delete_assistant_assistants_assistant_id_delete_request_builder(
281 configuration,
282 assistant_id,
283 )
284 .map_err(super::map_request_builder_error)?;
285 let req = req_builder.build()?;
286 let resp = configuration.client.execute(req).await?;
287
288 let status = resp.status();
289 let content_type = resp
290 .headers()
291 .get("content-type")
292 .and_then(|v| v.to_str().ok())
293 .unwrap_or("application/octet-stream");
294 let content_type = super::ContentType::from(content_type);
295
296 if !status.is_client_error() && !status.is_server_error() {
297 let content = resp.text().await?;
298 match content_type {
299 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
300 ContentType::Text => Err(Error::from(serde_json::Error::custom(
301 "Received `text/plain` content type response that cannot be converted to `serde_json::Value`",
302 ))),
303 ContentType::Unsupported(unknown_type) => {
304 Err(Error::from(serde_json::Error::custom(format!(
305 "Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`"
306 ))))
307 }
308 }
309 } else {
310 let content = resp.text().await?;
311 let entity: Option<DeleteAssistantAssistantsAssistantIdDeleteError> =
312 serde_json::from_str(&content).ok();
313 Err(Error::ResponseError(ResponseContent {
314 status,
315 content,
316 entity,
317 }))
318 }
319}
320
321pub fn get_assistant_assistants_assistant_id_get_request_builder(
323 configuration: &configuration::Configuration,
324 assistant_id: &str,
325) -> Result<reqwest::RequestBuilder, Error<serde_json::Error>> {
326 let p_path_assistant_id = assistant_id;
328
329 let uri_str = format!(
330 "{}/assistants/{assistant_id}",
331 configuration.base_path,
332 assistant_id = crate::apis::urlencode(p_path_assistant_id)
333 );
334 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
335
336 if let Some(ref user_agent) = configuration.user_agent {
337 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
338 }
339
340 Ok(req_builder)
341}
342
343pub async fn get_assistant_assistants_assistant_id_get(
344 configuration: &configuration::Configuration,
345 assistant_id: &str,
346) -> Result<models::Assistant, Error<GetAssistantAssistantsAssistantIdGetError>> {
347 let req_builder =
348 get_assistant_assistants_assistant_id_get_request_builder(configuration, assistant_id)
349 .map_err(super::map_request_builder_error)?;
350 let req = req_builder.build()?;
351 let resp = configuration.client.execute(req).await?;
352
353 let status = resp.status();
354 let content_type = resp
355 .headers()
356 .get("content-type")
357 .and_then(|v| v.to_str().ok())
358 .unwrap_or("application/octet-stream");
359 let content_type = super::ContentType::from(content_type);
360
361 if !status.is_client_error() && !status.is_server_error() {
362 let content = resp.text().await?;
363 match content_type {
364 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
365 ContentType::Text => Err(Error::from(serde_json::Error::custom(
366 "Received `text/plain` content type response that cannot be converted to `models::Assistant`",
367 ))),
368 ContentType::Unsupported(unknown_type) => {
369 Err(Error::from(serde_json::Error::custom(format!(
370 "Received `{unknown_type}` content type response that cannot be converted to `models::Assistant`"
371 ))))
372 }
373 }
374 } else {
375 let content = resp.text().await?;
376 let entity: Option<GetAssistantAssistantsAssistantIdGetError> =
377 serde_json::from_str(&content).ok();
378 Err(Error::ResponseError(ResponseContent {
379 status,
380 content,
381 entity,
382 }))
383 }
384}
385
386pub fn get_assistant_graph_assistants_assistant_id_graph_get_request_builder(
388 configuration: &configuration::Configuration,
389 assistant_id: &str,
390 xray: Option<&str>,
391) -> Result<reqwest::RequestBuilder, Error<serde_json::Error>> {
392 let p_path_assistant_id = assistant_id;
394 let p_query_xray = xray;
395
396 let uri_str = format!(
397 "{}/assistants/{assistant_id}/graph",
398 configuration.base_path,
399 assistant_id = p_path_assistant_id
400 );
401 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
402
403 if let Some(ref param_value) = p_query_xray {
404 req_builder = req_builder.query(&[("xray", &serde_json::to_string(param_value)?)]);
405 }
406 if let Some(ref user_agent) = configuration.user_agent {
407 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
408 }
409
410 Ok(req_builder)
411}
412
413pub async fn get_assistant_graph_assistants_assistant_id_graph_get(
414 configuration: &configuration::Configuration,
415 assistant_id: &str,
416 xray: Option<&str>,
417) -> Result<
418 std::collections::HashMap<String, Vec<serde_json::Value>>,
419 Error<GetAssistantGraphAssistantsAssistantIdGraphGetError>,
420> {
421 let req_builder = get_assistant_graph_assistants_assistant_id_graph_get_request_builder(
422 configuration,
423 assistant_id,
424 xray,
425 )
426 .map_err(super::map_request_builder_error)?;
427 let req = req_builder.build()?;
428 let resp = configuration.client.execute(req).await?;
429
430 let status = resp.status();
431 let content_type = resp
432 .headers()
433 .get("content-type")
434 .and_then(|v| v.to_str().ok())
435 .unwrap_or("application/octet-stream");
436 let content_type = super::ContentType::from(content_type);
437
438 if !status.is_client_error() && !status.is_server_error() {
439 let content = resp.text().await?;
440 match content_type {
441 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
442 ContentType::Text => Err(Error::from(serde_json::Error::custom(
443 "Received `text/plain` content type response that cannot be converted to `std::collections::HashMap<String, Vec<serde_json::Value>>`",
444 ))),
445 ContentType::Unsupported(unknown_type) => {
446 Err(Error::from(serde_json::Error::custom(format!(
447 "Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap<String, Vec<serde_json::Value>>`"
448 ))))
449 }
450 }
451 } else {
452 let content = resp.text().await?;
453 let entity: Option<GetAssistantGraphAssistantsAssistantIdGraphGetError> =
454 serde_json::from_str(&content).ok();
455 Err(Error::ResponseError(ResponseContent {
456 status,
457 content,
458 entity,
459 }))
460 }
461}
462
463pub fn get_assistant_schemas_assistants_assistant_id_schemas_get_request_builder(
465 configuration: &configuration::Configuration,
466 assistant_id: &str,
467) -> Result<reqwest::RequestBuilder, Error<serde_json::Error>> {
468 let p_path_assistant_id = assistant_id;
470
471 let uri_str = format!(
472 "{}/assistants/{assistant_id}/schemas",
473 configuration.base_path,
474 assistant_id = crate::apis::urlencode(p_path_assistant_id)
475 );
476 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
477
478 if let Some(ref user_agent) = configuration.user_agent {
479 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
480 }
481
482 Ok(req_builder)
483}
484
485pub async fn get_assistant_schemas_assistants_assistant_id_schemas_get(
486 configuration: &configuration::Configuration,
487 assistant_id: &str,
488) -> Result<models::GraphSchema, Error<GetAssistantSchemasAssistantsAssistantIdSchemasGetError>> {
489 let req_builder = get_assistant_schemas_assistants_assistant_id_schemas_get_request_builder(
490 configuration,
491 assistant_id,
492 )
493 .map_err(super::map_request_builder_error)?;
494 let req = req_builder.build()?;
495 let resp = configuration.client.execute(req).await?;
496
497 let status = resp.status();
498 let content_type = resp
499 .headers()
500 .get("content-type")
501 .and_then(|v| v.to_str().ok())
502 .unwrap_or("application/octet-stream");
503 let content_type = super::ContentType::from(content_type);
504
505 if !status.is_client_error() && !status.is_server_error() {
506 let content = resp.text().await?;
507 match content_type {
508 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
509 ContentType::Text => Err(Error::from(serde_json::Error::custom(
510 "Received `text/plain` content type response that cannot be converted to `models::GraphSchema`",
511 ))),
512 ContentType::Unsupported(unknown_type) => {
513 Err(Error::from(serde_json::Error::custom(format!(
514 "Received `{unknown_type}` content type response that cannot be converted to `models::GraphSchema`"
515 ))))
516 }
517 }
518 } else {
519 let content = resp.text().await?;
520 let entity: Option<GetAssistantSchemasAssistantsAssistantIdSchemasGetError> =
521 serde_json::from_str(&content).ok();
522 Err(Error::ResponseError(ResponseContent {
523 status,
524 content,
525 entity,
526 }))
527 }
528}
529
530pub fn get_assistant_subgraphs_assistants_assistant_id_subgraphs_get_request_builder(
532 configuration: &configuration::Configuration,
533 assistant_id: &str,
534 recurse: Option<bool>,
535) -> Result<reqwest::RequestBuilder, Error<serde_json::Error>> {
536 let p_path_assistant_id = assistant_id;
538 let p_query_recurse = recurse;
539
540 let uri_str = format!(
541 "{}/assistants/{assistant_id}/subgraphs",
542 configuration.base_path,
543 assistant_id = crate::apis::urlencode(p_path_assistant_id)
544 );
545 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
546
547 if let Some(ref param_value) = p_query_recurse {
548 req_builder = req_builder.query(&[("recurse", ¶m_value.to_string())]);
549 }
550 if let Some(ref user_agent) = configuration.user_agent {
551 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
552 }
553
554 Ok(req_builder)
555}
556
557pub async fn get_assistant_subgraphs_assistants_assistant_id_subgraphs_get(
558 configuration: &configuration::Configuration,
559 assistant_id: &str,
560 recurse: Option<bool>,
561) -> Result<
562 std::collections::HashMap<String, models::GraphSchemaNoId>,
563 Error<GetAssistantSubgraphsAssistantsAssistantIdSubgraphsGetError>,
564> {
565 let req_builder =
566 get_assistant_subgraphs_assistants_assistant_id_subgraphs_get_request_builder(
567 configuration,
568 assistant_id,
569 recurse,
570 )
571 .map_err(super::map_request_builder_error)?;
572 let req = req_builder.build()?;
573 let resp = configuration.client.execute(req).await?;
574
575 let status = resp.status();
576 let content_type = resp
577 .headers()
578 .get("content-type")
579 .and_then(|v| v.to_str().ok())
580 .unwrap_or("application/octet-stream");
581 let content_type = super::ContentType::from(content_type);
582
583 if !status.is_client_error() && !status.is_server_error() {
584 let content = resp.text().await?;
585 match content_type {
586 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
587 ContentType::Text => Err(Error::from(serde_json::Error::custom(
588 "Received `text/plain` content type response that cannot be converted to `std::collections::HashMap<String, models::GraphSchemaNoId>`",
589 ))),
590 ContentType::Unsupported(unknown_type) => {
591 Err(Error::from(serde_json::Error::custom(format!(
592 "Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap<String, models::GraphSchemaNoId>`"
593 ))))
594 }
595 }
596 } else {
597 let content = resp.text().await?;
598 let entity: Option<GetAssistantSubgraphsAssistantsAssistantIdSubgraphsGetError> =
599 serde_json::from_str(&content).ok();
600 Err(Error::ResponseError(ResponseContent {
601 status,
602 content,
603 entity,
604 }))
605 }
606}
607
608pub fn get_assistant_subgraphs_assistants_assistant_id_subgraphs_namespace_get_request_builder(
610 configuration: &configuration::Configuration,
611 assistant_id: &str,
612 namespace: &str,
613 recurse: Option<bool>,
614) -> Result<reqwest::RequestBuilder, Error<serde_json::Error>> {
615 let p_path_assistant_id = assistant_id;
617 let p_path_namespace = namespace;
618 let p_query_recurse = recurse;
619
620 let uri_str = format!(
621 "{}/assistants/{assistant_id}/subgraphs/{namespace}",
622 configuration.base_path,
623 assistant_id = crate::apis::urlencode(p_path_assistant_id),
624 namespace = crate::apis::urlencode(p_path_namespace)
625 );
626 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
627
628 if let Some(ref param_value) = p_query_recurse {
629 req_builder = req_builder.query(&[("recurse", ¶m_value.to_string())]);
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
635 Ok(req_builder)
636}
637
638pub async fn get_assistant_subgraphs_assistants_assistant_id_subgraphs_namespace_get(
639 configuration: &configuration::Configuration,
640 assistant_id: &str,
641 namespace: &str,
642 recurse: Option<bool>,
643) -> Result<
644 std::collections::HashMap<String, models::GraphSchemaNoId>,
645 Error<GetAssistantSubgraphsAssistantsAssistantIdSubgraphsNamespaceGetError>,
646> {
647 let req_builder =
648 get_assistant_subgraphs_assistants_assistant_id_subgraphs_namespace_get_request_builder(
649 configuration,
650 assistant_id,
651 namespace,
652 recurse,
653 )
654 .map_err(super::map_request_builder_error)?;
655 let req = req_builder.build()?;
656 let resp = configuration.client.execute(req).await?;
657
658 let status = resp.status();
659 let content_type = resp
660 .headers()
661 .get("content-type")
662 .and_then(|v| v.to_str().ok())
663 .unwrap_or("application/octet-stream");
664 let content_type = super::ContentType::from(content_type);
665
666 if !status.is_client_error() && !status.is_server_error() {
667 let content = resp.text().await?;
668 match content_type {
669 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
670 ContentType::Text => Err(Error::from(serde_json::Error::custom(
671 "Received `text/plain` content type response that cannot be converted to `std::collections::HashMap<String, models::GraphSchemaNoId>`",
672 ))),
673 ContentType::Unsupported(unknown_type) => {
674 Err(Error::from(serde_json::Error::custom(format!(
675 "Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap<String, models::GraphSchemaNoId>`"
676 ))))
677 }
678 }
679 } else {
680 let content = resp.text().await?;
681 let entity: Option<GetAssistantSubgraphsAssistantsAssistantIdSubgraphsNamespaceGetError> =
682 serde_json::from_str(&content).ok();
683 Err(Error::ResponseError(ResponseContent {
684 status,
685 content,
686 entity,
687 }))
688 }
689}
690
691pub fn get_assistant_versions_assistants_assistant_id_versions_get_request_builder(
693 configuration: &configuration::Configuration,
694 assistant_id: &str,
695) -> Result<reqwest::RequestBuilder, Error<serde_json::Error>> {
696 let p_path_assistant_id = assistant_id;
698
699 let uri_str = format!(
700 "{}/assistants/{assistant_id}/versions",
701 configuration.base_path,
702 assistant_id = crate::apis::urlencode(p_path_assistant_id)
703 );
704 let mut req_builder = configuration
705 .client
706 .request(reqwest::Method::POST, &uri_str);
707
708 if let Some(ref user_agent) = configuration.user_agent {
709 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
710 }
711
712 Ok(req_builder)
713}
714
715pub async fn get_assistant_versions_assistants_assistant_id_versions_get(
716 configuration: &configuration::Configuration,
717 assistant_id: &str,
718) -> Result<Vec<models::Assistant>, Error<GetAssistantVersionsAssistantsAssistantIdVersionsGetError>>
719{
720 let req_builder = get_assistant_versions_assistants_assistant_id_versions_get_request_builder(
721 configuration,
722 assistant_id,
723 )
724 .map_err(super::map_request_builder_error)?;
725 let req = req_builder.build()?;
726 let resp = configuration.client.execute(req).await?;
727
728 let status = resp.status();
729 let content_type = resp
730 .headers()
731 .get("content-type")
732 .and_then(|v| v.to_str().ok())
733 .unwrap_or("application/octet-stream");
734 let content_type = super::ContentType::from(content_type);
735
736 if !status.is_client_error() && !status.is_server_error() {
737 let content = resp.text().await?;
738 match content_type {
739 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
740 ContentType::Text => Err(Error::from(serde_json::Error::custom(
741 "Received `text/plain` content type response that cannot be converted to `Vec<models::Assistant>`",
742 ))),
743 ContentType::Unsupported(unknown_type) => {
744 Err(Error::from(serde_json::Error::custom(format!(
745 "Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Assistant>`"
746 ))))
747 }
748 }
749 } else {
750 let content = resp.text().await?;
751 let entity: Option<GetAssistantVersionsAssistantsAssistantIdVersionsGetError> =
752 serde_json::from_str(&content).ok();
753 Err(Error::ResponseError(ResponseContent {
754 status,
755 content,
756 entity,
757 }))
758 }
759}
760
761pub fn patch_assistant_assistants_assistant_id_patch_request_builder(
763 configuration: &configuration::Configuration,
764 assistant_id: &str,
765 assistant_patch: models::AssistantPatch,
766) -> Result<reqwest::RequestBuilder, Error<serde_json::Error>> {
767 let p_path_assistant_id = assistant_id;
769 let p_body_assistant_patch = assistant_patch;
770
771 let uri_str = format!(
772 "{}/assistants/{assistant_id}",
773 configuration.base_path,
774 assistant_id = crate::apis::urlencode(p_path_assistant_id)
775 );
776 let mut req_builder = configuration
777 .client
778 .request(reqwest::Method::PATCH, &uri_str);
779
780 if let Some(ref user_agent) = configuration.user_agent {
781 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
782 }
783 req_builder = req_builder.json(&p_body_assistant_patch);
784
785 Ok(req_builder)
786}
787
788pub async fn patch_assistant_assistants_assistant_id_patch(
789 configuration: &configuration::Configuration,
790 assistant_id: &str,
791 assistant_patch: models::AssistantPatch,
792) -> Result<models::Assistant, Error<PatchAssistantAssistantsAssistantIdPatchError>> {
793 let req_builder = patch_assistant_assistants_assistant_id_patch_request_builder(
794 configuration,
795 assistant_id,
796 assistant_patch,
797 )
798 .map_err(super::map_request_builder_error)?;
799 let req = req_builder.build()?;
800 let resp = configuration.client.execute(req).await?;
801
802 let status = resp.status();
803 let content_type = resp
804 .headers()
805 .get("content-type")
806 .and_then(|v| v.to_str().ok())
807 .unwrap_or("application/octet-stream");
808 let content_type = super::ContentType::from(content_type);
809
810 if !status.is_client_error() && !status.is_server_error() {
811 let content = resp.text().await?;
812 match content_type {
813 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
814 ContentType::Text => Err(Error::from(serde_json::Error::custom(
815 "Received `text/plain` content type response that cannot be converted to `models::Assistant`",
816 ))),
817 ContentType::Unsupported(unknown_type) => {
818 Err(Error::from(serde_json::Error::custom(format!(
819 "Received `{unknown_type}` content type response that cannot be converted to `models::Assistant`"
820 ))))
821 }
822 }
823 } else {
824 let content = resp.text().await?;
825 let entity: Option<PatchAssistantAssistantsAssistantIdPatchError> =
826 serde_json::from_str(&content).ok();
827 Err(Error::ResponseError(ResponseContent {
828 status,
829 content,
830 entity,
831 }))
832 }
833}
834
835pub fn search_assistants_assistants_search_post_request_builder(
837 configuration: &configuration::Configuration,
838 assistant_search_request: models::AssistantSearchRequest,
839) -> Result<reqwest::RequestBuilder, Error<serde_json::Error>> {
840 let p_body_assistant_search_request = assistant_search_request;
842
843 let uri_str = format!("{}/assistants/search", configuration.base_path);
844 let mut req_builder = configuration
845 .client
846 .request(reqwest::Method::POST, &uri_str);
847
848 if let Some(ref user_agent) = configuration.user_agent {
849 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
850 }
851 req_builder = req_builder.json(&p_body_assistant_search_request);
852
853 Ok(req_builder)
854}
855
856pub async fn search_assistants_assistants_search_post(
857 configuration: &configuration::Configuration,
858 assistant_search_request: models::AssistantSearchRequest,
859) -> Result<Vec<models::Assistant>, Error<SearchAssistantsAssistantsSearchPostError>> {
860 let req_builder = search_assistants_assistants_search_post_request_builder(
861 configuration,
862 assistant_search_request,
863 )
864 .map_err(super::map_request_builder_error)?;
865 let req = req_builder.build()?;
866 let resp = configuration.client.execute(req).await?;
867
868 let status = resp.status();
869 let content_type = resp
870 .headers()
871 .get("content-type")
872 .and_then(|v| v.to_str().ok())
873 .unwrap_or("application/octet-stream");
874 let content_type = super::ContentType::from(content_type);
875
876 if !status.is_client_error() && !status.is_server_error() {
877 let content = resp.text().await?;
878 match content_type {
879 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
880 ContentType::Text => Err(Error::from(serde_json::Error::custom(
881 "Received `text/plain` content type response that cannot be converted to `Vec<models::Assistant>`",
882 ))),
883 ContentType::Unsupported(unknown_type) => {
884 Err(Error::from(serde_json::Error::custom(format!(
885 "Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Assistant>`"
886 ))))
887 }
888 }
889 } else {
890 let content = resp.text().await?;
891 let entity: Option<SearchAssistantsAssistantsSearchPostError> =
892 serde_json::from_str(&content).ok();
893 Err(Error::ResponseError(ResponseContent {
894 status,
895 content,
896 entity,
897 }))
898 }
899}
900
901pub fn set_latest_assistant_version_assistants_assistant_id_versions_post_request_builder(
903 configuration: &configuration::Configuration,
904 assistant_id: &str,
905 version: i32,
906) -> Result<reqwest::RequestBuilder, Error<serde_json::Error>> {
907 let p_path_assistant_id = assistant_id;
909 let p_query_version = version;
910
911 let uri_str = format!(
912 "{}/assistants/{assistant_id}/latest",
913 configuration.base_path,
914 assistant_id = crate::apis::urlencode(p_path_assistant_id)
915 );
916 let mut req_builder = configuration
917 .client
918 .request(reqwest::Method::POST, &uri_str);
919
920 req_builder = req_builder.query(&[("version", &p_query_version.to_string())]);
921 if let Some(ref user_agent) = configuration.user_agent {
922 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
923 }
924
925 Ok(req_builder)
926}
927
928pub async fn set_latest_assistant_version_assistants_assistant_id_versions_post(
929 configuration: &configuration::Configuration,
930 assistant_id: &str,
931 version: i32,
932) -> Result<models::Assistant, Error<SetLatestAssistantVersionAssistantsAssistantIdVersionsPostError>>
933{
934 let req_builder =
935 set_latest_assistant_version_assistants_assistant_id_versions_post_request_builder(
936 configuration,
937 assistant_id,
938 version,
939 )
940 .map_err(super::map_request_builder_error)?;
941 let req = req_builder.build()?;
942 let resp = configuration.client.execute(req).await?;
943
944 let status = resp.status();
945 let content_type = resp
946 .headers()
947 .get("content-type")
948 .and_then(|v| v.to_str().ok())
949 .unwrap_or("application/octet-stream");
950 let content_type = super::ContentType::from(content_type);
951
952 if !status.is_client_error() && !status.is_server_error() {
953 let content = resp.text().await?;
954 match content_type {
955 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
956 ContentType::Text => Err(Error::from(serde_json::Error::custom(
957 "Received `text/plain` content type response that cannot be converted to `models::Assistant`",
958 ))),
959 ContentType::Unsupported(unknown_type) => {
960 Err(Error::from(serde_json::Error::custom(format!(
961 "Received `{unknown_type}` content type response that cannot be converted to `models::Assistant`"
962 ))))
963 }
964 }
965 } else {
966 let content = resp.text().await?;
967 let entity: Option<SetLatestAssistantVersionAssistantsAssistantIdVersionsPostError> =
968 serde_json::from_str(&content).ok();
969 Err(Error::ResponseError(ResponseContent {
970 status,
971 content,
972 entity,
973 }))
974 }
975}