oba

package module
v0.0.0-...-7e1cf15 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

README

oba - Golang Api for One Bus Away

Build Status Go Report Card Coverage Status

OneBusAway

Summary

I wanted to write some apps that interface with one bus away and could not find a go api, so I wrote one! One Bus Away Documentation It was also a good excuse to have some fun with golang

Get

$ go get -u github.com/Setheck/oba

Import

import (
    "log"
    "github.com/Setheck/oba"
)

Use

Agency
func main() {
    client := oba.NewDefaultClientS(server.URL, TestApiKey)
    agency, e := client.Agency("1")
    if e != nil {
        log.Fatal(e)
    }
}
AgenciesWithCoverage
func main() {
    client := oba.NewDefaultClientS(server.URL, TestApiKey)
    awcs, e := client.AgenciesWithCoverage()
    if e != nil {
        log.Fatal(e)
    }
}
Route
func main() {
    client := oba.NewDefaultClientS("http://api.pugetsound.onebusaway.org/api/where/", "TEST")
    route, err := client.Route("1_100224")
    if err != nil {
        log.Fatal(err)
    }
    log.Print(route.ID)
}

Documentation

Overview

Package oba - One Bus Away Go Api https://onebusaway.org/ Author: Seth T <[email protected]>

Package oba - One Bus Away Go Api https://onebusaway.org/ Author: Seth T <[email protected]>

Package oba - One Bus Away Go Api https://onebusaway.org/ Author: Seth T <[email protected]>

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agency

type Agency struct {
	Disclaimer     string
	Email          string
	FareURL        string
	ID             string
	Lang           string
	Name           string
	Phone          string
	PrivateService *bool
	TimeZone       string
	URL            string
}

Agency container object

func (Agency) String

func (a Agency) String() string

type AgencyWithCoverage

type AgencyWithCoverage struct {
	Agency  Agency
	Lat     float64
	LatSpan float64
	Lon     float64
	LonSpan float64
}

func (AgencyWithCoverage) String

func (a AgencyWithCoverage) String() string

type AltData

type AltData struct {
	List []string `json:"list,omitempty"`
}

func (AltData) String

func (d AltData) String() string

type AltEntry

type AltEntry struct {
	ID         string     `json:"id,omitempty"`
	Name       *NameEntry `json:"name,omitempty"`
	Names      []string   `json:"names,omitempty"`
	PolyLines  AltList    `json:"polylines,omitempty"`
	StopIDs    []string   `json:"stopIds,omitempty"`
	SubGroups  AltList    `json:"subGroups,omitempty"`
	Length     int        `json:"length,omitempty"`
	Levels     string     `json:"levels,omitempty"`
	Points     string     `json:"points,omitempty"`
	Type       string     `json:"type,omitempty"`
	Ordered    *bool      `json:"ordered,omitempty"`
	StopGroups AltList    `json:"stopGroups,omitempty"`
}

func (AltEntry) ToEncodedPolyLine

func (e AltEntry) ToEncodedPolyLine() *EncodedPolyLine

func (AltEntry) ToStopGrouping

func (e AltEntry) ToStopGrouping(ss []Stop) *StopGrouping

func (AltEntry) ToStopGroups

func (e AltEntry) ToStopGroups(stops []Stop) *StopGroup

type AltList

type AltList []AltEntry

type AltResponse

type AltResponse struct {
	Code        int      `json:"code"`
	CurrentTime int      `json:"currentTime"`
	Data        *AltData `json:"data,omitempty"`
	Text        string   `json:"text"`
	Version     int      `json:"version"`
}

func (AltResponse) String

func (r AltResponse) String() string

type ArrivalAndDeparture

type ArrivalAndDeparture struct {
	ArrivalEnabled               *bool
	BlockTripSequence            int
	DepartureEnabled             *bool
	DistanceFromStop             float64
	Frequency                    *string
	LastUpdateTime               int
	NumberOfStopsAway            int
	Predicted                    *bool
	PredictedArrivalInterval     int
	PredictedArrivalTime         int
	PredictedDepartureInterval   int
	PredictedDepartureTime       int
	ScheduleDeviationHistogramID string
	RouteID                      string
	RouteLongName                string
	RouteShortName               string
	ScheduledArrivalInterval     int
	ScheduledArrivalTime         int
	ScheduledDepartureInterval   int
	ScheduledDepartureTime       int
	ServiceDate                  int
	SituationIDs                 []string
	Status                       string
	StopID                       string
	StopSequence                 int
	TotalStopsInTrip             int
	TripHeadSign                 string
	TripID                       string
	TripStatus                   *TripStatus
	VehicleID                    string
}

func (ArrivalAndDeparture) String

func (a ArrivalAndDeparture) String() string

type ArrivalsAndDepartures

type ArrivalsAndDepartures []ArrivalAndDeparture

type Block

type Block struct {
	ID             string
	Configurations []BlockConfiguration
}

func (Block) String

func (b Block) String() string

type BlockConfiguration

type BlockConfiguration struct {
	ActiveServiceIDs   []string
	InactiveServiceIDs []string
	Trips              []BlockTrip
}

func (BlockConfiguration) String

func (b BlockConfiguration) String() string

type BlockStopTime

type BlockStopTime struct {
	AccumulatedSlackTime float64
	BlockSequence        int
	DistanceAlongBlock   float64
	StopTime             StopTime
}

func (BlockStopTime) String

func (b BlockStopTime) String() string

type BlockTrip

type BlockTrip struct {
	TripID         string
	BlockStopTimes []BlockStopTime
}

func (BlockTrip) String

func (b BlockTrip) String() string

type Client

type Client interface {
	AgenciesWithCoverage() ([]AgencyWithCoverage, error)
	Agency(id string) (*Agency, error)
	ArrivalAndDepartureForStop(id string, params map[string]string) (*ArrivalAndDeparture, error)
	ArrivalsAndDeparturesForStop(id string, params map[string]string) (*StopWithArrivalsAndDepartures, error)
	Block(id string) (*Block, error)
	CancelAlarm(id string) error
	CurrentTime() (*CurrentTime, error)
	RegisterAlarmForArrivalAndDepartureAtStop(id string, params map[string]string) (*RegisteredAlarm, error)
	ReportProblemWithStop(id string, params map[string]string) error
	ReportProblemWithTrip(id string, params map[string]string) error
	RouteIdsForAgency(id string) ([]string, error)
	Route(id string) (*Route, error)
	RoutesForAgency(id string) ([]Route, error)
	RoutesForLocation(params map[string]string) ([]Route, error)
	ScheduleForStop(id string) (*StopSchedule, error)
	Shape(id string) (*Shape, error)
	StopIDsForAgency(id string) ([]string, error)
	Stop(id string) (*Stop, error)
	StopsForLocation(params map[string]string) ([]Stop, error)
	StopsForRoute(id string) (*StopsForRoute, error)
	TripDetails(id string) (*TripDetails, error)
	TripForVehicle(id string, params map[string]string) (*TripDetails, error)
	Trip(id string) (*Trip, error)
	TripsForLocation(params map[string]string) ([]TripDetails, error)
	TripsForRoute(id string) ([]TripDetails, error)
	VehiclesForAgency(id string) ([]VehicleStatus, error)
}

