aboutsummaryrefslogtreecommitdiff
path: root/pkg/navitia_api_client/client.go
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--pkg/navitia_api_client/client.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/pkg/navitia_api_client/client.go b/pkg/navitia_api_client/client.go
index aef8d0e..71b82fe 100644
--- a/pkg/navitia_api_client/client.go
+++ b/pkg/navitia_api_client/client.go
@@ -5,9 +5,15 @@ import (
"net/http"
"sync"
"time"
+
+ "git.adyxax.org/adyxax/trains/pkg/model"
)
-type Client struct {
+type Client interface {
+ GetDepartures(trainStop string) (departures []model.Departure, err error)
+}
+
+type NavitiaClient struct {
baseURL string
httpClient *http.Client
@@ -20,8 +26,8 @@ type cachedResult struct {
result interface{}
}
-func NewClient(token string) *Client {
- return &Client{
+func NewClient(token string) Client {
+ return &NavitiaClient{
baseURL: fmt.Sprintf("https://%s@api.sncf.com/v1", token),
httpClient: &http.Client{
Timeout: time.Minute,