From f52890f58a3aef38e35868e50b09b8b039bc8fe2 Mon Sep 17 00:00:00 2001 From: Jasper Bok Date: Fri, 18 Aug 2023 17:04:56 +0200 Subject: [PATCH] Add the `GetBrengUrl` method to `Quay` --- main.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/main.go b/main.go index 909e377..fa2fd7b 100644 --- a/main.go +++ b/main.go @@ -1,7 +1,9 @@ package main import ( + "fmt" "net/http" + "net/url" ) type Route struct { @@ -26,6 +28,11 @@ func (q Quay) IsInterestingDeparture(d Departure) bool { return false } +func (q Quay) GetBrengUrl() string { + param := fmt.Sprintf("{\"quayid\":\"%s\",\"name\":\"%s\",\"town\":\"%s\"}", q.ID, q.Name, q.Town) + return fmt.Sprint("https://www.breng.nl/nl/resultaten/halte-informatie/?stop=%s", url.QueryEscape(param)) +} + var BusClient *http.Client var Quays []Quay = []Quay{}