51 lines
1.9 KiB
Go
51 lines
1.9 KiB
Go
package rest
|
|
|
|
import "encoding/json"
|
|
|
|
type Command struct {
|
|
Actor string `json:"actor" binding:"required,notblank"`
|
|
Commands []json.RawMessage `json:"cmd" binding:"min=1"`
|
|
}
|
|
|
|
type CommandType string
|
|
|
|
const (
|
|
CommandTypeQuit CommandType = "quit"
|
|
CommandTypeVote CommandType = "vote"
|
|
CommandTypeRelation CommandType = "declarePeace"
|
|
CommandShipClassCreate CommandType = "shipClassCreate"
|
|
CommandShipClassMerge CommandType = "shipClassMerge"
|
|
CommandShipClassRemove CommandType = "shipClassRemove"
|
|
CommandShipGroupLoad CommandType = "shipGroupLoad"
|
|
CommandShipGroupUnload CommandType = "shipGroupUnload"
|
|
CommandShipGroupSend CommandType = "shipGroupSend"
|
|
CommandShipGroupUpgrade CommandType = "shipGroupUpgrade"
|
|
CommandShipGroupMerge CommandType = "shipGroupMerge"
|
|
CommandShipGroupDismantle CommandType = "shipGroupDismantle"
|
|
CommandShipGroupTransfer CommandType = "shipGroupTransfer"
|
|
CommandTypeShipGroupJoinFleet CommandType = "shipGroupJoinFleet"
|
|
CommandTypeFleetMerge CommandType = "fleetMerge"
|
|
CommandTypeFleetSend CommandType = "fleetSend"
|
|
CommandTypeScienceCreate CommandType = "scienceCreate"
|
|
CommandTypeScienceRemove CommandType = "scienceRemove"
|
|
CommandTypePlanetRename CommandType = "planetRename"
|
|
CommandTypePlanetProduce CommandType = "planetProduce"
|
|
CommandTypePlanetRouteSet CommandType = "planetRouteSet"
|
|
CommandTypePlanetRouteRemove CommandType = "planetRouteRemove"
|
|
)
|
|
|
|
type CommandMeta struct {
|
|
Type CommandType `json:"@type"`
|
|
}
|
|
|
|
type CommandVote struct {
|
|
CommandMeta
|
|
Recipient string `json:"recipient" binding:"required,notblank"`
|
|
}
|
|
|
|
type CommandUpdateRelation struct {
|
|
CommandMeta
|
|
Opponent string `json:"recipient" binding:"required,notblank"`
|
|
Relation string `json:"relation" binding:"required,notblank"`
|
|
}
|