.. | ||
testdata | ||
.gitignore | ||
activePeriod.go | ||
calendar.go | ||
channel.go | ||
common_test.go | ||
company.go | ||
container_fuzz.go | ||
container_json.go | ||
container_test.go | ||
container.go | ||
coord.go | ||
departure.go | ||
display.go | ||
disruption_test.go | ||
disruption.go | ||
equipment.go | ||
exception.go | ||
fare.go | ||
fareZone.go | ||
fuzz.sh | ||
id_test.go | ||
id.go | ||
impactedObject.go | ||
impactedSection.go | ||
impactedStop.go | ||
isochrone.go | ||
journeyPattern.go | ||
journeys_fuzz.go | ||
journeys_test.go | ||
journeys.go | ||
json.go | ||
line_test.go | ||
line.go | ||
linereport.go | ||
link.go | ||
message.go | ||
misc.go | ||
mode.go | ||
network.go | ||
pathSegment.go | ||
period.go | ||
place.go | ||
ptobject.go | ||
README.md | ||
region_fuzz.go | ||
region_test.go | ||
region.go | ||
route_test.go | ||
route.go | ||
section_test.go | ||
section.go | ||
severity.go | ||
trafficreport.go | ||
types_test.go | ||
validityPattern.go | ||
vehicleJourney.go | ||
weekPattern.go |
navitia/types is a library for working with types returned by the Navitia API. ![GoDoc](https://godoc.org/github.com/govitia/navitia/types?status.svg)
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 Name | Description | Navitia Name |
---|---|---|
Journey |
A journey (X-->Y) | "journey" |
Section |
A section of a Journey |
"section" |
Region |
A region covered by the API | "region" |
Isochrone |
A region covered by the API | "isochrone" |
Container |
This contains a Place or a PTObject | "place"/"pt_object" |
Place |
Place is an empty interface, by convention used to identify an Address , StopPoint , StopArea , POI , Admin & Coordinates . |
|
PTObject |
PTObject is an empty interface by convention used to identify a Public Transportation object | |
Line |
A public transit line. | "line" |
Route |
A 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
toEffect
- 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)