// Copyright (c) The Geekeey Authors
// SPDX-License-Identifier: EUPL-1.2
namespace Geekeey.Request.Dispatcher;
///
/// Defines functionality to dispatch requests to their corresponding handlers.
///
public interface IRequestDispatcher
{
///
/// Asynchronously send a request to a handler producing a scalar value.
///
/// Request object
/// Optional cancellation token
/// Response type
/// A task that represents the send operation. The task result contains the handler response
Task DispatchAsync(IScalarRequest request, CancellationToken cancellationToken = default);
///
/// Asynchronously send a request to a handler producing a stream value.
///
/// Request object
/// Optional cancellation token
/// Response type
/// The created async enumerable, representing the stream of responses.
IAsyncEnumerable DispatchAsync(IStreamRequest request, CancellationToken cancellationToken = default);
}