Expand description
Client for the MOTIS 2 public transport routing API.
The types follow the OpenAPI specification of MOTIS MOTIS_VERSION,
vendored unchanged in openapi/openapi.yaml. They cover geocoding,
connections, departures and trips.
use motis::{Client, Geocode, LocationType};
let client = Client::builder("https://motis.example.org")
.user_agent("my-app/1.0 (contact: ops@example.org)")
.build()?;
let stops = client
.send(&Geocode {
types: vec![LocationType::Stop],
..Geocode::new("Hauptwache")
})
.await?;
for stop in stops {
println!("{} {}", stop.id, stop.name);
}The client sends every request once. It does not retry, and it does not cache: that is up to the caller.
Structs§
- Alert
- A service alert (GTFS-RT).
- Area
- An administrative area of a
Match. - Client
- A client for one MOTIS server.
- Client
Builder - Configures a
Client. - Geocode
- Finds stops, addresses and places by name (
/api/v1/geocode). - Itinerary
- A connection from one place to another.
- Leg
- One leg of an
Itinerary: a ride on one trip, or a walk. - Match
- A geocoding match: a stop, an address or another place.
- Place
- A stop or another place of a connection, with its times.
- Plan
- Plans connections between two places (
/api/v6/plan). - Plan
Response - The response of
Plan. - Reverse
Geocode - Finds stops, addresses and places near a position
(
/api/v1/reverse-geocode). - Stop
Time - A departure or arrival at a stop.
- Stoptimes
- Departures or arrivals at a stop (
/api/v6/stoptimes). - Stoptimes
Response - The response of
Stoptimes. - Time
Range - A period of an
Alert. - Timestamp
- An instant in time represented as the number of nanoseconds since the Unix epoch.
- Trip
- One trip with all its stops (
/api/v6/trip). - Url
- A parsed URL record.
Enums§
- Alert
Cause - The cause of an alert (GTFS-RT
Cause). - Alert
Effect - The effect of an alert on the service (GTFS-RT
Effect). - Alert
Severity Level - How severe an alert is.
- Direction
- The direction of a departure search without a page cursor.
- Error
- What can go wrong talking to the API.
- Location
Type - The kind of a geocoding match.
- Mode
- A means of transport, or a group of them like
Mode::Transit. - Pickup
Dropoff Type - Whether passengers may board or alight. Cancellations and skipped
stops show as
PickupDropoffType::NotAllowed. - Realtime
Mode - How routing uses realtime data.
- Timestamp
Reason - Where a time comes from.
- Vertex
Type - The kind of a place in a street routing.
Constants§
- API_
VERSION - The version of the API in the vendored specification (
info.version), also the path prefix of the routing endpoints, like/api/v6/plan. - DEFAULT_
TIMEOUT - The default time to wait for a response.
- MOTIS_
VERSION - The MOTIS release whose API this crate implements.
- OPENAPI_
SPEC - The vendored OpenAPI specification.
Traits§
- Request
- A request to one endpoint, sent with
Client::send.