mirror of
https://github.com/bitwarden/mobile
synced 2026-01-11 04:53:52 +00:00
Added icons for iOS. Broke out data access into repositories. Added syncing service.
This commit is contained in:
19
src/App/Abstractions/Repositories/IApiRepository.cs
Normal file
19
src/App/Abstractions/Repositories/IApiRepository.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.App.Models.Api;
|
||||
|
||||
namespace Bit.App.Abstractions
|
||||
{
|
||||
public interface IApiRepository<TRequest, TResponse, TId>
|
||||
where TRequest : class
|
||||
where TResponse : class
|
||||
where TId : IEquatable<TId>
|
||||
{
|
||||
Task<ApiResult<TResponse>> GetByIdAsync(TId id);
|
||||
Task<ApiResult<ListResponse<TResponse>>> GetAsync();
|
||||
Task<ApiResult<TResponse>> PostAsync(TRequest requestObj);
|
||||
Task<ApiResult<TResponse>> PutAsync(TId id, TRequest requestObj);
|
||||
Task<ApiResult<object>> DeleteAsync(TId id);
|
||||
}
|
||||
}
|
||||
11
src/App/Abstractions/Repositories/IAuthApiRepository.cs
Normal file
11
src/App/Abstractions/Repositories/IAuthApiRepository.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using System.Threading.Tasks;
|
||||
using Bit.App.Models.Api;
|
||||
|
||||
namespace Bit.App.Abstractions
|
||||
{
|
||||
public interface IAuthApiRepository
|
||||
{
|
||||
Task<ApiResult<TokenResponse>> PostTokenAsync(TokenRequest requestObj);
|
||||
Task<ApiResult<TokenResponse>> PostTokenTwoFactorAsync(TokenTwoFactorRequest requestObj);
|
||||
}
|
||||
}
|
||||
12
src/App/Abstractions/Repositories/IFolderApiRepository.cs
Normal file
12
src/App/Abstractions/Repositories/IFolderApiRepository.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.App.Models.Api;
|
||||
|
||||
namespace Bit.App.Abstractions
|
||||
{
|
||||
public interface IFolderApiRepository : IApiRepository<FolderRequest, FolderResponse, string>
|
||||
{
|
||||
Task<ApiResult<ListResponse<FolderResponse>>> GetByRevisionDateAsync(DateTime since);
|
||||
}
|
||||
}
|
||||
12
src/App/Abstractions/Repositories/IFolderRepository.cs
Normal file
12
src/App/Abstractions/Repositories/IFolderRepository.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.App.Models.Data;
|
||||
|
||||
namespace Bit.App.Abstractions
|
||||
{
|
||||
public interface IFolderRepository : IRepository<FolderData, string>
|
||||
{
|
||||
Task<IEnumerable<FolderData>> GetAllByUserIdAsync(string userId);
|
||||
}
|
||||
}
|
||||
18
src/App/Abstractions/Repositories/IRepository.cs
Normal file
18
src/App/Abstractions/Repositories/IRepository.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Bit.App.Abstractions
|
||||
{
|
||||
public interface IRepository<T, TId>
|
||||
where T : class, IDataObject<TId>, new()
|
||||
where TId : IEquatable<TId>
|
||||
{
|
||||
Task<T> GetByIdAsync(TId id);
|
||||
Task<IEnumerable<T>> GetAllAsync();
|
||||
Task UpdateAsync(T obj);
|
||||
Task InsertAsync(T obj);
|
||||
Task DeleteAsync(TId id);
|
||||
Task DeleteAsync(T obj);
|
||||
}
|
||||
}
|
||||
12
src/App/Abstractions/Repositories/ISiteApiRepository.cs
Normal file
12
src/App/Abstractions/Repositories/ISiteApiRepository.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.App.Models.Api;
|
||||
|
||||
namespace Bit.App.Abstractions
|
||||
{
|
||||
public interface ISiteApiRepository : IApiRepository<SiteRequest, SiteResponse, string>
|
||||
{
|
||||
Task<ApiResult<ListResponse<SiteResponse>>> GetByRevisionDateAsync(DateTime since);
|
||||
}
|
||||
}
|
||||
12
src/App/Abstractions/Repositories/ISiteRepository.cs
Normal file
12
src/App/Abstractions/Repositories/ISiteRepository.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.App.Models.Data;
|
||||
|
||||
namespace Bit.App.Abstractions
|
||||
{
|
||||
public interface ISiteRepository : IRepository<SiteData, string>
|
||||
{
|
||||
Task<IEnumerable<SiteData>> GetAllByUserIdAsync(string userId);
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.App.Models.Api;
|
||||
|
||||
namespace Bit.App.Abstractions
|
||||
{
|
||||
public interface IApiService
|
||||
{
|
||||
HttpClient Client { get; set; }
|
||||
|
||||
Task<ApiResult<T>> HandleErrorAsync<T>(HttpResponseMessage response);
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ namespace Bit.App.Abstractions
|
||||
{
|
||||
public interface ISiteService
|
||||
{
|
||||
Task<Site> GetByIdAsync(string id);
|
||||
Task<IEnumerable<Site>> GetAllAsync();
|
||||
Task<ApiResult<SiteResponse>> SaveAsync(Site site);
|
||||
Task<ApiResult<object>> DeleteAsync(string id);
|
||||
|
||||
9
src/App/Abstractions/Services/ISyncService.cs
Normal file
9
src/App/Abstractions/Services/ISyncService.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Bit.App.Abstractions
|
||||
{
|
||||
public interface ISyncService
|
||||
{
|
||||
Task<bool> SyncAsync();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user