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>;
31
32 async fn delete<'a>(&self, id: uuid::Uuid) -> Result<(), Error>;
34
35 async fn delete_admin<'a>(&self, id: uuid::Uuid) -> Result<(), Error>;
37
38 async fn delete_attachment<'a>(
40 &self,
41 id: uuid::Uuid,
42 attachment_id: &'a str,
43 ) -> Result<models::DeleteAttachmentResponseModel, Error>;
44
45 async fn delete_attachment_admin<'a>(
47 &self,
48 id: uuid::Uuid,
49 attachment_id: &'a str,
50 ) -> Result<models::DeleteAttachmentResponseModel, Error>;
51
52 async fn delete_many<'a>(
54 &self,
55 cipher_bulk_delete_request_model: Option<models::CipherBulkDeleteRequestModel>,
56 ) -> Result<(), Error>;
57
58 async fn delete_many_admin<'a>(
60 &self,
61 cipher_bulk_delete_request_model: Option<models::CipherBulkDeleteRequestModel>,
62 ) -> Result<(), Error>;
63
64 async fn download_attachment<'a>(&self, token: Option<&'a str>) -> Result<(), Error>;
66
67 async fn get<'a>(&self, id: uuid::Uuid) -> Result<models::CipherResponseModel, Error>;
69
70 async fn get_admin<'a>(&self, id: &'a str) -> Result<models::CipherMiniResponseModel, Error>;
72
73 async fn get_all(&self) -> Result<models::CipherDetailsResponseModelListResponseModel, Error>;
75
76 async fn get_assigned_organization_ciphers<'a>(
78 &self,
79 organization_id: Option<uuid::Uuid>,
80 ) -> Result<models::CipherDetailsResponseModelListResponseModel, Error>;
81
82 async fn get_attachment_data<'a>(
84 &self,
85 id: uuid::Uuid,
86 attachment_id: &'a str,
87 ) -> Result<models::AttachmentResponseModel, Error>;
88
89 async fn get_attachment_data_admin<'a>(
91 &self,
92 id: uuid::Uuid,
93 attachment_id: &'a str,
94 ) -> Result<models::AttachmentResponseModel, Error>;
95
96 async fn get_details<'a>(
98 &self,
99 id: uuid::Uuid,
100 ) -> Result<models::CipherDetailsResponseModel, Error>;
101
102 async fn get_organization_ciphers<'a>(
104 &self,
105 organization_id: Option<uuid::Uuid>,
106 include_member_items: Option<bool>,
107 ) -> Result<models::CipherMiniDetailsResponseModelListResponseModel, Error>;
108
109 async fn move_many<'a>(
111 &self,
112 cipher_bulk_move_request_model: Option<models::CipherBulkMoveRequestModel>,
113 ) -> Result<(), Error>;
114
115 async fn post<'a>(
117 &self,
118 cipher_request_model: Option<models::CipherRequestModel>,
119 ) -> Result<models::CipherResponseModel, Error>;
120
121 async fn post_admin<'a>(
123 &self,
124 cipher_create_request_model: Option<models::CipherCreateRequestModel>,
125 ) -> Result<models::CipherMiniResponseModel, Error>;
126
127 async fn post_attachment<'a>(
129 &self,
130 id: uuid::Uuid,
131 attachment_request_model: Option<models::AttachmentRequestModel>,
132 ) -> Result<models::AttachmentUploadDataResponseModel, Error>;
133
134 async fn post_attachment_admin<'a>(
136 &self,
137 id: &'a str,
138 ) -> Result<models::CipherMiniResponseModel, Error>;
139
140 async fn post_attachment_share<'a>(
142 &self,
143 id: &'a str,
144 attachment_id: &'a str,
145 organization_id: Option<uuid::Uuid>,
146 ) -> Result<(), Error>;
147
148 async fn post_bulk_collections<'a>(
150 &self,
151 cipher_bulk_update_collections_request_model: Option<
152 models::CipherBulkUpdateCollectionsRequestModel,
153 >,
154 ) -> Result<(), Error>;
155
156 async fn post_create<'a>(
158 &self,
159 cipher_create_request_model: Option<models::CipherCreateRequestModel>,
160 ) -> Result<models::CipherResponseModel, Error>;
161
162 async fn post_file_for_existing_attachment<'a>(
164 &self,
165 id: uuid::Uuid,
166 attachment_id: &'a str,
167 ) -> Result<(), Error>;
168
169 async fn post_purge<'a>(
171 &self,
172 organization_id: Option<uuid::Uuid>,
173 secret_verification_request_model: Option<models::SecretVerificationRequestModel>,
174 ) -> Result<(), Error>;
175
176 async fn put<'a>(
178 &self,
179 id: uuid::Uuid,
180 cipher_request_model: Option<models::CipherRequestModel>,
181 ) -> Result<models::CipherResponseModel, Error>;
182
183 async fn put_admin<'a>(
185 &self,
186 id: uuid::Uuid,
187 cipher_request_model: Option<models::CipherRequestModel>,
188 ) -> Result<models::CipherMiniResponseModel, Error>;
189
190 async fn put_archive<'a>(&self, id: uuid::Uuid) -> Result<models::CipherResponseModel, Error>;
192
193 async fn put_archive_many<'a>(
195 &self,
196 cipher_bulk_archive_request_model: Option<models::CipherBulkArchiveRequestModel>,
197 ) -> Result<models::CipherResponseModelListResponseModel, Error>;
198
199 async fn put_collections_admin<'a>(
201 &self,
202 id: &'a str,
203 cipher_collections_request_model: Option<models::CipherCollectionsRequestModel>,
204 ) -> Result<models::CipherMiniDetailsResponseModel, Error>;
205
206 async fn put_collections_v_next<'a>(
208 &self,
209 id: uuid::Uuid,
210 cipher_collections_request_model: Option<models::CipherCollectionsRequestModel>,
211 ) -> Result<models::OptionalCipherDetailsResponseModel, Error>;
212
213 async fn put_delete<'a>(&self, id: uuid::Uuid) -> Result<(), Error>;
215
216 async fn put_delete_admin<'a>(&self, id: uuid::Uuid) -> Result<(), Error>;
218
219 async fn put_delete_many<'a>(
221 &self,
222 cipher_bulk_delete_request_model: Option<models::CipherBulkDeleteRequestModel>,
223 ) -> Result<(), Error>;
224
225 async fn put_delete_many_admin<'a>(
227 &self,
228 cipher_bulk_delete_request_model: Option<models::CipherBulkDeleteRequestModel>,
229 ) -> Result<(), Error>;
230
231 async fn put_partial<'a>(
233 &self,
234 id: uuid::Uuid,
235 cipher_partial_request_model: Option<models::CipherPartialRequestModel>,
236 ) -> Result<models::CipherResponseModel, Error>;
237
238 async fn put_restore<'a>(&self, id: uuid::Uuid) -> Result<models::CipherResponseModel, Error>;
240
241 async fn put_restore_admin<'a>(
243 &self,
244 id: uuid::Uuid,
245 ) -> Result<models::CipherMiniResponseModel, Error>;
246
247 async fn put_restore_many<'a>(
249 &self,
250 cipher_bulk_restore_request_model: Option<models::CipherBulkRestoreRequestModel>,
251 ) -> Result<models::CipherMiniResponseModelListResponseModel, Error>;
252
253 async fn put_restore_many_admin<'a>(
255 &self,
256 cipher_bulk_restore_request_model: Option<models::CipherBulkRestoreRequestModel>,
257 ) -> Result<models::CipherMiniResponseModelListResponseModel, Error>;
258
259 async fn put_share<'a>(
261 &self,
262 id: uuid::Uuid,
263 cipher_share_request_model: Option<models::CipherShareRequestModel>,
264 ) -> Result<models::CipherResponseModel, Error>;
265
266 async fn put_share_many<'a>(
268 &self,
269 cipher_bulk_share_request_model: Option<models::CipherBulkShareRequestModel>,
270 ) -> Result<models::CipherMiniResponseModelListResponseModel, Error>;
271
272 async fn put_unarchive<'a>(&self, id: uuid::Uuid)
274 -> Result<models::CipherResponseModel, Error>;
275
276 async fn put_unarchive_many<'a>(
278 &self,
279 cipher_bulk_unarchive_request_model: Option<models::CipherBulkUnarchiveRequestModel>,
280 ) -> Result<models::CipherResponseModelListResponseModel, Error>;
281
282 async fn renew_file_upload_url<'a>(
284 &self,
285 id: uuid::Uuid,
286 attachment_id: &'a str,
287 ) -> Result<models::AttachmentUploadDataResponseModel, Error>;
288}
289
290pub struct CiphersApiClient {
291 configuration: Arc<configuration::Configuration>,
292}
293
294impl CiphersApiClient {
295 pub fn new(configuration: Arc<configuration::Configuration>) -> Self {
296 Self { configuration }
297 }
298}
299
300#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
301#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
302impl CiphersApi for CiphersApiClient {
303 async fn azure_validate_file(&self) -> Result<(), Error> {
304 let local_var_configuration = &self.configuration;
305
306 let local_var_client = &local_var_configuration.client;
307
308 let local_var_uri_str = format!(
309 "{}/ciphers/attachment/validate/azure",
310 local_var_configuration.base_path
311 );
312 let mut local_var_req_builder =
313 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
314
315 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
316
317 bitwarden_api_base::process_with_empty_response(local_var_req_builder).await
318 }
319
320 async fn delete<'a>(&self, id: uuid::Uuid) -> Result<(), Error> {
321 let local_var_configuration = &self.configuration;
322
323 let local_var_client = &local_var_configuration.client;
324
325 let local_var_uri_str = format!(
326 "{}/ciphers/{id}",
327 local_var_configuration.base_path,
328 id = id
329 );
330 let mut local_var_req_builder =
331 local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
332
333 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
334
335 bitwarden_api_base::process_with_empty_response(local_var_req_builder).await
336 }
337
338 async fn delete_admin<'a>(&self, id: uuid::Uuid) -> Result<(), Error> {
339 let local_var_configuration = &self.configuration;
340
341 let local_var_client = &local_var_configuration.client;
342
343 let local_var_uri_str = format!(
344 "{}/ciphers/{id}/admin",
345 local_var_configuration.base_path,
346 id = id
347 );
348 let mut local_var_req_builder =
349 local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
350
351 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
352
353 bitwarden_api_base::process_with_empty_response(local_var_req_builder).await
354 }
355
356 async fn delete_attachment<'a>(
357 &self,
358 id: uuid::Uuid,
359 attachment_id: &'a str,
360 ) -> Result<models::DeleteAttachmentResponseModel, Error> {
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}/attachment/{attachmentId}",
367 local_var_configuration.base_path,
368 id = id,
369 attachmentId = crate::apis::urlencode(attachment_id)
370 );
371 let mut local_var_req_builder =
372 local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
373
374 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
375
376 bitwarden_api_base::process_with_json_response(local_var_req_builder).await
377 }
378
379 async fn delete_attachment_admin<'a>(
380 &self,
381 id: uuid::Uuid,
382 attachment_id: &'a str,
383 ) -> Result<models::DeleteAttachmentResponseModel, Error> {
384 let local_var_configuration = &self.configuration;
385
386 let local_var_client = &local_var_configuration.client;
387
388 let local_var_uri_str = format!(
389 "{}/ciphers/{id}/attachment/{attachmentId}/admin",
390 local_var_configuration.base_path,
391 id = id,
392 attachmentId = crate::apis::urlencode(attachment_id)
393 );
394 let mut local_var_req_builder =
395 local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
396
397 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
398
399 bitwarden_api_base::process_with_json_response(local_var_req_builder).await
400 }
401
402 async fn delete_many<'a>(
403 &self,
404 cipher_bulk_delete_request_model: Option<models::CipherBulkDeleteRequestModel>,
405 ) -> Result<(), Error> {
406 let local_var_configuration = &self.configuration;
407
408 let local_var_client = &local_var_configuration.client;
409
410 let local_var_uri_str = format!("{}/ciphers", local_var_configuration.base_path);
411 let mut local_var_req_builder =
412 local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
413
414 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
415 local_var_req_builder = local_var_req_builder.json(&cipher_bulk_delete_request_model);
416
417 bitwarden_api_base::process_with_empty_response(local_var_req_builder).await
418 }
419
420 async fn delete_many_admin<'a>(
421 &self,
422 cipher_bulk_delete_request_model: Option<models::CipherBulkDeleteRequestModel>,
423 ) -> Result<(), Error> {
424 let local_var_configuration = &self.configuration;
425
426 let local_var_client = &local_var_configuration.client;
427
428 let local_var_uri_str = format!("{}/ciphers/admin", local_var_configuration.base_path);
429 let mut local_var_req_builder =
430 local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
431
432 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
433 local_var_req_builder = local_var_req_builder.json(&cipher_bulk_delete_request_model);
434
435 bitwarden_api_base::process_with_empty_response(local_var_req_builder).await
436 }
437
438 async fn download_attachment<'a>(&self, token: Option<&'a str>) -> Result<(), Error> {
439 let local_var_configuration = &self.configuration;
440
441 let local_var_client = &local_var_configuration.client;
442
443 let local_var_uri_str = format!(
444 "{}/ciphers/attachment/download",
445 local_var_configuration.base_path
446 );
447 let mut local_var_req_builder =
448 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
449
450 if let Some(ref param_value) = token {
451 local_var_req_builder =
452 local_var_req_builder.query(&[("token", ¶m_value.to_string())]);
453 }
454 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
455
456 bitwarden_api_base::process_with_empty_response(local_var_req_builder).await
457 }
458
459 async fn get<'a>(&self, id: uuid::Uuid) -> Result<models::CipherResponseModel, Error> {
460 let local_var_configuration = &self.configuration;
461
462 let local_var_client = &local_var_configuration.client;
463
464 let local_var_uri_str = format!(
465 "{}/ciphers/{id}",
466 local_var_configuration.base_path,
467 id = id
468 );
469 let mut local_var_req_builder =
470 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
471
472 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
473
474 bitwarden_api_base::process_with_json_response(local_var_req_builder).await
475 }
476
477 async fn get_admin<'a>(&self, id: &'a str) -> Result<models::CipherMiniResponseModel, Error> {
478 let local_var_configuration = &self.configuration;
479
480 let local_var_client = &local_var_configuration.client;
481
482 let local_var_uri_str = format!(
483 "{}/ciphers/{id}/admin",
484 local_var_configuration.base_path,
485 id = crate::apis::urlencode(id)
486 );
487 let mut local_var_req_builder =
488 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
489
490 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
491
492 bitwarden_api_base::process_with_json_response(local_var_req_builder).await
493 }
494
495 async fn get_all(&self) -> Result<models::CipherDetailsResponseModelListResponseModel, Error> {
496 let local_var_configuration = &self.configuration;
497
498 let local_var_client = &local_var_configuration.client;
499
500 let local_var_uri_str = format!("{}/ciphers", local_var_configuration.base_path);
501 let mut local_var_req_builder =
502 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
503
504 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
505
506 bitwarden_api_base::process_with_json_response(local_var_req_builder).await
507 }
508
509 async fn get_assigned_organization_ciphers<'a>(
510 &self,
511 organization_id: Option<uuid::Uuid>,
512 ) -> Result<models::CipherDetailsResponseModelListResponseModel, Error> {
513 let local_var_configuration = &self.configuration;
514
515 let local_var_client = &local_var_configuration.client;
516
517 let local_var_uri_str = format!(
518 "{}/ciphers/organization-details/assigned",
519 local_var_configuration.base_path
520 );
521 let mut local_var_req_builder =
522 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
523
524 if let Some(ref param_value) = organization_id {
525 local_var_req_builder =
526 local_var_req_builder.query(&[("organizationId", ¶m_value.to_string())]);
527 }
528 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
529
530 bitwarden_api_base::process_with_json_response(local_var_req_builder).await
531 }
532
533 async fn get_attachment_data<'a>(
534 &self,
535 id: uuid::Uuid,
536 attachment_id: &'a str,
537 ) -> Result<models::AttachmentResponseModel, Error> {
538 let local_var_configuration = &self.configuration;
539
540 let local_var_client = &local_var_configuration.client;
541
542 let local_var_uri_str = format!(
543 "{}/ciphers/{id}/attachment/{attachmentId}",
544 local_var_configuration.base_path,
545 id = id,
546 attachmentId = crate::apis::urlencode(attachment_id)
547 );
548 let mut local_var_req_builder =
549 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
550
551 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
552
553 bitwarden_api_base::process_with_json_response(local_var_req_builder).await
554 }
555
556 async fn get_attachment_data_admin<'a>(
557 &self,
558 id: uuid::Uuid,
559 attachment_id: &'a str,
560 ) -> Result<models::AttachmentResponseModel, Error> {
561 let local_var_configuration = &self.configuration;
562
563 let local_var_client = &local_var_configuration.client;
564
565 let local_var_uri_str = format!(
566 "{}/ciphers/{id}/attachment/{attachmentId}/admin",
567 local_var_configuration.base_path,
568 id = id,
569 attachmentId = crate::apis::urlencode(attachment_id)
570 );
571 let mut local_var_req_builder =
572 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
573
574 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
575
576 bitwarden_api_base::process_with_json_response(local_var_req_builder).await
577 }
578
579 async fn get_details<'a>(
580 &self,
581 id: uuid::Uuid,
582 ) -> Result<models::CipherDetailsResponseModel, Error> {
583 let local_var_configuration = &self.configuration;
584
585 let local_var_client = &local_var_configuration.client;
586
587 let local_var_uri_str = format!(
588 "{}/ciphers/{id}/details",
589 local_var_configuration.base_path,
590 id = id
591 );
592 let mut local_var_req_builder =
593 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
594
595 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
596
597 bitwarden_api_base::process_with_json_response(local_var_req_builder).await
598 }
599
600 async fn get_organization_ciphers<'a>(
601 &self,
602 organization_id: Option<uuid::Uuid>,
603 include_member_items: Option<bool>,
604 ) -> Result<models::CipherMiniDetailsResponseModelListResponseModel, Error> {
605 let local_var_configuration = &self.configuration;
606
607 let local_var_client = &local_var_configuration.client;
608
609 let local_var_uri_str = format!(
610 "{}/ciphers/organization-details",
611 local_var_configuration.base_path
612 );
613 let mut local_var_req_builder =
614 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
615
616 if let Some(ref param_value) = organization_id {
617 local_var_req_builder =
618 local_var_req_builder.query(&[("organizationId", ¶m_value.to_string())]);
619 }
620 if let Some(ref param_value) = include_member_items {
621 local_var_req_builder =
622 local_var_req_builder.query(&[("includeMemberItems", ¶m_value.to_string())]);
623 }
624 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
625
626 bitwarden_api_base::process_with_json_response(local_var_req_builder).await
627 }
628
629 async fn move_many<'a>(
630 &self,
631 cipher_bulk_move_request_model: Option<models::CipherBulkMoveRequestModel>,
632 ) -> Result<(), Error> {
633 let local_var_configuration = &self.configuration;
634
635 let local_var_client = &local_var_configuration.client;
636
637 let local_var_uri_str = format!("{}/ciphers/move", local_var_configuration.base_path);
638 let mut local_var_req_builder =
639 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
640
641 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
642 local_var_req_builder = local_var_req_builder.json(&cipher_bulk_move_request_model);
643
644 bitwarden_api_base::process_with_empty_response(local_var_req_builder).await
645 }
646
647 async fn post<'a>(
648 &self,
649 cipher_request_model: Option<models::CipherRequestModel>,
650 ) -> Result<models::CipherResponseModel, Error> {
651 let local_var_configuration = &self.configuration;
652
653 let local_var_client = &local_var_configuration.client;
654
655 let local_var_uri_str = format!("{}/ciphers", local_var_configuration.base_path);
656 let mut local_var_req_builder =
657 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
658
659 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
660 local_var_req_builder = local_var_req_builder.json(&cipher_request_model);
661
662 bitwarden_api_base::process_with_json_response(local_var_req_builder).await
663 }
664
665 async fn post_admin<'a>(
666 &self,
667 cipher_create_request_model: Option<models::CipherCreateRequestModel>,
668 ) -> Result<models::CipherMiniResponseModel, Error> {
669 let local_var_configuration = &self.configuration;
670
671 let local_var_client = &local_var_configuration.client;
672
673 let local_var_uri_str = format!("{}/ciphers/admin", local_var_configuration.base_path);
674 let mut local_var_req_builder =
675 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
676
677 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
678 local_var_req_builder = local_var_req_builder.json(&cipher_create_request_model);
679
680 bitwarden_api_base::process_with_json_response(local_var_req_builder).await
681 }
682
683 async fn post_attachment<'a>(
684 &self,
685 id: uuid::Uuid,
686 attachment_request_model: Option<models::AttachmentRequestModel>,
687 ) -> Result<models::AttachmentUploadDataResponseModel, Error> {
688 let local_var_configuration = &self.configuration;
689
690 let local_var_client = &local_var_configuration.client;
691
692 let local_var_uri_str = format!(
693 "{}/ciphers/{id}/attachment/v2",
694 local_var_configuration.base_path,
695 id = id
696 );
697 let mut local_var_req_builder =
698 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
699
700 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
701 local_var_req_builder = local_var_req_builder.json(&attachment_request_model);
702
703 bitwarden_api_base::process_with_json_response(local_var_req_builder).await
704 }
705
706 async fn post_attachment_admin<'a>(
707 &self,
708 id: &'a str,
709 ) -> Result<models::CipherMiniResponseModel, Error> {
710 let local_var_configuration = &self.configuration;
711
712 let local_var_client = &local_var_configuration.client;
713
714 let local_var_uri_str = format!(
715 "{}/ciphers/{id}/attachment-admin",
716 local_var_configuration.base_path,
717 id = crate::apis::urlencode(id)
718 );
719 let mut local_var_req_builder =
720 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
721
722 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
723
724 bitwarden_api_base::process_with_json_response(local_var_req_builder).await
725 }
726
727 async fn post_attachment_share<'a>(
728 &self,
729 id: &'a str,
730 attachment_id: &'a str,
731 organization_id: Option<uuid::Uuid>,
732 ) -> Result<(), Error> {
733 let local_var_configuration = &self.configuration;
734
735 let local_var_client = &local_var_configuration.client;
736
737 let local_var_uri_str = format!(
738 "{}/ciphers/{id}/attachment/{attachmentId}/share",
739 local_var_configuration.base_path,
740 id = crate::apis::urlencode(id),
741 attachmentId = crate::apis::urlencode(attachment_id)
742 );
743 let mut local_var_req_builder =
744 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
745
746 if let Some(ref param_value) = organization_id {
747 local_var_req_builder =
748 local_var_req_builder.query(&[("organizationId", ¶m_value.to_string())]);
749 }
750 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
751
752 bitwarden_api_base::process_with_empty_response(local_var_req_builder).await
753 }
754
755 async fn post_bulk_collections<'a>(
756 &self,
757 cipher_bulk_update_collections_request_model: Option<
758 models::CipherBulkUpdateCollectionsRequestModel,
759 >,
760 ) -> Result<(), Error> {
761 let local_var_configuration = &self.configuration;
762
763 let local_var_client = &local_var_configuration.client;
764
765 let local_var_uri_str = format!(
766 "{}/ciphers/bulk-collections",
767 local_var_configuration.base_path
768 );
769 let mut local_var_req_builder =
770 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
771
772 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
773 local_var_req_builder =
774 local_var_req_builder.json(&cipher_bulk_update_collections_request_model);
775
776 bitwarden_api_base::process_with_empty_response(local_var_req_builder).await
777 }
778
779 async fn post_create<'a>(
780 &self,
781 cipher_create_request_model: Option<models::CipherCreateRequestModel>,
782 ) -> Result<models::CipherResponseModel, Error> {
783 let local_var_configuration = &self.configuration;
784
785 let local_var_client = &local_var_configuration.client;
786
787 let local_var_uri_str = format!("{}/ciphers/create", local_var_configuration.base_path);
788 let mut local_var_req_builder =
789 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
790
791 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
792 local_var_req_builder = local_var_req_builder.json(&cipher_create_request_model);
793
794 bitwarden_api_base::process_with_json_response(local_var_req_builder).await
795 }
796
797 async fn post_file_for_existing_attachment<'a>(
798 &self,
799 id: uuid::Uuid,
800 attachment_id: &'a str,
801 ) -> Result<(), Error> {
802 let local_var_configuration = &self.configuration;
803
804 let local_var_client = &local_var_configuration.client;
805
806 let local_var_uri_str = format!(
807 "{}/ciphers/{id}/attachment/{attachmentId}",
808 local_var_configuration.base_path,
809 id = id,
810 attachmentId = crate::apis::urlencode(attachment_id)
811 );
812 let mut local_var_req_builder =
813 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
814
815 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
816
817 bitwarden_api_base::process_with_empty_response(local_var_req_builder).await
818 }
819
820 async fn post_purge<'a>(
821 &self,
822 organization_id: Option<uuid::Uuid>,
823 secret_verification_request_model: Option<models::SecretVerificationRequestModel>,
824 ) -> Result<(), Error> {
825 let local_var_configuration = &self.configuration;
826
827 let local_var_client = &local_var_configuration.client;
828
829 let local_var_uri_str = format!("{}/ciphers/purge", local_var_configuration.base_path);
830 let mut local_var_req_builder =
831 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
832
833 if let Some(ref param_value) = organization_id {
834 local_var_req_builder =
835 local_var_req_builder.query(&[("organizationId", ¶m_value.to_string())]);
836 }
837 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
838 local_var_req_builder = local_var_req_builder.json(&secret_verification_request_model);
839
840 bitwarden_api_base::process_with_empty_response(local_var_req_builder).await
841 }
842
843 async fn put<'a>(
844 &self,
845 id: uuid::Uuid,
846 cipher_request_model: Option<models::CipherRequestModel>,
847 ) -> Result<models::CipherResponseModel, Error> {
848 let local_var_configuration = &self.configuration;
849
850 let local_var_client = &local_var_configuration.client;
851
852 let local_var_uri_str = format!(
853 "{}/ciphers/{id}",
854 local_var_configuration.base_path,
855 id = id
856 );
857 let mut local_var_req_builder =
858 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
859
860 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
861 local_var_req_builder = local_var_req_builder.json(&cipher_request_model);
862
863 bitwarden_api_base::process_with_json_response(local_var_req_builder).await
864 }
865
866 async fn put_admin<'a>(
867 &self,
868 id: uuid::Uuid,
869 cipher_request_model: Option<models::CipherRequestModel>,
870 ) -> Result<models::CipherMiniResponseModel, Error> {
871 let local_var_configuration = &self.configuration;
872
873 let local_var_client = &local_var_configuration.client;
874
875 let local_var_uri_str = format!(
876 "{}/ciphers/{id}/admin",
877 local_var_configuration.base_path,
878 id = id
879 );
880 let mut local_var_req_builder =
881 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
882
883 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
884 local_var_req_builder = local_var_req_builder.json(&cipher_request_model);
885
886 bitwarden_api_base::process_with_json_response(local_var_req_builder).await
887 }
888
889 async fn put_archive<'a>(&self, id: uuid::Uuid) -> Result<models::CipherResponseModel, Error> {
890 let local_var_configuration = &self.configuration;
891
892 let local_var_client = &local_var_configuration.client;
893
894 let local_var_uri_str = format!(
895 "{}/ciphers/{id}/archive",
896 local_var_configuration.base_path,
897 id = id
898 );
899 let mut local_var_req_builder =
900 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
901
902 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
903
904 bitwarden_api_base::process_with_json_response(local_var_req_builder).await
905 }
906
907 async fn put_archive_many<'a>(
908 &self,
909 cipher_bulk_archive_request_model: Option<models::CipherBulkArchiveRequestModel>,
910 ) -> Result<models::CipherResponseModelListResponseModel, Error> {
911 let local_var_configuration = &self.configuration;
912
913 let local_var_client = &local_var_configuration.client;
914
915 let local_var_uri_str = format!("{}/ciphers/archive", local_var_configuration.base_path);
916 let mut local_var_req_builder =
917 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
918
919 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
920 local_var_req_builder = local_var_req_builder.json(&cipher_bulk_archive_request_model);
921
922 bitwarden_api_base::process_with_json_response(local_var_req_builder).await
923 }
924
925 async fn put_collections_admin<'a>(
926 &self,
927 id: &'a str,
928 cipher_collections_request_model: Option<models::CipherCollectionsRequestModel>,
929 ) -> Result<models::CipherMiniDetailsResponseModel, Error> {
930 let local_var_configuration = &self.configuration;
931
932 let local_var_client = &local_var_configuration.client;
933
934 let local_var_uri_str = format!(
935 "{}/ciphers/{id}/collections-admin",
936 local_var_configuration.base_path,
937 id = crate::apis::urlencode(id)
938 );
939 let mut local_var_req_builder =
940 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
941
942 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
943 local_var_req_builder = local_var_req_builder.json(&cipher_collections_request_model);
944
945 bitwarden_api_base::process_with_json_response(local_var_req_builder).await
946 }
947
948 async fn put_collections_v_next<'a>(
949 &self,
950 id: uuid::Uuid,
951 cipher_collections_request_model: Option<models::CipherCollectionsRequestModel>,
952 ) -> Result<models::OptionalCipherDetailsResponseModel, Error> {
953 let local_var_configuration = &self.configuration;
954
955 let local_var_client = &local_var_configuration.client;
956
957 let local_var_uri_str = format!(
958 "{}/ciphers/{id}/collections_v2",
959 local_var_configuration.base_path,
960 id = id
961 );
962 let mut local_var_req_builder =
963 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
964
965 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
966 local_var_req_builder = local_var_req_builder.json(&cipher_collections_request_model);
967
968 bitwarden_api_base::process_with_json_response(local_var_req_builder).await
969 }
970
971 async fn put_delete<'a>(&self, id: uuid::Uuid) -> Result<(), Error> {
972 let local_var_configuration = &self.configuration;
973
974 let local_var_client = &local_var_configuration.client;
975
976 let local_var_uri_str = format!(
977 "{}/ciphers/{id}/delete",
978 local_var_configuration.base_path,
979 id = id
980 );
981 let mut local_var_req_builder =
982 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
983
984 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
985
986 bitwarden_api_base::process_with_empty_response(local_var_req_builder).await
987 }
988
989 async fn put_delete_admin<'a>(&self, id: uuid::Uuid) -> Result<(), Error> {
990 let local_var_configuration = &self.configuration;
991
992 let local_var_client = &local_var_configuration.client;
993
994 let local_var_uri_str = format!(
995 "{}/ciphers/{id}/delete-admin",
996 local_var_configuration.base_path,
997 id = id
998 );
999 let mut local_var_req_builder =
1000 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1001
1002 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1003
1004 bitwarden_api_base::process_with_empty_response(local_var_req_builder).await
1005 }
1006
1007 async fn put_delete_many<'a>(
1008 &self,
1009 cipher_bulk_delete_request_model: Option<models::CipherBulkDeleteRequestModel>,
1010 ) -> Result<(), Error> {
1011 let local_var_configuration = &self.configuration;
1012
1013 let local_var_client = &local_var_configuration.client;
1014
1015 let local_var_uri_str = format!("{}/ciphers/delete", local_var_configuration.base_path);
1016 let mut local_var_req_builder =
1017 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1018
1019 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1020 local_var_req_builder = local_var_req_builder.json(&cipher_bulk_delete_request_model);
1021
1022 bitwarden_api_base::process_with_empty_response(local_var_req_builder).await
1023 }
1024
1025 async fn put_delete_many_admin<'a>(
1026 &self,
1027 cipher_bulk_delete_request_model: Option<models::CipherBulkDeleteRequestModel>,
1028 ) -> Result<(), Error> {
1029 let local_var_configuration = &self.configuration;
1030
1031 let local_var_client = &local_var_configuration.client;
1032
1033 let local_var_uri_str =
1034 format!("{}/ciphers/delete-admin", local_var_configuration.base_path);
1035 let mut local_var_req_builder =
1036 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1037
1038 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1039 local_var_req_builder = local_var_req_builder.json(&cipher_bulk_delete_request_model);
1040
1041 bitwarden_api_base::process_with_empty_response(local_var_req_builder).await
1042 }
1043
1044 async fn put_partial<'a>(
1045 &self,
1046 id: uuid::Uuid,
1047 cipher_partial_request_model: Option<models::CipherPartialRequestModel>,
1048 ) -> Result<models::CipherResponseModel, Error> {
1049 let local_var_configuration = &self.configuration;
1050
1051 let local_var_client = &local_var_configuration.client;
1052
1053 let local_var_uri_str = format!(
1054 "{}/ciphers/{id}/partial",
1055 local_var_configuration.base_path,
1056 id = id
1057 );
1058 let mut local_var_req_builder =
1059 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1060
1061 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1062 local_var_req_builder = local_var_req_builder.json(&cipher_partial_request_model);
1063
1064 bitwarden_api_base::process_with_json_response(local_var_req_builder).await
1065 }
1066
1067 async fn put_restore<'a>(&self, id: uuid::Uuid) -> Result<models::CipherResponseModel, Error> {
1068 let local_var_configuration = &self.configuration;
1069
1070 let local_var_client = &local_var_configuration.client;
1071
1072 let local_var_uri_str = format!(
1073 "{}/ciphers/{id}/restore",
1074 local_var_configuration.base_path,
1075 id = id
1076 );
1077 let mut local_var_req_builder =
1078 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1079
1080 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1081
1082 bitwarden_api_base::process_with_json_response(local_var_req_builder).await
1083 }
1084
1085 async fn put_restore_admin<'a>(
1086 &self,
1087 id: uuid::Uuid,
1088 ) -> Result<models::CipherMiniResponseModel, Error> {
1089 let local_var_configuration = &self.configuration;
1090
1091 let local_var_client = &local_var_configuration.client;
1092
1093 let local_var_uri_str = format!(
1094 "{}/ciphers/{id}/restore-admin",
1095 local_var_configuration.base_path,
1096 id = id
1097 );
1098 let mut local_var_req_builder =
1099 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1100
1101 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1102
1103 bitwarden_api_base::process_with_json_response(local_var_req_builder).await
1104 }
1105
1106 async fn put_restore_many<'a>(
1107 &self,
1108 cipher_bulk_restore_request_model: Option<models::CipherBulkRestoreRequestModel>,
1109 ) -> Result<models::CipherMiniResponseModelListResponseModel, Error> {
1110 let local_var_configuration = &self.configuration;
1111
1112 let local_var_client = &local_var_configuration.client;
1113
1114 let local_var_uri_str = format!("{}/ciphers/restore", local_var_configuration.base_path);
1115 let mut local_var_req_builder =
1116 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1117
1118 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1119 local_var_req_builder = local_var_req_builder.json(&cipher_bulk_restore_request_model);
1120
1121 bitwarden_api_base::process_with_json_response(local_var_req_builder).await
1122 }
1123
1124 async fn put_restore_many_admin<'a>(
1125 &self,
1126 cipher_bulk_restore_request_model: Option<models::CipherBulkRestoreRequestModel>,
1127 ) -> Result<models::CipherMiniResponseModelListResponseModel, Error> {
1128 let local_var_configuration = &self.configuration;
1129
1130 let local_var_client = &local_var_configuration.client;
1131
1132 let local_var_uri_str = format!(
1133 "{}/ciphers/restore-admin",
1134 local_var_configuration.base_path
1135 );
1136 let mut local_var_req_builder =
1137 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1138
1139 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1140 local_var_req_builder = local_var_req_builder.json(&cipher_bulk_restore_request_model);
1141
1142 bitwarden_api_base::process_with_json_response(local_var_req_builder).await
1143 }
1144
1145 async fn put_share<'a>(
1146 &self,
1147 id: uuid::Uuid,
1148 cipher_share_request_model: Option<models::CipherShareRequestModel>,
1149 ) -> Result<models::CipherResponseModel, Error> {
1150 let local_var_configuration = &self.configuration;
1151
1152 let local_var_client = &local_var_configuration.client;
1153
1154 let local_var_uri_str = format!(
1155 "{}/ciphers/{id}/share",
1156 local_var_configuration.base_path,
1157 id = id
1158 );
1159 let mut local_var_req_builder =
1160 local_var_client.request(reqwest::Method::PUT, 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_share_request_model);
1164
1165 bitwarden_api_base::process_with_json_response(local_var_req_builder).await
1166 }
1167
1168 async fn put_share_many<'a>(
1169 &self,
1170 cipher_bulk_share_request_model: Option<models::CipherBulkShareRequestModel>,
1171 ) -> Result<models::CipherMiniResponseModelListResponseModel, Error> {
1172 let local_var_configuration = &self.configuration;
1173
1174 let local_var_client = &local_var_configuration.client;
1175
1176 let local_var_uri_str = format!("{}/ciphers/share", local_var_configuration.base_path);
1177 let mut local_var_req_builder =
1178 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1179
1180 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1181 local_var_req_builder = local_var_req_builder.json(&cipher_bulk_share_request_model);
1182
1183 bitwarden_api_base::process_with_json_response(local_var_req_builder).await
1184 }
1185
1186 async fn put_unarchive<'a>(
1187 &self,
1188 id: uuid::Uuid,
1189 ) -> Result<models::CipherResponseModel, Error> {
1190 let local_var_configuration = &self.configuration;
1191
1192 let local_var_client = &local_var_configuration.client;
1193
1194 let local_var_uri_str = format!(
1195 "{}/ciphers/{id}/unarchive",
1196 local_var_configuration.base_path,
1197 id = id
1198 );
1199 let mut local_var_req_builder =
1200 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1201
1202 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1203
1204 bitwarden_api_base::process_with_json_response(local_var_req_builder).await
1205 }
1206
1207 async fn put_unarchive_many<'a>(
1208 &self,
1209 cipher_bulk_unarchive_request_model: Option<models::CipherBulkUnarchiveRequestModel>,
1210 ) -> Result<models::CipherResponseModelListResponseModel, Error> {
1211 let local_var_configuration = &self.configuration;
1212
1213 let local_var_client = &local_var_configuration.client;
1214
1215 let local_var_uri_str = format!("{}/ciphers/unarchive", local_var_configuration.base_path);
1216 let mut local_var_req_builder =
1217 local_var_client.request(reqwest::Method::PUT, 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(&cipher_bulk_unarchive_request_model);
1221
1222 bitwarden_api_base::process_with_json_response(local_var_req_builder).await
1223 }
1224
1225 async fn renew_file_upload_url<'a>(
1226 &self,
1227 id: uuid::Uuid,
1228 attachment_id: &'a str,
1229 ) -> Result<models::AttachmentUploadDataResponseModel, Error> {
1230 let local_var_configuration = &self.configuration;
1231
1232 let local_var_client = &local_var_configuration.client;
1233
1234 let local_var_uri_str = format!(
1235 "{}/ciphers/{id}/attachment/{attachmentId}/renew",
1236 local_var_configuration.base_path,
1237 id = id,
1238 attachmentId = crate::apis::urlencode(attachment_id)
1239 );
1240 let mut local_var_req_builder =
1241 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1242
1243 local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
1244
1245 bitwarden_api_base::process_with_json_response(local_var_req_builder).await
1246 }
1247}