~ruther/NosSmooth.Comms

ref: 00d1846f1e860c5e78e29db0384a1fc58e60b23c NosSmooth.Comms/src/Local/NosSmooth.Comms.Inject/MessageResponders/CommandResponder.cs -rw-r--r-- 995 bytes
00d1846f — Rutherther chore: update dependencies, add support for optional binding and hooks 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//
//  CommandResponder.cs
//
//  Copyright (c) František Boháček. All rights reserved.
//  Licensed under the MIT license. See LICENSE file in the project root for full license information.

using NosSmooth.Comms.Data.Messages;
using NosSmooth.Comms.Data.Responders;
using NosSmooth.Core.Client;
using Remora.Results;

namespace NosSmooth.Comms.Inject.MessageResponders;

/// <summary>
/// A responder to <see cref="CommandMessage"/>.
/// </summary>
public class CommandResponder : IMessageResponder<CommandMessage>
{
    private readonly INostaleClient _client;

    /// <summary>
    /// Initializes a new instance of the <see cref="CommandResponder"/> class.
    /// </summary>
    /// <param name="client">The client.</param>
    public CommandResponder(INostaleClient client)
    {
        _client = client;

    }

    /// <inheritdoc />
    public Task<Result> Respond(CommandMessage message, CancellationToken ct = default)
        => _client.SendCommandAsync(message.Command, ct);
}
Do not follow this link