mars

package
v0.3.22 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type Board added in v0.3.19

type Board string
const (
	BoardTharsis Board = "tharsis"
	BoardHellas  Board = "hellas"
	BoardElysium Board = "elysium"
)

type Config added in v0.3.5

type Config struct {
	BaseURL       *url.URL
	PublicBaseURL *url.URL
}

type CreateGameRequest

type CreateGameRequest struct {
	Players  []NewPlayer
	Settings GameSettings
}

type CreateGameResponse

type CreateGameResponse struct {
	Id          string
	SpectatorId string
	Players     []NewPlayer
	PurgeDate   time.Time
}

type GameSettings added in v0.3.19

type GameSettings struct {
	Board        Board
	CorporateEra bool
	Prelude      bool
	VenusNext    bool
	SolarPhase   bool
}

type GetGameModel added in v0.3.2

type GetGameModel struct {
	HasFinished bool
	Players     []GetGamePlayer
}

type GetGamePlayer added in v0.3.2

type GetGamePlayer struct {
	Id          string
	MegaCredits int
	Score       int
}

type GetGameRequest added in v0.3.2

type GetGameRequest struct {
	SpectatorId string
}

type GetGameResponse added in v0.3.2

type GetGameResponse struct {
	Game GetGameModel
	Raw  map[string]any
}

func GetGameResponseFromRaw added in v0.3.2

func GetGameResponseFromRaw(raw map[string]any) (GetGameResponse, error)

type NewPlayer

type NewPlayer struct {
	Id    string
	Name  string
	Color storage.Color
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(cfg Config, client *http.Client) (*Service, error)

func (*Service) CreateGame

func (s *Service) CreateGame(ctx context.Context, game CreateGameRequest) (CreateGameResponse, error)

func (*Service) GetGame added in v0.3.2

func (s *Service) GetGame(ctx context.Context, req GetGameRequest) (GetGameResponse, error)

func (*Service) GetPlayerUrl

func (s *Service) GetPlayerUrl(playerId string) string

func (*Service) WaitingFor

func (s *Service) WaitingFor(ctx context.Context, req WaitingForRequest) (WaitingForResponse, error)

type WaitingForRequest

type WaitingForRequest struct {
	PlayerId string
}

type WaitingForResponse

type WaitingForResponse struct {
	Colors []storage.Color
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL