diff --git a/Requests/IRequest.cs b/Requests/IRequest.cs deleted file mode 100644 index cb89e51..0000000 --- a/Requests/IRequest.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace HermesSocketLibrary.Requests -{ - public interface IRequest - { - string Name { get; } - - Task Grant(string sender, IDictionary? data); - } -} \ No newline at end of file diff --git a/Requests/IRequestManager.cs b/Requests/IRequestManager.cs deleted file mode 100644 index 2eefd99..0000000 --- a/Requests/IRequestManager.cs +++ /dev/null @@ -1,9 +0,0 @@ -using HermesSocketLibrary.Socket.Data; - -namespace HermesSocketLibrary.Requests -{ - public interface IRequestManager - { - Task Grant(string sender, RequestMessage? message); - } -} \ No newline at end of file diff --git a/Requests/RequestManager.cs b/Requests/RequestManager.cs deleted file mode 100644 index 9d317bc..0000000 --- a/Requests/RequestManager.cs +++ /dev/null @@ -1,41 +0,0 @@ -using HermesSocketLibrary.Socket.Data; -using Serilog; - -namespace HermesSocketLibrary.Requests -{ - public class RequestManager : IRequestManager - { - private readonly IDictionary _requests; - private readonly ILogger _logger; - - - public RequestManager(IEnumerable requests, ILogger logger) - { - _logger = logger; - - _requests = requests.ToDictionary(r => r.Name, r => r); - } - - public async Task Grant(string sender, RequestMessage? message) - { - if (message == null || message.Type == null) - return new RequestResult(false, null); - - if (!_requests.TryGetValue(message.Type, out IRequest? request) || request == null) - { - _logger.Warning($"Did not find request type '{message.Type}'."); - return new RequestResult(false, null); - } - - try - { - return await request.Grant(sender, message.Data); - } - catch (Exception e) - { - _logger.Error(e, $"Failed to grant a request of type '{message.Type}'."); - } - return new RequestResult(false, null); - } - } -} \ No newline at end of file diff --git a/Requests/RequestResult.cs b/Requests/RequestResult.cs deleted file mode 100644 index 39537ee..0000000 --- a/Requests/RequestResult.cs +++ /dev/null @@ -1,16 +0,0 @@ -namespace HermesSocketLibrary.Requests -{ - public class RequestResult - { - public bool Success; - public object? Result; - public bool NotifyClientsOnAccount; - - public RequestResult(bool success, object? result, bool notifyClientsOnAccount = true) - { - Success = success; - Result = result; - NotifyClientsOnAccount = notifyClientsOnAccount; - } - } -} \ No newline at end of file