1use reqwest;
12use serde::{de::Error as _, Deserialize, Serialize};
13
14use super::{configuration, ContentType, Error};
15use crate::{apis::ResponseContent, models};
16
17#[derive(Debug, Clone, Serialize, Deserialize)]
19#[serde(untagged)]
20pub enum EmergencyAccessGrantedGetError {
21 UnknownValue(serde_json::Value),
22}
23
24#[derive(Debug, Clone, Serialize, Deserialize)]
26#[serde(untagged)]
27pub enum EmergencyAccessIdAcceptPostError {
28 UnknownValue(serde_json::Value),
29}
30
31#[derive(Debug, Clone, Serialize, Deserialize)]
33#[serde(untagged)]
34pub enum EmergencyAccessIdApprovePostError {
35 UnknownValue(serde_json::Value),
36}
37
38#[derive(Debug, Clone, Serialize, Deserialize)]
40#[serde(untagged)]
41pub enum EmergencyAccessIdCipherIdAttachmentAttachmentIdGetError {
42 UnknownValue(serde_json::Value),
43}
44
45#[derive(Debug, Clone, Serialize, Deserialize)]
47#[serde(untagged)]
48pub enum EmergencyAccessIdConfirmPostError {
49 UnknownValue(serde_json::Value),
50}
51
52#[derive(Debug, Clone, Serialize, Deserialize)]
54#[serde(untagged)]
55pub enum EmergencyAccessIdDeleteError {
56 UnknownValue(serde_json::Value),
57}
58
59#[derive(Debug, Clone, Serialize, Deserialize)]
61#[serde(untagged)]
62pub enum EmergencyAccessIdDeletePostError {
63 UnknownValue(serde_json::Value),
64}
65
66#[derive(Debug, Clone, Serialize, Deserialize)]
68#[serde(untagged)]
69pub enum EmergencyAccessIdGetError {
70 UnknownValue(serde_json::Value),
71}
72
73#[derive(Debug, Clone, Serialize, Deserialize)]
75#[serde(untagged)]
76pub enum EmergencyAccessIdInitiatePostError {
77 UnknownValue(serde_json::Value),
78}
79
80#[derive(Debug, Clone, Serialize, Deserialize)]
82#[serde(untagged)]
83pub enum EmergencyAccessIdPasswordPostError {
84 UnknownValue(serde_json::Value),
85}
86
87#[derive(Debug, Clone, Serialize, Deserialize)]
89#[serde(untagged)]
90pub enum EmergencyAccessIdPoliciesGetError {
91 UnknownValue(serde_json::Value),
92}
93
94#[derive(Debug, Clone, Serialize, Deserialize)]
96#[serde(untagged)]
97pub enum EmergencyAccessIdPostError {
98 UnknownValue(serde_json::Value),
99}
100
101#[derive(Debug, Clone, Serialize, Deserialize)]
103#[serde(untagged)]
104pub enum EmergencyAccessIdPutError {
105 UnknownValue(serde_json::Value),
106}
107
108#[derive(Debug, Clone, Serialize, Deserialize)]
110#[serde(untagged)]
111pub enum EmergencyAccessIdReinvitePostError {
112 UnknownValue(serde_json::Value),
113}
114
115#[derive(Debug, Clone, Serialize, Deserialize)]
117#[serde(untagged)]
118pub enum EmergencyAccessIdRejectPostError {
119 UnknownValue(serde_json::Value),
120}
121
122#[derive(Debug, Clone, Serialize, Deserialize)]
124#[serde(untagged)]
125pub enum EmergencyAccessIdTakeoverPostError {
126 UnknownValue(serde_json::Value),
127}
128
129#[derive(Debug, Clone, Serialize, Deserialize)]
131#[serde(untagged)]
132pub enum EmergencyAccessIdViewPostError {
133 UnknownValue(serde_json::Value),
134}
135
136#[derive(Debug, Clone, Serialize, Deserialize)]
138#[serde(untagged)]
139pub enum EmergencyAccessInvitePostError {
140 UnknownValue(serde_json::Value),
141}
142
143#[derive(Debug, Clone, Serialize, Deserialize)]
145#[serde(untagged)]
146pub enum EmergencyAccessTrustedGetError {
147 UnknownValue(serde_json::Value),
148}
149
150pub async fn emergency_access_granted_get(
151 configuration: &configuration::Configuration,
152) -> Result<
153 models::EmergencyAccessGrantorDetailsResponseModelListResponseModel,
154 Error<EmergencyAccessGrantedGetError>,
155> {
156 let uri_str = format!("{}/emergency-access/granted", configuration.base_path);
157 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
158
159 if let Some(ref user_agent) = configuration.user_agent {
160 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
161 }
162 if let Some(ref token) = configuration.oauth_access_token {
163 req_builder = req_builder.bearer_auth(token.to_owned());
164 };
165
166 let req = req_builder.build()?;
167 let resp = configuration.client.execute(req).await?;
168
169 let status = resp.status();
170 let content_type = resp
171 .headers()
172 .get("content-type")
173 .and_then(|v| v.to_str().ok())
174 .unwrap_or("application/octet-stream");
175 let content_type = super::ContentType::from(content_type);
176
177 if !status.is_client_error() && !status.is_server_error() {
178 let content = resp.text().await?;
179 match content_type {
180 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
181 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::EmergencyAccessGrantorDetailsResponseModelListResponseModel`"))),
182 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::EmergencyAccessGrantorDetailsResponseModelListResponseModel`")))),
183 }
184 } else {
185 let content = resp.text().await?;
186 let entity: Option<EmergencyAccessGrantedGetError> = serde_json::from_str(&content).ok();
187 Err(Error::ResponseError(ResponseContent {
188 status,
189 content,
190 entity,
191 }))
192 }
193}
194
195pub async fn emergency_access_id_accept_post(
196 configuration: &configuration::Configuration,
197 id: uuid::Uuid,
198 organization_user_accept_request_model: Option<models::OrganizationUserAcceptRequestModel>,
199) -> Result<(), Error<EmergencyAccessIdAcceptPostError>> {
200 let p_id = id;
202 let p_organization_user_accept_request_model = organization_user_accept_request_model;
203
204 let uri_str = format!(
205 "{}/emergency-access/{id}/accept",
206 configuration.base_path,
207 id = crate::apis::urlencode(p_id.to_string())
208 );
209 let mut req_builder = configuration
210 .client
211 .request(reqwest::Method::POST, &uri_str);
212
213 if let Some(ref user_agent) = configuration.user_agent {
214 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
215 }
216 if let Some(ref token) = configuration.oauth_access_token {
217 req_builder = req_builder.bearer_auth(token.to_owned());
218 };
219 req_builder = req_builder.json(&p_organization_user_accept_request_model);
220
221 let req = req_builder.build()?;
222 let resp = configuration.client.execute(req).await?;
223
224 let status = resp.status();
225
226 if !status.is_client_error() && !status.is_server_error() {
227 Ok(())
228 } else {
229 let content = resp.text().await?;
230 let entity: Option<EmergencyAccessIdAcceptPostError> = serde_json::from_str(&content).ok();
231 Err(Error::ResponseError(ResponseContent {
232 status,
233 content,
234 entity,
235 }))
236 }
237}
238
239pub async fn emergency_access_id_approve_post(
240 configuration: &configuration::Configuration,
241 id: uuid::Uuid,
242) -> Result<(), Error<EmergencyAccessIdApprovePostError>> {
243 let p_id = id;
245
246 let uri_str = format!(
247 "{}/emergency-access/{id}/approve",
248 configuration.base_path,
249 id = crate::apis::urlencode(p_id.to_string())
250 );
251 let mut req_builder = configuration
252 .client
253 .request(reqwest::Method::POST, &uri_str);
254
255 if let Some(ref user_agent) = configuration.user_agent {
256 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
257 }
258 if let Some(ref token) = configuration.oauth_access_token {
259 req_builder = req_builder.bearer_auth(token.to_owned());
260 };
261
262 let req = req_builder.build()?;
263 let resp = configuration.client.execute(req).await?;
264
265 let status = resp.status();
266
267 if !status.is_client_error() && !status.is_server_error() {
268 Ok(())
269 } else {
270 let content = resp.text().await?;
271 let entity: Option<EmergencyAccessIdApprovePostError> = serde_json::from_str(&content).ok();
272 Err(Error::ResponseError(ResponseContent {
273 status,
274 content,
275 entity,
276 }))
277 }
278}
279
280pub async fn emergency_access_id_cipher_id_attachment_attachment_id_get(
281 configuration: &configuration::Configuration,
282 id: uuid::Uuid,
283 cipher_id: uuid::Uuid,
284 attachment_id: &str,
285) -> Result<
286 models::AttachmentResponseModel,
287 Error<EmergencyAccessIdCipherIdAttachmentAttachmentIdGetError>,
288> {
289 let p_id = id;
291 let p_cipher_id = cipher_id;
292 let p_attachment_id = attachment_id;
293
294 let uri_str = format!(
295 "{}/emergency-access/{id}/{cipherId}/attachment/{attachmentId}",
296 configuration.base_path,
297 id = crate::apis::urlencode(p_id.to_string()),
298 cipherId = crate::apis::urlencode(p_cipher_id.to_string()),
299 attachmentId = crate::apis::urlencode(p_attachment_id)
300 );
301 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
302
303 if let Some(ref user_agent) = configuration.user_agent {
304 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
305 }
306 if let Some(ref token) = configuration.oauth_access_token {
307 req_builder = req_builder.bearer_auth(token.to_owned());
308 };
309
310 let req = req_builder.build()?;
311 let resp = configuration.client.execute(req).await?;
312
313 let status = resp.status();
314 let content_type = resp
315 .headers()
316 .get("content-type")
317 .and_then(|v| v.to_str().ok())
318 .unwrap_or("application/octet-stream");
319 let content_type = super::ContentType::from(content_type);
320
321 if !status.is_client_error() && !status.is_server_error() {
322 let content = resp.text().await?;
323 match content_type {
324 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
325 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AttachmentResponseModel`"))),
326 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::AttachmentResponseModel`")))),
327 }
328 } else {
329 let content = resp.text().await?;
330 let entity: Option<EmergencyAccessIdCipherIdAttachmentAttachmentIdGetError> =
331 serde_json::from_str(&content).ok();
332 Err(Error::ResponseError(ResponseContent {
333 status,
334 content,
335 entity,
336 }))
337 }
338}
339
340pub async fn emergency_access_id_confirm_post(
341 configuration: &configuration::Configuration,
342 id: uuid::Uuid,
343 organization_user_confirm_request_model: Option<models::OrganizationUserConfirmRequestModel>,
344) -> Result<(), Error<EmergencyAccessIdConfirmPostError>> {
345 let p_id = id;
347 let p_organization_user_confirm_request_model = organization_user_confirm_request_model;
348
349 let uri_str = format!(
350 "{}/emergency-access/{id}/confirm",
351 configuration.base_path,
352 id = crate::apis::urlencode(p_id.to_string())
353 );
354 let mut req_builder = configuration
355 .client
356 .request(reqwest::Method::POST, &uri_str);
357
358 if let Some(ref user_agent) = configuration.user_agent {
359 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
360 }
361 if let Some(ref token) = configuration.oauth_access_token {
362 req_builder = req_builder.bearer_auth(token.to_owned());
363 };
364 req_builder = req_builder.json(&p_organization_user_confirm_request_model);
365
366 let req = req_builder.build()?;
367 let resp = configuration.client.execute(req).await?;
368
369 let status = resp.status();
370
371 if !status.is_client_error() && !status.is_server_error() {
372 Ok(())
373 } else {
374 let content = resp.text().await?;
375 let entity: Option<EmergencyAccessIdConfirmPostError> = serde_json::from_str(&content).ok();
376 Err(Error::ResponseError(ResponseContent {
377 status,
378 content,
379 entity,
380 }))
381 }
382}
383
384pub async fn emergency_access_id_delete(
385 configuration: &configuration::Configuration,
386 id: uuid::Uuid,
387) -> Result<(), Error<EmergencyAccessIdDeleteError>> {
388 let p_id = id;
390
391 let uri_str = format!(
392 "{}/emergency-access/{id}",
393 configuration.base_path,
394 id = crate::apis::urlencode(p_id.to_string())
395 );
396 let mut req_builder = configuration
397 .client
398 .request(reqwest::Method::DELETE, &uri_str);
399
400 if let Some(ref user_agent) = configuration.user_agent {
401 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
402 }
403 if let Some(ref token) = configuration.oauth_access_token {
404 req_builder = req_builder.bearer_auth(token.to_owned());
405 };
406
407 let req = req_builder.build()?;
408 let resp = configuration.client.execute(req).await?;
409
410 let status = resp.status();
411
412 if !status.is_client_error() && !status.is_server_error() {
413 Ok(())
414 } else {
415 let content = resp.text().await?;
416 let entity: Option<EmergencyAccessIdDeleteError> = serde_json::from_str(&content).ok();
417 Err(Error::ResponseError(ResponseContent {
418 status,
419 content,
420 entity,
421 }))
422 }
423}
424
425pub async fn emergency_access_id_delete_post(
426 configuration: &configuration::Configuration,
427 id: uuid::Uuid,
428) -> Result<(), Error<EmergencyAccessIdDeletePostError>> {
429 let p_id = id;
431
432 let uri_str = format!(
433 "{}/emergency-access/{id}/delete",
434 configuration.base_path,
435 id = crate::apis::urlencode(p_id.to_string())
436 );
437 let mut req_builder = configuration
438 .client
439 .request(reqwest::Method::POST, &uri_str);
440
441 if let Some(ref user_agent) = configuration.user_agent {
442 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
443 }
444 if let Some(ref token) = configuration.oauth_access_token {
445 req_builder = req_builder.bearer_auth(token.to_owned());
446 };
447
448 let req = req_builder.build()?;
449 let resp = configuration.client.execute(req).await?;
450
451 let status = resp.status();
452
453 if !status.is_client_error() && !status.is_server_error() {
454 Ok(())
455 } else {
456 let content = resp.text().await?;
457 let entity: Option<EmergencyAccessIdDeletePostError> = serde_json::from_str(&content).ok();
458 Err(Error::ResponseError(ResponseContent {
459 status,
460 content,
461 entity,
462 }))
463 }
464}
465
466pub async fn emergency_access_id_get(
467 configuration: &configuration::Configuration,
468 id: uuid::Uuid,
469) -> Result<models::EmergencyAccessGranteeDetailsResponseModel, Error<EmergencyAccessIdGetError>> {
470 let p_id = id;
472
473 let uri_str = format!(
474 "{}/emergency-access/{id}",
475 configuration.base_path,
476 id = crate::apis::urlencode(p_id.to_string())
477 );
478 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
479
480 if let Some(ref user_agent) = configuration.user_agent {
481 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
482 }
483 if let Some(ref token) = configuration.oauth_access_token {
484 req_builder = req_builder.bearer_auth(token.to_owned());
485 };
486
487 let req = req_builder.build()?;
488 let resp = configuration.client.execute(req).await?;
489
490 let status = resp.status();
491 let content_type = resp
492 .headers()
493 .get("content-type")
494 .and_then(|v| v.to_str().ok())
495 .unwrap_or("application/octet-stream");
496 let content_type = super::ContentType::from(content_type);
497
498 if !status.is_client_error() && !status.is_server_error() {
499 let content = resp.text().await?;
500 match content_type {
501 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
502 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::EmergencyAccessGranteeDetailsResponseModel`"))),
503 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::EmergencyAccessGranteeDetailsResponseModel`")))),
504 }
505 } else {
506 let content = resp.text().await?;
507 let entity: Option<EmergencyAccessIdGetError> = serde_json::from_str(&content).ok();
508 Err(Error::ResponseError(ResponseContent {
509 status,
510 content,
511 entity,
512 }))
513 }
514}
515
516pub async fn emergency_access_id_initiate_post(
517 configuration: &configuration::Configuration,
518 id: uuid::Uuid,
519) -> Result<(), Error<EmergencyAccessIdInitiatePostError>> {
520 let p_id = id;
522
523 let uri_str = format!(
524 "{}/emergency-access/{id}/initiate",
525 configuration.base_path,
526 id = crate::apis::urlencode(p_id.to_string())
527 );
528 let mut req_builder = configuration
529 .client
530 .request(reqwest::Method::POST, &uri_str);
531
532 if let Some(ref user_agent) = configuration.user_agent {
533 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
534 }
535 if let Some(ref token) = configuration.oauth_access_token {
536 req_builder = req_builder.bearer_auth(token.to_owned());
537 };
538
539 let req = req_builder.build()?;
540 let resp = configuration.client.execute(req).await?;
541
542 let status = resp.status();
543
544 if !status.is_client_error() && !status.is_server_error() {
545 Ok(())
546 } else {
547 let content = resp.text().await?;
548 let entity: Option<EmergencyAccessIdInitiatePostError> =
549 serde_json::from_str(&content).ok();
550 Err(Error::ResponseError(ResponseContent {
551 status,
552 content,
553 entity,
554 }))
555 }
556}
557
558pub async fn emergency_access_id_password_post(
559 configuration: &configuration::Configuration,
560 id: uuid::Uuid,
561 emergency_access_password_request_model: Option<models::EmergencyAccessPasswordRequestModel>,
562) -> Result<(), Error<EmergencyAccessIdPasswordPostError>> {
563 let p_id = id;
565 let p_emergency_access_password_request_model = emergency_access_password_request_model;
566
567 let uri_str = format!(
568 "{}/emergency-access/{id}/password",
569 configuration.base_path,
570 id = crate::apis::urlencode(p_id.to_string())
571 );
572 let mut req_builder = configuration
573 .client
574 .request(reqwest::Method::POST, &uri_str);
575
576 if let Some(ref user_agent) = configuration.user_agent {
577 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
578 }
579 if let Some(ref token) = configuration.oauth_access_token {
580 req_builder = req_builder.bearer_auth(token.to_owned());
581 };
582 req_builder = req_builder.json(&p_emergency_access_password_request_model);
583
584 let req = req_builder.build()?;
585 let resp = configuration.client.execute(req).await?;
586
587 let status = resp.status();
588
589 if !status.is_client_error() && !status.is_server_error() {
590 Ok(())
591 } else {
592 let content = resp.text().await?;
593 let entity: Option<EmergencyAccessIdPasswordPostError> =
594 serde_json::from_str(&content).ok();
595 Err(Error::ResponseError(ResponseContent {
596 status,
597 content,
598 entity,
599 }))
600 }
601}
602
603pub async fn emergency_access_id_policies_get(
604 configuration: &configuration::Configuration,
605 id: uuid::Uuid,
606) -> Result<models::PolicyResponseModelListResponseModel, Error<EmergencyAccessIdPoliciesGetError>>
607{
608 let p_id = id;
610
611 let uri_str = format!(
612 "{}/emergency-access/{id}/policies",
613 configuration.base_path,
614 id = crate::apis::urlencode(p_id.to_string())
615 );
616 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
617
618 if let Some(ref user_agent) = configuration.user_agent {
619 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
620 }
621 if let Some(ref token) = configuration.oauth_access_token {
622 req_builder = req_builder.bearer_auth(token.to_owned());
623 };
624
625 let req = req_builder.build()?;
626 let resp = configuration.client.execute(req).await?;
627
628 let status = resp.status();
629 let content_type = resp
630 .headers()
631 .get("content-type")
632 .and_then(|v| v.to_str().ok())
633 .unwrap_or("application/octet-stream");
634 let content_type = super::ContentType::from(content_type);
635
636 if !status.is_client_error() && !status.is_server_error() {
637 let content = resp.text().await?;
638 match content_type {
639 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
640 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PolicyResponseModelListResponseModel`"))),
641 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::PolicyResponseModelListResponseModel`")))),
642 }
643 } else {
644 let content = resp.text().await?;
645 let entity: Option<EmergencyAccessIdPoliciesGetError> = serde_json::from_str(&content).ok();
646 Err(Error::ResponseError(ResponseContent {
647 status,
648 content,
649 entity,
650 }))
651 }
652}
653
654pub async fn emergency_access_id_post(
655 configuration: &configuration::Configuration,
656 id: uuid::Uuid,
657 emergency_access_update_request_model: Option<models::EmergencyAccessUpdateRequestModel>,
658) -> Result<(), Error<EmergencyAccessIdPostError>> {
659 let p_id = id;
661 let p_emergency_access_update_request_model = emergency_access_update_request_model;
662
663 let uri_str = format!(
664 "{}/emergency-access/{id}",
665 configuration.base_path,
666 id = crate::apis::urlencode(p_id.to_string())
667 );
668 let mut req_builder = configuration
669 .client
670 .request(reqwest::Method::POST, &uri_str);
671
672 if let Some(ref user_agent) = configuration.user_agent {
673 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
674 }
675 if let Some(ref token) = configuration.oauth_access_token {
676 req_builder = req_builder.bearer_auth(token.to_owned());
677 };
678 req_builder = req_builder.json(&p_emergency_access_update_request_model);
679
680 let req = req_builder.build()?;
681 let resp = configuration.client.execute(req).await?;
682
683 let status = resp.status();
684
685 if !status.is_client_error() && !status.is_server_error() {
686 Ok(())
687 } else {
688 let content = resp.text().await?;
689 let entity: Option<EmergencyAccessIdPostError> = serde_json::from_str(&content).ok();
690 Err(Error::ResponseError(ResponseContent {
691 status,
692 content,
693 entity,
694 }))
695 }
696}
697
698pub async fn emergency_access_id_put(
699 configuration: &configuration::Configuration,
700 id: uuid::Uuid,
701 emergency_access_update_request_model: Option<models::EmergencyAccessUpdateRequestModel>,
702) -> Result<(), Error<EmergencyAccessIdPutError>> {
703 let p_id = id;
705 let p_emergency_access_update_request_model = emergency_access_update_request_model;
706
707 let uri_str = format!(
708 "{}/emergency-access/{id}",
709 configuration.base_path,
710 id = crate::apis::urlencode(p_id.to_string())
711 );
712 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
713
714 if let Some(ref user_agent) = configuration.user_agent {
715 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
716 }
717 if let Some(ref token) = configuration.oauth_access_token {
718 req_builder = req_builder.bearer_auth(token.to_owned());
719 };
720 req_builder = req_builder.json(&p_emergency_access_update_request_model);
721
722 let req = req_builder.build()?;
723 let resp = configuration.client.execute(req).await?;
724
725 let status = resp.status();
726
727 if !status.is_client_error() && !status.is_server_error() {
728 Ok(())
729 } else {
730 let content = resp.text().await?;
731 let entity: Option<EmergencyAccessIdPutError> = serde_json::from_str(&content).ok();
732 Err(Error::ResponseError(ResponseContent {
733 status,
734 content,
735 entity,
736 }))
737 }
738}
739
740pub async fn emergency_access_id_reinvite_post(
741 configuration: &configuration::Configuration,
742 id: uuid::Uuid,
743) -> Result<(), Error<EmergencyAccessIdReinvitePostError>> {
744 let p_id = id;
746
747 let uri_str = format!(
748 "{}/emergency-access/{id}/reinvite",
749 configuration.base_path,
750 id = crate::apis::urlencode(p_id.to_string())
751 );
752 let mut req_builder = configuration
753 .client
754 .request(reqwest::Method::POST, &uri_str);
755
756 if let Some(ref user_agent) = configuration.user_agent {
757 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
758 }
759 if let Some(ref token) = configuration.oauth_access_token {
760 req_builder = req_builder.bearer_auth(token.to_owned());
761 };
762
763 let req = req_builder.build()?;
764 let resp = configuration.client.execute(req).await?;
765
766 let status = resp.status();
767
768 if !status.is_client_error() && !status.is_server_error() {
769 Ok(())
770 } else {
771 let content = resp.text().await?;
772 let entity: Option<EmergencyAccessIdReinvitePostError> =
773 serde_json::from_str(&content).ok();
774 Err(Error::ResponseError(ResponseContent {
775 status,
776 content,
777 entity,
778 }))
779 }
780}
781
782pub async fn emergency_access_id_reject_post(
783 configuration: &configuration::Configuration,
784 id: uuid::Uuid,
785) -> Result<(), Error<EmergencyAccessIdRejectPostError>> {
786 let p_id = id;
788
789 let uri_str = format!(
790 "{}/emergency-access/{id}/reject",
791 configuration.base_path,
792 id = crate::apis::urlencode(p_id.to_string())
793 );
794 let mut req_builder = configuration
795 .client
796 .request(reqwest::Method::POST, &uri_str);
797
798 if let Some(ref user_agent) = configuration.user_agent {
799 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
800 }
801 if let Some(ref token) = configuration.oauth_access_token {
802 req_builder = req_builder.bearer_auth(token.to_owned());
803 };
804
805 let req = req_builder.build()?;
806 let resp = configuration.client.execute(req).await?;
807
808 let status = resp.status();
809
810 if !status.is_client_error() && !status.is_server_error() {
811 Ok(())
812 } else {
813 let content = resp.text().await?;
814 let entity: Option<EmergencyAccessIdRejectPostError> = serde_json::from_str(&content).ok();
815 Err(Error::ResponseError(ResponseContent {
816 status,
817 content,
818 entity,
819 }))
820 }
821}
822
823pub async fn emergency_access_id_takeover_post(
824 configuration: &configuration::Configuration,
825 id: uuid::Uuid,
826) -> Result<models::EmergencyAccessTakeoverResponseModel, Error<EmergencyAccessIdTakeoverPostError>>
827{
828 let p_id = id;
830
831 let uri_str = format!(
832 "{}/emergency-access/{id}/takeover",
833 configuration.base_path,
834 id = crate::apis::urlencode(p_id.to_string())
835 );
836 let mut req_builder = configuration
837 .client
838 .request(reqwest::Method::POST, &uri_str);
839
840 if let Some(ref user_agent) = configuration.user_agent {
841 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
842 }
843 if let Some(ref token) = configuration.oauth_access_token {
844 req_builder = req_builder.bearer_auth(token.to_owned());
845 };
846
847 let req = req_builder.build()?;
848 let resp = configuration.client.execute(req).await?;
849
850 let status = resp.status();
851 let content_type = resp
852 .headers()
853 .get("content-type")
854 .and_then(|v| v.to_str().ok())
855 .unwrap_or("application/octet-stream");
856 let content_type = super::ContentType::from(content_type);
857
858 if !status.is_client_error() && !status.is_server_error() {
859 let content = resp.text().await?;
860 match content_type {
861 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
862 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::EmergencyAccessTakeoverResponseModel`"))),
863 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::EmergencyAccessTakeoverResponseModel`")))),
864 }
865 } else {
866 let content = resp.text().await?;
867 let entity: Option<EmergencyAccessIdTakeoverPostError> =
868 serde_json::from_str(&content).ok();
869 Err(Error::ResponseError(ResponseContent {
870 status,
871 content,
872 entity,
873 }))
874 }
875}
876
877pub async fn emergency_access_id_view_post(
878 configuration: &configuration::Configuration,
879 id: uuid::Uuid,
880) -> Result<models::EmergencyAccessViewResponseModel, Error<EmergencyAccessIdViewPostError>> {
881 let p_id = id;
883
884 let uri_str = format!(
885 "{}/emergency-access/{id}/view",
886 configuration.base_path,
887 id = crate::apis::urlencode(p_id.to_string())
888 );
889 let mut req_builder = configuration
890 .client
891 .request(reqwest::Method::POST, &uri_str);
892
893 if let Some(ref user_agent) = configuration.user_agent {
894 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
895 }
896 if let Some(ref token) = configuration.oauth_access_token {
897 req_builder = req_builder.bearer_auth(token.to_owned());
898 };
899
900 let req = req_builder.build()?;
901 let resp = configuration.client.execute(req).await?;
902
903 let status = resp.status();
904 let content_type = resp
905 .headers()
906 .get("content-type")
907 .and_then(|v| v.to_str().ok())
908 .unwrap_or("application/octet-stream");
909 let content_type = super::ContentType::from(content_type);
910
911 if !status.is_client_error() && !status.is_server_error() {
912 let content = resp.text().await?;
913 match content_type {
914 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
915 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::EmergencyAccessViewResponseModel`"))),
916 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::EmergencyAccessViewResponseModel`")))),
917 }
918 } else {
919 let content = resp.text().await?;
920 let entity: Option<EmergencyAccessIdViewPostError> = serde_json::from_str(&content).ok();
921 Err(Error::ResponseError(ResponseContent {
922 status,
923 content,
924 entity,
925 }))
926 }
927}
928
929pub async fn emergency_access_invite_post(
930 configuration: &configuration::Configuration,
931 emergency_access_invite_request_model: Option<models::EmergencyAccessInviteRequestModel>,
932) -> Result<(), Error<EmergencyAccessInvitePostError>> {
933 let p_emergency_access_invite_request_model = emergency_access_invite_request_model;
935
936 let uri_str = format!("{}/emergency-access/invite", configuration.base_path);
937 let mut req_builder = configuration
938 .client
939 .request(reqwest::Method::POST, &uri_str);
940
941 if let Some(ref user_agent) = configuration.user_agent {
942 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
943 }
944 if let Some(ref token) = configuration.oauth_access_token {
945 req_builder = req_builder.bearer_auth(token.to_owned());
946 };
947 req_builder = req_builder.json(&p_emergency_access_invite_request_model);
948
949 let req = req_builder.build()?;
950 let resp = configuration.client.execute(req).await?;
951
952 let status = resp.status();
953
954 if !status.is_client_error() && !status.is_server_error() {
955 Ok(())
956 } else {
957 let content = resp.text().await?;
958 let entity: Option<EmergencyAccessInvitePostError> = serde_json::from_str(&content).ok();
959 Err(Error::ResponseError(ResponseContent {
960 status,
961 content,
962 entity,
963 }))
964 }
965}
966
967pub async fn emergency_access_trusted_get(
968 configuration: &configuration::Configuration,
969) -> Result<
970 models::EmergencyAccessGranteeDetailsResponseModelListResponseModel,
971 Error<EmergencyAccessTrustedGetError>,
972> {
973 let uri_str = format!("{}/emergency-access/trusted", configuration.base_path);
974 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
975
976 if let Some(ref user_agent) = configuration.user_agent {
977 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
978 }
979 if let Some(ref token) = configuration.oauth_access_token {
980 req_builder = req_builder.bearer_auth(token.to_owned());
981 };
982
983 let req = req_builder.build()?;
984 let resp = configuration.client.execute(req).await?;
985
986 let status = resp.status();
987 let content_type = resp
988 .headers()
989 .get("content-type")
990 .and_then(|v| v.to_str().ok())
991 .unwrap_or("application/octet-stream");
992 let content_type = super::ContentType::from(content_type);
993
994 if !status.is_client_error() && !status.is_server_error() {
995 let content = resp.text().await?;
996 match content_type {
997 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
998 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::EmergencyAccessGranteeDetailsResponseModelListResponseModel`"))),
999 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::EmergencyAccessGranteeDetailsResponseModelListResponseModel`")))),
1000 }
1001 } else {
1002 let content = resp.text().await?;
1003 let entity: Option<EmergencyAccessTrustedGetError> = serde_json::from_str(&content).ok();
1004 Err(Error::ResponseError(ResponseContent {
1005 status,
1006 content,
1007 entity,
1008 }))
1009 }
1010}