/*
* Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
* See https://github.com/openiddict/openiddict-core for more information concerning
* the license and the contributors participating to this project.
*/
namespace OpenIddict.Client;
///
/// Represents a handler able to process events.
///
/// The type of the events handled by this instance.
public sealed class OpenIddictClientHandler : IOpenIddictClientHandler where TContext : BaseContext
{
private readonly Func _handler;
///
/// Creates a new event using the specified handler delegate.
///
/// The event handler delegate.
public OpenIddictClientHandler(Func handler)
=> _handler = handler ?? throw new ArgumentNullException(nameof(handler));
///
/// Processes the event.
///
/// The event to process.
///
/// A that can be used to monitor the asynchronous operation.
///
public ValueTask HandleAsync(TContext context)
=> _handler(context ?? throw new ArgumentNullException(nameof(context)));
}