feat: http router, command api
This commit is contained in:
@@ -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"`
|
||||
}
|
||||
Reference in New Issue
Block a user