@@ -0,0 +1,16 @@
|
||||
package rest
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
type Command struct {
|
||||
Actor string `json:"actor" binding:"notblank"`
|
||||
Commands []json.RawMessage `json:"cmd" binding:"min=1"`
|
||||
}
|
||||
|
||||
func (o Command) MarshalBinary() (data []byte, err error) {
|
||||
return json.Marshal(&o)
|
||||
}
|
||||
|
||||
func (o *Command) UnmarshalBinary(data []byte) error {
|
||||
return json.Unmarshal(data, o)
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package rest
|
||||
|
||||
type Init struct {
|
||||
Races []Race `json:"races" binding:"required,gte=10"`
|
||||
}
|
||||
|
||||
type Race struct {
|
||||
Name string `json:"name" binding:"required,notblank"`
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package rest
|
||||
|
||||
import "github.com/google/uuid"
|
||||
|
||||
type StateResponse struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
Turn uint `json:"turn"`
|
||||
Stage uint `json:"stage"`
|
||||
Players []PlayerState `json:"player"`
|
||||
}
|
||||
|
||||
type PlayerState struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Extinct bool `json:"extinct"`
|
||||
}
|
||||
Reference in New Issue
Block a user