1use std::sync::Arc;
12
13use async_trait::async_trait;
14#[cfg(feature = "mockall")]
15use mockall::automock;
16use reqwest;
17use serde::{Deserialize, Serialize, de::Error as _};
18
19use super::{Error, configuration};
20use crate::{
21 apis::{AuthRequired, ContentType, ResponseContent},
22 models,
23};
24
25#[cfg_attr(feature = "mockall", automock)]
26#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
27#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
28pub trait CiphersApi: Send + Sync {
29 async fn azure_validate_file(&self) -> Result<(), Error<AzureValidateFileError>>;
31
32 async fn delete<'a>(&self, id: uuid::Uuid) -> Result<(), Error<DeleteError>>;
34
35 async fn delete_admin<'a>(&self, id: uuid::Uuid) -> Result<(), Error<DeleteAdminError>>;
37
38 async fn delete_attachment<'a>(
40 &self,
41 id: uuid::Uuid,
42 attachment_id: &'a str,
43 ) -> Result<models::DeleteAttachmentResponseModel, Error<DeleteAttachmentError>>;
44
45 async fn delete_attachment_admin<'a>(
47 &self,
48 id: uuid::Uuid,
49 attachment_id: &'a str,
50 ) -> Result<models::DeleteAttachmentResponseModel, Error<DeleteAttachmentAdminError>>;
51
52 async fn delete_many<'a>(
54 &self,
55 cipher_bulk_delete_request_model: Option<models::CipherBulkDeleteRequestModel>,
56 ) -> Result<(), Error<DeleteManyError>>;
57
58 async fn delete_many_admin<'a>(
60 &self,
61 cipher_bulk_delete_request_model: Option<models::CipherBulkDeleteRequestModel>,
62 ) -> Result<(), Error<DeleteManyAdminError>>;
63
64 async fn get<'a>(&self, id: uuid::Uuid)
66 -> Result<models::CipherResponseModel, Error<GetError>>;
67
68 async fn get_admin<'a>(
70 &self,
71 id: &'a str,
72 ) -> Result<models::CipherMiniResponseModel, Error<GetAdminError>>;
73
74 async fn get_all(
76 &self,
77 ) -> Result<models::CipherDetailsResponseModelListResponseModel, Error<GetAllError>>;
78
79 async fn get_assigned_organization_ciphers<'a>(
81 &self,
82 organization_id: Option<uuid::Uuid>,
83 ) -> Result<
84 models::CipherDetailsResponseModelListResponseModel,
85 Error<GetAssignedOrganizationCiphersError>,
86 >;
87
88 async fn get_attachment_data<'a>(
90 &self,
91 id: uuid::Uuid,
92 attachment_id: &'a str,
93 ) -> Result<models::AttachmentResponseModel, Error<GetAttachmentDataError>>;
94
95 async fn get_attachment_data_admin<'a>(
97 &self,
98 id: uuid::Uuid,
99 attachment_id: &'a str,
100 ) -> Result<models::AttachmentResponseModel, Error<GetAttachmentDataAdminError>>;
101
102 async fn get_details<'a>(
104 &self,
105 id: uuid::Uuid,
106 ) -> Result<models::CipherDetailsResponseModel, Error<GetDetailsError>>;
107
108 async fn get_organization_ciphers<'a>(
110 &self,
111 organization_id: Option<uuid::Uuid>,
112 include_member_items: Option<bool>,
113 ) -> Result<
114 models::CipherMiniDetailsResponseModelListResponseModel,
115 Error<GetOrganizationCiphersError>,
116 >;
117
118 async fn move_many<'a>(
120 &self,
121 cipher_bulk_move_request_model: Option<models::CipherBulkMoveRequestModel>,
122 ) -> Result<(), Error<MoveManyError>>;
123
124 async fn post<'a>(
126 &self,
127 cipher_request_model: Option<models::CipherRequestModel>,
128 ) -> Result<models::CipherResponseModel, Error<PostError>>;
129
130 async fn post_admin<'a>(
132 &self,
133 cipher_create_request_model: Option<models::CipherCreateRequestModel>,
134 ) -> Result<models::CipherMiniResponseModel, Error<PostAdminError>>;
135
136 async fn post_attachment<'a>(
138 &self,
139 id: uuid::Uuid,
140 attachment_request_model: Option<models::AttachmentRequestModel>,
141 ) -> Result<models::AttachmentUploadDataResponseModel, Error<PostAttachmentError>>;
142
143 async fn post_attachment_admin<'a>(
145 &self,
146 id: &'a str,
147 ) -> Result<models::CipherMiniResponseModel, Error<PostAttachmentAdminError>>;
148
149 async fn post_attachment_share<'a>(
151 &self,
152 id: &'a str,
153 attachment_id: &'a str,
154 organization_id: Option<uuid::Uuid>,
155 ) -> Result<(), Error<PostAttachmentShareError>>;
156
157 async fn post_bulk_collections<'a>(
159 &self,
160 cipher_bulk_update_collections_request_model: Option<
161 models::CipherBulkUpdateCollectionsRequestModel,
162 >,
163 ) -> Result<(), Error<PostBulkCollectionsError>>;
164
165 async fn post_create<'a>(
167 &self,
168 cipher_create_request_model: Option<models::CipherCreateRequestModel>,
169 ) -> Result<models::CipherResponseModel, Error<PostCreateError>>;
170
171 async fn post_file_for_existing_attachment<'a>(
173 &self,
174 id: uuid::Uuid,
175 attachment_id: &'a str,
176 ) -> Result<(), Error<PostFileForExistingAttachmentError>>;
177
178 async fn post_purge<'a>(
180 &self,
181 organization_id: Option<uuid::Uuid>,
182 secret_verification_request_model: Option<models::SecretVerificationRequestModel>,
183 ) -> Result<(), Error<PostPurgeError>>;
184
185 async fn put<'a>(
187 &self,
188 id: uuid::Uuid,
189 cipher_request_model: Option<models::CipherRequestModel>,
190 ) -> Result<models::CipherResponseModel, Error<PutError>>;
191
192 async fn put_admin<'a>(
194 &self,
195 id: uuid::Uuid,
196 cipher_request_model: Option<models::CipherRequestModel>,
197 ) -> Result<models::CipherMiniResponseModel, Error<PutAdminError>>;
198
199 async fn put_archive<'a>(
201 &self,
202 id: uuid::Uuid,
203 ) -> Result<models::CipherResponseModel, Error<PutArchiveError>>;
204
205 async fn put_archive_many<'a>(
207 &self,
208 cipher_bulk_archive_request_model: Option<models::CipherBulkArchiveRequestModel>,
209 ) -> Result<models::CipherResponseModelListResponseModel, Error<PutArchiveManyError>>;
210
211 async fn put_collections<'a>(
213 &self,
214 id: uuid::Uuid,
215 cipher_collections_request_model: Option<models::CipherCollectionsRequestModel>,
216 ) -> Result<models::CipherDetailsResponseModel, Error<PutCollectionsError>>;
217
218 async fn put_collections_admin<'a>(
220 &self,
221 id: &'a str,
222 cipher_collections_request_model: Option<models::CipherCollectionsRequestModel>,
223 ) -> Result<models::CipherMiniDetailsResponseModel, Error<PutCollectionsAdminError>>;
224
225 async fn put_collections_v_next<'a>(
227 &self,
228 id: uuid::Uuid,
229 cipher_collections_request_model: Option<models::CipherCollectionsRequestModel>,
230 ) -> Result<models::OptionalCipherDetailsResponseModel, Error<PutCollections_vNextError>>;
231
232 async fn put_delete<'a>(&self, id: uuid::Uuid) -> Result<(), Error<PutDeleteError>>;
234
235 async fn put_delete_admin<'a>(&self, id: uuid::Uuid) -> Result<(), Error<PutDeleteAdminError>>;
237
238 async fn put_delete_many<'a>(
240 &self,
241 cipher_bulk_delete_request_model: Option<models::CipherBulkDeleteRequestModel>,
242 ) -> Result<(), Error<PutDeleteManyError>>;
243
244 async fn put_delete_many_admin<'a>(
246 &self,
247 cipher_bulk_delete_request_model: Option<models::CipherBulkDeleteRequestModel>,
248 ) -> Result<(), Error<PutDeleteManyAdminError>>;
249
250 async fn put_partial<'a>(
252 &self,
253 id: uuid::Uuid,
254 cipher_partial_request_model: Option<models::CipherPartialRequestModel>,
255 ) -> Result<models::CipherResponseModel, Error<PutPartialError>>;
256
257 async fn put_restore<'a>(
259 &self,
260 id: uuid::Uuid,
261 ) -> Result<models::CipherResponseModel, Error<PutRestoreError>>;
262
263 async fn put_restore_admin<'a>(
265 &self,
266 id: uuid::Uuid,
267 ) -> Result<models::CipherMiniResponseModel, Error<PutRestoreAdminError>>;
268
269 async fn put_restore_many<'a>(
271 &self,
272 cipher_bulk_restore_request_model: Option<models::CipherBulkRestoreRequestModel>,
273 ) -> Result<models::CipherMiniResponseModelListResponseModel, Error<PutRestoreManyError>>;
274
275 async fn put_restore_many_admin<'a>(
277 &self,
278 cipher_bulk_restore_request_model: Option<models::CipherBulkRestoreRequestModel>,
279 ) -> Result<models::CipherMiniResponseModelListResponseModel, Error<PutRestoreManyAdminError>>;
280
281 async fn put_share<'a>(
283 &self,
284 id: uuid::Uuid,
285 cipher_share_request_model: Option<models::CipherShareRequestModel>,
286 ) -> Result<models::CipherResponseModel, Error<PutShareError>>;
287
288 async fn put_share_many<'a>(
290 &self,
291 cipher_bulk_share_request_model: Option<models::CipherBulkShareRequestModel>,
292 ) -> Result<models::CipherMiniResponseModelListResponseModel, Error<PutShareManyError>>;
293
294 async fn put_unarchive<'a>(
296 &self,
297 id: uuid::Uuid,
298 ) -> Result<models::CipherResponseModel, Error<PutUnarchiveError>>;
299
300 async fn put_unarchive_many<'a>(
302 &self,
303 cipher_bulk_unarchive_request_model: Option<models::CipherBulkUnarchiveRequestModel>,
304 ) -> Result<models::CipherResponseModelListResponseModel, Error<PutUnarchiveManyError>>;
305
306 async fn renew_file_upload_url<'a>(
308 &self,
309 id: uuid::Uuid,
310 attachment_id: &'a str,
311 ) -> Result<models::AttachmentUploadDataResponseModel, Error<RenewFileUploadUrlError>>;
312}
313
314pub struct CiphersApiClient {
315 configuration: Arc<configuration::Configuration>,
316}
317
318impl CiphersApiClient {
319 pub fn new(configuration: Arc<configuration::Configuration>) -> Self {
320 Self { configuration }
321 }
322}
323
324#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
325#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
326impl CiphersApi for CiphersApiClient {
327 async fn azure_validate_file(&self) -> Result<(), Error<AzureValidateFileError>> {
328 let local_var_configuration = &self.configuration;
329
330 let local_var_client = &local_var_configuration.client;
331
332 let local_var_uri_str = format!(
333 "{}/ciphers/attachment/validate/azure",
334 local_var_configuration.base_path
335 );
336 let mut local_var_req_builder =
337 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
338
339 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
340
341 let local_var_resp = local_var_req_builder.send().await?;
342
343 let local_var_status = local_var_resp.status();
344 let local_var_content = local_var_resp.text().await?;
345
346 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
347 Ok(())
348 } else {
349 let local_var_entity: Option<AzureValidateFileError> =
350 serde_json::from_str(&local_var_content).ok();
351 let local_var_error = ResponseContent {
352 status: local_var_status,
353 content: local_var_content,
354 entity: local_var_entity,
355 };
356 Err(Error::ResponseError(local_var_error))
357 }
358 }
359
360 async fn delete<'a>(&self, id: uuid::Uuid) -> Result<(), Error<DeleteError>> {
361 let local_var_configuration = &self.configuration;
362
363 let local_var_client = &local_var_configuration.client;
364
365 let local_var_uri_str = format!(
366 "{}/ciphers/{id}",
367 local_var_configuration.base_path,
368 id = id
369 );
370 let mut local_var_req_builder =
371 local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
372
373 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
374
375 let local_var_resp = local_var_req_builder.send().await?;
376
377 let local_var_status = local_var_resp.status();
378 let local_var_content = local_var_resp.text().await?;
379
380 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
381 Ok(())
382 } else {
383 let local_var_entity: Option<DeleteError> =
384 serde_json::from_str(&local_var_content).ok();
385 let local_var_error = ResponseContent {
386 status: local_var_status,
387 content: local_var_content,
388 entity: local_var_entity,
389 };
390 Err(Error::ResponseError(local_var_error))
391 }
392 }
393
394 async fn delete_admin<'a>(&self, id: uuid::Uuid) -> Result<(), Error<DeleteAdminError>> {
395 let local_var_configuration = &self.configuration;
396
397 let local_var_client = &local_var_configuration.client;
398
399 let local_var_uri_str = format!(
400 "{}/ciphers/{id}/admin",
401 local_var_configuration.base_path,
402 id = id
403 );
404 let mut local_var_req_builder =
405 local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
406
407 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
408
409 let local_var_resp = local_var_req_builder.send().await?;
410
411 let local_var_status = local_var_resp.status();
412 let local_var_content = local_var_resp.text().await?;
413
414 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
415 Ok(())
416 } else {
417 let local_var_entity: Option<DeleteAdminError> =
418 serde_json::from_str(&local_var_content).ok();
419 let local_var_error = ResponseContent {
420 status: local_var_status,
421 content: local_var_content,
422 entity: local_var_entity,
423 };
424 Err(Error::ResponseError(local_var_error))
425 }
426 }
427
428 async fn delete_attachment<'a>(
429 &self,
430 id: uuid::Uuid,
431 attachment_id: &'a str,
432 ) -> Result<models::DeleteAttachmentResponseModel, Error<DeleteAttachmentError>> {
433 let local_var_configuration = &self.configuration;
434
435 let local_var_client = &local_var_configuration.client;
436
437 let local_var_uri_str = format!(
438 "{}/ciphers/{id}/attachment/{attachmentId}",
439 local_var_configuration.base_path,
440 id = id,
441 attachmentId = crate::apis::urlencode(attachment_id)
442 );
443 let mut local_var_req_builder =
444 local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
445
446 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
447
448 let local_var_resp = local_var_req_builder.send().await?;
449
450 let local_var_status = local_var_resp.status();
451 let local_var_content_type = local_var_resp
452 .headers()
453 .get("content-type")
454 .and_then(|v| v.to_str().ok())
455 .unwrap_or("application/octet-stream");
456 let local_var_content_type = super::ContentType::from(local_var_content_type);
457 let local_var_content = local_var_resp.text().await?;
458
459 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
460 match local_var_content_type {
461 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
462 ContentType::Text => {
463 return Err(Error::from(serde_json::Error::custom(
464 "Received `text/plain` content type response that cannot be converted to `models::DeleteAttachmentResponseModel`",
465 )));
466 }
467 ContentType::Unsupported(local_var_unknown_type) => {
468 return Err(Error::from(serde_json::Error::custom(format!(
469 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::DeleteAttachmentResponseModel`"
470 ))));
471 }
472 }
473 } else {
474 let local_var_entity: Option<DeleteAttachmentError> =
475 serde_json::from_str(&local_var_content).ok();
476 let local_var_error = ResponseContent {
477 status: local_var_status,
478 content: local_var_content,
479 entity: local_var_entity,
480 };
481 Err(Error::ResponseError(local_var_error))
482 }
483 }
484
485 async fn delete_attachment_admin<'a>(
486 &self,
487 id: uuid::Uuid,
488 attachment_id: &'a str,
489 ) -> Result<models::DeleteAttachmentResponseModel, Error<DeleteAttachmentAdminError>> {
490 let local_var_configuration = &self.configuration;
491
492 let local_var_client = &local_var_configuration.client;
493
494 let local_var_uri_str = format!(
495 "{}/ciphers/{id}/attachment/{attachmentId}/admin",
496 local_var_configuration.base_path,
497 id = id,
498 attachmentId = crate::apis::urlencode(attachment_id)
499 );
500 let mut local_var_req_builder =
501 local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
502
503 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
504
505 let local_var_resp = local_var_req_builder.send().await?;
506
507 let local_var_status = local_var_resp.status();
508 let local_var_content_type = local_var_resp
509 .headers()
510 .get("content-type")
511 .and_then(|v| v.to_str().ok())
512 .unwrap_or("application/octet-stream");
513 let local_var_content_type = super::ContentType::from(local_var_content_type);
514 let local_var_content = local_var_resp.text().await?;
515
516 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
517 match local_var_content_type {
518 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
519 ContentType::Text => {
520 return Err(Error::from(serde_json::Error::custom(
521 "Received `text/plain` content type response that cannot be converted to `models::DeleteAttachmentResponseModel`",
522 )));
523 }
524 ContentType::Unsupported(local_var_unknown_type) => {
525 return Err(Error::from(serde_json::Error::custom(format!(
526 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::DeleteAttachmentResponseModel`"
527 ))));
528 }
529 }
530 } else {
531 let local_var_entity: Option<DeleteAttachmentAdminError> =
532 serde_json::from_str(&local_var_content).ok();
533 let local_var_error = ResponseContent {
534 status: local_var_status,
535 content: local_var_content,
536 entity: local_var_entity,
537 };
538 Err(Error::ResponseError(local_var_error))
539 }
540 }
541
542 async fn delete_many<'a>(
543 &self,
544 cipher_bulk_delete_request_model: Option<models::CipherBulkDeleteRequestModel>,
545 ) -> Result<(), Error<DeleteManyError>> {
546 let local_var_configuration = &self.configuration;
547
548 let local_var_client = &local_var_configuration.client;
549
550 let local_var_uri_str = format!("{}/ciphers", local_var_configuration.base_path);
551 let mut local_var_req_builder =
552 local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
553
554 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
555 local_var_req_builder = local_var_req_builder.json(&cipher_bulk_delete_request_model);
556
557 let local_var_resp = local_var_req_builder.send().await?;
558
559 let local_var_status = local_var_resp.status();
560 let local_var_content = local_var_resp.text().await?;
561
562 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
563 Ok(())
564 } else {
565 let local_var_entity: Option<DeleteManyError> =
566 serde_json::from_str(&local_var_content).ok();
567 let local_var_error = ResponseContent {
568 status: local_var_status,
569 content: local_var_content,
570 entity: local_var_entity,
571 };
572 Err(Error::ResponseError(local_var_error))
573 }
574 }
575
576 async fn delete_many_admin<'a>(
577 &self,
578 cipher_bulk_delete_request_model: Option<models::CipherBulkDeleteRequestModel>,
579 ) -> Result<(), Error<DeleteManyAdminError>> {
580 let local_var_configuration = &self.configuration;
581
582 let local_var_client = &local_var_configuration.client;
583
584 let local_var_uri_str = format!("{}/ciphers/admin", local_var_configuration.base_path);
585 let mut local_var_req_builder =
586 local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
587
588 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
589 local_var_req_builder = local_var_req_builder.json(&cipher_bulk_delete_request_model);
590
591 let local_var_resp = local_var_req_builder.send().await?;
592
593 let local_var_status = local_var_resp.status();
594 let local_var_content = local_var_resp.text().await?;
595
596 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
597 Ok(())
598 } else {
599 let local_var_entity: Option<DeleteManyAdminError> =
600 serde_json::from_str(&local_var_content).ok();
601 let local_var_error = ResponseContent {
602 status: local_var_status,
603 content: local_var_content,
604 entity: local_var_entity,
605 };
606 Err(Error::ResponseError(local_var_error))
607 }
608 }
609
610 async fn get<'a>(
611 &self,
612 id: uuid::Uuid,
613 ) -> Result<models::CipherResponseModel, Error<GetError>> {
614 let local_var_configuration = &self.configuration;
615
616 let local_var_client = &local_var_configuration.client;
617
618 let local_var_uri_str = format!(
619 "{}/ciphers/{id}",
620 local_var_configuration.base_path,
621 id = id
622 );
623 let mut local_var_req_builder =
624 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
625
626 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
627
628 let local_var_resp = local_var_req_builder.send().await?;
629
630 let local_var_status = local_var_resp.status();
631 let local_var_content_type = local_var_resp
632 .headers()
633 .get("content-type")
634 .and_then(|v| v.to_str().ok())
635 .unwrap_or("application/octet-stream");
636 let local_var_content_type = super::ContentType::from(local_var_content_type);
637 let local_var_content = local_var_resp.text().await?;
638
639 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
640 match local_var_content_type {
641 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
642 ContentType::Text => {
643 return Err(Error::from(serde_json::Error::custom(
644 "Received `text/plain` content type response that cannot be converted to `models::CipherResponseModel`",
645 )));
646 }
647 ContentType::Unsupported(local_var_unknown_type) => {
648 return Err(Error::from(serde_json::Error::custom(format!(
649 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::CipherResponseModel`"
650 ))));
651 }
652 }
653 } else {
654 let local_var_entity: Option<GetError> = serde_json::from_str(&local_var_content).ok();
655 let local_var_error = ResponseContent {
656 status: local_var_status,
657 content: local_var_content,
658 entity: local_var_entity,
659 };
660 Err(Error::ResponseError(local_var_error))
661 }
662 }
663
664 async fn get_admin<'a>(
665 &self,
666 id: &'a str,
667 ) -> Result<models::CipherMiniResponseModel, Error<GetAdminError>> {
668 let local_var_configuration = &self.configuration;
669
670 let local_var_client = &local_var_configuration.client;
671
672 let local_var_uri_str = format!(
673 "{}/ciphers/{id}/admin",
674 local_var_configuration.base_path,
675 id = crate::apis::urlencode(id)
676 );
677 let mut local_var_req_builder =
678 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
679
680 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
681
682 let local_var_resp = local_var_req_builder.send().await?;
683
684 let local_var_status = local_var_resp.status();
685 let local_var_content_type = local_var_resp
686 .headers()
687 .get("content-type")
688 .and_then(|v| v.to_str().ok())
689 .unwrap_or("application/octet-stream");
690 let local_var_content_type = super::ContentType::from(local_var_content_type);
691 let local_var_content = local_var_resp.text().await?;
692
693 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
694 match local_var_content_type {
695 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
696 ContentType::Text => {
697 return Err(Error::from(serde_json::Error::custom(
698 "Received `text/plain` content type response that cannot be converted to `models::CipherMiniResponseModel`",
699 )));
700 }
701 ContentType::Unsupported(local_var_unknown_type) => {
702 return Err(Error::from(serde_json::Error::custom(format!(
703 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::CipherMiniResponseModel`"
704 ))));
705 }
706 }
707 } else {
708 let local_var_entity: Option<GetAdminError> =
709 serde_json::from_str(&local_var_content).ok();
710 let local_var_error = ResponseContent {
711 status: local_var_status,
712 content: local_var_content,
713 entity: local_var_entity,
714 };
715 Err(Error::ResponseError(local_var_error))
716 }
717 }
718
719 async fn get_all(
720 &self,
721 ) -> Result<models::CipherDetailsResponseModelListResponseModel, Error<GetAllError>> {
722 let local_var_configuration = &self.configuration;
723
724 let local_var_client = &local_var_configuration.client;
725
726 let local_var_uri_str = format!("{}/ciphers", local_var_configuration.base_path);
727 let mut local_var_req_builder =
728 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
729
730 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
731
732 let local_var_resp = local_var_req_builder.send().await?;
733
734 let local_var_status = local_var_resp.status();
735 let local_var_content_type = local_var_resp
736 .headers()
737 .get("content-type")
738 .and_then(|v| v.to_str().ok())
739 .unwrap_or("application/octet-stream");
740 let local_var_content_type = super::ContentType::from(local_var_content_type);
741 let local_var_content = local_var_resp.text().await?;
742
743 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
744 match local_var_content_type {
745 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
746 ContentType::Text => {
747 return Err(Error::from(serde_json::Error::custom(
748 "Received `text/plain` content type response that cannot be converted to `models::CipherDetailsResponseModelListResponseModel`",
749 )));
750 }
751 ContentType::Unsupported(local_var_unknown_type) => {
752 return Err(Error::from(serde_json::Error::custom(format!(
753 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::CipherDetailsResponseModelListResponseModel`"
754 ))));
755 }
756 }
757 } else {
758 let local_var_entity: Option<GetAllError> =
759 serde_json::from_str(&local_var_content).ok();
760 let local_var_error = ResponseContent {
761 status: local_var_status,
762 content: local_var_content,
763 entity: local_var_entity,
764 };
765 Err(Error::ResponseError(local_var_error))
766 }
767 }
768
769 async fn get_assigned_organization_ciphers<'a>(
770 &self,
771 organization_id: Option<uuid::Uuid>,
772 ) -> Result<
773 models::CipherDetailsResponseModelListResponseModel,
774 Error<GetAssignedOrganizationCiphersError>,
775 > {
776 let local_var_configuration = &self.configuration;
777
778 let local_var_client = &local_var_configuration.client;
779
780 let local_var_uri_str = format!(
781 "{}/ciphers/organization-details/assigned",
782 local_var_configuration.base_path
783 );
784 let mut local_var_req_builder =
785 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
786
787 if let Some(ref param_value) = organization_id {
788 local_var_req_builder =
789 local_var_req_builder.query(&[("organizationId", ¶m_value.to_string())]);
790 }
791 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
792
793 let local_var_resp = local_var_req_builder.send().await?;
794
795 let local_var_status = local_var_resp.status();
796 let local_var_content_type = local_var_resp
797 .headers()
798 .get("content-type")
799 .and_then(|v| v.to_str().ok())
800 .unwrap_or("application/octet-stream");
801 let local_var_content_type = super::ContentType::from(local_var_content_type);
802 let local_var_content = local_var_resp.text().await?;
803
804 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
805 match local_var_content_type {
806 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
807 ContentType::Text => {
808 return Err(Error::from(serde_json::Error::custom(
809 "Received `text/plain` content type response that cannot be converted to `models::CipherDetailsResponseModelListResponseModel`",
810 )));
811 }
812 ContentType::Unsupported(local_var_unknown_type) => {
813 return Err(Error::from(serde_json::Error::custom(format!(
814 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::CipherDetailsResponseModelListResponseModel`"
815 ))));
816 }
817 }
818 } else {
819 let local_var_entity: Option<GetAssignedOrganizationCiphersError> =
820 serde_json::from_str(&local_var_content).ok();
821 let local_var_error = ResponseContent {
822 status: local_var_status,
823 content: local_var_content,
824 entity: local_var_entity,
825 };
826 Err(Error::ResponseError(local_var_error))
827 }
828 }
829
830 async fn get_attachment_data<'a>(
831 &self,
832 id: uuid::Uuid,
833 attachment_id: &'a str,
834 ) -> Result<models::AttachmentResponseModel, Error<GetAttachmentDataError>> {
835 let local_var_configuration = &self.configuration;
836
837 let local_var_client = &local_var_configuration.client;
838
839 let local_var_uri_str = format!(
840 "{}/ciphers/{id}/attachment/{attachmentId}",
841 local_var_configuration.base_path,
842 id = id,
843 attachmentId = crate::apis::urlencode(attachment_id)
844 );
845 let mut local_var_req_builder =
846 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
847
848 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
849
850 let local_var_resp = local_var_req_builder.send().await?;
851
852 let local_var_status = local_var_resp.status();
853 let local_var_content_type = local_var_resp
854 .headers()
855 .get("content-type")
856 .and_then(|v| v.to_str().ok())
857 .unwrap_or("application/octet-stream");
858 let local_var_content_type = super::ContentType::from(local_var_content_type);
859 let local_var_content = local_var_resp.text().await?;
860
861 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
862 match local_var_content_type {
863 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
864 ContentType::Text => {
865 return Err(Error::from(serde_json::Error::custom(
866 "Received `text/plain` content type response that cannot be converted to `models::AttachmentResponseModel`",
867 )));
868 }
869 ContentType::Unsupported(local_var_unknown_type) => {
870 return Err(Error::from(serde_json::Error::custom(format!(
871 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::AttachmentResponseModel`"
872 ))));
873 }
874 }
875 } else {
876 let local_var_entity: Option<GetAttachmentDataError> =
877 serde_json::from_str(&local_var_content).ok();
878 let local_var_error = ResponseContent {
879 status: local_var_status,
880 content: local_var_content,
881 entity: local_var_entity,
882 };
883 Err(Error::ResponseError(local_var_error))
884 }
885 }
886
887 async fn get_attachment_data_admin<'a>(
888 &self,
889 id: uuid::Uuid,
890 attachment_id: &'a str,
891 ) -> Result<models::AttachmentResponseModel, Error<GetAttachmentDataAdminError>> {
892 let local_var_configuration = &self.configuration;
893
894 let local_var_client = &local_var_configuration.client;
895
896 let local_var_uri_str = format!(
897 "{}/ciphers/{id}/attachment/{attachmentId}/admin",
898 local_var_configuration.base_path,
899 id = id,
900 attachmentId = crate::apis::urlencode(attachment_id)
901 );
902 let mut local_var_req_builder =
903 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
904
905 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
906
907 let local_var_resp = local_var_req_builder.send().await?;
908
909 let local_var_status = local_var_resp.status();
910 let local_var_content_type = local_var_resp
911 .headers()
912 .get("content-type")
913 .and_then(|v| v.to_str().ok())
914 .unwrap_or("application/octet-stream");
915 let local_var_content_type = super::ContentType::from(local_var_content_type);
916 let local_var_content = local_var_resp.text().await?;
917
918 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
919 match local_var_content_type {
920 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
921 ContentType::Text => {
922 return Err(Error::from(serde_json::Error::custom(
923 "Received `text/plain` content type response that cannot be converted to `models::AttachmentResponseModel`",
924 )));
925 }
926 ContentType::Unsupported(local_var_unknown_type) => {
927 return Err(Error::from(serde_json::Error::custom(format!(
928 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::AttachmentResponseModel`"
929 ))));
930 }
931 }
932 } else {
933 let local_var_entity: Option<GetAttachmentDataAdminError> =
934 serde_json::from_str(&local_var_content).ok();
935 let local_var_error = ResponseContent {
936 status: local_var_status,
937 content: local_var_content,
938 entity: local_var_entity,
939 };
940 Err(Error::ResponseError(local_var_error))
941 }
942 }
943
944 async fn get_details<'a>(
945 &self,
946 id: uuid::Uuid,
947 ) -> Result<models::CipherDetailsResponseModel, Error<GetDetailsError>> {
948 let local_var_configuration = &self.configuration;
949
950 let local_var_client = &local_var_configuration.client;
951
952 let local_var_uri_str = format!(
953 "{}/ciphers/{id}/details",
954 local_var_configuration.base_path,
955 id = id
956 );
957 let mut local_var_req_builder =
958 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
959
960 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
961
962 let local_var_resp = local_var_req_builder.send().await?;
963
964 let local_var_status = local_var_resp.status();
965 let local_var_content_type = local_var_resp
966 .headers()
967 .get("content-type")
968 .and_then(|v| v.to_str().ok())
969 .unwrap_or("application/octet-stream");
970 let local_var_content_type = super::ContentType::from(local_var_content_type);
971 let local_var_content = local_var_resp.text().await?;
972
973 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
974 match local_var_content_type {
975 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
976 ContentType::Text => {
977 return Err(Error::from(serde_json::Error::custom(
978 "Received `text/plain` content type response that cannot be converted to `models::CipherDetailsResponseModel`",
979 )));
980 }
981 ContentType::Unsupported(local_var_unknown_type) => {
982 return Err(Error::from(serde_json::Error::custom(format!(
983 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::CipherDetailsResponseModel`"
984 ))));
985 }
986 }
987 } else {
988 let local_var_entity: Option<GetDetailsError> =
989 serde_json::from_str(&local_var_content).ok();
990 let local_var_error = ResponseContent {
991 status: local_var_status,
992 content: local_var_content,
993 entity: local_var_entity,
994 };
995 Err(Error::ResponseError(local_var_error))
996 }
997 }
998
999 async fn get_organization_ciphers<'a>(
1000 &self,
1001 organization_id: Option<uuid::Uuid>,
1002 include_member_items: Option<bool>,
1003 ) -> Result<
1004 models::CipherMiniDetailsResponseModelListResponseModel,
1005 Error<GetOrganizationCiphersError>,
1006 > {
1007 let local_var_configuration = &self.configuration;
1008
1009 let local_var_client = &local_var_configuration.client;
1010
1011 let local_var_uri_str = format!(
1012 "{}/ciphers/organization-details",
1013 local_var_configuration.base_path
1014 );
1015 let mut local_var_req_builder =
1016 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1017
1018 if let Some(ref param_value) = organization_id {
1019 local_var_req_builder =
1020 local_var_req_builder.query(&[("organizationId", ¶m_value.to_string())]);
1021 }
1022 if let Some(ref param_value) = include_member_items {
1023 local_var_req_builder =
1024 local_var_req_builder.query(&[("includeMemberItems", ¶m_value.to_string())]);
1025 }
1026 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1027
1028 let local_var_resp = local_var_req_builder.send().await?;
1029
1030 let local_var_status = local_var_resp.status();
1031 let local_var_content_type = local_var_resp
1032 .headers()
1033 .get("content-type")
1034 .and_then(|v| v.to_str().ok())
1035 .unwrap_or("application/octet-stream");
1036 let local_var_content_type = super::ContentType::from(local_var_content_type);
1037 let local_var_content = local_var_resp.text().await?;
1038
1039 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1040 match local_var_content_type {
1041 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1042 ContentType::Text => {
1043 return Err(Error::from(serde_json::Error::custom(
1044 "Received `text/plain` content type response that cannot be converted to `models::CipherMiniDetailsResponseModelListResponseModel`",
1045 )));
1046 }
1047 ContentType::Unsupported(local_var_unknown_type) => {
1048 return Err(Error::from(serde_json::Error::custom(format!(
1049 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::CipherMiniDetailsResponseModelListResponseModel`"
1050 ))));
1051 }
1052 }
1053 } else {
1054 let local_var_entity: Option<GetOrganizationCiphersError> =
1055 serde_json::from_str(&local_var_content).ok();
1056 let local_var_error = ResponseContent {
1057 status: local_var_status,
1058 content: local_var_content,
1059 entity: local_var_entity,
1060 };
1061 Err(Error::ResponseError(local_var_error))
1062 }
1063 }
1064
1065 async fn move_many<'a>(
1066 &self,
1067 cipher_bulk_move_request_model: Option<models::CipherBulkMoveRequestModel>,
1068 ) -> Result<(), Error<MoveManyError>> {
1069 let local_var_configuration = &self.configuration;
1070
1071 let local_var_client = &local_var_configuration.client;
1072
1073 let local_var_uri_str = format!("{}/ciphers/move", local_var_configuration.base_path);
1074 let mut local_var_req_builder =
1075 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1076
1077 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1078 local_var_req_builder = local_var_req_builder.json(&cipher_bulk_move_request_model);
1079
1080 let local_var_resp = local_var_req_builder.send().await?;
1081
1082 let local_var_status = local_var_resp.status();
1083 let local_var_content = local_var_resp.text().await?;
1084
1085 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1086 Ok(())
1087 } else {
1088 let local_var_entity: Option<MoveManyError> =
1089 serde_json::from_str(&local_var_content).ok();
1090 let local_var_error = ResponseContent {
1091 status: local_var_status,
1092 content: local_var_content,
1093 entity: local_var_entity,
1094 };
1095 Err(Error::ResponseError(local_var_error))
1096 }
1097 }
1098
1099 async fn post<'a>(
1100 &self,
1101 cipher_request_model: Option<models::CipherRequestModel>,
1102 ) -> Result<models::CipherResponseModel, Error<PostError>> {
1103 let local_var_configuration = &self.configuration;
1104
1105 let local_var_client = &local_var_configuration.client;
1106
1107 let local_var_uri_str = format!("{}/ciphers", local_var_configuration.base_path);
1108 let mut local_var_req_builder =
1109 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1110
1111 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1112 local_var_req_builder = local_var_req_builder.json(&cipher_request_model);
1113
1114 let local_var_resp = local_var_req_builder.send().await?;
1115
1116 let local_var_status = local_var_resp.status();
1117 let local_var_content_type = local_var_resp
1118 .headers()
1119 .get("content-type")
1120 .and_then(|v| v.to_str().ok())
1121 .unwrap_or("application/octet-stream");
1122 let local_var_content_type = super::ContentType::from(local_var_content_type);
1123 let local_var_content = local_var_resp.text().await?;
1124
1125 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1126 match local_var_content_type {
1127 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1128 ContentType::Text => {
1129 return Err(Error::from(serde_json::Error::custom(
1130 "Received `text/plain` content type response that cannot be converted to `models::CipherResponseModel`",
1131 )));
1132 }
1133 ContentType::Unsupported(local_var_unknown_type) => {
1134 return Err(Error::from(serde_json::Error::custom(format!(
1135 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::CipherResponseModel`"
1136 ))));
1137 }
1138 }
1139 } else {
1140 let local_var_entity: Option<PostError> = serde_json::from_str(&local_var_content).ok();
1141 let local_var_error = ResponseContent {
1142 status: local_var_status,
1143 content: local_var_content,
1144 entity: local_var_entity,
1145 };
1146 Err(Error::ResponseError(local_var_error))
1147 }
1148 }
1149
1150 async fn post_admin<'a>(
1151 &self,
1152 cipher_create_request_model: Option<models::CipherCreateRequestModel>,
1153 ) -> Result<models::CipherMiniResponseModel, Error<PostAdminError>> {
1154 let local_var_configuration = &self.configuration;
1155
1156 let local_var_client = &local_var_configuration.client;
1157
1158 let local_var_uri_str = format!("{}/ciphers/admin", local_var_configuration.base_path);
1159 let mut local_var_req_builder =
1160 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1161
1162 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1163 local_var_req_builder = local_var_req_builder.json(&cipher_create_request_model);
1164
1165 let local_var_resp = local_var_req_builder.send().await?;
1166
1167 let local_var_status = local_var_resp.status();
1168 let local_var_content_type = local_var_resp
1169 .headers()
1170 .get("content-type")
1171 .and_then(|v| v.to_str().ok())
1172 .unwrap_or("application/octet-stream");
1173 let local_var_content_type = super::ContentType::from(local_var_content_type);
1174 let local_var_content = local_var_resp.text().await?;
1175
1176 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1177 match local_var_content_type {
1178 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1179 ContentType::Text => {
1180 return Err(Error::from(serde_json::Error::custom(
1181 "Received `text/plain` content type response that cannot be converted to `models::CipherMiniResponseModel`",
1182 )));
1183 }
1184 ContentType::Unsupported(local_var_unknown_type) => {
1185 return Err(Error::from(serde_json::Error::custom(format!(
1186 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::CipherMiniResponseModel`"
1187 ))));
1188 }
1189 }
1190 } else {
1191 let local_var_entity: Option<PostAdminError> =
1192 serde_json::from_str(&local_var_content).ok();
1193 let local_var_error = ResponseContent {
1194 status: local_var_status,
1195 content: local_var_content,
1196 entity: local_var_entity,
1197 };
1198 Err(Error::ResponseError(local_var_error))
1199 }
1200 }
1201
1202 async fn post_attachment<'a>(
1203 &self,
1204 id: uuid::Uuid,
1205 attachment_request_model: Option<models::AttachmentRequestModel>,
1206 ) -> Result<models::AttachmentUploadDataResponseModel, Error<PostAttachmentError>> {
1207 let local_var_configuration = &self.configuration;
1208
1209 let local_var_client = &local_var_configuration.client;
1210
1211 let local_var_uri_str = format!(
1212 "{}/ciphers/{id}/attachment/v2",
1213 local_var_configuration.base_path,
1214 id = id
1215 );
1216 let mut local_var_req_builder =
1217 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1218
1219 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1220 local_var_req_builder = local_var_req_builder.json(&attachment_request_model);
1221
1222 let local_var_resp = local_var_req_builder.send().await?;
1223
1224 let local_var_status = local_var_resp.status();
1225 let local_var_content_type = local_var_resp
1226 .headers()
1227 .get("content-type")
1228 .and_then(|v| v.to_str().ok())
1229 .unwrap_or("application/octet-stream");
1230 let local_var_content_type = super::ContentType::from(local_var_content_type);
1231 let local_var_content = local_var_resp.text().await?;
1232
1233 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1234 match local_var_content_type {
1235 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1236 ContentType::Text => {
1237 return Err(Error::from(serde_json::Error::custom(
1238 "Received `text/plain` content type response that cannot be converted to `models::AttachmentUploadDataResponseModel`",
1239 )));
1240 }
1241 ContentType::Unsupported(local_var_unknown_type) => {
1242 return Err(Error::from(serde_json::Error::custom(format!(
1243 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::AttachmentUploadDataResponseModel`"
1244 ))));
1245 }
1246 }
1247 } else {
1248 let local_var_entity: Option<PostAttachmentError> =
1249 serde_json::from_str(&local_var_content).ok();
1250 let local_var_error = ResponseContent {
1251 status: local_var_status,
1252 content: local_var_content,
1253 entity: local_var_entity,
1254 };
1255 Err(Error::ResponseError(local_var_error))
1256 }
1257 }
1258
1259 async fn post_attachment_admin<'a>(
1260 &self,
1261 id: &'a str,
1262 ) -> Result<models::CipherMiniResponseModel, Error<PostAttachmentAdminError>> {
1263 let local_var_configuration = &self.configuration;
1264
1265 let local_var_client = &local_var_configuration.client;
1266
1267 let local_var_uri_str = format!(
1268 "{}/ciphers/{id}/attachment-admin",
1269 local_var_configuration.base_path,
1270 id = crate::apis::urlencode(id)
1271 );
1272 let mut local_var_req_builder =
1273 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1274
1275 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1276
1277 let local_var_resp = local_var_req_builder.send().await?;
1278
1279 let local_var_status = local_var_resp.status();
1280 let local_var_content_type = local_var_resp
1281 .headers()
1282 .get("content-type")
1283 .and_then(|v| v.to_str().ok())
1284 .unwrap_or("application/octet-stream");
1285 let local_var_content_type = super::ContentType::from(local_var_content_type);
1286 let local_var_content = local_var_resp.text().await?;
1287
1288 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1289 match local_var_content_type {
1290 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1291 ContentType::Text => {
1292 return Err(Error::from(serde_json::Error::custom(
1293 "Received `text/plain` content type response that cannot be converted to `models::CipherMiniResponseModel`",
1294 )));
1295 }
1296 ContentType::Unsupported(local_var_unknown_type) => {
1297 return Err(Error::from(serde_json::Error::custom(format!(
1298 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::CipherMiniResponseModel`"
1299 ))));
1300 }
1301 }
1302 } else {
1303 let local_var_entity: Option<PostAttachmentAdminError> =
1304 serde_json::from_str(&local_var_content).ok();
1305 let local_var_error = ResponseContent {
1306 status: local_var_status,
1307 content: local_var_content,
1308 entity: local_var_entity,
1309 };
1310 Err(Error::ResponseError(local_var_error))
1311 }
1312 }
1313
1314 async fn post_attachment_share<'a>(
1315 &self,
1316 id: &'a str,
1317 attachment_id: &'a str,
1318 organization_id: Option<uuid::Uuid>,
1319 ) -> Result<(), Error<PostAttachmentShareError>> {
1320 let local_var_configuration = &self.configuration;
1321
1322 let local_var_client = &local_var_configuration.client;
1323
1324 let local_var_uri_str = format!(
1325 "{}/ciphers/{id}/attachment/{attachmentId}/share",
1326 local_var_configuration.base_path,
1327 id = crate::apis::urlencode(id),
1328 attachmentId = crate::apis::urlencode(attachment_id)
1329 );
1330 let mut local_var_req_builder =
1331 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1332
1333 if let Some(ref param_value) = organization_id {
1334 local_var_req_builder =
1335 local_var_req_builder.query(&[("organizationId", ¶m_value.to_string())]);
1336 }
1337 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1338
1339 let local_var_resp = local_var_req_builder.send().await?;
1340
1341 let local_var_status = local_var_resp.status();
1342 let local_var_content = local_var_resp.text().await?;
1343
1344 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1345 Ok(())
1346 } else {
1347 let local_var_entity: Option<PostAttachmentShareError> =
1348 serde_json::from_str(&local_var_content).ok();
1349 let local_var_error = ResponseContent {
1350 status: local_var_status,
1351 content: local_var_content,
1352 entity: local_var_entity,
1353 };
1354 Err(Error::ResponseError(local_var_error))
1355 }
1356 }
1357
1358 async fn post_bulk_collections<'a>(
1359 &self,
1360 cipher_bulk_update_collections_request_model: Option<
1361 models::CipherBulkUpdateCollectionsRequestModel,
1362 >,
1363 ) -> Result<(), Error<PostBulkCollectionsError>> {
1364 let local_var_configuration = &self.configuration;
1365
1366 let local_var_client = &local_var_configuration.client;
1367
1368 let local_var_uri_str = format!(
1369 "{}/ciphers/bulk-collections",
1370 local_var_configuration.base_path
1371 );
1372 let mut local_var_req_builder =
1373 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1374
1375 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1376 local_var_req_builder =
1377 local_var_req_builder.json(&cipher_bulk_update_collections_request_model);
1378
1379 let local_var_resp = local_var_req_builder.send().await?;
1380
1381 let local_var_status = local_var_resp.status();
1382 let local_var_content = local_var_resp.text().await?;
1383
1384 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1385 Ok(())
1386 } else {
1387 let local_var_entity: Option<PostBulkCollectionsError> =
1388 serde_json::from_str(&local_var_content).ok();
1389 let local_var_error = ResponseContent {
1390 status: local_var_status,
1391 content: local_var_content,
1392 entity: local_var_entity,
1393 };
1394 Err(Error::ResponseError(local_var_error))
1395 }
1396 }
1397
1398 async fn post_create<'a>(
1399 &self,
1400 cipher_create_request_model: Option<models::CipherCreateRequestModel>,
1401 ) -> Result<models::CipherResponseModel, Error<PostCreateError>> {
1402 let local_var_configuration = &self.configuration;
1403
1404 let local_var_client = &local_var_configuration.client;
1405
1406 let local_var_uri_str = format!("{}/ciphers/create", local_var_configuration.base_path);
1407 let mut local_var_req_builder =
1408 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1409
1410 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1411 local_var_req_builder = local_var_req_builder.json(&cipher_create_request_model);
1412
1413 let local_var_resp = local_var_req_builder.send().await?;
1414
1415 let local_var_status = local_var_resp.status();
1416 let local_var_content_type = local_var_resp
1417 .headers()
1418 .get("content-type")
1419 .and_then(|v| v.to_str().ok())
1420 .unwrap_or("application/octet-stream");
1421 let local_var_content_type = super::ContentType::from(local_var_content_type);
1422 let local_var_content = local_var_resp.text().await?;
1423
1424 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1425 match local_var_content_type {
1426 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1427 ContentType::Text => {
1428 return Err(Error::from(serde_json::Error::custom(
1429 "Received `text/plain` content type response that cannot be converted to `models::CipherResponseModel`",
1430 )));
1431 }
1432 ContentType::Unsupported(local_var_unknown_type) => {
1433 return Err(Error::from(serde_json::Error::custom(format!(
1434 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::CipherResponseModel`"
1435 ))));
1436 }
1437 }
1438 } else {
1439 let local_var_entity: Option<PostCreateError> =
1440 serde_json::from_str(&local_var_content).ok();
1441 let local_var_error = ResponseContent {
1442 status: local_var_status,
1443 content: local_var_content,
1444 entity: local_var_entity,
1445 };
1446 Err(Error::ResponseError(local_var_error))
1447 }
1448 }
1449
1450 async fn post_file_for_existing_attachment<'a>(
1451 &self,
1452 id: uuid::Uuid,
1453 attachment_id: &'a str,
1454 ) -> Result<(), Error<PostFileForExistingAttachmentError>> {
1455 let local_var_configuration = &self.configuration;
1456
1457 let local_var_client = &local_var_configuration.client;
1458
1459 let local_var_uri_str = format!(
1460 "{}/ciphers/{id}/attachment/{attachmentId}",
1461 local_var_configuration.base_path,
1462 id = id,
1463 attachmentId = crate::apis::urlencode(attachment_id)
1464 );
1465 let mut local_var_req_builder =
1466 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1467
1468 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1469
1470 let local_var_resp = local_var_req_builder.send().await?;
1471
1472 let local_var_status = local_var_resp.status();
1473 let local_var_content = local_var_resp.text().await?;
1474
1475 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1476 Ok(())
1477 } else {
1478 let local_var_entity: Option<PostFileForExistingAttachmentError> =
1479 serde_json::from_str(&local_var_content).ok();
1480 let local_var_error = ResponseContent {
1481 status: local_var_status,
1482 content: local_var_content,
1483 entity: local_var_entity,
1484 };
1485 Err(Error::ResponseError(local_var_error))
1486 }
1487 }
1488
1489 async fn post_purge<'a>(
1490 &self,
1491 organization_id: Option<uuid::Uuid>,
1492 secret_verification_request_model: Option<models::SecretVerificationRequestModel>,
1493 ) -> Result<(), Error<PostPurgeError>> {
1494 let local_var_configuration = &self.configuration;
1495
1496 let local_var_client = &local_var_configuration.client;
1497
1498 let local_var_uri_str = format!("{}/ciphers/purge", local_var_configuration.base_path);
1499 let mut local_var_req_builder =
1500 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1501
1502 if let Some(ref param_value) = organization_id {
1503 local_var_req_builder =
1504 local_var_req_builder.query(&[("organizationId", ¶m_value.to_string())]);
1505 }
1506 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1507 local_var_req_builder = local_var_req_builder.json(&secret_verification_request_model);
1508
1509 let local_var_resp = local_var_req_builder.send().await?;
1510
1511 let local_var_status = local_var_resp.status();
1512 let local_var_content = local_var_resp.text().await?;
1513
1514 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1515 Ok(())
1516 } else {
1517 let local_var_entity: Option<PostPurgeError> =
1518 serde_json::from_str(&local_var_content).ok();
1519 let local_var_error = ResponseContent {
1520 status: local_var_status,
1521 content: local_var_content,
1522 entity: local_var_entity,
1523 };
1524 Err(Error::ResponseError(local_var_error))
1525 }
1526 }
1527
1528 async fn put<'a>(
1529 &self,
1530 id: uuid::Uuid,
1531 cipher_request_model: Option<models::CipherRequestModel>,
1532 ) -> Result<models::CipherResponseModel, Error<PutError>> {
1533 let local_var_configuration = &self.configuration;
1534
1535 let local_var_client = &local_var_configuration.client;
1536
1537 let local_var_uri_str = format!(
1538 "{}/ciphers/{id}",
1539 local_var_configuration.base_path,
1540 id = id
1541 );
1542 let mut local_var_req_builder =
1543 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1544
1545 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1546 local_var_req_builder = local_var_req_builder.json(&cipher_request_model);
1547
1548 let local_var_resp = local_var_req_builder.send().await?;
1549
1550 let local_var_status = local_var_resp.status();
1551 let local_var_content_type = local_var_resp
1552 .headers()
1553 .get("content-type")
1554 .and_then(|v| v.to_str().ok())
1555 .unwrap_or("application/octet-stream");
1556 let local_var_content_type = super::ContentType::from(local_var_content_type);
1557 let local_var_content = local_var_resp.text().await?;
1558
1559 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1560 match local_var_content_type {
1561 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1562 ContentType::Text => {
1563 return Err(Error::from(serde_json::Error::custom(
1564 "Received `text/plain` content type response that cannot be converted to `models::CipherResponseModel`",
1565 )));
1566 }
1567 ContentType::Unsupported(local_var_unknown_type) => {
1568 return Err(Error::from(serde_json::Error::custom(format!(
1569 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::CipherResponseModel`"
1570 ))));
1571 }
1572 }
1573 } else {
1574 let local_var_entity: Option<PutError> = serde_json::from_str(&local_var_content).ok();
1575 let local_var_error = ResponseContent {
1576 status: local_var_status,
1577 content: local_var_content,
1578 entity: local_var_entity,
1579 };
1580 Err(Error::ResponseError(local_var_error))
1581 }
1582 }
1583
1584 async fn put_admin<'a>(
1585 &self,
1586 id: uuid::Uuid,
1587 cipher_request_model: Option<models::CipherRequestModel>,
1588 ) -> Result<models::CipherMiniResponseModel, Error<PutAdminError>> {
1589 let local_var_configuration = &self.configuration;
1590
1591 let local_var_client = &local_var_configuration.client;
1592
1593 let local_var_uri_str = format!(
1594 "{}/ciphers/{id}/admin",
1595 local_var_configuration.base_path,
1596 id = id
1597 );
1598 let mut local_var_req_builder =
1599 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1600
1601 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1602 local_var_req_builder = local_var_req_builder.json(&cipher_request_model);
1603
1604 let local_var_resp = local_var_req_builder.send().await?;
1605
1606 let local_var_status = local_var_resp.status();
1607 let local_var_content_type = local_var_resp
1608 .headers()
1609 .get("content-type")
1610 .and_then(|v| v.to_str().ok())
1611 .unwrap_or("application/octet-stream");
1612 let local_var_content_type = super::ContentType::from(local_var_content_type);
1613 let local_var_content = local_var_resp.text().await?;
1614
1615 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1616 match local_var_content_type {
1617 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1618 ContentType::Text => {
1619 return Err(Error::from(serde_json::Error::custom(
1620 "Received `text/plain` content type response that cannot be converted to `models::CipherMiniResponseModel`",
1621 )));
1622 }
1623 ContentType::Unsupported(local_var_unknown_type) => {
1624 return Err(Error::from(serde_json::Error::custom(format!(
1625 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::CipherMiniResponseModel`"
1626 ))));
1627 }
1628 }
1629 } else {
1630 let local_var_entity: Option<PutAdminError> =
1631 serde_json::from_str(&local_var_content).ok();
1632 let local_var_error = ResponseContent {
1633 status: local_var_status,
1634 content: local_var_content,
1635 entity: local_var_entity,
1636 };
1637 Err(Error::ResponseError(local_var_error))
1638 }
1639 }
1640
1641 async fn put_archive<'a>(
1642 &self,
1643 id: uuid::Uuid,
1644 ) -> Result<models::CipherResponseModel, Error<PutArchiveError>> {
1645 let local_var_configuration = &self.configuration;
1646
1647 let local_var_client = &local_var_configuration.client;
1648
1649 let local_var_uri_str = format!(
1650 "{}/ciphers/{id}/archive",
1651 local_var_configuration.base_path,
1652 id = id
1653 );
1654 let mut local_var_req_builder =
1655 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1656
1657 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1658
1659 let local_var_resp = local_var_req_builder.send().await?;
1660
1661 let local_var_status = local_var_resp.status();
1662 let local_var_content_type = local_var_resp
1663 .headers()
1664 .get("content-type")
1665 .and_then(|v| v.to_str().ok())
1666 .unwrap_or("application/octet-stream");
1667 let local_var_content_type = super::ContentType::from(local_var_content_type);
1668 let local_var_content = local_var_resp.text().await?;
1669
1670 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1671 match local_var_content_type {
1672 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1673 ContentType::Text => {
1674 return Err(Error::from(serde_json::Error::custom(
1675 "Received `text/plain` content type response that cannot be converted to `models::CipherResponseModel`",
1676 )));
1677 }
1678 ContentType::Unsupported(local_var_unknown_type) => {
1679 return Err(Error::from(serde_json::Error::custom(format!(
1680 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::CipherResponseModel`"
1681 ))));
1682 }
1683 }
1684 } else {
1685 let local_var_entity: Option<PutArchiveError> =
1686 serde_json::from_str(&local_var_content).ok();
1687 let local_var_error = ResponseContent {
1688 status: local_var_status,
1689 content: local_var_content,
1690 entity: local_var_entity,
1691 };
1692 Err(Error::ResponseError(local_var_error))
1693 }
1694 }
1695
1696 async fn put_archive_many<'a>(
1697 &self,
1698 cipher_bulk_archive_request_model: Option<models::CipherBulkArchiveRequestModel>,
1699 ) -> Result<models::CipherResponseModelListResponseModel, Error<PutArchiveManyError>> {
1700 let local_var_configuration = &self.configuration;
1701
1702 let local_var_client = &local_var_configuration.client;
1703
1704 let local_var_uri_str = format!("{}/ciphers/archive", local_var_configuration.base_path);
1705 let mut local_var_req_builder =
1706 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1707
1708 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1709 local_var_req_builder = local_var_req_builder.json(&cipher_bulk_archive_request_model);
1710
1711 let local_var_resp = local_var_req_builder.send().await?;
1712
1713 let local_var_status = local_var_resp.status();
1714 let local_var_content_type = local_var_resp
1715 .headers()
1716 .get("content-type")
1717 .and_then(|v| v.to_str().ok())
1718 .unwrap_or("application/octet-stream");
1719 let local_var_content_type = super::ContentType::from(local_var_content_type);
1720 let local_var_content = local_var_resp.text().await?;
1721
1722 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1723 match local_var_content_type {
1724 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1725 ContentType::Text => {
1726 return Err(Error::from(serde_json::Error::custom(
1727 "Received `text/plain` content type response that cannot be converted to `models::CipherResponseModelListResponseModel`",
1728 )));
1729 }
1730 ContentType::Unsupported(local_var_unknown_type) => {
1731 return Err(Error::from(serde_json::Error::custom(format!(
1732 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::CipherResponseModelListResponseModel`"
1733 ))));
1734 }
1735 }
1736 } else {
1737 let local_var_entity: Option<PutArchiveManyError> =
1738 serde_json::from_str(&local_var_content).ok();
1739 let local_var_error = ResponseContent {
1740 status: local_var_status,
1741 content: local_var_content,
1742 entity: local_var_entity,
1743 };
1744 Err(Error::ResponseError(local_var_error))
1745 }
1746 }
1747
1748 async fn put_collections<'a>(
1749 &self,
1750 id: uuid::Uuid,
1751 cipher_collections_request_model: Option<models::CipherCollectionsRequestModel>,
1752 ) -> Result<models::CipherDetailsResponseModel, Error<PutCollectionsError>> {
1753 let local_var_configuration = &self.configuration;
1754
1755 let local_var_client = &local_var_configuration.client;
1756
1757 let local_var_uri_str = format!(
1758 "{}/ciphers/{id}/collections",
1759 local_var_configuration.base_path,
1760 id = id
1761 );
1762 let mut local_var_req_builder =
1763 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1764
1765 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1766 local_var_req_builder = local_var_req_builder.json(&cipher_collections_request_model);
1767
1768 let local_var_resp = local_var_req_builder.send().await?;
1769
1770 let local_var_status = local_var_resp.status();
1771 let local_var_content_type = local_var_resp
1772 .headers()
1773 .get("content-type")
1774 .and_then(|v| v.to_str().ok())
1775 .unwrap_or("application/octet-stream");
1776 let local_var_content_type = super::ContentType::from(local_var_content_type);
1777 let local_var_content = local_var_resp.text().await?;
1778
1779 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1780 match local_var_content_type {
1781 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1782 ContentType::Text => {
1783 return Err(Error::from(serde_json::Error::custom(
1784 "Received `text/plain` content type response that cannot be converted to `models::CipherDetailsResponseModel`",
1785 )));
1786 }
1787 ContentType::Unsupported(local_var_unknown_type) => {
1788 return Err(Error::from(serde_json::Error::custom(format!(
1789 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::CipherDetailsResponseModel`"
1790 ))));
1791 }
1792 }
1793 } else {
1794 let local_var_entity: Option<PutCollectionsError> =
1795 serde_json::from_str(&local_var_content).ok();
1796 let local_var_error = ResponseContent {
1797 status: local_var_status,
1798 content: local_var_content,
1799 entity: local_var_entity,
1800 };
1801 Err(Error::ResponseError(local_var_error))
1802 }
1803 }
1804
1805 async fn put_collections_admin<'a>(
1806 &self,
1807 id: &'a str,
1808 cipher_collections_request_model: Option<models::CipherCollectionsRequestModel>,
1809 ) -> Result<models::CipherMiniDetailsResponseModel, Error<PutCollectionsAdminError>> {
1810 let local_var_configuration = &self.configuration;
1811
1812 let local_var_client = &local_var_configuration.client;
1813
1814 let local_var_uri_str = format!(
1815 "{}/ciphers/{id}/collections-admin",
1816 local_var_configuration.base_path,
1817 id = crate::apis::urlencode(id)
1818 );
1819 let mut local_var_req_builder =
1820 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1821
1822 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1823 local_var_req_builder = local_var_req_builder.json(&cipher_collections_request_model);
1824
1825 let local_var_resp = local_var_req_builder.send().await?;
1826
1827 let local_var_status = local_var_resp.status();
1828 let local_var_content_type = local_var_resp
1829 .headers()
1830 .get("content-type")
1831 .and_then(|v| v.to_str().ok())
1832 .unwrap_or("application/octet-stream");
1833 let local_var_content_type = super::ContentType::from(local_var_content_type);
1834 let local_var_content = local_var_resp.text().await?;
1835
1836 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1837 match local_var_content_type {
1838 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1839 ContentType::Text => {
1840 return Err(Error::from(serde_json::Error::custom(
1841 "Received `text/plain` content type response that cannot be converted to `models::CipherMiniDetailsResponseModel`",
1842 )));
1843 }
1844 ContentType::Unsupported(local_var_unknown_type) => {
1845 return Err(Error::from(serde_json::Error::custom(format!(
1846 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::CipherMiniDetailsResponseModel`"
1847 ))));
1848 }
1849 }
1850 } else {
1851 let local_var_entity: Option<PutCollectionsAdminError> =
1852 serde_json::from_str(&local_var_content).ok();
1853 let local_var_error = ResponseContent {
1854 status: local_var_status,
1855 content: local_var_content,
1856 entity: local_var_entity,
1857 };
1858 Err(Error::ResponseError(local_var_error))
1859 }
1860 }
1861
1862 async fn put_collections_v_next<'a>(
1863 &self,
1864 id: uuid::Uuid,
1865 cipher_collections_request_model: Option<models::CipherCollectionsRequestModel>,
1866 ) -> Result<models::OptionalCipherDetailsResponseModel, Error<PutCollections_vNextError>> {
1867 let local_var_configuration = &self.configuration;
1868
1869 let local_var_client = &local_var_configuration.client;
1870
1871 let local_var_uri_str = format!(
1872 "{}/ciphers/{id}/collections_v2",
1873 local_var_configuration.base_path,
1874 id = id
1875 );
1876 let mut local_var_req_builder =
1877 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1878
1879 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1880 local_var_req_builder = local_var_req_builder.json(&cipher_collections_request_model);
1881
1882 let local_var_resp = local_var_req_builder.send().await?;
1883
1884 let local_var_status = local_var_resp.status();
1885 let local_var_content_type = local_var_resp
1886 .headers()
1887 .get("content-type")
1888 .and_then(|v| v.to_str().ok())
1889 .unwrap_or("application/octet-stream");
1890 let local_var_content_type = super::ContentType::from(local_var_content_type);
1891 let local_var_content = local_var_resp.text().await?;
1892
1893 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1894 match local_var_content_type {
1895 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
1896 ContentType::Text => {
1897 return Err(Error::from(serde_json::Error::custom(
1898 "Received `text/plain` content type response that cannot be converted to `models::OptionalCipherDetailsResponseModel`",
1899 )));
1900 }
1901 ContentType::Unsupported(local_var_unknown_type) => {
1902 return Err(Error::from(serde_json::Error::custom(format!(
1903 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::OptionalCipherDetailsResponseModel`"
1904 ))));
1905 }
1906 }
1907 } else {
1908 let local_var_entity: Option<PutCollections_vNextError> =
1909 serde_json::from_str(&local_var_content).ok();
1910 let local_var_error = ResponseContent {
1911 status: local_var_status,
1912 content: local_var_content,
1913 entity: local_var_entity,
1914 };
1915 Err(Error::ResponseError(local_var_error))
1916 }
1917 }
1918
1919 async fn put_delete<'a>(&self, id: uuid::Uuid) -> Result<(), Error<PutDeleteError>> {
1920 let local_var_configuration = &self.configuration;
1921
1922 let local_var_client = &local_var_configuration.client;
1923
1924 let local_var_uri_str = format!(
1925 "{}/ciphers/{id}/delete",
1926 local_var_configuration.base_path,
1927 id = id
1928 );
1929 let mut local_var_req_builder =
1930 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1931
1932 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1933
1934 let local_var_resp = local_var_req_builder.send().await?;
1935
1936 let local_var_status = local_var_resp.status();
1937 let local_var_content = local_var_resp.text().await?;
1938
1939 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1940 Ok(())
1941 } else {
1942 let local_var_entity: Option<PutDeleteError> =
1943 serde_json::from_str(&local_var_content).ok();
1944 let local_var_error = ResponseContent {
1945 status: local_var_status,
1946 content: local_var_content,
1947 entity: local_var_entity,
1948 };
1949 Err(Error::ResponseError(local_var_error))
1950 }
1951 }
1952
1953 async fn put_delete_admin<'a>(&self, id: uuid::Uuid) -> Result<(), Error<PutDeleteAdminError>> {
1954 let local_var_configuration = &self.configuration;
1955
1956 let local_var_client = &local_var_configuration.client;
1957
1958 let local_var_uri_str = format!(
1959 "{}/ciphers/{id}/delete-admin",
1960 local_var_configuration.base_path,
1961 id = id
1962 );
1963 let mut local_var_req_builder =
1964 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1965
1966 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1967
1968 let local_var_resp = local_var_req_builder.send().await?;
1969
1970 let local_var_status = local_var_resp.status();
1971 let local_var_content = local_var_resp.text().await?;
1972
1973 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1974 Ok(())
1975 } else {
1976 let local_var_entity: Option<PutDeleteAdminError> =
1977 serde_json::from_str(&local_var_content).ok();
1978 let local_var_error = ResponseContent {
1979 status: local_var_status,
1980 content: local_var_content,
1981 entity: local_var_entity,
1982 };
1983 Err(Error::ResponseError(local_var_error))
1984 }
1985 }
1986
1987 async fn put_delete_many<'a>(
1988 &self,
1989 cipher_bulk_delete_request_model: Option<models::CipherBulkDeleteRequestModel>,
1990 ) -> Result<(), Error<PutDeleteManyError>> {
1991 let local_var_configuration = &self.configuration;
1992
1993 let local_var_client = &local_var_configuration.client;
1994
1995 let local_var_uri_str = format!("{}/ciphers/delete", local_var_configuration.base_path);
1996 let mut local_var_req_builder =
1997 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1998
1999 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
2000 local_var_req_builder = local_var_req_builder.json(&cipher_bulk_delete_request_model);
2001
2002 let local_var_resp = local_var_req_builder.send().await?;
2003
2004 let local_var_status = local_var_resp.status();
2005 let local_var_content = local_var_resp.text().await?;
2006
2007 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2008 Ok(())
2009 } else {
2010 let local_var_entity: Option<PutDeleteManyError> =
2011 serde_json::from_str(&local_var_content).ok();
2012 let local_var_error = ResponseContent {
2013 status: local_var_status,
2014 content: local_var_content,
2015 entity: local_var_entity,
2016 };
2017 Err(Error::ResponseError(local_var_error))
2018 }
2019 }
2020
2021 async fn put_delete_many_admin<'a>(
2022 &self,
2023 cipher_bulk_delete_request_model: Option<models::CipherBulkDeleteRequestModel>,
2024 ) -> Result<(), Error<PutDeleteManyAdminError>> {
2025 let local_var_configuration = &self.configuration;
2026
2027 let local_var_client = &local_var_configuration.client;
2028
2029 let local_var_uri_str =
2030 format!("{}/ciphers/delete-admin", local_var_configuration.base_path);
2031 let mut local_var_req_builder =
2032 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
2033
2034 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
2035 local_var_req_builder = local_var_req_builder.json(&cipher_bulk_delete_request_model);
2036
2037 let local_var_resp = local_var_req_builder.send().await?;
2038
2039 let local_var_status = local_var_resp.status();
2040 let local_var_content = local_var_resp.text().await?;
2041
2042 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2043 Ok(())
2044 } else {
2045 let local_var_entity: Option<PutDeleteManyAdminError> =
2046 serde_json::from_str(&local_var_content).ok();
2047 let local_var_error = ResponseContent {
2048 status: local_var_status,
2049 content: local_var_content,
2050 entity: local_var_entity,
2051 };
2052 Err(Error::ResponseError(local_var_error))
2053 }
2054 }
2055
2056 async fn put_partial<'a>(
2057 &self,
2058 id: uuid::Uuid,
2059 cipher_partial_request_model: Option<models::CipherPartialRequestModel>,
2060 ) -> Result<models::CipherResponseModel, Error<PutPartialError>> {
2061 let local_var_configuration = &self.configuration;
2062
2063 let local_var_client = &local_var_configuration.client;
2064
2065 let local_var_uri_str = format!(
2066 "{}/ciphers/{id}/partial",
2067 local_var_configuration.base_path,
2068 id = id
2069 );
2070 let mut local_var_req_builder =
2071 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
2072
2073 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
2074 local_var_req_builder = local_var_req_builder.json(&cipher_partial_request_model);
2075
2076 let local_var_resp = local_var_req_builder.send().await?;
2077
2078 let local_var_status = local_var_resp.status();
2079 let local_var_content_type = local_var_resp
2080 .headers()
2081 .get("content-type")
2082 .and_then(|v| v.to_str().ok())
2083 .unwrap_or("application/octet-stream");
2084 let local_var_content_type = super::ContentType::from(local_var_content_type);
2085 let local_var_content = local_var_resp.text().await?;
2086
2087 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2088 match local_var_content_type {
2089 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
2090 ContentType::Text => {
2091 return Err(Error::from(serde_json::Error::custom(
2092 "Received `text/plain` content type response that cannot be converted to `models::CipherResponseModel`",
2093 )));
2094 }
2095 ContentType::Unsupported(local_var_unknown_type) => {
2096 return Err(Error::from(serde_json::Error::custom(format!(
2097 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::CipherResponseModel`"
2098 ))));
2099 }
2100 }
2101 } else {
2102 let local_var_entity: Option<PutPartialError> =
2103 serde_json::from_str(&local_var_content).ok();
2104 let local_var_error = ResponseContent {
2105 status: local_var_status,
2106 content: local_var_content,
2107 entity: local_var_entity,
2108 };
2109 Err(Error::ResponseError(local_var_error))
2110 }
2111 }
2112
2113 async fn put_restore<'a>(
2114 &self,
2115 id: uuid::Uuid,
2116 ) -> Result<models::CipherResponseModel, Error<PutRestoreError>> {
2117 let local_var_configuration = &self.configuration;
2118
2119 let local_var_client = &local_var_configuration.client;
2120
2121 let local_var_uri_str = format!(
2122 "{}/ciphers/{id}/restore",
2123 local_var_configuration.base_path,
2124 id = id
2125 );
2126 let mut local_var_req_builder =
2127 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
2128
2129 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
2130
2131 let local_var_resp = local_var_req_builder.send().await?;
2132
2133 let local_var_status = local_var_resp.status();
2134 let local_var_content_type = local_var_resp
2135 .headers()
2136 .get("content-type")
2137 .and_then(|v| v.to_str().ok())
2138 .unwrap_or("application/octet-stream");
2139 let local_var_content_type = super::ContentType::from(local_var_content_type);
2140 let local_var_content = local_var_resp.text().await?;
2141
2142 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2143 match local_var_content_type {
2144 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
2145 ContentType::Text => {
2146 return Err(Error::from(serde_json::Error::custom(
2147 "Received `text/plain` content type response that cannot be converted to `models::CipherResponseModel`",
2148 )));
2149 }
2150 ContentType::Unsupported(local_var_unknown_type) => {
2151 return Err(Error::from(serde_json::Error::custom(format!(
2152 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::CipherResponseModel`"
2153 ))));
2154 }
2155 }
2156 } else {
2157 let local_var_entity: Option<PutRestoreError> =
2158 serde_json::from_str(&local_var_content).ok();
2159 let local_var_error = ResponseContent {
2160 status: local_var_status,
2161 content: local_var_content,
2162 entity: local_var_entity,
2163 };
2164 Err(Error::ResponseError(local_var_error))
2165 }
2166 }
2167
2168 async fn put_restore_admin<'a>(
2169 &self,
2170 id: uuid::Uuid,
2171 ) -> Result<models::CipherMiniResponseModel, Error<PutRestoreAdminError>> {
2172 let local_var_configuration = &self.configuration;
2173
2174 let local_var_client = &local_var_configuration.client;
2175
2176 let local_var_uri_str = format!(
2177 "{}/ciphers/{id}/restore-admin",
2178 local_var_configuration.base_path,
2179 id = id
2180 );
2181 let mut local_var_req_builder =
2182 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
2183
2184 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
2185
2186 let local_var_resp = local_var_req_builder.send().await?;
2187
2188 let local_var_status = local_var_resp.status();
2189 let local_var_content_type = local_var_resp
2190 .headers()
2191 .get("content-type")
2192 .and_then(|v| v.to_str().ok())
2193 .unwrap_or("application/octet-stream");
2194 let local_var_content_type = super::ContentType::from(local_var_content_type);
2195 let local_var_content = local_var_resp.text().await?;
2196
2197 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2198 match local_var_content_type {
2199 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
2200 ContentType::Text => {
2201 return Err(Error::from(serde_json::Error::custom(
2202 "Received `text/plain` content type response that cannot be converted to `models::CipherMiniResponseModel`",
2203 )));
2204 }
2205 ContentType::Unsupported(local_var_unknown_type) => {
2206 return Err(Error::from(serde_json::Error::custom(format!(
2207 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::CipherMiniResponseModel`"
2208 ))));
2209 }
2210 }
2211 } else {
2212 let local_var_entity: Option<PutRestoreAdminError> =
2213 serde_json::from_str(&local_var_content).ok();
2214 let local_var_error = ResponseContent {
2215 status: local_var_status,
2216 content: local_var_content,
2217 entity: local_var_entity,
2218 };
2219 Err(Error::ResponseError(local_var_error))
2220 }
2221 }
2222
2223 async fn put_restore_many<'a>(
2224 &self,
2225 cipher_bulk_restore_request_model: Option<models::CipherBulkRestoreRequestModel>,
2226 ) -> Result<models::CipherMiniResponseModelListResponseModel, Error<PutRestoreManyError>> {
2227 let local_var_configuration = &self.configuration;
2228
2229 let local_var_client = &local_var_configuration.client;
2230
2231 let local_var_uri_str = format!("{}/ciphers/restore", local_var_configuration.base_path);
2232 let mut local_var_req_builder =
2233 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
2234
2235 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
2236 local_var_req_builder = local_var_req_builder.json(&cipher_bulk_restore_request_model);
2237
2238 let local_var_resp = local_var_req_builder.send().await?;
2239
2240 let local_var_status = local_var_resp.status();
2241 let local_var_content_type = local_var_resp
2242 .headers()
2243 .get("content-type")
2244 .and_then(|v| v.to_str().ok())
2245 .unwrap_or("application/octet-stream");
2246 let local_var_content_type = super::ContentType::from(local_var_content_type);
2247 let local_var_content = local_var_resp.text().await?;
2248
2249 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2250 match local_var_content_type {
2251 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
2252 ContentType::Text => {
2253 return Err(Error::from(serde_json::Error::custom(
2254 "Received `text/plain` content type response that cannot be converted to `models::CipherMiniResponseModelListResponseModel`",
2255 )));
2256 }
2257 ContentType::Unsupported(local_var_unknown_type) => {
2258 return Err(Error::from(serde_json::Error::custom(format!(
2259 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::CipherMiniResponseModelListResponseModel`"
2260 ))));
2261 }
2262 }
2263 } else {
2264 let local_var_entity: Option<PutRestoreManyError> =
2265 serde_json::from_str(&local_var_content).ok();
2266 let local_var_error = ResponseContent {
2267 status: local_var_status,
2268 content: local_var_content,
2269 entity: local_var_entity,
2270 };
2271 Err(Error::ResponseError(local_var_error))
2272 }
2273 }
2274
2275 async fn put_restore_many_admin<'a>(
2276 &self,
2277 cipher_bulk_restore_request_model: Option<models::CipherBulkRestoreRequestModel>,
2278 ) -> Result<models::CipherMiniResponseModelListResponseModel, Error<PutRestoreManyAdminError>>
2279 {
2280 let local_var_configuration = &self.configuration;
2281
2282 let local_var_client = &local_var_configuration.client;
2283
2284 let local_var_uri_str = format!(
2285 "{}/ciphers/restore-admin",
2286 local_var_configuration.base_path
2287 );
2288 let mut local_var_req_builder =
2289 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
2290
2291 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
2292 local_var_req_builder = local_var_req_builder.json(&cipher_bulk_restore_request_model);
2293
2294 let local_var_resp = local_var_req_builder.send().await?;
2295
2296 let local_var_status = local_var_resp.status();
2297 let local_var_content_type = local_var_resp
2298 .headers()
2299 .get("content-type")
2300 .and_then(|v| v.to_str().ok())
2301 .unwrap_or("application/octet-stream");
2302 let local_var_content_type = super::ContentType::from(local_var_content_type);
2303 let local_var_content = local_var_resp.text().await?;
2304
2305 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2306 match local_var_content_type {
2307 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
2308 ContentType::Text => {
2309 return Err(Error::from(serde_json::Error::custom(
2310 "Received `text/plain` content type response that cannot be converted to `models::CipherMiniResponseModelListResponseModel`",
2311 )));
2312 }
2313 ContentType::Unsupported(local_var_unknown_type) => {
2314 return Err(Error::from(serde_json::Error::custom(format!(
2315 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::CipherMiniResponseModelListResponseModel`"
2316 ))));
2317 }
2318 }
2319 } else {
2320 let local_var_entity: Option<PutRestoreManyAdminError> =
2321 serde_json::from_str(&local_var_content).ok();
2322 let local_var_error = ResponseContent {
2323 status: local_var_status,
2324 content: local_var_content,
2325 entity: local_var_entity,
2326 };
2327 Err(Error::ResponseError(local_var_error))
2328 }
2329 }
2330
2331 async fn put_share<'a>(
2332 &self,
2333 id: uuid::Uuid,
2334 cipher_share_request_model: Option<models::CipherShareRequestModel>,
2335 ) -> Result<models::CipherResponseModel, Error<PutShareError>> {
2336 let local_var_configuration = &self.configuration;
2337
2338 let local_var_client = &local_var_configuration.client;
2339
2340 let local_var_uri_str = format!(
2341 "{}/ciphers/{id}/share",
2342 local_var_configuration.base_path,
2343 id = id
2344 );
2345 let mut local_var_req_builder =
2346 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
2347
2348 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
2349 local_var_req_builder = local_var_req_builder.json(&cipher_share_request_model);
2350
2351 let local_var_resp = local_var_req_builder.send().await?;
2352
2353 let local_var_status = local_var_resp.status();
2354 let local_var_content_type = local_var_resp
2355 .headers()
2356 .get("content-type")
2357 .and_then(|v| v.to_str().ok())
2358 .unwrap_or("application/octet-stream");
2359 let local_var_content_type = super::ContentType::from(local_var_content_type);
2360 let local_var_content = local_var_resp.text().await?;
2361
2362 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2363 match local_var_content_type {
2364 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
2365 ContentType::Text => {
2366 return Err(Error::from(serde_json::Error::custom(
2367 "Received `text/plain` content type response that cannot be converted to `models::CipherResponseModel`",
2368 )));
2369 }
2370 ContentType::Unsupported(local_var_unknown_type) => {
2371 return Err(Error::from(serde_json::Error::custom(format!(
2372 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::CipherResponseModel`"
2373 ))));
2374 }
2375 }
2376 } else {
2377 let local_var_entity: Option<PutShareError> =
2378 serde_json::from_str(&local_var_content).ok();
2379 let local_var_error = ResponseContent {
2380 status: local_var_status,
2381 content: local_var_content,
2382 entity: local_var_entity,
2383 };
2384 Err(Error::ResponseError(local_var_error))
2385 }
2386 }
2387
2388 async fn put_share_many<'a>(
2389 &self,
2390 cipher_bulk_share_request_model: Option<models::CipherBulkShareRequestModel>,
2391 ) -> Result<models::CipherMiniResponseModelListResponseModel, Error<PutShareManyError>> {
2392 let local_var_configuration = &self.configuration;
2393
2394 let local_var_client = &local_var_configuration.client;
2395
2396 let local_var_uri_str = format!("{}/ciphers/share", local_var_configuration.base_path);
2397 let mut local_var_req_builder =
2398 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
2399
2400 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
2401 local_var_req_builder = local_var_req_builder.json(&cipher_bulk_share_request_model);
2402
2403 let local_var_resp = local_var_req_builder.send().await?;
2404
2405 let local_var_status = local_var_resp.status();
2406 let local_var_content_type = local_var_resp
2407 .headers()
2408 .get("content-type")
2409 .and_then(|v| v.to_str().ok())
2410 .unwrap_or("application/octet-stream");
2411 let local_var_content_type = super::ContentType::from(local_var_content_type);
2412 let local_var_content = local_var_resp.text().await?;
2413
2414 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2415 match local_var_content_type {
2416 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
2417 ContentType::Text => {
2418 return Err(Error::from(serde_json::Error::custom(
2419 "Received `text/plain` content type response that cannot be converted to `models::CipherMiniResponseModelListResponseModel`",
2420 )));
2421 }
2422 ContentType::Unsupported(local_var_unknown_type) => {
2423 return Err(Error::from(serde_json::Error::custom(format!(
2424 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::CipherMiniResponseModelListResponseModel`"
2425 ))));
2426 }
2427 }
2428 } else {
2429 let local_var_entity: Option<PutShareManyError> =
2430 serde_json::from_str(&local_var_content).ok();
2431 let local_var_error = ResponseContent {
2432 status: local_var_status,
2433 content: local_var_content,
2434 entity: local_var_entity,
2435 };
2436 Err(Error::ResponseError(local_var_error))
2437 }
2438 }
2439
2440 async fn put_unarchive<'a>(
2441 &self,
2442 id: uuid::Uuid,
2443 ) -> Result<models::CipherResponseModel, Error<PutUnarchiveError>> {
2444 let local_var_configuration = &self.configuration;
2445
2446 let local_var_client = &local_var_configuration.client;
2447
2448 let local_var_uri_str = format!(
2449 "{}/ciphers/{id}/unarchive",
2450 local_var_configuration.base_path,
2451 id = id
2452 );
2453 let mut local_var_req_builder =
2454 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
2455
2456 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
2457
2458 let local_var_resp = local_var_req_builder.send().await?;
2459
2460 let local_var_status = local_var_resp.status();
2461 let local_var_content_type = local_var_resp
2462 .headers()
2463 .get("content-type")
2464 .and_then(|v| v.to_str().ok())
2465 .unwrap_or("application/octet-stream");
2466 let local_var_content_type = super::ContentType::from(local_var_content_type);
2467 let local_var_content = local_var_resp.text().await?;
2468
2469 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2470 match local_var_content_type {
2471 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
2472 ContentType::Text => {
2473 return Err(Error::from(serde_json::Error::custom(
2474 "Received `text/plain` content type response that cannot be converted to `models::CipherResponseModel`",
2475 )));
2476 }
2477 ContentType::Unsupported(local_var_unknown_type) => {
2478 return Err(Error::from(serde_json::Error::custom(format!(
2479 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::CipherResponseModel`"
2480 ))));
2481 }
2482 }
2483 } else {
2484 let local_var_entity: Option<PutUnarchiveError> =
2485 serde_json::from_str(&local_var_content).ok();
2486 let local_var_error = ResponseContent {
2487 status: local_var_status,
2488 content: local_var_content,
2489 entity: local_var_entity,
2490 };
2491 Err(Error::ResponseError(local_var_error))
2492 }
2493 }
2494
2495 async fn put_unarchive_many<'a>(
2496 &self,
2497 cipher_bulk_unarchive_request_model: Option<models::CipherBulkUnarchiveRequestModel>,
2498 ) -> Result<models::CipherResponseModelListResponseModel, Error<PutUnarchiveManyError>> {
2499 let local_var_configuration = &self.configuration;
2500
2501 let local_var_client = &local_var_configuration.client;
2502
2503 let local_var_uri_str = format!("{}/ciphers/unarchive", local_var_configuration.base_path);
2504 let mut local_var_req_builder =
2505 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
2506
2507 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
2508 local_var_req_builder = local_var_req_builder.json(&cipher_bulk_unarchive_request_model);
2509
2510 let local_var_resp = local_var_req_builder.send().await?;
2511
2512 let local_var_status = local_var_resp.status();
2513 let local_var_content_type = local_var_resp
2514 .headers()
2515 .get("content-type")
2516 .and_then(|v| v.to_str().ok())
2517 .unwrap_or("application/octet-stream");
2518 let local_var_content_type = super::ContentType::from(local_var_content_type);
2519 let local_var_content = local_var_resp.text().await?;
2520
2521 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2522 match local_var_content_type {
2523 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
2524 ContentType::Text => {
2525 return Err(Error::from(serde_json::Error::custom(
2526 "Received `text/plain` content type response that cannot be converted to `models::CipherResponseModelListResponseModel`",
2527 )));
2528 }
2529 ContentType::Unsupported(local_var_unknown_type) => {
2530 return Err(Error::from(serde_json::Error::custom(format!(
2531 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::CipherResponseModelListResponseModel`"
2532 ))));
2533 }
2534 }
2535 } else {
2536 let local_var_entity: Option<PutUnarchiveManyError> =
2537 serde_json::from_str(&local_var_content).ok();
2538 let local_var_error = ResponseContent {
2539 status: local_var_status,
2540 content: local_var_content,
2541 entity: local_var_entity,
2542 };
2543 Err(Error::ResponseError(local_var_error))
2544 }
2545 }
2546
2547 async fn renew_file_upload_url<'a>(
2548 &self,
2549 id: uuid::Uuid,
2550 attachment_id: &'a str,
2551 ) -> Result<models::AttachmentUploadDataResponseModel, Error<RenewFileUploadUrlError>> {
2552 let local_var_configuration = &self.configuration;
2553
2554 let local_var_client = &local_var_configuration.client;
2555
2556 let local_var_uri_str = format!(
2557 "{}/ciphers/{id}/attachment/{attachmentId}/renew",
2558 local_var_configuration.base_path,
2559 id = id,
2560 attachmentId = crate::apis::urlencode(attachment_id)
2561 );
2562 let mut local_var_req_builder =
2563 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2564
2565 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
2566
2567 let local_var_resp = local_var_req_builder.send().await?;
2568
2569 let local_var_status = local_var_resp.status();
2570 let local_var_content_type = local_var_resp
2571 .headers()
2572 .get("content-type")
2573 .and_then(|v| v.to_str().ok())
2574 .unwrap_or("application/octet-stream");
2575 let local_var_content_type = super::ContentType::from(local_var_content_type);
2576 let local_var_content = local_var_resp.text().await?;
2577
2578 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2579 match local_var_content_type {
2580 ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from),
2581 ContentType::Text => {
2582 return Err(Error::from(serde_json::Error::custom(
2583 "Received `text/plain` content type response that cannot be converted to `models::AttachmentUploadDataResponseModel`",
2584 )));
2585 }
2586 ContentType::Unsupported(local_var_unknown_type) => {
2587 return Err(Error::from(serde_json::Error::custom(format!(
2588 "Received `{local_var_unknown_type}` content type response that cannot be converted to `models::AttachmentUploadDataResponseModel`"
2589 ))));
2590 }
2591 }
2592 } else {
2593 let local_var_entity: Option<RenewFileUploadUrlError> =
2594 serde_json::from_str(&local_var_content).ok();
2595 let local_var_error = ResponseContent {
2596 status: local_var_status,
2597 content: local_var_content,
2598 entity: local_var_entity,
2599 };
2600 Err(Error::ResponseError(local_var_error))
2601 }
2602 }
2603}
2604
2605#[derive(Debug, Clone, Serialize, Deserialize)]
2607#[serde(untagged)]
2608pub enum AzureValidateFileError {
2609 UnknownValue(serde_json::Value),
2610}
2611#[derive(Debug, Clone, Serialize, Deserialize)]
2613#[serde(untagged)]
2614pub enum DeleteError {
2615 UnknownValue(serde_json::Value),
2616}
2617#[derive(Debug, Clone, Serialize, Deserialize)]
2619#[serde(untagged)]
2620pub enum DeleteAdminError {
2621 UnknownValue(serde_json::Value),
2622}
2623#[derive(Debug, Clone, Serialize, Deserialize)]
2625#[serde(untagged)]
2626pub enum DeleteAttachmentError {
2627 UnknownValue(serde_json::Value),
2628}
2629#[derive(Debug, Clone, Serialize, Deserialize)]
2631#[serde(untagged)]
2632pub enum DeleteAttachmentAdminError {
2633 UnknownValue(serde_json::Value),
2634}
2635#[derive(Debug, Clone, Serialize, Deserialize)]
2637#[serde(untagged)]
2638pub enum DeleteManyError {
2639 UnknownValue(serde_json::Value),
2640}
2641#[derive(Debug, Clone, Serialize, Deserialize)]
2643#[serde(untagged)]
2644pub enum DeleteManyAdminError {
2645 UnknownValue(serde_json::Value),
2646}
2647#[derive(Debug, Clone, Serialize, Deserialize)]
2649#[serde(untagged)]
2650pub enum GetError {
2651 UnknownValue(serde_json::Value),
2652}
2653#[derive(Debug, Clone, Serialize, Deserialize)]
2655#[serde(untagged)]
2656pub enum GetAdminError {
2657 UnknownValue(serde_json::Value),
2658}
2659#[derive(Debug, Clone, Serialize, Deserialize)]
2661#[serde(untagged)]
2662pub enum GetAllError {
2663 UnknownValue(serde_json::Value),
2664}
2665#[derive(Debug, Clone, Serialize, Deserialize)]
2667#[serde(untagged)]
2668pub enum GetAssignedOrganizationCiphersError {
2669 UnknownValue(serde_json::Value),
2670}
2671#[derive(Debug, Clone, Serialize, Deserialize)]
2673#[serde(untagged)]
2674pub enum GetAttachmentDataError {
2675 UnknownValue(serde_json::Value),
2676}
2677#[derive(Debug, Clone, Serialize, Deserialize)]
2679#[serde(untagged)]
2680pub enum GetAttachmentDataAdminError {
2681 UnknownValue(serde_json::Value),
2682}
2683#[derive(Debug, Clone, Serialize, Deserialize)]
2685#[serde(untagged)]
2686pub enum GetDetailsError {
2687 UnknownValue(serde_json::Value),
2688}
2689#[derive(Debug, Clone, Serialize, Deserialize)]
2691#[serde(untagged)]
2692pub enum GetOrganizationCiphersError {
2693 UnknownValue(serde_json::Value),
2694}
2695#[derive(Debug, Clone, Serialize, Deserialize)]
2697#[serde(untagged)]
2698pub enum MoveManyError {
2699 UnknownValue(serde_json::Value),
2700}
2701#[derive(Debug, Clone, Serialize, Deserialize)]
2703#[serde(untagged)]
2704pub enum PostError {
2705 UnknownValue(serde_json::Value),
2706}
2707#[derive(Debug, Clone, Serialize, Deserialize)]
2709#[serde(untagged)]
2710pub enum PostAdminError {
2711 UnknownValue(serde_json::Value),
2712}
2713#[derive(Debug, Clone, Serialize, Deserialize)]
2715#[serde(untagged)]
2716pub enum PostAttachmentError {
2717 UnknownValue(serde_json::Value),
2718}
2719#[derive(Debug, Clone, Serialize, Deserialize)]
2721#[serde(untagged)]
2722pub enum PostAttachmentAdminError {
2723 UnknownValue(serde_json::Value),
2724}
2725#[derive(Debug, Clone, Serialize, Deserialize)]
2727#[serde(untagged)]
2728pub enum PostAttachmentShareError {
2729 UnknownValue(serde_json::Value),
2730}
2731#[derive(Debug, Clone, Serialize, Deserialize)]
2733#[serde(untagged)]
2734pub enum PostBulkCollectionsError {
2735 UnknownValue(serde_json::Value),
2736}
2737#[derive(Debug, Clone, Serialize, Deserialize)]
2739#[serde(untagged)]
2740pub enum PostCreateError {
2741 UnknownValue(serde_json::Value),
2742}
2743#[derive(Debug, Clone, Serialize, Deserialize)]
2745#[serde(untagged)]
2746pub enum PostFileForExistingAttachmentError {
2747 UnknownValue(serde_json::Value),
2748}
2749#[derive(Debug, Clone, Serialize, Deserialize)]
2751#[serde(untagged)]
2752pub enum PostPurgeError {
2753 UnknownValue(serde_json::Value),
2754}
2755#[derive(Debug, Clone, Serialize, Deserialize)]
2757#[serde(untagged)]
2758pub enum PutError {
2759 UnknownValue(serde_json::Value),
2760}
2761#[derive(Debug, Clone, Serialize, Deserialize)]
2763#[serde(untagged)]
2764pub enum PutAdminError {
2765 UnknownValue(serde_json::Value),
2766}
2767#[derive(Debug, Clone, Serialize, Deserialize)]
2769#[serde(untagged)]
2770pub enum PutArchiveError {
2771 UnknownValue(serde_json::Value),
2772}
2773#[derive(Debug, Clone, Serialize, Deserialize)]
2775#[serde(untagged)]
2776pub enum PutArchiveManyError {
2777 UnknownValue(serde_json::Value),
2778}
2779#[derive(Debug, Clone, Serialize, Deserialize)]
2781#[serde(untagged)]
2782pub enum PutCollectionsError {
2783 UnknownValue(serde_json::Value),
2784}
2785#[derive(Debug, Clone, Serialize, Deserialize)]
2787#[serde(untagged)]
2788pub enum PutCollectionsAdminError {
2789 UnknownValue(serde_json::Value),
2790}
2791#[derive(Debug, Clone, Serialize, Deserialize)]
2793#[serde(untagged)]
2794pub enum PutCollections_vNextError {
2795 UnknownValue(serde_json::Value),
2796}
2797#[derive(Debug, Clone, Serialize, Deserialize)]
2799#[serde(untagged)]
2800pub enum PutDeleteError {
2801 UnknownValue(serde_json::Value),
2802}
2803#[derive(Debug, Clone, Serialize, Deserialize)]
2805#[serde(untagged)]
2806pub enum PutDeleteAdminError {
2807 UnknownValue(serde_json::Value),
2808}
2809#[derive(Debug, Clone, Serialize, Deserialize)]
2811#[serde(untagged)]
2812pub enum PutDeleteManyError {
2813 UnknownValue(serde_json::Value),
2814}
2815#[derive(Debug, Clone, Serialize, Deserialize)]
2817#[serde(untagged)]
2818pub enum PutDeleteManyAdminError {
2819 UnknownValue(serde_json::Value),
2820}
2821#[derive(Debug, Clone, Serialize, Deserialize)]
2823#[serde(untagged)]
2824pub enum PutPartialError {
2825 UnknownValue(serde_json::Value),
2826}
2827#[derive(Debug, Clone, Serialize, Deserialize)]
2829#[serde(untagged)]
2830pub enum PutRestoreError {
2831 UnknownValue(serde_json::Value),
2832}
2833#[derive(Debug, Clone, Serialize, Deserialize)]
2835#[serde(untagged)]
2836pub enum PutRestoreAdminError {
2837 UnknownValue(serde_json::Value),
2838}
2839#[derive(Debug, Clone, Serialize, Deserialize)]
2841#[serde(untagged)]
2842pub enum PutRestoreManyError {
2843 UnknownValue(serde_json::Value),
2844}
2845#[derive(Debug, Clone, Serialize, Deserialize)]
2847#[serde(untagged)]
2848pub enum PutRestoreManyAdminError {
2849 UnknownValue(serde_json::Value),
2850}
2851#[derive(Debug, Clone, Serialize, Deserialize)]
2853#[serde(untagged)]
2854pub enum PutShareError {
2855 UnknownValue(serde_json::Value),
2856}
2857#[derive(Debug, Clone, Serialize, Deserialize)]
2859#[serde(untagged)]
2860pub enum PutShareManyError {
2861 UnknownValue(serde_json::Value),
2862}
2863#[derive(Debug, Clone, Serialize, Deserialize)]
2865#[serde(untagged)]
2866pub enum PutUnarchiveError {
2867 UnknownValue(serde_json::Value),
2868}
2869#[derive(Debug, Clone, Serialize, Deserialize)]
2871#[serde(untagged)]
2872pub enum PutUnarchiveManyError {
2873 UnknownValue(serde_json::Value),
2874}
2875#[derive(Debug, Clone, Serialize, Deserialize)]
2877#[serde(untagged)]
2878pub enum RenewFileUploadUrlError {
2879 UnknownValue(serde_json::Value),
2880}