Client - Interface for a One Bus Away Client

type Consequence

type Consequence struct {
	Condition                          string
	ConditionDetailDiversionPathPoints []string
	ConditionDetailDiversionStopIDs    []string
}

func (Consequence) String

func (c Consequence) String() string

type Coverage

type Coverage struct {
	AgencyID string
	Lat      float64
	LatSpan  float64
	Lon      float64
	LonSpan  float64
}

func (Coverage) String

func (c Coverage) String() string

type CurrentTime

type CurrentTime struct {
	ReadableTime string
	Time         int
}

func (CurrentTime) String

func (c CurrentTime) String() string

type Data

type Data struct {
	LimitExceeded *bool       `json:"limitExceeded,omitempty"`
	List          *List       `json:"list,omitempty"`
	Entry         *Entry      `json:"entry,omitempty"`
	OutOfRange    *bool       `json:"outOfRange,omitempty"`
	References    *References `json:"references"`
	Time          *Time       `json:",omitempty"`
}

Data container object

func (Data) Agencies

func (d Data) Agencies() []Agency

func (Data) Routes

func (d Data) Routes(ags []Agency) []Route

func (Data) Situations

func (d Data) Situations() []Situation

func (Data) Stops

func (d Data) Stops(rs []Route) []Stop

func (Data) String

func (d Data) String() string

func (Data) TripDetails

func (d Data) TripDetails() *TripDetails

func (Data) Trips

func (d Data) Trips() []Trip

type DefaultClient

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

func NewDefaultClient

func NewDefaultClient(u *url.URL, apiKey string) *DefaultClient

NewDefaultClient - instantiate a new instance of a Client

func NewDefaultClientS

func NewDefaultClientS(s string, apiKey string) *DefaultClient

func (DefaultClient) AgenciesWithCoverage

func (c DefaultClient) AgenciesWithCoverage() ([]AgencyWithCoverage, error)

AgenciesWithCoverage - list all supported agencies along with the center of

their coverage area

http://developer.onebusaway.org/modules/onebusaway-application-modules/current/api/where/methods/agencies-with-coverage.html

Method: agency-with-coverage

Returns a list of all transit agencies currently supported by OneBusAway
along with the center of their coverage area.

Sample Request http://api.pugetsound.onebusaway.org/api/where/agencies-with-coverage.xml?key=TEST

Sample Response <response>

<version>2</version>
<code>200</code>
<text>OK</text>
<currentTime>1270614730908</currentTime>
<data class="listWithReferences">
  <references>...</references>
  <list>
    <agencyWithCoverage>
      <agencyId>3</agencyId>
      <lat>47.21278384769539</lat>
      <lon>-122.45624875362905</lon>
      <latSpan>0.3559410000000014</latSpan>
      <lonSpan>0.9080050000000028</lonSpan>
    </agencyWithCoverage>
    <agencyWithCoverage>...</agencyWithCoverage>
 </list>
  <limitExceeded>false</limitExceeded>
</data>

</response>

Response The response has the following fields:

agencyId - 				an agency id for the agency whose coverage is included.
						Should match an <agency/> element referenced in the
						<references/> section.

lat and lon - indicates the center of the agency’s coverage area latSpan and lonSpan - indicate the height (lat) and width (lon) of the

coverage bounding box for the agency.

func (DefaultClient) Agency

func (c DefaultClient) Agency(id string) (*Agency, error)

func (DefaultClient) ArrivalAndDepartureForStop

func (c DefaultClient) ArrivalAndDepartureForStop(id string, params map[string]string) (*ArrivalAndDeparture, error)

ArrivalAndDepartureForStop - details about a specific arrival/departure at a

stop

http://developer.onebusaway.org/modules/onebusaway-application-modules/current/api/where/methods/arrival-and-departure-for-stop.html

Method: arrival-and-departure-for-stop

Get info about a single arrival and departure for a stop

Sample Request http://api.pugetsound.onebusaway.org/api/where/arrival-and-departure-for-stop/1_75403.xml?key=TEST&tripId=1_15551341&serviceDate=1291536000000&vehicleId=1_3521&stopSequence=42

Sample Response <response>

<version>2</version>
<code>200</code>
<text>OK</text>
<currentTime>1270614730908</currentTime>
<data class="entryWithReferences">
  <references>...</references>
  <entry class="arrivalAndDeparture">
    <!-- See documentation for the arrivalAndDeparture element, linked below -->
  </entry>
</data>

</response>

Request Parameters id - the stop id, encoded directly in the URL:

http://api.pugetsound.onebusaway.org/api/where/arrival-and-departure-for-stop/[ID GOES HERE].xml

tripId - the trip id of the arriving transit vehicle serviceDate - the service date of the arriving transit vehicle vehicleId - the vehicle id of the arriving transit vehicle (optional) stopSequence - the stop sequence index of the stop in the transit vehicle’s trip time - by default, the method returns the status of the system

right now. However, the system can also be queried at a
specific time. This can be useful for testing. See
timestamps for details on the format of the time parameter.

The key here is uniquely identifying which arrival you are interested in. Typically, you would first make a call to arrivals-and-departures-for-stop to get a list of upcoming arrivals and departures at a particular stop. You can then use information from those results to specify a particular arrival. At minimum, you must specify the trip id and service date. Additionally, you are also encouraged to specify the vehicle id if available to help disambiguate between multiple vehicles serving the same trip instance. Finally, you are encouraged to specify the stop sequence. This helps in the situation when a vehicle visits a stop multiple times during a trip (it happens) plus there is performance benefit on the back-end as well.

Response The method returns an <arrivalAndDeparture/> element as its content.

func (DefaultClient) ArrivalsAndDeparturesForStop

func (c DefaultClient) ArrivalsAndDeparturesForStop(id string, params map[string]string) (*StopWithArrivalsAndDepartures, error)

ArrivalsAndDeparturesForStop - get current arrivals and departures for a stop http://developer.onebusaway.org/modules/onebusaway-application-modules/current/api/where/methods/arrivals-and-departures-for-stop.html

