mirror of
https://github.com/bitwarden/mobile.git
synced 2024-12-24 16:38:22 +01:00
interfaces
This commit is contained in:
parent
6cab060509
commit
d050e01d08
25
src/Core/Abstractions/ICollectionService.cs
Normal file
25
src/Core/Abstractions/ICollectionService.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Models.Domain;
|
||||
using Bit.Core.Models.View;
|
||||
|
||||
namespace Bit.Core.Abstractions
|
||||
{
|
||||
public interface ICollectionService
|
||||
{
|
||||
Task ClearAsync(string userId);
|
||||
void ClearCache();
|
||||
Task<List<CollectionView>> DecryptManyAsync(List<Collection> collections);
|
||||
Task DeleteAsync(string id);
|
||||
Task<Collection> EncryptAsync(CollectionView model);
|
||||
Task<List<Collection>> GetAllAsync();
|
||||
Task<List<CollectionView>> GetAllDecryptedAsync();
|
||||
Task<List<TreeNode<CollectionView>>> GetAllNestedAsync(List<CollectionView> collections = null);
|
||||
Task<Collection> GetAsync(string id);
|
||||
Task<TreeNode<CollectionView>> GetNestedAsync(string id);
|
||||
Task ReplaceAsync(Dictionary<string, CollectionData> collections);
|
||||
Task UpsertAsync(CollectionData collection);
|
||||
Task UpsertAsync(List<CollectionData> collection);
|
||||
}
|
||||
}
|
26
src/Core/Abstractions/IFolderService.cs
Normal file
26
src/Core/Abstractions/IFolderService.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Models.Domain;
|
||||
using Bit.Core.Models.View;
|
||||
|
||||
namespace Bit.Core.Abstractions
|
||||
{
|
||||
public interface IFolderService
|
||||
{
|
||||
Task ClearAsync(string userId);
|
||||
void ClearCache();
|
||||
Task DeleteAsync(string id);
|
||||
Task DeleteWithServerAsync(string id);
|
||||
Task<Folder> EncryptAsync(FolderView model, SymmetricCryptoKey key = null);
|
||||
Task<List<Folder>> GetAllAsync();
|
||||
Task<List<FolderView>> GetAllDecryptedAsync();
|
||||
Task<List<TreeNode<FolderView>>> GetAllNestedAsync();
|
||||
Task<Folder> GetAsync(string id);
|
||||
Task<TreeNode<FolderView>> GetNestedAsync(string id);
|
||||
Task ReplaceAsync(Dictionary<string, FolderData> folders);
|
||||
Task SaveWithServerAsync(Folder folder);
|
||||
Task UpsertAsync(FolderData folder);
|
||||
Task UpsertAsync(List<FolderData> folder);
|
||||
}
|
||||
}
|
@ -11,7 +11,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Bit.Core.Services
|
||||
{
|
||||
public class CollectionService
|
||||
public class CollectionService : ICollectionService
|
||||
{
|
||||
private const string Keys_CollectionsFormat = "collections_{0}";
|
||||
private const char NestingDelimiter = '/';
|
||||
@ -19,25 +19,19 @@ namespace Bit.Core.Services
|
||||
private List<CollectionView> _decryptedCollectionCache;
|
||||
private readonly ICryptoService _cryptoService;
|
||||
private readonly IUserService _userService;
|
||||
private readonly IApiService _apiService;
|
||||
private readonly IStorageService _storageService;
|
||||
private readonly II18nService _i18nService;
|
||||
private readonly ICipherService _cipherService;
|
||||
|
||||
public CollectionService(
|
||||
ICryptoService cryptoService,
|
||||
IUserService userService,
|
||||
IApiService apiService,
|
||||
IStorageService storageService,
|
||||
II18nService i18nService,
|
||||
ICipherService cipherService)
|
||||
II18nService i18nService)
|
||||
{
|
||||
_cryptoService = cryptoService;
|
||||
_userService = userService;
|
||||
_apiService = apiService;
|
||||
_storageService = storageService;
|
||||
_i18nService = i18nService;
|
||||
_cipherService = cipherService;
|
||||
}
|
||||
|
||||
public void ClearCache()
|
||||
|
@ -13,7 +13,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Bit.Core.Services
|
||||
{
|
||||
public class FolderService
|
||||
public class FolderService : IFolderService
|
||||
{
|
||||
private const string Keys_CiphersFormat = "ciphers_{0}";
|
||||
private const string Keys_FoldersFormat = "folders_{0}";
|
||||
|
Loading…
Reference in New Issue
Block a user