package
0.4.1
Repository: https://github.com/govitia/navitia.git
Documentation: pkg.go.dev

# README

navitia/types is a library for working with types returned by the Navitia API. GoDoc

Package types implements support for the types used in the Navitia API (see doc.navitia.io), simplified and modified for idiomatic Go use.

This is navitia/types v0.2. It is not API-Stable, and won't be until the v1 release of navitia, but it's getting closer ! This package was and is developped as a supporting library for the navitia API client but can be used to build other navitia API clients.

Install

Simply run go get -u github.com/govitia/navitia/types.

Coverage

Preview of the supported types, see the doc for more information, and the navitia.io doc for information about the remote API.

Type NameDescriptionNavitia Name
JourneyA journey (X-->Y)"journey"
SectionA section of a Journey"section"
RegionA region covered by the API"region"
IsochroneA region covered by the API"isochrone"
ContainerThis contains a Place or a PTObject"place"/"pt_object"
PlacePlace is an empty interface, by convention used to identify an Address, StopPoint, StopArea, POI, Admin & Coordinates.
PTObjectPTObject is an empty interface by convention used to identify a Public Transportation object
LineA public transit line."line"
RouteA specific route within a Line."route"

And others, such as Display ["display_informations"], PTDateTime ["pt-date-time"], StopTime ["stop_time"]

Getting started

import (
	"fmt"

	"github.com/govitia/navitia/types"
)

func main() {
	data := []byte{"some journey's json"}
	var j types.Journey
	_ = j.UnmarshalJSON(data)
}

Going further

Obviously, this is a very simple example of what navitia/types can do, check out the documentation !

What's new in v0.2

  • Merge back into the navitia tree !
  • Container is now a type that can be used as a Place Container or as a PTObject Container, which helps everyone!
  • No more String methods
  • Better unmarshalling, including better error handling, along with better testing
  • Benchmarks !
  • Disruption support, along with what it entails.
  • Rename JourneyStatus to Effect
  • And others ! See git log for more information !

TODO

Documentation

  • Update readme.md to reflect new changes
  • Add links to the doc.navitia.io documentation to every type

Testing

  • (*PTDateTime).UnmarshalJSON
  • ErrInvalidPlaceContainer.Error
  • Equipment.Known
  • Every Type should have at least one file to be tested against
  • Globalise mutual code in unmarshal testers

Footnotes

I made this project as I wanted to explore and push my go skills, and I'm really up for you to contribute ! Send me a pull request and/or contact me if you have any questions! ( @aabizri on twitter)

# Constants

DataFreshnessBaseSchedule means you can get disrupted journeys in the response.
DataFreshnessRealTime means you'll get undisrupted journeys.
DateFormat is when there is no time info.
YYYYMMDDThhmmss.
Service suspended.
This is a place.
This is a place.
This is a PT Object.
This is a PT Object.
This is a PT Object.
This is a place.
This is a PT Object.
This is a Place & a PT Object.
This is a place.
This is a PT Object.
EquipmentWheelchairAccessibility are known equipments.
EquipmentWheelchairAccessibility are known equipments.
EquipmentWheelchairAccessibility are known equipments.
EquipmentWheelchairAccessibility are known equipments.
EquipmentWheelchairAccessibility are known equipments.
EquipmentWheelchairAccessibility are known equipments.
EquipmentWheelchairAccessibility are known equipments.
EquipmentWheelchairAccessibility are known equipments.
EquipmentWheelchairAccessibility are known equipments.
EquipmentWheelchairAccessibility are known equipments.
EquipmentWheelchairAccessibility are known equipments.
EquipmentWheelchairAccessibility are known equipments.
EquipmentWheelchairAccessibility are known equipments.
JourneyXXX qualify journeys.
JourneyXXX qualify journeys.
JourneyXXX qualify journeys.
JourneyXXX qualify journeys.
JourneyXXX qualify journeys.
JourneyXXX qualify journeys.
JourneyXXX qualify journeys.
JourneyXXX qualify journeys.
JourneyXXX qualify journeys.
JourneyXXX qualify journeys.
JourneyXXX qualify journeys.
Service above normal capacity.
Service running on alternative routes to avoid problem.
Service different from normal capacity.
Miscellaneous, undefined Effect.
Service running at lowered capacity.
Service running but with substantial delays expected.
Stop not at previous location or stop no longer on route.
Default setting: Undetermined or Effect not known.
ModeXXX are known non-public transportation mode.
Not used in Section.
ModeXXX are known non-public transportation mode.
ModeXXX are known non-public transportation mode.
PhysicalModeXXX are the possible physical modes in ID form.
PhysicalModeXXX are the possible physical modes in ID form.
PhysicalModeXXX are the possible physical modes in ID form.
PhysicalModeXXX are the possible physical modes in ID form.
PhysicalModeXXX are the possible physical modes in ID form.
PhysicalModeXXX are the possible physical modes in ID form.
PhysicalModeXXX are the possible physical modes in ID form.
PhysicalModeXXX are the possible physical modes in ID form.
PhysicalModeXXX are the possible physical modes in ID form.
PhysicalModeXXX are the possible physical modes in ID form.
PhysicalModeXXX are the possible physical modes in ID form.
PhysicalModeXXX are the possible physical modes in ID form.
PhysicalModeXXX are the possible physical modes in ID form.
PhysicalModeXXX are the possible physical modes in ID form.
PhysicalModeXXX are the possible physical modes in ID form.
PTMethodDateTimeEstimated: No on-demand transport.
PTMethodODTStopPoint: Line can contain some estimated stop times, but no zonal stop point location.
PTMethodODTStopTime: Line does not contain any estimated stop times, nor zonal stop point location.
PTMethodODTZone: Line can contain some estimated stop times, and zonal stop point location.
PTMethodRegular: No on-demand transport.
Putting back a bike from a bike sharing system (bss).
Taking a bike from a bike sharing system (bss).
Boarding on plane.
Teleportation section.
Landing off the plane.
Vehicle may not drive along: traveler will have to call agency to confirm journey Also sometimes called ODT.
Public transport section.
This “stay in the vehicle” section occurs when the traveller has to stay in the vehicle when the bus change its routing.
Street section.
Transfer section.
Waiting section between transport.
A fast walker.
A Traveler in a wheelchair.
A slow walker.
A standard Traveler.
A Traveler with luggage.

