mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 10:30:38 +00:00
17 lines
631 B
Java
17 lines
631 B
Java
package org.asamk.signal.json;
|
|
|
|
import org.asamk.signal.manager.api.MessageEnvelope;
|
|
|
|
record JsonAttachment(String contentType, String filename, String id, Long size) {
|
|
|
|
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);
|
|
}
|
|
|
|
static JsonAttachment from(String filename) {
|
|
return new JsonAttachment(filename, null, null, null);
|
|
}
|
|
}
|