mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Use record classes
This commit is contained in:
parent
ce70a623c2
commit
ce7aa580b6
66 changed files with 754 additions and 1877 deletions
|
@ -1,25 +1,15 @@
|
|||
package org.asamk.signal.json;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceDataMessage;
|
||||
|
||||
import java.util.Base64;
|
||||
|
||||
public class JsonSticker {
|
||||
public record JsonSticker(String packId, String packKey, int stickerId) {
|
||||
|
||||
@JsonProperty
|
||||
final String packId;
|
||||
|
||||
@JsonProperty
|
||||
final String packKey;
|
||||
|
||||
@JsonProperty
|
||||
final 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();
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue