aboutsummaryrefslogtreecommitdiff
path: root/api/client.go
diff options
context:
space:
mode:
authorJulien Dessaux2021-03-18 20:12:43 +0100
committerJulien Dessaux2021-03-19 11:27:21 +0100
commitbb78fe4cbac510b54d49f41efbdb35ffe7175299 (patch)
tree4c5ebba1ac3cae5b5e2b0755e2de1a0f3c00eb8d /api/client.go
parentInitial import (diff)
downloadtrains-bb78fe4cbac510b54d49f41efbdb35ffe7175299.tar.gz
trains-bb78fe4cbac510b54d49f41efbdb35ffe7175299.tar.bz2
trains-bb78fe4cbac510b54d49f41efbdb35ffe7175299.zip
Added api module with departures feature
Diffstat (limited to '')
-rw-r--r--api/client.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/api/client.go b/api/client.go
new file mode 100644
index 0000000..79c8314
--- /dev/null
+++ b/api/client.go
@@ -0,0 +1,21 @@
+package api
+
+import (
+ "fmt"
+ "net/http"
+ "time"
+)
+
+type Client struct {
+ baseURL string
+ httpClient *http.Client
+}
+
+func NewClient(token string) *Client {
+ return &Client{
+ baseURL: fmt.Sprintf("https://%s@api.sncf.com/v1", token),
+ httpClient: &http.Client{
+ Timeout: time.Minute,
+ },
+ }
+}