diff --git a/crates/bitwarden-vault/src/cipher/attachment_client.rs b/crates/bitwarden-vault/src/cipher/attachment_client.rs index 4bc6e18b0..ce4c8002a 100644 --- a/crates/bitwarden-vault/src/cipher/attachment_client.rs +++ b/crates/bitwarden-vault/src/cipher/attachment_client.rs @@ -7,7 +7,7 @@ use thiserror::Error; use crate::{ Attachment, AttachmentEncryptResult, AttachmentFile, AttachmentFileView, AttachmentView, - Cipher, DecryptError, EncryptError, VaultClient, + Cipher, DecryptError, EncryptError, }; pub struct AttachmentsClient { @@ -92,11 +92,3 @@ impl AttachmentsClient { Ok(()) } } - -impl VaultClient { - pub fn attachments(&self) -> AttachmentsClient { - AttachmentsClient { - client: self.client.clone(), - } - } -} diff --git a/crates/bitwarden-vault/src/cipher/cipher_client.rs b/crates/bitwarden-vault/src/cipher/cipher_client.rs index e347302e5..e09ca31e5 100644 --- a/crates/bitwarden-vault/src/cipher/cipher_client.rs +++ b/crates/bitwarden-vault/src/cipher/cipher_client.rs @@ -4,9 +4,7 @@ use bitwarden_crypto::IdentifyKey; use wasm_bindgen::prelude::*; use super::EncryptionContext; -use crate::{ - Cipher, CipherError, CipherListView, CipherView, DecryptError, EncryptError, VaultClient, -}; +use crate::{Cipher, CipherError, CipherListView, CipherView, DecryptError, EncryptError}; #[cfg_attr(feature = "wasm", wasm_bindgen)] pub struct CiphersClient { @@ -85,14 +83,6 @@ impl CiphersClient { } } -impl VaultClient { - pub fn ciphers(&self) -> CiphersClient { - CiphersClient { - client: self.client.clone(), - } - } -} - #[cfg(test)] mod tests { diff --git a/crates/bitwarden-vault/src/collection_client.rs b/crates/bitwarden-vault/src/collection_client.rs index 9b446ec6b..f99a93117 100644 --- a/crates/bitwarden-vault/src/collection_client.rs +++ b/crates/bitwarden-vault/src/collection_client.rs @@ -1,6 +1,6 @@ use bitwarden_core::Client; -use crate::{error::DecryptError, Collection, CollectionView, VaultClient}; +use crate::{error::DecryptError, Collection, CollectionView}; pub struct CollectionsClient { pub(crate) client: Client, @@ -23,14 +23,6 @@ impl CollectionsClient { } } -impl VaultClient { - pub fn collections(&self) -> CollectionsClient { - CollectionsClient { - client: self.client.clone(), - } - } -} - #[cfg(test)] mod tests { use bitwarden_core::client::test_accounts::test_bitwarden_com_account; diff --git a/crates/bitwarden-vault/src/folder_client.rs b/crates/bitwarden-vault/src/folder_client.rs index a238f834b..1492558bb 100644 --- a/crates/bitwarden-vault/src/folder_client.rs +++ b/crates/bitwarden-vault/src/folder_client.rs @@ -4,7 +4,7 @@ use wasm_bindgen::prelude::*; use crate::{ error::{DecryptError, EncryptError}, - Folder, FolderView, VaultClient, + Folder, FolderView, }; #[cfg_attr(feature = "wasm", wasm_bindgen)] @@ -32,11 +32,3 @@ impl FoldersClient { Ok(views) } } - -impl VaultClient { - pub fn folders(&self) -> FoldersClient { - FoldersClient { - client: self.client.clone(), - } - } -} diff --git a/crates/bitwarden-vault/src/password_history_client.rs b/crates/bitwarden-vault/src/password_history_client.rs index 4be2dda33..3fcc916b7 100644 --- a/crates/bitwarden-vault/src/password_history_client.rs +++ b/crates/bitwarden-vault/src/password_history_client.rs @@ -1,6 +1,6 @@ use bitwarden_core::Client; -use crate::{DecryptError, EncryptError, PasswordHistory, PasswordHistoryView, VaultClient}; +use crate::{DecryptError, EncryptError, PasswordHistory, PasswordHistoryView}; pub struct PasswordHistoryClient { pub(crate) client: Client, @@ -25,11 +25,3 @@ impl PasswordHistoryClient { Ok(history_view) } } - -impl VaultClient { - pub fn password_history(&self) -> PasswordHistoryClient { - PasswordHistoryClient { - client: self.client.clone(), - } - } -} diff --git a/crates/bitwarden-vault/src/vault_client.rs b/crates/bitwarden-vault/src/vault_client.rs index cc0832d2f..abd71dfed 100644 --- a/crates/bitwarden-vault/src/vault_client.rs +++ b/crates/bitwarden-vault/src/vault_client.rs @@ -2,6 +2,7 @@ use bitwarden_core::Client; use crate::{ sync::{sync, SyncError}, + AttachmentsClient, CiphersClient, CollectionsClient, FoldersClient, PasswordHistoryClient, SyncRequest, SyncResponse, }; @@ -15,6 +16,41 @@ impl VaultClient { Self { client } } + /// Attachment related operations. + pub fn attachments(&self) -> AttachmentsClient { + AttachmentsClient { + client: self.client.clone(), + } + } + + /// Cipher related operations. + pub fn ciphers(&self) -> CiphersClient { + CiphersClient { + client: self.client.clone(), + } + } + + /// Collection related operations. + pub fn collections(&self) -> CollectionsClient { + CollectionsClient { + client: self.client.clone(), + } + } + + /// Folder related operations. + pub fn folders(&self) -> FoldersClient { + FoldersClient { + client: self.client.clone(), + } + } + + /// Password history related operations. + pub fn password_history(&self) -> PasswordHistoryClient { + PasswordHistoryClient { + client: self.client.clone(), + } + } + pub async fn sync(&self, input: &SyncRequest) -> Result { sync(&self.client, input).await }