Scontrini-TUI-Client/api/json_structs.go

38 lines
619 B
Go

package api
/**
* Commands to give to the API
*/
type JSONCommand interface {
PrintCommand | PizzaCommand | GetPizzasCommand
}
type PrintCommand struct {
Command string `json:"command"`
Text string `json:"text"`
}
type PizzaCommand struct {
Command string `json:"command"`
Pizzas []Pizza `json:"pizzas"`
}
type GetPizzasCommand struct {
Command string `json:"command"`
}
/**
* What to receive from the API
*/
type JSONReceived interface {
ReceivePizzas | ReceivePrice
}
type ReceivePizzas struct {
Pizzas []Pizza `json:"pizzas"`
}
type ReceivePrice struct {
TotalPrice int `json:"total_price"`
}