about summary refs log tree commit diff
path: root/MatrixRoomUtils.Core/Interfaces
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2023-06-19 02:36:32 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2023-06-19 02:36:32 +0200
commited2205972a7b7d6fdd4563c3775a83616920597a (patch)
tree54aec1cfdf861fd8a7739be131fbe79ae24d91e4 /MatrixRoomUtils.Core/Interfaces
parentPartial refactor (diff)
downloadMatrixUtils-ed2205972a7b7d6fdd4563c3775a83616920597a.tar.xz
Working sync
Diffstat (limited to 'MatrixRoomUtils.Core/Interfaces')
-rw-r--r--MatrixRoomUtils.Core/Interfaces/IHomeServer.cs2
-rw-r--r--MatrixRoomUtils.Core/Interfaces/Services/IStorageProvider.cs39
2 files changed, 35 insertions, 6 deletions
diff --git a/MatrixRoomUtils.Core/Interfaces/IHomeServer.cs b/MatrixRoomUtils.Core/Interfaces/IHomeServer.cs

index a808c3d..c5645e6 100644 --- a/MatrixRoomUtils.Core/Interfaces/IHomeServer.cs +++ b/MatrixRoomUtils.Core/Interfaces/IHomeServer.cs
@@ -10,7 +10,7 @@ public class IHomeServer { public string HomeServerDomain { get; set; } public string FullHomeServerDomain { get; set; } - private protected MatrixHttpClient _httpClient { get; set; } = new(); + protected internal MatrixHttpClient _httpClient { get; set; } = new(); public async Task<string> ResolveHomeserverFromWellKnown(string homeserver) { var res = await _resolveHomeserverFromWellKnown(homeserver); diff --git a/MatrixRoomUtils.Core/Interfaces/Services/IStorageProvider.cs b/MatrixRoomUtils.Core/Interfaces/Services/IStorageProvider.cs
index 2540ad7..01314da 100644 --- a/MatrixRoomUtils.Core/Interfaces/Services/IStorageProvider.cs +++ b/MatrixRoomUtils.Core/Interfaces/Services/IStorageProvider.cs
@@ -1,17 +1,46 @@ namespace MatrixRoomUtils.Core.Interfaces.Services; public interface IStorageProvider { - // save - public async Task SaveAll() { - Console.WriteLine($"StorageProvider<{GetType().Name}> does not implement Save()!"); + // save all children of a type with reflection + public Task SaveAllChildren<T>(string key, T value) { + Console.WriteLine($"StorageProvider<{GetType().Name}> does not implement SaveAllChildren<T>(key, value)!"); + return Task.CompletedTask; } + + // load all children of a type with reflection + public Task<T?> LoadAllChildren<T>(string key) { + Console.WriteLine($"StorageProvider<{GetType().Name}> does not implement LoadAllChildren<T>(key)!"); + return Task.FromResult(default(T)); + } + - public async Task SaveObject<T>(string key, T value) { + public Task SaveObject<T>(string key, T value) { Console.WriteLine($"StorageProvider<{GetType().Name}> does not implement SaveObject<T>(key, value)!"); + return Task.CompletedTask; + } + + // load + public Task<T?> LoadObject<T>(string key) { + Console.WriteLine($"StorageProvider<{GetType().Name}> does not implement LoadObject<T>(key)!"); + return Task.FromResult(default(T)); + } + + // check if exists + public Task<bool> ObjectExists(string key) { + Console.WriteLine($"StorageProvider<{GetType().Name}> does not implement ObjectExists(key)!"); + return Task.FromResult(false); + } + + // get all keys + public Task<List<string>> GetAllKeys() { + Console.WriteLine($"StorageProvider<{GetType().Name}> does not implement GetAllKeys()!"); + return Task.FromResult(new List<string>()); } + // delete - public async Task DeleteObject(string key) { + public Task DeleteObject(string key) { Console.WriteLine($"StorageProvider<{GetType().Name}> does not implement DeleteObject(key)!"); + return Task.CompletedTask; } } \ No newline at end of file