baldaapi

package
v0.0.0-...-9cefb10 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2026 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Overview

Code generated by ogen, DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRolesForAPIKeyHeader

func GetRolesForAPIKeyHeader(operation string) []string

GetRolesForAPIKeyHeader returns the required roles for the given operation.

This is useful for authorization scenarios where you need to know which roles are required for an operation.

Example:

requiredRoles := GetRolesForAPIKeyHeader(AddPetOperation)

Returns nil if the operation has no role requirements or if the operation is unknown.

func GetRolesForAPIKeyQueryParam

func GetRolesForAPIKeyQueryParam(operation string) []string

GetRolesForAPIKeyQueryParam returns the required roles for the given operation.

This is useful for authorization scenarios where you need to know which roles are required for an operation.

Example:

requiredRoles := GetRolesForAPIKeyQueryParam(AddPetOperation)

Returns nil if the operation has no role requirements or if the operation is unknown.

func WithServerURL

func WithServerURL(ctx context.Context, u *url.URL) context.Context

WithServerURL sets context key to override server URL.

Types

type APIKeyHeader

type APIKeyHeader struct {
	APIKey string
	Roles  []string
}

func (*APIKeyHeader) GetAPIKey

func (s *APIKeyHeader) GetAPIKey() string

GetAPIKey returns the value of APIKey.

func (*APIKeyHeader) GetRoles

func (s *APIKeyHeader) GetRoles() []string

GetRoles returns the value of Roles.

func (*APIKeyHeader) SetAPIKey

func (s *APIKeyHeader) SetAPIKey(val string)

SetAPIKey sets the value of APIKey.

func (*APIKeyHeader) SetRoles

func (s *APIKeyHeader) SetRoles(val []string)

SetRoles sets the value of Roles.

type APIKeyQueryParam

type APIKeyQueryParam struct {
	APIKey string
	Roles  []string
}

func (*APIKeyQueryParam) GetAPIKey

func (s *APIKeyQueryParam) GetAPIKey() string

GetAPIKey returns the value of APIKey.

func (*APIKeyQueryParam) GetRoles

func (s *APIKeyQueryParam) GetRoles() []string

GetRoles returns the value of Roles.

func (*APIKeyQueryParam) SetAPIKey

func (s *APIKeyQueryParam) SetAPIKey(val string)

SetAPIKey sets the value of APIKey.

func (*APIKeyQueryParam) SetRoles

func (s *APIKeyQueryParam) SetRoles(val []string)

SetRoles sets the value of Roles.

type AuthRequest

type AuthRequest struct {
	// User's email.
	Email string `json:"email"`
	// User's password.
	Password string `json:"password"`
}

Ref: #/components/schemas/AuthRequest

func (*AuthRequest) Decode

func (s *AuthRequest) Decode(d *jx.Decoder) error

Decode decodes AuthRequest from json.

func (*AuthRequest) Encode

func (s *AuthRequest) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*AuthRequest) GetEmail

func (s *AuthRequest) GetEmail() string

GetEmail returns the value of Email.

func (*AuthRequest) GetPassword

func (s *AuthRequest) GetPassword() string

GetPassword returns the value of Password.

func (*AuthRequest) MarshalJSON

func (s *AuthRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*AuthRequest) SetEmail

func (s *AuthRequest) SetEmail(val string)

SetEmail sets the value of Email.

func (*AuthRequest) SetPassword

func (s *AuthRequest) SetPassword(val string)

SetPassword sets the value of Password.

func (*AuthRequest) UnmarshalJSON

func (s *AuthRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type AuthRes

type AuthRes interface {
	// contains filtered or unexported methods
}

type AuthResponse

type AuthResponse struct {
	Player OptPlayer `json:"player"`
	// JWT for connecting to the Centrifugo WebSocket.
	CentrifugoToken OptString `json:"centrifugo_token"`
	// Centrifugo subscription JWT for the lobby channel.
	LobbyToken OptString `json:"lobby_token"`
}

Ref: #/components/schemas/AuthResponse

func (*AuthResponse) Decode

func (s *AuthResponse) Decode(d *jx.Decoder) error

Decode decodes AuthResponse from json.

func (*AuthResponse) Encode

func (s *AuthResponse) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*AuthResponse) GetCentrifugoToken

func (s *AuthResponse) GetCentrifugoToken() OptString

GetCentrifugoToken returns the value of CentrifugoToken.

func (*AuthResponse) GetLobbyToken

func (s *AuthResponse) GetLobbyToken() OptString

GetLobbyToken returns the value of LobbyToken.

func (*AuthResponse) GetPlayer

func (s *AuthResponse) GetPlayer() OptPlayer

GetPlayer returns the value of Player.

func (*AuthResponse) MarshalJSON

func (s *AuthResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*AuthResponse) SetCentrifugoToken

func (s *AuthResponse) SetCentrifugoToken(val OptString)

SetCentrifugoToken sets the value of CentrifugoToken.

func (*AuthResponse) SetLobbyToken

func (s *AuthResponse) SetLobbyToken(val OptString)

SetLobbyToken sets the value of LobbyToken.

func (*AuthResponse) SetPlayer

func (s *AuthResponse) SetPlayer(val OptPlayer)

SetPlayer sets the value of Player.

func (*AuthResponse) UnmarshalJSON

func (s *AuthResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type BoardCell

type BoardCell struct {
	Row int `json:"row"`
	Col int `json:"col"`
}

Ref: #/components/schemas/BoardCell

func (*BoardCell) Decode

func (s *BoardCell) Decode(d *jx.Decoder) error

Decode decodes BoardCell from json.

func (*BoardCell) Encode

func (s *BoardCell) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*BoardCell) GetCol

func (s *BoardCell) GetCol() int

GetCol returns the value of Col.

func (*BoardCell) GetRow

func (s *BoardCell) GetRow() int

GetRow returns the value of Row.

func (*BoardCell) MarshalJSON

func (s *BoardCell) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*BoardCell) SetCol

func (s *BoardCell) SetCol(val int)

SetCol sets the value of Col.

func (*BoardCell) SetRow

func (s *BoardCell) SetRow(val int)

SetRow sets the value of Row.

func (*BoardCell) UnmarshalJSON

func (s *BoardCell) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*BoardCell) Validate

func (s *BoardCell) Validate() error

type Client

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

Client implements OAS client.

func NewClient

func NewClient(serverURL string, sec SecuritySource, opts ...ClientOption) (*Client, error)

NewClient initializes new Client defined by OAS.

func (*Client) Auth

func (c *Client) Auth(ctx context.Context, request *AuthRequest) (AuthRes, error)

Auth invokes auth operation.

Auth request.

POST /auth

func (*Client) CreateGame

func (c *Client) CreateGame(ctx context.Context, params CreateGameParams) (CreateGameRes, error)

CreateGame invokes createGame operation.

Create a new game.

POST /games

func (*Client) GetPlayerStateUID

func (c *Client) GetPlayerStateUID(ctx context.Context, params GetPlayerStateUIDParams) (GetPlayerStateUIDRes, error)

GetPlayerStateUID invokes getPlayerStateUID operation.

Get user state.

GET /player/state/{uid}

func (*Client) JoinGame

func (c *Client) JoinGame(ctx context.Context, params JoinGameParams) (JoinGameRes, error)

JoinGame invokes joinGame operation.

Adds the authenticated player to the specified waiting game. When the second player joins (quorum of 2 is reached) the game transitions to in_progress and the first move belongs to the player who created the game.

POST /games/{id}/join

func (*Client) ListGames

func (c *Client) ListGames(ctx context.Context, params ListGamesParams) (ListGamesRes, error)

ListGames invokes listGames operation.

Returns a snapshot of all currently active games.

GET /games

func (*Client) MoveGame

