From 3dad3f60f280289dee1b34ae04744f244d070bf7 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Thu, 13 Feb 2025 21:35:32 +0100 Subject: [golang] Bootstrap contracting and refactor the agent code --- golang/pkg/api/contracts.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 golang/pkg/api/contracts.go (limited to 'golang/pkg/api/contracts.go') diff --git a/golang/pkg/api/contracts.go b/golang/pkg/api/contracts.go new file mode 100644 index 0000000..f82ee6d --- /dev/null +++ b/golang/pkg/api/contracts.go @@ -0,0 +1,17 @@ +package api + +import ( + "fmt" + "net/url" + + "git.adyxax.org/adyxax/spacetraders/golang/pkg/model" +) + +func (c *Client) MyContracts() ([]model.Contract, error) { + uriRef := url.URL{Path: "my/contracts"} + var contracts []model.Contract + if err := c.Send("GET", &uriRef, nil, &contracts); err != nil { + return nil, fmt.Errorf("failed to get contracts: %w", err) + } + return contracts, nil +} -- cgit v1.2.3