trainpositions

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2019 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GetLiveTrainPositionsResponse

type GetLiveTrainPositionsResponse struct {
	XMLName   xml.Name        `json:"-" xml:"http://www.wmata.com TrainPositionResp"`
	Positions []TrainPosition `json:"TrainPositions" xml:"TrainPositions>TrainPosition"`
}

type GetStandardRoutesResponse

type GetStandardRoutesResponse struct {
	XMLName xml.Name `json:"-" xml:"http://www.wmata.com StandardRouteResp"`
	Routes  []Route  `json:"StandardRoutes" xml:"StandardRoutes>StandardRoute"`
}

type GetTrackCircuitsResponse

type GetTrackCircuitsResponse struct {
	XMLName       xml.Name       `json:"-" xml:"http://www.wmata.com TrackCircuitResp"`
	TrackCircuits []TrackCircuit `json:"TrackCircuits" xml:"TrackCircuits>TrackCircuit"`
}

type Neighbor

type Neighbor struct {
	CircuitIDs   []int  `json:"CircuitIds" xml:"CircuitIds>int"`
	NeighborType string `json:"NeighborType" xml:"NeighborType"`
}

type Route

type Route struct {
	LineCode      string                 `json:"LineCode" xml:"LineCode"`
	TrackNumber   int                    `json:"TrackNum" xml:"TrackNum"`
	TrackCircuits []StandardTrackCircuit `json:"TrackCircuits" xml:"TrackCircuits>TrackCircuit"`
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service provides all API methods for the TrainPositions API

func NewService

func NewService(client *wmata.Client, responseType wmata.ResponseType) *Service

NewService returns a new Incidents service with a reference to an existing wmata.Client

func (*Service) GetLiveTrainPositions

func (service *Service) GetLiveTrainPositions() (*GetLiveTrainPositionsResponse, error)

GetLiveTrainPositions retrieves information on the trains that are currently in service and where they are Documentation on service structure can be found here: https://developer.wmata.com/docs/services/5763fa6ff91823096cac1057/operations/5763fb35f91823096cac1058

func (*Service) GetStandardRoutes

func (service *Service) GetStandardRoutes() (*GetStandardRoutesResponse, error)

GetStandardRoutes retrieves an ordered list of standard routes Documentation on service structure can be found here: https://developer.wmata.com/docs/services/5763fa6ff91823096cac1057/operations/57641afc031f59363c586dca?

func (*Service) GetTrackCircuits

func (service *Service) GetTrackCircuits() (*GetTrackCircuitsResponse, error)

GetTrackCircuits retrieves a list of all track circuits with reference to neighbors Documentation on service structure can be found here: https://developer.wmata.com/docs/services/5763fa6ff91823096cac1057/operations/57644238031f59363c586dcb?

type StandardTrackCircuit

type StandardTrackCircuit struct {
	CircuitID      int    `json:"CircuitId" xml:"CircuitId"`
	SequenceNumber int    `json:"SeqNum" xml:"SeqNum"`
	StationCode    string `json:"StationCode" xml:"StationCode"`
}

type TrackCircuit

type TrackCircuit struct {
	CircuitID int        `json:"CircuitId" xml:"CircuitId"`
	Track     int        `json:"Track" xml:"Track"`
	Neighbors []Neighbor `json:"Neighbors" xml:"Neighbors>TrackCircuitNeighbor"`
}

type TrainPosition

type TrainPosition struct {
	CarCount               int    `json:"CarCount" xml:"CarCount"`
	CircuitID              int    `json:"CircuitId" xml:"CircuitId"`
	DestinationStationCode string `json:"DestinationStationCode" xml:"DestinationStationCode"`
	DirectionNumber        int    `json:"DirectionNum" xml:"DirectionNum"`
	LineCode               string `json:"LineCode" xml:"LineCode"`
	SecondsAtLocation      int    `json:"SecondsAtLocation" xml:"SecondsAtLocation"`
	ServiceType            string `json:"ServiceType" xml:"ServiceType"`
	TrainID                string `json:"TrainId" xml:"TrainId"`
	TrainNumber            string `json:"TrainNumber" xml:"TrainNumber"`
}

type TrainPositions

type TrainPositions interface {
	GetLiveTrainPositions() (*GetLiveTrainPositionsResponse, error)
	GetStandardRoutes() (*GetStandardRoutesResponse, error)
	GetTrackCircuits() (*GetTrackCircuitsResponse, error)
}

TrainPositions defines the methods available in the WMATA "Train Positions" API

Jump to

Keyboard shortcuts

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