func (c *Client) MoveGame(ctx context.Context, request *MoveRequest, params MoveGameParams) (MoveGameRes, error)

MoveGame invokes moveGame operation.

Places a new letter on the board and submits a word. If the word is valid, the player's score is updated and the turn passes to the opponent.

POST /games/{id}/move

func (*Client) Ping

func (c *Client) Ping(ctx context.Context, params PingParams) (PingRes, error)

Ping invokes ping operation.

POST not GET — mutates session TTL. Returns 204 with X-Server-Time header instead of a JSON body to minimize bandwidth on frequent pings (every ping_delay ms).

POST /session/ping

func (*Client) Signup

func (c *Client) Signup(ctx context.Context, request *SignupRequest) (SignupRes, error)

Signup invokes signup operation.

Sign-up request.

POST /signup

func (*Client) SkipGame

func (c *Client) SkipGame(ctx context.Context, params SkipGameParams) (SkipGameRes, error)

SkipGame invokes skipGame operation.

Ends the current turn without making a move. The turn passes to the opponent.

POST /games/{id}/skip

type ClientOption

type ClientOption interface {
	// contains filtered or unexported methods
}

ClientOption is client config option.

func WithClient

func WithClient(client ht.Client) ClientOption

WithClient specifies http client to use.

type CreateGameParams

type CreateGameParams struct {
	XAPISession string
}

CreateGameParams is parameters of createGame operation.

type CreateGameRes

type CreateGameRes interface {
	// contains filtered or unexported methods
}

type CreateGameResponse

type CreateGameResponse struct {
	Game OptGameSummary `json:"game"`
	// Centrifugo subscription JWT for the game channel.
	GameToken OptString `json:"game_token"`
}

Ref: #/components/schemas/CreateGameResponse

func (*CreateGameResponse) Decode

func (s *CreateGameResponse) Decode(d *jx.Decoder) error

Decode decodes CreateGameResponse from json.

func (*CreateGameResponse) Encode

func (s *CreateGameResponse) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*CreateGameResponse) GetGame

func (s *CreateGameResponse) GetGame() OptGameSummary

GetGame returns the value of Game.

func (*CreateGameResponse) GetGameToken

func (s *CreateGameResponse) GetGameToken() OptString

GetGameToken returns the value of GameToken.

func (*CreateGameResponse) MarshalJSON

func (s *CreateGameResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*CreateGameResponse) SetGame

func (s *CreateGameResponse) SetGame(val OptGameSummary)

SetGame sets the value of Game.

func (*CreateGameResponse) SetGameToken

func (s *CreateGameResponse) SetGameToken(val OptString)

SetGameToken sets the value of GameToken.

func (*CreateGameResponse) UnmarshalJSON

func (s *CreateGameResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*CreateGameResponse) Validate

func (s *CreateGameResponse) Validate() error

type ErrorHandler

type ErrorHandler = ogenerrors.ErrorHandler

ErrorHandler is error handler.

type ErrorResponse

type ErrorResponse struct {
	// The HTTP response code.
	Status OptInt `json:"status"`
	// A human-readable explanation of the error.
	Message OptString `json:"message"`
	// Type of the error message.
	Type OptString `json:"type"`
}

Ref: #/components/schemas/ErrorResponse

func (*ErrorResponse) Decode

func (s *ErrorResponse) Decode(d *jx.Decoder) error

Decode decodes ErrorResponse from json.

func (*ErrorResponse) Encode

func (s *ErrorResponse) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*ErrorResponse) GetMessage

func (s *ErrorResponse) GetMessage() OptString

GetMessage returns the value of Message.

func (*ErrorResponse) GetStatus

func (s *ErrorResponse) GetStatus() OptInt

GetStatus returns the value of Status.

func (*ErrorResponse) GetType

func (s *ErrorResponse) GetType() OptString

GetType returns the value of Type.

func (*ErrorResponse) MarshalJSON

func (s *ErrorResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*ErrorResponse) SetMessage

func (s *ErrorResponse) SetMessage(val OptString)

SetMessage sets the value of Message.

func (*ErrorResponse) SetStatus

func (s *ErrorResponse) SetStatus(val OptInt)

SetStatus sets the value of Status.

func (*ErrorResponse) SetType

func (s *ErrorResponse) SetType(val OptString)

SetType sets the value of Type.

func (*ErrorResponse) UnmarshalJSON

func (s *ErrorResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type GameStatus

type GameStatus string

Current state of the game. Ref: #/components/schemas/GameStatus

const (
	GameStatusWaiting    GameStatus = "waiting"
	GameStatusInProgress GameStatus = "in_progress"
	GameStatusFinished   GameStatus = "finished"
)

func (GameStatus) AllValues

func (GameStatus) AllValues() []GameStatus

AllValues returns all GameStatus values.

func (*GameStatus) Decode

func (s *GameStatus) Decode(d *jx.Decoder) error

Decode decodes GameStatus from json.

func (GameStatus) Encode

func (s GameStatus) Encode(e *jx.Encoder)

Encode encodes GameStatus as json.

func (GameStatus) MarshalJSON

func (s GameStatus) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (GameStatus) MarshalText

func (s GameStatus) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (*GameStatus) UnmarshalJSON

func (s *GameStatus) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*GameStatus) UnmarshalText

func (s *GameStatus) UnmarshalText(data []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (GameStatus) Validate

func (s GameStatus) Validate() error

type GameSummary

type GameSummary struct {
	// Game ID.
	ID OptUUID `json:"id"`
	// IDs of players participating in the game.
	PlayerIds []uuid.UUID   `json:"player_ids"`
	Status    OptGameStatus `json:"status"`
	// When the game was started (Unix timestamp in milliseconds).
	StartedAt OptInt64 `json:"started_at"`
}

Ref: #/components/schemas/GameSummary

func (*GameSummary) Decode

func (s *GameSummary) Decode(d *jx.Decoder) error

Decode decodes GameSummary from json.

func (*GameSummary) Encode

func (s *GameSummary) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*GameSummary) GetID

func (s *GameSummary) GetID() OptUUID

GetID returns the value of ID.

func (*GameSummary) GetPlayerIds

func (s *GameSummary) GetPlayerIds() []uuid.UUID

GetPlayerIds returns the value of PlayerIds.

func (*GameSummary) GetStartedAt

func (s *GameSummary) GetStartedAt() OptInt64

GetStartedAt returns the value of StartedAt.

func (*GameSummary) GetStatus

func (s *GameSummary) GetStatus() OptGameStatus

GetStatus returns the value of Status.

func (*GameSummary) MarshalJSON

func (s *GameSummary) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*GameSummary) SetID

func (s *GameSummary) SetID(val OptUUID)

SetID sets the value of ID.

func (*GameSummary) SetPlayerIds

func (s *GameSummary) SetPlayerIds(val []uuid.UUID)

SetPlayerIds sets the value of PlayerIds.

func (*GameSummary) SetStartedAt

func (s *GameSummary) SetStartedAt(val OptInt64)

SetStartedAt sets the value of StartedAt.

func (*GameSummary) SetStatus

func (s *GameSummary) SetStatus(val OptGameStatus)

SetStatus sets the value of Status.

func (*GameSummary) UnmarshalJSON

func (s *GameSummary) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*GameSummary) Validate

func (s *GameSummary) Validate() error

type GetPlayerStateUIDParams

type GetPlayerStateUIDParams struct {
	// Player ID.
	UID uuid.UUID
}

GetPlayerStateUIDParams is parameters of getPlayerStateUID operation.

type GetPlayerStateUIDRes

type GetPlayerStateUIDRes interface {
	// contains filtered or unexported methods
}

type Handler

