v0.16.0 import PGN, delete games, two-layout web client
test / test (push) Canceled after 0s
test / e2e (push) Canceled after 0s

This commit is contained in:
lixen committed 2026-10-19 21:02:39 -04:00
1 parent e1fa5242e3
commit 664cf9654e
34 files changed
+2007 -150

No files matched your search

+15
View File
@@ -254,6 +254,21 @@ func (c *Client) GetMyGames(limit int, cursor string) (*GameListResponse, error)
return &resp, err
}
// RemoveMyGame takes a stored game off the caller's list: deleted when the
// caller alone holds it, released when another player keeps it.
func (c *Client) RemoveMyGame(gameID string) (*RemoveGameResponse, error) {
var resp RemoveGameResponse
err := c.doRequest("DELETE", "/api/users/me/games/"+gameID, nil, &resp)
return &resp, err
}
// ImportGame stores a PGN game for the caller.
func (c *Client) ImportGame(pgn string) (*ImportGameResponse, error) {
var resp ImportGameResponse
err := c.doRequest("POST", "/api/games/import", &ImportGameRequest{PGN: pgn}, &resp)
return &resp, err
}
func (c *Client) Register(username, password, email string) (*AuthResponse, error) {
req := &RegisterRequest{
Username: username,
+21
View File
@@ -131,6 +131,10 @@ type GameHistoryResponse struct {
StartTimeUTC time.Time `json:"startTimeUtc"`
EndTimeUTC *time.Time `json:"endTimeUtc,omitempty"`
Concession *Concession `json:"concession,omitempty"` // Result in stored form ("black_wins")
Origin string `json:"origin,omitempty"`
Event string `json:"event,omitempty"`
Site string `json:"site,omitempty"`
Round string `json:"round,omitempty"`
Players PlayersResponse `json:"players"`
Moves []HistoryMove `json:"moves"`
}
@@ -154,9 +158,26 @@ type GameSummary struct {
StartTimeUTC time.Time `json:"startTimeUtc"`
EndTimeUTC *time.Time `json:"endTimeUtc,omitempty"`
MoveCount int `json:"moveCount"`
Origin string `json:"origin,omitempty"`
Event string `json:"event,omitempty"`
Players PlayersResponse `json:"players"`
}
type ImportGameRequest struct {
PGN string `json:"pgn"`
}
type ImportGameResponse struct {
GameID string `json:"gameId"`
MoveCount int `json:"moveCount"`
Result string `json:"result,omitempty"`
PGNResult string `json:"pgnResult"`
}
type RemoveGameResponse struct {
Removed string `json:"removed"` // "game" or "claim"
}
type GameListResponse struct {
Games []GameSummary `json:"games"`
Limit int `json:"limit"`