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 DeleteAgentsByRefError {
22 UnknownValue(serde_json::Value),
23}
24
25#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum DeleteAgentsTargetsByIdError {
29 UnknownValue(serde_json::Value),
30}
31
32#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum GetAgentsError {
36 UnknownValue(serde_json::Value),
37}
38
39#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum GetAgentsActivityError {
43 UnknownValue(serde_json::Value),
44}
45
46#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum GetAgentsBuildsError {
50 UnknownValue(serde_json::Value),
51}
52
53#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum GetAgentsBuildsByOrgByProjectError {
57 UnknownValue(serde_json::Value),
58}
59
60#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum GetAgentsByRefError {
64 UnknownValue(serde_json::Value),
65}
66
67#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum GetAgentsByRefRunsError {
71 UnknownValue(serde_json::Value),
72}
73
74#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum GetAgentsChatConversationsError {
78 UnknownValue(serde_json::Value),
79}
80
81#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum GetAgentsChatConversationsByIdError {
85 UnknownValue(serde_json::Value),
86}
87
88#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum GetAgentsChatPresetsError {
92 UnknownValue(serde_json::Value),
93}
94
95#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum GetAgentsMetricsError {
99 UnknownValue(serde_json::Value),
100}
101
102#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum GetAgentsRunsError {
106 UnknownValue(serde_json::Value),
107}
108
109#[derive(Debug, Clone, Serialize, Deserialize)]
111#[serde(untagged)]
112pub enum GetAgentsSessionsError {
113 UnknownValue(serde_json::Value),
114}
115
116#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum GetAgentsSessionsByIdError {
120 UnknownValue(serde_json::Value),
121}
122
123#[derive(Debug, Clone, Serialize, Deserialize)]
125#[serde(untagged)]
126pub enum GetAgentsSessionsByIdControlError {
127 UnknownValue(serde_json::Value),
128}
129
130#[derive(Debug, Clone, Serialize, Deserialize)]
132#[serde(untagged)]
133pub enum GetAgentsSessionsByIdProgressError {
134 UnknownValue(serde_json::Value),
135}
136
137#[derive(Debug, Clone, Serialize, Deserialize)]
139#[serde(untagged)]
140pub enum GetAgentsSessionsByIdTreeError {
141 UnknownValue(serde_json::Value),
142}
143
144#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum GetAgentsSessionsStreamError {
148 UnknownValue(serde_json::Value),
149}
150
151#[derive(Debug, Clone, Serialize, Deserialize)]
153#[serde(untagged)]
154pub enum GetAgentsTargetsError {
155 UnknownValue(serde_json::Value),
156}
157
158#[derive(Debug, Clone, Serialize, Deserialize)]
160#[serde(untagged)]
161pub enum GetAgentsTargetsByIdError {
162 UnknownValue(serde_json::Value),
163}
164
165#[derive(Debug, Clone, Serialize, Deserialize)]
167#[serde(untagged)]
168pub enum PatchAgentsByRefError {
169 UnknownValue(serde_json::Value),
170}
171
172#[derive(Debug, Clone, Serialize, Deserialize)]
174#[serde(untagged)]
175pub enum PatchAgentsSessionsByIdError {
176 UnknownValue(serde_json::Value),
177}
178
179#[derive(Debug, Clone, Serialize, Deserialize)]
181#[serde(untagged)]
182pub enum PatchAgentsTargetsByIdError {
183 UnknownValue(serde_json::Value),
184}
185
186#[derive(Debug, Clone, Serialize, Deserialize)]
188#[serde(untagged)]
189pub enum PostAgentsError {
190 UnknownValue(serde_json::Value),
191}
192
193#[derive(Debug, Clone, Serialize, Deserialize)]
195#[serde(untagged)]
196pub enum PostAgentsByRefRunError {
197 UnknownValue(serde_json::Value),
198}
199
200#[derive(Debug, Clone, Serialize, Deserialize)]
202#[serde(untagged)]
203pub enum PostAgentsChatError {
204 UnknownValue(serde_json::Value),
205}
206
207#[derive(Debug, Clone, Serialize, Deserialize)]
209#[serde(untagged)]
210pub enum PostAgentsCodingError {
211 UnknownValue(serde_json::Value),
212}
213
214#[derive(Debug, Clone, Serialize, Deserialize)]
216#[serde(untagged)]
217pub enum PostAgentsSessionsError {
218 UnknownValue(serde_json::Value),
219}
220
221#[derive(Debug, Clone, Serialize, Deserialize)]
223#[serde(untagged)]
224pub enum PostAgentsSessionsByIdEventsError {
225 UnknownValue(serde_json::Value),
226}
227
228#[derive(Debug, Clone, Serialize, Deserialize)]
230#[serde(untagged)]
231pub enum PostAgentsSessionsByIdMessageError {
232 UnknownValue(serde_json::Value),
233}
234
235#[derive(Debug, Clone, Serialize, Deserialize)]
237#[serde(untagged)]
238pub enum PostAgentsSessionsByIdPauseError {
239 UnknownValue(serde_json::Value),
240}
241
242#[derive(Debug, Clone, Serialize, Deserialize)]
244#[serde(untagged)]
245pub enum PostAgentsSessionsByIdResumeError {
246 UnknownValue(serde_json::Value),
247}
248
249#[derive(Debug, Clone, Serialize, Deserialize)]
251#[serde(untagged)]
252pub enum PostAgentsSessionsByIdStopError {
253 UnknownValue(serde_json::Value),
254}
255
256#[derive(Debug, Clone, Serialize, Deserialize)]
258#[serde(untagged)]
259pub enum PostAgentsTargetsError {
260 UnknownValue(serde_json::Value),
261}
262
263#[derive(Debug, Clone, Serialize, Deserialize)]
265#[serde(untagged)]
266pub enum PostAgentsTargetsByIdClaimError {
267 UnknownValue(serde_json::Value),
268}
269
270#[derive(Debug, Clone, Serialize, Deserialize)]
272#[serde(untagged)]
273pub enum PostAgentsTargetsByIdKeyError {
274 UnknownValue(serde_json::Value),
275}
276
277#[derive(Debug, Clone, Serialize, Deserialize)]
279#[serde(untagged)]
280pub enum PostAgentsTargetsByIdRunsByRunidReportError {
281 UnknownValue(serde_json::Value),
282}
283
284
285pub async fn delete_agents_by_ref(configuration: &configuration::Configuration, r#ref: &str) -> Result<(), Error<DeleteAgentsByRefError>> {
287 let p_ref = r#ref;
289
290 let uri_str = format!("{}/v1/agents/{ref}", configuration.base_path, ref=crate::apis::urlencode(p_ref));
291 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
292
293 if let Some(ref user_agent) = configuration.user_agent {
294 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
295 }
296 if let Some(ref token) = configuration.bearer_access_token {
297 req_builder = req_builder.bearer_auth(token.to_owned());
298 };
299
300 let req = req_builder.build()?;
301 let resp = configuration.client.execute(req).await?;
302
303 let status = resp.status();
304
305 if !status.is_client_error() && !status.is_server_error() {
306 Ok(())
307 } else {
308 let content = resp.text().await?;
309 let entity: Option<DeleteAgentsByRefError> = serde_json::from_str(&content).ok();
310 Err(Error::ResponseError(ResponseContent { status, content, entity }))
311 }
312}
313
314pub async fn delete_agents_targets_by_id(configuration: &configuration::Configuration, id: &str) -> Result<models::TargetDeleted, Error<DeleteAgentsTargetsByIdError>> {
316 let p_id = id;
318
319 let uri_str = format!("{}/v1/agents/targets/{id}", configuration.base_path, id=crate::apis::urlencode(p_id));
320 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
321
322 if let Some(ref user_agent) = configuration.user_agent {
323 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
324 }
325 if let Some(ref token) = configuration.bearer_access_token {
326 req_builder = req_builder.bearer_auth(token.to_owned());
327 };
328
329 let req = req_builder.build()?;
330 let resp = configuration.client.execute(req).await?;
331
332 let status = resp.status();
333 let content_type = resp
334 .headers()
335 .get("content-type")
336 .and_then(|v| v.to_str().ok())
337 .unwrap_or("application/octet-stream");
338 let content_type = super::ContentType::from(content_type);
339
340 if !status.is_client_error() && !status.is_server_error() {
341 let content = resp.text().await?;
342 match content_type {
343 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
344 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TargetDeleted`"))),
345 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::TargetDeleted`")))),
346 }
347 } else {
348 let content = resp.text().await?;
349 let entity: Option<DeleteAgentsTargetsByIdError> = serde_json::from_str(&content).ok();
350 Err(Error::ResponseError(ResponseContent { status, content, entity }))
351 }
352}
353
354pub async fn get_agents(configuration: &configuration::Configuration, ) -> Result<models::AgentList, Error<GetAgentsError>> {
356
357 let uri_str = format!("{}/v1/agents", configuration.base_path);
358 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
359
360 if let Some(ref user_agent) = configuration.user_agent {
361 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
362 }
363 if let Some(ref token) = configuration.bearer_access_token {
364 req_builder = req_builder.bearer_auth(token.to_owned());
365 };
366
367 let req = req_builder.build()?;
368 let resp = configuration.client.execute(req).await?;
369
370 let status = resp.status();
371 let content_type = resp
372 .headers()
373 .get("content-type")
374 .and_then(|v| v.to_str().ok())
375 .unwrap_or("application/octet-stream");
376 let content_type = super::ContentType::from(content_type);
377
378 if !status.is_client_error() && !status.is_server_error() {
379 let content = resp.text().await?;
380 match content_type {
381 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
382 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AgentList`"))),
383 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::AgentList`")))),
384 }
385 } else {
386 let content = resp.text().await?;
387 let entity: Option<GetAgentsError> = serde_json::from_str(&content).ok();
388 Err(Error::ResponseError(ResponseContent { status, content, entity }))
389 }
390}
391
392pub async fn get_agents_activity(configuration: &configuration::Configuration, ) -> Result<models::ActivityFeed, Error<GetAgentsActivityError>> {
394
395 let uri_str = format!("{}/v1/agents/activity", configuration.base_path);
396 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
397
398 if let Some(ref user_agent) = configuration.user_agent {
399 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
400 }
401 if let Some(ref token) = configuration.bearer_access_token {
402 req_builder = req_builder.bearer_auth(token.to_owned());
403 };
404
405 let req = req_builder.build()?;
406 let resp = configuration.client.execute(req).await?;
407
408 let status = resp.status();
409 let content_type = resp
410 .headers()
411 .get("content-type")
412 .and_then(|v| v.to_str().ok())
413 .unwrap_or("application/octet-stream");
414 let content_type = super::ContentType::from(content_type);
415
416 if !status.is_client_error() && !status.is_server_error() {
417 let content = resp.text().await?;
418 match content_type {
419 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
420 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ActivityFeed`"))),
421 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::ActivityFeed`")))),
422 }
423 } else {
424 let content = resp.text().await?;
425 let entity: Option<GetAgentsActivityError> = serde_json::from_str(&content).ok();
426 Err(Error::ResponseError(ResponseContent { status, content, entity }))
427 }
428}
429
430pub async fn get_agents_builds(configuration: &configuration::Configuration, limit: Option<i32>) -> Result<models::BuildList, Error<GetAgentsBuildsError>> {
432 let p_limit = limit;
434
435 let uri_str = format!("{}/v1/agents/builds", configuration.base_path);
436 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
437
438 if let Some(ref param_value) = p_limit {
439 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
440 }
441 if let Some(ref user_agent) = configuration.user_agent {
442 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
443 }
444 if let Some(ref token) = configuration.bearer_access_token {
445 req_builder = req_builder.bearer_auth(token.to_owned());
446 };
447
448 let req = req_builder.build()?;
449 let resp = configuration.client.execute(req).await?;
450
451 let status = resp.status();
452 let content_type = resp
453 .headers()
454 .get("content-type")
455 .and_then(|v| v.to_str().ok())
456 .unwrap_or("application/octet-stream");
457 let content_type = super::ContentType::from(content_type);
458
459 if !status.is_client_error() && !status.is_server_error() {
460 let content = resp.text().await?;
461 match content_type {
462 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
463 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::BuildList`"))),
464 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::BuildList`")))),
465 }
466 } else {
467 let content = resp.text().await?;
468 let entity: Option<GetAgentsBuildsError> = serde_json::from_str(&content).ok();
469 Err(Error::ResponseError(ResponseContent { status, content, entity }))
470 }
471}
472
473pub async fn get_agents_builds_by_org_by_project(configuration: &configuration::Configuration, org: &str, project: &str) -> Result<models::BuildView, Error<GetAgentsBuildsByOrgByProjectError>> {
475 let p_org = org;
477 let p_project = project;
478
479 let uri_str = format!("{}/v1/agents/builds/{org}/{project}", configuration.base_path, org=crate::apis::urlencode(p_org), project=crate::apis::urlencode(p_project));
480 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
481
482 if let Some(ref user_agent) = configuration.user_agent {
483 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
484 }
485 if let Some(ref token) = configuration.bearer_access_token {
486 req_builder = req_builder.bearer_auth(token.to_owned());
487 };
488
489 let req = req_builder.build()?;
490 let resp = configuration.client.execute(req).await?;
491
492 let status = resp.status();
493 let content_type = resp
494 .headers()
495 .get("content-type")
496 .and_then(|v| v.to_str().ok())
497 .unwrap_or("application/octet-stream");
498 let content_type = super::ContentType::from(content_type);
499
500 if !status.is_client_error() && !status.is_server_error() {
501 let content = resp.text().await?;
502 match content_type {
503 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
504 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::BuildView`"))),
505 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::BuildView`")))),
506 }
507 } else {
508 let content = resp.text().await?;
509 let entity: Option<GetAgentsBuildsByOrgByProjectError> = serde_json::from_str(&content).ok();
510 Err(Error::ResponseError(ResponseContent { status, content, entity }))
511 }
512}
513
514pub async fn get_agents_by_ref(configuration: &configuration::Configuration, r#ref: &str) -> Result<models::AgentDetail, Error<GetAgentsByRefError>> {
516 let p_ref = r#ref;
518
519 let uri_str = format!("{}/v1/agents/{ref}", configuration.base_path, ref=crate::apis::urlencode(p_ref));
520 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
521
522 if let Some(ref user_agent) = configuration.user_agent {
523 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
524 }
525 if let Some(ref token) = configuration.bearer_access_token {
526 req_builder = req_builder.bearer_auth(token.to_owned());
527 };
528
529 let req = req_builder.build()?;
530 let resp = configuration.client.execute(req).await?;
531
532 let status = resp.status();
533 let content_type = resp
534 .headers()
535 .get("content-type")
536 .and_then(|v| v.to_str().ok())
537 .unwrap_or("application/octet-stream");
538 let content_type = super::ContentType::from(content_type);
539
540 if !status.is_client_error() && !status.is_server_error() {
541 let content = resp.text().await?;
542 match content_type {
543 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
544 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AgentDetail`"))),
545 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::AgentDetail`")))),
546 }
547 } else {
548 let content = resp.text().await?;
549 let entity: Option<GetAgentsByRefError> = serde_json::from_str(&content).ok();
550 Err(Error::ResponseError(ResponseContent { status, content, entity }))
551 }
552}
553
554pub async fn get_agents_by_ref_runs(configuration: &configuration::Configuration, r#ref: &str, limit: Option<i32>) -> Result<models::RunList, Error<GetAgentsByRefRunsError>> {
556 let p_ref = r#ref;
558 let p_limit = limit;
559
560 let uri_str = format!("{}/v1/agents/{ref}/runs", configuration.base_path, ref=crate::apis::urlencode(p_ref));
561 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
562
563 if let Some(ref param_value) = p_limit {
564 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
565 }
566 if let Some(ref user_agent) = configuration.user_agent {
567 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
568 }
569 if let Some(ref token) = configuration.bearer_access_token {
570 req_builder = req_builder.bearer_auth(token.to_owned());
571 };
572
573 let req = req_builder.build()?;
574 let resp = configuration.client.execute(req).await?;
575
576 let status = resp.status();
577 let content_type = resp
578 .headers()
579 .get("content-type")
580 .and_then(|v| v.to_str().ok())
581 .unwrap_or("application/octet-stream");
582 let content_type = super::ContentType::from(content_type);
583
584 if !status.is_client_error() && !status.is_server_error() {
585 let content = resp.text().await?;
586 match content_type {
587 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
588 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RunList`"))),
589 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::RunList`")))),
590 }
591 } else {
592 let content = resp.text().await?;
593 let entity: Option<GetAgentsByRefRunsError> = serde_json::from_str(&content).ok();
594 Err(Error::ResponseError(ResponseContent { status, content, entity }))
595 }
596}
597
598pub async fn get_agents_chat_conversations(configuration: &configuration::Configuration, ) -> Result<(), Error<GetAgentsChatConversationsError>> {
600
601 let uri_str = format!("{}/v1/agents/chat/conversations", configuration.base_path);
602 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
603
604 if let Some(ref user_agent) = configuration.user_agent {
605 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
606 }
607 if let Some(ref token) = configuration.bearer_access_token {
608 req_builder = req_builder.bearer_auth(token.to_owned());
609 };
610
611 let req = req_builder.build()?;
612 let resp = configuration.client.execute(req).await?;
613
614 let status = resp.status();
615
616 if !status.is_client_error() && !status.is_server_error() {
617 Ok(())
618 } else {
619 let content = resp.text().await?;
620 let entity: Option<GetAgentsChatConversationsError> = serde_json::from_str(&content).ok();
621 Err(Error::ResponseError(ResponseContent { status, content, entity }))
622 }
623}
624
625pub async fn get_agents_chat_conversations_by_id(configuration: &configuration::Configuration, id: &str) -> Result<(), Error<GetAgentsChatConversationsByIdError>> {
627 let p_id = id;
629
630 let uri_str = format!("{}/v1/agents/chat/conversations/{id}", configuration.base_path, id=crate::apis::urlencode(p_id));
631 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
632
633 if let Some(ref user_agent) = configuration.user_agent {
634 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
635 }
636 if let Some(ref token) = configuration.bearer_access_token {
637 req_builder = req_builder.bearer_auth(token.to_owned());
638 };
639
640 let req = req_builder.build()?;
641 let resp = configuration.client.execute(req).await?;
642
643 let status = resp.status();
644
645 if !status.is_client_error() && !status.is_server_error() {
646 Ok(())
647 } else {
648 let content = resp.text().await?;
649 let entity: Option<GetAgentsChatConversationsByIdError> = serde_json::from_str(&content).ok();
650 Err(Error::ResponseError(ResponseContent { status, content, entity }))
651 }
652}
653
654pub async fn get_agents_chat_presets(configuration: &configuration::Configuration, ) -> Result<(), Error<GetAgentsChatPresetsError>> {
656
657 let uri_str = format!("{}/v1/agents/chat/presets", configuration.base_path);
658 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
659
660 if let Some(ref user_agent) = configuration.user_agent {
661 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
662 }
663 if let Some(ref token) = configuration.bearer_access_token {
664 req_builder = req_builder.bearer_auth(token.to_owned());
665 };
666
667 let req = req_builder.build()?;
668 let resp = configuration.client.execute(req).await?;
669
670 let status = resp.status();
671
672 if !status.is_client_error() && !status.is_server_error() {
673 Ok(())
674 } else {
675 let content = resp.text().await?;
676 let entity: Option<GetAgentsChatPresetsError> = serde_json::from_str(&content).ok();
677 Err(Error::ResponseError(ResponseContent { status, content, entity }))
678 }
679}
680
681pub async fn get_agents_metrics(configuration: &configuration::Configuration, range: Option<&str>) -> Result<models::MetricsView, Error<GetAgentsMetricsError>> {
683 let p_range = range;
685
686 let uri_str = format!("{}/v1/agents/metrics", configuration.base_path);
687 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
688
689 if let Some(ref param_value) = p_range {
690 req_builder = req_builder.query(&[("range", ¶m_value.to_string())]);
691 }
692 if let Some(ref user_agent) = configuration.user_agent {
693 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
694 }
695 if let Some(ref token) = configuration.bearer_access_token {
696 req_builder = req_builder.bearer_auth(token.to_owned());
697 };
698
699 let req = req_builder.build()?;
700 let resp = configuration.client.execute(req).await?;
701
702 let status = resp.status();
703 let content_type = resp
704 .headers()
705 .get("content-type")
706 .and_then(|v| v.to_str().ok())
707 .unwrap_or("application/octet-stream");
708 let content_type = super::ContentType::from(content_type);
709
710 if !status.is_client_error() && !status.is_server_error() {
711 let content = resp.text().await?;
712 match content_type {
713 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
714 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::MetricsView`"))),
715 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::MetricsView`")))),
716 }
717 } else {
718 let content = resp.text().await?;
719 let entity: Option<GetAgentsMetricsError> = serde_json::from_str(&content).ok();
720 Err(Error::ResponseError(ResponseContent { status, content, entity }))
721 }
722}
723
724pub async fn get_agents_runs(configuration: &configuration::Configuration, limit: Option<i32>, status: Option<&str>) -> Result<models::RunList, Error<GetAgentsRunsError>> {
726 let p_limit = limit;
728 let p_status = status;
729
730 let uri_str = format!("{}/v1/agents/runs", configuration.base_path);
731 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
732
733 if let Some(ref param_value) = p_limit {
734 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
735 }
736 if let Some(ref param_value) = p_status {
737 req_builder = req_builder.query(&[("status", ¶m_value.to_string())]);
738 }
739 if let Some(ref user_agent) = configuration.user_agent {
740 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
741 }
742 if let Some(ref token) = configuration.bearer_access_token {
743 req_builder = req_builder.bearer_auth(token.to_owned());
744 };
745
746 let req = req_builder.build()?;
747 let resp = configuration.client.execute(req).await?;
748
749 let status = resp.status();
750 let content_type = resp
751 .headers()
752 .get("content-type")
753 .and_then(|v| v.to_str().ok())
754 .unwrap_or("application/octet-stream");
755 let content_type = super::ContentType::from(content_type);
756
757 if !status.is_client_error() && !status.is_server_error() {
758 let content = resp.text().await?;
759 match content_type {
760 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
761 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RunList`"))),
762 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::RunList`")))),
763 }
764 } else {
765 let content = resp.text().await?;
766 let entity: Option<GetAgentsRunsError> = serde_json::from_str(&content).ok();
767 Err(Error::ResponseError(ResponseContent { status, content, entity }))
768 }
769}
770
771pub async fn get_agents_sessions(configuration: &configuration::Configuration, root: Option<&str>, parent: Option<&str>, status: Option<&str>, project: Option<&str>, room: Option<&str>, limit: Option<i32>) -> Result<models::SessionList, Error<GetAgentsSessionsError>> {
773 let p_root = root;
775 let p_parent = parent;
776 let p_status = status;
777 let p_project = project;
778 let p_room = room;
779 let p_limit = limit;
780
781 let uri_str = format!("{}/v1/agents/sessions", configuration.base_path);
782 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
783
784 if let Some(ref param_value) = p_root {
785 req_builder = req_builder.query(&[("root", ¶m_value.to_string())]);
786 }
787 if let Some(ref param_value) = p_parent {
788 req_builder = req_builder.query(&[("parent", ¶m_value.to_string())]);
789 }
790 if let Some(ref param_value) = p_status {
791 req_builder = req_builder.query(&[("status", ¶m_value.to_string())]);
792 }
793 if let Some(ref param_value) = p_project {
794 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
795 }
796 if let Some(ref param_value) = p_room {
797 req_builder = req_builder.query(&[("room", ¶m_value.to_string())]);
798 }
799 if let Some(ref param_value) = p_limit {
800 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
801 }
802 if let Some(ref user_agent) = configuration.user_agent {
803 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
804 }
805 if let Some(ref token) = configuration.bearer_access_token {
806 req_builder = req_builder.bearer_auth(token.to_owned());
807 };
808
809 let req = req_builder.build()?;
810 let resp = configuration.client.execute(req).await?;
811
812 let status = resp.status();
813 let content_type = resp
814 .headers()
815 .get("content-type")
816 .and_then(|v| v.to_str().ok())
817 .unwrap_or("application/octet-stream");
818 let content_type = super::ContentType::from(content_type);
819
820 if !status.is_client_error() && !status.is_server_error() {
821 let content = resp.text().await?;
822 match content_type {
823 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
824 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SessionList`"))),
825 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::SessionList`")))),
826 }
827 } else {
828 let content = resp.text().await?;
829 let entity: Option<GetAgentsSessionsError> = serde_json::from_str(&content).ok();
830 Err(Error::ResponseError(ResponseContent { status, content, entity }))
831 }
832}
833
834pub async fn get_agents_sessions_by_id(configuration: &configuration::Configuration, id: &str) -> Result<models::SessionDetail, Error<GetAgentsSessionsByIdError>> {
836 let p_id = id;
838
839 let uri_str = format!("{}/v1/agents/sessions/{id}", configuration.base_path, id=crate::apis::urlencode(p_id));
840 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
841
842 if let Some(ref user_agent) = configuration.user_agent {
843 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
844 }
845 if let Some(ref token) = configuration.bearer_access_token {
846 req_builder = req_builder.bearer_auth(token.to_owned());
847 };
848
849 let req = req_builder.build()?;
850 let resp = configuration.client.execute(req).await?;
851
852 let status = resp.status();
853 let content_type = resp
854 .headers()
855 .get("content-type")
856 .and_then(|v| v.to_str().ok())
857 .unwrap_or("application/octet-stream");
858 let content_type = super::ContentType::from(content_type);
859
860 if !status.is_client_error() && !status.is_server_error() {
861 let content = resp.text().await?;
862 match content_type {
863 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
864 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SessionDetail`"))),
865 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::SessionDetail`")))),
866 }
867 } else {
868 let content = resp.text().await?;
869 let entity: Option<GetAgentsSessionsByIdError> = serde_json::from_str(&content).ok();
870 Err(Error::ResponseError(ResponseContent { status, content, entity }))
871 }
872}
873
874pub async fn get_agents_sessions_by_id_control(configuration: &configuration::Configuration, id: &str, after: Option<i32>) -> Result<models::ControlDrain, Error<GetAgentsSessionsByIdControlError>> {
876 let p_id = id;
878 let p_after = after;
879
880 let uri_str = format!("{}/v1/agents/sessions/{id}/control", configuration.base_path, id=crate::apis::urlencode(p_id));
881 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
882
883 if let Some(ref param_value) = p_after {
884 req_builder = req_builder.query(&[("after", ¶m_value.to_string())]);
885 }
886 if let Some(ref user_agent) = configuration.user_agent {
887 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
888 }
889 if let Some(ref token) = configuration.bearer_access_token {
890 req_builder = req_builder.bearer_auth(token.to_owned());
891 };
892
893 let req = req_builder.build()?;
894 let resp = configuration.client.execute(req).await?;
895
896 let status = resp.status();
897 let content_type = resp
898 .headers()
899 .get("content-type")
900 .and_then(|v| v.to_str().ok())
901 .unwrap_or("application/octet-stream");
902 let content_type = super::ContentType::from(content_type);
903
904 if !status.is_client_error() && !status.is_server_error() {
905 let content = resp.text().await?;
906 match content_type {
907 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
908 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ControlDrain`"))),
909 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::ControlDrain`")))),
910 }
911 } else {
912 let content = resp.text().await?;
913 let entity: Option<GetAgentsSessionsByIdControlError> = serde_json::from_str(&content).ok();
914 Err(Error::ResponseError(ResponseContent { status, content, entity }))
915 }
916}
917
918pub async fn get_agents_sessions_by_id_progress(configuration: &configuration::Configuration, id: &str) -> Result<models::SessionProgress, Error<GetAgentsSessionsByIdProgressError>> {
920 let p_id = id;
922
923 let uri_str = format!("{}/v1/agents/sessions/{id}/progress", configuration.base_path, id=crate::apis::urlencode(p_id));
924 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
925
926 if let Some(ref user_agent) = configuration.user_agent {
927 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
928 }
929 if let Some(ref token) = configuration.bearer_access_token {
930 req_builder = req_builder.bearer_auth(token.to_owned());
931 };
932
933 let req = req_builder.build()?;
934 let resp = configuration.client.execute(req).await?;
935
936 let status = resp.status();
937 let content_type = resp
938 .headers()
939 .get("content-type")
940 .and_then(|v| v.to_str().ok())
941 .unwrap_or("application/octet-stream");
942 let content_type = super::ContentType::from(content_type);
943
944 if !status.is_client_error() && !status.is_server_error() {
945 let content = resp.text().await?;
946 match content_type {
947 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
948 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SessionProgress`"))),
949 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::SessionProgress`")))),
950 }
951 } else {
952 let content = resp.text().await?;
953 let entity: Option<GetAgentsSessionsByIdProgressError> = serde_json::from_str(&content).ok();
954 Err(Error::ResponseError(ResponseContent { status, content, entity }))
955 }
956}
957
958pub async fn get_agents_sessions_by_id_tree(configuration: &configuration::Configuration, id: &str) -> Result<models::TreeNode, Error<GetAgentsSessionsByIdTreeError>> {
960 let p_id = id;
962
963 let uri_str = format!("{}/v1/agents/sessions/{id}/tree", configuration.base_path, id=crate::apis::urlencode(p_id));
964 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
965
966 if let Some(ref user_agent) = configuration.user_agent {
967 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
968 }
969 if let Some(ref token) = configuration.bearer_access_token {
970 req_builder = req_builder.bearer_auth(token.to_owned());
971 };
972
973 let req = req_builder.build()?;
974 let resp = configuration.client.execute(req).await?;
975
976 let status = resp.status();
977 let content_type = resp
978 .headers()
979 .get("content-type")
980 .and_then(|v| v.to_str().ok())
981 .unwrap_or("application/octet-stream");
982 let content_type = super::ContentType::from(content_type);
983
984 if !status.is_client_error() && !status.is_server_error() {
985 let content = resp.text().await?;
986 match content_type {
987 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
988 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TreeNode`"))),
989 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::TreeNode`")))),
990 }
991 } else {
992 let content = resp.text().await?;
993 let entity: Option<GetAgentsSessionsByIdTreeError> = serde_json::from_str(&content).ok();
994 Err(Error::ResponseError(ResponseContent { status, content, entity }))
995 }
996}
997
998pub async fn get_agents_sessions_stream(configuration: &configuration::Configuration, ) -> Result<(), Error<GetAgentsSessionsStreamError>> {
1000
1001 let uri_str = format!("{}/v1/agents/sessions/stream", configuration.base_path);
1002 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1003
1004 if let Some(ref user_agent) = configuration.user_agent {
1005 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1006 }
1007 if let Some(ref token) = configuration.bearer_access_token {
1008 req_builder = req_builder.bearer_auth(token.to_owned());
1009 };
1010
1011 let req = req_builder.build()?;
1012 let resp = configuration.client.execute(req).await?;
1013
1014 let status = resp.status();
1015
1016 if !status.is_client_error() && !status.is_server_error() {
1017 Ok(())
1018 } else {
1019 let content = resp.text().await?;
1020 let entity: Option<GetAgentsSessionsStreamError> = serde_json::from_str(&content).ok();
1021 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1022 }
1023}
1024
1025pub async fn get_agents_targets(configuration: &configuration::Configuration, ) -> Result<models::TargetList, Error<GetAgentsTargetsError>> {
1027
1028 let uri_str = format!("{}/v1/agents/targets", configuration.base_path);
1029 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1030
1031 if let Some(ref user_agent) = configuration.user_agent {
1032 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1033 }
1034 if let Some(ref token) = configuration.bearer_access_token {
1035 req_builder = req_builder.bearer_auth(token.to_owned());
1036 };
1037
1038 let req = req_builder.build()?;
1039 let resp = configuration.client.execute(req).await?;
1040
1041 let status = resp.status();
1042 let content_type = resp
1043 .headers()
1044 .get("content-type")
1045 .and_then(|v| v.to_str().ok())
1046 .unwrap_or("application/octet-stream");
1047 let content_type = super::ContentType::from(content_type);
1048
1049 if !status.is_client_error() && !status.is_server_error() {
1050 let content = resp.text().await?;
1051 match content_type {
1052 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1053 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TargetList`"))),
1054 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::TargetList`")))),
1055 }
1056 } else {
1057 let content = resp.text().await?;
1058 let entity: Option<GetAgentsTargetsError> = serde_json::from_str(&content).ok();
1059 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1060 }
1061}
1062
1063pub async fn get_agents_targets_by_id(configuration: &configuration::Configuration, id: &str) -> Result<models::TargetView, Error<GetAgentsTargetsByIdError>> {
1065 let p_id = id;
1067
1068 let uri_str = format!("{}/v1/agents/targets/{id}", configuration.base_path, id=crate::apis::urlencode(p_id));
1069 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1070
1071 if let Some(ref user_agent) = configuration.user_agent {
1072 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1073 }
1074 if let Some(ref token) = configuration.bearer_access_token {
1075 req_builder = req_builder.bearer_auth(token.to_owned());
1076 };
1077
1078 let req = req_builder.build()?;
1079 let resp = configuration.client.execute(req).await?;
1080
1081 let status = resp.status();
1082 let content_type = resp
1083 .headers()
1084 .get("content-type")
1085 .and_then(|v| v.to_str().ok())
1086 .unwrap_or("application/octet-stream");
1087 let content_type = super::ContentType::from(content_type);
1088
1089 if !status.is_client_error() && !status.is_server_error() {
1090 let content = resp.text().await?;
1091 match content_type {
1092 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1093 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TargetView`"))),
1094 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::TargetView`")))),
1095 }
1096 } else {
1097 let content = resp.text().await?;
1098 let entity: Option<GetAgentsTargetsByIdError> = serde_json::from_str(&content).ok();
1099 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1100 }
1101}
1102
1103pub async fn patch_agents_by_ref(configuration: &configuration::Configuration, r#ref: &str, update_agent_in: models::UpdateAgentIn) -> Result<models::AgentView, Error<PatchAgentsByRefError>> {
1105 let p_ref = r#ref;
1107 let p_update_agent_in = update_agent_in;
1108
1109 let uri_str = format!("{}/v1/agents/{ref}", configuration.base_path, ref=crate::apis::urlencode(p_ref));
1110 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
1111
1112 if let Some(ref user_agent) = configuration.user_agent {
1113 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1114 }
1115 if let Some(ref token) = configuration.bearer_access_token {
1116 req_builder = req_builder.bearer_auth(token.to_owned());
1117 };
1118 req_builder = req_builder.json(&p_update_agent_in);
1119
1120 let req = req_builder.build()?;
1121 let resp = configuration.client.execute(req).await?;
1122
1123 let status = resp.status();
1124 let content_type = resp
1125 .headers()
1126 .get("content-type")
1127 .and_then(|v| v.to_str().ok())
1128 .unwrap_or("application/octet-stream");
1129 let content_type = super::ContentType::from(content_type);
1130
1131 if !status.is_client_error() && !status.is_server_error() {
1132 let content = resp.text().await?;
1133 match content_type {
1134 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1135 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AgentView`"))),
1136 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::AgentView`")))),
1137 }
1138 } else {
1139 let content = resp.text().await?;
1140 let entity: Option<PatchAgentsByRefError> = serde_json::from_str(&content).ok();
1141 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1142 }
1143}
1144
1145pub async fn patch_agents_sessions_by_id(configuration: &configuration::Configuration, id: &str, patch_session_in: models::PatchSessionIn) -> Result<models::SessionView, Error<PatchAgentsSessionsByIdError>> {
1147 let p_id = id;
1149 let p_patch_session_in = patch_session_in;
1150
1151 let uri_str = format!("{}/v1/agents/sessions/{id}", configuration.base_path, id=crate::apis::urlencode(p_id));
1152 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
1153
1154 if let Some(ref user_agent) = configuration.user_agent {
1155 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1156 }
1157 if let Some(ref token) = configuration.bearer_access_token {
1158 req_builder = req_builder.bearer_auth(token.to_owned());
1159 };
1160 req_builder = req_builder.json(&p_patch_session_in);
1161
1162 let req = req_builder.build()?;
1163 let resp = configuration.client.execute(req).await?;
1164
1165 let status = resp.status();
1166 let content_type = resp
1167 .headers()
1168 .get("content-type")
1169 .and_then(|v| v.to_str().ok())
1170 .unwrap_or("application/octet-stream");
1171 let content_type = super::ContentType::from(content_type);
1172
1173 if !status.is_client_error() && !status.is_server_error() {
1174 let content = resp.text().await?;
1175 match content_type {
1176 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1177 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SessionView`"))),
1178 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::SessionView`")))),
1179 }
1180 } else {
1181 let content = resp.text().await?;
1182 let entity: Option<PatchAgentsSessionsByIdError> = serde_json::from_str(&content).ok();
1183 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1184 }
1185}
1186
1187pub async fn patch_agents_targets_by_id(configuration: &configuration::Configuration, id: &str, patch_target_in: models::PatchTargetIn) -> Result<models::TargetView, Error<PatchAgentsTargetsByIdError>> {
1189 let p_id = id;
1191 let p_patch_target_in = patch_target_in;
1192
1193 let uri_str = format!("{}/v1/agents/targets/{id}", configuration.base_path, id=crate::apis::urlencode(p_id));
1194 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
1195
1196 if let Some(ref user_agent) = configuration.user_agent {
1197 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1198 }
1199 if let Some(ref token) = configuration.bearer_access_token {
1200 req_builder = req_builder.bearer_auth(token.to_owned());
1201 };
1202 req_builder = req_builder.json(&p_patch_target_in);
1203
1204 let req = req_builder.build()?;
1205 let resp = configuration.client.execute(req).await?;
1206
1207 let status = resp.status();
1208 let content_type = resp
1209 .headers()
1210 .get("content-type")
1211 .and_then(|v| v.to_str().ok())
1212 .unwrap_or("application/octet-stream");
1213 let content_type = super::ContentType::from(content_type);
1214
1215 if !status.is_client_error() && !status.is_server_error() {
1216 let content = resp.text().await?;
1217 match content_type {
1218 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1219 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TargetView`"))),
1220 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::TargetView`")))),
1221 }
1222 } else {
1223 let content = resp.text().await?;
1224 let entity: Option<PatchAgentsTargetsByIdError> = serde_json::from_str(&content).ok();
1225 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1226 }
1227}
1228
1229pub async fn post_agents(configuration: &configuration::Configuration, create_agent_in: models::CreateAgentIn) -> Result<models::AgentView, Error<PostAgentsError>> {
1231 let p_create_agent_in = create_agent_in;
1233
1234 let uri_str = format!("{}/v1/agents", configuration.base_path);
1235 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1236
1237 if let Some(ref user_agent) = configuration.user_agent {
1238 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1239 }
1240 if let Some(ref token) = configuration.bearer_access_token {
1241 req_builder = req_builder.bearer_auth(token.to_owned());
1242 };
1243 req_builder = req_builder.json(&p_create_agent_in);
1244
1245 let req = req_builder.build()?;
1246 let resp = configuration.client.execute(req).await?;
1247
1248 let status = resp.status();
1249 let content_type = resp
1250 .headers()
1251 .get("content-type")
1252 .and_then(|v| v.to_str().ok())
1253 .unwrap_or("application/octet-stream");
1254 let content_type = super::ContentType::from(content_type);
1255
1256 if !status.is_client_error() && !status.is_server_error() {
1257 let content = resp.text().await?;
1258 match content_type {
1259 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1260 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AgentView`"))),
1261 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::AgentView`")))),
1262 }
1263 } else {
1264 let content = resp.text().await?;
1265 let entity: Option<PostAgentsError> = serde_json::from_str(&content).ok();
1266 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1267 }
1268}
1269
1270pub async fn post_agents_by_ref_run(configuration: &configuration::Configuration, r#ref: &str) -> Result<(), Error<PostAgentsByRefRunError>> {
1272 let p_ref = r#ref;
1274
1275 let uri_str = format!("{}/v1/agents/{ref}/run", configuration.base_path, ref=crate::apis::urlencode(p_ref));
1276 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1277
1278 if let Some(ref user_agent) = configuration.user_agent {
1279 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1280 }
1281 if let Some(ref token) = configuration.bearer_access_token {
1282 req_builder = req_builder.bearer_auth(token.to_owned());
1283 };
1284
1285 let req = req_builder.build()?;
1286 let resp = configuration.client.execute(req).await?;
1287
1288 let status = resp.status();
1289
1290 if !status.is_client_error() && !status.is_server_error() {
1291 Ok(())
1292 } else {
1293 let content = resp.text().await?;
1294 let entity: Option<PostAgentsByRefRunError> = serde_json::from_str(&content).ok();
1295 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1296 }
1297}
1298
1299pub async fn post_agents_chat(configuration: &configuration::Configuration, ) -> Result<(), Error<PostAgentsChatError>> {
1301
1302 let uri_str = format!("{}/v1/agents/chat", configuration.base_path);
1303 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1304
1305 if let Some(ref user_agent) = configuration.user_agent {
1306 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1307 }
1308 if let Some(ref token) = configuration.bearer_access_token {
1309 req_builder = req_builder.bearer_auth(token.to_owned());
1310 };
1311
1312 let req = req_builder.build()?;
1313 let resp = configuration.client.execute(req).await?;
1314
1315 let status = resp.status();
1316
1317 if !status.is_client_error() && !status.is_server_error() {
1318 Ok(())
1319 } else {
1320 let content = resp.text().await?;
1321 let entity: Option<PostAgentsChatError> = serde_json::from_str(&content).ok();
1322 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1323 }
1324}
1325
1326pub async fn post_agents_coding(configuration: &configuration::Configuration, coding_start_in: models::CodingStartIn) -> Result<models::CodingStarted, Error<PostAgentsCodingError>> {
1328 let p_coding_start_in = coding_start_in;
1330
1331 let uri_str = format!("{}/v1/agents/coding", configuration.base_path);
1332 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1333
1334 if let Some(ref user_agent) = configuration.user_agent {
1335 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1336 }
1337 if let Some(ref token) = configuration.bearer_access_token {
1338 req_builder = req_builder.bearer_auth(token.to_owned());
1339 };
1340 req_builder = req_builder.json(&p_coding_start_in);
1341
1342 let req = req_builder.build()?;
1343 let resp = configuration.client.execute(req).await?;
1344
1345 let status = resp.status();
1346 let content_type = resp
1347 .headers()
1348 .get("content-type")
1349 .and_then(|v| v.to_str().ok())
1350 .unwrap_or("application/octet-stream");
1351 let content_type = super::ContentType::from(content_type);
1352
1353 if !status.is_client_error() && !status.is_server_error() {
1354 let content = resp.text().await?;
1355 match content_type {
1356 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1357 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CodingStarted`"))),
1358 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::CodingStarted`")))),
1359 }
1360 } else {
1361 let content = resp.text().await?;
1362 let entity: Option<PostAgentsCodingError> = serde_json::from_str(&content).ok();
1363 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1364 }
1365}
1366
1367pub async fn post_agents_sessions(configuration: &configuration::Configuration, register_req: models::RegisterReq) -> Result<models::SessionView, Error<PostAgentsSessionsError>> {
1369 let p_register_req = register_req;
1371
1372 let uri_str = format!("{}/v1/agents/sessions", configuration.base_path);
1373 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1374
1375 if let Some(ref user_agent) = configuration.user_agent {
1376 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1377 }
1378 if let Some(ref token) = configuration.bearer_access_token {
1379 req_builder = req_builder.bearer_auth(token.to_owned());
1380 };
1381 req_builder = req_builder.json(&p_register_req);
1382
1383 let req = req_builder.build()?;
1384 let resp = configuration.client.execute(req).await?;
1385
1386 let status = resp.status();
1387 let content_type = resp
1388 .headers()
1389 .get("content-type")
1390 .and_then(|v| v.to_str().ok())
1391 .unwrap_or("application/octet-stream");
1392 let content_type = super::ContentType::from(content_type);
1393
1394 if !status.is_client_error() && !status.is_server_error() {
1395 let content = resp.text().await?;
1396 match content_type {
1397 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1398 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SessionView`"))),
1399 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::SessionView`")))),
1400 }
1401 } else {
1402 let content = resp.text().await?;
1403 let entity: Option<PostAgentsSessionsError> = serde_json::from_str(&content).ok();
1404 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1405 }
1406}
1407
1408pub async fn post_agents_sessions_by_id_events(configuration: &configuration::Configuration, id: &str, event_in: models::EventIn) -> Result<models::EventView, Error<PostAgentsSessionsByIdEventsError>> {
1410 let p_id = id;
1412 let p_event_in = event_in;
1413
1414 let uri_str = format!("{}/v1/agents/sessions/{id}/events", configuration.base_path, id=crate::apis::urlencode(p_id));
1415 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1416
1417 if let Some(ref user_agent) = configuration.user_agent {
1418 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1419 }
1420 if let Some(ref token) = configuration.bearer_access_token {
1421 req_builder = req_builder.bearer_auth(token.to_owned());
1422 };
1423 req_builder = req_builder.json(&p_event_in);
1424
1425 let req = req_builder.build()?;
1426 let resp = configuration.client.execute(req).await?;
1427
1428 let status = resp.status();
1429 let content_type = resp
1430 .headers()
1431 .get("content-type")
1432 .and_then(|v| v.to_str().ok())
1433 .unwrap_or("application/octet-stream");
1434 let content_type = super::ContentType::from(content_type);
1435
1436 if !status.is_client_error() && !status.is_server_error() {
1437 let content = resp.text().await?;
1438 match content_type {
1439 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1440 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::EventView`"))),
1441 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::EventView`")))),
1442 }
1443 } else {
1444 let content = resp.text().await?;
1445 let entity: Option<PostAgentsSessionsByIdEventsError> = serde_json::from_str(&content).ok();
1446 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1447 }
1448}
1449
1450pub async fn post_agents_sessions_by_id_message(configuration: &configuration::Configuration, id: &str, control_in: models::ControlIn) -> Result<models::ControlResult, Error<PostAgentsSessionsByIdMessageError>> {
1452 let p_id = id;
1454 let p_control_in = control_in;
1455
1456 let uri_str = format!("{}/v1/agents/sessions/{id}/message", configuration.base_path, id=crate::apis::urlencode(p_id));
1457 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1458
1459 if let Some(ref user_agent) = configuration.user_agent {
1460 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1461 }
1462 if let Some(ref token) = configuration.bearer_access_token {
1463 req_builder = req_builder.bearer_auth(token.to_owned());
1464 };
1465 req_builder = req_builder.json(&p_control_in);
1466
1467 let req = req_builder.build()?;
1468 let resp = configuration.client.execute(req).await?;
1469
1470 let status = resp.status();
1471 let content_type = resp
1472 .headers()
1473 .get("content-type")
1474 .and_then(|v| v.to_str().ok())
1475 .unwrap_or("application/octet-stream");
1476 let content_type = super::ContentType::from(content_type);
1477
1478 if !status.is_client_error() && !status.is_server_error() {
1479 let content = resp.text().await?;
1480 match content_type {
1481 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1482 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ControlResult`"))),
1483 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::ControlResult`")))),
1484 }
1485 } else {
1486 let content = resp.text().await?;
1487 let entity: Option<PostAgentsSessionsByIdMessageError> = serde_json::from_str(&content).ok();
1488 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1489 }
1490}
1491
1492pub async fn post_agents_sessions_by_id_pause(configuration: &configuration::Configuration, id: &str, control_in: models::ControlIn) -> Result<models::ControlResult, Error<PostAgentsSessionsByIdPauseError>> {
1494 let p_id = id;
1496 let p_control_in = control_in;
1497
1498 let uri_str = format!("{}/v1/agents/sessions/{id}/pause", configuration.base_path, id=crate::apis::urlencode(p_id));
1499 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1500
1501 if let Some(ref user_agent) = configuration.user_agent {
1502 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1503 }
1504 if let Some(ref token) = configuration.bearer_access_token {
1505 req_builder = req_builder.bearer_auth(token.to_owned());
1506 };
1507 req_builder = req_builder.json(&p_control_in);
1508
1509 let req = req_builder.build()?;
1510 let resp = configuration.client.execute(req).await?;
1511
1512 let status = resp.status();
1513 let content_type = resp
1514 .headers()
1515 .get("content-type")
1516 .and_then(|v| v.to_str().ok())
1517 .unwrap_or("application/octet-stream");
1518 let content_type = super::ContentType::from(content_type);
1519
1520 if !status.is_client_error() && !status.is_server_error() {
1521 let content = resp.text().await?;
1522 match content_type {
1523 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1524 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ControlResult`"))),
1525 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::ControlResult`")))),
1526 }
1527 } else {
1528 let content = resp.text().await?;
1529 let entity: Option<PostAgentsSessionsByIdPauseError> = serde_json::from_str(&content).ok();
1530 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1531 }
1532}
1533
1534pub async fn post_agents_sessions_by_id_resume(configuration: &configuration::Configuration, id: &str, control_in: models::ControlIn) -> Result<models::ControlResult, Error<PostAgentsSessionsByIdResumeError>> {
1536 let p_id = id;
1538 let p_control_in = control_in;
1539
1540 let uri_str = format!("{}/v1/agents/sessions/{id}/resume", configuration.base_path, id=crate::apis::urlencode(p_id));
1541 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1542
1543 if let Some(ref user_agent) = configuration.user_agent {
1544 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1545 }
1546 if let Some(ref token) = configuration.bearer_access_token {
1547 req_builder = req_builder.bearer_auth(token.to_owned());
1548 };
1549 req_builder = req_builder.json(&p_control_in);
1550
1551 let req = req_builder.build()?;
1552 let resp = configuration.client.execute(req).await?;
1553
1554 let status = resp.status();
1555 let content_type = resp
1556 .headers()
1557 .get("content-type")
1558 .and_then(|v| v.to_str().ok())
1559 .unwrap_or("application/octet-stream");
1560 let content_type = super::ContentType::from(content_type);
1561
1562 if !status.is_client_error() && !status.is_server_error() {
1563 let content = resp.text().await?;
1564 match content_type {
1565 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1566 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ControlResult`"))),
1567 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::ControlResult`")))),
1568 }
1569 } else {
1570 let content = resp.text().await?;
1571 let entity: Option<PostAgentsSessionsByIdResumeError> = serde_json::from_str(&content).ok();
1572 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1573 }
1574}
1575
1576pub async fn post_agents_sessions_by_id_stop(configuration: &configuration::Configuration, id: &str, control_in: models::ControlIn) -> Result<models::ControlResult, Error<PostAgentsSessionsByIdStopError>> {
1578 let p_id = id;
1580 let p_control_in = control_in;
1581
1582 let uri_str = format!("{}/v1/agents/sessions/{id}/stop", configuration.base_path, id=crate::apis::urlencode(p_id));
1583 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1584
1585 if let Some(ref user_agent) = configuration.user_agent {
1586 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1587 }
1588 if let Some(ref token) = configuration.bearer_access_token {
1589 req_builder = req_builder.bearer_auth(token.to_owned());
1590 };
1591 req_builder = req_builder.json(&p_control_in);
1592
1593 let req = req_builder.build()?;
1594 let resp = configuration.client.execute(req).await?;
1595
1596 let status = resp.status();
1597 let content_type = resp
1598 .headers()
1599 .get("content-type")
1600 .and_then(|v| v.to_str().ok())
1601 .unwrap_or("application/octet-stream");
1602 let content_type = super::ContentType::from(content_type);
1603
1604 if !status.is_client_error() && !status.is_server_error() {
1605 let content = resp.text().await?;
1606 match content_type {
1607 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1608 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ControlResult`"))),
1609 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::ControlResult`")))),
1610 }
1611 } else {
1612 let content = resp.text().await?;
1613 let entity: Option<PostAgentsSessionsByIdStopError> = serde_json::from_str(&content).ok();
1614 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1615 }
1616}
1617
1618pub async fn post_agents_targets(configuration: &configuration::Configuration, target_req: models::TargetReq) -> Result<models::TargetView, Error<PostAgentsTargetsError>> {
1620 let p_target_req = target_req;
1622
1623 let uri_str = format!("{}/v1/agents/targets", configuration.base_path);
1624 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1625
1626 if let Some(ref user_agent) = configuration.user_agent {
1627 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1628 }
1629 if let Some(ref token) = configuration.bearer_access_token {
1630 req_builder = req_builder.bearer_auth(token.to_owned());
1631 };
1632 req_builder = req_builder.json(&p_target_req);
1633
1634 let req = req_builder.build()?;
1635 let resp = configuration.client.execute(req).await?;
1636
1637 let status = resp.status();
1638 let content_type = resp
1639 .headers()
1640 .get("content-type")
1641 .and_then(|v| v.to_str().ok())
1642 .unwrap_or("application/octet-stream");
1643 let content_type = super::ContentType::from(content_type);
1644
1645 if !status.is_client_error() && !status.is_server_error() {
1646 let content = resp.text().await?;
1647 match content_type {
1648 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1649 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TargetView`"))),
1650 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::TargetView`")))),
1651 }
1652 } else {
1653 let content = resp.text().await?;
1654 let entity: Option<PostAgentsTargetsError> = serde_json::from_str(&content).ok();
1655 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1656 }
1657}
1658
1659pub async fn post_agents_targets_by_id_claim(configuration: &configuration::Configuration, id: &str) -> Result<models::RoutedRunOut, Error<PostAgentsTargetsByIdClaimError>> {
1661 let p_id = id;
1663
1664 let uri_str = format!("{}/v1/agents/targets/{id}/claim", configuration.base_path, id=crate::apis::urlencode(p_id));
1665 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1666
1667 if let Some(ref user_agent) = configuration.user_agent {
1668 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1669 }
1670 if let Some(ref token) = configuration.bearer_access_token {
1671 req_builder = req_builder.bearer_auth(token.to_owned());
1672 };
1673
1674 let req = req_builder.build()?;
1675 let resp = configuration.client.execute(req).await?;
1676
1677 let status = resp.status();
1678 let content_type = resp
1679 .headers()
1680 .get("content-type")
1681 .and_then(|v| v.to_str().ok())
1682 .unwrap_or("application/octet-stream");
1683 let content_type = super::ContentType::from(content_type);
1684
1685 if !status.is_client_error() && !status.is_server_error() {
1686 let content = resp.text().await?;
1687 match content_type {
1688 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1689 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RoutedRunOut`"))),
1690 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::RoutedRunOut`")))),
1691 }
1692 } else {
1693 let content = resp.text().await?;
1694 let entity: Option<PostAgentsTargetsByIdClaimError> = serde_json::from_str(&content).ok();
1695 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1696 }
1697}
1698
1699pub async fn post_agents_targets_by_id_key(configuration: &configuration::Configuration, id: &str) -> Result<models::ClaimKeyOut, Error<PostAgentsTargetsByIdKeyError>> {
1701 let p_id = id;
1703
1704 let uri_str = format!("{}/v1/agents/targets/{id}/key", configuration.base_path, id=crate::apis::urlencode(p_id));
1705 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1706
1707 if let Some(ref user_agent) = configuration.user_agent {
1708 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1709 }
1710 if let Some(ref token) = configuration.bearer_access_token {
1711 req_builder = req_builder.bearer_auth(token.to_owned());
1712 };
1713
1714 let req = req_builder.build()?;
1715 let resp = configuration.client.execute(req).await?;
1716
1717 let status = resp.status();
1718 let content_type = resp
1719 .headers()
1720 .get("content-type")
1721 .and_then(|v| v.to_str().ok())
1722 .unwrap_or("application/octet-stream");
1723 let content_type = super::ContentType::from(content_type);
1724
1725 if !status.is_client_error() && !status.is_server_error() {
1726 let content = resp.text().await?;
1727 match content_type {
1728 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1729 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClaimKeyOut`"))),
1730 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::ClaimKeyOut`")))),
1731 }
1732 } else {
1733 let content = resp.text().await?;
1734 let entity: Option<PostAgentsTargetsByIdKeyError> = serde_json::from_str(&content).ok();
1735 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1736 }
1737}
1738
1739pub async fn post_agents_targets_by_id_runs_by_runid_report(configuration: &configuration::Configuration, id: &str, run_id: &str, report_run_in: models::ReportRunIn) -> Result<models::ReportOut, Error<PostAgentsTargetsByIdRunsByRunidReportError>> {
1741 let p_id = id;
1743 let p_run_id = run_id;
1744 let p_report_run_in = report_run_in;
1745
1746 let uri_str = format!("{}/v1/agents/targets/{id}/runs/{runId}/report", configuration.base_path, id=crate::apis::urlencode(p_id), runId=crate::apis::urlencode(p_run_id));
1747 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1748
1749 if let Some(ref user_agent) = configuration.user_agent {
1750 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1751 }
1752 if let Some(ref token) = configuration.bearer_access_token {
1753 req_builder = req_builder.bearer_auth(token.to_owned());
1754 };
1755 req_builder = req_builder.json(&p_report_run_in);
1756
1757 let req = req_builder.build()?;
1758 let resp = configuration.client.execute(req).await?;
1759
1760 let status = resp.status();
1761 let content_type = resp
1762 .headers()
1763 .get("content-type")
1764 .and_then(|v| v.to_str().ok())
1765 .unwrap_or("application/octet-stream");
1766 let content_type = super::ContentType::from(content_type);
1767
1768 if !status.is_client_error() && !status.is_server_error() {
1769 let content = resp.text().await?;
1770 match content_type {
1771 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1772 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ReportOut`"))),
1773 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::ReportOut`")))),
1774 }
1775 } else {
1776 let content = resp.text().await?;
1777 let entity: Option<PostAgentsTargetsByIdRunsByRunidReportError> = serde_json::from_str(&content).ok();
1778 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1779 }
1780}
1781