type Handler interface {
	// Auth implements auth operation.
	//
	// Auth request.
	//
	// POST /auth
	Auth(ctx context.Context, req *AuthRequest) (AuthRes, error)
	// CreateGame implements createGame operation.
	//
	// Create a new game.
	//
	// POST /games
	CreateGame(ctx context.Context, params CreateGameParams) (CreateGameRes, error)
	// GetPlayerStateUID implements getPlayerStateUID operation.
	//
	// Get user state.
	//
	// GET /player/state/{uid}
	GetPlayerStateUID(ctx context.Context, params GetPlayerStateUIDParams) (GetPlayerStateUIDRes, error)
	// JoinGame implements joinGame operation.
	//
	// Adds the authenticated player to the specified waiting game.
	// When the second player joins (quorum of 2 is reached) the game
	// transitions to in_progress and the first move belongs to the
	// player who created the game.
	//
	// POST /games/{id}/join
	JoinGame(ctx context.Context, params JoinGameParams) (JoinGameRes, error)
	// ListGames implements listGames operation.
	//
	// Returns a snapshot of all currently active games.
	//
	// GET /games
	ListGames(ctx context.Context, params ListGamesParams) (ListGamesRes, error)
	// MoveGame implements moveGame operation.
	//
	// Places a new letter on the board and submits a word. If the word is valid,
	// the player's score is updated and the turn passes to the opponent.
	//
	// POST /games/{id}/move
	MoveGame(ctx context.Context, req *MoveRequest, params MoveGameParams) (MoveGameRes, error)
	// Ping implements ping operation.
	//
	// POST not GET — mutates session TTL.
	// Returns 204 with X-Server-Time header instead of a JSON body
	// to minimize bandwidth on frequent pings (every ping_delay ms).
	//
	// POST /session/ping
	Ping(ctx context.Context, params PingParams) (PingRes, error)
	// Signup implements signup operation.
	//
	// Sign-up request.
	//
	// POST /signup
	Signup(ctx context.Context, req *SignupRequest) (SignupRes, error)
	// SkipGame implements skipGame operation.
	//
	// Ends the current turn without making a move. The turn passes to the opponent.
	//
	// POST /games/{id}/skip
	SkipGame(ctx context.Context, params SkipGameParams) (SkipGameRes, error)
}

Handler handles operations described by OpenAPI v3 specification.

type Invoker

type Invoker interface {
	// Auth invokes auth operation.
	//
	// Auth request.
	//
	// POST /auth
	Auth(ctx context.Context, request *AuthRequest) (AuthRes, error)
	// CreateGame invokes createGame operation.
	//
	// Create a new game.
	//
	// POST /games
	CreateGame(ctx context.Context, params CreateGameParams) (CreateGameRes, error)
	// GetPlayerStateUID invokes getPlayerStateUID operation.
	//
	// Get user state.
	//
	// GET /player/state/{uid}
	GetPlayerStateUID(ctx context.Context, params GetPlayerStateUIDParams) (GetPlayerStateUIDRes, error)
	// JoinGame invokes joinGame operation.
	//
	// Adds the authenticated player to the specified waiting game.
	// When the second player joins (quorum of 2 is reached) the game
	// transitions to in_progress and the first move belongs to the
	// player who created the game.
	//
	// POST /games/{id}/join
	JoinGame(ctx context.Context, params JoinGameParams) (JoinGameRes, error)
	// ListGames invokes listGames operation.
	//
	// Returns a snapshot of all currently active games.
	//
	// GET /games
	ListGames(ctx context.Context, params ListGamesParams) (ListGamesRes, error)
	// MoveGame invokes moveGame operation.
	//
	// Places a new letter on the board and submits a word. If the word is valid,
	// the player's score is updated and the turn passes to the opponent.
	//
	// POST /games/{id}/move
	MoveGame(ctx context.Context, request *MoveRequest, params MoveGameParams) (MoveGameRes, error)
	// Ping invokes ping operation.
	//
	// POST not GET — mutates session TTL.
	// Returns 204 with X-Server-Time header instead of a JSON body
	// to minimize bandwidth on frequent pings (every ping_delay ms).
	//
	// POST /session/ping
	Ping(ctx context.Context, params PingParams) (PingRes, error)
	// Signup invokes signup operation.
	//
	// Sign-up request.
	//
	// POST /signup
	Signup(ctx context.Context, request *SignupRequest) (SignupRes, error)
	// SkipGame invokes skipGame operation.
	//
	// Ends the current turn without making a move. The turn passes to the opponent.
	//
	// POST /games/{id}/skip
	SkipGame(ctx context.Context, params SkipGameParams) (SkipGameRes, error)
}

Invoker invokes operations described by OpenAPI v3 specification.

type JoinGameConflict

type JoinGameConflict ErrorResponse

func (*JoinGameConflict) Decode

func (s *JoinGameConflict) Decode(d *jx.Decoder) error

Decode decodes JoinGameConflict from json.

func (*JoinGameConflict) Encode

func (s *JoinGameConflict) Encode(e *jx.Encoder)

Encode encodes JoinGameConflict as json.

func (*JoinGameConflict) MarshalJSON

func (s *JoinGameConflict) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*JoinGameConflict) UnmarshalJSON

func (s *JoinGameConflict) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type JoinGameNotFound

type JoinGameNotFound ErrorResponse

func (*JoinGameNotFound) Decode

func (s *JoinGameNotFound) Decode(d *jx.Decoder) error

Decode decodes JoinGameNotFound from json.

func (*JoinGameNotFound) Encode

func (s *JoinGameNotFound) Encode(e *jx.Encoder)

Encode encodes JoinGameNotFound as json.

func (*JoinGameNotFound) MarshalJSON

func (s *JoinGameNotFound) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*JoinGameNotFound) UnmarshalJSON

func (s *JoinGameNotFound) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type JoinGameParams

type JoinGameParams struct {
	XAPISession string
	// ID of the game to join.
	ID uuid.UUID
}

JoinGameParams is parameters of joinGame operation.

type JoinGameRes

type JoinGameRes interface {
	// contains filtered or unexported methods
}

type JoinGameResponse

type JoinGameResponse struct {
	Game OptGameSummary `json:"game"`
	// Centrifugo subscription JWT for the game channel.
	GameToken OptString `json:"game_token"`
	// Initial 5x5 board state. Each row is an array of 5 single-character strings
	// (empty string means empty cell). Included so the joining player can render
	// the board immediately without waiting for the Centrifugo game_state event.
	Board [][]string `json:"board"`
	// ID of the player whose turn it is first (the game creator).
	CurrentTurnUID OptString `json:"current_turn_uid"`
}

Ref: #/components/schemas/JoinGameResponse

func (*JoinGameResponse) Decode

func (s *JoinGameResponse) Decode(d *jx.Decoder) error

Decode decodes JoinGameResponse from json.

func (*JoinGameResponse) Encode

func (s *JoinGameResponse) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*JoinGameResponse) GetBoard

func (s *JoinGameResponse) GetBoard() [][]string

GetBoard returns the value of Board.

func (*JoinGameResponse) GetCurrentTurnUID

func (s *JoinGameResponse) GetCurrentTurnUID() OptString

GetCurrentTurnUID returns the value of CurrentTurnUID.

func (*JoinGameResponse) GetGame

func (s *JoinGameResponse) GetGame() OptGameSummary

GetGame returns the value of Game.

func (*JoinGameResponse) GetGameToken

func (s *JoinGameResponse) GetGameToken() OptString

GetGameToken returns the value of GameToken.

func (*JoinGameResponse) MarshalJSON

func (s *JoinGameResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*JoinGameResponse) SetBoard

func (s *JoinGameResponse) SetBoard(val [][]string)

SetBoard sets the value of Board.

func (*JoinGameResponse) SetCurrentTurnUID

