mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Refactor receive api
This commit is contained in:
parent
b615a4b04d
commit
9075cc1a30
36 changed files with 1510 additions and 970 deletions
|
@ -1,15 +1,16 @@
|
|||
package org.asamk.signal.json;
|
||||
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceDataMessage;
|
||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||
|
||||
import java.util.Base64;
|
||||
|
||||
public record JsonSticker(String packId, String packKey, int stickerId) {
|
||||
|
||||
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();
|
||||
static JsonSticker from(MessageEnvelope.Data.Sticker sticker) {
|
||||
final var encoder = Base64.getEncoder();
|
||||
final var packId = encoder.encodeToString(sticker.packId());
|
||||
final var packKey = encoder.encodeToString(sticker.packKey());
|
||||
final var stickerId = sticker.stickerId();
|
||||
return new JsonSticker(packId, packKey, stickerId);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue