feat: create request projects for basic CQRS

This commit is contained in:
Louis Seubert 2026-05-08 20:26:26 +02:00
commit d614788e06
Signed by: louis9902
GPG key ID: 4B9DB28F826553BD
190 changed files with 12236 additions and 0 deletions

View file

@ -0,0 +1,35 @@
// Copyright (c) The Geekeey Authors
// SPDX-License-Identifier: EUPL-1.2
#pragma warning disable CA1711
#pragma warning disable CA1716
namespace Geekeey.Request.Dispatcher;
/// <summary>
/// Represents a behavior in the request pipeline, allowing interception, modification,
/// or chaining of asynchronous stream requests and responses.
/// </summary>
/// <typeparam name="TRequest">The type of the request being processed. Must implement <see cref="IStreamRequest{TResponse}"/>.</typeparam>
/// <typeparam name="TResponse">The type of the response produced by the implementing request handler.</typeparam>
public interface IStreamRequestBehavior<in TRequest, TResponse> where TRequest : IStreamRequest<TResponse>
{
/// <summary>
/// Handles the asynchronous processing of a request, allowing behavior customization
/// such as interception, modification, or chaining of the request and its response.
/// </summary>
/// <param name="request">The request instance being processed.</param>
/// <param name="next">The next delegate in the pipeline to execute after the custom behavior.</param>
/// <param name="cancellationToken">A token to monitor for cancellation requests.</param>
/// <returns>An asynchronous stream of <typeparamref name="TResponse"/> representing the processed response.</returns>
IAsyncEnumerable<TResponse> HandleAsync(TRequest request, StreamHandlerDelegate<TResponse> next, CancellationToken cancellationToken);
}
/// <summary>
/// Represents the delegate responsible for handling asynchronous requests in a pipeline.
/// </summary>
/// <typeparam name="TResponse">The type of the response produced by the implementing request handler.</typeparam>
/// <param name="request">The asynchronous request being processed.</param>
/// <param name="cancellationToken">A token for monitoring cancellation requests.</param>
/// <returns>An asynchronous stream of responses of type <typeparamref name="TResponse"/>.</returns>
public delegate IAsyncEnumerable<TResponse> StreamHandlerDelegate<TResponse>(IStreamRequest<TResponse> request, CancellationToken cancellationToken);