summaryrefslogtreecommitdiff
path: root/golang/pkg/api/contracts.go
blob: f82ee6d9f7b84757d678e8a7ea13030f49c822d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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
}