hafas
Client for the HAFAS ReST public transport API, for the dialect versions 2.39 and 2.52.
Part of rmv.
It covers location.name, location.nearbystops, departureBoard,
arrivalBoard, trip, journeyDetail and recon. The crate has no default
server and no policy for the access key: the caller passes both.
use ;
async
The access key
The access key is a query parameter, so every request URL contains it. The client keeps it out of everything it hands back:
Client::urlbuilds a URL without the key, andDebughides it.- Errors carry no URL, and texts from the server have the key replaced.
- The debug log of a request shows the URL without the key.
- Without a key,
sendreturnsError::AccessIdMissingbefore it opens a connection.
The client does not retry. Whether and how often to try again is up to the
caller; Error::retry_after gives the wait the server asked for.
Versions
Servers send their serverVersion and dialectVersion in every answer, and
the client logs both at debug level. The types read the fields of both
dialect versions and keep enum values they do not know in Other, so a newer
server does not break decoding.
schema/ holds a reduced extract of the XSD and the WADLs of both versions:
names, types, enums and cardinality. The tests check every field of the types
and every request parameter against it.