summaryrefslogtreecommitdiff
path: root/golang/pkg/api/client.go
diff options
context:
space:
mode:
Diffstat (limited to 'golang/pkg/api/client.go')
-rw-r--r--golang/pkg/api/client.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/golang/pkg/api/client.go b/golang/pkg/api/client.go
index 2ea555e..e6a1883 100644
--- a/golang/pkg/api/client.go
+++ b/golang/pkg/api/client.go
@@ -6,10 +6,13 @@ import (
"net/http"
"net/url"
"time"
+
+ "git.adyxax.org/adyxax/spacetraders/golang/pkg/database"
)
type Client struct {
baseURI *url.URL
+ db *database.DB
requestsChannel chan *Request
ctx context.Context
headers *http.Header
@@ -17,7 +20,7 @@ type Client struct {
pq *PriorityQueue
}
-func NewClient(ctx context.Context) *Client {
+func NewClient(ctx context.Context, db *database.DB) *Client {
baseURI, err := url.Parse("https://api.spacetraders.io/v2/")
if err != nil {
panic("baseURI failed to parse")
@@ -26,6 +29,7 @@ func NewClient(ctx context.Context) *Client {
heap.Init(&pq)
client := &Client{
baseURI: baseURI,
+ db: db,
requestsChannel: make(chan *Request),
ctx: ctx,
headers: &http.Header{