Method: arrivals-and-departures-for-stop

Get current arrivals and departures for a stop identified by id

Sample Request http://api.pugetsound.onebusaway.org/api/where/arrivals-and-departures-for-stop/1_75403.xml?key=TEST

Sample Response <response>

<version>2</version>
<code>200</code>
<text>OK</text>
<currentTime>1270614730908</currentTime>
<data class="listWithReferences">
  <references>...</references>
  <entry class="stopWithArrivalsAndDepartures">
    <stopId>1_75403</stopId>
    <arrivalsAndDepartures>
      <arrivalAndDeparture>...</arrivalAndDeparture>
      <arrivalAndDeparture>...</arrivalAndDeparture>
      <arrivalAndDeparture>...</arrivalAndDeparture>
    </arrivalsAndDepartures>
    <nearbyStopIds>
      <string>1_75414</string>
      <string>...</string>
    </nearbyStopIds>
  </entry>
</data>

</response>

Request Parameters id - the stop id, encoded directly in the URL:

http://api.pugetsound.onebusaway.org/api/where/arrivals-and-departures-for-stop/[ID GOES HERE].xml

minutesBefore=n - include vehicles having arrived or departed in the

previous n minutes (default=5)

minutesAfter=n - include vehicles arriving or departing in the next n

minutes (default=35)

time - by default, the method returns the status of the system

right now. However, the system can also be queried at a
specific time. This can be useful for testing. See
timestamps for details on the format of the time parameter.

Response The response is primarily composed of <arrivalAndDeparture/> elements, so see the element documentation for specific details. The nearby stop list is designed to capture stops that are very close by (like across the street) for quick navigation.

func (DefaultClient) Block

func (c DefaultClient) Block(id string) (*Block, error)

func (DefaultClient) CancelAlarm

func (c DefaultClient) CancelAlarm(id string) error

CancelAlarm - cancel a registered alarm http://developer.onebusaway.org/modules/onebusaway-application-modules/current/api/where/methods/cancel-alarm.html

Method: cancel-alarm

Cancel a registered alarm.

Sample Request http://api.pugetsound.onebusaway.org/api/where/cancel_alarm/1_00859082-9b9d-4f72-a89f-c4be0e2cf01a.xml

Sample Response <response>

<version>2</version>
<code>200</code>
<text>OK</text>
<currentTime>1270614730908</currentTime>
<data>
  <references/>
</data>

</response>

Request Parameters id - the alarm id is encoded directly in the URL

http://api.pugetsound.onebusaway.org/api/where/cancel_alarm/[ID GOES HERE].xml

The alarm id is returned in the call to register-alarm-for-arrival-and-departure-at-stop API method.

func (DefaultClient) CurrentTime

func (c DefaultClient) CurrentTime() (*CurrentTime, error)

func (DefaultClient) RegisterAlarmForArrivalAndDepartureAtStop

func (c DefaultClient) RegisterAlarmForArrivalAndDepartureAtStop(id string, params map[string]string) (*RegisteredAlarm, error)

func (DefaultClient) ReportProblemWithStop

func (c DefaultClient) ReportProblemWithStop(id string, params map[string]string) error

ReportProblemWithStop - submit a user-generated problem for a stop This is an assumption

func (DefaultClient) ReportProblemWithTrip

func (c DefaultClient) ReportProblemWithTrip(id string, params map[string]string) error

ReportProblemWithTrip - submit a user-generated problem for a trip http://developer.onebusaway.org/modules/onebusaway-application-modules/current/api/where/methods/report-problem-with-trip.html

Method: report-problem-with-trip Submit a user-generated problem report for a particular trip. The reporting mechanism provides lots of fields that can be specified to give more context about the details of the problem (which trip, stop, vehicle, etc was involved), making it easier for a developer or transit agency staff to diagnose the problem. These reports feed into the problem reporting admin interface.

Sample Request http://api.pugetsound.onebusaway.org/api/where/report-problem-with-trip/1_79430293.xml?key=TEST&serviceDate=1291536000000&vehicleId=1_3521&stopId=1_75403&code=vehicle_never_came

Sample Response <response>

<version>2</version>
<code>200</code>
<currentTime>1318879898047</currentTime>
<text>OK</text>
<data/>

</response>

Request Parameters tripId - the trip id, encoded directly in the URL:

http://api.pugetsound.onebusaway.org/api/where/report-problem-with-trip/[ID GOES HERE].xml

serviceDate - the service date of the trip vehicleId - the vehicle actively serving the trip stopId - a stop id indicating the stop where the user is experiencing

the problem

code - a string code identifying the nature of the problem

vehicle_never_came
vehicle_came_early - 			the vehicle arrived earlier
								than predicted
vehicle_came_late - 			the vehicle arrived later
								than predicted
wrong_headsign - 				the headsign reported by
								OneBusAway differed from the
								vehicle’s actual headsign
vehicle_does_not_stop_here - 	the trip in question does
								not actually service the
								indicated stop
other - 						catch-all for everythign else

userComment - additional comment text supplied by the user describing the

problem

userOnVehicle - true/false to indicate if the user is on the transit vehicle

experiencing the problem

userVehicleNumber - the vehicle number, as reported by the user userLat - the reporting user’s current latitude userLon - the reporting user’s current longitude userLocationAccuracy - the reporting user’s location accuracy, in meters

In general, everything but the trip id itself is optional, but generally speaking, providing more fields in the report will make it easier to diagnose the actual underlying problem. Note that while we record specific location information for the user, we do not store any identifying information for the user in order to make it hard to link the user to their location as some point in the future.

func (DefaultClient) Route

func (c DefaultClient) Route(id string) (*Route, error)

func (DefaultClient) RouteIdsForAgency

func (c DefaultClient) RouteIdsForAgency(id string) ([]string, error)

RouteIdsForAgency - get a list of all route ids for an agency http://developer.onebusaway.org/modules/onebusaway-application-modules/current/api/where/methods/route-ids-for-agency.html

Method: route-ids-for-agency

Retrieve the list of all route ids for a particular agency.

Sample Request http://api.pugetsound.onebusaway.org/api/where/route-ids-for-agency/40.xml?key=TEST

Sample Respsone <response>

<version>2</version>
<code>200</code>
<text>OK</text>
<currentTime>1270614730908</currentTime>
<data class="listWithReferences">
  <references/>
  <list>
    <string>40_510</string>
    <string>40_511</string>
    <string>40_513</string>
    <string>...</string>
  </list>
  <limitExceeded>false</limitExceeded>
</data>

</response>

Request Parameters id - the id of the agency, encoded directly in the URL:

