This commit is contained in:
2025-07-28 13:46:10 +02:00
parent 49baf33e92
commit 4e3e5ab8b1
6 changed files with 199 additions and 6 deletions

View File

@@ -13,6 +13,7 @@ import (
"net/url"
"os"
"strconv"
"time"
)
type (
@@ -67,6 +68,24 @@ func (c *Client) Version(gameID string) (int, error) {
return 0, errors.New("invalid payload sent by the server")
}
func (c *Client) Date(gameID string) (time.Time, error) {
u, err := url.JoinPath(c.baseURL, "api", "v1", "games", gameID, "version")
if err != nil {
return time.Time{}, err
}
o, err := c.get(u)
if err != nil {
return time.Time{}, err
}
if h, ok := (o.Data).(time.Time); ok {
return h, nil
}
return time.Time{}, errors.New("invalid payload sent by the server")
}
func (c *Client) Push(gameID, archivePath string, m game.Metadata) error {
u, err := url.JoinPath(c.baseURL, "api", "v1", "games", gameID, "data")
if err != nil {