status-lib/status/signals/envelope.nim
2021-09-08 16:55:37 -04:00

15 lines
508 B
Nim

import json
import base
import signal_type
type EnvelopeSentSignal* = ref object of Signal
messageIds*: seq[string]
proc fromEvent*(T: type EnvelopeSentSignal, jsonSignal: JsonNode): EnvelopeSentSignal =
result = EnvelopeSentSignal()
result.signalType = SignalType.EnvelopeSent
if jsonSignal["event"].kind != JNull and jsonSignal["event"].hasKey("ids") and jsonSignal["event"]["ids"].kind != JNull:
for messageId in jsonSignal["event"]["ids"]:
result.messageIds.add(messageId.getStr)