http://api.pugetsound.onebusaway.org/api/where/route-ids-for-agency/[ID GOES HERE].xml?key=TEST

Response Returns a list of all route ids for routes served by the specified agency. Note that <route/> elements for the referenced routes will NOT be included in the <references/> section, since there are potentially a large number of routes for an agency.

func (DefaultClient) RoutesForAgency

func (c DefaultClient) RoutesForAgency(id string) ([]Route, error)

func (DefaultClient) RoutesForLocation

func (c DefaultClient) RoutesForLocation(params map[string]string) ([]Route, error)

RoutesForLocation - search for routes near a location, optionally by route name http://developer.onebusaway.org/modules/onebusaway-application-modules/current/api/where/methods/routes-for-location.html

Method: routes-for-location

Search for routes near a specific location, optionally by name

Sample Request http://api.pugetsound.onebusaway.org/api/where/routes-for-location.xml?key=TEST&lat=47.653435&lon=-122.305641

Sample Response <response>

<version>2</version>
<code>200</code>
<text>OK</text>
<currentTime>1270614730908</currentTime>
<data class="listWithReferences">
  <references>...</references>
  <list>
    <route>...</route>
    <!-- More routes -->
  </list>
  <limitExceeded>true</limitExceeded>
</data>

</response>

Request Parameters lat - The latitude coordinate of the search center lon - The longitude coordinate of the search center radius - The search radius in meters (optional) latSpan/lonSpan - An alternative to radius to set the search bounding

box (optional)

query - A specific route short name to search for (optional) If you just specify a lat,lon search location, the routes-for-location method will just return nearby routes. If you specify an optional query parameter,

we’ll search for nearby routes with the specified route short name. This is

the primary method from going from a user-facing route name like “44” to the actual underlying route id unique to a route for a particular transit agency.

Response The routes-for-location method returns a list result, so see additional documentation on controlling the number of elements returned and interpreting the results. The list contents are <route/> elements.

func (DefaultClient) ScheduleForStop

func (c DefaultClient) ScheduleForStop(id string) (*StopSchedule, error)

ScheduleForStop - get the full schedule for a stop on a particular day http://developer.onebusaway.org/modules/onebusaway-application-modules/current/api/where/methods/schedule-for-stop.html

Method: schedule-for-stop

Retrieve the full schedule for a stop on a particular day

Sample Request http://api.pugetsound.onebusaway.org/api/where/schedule-for-stop/1_75403.xml?key=TEST

Sample Response <response>

<version>2</version>
<code>200</code>
<text>OK</text>
<currentTime>1270614730908</currentTime>
<data class="entryWithReferences">
  <references>...</references>
  <entry class="stopSchedule">
    <date>1270623339481</date>
    <stopId>1_75403</stopId>
    <stopRouteSchedules>
      <stopRouteSchedule>
        <routeId>1_31</routeId>
        <stopRouteDirectionSchedules>
          <stopRouteDirectionSchedule>
            <tripHeadsign>Central Magnolia</tripHeadsign>
            <scheduleStopTimes>
              <scheduleStopTime>
                <arrivalTime>1270559769000</arrivalTime>
                <departureTime>1270559769000</departureTime>
                <serviceId>1_114-WEEK</serviceId>
                <tripId>1_11893408</tripId>
              </scheduleStopTime>
              <!-- More schduleStopTime entries... -->
            </scheduleStopTimes>
          </stopRouteDirectionSchedule>
        </stopRouteDirectionSchedules>
        <!-- More stopRouteDirectionSchedule entries -->
      </stopRouteSchedule>
      <!-- More stopRouteSchedule entries -->
    </stopRouteSchedules>
    <timeZone>America/Los_Angeles</timeZone>
    <stopCalendarDays>
      <stopCalendarDay>
        <date>1276239600000</date>
        <group>1</group>
        </stopCalendarDay>
      <!-- More stopCalendarDay entries -->
    </stopCalendarDays>
  </entry>
</data>

</response>

Request Parameters id - the stop id to request the schedule for, encoded directly in the URL:

http://api.pugetsound.onebusaway.org/api/where/schedule-for-stop/[ID GOES HERE].xml

date - The date for which you want to request a schedule of the format YYYY-MM-DD (optional, defaults to current date)

Response The response is pretty complex, so we’ll describe the details at a high-level along with references to the various elements in the response. The response can be considered in two parts. The first part lists specific arrivals and departures at a stop on a given date (<stopRouteSchedules/> section) while the second part lists which days the stop currently has service defined (the <stopCalendarDays/> section). By convention, we refer to the arrival and departure time details for a particular trip at a stop as a stop time.

We break up the stop time listings in a couple of ways. First, we split the stop times by route (corresponds to each <stopRouteSchedule/> element). We next split the stop times for each route by direction of travel along the route (corresponds to each <stopRouteDirectionSchedule/> element). Most stops will serve just one direction of a particular route, but some stops will serve both directions, and it may be useful to present those listings separately. Each <stopRouteDirectionSchedule/> element has a tripHeadsign property that indicates the direction of travel.

Finally we get down to the unit of a stop time, as represented by the <scheduleStopTime/> element. Each element has the following set of properties: arrivalTime - time in milliseconds since the Unix epoch that the transit

vehicle will arrive

departureTime - time in milliseconds since the Unix epoch that the transit

vehicle will depart

