[golang] Bootstrap contracting and refactor the agent code
This commit is contained in:
parent
8fbd912414
commit
3dad3f60f2
8 changed files with 158 additions and 106 deletions
17
golang/pkg/api/contracts.go
Normal file
17
golang/pkg/api/contracts.go
Normal 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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue