gosubway

package module
v0.0.0-...-7c60290 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 15, 2018 License: MIT Imports: 10 Imported by: 1

README

Experimental project for pulling realtime MTA subway data with Go.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NextTrainTimes

func NextTrainTimes(updates []*StopTimeUpdate) []time.Time

NextTrainTimes will extract the departure times from the given update slice, order and return them.

Types

type Alert

type Alert struct {
	transit_realtime.Alert
}

type FeedMessage

type FeedMessage struct {
	transit_realtime.FeedMessage
}

func GetFeed

func GetFeed(ctx context.Context, key string, ft FeedType) (*FeedMessage, error)

GetFeed takes an API key generated from http://datamine.mta.info/user/register and a boolean specifying which feed (1,2,3,4,5,6,S trains OR L train) and it will return a transit_realtime.FeedMessage with NYCT extensions.

func (*FeedMessage) NextTrainTimes

func (f *FeedMessage) NextTrainTimes(stopId, line string) (alerts []*Alert, northbound, southbound []time.Time)

NextTrainTimes will return an ordered slice of upcoming train departure times in either direction.

func (*FeedMessage) Trains

func (f *FeedMessage) Trains(stopId, line string) (alerts []*Alert, northbound, southbound []*StopTimeUpdate)

Trains will accept a stopId plus a train line (found here: http://web.mta.info/developers/data/nyct/subway/google_transit.zip) and returns a list of updates from northbound and southbound trains

type FeedType

type FeedType int
const (
	NumberedFeed FeedType = 1
	BlueFeed     FeedType = 26
	YellowFeed   FeedType = 16
	OrangeFeed   FeedType = 21
	LFeed        FeedType = 2
	GFeed        FeedType = 31
	SevenFeed    FeedType = 51
	BrownFeed    FeedType = 36
)

type StopTimeUpdate

type StopTimeUpdate struct {
	transit_realtime.TripUpdate_StopTimeUpdate
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL