-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add initial line models and function * add comments to models * add comment to conv function * correct casing of id fields
- Loading branch information
1 parent
e816663
commit de8f4d9
Showing
3 changed files
with
252 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package conv | ||
|
||
import "strings" | ||
|
||
// StringSliceToString converts a string slice to a string. | ||
func StringSliceToString(s []string) string { | ||
return strings.Join(s, ",") | ||
} |
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package tfl | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/jamesalexatkin/tfl-golang/internal/conv" | ||
) | ||
|
||
// GetLineStatusByMode gets the line status of all lines for the given modes. | ||
// | ||
// https://api.tfl.gov.uk/swagger/ui/index.html?url=/swagger/docs/v1#!/Line/Line_StatusByMode | ||
func (c *Client) GetLineStatusByMode(ctx context.Context, modes []string) ([]Status, error) { | ||
path := fmt.Sprintf("/Line/Mode/%s/Status", conv.StringSliceToString(modes)) | ||
|
||
statuses := []Status{} | ||
err := c.get(ctx, path, &statuses) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return statuses, err | ||
} |
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