- JsonDataMessage(SignalServiceDataMessage dataMessage) {
- this.timestamp = dataMessage.getTimestamp();
- if (dataMessage.getGroupContext().isPresent() && dataMessage.getGroupContext().get().getGroupV1().isPresent()) {
- SignalServiceGroup groupInfo = dataMessage.getGroupContext().get().getGroupV1().get();
- this.groupInfo = new JsonGroupInfo(groupInfo);
- }
- if (dataMessage.getBody().isPresent()) {
- this.message = dataMessage.getBody().get();
- }
- this.expiresInSeconds = dataMessage.getExpiresInSeconds();
- if (dataMessage.getAttachments().isPresent()) {
- this.attachments = new ArrayList<>(dataMessage.getAttachments().get().size());
- for (SignalServiceAttachment attachment : dataMessage.getAttachments().get()) {
- this.attachments.add(new JsonAttachment(attachment));
- }
- } else {
- this.attachments = new ArrayList<>();
- }
- }
+record JsonDataMessage(
+ long timestamp,
+ String message,
+ Integer expiresInSeconds,
+ @JsonInclude(JsonInclude.Include.NON_NULL) Boolean viewOnce,
+ @JsonInclude(JsonInclude.Include.NON_NULL) JsonReaction reaction,
+ @JsonInclude(JsonInclude.Include.NON_NULL) JsonQuote quote,
+ @JsonInclude(JsonInclude.Include.NON_NULL) JsonPayment payment,
+ @JsonInclude(JsonInclude.Include.NON_NULL) List<JsonMention> mentions,
+ @JsonInclude(JsonInclude.Include.NON_NULL) List<JsonPreview> previews,
+ @JsonInclude(JsonInclude.Include.NON_NULL) List<JsonAttachment> attachments,
+ @JsonInclude(JsonInclude.Include.NON_NULL) JsonSticker sticker,
+ @JsonInclude(JsonInclude.Include.NON_NULL) JsonRemoteDelete remoteDelete,
+ @JsonInclude(JsonInclude.Include.NON_NULL) List<JsonSharedContact> contacts,
+ @JsonInclude(JsonInclude.Include.NON_NULL) JsonGroupInfo groupInfo
+) {