func (s *JoinGameResponse) SetCurrentTurnUID(val OptString)

SetCurrentTurnUID sets the value of CurrentTurnUID.

func (*JoinGameResponse) SetGame

func (s *JoinGameResponse) SetGame(val OptGameSummary)

SetGame sets the value of Game.

func (*JoinGameResponse) SetGameToken

func (s *JoinGameResponse) SetGameToken(val OptString)

SetGameToken sets the value of GameToken.

func (*JoinGameResponse) UnmarshalJSON

func (s *JoinGameResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*JoinGameResponse) Validate

func (s *JoinGameResponse) Validate() error

type JoinGameUnauthorized

type JoinGameUnauthorized ErrorResponse

func (*JoinGameUnauthorized) Decode

func (s *JoinGameUnauthorized) Decode(d *jx.Decoder) error

Decode decodes JoinGameUnauthorized from json.

func (*JoinGameUnauthorized) Encode

func (s *JoinGameUnauthorized) Encode(e *jx.Encoder)

Encode encodes JoinGameUnauthorized as json.

func (*JoinGameUnauthorized) MarshalJSON

func (s *JoinGameUnauthorized) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*JoinGameUnauthorized) UnmarshalJSON

func (s *JoinGameUnauthorized) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type Labeler

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

Labeler is used to allow adding custom attributes to the server request metrics.

func LabelerFromContext

func LabelerFromContext(ctx context.Context) (*Labeler, bool)

LabelerFromContext retrieves the Labeler from the provided context, if present.

If no Labeler was found in the provided context a new, empty Labeler is returned and the second return value is false. In this case it is safe to use the Labeler but any attributes added to it will not be used.

func (*Labeler) Add

func (l *Labeler) Add(attrs ...attribute.KeyValue)

Add attributes to the Labeler.

func (*Labeler) AttributeSet

func (l *Labeler) AttributeSet() attribute.Set

AttributeSet returns the attributes added to the Labeler as an attribute.Set.

type ListGamesParams

type ListGamesParams struct {
	XAPISession string
}

ListGamesParams is parameters of listGames operation.

type ListGamesRes

type ListGamesRes interface {
	// contains filtered or unexported methods
}

type ListGamesResponse

type ListGamesResponse struct {
	Games []GameSummary `json:"games"`
}

Ref: #/components/schemas/ListGamesResponse

func (*ListGamesResponse) Decode

func (s *ListGamesResponse) Decode(d *jx.Decoder) error

Decode decodes ListGamesResponse from json.

func (*ListGamesResponse) Encode

func (s *ListGamesResponse) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*ListGamesResponse) GetGames

func (s *ListGamesResponse) GetGames() []GameSummary

GetGames returns the value of Games.

func (*ListGamesResponse) MarshalJSON

func (s *ListGamesResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*ListGamesResponse) SetGames

func (s *ListGamesResponse) SetGames(val []GameSummary)

SetGames sets the value of Games.

func (*ListGamesResponse) UnmarshalJSON

func (s *ListGamesResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*ListGamesResponse) Validate

func (s *ListGamesResponse) Validate() error

type Middleware

type Middleware = middleware.Middleware

Middleware is middleware type.

type MoveGameBadRequest

type MoveGameBadRequest ErrorResponse

func (*MoveGameBadRequest) Decode

func (s *MoveGameBadRequest) Decode(d *jx.Decoder) error

Decode decodes MoveGameBadRequest from json.

func (*MoveGameBadRequest) Encode

func (s *MoveGameBadRequest) Encode(e *jx.Encoder)

Encode encodes MoveGameBadRequest as json.

func (*MoveGameBadRequest) MarshalJSON

func (s *MoveGameBadRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*MoveGameBadRequest) UnmarshalJSON

func (s *MoveGameBadRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type MoveGameConflict

type MoveGameConflict ErrorResponse

func (*MoveGameConflict) Decode

func (s *MoveGameConflict) Decode(d *jx.Decoder) error

Decode decodes MoveGameConflict from json.

func (*MoveGameConflict) Encode

func (s *MoveGameConflict) Encode(e *jx.Encoder)

Encode encodes MoveGameConflict as json.

func (*MoveGameConflict) MarshalJSON

func (s *MoveGameConflict) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*MoveGameConflict) UnmarshalJSON

func (s *MoveGameConflict) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type MoveGameNotFound

type MoveGameNotFound ErrorResponse

func (*MoveGameNotFound) Decode

func (s *MoveGameNotFound) Decode(d *jx.Decoder) error

Decode decodes MoveGameNotFound from json.

func (*MoveGameNotFound) Encode

func (s *MoveGameNotFound) Encode(e *jx.Encoder)

Encode encodes MoveGameNotFound as json.

func (*MoveGameNotFound) MarshalJSON

func (s *MoveGameNotFound) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*MoveGameNotFound) UnmarshalJSON

func (s *MoveGameNotFound) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type MoveGameParams

type MoveGameParams struct {
	XAPISession string
	// ID of the game.
	ID uuid.UUID
}

MoveGameParams is parameters of moveGame operation.

type MoveGameRes

type MoveGameRes interface {
	// contains filtered or unexported methods
}

type MoveGameUnauthorized

type MoveGameUnauthorized ErrorResponse

func (*MoveGameUnauthorized) Decode

func (s *MoveGameUnauthorized) Decode(d *jx.Decoder) error

Decode decodes MoveGameUnauthorized from json.

func (*MoveGameUnauthorized) Encode

func (s *MoveGameUnauthorized) Encode(e *jx.Encoder)

Encode encodes MoveGameUnauthorized as json.

func (*MoveGameUnauthorized) MarshalJSON

func (s *MoveGameUnauthorized) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*MoveGameUnauthorized) UnmarshalJSON

func (s *MoveGameUnauthorized) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type MoveRequest

type MoveRequest struct {
	NewLetter MoveRequestNewLetter `json:"new_letter"`
	WordPath  []BoardCell          `json:"word_path"`
}

Ref: #/components/schemas/MoveRequest

func (*MoveRequest) Decode

func (s *MoveRequest) Decode(d *jx.Decoder) error

Decode decodes MoveRequest from json.

func (*MoveRequest) Encode

func (s *MoveRequest) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*MoveRequest) GetNewLetter

func (s *MoveRequest) GetNewLetter() MoveRequestNewLetter

GetNewLetter returns the value of NewLetter.

func (*MoveRequest) GetWordPath

func (s *MoveRequest) GetWordPath() []BoardCell

GetWordPath returns the value of WordPath.

func (*MoveRequest) MarshalJSON

func (s *MoveRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*MoveRequest) SetNewLetter

func (s *MoveRequest) SetNewLetter(val MoveRequestNewLetter)

SetNewLetter sets the value of NewLetter.

func (*MoveRequest) SetWordPath

func (s *MoveRequest) SetWordPath(val []BoardCell)

SetWordPath sets the value of WordPath.

func (*MoveRequest) UnmarshalJSON

func (s *MoveRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*MoveRequest) Validate

func (s *MoveRequest) Validate() error

type MoveRequestNewLetter

type MoveRequestNewLetter struct {
	Row int `json:"row"`
	Col int `json:"col"`
	// Single Cyrillic letter to place.
	Char string `json:"char"`
}

func (*MoveRequestNewLetter) Decode

func (s *MoveRequestNewLetter) Decode(d *jx.Decoder) error

Decode decodes MoveRequestNewLetter from json.

func (*MoveRequestNewLetter) Encode

func (s *MoveRequestNewLetter) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*MoveRequestNewLetter) GetChar

func (s *MoveRequestNewLetter) GetChar() string

GetChar returns the value of Char.

func (*MoveRequestNewLetter) GetCol

func (s *MoveRequestNewLetter) GetCol() int

GetCol returns the value of Col.

