summaryrefslogtreecommitdiff
path: root/src/cardmarket/game.go
diff options
context:
space:
mode:
authorDJ O'Leary <dijitol@proton.me>2026-09-06 23:52:13 +0200
committerDJ O'Leary <dijitol@proton.me>2026-09-06 23:52:13 +0200
commit4c1525d84968a5302ce2d87f923b84b56c5777eb (patch)
treecf553d12a0f529b62532b4dbb610ef1735dce0e5 /src/cardmarket/game.go
parent497c6b9793e4745e7d180d2faec1e26ff6a28788 (diff)
feat(cardmarket): implement some endpoints of the v2 api
Diffstat (limited to 'src/cardmarket/game.go')
-rw-r--r--src/cardmarket/game.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/cardmarket/game.go b/src/cardmarket/game.go
new file mode 100644
index 0000000..995162d
--- /dev/null
+++ b/src/cardmarket/game.go
@@ -0,0 +1,24 @@
+package cardmarket
+
+import (
+ "context"
+)
+
+type Game struct {
+ GameID uint32 `json:"idGame"`
+ Name string `json:"name"`
+ Abbreviation string `json:"abbreviation"`
+ Links Links `json:"links"`
+}
+
+func (c *ApiClient) GetGames(ctx context.Context) ([]Game, error) {
+ type responseBody struct {
+ Game []Game `json:"game"`
+ Links Links `json:"links"`
+ }
+ respBody := &responseBody{}
+ if err := c.get(ctx, "/games", respBody); err != nil {
+ return nil, err
+ }
+ return respBody.Game, nil
+}