railinfo

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: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AllDayParking

type AllDayParking struct {
	TotalCount           int     `json:"TotalCount" xml:"TotalCount"`
	RiderCost            float64 `json:"RiderCost" xml:"RiderCost"`
	NonRiderCost         float64 `json:"NonRiderCost" xml:"NonRiderCost"`
	SaturdayRiderCost    float64 `json:"SaturdayRiderCost" xml:"SaturdayRiderCost"`
	SaturdayNonRiderCost float64 `json:"SaturdayNonRiderCost" xml:"SaturdayNonRiderCost"`
}

type GetLinesResponse

type GetLinesResponse struct {
	XMLName xml.Name       `json:"-" xml:"http://www.wmata.com LinesResp"`
	Lines   []LineResponse `json:"Lines" xml:"Lines>Line"`
}

type GetParkingInformationResponse

type GetParkingInformationResponse struct {
	XMLName            xml.Name         `json:"-" xml:"http://www.wmata.com StationParkingResp"`
	ParkingInformation []StationParking `json:"StationsParking" xml:"StationsParking>StationParking"`
}

type GetPathBetweenStationsResponse

type GetPathBetweenStationsResponse struct {
	XMLName xml.Name   `json:"-" xml:"http://www.wmata.com PathResp"`
	Path    []PathItem `json:"Path" xml:"Path>MetroPathItem"`
}

type GetStationEntrancesRequest

type GetStationEntrancesRequest struct {
	Latitude  float64
	Longitude float64
	Radius    float64
}

type GetStationEntrancesResponse

type GetStationEntrancesResponse struct {
	XMLName   xml.Name          `json:"-" xml:"http://www.wmata.com StationEntrancesResp"`
	Entrances []StationEntrance `json:"Entrances" xml:"Entrances>StationEntrance"`
}

type GetStationInformationResponse

type GetStationInformationResponse struct {
	XMLName          xml.Name       `json:"-" xml:"http://www.wmata.com Station"`
	Address          StationAddress `json:"Address" xml:"Address"`
	Latitude         float64        `json:"Lat" xml:"Lat"`
	LineCode1        string         `json:"LineCode1" xml:"LineCode1"`
	LineCode2        string         `json:"LineCode2" xml:"LineCode2"`
	Longitude        float64        `json:"Lon" xml:"Lon"`
	Name             string         `json:"Name" xml:"Name"`
	StationCode      string         `json:"Code" xml:"Code"`
	StationTogether1 string         `json:"StationTogether1" xml:"StationTogether1"`
	StationTogether2 string         `json:"StationTogether2" xml:"StationTogether2"`
}

type GetStationListResponse

type GetStationListResponse struct {
	XMLName  xml.Name                     `json:"-" xml:"http://www.wmata.com StationsResp"`
	Stations []GetStationListResponseItem `json:"Stations" xml:"Stations>Station"`
}

type GetStationListResponseItem

type GetStationListResponseItem struct {
	Address          StationAddress `json:"Address" xml:"Address"`
	StationCode      string         `json:"Code" xml:"Code"`
	Latitude         float64        `json:"Lat" xml:"Lat"`
	LineCode1        string         `json:"LineCode1" xml:"LineCode1"`
	LineCode2        string         `json:"LineCode2" xml:"LineCode2"`
	LineCode3        string         `json:"LineCode3" xml:"LineCode3"`
	LineCode4        string         `json:"LineCode4" xml:"LineCode4"`
	Longitude        float64        `json:"Lon" xml:"Lon"`
	Name             string         `json:"Name" xml:"Name"`
	StationTogether1 string         `json:"StationTogether1" xml:"StationTogether1"`
	StationTogether2 string         `json:"StationTogether2" xml:"StationTogether2"`
}

type GetStationTimingsResponse

type GetStationTimingsResponse struct {
	XMLName      xml.Name      `json:"-" xml:"http://www.wmata.com StationTimeResp"`
	StationTimes []StationTime `json:"StationTimes" xml:"StationTimes>StationTime"`
}

type GetStationToStationInformationResponse

