status-lib/status/signals/envelope.nim

15 lines
508 B
Nim
Raw Normal View History

2021-09-08 18:05:39 +00:00
import json
import base
2021-09-08 20:55:37 +00:00
import signal_type
2021-09-08 18:05:39 +00:00
type EnvelopeSentSignal* = ref object of Signal
messageIds*: seq[string]
2021-09-08 20:55:37 +00:00
proc fromEvent*(T: type EnvelopeSentSignal, jsonSignal: JsonNode): EnvelopeSentSignal =
result = EnvelopeSentSignal()
result.signalType = SignalType.EnvelopeSent
2021-09-08 18:05:39 +00:00
if jsonSignal["event"].kind != JNull and jsonSignal["event"].hasKey("ids") and jsonSignal["event"]["ids"].kind != JNull:
for messageId in jsonSignal["event"]["ids"]:
2021-09-08 20:55:37 +00:00
result.messageIds.add(messageId.getStr)
2021-09-08 18:05:39 +00:00