Documentation ¶
Index ¶
- type BusInfo
- type BusPosition
- type Direction
- type GetPositionsRequest
- type GetPositionsResponse
- type GetRouteDetailsResponse
- type GetRoutesResponse
- type GetScheduleAtStopResponse
- type GetScheduleResponse
- type GetStopsRequest
- type GetStopsResponse
- type Route
- type ScheduleArrival
- type Service
- func (busService *Service) GetPositions(request *GetPositionsRequest) (*GetPositionsResponse, error)
- func (busService *Service) GetRouteDetails(routeID, date string) (*GetRouteDetailsResponse, error)
- func (busService *Service) GetRoutes() (*GetRoutesResponse, error)
- func (busService *Service) GetSchedule(routeID, date string, includeVariations bool) (*GetScheduleResponse, error)
- func (busService *Service) GetScheduleAtStop(stopID, date string) (*GetScheduleAtStopResponse, error)
- func (busService *Service) GetStops(request *GetStopsRequest) (*GetStopsResponse, error)
- type ShapePoint
- type Stop
- type StopTime
- type Trip
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BusInfo ¶
type BusInfo interface { GetPositions(request *GetPositionsRequest) (*GetPositionsResponse, error) GetRouteDetails(routeID, date string) (*GetRouteDetailsResponse, error) GetRoutes() (*GetRoutesResponse, error) GetSchedule(routeID, date string, includeVariations bool) (*GetScheduleResponse, error) GetScheduleAtStop(stopID, date string) (*GetScheduleAtStopResponse, error) GetStops(request *GetStopsRequest) (*GetStopsResponse, error) }
BusInfo defines the methods available in the WMATA "Bus Route and Stop Methods" API
type BusPosition ¶
type BusPosition struct { BlockNumber string `json:"BlockNumber" xml:"BlockNumber"` DateTime string `json:"DateTime" xml:"DateTime"` Deviation int `json:"Deviation" xml:"Deviation"` // Deprecated: DirectionNumber response field is deprecated, use DirectionText DirectionNumber int `json:"DirectionNum" xml:"DirectionNum"` DirectionText string `json:"DirectionText" xml:"DirectionText"` Latitude float64 `json:"Lat" xml:"Lat"` Longitude float64 `json:"Lon" xml:"Lon"` RouteID string `json:"RouteID" xml:"RouteID"` TripEndTime string `json:"TripEndTime" xml:"TripEndTime"` TripDestination string `json:"TripHeadsign" xml:"TripHeadsign"` TripID string `json:"TripID" xml:"TripID"` TripStartTime string `json:"TripStartTime" xml:"TripStartTime"` VehicleID string `json:"VehicleID" xml:"VehicleID"` }
type Direction ¶
type Direction struct { // Deprecated: DirectionNumber response field is deprecated, use DirectionText DirectionNumber string `json:"DirectionNum" xml:"DirectionNum"` DirectionText string `json:"DirectionText" xml:"DirectionText"` Shapes []ShapePoint `json:"Shape" xml:"Shape>ShapePoint"` Stops []Stop `json:"Stops" xml:"Stops>Stop"` TripDestination string `json:"TripHeadsign" xml:"TripHeadsign"` }
type GetPositionsRequest ¶
type GetPositionsRequest struct { RouteID string Latitude float64 Longitude float64 Radius float64 }
GetPositionsRequest wraps a request to the "Bus Position" service
type GetPositionsResponse ¶
type GetPositionsResponse struct { XMLName xml.Name `json:"-" xml:"http://www.wmata.com BusPositionsResp"` BusPositions []BusPosition `json:"BusPositions" xml:"BusPositions>BusPosition"` }
type GetRouteDetailsResponse ¶
type GetRouteDetailsResponse struct { XMLName xml.Name `json:"-" xml:"http://www.wmata.com RouteDetailsInfo"` Direction0 Direction `json:"Direction0" xml:"Direction0"` Direction1 Direction `json:"Direction1" xml:"Direction1"` Name string `json:"Name" xml:"Name"` RouteID string `json:"RouteID" xml:"RouteID"` }
type GetRoutesResponse ¶
type GetScheduleAtStopResponse ¶
type GetScheduleAtStopResponse struct { XMLName xml.Name `json:"-" xml:"http://www.wmata.com StopScheduleInfo"` ScheduleArrivals []ScheduleArrival `json:"ScheduleArrivals" xml:"ScheduleArrivals>StopScheduleArrival"` StopInfo Stop `json:"Stop" xml:"Stop"` }
type GetScheduleResponse ¶
type GetStopsRequest ¶
type GetStopsResponse ¶
type ScheduleArrival ¶
type ScheduleArrival struct { DirectionNumber string `json:"DirectionNum" xml:"DirectionNum"` EndTime string `json:"EndTime" xml:"EndTime"` RouteID string `json:"RouteID" xml:"RouteID"` ScheduleTime string `json:"ScheduleTime" xml:"ScheduleTime"` StartTime string `json:"StartTime" xml:"StartTime"` TripDirection string `json:"TripDirectionText" xml:"TripDirectionText"` TripDestination string `json:"TripHeadsign" xml:"TripHeadsign"` TripID string `json:"TripID" xml:"TripID"` }
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service provides all API methods for Bus Route and Stop Information from WMATA
func NewService ¶
func NewService(client *wmata.Client, responseType wmata.ResponseType) *Service
NewService returns a new BusInfo Service service with a reference to an existing wmata.Client
func (*Service) GetPositions ¶
func (busService *Service) GetPositions(request *GetPositionsRequest) (*GetPositionsResponse, error)
GetPositions retrieves the bus positions for a given route. Documentation on service structure can be found here: https://developer.wmata.com/docs/services/54763629281d83086473f231/operations/5476362a281d830c946a3d68
func (*Service) GetRouteDetails ¶
func (busService *Service) GetRouteDetails(routeID, date string) (*GetRouteDetailsResponse, error)
GetRouteDetails gets bus latitude and longitude by route Documentation on service structure can be found here: https://developer.wmata.com/docs/services/54763629281d83086473f231/operations/5476362a281d830c946a3d69?
func (*Service) GetRoutes ¶
func (busService *Service) GetRoutes() (*GetRoutesResponse, error)
GetRoutes gets a list of all bus route variants Documentation on service structure can be found here: https://developer.wmata.com/docs/services/54763629281d83086473f231/operations/5476362a281d830c946a3d6a?
func (*Service) GetSchedule ¶
func (busService *Service) GetSchedule(routeID, date string, includeVariations bool) (*GetScheduleResponse, error)
GetSchedule gets a schedule for a route on a given date Documentation on service structure can be found here: https://developer.wmata.com/docs/services/54763629281d83086473f231/operations/5476362a281d830c946a3d6b?
func (*Service) GetScheduleAtStop ¶
func (busService *Service) GetScheduleAtStop(stopID, date string) (*GetScheduleAtStopResponse, error)
GetScheduleAtStop gets a list of all buses scheduled to arrive at a given stop and date Documentation on service structure can be found here: https://developer.wmata.com/docs/services/54763629281d83086473f231/operations/5476362a281d830c946a3d6c?
func (*Service) GetStops ¶
func (busService *Service) GetStops(request *GetStopsRequest) (*GetStopsResponse, error)
GetStops gets a list of nearby bus stops based on provided coordinates Documentation on service structure can be found here: https://developer.wmata.com/docs/services/54763629281d83086473f231/operations/5476362a281d830c946a3d6d?
type ShapePoint ¶
type Trip ¶
type Trip struct { DirectionNumber string `json:"DirectionNum" xml:"DirectionNum"` EndTime string `json:"EndTime" xml:"EndTime"` RouteID string `json:"RouteID" xml:"RouteID"` StartTime string `json:"StartTime" xml:"StartTime"` StopTimes []StopTime `json:"StopTimes" xml:"StopTimes>StopTime"` TripDirection string `json:"TripDirectionText" xml:"TripDirectionText"` TripDestination string `json:"TripHeadsign" xml:"TripHeadsign"` TripID string `json:"TripID" xml:"TripID"` }