tripId - the id for the trip of the scheduled transit vehicle serviceId - the serviceId for the schedule trip (see the GTFS spec for

more details

In addition to all the <scheduleStopTime/> elements, the response also contains <stopCalendarDay/> elements which list out all the days that a particular stop has service. This element has the following properties: date - the date of service in milliseconds since the Unix epoch group - we provide a group id that groups <stopCalendarDay/> into

collections of days with similar service. For example,
Monday-Friday might all have the same schedule and the same group
id as result, while Saturday and Sunday have a different weekend
schedule, so they’d get their own group id.

In addition to all the <scheduleStopTime/> elements, the main entry also has the following properties: date - the active date for the returned calendar stopId - the stop id for the requested stop, which can be used to access

the <stop/> element in the <references/> section

timeZone - the time-zone the stop is located in

func (DefaultClient) Shape

func (c DefaultClient) Shape(id string) (*Shape, error)

func (DefaultClient) Stop

func (c DefaultClient) Stop(id string) (*Stop, error)

func (DefaultClient) StopIDsForAgency

func (c DefaultClient) StopIDsForAgency(id string) ([]string, error)

func (DefaultClient) StopsForLocation

func (c DefaultClient) StopsForLocation(params map[string]string) ([]Stop, error)

StopsForLocation - search for stops near a location, optionally by stop code http://developer.onebusaway.org/modules/onebusaway-application-modules/current/api/where/methods/stops-for-location.html

Method: stops-for-location

Search for stops near a specific location, optionally by stop code

Sample Request http://api.pugetsound.onebusaway.org/api/where/stops-for-location.xml?key=TEST&lat=47.653435&lon=-122.305641

Sample Response <response>

<version>2</version>
<code>200</code>
<text>OK</text>
<currentTime>1270614730908</currentTime>
<data class="listWithReferences">
  <references>...</references>
  <list>
    <stop>...</stop>
    <!-- More stops -->
  </list>
  <limitExceeded>true</limitExceeded>
  <outOfRange>false</outOfRange>
</data>

</response>

Request Parameters lat - The latitude coordinate of the search center lon - The longitude coordinate of the search center radius - The search radius in meters (optional) latSpan/lonSpan - An alternative to radius to set the search bounding box (optional) query - A specific stop code to search for (optional) If you just specify a lat,lon search location, the stops-for-location method will just return nearby stops. If you specify an optional query parameter, we’ll search for nearby stops with the specified code. This is the primary method from going from a user-facing stop code like “75403” to the actual underlying stop id unique to a stop for a particular transit agency.

Response The stops-for-location method returns a list result, so see additional documentation on controlling the number of elements returned and interpreting the results. The list contents are <stop/> elements, so see details about the various properties of the <stop/> element.

func (DefaultClient) StopsForRoute

func (c DefaultClient) StopsForRoute(id string) (*StopsForRoute, error)

func (DefaultClient) Trip

func (c DefaultClient) Trip(id string) (*Trip, error)

func (DefaultClient) TripDetails

func (c DefaultClient) TripDetails(id string) (*TripDetails, error)

func (DefaultClient) TripForVehicle

func (c DefaultClient) TripForVehicle(id string, params map[string]string) (*TripDetails, error)

func (DefaultClient) TripsForLocation

func (c DefaultClient) TripsForLocation(params map[string]string) ([]TripDetails, error)

TripsForLocation - get active trips near a location http://developer.onebusaway.org/modules/onebusaway-application-modules/current/api/where/methods/trips-for-location.html

Method: trips-for-location

Search for active trips near a specific location.

Sample Request http://api.pugetsound.onebusaway.org/api/where/trips-for-location.xml?key=TEST&lat=47.653&lon=-122.307&latSpan=0.008&lonSpan=0.008

Sample Response <response>

<version>2</version>
<code>200</code>
<text>OK</text>
<currentTime>1270614730908</currentTime>
<data class="listWithReferences">
  <references>...</references>
  <list>
    <tripDetails>...</tripDetails>
    <tripDetails>...</tripDetails>
    ...
  </list>
  <limitExceeded>false</limitExceeded>
</data>

</response>

Request Parameters lat - The latitude coordinate of the search center lon - The longitude coordinate of the search center latSpan/lonSpan - Set the limits of the search bounding box includeTrip - Can be true/false to determine whether full <trip/>

elements are included in the <references/> section.
Defaults to false.

includeSchedule - Can be true/false to determine whether full <schedule/>

elements are included in the <tripDetails/> section.
Defaults to false.

time - by default, the method returns the status of the system

right now. However, the system can also be queried at a
specific time. This can be useful for testing. See
timestamps for details on the format of the time parameter.

Response The response is a list of <tripDetails/> element that captures extended details about each active trip. Active trips are ones where the transit vehicle is currently located within the search radius. We use real-time arrival data to determine the position of transit vehicles when available, otherwise we determine the location of vehicles from the static schedule.

func (DefaultClient) TripsForRoute

func (c DefaultClient) TripsForRoute(id string) ([]TripDetails, error)

TripsForRoute - get active trips for a route http://developer.onebusaway.org/modules/onebusaway-application-modules/current/api/where/methods/trips-for-route.html

Method: trips-for-route

Search for active trips for a specific route.

Sample Request http://api.pugetsound.onebusaway.org/api/where/trips-for-route/1_100224.xml?key=TEST

Sample Response <response>

<version>2</version>
<code>200</code>
<text>OK</text>
<currentTime>1270614730908</currentTime>
<data class="listWithReferences">
  <references>...</references>
  <list>
    <tripDetails>...</tripDetails>
    <tripDetails>...</tripDetails>
    ...
  </list>
  <limitExceeded>false</limitExceeded>
</data>

</response>

Request Parameters id - the id of the route, encoded directly in the URL:

http://api.pugetsound.onebusaway.org/api/where/trips-for-route/[ID GOES HERE].xml

includeStatus - Can be true/false to determine whether full <tripStatus/>

elements with full real-time information are included in
the <status/> section for each <tripDetails/> element.
Defaults to false.

includeSchedule - Can be true/false to determine whether full <schedule/>

elements are included in the <tripDetails/> element.
Defaults to false.

time - by default, the method returns the status of the system

right now. However, the system can also be queried at a
specific time. This can be useful for testing. See
timestamps for details on the format of the time parameter.

Response The response is a list of <tripDetails/> element that captures extended details about each active trip. The set of active trips includes any trip that serves that specified route that is currently active.

func (DefaultClient) VehiclesForAgency

func (c DefaultClient) VehiclesForAgency(id string) ([]VehicleStatus, error)

VehiclesForAgency - get active vehicles for an agency http://developer.onebusaway.org/modules/onebusaway-application-modules/current/api/where/methods/vehicles-for-agency.html

Method: vehicles-for-agency

Search for active vehicles for a particular agency by id.

Sample Request http://api.onebusaway.org/api/where/vehicles-for-agency/1.xml?key=TEST

Sample Response <response>

<version>2</version>
<code>200</code>
<text>OK</text>
<currentTime>1270614730908</currentTime>
<data class="listWithRangeAndReferences">
  <references>...</references>
  <list>
    <vehicleStatus>...</vehicleStatus>
    <vehicleStatus>...</vehicleStatus>
    <vehicleStatus>...</vehicleStatus>
    ...
  </list>
  <limitExceeded>false</limitExceeded>
  <outOfRange>false</outOfRange>
</data>

</response>

Request Parameters id - the id of the agency, encoded directly in the URL:

http://api.onebusaway.org/api/where/vehicles-for-agency/[ID GOES HERE].xml

time - by default, the method returns the status of the system right now.

However, the system can also be queried at a specific time. This can
be useful for testing. See timestamps for details on the format of
the time parameter.

Response The response is a list of <vehicleStatus/> elements that captures extended details about each active vehicle associated with the specified agency.

type EncodedPolyLine

type EncodedPolyLine struct {
	Length int
	Levels string
	Points string
}

func (EncodedPolyLine) String

func (e EncodedPolyLine) String() string

type Entry

type Entry struct {
	AccumulatedSlackTime         float64          `json:"accumulatedSlackTime,omitempty"`
	ActiveServiceID              []string         `json:"activeServiceIds,omitempty"`
	ActiveTripID                 string           `json:"activeTripId"`
	Affects                      []VehicleJourney `json:"vehicleJourneys>vehicleJourney"`
	AgencyID                     string           `json:"agencyId,omitempty"`
	AlarmID                      string           `json:"alarmId,omitempty"`
	ArrivalEnabled               *bool            `json:"arrivalEnabled,omitempty"`
	ArrivalsAndDepartures        List             `json:"arrivalsAndDepartures,omitempty"`
	ArrivalTime                  int              `json:"arrivalTime"`
	BlockID                      string           `json:"blockId,omitempty"`
	BlockSequence                int              `json:"blockSequence,omitempty"`
	BlockStopTimes               List             `json:"blockStopTimes,omitempty"`
	BlockTripSequence            int              `json:"blockTripSequence,omitempty"`
	Trips                        List             `json:"trips,omitempty"`
	ClosestStop                  string           `json:"closestStop"`
	ClosestStopTimeOffset        int              `json:"closestStopTimeOffset"`
	Code                         string           `json:"code,omitempty"`
	Color                        string           `json:"color,omitempty"`
	Configurations               List             `json:"configurations,omitempty"`
	Consequences                 []Consequence    `json:"consequences>consequence"`
	CreationTime                 string           `json:"creationTime"`
	Date                         int              `json:"date,omitempty"`
	DepartureEnabled             *bool            `json:"departureEnabled,omitempty"`
	DepartureTime                int              `json:"departureTime,omitempty"`
	Description                  string           `json:"description,omitempty"`
	Direction                    string           `json:"direction,omitempty"`
	DirectionID                  string           `json:"directionId,omitempty"`
	Disclaimer                   string           `json:"disclaimer,omitempty"`
	DistanceAlongBlock           float64          `json:"distanceAlongBlock,omitempty"`
	DistanceAlongTrip            float64          `json:"distanceAlongTrip,omitempty"`
	DistanceFromStop             float64          `json:"distanceFromStop,omitempty"`
	DropOffType                  int              `json:"dropOffType,omitempty"`
	Email                        string           `json:"email,omitempty"`
	EndTime                      int              `json:"entTime,omitempty"`
	EnvironmentReason            string           `json:"environmentReason"`
	FareURL                      string           `json:"fareUrl,omitempty"`
	Frequency                    *string          `json:"frequency,omitempty"`
	Headway                      int              `json:"headway,omitempty"`
	ID                           string           `json:"id,omitempty"`
	InactiveServiceID            []string         `json:"inactiveServiceIds,omitempty"`
	Lang                         string           `json:"lang,omitempty"`
	LastKnownDistanceAlongTrip   float64          `json:"lastKnownDistanceAlongTrip,omitempty"`
	LastKnownLocation            Location         `json:"lastKnownLocation,omitempty"`
	LastKnownOrientation         int              `json:"lastKnownOrientation,omitempty"`
	LastLocationUpdateTime       int              `json:"lastLocationUpdateTime,omitempty"`
	LastUpdateTime               int              `json:"lastUpdateTime,omitempty"`
	Lat                          float64          `json:"lat,omitempty"`
	LatSpan                      float64          `json:"latSpan,omitempty"`
	Length                       int              `json:"length,omitempty"`
	Levels                       string           `json:"levels,omitempty"`
	Location                     *Entry           `json:"location,omitempty"`
	LocationType                 int              `json:"locationType,omitempty"`
	Lon                          float64          `json:"lon,omitempty"`
	LongName                     string           `json:"longName,omitempty"`
	LonSpan                      float64          `json:"lonSpan,omitempty"`
	Name                         string           `json:"name,omitempty"`
	Names                        []string         `json:"names,omitempty"`
	NearbyStopIds                []string         `json:"nearbyStopIds,omitempty"`
	NextStop                     string           `json:"nextStop,omitempty"`
	NextStopTimeOffset           int              `json:"nextStopTimeOffset,omitempty"`
	NumberOfStopsAway            int              `json:"numberOfStopsAway,omitempty"`
	Orientation                  float64          `json:"orientation,omitempty"`
	Ordered                      *bool            `json:"ordered,omitempty"`
	Phase                        string           `json:"phase,omitempty"`
	Phone                        string           `json:"phone,omitempty"`
	PickupType                   int              `json:"pickupType,omitempty"`
	Points                       string           `json:"points,omitempty"`
	PolyLines                    List             `json:"polylines,omitempty"`
	Position                     Location         `json:"position"`
	Predicted                    *bool            `json:"predicted,omitempty"`
	PredictedArrivalInterval     int              `json:"predictedArrivalInterval,omitempty"`
	PredictedArrivalTime         int              `json:"predictedArrivalTime,omitempty"`
	PredictedDepartureInterval   int              `json:"predictedDepartureInterval,omitempty"`
	PredictedDepartureTime       int              `json:"predictedDepartureTime,omitempty"`
	PrivateService               *bool            `json:"privateService,omitempty"`
	ReadableTime                 string           `json:"readableTime,omitempty"`
	RouteID                      string           `json:"routeId,omitempty"`
	RouteIDs                     []string         `json:"routeIds,omitempty"`
	RouteLongName                string           `json:"routeLongName,omitempty"`
	RouteShortName               string           `json:"routeShortName,omitempty"`
	ScheduledArrivalInterval     int              `json:"scheduledArrivalInterval,omitempty"`
	ScheduledArrivalTime         int              `json:"scheduledArrivalTime,omitempty"`
	ScheduledDepartureInterval   int              `json:"scheduledDepartureInterval,omitempty"`
	ScheduledDepartureTime       int              `json:"scheduledDepartureTime,omitempty"`
	ScheduledDistanceAlongTrip   float64          `json:"scheduledDistanceAlongTrip"`
	ScheduleDeviation            int              `json:"scheduleDeviation"`
	ScheduleDeviationHistogramID string           `json:"scheduleDeviationHistogramId,omitempty"`
	ScheduleFrequencies          List             `json:"scheduleFrequencies,omitempty"`
	ScheduleStopTimes            List             `json:"scheduleStopTimes,omitempty"`
	ServiceDate                  int              `json:"serviceDate,omitempty"`
	ServiceID                    string           `json:"serviceId,omitempty"`
	ShapeID                      string           `json:"shapeId,omitempty"`
	ShortName                    string           `json:"shortName,omitempty"`
	SituationID                  string           `json:"situationId,omitempty"`
	SituationIDs                 []string         `json:"situationIds,omitempty"`
	StartTime                    int              `json:"startTime,omitempty"`
	Status                       string           `json:"status,omitempty"`
	StopCalendarDays             List             `json:"stopCalendarDays,omitempty"`
	StopHeadsign                 string           `json:"stopHeadsign,omitempty"`
	StopGroupings                AltList          `json:"stopGroupings,omitempty"`
	StopGroups                   AltList          `json:"stopGroups,omitempty"`
	StopID                       string           `json:"stopId,omitempty"`
	StopIDs                      []string         `json:"stopIds,omitempty"`
	StopRouteSchedules           List             `json:"stopRouteSchedules,omitempty"`
	StopRouteDirectionSchedules  List             `json:"stopRouteDirectionSchedules,omitempty"`
	StopSequence                 int              `json:"stopSequence,omitempty"`
	StopTime                     *Entry           `json:"stopTime,omitempty"`
	Summary                      []string         `json:"summary,omitempty"`
	TextColor                    string           `json:"textColor,omitempty"`
	Time                         int              `json:"time,omitempty"`
	TimeZone                     string           `json:"timezone,omitempty"`
	TotalDistanceAlongTrip       float64          `json:"totalDistanceAlongTrip"`
	TotalStopsInTrip             int              `json:"totalStopsInTrip,omitempty"`
	TripHeadSign                 string           `json:"tripHeadsign,omitempty"`
	TripID                       string           `json:"tripId,omitempty"`
	TripShortName                string           `json:"tripShortName,omitempty"`
	TripStatus                   *Entry           `json:"tripStatus,omitempty"`
	Type                         int              `json:"type,omitempty"`
	URL                          string           `json:"url,omitempty"`
	VehicleID                    string           `json:"vehicleId,omitempty"`
	WheelChairBoarding           string           `json:"wheelchairBoarding,omitempty"`
}

Entry container object

func (Entry) ToAgency

func (e Entry) ToAgency() *Agency

func (Entry) ToAgencyWithCoverage

func (e Entry) ToAgencyWithCoverage(a Agency) *AgencyWithCoverage

func (Entry) ToArrivalAndDeparture

func (e Entry) ToArrivalAndDeparture(sis []Situation, st []Stop, ts []Trip) *ArrivalAndDeparture

func (Entry) ToBlock

func (e Entry) ToBlock() *Block

func (Entry) ToBlockConfiguration

func (e Entry) ToBlockConfiguration(asds, isds []string, tps []BlockTrip) *BlockConfiguration

func (Entry) ToBlockStopTime

func (e Entry) ToBlockStopTime() *BlockStopTime

func (Entry) ToBlockTrip

func (e Entry) ToBlockTrip() *BlockTrip

func (Entry) ToCoverage

func (e Entry) ToCoverage() Coverage

func (Entry) ToCurrentTime

func (e Entry) ToCurrentTime() *CurrentTime

func (Entry) ToFrequency

func (e Entry) ToFrequency() *Frequency

func (Entry) ToLocation

func (e Entry) ToLocation() *Location

func (Entry) ToRegisteredAlarm

func (e Entry) ToRegisteredAlarm() *RegisteredAlarm

func (Entry) ToRoute

func (e Entry) ToRoute(agencies []Agency) *Route

func (Entry) ToScheduleFrequency

func (e Entry) ToScheduleFrequency() *ScheduleFrequency

func (Entry) ToScheduleStopTime

func (e Entry) ToScheduleStopTime() *ScheduleStopTime

func (Entry) ToShape

func (e Entry) ToShape() *Shape

func (Entry) ToSituation

func (e Entry) ToSituation() *Situation

func (Entry) ToStop

func (e Entry) ToStop() *Stop

func (Entry) ToStopRouteDirectionSchedule

func (e Entry) ToStopRouteDirectionSchedule() *StopRouteDirectionSchedule

func (Entry) ToStopRouteSchedule

func (e Entry) ToStopRouteSchedule(r Route) *StopRouteSchedule

func (Entry) ToStopSchedule

func (e Entry) ToStopSchedule(ss []Stop) *StopSchedule

func (Entry) ToStopTime

func (e Entry) ToStopTime() *StopTime

func (Entry) ToStopWithArrivalsAndDepartures

func (e Entry) ToStopWithArrivalsAndDepartures(a ArrivalsAndDepartures) *StopWithArrivalsAndDepartures

func (Entry) ToStopsForRoute

func (e Entry) ToStopsForRoute(rs []Route, ss []Stop) *StopsForRoute

func (Entry) ToTrip

func (e Entry) ToTrip() *Trip

func (Entry) ToTripDetails

func (e Entry) ToTripDetails(ts []Trip, ss []Situation) *TripDetails

func (Entry) ToTripStatus

func (e Entry) ToTripStatus(ss []Stop) *TripStatus

func (Entry) ToVehicleStatus

func (e Entry) ToVehicleStatus(ss []Stop, ts []Trip) (ret *VehicleStatus)

type Frequency

type Frequency struct {
	StartTime int
	EndTime   int
	Headway   int
}

func (Frequency) String

func (f Frequency) String() string

type Histogram

type Histogram struct {
	Counts   []int
	Labels   []string
	MaxCount int
	Values   []float64
}

func (Histogram) String

func (h Histogram) String() string

type List

type List []Entry

type Location

type Location struct {
	Lat float64
	Lon float64
}

func (Location) String

func (l Location) String() string

type Name

type Name struct {
	Name  string
	Names []string
	Type  string
}

func (Name) String

func (n Name) String() string

type NameEntry

type NameEntry struct {
	Name  string   `json:"name,omitempty"`
	Names []string `json:"names,omitempty"`
	Type  string   `json:"type,omitempty"`
}

func (NameEntry) ToName

func (e NameEntry) ToName() *Name

type References

type References struct {
	Agencies   List `json:"agencies"`
	Routes     List `json:"routes"`
	Situations List `json:"situations"`
	Stops      List `json:"stops"`
	Trips      List `json:"trips"`
}

References - The <references/> element contains a dictionary of objects referenced by the main result payload. For elements that are often repeated in the result payload, the elements are instead included in the <references/> section and the payload will refer to elements by and object id that can be used to lookup the object in the <references/> dictionary. They will always appear in that order, since stops and trips reference routes and routes reference agencies. If you are processing the result stream in order, you should always be able to assume that an referenced entity would already have been included in the references section. Every API method supports an optional includeReferences=true|false parameter that determines if the <references/> section is included in a response. If you don’t need the contents of the <references/> section, perhaps because you’ve pre-cached all the elements, then setting includeReferences=false can be a good way to reduce the response size.

func (References) String

func (r References) String() string

type RegisteredAlarm

type RegisteredAlarm struct {
	AlarmID string
}

func (RegisteredAlarm) String

func (r RegisteredAlarm) String() string

type Response

type Response struct {
	Code        int    `json:"code"`
	CurrentTime int    `json:"currentTime"`
	Data        *Data  `json:"data,omitempty"`
	Text        string `json:"text"`
	Version     int    `json:"version"`
}

Response Element - All responses are wrapped in a response element. The response element carries the following fields: version - response version information code - a machine-readable response code with the following semantics: 200 - Success 400 - The request could not be understood due to an invalid request parameter or some other error 401 - The application key is either missing or invalid 404 - The specified resource was not found 500 - A service exception or error occurred while processing the request text - a human-readable version of the response code currentTime - current system time on the api server as milliseconds since the unix epoch data - the response payload references see the discussion of references below

func (Response) String

func (r Response) String() string

type Route

type Route struct {
	Agency      Agency
	Color       string
	Description string
	ID          string
	LongName    string
	ShortName   string
	TextColor   string
	Type        int
	URL         string
}

Route object

func (Route) String

func (r Route) String() string

type ScheduleFrequency

type ScheduleFrequency struct {
	*Frequency
}

func (ScheduleFrequency) String

func (s ScheduleFrequency) String() string

type ScheduleStopTime

type ScheduleStopTime struct {
	ArrivalEnabled   *bool
	ArrivalTime      int
	DepartureEnabled *bool
	DepartureTime    int
	ServiceID        string
	StopHeadsign     string
	TripID           string
}

func (ScheduleStopTime) String

func (s ScheduleStopTime) String() string

type Shape

type Shape struct {
	Points string
	Length int
}

func (Shape) String

func (s Shape) String() string

type Situation

type Situation struct {
	ID                string
	CreationTime      string
	EnvironmentReason string
	Summary           []string
	Description       []string
	Affects           []VehicleJourney
	Consequences      []Consequence
}

func (Situation) String

func (s Situation) String() string

type Stop

type Stop struct {
	Code               string
	Direction          string
	ID                 string
	Lat                float64
	LocationType       int
	Lon                float64
	Name               string
	Routes             []Route
	WheelChairBoarding string
}

func (Stop) String

func (s Stop) String() string

type StopCalendarDay

type StopCalendarDay struct {
	Date  string
	Group string
}

func (StopCalendarDay) String

func (s StopCalendarDay) String() string

type StopGroup

type StopGroup struct {
	ID        string
	Name      Name
	Stops     []Stop
	PolyLines []EncodedPolyLine
}

func (StopGroup) String

func (s StopGroup) String() string

type StopGrouping

type StopGrouping struct {
	Type       string
	Ordered    *bool
	StopGroups []StopGroup
}

func (StopGrouping) String

func (s StopGrouping) String() string

type StopRouteDirectionSchedule

type StopRouteDirectionSchedule struct {
	ScheduleFrequencies []ScheduleFrequency
	ScheduleStopTimes   []ScheduleStopTime
	TripHeadsign        string
}

func (StopRouteDirectionSchedule) String

type StopRouteSchedule

type StopRouteSchedule struct {
	Route                       Route
	StopRouteDirectionSchedules []StopRouteDirectionSchedule
}

func (StopRouteSchedule) String

func (s StopRouteSchedule) String() string

type StopSchedule

type StopSchedule struct {
	Date               int
	Stop               Stop
	StopRouteSchedules []StopRouteSchedule
	TimeZone           string
	StopCalendarDays   []StopCalendarDay
}

func (StopSchedule) String

func (s StopSchedule) String() string

type StopTime

type StopTime struct {
	StopID        string
	ArrivalTime   int
	DepartureTime int
	PickupType    int
	DropOffType   int
}

func (StopTime) String

func (s StopTime) String() string

type StopWithArrivalsAndDepartures

type StopWithArrivalsAndDepartures struct {
	StopID                string
	ArrivalsAndDepartures ArrivalsAndDepartures
	NearByStopIDs         []string
}

func (StopWithArrivalsAndDepartures) String

type StopsForRoute

type StopsForRoute struct {
	Route         Route
	Stops         []Stop
	StopGroupings []StopGrouping
}

func (StopsForRoute) String

func (s StopsForRoute) String() string

type Time

type Time struct {
	ReadableTime *string `json:"readableTime,omitempty"`
	Time         *int    `json:"time,omitempty"`
}

func (Time) String

func (t Time) String() string

type Trip

type Trip struct {
	BlockID        string
	DirectionID    string
	ID             string
	RouteID        string
	RouteShortName string
	ServiceID      string
	ShapeID        string
	TimeZone       string
	TripHeadsign   string
	TripShortName  string
}

func (Trip) String

func (t Trip) String() string

type TripDetails

type TripDetails struct {
	Trip        Trip
	ServiceDate int
	Frequency   *string
	Status      string
	Situations  []Situation
}

func (TripDetails) String

func (t TripDetails) String() string

type TripStatus

type TripStatus struct {
	ActiveTripID               string
	BlockTripSequence          int
	ClosestStop                Stop
	ClosestStopTimeOffset      int
	DistanceAlongTrip          float64
	Frequency                  *string
	LastKnownDistanceAlongTrip float64
	LastKnownLocation          Location
	LastKnownOrientation       int
	LastLocationUpdateTime     int
	LastUpdateTime             int
	NextStop                   Stop
	NextStopTimeOffset         int
	Orientation                float64
	Phase                      string
	Position                   Location
	Predicted                  *bool
	ScheduleDeviation          int
	ScheduledDistanceAlongTrip float64
	ServiceDate                int
	SituationIDs               []string
	Status                     string
	TotalDistanceAlongTrip     float64
	VehicleID                  string
}

func (TripStatus) String

func (t TripStatus) String() string

type VehicleJourney

type VehicleJourney struct {
	LineID      string
	Direction   string
	CallStopIDs []string
}

func (VehicleJourney) String

func (v VehicleJourney) String() string

type VehicleStatus

type VehicleStatus struct {
	VehicleID              string
	LastUpdateTime         int
	LastLocationUpdateTime int
	Location               Location
	Phase                  string
	Status                 string
	Trip                   Trip
	TripStatus             TripStatus
}

func (VehicleStatus) String

func (v VehicleStatus) String() string

Directories

Path Synopsis
cli
cmd

Jump to

Keyboard shortcuts

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