mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-11-10 11:47:24 +01:00
Adds an isValid function to all commands so we can check before sending
This commit is contained in:
@@ -27,6 +27,8 @@ class AuthCmd(
|
||||
) : Command {
|
||||
override fun label(): String = LABEL
|
||||
|
||||
override fun isValid() = true
|
||||
|
||||
companion object {
|
||||
const val LABEL = "AUTH"
|
||||
}
|
||||
|
||||
@@ -25,6 +25,8 @@ class CloseCmd(
|
||||
) : Command {
|
||||
override fun label(): String = LABEL
|
||||
|
||||
override fun isValid() = subId.isNotEmpty()
|
||||
|
||||
companion object {
|
||||
const val LABEL = "CLOSE"
|
||||
}
|
||||
|
||||
@@ -24,4 +24,6 @@ import com.vitorpamplona.quartz.nip01Core.core.OptimizedSerializable
|
||||
|
||||
interface Command : OptimizedSerializable {
|
||||
fun label(): String
|
||||
|
||||
fun isValid(): Boolean
|
||||
}
|
||||
|
||||
@@ -28,6 +28,8 @@ class CountCmd(
|
||||
) : Command {
|
||||
override fun label(): String = LABEL
|
||||
|
||||
override fun isValid() = subId.isNotEmpty() && filters.isNotEmpty()
|
||||
|
||||
companion object {
|
||||
const val LABEL = "COUNT"
|
||||
}
|
||||
|
||||
@@ -27,6 +27,8 @@ class EventCmd(
|
||||
) : Command {
|
||||
override fun label(): String = LABEL
|
||||
|
||||
override fun isValid() = true
|
||||
|
||||
companion object {
|
||||
const val LABEL = "EVENT"
|
||||
}
|
||||
|
||||
@@ -28,6 +28,8 @@ class ReqCmd(
|
||||
) : Command {
|
||||
override fun label(): String = LABEL
|
||||
|
||||
override fun isValid() = subId.isNotEmpty() && filters.isNotEmpty()
|
||||
|
||||
companion object {
|
||||
const val LABEL = "REQ"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user