From 2e89a0717a60598904c92499adb7e01b2075fbb9 Mon Sep 17 00:00:00 2001 From: "Emma@Rory&" Date: Wed, 26 Jul 2023 21:02:50 +0200 Subject: MRU desktop start --- MatrixRoomUtils.Core/Interfaces/IHomeServer.cs | 8 +++---- .../Interfaces/Services/IStorageProvider.cs | 26 ++++++++++++++++------ 2 files changed, 23 insertions(+), 11 deletions(-) (limited to 'MatrixRoomUtils.Core/Interfaces') diff --git a/MatrixRoomUtils.Core/Interfaces/IHomeServer.cs b/MatrixRoomUtils.Core/Interfaces/IHomeServer.cs index d41a6cd..3521a51 100644 --- a/MatrixRoomUtils.Core/Interfaces/IHomeServer.cs +++ b/MatrixRoomUtils.Core/Interfaces/IHomeServer.cs @@ -11,7 +11,7 @@ public class IHomeServer { public string HomeServerDomain { get; set; } public string FullHomeServerDomain { get; set; } - protected internal MatrixHttpClient _httpClient { get; set; } = new(); + public MatrixHttpClient _httpClient { get; set; } = new(); public async Task GetProfile(string mxid) { if(mxid is null) throw new ArgumentNullException(nameof(mxid)); @@ -20,12 +20,12 @@ public class IHomeServer { if (_profileCache[mxid] is ProfileResponseEventData p) return p; } _profileCache[mxid] = new SemaphoreSlim(1); - + var resp = await _httpClient.GetAsync($"/_matrix/client/v3/profile/{mxid}"); var data = await resp.Content.ReadFromJsonAsync(); if (!resp.IsSuccessStatusCode) Console.WriteLine("Profile: " + data); _profileCache[mxid] = data; - + return data; } -} \ No newline at end of file +} diff --git a/MatrixRoomUtils.Core/Interfaces/Services/IStorageProvider.cs b/MatrixRoomUtils.Core/Interfaces/Services/IStorageProvider.cs index eefb79c..1de9885 100644 --- a/MatrixRoomUtils.Core/Interfaces/Services/IStorageProvider.cs +++ b/MatrixRoomUtils.Core/Interfaces/Services/IStorageProvider.cs @@ -1,4 +1,4 @@ -namespace MatrixRoomUtils.Core.Interfaces.Services; +namespace MatrixRoomUtils.Core.Interfaces.Services; public interface IStorageProvider { // save all children of a type with reflection @@ -6,7 +6,7 @@ public interface IStorageProvider { Console.WriteLine($"StorageProvider<{GetType().Name}> does not implement SaveAllChildren(key, value)!"); throw new NotImplementedException(); } - + // load all children of a type with reflection public Task LoadAllChildrenAsync(string key) { Console.WriteLine($"StorageProvider<{GetType().Name}> does not implement LoadAllChildren(key)!"); @@ -18,29 +18,41 @@ public interface IStorageProvider { Console.WriteLine($"StorageProvider<{GetType().Name}> does not implement SaveObject(key, value)!"); throw new NotImplementedException(); } - + // load public Task LoadObjectAsync(string key) { Console.WriteLine($"StorageProvider<{GetType().Name}> does not implement LoadObject(key)!"); throw new NotImplementedException(); } - + // check if exists public Task ObjectExistsAsync(string key) { Console.WriteLine($"StorageProvider<{GetType().Name}> does not implement ObjectExists(key)!"); throw new NotImplementedException(); } - + // get all keys public Task> GetAllKeysAsync() { Console.WriteLine($"StorageProvider<{GetType().Name}> does not implement GetAllKeys()!"); throw new NotImplementedException(); } - + // delete public Task DeleteObjectAsync(string key) { Console.WriteLine($"StorageProvider<{GetType().Name}> does not implement DeleteObject(key)!"); throw new NotImplementedException(); } -} \ No newline at end of file + + // save stream + public Task SaveStreamAsync(string key, Stream stream) { + Console.WriteLine($"StorageProvider<{GetType().Name}> does not implement SaveStream(key, stream)!"); + throw new NotImplementedException(); + } + + // load stream + public Task LoadStreamAsync(string key) { + Console.WriteLine($"StorageProvider<{GetType().Name}> does not implement LoadStream(key)!"); + throw new NotImplementedException(); + } +} -- cgit 1.5.1