package rest import "encoding/json" type Command struct { Actor string `json:"actor" binding:"notblank"` // Commands carries the engine-bound payload for either the // command (`PUT /api/v1/command`, immediate) or the order // (`PUT /api/v1/order`, validate-and-store) path. The order // path treats an empty array as "the player has no orders for // this turn" and stores it. The command handler still rejects // an empty array by hand because immediate execution of a // no-op makes no sense. Commands []json.RawMessage `json:"cmd"` } func (o Command) MarshalBinary() (data []byte, err error) { return json.Marshal(&o) } func (o *Command) UnmarshalBinary(data []byte) error { return json.Unmarshal(data, o) }