import java.util.Base64;
-public class JsonSticker {
+public record JsonSticker(String packId, String packKey, int stickerId) {
- String packId;
- String packKey;
- int stickerId;
-
- public JsonSticker(SignalServiceDataMessage.Sticker sticker) {
- this.packId = Base64.getEncoder().encodeToString(sticker.getPackId());
- this.packKey = Base64.getEncoder().encodeToString(sticker.getPackKey());
- this.stickerId = sticker.getStickerId();
- // TODO also download sticker image ??
+ static JsonSticker from(SignalServiceDataMessage.Sticker sticker) {
+ final var packId = Base64.getEncoder().encodeToString(sticker.getPackId());
+ final var packKey = Base64.getEncoder().encodeToString(sticker.getPackKey());
+ final var stickerId = sticker.getStickerId();
+ return new JsonSticker(packId, packKey, stickerId);
}
}