Skip to content

Commit

Permalink
Add StationMessages client call
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-mount committed Sep 21, 2021
1 parent fecf561 commit a33be0a
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions darwind3/client/stationMessage.go
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
}

0 comments on commit a33be0a

Please sign in to comment.