1use super::{configuration, ContentType, Error};
12use crate::{apis::ResponseContent, models};
13use reqwest;
14use serde::{de::Error as _, Deserialize, Serialize};
15
16#[derive(Debug, Clone, Serialize, Deserialize)]
18#[serde(untagged)]
19pub enum EndpointsAgentsConnectorsAgentConfigRetrieveError {
20 Status400(models::ValidationError),
21 Status403(models::GenericError),
22 UnknownValue(serde_json::Value),
23}
24
25#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum EndpointsAgentsConnectorsAuthFedCreateError {
29 Status404(),
30 Status400(models::ValidationError),
31 Status403(models::GenericError),
32 UnknownValue(serde_json::Value),
33}
34
35#[derive(Debug, Clone, Serialize, Deserialize)]
37#[serde(untagged)]
38pub enum EndpointsAgentsConnectorsAuthIaCreateError {
39 Status400(models::ValidationError),
40 Status403(models::GenericError),
41 UnknownValue(serde_json::Value),
42}
43
44#[derive(Debug, Clone, Serialize, Deserialize)]
46#[serde(untagged)]
47pub enum EndpointsAgentsConnectorsCheckInCreateError {
48 Status400(models::ValidationError),
49 Status403(models::GenericError),
50 UnknownValue(serde_json::Value),
51}
52
53#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum EndpointsAgentsConnectorsCreateError {
57 Status400(models::ValidationError),
58 Status403(models::GenericError),
59 UnknownValue(serde_json::Value),
60}
61
62#[derive(Debug, Clone, Serialize, Deserialize)]
64#[serde(untagged)]
65pub enum EndpointsAgentsConnectorsDestroyError {
66 Status400(models::ValidationError),
67 Status403(models::GenericError),
68 UnknownValue(serde_json::Value),
69}
70
71#[derive(Debug, Clone, Serialize, Deserialize)]
73#[serde(untagged)]
74pub enum EndpointsAgentsConnectorsEnrollCreateError {
75 Status400(models::ValidationError),
76 Status403(models::GenericError),
77 UnknownValue(serde_json::Value),
78}
79
80#[derive(Debug, Clone, Serialize, Deserialize)]
82#[serde(untagged)]
83pub enum EndpointsAgentsConnectorsListError {
84 Status400(models::ValidationError),
85 Status403(models::GenericError),
86 UnknownValue(serde_json::Value),
87}
88
89#[derive(Debug, Clone, Serialize, Deserialize)]
91#[serde(untagged)]
92pub enum EndpointsAgentsConnectorsMdmConfigCreateError {
93 Status400(models::ValidationError),
94 Status403(models::GenericError),
95 UnknownValue(serde_json::Value),
96}
97
98#[derive(Debug, Clone, Serialize, Deserialize)]
100#[serde(untagged)]
101pub enum EndpointsAgentsConnectorsPartialUpdateError {
102 Status400(models::ValidationError),
103 Status403(models::GenericError),
104 UnknownValue(serde_json::Value),
105}
106
107#[derive(Debug, Clone, Serialize, Deserialize)]
109#[serde(untagged)]
110pub enum EndpointsAgentsConnectorsRetrieveError {
111 Status400(models::ValidationError),
112 Status403(models::GenericError),
113 UnknownValue(serde_json::Value),
114}
115
116#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum EndpointsAgentsConnectorsUpdateError {
120 Status400(models::ValidationError),
121 Status403(models::GenericError),
122 UnknownValue(serde_json::Value),
123}
124
125#[derive(Debug, Clone, Serialize, Deserialize)]
127#[serde(untagged)]
128pub enum EndpointsAgentsConnectorsUsedByListError {
129 Status400(models::ValidationError),
130 Status403(models::GenericError),
131 UnknownValue(serde_json::Value),
132}
133
134#[derive(Debug, Clone, Serialize, Deserialize)]
136#[serde(untagged)]
137pub enum EndpointsAgentsEnrollmentTokensCreateError {
138 Status400(models::ValidationError),
139 Status403(models::GenericError),
140 UnknownValue(serde_json::Value),
141}
142
143#[derive(Debug, Clone, Serialize, Deserialize)]
145#[serde(untagged)]
146pub enum EndpointsAgentsEnrollmentTokensDestroyError {
147 Status400(models::ValidationError),
148 Status403(models::GenericError),
149 UnknownValue(serde_json::Value),
150}
151
152#[derive(Debug, Clone, Serialize, Deserialize)]
154#[serde(untagged)]
155pub enum EndpointsAgentsEnrollmentTokensListError {
156 Status400(models::ValidationError),
157 Status403(models::GenericError),
158 UnknownValue(serde_json::Value),
159}
160
161#[derive(Debug, Clone, Serialize, Deserialize)]
163#[serde(untagged)]
164pub enum EndpointsAgentsEnrollmentTokensPartialUpdateError {
165 Status400(models::ValidationError),
166 Status403(models::GenericError),
167 UnknownValue(serde_json::Value),
168}
169
170#[derive(Debug, Clone, Serialize, Deserialize)]
172#[serde(untagged)]
173pub enum EndpointsAgentsEnrollmentTokensRetrieveError {
174 Status400(models::ValidationError),
175 Status403(models::GenericError),
176 UnknownValue(serde_json::Value),
177}
178
179#[derive(Debug, Clone, Serialize, Deserialize)]
181#[serde(untagged)]
182pub enum EndpointsAgentsEnrollmentTokensUpdateError {
183 Status400(models::ValidationError),
184 Status403(models::GenericError),
185 UnknownValue(serde_json::Value),
186}
187
188#[derive(Debug, Clone, Serialize, Deserialize)]
190#[serde(untagged)]
191pub enum EndpointsAgentsEnrollmentTokensUsedByListError {
192 Status400(models::ValidationError),
193 Status403(models::GenericError),
194 UnknownValue(serde_json::Value),
195}
196
197#[derive(Debug, Clone, Serialize, Deserialize)]
199#[serde(untagged)]
200pub enum EndpointsAgentsEnrollmentTokensViewKeyRetrieveError {
201 Status404(),
202 Status400(models::ValidationError),
203 Status403(models::GenericError),
204 UnknownValue(serde_json::Value),
205}
206
207#[derive(Debug, Clone, Serialize, Deserialize)]
209#[serde(untagged)]
210pub enum EndpointsAgentsPssoRegisterDeviceCreateError {
211 Status400(models::ValidationError),
212 Status403(models::GenericError),
213 UnknownValue(serde_json::Value),
214}
215
216#[derive(Debug, Clone, Serialize, Deserialize)]
218#[serde(untagged)]
219pub enum EndpointsAgentsPssoRegisterUserCreateError {
220 Status400(models::ValidationError),
221 Status403(models::GenericError),
222 UnknownValue(serde_json::Value),
223}
224
225#[derive(Debug, Clone, Serialize, Deserialize)]
227#[serde(untagged)]
228pub enum EndpointsConnectorsDestroyError {
229 Status400(models::ValidationError),
230 Status403(models::GenericError),
231 UnknownValue(serde_json::Value),
232}
233
234#[derive(Debug, Clone, Serialize, Deserialize)]
236#[serde(untagged)]
237pub enum EndpointsConnectorsListError {
238 Status400(models::ValidationError),
239 Status403(models::GenericError),
240 UnknownValue(serde_json::Value),
241}
242
243#[derive(Debug, Clone, Serialize, Deserialize)]
245#[serde(untagged)]
246pub enum EndpointsConnectorsRetrieveError {
247 Status400(models::ValidationError),
248 Status403(models::GenericError),
249 UnknownValue(serde_json::Value),
250}
251
252#[derive(Debug, Clone, Serialize, Deserialize)]
254#[serde(untagged)]
255pub enum EndpointsConnectorsTypesListError {
256 Status400(models::ValidationError),
257 Status403(models::GenericError),
258 UnknownValue(serde_json::Value),
259}
260
261#[derive(Debug, Clone, Serialize, Deserialize)]
263#[serde(untagged)]
264pub enum EndpointsConnectorsUsedByListError {
265 Status400(models::ValidationError),
266 Status403(models::GenericError),
267 UnknownValue(serde_json::Value),
268}
269
270#[derive(Debug, Clone, Serialize, Deserialize)]
272#[serde(untagged)]
273pub enum EndpointsDeviceAccessGroupsCreateError {
274 Status400(models::ValidationError),
275 Status403(models::GenericError),
276 UnknownValue(serde_json::Value),
277}
278
279#[derive(Debug, Clone, Serialize, Deserialize)]
281#[serde(untagged)]
282pub enum EndpointsDeviceAccessGroupsDestroyError {
283 Status400(models::ValidationError),
284 Status403(models::GenericError),
285 UnknownValue(serde_json::Value),
286}
287
288#[derive(Debug, Clone, Serialize, Deserialize)]
290#[serde(untagged)]
291pub enum EndpointsDeviceAccessGroupsListError {
292 Status400(models::ValidationError),
293 Status403(models::GenericError),
294 UnknownValue(serde_json::Value),
295}
296
297#[derive(Debug, Clone, Serialize, Deserialize)]
299#[serde(untagged)]
300pub enum EndpointsDeviceAccessGroupsPartialUpdateError {
301 Status400(models::ValidationError),
302 Status403(models::GenericError),
303 UnknownValue(serde_json::Value),
304}
305
306#[derive(Debug, Clone, Serialize, Deserialize)]
308#[serde(untagged)]
309pub enum EndpointsDeviceAccessGroupsRetrieveError {
310 Status400(models::ValidationError),
311 Status403(models::GenericError),
312 UnknownValue(serde_json::Value),
313}
314
315#[derive(Debug, Clone, Serialize, Deserialize)]
317#[serde(untagged)]
318pub enum EndpointsDeviceAccessGroupsUpdateError {
319 Status400(models::ValidationError),
320 Status403(models::GenericError),
321 UnknownValue(serde_json::Value),
322}
323
324#[derive(Debug, Clone, Serialize, Deserialize)]
326#[serde(untagged)]
327pub enum EndpointsDeviceAccessGroupsUsedByListError {
328 Status400(models::ValidationError),
329 Status403(models::GenericError),
330 UnknownValue(serde_json::Value),
331}
332
333#[derive(Debug, Clone, Serialize, Deserialize)]
335#[serde(untagged)]
336pub enum EndpointsDeviceBindingsCreateError {
337 Status400(models::ValidationError),
338 Status403(models::GenericError),
339 UnknownValue(serde_json::Value),
340}
341
342#[derive(Debug, Clone, Serialize, Deserialize)]
344#[serde(untagged)]
345pub enum EndpointsDeviceBindingsDestroyError {
346 Status400(models::ValidationError),
347 Status403(models::GenericError),
348 UnknownValue(serde_json::Value),
349}
350
351#[derive(Debug, Clone, Serialize, Deserialize)]
353#[serde(untagged)]
354pub enum EndpointsDeviceBindingsListError {
355 Status400(models::ValidationError),
356 Status403(models::GenericError),
357 UnknownValue(serde_json::Value),
358}
359
360#[derive(Debug, Clone, Serialize, Deserialize)]
362#[serde(untagged)]
363pub enum EndpointsDeviceBindingsPartialUpdateError {
364 Status400(models::ValidationError),
365 Status403(models::GenericError),
366 UnknownValue(serde_json::Value),
367}
368
369#[derive(Debug, Clone, Serialize, Deserialize)]
371#[serde(untagged)]
372pub enum EndpointsDeviceBindingsRetrieveError {
373 Status400(models::ValidationError),
374 Status403(models::GenericError),
375 UnknownValue(serde_json::Value),
376}
377
378#[derive(Debug, Clone, Serialize, Deserialize)]
380#[serde(untagged)]
381pub enum EndpointsDeviceBindingsUpdateError {
382 Status400(models::ValidationError),
383 Status403(models::GenericError),
384 UnknownValue(serde_json::Value),
385}
386
387#[derive(Debug, Clone, Serialize, Deserialize)]
389#[serde(untagged)]
390pub enum EndpointsDeviceBindingsUsedByListError {
391 Status400(models::ValidationError),
392 Status403(models::GenericError),
393 UnknownValue(serde_json::Value),
394}
395
396#[derive(Debug, Clone, Serialize, Deserialize)]
398#[serde(untagged)]
399pub enum EndpointsDevicesDestroyError {
400 Status400(models::ValidationError),
401 Status403(models::GenericError),
402 UnknownValue(serde_json::Value),
403}
404
405#[derive(Debug, Clone, Serialize, Deserialize)]
407#[serde(untagged)]
408pub enum EndpointsDevicesListError {
409 Status400(models::ValidationError),
410 Status403(models::GenericError),
411 UnknownValue(serde_json::Value),
412}
413
414#[derive(Debug, Clone, Serialize, Deserialize)]
416#[serde(untagged)]
417pub enum EndpointsDevicesPartialUpdateError {
418 Status400(models::ValidationError),
419 Status403(models::GenericError),
420 UnknownValue(serde_json::Value),
421}
422
423#[derive(Debug, Clone, Serialize, Deserialize)]
425#[serde(untagged)]
426pub enum EndpointsDevicesRetrieveError {
427 Status400(models::ValidationError),
428 Status403(models::GenericError),
429 UnknownValue(serde_json::Value),
430}
431
432#[derive(Debug, Clone, Serialize, Deserialize)]
434#[serde(untagged)]
435pub enum EndpointsDevicesSummaryRetrieveError {
436 Status400(models::ValidationError),
437 Status403(models::GenericError),
438 UnknownValue(serde_json::Value),
439}
440
441#[derive(Debug, Clone, Serialize, Deserialize)]
443#[serde(untagged)]
444pub enum EndpointsDevicesUpdateError {
445 Status400(models::ValidationError),
446 Status403(models::GenericError),
447 UnknownValue(serde_json::Value),
448}
449
450#[derive(Debug, Clone, Serialize, Deserialize)]
452#[serde(untagged)]
453pub enum EndpointsDevicesUsedByListError {
454 Status400(models::ValidationError),
455 Status403(models::GenericError),
456 UnknownValue(serde_json::Value),
457}
458
459pub async fn endpoints_agents_connectors_agent_config_retrieve(
461 configuration: &configuration::Configuration,
462) -> Result<models::AgentConfig, Error<EndpointsAgentsConnectorsAgentConfigRetrieveError>> {
463 let uri_str = format!("{}/endpoints/agents/connectors/agent_config/", configuration.base_path);
464 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
465
466 if let Some(ref user_agent) = configuration.user_agent {
467 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
468 }
469
470 let req = req_builder.build()?;
471 let resp = configuration.client.execute(req).await?;
472
473 let status = resp.status();
474 let content_type = resp
475 .headers()
476 .get("content-type")
477 .and_then(|v| v.to_str().ok())
478 .unwrap_or("application/octet-stream");
479 let content_type = super::ContentType::from(content_type);
480
481 if !status.is_client_error() && !status.is_server_error() {
482 let content = resp.text().await?;
483 match content_type {
484 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
485 ContentType::Text => {
486 return Err(Error::from(serde_json::Error::custom(
487 "Received `text/plain` content type response that cannot be converted to `models::AgentConfig`",
488 )))
489 }
490 ContentType::Unsupported(unknown_type) => {
491 return Err(Error::from(serde_json::Error::custom(format!(
492 "Received `{unknown_type}` content type response that cannot be converted to `models::AgentConfig`"
493 ))))
494 }
495 }
496 } else {
497 let content = resp.text().await?;
498 let entity: Option<EndpointsAgentsConnectorsAgentConfigRetrieveError> = serde_json::from_str(&content).ok();
499 Err(Error::ResponseError(ResponseContent {
500 status,
501 content,
502 entity,
503 }))
504 }
505}
506
507pub async fn endpoints_agents_connectors_auth_fed_create(
509 configuration: &configuration::Configuration,
510 device: &str,
511) -> Result<models::AgentTokenResponse, Error<EndpointsAgentsConnectorsAuthFedCreateError>> {
512 let p_query_device = device;
514
515 let uri_str = format!("{}/endpoints/agents/connectors/auth_fed/", configuration.base_path);
516 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
517
518 req_builder = req_builder.query(&[("device", &p_query_device.to_string())]);
519 if let Some(ref user_agent) = configuration.user_agent {
520 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
521 }
522
523 let req = req_builder.build()?;
524 let resp = configuration.client.execute(req).await?;
525
526 let status = resp.status();
527 let content_type = resp
528 .headers()
529 .get("content-type")
530 .and_then(|v| v.to_str().ok())
531 .unwrap_or("application/octet-stream");
532 let content_type = super::ContentType::from(content_type);
533
534 if !status.is_client_error() && !status.is_server_error() {
535 let content = resp.text().await?;
536 match content_type {
537 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
538 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AgentTokenResponse`"))),
539 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::AgentTokenResponse`")))),
540 }
541 } else {
542 let content = resp.text().await?;
543 let entity: Option<EndpointsAgentsConnectorsAuthFedCreateError> = serde_json::from_str(&content).ok();
544 Err(Error::ResponseError(ResponseContent {
545 status,
546 content,
547 entity,
548 }))
549 }
550}
551
552pub async fn endpoints_agents_connectors_auth_ia_create(
554 configuration: &configuration::Configuration,
555) -> Result<models::AgentAuthenticationResponse, Error<EndpointsAgentsConnectorsAuthIaCreateError>> {
556 let uri_str = format!("{}/endpoints/agents/connectors/auth_ia/", configuration.base_path);
557 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
558
559 if let Some(ref user_agent) = configuration.user_agent {
560 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
561 }
562
563 let req = req_builder.build()?;
564 let resp = configuration.client.execute(req).await?;
565
566 let status = resp.status();
567 let content_type = resp
568 .headers()
569 .get("content-type")
570 .and_then(|v| v.to_str().ok())
571 .unwrap_or("application/octet-stream");
572 let content_type = super::ContentType::from(content_type);
573
574 if !status.is_client_error() && !status.is_server_error() {
575 let content = resp.text().await?;
576 match content_type {
577 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
578 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AgentAuthenticationResponse`"))),
579 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::AgentAuthenticationResponse`")))),
580 }
581 } else {
582 let content = resp.text().await?;
583 let entity: Option<EndpointsAgentsConnectorsAuthIaCreateError> = serde_json::from_str(&content).ok();
584 Err(Error::ResponseError(ResponseContent {
585 status,
586 content,
587 entity,
588 }))
589 }
590}
591
592pub async fn endpoints_agents_connectors_check_in_create(
594 configuration: &configuration::Configuration,
595 device_facts_request: Option<models::DeviceFactsRequest>,
596) -> Result<(), Error<EndpointsAgentsConnectorsCheckInCreateError>> {
597 let p_body_device_facts_request = device_facts_request;
599
600 let uri_str = format!("{}/endpoints/agents/connectors/check_in/", configuration.base_path);
601 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
602
603 if let Some(ref user_agent) = configuration.user_agent {
604 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
605 }
606 req_builder = req_builder.json(&p_body_device_facts_request);
607
608 let req = req_builder.build()?;
609 let resp = configuration.client.execute(req).await?;
610
611 let status = resp.status();
612
613 if !status.is_client_error() && !status.is_server_error() {
614 Ok(())
615 } else {
616 let content = resp.text().await?;
617 let entity: Option<EndpointsAgentsConnectorsCheckInCreateError> = serde_json::from_str(&content).ok();
618 Err(Error::ResponseError(ResponseContent {
619 status,
620 content,
621 entity,
622 }))
623 }
624}
625
626pub async fn endpoints_agents_connectors_create(
628 configuration: &configuration::Configuration,
629 agent_connector_request: models::AgentConnectorRequest,
630) -> Result<models::AgentConnector, Error<EndpointsAgentsConnectorsCreateError>> {
631 let p_body_agent_connector_request = agent_connector_request;
633
634 let uri_str = format!("{}/endpoints/agents/connectors/", configuration.base_path);
635 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
636
637 if let Some(ref user_agent) = configuration.user_agent {
638 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
639 }
640 if let Some(ref token) = configuration.bearer_access_token {
641 req_builder = req_builder.bearer_auth(token.to_owned());
642 };
643 req_builder = req_builder.json(&p_body_agent_connector_request);
644
645 let req = req_builder.build()?;
646 let resp = configuration.client.execute(req).await?;
647
648 let status = resp.status();
649 let content_type = resp
650 .headers()
651 .get("content-type")
652 .and_then(|v| v.to_str().ok())
653 .unwrap_or("application/octet-stream");
654 let content_type = super::ContentType::from(content_type);
655
656 if !status.is_client_error() && !status.is_server_error() {
657 let content = resp.text().await?;
658 match content_type {
659 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
660 ContentType::Text => {
661 return Err(Error::from(serde_json::Error::custom(
662 "Received `text/plain` content type response that cannot be converted to `models::AgentConnector`",
663 )))
664 }
665 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
666 "Received `{unknown_type}` content type response that cannot be converted to `models::AgentConnector`"
667 )))),
668 }
669 } else {
670 let content = resp.text().await?;
671 let entity: Option<EndpointsAgentsConnectorsCreateError> = serde_json::from_str(&content).ok();
672 Err(Error::ResponseError(ResponseContent {
673 status,
674 content,
675 entity,
676 }))
677 }
678}
679
680pub async fn endpoints_agents_connectors_destroy(
682 configuration: &configuration::Configuration,
683 connector_uuid: &str,
684) -> Result<(), Error<EndpointsAgentsConnectorsDestroyError>> {
685 let p_path_connector_uuid = connector_uuid;
687
688 let uri_str = format!(
689 "{}/endpoints/agents/connectors/{connector_uuid}/",
690 configuration.base_path,
691 connector_uuid = crate::apis::urlencode(p_path_connector_uuid)
692 );
693 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
694
695 if let Some(ref user_agent) = configuration.user_agent {
696 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
697 }
698 if let Some(ref token) = configuration.bearer_access_token {
699 req_builder = req_builder.bearer_auth(token.to_owned());
700 };
701
702 let req = req_builder.build()?;
703 let resp = configuration.client.execute(req).await?;
704
705 let status = resp.status();
706
707 if !status.is_client_error() && !status.is_server_error() {
708 Ok(())
709 } else {
710 let content = resp.text().await?;
711 let entity: Option<EndpointsAgentsConnectorsDestroyError> = serde_json::from_str(&content).ok();
712 Err(Error::ResponseError(ResponseContent {
713 status,
714 content,
715 entity,
716 }))
717 }
718}
719
720pub async fn endpoints_agents_connectors_enroll_create(
722 configuration: &configuration::Configuration,
723 enroll_request: models::EnrollRequest,
724) -> Result<models::AgentTokenResponse, Error<EndpointsAgentsConnectorsEnrollCreateError>> {
725 let p_body_enroll_request = enroll_request;
727
728 let uri_str = format!("{}/endpoints/agents/connectors/enroll/", configuration.base_path);
729 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
730
731 if let Some(ref user_agent) = configuration.user_agent {
732 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
733 }
734 req_builder = req_builder.json(&p_body_enroll_request);
735
736 let req = req_builder.build()?;
737 let resp = configuration.client.execute(req).await?;
738
739 let status = resp.status();
740 let content_type = resp
741 .headers()
742 .get("content-type")
743 .and_then(|v| v.to_str().ok())
744 .unwrap_or("application/octet-stream");
745 let content_type = super::ContentType::from(content_type);
746
747 if !status.is_client_error() && !status.is_server_error() {
748 let content = resp.text().await?;
749 match content_type {
750 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
751 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AgentTokenResponse`"))),
752 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::AgentTokenResponse`")))),
753 }
754 } else {
755 let content = resp.text().await?;
756 let entity: Option<EndpointsAgentsConnectorsEnrollCreateError> = serde_json::from_str(&content).ok();
757 Err(Error::ResponseError(ResponseContent {
758 status,
759 content,
760 entity,
761 }))
762 }
763}
764
765pub async fn endpoints_agents_connectors_list(
767 configuration: &configuration::Configuration,
768 enabled: Option<bool>,
769 name: Option<&str>,
770 ordering: Option<&str>,
771 page: Option<i32>,
772 page_size: Option<i32>,
773 search: Option<&str>,
774) -> Result<models::PaginatedAgentConnectorList, Error<EndpointsAgentsConnectorsListError>> {
775 let p_query_enabled = enabled;
777 let p_query_name = name;
778 let p_query_ordering = ordering;
779 let p_query_page = page;
780 let p_query_page_size = page_size;
781 let p_query_search = search;
782
783 let uri_str = format!("{}/endpoints/agents/connectors/", configuration.base_path);
784 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
785
786 if let Some(ref param_value) = p_query_enabled {
787 req_builder = req_builder.query(&[("enabled", ¶m_value.to_string())]);
788 }
789 if let Some(ref param_value) = p_query_name {
790 req_builder = req_builder.query(&[("name", ¶m_value.to_string())]);
791 }
792 if let Some(ref param_value) = p_query_ordering {
793 req_builder = req_builder.query(&[("ordering", ¶m_value.to_string())]);
794 }
795 if let Some(ref param_value) = p_query_page {
796 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
797 }
798 if let Some(ref param_value) = p_query_page_size {
799 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
800 }
801 if let Some(ref param_value) = p_query_search {
802 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
803 }
804 if let Some(ref user_agent) = configuration.user_agent {
805 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
806 }
807 if let Some(ref token) = configuration.bearer_access_token {
808 req_builder = req_builder.bearer_auth(token.to_owned());
809 };
810
811 let req = req_builder.build()?;
812 let resp = configuration.client.execute(req).await?;
813
814 let status = resp.status();
815 let content_type = resp
816 .headers()
817 .get("content-type")
818 .and_then(|v| v.to_str().ok())
819 .unwrap_or("application/octet-stream");
820 let content_type = super::ContentType::from(content_type);
821
822 if !status.is_client_error() && !status.is_server_error() {
823 let content = resp.text().await?;
824 match content_type {
825 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
826 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedAgentConnectorList`"))),
827 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::PaginatedAgentConnectorList`")))),
828 }
829 } else {
830 let content = resp.text().await?;
831 let entity: Option<EndpointsAgentsConnectorsListError> = serde_json::from_str(&content).ok();
832 Err(Error::ResponseError(ResponseContent {
833 status,
834 content,
835 entity,
836 }))
837 }
838}
839
840pub async fn endpoints_agents_connectors_mdm_config_create(
842 configuration: &configuration::Configuration,
843 connector_uuid: &str,
844 mdm_config_request: models::MdmConfigRequest,
845) -> Result<models::MdmConfigResponse, Error<EndpointsAgentsConnectorsMdmConfigCreateError>> {
846 let p_path_connector_uuid = connector_uuid;
848 let p_body_mdm_config_request = mdm_config_request;
849
850 let uri_str = format!(
851 "{}/endpoints/agents/connectors/{connector_uuid}/mdm_config/",
852 configuration.base_path,
853 connector_uuid = crate::apis::urlencode(p_path_connector_uuid)
854 );
855 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
856
857 if let Some(ref user_agent) = configuration.user_agent {
858 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
859 }
860 if let Some(ref token) = configuration.bearer_access_token {
861 req_builder = req_builder.bearer_auth(token.to_owned());
862 };
863 req_builder = req_builder.json(&p_body_mdm_config_request);
864
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 => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::MdmConfigResponse`"))),
881 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::MdmConfigResponse`")))),
882 }
883 } else {
884 let content = resp.text().await?;
885 let entity: Option<EndpointsAgentsConnectorsMdmConfigCreateError> = serde_json::from_str(&content).ok();
886 Err(Error::ResponseError(ResponseContent {
887 status,
888 content,
889 entity,
890 }))
891 }
892}
893
894pub async fn endpoints_agents_connectors_partial_update(
896 configuration: &configuration::Configuration,
897 connector_uuid: &str,
898 patched_agent_connector_request: Option<models::PatchedAgentConnectorRequest>,
899) -> Result<models::AgentConnector, Error<EndpointsAgentsConnectorsPartialUpdateError>> {
900 let p_path_connector_uuid = connector_uuid;
902 let p_body_patched_agent_connector_request = patched_agent_connector_request;
903
904 let uri_str = format!(
905 "{}/endpoints/agents/connectors/{connector_uuid}/",
906 configuration.base_path,
907 connector_uuid = crate::apis::urlencode(p_path_connector_uuid)
908 );
909 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
910
911 if let Some(ref user_agent) = configuration.user_agent {
912 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
913 }
914 if let Some(ref token) = configuration.bearer_access_token {
915 req_builder = req_builder.bearer_auth(token.to_owned());
916 };
917 req_builder = req_builder.json(&p_body_patched_agent_connector_request);
918
919 let req = req_builder.build()?;
920 let resp = configuration.client.execute(req).await?;
921
922 let status = resp.status();
923 let content_type = resp
924 .headers()
925 .get("content-type")
926 .and_then(|v| v.to_str().ok())
927 .unwrap_or("application/octet-stream");
928 let content_type = super::ContentType::from(content_type);
929
930 if !status.is_client_error() && !status.is_server_error() {
931 let content = resp.text().await?;
932 match content_type {
933 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
934 ContentType::Text => {
935 return Err(Error::from(serde_json::Error::custom(
936 "Received `text/plain` content type response that cannot be converted to `models::AgentConnector`",
937 )))
938 }
939 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
940 "Received `{unknown_type}` content type response that cannot be converted to `models::AgentConnector`"
941 )))),
942 }
943 } else {
944 let content = resp.text().await?;
945 let entity: Option<EndpointsAgentsConnectorsPartialUpdateError> = serde_json::from_str(&content).ok();
946 Err(Error::ResponseError(ResponseContent {
947 status,
948 content,
949 entity,
950 }))
951 }
952}
953
954pub async fn endpoints_agents_connectors_retrieve(
956 configuration: &configuration::Configuration,
957 connector_uuid: &str,
958) -> Result<models::AgentConnector, Error<EndpointsAgentsConnectorsRetrieveError>> {
959 let p_path_connector_uuid = connector_uuid;
961
962 let uri_str = format!(
963 "{}/endpoints/agents/connectors/{connector_uuid}/",
964 configuration.base_path,
965 connector_uuid = crate::apis::urlencode(p_path_connector_uuid)
966 );
967 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
968
969 if let Some(ref user_agent) = configuration.user_agent {
970 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
971 }
972 if let Some(ref token) = configuration.bearer_access_token {
973 req_builder = req_builder.bearer_auth(token.to_owned());
974 };
975
976 let req = req_builder.build()?;
977 let resp = configuration.client.execute(req).await?;
978
979 let status = resp.status();
980 let content_type = resp
981 .headers()
982 .get("content-type")
983 .and_then(|v| v.to_str().ok())
984 .unwrap_or("application/octet-stream");
985 let content_type = super::ContentType::from(content_type);
986
987 if !status.is_client_error() && !status.is_server_error() {
988 let content = resp.text().await?;
989 match content_type {
990 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
991 ContentType::Text => {
992 return Err(Error::from(serde_json::Error::custom(
993 "Received `text/plain` content type response that cannot be converted to `models::AgentConnector`",
994 )))
995 }
996 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
997 "Received `{unknown_type}` content type response that cannot be converted to `models::AgentConnector`"
998 )))),
999 }
1000 } else {
1001 let content = resp.text().await?;
1002 let entity: Option<EndpointsAgentsConnectorsRetrieveError> = serde_json::from_str(&content).ok();
1003 Err(Error::ResponseError(ResponseContent {
1004 status,
1005 content,
1006 entity,
1007 }))
1008 }
1009}
1010
1011pub async fn endpoints_agents_connectors_update(
1013 configuration: &configuration::Configuration,
1014 connector_uuid: &str,
1015 agent_connector_request: models::AgentConnectorRequest,
1016) -> Result<models::AgentConnector, Error<EndpointsAgentsConnectorsUpdateError>> {
1017 let p_path_connector_uuid = connector_uuid;
1019 let p_body_agent_connector_request = agent_connector_request;
1020
1021 let uri_str = format!(
1022 "{}/endpoints/agents/connectors/{connector_uuid}/",
1023 configuration.base_path,
1024 connector_uuid = crate::apis::urlencode(p_path_connector_uuid)
1025 );
1026 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1027
1028 if let Some(ref user_agent) = configuration.user_agent {
1029 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1030 }
1031 if let Some(ref token) = configuration.bearer_access_token {
1032 req_builder = req_builder.bearer_auth(token.to_owned());
1033 };
1034 req_builder = req_builder.json(&p_body_agent_connector_request);
1035
1036 let req = req_builder.build()?;
1037 let resp = configuration.client.execute(req).await?;
1038
1039 let status = resp.status();
1040 let content_type = resp
1041 .headers()
1042 .get("content-type")
1043 .and_then(|v| v.to_str().ok())
1044 .unwrap_or("application/octet-stream");
1045 let content_type = super::ContentType::from(content_type);
1046
1047 if !status.is_client_error() && !status.is_server_error() {
1048 let content = resp.text().await?;
1049 match content_type {
1050 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1051 ContentType::Text => {
1052 return Err(Error::from(serde_json::Error::custom(
1053 "Received `text/plain` content type response that cannot be converted to `models::AgentConnector`",
1054 )))
1055 }
1056 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
1057 "Received `{unknown_type}` content type response that cannot be converted to `models::AgentConnector`"
1058 )))),
1059 }
1060 } else {
1061 let content = resp.text().await?;
1062 let entity: Option<EndpointsAgentsConnectorsUpdateError> = serde_json::from_str(&content).ok();
1063 Err(Error::ResponseError(ResponseContent {
1064 status,
1065 content,
1066 entity,
1067 }))
1068 }
1069}
1070
1071pub async fn endpoints_agents_connectors_used_by_list(
1073 configuration: &configuration::Configuration,
1074 connector_uuid: &str,
1075) -> Result<Vec<models::UsedBy>, Error<EndpointsAgentsConnectorsUsedByListError>> {
1076 let p_path_connector_uuid = connector_uuid;
1078
1079 let uri_str = format!(
1080 "{}/endpoints/agents/connectors/{connector_uuid}/used_by/",
1081 configuration.base_path,
1082 connector_uuid = crate::apis::urlencode(p_path_connector_uuid)
1083 );
1084 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1085
1086 if let Some(ref user_agent) = configuration.user_agent {
1087 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1088 }
1089 if let Some(ref token) = configuration.bearer_access_token {
1090 req_builder = req_builder.bearer_auth(token.to_owned());
1091 };
1092
1093 let req = req_builder.build()?;
1094 let resp = configuration.client.execute(req).await?;
1095
1096 let status = resp.status();
1097 let content_type = resp
1098 .headers()
1099 .get("content-type")
1100 .and_then(|v| v.to_str().ok())
1101 .unwrap_or("application/octet-stream");
1102 let content_type = super::ContentType::from(content_type);
1103
1104 if !status.is_client_error() && !status.is_server_error() {
1105 let content = resp.text().await?;
1106 match content_type {
1107 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1108 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::UsedBy>`"))),
1109 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::UsedBy>`")))),
1110 }
1111 } else {
1112 let content = resp.text().await?;
1113 let entity: Option<EndpointsAgentsConnectorsUsedByListError> = serde_json::from_str(&content).ok();
1114 Err(Error::ResponseError(ResponseContent {
1115 status,
1116 content,
1117 entity,
1118 }))
1119 }
1120}
1121
1122pub async fn endpoints_agents_enrollment_tokens_create(
1124 configuration: &configuration::Configuration,
1125 enrollment_token_request: models::EnrollmentTokenRequest,
1126) -> Result<models::EnrollmentToken, Error<EndpointsAgentsEnrollmentTokensCreateError>> {
1127 let p_body_enrollment_token_request = enrollment_token_request;
1129
1130 let uri_str = format!("{}/endpoints/agents/enrollment_tokens/", configuration.base_path);
1131 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1132
1133 if let Some(ref user_agent) = configuration.user_agent {
1134 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1135 }
1136 if let Some(ref token) = configuration.bearer_access_token {
1137 req_builder = req_builder.bearer_auth(token.to_owned());
1138 };
1139 req_builder = req_builder.json(&p_body_enrollment_token_request);
1140
1141 let req = req_builder.build()?;
1142 let resp = configuration.client.execute(req).await?;
1143
1144 let status = resp.status();
1145 let content_type = resp
1146 .headers()
1147 .get("content-type")
1148 .and_then(|v| v.to_str().ok())
1149 .unwrap_or("application/octet-stream");
1150 let content_type = super::ContentType::from(content_type);
1151
1152 if !status.is_client_error() && !status.is_server_error() {
1153 let content = resp.text().await?;
1154 match content_type {
1155 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1156 ContentType::Text => {
1157 return Err(Error::from(serde_json::Error::custom(
1158 "Received `text/plain` content type response that cannot be converted to `models::EnrollmentToken`",
1159 )))
1160 }
1161 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
1162 "Received `{unknown_type}` content type response that cannot be converted to `models::EnrollmentToken`"
1163 )))),
1164 }
1165 } else {
1166 let content = resp.text().await?;
1167 let entity: Option<EndpointsAgentsEnrollmentTokensCreateError> = serde_json::from_str(&content).ok();
1168 Err(Error::ResponseError(ResponseContent {
1169 status,
1170 content,
1171 entity,
1172 }))
1173 }
1174}
1175
1176pub async fn endpoints_agents_enrollment_tokens_destroy(
1178 configuration: &configuration::Configuration,
1179 token_uuid: &str,
1180) -> Result<(), Error<EndpointsAgentsEnrollmentTokensDestroyError>> {
1181 let p_path_token_uuid = token_uuid;
1183
1184 let uri_str = format!(
1185 "{}/endpoints/agents/enrollment_tokens/{token_uuid}/",
1186 configuration.base_path,
1187 token_uuid = crate::apis::urlencode(p_path_token_uuid)
1188 );
1189 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
1190
1191 if let Some(ref user_agent) = configuration.user_agent {
1192 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1193 }
1194 if let Some(ref token) = configuration.bearer_access_token {
1195 req_builder = req_builder.bearer_auth(token.to_owned());
1196 };
1197
1198 let req = req_builder.build()?;
1199 let resp = configuration.client.execute(req).await?;
1200
1201 let status = resp.status();
1202
1203 if !status.is_client_error() && !status.is_server_error() {
1204 Ok(())
1205 } else {
1206 let content = resp.text().await?;
1207 let entity: Option<EndpointsAgentsEnrollmentTokensDestroyError> = serde_json::from_str(&content).ok();
1208 Err(Error::ResponseError(ResponseContent {
1209 status,
1210 content,
1211 entity,
1212 }))
1213 }
1214}
1215
1216pub async fn endpoints_agents_enrollment_tokens_list(
1218 configuration: &configuration::Configuration,
1219 connector: Option<&str>,
1220 ordering: Option<&str>,
1221 page: Option<i32>,
1222 page_size: Option<i32>,
1223 search: Option<&str>,
1224 token_uuid: Option<&str>,
1225) -> Result<models::PaginatedEnrollmentTokenList, Error<EndpointsAgentsEnrollmentTokensListError>> {
1226 let p_query_connector = connector;
1228 let p_query_ordering = ordering;
1229 let p_query_page = page;
1230 let p_query_page_size = page_size;
1231 let p_query_search = search;
1232 let p_query_token_uuid = token_uuid;
1233
1234 let uri_str = format!("{}/endpoints/agents/enrollment_tokens/", configuration.base_path);
1235 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1236
1237 if let Some(ref param_value) = p_query_connector {
1238 req_builder = req_builder.query(&[("connector", ¶m_value.to_string())]);
1239 }
1240 if let Some(ref param_value) = p_query_ordering {
1241 req_builder = req_builder.query(&[("ordering", ¶m_value.to_string())]);
1242 }
1243 if let Some(ref param_value) = p_query_page {
1244 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
1245 }
1246 if let Some(ref param_value) = p_query_page_size {
1247 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
1248 }
1249 if let Some(ref param_value) = p_query_search {
1250 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
1251 }
1252 if let Some(ref param_value) = p_query_token_uuid {
1253 req_builder = req_builder.query(&[("token_uuid", ¶m_value.to_string())]);
1254 }
1255 if let Some(ref user_agent) = configuration.user_agent {
1256 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1257 }
1258 if let Some(ref token) = configuration.bearer_access_token {
1259 req_builder = req_builder.bearer_auth(token.to_owned());
1260 };
1261
1262 let req = req_builder.build()?;
1263 let resp = configuration.client.execute(req).await?;
1264
1265 let status = resp.status();
1266 let content_type = resp
1267 .headers()
1268 .get("content-type")
1269 .and_then(|v| v.to_str().ok())
1270 .unwrap_or("application/octet-stream");
1271 let content_type = super::ContentType::from(content_type);
1272
1273 if !status.is_client_error() && !status.is_server_error() {
1274 let content = resp.text().await?;
1275 match content_type {
1276 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1277 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedEnrollmentTokenList`"))),
1278 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::PaginatedEnrollmentTokenList`")))),
1279 }
1280 } else {
1281 let content = resp.text().await?;
1282 let entity: Option<EndpointsAgentsEnrollmentTokensListError> = serde_json::from_str(&content).ok();
1283 Err(Error::ResponseError(ResponseContent {
1284 status,
1285 content,
1286 entity,
1287 }))
1288 }
1289}
1290
1291pub async fn endpoints_agents_enrollment_tokens_partial_update(
1293 configuration: &configuration::Configuration,
1294 token_uuid: &str,
1295 patched_enrollment_token_request: Option<models::PatchedEnrollmentTokenRequest>,
1296) -> Result<models::EnrollmentToken, Error<EndpointsAgentsEnrollmentTokensPartialUpdateError>> {
1297 let p_path_token_uuid = token_uuid;
1299 let p_body_patched_enrollment_token_request = patched_enrollment_token_request;
1300
1301 let uri_str = format!(
1302 "{}/endpoints/agents/enrollment_tokens/{token_uuid}/",
1303 configuration.base_path,
1304 token_uuid = crate::apis::urlencode(p_path_token_uuid)
1305 );
1306 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
1307
1308 if let Some(ref user_agent) = configuration.user_agent {
1309 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1310 }
1311 if let Some(ref token) = configuration.bearer_access_token {
1312 req_builder = req_builder.bearer_auth(token.to_owned());
1313 };
1314 req_builder = req_builder.json(&p_body_patched_enrollment_token_request);
1315
1316 let req = req_builder.build()?;
1317 let resp = configuration.client.execute(req).await?;
1318
1319 let status = resp.status();
1320 let content_type = resp
1321 .headers()
1322 .get("content-type")
1323 .and_then(|v| v.to_str().ok())
1324 .unwrap_or("application/octet-stream");
1325 let content_type = super::ContentType::from(content_type);
1326
1327 if !status.is_client_error() && !status.is_server_error() {
1328 let content = resp.text().await?;
1329 match content_type {
1330 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1331 ContentType::Text => {
1332 return Err(Error::from(serde_json::Error::custom(
1333 "Received `text/plain` content type response that cannot be converted to `models::EnrollmentToken`",
1334 )))
1335 }
1336 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
1337 "Received `{unknown_type}` content type response that cannot be converted to `models::EnrollmentToken`"
1338 )))),
1339 }
1340 } else {
1341 let content = resp.text().await?;
1342 let entity: Option<EndpointsAgentsEnrollmentTokensPartialUpdateError> = serde_json::from_str(&content).ok();
1343 Err(Error::ResponseError(ResponseContent {
1344 status,
1345 content,
1346 entity,
1347 }))
1348 }
1349}
1350
1351pub async fn endpoints_agents_enrollment_tokens_retrieve(
1353 configuration: &configuration::Configuration,
1354 token_uuid: &str,
1355) -> Result<models::EnrollmentToken, Error<EndpointsAgentsEnrollmentTokensRetrieveError>> {
1356 let p_path_token_uuid = token_uuid;
1358
1359 let uri_str = format!(
1360 "{}/endpoints/agents/enrollment_tokens/{token_uuid}/",
1361 configuration.base_path,
1362 token_uuid = crate::apis::urlencode(p_path_token_uuid)
1363 );
1364 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1365
1366 if let Some(ref user_agent) = configuration.user_agent {
1367 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1368 }
1369 if let Some(ref token) = configuration.bearer_access_token {
1370 req_builder = req_builder.bearer_auth(token.to_owned());
1371 };
1372
1373 let req = req_builder.build()?;
1374 let resp = configuration.client.execute(req).await?;
1375
1376 let status = resp.status();
1377 let content_type = resp
1378 .headers()
1379 .get("content-type")
1380 .and_then(|v| v.to_str().ok())
1381 .unwrap_or("application/octet-stream");
1382 let content_type = super::ContentType::from(content_type);
1383
1384 if !status.is_client_error() && !status.is_server_error() {
1385 let content = resp.text().await?;
1386 match content_type {
1387 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1388 ContentType::Text => {
1389 return Err(Error::from(serde_json::Error::custom(
1390 "Received `text/plain` content type response that cannot be converted to `models::EnrollmentToken`",
1391 )))
1392 }
1393 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
1394 "Received `{unknown_type}` content type response that cannot be converted to `models::EnrollmentToken`"
1395 )))),
1396 }
1397 } else {
1398 let content = resp.text().await?;
1399 let entity: Option<EndpointsAgentsEnrollmentTokensRetrieveError> = serde_json::from_str(&content).ok();
1400 Err(Error::ResponseError(ResponseContent {
1401 status,
1402 content,
1403 entity,
1404 }))
1405 }
1406}
1407
1408pub async fn endpoints_agents_enrollment_tokens_update(
1410 configuration: &configuration::Configuration,
1411 token_uuid: &str,
1412 enrollment_token_request: models::EnrollmentTokenRequest,
1413) -> Result<models::EnrollmentToken, Error<EndpointsAgentsEnrollmentTokensUpdateError>> {
1414 let p_path_token_uuid = token_uuid;
1416 let p_body_enrollment_token_request = enrollment_token_request;
1417
1418 let uri_str = format!(
1419 "{}/endpoints/agents/enrollment_tokens/{token_uuid}/",
1420 configuration.base_path,
1421 token_uuid = crate::apis::urlencode(p_path_token_uuid)
1422 );
1423 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1424
1425 if let Some(ref user_agent) = configuration.user_agent {
1426 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1427 }
1428 if let Some(ref token) = configuration.bearer_access_token {
1429 req_builder = req_builder.bearer_auth(token.to_owned());
1430 };
1431 req_builder = req_builder.json(&p_body_enrollment_token_request);
1432
1433 let req = req_builder.build()?;
1434 let resp = configuration.client.execute(req).await?;
1435
1436 let status = resp.status();
1437 let content_type = resp
1438 .headers()
1439 .get("content-type")
1440 .and_then(|v| v.to_str().ok())
1441 .unwrap_or("application/octet-stream");
1442 let content_type = super::ContentType::from(content_type);
1443
1444 if !status.is_client_error() && !status.is_server_error() {
1445 let content = resp.text().await?;
1446 match content_type {
1447 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1448 ContentType::Text => {
1449 return Err(Error::from(serde_json::Error::custom(
1450 "Received `text/plain` content type response that cannot be converted to `models::EnrollmentToken`",
1451 )))
1452 }
1453 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
1454 "Received `{unknown_type}` content type response that cannot be converted to `models::EnrollmentToken`"
1455 )))),
1456 }
1457 } else {
1458 let content = resp.text().await?;
1459 let entity: Option<EndpointsAgentsEnrollmentTokensUpdateError> = serde_json::from_str(&content).ok();
1460 Err(Error::ResponseError(ResponseContent {
1461 status,
1462 content,
1463 entity,
1464 }))
1465 }
1466}
1467
1468pub async fn endpoints_agents_enrollment_tokens_used_by_list(
1470 configuration: &configuration::Configuration,
1471 token_uuid: &str,
1472) -> Result<Vec<models::UsedBy>, Error<EndpointsAgentsEnrollmentTokensUsedByListError>> {
1473 let p_path_token_uuid = token_uuid;
1475
1476 let uri_str = format!(
1477 "{}/endpoints/agents/enrollment_tokens/{token_uuid}/used_by/",
1478 configuration.base_path,
1479 token_uuid = crate::apis::urlencode(p_path_token_uuid)
1480 );
1481 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1482
1483 if let Some(ref user_agent) = configuration.user_agent {
1484 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1485 }
1486 if let Some(ref token) = configuration.bearer_access_token {
1487 req_builder = req_builder.bearer_auth(token.to_owned());
1488 };
1489
1490 let req = req_builder.build()?;
1491 let resp = configuration.client.execute(req).await?;
1492
1493 let status = resp.status();
1494 let content_type = resp
1495 .headers()
1496 .get("content-type")
1497 .and_then(|v| v.to_str().ok())
1498 .unwrap_or("application/octet-stream");
1499 let content_type = super::ContentType::from(content_type);
1500
1501 if !status.is_client_error() && !status.is_server_error() {
1502 let content = resp.text().await?;
1503 match content_type {
1504 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1505 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::UsedBy>`"))),
1506 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::UsedBy>`")))),
1507 }
1508 } else {
1509 let content = resp.text().await?;
1510 let entity: Option<EndpointsAgentsEnrollmentTokensUsedByListError> = serde_json::from_str(&content).ok();
1511 Err(Error::ResponseError(ResponseContent {
1512 status,
1513 content,
1514 entity,
1515 }))
1516 }
1517}
1518
1519pub async fn endpoints_agents_enrollment_tokens_view_key_retrieve(
1521 configuration: &configuration::Configuration,
1522 token_uuid: &str,
1523) -> Result<models::TokenView, Error<EndpointsAgentsEnrollmentTokensViewKeyRetrieveError>> {
1524 let p_path_token_uuid = token_uuid;
1526
1527 let uri_str = format!(
1528 "{}/endpoints/agents/enrollment_tokens/{token_uuid}/view_key/",
1529 configuration.base_path,
1530 token_uuid = crate::apis::urlencode(p_path_token_uuid)
1531 );
1532 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1533
1534 if let Some(ref user_agent) = configuration.user_agent {
1535 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1536 }
1537 if let Some(ref token) = configuration.bearer_access_token {
1538 req_builder = req_builder.bearer_auth(token.to_owned());
1539 };
1540
1541 let req = req_builder.build()?;
1542 let resp = configuration.client.execute(req).await?;
1543
1544 let status = resp.status();
1545 let content_type = resp
1546 .headers()
1547 .get("content-type")
1548 .and_then(|v| v.to_str().ok())
1549 .unwrap_or("application/octet-stream");
1550 let content_type = super::ContentType::from(content_type);
1551
1552 if !status.is_client_error() && !status.is_server_error() {
1553 let content = resp.text().await?;
1554 match content_type {
1555 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1556 ContentType::Text => {
1557 return Err(Error::from(serde_json::Error::custom(
1558 "Received `text/plain` content type response that cannot be converted to `models::TokenView`",
1559 )))
1560 }
1561 ContentType::Unsupported(unknown_type) => {
1562 return Err(Error::from(serde_json::Error::custom(format!(
1563 "Received `{unknown_type}` content type response that cannot be converted to `models::TokenView`"
1564 ))))
1565 }
1566 }
1567 } else {
1568 let content = resp.text().await?;
1569 let entity: Option<EndpointsAgentsEnrollmentTokensViewKeyRetrieveError> = serde_json::from_str(&content).ok();
1570 Err(Error::ResponseError(ResponseContent {
1571 status,
1572 content,
1573 entity,
1574 }))
1575 }
1576}
1577
1578pub async fn endpoints_agents_psso_register_device_create(
1579 configuration: &configuration::Configuration,
1580 agent_psso_device_registration_request: models::AgentPssoDeviceRegistrationRequest,
1581) -> Result<models::AgentPssoDeviceRegistrationResponse, Error<EndpointsAgentsPssoRegisterDeviceCreateError>> {
1582 let p_body_agent_psso_device_registration_request = agent_psso_device_registration_request;
1584
1585 let uri_str = format!("{}/endpoints/agents/psso/register/device/", configuration.base_path);
1586 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1587
1588 if let Some(ref user_agent) = configuration.user_agent {
1589 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1590 }
1591 req_builder = req_builder.json(&p_body_agent_psso_device_registration_request);
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::AgentPssoDeviceRegistrationResponse`"))),
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::AgentPssoDeviceRegistrationResponse`")))),
1610 }
1611 } else {
1612 let content = resp.text().await?;
1613 let entity: Option<EndpointsAgentsPssoRegisterDeviceCreateError> = serde_json::from_str(&content).ok();
1614 Err(Error::ResponseError(ResponseContent {
1615 status,
1616 content,
1617 entity,
1618 }))
1619 }
1620}
1621
1622pub async fn endpoints_agents_psso_register_user_create(
1623 configuration: &configuration::Configuration,
1624 agent_psso_user_registration_request: models::AgentPssoUserRegistrationRequest,
1625) -> Result<models::UserSelf, Error<EndpointsAgentsPssoRegisterUserCreateError>> {
1626 let p_body_agent_psso_user_registration_request = agent_psso_user_registration_request;
1628
1629 let uri_str = format!("{}/endpoints/agents/psso/register/user/", configuration.base_path);
1630 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1631
1632 if let Some(ref user_agent) = configuration.user_agent {
1633 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1634 }
1635 req_builder = req_builder.json(&p_body_agent_psso_user_registration_request);
1636
1637 let req = req_builder.build()?;
1638 let resp = configuration.client.execute(req).await?;
1639
1640 let status = resp.status();
1641 let content_type = resp
1642 .headers()
1643 .get("content-type")
1644 .and_then(|v| v.to_str().ok())
1645 .unwrap_or("application/octet-stream");
1646 let content_type = super::ContentType::from(content_type);
1647
1648 if !status.is_client_error() && !status.is_server_error() {
1649 let content = resp.text().await?;
1650 match content_type {
1651 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1652 ContentType::Text => {
1653 return Err(Error::from(serde_json::Error::custom(
1654 "Received `text/plain` content type response that cannot be converted to `models::UserSelf`",
1655 )))
1656 }
1657 ContentType::Unsupported(unknown_type) => {
1658 return Err(Error::from(serde_json::Error::custom(format!(
1659 "Received `{unknown_type}` content type response that cannot be converted to `models::UserSelf`"
1660 ))))
1661 }
1662 }
1663 } else {
1664 let content = resp.text().await?;
1665 let entity: Option<EndpointsAgentsPssoRegisterUserCreateError> = serde_json::from_str(&content).ok();
1666 Err(Error::ResponseError(ResponseContent {
1667 status,
1668 content,
1669 entity,
1670 }))
1671 }
1672}
1673
1674pub async fn endpoints_connectors_destroy(
1676 configuration: &configuration::Configuration,
1677 connector_uuid: &str,
1678) -> Result<(), Error<EndpointsConnectorsDestroyError>> {
1679 let p_path_connector_uuid = connector_uuid;
1681
1682 let uri_str = format!(
1683 "{}/endpoints/connectors/{connector_uuid}/",
1684 configuration.base_path,
1685 connector_uuid = crate::apis::urlencode(p_path_connector_uuid)
1686 );
1687 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
1688
1689 if let Some(ref user_agent) = configuration.user_agent {
1690 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1691 }
1692 if let Some(ref token) = configuration.bearer_access_token {
1693 req_builder = req_builder.bearer_auth(token.to_owned());
1694 };
1695
1696 let req = req_builder.build()?;
1697 let resp = configuration.client.execute(req).await?;
1698
1699 let status = resp.status();
1700
1701 if !status.is_client_error() && !status.is_server_error() {
1702 Ok(())
1703 } else {
1704 let content = resp.text().await?;
1705 let entity: Option<EndpointsConnectorsDestroyError> = serde_json::from_str(&content).ok();
1706 Err(Error::ResponseError(ResponseContent {
1707 status,
1708 content,
1709 entity,
1710 }))
1711 }
1712}
1713
1714pub async fn endpoints_connectors_list(
1716 configuration: &configuration::Configuration,
1717 ordering: Option<&str>,
1718 page: Option<i32>,
1719 page_size: Option<i32>,
1720 search: Option<&str>,
1721) -> Result<models::PaginatedConnectorList, Error<EndpointsConnectorsListError>> {
1722 let p_query_ordering = ordering;
1724 let p_query_page = page;
1725 let p_query_page_size = page_size;
1726 let p_query_search = search;
1727
1728 let uri_str = format!("{}/endpoints/connectors/", configuration.base_path);
1729 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1730
1731 if let Some(ref param_value) = p_query_ordering {
1732 req_builder = req_builder.query(&[("ordering", ¶m_value.to_string())]);
1733 }
1734 if let Some(ref param_value) = p_query_page {
1735 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
1736 }
1737 if let Some(ref param_value) = p_query_page_size {
1738 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
1739 }
1740 if let Some(ref param_value) = p_query_search {
1741 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
1742 }
1743 if let Some(ref user_agent) = configuration.user_agent {
1744 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1745 }
1746 if let Some(ref token) = configuration.bearer_access_token {
1747 req_builder = req_builder.bearer_auth(token.to_owned());
1748 };
1749
1750 let req = req_builder.build()?;
1751 let resp = configuration.client.execute(req).await?;
1752
1753 let status = resp.status();
1754 let content_type = resp
1755 .headers()
1756 .get("content-type")
1757 .and_then(|v| v.to_str().ok())
1758 .unwrap_or("application/octet-stream");
1759 let content_type = super::ContentType::from(content_type);
1760
1761 if !status.is_client_error() && !status.is_server_error() {
1762 let content = resp.text().await?;
1763 match content_type {
1764 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1765 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedConnectorList`"))),
1766 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::PaginatedConnectorList`")))),
1767 }
1768 } else {
1769 let content = resp.text().await?;
1770 let entity: Option<EndpointsConnectorsListError> = serde_json::from_str(&content).ok();
1771 Err(Error::ResponseError(ResponseContent {
1772 status,
1773 content,
1774 entity,
1775 }))
1776 }
1777}
1778
1779pub async fn endpoints_connectors_retrieve(
1781 configuration: &configuration::Configuration,
1782 connector_uuid: &str,
1783) -> Result<models::Connector, Error<EndpointsConnectorsRetrieveError>> {
1784 let p_path_connector_uuid = connector_uuid;
1786
1787 let uri_str = format!(
1788 "{}/endpoints/connectors/{connector_uuid}/",
1789 configuration.base_path,
1790 connector_uuid = crate::apis::urlencode(p_path_connector_uuid)
1791 );
1792 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1793
1794 if let Some(ref user_agent) = configuration.user_agent {
1795 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1796 }
1797 if let Some(ref token) = configuration.bearer_access_token {
1798 req_builder = req_builder.bearer_auth(token.to_owned());
1799 };
1800
1801 let req = req_builder.build()?;
1802 let resp = configuration.client.execute(req).await?;
1803
1804 let status = resp.status();
1805 let content_type = resp
1806 .headers()
1807 .get("content-type")
1808 .and_then(|v| v.to_str().ok())
1809 .unwrap_or("application/octet-stream");
1810 let content_type = super::ContentType::from(content_type);
1811
1812 if !status.is_client_error() && !status.is_server_error() {
1813 let content = resp.text().await?;
1814 match content_type {
1815 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1816 ContentType::Text => {
1817 return Err(Error::from(serde_json::Error::custom(
1818 "Received `text/plain` content type response that cannot be converted to `models::Connector`",
1819 )))
1820 }
1821 ContentType::Unsupported(unknown_type) => {
1822 return Err(Error::from(serde_json::Error::custom(format!(
1823 "Received `{unknown_type}` content type response that cannot be converted to `models::Connector`"
1824 ))))
1825 }
1826 }
1827 } else {
1828 let content = resp.text().await?;
1829 let entity: Option<EndpointsConnectorsRetrieveError> = serde_json::from_str(&content).ok();
1830 Err(Error::ResponseError(ResponseContent {
1831 status,
1832 content,
1833 entity,
1834 }))
1835 }
1836}
1837
1838pub async fn endpoints_connectors_types_list(
1840 configuration: &configuration::Configuration,
1841) -> Result<Vec<models::TypeCreate>, Error<EndpointsConnectorsTypesListError>> {
1842 let uri_str = format!("{}/endpoints/connectors/types/", configuration.base_path);
1843 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1844
1845 if let Some(ref user_agent) = configuration.user_agent {
1846 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1847 }
1848 if let Some(ref token) = configuration.bearer_access_token {
1849 req_builder = req_builder.bearer_auth(token.to_owned());
1850 };
1851
1852 let req = req_builder.build()?;
1853 let resp = configuration.client.execute(req).await?;
1854
1855 let status = resp.status();
1856 let content_type = resp
1857 .headers()
1858 .get("content-type")
1859 .and_then(|v| v.to_str().ok())
1860 .unwrap_or("application/octet-stream");
1861 let content_type = super::ContentType::from(content_type);
1862
1863 if !status.is_client_error() && !status.is_server_error() {
1864 let content = resp.text().await?;
1865 match content_type {
1866 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1867 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::TypeCreate>`"))),
1868 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::TypeCreate>`")))),
1869 }
1870 } else {
1871 let content = resp.text().await?;
1872 let entity: Option<EndpointsConnectorsTypesListError> = serde_json::from_str(&content).ok();
1873 Err(Error::ResponseError(ResponseContent {
1874 status,
1875 content,
1876 entity,
1877 }))
1878 }
1879}
1880
1881pub async fn endpoints_connectors_used_by_list(
1883 configuration: &configuration::Configuration,
1884 connector_uuid: &str,
1885) -> Result<Vec<models::UsedBy>, Error<EndpointsConnectorsUsedByListError>> {
1886 let p_path_connector_uuid = connector_uuid;
1888
1889 let uri_str = format!(
1890 "{}/endpoints/connectors/{connector_uuid}/used_by/",
1891 configuration.base_path,
1892 connector_uuid = crate::apis::urlencode(p_path_connector_uuid)
1893 );
1894 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1895
1896 if let Some(ref user_agent) = configuration.user_agent {
1897 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1898 }
1899 if let Some(ref token) = configuration.bearer_access_token {
1900 req_builder = req_builder.bearer_auth(token.to_owned());
1901 };
1902
1903 let req = req_builder.build()?;
1904 let resp = configuration.client.execute(req).await?;
1905
1906 let status = resp.status();
1907 let content_type = resp
1908 .headers()
1909 .get("content-type")
1910 .and_then(|v| v.to_str().ok())
1911 .unwrap_or("application/octet-stream");
1912 let content_type = super::ContentType::from(content_type);
1913
1914 if !status.is_client_error() && !status.is_server_error() {
1915 let content = resp.text().await?;
1916 match content_type {
1917 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1918 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::UsedBy>`"))),
1919 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::UsedBy>`")))),
1920 }
1921 } else {
1922 let content = resp.text().await?;
1923 let entity: Option<EndpointsConnectorsUsedByListError> = serde_json::from_str(&content).ok();
1924 Err(Error::ResponseError(ResponseContent {
1925 status,
1926 content,
1927 entity,
1928 }))
1929 }
1930}
1931
1932pub async fn endpoints_device_access_groups_create(
1934 configuration: &configuration::Configuration,
1935 device_access_group_request: models::DeviceAccessGroupRequest,
1936) -> Result<models::DeviceAccessGroup, Error<EndpointsDeviceAccessGroupsCreateError>> {
1937 let p_body_device_access_group_request = device_access_group_request;
1939
1940 let uri_str = format!("{}/endpoints/device_access_groups/", configuration.base_path);
1941 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1942
1943 if let Some(ref user_agent) = configuration.user_agent {
1944 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1945 }
1946 if let Some(ref token) = configuration.bearer_access_token {
1947 req_builder = req_builder.bearer_auth(token.to_owned());
1948 };
1949 req_builder = req_builder.json(&p_body_device_access_group_request);
1950
1951 let req = req_builder.build()?;
1952 let resp = configuration.client.execute(req).await?;
1953
1954 let status = resp.status();
1955 let content_type = resp
1956 .headers()
1957 .get("content-type")
1958 .and_then(|v| v.to_str().ok())
1959 .unwrap_or("application/octet-stream");
1960 let content_type = super::ContentType::from(content_type);
1961
1962 if !status.is_client_error() && !status.is_server_error() {
1963 let content = resp.text().await?;
1964 match content_type {
1965 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1966 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeviceAccessGroup`"))),
1967 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::DeviceAccessGroup`")))),
1968 }
1969 } else {
1970 let content = resp.text().await?;
1971 let entity: Option<EndpointsDeviceAccessGroupsCreateError> = serde_json::from_str(&content).ok();
1972 Err(Error::ResponseError(ResponseContent {
1973 status,
1974 content,
1975 entity,
1976 }))
1977 }
1978}
1979
1980pub async fn endpoints_device_access_groups_destroy(
1982 configuration: &configuration::Configuration,
1983 pbm_uuid: &str,
1984) -> Result<(), Error<EndpointsDeviceAccessGroupsDestroyError>> {
1985 let p_path_pbm_uuid = pbm_uuid;
1987
1988 let uri_str = format!(
1989 "{}/endpoints/device_access_groups/{pbm_uuid}/",
1990 configuration.base_path,
1991 pbm_uuid = crate::apis::urlencode(p_path_pbm_uuid)
1992 );
1993 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
1994
1995 if let Some(ref user_agent) = configuration.user_agent {
1996 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1997 }
1998 if let Some(ref token) = configuration.bearer_access_token {
1999 req_builder = req_builder.bearer_auth(token.to_owned());
2000 };
2001
2002 let req = req_builder.build()?;
2003 let resp = configuration.client.execute(req).await?;
2004
2005 let status = resp.status();
2006
2007 if !status.is_client_error() && !status.is_server_error() {
2008 Ok(())
2009 } else {
2010 let content = resp.text().await?;
2011 let entity: Option<EndpointsDeviceAccessGroupsDestroyError> = serde_json::from_str(&content).ok();
2012 Err(Error::ResponseError(ResponseContent {
2013 status,
2014 content,
2015 entity,
2016 }))
2017 }
2018}
2019
2020pub async fn endpoints_device_access_groups_list(
2022 configuration: &configuration::Configuration,
2023 name: Option<&str>,
2024 ordering: Option<&str>,
2025 page: Option<i32>,
2026 page_size: Option<i32>,
2027 pbm_uuid: Option<&str>,
2028 search: Option<&str>,
2029) -> Result<models::PaginatedDeviceAccessGroupList, Error<EndpointsDeviceAccessGroupsListError>> {
2030 let p_query_name = name;
2032 let p_query_ordering = ordering;
2033 let p_query_page = page;
2034 let p_query_page_size = page_size;
2035 let p_query_pbm_uuid = pbm_uuid;
2036 let p_query_search = search;
2037
2038 let uri_str = format!("{}/endpoints/device_access_groups/", configuration.base_path);
2039 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2040
2041 if let Some(ref param_value) = p_query_name {
2042 req_builder = req_builder.query(&[("name", ¶m_value.to_string())]);
2043 }
2044 if let Some(ref param_value) = p_query_ordering {
2045 req_builder = req_builder.query(&[("ordering", ¶m_value.to_string())]);
2046 }
2047 if let Some(ref param_value) = p_query_page {
2048 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
2049 }
2050 if let Some(ref param_value) = p_query_page_size {
2051 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
2052 }
2053 if let Some(ref param_value) = p_query_pbm_uuid {
2054 req_builder = req_builder.query(&[("pbm_uuid", ¶m_value.to_string())]);
2055 }
2056 if let Some(ref param_value) = p_query_search {
2057 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
2058 }
2059 if let Some(ref user_agent) = configuration.user_agent {
2060 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2061 }
2062 if let Some(ref token) = configuration.bearer_access_token {
2063 req_builder = req_builder.bearer_auth(token.to_owned());
2064 };
2065
2066 let req = req_builder.build()?;
2067 let resp = configuration.client.execute(req).await?;
2068
2069 let status = resp.status();
2070 let content_type = resp
2071 .headers()
2072 .get("content-type")
2073 .and_then(|v| v.to_str().ok())
2074 .unwrap_or("application/octet-stream");
2075 let content_type = super::ContentType::from(content_type);
2076
2077 if !status.is_client_error() && !status.is_server_error() {
2078 let content = resp.text().await?;
2079 match content_type {
2080 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2081 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedDeviceAccessGroupList`"))),
2082 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::PaginatedDeviceAccessGroupList`")))),
2083 }
2084 } else {
2085 let content = resp.text().await?;
2086 let entity: Option<EndpointsDeviceAccessGroupsListError> = serde_json::from_str(&content).ok();
2087 Err(Error::ResponseError(ResponseContent {
2088 status,
2089 content,
2090 entity,
2091 }))
2092 }
2093}
2094
2095pub async fn endpoints_device_access_groups_partial_update(
2097 configuration: &configuration::Configuration,
2098 pbm_uuid: &str,
2099 patched_device_access_group_request: Option<models::PatchedDeviceAccessGroupRequest>,
2100) -> Result<models::DeviceAccessGroup, Error<EndpointsDeviceAccessGroupsPartialUpdateError>> {
2101 let p_path_pbm_uuid = pbm_uuid;
2103 let p_body_patched_device_access_group_request = patched_device_access_group_request;
2104
2105 let uri_str = format!(
2106 "{}/endpoints/device_access_groups/{pbm_uuid}/",
2107 configuration.base_path,
2108 pbm_uuid = crate::apis::urlencode(p_path_pbm_uuid)
2109 );
2110 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
2111
2112 if let Some(ref user_agent) = configuration.user_agent {
2113 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2114 }
2115 if let Some(ref token) = configuration.bearer_access_token {
2116 req_builder = req_builder.bearer_auth(token.to_owned());
2117 };
2118 req_builder = req_builder.json(&p_body_patched_device_access_group_request);
2119
2120 let req = req_builder.build()?;
2121 let resp = configuration.client.execute(req).await?;
2122
2123 let status = resp.status();
2124 let content_type = resp
2125 .headers()
2126 .get("content-type")
2127 .and_then(|v| v.to_str().ok())
2128 .unwrap_or("application/octet-stream");
2129 let content_type = super::ContentType::from(content_type);
2130
2131 if !status.is_client_error() && !status.is_server_error() {
2132 let content = resp.text().await?;
2133 match content_type {
2134 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2135 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeviceAccessGroup`"))),
2136 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::DeviceAccessGroup`")))),
2137 }
2138 } else {
2139 let content = resp.text().await?;
2140 let entity: Option<EndpointsDeviceAccessGroupsPartialUpdateError> = serde_json::from_str(&content).ok();
2141 Err(Error::ResponseError(ResponseContent {
2142 status,
2143 content,
2144 entity,
2145 }))
2146 }
2147}
2148
2149pub async fn endpoints_device_access_groups_retrieve(
2151 configuration: &configuration::Configuration,
2152 pbm_uuid: &str,
2153) -> Result<models::DeviceAccessGroup, Error<EndpointsDeviceAccessGroupsRetrieveError>> {
2154 let p_path_pbm_uuid = pbm_uuid;
2156
2157 let uri_str = format!(
2158 "{}/endpoints/device_access_groups/{pbm_uuid}/",
2159 configuration.base_path,
2160 pbm_uuid = crate::apis::urlencode(p_path_pbm_uuid)
2161 );
2162 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2163
2164 if let Some(ref user_agent) = configuration.user_agent {
2165 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2166 }
2167 if let Some(ref token) = configuration.bearer_access_token {
2168 req_builder = req_builder.bearer_auth(token.to_owned());
2169 };
2170
2171 let req = req_builder.build()?;
2172 let resp = configuration.client.execute(req).await?;
2173
2174 let status = resp.status();
2175 let content_type = resp
2176 .headers()
2177 .get("content-type")
2178 .and_then(|v| v.to_str().ok())
2179 .unwrap_or("application/octet-stream");
2180 let content_type = super::ContentType::from(content_type);
2181
2182 if !status.is_client_error() && !status.is_server_error() {
2183 let content = resp.text().await?;
2184 match content_type {
2185 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2186 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeviceAccessGroup`"))),
2187 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::DeviceAccessGroup`")))),
2188 }
2189 } else {
2190 let content = resp.text().await?;
2191 let entity: Option<EndpointsDeviceAccessGroupsRetrieveError> = serde_json::from_str(&content).ok();
2192 Err(Error::ResponseError(ResponseContent {
2193 status,
2194 content,
2195 entity,
2196 }))
2197 }
2198}
2199
2200pub async fn endpoints_device_access_groups_update(
2202 configuration: &configuration::Configuration,
2203 pbm_uuid: &str,
2204 device_access_group_request: models::DeviceAccessGroupRequest,
2205) -> Result<models::DeviceAccessGroup, Error<EndpointsDeviceAccessGroupsUpdateError>> {
2206 let p_path_pbm_uuid = pbm_uuid;
2208 let p_body_device_access_group_request = device_access_group_request;
2209
2210 let uri_str = format!(
2211 "{}/endpoints/device_access_groups/{pbm_uuid}/",
2212 configuration.base_path,
2213 pbm_uuid = crate::apis::urlencode(p_path_pbm_uuid)
2214 );
2215 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
2216
2217 if let Some(ref user_agent) = configuration.user_agent {
2218 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2219 }
2220 if let Some(ref token) = configuration.bearer_access_token {
2221 req_builder = req_builder.bearer_auth(token.to_owned());
2222 };
2223 req_builder = req_builder.json(&p_body_device_access_group_request);
2224
2225 let req = req_builder.build()?;
2226 let resp = configuration.client.execute(req).await?;
2227
2228 let status = resp.status();
2229 let content_type = resp
2230 .headers()
2231 .get("content-type")
2232 .and_then(|v| v.to_str().ok())
2233 .unwrap_or("application/octet-stream");
2234 let content_type = super::ContentType::from(content_type);
2235
2236 if !status.is_client_error() && !status.is_server_error() {
2237 let content = resp.text().await?;
2238 match content_type {
2239 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2240 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeviceAccessGroup`"))),
2241 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::DeviceAccessGroup`")))),
2242 }
2243 } else {
2244 let content = resp.text().await?;
2245 let entity: Option<EndpointsDeviceAccessGroupsUpdateError> = serde_json::from_str(&content).ok();
2246 Err(Error::ResponseError(ResponseContent {
2247 status,
2248 content,
2249 entity,
2250 }))
2251 }
2252}
2253
2254pub async fn endpoints_device_access_groups_used_by_list(
2256 configuration: &configuration::Configuration,
2257 pbm_uuid: &str,
2258) -> Result<Vec<models::UsedBy>, Error<EndpointsDeviceAccessGroupsUsedByListError>> {
2259 let p_path_pbm_uuid = pbm_uuid;
2261
2262 let uri_str = format!(
2263 "{}/endpoints/device_access_groups/{pbm_uuid}/used_by/",
2264 configuration.base_path,
2265 pbm_uuid = crate::apis::urlencode(p_path_pbm_uuid)
2266 );
2267 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2268
2269 if let Some(ref user_agent) = configuration.user_agent {
2270 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2271 }
2272 if let Some(ref token) = configuration.bearer_access_token {
2273 req_builder = req_builder.bearer_auth(token.to_owned());
2274 };
2275
2276 let req = req_builder.build()?;
2277 let resp = configuration.client.execute(req).await?;
2278
2279 let status = resp.status();
2280 let content_type = resp
2281 .headers()
2282 .get("content-type")
2283 .and_then(|v| v.to_str().ok())
2284 .unwrap_or("application/octet-stream");
2285 let content_type = super::ContentType::from(content_type);
2286
2287 if !status.is_client_error() && !status.is_server_error() {
2288 let content = resp.text().await?;
2289 match content_type {
2290 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2291 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::UsedBy>`"))),
2292 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::UsedBy>`")))),
2293 }
2294 } else {
2295 let content = resp.text().await?;
2296 let entity: Option<EndpointsDeviceAccessGroupsUsedByListError> = serde_json::from_str(&content).ok();
2297 Err(Error::ResponseError(ResponseContent {
2298 status,
2299 content,
2300 entity,
2301 }))
2302 }
2303}
2304
2305pub async fn endpoints_device_bindings_create(
2307 configuration: &configuration::Configuration,
2308 device_user_binding_request: models::DeviceUserBindingRequest,
2309) -> Result<models::DeviceUserBinding, Error<EndpointsDeviceBindingsCreateError>> {
2310 let p_body_device_user_binding_request = device_user_binding_request;
2312
2313 let uri_str = format!("{}/endpoints/device_bindings/", configuration.base_path);
2314 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2315
2316 if let Some(ref user_agent) = configuration.user_agent {
2317 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2318 }
2319 if let Some(ref token) = configuration.bearer_access_token {
2320 req_builder = req_builder.bearer_auth(token.to_owned());
2321 };
2322 req_builder = req_builder.json(&p_body_device_user_binding_request);
2323
2324 let req = req_builder.build()?;
2325 let resp = configuration.client.execute(req).await?;
2326
2327 let status = resp.status();
2328 let content_type = resp
2329 .headers()
2330 .get("content-type")
2331 .and_then(|v| v.to_str().ok())
2332 .unwrap_or("application/octet-stream");
2333 let content_type = super::ContentType::from(content_type);
2334
2335 if !status.is_client_error() && !status.is_server_error() {
2336 let content = resp.text().await?;
2337 match content_type {
2338 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2339 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeviceUserBinding`"))),
2340 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::DeviceUserBinding`")))),
2341 }
2342 } else {
2343 let content = resp.text().await?;
2344 let entity: Option<EndpointsDeviceBindingsCreateError> = serde_json::from_str(&content).ok();
2345 Err(Error::ResponseError(ResponseContent {
2346 status,
2347 content,
2348 entity,
2349 }))
2350 }
2351}
2352
2353pub async fn endpoints_device_bindings_destroy(
2355 configuration: &configuration::Configuration,
2356 policy_binding_uuid: &str,
2357) -> Result<(), Error<EndpointsDeviceBindingsDestroyError>> {
2358 let p_path_policy_binding_uuid = policy_binding_uuid;
2360
2361 let uri_str = format!(
2362 "{}/endpoints/device_bindings/{policy_binding_uuid}/",
2363 configuration.base_path,
2364 policy_binding_uuid = crate::apis::urlencode(p_path_policy_binding_uuid)
2365 );
2366 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2367
2368 if let Some(ref user_agent) = configuration.user_agent {
2369 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2370 }
2371 if let Some(ref token) = configuration.bearer_access_token {
2372 req_builder = req_builder.bearer_auth(token.to_owned());
2373 };
2374
2375 let req = req_builder.build()?;
2376 let resp = configuration.client.execute(req).await?;
2377
2378 let status = resp.status();
2379
2380 if !status.is_client_error() && !status.is_server_error() {
2381 Ok(())
2382 } else {
2383 let content = resp.text().await?;
2384 let entity: Option<EndpointsDeviceBindingsDestroyError> = serde_json::from_str(&content).ok();
2385 Err(Error::ResponseError(ResponseContent {
2386 status,
2387 content,
2388 entity,
2389 }))
2390 }
2391}
2392
2393pub async fn endpoints_device_bindings_list(
2395 configuration: &configuration::Configuration,
2396 enabled: Option<bool>,
2397 order: Option<i32>,
2398 ordering: Option<&str>,
2399 page: Option<i32>,
2400 page_size: Option<i32>,
2401 policy: Option<&str>,
2402 policy__isnull: Option<bool>,
2403 search: Option<&str>,
2404 target: Option<&str>,
2405 target_in: Option<Vec<uuid::Uuid>>,
2406 timeout: Option<i32>,
2407) -> Result<models::PaginatedDeviceUserBindingList, Error<EndpointsDeviceBindingsListError>> {
2408 let p_query_enabled = enabled;
2410 let p_query_order = order;
2411 let p_query_ordering = ordering;
2412 let p_query_page = page;
2413 let p_query_page_size = page_size;
2414 let p_query_policy = policy;
2415 let p_query_policy__isnull = policy__isnull;
2416 let p_query_search = search;
2417 let p_query_target = target;
2418 let p_query_target_in = target_in;
2419 let p_query_timeout = timeout;
2420
2421 let uri_str = format!("{}/endpoints/device_bindings/", configuration.base_path);
2422 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2423
2424 if let Some(ref param_value) = p_query_enabled {
2425 req_builder = req_builder.query(&[("enabled", ¶m_value.to_string())]);
2426 }
2427 if let Some(ref param_value) = p_query_order {
2428 req_builder = req_builder.query(&[("order", ¶m_value.to_string())]);
2429 }
2430 if let Some(ref param_value) = p_query_ordering {
2431 req_builder = req_builder.query(&[("ordering", ¶m_value.to_string())]);
2432 }
2433 if let Some(ref param_value) = p_query_page {
2434 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
2435 }
2436 if let Some(ref param_value) = p_query_page_size {
2437 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
2438 }
2439 if let Some(ref param_value) = p_query_policy {
2440 req_builder = req_builder.query(&[("policy", ¶m_value.to_string())]);
2441 }
2442 if let Some(ref param_value) = p_query_policy__isnull {
2443 req_builder = req_builder.query(&[("policy__isnull", ¶m_value.to_string())]);
2444 }
2445 if let Some(ref param_value) = p_query_search {
2446 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
2447 }
2448 if let Some(ref param_value) = p_query_target {
2449 req_builder = req_builder.query(&[("target", ¶m_value.to_string())]);
2450 }
2451 if let Some(ref param_value) = p_query_target_in {
2452 req_builder = match "multi" {
2453 "multi" => req_builder.query(
2454 ¶m_value
2455 .into_iter()
2456 .map(|p| ("target_in".to_owned(), p.to_string()))
2457 .collect::<Vec<(std::string::String, std::string::String)>>(),
2458 ),
2459 _ => req_builder.query(&[(
2460 "target_in",
2461 ¶m_value
2462 .into_iter()
2463 .map(|p| p.to_string())
2464 .collect::<Vec<String>>()
2465 .join(",")
2466 .to_string(),
2467 )]),
2468 };
2469 }
2470 if let Some(ref param_value) = p_query_timeout {
2471 req_builder = req_builder.query(&[("timeout", ¶m_value.to_string())]);
2472 }
2473 if let Some(ref user_agent) = configuration.user_agent {
2474 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2475 }
2476 if let Some(ref token) = configuration.bearer_access_token {
2477 req_builder = req_builder.bearer_auth(token.to_owned());
2478 };
2479
2480 let req = req_builder.build()?;
2481 let resp = configuration.client.execute(req).await?;
2482
2483 let status = resp.status();
2484 let content_type = resp
2485 .headers()
2486 .get("content-type")
2487 .and_then(|v| v.to_str().ok())
2488 .unwrap_or("application/octet-stream");
2489 let content_type = super::ContentType::from(content_type);
2490
2491 if !status.is_client_error() && !status.is_server_error() {
2492 let content = resp.text().await?;
2493 match content_type {
2494 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2495 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedDeviceUserBindingList`"))),
2496 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::PaginatedDeviceUserBindingList`")))),
2497 }
2498 } else {
2499 let content = resp.text().await?;
2500 let entity: Option<EndpointsDeviceBindingsListError> = serde_json::from_str(&content).ok();
2501 Err(Error::ResponseError(ResponseContent {
2502 status,
2503 content,
2504 entity,
2505 }))
2506 }
2507}
2508
2509pub async fn endpoints_device_bindings_partial_update(
2511 configuration: &configuration::Configuration,
2512 policy_binding_uuid: &str,
2513 patched_device_user_binding_request: Option<models::PatchedDeviceUserBindingRequest>,
2514) -> Result<models::DeviceUserBinding, Error<EndpointsDeviceBindingsPartialUpdateError>> {
2515 let p_path_policy_binding_uuid = policy_binding_uuid;
2517 let p_body_patched_device_user_binding_request = patched_device_user_binding_request;
2518
2519 let uri_str = format!(
2520 "{}/endpoints/device_bindings/{policy_binding_uuid}/",
2521 configuration.base_path,
2522 policy_binding_uuid = crate::apis::urlencode(p_path_policy_binding_uuid)
2523 );
2524 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
2525
2526 if let Some(ref user_agent) = configuration.user_agent {
2527 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2528 }
2529 if let Some(ref token) = configuration.bearer_access_token {
2530 req_builder = req_builder.bearer_auth(token.to_owned());
2531 };
2532 req_builder = req_builder.json(&p_body_patched_device_user_binding_request);
2533
2534 let req = req_builder.build()?;
2535 let resp = configuration.client.execute(req).await?;
2536
2537 let status = resp.status();
2538 let content_type = resp
2539 .headers()
2540 .get("content-type")
2541 .and_then(|v| v.to_str().ok())
2542 .unwrap_or("application/octet-stream");
2543 let content_type = super::ContentType::from(content_type);
2544
2545 if !status.is_client_error() && !status.is_server_error() {
2546 let content = resp.text().await?;
2547 match content_type {
2548 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2549 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeviceUserBinding`"))),
2550 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::DeviceUserBinding`")))),
2551 }
2552 } else {
2553 let content = resp.text().await?;
2554 let entity: Option<EndpointsDeviceBindingsPartialUpdateError> = serde_json::from_str(&content).ok();
2555 Err(Error::ResponseError(ResponseContent {
2556 status,
2557 content,
2558 entity,
2559 }))
2560 }
2561}
2562
2563pub async fn endpoints_device_bindings_retrieve(
2565 configuration: &configuration::Configuration,
2566 policy_binding_uuid: &str,
2567) -> Result<models::DeviceUserBinding, Error<EndpointsDeviceBindingsRetrieveError>> {
2568 let p_path_policy_binding_uuid = policy_binding_uuid;
2570
2571 let uri_str = format!(
2572 "{}/endpoints/device_bindings/{policy_binding_uuid}/",
2573 configuration.base_path,
2574 policy_binding_uuid = crate::apis::urlencode(p_path_policy_binding_uuid)
2575 );
2576 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2577
2578 if let Some(ref user_agent) = configuration.user_agent {
2579 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2580 }
2581 if let Some(ref token) = configuration.bearer_access_token {
2582 req_builder = req_builder.bearer_auth(token.to_owned());
2583 };
2584
2585 let req = req_builder.build()?;
2586 let resp = configuration.client.execute(req).await?;
2587
2588 let status = resp.status();
2589 let content_type = resp
2590 .headers()
2591 .get("content-type")
2592 .and_then(|v| v.to_str().ok())
2593 .unwrap_or("application/octet-stream");
2594 let content_type = super::ContentType::from(content_type);
2595
2596 if !status.is_client_error() && !status.is_server_error() {
2597 let content = resp.text().await?;
2598 match content_type {
2599 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2600 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeviceUserBinding`"))),
2601 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::DeviceUserBinding`")))),
2602 }
2603 } else {
2604 let content = resp.text().await?;
2605 let entity: Option<EndpointsDeviceBindingsRetrieveError> = serde_json::from_str(&content).ok();
2606 Err(Error::ResponseError(ResponseContent {
2607 status,
2608 content,
2609 entity,
2610 }))
2611 }
2612}
2613
2614pub async fn endpoints_device_bindings_update(
2616 configuration: &configuration::Configuration,
2617 policy_binding_uuid: &str,
2618 device_user_binding_request: models::DeviceUserBindingRequest,
2619) -> Result<models::DeviceUserBinding, Error<EndpointsDeviceBindingsUpdateError>> {
2620 let p_path_policy_binding_uuid = policy_binding_uuid;
2622 let p_body_device_user_binding_request = device_user_binding_request;
2623
2624 let uri_str = format!(
2625 "{}/endpoints/device_bindings/{policy_binding_uuid}/",
2626 configuration.base_path,
2627 policy_binding_uuid = crate::apis::urlencode(p_path_policy_binding_uuid)
2628 );
2629 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
2630
2631 if let Some(ref user_agent) = configuration.user_agent {
2632 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2633 }
2634 if let Some(ref token) = configuration.bearer_access_token {
2635 req_builder = req_builder.bearer_auth(token.to_owned());
2636 };
2637 req_builder = req_builder.json(&p_body_device_user_binding_request);
2638
2639 let req = req_builder.build()?;
2640 let resp = configuration.client.execute(req).await?;
2641
2642 let status = resp.status();
2643 let content_type = resp
2644 .headers()
2645 .get("content-type")
2646 .and_then(|v| v.to_str().ok())
2647 .unwrap_or("application/octet-stream");
2648 let content_type = super::ContentType::from(content_type);
2649
2650 if !status.is_client_error() && !status.is_server_error() {
2651 let content = resp.text().await?;
2652 match content_type {
2653 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2654 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeviceUserBinding`"))),
2655 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::DeviceUserBinding`")))),
2656 }
2657 } else {
2658 let content = resp.text().await?;
2659 let entity: Option<EndpointsDeviceBindingsUpdateError> = serde_json::from_str(&content).ok();
2660 Err(Error::ResponseError(ResponseContent {
2661 status,
2662 content,
2663 entity,
2664 }))
2665 }
2666}
2667
2668pub async fn endpoints_device_bindings_used_by_list(
2670 configuration: &configuration::Configuration,
2671 policy_binding_uuid: &str,
2672) -> Result<Vec<models::UsedBy>, Error<EndpointsDeviceBindingsUsedByListError>> {
2673 let p_path_policy_binding_uuid = policy_binding_uuid;
2675
2676 let uri_str = format!(
2677 "{}/endpoints/device_bindings/{policy_binding_uuid}/used_by/",
2678 configuration.base_path,
2679 policy_binding_uuid = crate::apis::urlencode(p_path_policy_binding_uuid)
2680 );
2681 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2682
2683 if let Some(ref user_agent) = configuration.user_agent {
2684 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2685 }
2686 if let Some(ref token) = configuration.bearer_access_token {
2687 req_builder = req_builder.bearer_auth(token.to_owned());
2688 };
2689
2690 let req = req_builder.build()?;
2691 let resp = configuration.client.execute(req).await?;
2692
2693 let status = resp.status();
2694 let content_type = resp
2695 .headers()
2696 .get("content-type")
2697 .and_then(|v| v.to_str().ok())
2698 .unwrap_or("application/octet-stream");
2699 let content_type = super::ContentType::from(content_type);
2700
2701 if !status.is_client_error() && !status.is_server_error() {
2702 let content = resp.text().await?;
2703 match content_type {
2704 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2705 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::UsedBy>`"))),
2706 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::UsedBy>`")))),
2707 }
2708 } else {
2709 let content = resp.text().await?;
2710 let entity: Option<EndpointsDeviceBindingsUsedByListError> = serde_json::from_str(&content).ok();
2711 Err(Error::ResponseError(ResponseContent {
2712 status,
2713 content,
2714 entity,
2715 }))
2716 }
2717}
2718
2719pub async fn endpoints_devices_destroy(
2721 configuration: &configuration::Configuration,
2722 device_uuid: &str,
2723) -> Result<(), Error<EndpointsDevicesDestroyError>> {
2724 let p_path_device_uuid = device_uuid;
2726
2727 let uri_str = format!(
2728 "{}/endpoints/devices/{device_uuid}/",
2729 configuration.base_path,
2730 device_uuid = crate::apis::urlencode(p_path_device_uuid)
2731 );
2732 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2733
2734 if let Some(ref user_agent) = configuration.user_agent {
2735 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2736 }
2737 if let Some(ref token) = configuration.bearer_access_token {
2738 req_builder = req_builder.bearer_auth(token.to_owned());
2739 };
2740
2741 let req = req_builder.build()?;
2742 let resp = configuration.client.execute(req).await?;
2743
2744 let status = resp.status();
2745
2746 if !status.is_client_error() && !status.is_server_error() {
2747 Ok(())
2748 } else {
2749 let content = resp.text().await?;
2750 let entity: Option<EndpointsDevicesDestroyError> = serde_json::from_str(&content).ok();
2751 Err(Error::ResponseError(ResponseContent {
2752 status,
2753 content,
2754 entity,
2755 }))
2756 }
2757}
2758
2759pub async fn endpoints_devices_list(
2761 configuration: &configuration::Configuration,
2762 identifier: Option<&str>,
2763 name: Option<&str>,
2764 ordering: Option<&str>,
2765 page: Option<i32>,
2766 page_size: Option<i32>,
2767 search: Option<&str>,
2768) -> Result<models::PaginatedEndpointDeviceList, Error<EndpointsDevicesListError>> {
2769 let p_query_identifier = identifier;
2771 let p_query_name = name;
2772 let p_query_ordering = ordering;
2773 let p_query_page = page;
2774 let p_query_page_size = page_size;
2775 let p_query_search = search;
2776
2777 let uri_str = format!("{}/endpoints/devices/", configuration.base_path);
2778 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2779
2780 if let Some(ref param_value) = p_query_identifier {
2781 req_builder = req_builder.query(&[("identifier", ¶m_value.to_string())]);
2782 }
2783 if let Some(ref param_value) = p_query_name {
2784 req_builder = req_builder.query(&[("name", ¶m_value.to_string())]);
2785 }
2786 if let Some(ref param_value) = p_query_ordering {
2787 req_builder = req_builder.query(&[("ordering", ¶m_value.to_string())]);
2788 }
2789 if let Some(ref param_value) = p_query_page {
2790 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
2791 }
2792 if let Some(ref param_value) = p_query_page_size {
2793 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
2794 }
2795 if let Some(ref param_value) = p_query_search {
2796 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
2797 }
2798 if let Some(ref user_agent) = configuration.user_agent {
2799 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2800 }
2801 if let Some(ref token) = configuration.bearer_access_token {
2802 req_builder = req_builder.bearer_auth(token.to_owned());
2803 };
2804
2805 let req = req_builder.build()?;
2806 let resp = configuration.client.execute(req).await?;
2807
2808 let status = resp.status();
2809 let content_type = resp
2810 .headers()
2811 .get("content-type")
2812 .and_then(|v| v.to_str().ok())
2813 .unwrap_or("application/octet-stream");
2814 let content_type = super::ContentType::from(content_type);
2815
2816 if !status.is_client_error() && !status.is_server_error() {
2817 let content = resp.text().await?;
2818 match content_type {
2819 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2820 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedEndpointDeviceList`"))),
2821 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::PaginatedEndpointDeviceList`")))),
2822 }
2823 } else {
2824 let content = resp.text().await?;
2825 let entity: Option<EndpointsDevicesListError> = serde_json::from_str(&content).ok();
2826 Err(Error::ResponseError(ResponseContent {
2827 status,
2828 content,
2829 entity,
2830 }))
2831 }
2832}
2833
2834pub async fn endpoints_devices_partial_update(
2836 configuration: &configuration::Configuration,
2837 device_uuid: &str,
2838 patched_endpoint_device_request: Option<models::PatchedEndpointDeviceRequest>,
2839) -> Result<models::EndpointDevice, Error<EndpointsDevicesPartialUpdateError>> {
2840 let p_path_device_uuid = device_uuid;
2842 let p_body_patched_endpoint_device_request = patched_endpoint_device_request;
2843
2844 let uri_str = format!(
2845 "{}/endpoints/devices/{device_uuid}/",
2846 configuration.base_path,
2847 device_uuid = crate::apis::urlencode(p_path_device_uuid)
2848 );
2849 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
2850
2851 if let Some(ref user_agent) = configuration.user_agent {
2852 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2853 }
2854 if let Some(ref token) = configuration.bearer_access_token {
2855 req_builder = req_builder.bearer_auth(token.to_owned());
2856 };
2857 req_builder = req_builder.json(&p_body_patched_endpoint_device_request);
2858
2859 let req = req_builder.build()?;
2860 let resp = configuration.client.execute(req).await?;
2861
2862 let status = resp.status();
2863 let content_type = resp
2864 .headers()
2865 .get("content-type")
2866 .and_then(|v| v.to_str().ok())
2867 .unwrap_or("application/octet-stream");
2868 let content_type = super::ContentType::from(content_type);
2869
2870 if !status.is_client_error() && !status.is_server_error() {
2871 let content = resp.text().await?;
2872 match content_type {
2873 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2874 ContentType::Text => {
2875 return Err(Error::from(serde_json::Error::custom(
2876 "Received `text/plain` content type response that cannot be converted to `models::EndpointDevice`",
2877 )))
2878 }
2879 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
2880 "Received `{unknown_type}` content type response that cannot be converted to `models::EndpointDevice`"
2881 )))),
2882 }
2883 } else {
2884 let content = resp.text().await?;
2885 let entity: Option<EndpointsDevicesPartialUpdateError> = serde_json::from_str(&content).ok();
2886 Err(Error::ResponseError(ResponseContent {
2887 status,
2888 content,
2889 entity,
2890 }))
2891 }
2892}
2893
2894pub async fn endpoints_devices_retrieve(
2896 configuration: &configuration::Configuration,
2897 device_uuid: &str,
2898) -> Result<models::EndpointDeviceDetails, Error<EndpointsDevicesRetrieveError>> {
2899 let p_path_device_uuid = device_uuid;
2901
2902 let uri_str = format!(
2903 "{}/endpoints/devices/{device_uuid}/",
2904 configuration.base_path,
2905 device_uuid = crate::apis::urlencode(p_path_device_uuid)
2906 );
2907 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2908
2909 if let Some(ref user_agent) = configuration.user_agent {
2910 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2911 }
2912 if let Some(ref token) = configuration.bearer_access_token {
2913 req_builder = req_builder.bearer_auth(token.to_owned());
2914 };
2915
2916 let req = req_builder.build()?;
2917 let resp = configuration.client.execute(req).await?;
2918
2919 let status = resp.status();
2920 let content_type = resp
2921 .headers()
2922 .get("content-type")
2923 .and_then(|v| v.to_str().ok())
2924 .unwrap_or("application/octet-stream");
2925 let content_type = super::ContentType::from(content_type);
2926
2927 if !status.is_client_error() && !status.is_server_error() {
2928 let content = resp.text().await?;
2929 match content_type {
2930 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2931 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::EndpointDeviceDetails`"))),
2932 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::EndpointDeviceDetails`")))),
2933 }
2934 } else {
2935 let content = resp.text().await?;
2936 let entity: Option<EndpointsDevicesRetrieveError> = serde_json::from_str(&content).ok();
2937 Err(Error::ResponseError(ResponseContent {
2938 status,
2939 content,
2940 entity,
2941 }))
2942 }
2943}
2944
2945pub async fn endpoints_devices_summary_retrieve(
2947 configuration: &configuration::Configuration,
2948) -> Result<models::DeviceSummary, Error<EndpointsDevicesSummaryRetrieveError>> {
2949 let uri_str = format!("{}/endpoints/devices/summary/", configuration.base_path);
2950 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2951
2952 if let Some(ref user_agent) = configuration.user_agent {
2953 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2954 }
2955 if let Some(ref token) = configuration.bearer_access_token {
2956 req_builder = req_builder.bearer_auth(token.to_owned());
2957 };
2958
2959 let req = req_builder.build()?;
2960 let resp = configuration.client.execute(req).await?;
2961
2962 let status = resp.status();
2963 let content_type = resp
2964 .headers()
2965 .get("content-type")
2966 .and_then(|v| v.to_str().ok())
2967 .unwrap_or("application/octet-stream");
2968 let content_type = super::ContentType::from(content_type);
2969
2970 if !status.is_client_error() && !status.is_server_error() {
2971 let content = resp.text().await?;
2972 match content_type {
2973 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2974 ContentType::Text => {
2975 return Err(Error::from(serde_json::Error::custom(
2976 "Received `text/plain` content type response that cannot be converted to `models::DeviceSummary`",
2977 )))
2978 }
2979 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
2980 "Received `{unknown_type}` content type response that cannot be converted to `models::DeviceSummary`"
2981 )))),
2982 }
2983 } else {
2984 let content = resp.text().await?;
2985 let entity: Option<EndpointsDevicesSummaryRetrieveError> = serde_json::from_str(&content).ok();
2986 Err(Error::ResponseError(ResponseContent {
2987 status,
2988 content,
2989 entity,
2990 }))
2991 }
2992}
2993
2994pub async fn endpoints_devices_update(
2996 configuration: &configuration::Configuration,
2997 device_uuid: &str,
2998 endpoint_device_request: models::EndpointDeviceRequest,
2999) -> Result<models::EndpointDevice, Error<EndpointsDevicesUpdateError>> {
3000 let p_path_device_uuid = device_uuid;
3002 let p_body_endpoint_device_request = endpoint_device_request;
3003
3004 let uri_str = format!(
3005 "{}/endpoints/devices/{device_uuid}/",
3006 configuration.base_path,
3007 device_uuid = crate::apis::urlencode(p_path_device_uuid)
3008 );
3009 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
3010
3011 if let Some(ref user_agent) = configuration.user_agent {
3012 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3013 }
3014 if let Some(ref token) = configuration.bearer_access_token {
3015 req_builder = req_builder.bearer_auth(token.to_owned());
3016 };
3017 req_builder = req_builder.json(&p_body_endpoint_device_request);
3018
3019 let req = req_builder.build()?;
3020 let resp = configuration.client.execute(req).await?;
3021
3022 let status = resp.status();
3023 let content_type = resp
3024 .headers()
3025 .get("content-type")
3026 .and_then(|v| v.to_str().ok())
3027 .unwrap_or("application/octet-stream");
3028 let content_type = super::ContentType::from(content_type);
3029
3030 if !status.is_client_error() && !status.is_server_error() {
3031 let content = resp.text().await?;
3032 match content_type {
3033 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3034 ContentType::Text => {
3035 return Err(Error::from(serde_json::Error::custom(
3036 "Received `text/plain` content type response that cannot be converted to `models::EndpointDevice`",
3037 )))
3038 }
3039 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
3040 "Received `{unknown_type}` content type response that cannot be converted to `models::EndpointDevice`"
3041 )))),
3042 }
3043 } else {
3044 let content = resp.text().await?;
3045 let entity: Option<EndpointsDevicesUpdateError> = serde_json::from_str(&content).ok();
3046 Err(Error::ResponseError(ResponseContent {
3047 status,
3048 content,
3049 entity,
3050 }))
3051 }
3052}
3053
3054pub async fn endpoints_devices_used_by_list(
3056 configuration: &configuration::Configuration,
3057 device_uuid: &str,
3058) -> Result<Vec<models::UsedBy>, Error<EndpointsDevicesUsedByListError>> {
3059 let p_path_device_uuid = device_uuid;
3061
3062 let uri_str = format!(
3063 "{}/endpoints/devices/{device_uuid}/used_by/",
3064 configuration.base_path,
3065 device_uuid = crate::apis::urlencode(p_path_device_uuid)
3066 );
3067 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3068
3069 if let Some(ref user_agent) = configuration.user_agent {
3070 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3071 }
3072 if let Some(ref token) = configuration.bearer_access_token {
3073 req_builder = req_builder.bearer_auth(token.to_owned());
3074 };
3075
3076 let req = req_builder.build()?;
3077 let resp = configuration.client.execute(req).await?;
3078
3079 let status = resp.status();
3080 let content_type = resp
3081 .headers()
3082 .get("content-type")
3083 .and_then(|v| v.to_str().ok())
3084 .unwrap_or("application/octet-stream");
3085 let content_type = super::ContentType::from(content_type);
3086
3087 if !status.is_client_error() && !status.is_server_error() {
3088 let content = resp.text().await?;
3089 match content_type {
3090 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3091 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::UsedBy>`"))),
3092 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::UsedBy>`")))),
3093 }
3094 } else {
3095 let content = resp.text().await?;
3096 let entity: Option<EndpointsDevicesUsedByListError> = serde_json::from_str(&content).ok();
3097 Err(Error::ResponseError(ResponseContent {
3098 status,
3099 content,
3100 entity,
3101 }))
3102 }
3103}