Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@

namespace Devlooped.WhatsApp;

/// <summary>Represents a delegating chat client that wraps an inner handler with implementation provided by a delegate.</summary>
class AnonymousDelegatingHandler : DelegatingHandler
/// <summary>
/// Represents a delegating handler that wraps an inner handler with implementation provided by a delegate.
/// </summary>
class AnonymousWhatsAppHandler : DelegatingWhatsAppHandler
{
/// <summary>The delegate to use as the implementation of <see cref="Handle"/>.</summary>
readonly Func<IEnumerable<Message>, IWhatsAppHandler, CancellationToken, Task> handlerFunc;
Expand All @@ -12,7 +14,7 @@ class AnonymousDelegatingHandler : DelegatingHandler
/// </summary>
/// <param name="innerHandler">The inner handler.</param>
/// <param name="handlerFunc">A delegate that provides the implementation for <see cref="HandleAsync"/></param>
public AnonymousDelegatingHandler(
public AnonymousWhatsAppHandler(
IWhatsAppHandler innerHandler,
Func<IEnumerable<Message>, IWhatsAppHandler, CancellationToken, Task> handlerFunc) : base(innerHandler)
=> this.handlerFunc = Throw.IfNull(handlerFunc);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
/// This is recommended as a base type when building handlers that can be chained around an underlying <see cref="IWhatsAppHandler"/>.
/// The default implementation simply passes each call to the inner handler instance.
/// </remarks>
public class DelegatingHandler : IWhatsAppHandler, IDisposable
public class DelegatingWhatsAppHandler : IWhatsAppHandler, IDisposable
{
/// <summary>
/// Initializes a new instance of the <see cref="DelegatingHandler"/> class.
/// Initializes a new instance of the <see cref="DelegatingWhatsAppHandler"/> class.
/// </summary>
/// <param name="innerHandler">The wrapped handler instance.</param>
public DelegatingHandler(IWhatsAppHandler innerHandler)
public DelegatingWhatsAppHandler(IWhatsAppHandler innerHandler)
=> InnerHandler = Throw.IfNull(innerHandler);

/// <summary>Gets the inner <see cref="IWhatsAppHandler" />.</summary>
Expand Down
2 changes: 1 addition & 1 deletion src/WhatsApp/LoggingHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Devlooped.WhatsApp;

public partial class LoggingHandler(IWhatsAppHandler innerHandler, ILogger logger) : DelegatingHandler(innerHandler)
public partial class LoggingHandler(IWhatsAppHandler innerHandler, ILogger logger) : DelegatingWhatsAppHandler(innerHandler)
{
JsonSerializerOptions options = JsonContext.DefaultOptions;

Expand Down
2 changes: 1 addition & 1 deletion src/WhatsApp/WhatsAppHandlerBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public WhatsAppHandlerBuilder Use(Func<IEnumerable<Message>, IWhatsAppHandler, C
{
_ = Throw.IfNull(handlerFunc);

return Use((innerClient, _) => new AnonymousDelegatingHandler(innerClient, handlerFunc));
return Use((innerClient, _) => new AnonymousWhatsAppHandler(innerClient, handlerFunc));
}

class EmptyHandler : IWhatsAppHandler
Expand Down