func (*MoveRequestNewLetter) GetRow

func (s *MoveRequestNewLetter) GetRow() int

GetRow returns the value of Row.

func (*MoveRequestNewLetter) MarshalJSON

func (s *MoveRequestNewLetter) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*MoveRequestNewLetter) SetChar

func (s *MoveRequestNewLetter) SetChar(val string)

SetChar sets the value of Char.

func (*MoveRequestNewLetter) SetCol

func (s *MoveRequestNewLetter) SetCol(val int)

SetCol sets the value of Col.

func (*MoveRequestNewLetter) SetRow

func (s *MoveRequestNewLetter) SetRow(val int)

SetRow sets the value of Row.

func (*MoveRequestNewLetter) UnmarshalJSON

func (s *MoveRequestNewLetter) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*MoveRequestNewLetter) Validate

func (s *MoveRequestNewLetter) Validate() error

type MoveResponse

type MoveResponse struct {
	// Updated 5x5 board state.
	Board [][]string `json:"board"`
	// ID of the player whose turn it is now.
	CurrentTurnUID OptUUID           `json:"current_turn_uid"`
	Players        []PlayerGameState `json:"players"`
	Status         OptGameStatus     `json:"status"`
	MoveNumber     OptInt            `json:"move_number"`
}

Ref: #/components/schemas/MoveResponse

func (*MoveResponse) Decode

func (s *MoveResponse) Decode(d *jx.Decoder) error

Decode decodes MoveResponse from json.

func (*MoveResponse) Encode

func (s *MoveResponse) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*MoveResponse) GetBoard

func (s *MoveResponse) GetBoard() [][]string

GetBoard returns the value of Board.

func (*MoveResponse) GetCurrentTurnUID

func (s *MoveResponse) GetCurrentTurnUID() OptUUID

GetCurrentTurnUID returns the value of CurrentTurnUID.

func (*MoveResponse) GetMoveNumber

func (s *MoveResponse) GetMoveNumber() OptInt

GetMoveNumber returns the value of MoveNumber.

func (*MoveResponse) GetPlayers

func (s *MoveResponse) GetPlayers() []PlayerGameState

GetPlayers returns the value of Players.

func (*MoveResponse) GetStatus

func (s *MoveResponse) GetStatus() OptGameStatus

GetStatus returns the value of Status.

func (*MoveResponse) MarshalJSON

func (s *MoveResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*MoveResponse) SetBoard

func (s *MoveResponse) SetBoard(val [][]string)

SetBoard sets the value of Board.

func (*MoveResponse) SetCurrentTurnUID

func (s *MoveResponse) SetCurrentTurnUID(val OptUUID)

SetCurrentTurnUID sets the value of CurrentTurnUID.

func (*MoveResponse) SetMoveNumber

func (s *MoveResponse) SetMoveNumber(val OptInt)

SetMoveNumber sets the value of MoveNumber.

func (*MoveResponse) SetPlayers

func (s *MoveResponse) SetPlayers(val []PlayerGameState)

SetPlayers sets the value of Players.

func (*MoveResponse) SetStatus

func (s *MoveResponse) SetStatus(val OptGameStatus)

SetStatus sets the value of Status.

func (*MoveResponse) UnmarshalJSON

func (s *MoveResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*MoveResponse) Validate

func (s *MoveResponse) Validate() error

type OperationName

type OperationName = string

OperationName is the ogen operation name

const (
	AuthOperation              OperationName = "Auth"
	CreateGameOperation        OperationName = "CreateGame"
	GetPlayerStateUIDOperation OperationName = "GetPlayerStateUID"
	JoinGameOperation          OperationName = "JoinGame"
	ListGamesOperation         OperationName = "ListGames"
	MoveGameOperation          OperationName = "MoveGame"
	PingOperation              OperationName = "Ping"
	SignupOperation            OperationName = "Signup"
	SkipGameOperation          OperationName = "SkipGame"
)

type OptGameStatus

type OptGameStatus struct {
	Value GameStatus
	Set   bool
}

OptGameStatus is optional GameStatus.

func NewOptGameStatus

func NewOptGameStatus(v GameStatus) OptGameStatus

NewOptGameStatus returns new OptGameStatus with value set to v.

func (*OptGameStatus) Decode

func (o *OptGameStatus) Decode(d *jx.Decoder) error

Decode decodes GameStatus from json.

func (OptGameStatus) Encode

func (o OptGameStatus) Encode(e *jx.Encoder)

Encode encodes GameStatus as json.

func (OptGameStatus) Get

func (o OptGameStatus) Get() (v GameStatus, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptGameStatus) IsSet

func (o OptGameStatus) IsSet() bool

IsSet returns true if OptGameStatus was set.

func (OptGameStatus) MarshalJSON

func (s OptGameStatus) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (OptGameStatus) Or

Or returns value if set, or given parameter if does not.

func (*OptGameStatus) Reset

func (o *OptGameStatus) Reset()

Reset unsets value.

func (*OptGameStatus) SetTo

func (o *OptGameStatus) SetTo(v GameStatus)

SetTo sets value to v.

func (*OptGameStatus) UnmarshalJSON

func (s *OptGameStatus) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type OptGameSummary

type OptGameSummary struct {
	Value GameSummary
	Set   bool
}

OptGameSummary is optional GameSummary.

func NewOptGameSummary

func NewOptGameSummary(v GameSummary) OptGameSummary

NewOptGameSummary returns new OptGameSummary with value set to v.

func (*OptGameSummary) Decode

func (o *OptGameSummary) Decode(d *jx.Decoder) error

Decode decodes GameSummary from json.

func (OptGameSummary) Encode

func (o OptGameSummary) Encode(e *jx.Encoder)

Encode encodes GameSummary as json.

func (OptGameSummary) Get

func (o OptGameSummary) Get() (v GameSummary, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptGameSummary) IsSet

func (o OptGameSummary) IsSet() bool

IsSet returns true if OptGameSummary was set.

func (OptGameSummary) MarshalJSON

func (s OptGameSummary) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (OptGameSummary) Or

Or returns value if set, or given parameter if does not.

func (*OptGameSummary) Reset

func (o *OptGameSummary) Reset()

Reset unsets value.

func (*OptGameSummary) SetTo

func (o *OptGameSummary) SetTo(v GameSummary)

SetTo sets value to v.

func (*OptGameSummary) UnmarshalJSON

func (s *OptGameSummary) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type OptInt

type OptInt struct {
	Value int
	Set   bool
}

OptInt is optional int.

func NewOptInt

func NewOptInt(v int) OptInt

NewOptInt returns new OptInt with value set to v.

func (*OptInt) Decode

func (o *OptInt) Decode(d *jx.Decoder) error

Decode decodes int from json.

func (OptInt) Encode

func (o OptInt) Encode(e *jx.Encoder)

Encode encodes int as json.

func (OptInt) Get

func (o OptInt) Get() (v int, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptInt) IsSet

func (o OptInt) IsSet() bool

IsSet returns true if OptInt was set.

func (OptInt) MarshalJSON

func (s OptInt) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (OptInt) Or

func (o OptInt) Or(d int) int

Or returns value if set, or given parameter if does not.

func (*OptInt) Reset

func (o *OptInt) Reset()

Reset unsets value.

func (*OptInt) SetTo

func (o *OptInt) SetTo(v int)

SetTo sets value to v.

func (*OptInt) UnmarshalJSON

func (s *OptInt) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type OptInt64

type OptInt64 struct {
	Value int64
	Set   bool
}

OptInt64 is optional int64.

func NewOptInt64

func NewOptInt64(v int64) OptInt64

NewOptInt64 returns new OptInt64 with value set to v.

func (*OptInt64) Decode

func (o *OptInt64) Decode(d *jx.Decoder) error

