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