Documentation ¶
Overview ¶
Package types implements support for the types used in the Navitia API (see doc.navitia.io), simplified and modified for idiomatic Go use.
This package was and is developed as a supporting library for the gonavitia API client (https://github.com/aabizri/navitia) but can be used to build other API clients.
Index ¶
- Constants
- Variables
- type Address
- type Admin
- type CO2Emissions
- type Channel
- type Code
- type CommercialMode
- type Company
- type Container
- func (c *Container) Check() error
- func (c *Container) Empty() bool
- func (c *Container) IsPTObject() bool
- func (c *Container) IsPlace() bool
- func (c *Container) Object() (Object, error)
- func (c *Container) PTObject() (PTObject, error)
- func (c *Container) Place() (Place, error)
- func (c *Container) UnmarshalJSON(b []byte) error
- type Coordinates
- type DataFreshness
- type Display
- type Disruption
- type Effect
- type Equipment
- type ErrInvalidContainer
- type Fare
- type ID
- type ImpactedObject
- type ImpactedSection
- type ImpactedStop
- type Isochrone
- type Journey
- type JourneyQualification
- type Line
- type Message
- type Network
- type Object
- type POI
- type POIType
- type PTDateTime
- type PTMethod
- type PTObject
- type PathSegment
- type Period
- type PhysicalMode
- type Place
- type Region
- type Route
- type Section
- type SectionType
- type Severity
- type StopArea
- type StopPoint
- type StopTime
- type TrafficReport
- type TravelerType
- type Trip
- type UnmarshalError
Constants ¶
const ( EmbeddedStopArea string = "stop_area" // This is a Place & a PT Object EmbeddedPOI = "poi" // This is a place EmbeddedAddress = "address" // This is a place EmbeddedStopPoint = "stop_point" // This is a place EmbeddedAdmin = "administrative_region" // This is a place EmbeddedLine = "line" // This is a PT Object EmbeddedRoute = "route" // This is a PT Object EmbeddedNetwork = "network" // This is a PT Object EmbeddedCommercialMode = "commercial_mode" // This is a PT Object EmbeddedTrip = "trip" // This is a PT Object )
these are the types that can be embedded
const ( // Service suspended. EffectNoService Effect = "NO_SERVICE" // Service running at lowered capacity. JourneyStatusReducedService = "REDUCED_SERVICE" // Service running but with substantial delays expected. JourneyStatusSignificantDelay = "SIGNIFICANT_DELAY" // Service running on alternative routes to avoid problem. JourneyStatusDetour = "DETOUR" // Service above normal capacity. JourneyStatusAdditionalService = "ADDITIONAL_SERVICE" // Service different from normal capacity. JourneyStatusModifiedService = "MODIFIED_SERVICE" // Miscellaneous, undefined Effect. JourneyStatusOtherEffect = "OTHER_EFFECT" // Default setting: Undetermined or Effect not known. JourneyStatusUnknownEffect = "UNKNOWN_EFFECT" // Stop not at previous location or stop no longer on route. JourneyStatusStopMoved = "STOP_MOVED" )
JourneyStatusXXX are known JourneyStatuse
const ( EquipmentWheelchairAccessibility Equipment = "has_wheelchair_accessibility" EquipmentBikeAccepted = "has_bike_accepted" EquipmentAirConditioned = "has_air_conditioned" EquipmentVisualAnnouncement = "has_visual_announcement" EquipmentAudibleAnnouncement = "has_audible_announcement" EquipmentAppropriateEscort = "has_appropriate_escort" EquipmentAppropriateSignage = "has_appropriate_signage" EquipmentSchoolVehicle = "has_school_vehicle" EquipmentWheelchairBoarding = "has_wheelchair_boarding" EquipmentSheltered = "has_sheltered" EquipmentElevator = "has_elevator" EquipmentEscalator = "has_escalator" EquipmentBikeDepot = "has_bike_depot" )
EquipmentWheelchairAccessibility are known equipments
const ( JourneyBest JourneyQualification = "best" JourneyRapid = "rapid" JourneyComfort = "comfort" JourneyCar = "car" JourneyLessWalk = "less_fallback_walk" JourneyLessBike = "less_fallback_bike" JourneyFastest = "fastest" JourneyNoPTWalk = "non_pt_walk" JourneyNoPTBike = "non_pt_bike" )
JourneyXXX qualify journeys
const ( // A standard Traveler TravelerStandard TravelerType = "standard" // A slow walker TravelerSlowWalker = "slow_walker" // A fast walker TravelerFastWalker = "fast_walker" // A Traveler with luggage TravelerWithLuggage = "luggage" // A Traveler in a wheelchair TravelerInWheelchair = "wheelchair" )
The defined types of the api
const ( // DateTimeFormat is the format used by the Navitia Api for use with time pkg. DateTimeFormat string = "20060102T150405" // YYYYMMDDThhmmss // DateFormat is when there is no time info DateFormat string = "20060102" )
const ( ModeWalking string = "walking" ModeBike = "bike" ModeCar = "car" ModeBikeShare = "bss" )
ModeXXX are known non-public transportation mode
const ( PhysicalModeAir ID = "physical_mode:Air" PhysicalModeBoat = "physical_mode:Boat" PhysicalModeBus = "physical_mode:Bus" PhysicalModeBusRapidTransit = "physical_mode:BusRapidTransit" PhysicalModeCoach = "physical_mode:Coach" PhysicalModeFerry = "physical_mode:Ferry" PhysicalModeFunicular = "physical_mode:Funicular" PhysicalModeLocalTrain = "physical_mode:LocalTrain" PhysicalModeLongDistanceTrain = "physical_mode:LongDistanceTrain" PhysicalModeMetro = "physical_mode:Metro" PhysicalModeRapidTransit = "physical_mode:RapidTransit" PhysicalModeShuttle = "physical_mode:Shuttle" PhysicalModeTaxi = "physical_mode:Taxi" PhysicalModeTrain = "physical_mode:Train" PhysicalModeTramway = "physical_mode:Tramway" )
PhysicalModeXXX are the possible physical modes in ID form
const ( // Public transport section SectionPublicTransport SectionType = "public_transport" // Street section SectionStreetNetwork = "street_network" // Waiting section between transport SectionWaiting = "waiting" // This “stay in the vehicle” section occurs when the traveller has to stay in the vehicle when the bus change its routing. SectionStayIn = "stay_in" // Transfer section SectionTransfer = "transfer" // Teleportation section. Used when starting or arriving to a city or a stoparea (“potato shaped” objects) Useful to make navitia idempotent. // Warning: Be careful: no Path nor Geo items in this case SectionCrowFly = "crow_fly" // Vehicle may not drive along: traveler will have to call agency to confirm journey // Also sometimes called ODT SectionOnDemandTransport = "on_demand_transport" SectionBikeShareRent = "bss_rent" SectionBikeSharePutBack = "bss_put_back" // Boarding on plane SectionBoarding = "boarding" // Landing off the plane SectionLanding = "landing" )
These are the types of sections that can be returned from the API
const ( // PTMethodRegular: No on-demand transport. Line does not contain any estimated stop times, nor zonal stop point location. No need to call too. PTMethodRegular PTMethod = "regular" // PTMethodDateTimeEstimated: No on-demand transport. However, line has at least one estimated date time. PTMethodDateTimeEstimated = "had_date_time_estimated" // PTMethodODTStopTime: Line does not contain any estimated stop times, nor zonal stop point location. But you will have to call to take it. PTMethodODTStopTime = "odt_with_stop_time" // PTMethodODTStopPoint: Line can contain some estimated stop times, but no zonal stop point location. And you will have to call to take it. PTMethodODTStopPoint = "odt_with_stop_point" // PTMethodODTZone: Line can contain some estimated stop times, and zonal stop point location. And you will have to call to take it. Well, not really a public transport line, more a cab… PTMethodODTZone = "odt_with_zone" )
PTMethodXXX codes for known PTMethod
const Version = "v0.2"
Version is the version of this package
Variables ¶
var EmbeddedTypes = [...]string{ EmbeddedStopArea, EmbeddedPOI, EmbeddedAddress, EmbeddedStopPoint, EmbeddedAdmin, EmbeddedLine, EmbeddedRoute, EmbeddedNetwork, EmbeddedCommercialMode, EmbeddedTrip, }
EmbeddedTypes lists all the possible embedded types you can find in a Container
var JourneyQualifications = []JourneyQualification{ JourneyBest, JourneyRapid, JourneyComfort, JourneyCar, JourneyLessWalk, JourneyLessBike, JourneyLessBikeShare, JourneyFastest, JourneyNoPTWalk, JourneyNoPTBike, JourneyNoPTBikeShare, }
JourneyQualifications is a user-friendly slice of all journey qualification
As it might be used in requests, this is exported
var PhysicalModes = map[ID]string{
PhysicalModeAir: "Air",
PhysicalModeBoat: "Boat",
PhysicalModeBus: "Bus",
PhysicalModeBusRapidTransit: "Bus (Rapid Transit)",
PhysicalModeCoach: "Coach",
PhysicalModeFerry: "Ferry",
PhysicalModeFunicular: "Funicular",
PhysicalModeLocalTrain: "Local Train",
PhysicalModeLongDistanceTrain: "Long-distance Train",
PhysicalModeMetro: "Metro",
PhysicalModeRapidTransit: "Rapid Transit",
PhysicalModeShuttle: "Shuttle",
PhysicalModeTaxi: "Taxi",
PhysicalModeTrain: "Train",
PhysicalModeTramway: "Tramway",
}
PhysicalModes is defined to help the user list all possible physical modes in ID form
var SectionTypes = map[SectionType]string{ SectionPublicTransport: "Public transport section", SectionStreetNetwork: "Street section", SectionWaiting: "Waiting section between transport", SectionStayIn: "This “stay in the vehicle” section occurs when the traveller has to stay in the vehicle when the bus change its routing.", SectionTransfer: "Transfer section", SectionCrowFly: "Teleportation section. Used when starting or arriving to a city or a stoparea (“potato shaped” objects) Useful to make navitia idempotent", SectionOnDemandTransport: "Vehicle may not drive along: traveler will have to call agency to confirm journey", SectionBikeShareRent: "Taking a bike from a bike sharing system (bss)", SectionBikeSharePutBack: "Putting back a bike from a bike sharing system (bss)", SectionBoarding: "Boarding on plane", SectionLanding: "Landing off the plane", }
SectionTypes is the type of a section
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Address struct { ID ID `json:"id"` Name string `json:"name"` // Label of the address // The name is directly taken from the data whereas the label is something computed by navitia for better traveler information. // If you don't know what to display, display the label Label string `json:"label"` // Coordinates of the address Coord Coordinates `json:"coord"` // House number of the address HouseNumber uint `json:"house_number"` // Administrative regions of the stop area in which is placed the stop area Admins []Admin `json:"administrative_regions"` }
An Address codes for a real-world address: a point located in a street.
type Admin ¶
type Admin struct { ID ID `json:"id"` Name string `json:"name"` // Label of the address // The name is directly taken from the data whereas the label is something computed by navitia for better traveler information. // If you don't know what to display, display the label Label string `json:"label"` // Coordinates of the administrative region Coord Coordinates `json:"coord"` // Level of the administrative region Level int `json:"level"` // Zip code of the administrative region ZipCode string `json:"zip_code"` }
An Admin represents an administrative region: a region under the control/responsibility of a specific organisation. It can be a city, a district, a neightborhood, etc.
type CO2Emissions ¶
CO2Emissions holds how much CO2 is emitted.
func (*CO2Emissions) UnmarshalJSON ¶
func (c *CO2Emissions) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaller for CO2Emissions
type Channel ¶
type Channel struct { // ID of the address ID ID `json:"id"` // Content Type (text/html etc.) RFC1341.4 ContentType string `json:"content_type"` // Name of the channel Name string `json:"name"` // Types ? Types []string `json:"types,omitempty"` }
A Channel is a destination media for a message.
type Code ¶
A Code is associated to a dataset
Every object managed by Navitia comes with its own list of ids. You will find some source ids, merge ids, etc. in “codes” list in json responses. Be careful, these codes may not be unique. The navitia id is the only unique id.
type CommercialMode ¶
type CommercialMode struct { // A CommercialMode ID is in the form of "commercial_mode:something" ID ID `json:"id"` // Name of the commercial mode Name string `json:"name"` // Physical modes of this commercial modes // Example: []PhysicalMode{PhysicalMode{ID: "physical_mode:Tramway", Name: "Tramway"}} PhysicalModes []PhysicalMode `json:"physical_modes"` }
A CommercialMode codes for a commercial method of transportation.
Note that in contrast with physical modes, commercial modes aren't normalised, if you want to query with them, it is best to use a PhysicalMode.
type Company ¶
type Company struct { // Identifier of the company ID string `json:"id"` // Name of the company Name string `json:"name"` }
A Company is a provider of transport
Example: the RATP in Paris
type Container ¶
type Container struct { ID ID Name string EmbeddedType string Quality int // contains filtered or unexported fields }
A Container holds an Object, which can be a Place or a PT Object
func (*Container) Check ¶
Check checks the validity of the Container. Returns an ErrInvalidContainer.
An empty Container is valid. But those cases aren't:
- If the Container has an empty ID.
- If the Container has an empty EmbeddedType & a non-empty embedded struct inside.
- If the Container has an unknown EmbeddedType.
func (*Container) IsPTObject ¶
IsPTObject returns true if the container's content is a PTObject
func (*Container) Object ¶
Object returns the Object contained in a Container. If the Container is empty, Object returns an error. Check() is run on the Container.
func (*Container) PTObject ¶
PTObject returns the PTObject contained in the container if that is what's inside
If the Object isn't a PTObject or the Container is empty or invalid, Place returns an error
func (*Container) Place ¶
Place returns the Place contained in the container if that is what's inside
If the Object isn't a Place or the Container is empty or invalid, Place returns an error
func (*Container) UnmarshalJSON ¶
UnmarshalJSON satisfies the json.Unmarshaller interface
type Coordinates ¶
Coordinates code for coordinates used throughout the API
This is the Go representation of "Coord". It implements Place.
See http://doc.navitia.io/#standard-objects
func (Coordinates) ID ¶
func (c Coordinates) ID() ID
ID formats coordinates for use in queries as an ID
func (*Coordinates) UnmarshalJSON ¶
func (c *Coordinates) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaller for a Coordinates
type DataFreshness ¶
type DataFreshness string
DataFreshness codes for a specific data freshness requirement: realtime or base_schedule
const ( // DataFreshnessRealTime means you'll get undisrupted journeys DataFreshnessRealTime DataFreshness = "realtime" // DataFreshnessBaseSchedule means you can get disrupted journeys in the response. DataFreshnessBaseSchedule = "base_schedule" )
type Display ¶
type Display struct { // The headsign associated with the object Headsign string // The name of the belonging network Network string // A direction to take Direction string // The commercial mode in ID Form CommercialMode ID // The physical mode in ID Form PhysicalMode ID // The label of the object Label string // Hexadecimal color of the line Color color.Color // The text color for this section TextColor color.Color // The code of the line Code string // Description Description string // Equipments on this object Equipments []Equipment }
A Display holds informations useful to display.
func (*Display) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaller for a Display
type Disruption ¶
type Disruption struct { // ID of the Disruption ID ID `json:"id"` // State of the disruption. // The state is computed using the application_periods of the disruption and the current time of the query. // // It can be either "Past", "Active" or "Future" Status string `json:"status"` // For traceability, ID of original input disruption InputDisruptionID ID // For traceability: Id of original input impact InputImpactID ID // Severity gives some categorization element Severity Severity // Dates where the current disruption is active Periods []Period // Text to provide to the traveller Messages []Message // Last Update of that disruption LastUpdated time.Time // Objects impacted Impacted []ImpactedObject // The cause of that disruption Cause string // The category of the disruption. // Optional. Category string }
A Disruption reports the specifics of a Disruption
func (*Disruption) UnmarshalJSON ¶
func (d *Disruption) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaller for a Disruption
type Effect ¶
type Effect string
Effect codes for known journey status information For example, reduced service, detours or moved stops.
See https://developers.google.com/transit/gtfs-realtime/reference/Effect for more information
type Equipment ¶
type Equipment string
An Equipment codes for specific equipment the public transport object has
type ErrInvalidContainer ¶
type ErrInvalidContainer struct { // If the Container has a zero ID. NoID bool // If the PlaceContainer has an EmbeddedType yet non-empty embedded content. NoEmbeddedType bool // If the PlaceContainer has an unknown EmbeddedType UnknownEmbeddedType bool }
ErrInvalidContainer is returned after a check on a Container
func (ErrInvalidContainer) Error ¶
func (err ErrInvalidContainer) Error() string
Error satisfies the error interface
type Fare ¶
Fare is the fare of some thing
func (*Fare) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaller for a Fare
type ID ¶
type ID string
An ID is used throughout the library, it is something used by the navitia API and useful to communicate with it.
type ImpactedObject ¶
type ImpactedObject struct { // The impacted public transport object Object Container `json:"pt_object"` // Only for line section impact, the impacted section ImpactedSection ImpactedSection `json:"impacted_section"` // Only for Trip delay, the list of delays, stop by stop ImpactedStops []ImpactedStop `json:"impacted_stops"` }
An ImpactedObject describes a PTObject impacted by a Disruption with some additional info.
type ImpactedSection ¶
type ImpactedSection struct { // The start of the disruption, spatially From Container `json:"from"` // Until this point To Container `json:"to"` }
An ImpactedSection records the impact to a section
type ImpactedStop ¶
type ImpactedStop struct { // The impacted stop point of the trip Point StopPoint // New departure hour (format HHMMSS) of the trip on this stop point NewDeparture string // New arrival hour (format HHMMSS) of the trip on this stop point NewArrival string // Base departure hour (format HHMMSS) of the trip on this stop point BaseDeparture string // Base arrival hour (format HHMMSS) of the trip on this stop point BaseArrival string // Cause of the modification Cause string // Effect on that StopPoint // Can be "added", "deleted", "delayed" Effect string }
An ImpactedStop records the impact to a stop
type Isochrone ¶
type Isochrone geojson.Geometry
An Isochrone is sent back by the /isochrones service, it gives you a multi-polygon geojson response which represent a same time travel zone.
See https://en.wikipedia.org/wiki/Isochrone_map for what is an isochrone.
type Journey ¶
type Journey struct { Duration time.Duration Transfers uint Departure time.Time Requested time.Time Arrival time.Time CO2Emissions CO2Emissions Sections []Section From Container To Container Type JourneyQualification Fare Fare //Status from the whole journey taking into acount the most disturbing information retrieved on every object used Status Effect }
A Journey holds information about a possible journey
func (*Journey) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaller for a Journey
Behaviour:
- If "from" is empty, then don't populate the From field.
- Same for "to"
type JourneyQualification ¶
type JourneyQualification string
A JourneyQualification qualifies a Journey, see const declaration.
type Line ¶
type Line struct { // ID is the navitia identifier of the line // For example: "line:RAT:M6" ID ID // Name is the name of the line // For example: "Nation - Charles de Gaule Etoile" Name string // Code is the codename of the line. // For example: "6" Code string // Color is the color given to the line // For example: "79BB92" in Hex Color color.Color // OpeningTime is the opening time of the line OpeningTime struct { Hours uint8 Minutes uint8 Seconds uint8 } // ClosingTime is the closing time of the line ClosingTime struct { Hours uint8 Minutes uint8 Seconds uint8 } // Routes contains the routes of the line Routes []Route // CommercialMode of the line CommercialMode CommercialMode // PhysicalModes of the line PhysicalModes []PhysicalMode }
A Line codes for a public transit line.
Warning: a Line isn't a route, it has no direction information, and can have several embranchments.
See http://doc.navitia.io/#public-transport-objects
func (*Line) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaller for a Line
type Message ¶
type Message struct { // The message to bring to the traveler Text string `json:"text"` // The destination media for this Message. Channel *Channel `json:"channel"` }
A Message contains the text to be provided to the traveler.
type Network ¶
type Network struct { // ID is the identifier of the network ID string `json:"id"` // Name is the name of the network Name string `json:"name"` }
Network represents a specific network. They are fed by the agencies.
type POI ¶
type POI struct { ID ID `json:"id"` Name string `json:"name"` // The name is directly taken from the data whereas the label is something computed by navitia for better traveler information. // If you don't know what to display, display the label Label string `json:"label"` // The type of the POI Type POIType `json:"poi_type"` }
A POI is a Point Of Interest. A loosely-defined place.
type PTDateTime ¶
type PTDateTime struct { // Date/Time of departure Departure time.Time // Date/Time of arrival Arrival time.Time }
A PTDateTime (pt stands for “public transport”) is a complex date time object to manage the difference between stop and leaving times at a stop. It is used by:
- Row in Schedule
- StopSchedule
- StopDatetime
func (*PTDateTime) UnmarshalJSON ¶
func (ptdt *PTDateTime) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaller for a PTDateTime
type PTMethod ¶
type PTMethod string
A PTMethod is a Public Transportation method: it can be regular, estimated times or ODT (on-demand transport)
type PTObject ¶
type PTObject interface{}
A PTObject is a Public Transport object: StopArea, Trip, Line, Route, Network, etc.
type PathSegment ¶
type PathSegment struct { // The Length of the segment Length uint // The Name of the way corresponding to the segment Name string // The duration in seconds of the segment Duration time.Duration // The angle in degree between the previous segment and this segment // = 0 Means going straight // < 0 Means turning left // > 0 Means turning right Direction int }
A PathSegment (called Path item in the Navitia API) is a part of a path
func (*PathSegment) UnmarshalJSON ¶
func (ps *PathSegment) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaller for a PathSegment
type Period ¶
Period of effect
func (*Period) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaller for a Period
type PhysicalMode ¶
type PhysicalMode struct { // Identifier of the physical mode // For example: "physical_mode:Tramway" ID ID `json:"id"` // Name of the physical mode // For example: "Tramway" Name string `json:"name"` // Commercial modes of this physical mode CommercialModes []CommercialMode `json:"commercial_mode"` }
A PhysicalMode codes for a physical method of transportation For example, air travel, bus, metro and train.
As well, note that physical modes are normalised and fastened, see the list in PhysicalModes ¶
type Place ¶
type Place interface{}
A Place isn't something directly used by the Navitia.io api.
However, it allows the library user to use idiomatic go when working with the library. If you want a countainer, see Container
Place is held by these types:
- StopArea
- POI
- Address
- StopPoint
- Admin
type Region ¶
type Region struct { // Identifier of the region ID ID // Name of the region Name string // Status of the dataset Status string // Shape of the region. // You can use it to check if a particular coordinate is within that MultiPolygon Shape *geom.MultiPolygon // When was the DataSet created ? DatasetCreation time.Time // When was it last loaded at navitia.io's end ? LastLoaded time.Time // When did production start ? ProductionStart time.Time // When did or when will it stop ? ProductionEnd time.Time // An error in the dataset. // This comes from the server, not from this package. Error string }
A Region holds information about a geographical region, including its ID, name & shape.
func (*Region) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaller for a Region
type Route ¶
type Route struct { // Identifier of the route // For example: "route:RAT:M6" ID ID // Name of the route // For example:"Nation - Charles de Gaule Etoile" Name string // Frequence is true when the route has frequency, if it doesn't it stays false Frequence bool // Line is the line it is connected to Line Line // Direction is the direction of the route // Note: As direction is a Place, it can be a POI in some data Direction Container }
A Route represents a route: a Line can have several routes, that is several directions with potential embranchments and different frequency for each.
See http://doc.navitia.io/#public-transport-objects
func (*Route) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaller for Route
type Section ¶
type Section struct { Type SectionType ID ID Mode string // From & To From Container To Container // Arrival time & departure time Departure time.Time Arrival time.Time // Duration of travel Duration time.Duration // The path taken by this section Path []PathSegment // The path in geojson format Geo *geom.LineString // List of the stop times of this section StopTimes []StopTime // Information to display Display Display // Additional informations, from what I can see this is always a PTMethod Additional []PTMethod }
A Section holds information about a specific section
func (*Section) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaller for a Section
Behaviour:
- If "from" is empty, then don't populate the From field.
- Same for "to"
type SectionType ¶
type SectionType string
A SectionType codifies the type of section that can be encountered
type Severity ¶
type Severity struct { // Name of severity Name string // Priority of the severity. Given by the agency. 0 is the strongest priority, a nil Priority means its undefined (duh). Priority *int // HTML color for classification Color color.Color // Effect: Normalized value of the effect on the public transport object Effect Effect }
Severity object can be used to make visual grouping.
func (*Severity) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaller for a Severity
type StopArea ¶
type StopArea struct { ID ID `json:"id"` Name string `json:"name"` // Label of the stop area. // The name is directly taken from the data whereas the label is something computed by navitia for better traveler information. // If you don't know what to display, display the label Label string `json:"label"` // Coordinates of the stop area Coord Coordinates `json:"coord"` // Administrative regions of the stop area in which is placed the stop area Admins []Admin `json:"administrative_regions"` // Stop points countained in this stop area StopPoints []StopPoint `json:"stop_points"` }
A StopArea represents a stop area: a nameable zone, where there are some stop points.
type StopPoint ¶
type StopPoint struct { ID ID `json:"id"` // Name of the stop point Name string `json:"name"` // Coordinates of the stop point Coord Coordinates `json:"coord"` // Administrative regions of the stop point Admins []Admin `json:"administrative_regions"` // List of equipments of the stop point Equipments []Equipment `json:"equipment"` // Stop Area countaining the stop point StopArea *StopArea `json:"stop_area"` }
A StopPoint codes for a stop point in a line: a location where vehicles can pickup or drop off passengers.
type StopTime ¶
type StopTime struct { // The PTDateTime of the stop, this stores the info about the arrival & departure PTDateTime PTDateTime // The stop point in question StopPoint StopPoint }
A StopTime stores info about a stop in a route: when the vehicle comes in, when it comes out, and what stop it is.
type TrafficReport ¶
type TrafficReport struct { // Main object (network) and links within its own disruptions Network Network // List of all disrupted Lines from the network Lines []Line // List of all disrupted StopAreas from the network StopAreas []StopArea }
A TrafficReport made of a network, an array of lines and an array of stop_areas. Named "traffic_report" in the Navitia doc
See http://doc.navitia.io/#traffic-reports TODO: Add the internal links
type TravelerType ¶
type TravelerType string
TravelerType is a Traveler's type Defines speeds & accessibility values for different types of people
type Trip ¶
A Trip corresponds to a scheduled vehicle circulation (and all its linked real-time and disrupted routes).
An example : a train, routing a Paris to Lyon itinerary every day at 06h29, is the “Trip” named “6641”.
type UnmarshalError ¶
type UnmarshalError struct { // Type on which the unmarshaller where the error occurred works Type string // JSON Key where failure occurred Key string // Name of the key in package Name string // Value associated with the key Value interface{} // Message of the error Message string // Underlying error Underlying error // Full JSON data JSON []byte }
UnmarshalError is returned when unmarshalling fails It implements both error and github.com/pkg/errors's causer
func (UnmarshalError) Cause ¶
func (err UnmarshalError) Cause() error
Cause implements github.com/pkg/error's causer
Source Files ¶
- common.go
- company.go
- container.go
- container_json.go
- coordinates.go
- coordinates_json.go
- display.go
- display_json.go
- disruption.go
- disruption_json.go
- equipment.go
- id.go
- isochrone.go
- journeys.go
- journeys_json.go
- json.go
- line.go
- line_json.go
- misc.go
- mode.go
- network.go
- path.go
- path_json.go
- place.go
- ptobject.go
- region.go
- region_json.go
- route.go
- route_json.go
- section.go
- section_json.go
- trafficreport.go