# Variables

EmbeddedTypes lists all the possible embedded types you can find in a Container.
JourneyQualifications is a user-friendly slice of all journey qualification As it might be used in requests, this is exported.
SectionTypes is the type of a section.

# Structs

No description provided by the author
An Address codes for a real-world address: a point located in a street.
An Admin represents an administrative region: a region under the control/responsibility of a specific organisation.
Calendar is returned on vehicle journey message and indicates periodicity informations about transport schedules.
A Channel is a destination media for a message.
CO2Emissions holds how much CO2 is emitted.
A Code is associated to a dataset Every object managed by Navitia comes with its own list of ids.
A CommercialMode codes for a commercial method of transportation.
A Company is a provider of transport Example: the RATP in Paris See http://doc.navitia.io/#public-transport-objects.
A Container holds an Object, which can be a Place or a PT Object.
Coordinates code for coordinates used throughout the API.
No description provided by the author
A Display holds informations useful to display.
A Disruption reports the specifics of a Disruption.
ErrInvalidContainer is returned after a check on a Container.
No description provided by the author
Fare is the fare of some thing.
No description provided by the author
No description provided by the author
An ImpactedObject describes a PTObject impacted by a Disruption with some additional info.
An ImpactedSection records the impact to a section.
An ImpactedStop records the impact to a stop.
A Journey holds information about a possible journey.
JourneyPattern A journey pattern is an ordered list of stop points.
A Line codes for a public transit line.
No description provided by the author
A Message contains the text to be provided to the traveler.
Network represents a specific network.
A PathSegment (called Path item in the Navitia API) is a part of a path.
Period of effect.
A PhysicalMode codes for a physical method of transportation For example, air travel, bus, metro and train.
A POI is a Point Of Interest.
A POIType codes for the type of the point of interest.
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.
No description provided by the author
A Region holds information about a geographical region, including its ID, name & shape.
A Route represents a route: a Line can have several routes, that is several directions with potential junctions and different frequency for each.
A Section holds information about a specific section.
Severity object can be used to make visual grouping.
A StopArea represents a stop area: a nameable zone, where there are some stop points.
No description provided by the author
A StopPoint codes for a stop point in a line: a location where vehicles can pickup or drop off passengers.
A StopTime stores info about a stop in a route: when the vehicle comes in, when it comes out, and what stop it is.
A TrafficReport made of a network, an array of lines and an array of stop_areas.
A Trip corresponds to a scheduled vehicle circulation (and all its linked real-time and disrupted routes).
UnmarshalError is returned when unmarshalling fails It implements both error and github.com/pkg/errors's causer.
No description provided by the author
VehicleJourney gives informations on vehicle transportation schedule and details.
No description provided by the author

# Interfaces

An Object is what is contained by a Container.
A Place isn't something directly used by the Navitia.io api.
A PTObject is a Public Transport object: StopArea, Trip, Line, Route, Network, etc.

# Type aliases

DataFreshness codes for a specific data freshness requirement: realtime or base_schedule.
Effect codes for known journey status information For example, reduced service, detours or moved stops.
An Equipment codes for specific equipment the public transport object has.
An ID is used throughout the library, it is something used by the navitia API and useful to communicate with it.
An Isochrone is sent back by the /isochrones service, it gives you a multi-polygon geojson response which represent a same time travel zone.
A JourneyQualification qualifies a Journey, see const declaration.
A PTMethod is a Public Transportation method: it can be regular, estimated times or ODT (on-demand transport).
A SectionType codifies the type of section that can be encountered.
TravelerType is a Traveler's type Defines speeds & accessibility values for different types of people.