]> nmode's Git Repositories - signal-cli/commitdiff
Added missing file attachment attributes in JsonAttachment output
authorsignals-from-outer-space <signaling@gmx.net>
Sun, 2 Apr 2023 06:34:43 +0000 (08:34 +0200)
committerAsamK <asamk@gmx.de>
Sun, 2 Apr 2023 16:49:42 +0000 (18:49 +0200)
Closes #1217
Fixes #1216

src/main/java/org/asamk/signal/json/JsonAttachment.java

index 1f6e65101cd5fc2e18241e9d3c108bbd26a6e7e6..c75b3987700c18cbff3e72fe8573656b1ce16bb9 100644 (file)
@@ -2,12 +2,33 @@ package org.asamk.signal.json;
 
 import org.asamk.signal.manager.api.MessageEnvelope;
 
-record JsonAttachment(String contentType, String filename, String id, Long size) {
+record JsonAttachment(
+        String contentType,
+        String filename,
+        String id,
+        Long size,
+        Integer width,
+        Integer height,
+        String caption,
+        Long uploadTimestamp
+) {
 
     static JsonAttachment from(MessageEnvelope.Data.Attachment attachment) {
         final var id = attachment.id().orElse(null);
         final var filename = attachment.fileName().orElse(null);
         final var size = attachment.size().orElse(null);
-        return new JsonAttachment(attachment.contentType(), filename, id, size);
+        final var width = attachment.width().orElse(null);
+        final var height = attachment.height().orElse(null);
+        final var caption = attachment.caption().orElse(null);
+        final var uploadTimestamp = attachment.uploadTimestamp().orElse(null);
+
+        return new JsonAttachment(attachment.contentType(),
+                filename,
+                id,
+                size,
+                width,
+                height,
+                caption,
+                uploadTimestamp);
     }
 }