From ec43421f8582a523892f7952ce449414a82370dc Mon Sep 17 00:00:00 2001 From: Zhou Wei Date: Thu, 27 Jul 2023 18:00:03 +0800 Subject: [PATCH] fix video caption --- src/main/java/com/whatsapp/api/domain/webhook/Video.java | 5 +++++ .../com/whatsapp/api/domain/webhook/WebHookPayloadTest.java | 1 + src/test/resources/deserialization/videoMessage.json | 1 + 3 files changed, 7 insertions(+) diff --git a/src/main/java/com/whatsapp/api/domain/webhook/Video.java b/src/main/java/com/whatsapp/api/domain/webhook/Video.java index 76b31a374..0168a8c59 100644 --- a/src/main/java/com/whatsapp/api/domain/webhook/Video.java +++ b/src/main/java/com/whatsapp/api/domain/webhook/Video.java @@ -7,6 +7,7 @@ * * @param sha256 The checksum of the media. * @param mimeType The mime type of the media. The caption that describes the media. + * @param caption Added to Webhooks if it has been previously specified. The caption that describes the media. * @param id The ID of the medi */ public record Video( @@ -15,7 +16,11 @@ public record Video( @JsonProperty("sha256") String sha256, + @JsonProperty("caption") String caption, + @JsonProperty("id") String id + + ) { } diff --git a/src/test/java/com/whatsapp/api/domain/webhook/WebHookPayloadTest.java b/src/test/java/com/whatsapp/api/domain/webhook/WebHookPayloadTest.java index d534e7929..71d2e1265 100644 --- a/src/test/java/com/whatsapp/api/domain/webhook/WebHookPayloadTest.java +++ b/src/test/java/com/whatsapp/api/domain/webhook/WebHookPayloadTest.java @@ -247,6 +247,7 @@ void testDeserializationVideoMessage() throws IOException, URISyntaxException { Assertions.assertEquals("1673029501", obj.entry().get(0).changes().get(0).value().messages().get(0).timestamp()); Assertions.assertEquals(MessageType.VIDEO, obj.entry().get(0).changes().get(0).value().messages().get(0).type()); Assertions.assertEquals("video/mp4", obj.entry().get(0).changes().get(0).value().messages().get(0).video().mimeType()); + Assertions.assertEquals("hello world", obj.entry().get(0).changes().get(0).value().messages().get(0).video().caption()); Assertions.assertEquals("waIq5BBe5GgjT6DHWu3LY9F8jYOZzYLHRRRGDTbipNk=", obj.entry().get(0).changes().get(0).value().messages().get(0).video().sha256()); Assertions.assertEquals("661828760183585", obj.entry().get(0).changes().get(0).value().messages().get(0).video().id()); diff --git a/src/test/resources/deserialization/videoMessage.json b/src/test/resources/deserialization/videoMessage.json index 3d5b73ad5..e7fc2fae0 100644 --- a/src/test/resources/deserialization/videoMessage.json +++ b/src/test/resources/deserialization/videoMessage.json @@ -26,6 +26,7 @@ "timestamp": "1673029501", "type": "video", "video": { + "caption": "hello world", "mime_type": "video/mp4", "sha256": "waIq5BBe5GgjT6DHWu3LY9F8jYOZzYLHRRRGDTbipNk=", "id": "661828760183585"