package org.asamk.signal.manager;
-import com.fasterxml.jackson.annotation.JsonProperty;
+import org.asamk.signal.manager.api.StickerPack;
import java.util.List;
-public class JsonStickerPack {
+public record JsonStickerPack(String title, String author, JsonSticker cover, List<JsonSticker> stickers) {
- @JsonProperty
- public String title;
+ public record JsonSticker(Integer id, String emoji, String file, String contentType) {
- @JsonProperty
- public String author;
-
- @JsonProperty
- public JsonSticker cover;
-
- @JsonProperty
- public List<JsonSticker> stickers;
-
- // For deserialization
- private JsonStickerPack() {
- }
-
- public JsonStickerPack(
- final String title, final String author, final JsonSticker cover, final List<JsonSticker> stickers
- ) {
- this.title = title;
- this.author = author;
- this.cover = cover;
- this.stickers = stickers;
- }
-
- public static class JsonSticker {
-
- @JsonProperty
- public String emoji;
-
- @JsonProperty
- public String file;
-
- @JsonProperty
- public String contentType;
-
- // For deserialization
- private JsonSticker() {
- }
-
- public JsonSticker(final String emoji, final String file, final String contentType) {
- this.emoji = emoji;
- this.file = file;
- this.contentType = contentType;
+ public StickerPack.Sticker toApi() {
+ return new StickerPack.Sticker(id == null ? Integer.parseInt(file) : id, emoji, contentType);
}
}
}