Documentation
¶
Index ¶
- Constants
- Variables
- type BusDVTrip
- type BusDataClient
- func (c *BusDataClient) GetBusDV(request GetBusDVRequest) (*GetBusDVResponse, error)
- func (c *BusDataClient) GetBusLocations() (*GetBusLocationsResponse, error)
- func (c *BusDataClient) GetBusVehicleData() (*GetBusVehicleDataResponse, error)
- func (c *BusDataClient) GetBusVehicleDataStream(r chan BusVehicleDataRow, e chan error, updateTnterval time.Duration, ...)
- func (c *BusDataClient) GetMessages(request GetMessagesRequest) (*GetMessagesResponse, error)
- func (c *BusDataClient) GetNextTrips(request GetNextTripsRequest) (*GetNextTripsResponse, error)
- func (c *BusDataClient) GetScheduleData(request GetScheduleDataRequest) (*GetScheduleDataResponse, error)
- func (c *BusDataClient) GetScheduleXGTFS(request GetScheduleXGTFSRequest) (*GetScheduleXGTFSResponse, error)
- type BusVehicleDataRow
- type BusVehicleDataRowTimepoint
- type GetBusDVRequest
- type GetBusDVResponse
- type GetBusLocationsResponse
- type GetBusVehicleDataResponse
- type GetMessagesRequest
- type GetMessagesResponse
- type GetNextTrip
- type GetNextTripsRequest
- type GetNextTripsResponse
- type GetScheduleDataRequest
- type GetScheduleDataResponse
- type GetScheduleDataTrip
- type GetScheduleDataTripStop
- type GetScheduleXGTFSRequest
- type GetScheduleXGTFSResponse
- type GetScheduleXGTFSTrip
- type GetStationListResponse
- type GetStationListResponseStation
- type GetStationMessageResponse
- type GetStationMessageResponseItem
- type GetStationScheduleResponse
- type GetStationScheduleResponseItem
- type GetTrainSchedule19RecResponse
- type GetTrainSchedule19RecResponseItem
- type GetTrainScheduleResponse
- type GetVehicleDataResponse
- type ScheduleXGTFSTrip
- type TrainDataClient
- func (t *TrainDataClient) GetStationList() (*GetStationListResponse, error)
- func (t *TrainDataClient) GetStationMessage(station, trainLine string) (*GetStationMessageResponse, error)
- func (t *TrainDataClient) GetStationSchedule(station string, njtransitOnly bool) (*GetStationScheduleResponse, error)
- func (t *TrainDataClient) GetTrainSchedule(station string, njtransitOnly bool) (*GetTrainScheduleResponse, error)
- func (t *TrainDataClient) GetTrainSchedule19Rec(station string) (*GetTrainSchedule19RecResponse, error)
- func (t *TrainDataClient) GetVehicleData() (*GetVehicleDataResponse, error)
Constants ¶
const ( BusDataProdURL = "https://busdata.njtransit.com/NJTBusData.asmx" BusDataTestURL = "https://busdata_tst.njtransit.com/NJTBusData.asmx" )
Web Serivces URLs
const ( CamdenBusTerminal = "CAMD" AtlanticCityBusTerminal = "ATLC" HackensackBusTerminal = "HACK" HobokenBusTerminal = "HBKN" IrvingtonBusTerminal = "IRVN" LakewoodBusTerminal = "LKWD" NewarkPennStation = "NWRK" MetroParkBusTerminal = "MTPK" PortAuthorityBusTerminal = "PABT" OldBridgeBusTerminal = "OBRG" WayneBusTerminal = "WYNE" TrentonBusTerminal = "TREN" GeorgeWashingtonTerminal = "GWBT" )
Pre-defined locations That can be used in GetBusDV method
const ( TrainDataProdURL = "https://traindata.njtransit.com/NJTTrainData.asmx" TrainDataTestURL = "https://njttraindatatst.njtransit.com/NJTTrainData.asmx" )
Variables ¶
var ErrNotImplemented = errors.New("not implemented")
Functions ¶
This section is empty.
Types ¶
type BusDVTrip ¶
type BusDVTrip struct { PublicRoute string `xml:"public_route"` // 123 Header string `xml:"header"` // JERSEY CITY CHRIST HOSP Lanegate string `xml:"lanegate"` // 303 DepartureTime string `xml:"departuretime"` // Approaching Remarks string `xml:"remarks"` // }
BusDVTrip represents part of GetBusDVResponse
type BusDataClient ¶
type BusDataClient struct {
// contains filtered or unexported fields
}
BusDataClient holds information between API calls
func NewBusDataClient ¶
func NewBusDataClient(username, password, busDataURL string) *BusDataClient
NewBusDataClient creates new BusDataClient
func (*BusDataClient) GetBusDV ¶
func (c *BusDataClient) GetBusDV(request GetBusDVRequest) (*GetBusDVResponse, error)
GetBusDV - Gets the first layer of data for BusDV This method provides schedule information. The data consist of the next trip to depart for each possible lane at the requested location.
func (*BusDataClient) GetBusLocations ¶
func (c *BusDataClient) GetBusLocations() (*GetBusLocationsResponse, error)
GetBusLocations - This method provides a list of locations that can be used in the GetBusDVXML
func (*BusDataClient) GetBusVehicleData ¶
func (c *BusDataClient) GetBusVehicleData() (*GetBusVehicleDataResponse, error)
GetBusVehicleData - Status By Bus data This Method will provide Bus Vehicle Information. It will list the vehicles currently reporting real-time information.
func (*BusDataClient) GetBusVehicleDataStream ¶
func (c *BusDataClient) GetBusVehicleDataStream(r chan BusVehicleDataRow, e chan error, updateTnterval time.Duration, dedupe bool)
GetBusVehicleDataStream provides a stream or BusVehicleData updates.
func (*BusDataClient) GetMessages ¶
func (c *BusDataClient) GetMessages(request GetMessagesRequest) (*GetMessagesResponse, error)
GetMessages - This method provides a list of messages
func (*BusDataClient) GetNextTrips ¶
func (c *BusDataClient) GetNextTrips(request GetNextTripsRequest) (*GetNextTripsResponse, error)
GetNextTrips retrieves upcoming bus arrivals for given stopID This method provides schedule information. The data consist of the next 20 trips that depart the given stop
func (*BusDataClient) GetScheduleData ¶
func (c *BusDataClient) GetScheduleData(request GetScheduleDataRequest) (*GetScheduleDataResponse, error)
GetScheduleData - This method will provide schedule information. The data consists of the departures for the given site that depart within the given number of minutes. Also included are the remaining stops that each of these trips will be making.
func (*BusDataClient) GetScheduleXGTFS ¶
func (c *BusDataClient) GetScheduleXGTFS(request GetScheduleXGTFSRequest) (*GetScheduleXGTFSResponse, error)
GetScheduleXGTFS -This method will provide schedule information. The data consists of the arrivals and departures for the given site that depart within the given number of minutes.
type BusVehicleDataRow ¶
type BusVehicleDataRow struct { VehicleID string `xml:"VEHICLE_ID"` // 5987 Route string `xml:"ROUTE"` // 1 RunID string `xml:"RUN_ID"` // 21 TripBlock string `xml:"TRIP_BLOCK"` // 001HL064 PatternID string `xml:"PATTERN_ID"` // 264 Destination string `xml:"DESTINATION"` // 1 NEWARK-IVY HILL VIA RIVER TERM Longitude string `xml:"LONGITUDE"` // -74.24513778686523 Latitude string `xml:"LATITUDE"` // 40.73779029846192 GPSTimestmp string `xml:"GPS_TIMESTMP"` // 25-Apr-2019 12:15:12 AM LastModified string `xml:"LAST_MODIFIED"` // 25-Apr-2019 12:16:10 AM AsInternalTripNumber string `xml:"AS_INTERNAL_TRIP_NUMBER"` // 13734490 Timepoints []BusVehicleDataRowTimepoint `xml:"TIMEPOINTS"` }
BusVehicleDataRow is part of the GetBusVehicleDataResponse
type BusVehicleDataRowTimepoint ¶
type BusVehicleDataRowTimepoint struct { AsTimingPointID string `xml:"AS_TIMING_POINT_ID"` // IVY HILL AsDescription string `xml:"AS_DESCRIPTION"` // IVY HILL LOOP (MT VERNON PL) AsSchedDepTime string `xml:"AS_SCHED_DEP_TIME"` // 25-Apr-2019 12:20:00 AM }
BusVehicleDataRowTimepoint is part of the BusVehicleDataRow
type GetBusDVRequest ¶
type GetBusDVRequest struct {
Location string
}
GetBusDVRequest represents GetBusDV API request
type GetBusDVResponse ¶
type GetBusDVResponse struct {
Trip []BusDVTrip `xml:"Trip"`
}
GetBusDVResponse represents GetBusDV API response
type GetBusLocationsResponse ¶
type GetBusLocationsResponse struct {
Terminal []string `xml:"terminal"`
}
GetBusLocationsResponse represents GetBusLocations API response
type GetBusVehicleDataResponse ¶
type GetBusVehicleDataResponse struct {
Rows []BusVehicleDataRow `xml:"ROW"`
}
GetBusVehicleDataResponse represents GetBusVehicleData API response
type GetMessagesRequest ¶
type GetMessagesRequest struct {
StopID int
}
GetMessagesRequest represents GetMessages API response
type GetMessagesResponse ¶
type GetMessagesResponse struct {
Message []string `xml:"message"`
}
GetMessagesResponse represents GetMessages API response
type GetNextTrip ¶
type GetNextTrip struct { TripID string `xml:"Trip_id"` // 35971 ArrivalTime string `xml:"arrival_time"` // 23:00:48 DepartureTime string `xml:"departure_time"` // 23:00:48 SchedDepTime string `xml:"sched_dep_time"` // 4/22/2019 11:09:00 PM StopID string `xml:"stop_id"` // 21884 StopSequence string `xml:"stop_sequence"` // 84 Route string `xml:"route"` // 94 Header string `xml:"header"` // BLOOMFIELD CENTER StopName string `xml:"stop_name"` // HESSIAN AVE AT RED BANK AVE# TimingPointID string `xml:"timing_point_id"` // BLFDMUNI StopLat float32 `xml:"stop_lat"` // 39.862620 StopLon float32 `xml:"stop_lon"` // -75.168910 SecLate int `xml:"sec_late"` // -60 }
GetNextTrip represents part of the GetNextTripsResponse
type GetNextTripsRequest ¶
type GetNextTripsRequest struct {
StopID int
}
GetNextTripsRequest represents GetNextTrips API request
type GetNextTripsResponse ¶
type GetNextTripsResponse struct {
Trips []GetNextTrip `xml:"Trip"`
}
GetNextTripsResponse represents GetNextTrips API response
type GetScheduleDataRequest ¶
GetScheduleDataRequest represents GetScheduleData API response
type GetScheduleDataResponse ¶
type GetScheduleDataResponse struct {
Trips []GetScheduleDataTrip `xml:"trip"`
}
GetScheduleDataResponse represents GetScheduleData API response
type GetScheduleDataTrip ¶
type GetScheduleDataTrip struct { InternalTripNumber string `xml:"internal_trip_number"` // 13694960 Route string `xml:"route"` // 123 BusHeader string `xml:"BusHeader"` // Jersey City Christ Hosp RunID string `xml:"run_id"` // 624 ManualLaneGate string `xml:"manual_lane_gate"` // LaneGate string `xml:"LaneGate"` // 214-3 SecLate string `xml:"sec_late"` // Remarks string `xml:"Remarks"` // DepartureTime string `xml:"DepartureTime"` // 8:14 PM Stop GetScheduleDataTripStop `xml:"STOP"` }
GetScheduleDataTrip represents part of GetScheduleDataResponse
type GetScheduleDataTripStop ¶
type GetScheduleDataTripStop struct { ScheduledDepartureDate string `xml:"scheduleddeparturedate"` // 4/24/2019 12:00:00 AM ScheduledDepartureTime string `xml:"cheduleddeparturetime"` // 8:18 PM TopName string `xml:"topname"` // Port Authority Bus Terminal TopCity string `xml:"topcity"` // NEW YORK CITY }
GetScheduleDataTripStop represents part of GetScheduleDataTrip
type GetScheduleXGTFSRequest ¶
GetScheduleXGTFSRequest represents GetScheduleXGTFS API response
type GetScheduleXGTFSResponse ¶
type GetScheduleXGTFSResponse struct {
Trips []GetScheduleXGTFSTrip `xml:"trip"`
}
GetScheduleXGTFSResponse represents GetScheduleXGTFS API response
type GetScheduleXGTFSTrip ¶
type GetScheduleXGTFSTrip struct { GTFSTripID int `xml:"gtfs_trip_id"` GTFSStopID int `xml:"gtfs_stop_id"` GTFSStopCode string `xml:"gtfs_stop_Code"` GTFSRouteID int `xml:"gtfs_route_id"` GTFSServiceID int `xml:"gtfs_service_id"` GTFSFileDate string `xml:"gtfs_file_Date"` Route string `xml:"route"` Lanegate string `xml:"lanegate"` // terminal Line or Gate (".." for inbound buses) ScheduledLaneGate string `xml:"scheduled_lane_gate"` // can be empty ManualLaneGate string `xml:"manual_lane_gate"` // can be empty DepartureTime string `xml:"departuretime"` // example: 1:41 AM ScheduledDepartureDate string `xml:"scheduleddeparturedate"` // example: 03-JAN-19 ScheduledDepartureTime string `xml:"scheduleddeparturetime"` // example: 1:41 AM SchedDepTime string `xml:"sched_dep_Time"` // example: 03-JAN-19 01.41.00.000000 AM SecLate string `xml:"sec_late"` // can be empty BusHeader string `xml:"busheader"` RunID int `xml:"run_id"` StopName string `xml:"stopname"` StopCity string `xml:"stopcity"` // example: NEW YORK CITY TripBlock string `xml:"trip_block"` Direction string `xml:"direction"` // can be "In" or "Ou" }
GetScheduleXGTFSTrip represents part of GetScheduleXGTFSResponse
type GetStationListResponse ¶
type GetStationListResponse struct {
Stations []GetStationListResponseStation `xml:"STATION"`
}
type GetStationMessageResponse ¶
type GetStationMessageResponse struct { TwoChar string `xml:"STATION_2CHAR"` Name string `xml:"STATIONNAME"` BannerMessage string `xml:"BANNERMSGS"` Items []*GetStationMessageResponseItem `xml:"ITEMS>ITEM"` }
type GetStationMessageResponseItem ¶
type GetStationMessageResponseItem struct { ItemIndex string `xml:"ITEM_INDEX"` SchedDepDate string `xml:"SCHED_DEP_DATE"` Destination string `xml:"DESTINATION"` Track string `xml:"TRACK"` Line string `xml:"LINE"` TrainID string `xml:"TRAIN_ID"` ConnectingTrainID string `xml:"CONNECTING_TRAIN_ID"` Status string `xml:"STATUS"` SecLate string `xml:"SEC_LATE"` LastModified string `xml:"LAST_MODIFIED"` BackgroundColor string `xml:"BACKCOLOR"` ForegroundColor string `xml:"FORECOLOR"` ShadowColor string `xml:"SHADOWCOLOR"` GPSLatitude string `xml:"GPSLATITUDE"` GPSLongitude string `xml:"GPSLONGITUDE"` GPSTime string `xml:"GPSTIME"` StationPosition string `xml:"STATION_POSITION"` LineAbbreviation string `xml:"LINEABBREVIATION"` InlineMessage string `xml:"INLINEMSG"` }
type GetStationScheduleResponse ¶
type GetStationScheduleResponse struct { TwoChar string `xml:"STATION_2CHAR"` Name string `xml:"STATIONNAME"` Items []GetStationScheduleResponseItem `xml:"ITEMS>ITEM"` }
type GetStationScheduleResponseItem ¶
type GetStationScheduleResponseItem struct { ItemIndex int `xml:"ITEM_INDEX"` SchedDepDate string `xml:"SCHED_DEP_DATE"` Destination string `xml:"DESTINATION"` SchedTrack string `xml:"SCHED_TRACK"` // see Appendix II TrainID string `xml:"TRAIN_ID"` Line string `xml:"LINE"` StationPosition string `xml:"STATION_POSITION"` // see Appendix III Direction string `xml:"DIRECTION"` DwellTimeSeconds int `xml:"DWELL_TIME"` PermConnectingTrainID string `xml:"PERM_CONNECTING_TRAIN_ID"` PermPickup string `xml:"PERM_PICKUP"` PermDropoff string `xml:"PERM_DROPOFF"` StopCode string `xml:"STOP_CODE"` // see Appendix IV StoppingAt string `xml:"STOPPING_AT"` }
type GetTrainSchedule19RecResponse ¶
type GetTrainSchedule19RecResponse struct { TwoChar string `xml:"STATION_2CHAR"` Name string `xml:"STATIONNAME"` Items []*GetTrainSchedule19RecResponseItem `xml:"ITEMS>ITEM"` }
type GetTrainSchedule19RecResponseItem ¶ added in v1.1.0
type GetTrainSchedule19RecResponseItem struct { ItemIndex int `xml:"ITEM_INDEX"` SchedDepDate string `xml:"SCHED_DEP_DATE"` Destination string `xml:"DESTINATION"` Track string `xml:"TRACK"` Line string `xml:"LINE"` TrainID string `xml:"TRAIN_ID"` ConnectingTrainID string `xml:"CONNECTING_TRAIN_ID"` Status string `xml:"STATUS"` SecLate int `xml:"SEC_LATE"` LastModified string `xml:"LAST_MODIFIED"` BackgroundColor string `xml:"BACKCOLOR"` ForegroundColor string `xml:"FORECOLOR"` ShadowColor string `xml:"SHADOWCOLOR"` GPSLatitude string `xml:"GPSLATITUDE"` GPSLongitude string `xml:"GPSLONGITUDE"` GPSTime string `xml:"GPSTIME"` StationPosition string `xml:"STATION_POSITION"` LineAbbreviation string `xml:"LINEABBREVIATION"` InlineMessage string `xml:"INLINEMSG"` }
type GetTrainScheduleResponse ¶
type GetTrainScheduleResponse struct { }
type GetVehicleDataResponse ¶
type GetVehicleDataResponse struct { }
type ScheduleXGTFSTrip ¶
type ScheduleXGTFSTrip struct { GTFSTripID int `xml:"gtfs_trip_id"` GTFSStopID int `xml:"gtfs_stop_id"` GTFSStopCode string `xml:"gtfs_stop_Code"` GTFSRouteID int `xml:"gtfs_route_id"` GTFSServiceID int `xml:"gtfs_service_id"` GTFSFileDate string `xml:"gtfs_file_Date"` Route string `xml:"route"` Lanegate string `xml:"lanegate"` // terminal Line or Gate (".." for inbound buses) ScheduledLaneGate string `xml:"scheduled_lane_gate"` ManualLaneGate string `xml:"manual_lane_gate"` DepartureTime string `xml:"departuretime"` // example: 1:41 AM ScheduledDepartureDate string `xml:"scheduleddeparturedate"` // example: 03-JAN-19 ScheduledDepartureTime string `xml:"scheduleddeparturetime"` // example: 1:41 AM SchedDepTime string `xml:"sched_dep_Time"` // example: 03-JAN-19 01.41.00.000000 AM SecLate string `xml:"sec_late"` BusHeader string `xml:"busheader"` RunID string `xml:"run_id"` StopName string `xml:"stopname"` StopCity string `xml:"stopcity"` // example: NEW YORK CITY TripBlock string `xml:"trip_block"` Direction string `xml:"direction"` // can be "In" or "Ou" }
ScheduleXGTFSTrip is part of the GetScheduleXGTFSResponse
type TrainDataClient ¶
type TrainDataClient struct {
// contains filtered or unexported fields
}
func NewTrainDataClient ¶
func NewTrainDataClient(httpClient httpClient, username, password, trainDataURL string) *TrainDataClient
func (*TrainDataClient) GetStationList ¶
func (t *TrainDataClient) GetStationList() (*GetStationListResponse, error)
GetStationList - List all stations
func (*TrainDataClient) GetStationMessage ¶
func (t *TrainDataClient) GetStationMessage(station, trainLine string) (*GetStationMessageResponse, error)
GetStationMessage - Gets the all station message, but when pass station code, returns station message. Note – this is provided by a third party from our above APIs.
func (*TrainDataClient) GetStationSchedule ¶
func (t *TrainDataClient) GetStationSchedule(station string, njtransitOnly bool) (*GetStationScheduleResponse, error)
GetStationSchedule - Provides a list of the 27 hours of train schedule data for any one station or all stations. Limited access to 10 times per day but only needed once per day after midnight - 12:30 would be better - to show the schedule for the 27 hour period from 12 midnight until 3am the next day. The GTFS data does not always match the daily schedules in our train control system. NJT_Only is a filter, pass value 1 for NJT trains only; pass value 0 for All trains
func (*TrainDataClient) GetTrainSchedule ¶
func (t *TrainDataClient) GetTrainSchedule(station string, njtransitOnly bool) (*GetTrainScheduleResponse, error)
GetTrainSchedule - List train schedule for a given station, data is much the same as DepartureVision with train stop list information
func (*TrainDataClient) GetTrainSchedule19Rec ¶
func (t *TrainDataClient) GetTrainSchedule19Rec(station string) (*GetTrainSchedule19RecResponse, error)
GetTrainScheduleJSON19Rec - List train schedule for a given station, data is much the same as DepartureVision, but without train stop list information.
func (*TrainDataClient) GetVehicleData ¶
func (t *TrainDataClient) GetVehicleData() (*GetVehicleDataResponse, error)
GetVehicleDataXML - Provides the real-time position data for each active train. Provides the latest position, next station and seconds late for any train that has moved in the last 5 minutes. There is a limit of 40,000 requests per day.