Working sync
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
|