type GetStationToStationInformationResponse struct {
	XMLName                     xml.Name           `json:"-" xml:"http://www.wmata.com StationToStationInfoResp"`
	StationToStationInformation []StationToStation `json:"StationToStationInfos" xml:"StationToStationInfos>StationToStationInfo"`
}

type LineResponse

type LineResponse struct {
	DisplayName          string `json:"DisplayName" xml:"DisplayName"`
	EndStationCode       string `json:"EndStationCode" xml:"EndStationCode"`
	InternalDestination1 string `json:"InternalDestination1" xml:"InternalDestination1"`
	InternalDestination2 string `json:"InternalDestination2" xml:"InternalDestination2"`
	LineCode             string `json:"LineCode" xml:"LineCode"`
	StartStationCode     string `json:"StartStationCode" xml:"StartStationCode"`
}

type PathItem

type PathItem struct {
	DistanceToPreviousStation int    `json:"DistanceToPrev" xml:"DistanceToPrev"`
	LineCode                  string `json:"LineCode" xml:"LineCode"`
	SequenceNumber            int    `json:"SeqNum" xml:"SeqNum"`
	StationCode               string `json:"StationCode" xml:"StationCode"`
	StationName               string `json:"StationName" xml:"StationName"`
}

type RailFare

type RailFare struct {
	OffPeakTime    float64 `json:"OffPeakTime" xml:"OffPeakTime"`
	PeakTime       float64 `json:"PeakTime" xml:"PeakTime"`
	SeniorDisabled float64 `json:"SeniorDisabled" xml:"SeniorDisabled"`
}

type RailInfo

type RailInfo interface {
	GetLines() (*GetLinesResponse, error)
	GetParkingInformation(stationCode string) (*GetParkingInformationResponse, error)
	GetPathBetweenStations(fromStation, toStation string) (*GetPathBetweenStationsResponse, error)
	GetStationEntrances(getStationEntranceRequest *GetStationEntrancesRequest) (*GetStationEntrancesResponse, error)
	GetStationInformation(stationCode string) (*GetStationInformationResponse, error)
	GetStationList(lineCode string) (*GetStationListResponse, error)
	GetStationTimings(stationCode string) (*GetStationTimingsResponse, error)
	GetStationToStationInformation(fromStation, toStation string) (*GetStationToStationInformationResponse, error)
}

RailInfo defines the methods available in the WMATA "Rail Station Information" API

type Service

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

Service provides all API methods for Rail Station Information from WMATA

func NewService

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

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

func (*Service) GetLines

func (railService *Service) GetLines() (*GetLinesResponse, error)

GetLines retrieves information about all rail lines Documentation on service structure can be found here: https://developer.wmata.com/docs/services/5476364f031f590f38092507/operations/5476364f031f5909e4fe330c

func (*Service) GetParkingInformation

func (railService *Service) GetParkingInformation(stationCode string) (*GetParkingInformationResponse, error)

GetParkingInformation retrieves parking information for a given station Documentation on service structure can be found here: https://developer.wmata.com/docs/services/5476364f031f590f38092507/operations/5476364f031f5909e4fe330d?

func (*Service) GetPathBetweenStations

func (railService *Service) GetPathBetweenStations(fromStation, toStation string) (*GetPathBetweenStationsResponse, error)

GetPathBetweenStations retrieves an ordered list of stations and distances between two stations Documentation on service structure can be found here: https://developer.wmata.com/docs/services/5476364f031f590f38092507/operations/5476364f031f5909e4fe330e?

func (*Service) GetStationEntrances

func (railService *Service) GetStationEntrances(getStationEntranceRequest *GetStationEntrancesRequest) (*GetStationEntrancesResponse, error)

GetStationEntrances retrieves a list of station entrances near the provided coordinates Documentation on service structure can be found here: https://developer.wmata.com/docs/services/5476364f031f590f38092507/operations/5476364f031f5909e4fe330f?

func (*Service) GetStationInformation

func (railService *Service) GetStationInformation(stationCode string) (*GetStationInformationResponse, error)

GetStationInformation retrieves station location and address information by station code Documentation on service structure can be found here: https://developer.wmata.com/docs/services/5476364f031f590f38092507/operations/5476364f031f5909e4fe3310?

func (*Service) GetStationList

