diff --git a/src/SampleApp/Sample/Program.cs b/src/SampleApp/Sample/Program.cs index 5502dcd..e253832 100644 --- a/src/SampleApp/Sample/Program.cs +++ b/src/SampleApp/Sample/Program.cs @@ -95,7 +95,7 @@ static async IAsyncEnumerable ProcessMessagesAsync( // simulate some hard work at hand, like doing some LLM-stuff :) //await Task.Delay(2000); - yield return content.TextWithButtons( + yield return content.Text( $"☑️ Got your {content.Content.Type}:\r\n{JsonSerializer.Serialize(content, options)}", new Button("btn_good", "👍"), new Button("btn_bad", "👎")); diff --git a/src/WhatsApp/MessageExtensions.cs b/src/WhatsApp/MessageExtensions.cs index 9cf2a69..f1b9b1e 100644 --- a/src/WhatsApp/MessageExtensions.cs +++ b/src/WhatsApp/MessageExtensions.cs @@ -11,25 +11,25 @@ public static partial class MessageExtensions /// Creates a reaction response for the user message. /// public static ReactionResponse React(this UserMessage message, string emoji) - => new ReactionResponse(message.From.Number, message.To.Id, message.Id, message.ConversationId, emoji); + => new(message.From.Number, message.To.Id, message.Id, message.ConversationId, emoji); /// /// Creates a reengagement response for the error message. /// public static TemplateResponse Reengage(this ErrorMessage message) - => new TemplateResponse(message.From.Number, message.To.Id, message.Id, message.ConversationId, "reengagement", "es_AR"); + => new(message.From.Number, message.To.Id, message.Id, message.ConversationId, "reengagement", "es_AR"); /// /// Creates a text response for the message. /// public static TextResponse Text(this Message message, string text) - => new TextResponse(message.From.Number, message.To.Id, message.Id, message.ConversationId, text); + => new(message.From.Number, message.To.Id, message.Id, message.ConversationId, text); /// /// Creates a text response with buttons for the message. /// - public static TextResponse TextWithButtons(this Message message, string text, Button button1, Button? button2 = default) - => new TextResponse(message.From.Number, message.To.Id, message.Id, message.ConversationId, text, button1, button2); + public static TextResponse Text(this Message message, string text, Button button1, Button? button2 = default) + => new(message.From.Number, message.To.Id, message.Id, message.ConversationId, text, button1, button2); /// /// Attempts to retrieve a single message from the specified collection. @@ -42,7 +42,7 @@ public static TextResponse TextWithButtons(this Message message, string text, Bu /// When this method returns , contains the single message from the collection. When this /// method returns , contains . /// if the collection contains exactly one message; otherwise, . - public static bool TrySingle(this IEnumerable messages, [NotNullWhen(true)] out IMessage? message) + internal static bool TrySingle(this IEnumerable messages, [NotNullWhen(true)] out IMessage? message) { if (messages is IList list && list.Count == 1) { diff --git a/src/WhatsApp/ReactionResponse.cs b/src/WhatsApp/ReactionResponse.cs index 8962724..cc50f54 100644 --- a/src/WhatsApp/ReactionResponse.cs +++ b/src/WhatsApp/ReactionResponse.cs @@ -6,7 +6,7 @@ /// This response is used to react to a message by sending an emoji. The reaction is associated with a /// specific message identified by the property in the context of a conversation. /// The phone number of the recipient in international format. -/// The identifier of the service handling the message. +/// The identifier of the service handling the message. /// The unique identifier of the message to which the reaction is being sent. /// The emoji representing the reaction to the message. public record ReactionResponse(string Number, string Service, string Context, string? ConversationId, string Emoji) : Response(Number, Service, Context, ConversationId) diff --git a/src/WhatsApp/Response.cs b/src/WhatsApp/Response.cs index 59cdce5..4aac335 100644 --- a/src/WhatsApp/Response.cs +++ b/src/WhatsApp/Response.cs @@ -1,7 +1,4 @@ -using System.Text.Json.Serialization; -using Microsoft.AspNetCore.Mvc; - -namespace Devlooped.WhatsApp; +namespace Devlooped.WhatsApp; /// /// Represents a response message or command that can be sent using a WhatsApp client. @@ -11,7 +8,7 @@ namespace Devlooped.WhatsApp; /// , and , as well as methods for sending the response /// asynchronously. /// The phone number of the recipient in international format. -/// The identifier of the service handling the message. +/// The identifier of the service handling the message. /// The unique identifier of the message to which the reaction is being sent. /// The conversation id where this response was generated public abstract partial record Response(string Number, string Service, string Context, string? ConversationId) : IMessage diff --git a/src/WhatsApp/TemplateResponse.cs b/src/WhatsApp/TemplateResponse.cs index 4645dd9..093e83a 100644 --- a/src/WhatsApp/TemplateResponse.cs +++ b/src/WhatsApp/TemplateResponse.cs @@ -7,7 +7,7 @@ /// The template is identified by its name and code. The method handles the actual sending /// of the template message. /// The phone number of the recipient in international format. -/// The identifier of the service handling the message. +/// The identifier of the service handling the message. /// The unique identifier of the message to which the reaction is being sent. /// The template name /// The template lang code diff --git a/src/WhatsApp/TextResponse.cs b/src/WhatsApp/TextResponse.cs index dec1670..8158fb5 100644 --- a/src/WhatsApp/TextResponse.cs +++ b/src/WhatsApp/TextResponse.cs @@ -6,7 +6,7 @@ /// This response type allows sending a text message with up to two optional buttons for user /// interaction. If no buttons are provided, the response will consist of only the text message. /// The phone number of the recipient in international format. -/// The identifier of the service handling the message. +/// The identifier of the service handling the message. /// The unique identifier of the message to which the reaction is being sent. /// The text content of the response message. /// An optional button to include in the response for user interaction.