pub struct Client { /* private fields */ }Expand description
Client for MOTIS API
This is the MOTIS routing API.
Version: v4
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(baseurl: &str) -> Self
pub fn new(baseurl: &str) -> Self
Create a new client.
baseurl is the base URL provided to the internal
reqwest::Client, and should include a scheme and hostname,
as well as port and a path stem if applicable.
Sourcepub fn new_with_client(baseurl: &str, client: Client) -> Self
pub fn new_with_client(baseurl: &str, client: Client) -> Self
Construct a new client with an existing reqwest::Client,
allowing more control over its configuration.
baseurl is the base URL provided to the internal
reqwest::Client, and should include a scheme and hostname,
as well as port and a path stem if applicable.
Source§impl Client
impl Client
Sourcepub fn plan(&self) -> Plan<'_>
pub fn plan(&self) -> Plan<'_>
Computes optimal connections from one place to another
Sends a GET request to /api/v4/plan
Arguments:
additional_transfer_time: Optional. Default is 0 minutes.
Additional transfer time reserved for each transfer in minutes.
-
algorithm: algorithm to use -
arrive_by: Optional. Default isfalse. -
arriveBy=true: the parametersdateandtimerefer to the arrival time -
arriveBy=false: the parametersdateandtimerefer to the departure time -
detailed_transfers: - true: Compute transfer polylines and step instructions. -
false: Only return basic information (start time, end time, duration) for transfers.
-
direct_modes: Optional. Default isWALKwhich will compute walking routes as direct connections.
Modes used for direction connections from start to destination without
using transit. Results will be returned on the direct key.
Note: Direct connections will only be returned on the first call. For paging calls, they can be omitted.
Note: Transit connections that are slower than the fastest direct
connection will not show up. This is being used as a cut-off during
transit routing to speed up the search. To prevent this, it’s
possible to send two separate requests (one with only transitModes and
one with only directModes).
Note: the output direct array will stay empty if the input param
maxDirectTime makes any direct trip impossible.
Only non-transit modes such as WALK, BIKE, CAR, BIKE_SHARING,
etc. can be used.
direct_rental_form_factors: Experimental. Expect unannounced breaking changes (without version bumps).
Optional. Only applies to direct connections.
A list of vehicle type form factors that are allowed to be used for
direct connections. If empty (the default), all form factors are
allowed. Example: BICYCLE,SCOOTER_STANDING.
direct_rental_propulsion_types: Experimental. Expect unannounced breaking changes (without version bumps).
Optional. Only applies to direct connections.
A list of vehicle type form factors that are allowed to be used for
direct connections. If empty (the default), all propulsion types are
allowed. Example: HUMAN,ELECTRIC,ELECTRIC_ASSIST.
direct_rental_providers: Experimental. Expect unannounced breaking changes (without version bumps).
Optional. Only applies to direct connections.
A list of rental providers that are allowed to be used for direct connections. If empty (the default), all providers are allowed.
elevation_costs: Optional. Default isNONE.
Set an elevation cost profile, to penalize routes with incline.
NONE: No additional costs for elevations. This is the default behaviorLOW: Add a low cost for increase in elevation and incline along the way. This will prefer routes with less ascent, if small detours are required.HIGH: Add a high cost for increase in elevation and incline along the way. This will prefer routes with less ascent, if larger detours are required.
As using an elevation costs profile will increase the travel duration, routing through steep terrain may exceed the maximal allowed duration, causing a location to appear unreachable. Increasing the maximum travel time for these segments may resolve this issue.
The profile is used for direct routing, on the first mile, and last mile.
Elevation cost profiles are currently used by following street modes:
-
BIKE -
fastest_direct_factor: Optional. Experimental. Default is1.0. Factor with which the duration of the fastest direct non-public-transit connection is multiplied. Values > 1.0 allow transit connections that are slower than the fastest direct non-public-transit connection to be found. -
fastest_slow_direct_factor: Optional. Factor with which the duration of the fastest slowDirect connection is multiplied. Values > 1.0 allow connections that are slower than the fastest direct transit connection to be found. Values < 1.0 will return all slowDirect connections. -
from_place: `latitude,longitude[,level]` tuple with -
latitude and longitude in degrees
-
(optional) level: the OSM level (default: 0)
OR
stop id
ignore_direct_rental_return_constraints: Experimental. Expect unannounced breaking changes (without version bumps).
Optional. Default is false.
If set to true, the routing will ignore rental return constraints for
direct connections, allowing the rental vehicle to be parked
anywhere.
ignore_post_transit_rental_return_constraints: Experimental. Expect unannounced breaking changes (without version bumps).
Optional. Default is false.
If set to true, the routing will ignore rental return constraints for
the part from the last transit stop to the to coordinate, allowing
the rental vehicle to be parked anywhere.
ignore_pre_transit_rental_return_constraints: Experimental. Expect unannounced breaking changes (without version bumps).
Optional. Default is false.
If set to true, the routing will ignore rental return constraints for
the part from the from coordinate to the first transit stop,
allowing the rental vehicle to be parked anywhere.
join_interlined_legs: Optional. Default istrue.
Controls if a journey section with stay-seated transfers is returned:
-
joinInterlinedLegs=false: as several legs (full information about all trip numbers, headsigns, etc.). Legs that do not require a transfer (stay-seated transfer) are marked withinterlineWithPreviousLeg=true. -
joinInterlinedLegs=true(default behavior): as only one joined leg containing all stops -
language: language tags as used in OpenStreetMap / GTFS (usually BCP-47 / ISO 639-1, or ISO 639-2 if there’s no ISO 639-1) -
luggage: Optional. Experimental. Number of luggage pieces; base unit: airline cabin luggage (e.g. for ODM or price calculation) -
max_direct_time: Optional. Default is 30min which is1800. Maximum time in seconds for direct connections. -
max_matching_distance: Optional. Default is 25 meters.
Maximum matching distance in meters to match geo coordinates to the street network.
-
max_post_transit_time: Optional. Default is 15min which is900. Maximum time in seconds for the last street leg. -
max_pre_transit_time: Optional. Default is 15min which is900. Maximum time in seconds for the first street leg. -
max_transfers: The maximum number of allowed transfers (i.e. interchanges between transit legs, pre- and postTransit do not count as transfers).maxTransfers=0searches for direct transit connections without any transfers. If you want to search only for non-transit connections (FOOT,CAR, etc.), send an emptytransitModesparameter instead.
If not provided, the routing uses the server-side default value which is hardcoded and very high to cover all use cases.
Warning: Use with care. Setting this too low can lead to optimal (e.g. the fastest) journeys not being found. If this value is too low to reach the destination at all, it can lead to slow routing performance.
In plan endpoints before v3, the behavior is off by one,
i.e. maxTransfers=0 only returns non-transit connections.
max_travel_time: The maximum travel time in minutes. If not provided, the routing to uses the value hardcoded in the server which is usually quite high.
Warning: Use with care. Setting this too low can lead to optimal (e.g. the least transfers) journeys not being found. If this value is too low to reach the destination at all, it can lead to slow routing performance.
min_transfer_time: Optional. Default is 0 minutes.
Minimum transfer time for each transfer in minutes.
-
num_itineraries: The minimum number of itineraries to compute. This is only relevant iftimetableView=true. The default value is 5. -
page_cursor: Use the cursor to go to the next “page” of itineraries. Copy the cursor from the last response and keep the original request as is. This will enable you to search for itineraries in the next or previous time-window. -
passengers: Optional. Experimental. Number of passengers (e.g. for ODM or price calculation) -
pedestrian_profile: Optional. Default isFOOT.
Accessibility profile to use for pedestrian routing in transfers between transit connections, on the first mile, and last mile.
post_transit_modes: Optional. Default isWALK. Only applies if thetoplace is a coordinate (not a transit stop). Does not apply to direct connections (seedirectModes).
A list of modes that are allowed to be used from the last transit stop
to the to coordinate. Example: WALK,BIKE_SHARING.
post_transit_rental_form_factors: Experimental. Expect unannounced breaking changes (without version bumps).
Optional. Only applies if the to place is a coordinate (not a transit
stop). Does not apply to direct connections (see
directRentalFormFactors).
A list of vehicle type form factors that are allowed to be used from the
last transit stop to the to coordinate. If empty (the default),
all form factors are allowed. Example: BICYCLE,SCOOTER_STANDING.
post_transit_rental_propulsion_types: Experimental. Expect unannounced breaking changes (without version bumps).
Optional. Only applies if the to place is a coordinate (not a transit
stop). Does not apply to direct connections (see
directRentalPropulsionTypes).
A list of vehicle propulsion types that are allowed to be used from the
last transit stop to the to coordinate. If empty (the default),
all propulsion types are allowed. Example: HUMAN,ELECTRIC, ELECTRIC_ASSIST.
post_transit_rental_providers: Experimental. Expect unannounced breaking changes (without version bumps).
Optional. Only applies if the to place is a coordinate (not a transit
stop). Does not apply to direct connections (see
directRentalProviders).
A list of rental providers that are allowed to be used from the last
transit stop to the to coordinate. If empty (the default), all
providers are allowed.
pre_transit_modes: Optional. Default isWALK. Only applies if thefromplace is a coordinate (not a transit stop). Does not apply to direct connections (seedirectModes).
A list of modes that are allowed to be used from the from coordinate
to the first transit stop. Example: WALK,BIKE_SHARING.
pre_transit_rental_form_factors: Experimental. Expect unannounced breaking changes (without version bumps).
Optional. Only applies if the from place is a coordinate (not a
transit stop). Does not apply to direct connections (see
directRentalFormFactors).
A list of vehicle type form factors that are allowed to be used from the
from coordinate to the first transit stop. If empty (the default),
all form factors are allowed. Example: BICYCLE,SCOOTER_STANDING.
pre_transit_rental_propulsion_types: Experimental. Expect unannounced breaking changes (without version bumps).
Optional. Only applies if the from place is a coordinate (not a
transit stop). Does not apply to direct connections (see
directRentalPropulsionTypes).
A list of vehicle propulsion types that are allowed to be used from the
from coordinate to the first transit stop. If empty (the default),
all propulsion types are allowed. Example: HUMAN,ELECTRIC, ELECTRIC_ASSIST.
pre_transit_rental_providers: Experimental. Expect unannounced breaking changes (without version bumps).
Optional. Only applies if the from place is a coordinate (not a
transit stop). Does not apply to direct connections (see
directRentalProviders).
A list of rental providers that are allowed to be used from the from
coordinate to the first transit stop. If empty (the default), all
providers are allowed.
require_bike_transport: Optional. Default isfalse.
If set to true, all used transit trips are required to allow bike
carriage.
require_car_transport: Optional. Default isfalse.
If set to true, all used transit trips are required to allow car
carriage.
search_window: Optional. Default is 2 hours which is7200.
The length of the search-window in seconds. Default value two hours.
-
arriveBy=true: number of seconds between the earliest departure time and latest departure time -
arriveBy=false: number of seconds between the earliest arrival time and the latest arrival time -
slow_direct: Optional. Experimental. Adds overtaken direct public transit connections. -
time: Optional. Defaults to the current time.
Departure time ($arriveBy=false) / arrival date ($arriveBy=true),
timeout: Optional. Query timeout in seconds.timetable_view: Optional. Default istrue.
Search for the best trip options within a time window. If true two itineraries are considered optimal if one is better on arrival time (earliest wins) and the other is better on departure time (latest wins). In combination with arriveBy this parameter cover the following use cases:
timetable=false = waiting for the first transit departure/arrival is
considered travel time:
arriveBy=true: event (e.g. a meeting) starts at 10:00 am, compute the best journeys that arrive by that time (maximizes departure time)arriveBy=false: event (e.g. a meeting) ends at 11:00 am, compute the best journeys that depart after that time
timetable=true = optimize “later departure” + “earlier arrival” and
give all options over a time window:
-
arriveBy=true: the time window arounddateandtimerefers to the arrival time window -
arriveBy=false: the time window arounddateandtimerefers to the departure time window -
to_place: `latitude,longitude[,level]` tuple with -
latitude and longitude in degrees
-
(optional) level: the OSM level (default: 0)
OR
stop id
transfer_time_factor: Optional. Default is 1.0
Factor to multiply minimum required transfer times with. Values smaller than 1.0 are not supported.
-
transit_modes: Optional. Default isTRANSITwhich allows all transit modes (no restriction). Allowed modes for the transit part. If empty, no transit connections will be computed. For example, this can be used to allow onlyMETRO,SUBWAY,TRAM. -
use_routed_transfers: Optional. Default isfalse.
Whether to use transfers routed on OpenStreetMap data.
-
via: List of via stops to visit (only stop IDs, no coordinates allowed for now). Also see the optional parameterviaMinimumStayto set a set a minimum stay duration for each via stop. -
via_minimum_stay: Optional. If not set, the default is0,0- no stay required.
For each via stop a minimum stay duration in minutes.
The value 0 signals that it’s allowed to stay in the same trip.
This enables via stays without counting a transfer and can lead
to better connections with less transfers. Transfer connections can
still be found with viaMinimumStay=0.
with_fares: Optional. Experimental. If set to true, the response will contain fare information.with_scheduled_skipped_stops: Optional. Include intermediate stops where passengers can not alight/board according to schedule.
let response = client.plan()
.additional_transfer_time(additional_transfer_time)
.algorithm(algorithm)
.arrive_by(arrive_by)
.detailed_transfers(detailed_transfers)
.direct_modes(direct_modes)
.direct_rental_form_factors(direct_rental_form_factors)
.direct_rental_propulsion_types(direct_rental_propulsion_types)
.direct_rental_providers(direct_rental_providers)
.elevation_costs(elevation_costs)
.fastest_direct_factor(fastest_direct_factor)
.fastest_slow_direct_factor(fastest_slow_direct_factor)
.from_place(from_place)
.ignore_direct_rental_return_constraints(ignore_direct_rental_return_constraints)
.ignore_post_transit_rental_return_constraints(ignore_post_transit_rental_return_constraints)
.ignore_pre_transit_rental_return_constraints(ignore_pre_transit_rental_return_constraints)
.join_interlined_legs(join_interlined_legs)
.language(language)
.luggage(luggage)
.max_direct_time(max_direct_time)
.max_matching_distance(max_matching_distance)
.max_post_transit_time(max_post_transit_time)
.max_pre_transit_time(max_pre_transit_time)
.max_transfers(max_transfers)
.max_travel_time(max_travel_time)
.min_transfer_time(min_transfer_time)
.num_itineraries(num_itineraries)
.page_cursor(page_cursor)
.passengers(passengers)
.pedestrian_profile(pedestrian_profile)
.post_transit_modes(post_transit_modes)
.post_transit_rental_form_factors(post_transit_rental_form_factors)
.post_transit_rental_propulsion_types(post_transit_rental_propulsion_types)
.post_transit_rental_providers(post_transit_rental_providers)
.pre_transit_modes(pre_transit_modes)
.pre_transit_rental_form_factors(pre_transit_rental_form_factors)
.pre_transit_rental_propulsion_types(pre_transit_rental_propulsion_types)
.pre_transit_rental_providers(pre_transit_rental_providers)
.require_bike_transport(require_bike_transport)
.require_car_transport(require_car_transport)
.search_window(search_window)
.slow_direct(slow_direct)
.time(time)
.timeout(timeout)
.timetable_view(timetable_view)
.to_place(to_place)
.transfer_time_factor(transfer_time_factor)
.transit_modes(transit_modes)
.use_routed_transfers(use_routed_transfers)
.via(via)
.via_minimum_stay(via_minimum_stay)
.with_fares(with_fares)
.with_scheduled_skipped_stops(with_scheduled_skipped_stops)
.send()
.await;Sourcepub fn one_to_many(&self) -> OneToMany<'_>
pub fn one_to_many(&self) -> OneToMany<'_>
Street routing from one to many places or many to one. The order in the response array corresponds to the order of coordinates of the `many` parameter in the query.
Sends a GET request to /api/v1/one-to-many
Arguments:
-
arrive_by: true = many to one false = one to many -
elevation_costs: Optional. Default isNONE.
Set an elevation cost profile, to penalize routes with incline.
NONE: No additional costs for elevations. This is the default behaviorLOW: Add a low cost for increase in elevation and incline along the way. This will prefer routes with less ascent, if small detours are required.HIGH: Add a high cost for increase in elevation and incline along the way. This will prefer routes with less ascent, if larger detours are required.
As using an elevation costs profile will increase the travel duration, routing through steep terrain may exceed the maximal allowed duration, causing a location to appear unreachable. Increasing the maximum travel time for these segments may resolve this issue.
Elevation cost profiles are currently used by following street modes:
-
BIKE -
many: geo locations as latitude;longitude,latitude;longitude,… -
max: maximum travel time in seconds -
max_matching_distance: maximum matching distance in meters to match geo coordinates to the street network -
mode: routing profile to use (currently supported: `WALK`, `BIKE`, `CAR`) -
one: geo location as latitude;longitude
let response = client.one_to_many()
.arrive_by(arrive_by)
.elevation_costs(elevation_costs)
.many(many)
.max(max)
.max_matching_distance(max_matching_distance)
.mode(mode)
.one(one)
.send()
.await;Sourcepub fn one_to_all(&self) -> OneToAll<'_>
pub fn one_to_all(&self) -> OneToAll<'_>
Computes all reachable locations from a given stop within a set duration. Each result entry will contain the fastest travel duration and the number of connections used.
Sends a GET request to /api/v1/one-to-all
Arguments:
additional_transfer_time: Optional. Default is 0 minutes.
Additional transfer time reserved for each transfer in minutes.
-
arrive_by: true = all to one, false = one to all -
elevation_costs: Optional. Default isNONE.
Set an elevation cost profile, to penalize routes with incline.
NONE: No additional costs for elevations. This is the default behaviorLOW: Add a low cost for increase in elevation and incline along the way. This will prefer routes with less ascent, if small detours are required.HIGH: Add a high cost for increase in elevation and incline along the way. This will prefer routes with less ascent, if larger detours are required.
As using an elevation costs profile will increase the travel duration, routing through steep terrain may exceed the maximal allowed duration, causing a location to appear unreachable. Increasing the maximum travel time for these segments may resolve this issue.
The profile is used for routing on both the first and last mile.
Elevation cost profiles are currently used by following street modes:
-
BIKE -
max_matching_distance: Optional. Default is 25 meters.
Maximum matching distance in meters to match geo coordinates to the street network.
-
max_post_transit_time: Optional. Default is 15min which is900. -
arriveBy=true: Maximum time in seconds for the street leg atonelocation. -
arriveBy=false: Currently not used -
max_pre_transit_time: Optional. Default is 15min which is900. -
arriveBy=true: Currently not used -
arriveBy=false: Maximum time in seconds for the street leg atonelocation. -
max_transfers: The maximum number of allowed transfers (i.e. interchanges between transit legs, pre- and postTransit do not count as transfers).maxTransfers=0searches for direct transit connections without any transfers. If you want to search only for non-transit connections (FOOT,CAR, etc.), send an emptytransitModesparameter instead.
If not provided, the routing uses the server-side default value which is hardcoded and very high to cover all use cases.
Warning: Use with care. Setting this too low can lead to optimal (e.g. the fastest) journeys not being found. If this value is too low to reach the destination at all, it can lead to slow routing performance.
In plan endpoints before v3, the behavior is off by one,
i.e. maxTransfers=0 only returns non-transit connections.
max_travel_time: The maximum travel time in minutes. Defaults to 90. The limit may be increased by the server administrator usingonetoall_max_travel_minutesoption inconfig.yml. See documentation for details.min_transfer_time: Optional. Default is 0 minutes.
Minimum transfer time for each transfer in minutes.
one: `latitude,longitude[,level]` tuple with- latitude and longitude in degrees
- (optional) level: the OSM level (default: 0)
OR
stop id
pedestrian_profile: Optional. Default isFOOT.
Accessibility profile to use for pedestrian routing in transfers between transit connections and the first and last mile respectively.
post_transit_modes: Optional. Default isWALK. The behavior depends on whetherarriveByis set:arriveBy=true: Only applies if theoneplace is a coordinate (not a transit stop).arriveBy=false: Currently not used
A list of modes that are allowed to be used from the last transit stop
to the to coordinate. Example: WALK,BIKE_SHARING.
pre_transit_modes: Optional. Default isWALK. The behavior depends on whetherarriveByis set:arriveBy=true: Currently not usedarriveBy=false: Only applies if theoneplace is a coordinate (not a transit stop).
A list of modes that are allowed to be used from the last transit stop
to the to coordinate. Example: WALK,BIKE_SHARING.
require_bike_transport: Optional. Default isfalse.
If set to true, all used transit trips are required to allow bike
carriage.
require_car_transport: Optional. Default isfalse.
If set to true, all used transit trips are required to allow car
carriage.
time: Optional. Defaults to the current time.
Departure time ($arriveBy=false) / arrival date ($arriveBy=true),
transfer_time_factor: Optional. Default is 1.0
Factor to multiply minimum required transfer times with. Values smaller than 1.0 are not supported.
-
transit_modes: Optional. Default isTRANSITwhich allows all transit modes (no restriction). Allowed modes for the transit part. If empty, no transit connections will be computed. For example, this can be used to allow onlyMETRO,SUBWAY,TRAM. -
use_routed_transfers: Optional. Default isfalse.
Whether to use transfers routed on OpenStreetMap data.
let response = client.one_to_all()
.additional_transfer_time(additional_transfer_time)
.arrive_by(arrive_by)
.elevation_costs(elevation_costs)
.max_matching_distance(max_matching_distance)
.max_post_transit_time(max_post_transit_time)
.max_pre_transit_time(max_pre_transit_time)
.max_transfers(max_transfers)
.max_travel_time(max_travel_time)
.min_transfer_time(min_transfer_time)
.one(one)
.pedestrian_profile(pedestrian_profile)
.post_transit_modes(post_transit_modes)
.pre_transit_modes(pre_transit_modes)
.require_bike_transport(require_bike_transport)
.require_car_transport(require_car_transport)
.time(time)
.transfer_time_factor(transfer_time_factor)
.transit_modes(transit_modes)
.use_routed_transfers(use_routed_transfers)
.send()
.await;Sourcepub fn reverse_geocode(&self) -> ReverseGeocode<'_>
pub fn reverse_geocode(&self) -> ReverseGeocode<'_>
Translate coordinates to the closest address(es)/places/stops
Sends a GET request to /api/v1/reverse-geocode
Arguments:
place: latitude, longitude in degreestype_: Optional. Default is all types.
Only return results of the given type.
For example, this can be used to allow only ADDRESS and STOP
results.
let response = client.reverse_geocode()
.place(place)
.type_(type_)
.send()
.await;Sourcepub fn geocode(&self) -> Geocode<'_>
pub fn geocode(&self) -> Geocode<'_>
Autocompletion & geocoding that resolves user input addresses including coordinates
Sends a GET request to /api/v1/geocode
Arguments:
-
language: language tags as used in OpenStreetMap (usually ISO 639-1, or ISO 639-2 if there’s no ISO 639-1) -
place: Optional. Used for biasing results towards the coordinate.
Format: latitude,longitude in degrees
-
place_bias: Optional. Used for biasing results towards the coordinate. Higher number = higher bias. -
text: the (potentially partially typed) address to resolve -
type_: Optional. Default is all types.
Only return results of the given types.
For example, this can be used to allow only ADDRESS and STOP
results.
let response = client.geocode()
.language(language)
.place(place)
.place_bias(place_bias)
.text(text)
.type_(type_)
.send()
.await;Sourcepub fn trip(&self) -> Trip<'_>
pub fn trip(&self) -> Trip<'_>
Get a trip as itinerary
Sends a GET request to /api/v4/trip
Arguments:
join_interlined_legs: Optional. Default istrue.
Controls if a trip with stay-seated transfers is returned:
-
joinInterlinedLegs=false: as several legs (full information about all trip numbers, headsigns, etc.). Legs that do not require a transfer (stay-seated transfer) are marked withinterlineWithPreviousLeg=true. -
joinInterlinedLegs=true(default behavior): as only one joined leg containing all stops -
language: language tags as used in OpenStreetMap / GTFS (usually BCP-47 / ISO 639-1, or ISO 639-2 if there’s no ISO 639-1) -
trip_id: trip identifier (e.g. from an itinerary leg or stop event) -
with_scheduled_skipped_stops: Optional. Include intermediate stops where passengers can not alight/board according to schedule.
let response = client.trip()
.join_interlined_legs(join_interlined_legs)
.language(language)
.trip_id(trip_id)
.with_scheduled_skipped_stops(with_scheduled_skipped_stops)
.send()
.await;Sourcepub fn stoptimes(&self) -> Stoptimes<'_>
pub fn stoptimes(&self) -> Stoptimes<'_>
Get the next N departures or arrivals of a stop sorted by time
Sends a GET request to /api/v4/stoptimes
Arguments:
-
arrive_by: Optional. Default isfalse. -
arriveBy=true: the parametersdateandtimerefer to the arrival time -
arriveBy=false: the parametersdateandtimerefer to the departure time -
direction: This parameter will be ignored in casepageCursoris set.
Optional. Default is
LATERforarriveBy=falseEARLIERforarriveBy=true
The response will contain the next n arrivals / departures
in case EARLIER is selected and the previous n
arrivals / departures if LATER is selected.
exact_radius: Optional. Default isfalse.
If set to true, only stations that are phyiscally in the radius are
considered. If set to false, additionally to the stations in the
radius, equivalences with the same name and children are considered.
fetch_stops: Experimental. Expect unannounced breaking changes (without version bumps).
Optional. Default is false. If set to true, the following stops are
returned for departures and the previous stops are returned for
arrivals.
-
language: language tags as used in OpenStreetMap / GTFS (usually BCP-47 / ISO 639-1, or ISO 639-2 if there’s no ISO 639-1) -
mode: Optional. Default is all transit modes.
Only return arrivals/departures of the given modes.
-
n: the number of events -
page_cursor: Use the cursor to go to the next “page” of stop times. Copy the cursor from the last response and keep the original request as is. This will enable you to search for stop times in the next or previous time-window. -
radius: Optional. Radius in meters.
Default is that only stop times of the parent of the stop itself and all stops with the same name (+ their child stops) are returned.
If set, all stops at parent stations and their child stops in the specified radius are returned.
-
stop_id: stop id of the stop to retrieve departures/arrivals for -
time: Optional. Defaults to the current time. -
with_scheduled_skipped_stops: Optional. Include stoptimes where passengers can not alight/board according to schedule.
let response = client.stoptimes()
.arrive_by(arrive_by)
.direction(direction)
.exact_radius(exact_radius)
.fetch_stops(fetch_stops)
.language(language)
.mode(mode)
.n(n)
.page_cursor(page_cursor)
.radius(radius)
.stop_id(stop_id)
.time(time)
.with_scheduled_skipped_stops(with_scheduled_skipped_stops)
.send()
.await;Sourcepub fn trips(&self) -> Trips<'_>
pub fn trips(&self) -> Trips<'_>
Given a area frame (box defined by top right and bottom left corner) and a time frame, it returns all trips and their respective shapes that operate in this area + time frame. Trips are filtered by zoom level. On low zoom levels, only long distance trains will be shown while on high zoom levels, also metros, buses and trams will be returned.
Sends a GET request to /api/v4/map/trips
Arguments:
end_time: end if the time windowmax: latitude,longitude pair of the upper left coordinatemin: latitude,longitude pair of the lower right coordinatestart_time: start of the time windowzoom: current zoom level
let response = client.trips()
.end_time(end_time)
.max(max)
.min(min)
.start_time(start_time)
.zoom(zoom)
.send()
.await;Sourcepub fn initial(&self) -> Initial<'_>
pub fn initial(&self) -> Initial<'_>
initial location to view the map at after loading based on where public transport should be visible
Sends a GET request to /api/v1/map/initial
let response = client.initial()
.send()
.await;Sourcepub fn stops(&self) -> Stops<'_>
pub fn stops(&self) -> Stops<'_>
Get all stops for a map section
Sends a GET request to /api/v1/map/stops
Arguments:
max: latitude,longitude pair of the upper left coordinatemin: latitude,longitude pair of the lower right coordinate
let response = client.stops()
.max(max)
.min(min)
.send()
.await;Sourcepub fn levels(&self) -> Levels<'_>
pub fn levels(&self) -> Levels<'_>
Get all available levels for a map section
Sends a GET request to /api/v1/map/levels
Arguments:
max: latitude,longitude pair of the upper left coordinatemin: latitude,longitude pair of the lower right coordinate
let response = client.levels()
.max(max)
.min(min)
.send()
.await;