func (railService *Service) GetStationList(lineCode string) (*GetStationListResponse, error)

GetStationList retrieves a list of station location and address information for all stations on a given line Documentation on service structure can be found here: https://developer.wmata.com/docs/services/5476364f031f590f38092507/operations/5476364f031f5909e4fe3311?

func (*Service) GetStationTimings

func (railService *Service) GetStationTimings(stationCode string) (*GetStationTimingsResponse, error)

GetStationTimings retrieves opening and scheduled first and last train times for a given station Documentation on service structure can be found here: https://developer.wmata.com/docs/services/5476364f031f590f38092507/operations/5476364f031f5909e4fe3312?

func (*Service) GetStationToStationInformation

func (railService *Service) GetStationToStationInformation(fromStation, toStation string) (*GetStationToStationInformationResponse, error)

GetStationToStationInformation retrieves distance, fare and estimated travel time between the given two stations Documentation on service structure can be found here: https://developer.wmata.com/docs/services/5476364f031f590f38092507/operations/5476364f031f5909e4fe3313?

type ShortTermParking

type ShortTermParking struct {
	TotalCount int    `json:"TotalCount" xml:"TotalCount"`
	Notes      string `json:"Notes" xml:"Notes"`
}

type StationAddress

type StationAddress struct {
	City   string `json:"City" xml:"City"`
	State  string `json:"State" xml:"State"`
	Street string `json:"Street" xml:"Street"`
	Zip    string `json:"Zip" xml:"Zip"`
}

type StationDayItem

type StationDayItem struct {
	OpeningTime string                    `json:"OpeningTime" xml:"OpeningTime"`
	FirstTrains []StationTrainInformation `json:"FirstTrains" xml:"FirstTrains>Train"`
	LastTrains  []StationTrainInformation `json:"LastTrains" xml:"LastTrains>Train"`
}

type StationEntrance

type StationEntrance struct {
	Description string `json:"Description" xml:"Description"`
	// Deprecated: ID response field is deprecated
	ID           string  `json:"ID" xml:"ID"`
	Latitude     float64 `json:"Lat" xml:"Lat"`
	Longitude    float64 `json:"Lon" xml:"Lon"`
	Name         string  `json:"Name" xml:"Name"`
	StationCode1 string  `json:"StationCode1" xml:"StationCode1"`
	StationCode2 string  `json:"StationCode2" xml:"StationCode2"`
}

type StationParking

type StationParking struct {
	StationCode string           `json:"Code" xml:"Code"`
	Notes       string           `json:"Notes" xml:"Notes"`
	AllDay      AllDayParking    `json:"AllDayParking" xml:"AllDayParking"`
	ShortTerm   ShortTermParking `json:"ShortTermParking" xml:"ShortTermParking"`
}

type StationTime

type StationTime struct {
	StationCode string         `json:"Code" xml:"Code"`
	StationName string         `json:"StationName" xml:"StationName"`
	Monday      StationDayItem `json:"Monday" xml:"Monday"`
	Tuesday     StationDayItem `json:"Tuesday" xml:"Tuesday"`
	Wednesday   StationDayItem `json:"Wednesday" xml:"Wednesday"`
	Thursday    StationDayItem `json:"Thursday" xml:"Thursday"`
	Friday      StationDayItem `json:"Friday" xml:"Friday"`
	Saturday    StationDayItem `json:"Saturday" xml:"Saturday"`
	Sunday      StationDayItem `json:"Sunday" xml:"Sunday"`
}

type StationToStation

type StationToStation struct {
	CompositeMiles     float64  `json:"CompositeMiles" xml:"CompositeMiles"`
	DestinationStation string   `json:"DestinationStation" xml:"DestinationStation"`
	Fare               RailFare `json:"RailFare" xml:"RailFare"`
	Time               int      `json:"RailTime" xml:"RailTime"`
	SourceStation      string   `json:"SourceStation" xml:"SourceStation"`
}

type StationTrainInformation

type StationTrainInformation struct {
	Time               string `json:"Time" xml:"Time"`
	DestinationStation string `json:"DestinationStation" xml:"DestinationStation"`
}

Jump to

Keyboard shortcuts

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