~ruther/NosSmooth.Comms

ref: 3b9b88c2fee4419a3325fcc71d7b949d9d63f90e NosSmooth.Comms/src/Core/NosSmooth.Comms.Core/Responders/ResponseResultResponder.cs -rw-r--r-- 1.0 KiB
3b9b88c2 — Rutherther chore: add versions for packing 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
//
//  ResponseResultResponder.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.Contracts;
using Remora.Results;

namespace NosSmooth.Comms.Core.Responders;

/// <summary>
/// Responds to <see cref="ResponseResult"/> by updating contractor with the response.
/// </summary>
public class ResponseResultResponder : IMessageResponder<ResponseResult>
{
    private readonly Contractor _contractor;

    /// <summary>
    /// Initializes a new instance of the <see cref="ResponseResultResponder"/> class.
    /// </summary>
    /// <param name="contractor">The contractor.</param>
    public ResponseResultResponder(Contractor contractor)
    {
        _contractor = contractor;

    }

    /// <inheritdoc />
    public Task<Result> Respond(ResponseResult message, CancellationToken ct = default)
        => _contractor.Update(message, ct);
}
Do not follow this link