diff --git a/src/Sinch/Conversation/Messages/Message/ListItemChoice.cs b/src/Sinch/Conversation/Messages/Message/ChoiceItem.cs similarity index 97% rename from src/Sinch/Conversation/Messages/Message/ListItemChoice.cs rename to src/Sinch/Conversation/Messages/Message/ChoiceItem.cs index 607451e..a1a7b0d 100644 --- a/src/Sinch/Conversation/Messages/Message/ListItemChoice.cs +++ b/src/Sinch/Conversation/Messages/Message/ChoiceItem.cs @@ -5,7 +5,7 @@ namespace Sinch.Conversation.Messages.Message /// /// A message component for interactive messages, containing a choice. /// - public class ListItemChoice : IListItem + public class ChoiceItem : IListItem { /// /// Required parameter. Title for the choice item. diff --git a/src/Sinch/Conversation/Messages/Message/ListMessage.cs b/src/Sinch/Conversation/Messages/Message/ListMessage.cs index 50e04dc..25c37ad 100644 --- a/src/Sinch/Conversation/Messages/Message/ListMessage.cs +++ b/src/Sinch/Conversation/Messages/Message/ListMessage.cs @@ -105,12 +105,12 @@ public class ListItemJsonConverter : JsonConverter var elem = JsonElement.ParseValue(ref reader); if (elem.TryGetProperty("choice", out var choice)) { - return choice.Deserialize(options); + return choice.Deserialize(options); } if (elem.TryGetProperty("product", out var product)) { - return product.Deserialize(options); + return product.Deserialize(options); } throw new JsonException( @@ -120,20 +120,20 @@ public class ListItemJsonConverter : JsonConverter public override void Write(Utf8JsonWriter writer, IListItem value, JsonSerializerOptions options) { var type = value.GetType(); - if (type == typeof(ListItemChoice)) + if (type == typeof(ChoiceItem)) { JsonSerializer.Serialize(writer, new ListItemChoiceWrapper() { - Choice = value as ListItemChoice + Choice = value as ChoiceItem }, options); return; } - if (type == typeof(ListItemProduct)) + if (type == typeof(ProductItem)) { JsonSerializer.Serialize(writer, new ListItemProductWrapper() { - Product = value as ListItemProduct + Product = value as ProductItem }, options); return; } @@ -145,12 +145,12 @@ public override void Write(Utf8JsonWriter writer, IListItem value, JsonSerialize internal class ListItemChoiceWrapper { - public ListItemChoice? Choice { get; set; } + public ChoiceItem? Choice { get; set; } } internal class ListItemProductWrapper { - public ListItemProduct? Product { get; set; } + public ProductItem? Product { get; set; } } /// diff --git a/src/Sinch/Conversation/Messages/Message/ListItemProduct.cs b/src/Sinch/Conversation/Messages/Message/ProductItem.cs similarity index 97% rename from src/Sinch/Conversation/Messages/Message/ListItemProduct.cs rename to src/Sinch/Conversation/Messages/Message/ProductItem.cs index cad907a..8758d33 100644 --- a/src/Sinch/Conversation/Messages/Message/ListItemProduct.cs +++ b/src/Sinch/Conversation/Messages/Message/ProductItem.cs @@ -5,7 +5,7 @@ namespace Sinch.Conversation.Messages.Message /// /// A message component for interactive messages, containing a product. /// - public sealed class ListItemProduct : IListItem + public sealed class ProductItem : IListItem { /// /// Required parameter. The ID for the product. diff --git a/tests/Sinch.Tests/Conversation/MessagesTests.cs b/tests/Sinch.Tests/Conversation/MessagesTests.cs index 3cc46a3..4b4a9bb 100644 --- a/tests/Sinch.Tests/Conversation/MessagesTests.cs +++ b/tests/Sinch.Tests/Conversation/MessagesTests.cs @@ -44,7 +44,7 @@ public async Task GetMessage() Title = "sec1", Items = new List() { - new ListItemChoice() + new ChoiceItem() { Title = "title", Description = "desc", @@ -61,7 +61,7 @@ public async Task GetMessage() Title = "sec2", Items = new List { - new ListItemProduct() + new ProductItem() { Id = "id", Marketplace = "amazon" diff --git a/tests/Sinch.Tests/Conversation/SendMessageTests.cs b/tests/Sinch.Tests/Conversation/SendMessageTests.cs index 04020ee..08cbf81 100644 --- a/tests/Sinch.Tests/Conversation/SendMessageTests.cs +++ b/tests/Sinch.Tests/Conversation/SendMessageTests.cs @@ -382,7 +382,7 @@ public async Task SendList() Title = "item1", Items = new List() { - new ListItemChoice() + new ChoiceItem() { Title = "listitemchoice", PostbackData = "postno", @@ -393,7 +393,7 @@ public async Task SendList() ThumbnailUrl = new Uri("https://knowyourmeme.com/photos/377946") } }, - new ListItemProduct + new ProductItem { Id = "prod_id", Marketplace = "amazon",