rtd

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	URL_TEMPLATE = "https://nodejs-prod.rtd-denver.com/api/v2/nextride/stops/%d"
	API_KEY      = "e7b926a1-cddb-46e7-bb27-6d134e5b5feb"
	BROWSER      = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4.1 Safari/605.1.15"
)
View Source
const (
	SCHEDULED = "SCHEDULED"
	SHUTTLE   = "BUS SHUTTLE"
)

Variables

This section is empty.

Functions

func NewRequest

func NewRequest(line string, stop uint64) (*http.Request, error)

Types

type Branch

type Branch struct {
	ID             string  `json:"id"`
	RouteColor     string  `json:"routeColor"`
	RouteTextColor string  `json:"routeTextColor"`
	RouteLongName  string  `json:"routeLongName"`
	RouteType      *int    `json:"routeType"`
	Mode           string  `json:"mode"`
	Headsign       string  `json:"headsign"`
	DirectionID    *int    `json:"directionId"`
	DirectionName  string  `json:"directionName"`
	StopName       string  `json:"stopName"`
	StopID         string  `json:"stopId"`
	AgencyID       string  `json:"agencyId"`
	DropoffOnly    bool    `json:"dropoffOnly"`
	UpcomingTrips  []*Trip `json:"upcomingTrips"`
}

type Rtd

type Rtd struct {
	Client *http.Client
	Line   string
	Stop   uint64
}

func NewRtd

func NewRtd(line string, stop uint64) *Rtd

NewRtd creates a new Rtd struct with a sensible default http.Client (10 second timeout)

func (Rtd) DoRequest

func (r Rtd) DoRequest(req *http.Request) (*http.Response, error)

func (Rtd) Get

func (r Rtd) Get() (*Trip, error)

type Station

type Station struct {
	ID                string    `json:"id"`
	Name              string    `json:"name"`
	Lat               float64   `json:"lat"`
	Lng               float64   `json:"lng"`
	ChildStops        []string  `json:"childStops"`
	ParentStationName string    `json:"parentStationName"`
	ParentStationID   string    `json:"parentStationId"`
	Branches          []*Branch `json:"branches"`
}

func (*Station) GetUpcomingTrip

func (s *Station) GetUpcomingTrip(line string) *Trip

type Trip

type Trip struct {
	PredictedArrivalTime   *int64   `json:"predictedArrivalTime"`
	PredictedDepartureTime *int64   `json:"predictedDepartureTime"`
	ScheduledArrivalTime   *int64   `json:"scheduledArrivalTime"`
	ScheduledDepartureTime *int64   `json:"scheduledDepartureTime"`
	StopDropOffType        *int     `json:"stopDropOffType"`
	StopPickupType         *int     `json:"stopPickupType"`
	TripID                 string   `json:"tripId"`
	TripStatus             string   `json:"tripStatus"`
	TripStopStatus         string   `json:"tripStopStatus"`
	Vehicle                *Vehicle `json:"vehicle,omitempty"`
}

func (*Trip) GetTime

func (t *Trip) GetTime() string

func (*Trip) IsScheduled

func (t *Trip) IsScheduled() bool

func (*Trip) IsShuttleBus

func (t *Trip) IsShuttleBus() bool

func (*Trip) IsValid

func (t *Trip) IsValid() bool

type Vehicle

type Vehicle struct {
	Bearing        *float32 `json:"bearing"`
	ID             string   `json:"id"`
	Label          string   `json:"label"`
	Lat            *float32 `json:"lat"`
	Lng            *float32 `json:"lng"`
	Timestamp      *int64   `json:"timestamp"`
	RouteTextColor string   `json:"routeTextColor"`
	RouteColor     string   `json:"routeColor"`
	Mode           string   `json:"mode"`
}

Jump to

Keyboard shortcuts

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