nostr: add is_{read,write} helpers on requests

This will be handy in the future when we properly filter relay lists by
RelayInfo
This commit is contained in:
William Casarin
2023-05-09 18:38:07 -07:00
parent 23aab6710a
commit 1da0a8ee52

View File

@@ -16,4 +16,19 @@ enum NostrRequest {
case subscribe(NostrSubscribe)
case unsubscribe(String)
case event(NostrEvent)
var is_write: Bool {
switch self {
case .subscribe:
return false
case .unsubscribe:
return false
case .event:
return true
}
}
var is_read: Bool {
return !is_write
}
}