summaryrefslogtreecommitdiff
path: root/src/cardmarket/game.go
diff options
context:
space:
mode:
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
+}