Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/daenney/trafikinfo
Go client for the Trafikinfo API from Trafikverket
https://github.com/daenney/trafikinfo
sweden trafikinfo trafikverket transport
Last synced: about 2 months ago
JSON representation
Go client for the Trafikinfo API from Trafikverket
- Host: GitHub
- URL: https://github.com/daenney/trafikinfo
- Owner: daenney
- License: mit
- Created: 2022-06-18T15:05:19.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-01-24T15:51:32.000Z (11 months ago)
- Last Synced: 2024-10-20T00:39:00.101Z (3 months ago)
- Topics: sweden, trafikinfo, trafikverket, transport
- Language: Go
- Homepage:
- Size: 230 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
🚦 Trafikinfo 🦺A Go library for the Trafikinfo API from Trafikverket
This library provides the necessary primitives to interact with the
Trafikinfo API. It contains a query builder that can be used to build up a
`Request` object. You can then `xml.Marshal` it and pass it on to your
favourite HTTP client to retrieve it. The response can be decoded using `xml.Unmarshal`.The data returned by the [Trafikinfo API is licensed][tl] under [Creative Commons
CC0][cc0].[tl]: https://data.trafikverket.se/documentation/datacache/intro
[cc0]: https://creativecommons.org/publicdomain/zero/1.0/## Usage
See the example client in [`examples/client`](examples/client/). It includes
preparing the query, decoding the response etc.Multiple queries can be passed by either passing multiple `NewQuery()` into a
single `Query()` call, or chaining `.Query()` multiple times on the result of
`NewRequest()`.Calling `.Filter()` multiple times on a `Query` will replace the whole filter,
as a query can only have one filter block.## Supported object types
This library provides facilities for response decoding for the following object
types and versions.| Object | Version(s) |
:-- | :-----------
`Camera` | 1
`FerryAnnouncement` | 1.2
`FerryRoute` | 1.2
`Icon` | 1.1
`MeasurementData20` | 1.0
`MeasurementData100` | 1.0
`Parking` | 1.4
`PavementData` | 1
`RailCrossing` | 1.5
`ReasonCode` | 1
`RoadCondition` | 1.2
`RoadData` | 1
`RoadGeometry` | 1
`Situation` | 1.5
`TrafficFlow` | 1.4
`TrafficSafetyCamera` | 1
`TrainAnnouncement` | 1.9
`TrainMessage` | 1.7
`TrainPosition` | 1.1
`TrainStation` | 1.4
`TrainStationMessage` | 1
`TravelTimeRoute` | 1.5
`WeatherMeasurepoint` | 2
`WeatherObservation` | 2