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 CiphersAdminDeleteError {
21 UnknownValue(serde_json::Value),
22}
23
24#[derive(Debug, Clone, Serialize, Deserialize)]
26#[serde(untagged)]
27pub enum CiphersAdminPostError {
28 UnknownValue(serde_json::Value),
29}
30
31#[derive(Debug, Clone, Serialize, Deserialize)]
33#[serde(untagged)]
34pub enum CiphersAttachmentValidateAzurePostError {
35 UnknownValue(serde_json::Value),
36}
37
38#[derive(Debug, Clone, Serialize, Deserialize)]
40#[serde(untagged)]
41pub enum CiphersBulkCollectionsPostError {
42 UnknownValue(serde_json::Value),
43}
44
45#[derive(Debug, Clone, Serialize, Deserialize)]
47#[serde(untagged)]
48pub enum CiphersCreatePostError {
49 UnknownValue(serde_json::Value),
50}
51
52#[derive(Debug, Clone, Serialize, Deserialize)]
54#[serde(untagged)]
55pub enum CiphersDeleteError {
56 UnknownValue(serde_json::Value),
57}
58
59#[derive(Debug, Clone, Serialize, Deserialize)]
61#[serde(untagged)]
62pub enum CiphersDeleteAdminPostError {
63 UnknownValue(serde_json::Value),
64}
65
66#[derive(Debug, Clone, Serialize, Deserialize)]
68#[serde(untagged)]
69pub enum CiphersDeleteAdminPutError {
70 UnknownValue(serde_json::Value),
71}
72
73#[derive(Debug, Clone, Serialize, Deserialize)]
75#[serde(untagged)]
76pub enum CiphersDeletePostError {
77 UnknownValue(serde_json::Value),
78}
79
80#[derive(Debug, Clone, Serialize, Deserialize)]
82#[serde(untagged)]
83pub enum CiphersDeletePutError {
84 UnknownValue(serde_json::Value),
85}
86
87#[derive(Debug, Clone, Serialize, Deserialize)]
89#[serde(untagged)]
90pub enum CiphersGetError {
91 UnknownValue(serde_json::Value),
92}
93
94#[derive(Debug, Clone, Serialize, Deserialize)]
96#[serde(untagged)]
97pub enum CiphersIdAdminDeleteError {
98 UnknownValue(serde_json::Value),
99}
100
101#[derive(Debug, Clone, Serialize, Deserialize)]
103#[serde(untagged)]
104pub enum CiphersIdAdminGetError {
105 UnknownValue(serde_json::Value),
106}
107
108#[derive(Debug, Clone, Serialize, Deserialize)]
110#[serde(untagged)]
111pub enum CiphersIdAdminPostError {
112 UnknownValue(serde_json::Value),
113}
114
115#[derive(Debug, Clone, Serialize, Deserialize)]
117#[serde(untagged)]
118pub enum CiphersIdAdminPutError {
119 UnknownValue(serde_json::Value),
120}
121
122#[derive(Debug, Clone, Serialize, Deserialize)]
124#[serde(untagged)]
125pub enum CiphersIdAttachmentAdminPostError {
126 UnknownValue(serde_json::Value),
127}
128
129#[derive(Debug, Clone, Serialize, Deserialize)]
131#[serde(untagged)]
132pub enum CiphersIdAttachmentAttachmentIdAdminDeleteError {
133 UnknownValue(serde_json::Value),
134}
135
136#[derive(Debug, Clone, Serialize, Deserialize)]
138#[serde(untagged)]
139pub enum CiphersIdAttachmentAttachmentIdAdminGetError {
140 UnknownValue(serde_json::Value),
141}
142
143#[derive(Debug, Clone, Serialize, Deserialize)]
145#[serde(untagged)]
146pub enum CiphersIdAttachmentAttachmentIdDeleteError {
147 UnknownValue(serde_json::Value),
148}
149
150#[derive(Debug, Clone, Serialize, Deserialize)]
152#[serde(untagged)]
153pub enum CiphersIdAttachmentAttachmentIdDeleteAdminPostError {
154 UnknownValue(serde_json::Value),
155}
156
157#[derive(Debug, Clone, Serialize, Deserialize)]
159#[serde(untagged)]
160pub enum CiphersIdAttachmentAttachmentIdDeletePostError {
161 UnknownValue(serde_json::Value),
162}
163
164#[derive(Debug, Clone, Serialize, Deserialize)]
166#[serde(untagged)]
167pub enum CiphersIdAttachmentAttachmentIdGetError {
168 UnknownValue(serde_json::Value),
169}
170
171#[derive(Debug, Clone, Serialize, Deserialize)]
173#[serde(untagged)]
174pub enum CiphersIdAttachmentAttachmentIdPostError {
175 UnknownValue(serde_json::Value),
176}
177
178#[derive(Debug, Clone, Serialize, Deserialize)]
180#[serde(untagged)]
181pub enum CiphersIdAttachmentAttachmentIdRenewGetError {
182 UnknownValue(serde_json::Value),
183}
184
185#[derive(Debug, Clone, Serialize, Deserialize)]
187#[serde(untagged)]
188pub enum CiphersIdAttachmentAttachmentIdSharePostError {
189 UnknownValue(serde_json::Value),
190}
191
192#[derive(Debug, Clone, Serialize, Deserialize)]
194#[serde(untagged)]
195pub enum CiphersIdAttachmentPostError {
196 UnknownValue(serde_json::Value),
197}
198
199#[derive(Debug, Clone, Serialize, Deserialize)]
201#[serde(untagged)]
202pub enum CiphersIdAttachmentV2PostError {
203 UnknownValue(serde_json::Value),
204}
205
206#[derive(Debug, Clone, Serialize, Deserialize)]
208#[serde(untagged)]
209pub enum CiphersIdCollectionsAdminPostError {
210 UnknownValue(serde_json::Value),
211}
212
213#[derive(Debug, Clone, Serialize, Deserialize)]
215#[serde(untagged)]
216pub enum CiphersIdCollectionsAdminPutError {
217 UnknownValue(serde_json::Value),
218}
219
220#[derive(Debug, Clone, Serialize, Deserialize)]
222#[serde(untagged)]
223pub enum CiphersIdCollectionsPostError {
224 UnknownValue(serde_json::Value),
225}
226
227#[derive(Debug, Clone, Serialize, Deserialize)]
229#[serde(untagged)]
230pub enum CiphersIdCollectionsPutError {
231 UnknownValue(serde_json::Value),
232}
233
234#[derive(Debug, Clone, Serialize, Deserialize)]
236#[serde(untagged)]
237pub enum CiphersIdCollectionsV2PostError {
238 UnknownValue(serde_json::Value),
239}
240
241#[derive(Debug, Clone, Serialize, Deserialize)]
243#[serde(untagged)]
244pub enum CiphersIdCollectionsV2PutError {
245 UnknownValue(serde_json::Value),
246}
247
248#[derive(Debug, Clone, Serialize, Deserialize)]
250#[serde(untagged)]
251pub enum CiphersIdDeleteError {
252 UnknownValue(serde_json::Value),
253}
254
255#[derive(Debug, Clone, Serialize, Deserialize)]
257#[serde(untagged)]
258pub enum CiphersIdDeleteAdminPostError {
259 UnknownValue(serde_json::Value),
260}
261
262#[derive(Debug, Clone, Serialize, Deserialize)]
264#[serde(untagged)]
265pub enum CiphersIdDeleteAdminPutError {
266 UnknownValue(serde_json::Value),
267}
268
269#[derive(Debug, Clone, Serialize, Deserialize)]
271#[serde(untagged)]
272pub enum CiphersIdDeletePostError {
273 UnknownValue(serde_json::Value),
274}
275
276#[derive(Debug, Clone, Serialize, Deserialize)]
278#[serde(untagged)]
279pub enum CiphersIdDeletePutError {
280 UnknownValue(serde_json::Value),
281}
282
283#[derive(Debug, Clone, Serialize, Deserialize)]
285#[serde(untagged)]
286pub enum CiphersIdDetailsGetError {
287 UnknownValue(serde_json::Value),
288}
289
290#[derive(Debug, Clone, Serialize, Deserialize)]
292#[serde(untagged)]
293pub enum CiphersIdFullDetailsGetError {
294 UnknownValue(serde_json::Value),
295}
296
297#[derive(Debug, Clone, Serialize, Deserialize)]
299#[serde(untagged)]
300pub enum CiphersIdGetError {
301 UnknownValue(serde_json::Value),
302}
303
304#[derive(Debug, Clone, Serialize, Deserialize)]
306#[serde(untagged)]
307pub enum CiphersIdPartialPostError {
308 UnknownValue(serde_json::Value),
309}
310
311#[derive(Debug, Clone, Serialize, Deserialize)]
313#[serde(untagged)]
314pub enum CiphersIdPartialPutError {
315 UnknownValue(serde_json::Value),
316}
317
318#[derive(Debug, Clone, Serialize, Deserialize)]
320#[serde(untagged)]
321pub enum CiphersIdPostError {
322 UnknownValue(serde_json::Value),
323}
324
325#[derive(Debug, Clone, Serialize, Deserialize)]
327#[serde(untagged)]
328pub enum CiphersIdPutError {
329 UnknownValue(serde_json::Value),
330}
331
332#[derive(Debug, Clone, Serialize, Deserialize)]
334#[serde(untagged)]
335pub enum CiphersIdRestoreAdminPutError {
336 UnknownValue(serde_json::Value),
337}
338
339#[derive(Debug, Clone, Serialize, Deserialize)]
341#[serde(untagged)]
342pub enum CiphersIdRestorePutError {
343 UnknownValue(serde_json::Value),
344}
345
346#[derive(Debug, Clone, Serialize, Deserialize)]
348#[serde(untagged)]
349pub enum CiphersIdSharePostError {
350 UnknownValue(serde_json::Value),
351}
352
353#[derive(Debug, Clone, Serialize, Deserialize)]
355#[serde(untagged)]
356pub enum CiphersIdSharePutError {
357 UnknownValue(serde_json::Value),
358}
359
360#[derive(Debug, Clone, Serialize, Deserialize)]
362#[serde(untagged)]
363pub enum CiphersMovePostError {
364 UnknownValue(serde_json::Value),
365}
366
367#[derive(Debug, Clone, Serialize, Deserialize)]
369#[serde(untagged)]
370pub enum CiphersMovePutError {
371 UnknownValue(serde_json::Value),
372}
373
374#[derive(Debug, Clone, Serialize, Deserialize)]
376#[serde(untagged)]
377pub enum CiphersOrganizationDetailsAssignedGetError {
378 UnknownValue(serde_json::Value),
379}
380
381#[derive(Debug, Clone, Serialize, Deserialize)]
383#[serde(untagged)]
384pub enum CiphersOrganizationDetailsGetError {
385 UnknownValue(serde_json::Value),
386}
387
388#[derive(Debug, Clone, Serialize, Deserialize)]
390#[serde(untagged)]
391pub enum CiphersPostError {
392 UnknownValue(serde_json::Value),
393}
394
395#[derive(Debug, Clone, Serialize, Deserialize)]
397#[serde(untagged)]
398pub enum CiphersPurgePostError {
399 UnknownValue(serde_json::Value),
400}
401
402#[derive(Debug, Clone, Serialize, Deserialize)]
404#[serde(untagged)]
405pub enum CiphersRestoreAdminPutError {
406 UnknownValue(serde_json::Value),
407}
408
409#[derive(Debug, Clone, Serialize, Deserialize)]
411#[serde(untagged)]
412pub enum CiphersRestorePutError {
413 UnknownValue(serde_json::Value),
414}
415
416#[derive(Debug, Clone, Serialize, Deserialize)]
418#[serde(untagged)]
419pub enum CiphersSharePostError {
420 UnknownValue(serde_json::Value),
421}
422
423#[derive(Debug, Clone, Serialize, Deserialize)]
425#[serde(untagged)]
426pub enum CiphersSharePutError {
427 UnknownValue(serde_json::Value),
428}
429
430pub async fn ciphers_admin_delete(
431 configuration: &configuration::Configuration,
432 cipher_bulk_delete_request_model: Option<models::CipherBulkDeleteRequestModel>,
433) -> Result<(), Error<CiphersAdminDeleteError>> {
434 let p_cipher_bulk_delete_request_model = cipher_bulk_delete_request_model;
436
437 let uri_str = format!("{}/ciphers/admin", configuration.base_path);
438 let mut req_builder = configuration
439 .client
440 .request(reqwest::Method::DELETE, &uri_str);
441
442 if let Some(ref user_agent) = configuration.user_agent {
443 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
444 }
445 if let Some(ref token) = configuration.oauth_access_token {
446 req_builder = req_builder.bearer_auth(token.to_owned());
447 };
448 req_builder = req_builder.json(&p_cipher_bulk_delete_request_model);
449
450 let req = req_builder.build()?;
451 let resp = configuration.client.execute(req).await?;
452
453 let status = resp.status();
454
455 if !status.is_client_error() && !status.is_server_error() {
456 Ok(())
457 } else {
458 let content = resp.text().await?;
459 let entity: Option<CiphersAdminDeleteError> = serde_json::from_str(&content).ok();
460 Err(Error::ResponseError(ResponseContent {
461 status,
462 content,
463 entity,
464 }))
465 }
466}
467
468pub async fn ciphers_admin_post(
469 configuration: &configuration::Configuration,
470 cipher_create_request_model: Option<models::CipherCreateRequestModel>,
471) -> Result<models::CipherMiniResponseModel, Error<CiphersAdminPostError>> {
472 let p_cipher_create_request_model = cipher_create_request_model;
474
475 let uri_str = format!("{}/ciphers/admin", configuration.base_path);
476 let mut req_builder = configuration
477 .client
478 .request(reqwest::Method::POST, &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 req_builder = req_builder.json(&p_cipher_create_request_model);
487
488 let req = req_builder.build()?;
489 let resp = configuration.client.execute(req).await?;
490
491 let status = resp.status();
492 let content_type = resp
493 .headers()
494 .get("content-type")
495 .and_then(|v| v.to_str().ok())
496 .unwrap_or("application/octet-stream");
497 let content_type = super::ContentType::from(content_type);
498
499 if !status.is_client_error() && !status.is_server_error() {
500 let content = resp.text().await?;
501 match content_type {
502 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
503 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherMiniResponseModel`"))),
504 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::CipherMiniResponseModel`")))),
505 }
506 } else {
507 let content = resp.text().await?;
508 let entity: Option<CiphersAdminPostError> = serde_json::from_str(&content).ok();
509 Err(Error::ResponseError(ResponseContent {
510 status,
511 content,
512 entity,
513 }))
514 }
515}
516
517pub async fn ciphers_attachment_validate_azure_post(
518 configuration: &configuration::Configuration,
519) -> Result<(), Error<CiphersAttachmentValidateAzurePostError>> {
520 let uri_str = format!(
521 "{}/ciphers/attachment/validate/azure",
522 configuration.base_path
523 );
524 let mut req_builder = configuration
525 .client
526 .request(reqwest::Method::POST, &uri_str);
527
528 if let Some(ref user_agent) = configuration.user_agent {
529 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
530 }
531 if let Some(ref token) = configuration.oauth_access_token {
532 req_builder = req_builder.bearer_auth(token.to_owned());
533 };
534
535 let req = req_builder.build()?;
536 let resp = configuration.client.execute(req).await?;
537
538 let status = resp.status();
539
540 if !status.is_client_error() && !status.is_server_error() {
541 Ok(())
542 } else {
543 let content = resp.text().await?;
544 let entity: Option<CiphersAttachmentValidateAzurePostError> =
545 serde_json::from_str(&content).ok();
546 Err(Error::ResponseError(ResponseContent {
547 status,
548 content,
549 entity,
550 }))
551 }
552}
553
554pub async fn ciphers_bulk_collections_post(
555 configuration: &configuration::Configuration,
556 cipher_bulk_update_collections_request_model: Option<
557 models::CipherBulkUpdateCollectionsRequestModel,
558 >,
559) -> Result<(), Error<CiphersBulkCollectionsPostError>> {
560 let p_cipher_bulk_update_collections_request_model =
562 cipher_bulk_update_collections_request_model;
563
564 let uri_str = format!("{}/ciphers/bulk-collections", configuration.base_path);
565 let mut req_builder = configuration
566 .client
567 .request(reqwest::Method::POST, &uri_str);
568
569 if let Some(ref user_agent) = configuration.user_agent {
570 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
571 }
572 if let Some(ref token) = configuration.oauth_access_token {
573 req_builder = req_builder.bearer_auth(token.to_owned());
574 };
575 req_builder = req_builder.json(&p_cipher_bulk_update_collections_request_model);
576
577 let req = req_builder.build()?;
578 let resp = configuration.client.execute(req).await?;
579
580 let status = resp.status();
581
582 if !status.is_client_error() && !status.is_server_error() {
583 Ok(())
584 } else {
585 let content = resp.text().await?;
586 let entity: Option<CiphersBulkCollectionsPostError> = serde_json::from_str(&content).ok();
587 Err(Error::ResponseError(ResponseContent {
588 status,
589 content,
590 entity,
591 }))
592 }
593}
594
595pub async fn ciphers_create_post(
596 configuration: &configuration::Configuration,
597 cipher_create_request_model: Option<models::CipherCreateRequestModel>,
598) -> Result<models::CipherResponseModel, Error<CiphersCreatePostError>> {
599 let p_cipher_create_request_model = cipher_create_request_model;
601
602 let uri_str = format!("{}/ciphers/create", configuration.base_path);
603 let mut req_builder = configuration
604 .client
605 .request(reqwest::Method::POST, &uri_str);
606
607 if let Some(ref user_agent) = configuration.user_agent {
608 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
609 }
610 if let Some(ref token) = configuration.oauth_access_token {
611 req_builder = req_builder.bearer_auth(token.to_owned());
612 };
613 req_builder = req_builder.json(&p_cipher_create_request_model);
614
615 let req = req_builder.build()?;
616 let resp = configuration.client.execute(req).await?;
617
618 let status = resp.status();
619 let content_type = resp
620 .headers()
621 .get("content-type")
622 .and_then(|v| v.to_str().ok())
623 .unwrap_or("application/octet-stream");
624 let content_type = super::ContentType::from(content_type);
625
626 if !status.is_client_error() && !status.is_server_error() {
627 let content = resp.text().await?;
628 match content_type {
629 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
630 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherResponseModel`"))),
631 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::CipherResponseModel`")))),
632 }
633 } else {
634 let content = resp.text().await?;
635 let entity: Option<CiphersCreatePostError> = serde_json::from_str(&content).ok();
636 Err(Error::ResponseError(ResponseContent {
637 status,
638 content,
639 entity,
640 }))
641 }
642}
643
644pub async fn ciphers_delete(
645 configuration: &configuration::Configuration,
646 cipher_bulk_delete_request_model: Option<models::CipherBulkDeleteRequestModel>,
647) -> Result<(), Error<CiphersDeleteError>> {
648 let p_cipher_bulk_delete_request_model = cipher_bulk_delete_request_model;
650
651 let uri_str = format!("{}/ciphers", configuration.base_path);
652 let mut req_builder = configuration
653 .client
654 .request(reqwest::Method::DELETE, &uri_str);
655
656 if let Some(ref user_agent) = configuration.user_agent {
657 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
658 }
659 if let Some(ref token) = configuration.oauth_access_token {
660 req_builder = req_builder.bearer_auth(token.to_owned());
661 };
662 req_builder = req_builder.json(&p_cipher_bulk_delete_request_model);
663
664 let req = req_builder.build()?;
665 let resp = configuration.client.execute(req).await?;
666
667 let status = resp.status();
668
669 if !status.is_client_error() && !status.is_server_error() {
670 Ok(())
671 } else {
672 let content = resp.text().await?;
673 let entity: Option<CiphersDeleteError> = serde_json::from_str(&content).ok();
674 Err(Error::ResponseError(ResponseContent {
675 status,
676 content,
677 entity,
678 }))
679 }
680}
681
682pub async fn ciphers_delete_admin_post(
683 configuration: &configuration::Configuration,
684 cipher_bulk_delete_request_model: Option<models::CipherBulkDeleteRequestModel>,
685) -> Result<(), Error<CiphersDeleteAdminPostError>> {
686 let p_cipher_bulk_delete_request_model = cipher_bulk_delete_request_model;
688
689 let uri_str = format!("{}/ciphers/delete-admin", configuration.base_path);
690 let mut req_builder = configuration
691 .client
692 .request(reqwest::Method::POST, &uri_str);
693
694 if let Some(ref user_agent) = configuration.user_agent {
695 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
696 }
697 if let Some(ref token) = configuration.oauth_access_token {
698 req_builder = req_builder.bearer_auth(token.to_owned());
699 };
700 req_builder = req_builder.json(&p_cipher_bulk_delete_request_model);
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<CiphersDeleteAdminPostError> = serde_json::from_str(&content).ok();
712 Err(Error::ResponseError(ResponseContent {
713 status,
714 content,
715 entity,
716 }))
717 }
718}
719
720pub async fn ciphers_delete_admin_put(
721 configuration: &configuration::Configuration,
722 cipher_bulk_delete_request_model: Option<models::CipherBulkDeleteRequestModel>,
723) -> Result<(), Error<CiphersDeleteAdminPutError>> {
724 let p_cipher_bulk_delete_request_model = cipher_bulk_delete_request_model;
726
727 let uri_str = format!("{}/ciphers/delete-admin", configuration.base_path);
728 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
729
730 if let Some(ref user_agent) = configuration.user_agent {
731 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
732 }
733 if let Some(ref token) = configuration.oauth_access_token {
734 req_builder = req_builder.bearer_auth(token.to_owned());
735 };
736 req_builder = req_builder.json(&p_cipher_bulk_delete_request_model);
737
738 let req = req_builder.build()?;
739 let resp = configuration.client.execute(req).await?;
740
741 let status = resp.status();
742
743 if !status.is_client_error() && !status.is_server_error() {
744 Ok(())
745 } else {
746 let content = resp.text().await?;
747 let entity: Option<CiphersDeleteAdminPutError> = serde_json::from_str(&content).ok();
748 Err(Error::ResponseError(ResponseContent {
749 status,
750 content,
751 entity,
752 }))
753 }
754}
755
756pub async fn ciphers_delete_post(
757 configuration: &configuration::Configuration,
758 cipher_bulk_delete_request_model: Option<models::CipherBulkDeleteRequestModel>,
759) -> Result<(), Error<CiphersDeletePostError>> {
760 let p_cipher_bulk_delete_request_model = cipher_bulk_delete_request_model;
762
763 let uri_str = format!("{}/ciphers/delete", configuration.base_path);
764 let mut req_builder = configuration
765 .client
766 .request(reqwest::Method::POST, &uri_str);
767
768 if let Some(ref user_agent) = configuration.user_agent {
769 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
770 }
771 if let Some(ref token) = configuration.oauth_access_token {
772 req_builder = req_builder.bearer_auth(token.to_owned());
773 };
774 req_builder = req_builder.json(&p_cipher_bulk_delete_request_model);
775
776 let req = req_builder.build()?;
777 let resp = configuration.client.execute(req).await?;
778
779 let status = resp.status();
780
781 if !status.is_client_error() && !status.is_server_error() {
782 Ok(())
783 } else {
784 let content = resp.text().await?;
785 let entity: Option<CiphersDeletePostError> = serde_json::from_str(&content).ok();
786 Err(Error::ResponseError(ResponseContent {
787 status,
788 content,
789 entity,
790 }))
791 }
792}
793
794pub async fn ciphers_delete_put(
795 configuration: &configuration::Configuration,
796 cipher_bulk_delete_request_model: Option<models::CipherBulkDeleteRequestModel>,
797) -> Result<(), Error<CiphersDeletePutError>> {
798 let p_cipher_bulk_delete_request_model = cipher_bulk_delete_request_model;
800
801 let uri_str = format!("{}/ciphers/delete", configuration.base_path);
802 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
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.oauth_access_token {
808 req_builder = req_builder.bearer_auth(token.to_owned());
809 };
810 req_builder = req_builder.json(&p_cipher_bulk_delete_request_model);
811
812 let req = req_builder.build()?;
813 let resp = configuration.client.execute(req).await?;
814
815 let status = resp.status();
816
817 if !status.is_client_error() && !status.is_server_error() {
818 Ok(())
819 } else {
820 let content = resp.text().await?;
821 let entity: Option<CiphersDeletePutError> = serde_json::from_str(&content).ok();
822 Err(Error::ResponseError(ResponseContent {
823 status,
824 content,
825 entity,
826 }))
827 }
828}
829
830pub async fn ciphers_get(
831 configuration: &configuration::Configuration,
832) -> Result<models::CipherDetailsResponseModelListResponseModel, Error<CiphersGetError>> {
833 let uri_str = format!("{}/ciphers", configuration.base_path);
834 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
835
836 if let Some(ref user_agent) = configuration.user_agent {
837 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
838 }
839 if let Some(ref token) = configuration.oauth_access_token {
840 req_builder = req_builder.bearer_auth(token.to_owned());
841 };
842
843 let req = req_builder.build()?;
844 let resp = configuration.client.execute(req).await?;
845
846 let status = resp.status();
847 let content_type = resp
848 .headers()
849 .get("content-type")
850 .and_then(|v| v.to_str().ok())
851 .unwrap_or("application/octet-stream");
852 let content_type = super::ContentType::from(content_type);
853
854 if !status.is_client_error() && !status.is_server_error() {
855 let content = resp.text().await?;
856 match content_type {
857 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
858 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherDetailsResponseModelListResponseModel`"))),
859 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::CipherDetailsResponseModelListResponseModel`")))),
860 }
861 } else {
862 let content = resp.text().await?;
863 let entity: Option<CiphersGetError> = serde_json::from_str(&content).ok();
864 Err(Error::ResponseError(ResponseContent {
865 status,
866 content,
867 entity,
868 }))
869 }
870}
871
872pub async fn ciphers_id_admin_delete(
873 configuration: &configuration::Configuration,
874 id: uuid::Uuid,
875) -> Result<(), Error<CiphersIdAdminDeleteError>> {
876 let p_id = id;
878
879 let uri_str = format!(
880 "{}/ciphers/{id}/admin",
881 configuration.base_path,
882 id = crate::apis::urlencode(p_id.to_string())
883 );
884 let mut req_builder = configuration
885 .client
886 .request(reqwest::Method::DELETE, &uri_str);
887
888 if let Some(ref user_agent) = configuration.user_agent {
889 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
890 }
891 if let Some(ref token) = configuration.oauth_access_token {
892 req_builder = req_builder.bearer_auth(token.to_owned());
893 };
894
895 let req = req_builder.build()?;
896 let resp = configuration.client.execute(req).await?;
897
898 let status = resp.status();
899
900 if !status.is_client_error() && !status.is_server_error() {
901 Ok(())
902 } else {
903 let content = resp.text().await?;
904 let entity: Option<CiphersIdAdminDeleteError> = serde_json::from_str(&content).ok();
905 Err(Error::ResponseError(ResponseContent {
906 status,
907 content,
908 entity,
909 }))
910 }
911}
912
913pub async fn ciphers_id_admin_get(
914 configuration: &configuration::Configuration,
915 id: &str,
916) -> Result<models::CipherMiniResponseModel, Error<CiphersIdAdminGetError>> {
917 let p_id = id;
919
920 let uri_str = format!(
921 "{}/ciphers/{id}/admin",
922 configuration.base_path,
923 id = crate::apis::urlencode(p_id)
924 );
925 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
926
927 if let Some(ref user_agent) = configuration.user_agent {
928 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
929 }
930 if let Some(ref token) = configuration.oauth_access_token {
931 req_builder = req_builder.bearer_auth(token.to_owned());
932 };
933
934 let req = req_builder.build()?;
935 let resp = configuration.client.execute(req).await?;
936
937 let status = resp.status();
938 let content_type = resp
939 .headers()
940 .get("content-type")
941 .and_then(|v| v.to_str().ok())
942 .unwrap_or("application/octet-stream");
943 let content_type = super::ContentType::from(content_type);
944
945 if !status.is_client_error() && !status.is_server_error() {
946 let content = resp.text().await?;
947 match content_type {
948 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
949 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherMiniResponseModel`"))),
950 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::CipherMiniResponseModel`")))),
951 }
952 } else {
953 let content = resp.text().await?;
954 let entity: Option<CiphersIdAdminGetError> = serde_json::from_str(&content).ok();
955 Err(Error::ResponseError(ResponseContent {
956 status,
957 content,
958 entity,
959 }))
960 }
961}
962
963pub async fn ciphers_id_admin_post(
964 configuration: &configuration::Configuration,
965 id: uuid::Uuid,
966 cipher_request_model: Option<models::CipherRequestModel>,
967) -> Result<models::CipherMiniResponseModel, Error<CiphersIdAdminPostError>> {
968 let p_id = id;
970 let p_cipher_request_model = cipher_request_model;
971
972 let uri_str = format!(
973 "{}/ciphers/{id}/admin",
974 configuration.base_path,
975 id = crate::apis::urlencode(p_id.to_string())
976 );
977 let mut req_builder = configuration
978 .client
979 .request(reqwest::Method::POST, &uri_str);
980
981 if let Some(ref user_agent) = configuration.user_agent {
982 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
983 }
984 if let Some(ref token) = configuration.oauth_access_token {
985 req_builder = req_builder.bearer_auth(token.to_owned());
986 };
987 req_builder = req_builder.json(&p_cipher_request_model);
988
989 let req = req_builder.build()?;
990 let resp = configuration.client.execute(req).await?;
991
992 let status = resp.status();
993 let content_type = resp
994 .headers()
995 .get("content-type")
996 .and_then(|v| v.to_str().ok())
997 .unwrap_or("application/octet-stream");
998 let content_type = super::ContentType::from(content_type);
999
1000 if !status.is_client_error() && !status.is_server_error() {
1001 let content = resp.text().await?;
1002 match content_type {
1003 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1004 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherMiniResponseModel`"))),
1005 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::CipherMiniResponseModel`")))),
1006 }
1007 } else {
1008 let content = resp.text().await?;
1009 let entity: Option<CiphersIdAdminPostError> = serde_json::from_str(&content).ok();
1010 Err(Error::ResponseError(ResponseContent {
1011 status,
1012 content,
1013 entity,
1014 }))
1015 }
1016}
1017
1018pub async fn ciphers_id_admin_put(
1019 configuration: &configuration::Configuration,
1020 id: uuid::Uuid,
1021 cipher_request_model: Option<models::CipherRequestModel>,
1022) -> Result<models::CipherMiniResponseModel, Error<CiphersIdAdminPutError>> {
1023 let p_id = id;
1025 let p_cipher_request_model = cipher_request_model;
1026
1027 let uri_str = format!(
1028 "{}/ciphers/{id}/admin",
1029 configuration.base_path,
1030 id = crate::apis::urlencode(p_id.to_string())
1031 );
1032 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1033
1034 if let Some(ref user_agent) = configuration.user_agent {
1035 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1036 }
1037 if let Some(ref token) = configuration.oauth_access_token {
1038 req_builder = req_builder.bearer_auth(token.to_owned());
1039 };
1040 req_builder = req_builder.json(&p_cipher_request_model);
1041
1042 let req = req_builder.build()?;
1043 let resp = configuration.client.execute(req).await?;
1044
1045 let status = resp.status();
1046 let content_type = resp
1047 .headers()
1048 .get("content-type")
1049 .and_then(|v| v.to_str().ok())
1050 .unwrap_or("application/octet-stream");
1051 let content_type = super::ContentType::from(content_type);
1052
1053 if !status.is_client_error() && !status.is_server_error() {
1054 let content = resp.text().await?;
1055 match content_type {
1056 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1057 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherMiniResponseModel`"))),
1058 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::CipherMiniResponseModel`")))),
1059 }
1060 } else {
1061 let content = resp.text().await?;
1062 let entity: Option<CiphersIdAdminPutError> = serde_json::from_str(&content).ok();
1063 Err(Error::ResponseError(ResponseContent {
1064 status,
1065 content,
1066 entity,
1067 }))
1068 }
1069}
1070
1071pub async fn ciphers_id_attachment_admin_post(
1072 configuration: &configuration::Configuration,
1073 id: &str,
1074) -> Result<models::CipherMiniResponseModel, Error<CiphersIdAttachmentAdminPostError>> {
1075 let p_id = id;
1077
1078 let uri_str = format!(
1079 "{}/ciphers/{id}/attachment-admin",
1080 configuration.base_path,
1081 id = crate::apis::urlencode(p_id)
1082 );
1083 let mut req_builder = configuration
1084 .client
1085 .request(reqwest::Method::POST, &uri_str);
1086
1087 if let Some(ref user_agent) = configuration.user_agent {
1088 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1089 }
1090 if let Some(ref token) = configuration.oauth_access_token {
1091 req_builder = req_builder.bearer_auth(token.to_owned());
1092 };
1093
1094 let req = req_builder.build()?;
1095 let resp = configuration.client.execute(req).await?;
1096
1097 let status = resp.status();
1098 let content_type = resp
1099 .headers()
1100 .get("content-type")
1101 .and_then(|v| v.to_str().ok())
1102 .unwrap_or("application/octet-stream");
1103 let content_type = super::ContentType::from(content_type);
1104
1105 if !status.is_client_error() && !status.is_server_error() {
1106 let content = resp.text().await?;
1107 match content_type {
1108 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1109 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherMiniResponseModel`"))),
1110 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::CipherMiniResponseModel`")))),
1111 }
1112 } else {
1113 let content = resp.text().await?;
1114 let entity: Option<CiphersIdAttachmentAdminPostError> = serde_json::from_str(&content).ok();
1115 Err(Error::ResponseError(ResponseContent {
1116 status,
1117 content,
1118 entity,
1119 }))
1120 }
1121}
1122
1123pub async fn ciphers_id_attachment_attachment_id_admin_delete(
1124 configuration: &configuration::Configuration,
1125 id: uuid::Uuid,
1126 attachment_id: &str,
1127) -> Result<
1128 models::DeleteAttachmentResponseData,
1129 Error<CiphersIdAttachmentAttachmentIdAdminDeleteError>,
1130> {
1131 let p_id = id;
1133 let p_attachment_id = attachment_id;
1134
1135 let uri_str = format!(
1136 "{}/ciphers/{id}/attachment/{attachmentId}/admin",
1137 configuration.base_path,
1138 id = crate::apis::urlencode(p_id.to_string()),
1139 attachmentId = crate::apis::urlencode(p_attachment_id)
1140 );
1141 let mut req_builder = configuration
1142 .client
1143 .request(reqwest::Method::DELETE, &uri_str);
1144
1145 if let Some(ref user_agent) = configuration.user_agent {
1146 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1147 }
1148 if let Some(ref token) = configuration.oauth_access_token {
1149 req_builder = req_builder.bearer_auth(token.to_owned());
1150 };
1151
1152 let req = req_builder.build()?;
1153 let resp = configuration.client.execute(req).await?;
1154
1155 let status = resp.status();
1156 let content_type = resp
1157 .headers()
1158 .get("content-type")
1159 .and_then(|v| v.to_str().ok())
1160 .unwrap_or("application/octet-stream");
1161 let content_type = super::ContentType::from(content_type);
1162
1163 if !status.is_client_error() && !status.is_server_error() {
1164 let content = resp.text().await?;
1165 match content_type {
1166 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1167 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeleteAttachmentResponseData`"))),
1168 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::DeleteAttachmentResponseData`")))),
1169 }
1170 } else {
1171 let content = resp.text().await?;
1172 let entity: Option<CiphersIdAttachmentAttachmentIdAdminDeleteError> =
1173 serde_json::from_str(&content).ok();
1174 Err(Error::ResponseError(ResponseContent {
1175 status,
1176 content,
1177 entity,
1178 }))
1179 }
1180}
1181
1182pub async fn ciphers_id_attachment_attachment_id_admin_get(
1183 configuration: &configuration::Configuration,
1184 id: uuid::Uuid,
1185 attachment_id: &str,
1186) -> Result<models::AttachmentResponseModel, Error<CiphersIdAttachmentAttachmentIdAdminGetError>> {
1187 let p_id = id;
1189 let p_attachment_id = attachment_id;
1190
1191 let uri_str = format!(
1192 "{}/ciphers/{id}/attachment/{attachmentId}/admin",
1193 configuration.base_path,
1194 id = crate::apis::urlencode(p_id.to_string()),
1195 attachmentId = crate::apis::urlencode(p_attachment_id)
1196 );
1197 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1198
1199 if let Some(ref user_agent) = configuration.user_agent {
1200 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1201 }
1202 if let Some(ref token) = configuration.oauth_access_token {
1203 req_builder = req_builder.bearer_auth(token.to_owned());
1204 };
1205
1206 let req = req_builder.build()?;
1207 let resp = configuration.client.execute(req).await?;
1208
1209 let status = resp.status();
1210 let content_type = resp
1211 .headers()
1212 .get("content-type")
1213 .and_then(|v| v.to_str().ok())
1214 .unwrap_or("application/octet-stream");
1215 let content_type = super::ContentType::from(content_type);
1216
1217 if !status.is_client_error() && !status.is_server_error() {
1218 let content = resp.text().await?;
1219 match content_type {
1220 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1221 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AttachmentResponseModel`"))),
1222 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`")))),
1223 }
1224 } else {
1225 let content = resp.text().await?;
1226 let entity: Option<CiphersIdAttachmentAttachmentIdAdminGetError> =
1227 serde_json::from_str(&content).ok();
1228 Err(Error::ResponseError(ResponseContent {
1229 status,
1230 content,
1231 entity,
1232 }))
1233 }
1234}
1235
1236pub async fn ciphers_id_attachment_attachment_id_delete(
1237 configuration: &configuration::Configuration,
1238 id: uuid::Uuid,
1239 attachment_id: &str,
1240) -> Result<models::DeleteAttachmentResponseData, Error<CiphersIdAttachmentAttachmentIdDeleteError>>
1241{
1242 let p_id = id;
1244 let p_attachment_id = attachment_id;
1245
1246 let uri_str = format!(
1247 "{}/ciphers/{id}/attachment/{attachmentId}",
1248 configuration.base_path,
1249 id = crate::apis::urlencode(p_id.to_string()),
1250 attachmentId = crate::apis::urlencode(p_attachment_id)
1251 );
1252 let mut req_builder = configuration
1253 .client
1254 .request(reqwest::Method::DELETE, &uri_str);
1255
1256 if let Some(ref user_agent) = configuration.user_agent {
1257 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1258 }
1259 if let Some(ref token) = configuration.oauth_access_token {
1260 req_builder = req_builder.bearer_auth(token.to_owned());
1261 };
1262
1263 let req = req_builder.build()?;
1264 let resp = configuration.client.execute(req).await?;
1265
1266 let status = resp.status();
1267 let content_type = resp
1268 .headers()
1269 .get("content-type")
1270 .and_then(|v| v.to_str().ok())
1271 .unwrap_or("application/octet-stream");
1272 let content_type = super::ContentType::from(content_type);
1273
1274 if !status.is_client_error() && !status.is_server_error() {
1275 let content = resp.text().await?;
1276 match content_type {
1277 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1278 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeleteAttachmentResponseData`"))),
1279 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::DeleteAttachmentResponseData`")))),
1280 }
1281 } else {
1282 let content = resp.text().await?;
1283 let entity: Option<CiphersIdAttachmentAttachmentIdDeleteError> =
1284 serde_json::from_str(&content).ok();
1285 Err(Error::ResponseError(ResponseContent {
1286 status,
1287 content,
1288 entity,
1289 }))
1290 }
1291}
1292
1293pub async fn ciphers_id_attachment_attachment_id_delete_admin_post(
1294 configuration: &configuration::Configuration,
1295 id: uuid::Uuid,
1296 attachment_id: &str,
1297) -> Result<
1298 models::DeleteAttachmentResponseData,
1299 Error<CiphersIdAttachmentAttachmentIdDeleteAdminPostError>,
1300> {
1301 let p_id = id;
1303 let p_attachment_id = attachment_id;
1304
1305 let uri_str = format!(
1306 "{}/ciphers/{id}/attachment/{attachmentId}/delete-admin",
1307 configuration.base_path,
1308 id = crate::apis::urlencode(p_id.to_string()),
1309 attachmentId = crate::apis::urlencode(p_attachment_id)
1310 );
1311 let mut req_builder = configuration
1312 .client
1313 .request(reqwest::Method::POST, &uri_str);
1314
1315 if let Some(ref user_agent) = configuration.user_agent {
1316 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1317 }
1318 if let Some(ref token) = configuration.oauth_access_token {
1319 req_builder = req_builder.bearer_auth(token.to_owned());
1320 };
1321
1322 let req = req_builder.build()?;
1323 let resp = configuration.client.execute(req).await?;
1324
1325 let status = resp.status();
1326 let content_type = resp
1327 .headers()
1328 .get("content-type")
1329 .and_then(|v| v.to_str().ok())
1330 .unwrap_or("application/octet-stream");
1331 let content_type = super::ContentType::from(content_type);
1332
1333 if !status.is_client_error() && !status.is_server_error() {
1334 let content = resp.text().await?;
1335 match content_type {
1336 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1337 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeleteAttachmentResponseData`"))),
1338 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::DeleteAttachmentResponseData`")))),
1339 }
1340 } else {
1341 let content = resp.text().await?;
1342 let entity: Option<CiphersIdAttachmentAttachmentIdDeleteAdminPostError> =
1343 serde_json::from_str(&content).ok();
1344 Err(Error::ResponseError(ResponseContent {
1345 status,
1346 content,
1347 entity,
1348 }))
1349 }
1350}
1351
1352pub async fn ciphers_id_attachment_attachment_id_delete_post(
1353 configuration: &configuration::Configuration,
1354 id: uuid::Uuid,
1355 attachment_id: &str,
1356) -> Result<
1357 models::DeleteAttachmentResponseData,
1358 Error<CiphersIdAttachmentAttachmentIdDeletePostError>,
1359> {
1360 let p_id = id;
1362 let p_attachment_id = attachment_id;
1363
1364 let uri_str = format!(
1365 "{}/ciphers/{id}/attachment/{attachmentId}/delete",
1366 configuration.base_path,
1367 id = crate::apis::urlencode(p_id.to_string()),
1368 attachmentId = crate::apis::urlencode(p_attachment_id)
1369 );
1370 let mut req_builder = configuration
1371 .client
1372 .request(reqwest::Method::POST, &uri_str);
1373
1374 if let Some(ref user_agent) = configuration.user_agent {
1375 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1376 }
1377 if let Some(ref token) = configuration.oauth_access_token {
1378 req_builder = req_builder.bearer_auth(token.to_owned());
1379 };
1380
1381 let req = req_builder.build()?;
1382 let resp = configuration.client.execute(req).await?;
1383
1384 let status = resp.status();
1385 let content_type = resp
1386 .headers()
1387 .get("content-type")
1388 .and_then(|v| v.to_str().ok())
1389 .unwrap_or("application/octet-stream");
1390 let content_type = super::ContentType::from(content_type);
1391
1392 if !status.is_client_error() && !status.is_server_error() {
1393 let content = resp.text().await?;
1394 match content_type {
1395 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1396 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeleteAttachmentResponseData`"))),
1397 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::DeleteAttachmentResponseData`")))),
1398 }
1399 } else {
1400 let content = resp.text().await?;
1401 let entity: Option<CiphersIdAttachmentAttachmentIdDeletePostError> =
1402 serde_json::from_str(&content).ok();
1403 Err(Error::ResponseError(ResponseContent {
1404 status,
1405 content,
1406 entity,
1407 }))
1408 }
1409}
1410
1411pub async fn ciphers_id_attachment_attachment_id_get(
1412 configuration: &configuration::Configuration,
1413 id: uuid::Uuid,
1414 attachment_id: &str,
1415) -> Result<models::AttachmentResponseModel, Error<CiphersIdAttachmentAttachmentIdGetError>> {
1416 let p_id = id;
1418 let p_attachment_id = attachment_id;
1419
1420 let uri_str = format!(
1421 "{}/ciphers/{id}/attachment/{attachmentId}",
1422 configuration.base_path,
1423 id = crate::apis::urlencode(p_id.to_string()),
1424 attachmentId = crate::apis::urlencode(p_attachment_id)
1425 );
1426 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1427
1428 if let Some(ref user_agent) = configuration.user_agent {
1429 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1430 }
1431 if let Some(ref token) = configuration.oauth_access_token {
1432 req_builder = req_builder.bearer_auth(token.to_owned());
1433 };
1434
1435 let req = req_builder.build()?;
1436 let resp = configuration.client.execute(req).await?;
1437
1438 let status = resp.status();
1439 let content_type = resp
1440 .headers()
1441 .get("content-type")
1442 .and_then(|v| v.to_str().ok())
1443 .unwrap_or("application/octet-stream");
1444 let content_type = super::ContentType::from(content_type);
1445
1446 if !status.is_client_error() && !status.is_server_error() {
1447 let content = resp.text().await?;
1448 match content_type {
1449 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1450 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AttachmentResponseModel`"))),
1451 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`")))),
1452 }
1453 } else {
1454 let content = resp.text().await?;
1455 let entity: Option<CiphersIdAttachmentAttachmentIdGetError> =
1456 serde_json::from_str(&content).ok();
1457 Err(Error::ResponseError(ResponseContent {
1458 status,
1459 content,
1460 entity,
1461 }))
1462 }
1463}
1464
1465pub async fn ciphers_id_attachment_attachment_id_post(
1466 configuration: &configuration::Configuration,
1467 id: uuid::Uuid,
1468 attachment_id: &str,
1469) -> Result<(), Error<CiphersIdAttachmentAttachmentIdPostError>> {
1470 let p_id = id;
1472 let p_attachment_id = attachment_id;
1473
1474 let uri_str = format!(
1475 "{}/ciphers/{id}/attachment/{attachmentId}",
1476 configuration.base_path,
1477 id = crate::apis::urlencode(p_id.to_string()),
1478 attachmentId = crate::apis::urlencode(p_attachment_id)
1479 );
1480 let mut req_builder = configuration
1481 .client
1482 .request(reqwest::Method::POST, &uri_str);
1483
1484 if let Some(ref user_agent) = configuration.user_agent {
1485 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1486 }
1487 if let Some(ref token) = configuration.oauth_access_token {
1488 req_builder = req_builder.bearer_auth(token.to_owned());
1489 };
1490
1491 let req = req_builder.build()?;
1492 let resp = configuration.client.execute(req).await?;
1493
1494 let status = resp.status();
1495
1496 if !status.is_client_error() && !status.is_server_error() {
1497 Ok(())
1498 } else {
1499 let content = resp.text().await?;
1500 let entity: Option<CiphersIdAttachmentAttachmentIdPostError> =
1501 serde_json::from_str(&content).ok();
1502 Err(Error::ResponseError(ResponseContent {
1503 status,
1504 content,
1505 entity,
1506 }))
1507 }
1508}
1509
1510pub async fn ciphers_id_attachment_attachment_id_renew_get(
1511 configuration: &configuration::Configuration,
1512 id: uuid::Uuid,
1513 attachment_id: &str,
1514) -> Result<
1515 models::AttachmentUploadDataResponseModel,
1516 Error<CiphersIdAttachmentAttachmentIdRenewGetError>,
1517> {
1518 let p_id = id;
1520 let p_attachment_id = attachment_id;
1521
1522 let uri_str = format!(
1523 "{}/ciphers/{id}/attachment/{attachmentId}/renew",
1524 configuration.base_path,
1525 id = crate::apis::urlencode(p_id.to_string()),
1526 attachmentId = crate::apis::urlencode(p_attachment_id)
1527 );
1528 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1529
1530 if let Some(ref user_agent) = configuration.user_agent {
1531 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1532 }
1533 if let Some(ref token) = configuration.oauth_access_token {
1534 req_builder = req_builder.bearer_auth(token.to_owned());
1535 };
1536
1537 let req = req_builder.build()?;
1538 let resp = configuration.client.execute(req).await?;
1539
1540 let status = resp.status();
1541 let content_type = resp
1542 .headers()
1543 .get("content-type")
1544 .and_then(|v| v.to_str().ok())
1545 .unwrap_or("application/octet-stream");
1546 let content_type = super::ContentType::from(content_type);
1547
1548 if !status.is_client_error() && !status.is_server_error() {
1549 let content = resp.text().await?;
1550 match content_type {
1551 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1552 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AttachmentUploadDataResponseModel`"))),
1553 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::AttachmentUploadDataResponseModel`")))),
1554 }
1555 } else {
1556 let content = resp.text().await?;
1557 let entity: Option<CiphersIdAttachmentAttachmentIdRenewGetError> =
1558 serde_json::from_str(&content).ok();
1559 Err(Error::ResponseError(ResponseContent {
1560 status,
1561 content,
1562 entity,
1563 }))
1564 }
1565}
1566
1567pub async fn ciphers_id_attachment_attachment_id_share_post(
1568 configuration: &configuration::Configuration,
1569 id: &str,
1570 attachment_id: &str,
1571 organization_id: Option<uuid::Uuid>,
1572) -> Result<(), Error<CiphersIdAttachmentAttachmentIdSharePostError>> {
1573 let p_id = id;
1575 let p_attachment_id = attachment_id;
1576 let p_organization_id = organization_id;
1577
1578 let uri_str = format!(
1579 "{}/ciphers/{id}/attachment/{attachmentId}/share",
1580 configuration.base_path,
1581 id = crate::apis::urlencode(p_id),
1582 attachmentId = crate::apis::urlencode(p_attachment_id)
1583 );
1584 let mut req_builder = configuration
1585 .client
1586 .request(reqwest::Method::POST, &uri_str);
1587
1588 if let Some(ref param_value) = p_organization_id {
1589 req_builder = req_builder.query(&[("organizationId", ¶m_value.to_string())]);
1590 }
1591 if let Some(ref user_agent) = configuration.user_agent {
1592 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1593 }
1594 if let Some(ref token) = configuration.oauth_access_token {
1595 req_builder = req_builder.bearer_auth(token.to_owned());
1596 };
1597
1598 let req = req_builder.build()?;
1599 let resp = configuration.client.execute(req).await?;
1600
1601 let status = resp.status();
1602
1603 if !status.is_client_error() && !status.is_server_error() {
1604 Ok(())
1605 } else {
1606 let content = resp.text().await?;
1607 let entity: Option<CiphersIdAttachmentAttachmentIdSharePostError> =
1608 serde_json::from_str(&content).ok();
1609 Err(Error::ResponseError(ResponseContent {
1610 status,
1611 content,
1612 entity,
1613 }))
1614 }
1615}
1616
1617pub async fn ciphers_id_attachment_post(
1618 configuration: &configuration::Configuration,
1619 id: uuid::Uuid,
1620) -> Result<models::CipherResponseModel, Error<CiphersIdAttachmentPostError>> {
1621 let p_id = id;
1623
1624 let uri_str = format!(
1625 "{}/ciphers/{id}/attachment",
1626 configuration.base_path,
1627 id = crate::apis::urlencode(p_id.to_string())
1628 );
1629 let mut req_builder = configuration
1630 .client
1631 .request(reqwest::Method::POST, &uri_str);
1632
1633 if let Some(ref user_agent) = configuration.user_agent {
1634 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1635 }
1636 if let Some(ref token) = configuration.oauth_access_token {
1637 req_builder = req_builder.bearer_auth(token.to_owned());
1638 };
1639
1640 let req = req_builder.build()?;
1641 let resp = configuration.client.execute(req).await?;
1642
1643 let status = resp.status();
1644 let content_type = resp
1645 .headers()
1646 .get("content-type")
1647 .and_then(|v| v.to_str().ok())
1648 .unwrap_or("application/octet-stream");
1649 let content_type = super::ContentType::from(content_type);
1650
1651 if !status.is_client_error() && !status.is_server_error() {
1652 let content = resp.text().await?;
1653 match content_type {
1654 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1655 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherResponseModel`"))),
1656 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::CipherResponseModel`")))),
1657 }
1658 } else {
1659 let content = resp.text().await?;
1660 let entity: Option<CiphersIdAttachmentPostError> = serde_json::from_str(&content).ok();
1661 Err(Error::ResponseError(ResponseContent {
1662 status,
1663 content,
1664 entity,
1665 }))
1666 }
1667}
1668
1669pub async fn ciphers_id_attachment_v2_post(
1670 configuration: &configuration::Configuration,
1671 id: uuid::Uuid,
1672 attachment_request_model: Option<models::AttachmentRequestModel>,
1673) -> Result<models::AttachmentUploadDataResponseModel, Error<CiphersIdAttachmentV2PostError>> {
1674 let p_id = id;
1676 let p_attachment_request_model = attachment_request_model;
1677
1678 let uri_str = format!(
1679 "{}/ciphers/{id}/attachment/v2",
1680 configuration.base_path,
1681 id = crate::apis::urlencode(p_id.to_string())
1682 );
1683 let mut req_builder = configuration
1684 .client
1685 .request(reqwest::Method::POST, &uri_str);
1686
1687 if let Some(ref user_agent) = configuration.user_agent {
1688 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1689 }
1690 if let Some(ref token) = configuration.oauth_access_token {
1691 req_builder = req_builder.bearer_auth(token.to_owned());
1692 };
1693 req_builder = req_builder.json(&p_attachment_request_model);
1694
1695 let req = req_builder.build()?;
1696 let resp = configuration.client.execute(req).await?;
1697
1698 let status = resp.status();
1699 let content_type = resp
1700 .headers()
1701 .get("content-type")
1702 .and_then(|v| v.to_str().ok())
1703 .unwrap_or("application/octet-stream");
1704 let content_type = super::ContentType::from(content_type);
1705
1706 if !status.is_client_error() && !status.is_server_error() {
1707 let content = resp.text().await?;
1708 match content_type {
1709 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1710 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AttachmentUploadDataResponseModel`"))),
1711 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::AttachmentUploadDataResponseModel`")))),
1712 }
1713 } else {
1714 let content = resp.text().await?;
1715 let entity: Option<CiphersIdAttachmentV2PostError> = serde_json::from_str(&content).ok();
1716 Err(Error::ResponseError(ResponseContent {
1717 status,
1718 content,
1719 entity,
1720 }))
1721 }
1722}
1723
1724pub async fn ciphers_id_collections_admin_post(
1725 configuration: &configuration::Configuration,
1726 id: &str,
1727 cipher_collections_request_model: Option<models::CipherCollectionsRequestModel>,
1728) -> Result<models::CipherMiniDetailsResponseModel, Error<CiphersIdCollectionsAdminPostError>> {
1729 let p_id = id;
1731 let p_cipher_collections_request_model = cipher_collections_request_model;
1732
1733 let uri_str = format!(
1734 "{}/ciphers/{id}/collections-admin",
1735 configuration.base_path,
1736 id = crate::apis::urlencode(p_id)
1737 );
1738 let mut req_builder = configuration
1739 .client
1740 .request(reqwest::Method::POST, &uri_str);
1741
1742 if let Some(ref user_agent) = configuration.user_agent {
1743 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1744 }
1745 if let Some(ref token) = configuration.oauth_access_token {
1746 req_builder = req_builder.bearer_auth(token.to_owned());
1747 };
1748 req_builder = req_builder.json(&p_cipher_collections_request_model);
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::CipherMiniDetailsResponseModel`"))),
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::CipherMiniDetailsResponseModel`")))),
1767 }
1768 } else {
1769 let content = resp.text().await?;
1770 let entity: Option<CiphersIdCollectionsAdminPostError> =
1771 serde_json::from_str(&content).ok();
1772 Err(Error::ResponseError(ResponseContent {
1773 status,
1774 content,
1775 entity,
1776 }))
1777 }
1778}
1779
1780pub async fn ciphers_id_collections_admin_put(
1781 configuration: &configuration::Configuration,
1782 id: &str,
1783 cipher_collections_request_model: Option<models::CipherCollectionsRequestModel>,
1784) -> Result<models::CipherMiniDetailsResponseModel, Error<CiphersIdCollectionsAdminPutError>> {
1785 let p_id = id;
1787 let p_cipher_collections_request_model = cipher_collections_request_model;
1788
1789 let uri_str = format!(
1790 "{}/ciphers/{id}/collections-admin",
1791 configuration.base_path,
1792 id = crate::apis::urlencode(p_id)
1793 );
1794 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1795
1796 if let Some(ref user_agent) = configuration.user_agent {
1797 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1798 }
1799 if let Some(ref token) = configuration.oauth_access_token {
1800 req_builder = req_builder.bearer_auth(token.to_owned());
1801 };
1802 req_builder = req_builder.json(&p_cipher_collections_request_model);
1803
1804 let req = req_builder.build()?;
1805 let resp = configuration.client.execute(req).await?;
1806
1807 let status = resp.status();
1808 let content_type = resp
1809 .headers()
1810 .get("content-type")
1811 .and_then(|v| v.to_str().ok())
1812 .unwrap_or("application/octet-stream");
1813 let content_type = super::ContentType::from(content_type);
1814
1815 if !status.is_client_error() && !status.is_server_error() {
1816 let content = resp.text().await?;
1817 match content_type {
1818 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1819 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherMiniDetailsResponseModel`"))),
1820 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::CipherMiniDetailsResponseModel`")))),
1821 }
1822 } else {
1823 let content = resp.text().await?;
1824 let entity: Option<CiphersIdCollectionsAdminPutError> = serde_json::from_str(&content).ok();
1825 Err(Error::ResponseError(ResponseContent {
1826 status,
1827 content,
1828 entity,
1829 }))
1830 }
1831}
1832
1833pub async fn ciphers_id_collections_post(
1834 configuration: &configuration::Configuration,
1835 id: uuid::Uuid,
1836 cipher_collections_request_model: Option<models::CipherCollectionsRequestModel>,
1837) -> Result<models::CipherDetailsResponseModel, Error<CiphersIdCollectionsPostError>> {
1838 let p_id = id;
1840 let p_cipher_collections_request_model = cipher_collections_request_model;
1841
1842 let uri_str = format!(
1843 "{}/ciphers/{id}/collections",
1844 configuration.base_path,
1845 id = crate::apis::urlencode(p_id.to_string())
1846 );
1847 let mut req_builder = configuration
1848 .client
1849 .request(reqwest::Method::POST, &uri_str);
1850
1851 if let Some(ref user_agent) = configuration.user_agent {
1852 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1853 }
1854 if let Some(ref token) = configuration.oauth_access_token {
1855 req_builder = req_builder.bearer_auth(token.to_owned());
1856 };
1857 req_builder = req_builder.json(&p_cipher_collections_request_model);
1858
1859 let req = req_builder.build()?;
1860 let resp = configuration.client.execute(req).await?;
1861
1862 let status = resp.status();
1863 let content_type = resp
1864 .headers()
1865 .get("content-type")
1866 .and_then(|v| v.to_str().ok())
1867 .unwrap_or("application/octet-stream");
1868 let content_type = super::ContentType::from(content_type);
1869
1870 if !status.is_client_error() && !status.is_server_error() {
1871 let content = resp.text().await?;
1872 match content_type {
1873 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1874 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherDetailsResponseModel`"))),
1875 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::CipherDetailsResponseModel`")))),
1876 }
1877 } else {
1878 let content = resp.text().await?;
1879 let entity: Option<CiphersIdCollectionsPostError> = serde_json::from_str(&content).ok();
1880 Err(Error::ResponseError(ResponseContent {
1881 status,
1882 content,
1883 entity,
1884 }))
1885 }
1886}
1887
1888pub async fn ciphers_id_collections_put(
1889 configuration: &configuration::Configuration,
1890 id: uuid::Uuid,
1891 cipher_collections_request_model: Option<models::CipherCollectionsRequestModel>,
1892) -> Result<models::CipherDetailsResponseModel, Error<CiphersIdCollectionsPutError>> {
1893 let p_id = id;
1895 let p_cipher_collections_request_model = cipher_collections_request_model;
1896
1897 let uri_str = format!(
1898 "{}/ciphers/{id}/collections",
1899 configuration.base_path,
1900 id = crate::apis::urlencode(p_id.to_string())
1901 );
1902 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1903
1904 if let Some(ref user_agent) = configuration.user_agent {
1905 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1906 }
1907 if let Some(ref token) = configuration.oauth_access_token {
1908 req_builder = req_builder.bearer_auth(token.to_owned());
1909 };
1910 req_builder = req_builder.json(&p_cipher_collections_request_model);
1911
1912 let req = req_builder.build()?;
1913 let resp = configuration.client.execute(req).await?;
1914
1915 let status = resp.status();
1916 let content_type = resp
1917 .headers()
1918 .get("content-type")
1919 .and_then(|v| v.to_str().ok())
1920 .unwrap_or("application/octet-stream");
1921 let content_type = super::ContentType::from(content_type);
1922
1923 if !status.is_client_error() && !status.is_server_error() {
1924 let content = resp.text().await?;
1925 match content_type {
1926 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1927 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherDetailsResponseModel`"))),
1928 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::CipherDetailsResponseModel`")))),
1929 }
1930 } else {
1931 let content = resp.text().await?;
1932 let entity: Option<CiphersIdCollectionsPutError> = serde_json::from_str(&content).ok();
1933 Err(Error::ResponseError(ResponseContent {
1934 status,
1935 content,
1936 entity,
1937 }))
1938 }
1939}
1940
1941pub async fn ciphers_id_collections_v2_post(
1942 configuration: &configuration::Configuration,
1943 id: uuid::Uuid,
1944 cipher_collections_request_model: Option<models::CipherCollectionsRequestModel>,
1945) -> Result<models::OptionalCipherDetailsResponseModel, Error<CiphersIdCollectionsV2PostError>> {
1946 let p_id = id;
1948 let p_cipher_collections_request_model = cipher_collections_request_model;
1949
1950 let uri_str = format!(
1951 "{}/ciphers/{id}/collections_v2",
1952 configuration.base_path,
1953 id = crate::apis::urlencode(p_id.to_string())
1954 );
1955 let mut req_builder = configuration
1956 .client
1957 .request(reqwest::Method::POST, &uri_str);
1958
1959 if let Some(ref user_agent) = configuration.user_agent {
1960 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1961 }
1962 if let Some(ref token) = configuration.oauth_access_token {
1963 req_builder = req_builder.bearer_auth(token.to_owned());
1964 };
1965 req_builder = req_builder.json(&p_cipher_collections_request_model);
1966
1967 let req = req_builder.build()?;
1968 let resp = configuration.client.execute(req).await?;
1969
1970 let status = resp.status();
1971 let content_type = resp
1972 .headers()
1973 .get("content-type")
1974 .and_then(|v| v.to_str().ok())
1975 .unwrap_or("application/octet-stream");
1976 let content_type = super::ContentType::from(content_type);
1977
1978 if !status.is_client_error() && !status.is_server_error() {
1979 let content = resp.text().await?;
1980 match content_type {
1981 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1982 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::OptionalCipherDetailsResponseModel`"))),
1983 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::OptionalCipherDetailsResponseModel`")))),
1984 }
1985 } else {
1986 let content = resp.text().await?;
1987 let entity: Option<CiphersIdCollectionsV2PostError> = serde_json::from_str(&content).ok();
1988 Err(Error::ResponseError(ResponseContent {
1989 status,
1990 content,
1991 entity,
1992 }))
1993 }
1994}
1995
1996pub async fn ciphers_id_collections_v2_put(
1997 configuration: &configuration::Configuration,
1998 id: uuid::Uuid,
1999 cipher_collections_request_model: Option<models::CipherCollectionsRequestModel>,
2000) -> Result<models::OptionalCipherDetailsResponseModel, Error<CiphersIdCollectionsV2PutError>> {
2001 let p_id = id;
2003 let p_cipher_collections_request_model = cipher_collections_request_model;
2004
2005 let uri_str = format!(
2006 "{}/ciphers/{id}/collections_v2",
2007 configuration.base_path,
2008 id = crate::apis::urlencode(p_id.to_string())
2009 );
2010 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
2011
2012 if let Some(ref user_agent) = configuration.user_agent {
2013 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2014 }
2015 if let Some(ref token) = configuration.oauth_access_token {
2016 req_builder = req_builder.bearer_auth(token.to_owned());
2017 };
2018 req_builder = req_builder.json(&p_cipher_collections_request_model);
2019
2020 let req = req_builder.build()?;
2021 let resp = configuration.client.execute(req).await?;
2022
2023 let status = resp.status();
2024 let content_type = resp
2025 .headers()
2026 .get("content-type")
2027 .and_then(|v| v.to_str().ok())
2028 .unwrap_or("application/octet-stream");
2029 let content_type = super::ContentType::from(content_type);
2030
2031 if !status.is_client_error() && !status.is_server_error() {
2032 let content = resp.text().await?;
2033 match content_type {
2034 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2035 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::OptionalCipherDetailsResponseModel`"))),
2036 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::OptionalCipherDetailsResponseModel`")))),
2037 }
2038 } else {
2039 let content = resp.text().await?;
2040 let entity: Option<CiphersIdCollectionsV2PutError> = serde_json::from_str(&content).ok();
2041 Err(Error::ResponseError(ResponseContent {
2042 status,
2043 content,
2044 entity,
2045 }))
2046 }
2047}
2048
2049pub async fn ciphers_id_delete(
2050 configuration: &configuration::Configuration,
2051 id: uuid::Uuid,
2052) -> Result<(), Error<CiphersIdDeleteError>> {
2053 let p_id = id;
2055
2056 let uri_str = format!(
2057 "{}/ciphers/{id}",
2058 configuration.base_path,
2059 id = crate::apis::urlencode(p_id.to_string())
2060 );
2061 let mut req_builder = configuration
2062 .client
2063 .request(reqwest::Method::DELETE, &uri_str);
2064
2065 if let Some(ref user_agent) = configuration.user_agent {
2066 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2067 }
2068 if let Some(ref token) = configuration.oauth_access_token {
2069 req_builder = req_builder.bearer_auth(token.to_owned());
2070 };
2071
2072 let req = req_builder.build()?;
2073 let resp = configuration.client.execute(req).await?;
2074
2075 let status = resp.status();
2076
2077 if !status.is_client_error() && !status.is_server_error() {
2078 Ok(())
2079 } else {
2080 let content = resp.text().await?;
2081 let entity: Option<CiphersIdDeleteError> = serde_json::from_str(&content).ok();
2082 Err(Error::ResponseError(ResponseContent {
2083 status,
2084 content,
2085 entity,
2086 }))
2087 }
2088}
2089
2090pub async fn ciphers_id_delete_admin_post(
2091 configuration: &configuration::Configuration,
2092 id: uuid::Uuid,
2093) -> Result<(), Error<CiphersIdDeleteAdminPostError>> {
2094 let p_id = id;
2096
2097 let uri_str = format!(
2098 "{}/ciphers/{id}/delete-admin",
2099 configuration.base_path,
2100 id = crate::apis::urlencode(p_id.to_string())
2101 );
2102 let mut req_builder = configuration
2103 .client
2104 .request(reqwest::Method::POST, &uri_str);
2105
2106 if let Some(ref user_agent) = configuration.user_agent {
2107 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2108 }
2109 if let Some(ref token) = configuration.oauth_access_token {
2110 req_builder = req_builder.bearer_auth(token.to_owned());
2111 };
2112
2113 let req = req_builder.build()?;
2114 let resp = configuration.client.execute(req).await?;
2115
2116 let status = resp.status();
2117
2118 if !status.is_client_error() && !status.is_server_error() {
2119 Ok(())
2120 } else {
2121 let content = resp.text().await?;
2122 let entity: Option<CiphersIdDeleteAdminPostError> = serde_json::from_str(&content).ok();
2123 Err(Error::ResponseError(ResponseContent {
2124 status,
2125 content,
2126 entity,
2127 }))
2128 }
2129}
2130
2131pub async fn ciphers_id_delete_admin_put(
2132 configuration: &configuration::Configuration,
2133 id: uuid::Uuid,
2134) -> Result<(), Error<CiphersIdDeleteAdminPutError>> {
2135 let p_id = id;
2137
2138 let uri_str = format!(
2139 "{}/ciphers/{id}/delete-admin",
2140 configuration.base_path,
2141 id = crate::apis::urlencode(p_id.to_string())
2142 );
2143 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
2144
2145 if let Some(ref user_agent) = configuration.user_agent {
2146 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2147 }
2148 if let Some(ref token) = configuration.oauth_access_token {
2149 req_builder = req_builder.bearer_auth(token.to_owned());
2150 };
2151
2152 let req = req_builder.build()?;
2153 let resp = configuration.client.execute(req).await?;
2154
2155 let status = resp.status();
2156
2157 if !status.is_client_error() && !status.is_server_error() {
2158 Ok(())
2159 } else {
2160 let content = resp.text().await?;
2161 let entity: Option<CiphersIdDeleteAdminPutError> = serde_json::from_str(&content).ok();
2162 Err(Error::ResponseError(ResponseContent {
2163 status,
2164 content,
2165 entity,
2166 }))
2167 }
2168}
2169
2170pub async fn ciphers_id_delete_post(
2171 configuration: &configuration::Configuration,
2172 id: uuid::Uuid,
2173) -> Result<(), Error<CiphersIdDeletePostError>> {
2174 let p_id = id;
2176
2177 let uri_str = format!(
2178 "{}/ciphers/{id}/delete",
2179 configuration.base_path,
2180 id = crate::apis::urlencode(p_id.to_string())
2181 );
2182 let mut req_builder = configuration
2183 .client
2184 .request(reqwest::Method::POST, &uri_str);
2185
2186 if let Some(ref user_agent) = configuration.user_agent {
2187 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2188 }
2189 if let Some(ref token) = configuration.oauth_access_token {
2190 req_builder = req_builder.bearer_auth(token.to_owned());
2191 };
2192
2193 let req = req_builder.build()?;
2194 let resp = configuration.client.execute(req).await?;
2195
2196 let status = resp.status();
2197
2198 if !status.is_client_error() && !status.is_server_error() {
2199 Ok(())
2200 } else {
2201 let content = resp.text().await?;
2202 let entity: Option<CiphersIdDeletePostError> = serde_json::from_str(&content).ok();
2203 Err(Error::ResponseError(ResponseContent {
2204 status,
2205 content,
2206 entity,
2207 }))
2208 }
2209}
2210
2211pub async fn ciphers_id_delete_put(
2212 configuration: &configuration::Configuration,
2213 id: uuid::Uuid,
2214) -> Result<(), Error<CiphersIdDeletePutError>> {
2215 let p_id = id;
2217
2218 let uri_str = format!(
2219 "{}/ciphers/{id}/delete",
2220 configuration.base_path,
2221 id = crate::apis::urlencode(p_id.to_string())
2222 );
2223 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
2224
2225 if let Some(ref user_agent) = configuration.user_agent {
2226 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2227 }
2228 if let Some(ref token) = configuration.oauth_access_token {
2229 req_builder = req_builder.bearer_auth(token.to_owned());
2230 };
2231
2232 let req = req_builder.build()?;
2233 let resp = configuration.client.execute(req).await?;
2234
2235 let status = resp.status();
2236
2237 if !status.is_client_error() && !status.is_server_error() {
2238 Ok(())
2239 } else {
2240 let content = resp.text().await?;
2241 let entity: Option<CiphersIdDeletePutError> = serde_json::from_str(&content).ok();
2242 Err(Error::ResponseError(ResponseContent {
2243 status,
2244 content,
2245 entity,
2246 }))
2247 }
2248}
2249
2250pub async fn ciphers_id_details_get(
2251 configuration: &configuration::Configuration,
2252 id: uuid::Uuid,
2253) -> Result<models::CipherDetailsResponseModel, Error<CiphersIdDetailsGetError>> {
2254 let p_id = id;
2256
2257 let uri_str = format!(
2258 "{}/ciphers/{id}/details",
2259 configuration.base_path,
2260 id = crate::apis::urlencode(p_id.to_string())
2261 );
2262 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2263
2264 if let Some(ref user_agent) = configuration.user_agent {
2265 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2266 }
2267 if let Some(ref token) = configuration.oauth_access_token {
2268 req_builder = req_builder.bearer_auth(token.to_owned());
2269 };
2270
2271 let req = req_builder.build()?;
2272 let resp = configuration.client.execute(req).await?;
2273
2274 let status = resp.status();
2275 let content_type = resp
2276 .headers()
2277 .get("content-type")
2278 .and_then(|v| v.to_str().ok())
2279 .unwrap_or("application/octet-stream");
2280 let content_type = super::ContentType::from(content_type);
2281
2282 if !status.is_client_error() && !status.is_server_error() {
2283 let content = resp.text().await?;
2284 match content_type {
2285 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2286 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherDetailsResponseModel`"))),
2287 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::CipherDetailsResponseModel`")))),
2288 }
2289 } else {
2290 let content = resp.text().await?;
2291 let entity: Option<CiphersIdDetailsGetError> = serde_json::from_str(&content).ok();
2292 Err(Error::ResponseError(ResponseContent {
2293 status,
2294 content,
2295 entity,
2296 }))
2297 }
2298}
2299
2300pub async fn ciphers_id_full_details_get(
2301 configuration: &configuration::Configuration,
2302 id: uuid::Uuid,
2303) -> Result<models::CipherDetailsResponseModel, Error<CiphersIdFullDetailsGetError>> {
2304 let p_id = id;
2306
2307 let uri_str = format!(
2308 "{}/ciphers/{id}/full-details",
2309 configuration.base_path,
2310 id = crate::apis::urlencode(p_id.to_string())
2311 );
2312 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2313
2314 if let Some(ref user_agent) = configuration.user_agent {
2315 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2316 }
2317 if let Some(ref token) = configuration.oauth_access_token {
2318 req_builder = req_builder.bearer_auth(token.to_owned());
2319 };
2320
2321 let req = req_builder.build()?;
2322 let resp = configuration.client.execute(req).await?;
2323
2324 let status = resp.status();
2325 let content_type = resp
2326 .headers()
2327 .get("content-type")
2328 .and_then(|v| v.to_str().ok())
2329 .unwrap_or("application/octet-stream");
2330 let content_type = super::ContentType::from(content_type);
2331
2332 if !status.is_client_error() && !status.is_server_error() {
2333 let content = resp.text().await?;
2334 match content_type {
2335 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2336 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherDetailsResponseModel`"))),
2337 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::CipherDetailsResponseModel`")))),
2338 }
2339 } else {
2340 let content = resp.text().await?;
2341 let entity: Option<CiphersIdFullDetailsGetError> = serde_json::from_str(&content).ok();
2342 Err(Error::ResponseError(ResponseContent {
2343 status,
2344 content,
2345 entity,
2346 }))
2347 }
2348}
2349
2350pub async fn ciphers_id_get(
2351 configuration: &configuration::Configuration,
2352 id: uuid::Uuid,
2353) -> Result<models::CipherResponseModel, Error<CiphersIdGetError>> {
2354 let p_id = id;
2356
2357 let uri_str = format!(
2358 "{}/ciphers/{id}",
2359 configuration.base_path,
2360 id = crate::apis::urlencode(p_id.to_string())
2361 );
2362 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2363
2364 if let Some(ref user_agent) = configuration.user_agent {
2365 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2366 }
2367 if let Some(ref token) = configuration.oauth_access_token {
2368 req_builder = req_builder.bearer_auth(token.to_owned());
2369 };
2370
2371 let req = req_builder.build()?;
2372 let resp = configuration.client.execute(req).await?;
2373
2374 let status = resp.status();
2375 let content_type = resp
2376 .headers()
2377 .get("content-type")
2378 .and_then(|v| v.to_str().ok())
2379 .unwrap_or("application/octet-stream");
2380 let content_type = super::ContentType::from(content_type);
2381
2382 if !status.is_client_error() && !status.is_server_error() {
2383 let content = resp.text().await?;
2384 match content_type {
2385 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2386 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherResponseModel`"))),
2387 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::CipherResponseModel`")))),
2388 }
2389 } else {
2390 let content = resp.text().await?;
2391 let entity: Option<CiphersIdGetError> = serde_json::from_str(&content).ok();
2392 Err(Error::ResponseError(ResponseContent {
2393 status,
2394 content,
2395 entity,
2396 }))
2397 }
2398}
2399
2400pub async fn ciphers_id_partial_post(
2401 configuration: &configuration::Configuration,
2402 id: uuid::Uuid,
2403 cipher_partial_request_model: Option<models::CipherPartialRequestModel>,
2404) -> Result<models::CipherResponseModel, Error<CiphersIdPartialPostError>> {
2405 let p_id = id;
2407 let p_cipher_partial_request_model = cipher_partial_request_model;
2408
2409 let uri_str = format!(
2410 "{}/ciphers/{id}/partial",
2411 configuration.base_path,
2412 id = crate::apis::urlencode(p_id.to_string())
2413 );
2414 let mut req_builder = configuration
2415 .client
2416 .request(reqwest::Method::POST, &uri_str);
2417
2418 if let Some(ref user_agent) = configuration.user_agent {
2419 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2420 }
2421 if let Some(ref token) = configuration.oauth_access_token {
2422 req_builder = req_builder.bearer_auth(token.to_owned());
2423 };
2424 req_builder = req_builder.json(&p_cipher_partial_request_model);
2425
2426 let req = req_builder.build()?;
2427 let resp = configuration.client.execute(req).await?;
2428
2429 let status = resp.status();
2430 let content_type = resp
2431 .headers()
2432 .get("content-type")
2433 .and_then(|v| v.to_str().ok())
2434 .unwrap_or("application/octet-stream");
2435 let content_type = super::ContentType::from(content_type);
2436
2437 if !status.is_client_error() && !status.is_server_error() {
2438 let content = resp.text().await?;
2439 match content_type {
2440 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2441 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherResponseModel`"))),
2442 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::CipherResponseModel`")))),
2443 }
2444 } else {
2445 let content = resp.text().await?;
2446 let entity: Option<CiphersIdPartialPostError> = serde_json::from_str(&content).ok();
2447 Err(Error::ResponseError(ResponseContent {
2448 status,
2449 content,
2450 entity,
2451 }))
2452 }
2453}
2454
2455pub async fn ciphers_id_partial_put(
2456 configuration: &configuration::Configuration,
2457 id: uuid::Uuid,
2458 cipher_partial_request_model: Option<models::CipherPartialRequestModel>,
2459) -> Result<models::CipherResponseModel, Error<CiphersIdPartialPutError>> {
2460 let p_id = id;
2462 let p_cipher_partial_request_model = cipher_partial_request_model;
2463
2464 let uri_str = format!(
2465 "{}/ciphers/{id}/partial",
2466 configuration.base_path,
2467 id = crate::apis::urlencode(p_id.to_string())
2468 );
2469 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
2470
2471 if let Some(ref user_agent) = configuration.user_agent {
2472 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2473 }
2474 if let Some(ref token) = configuration.oauth_access_token {
2475 req_builder = req_builder.bearer_auth(token.to_owned());
2476 };
2477 req_builder = req_builder.json(&p_cipher_partial_request_model);
2478
2479 let req = req_builder.build()?;
2480 let resp = configuration.client.execute(req).await?;
2481
2482 let status = resp.status();
2483 let content_type = resp
2484 .headers()
2485 .get("content-type")
2486 .and_then(|v| v.to_str().ok())
2487 .unwrap_or("application/octet-stream");
2488 let content_type = super::ContentType::from(content_type);
2489
2490 if !status.is_client_error() && !status.is_server_error() {
2491 let content = resp.text().await?;
2492 match content_type {
2493 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2494 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherResponseModel`"))),
2495 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::CipherResponseModel`")))),
2496 }
2497 } else {
2498 let content = resp.text().await?;
2499 let entity: Option<CiphersIdPartialPutError> = serde_json::from_str(&content).ok();
2500 Err(Error::ResponseError(ResponseContent {
2501 status,
2502 content,
2503 entity,
2504 }))
2505 }
2506}
2507
2508pub async fn ciphers_id_post(
2509 configuration: &configuration::Configuration,
2510 id: uuid::Uuid,
2511 cipher_request_model: Option<models::CipherRequestModel>,
2512) -> Result<models::CipherResponseModel, Error<CiphersIdPostError>> {
2513 let p_id = id;
2515 let p_cipher_request_model = cipher_request_model;
2516
2517 let uri_str = format!(
2518 "{}/ciphers/{id}",
2519 configuration.base_path,
2520 id = crate::apis::urlencode(p_id.to_string())
2521 );
2522 let mut req_builder = configuration
2523 .client
2524 .request(reqwest::Method::POST, &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.oauth_access_token {
2530 req_builder = req_builder.bearer_auth(token.to_owned());
2531 };
2532 req_builder = req_builder.json(&p_cipher_request_model);
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::CipherResponseModel`"))),
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::CipherResponseModel`")))),
2551 }
2552 } else {
2553 let content = resp.text().await?;
2554 let entity: Option<CiphersIdPostError> = serde_json::from_str(&content).ok();
2555 Err(Error::ResponseError(ResponseContent {
2556 status,
2557 content,
2558 entity,
2559 }))
2560 }
2561}
2562
2563pub async fn ciphers_id_put(
2564 configuration: &configuration::Configuration,
2565 id: uuid::Uuid,
2566 cipher_request_model: Option<models::CipherRequestModel>,
2567) -> Result<models::CipherResponseModel, Error<CiphersIdPutError>> {
2568 let p_id = id;
2570 let p_cipher_request_model = cipher_request_model;
2571
2572 let uri_str = format!(
2573 "{}/ciphers/{id}",
2574 configuration.base_path,
2575 id = crate::apis::urlencode(p_id.to_string())
2576 );
2577 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
2578
2579 if let Some(ref user_agent) = configuration.user_agent {
2580 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2581 }
2582 if let Some(ref token) = configuration.oauth_access_token {
2583 req_builder = req_builder.bearer_auth(token.to_owned());
2584 };
2585 req_builder = req_builder.json(&p_cipher_request_model);
2586
2587 let req = req_builder.build()?;
2588 let resp = configuration.client.execute(req).await?;
2589
2590 let status = resp.status();
2591 let content_type = resp
2592 .headers()
2593 .get("content-type")
2594 .and_then(|v| v.to_str().ok())
2595 .unwrap_or("application/octet-stream");
2596 let content_type = super::ContentType::from(content_type);
2597
2598 if !status.is_client_error() && !status.is_server_error() {
2599 let content = resp.text().await?;
2600 match content_type {
2601 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2602 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherResponseModel`"))),
2603 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::CipherResponseModel`")))),
2604 }
2605 } else {
2606 let content = resp.text().await?;
2607 let entity: Option<CiphersIdPutError> = serde_json::from_str(&content).ok();
2608 Err(Error::ResponseError(ResponseContent {
2609 status,
2610 content,
2611 entity,
2612 }))
2613 }
2614}
2615
2616pub async fn ciphers_id_restore_admin_put(
2617 configuration: &configuration::Configuration,
2618 id: uuid::Uuid,
2619) -> Result<models::CipherMiniResponseModel, Error<CiphersIdRestoreAdminPutError>> {
2620 let p_id = id;
2622
2623 let uri_str = format!(
2624 "{}/ciphers/{id}/restore-admin",
2625 configuration.base_path,
2626 id = crate::apis::urlencode(p_id.to_string())
2627 );
2628 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
2629
2630 if let Some(ref user_agent) = configuration.user_agent {
2631 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2632 }
2633 if let Some(ref token) = configuration.oauth_access_token {
2634 req_builder = req_builder.bearer_auth(token.to_owned());
2635 };
2636
2637 let req = req_builder.build()?;
2638 let resp = configuration.client.execute(req).await?;
2639
2640 let status = resp.status();
2641 let content_type = resp
2642 .headers()
2643 .get("content-type")
2644 .and_then(|v| v.to_str().ok())
2645 .unwrap_or("application/octet-stream");
2646 let content_type = super::ContentType::from(content_type);
2647
2648 if !status.is_client_error() && !status.is_server_error() {
2649 let content = resp.text().await?;
2650 match content_type {
2651 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2652 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherMiniResponseModel`"))),
2653 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::CipherMiniResponseModel`")))),
2654 }
2655 } else {
2656 let content = resp.text().await?;
2657 let entity: Option<CiphersIdRestoreAdminPutError> = serde_json::from_str(&content).ok();
2658 Err(Error::ResponseError(ResponseContent {
2659 status,
2660 content,
2661 entity,
2662 }))
2663 }
2664}
2665
2666pub async fn ciphers_id_restore_put(
2667 configuration: &configuration::Configuration,
2668 id: uuid::Uuid,
2669) -> Result<models::CipherResponseModel, Error<CiphersIdRestorePutError>> {
2670 let p_id = id;
2672
2673 let uri_str = format!(
2674 "{}/ciphers/{id}/restore",
2675 configuration.base_path,
2676 id = crate::apis::urlencode(p_id.to_string())
2677 );
2678 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
2679
2680 if let Some(ref user_agent) = configuration.user_agent {
2681 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2682 }
2683 if let Some(ref token) = configuration.oauth_access_token {
2684 req_builder = req_builder.bearer_auth(token.to_owned());
2685 };
2686
2687 let req = req_builder.build()?;
2688 let resp = configuration.client.execute(req).await?;
2689
2690 let status = resp.status();
2691 let content_type = resp
2692 .headers()
2693 .get("content-type")
2694 .and_then(|v| v.to_str().ok())
2695 .unwrap_or("application/octet-stream");
2696 let content_type = super::ContentType::from(content_type);
2697
2698 if !status.is_client_error() && !status.is_server_error() {
2699 let content = resp.text().await?;
2700 match content_type {
2701 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2702 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherResponseModel`"))),
2703 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::CipherResponseModel`")))),
2704 }
2705 } else {
2706 let content = resp.text().await?;
2707 let entity: Option<CiphersIdRestorePutError> = serde_json::from_str(&content).ok();
2708 Err(Error::ResponseError(ResponseContent {
2709 status,
2710 content,
2711 entity,
2712 }))
2713 }
2714}
2715
2716pub async fn ciphers_id_share_post(
2717 configuration: &configuration::Configuration,
2718 id: uuid::Uuid,
2719 cipher_share_request_model: Option<models::CipherShareRequestModel>,
2720) -> Result<models::CipherResponseModel, Error<CiphersIdSharePostError>> {
2721 let p_id = id;
2723 let p_cipher_share_request_model = cipher_share_request_model;
2724
2725 let uri_str = format!(
2726 "{}/ciphers/{id}/share",
2727 configuration.base_path,
2728 id = crate::apis::urlencode(p_id.to_string())
2729 );
2730 let mut req_builder = configuration
2731 .client
2732 .request(reqwest::Method::POST, &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.oauth_access_token {
2738 req_builder = req_builder.bearer_auth(token.to_owned());
2739 };
2740 req_builder = req_builder.json(&p_cipher_share_request_model);
2741
2742 let req = req_builder.build()?;
2743 let resp = configuration.client.execute(req).await?;
2744
2745 let status = resp.status();
2746 let content_type = resp
2747 .headers()
2748 .get("content-type")
2749 .and_then(|v| v.to_str().ok())
2750 .unwrap_or("application/octet-stream");
2751 let content_type = super::ContentType::from(content_type);
2752
2753 if !status.is_client_error() && !status.is_server_error() {
2754 let content = resp.text().await?;
2755 match content_type {
2756 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2757 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherResponseModel`"))),
2758 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::CipherResponseModel`")))),
2759 }
2760 } else {
2761 let content = resp.text().await?;
2762 let entity: Option<CiphersIdSharePostError> = serde_json::from_str(&content).ok();
2763 Err(Error::ResponseError(ResponseContent {
2764 status,
2765 content,
2766 entity,
2767 }))
2768 }
2769}
2770
2771pub async fn ciphers_id_share_put(
2772 configuration: &configuration::Configuration,
2773 id: uuid::Uuid,
2774 cipher_share_request_model: Option<models::CipherShareRequestModel>,
2775) -> Result<models::CipherResponseModel, Error<CiphersIdSharePutError>> {
2776 let p_id = id;
2778 let p_cipher_share_request_model = cipher_share_request_model;
2779
2780 let uri_str = format!(
2781 "{}/ciphers/{id}/share",
2782 configuration.base_path,
2783 id = crate::apis::urlencode(p_id.to_string())
2784 );
2785 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
2786
2787 if let Some(ref user_agent) = configuration.user_agent {
2788 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2789 }
2790 if let Some(ref token) = configuration.oauth_access_token {
2791 req_builder = req_builder.bearer_auth(token.to_owned());
2792 };
2793 req_builder = req_builder.json(&p_cipher_share_request_model);
2794
2795 let req = req_builder.build()?;
2796 let resp = configuration.client.execute(req).await?;
2797
2798 let status = resp.status();
2799 let content_type = resp
2800 .headers()
2801 .get("content-type")
2802 .and_then(|v| v.to_str().ok())
2803 .unwrap_or("application/octet-stream");
2804 let content_type = super::ContentType::from(content_type);
2805
2806 if !status.is_client_error() && !status.is_server_error() {
2807 let content = resp.text().await?;
2808 match content_type {
2809 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2810 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherResponseModel`"))),
2811 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::CipherResponseModel`")))),
2812 }
2813 } else {
2814 let content = resp.text().await?;
2815 let entity: Option<CiphersIdSharePutError> = serde_json::from_str(&content).ok();
2816 Err(Error::ResponseError(ResponseContent {
2817 status,
2818 content,
2819 entity,
2820 }))
2821 }
2822}
2823
2824pub async fn ciphers_move_post(
2825 configuration: &configuration::Configuration,
2826 cipher_bulk_move_request_model: Option<models::CipherBulkMoveRequestModel>,
2827) -> Result<(), Error<CiphersMovePostError>> {
2828 let p_cipher_bulk_move_request_model = cipher_bulk_move_request_model;
2830
2831 let uri_str = format!("{}/ciphers/move", configuration.base_path);
2832 let mut req_builder = configuration
2833 .client
2834 .request(reqwest::Method::POST, &uri_str);
2835
2836 if let Some(ref user_agent) = configuration.user_agent {
2837 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2838 }
2839 if let Some(ref token) = configuration.oauth_access_token {
2840 req_builder = req_builder.bearer_auth(token.to_owned());
2841 };
2842 req_builder = req_builder.json(&p_cipher_bulk_move_request_model);
2843
2844 let req = req_builder.build()?;
2845 let resp = configuration.client.execute(req).await?;
2846
2847 let status = resp.status();
2848
2849 if !status.is_client_error() && !status.is_server_error() {
2850 Ok(())
2851 } else {
2852 let content = resp.text().await?;
2853 let entity: Option<CiphersMovePostError> = serde_json::from_str(&content).ok();
2854 Err(Error::ResponseError(ResponseContent {
2855 status,
2856 content,
2857 entity,
2858 }))
2859 }
2860}
2861
2862pub async fn ciphers_move_put(
2863 configuration: &configuration::Configuration,
2864 cipher_bulk_move_request_model: Option<models::CipherBulkMoveRequestModel>,
2865) -> Result<(), Error<CiphersMovePutError>> {
2866 let p_cipher_bulk_move_request_model = cipher_bulk_move_request_model;
2868
2869 let uri_str = format!("{}/ciphers/move", configuration.base_path);
2870 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
2871
2872 if let Some(ref user_agent) = configuration.user_agent {
2873 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2874 }
2875 if let Some(ref token) = configuration.oauth_access_token {
2876 req_builder = req_builder.bearer_auth(token.to_owned());
2877 };
2878 req_builder = req_builder.json(&p_cipher_bulk_move_request_model);
2879
2880 let req = req_builder.build()?;
2881 let resp = configuration.client.execute(req).await?;
2882
2883 let status = resp.status();
2884
2885 if !status.is_client_error() && !status.is_server_error() {
2886 Ok(())
2887 } else {
2888 let content = resp.text().await?;
2889 let entity: Option<CiphersMovePutError> = serde_json::from_str(&content).ok();
2890 Err(Error::ResponseError(ResponseContent {
2891 status,
2892 content,
2893 entity,
2894 }))
2895 }
2896}
2897
2898pub async fn ciphers_organization_details_assigned_get(
2899 configuration: &configuration::Configuration,
2900 organization_id: Option<uuid::Uuid>,
2901) -> Result<
2902 models::CipherDetailsResponseModelListResponseModel,
2903 Error<CiphersOrganizationDetailsAssignedGetError>,
2904> {
2905 let p_organization_id = organization_id;
2907
2908 let uri_str = format!(
2909 "{}/ciphers/organization-details/assigned",
2910 configuration.base_path
2911 );
2912 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2913
2914 if let Some(ref param_value) = p_organization_id {
2915 req_builder = req_builder.query(&[("organizationId", ¶m_value.to_string())]);
2916 }
2917 if let Some(ref user_agent) = configuration.user_agent {
2918 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2919 }
2920 if let Some(ref token) = configuration.oauth_access_token {
2921 req_builder = req_builder.bearer_auth(token.to_owned());
2922 };
2923
2924 let req = req_builder.build()?;
2925 let resp = configuration.client.execute(req).await?;
2926
2927 let status = resp.status();
2928 let content_type = resp
2929 .headers()
2930 .get("content-type")
2931 .and_then(|v| v.to_str().ok())
2932 .unwrap_or("application/octet-stream");
2933 let content_type = super::ContentType::from(content_type);
2934
2935 if !status.is_client_error() && !status.is_server_error() {
2936 let content = resp.text().await?;
2937 match content_type {
2938 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2939 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherDetailsResponseModelListResponseModel`"))),
2940 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::CipherDetailsResponseModelListResponseModel`")))),
2941 }
2942 } else {
2943 let content = resp.text().await?;
2944 let entity: Option<CiphersOrganizationDetailsAssignedGetError> =
2945 serde_json::from_str(&content).ok();
2946 Err(Error::ResponseError(ResponseContent {
2947 status,
2948 content,
2949 entity,
2950 }))
2951 }
2952}
2953
2954pub async fn ciphers_organization_details_get(
2955 configuration: &configuration::Configuration,
2956 organization_id: Option<uuid::Uuid>,
2957) -> Result<
2958 models::CipherMiniDetailsResponseModelListResponseModel,
2959 Error<CiphersOrganizationDetailsGetError>,
2960> {
2961 let p_organization_id = organization_id;
2963
2964 let uri_str = format!("{}/ciphers/organization-details", configuration.base_path);
2965 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2966
2967 if let Some(ref param_value) = p_organization_id {
2968 req_builder = req_builder.query(&[("organizationId", ¶m_value.to_string())]);
2969 }
2970 if let Some(ref user_agent) = configuration.user_agent {
2971 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2972 }
2973 if let Some(ref token) = configuration.oauth_access_token {
2974 req_builder = req_builder.bearer_auth(token.to_owned());
2975 };
2976
2977 let req = req_builder.build()?;
2978 let resp = configuration.client.execute(req).await?;
2979
2980 let status = resp.status();
2981 let content_type = resp
2982 .headers()
2983 .get("content-type")
2984 .and_then(|v| v.to_str().ok())
2985 .unwrap_or("application/octet-stream");
2986 let content_type = super::ContentType::from(content_type);
2987
2988 if !status.is_client_error() && !status.is_server_error() {
2989 let content = resp.text().await?;
2990 match content_type {
2991 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2992 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherMiniDetailsResponseModelListResponseModel`"))),
2993 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::CipherMiniDetailsResponseModelListResponseModel`")))),
2994 }
2995 } else {
2996 let content = resp.text().await?;
2997 let entity: Option<CiphersOrganizationDetailsGetError> =
2998 serde_json::from_str(&content).ok();
2999 Err(Error::ResponseError(ResponseContent {
3000 status,
3001 content,
3002 entity,
3003 }))
3004 }
3005}
3006
3007pub async fn ciphers_post(
3008 configuration: &configuration::Configuration,
3009 cipher_request_model: Option<models::CipherRequestModel>,
3010) -> Result<models::CipherResponseModel, Error<CiphersPostError>> {
3011 let p_cipher_request_model = cipher_request_model;
3013
3014 let uri_str = format!("{}/ciphers", configuration.base_path);
3015 let mut req_builder = configuration
3016 .client
3017 .request(reqwest::Method::POST, &uri_str);
3018
3019 if let Some(ref user_agent) = configuration.user_agent {
3020 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3021 }
3022 if let Some(ref token) = configuration.oauth_access_token {
3023 req_builder = req_builder.bearer_auth(token.to_owned());
3024 };
3025 req_builder = req_builder.json(&p_cipher_request_model);
3026
3027 let req = req_builder.build()?;
3028 let resp = configuration.client.execute(req).await?;
3029
3030 let status = resp.status();
3031 let content_type = resp
3032 .headers()
3033 .get("content-type")
3034 .and_then(|v| v.to_str().ok())
3035 .unwrap_or("application/octet-stream");
3036 let content_type = super::ContentType::from(content_type);
3037
3038 if !status.is_client_error() && !status.is_server_error() {
3039 let content = resp.text().await?;
3040 match content_type {
3041 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3042 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherResponseModel`"))),
3043 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::CipherResponseModel`")))),
3044 }
3045 } else {
3046 let content = resp.text().await?;
3047 let entity: Option<CiphersPostError> = serde_json::from_str(&content).ok();
3048 Err(Error::ResponseError(ResponseContent {
3049 status,
3050 content,
3051 entity,
3052 }))
3053 }
3054}
3055
3056pub async fn ciphers_purge_post(
3057 configuration: &configuration::Configuration,
3058 organization_id: Option<&str>,
3059 secret_verification_request_model: Option<models::SecretVerificationRequestModel>,
3060) -> Result<(), Error<CiphersPurgePostError>> {
3061 let p_organization_id = organization_id;
3063 let p_secret_verification_request_model = secret_verification_request_model;
3064
3065 let uri_str = format!("{}/ciphers/purge", configuration.base_path);
3066 let mut req_builder = configuration
3067 .client
3068 .request(reqwest::Method::POST, &uri_str);
3069
3070 if let Some(ref param_value) = p_organization_id {
3071 req_builder = req_builder.query(&[("organizationId", ¶m_value.to_string())]);
3072 }
3073 if let Some(ref user_agent) = configuration.user_agent {
3074 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3075 }
3076 if let Some(ref token) = configuration.oauth_access_token {
3077 req_builder = req_builder.bearer_auth(token.to_owned());
3078 };
3079 req_builder = req_builder.json(&p_secret_verification_request_model);
3080
3081 let req = req_builder.build()?;
3082 let resp = configuration.client.execute(req).await?;
3083
3084 let status = resp.status();
3085
3086 if !status.is_client_error() && !status.is_server_error() {
3087 Ok(())
3088 } else {
3089 let content = resp.text().await?;
3090 let entity: Option<CiphersPurgePostError> = serde_json::from_str(&content).ok();
3091 Err(Error::ResponseError(ResponseContent {
3092 status,
3093 content,
3094 entity,
3095 }))
3096 }
3097}
3098
3099pub async fn ciphers_restore_admin_put(
3100 configuration: &configuration::Configuration,
3101 cipher_bulk_restore_request_model: Option<models::CipherBulkRestoreRequestModel>,
3102) -> Result<models::CipherMiniResponseModelListResponseModel, Error<CiphersRestoreAdminPutError>> {
3103 let p_cipher_bulk_restore_request_model = cipher_bulk_restore_request_model;
3105
3106 let uri_str = format!("{}/ciphers/restore-admin", configuration.base_path);
3107 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
3108
3109 if let Some(ref user_agent) = configuration.user_agent {
3110 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3111 }
3112 if let Some(ref token) = configuration.oauth_access_token {
3113 req_builder = req_builder.bearer_auth(token.to_owned());
3114 };
3115 req_builder = req_builder.json(&p_cipher_bulk_restore_request_model);
3116
3117 let req = req_builder.build()?;
3118 let resp = configuration.client.execute(req).await?;
3119
3120 let status = resp.status();
3121 let content_type = resp
3122 .headers()
3123 .get("content-type")
3124 .and_then(|v| v.to_str().ok())
3125 .unwrap_or("application/octet-stream");
3126 let content_type = super::ContentType::from(content_type);
3127
3128 if !status.is_client_error() && !status.is_server_error() {
3129 let content = resp.text().await?;
3130 match content_type {
3131 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3132 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherMiniResponseModelListResponseModel`"))),
3133 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::CipherMiniResponseModelListResponseModel`")))),
3134 }
3135 } else {
3136 let content = resp.text().await?;
3137 let entity: Option<CiphersRestoreAdminPutError> = serde_json::from_str(&content).ok();
3138 Err(Error::ResponseError(ResponseContent {
3139 status,
3140 content,
3141 entity,
3142 }))
3143 }
3144}
3145
3146pub async fn ciphers_restore_put(
3147 configuration: &configuration::Configuration,
3148 cipher_bulk_restore_request_model: Option<models::CipherBulkRestoreRequestModel>,
3149) -> Result<models::CipherMiniResponseModelListResponseModel, Error<CiphersRestorePutError>> {
3150 let p_cipher_bulk_restore_request_model = cipher_bulk_restore_request_model;
3152
3153 let uri_str = format!("{}/ciphers/restore", configuration.base_path);
3154 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
3155
3156 if let Some(ref user_agent) = configuration.user_agent {
3157 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3158 }
3159 if let Some(ref token) = configuration.oauth_access_token {
3160 req_builder = req_builder.bearer_auth(token.to_owned());
3161 };
3162 req_builder = req_builder.json(&p_cipher_bulk_restore_request_model);
3163
3164 let req = req_builder.build()?;
3165 let resp = configuration.client.execute(req).await?;
3166
3167 let status = resp.status();
3168 let content_type = resp
3169 .headers()
3170 .get("content-type")
3171 .and_then(|v| v.to_str().ok())
3172 .unwrap_or("application/octet-stream");
3173 let content_type = super::ContentType::from(content_type);
3174
3175 if !status.is_client_error() && !status.is_server_error() {
3176 let content = resp.text().await?;
3177 match content_type {
3178 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3179 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherMiniResponseModelListResponseModel`"))),
3180 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::CipherMiniResponseModelListResponseModel`")))),
3181 }
3182 } else {
3183 let content = resp.text().await?;
3184 let entity: Option<CiphersRestorePutError> = serde_json::from_str(&content).ok();
3185 Err(Error::ResponseError(ResponseContent {
3186 status,
3187 content,
3188 entity,
3189 }))
3190 }
3191}
3192
3193pub async fn ciphers_share_post(
3194 configuration: &configuration::Configuration,
3195 cipher_bulk_share_request_model: Option<models::CipherBulkShareRequestModel>,
3196) -> Result<models::CipherMiniResponseModelListResponseModel, Error<CiphersSharePostError>> {
3197 let p_cipher_bulk_share_request_model = cipher_bulk_share_request_model;
3199
3200 let uri_str = format!("{}/ciphers/share", configuration.base_path);
3201 let mut req_builder = configuration
3202 .client
3203 .request(reqwest::Method::POST, &uri_str);
3204
3205 if let Some(ref user_agent) = configuration.user_agent {
3206 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3207 }
3208 if let Some(ref token) = configuration.oauth_access_token {
3209 req_builder = req_builder.bearer_auth(token.to_owned());
3210 };
3211 req_builder = req_builder.json(&p_cipher_bulk_share_request_model);
3212
3213 let req = req_builder.build()?;
3214 let resp = configuration.client.execute(req).await?;
3215
3216 let status = resp.status();
3217 let content_type = resp
3218 .headers()
3219 .get("content-type")
3220 .and_then(|v| v.to_str().ok())
3221 .unwrap_or("application/octet-stream");
3222 let content_type = super::ContentType::from(content_type);
3223
3224 if !status.is_client_error() && !status.is_server_error() {
3225 let content = resp.text().await?;
3226 match content_type {
3227 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3228 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherMiniResponseModelListResponseModel`"))),
3229 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::CipherMiniResponseModelListResponseModel`")))),
3230 }
3231 } else {
3232 let content = resp.text().await?;
3233 let entity: Option<CiphersSharePostError> = serde_json::from_str(&content).ok();
3234 Err(Error::ResponseError(ResponseContent {
3235 status,
3236 content,
3237 entity,
3238 }))
3239 }
3240}
3241
3242pub async fn ciphers_share_put(
3243 configuration: &configuration::Configuration,
3244 cipher_bulk_share_request_model: Option<models::CipherBulkShareRequestModel>,
3245) -> Result<models::CipherMiniResponseModelListResponseModel, Error<CiphersSharePutError>> {
3246 let p_cipher_bulk_share_request_model = cipher_bulk_share_request_model;
3248
3249 let uri_str = format!("{}/ciphers/share", configuration.base_path);
3250 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
3251
3252 if let Some(ref user_agent) = configuration.user_agent {
3253 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3254 }
3255 if let Some(ref token) = configuration.oauth_access_token {
3256 req_builder = req_builder.bearer_auth(token.to_owned());
3257 };
3258 req_builder = req_builder.json(&p_cipher_bulk_share_request_model);
3259
3260 let req = req_builder.build()?;
3261 let resp = configuration.client.execute(req).await?;
3262
3263 let status = resp.status();
3264 let content_type = resp
3265 .headers()
3266 .get("content-type")
3267 .and_then(|v| v.to_str().ok())
3268 .unwrap_or("application/octet-stream");
3269 let content_type = super::ContentType::from(content_type);
3270
3271 if !status.is_client_error() && !status.is_server_error() {
3272 let content = resp.text().await?;
3273 match content_type {
3274 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3275 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherMiniResponseModelListResponseModel`"))),
3276 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::CipherMiniResponseModelListResponseModel`")))),
3277 }
3278 } else {
3279 let content = resp.text().await?;
3280 let entity: Option<CiphersSharePutError> = serde_json::from_str(&content).ok();
3281 Err(Error::ResponseError(ResponseContent {
3282 status,
3283 content,
3284 entity,
3285 }))
3286 }
3287}