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