feat: http router, command api

This commit is contained in:
Ilia Denisov
2026-01-07 13:52:20 +02:00
parent c9ed52b268
commit 1b0ab7a079
9 changed files with 404 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
package rest
/*
Full list of requirements must be updated when adding new command:
required_without_all=Vote DeclarePeace DeclareWar
| excluded_with=Vote DeclarePeace DeclareWar
*/
type Command struct {
Race string `json:"race" binding:"required,notblank"`
Vote *CommandVote `json:"vote" binding:"required_without_all=DeclarePeace DeclareWar,excluded_with=DeclarePeace DeclareWar"`
DeclarePeace *CommandDeclarePeace `json:"declarePeace" binding:"required_without_all=Vote DeclareWar,excluded_with=Vote DeclareWar"`
DeclareWar *CommandDeclareWar `json:"declareWar" binding:"required_without_all=Vote DeclarePeace,excluded_with=Vote DeclarePeace"`
}
type CommandVote struct {
Recipient string `json:"recipient" binding:"required,notblank"`
}
type CommandDeclarePeace struct {
Opponent string `json:"recipient" binding:"required,notblank"`
}
type CommandDeclareWar struct {
Opponent string `json:"recipient" binding:"required,notblank"`
}