njtransit

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BusProdURL = "https://pcsdata.njtransit.com/api/GTFS/"
	BusTestURL = "https://testpcsdata.njtransit.com/api/GTFS/"
)
View Source
const (
	BusDVProdURL = "https://pcsdata.njtransit.com/api/BUSDV2/"
	BusDVTestURL = "https://testpcsdata.njtransit.com/api/BUSDV2/"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BusClient

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

BusClient holds information between API calls

func NewBusClient

func NewBusClient(
	url,
	username,
	password,
	userAgent string,
	client HTTPClient,
) (*BusClient, error)

NewBusClient creates new BusClient

func (*BusClient) AuthenticateUser

func (bc *BusClient) AuthenticateUser() error

AuthenticateUser gets token for user

func (*BusClient) GetAlerts

func (bc *BusClient) GetAlerts() (*gtfs.FeedMessage, error)

func (*BusClient) GetGTFS

func (bc *BusClient) GetGTFS() ([]byte, error)

func (*BusClient) GetTripUpdates

func (bc *BusClient) GetTripUpdates() (*gtfs.FeedMessage, error)

func (*BusClient) GetVehiclePositions

func (bc *BusClient) GetVehiclePositions() (*gtfs.FeedMessage, error)

type BusDV2Client

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

BusDV2Client holds information between API calls

func NewBusDV2Client

func NewBusDV2Client(
	url,
	username,
	password,
	userAgent string,
	client HTTPClient,
) (*BusDV2Client, error)

NewBusDV2Client creates new BusDV2Client

func (*BusDV2Client) AuthenticateUser

func (bc *BusDV2Client) AuthenticateUser() error

AuthenticateUser gets token for user

func (*BusDV2Client) GetBusDV

func (bc *BusDV2Client) GetBusDV(stop, direction, route, ip string) (*GetBusDVResponse, error)

func (*BusDV2Client) GetVehicleLocations

func (bc *BusDV2Client) GetVehicleLocations(lat, lon string, radius int, mode string) (*GetVehicleLocations, error)

type DVTrip

type DVTrip struct {
	PublicRoute     string `json:"public_route"`
	Header          string `json:"header"`
	Lanegate        string `json:"lanegate"`
	DepartureTime   string `json:"departuretime"`
	Remarks         string `json:"remarks"`
	InternalTripNum string `json:"internal_trip_number"`
	SchedDepTime    string `json:"sched_dep_time"`
	TimingPointID   string `json:"timing_point_id"`
	Message         string `json:"message"`
	FullScreen      string `json:"fullscreen"`
	PassLoad        string `json:"passload"`
	VehicleID       string `json:"vehicle_id"`
}

type GetBusDVResponse

type GetBusDVResponse struct {
	Message struct {
		Message string `json:"message"`
	} `json:"message"`
	DVTrip DVTrip `json:"DVTrip"`
}

type GetVehicleLocations

type GetVehicleLocations []VehicleLocation

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

type VehicleLocation

type VehicleLocation struct {
	VehicleLat                string `json:"VehicleLat"`
	VehicleLong               string `json:"VehicleLong"`
	VehicleID                 string `json:"VehicleID"`
	VehiclePassengerLoad      string `json:"VehiclePassengerLoad"`
	VehicleRoute              string `json:"VehicleRoute"`
	VehicleDestination        string `json:"VehicleDestination"`
	VehicleDistanceMiles      string `json:"VehicleDistanceMiles"`
	VehicleInternalTripNumber string `json:"VehicleInternalTripNumber"`
	VehicleScheduledDeparture string `json:"VehicleScheduledDeparture"`
}

Jump to

Keyboard shortcuts

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