Decode decodes int64 from json.

func (OptInt64) Encode

func (o OptInt64) Encode(e *jx.Encoder)

Encode encodes int64 as json.

func (OptInt64) Get

func (o OptInt64) Get() (v int64, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptInt64) IsSet

func (o OptInt64) IsSet() bool

IsSet returns true if OptInt64 was set.

func (OptInt64) MarshalJSON

func (s OptInt64) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (OptInt64) Or

func (o OptInt64) Or(d int64) int64

Or returns value if set, or given parameter if does not.

func (*OptInt64) Reset

func (o *OptInt64) Reset()

Reset unsets value.

func (*OptInt64) SetTo

func (o *OptInt64) SetTo(v int64)

SetTo sets value to v.

func (*OptInt64) UnmarshalJSON

func (s *OptInt64) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type OptPlayer

type OptPlayer struct {
	Value Player
	Set   bool
}

OptPlayer is optional Player.

func NewOptPlayer

func NewOptPlayer(v Player) OptPlayer

NewOptPlayer returns new OptPlayer with value set to v.

func (*OptPlayer) Decode

func (o *OptPlayer) Decode(d *jx.Decoder) error

Decode decodes Player from json.

func (OptPlayer) Encode

func (o OptPlayer) Encode(e *jx.Encoder)

Encode encodes Player as json.

func (OptPlayer) Get

func (o OptPlayer) Get() (v Player, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptPlayer) IsSet

func (o OptPlayer) IsSet() bool

IsSet returns true if OptPlayer was set.

func (OptPlayer) MarshalJSON

func (s OptPlayer) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (OptPlayer) Or

func (o OptPlayer) Or(d Player) Player

Or returns value if set, or given parameter if does not.

func (*OptPlayer) Reset

func (o *OptPlayer) Reset()

Reset unsets value.

func (*OptPlayer) SetTo

func (o *OptPlayer) SetTo(v Player)

SetTo sets value to v.

func (*OptPlayer) UnmarshalJSON

func (s *OptPlayer) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type OptString

type OptString struct {
	Value string
	Set   bool
}

OptString is optional string.

func NewOptString

func NewOptString(v string) OptString

NewOptString returns new OptString with value set to v.

func (*OptString) Decode

func (o *OptString) Decode(d *jx.Decoder) error

Decode decodes string from json.

func (OptString) Encode

func (o OptString) Encode(e *jx.Encoder)

Encode encodes string as json.

func (OptString) Get

func (o OptString) Get() (v string, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptString) IsSet

func (o OptString) IsSet() bool

IsSet returns true if OptString was set.

func (OptString) MarshalJSON

func (s OptString) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (OptString) Or

func (o OptString) Or(d string) string

Or returns value if set, or given parameter if does not.

func (*OptString) Reset

func (o *OptString) Reset()

Reset unsets value.

func (*OptString) SetTo

func (o *OptString) SetTo(v string)

SetTo sets value to v.

func (*OptString) UnmarshalJSON

func (s *OptString) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type OptUUID

type OptUUID struct {
	Value uuid.UUID
	Set   bool
}

OptUUID is optional uuid.UUID.

func NewOptUUID

func NewOptUUID(v uuid.UUID) OptUUID

NewOptUUID returns new OptUUID with value set to v.

func (*OptUUID) Decode

func (o *OptUUID) Decode(d *jx.Decoder) error

Decode decodes uuid.UUID from json.

func (OptUUID) Encode

func (o OptUUID) Encode(e *jx.Encoder)

Encode encodes uuid.UUID as json.

func (OptUUID) Get

func (o OptUUID) Get() (v uuid.UUID, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptUUID) IsSet

func (o OptUUID) IsSet() bool

IsSet returns true if OptUUID was set.

func (OptUUID) MarshalJSON

func (s OptUUID) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (OptUUID) Or

func (o OptUUID) Or(d uuid.UUID) uuid.UUID

Or returns value if set, or given parameter if does not.

func (*OptUUID) Reset

func (o *OptUUID) Reset()

Reset unsets value.

func (*OptUUID) SetTo

func (o *OptUUID) SetTo(v uuid.UUID)

SetTo sets value to v.

func (*OptUUID) UnmarshalJSON

func (s *OptUUID) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type Option

type Option interface {
	ServerOption
	ClientOption
}

Option is config option.

func WithAttributes

func WithAttributes(attributes ...attribute.KeyValue) Option

WithAttributes specifies default otel attributes.

func WithMeterProvider

func WithMeterProvider(provider metric.MeterProvider) Option

WithMeterProvider specifies a meter provider to use for creating a meter.

If none is specified, the otel.GetMeterProvider() is used.

func WithTracerProvider

func WithTracerProvider(provider trace.TracerProvider) Option

WithTracerProvider specifies a tracer provider to use for creating a tracer.

If none is specified, the global provider is used.

type PingNoContent

type PingNoContent struct {
	XRequestID  OptInt64
	XServerTime OptInt64
}

PingNoContent is response for Ping operation.

func (*PingNoContent) GetXRequestID

func (s *PingNoContent) GetXRequestID() OptInt64

GetXRequestID returns the value of XRequestID.

func (*PingNoContent) GetXServerTime

func (s *PingNoContent) GetXServerTime() OptInt64

GetXServerTime returns the value of XServerTime.

func (*PingNoContent) SetXRequestID

func (s *PingNoContent) SetXRequestID(val OptInt64)

SetXRequestID sets the value of XRequestID.

func (*PingNoContent) SetXServerTime

func (s *PingNoContent) SetXServerTime(val OptInt64)

SetXServerTime sets the value of XServerTime.

func (*PingNoContent) Validate

func (s *PingNoContent) Validate() error

type PingParams

type PingParams struct {
	XRequestID  int64
	XAPISession string
}

PingParams is parameters of ping operation.

type PingRes

type PingRes interface {
	// contains filtered or unexported methods
}

type Player

type Player struct {
	// Player's ID in the system.
	UID OptUUID `json:"uid"`
	// Player's first name.
	Firstname OptString `json:"firstname"`
	// Player's last name.
	Lastname OptString `json:"lastname"`
	// Player's session ID.
	Sid OptString `json:"sid"`
	// Player's API Key that the client needs to provide when making API calls.
	Key OptString `json:"key"`
}

Ref: #/components/schemas/Player

func (*Player) Decode

func (s *Player) Decode(d *jx.Decoder) error

Decode decodes Player from json.

func (*Player) Encode

func (s *Player) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*Player) GetFirstname

func (s *Player) GetFirstname() OptString

GetFirstname returns the value of Firstname.

func (*Player) GetKey

func (s *Player) GetKey() OptString

GetKey returns the value of Key.

func (*Player) GetLastname

func (s *Player) GetLastname() OptString

GetLastname returns the value of Lastname.

func (*Player) GetSid

func (s *Player) GetSid() OptString

GetSid returns the value of Sid.

func (*Player) GetUID

func (s *Player) GetUID() OptUUID

GetUID returns the value of UID.

func (*Player) MarshalJSON

func (s *Player) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*Player) SetFirstname

func (s *Player) SetFirstname(val OptString)

SetFirstname sets the value of Firstname.

func (*Player) SetKey

func (s *Player) SetKey(val OptString)

SetKey sets the value of Key.

func (*Player) SetLastname

func (s *Player) SetLastname(val OptString)

SetLastname sets the value of Lastname.

func (*Player) SetSid

func (s *Player) SetSid(val OptString)

SetSid sets the value of Sid.

func (*Player) SetUID

func (s *Player) SetUID(val OptUUID)

SetUID sets the value of UID.

func (*Player) UnmarshalJSON

func (s *Player) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type PlayerGameState

