From b04ac43f0bc1cfd9cd7583a8cddc9e0e034936f6 Mon Sep 17 00:00:00 2001 From: tr00d Date: Thu, 8 Aug 2024 10:22:15 +0200 Subject: [PATCH] feat: add name to WhatsApp file attachment --- .../Data/SendWhatsAppFileAsyncReturnsOk-request.json | 3 ++- ...endWhatsAppFileAsyncReturnsOkWithContext-request.json | 3 ++- Vonage.Test/Messages/WhatsApp/WhatsAppMessagesTest.cs | 2 ++ Vonage/Messages/CaptionedAttachment.cs | 9 ++++++++- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Vonage.Test/Messages/WhatsApp/Data/SendWhatsAppFileAsyncReturnsOk-request.json b/Vonage.Test/Messages/WhatsApp/Data/SendWhatsAppFileAsyncReturnsOk-request.json index ada64bcde..544802890 100644 --- a/Vonage.Test/Messages/WhatsApp/Data/SendWhatsAppFileAsyncReturnsOk-request.json +++ b/Vonage.Test/Messages/WhatsApp/Data/SendWhatsAppFileAsyncReturnsOk-request.json @@ -6,7 +6,8 @@ "client_ref": "abcdefg", "file": { "url": "https://test.com/me.txt", - "caption": "Me" + "caption": "Me", + "name": "file.txt" }, "webhook_version": "v1", "webhook_url": "https://example.com/status" diff --git a/Vonage.Test/Messages/WhatsApp/Data/SendWhatsAppFileAsyncReturnsOkWithContext-request.json b/Vonage.Test/Messages/WhatsApp/Data/SendWhatsAppFileAsyncReturnsOkWithContext-request.json index f3c4f59df..24ad35a49 100644 --- a/Vonage.Test/Messages/WhatsApp/Data/SendWhatsAppFileAsyncReturnsOkWithContext-request.json +++ b/Vonage.Test/Messages/WhatsApp/Data/SendWhatsAppFileAsyncReturnsOkWithContext-request.json @@ -6,7 +6,8 @@ "client_ref": "abcdefg", "file": { "url": "https://test.com/me.txt", - "caption": "Me" + "caption": "Me", + "name": "file.txt" }, "context": { "message_uuid": "a1b2c3d4a1b2c3d4" diff --git a/Vonage.Test/Messages/WhatsApp/WhatsAppMessagesTest.cs b/Vonage.Test/Messages/WhatsApp/WhatsAppMessagesTest.cs index 6437a72b0..40a0bab52 100644 --- a/Vonage.Test/Messages/WhatsApp/WhatsAppMessagesTest.cs +++ b/Vonage.Test/Messages/WhatsApp/WhatsAppMessagesTest.cs @@ -143,6 +143,7 @@ public async Task SendWhatsAppFileAsyncReturnsOk() { Url = "https://test.com/me.txt", Caption = "Me", + Name = "file.txt", }, ClientRef = "abcdefg", WebhookUrl = new Uri("https://example.com/status"), @@ -163,6 +164,7 @@ public async Task SendWhatsAppFileAsyncReturnsOkWithContext() { Url = "https://test.com/me.txt", Caption = "Me", + Name = "file.txt", }, ClientRef = "abcdefg", Context = new WhatsAppContext("a1b2c3d4a1b2c3d4"), diff --git a/Vonage/Messages/CaptionedAttachment.cs b/Vonage/Messages/CaptionedAttachment.cs index df10ce210..922ca3fba 100644 --- a/Vonage/Messages/CaptionedAttachment.cs +++ b/Vonage/Messages/CaptionedAttachment.cs @@ -1,4 +1,6 @@ -using System.Text.Json.Serialization; +#region +using System.Text.Json.Serialization; +#endregion namespace Vonage.Messages; @@ -18,4 +20,9 @@ public class CaptionedAttachment /// [JsonPropertyOrder(0)] public string Url { get; set; } + + /// + /// + [JsonPropertyOrder(2)] + public string Name { get; set; } } \ No newline at end of file