hafas 1.0.0

Client for the HAFAS ReST public transport API
Documentation
//! Client for the HAFAS ReST public transport API.
//!
//! The types follow the dialect versions [`DIALECT_VERSIONS`] of the API
//! and read both: fields that only one of them sends are optional. They
//! cover location search, departure and arrival boards, trip search, journey
//! details and the reconstruction of a trip.
//!
//! The crate is neutral towards the operator: it has no default base URL and
//! no policy for the access key.
//!
//! ```no_run
//! # async fn run() -> Result<(), hafas::Error> {
//! use hafas::{Client, LocationName};
//!
//! let client = Client::builder("https://hafas.example.org/api/")
//!     .access_id("secret")
//!     .user_agent("my-app/1.0 (+https://example.org)")
//!     .build()?;
//! let list = client.send(&LocationName::new("Hauptwache")).await?;
//! for stop in list.stops() {
//!     println!("{} {}", stop.ext_id, stop.name);
//! }
//! # Ok(())
//! # }
//! ```
//!
//! The access key is a query parameter, so every request URL contains it.
//! The client keeps it out of everything it returns or logs: [`Client::url`]
//! leaves it out, errors carry no URL, and texts of the API that echo the key
//! have it replaced by [`REDACTED`].
//!
//! The client sends every request once. It does not retry, and it does not
//! cache: that is up to the caller.

mod client;
mod enums;
mod error;
mod list;
mod request;
mod types;

pub use client::{Client, ClientBuilder, DEFAULT_TIMEOUT, REDACTED};
pub use enums::{JourneyStatus, LocationKind, PlatformKind, PrognosisType, RtMode};
pub use error::Error;
pub use request::{
    ArrivalBoard, DepartureBoard, JourneyDetail, LocationName, NearbyStops, Place, Recon, Request,
    TripSearch,
};
pub use reqwest::Url;
pub use types::{
    Arrival, ArrivalList, BoardEvent, CoordLocation, Departure, DepartureList, Direction, Journey,
    JourneyDetailRef, Leg, Location, LocationList, LocationNote, Message, Name, Note, Occupancy,
    OriginDest, Platform, Product, ResponseInfo, ServiceDays, Stop, StopLocation, Trip, TripList,
    TripStatus,
};

/// The dialect versions of the API this crate reads.
pub const DIALECT_VERSIONS: [&str; 2] = ["2.39", "2.52"];