type PlayerGameState struct {
	// Player's ID.
	UID OptUUID `json:"uid"`
	// Number of points scored in the current game.
	Score OptInt `json:"score"`
	// Number of words submitted by the player.
	WordsCount OptInt `json:"words_count"`
	// List of words submitted by the player in this game.
	Words []string `json:"words"`
}

Ref: #/components/schemas/PlayerGameState

func (*PlayerGameState) Decode

func (s *PlayerGameState) Decode(d *jx.Decoder) error

Decode decodes PlayerGameState from json.

func (*PlayerGameState) Encode

func (s *PlayerGameState) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*PlayerGameState) GetScore

func (s *PlayerGameState) GetScore() OptInt

GetScore returns the value of Score.

func (*PlayerGameState) GetUID

func (s *PlayerGameState) GetUID() OptUUID

GetUID returns the value of UID.

func (*PlayerGameState) GetWords

func (s *PlayerGameState) GetWords() []string

GetWords returns the value of Words.

func (*PlayerGameState) GetWordsCount

func (s *PlayerGameState) GetWordsCount() OptInt

GetWordsCount returns the value of WordsCount.

func (*PlayerGameState) MarshalJSON

func (s *PlayerGameState) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*PlayerGameState) SetScore

func (s *PlayerGameState) SetScore(val OptInt)

SetScore sets the value of Score.

func (*PlayerGameState) SetUID

func (s *PlayerGameState) SetUID(val OptUUID)

SetUID sets the value of UID.

func (*PlayerGameState) SetWords

func (s *PlayerGameState) SetWords(val []string)

SetWords sets the value of Words.

func (*PlayerGameState) SetWordsCount

func (s *PlayerGameState) SetWordsCount(val OptInt)

SetWordsCount sets the value of WordsCount.

func (*PlayerGameState) UnmarshalJSON

func (s *PlayerGameState) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type PlayerState

type PlayerState struct {
	// Player's ID in the system.
	UID OptUUID `json:"uid"`
	// Generated nickname in the system.
	Nickname OptString `json:"nickname"`
	// Player's exp points in the system.
	Exp OptInt64 `json:"exp"`
	// Player's lives count in the system.
	Lives OptInt64 `json:"lives"`
	// Some Player's flags.
	Flags OptInt64 `json:"flags"`
	// Game's ID (if game_id empty or absent then player in the lobby).
	GameID OptUUID `json:"game_id"`
}

Ref: #/components/schemas/PlayerState

func (*PlayerState) Decode

func (s *PlayerState) Decode(d *jx.Decoder) error

Decode decodes PlayerState from json.

func (*PlayerState) Encode

func (s *PlayerState) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*PlayerState) GetExp

func (s *PlayerState) GetExp() OptInt64

GetExp returns the value of Exp.

func (*PlayerState) GetFlags

func (s *PlayerState) GetFlags() OptInt64

GetFlags returns the value of Flags.

func (*PlayerState) GetGameID

func (s *PlayerState) GetGameID() OptUUID

GetGameID returns the value of GameID.

func (*PlayerState) GetLives

func (s *PlayerState) GetLives() OptInt64

GetLives returns the value of Lives.

func (*PlayerState) GetNickname

func (s *PlayerState) GetNickname() OptString

GetNickname returns the value of Nickname.

func (*PlayerState) GetUID

func (s *PlayerState) GetUID() OptUUID

GetUID returns the value of UID.

func (*PlayerState) MarshalJSON

func (s *PlayerState) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*PlayerState) SetExp

func (s *PlayerState) SetExp(val OptInt64)

SetExp sets the value of Exp.

func (*PlayerState) SetFlags

func (s *PlayerState) SetFlags(val OptInt64)

SetFlags sets the value of Flags.

func (*PlayerState) SetGameID

func (s *PlayerState) SetGameID(val OptUUID)

SetGameID sets the value of GameID.

func (*PlayerState) SetLives

func (s *PlayerState) SetLives(val OptInt64)

SetLives sets the value of Lives.

func (*PlayerState) SetNickname

func (s *PlayerState) SetNickname(val OptString)

SetNickname sets the value of Nickname.

func (*PlayerState) SetUID

func (s *PlayerState) SetUID(val OptUUID)

SetUID sets the value of UID.

func (*PlayerState) UnmarshalJSON

func (s *PlayerState) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type Route

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

Route is route object.

func (Route) Args

func (r Route) Args() []string

Args returns parsed arguments.

func (Route) Name

func (r Route) Name() string

Name returns ogen operation name.

It is guaranteed to be unique and not empty.

func (Route) OperationGroup

func (r Route) OperationGroup() string

OperationGroup returns the x-ogen-operation-group value.

func (Route) OperationID

func (r Route) OperationID() string

OperationID returns OpenAPI operationId.

func (Route) PathPattern

func (r Route) PathPattern() string

PathPattern returns OpenAPI path.

func (Route) Summary

func (r Route) Summary() string

Summary returns OpenAPI summary.

type SecurityHandler

type SecurityHandler interface {
	// HandleAPIKeyHeader handles APIKeyHeader security.
	HandleAPIKeyHeader(ctx context.Context, operationName OperationName, t APIKeyHeader) (context.Context, error)
	// HandleAPIKeyQueryParam handles APIKeyQueryParam security.
	HandleAPIKeyQueryParam(ctx context.Context, operationName OperationName, t APIKeyQueryParam) (context.Context, error)
}

SecurityHandler is handler for security parameters.

type SecuritySource

type SecuritySource interface {
	// APIKeyHeader provides APIKeyHeader security value.
	APIKeyHeader(ctx context.Context, operationName OperationName) (APIKeyHeader, error)
	// APIKeyQueryParam provides APIKeyQueryParam security value.
	APIKeyQueryParam(ctx context.Context, operationName OperationName) (APIKeyQueryParam, error)
}

SecuritySource is provider of security values (tokens, passwords, etc.).

type Server

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

Server implements http server based on OpenAPI v3 specification and calls Handler to handle requests.

func NewServer

func NewServer(h Handler, sec SecurityHandler, opts ...ServerOption) (*Server, error)

NewServer creates new Server.

func (*Server) FindPath

func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool)

FindPath finds Route for given method and URL.

func (*Server) FindRoute

func (s *Server) FindRoute(method, path string) (Route, bool)

FindRoute finds Route for given method and path.

Note: this method does not unescape path or handle reserved characters in path properly. Use FindPath instead.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP serves http request as defined by OpenAPI v3 specification, calling handler that matches the path or returning not found error.

type ServerOption

type ServerOption interface {
	// contains filtered or unexported methods
}

ServerOption is server config option.

func WithErrorHandler

func WithErrorHandler(h ErrorHandler) ServerOption

WithErrorHandler specifies error handler to use.

func WithMaxMultipartMemory

func WithMaxMultipartMemory(max int64) ServerOption

WithMaxMultipartMemory specifies limit of memory for storing file parts. File parts which can't be stored in memory will be stored on disk in temporary files.

func WithMethodNotAllowed

func WithMethodNotAllowed(methodNotAllowed func(w http.ResponseWriter, r *http.Request, allowed string)) ServerOption

WithMethodNotAllowed specifies Method Not Allowed handler to use.

func WithMiddleware

func WithMiddleware(m ...Middleware) ServerOption

WithMiddleware specifies middlewares to use.

func WithNotFound

func WithNotFound(notFound http.HandlerFunc) ServerOption

WithNotFound specifies Not Found handler to use.

func WithPathPrefix

func WithPathPrefix(prefix string) ServerOption

WithPathPrefix specifies server path prefix.

type SignupRequest

type SignupRequest struct {
	// User's first name.
	Firstname string `json:"firstname"`
	// User's last name.
	Lastname string `json:"lastname"`
	// User's email.
	Email string `json:"email"`
	// User's password.
	Password string `json:"password"`
}

