feat: adding HistoryRequestBatchProcessed signal and batch attributes (#78)
* feat: adding HistoryRequestBatchProcessed signal and batch attributes * bump status-go Co-authored-by: Iuri Matias <iuri.matias@gmail.com>
This commit is contained in:
parent
7095b80cb6
commit
1aba03aed6
|
@ -28,6 +28,7 @@ proc decode*(jsonSignal: JsonNode): Signal =
|
|||
of SignalType.HistoryRequestCompleted: HistoryRequestCompletedSignal.fromEvent(jsonSignal)
|
||||
of SignalType.HistoryRequestStarted: HistoryRequestStartedSignal.fromEvent(jsonSignal)
|
||||
of SignalType.HistoryRequestFailed: HistoryRequestFailedSignal.fromEvent(jsonSignal)
|
||||
of SignalType.HistoryRequestBatchProcessed: HistoryRequestBatchProcessedSignal.fromEvent(jsonSignal)
|
||||
of SignalType.KeycardConnected: KeycardConnectedSignal.fromEvent(jsonSignal)
|
||||
else: Signal()
|
||||
|
||||
|
|
|
@ -14,12 +14,22 @@ type MailserverRequestExpiredSignal* = ref object of Signal
|
|||
# TODO
|
||||
|
||||
type HistoryRequestStartedSignal* = ref object of Signal
|
||||
requestId*: string
|
||||
numBatches*: int
|
||||
|
||||
type HistoryRequestBatchProcessedSignal* = ref object of Signal
|
||||
requestId*: string
|
||||
batchIndex*: int
|
||||
numBatches*: int
|
||||
|
||||
type HistoryRequestCompletedSignal* = ref object of Signal
|
||||
requestId*: string
|
||||
|
||||
type HistoryRequestFailedSignal* = ref object of Signal
|
||||
requestId*: string
|
||||
errorMessage*: string
|
||||
error*: bool
|
||||
|
||||
|
||||
proc fromEvent*(T: type MailserverRequestCompletedSignal, jsonSignal: JsonNode): MailserverRequestCompletedSignal =
|
||||
result = MailserverRequestCompletedSignal()
|
||||
result.signalType = SignalType.MailserverRequestCompleted
|
||||
|
@ -38,14 +48,25 @@ proc fromEvent*(T: type MailserverRequestExpiredSignal, jsonSignal: JsonNode): M
|
|||
proc fromEvent*(T: type HistoryRequestStartedSignal, jsonSignal: JsonNode): HistoryRequestStartedSignal =
|
||||
result = HistoryRequestStartedSignal()
|
||||
result.signalType = SignalType.HistoryRequestStarted
|
||||
result.requestId = jsonSignal["event"]{"requestId"}.getStr()
|
||||
result.numBatches = jsonSIgnal["event"]{"numBatches"}.getInt()
|
||||
|
||||
proc fromEvent*(T: type HistoryRequestBatchProcessedSignal, jsonSignal: JsonNode): HistoryRequestBatchProcessedSignal =
|
||||
result = HistoryRequestBatchProcessedSignal()
|
||||
result.signalType = SignalType.HistoryRequestBatchProcessed
|
||||
result.requestId = jsonSignal["event"]{"requestId"}.getStr()
|
||||
result.batchIndex = jsonSIgnal["event"]{"batchIndex"}.getInt()
|
||||
result.numBatches = jsonSIgnal["event"]{"numBatches"}.getInt()
|
||||
|
||||
proc fromEvent*(T: type HistoryRequestCompletedSignal, jsonSignal: JsonNode): HistoryRequestCompletedSignal =
|
||||
result = HistoryRequestCompletedSignal()
|
||||
result.signalType = SignalType.HistoryRequestCompleted
|
||||
result.requestId = jsonSignal["event"]{"requestId"}.getStr()
|
||||
|
||||
proc fromEvent*(T: type HistoryRequestFailedSignal, jsonSignal: JsonNode): HistoryRequestFailedSignal =
|
||||
result = HistoryRequestFailedSignal()
|
||||
result.signalType = SignalType.HistoryRequestStarted
|
||||
result.requestId = jsonSignal["event"]{"requestId"}.getStr()
|
||||
if jsonSignal["event"].kind != JNull:
|
||||
result.errorMessage = jsonSignal["event"]{"errorMessage"}.getStr()
|
||||
result.error = result.errorMessage != ""
|
||||
|
|
|
@ -25,6 +25,7 @@ type SignalType* {.pure.} = enum
|
|||
HistoryRequestStarted = "history.request.started"
|
||||
HistoryRequestCompleted = "history.request.completed"
|
||||
HistoryRequestFailed = "history.request.failed"
|
||||
HistoryRequestBatchProcessed = "history.request.batch.processed"
|
||||
KeycardConnected = "keycard.connected"
|
||||
Unknown
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ proc delete*(peer: string) =
|
|||
|
||||
proc requestAllHistoricMessages*(): string =
|
||||
result = callPrivateRPC("requestAllHistoricMessages".prefix, %*[])
|
||||
info "requestAllHistoricMessages", topics="mailserver-interaction", rpc_method="mailservers_requestAllHistoricMessages", result
|
||||
info "requestAllHistoricMessages", topics="mailserver-interaction", rpc_method="mailservers_requestAllHistoricMessages"
|
||||
|
||||
proc requestStoreMessages*(topics: seq[string], symKeyID: string, peer: string, numberOfMessages: int, fromTimestamp: int64 = 0, toTimestamp: int64 = 0, force: bool = false) =
|
||||
var toValue = times.toUnix(times.getTime())
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit d35e0a339ddfdee0e52e2f6d5859302c7ec54dc6
|
||||
Subproject commit 7440c184c0e8fbb3ad88803ae66c87a9c32bf962
|
Loading…
Reference in New Issue