-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fecf561
commit a33be0a
Showing
1 changed file
with
19 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,26 @@ | ||
package client | ||
|
||
import ( | ||
"fmt" | ||
"github.com/peter-mount/nre-feeds/darwind3" | ||
"fmt" | ||
"github.com/peter-mount/nre-feeds/darwind3" | ||
) | ||
|
||
// GetJourney returns a Journey by making an HTTP call to a remote instance of | ||
// DarwinTimetable | ||
// GetStationMessage returns a specific station message | ||
func (c *DarwinD3Client) GetStationMessage(id int64) (*darwind3.StationMessage, error) { | ||
msg := &darwind3.StationMessage{} | ||
if found, err := c.get(fmt.Sprintf("/message/%d", id), msg); err != nil { | ||
return nil, err | ||
} else if found { | ||
return msg, nil | ||
} else { | ||
return nil, nil | ||
} | ||
msg := &darwind3.StationMessage{} | ||
if found, err := c.get(fmt.Sprintf("/message/%d", id), msg); err != nil { | ||
return nil, err | ||
} else if found { | ||
return msg, nil | ||
} else { | ||
return nil, nil | ||
} | ||
} | ||
|
||
// GetStationMessages returns all Station messages | ||
func (c *DarwinD3Client) GetStationMessages() ([]darwind3.StationMessage, error) { | ||
var msg []darwind3.StationMessage | ||
|
||
_, err := c.get("/messages", &msg) | ||
return msg, err | ||
} |