Ref: #/components/schemas/SignupRequest

func (*SignupRequest) Decode

func (s *SignupRequest) Decode(d *jx.Decoder) error

Decode decodes SignupRequest from json.

func (*SignupRequest) Encode

func (s *SignupRequest) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*SignupRequest) GetEmail

func (s *SignupRequest) GetEmail() string

GetEmail returns the value of Email.

func (*SignupRequest) GetFirstname

func (s *SignupRequest) GetFirstname() string

GetFirstname returns the value of Firstname.

func (*SignupRequest) GetLastname

func (s *SignupRequest) GetLastname() string

GetLastname returns the value of Lastname.

func (*SignupRequest) GetPassword

func (s *SignupRequest) GetPassword() string

GetPassword returns the value of Password.

func (*SignupRequest) MarshalJSON

func (s *SignupRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*SignupRequest) SetEmail

func (s *SignupRequest) SetEmail(val string)

SetEmail sets the value of Email.

func (*SignupRequest) SetFirstname

func (s *SignupRequest) SetFirstname(val string)

SetFirstname sets the value of Firstname.

func (*SignupRequest) SetLastname

func (s *SignupRequest) SetLastname(val string)

SetLastname sets the value of Lastname.

func (*SignupRequest) SetPassword

func (s *SignupRequest) SetPassword(val string)

SetPassword sets the value of Password.

func (*SignupRequest) UnmarshalJSON

func (s *SignupRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*SignupRequest) Validate

func (s *SignupRequest) Validate() error

type SignupRes

type SignupRes interface {
	// contains filtered or unexported methods
}

type SignupResponse

type SignupResponse struct {
	User OptPlayer `json:"user"`
	// JWT for connecting to the Centrifugo WebSocket.
	CentrifugoToken OptString `json:"centrifugo_token"`
	// Centrifugo subscription JWT for the lobby channel.
	LobbyToken OptString `json:"lobby_token"`
}

Ref: #/components/schemas/SignupResponse

func (*SignupResponse) Decode

func (s *SignupResponse) Decode(d *jx.Decoder) error

Decode decodes SignupResponse from json.

func (*SignupResponse) Encode

func (s *SignupResponse) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*SignupResponse) GetCentrifugoToken

func (s *SignupResponse) GetCentrifugoToken() OptString

GetCentrifugoToken returns the value of CentrifugoToken.

func (*SignupResponse) GetLobbyToken

func (s *SignupResponse) GetLobbyToken() OptString

GetLobbyToken returns the value of LobbyToken.

func (*SignupResponse) GetUser

func (s *SignupResponse) GetUser() OptPlayer

GetUser returns the value of User.

func (*SignupResponse) MarshalJSON

func (s *SignupResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*SignupResponse) SetCentrifugoToken

func (s *SignupResponse) SetCentrifugoToken(val OptString)

SetCentrifugoToken sets the value of CentrifugoToken.

func (*SignupResponse) SetLobbyToken

func (s *SignupResponse) SetLobbyToken(val OptString)

SetLobbyToken sets the value of LobbyToken.

func (*SignupResponse) SetUser

func (s *SignupResponse) SetUser(val OptPlayer)

SetUser sets the value of User.

func (*SignupResponse) UnmarshalJSON

func (s *SignupResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type SkipGameConflict

type SkipGameConflict ErrorResponse

func (*SkipGameConflict) Decode

func (s *SkipGameConflict) Decode(d *jx.Decoder) error

Decode decodes SkipGameConflict from json.

func (*SkipGameConflict) Encode

func (s *SkipGameConflict) Encode(e *jx.Encoder)

Encode encodes SkipGameConflict as json.

func (*SkipGameConflict) MarshalJSON

func (s *SkipGameConflict) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*SkipGameConflict) UnmarshalJSON

func (s *SkipGameConflict) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type SkipGameNoContent

type SkipGameNoContent struct{}

SkipGameNoContent is response for SkipGame operation.

type SkipGameNotFound

type SkipGameNotFound ErrorResponse

func (*SkipGameNotFound) Decode

func (s *SkipGameNotFound) Decode(d *jx.Decoder) error

Decode decodes SkipGameNotFound from json.

func (*SkipGameNotFound) Encode

func (s *SkipGameNotFound) Encode(e *jx.Encoder)

Encode encodes SkipGameNotFound as json.

func (*SkipGameNotFound) MarshalJSON

func (s *SkipGameNotFound) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*SkipGameNotFound) UnmarshalJSON

func (s *SkipGameNotFound) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type SkipGameParams

type SkipGameParams struct {
	XAPISession string
	// ID of the game.
	ID uuid.UUID
}

SkipGameParams is parameters of skipGame operation.

type SkipGameRes

type SkipGameRes interface {
	// contains filtered or unexported methods
}

type SkipGameUnauthorized

type SkipGameUnauthorized ErrorResponse

func (*SkipGameUnauthorized) Decode

func (s *SkipGameUnauthorized) Decode(d *jx.Decoder) error

Decode decodes SkipGameUnauthorized from json.

func (*SkipGameUnauthorized) Encode

func (s *SkipGameUnauthorized) Encode(e *jx.Encoder)

Encode encodes SkipGameUnauthorized as json.

func (*SkipGameUnauthorized) MarshalJSON

func (s *SkipGameUnauthorized) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*SkipGameUnauthorized) UnmarshalJSON

func (s *SkipGameUnauthorized) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type UnimplementedHandler

type UnimplementedHandler struct{}

UnimplementedHandler is no-op Handler which returns http.ErrNotImplemented.

func (UnimplementedHandler) Auth

Auth implements auth operation.

Auth request.

POST /auth

func (UnimplementedHandler) CreateGame

CreateGame implements createGame operation.

Create a new game.

POST /games

func (UnimplementedHandler) GetPlayerStateUID

GetPlayerStateUID implements getPlayerStateUID operation.

Get user state.

GET /player/state/{uid}

func (UnimplementedHandler) JoinGame

func (UnimplementedHandler) JoinGame(ctx context.Context, params JoinGameParams) (r JoinGameRes, _ error)

JoinGame implements joinGame operation.

Adds the authenticated player to the specified waiting game. When the second player joins (quorum of 2 is reached) the game transitions to in_progress and the first move belongs to the player who created the game.

POST /games/{id}/join

func (UnimplementedHandler) ListGames

func (UnimplementedHandler) ListGames(ctx context.Context, params ListGamesParams) (r ListGamesRes, _ error)

ListGames implements listGames operation.

Returns a snapshot of all currently active games.

GET /games

func (UnimplementedHandler) MoveGame

func (UnimplementedHandler) MoveGame(ctx context.Context, req *MoveRequest, params MoveGameParams) (r MoveGameRes, _ error)

MoveGame implements moveGame operation.

Places a new letter on the board and submits a word. If the word is valid, the player's score is updated and the turn passes to the opponent.

POST /games/{id}/move

func (UnimplementedHandler) Ping

func (UnimplementedHandler) Ping(ctx context.Context, params PingParams) (r PingRes, _ error)

Ping implements ping operation.

POST not GET — mutates session TTL. Returns 204 with X-Server-Time header instead of a JSON body to minimize bandwidth on frequent pings (every ping_delay ms).

POST /session/ping

func (UnimplementedHandler) Signup

Signup implements signup operation.

Sign-up request.

POST /signup

func (UnimplementedHandler) SkipGame

func (UnimplementedHandler) SkipGame(ctx context.Context, params SkipGameParams) (r SkipGameRes, _ error)

SkipGame implements skipGame operation.

Ends the current turn without making a move. The turn passes to the opponent.

POST /games/{id}/skip

Jump to

Keyboard shortcuts

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