mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-11-10 19:06:38 +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 {
|
) : Command {
|
||||||
override fun label(): String = LABEL
|
override fun label(): String = LABEL
|
||||||
|
|
||||||
|
override fun isValid() = true
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val LABEL = "AUTH"
|
const val LABEL = "AUTH"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ class CloseCmd(
|
|||||||
) : Command {
|
) : Command {
|
||||||
override fun label(): String = LABEL
|
override fun label(): String = LABEL
|
||||||
|
|
||||||
|
override fun isValid() = subId.isNotEmpty()
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val LABEL = "CLOSE"
|
const val LABEL = "CLOSE"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,4 +24,6 @@ import com.vitorpamplona.quartz.nip01Core.core.OptimizedSerializable
|
|||||||
|
|
||||||
interface Command : OptimizedSerializable {
|
interface Command : OptimizedSerializable {
|
||||||
fun label(): String
|
fun label(): String
|
||||||
|
|
||||||
|
fun isValid(): Boolean
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ class CountCmd(
|
|||||||
) : Command {
|
) : Command {
|
||||||
override fun label(): String = LABEL
|
override fun label(): String = LABEL
|
||||||
|
|
||||||
|
override fun isValid() = subId.isNotEmpty() && filters.isNotEmpty()
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val LABEL = "COUNT"
|
const val LABEL = "COUNT"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ class EventCmd(
|
|||||||
) : Command {
|
) : Command {
|
||||||
override fun label(): String = LABEL
|
override fun label(): String = LABEL
|
||||||
|
|
||||||
|
override fun isValid() = true
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val LABEL = "EVENT"
|
const val LABEL = "EVENT"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ class ReqCmd(
|
|||||||
) : Command {
|
) : Command {
|
||||||
override fun label(): String = LABEL
|
override fun label(): String = LABEL
|
||||||
|
|
||||||
|
override fun isValid() = subId.isNotEmpty() && filters.isNotEmpty()
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val LABEL = "REQ"
|
const val LABEL = "REQ"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user