status-lib/status/signals/expired.nim

15 lines
523 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 EnvelopeExpiredSignal* = ref object of Signal
messageIds*: seq[string]
2021-09-08 20:55:37 +00:00
proc fromEvent*(T: type EnvelopeExpiredSignal, jsonSignal: JsonNode): EnvelopeExpiredSignal =
result = EnvelopeExpiredSignal()
result.signalType = SignalType.EnvelopeExpired
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