1
0
Fork 0

[golang] Bootstrap contracting and refactor the agent code

This commit is contained in:
Julien Dessaux 2025-02-13 21:35:32 +01:00
parent 8fbd912414
commit 3dad3f60f2
Signed by: adyxax
GPG key ID: F92E51B86E07177E
8 changed files with 158 additions and 106 deletions

View file

@ -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
}