Crates.io | kvv-efa-api |
lib.rs | kvv-efa-api |
version | 0.1.1 |
source | src |
created_at | 2024-01-19 22:51:26.342643 |
updated_at | 2024-04-26 17:08:25.028917 |
description | Rust bindings for the KVV (Karlsruher Verkehrs Verbund) "EFA"-API |
homepage | |
repository | https://github.com/spydr06/kvv-api-rs |
max_upload_size | |
id | 1105797 |
size | 51,191 |
Rust bindings for the KVV (Karlsruher Verkehrsverbund) "EFA" API
Warning: This API doesn't seem like a permanent solution, it could change at any time completely, making these bindings useless!
This crate includes a set of examples in the examples/
directory, run them with:
$ cargo run --example <example> --features reqwest
XSLT_DM_REQUEST
: request::departure_monitor
,XSLT_STOPFINDER_REQUEST
: request::stop_finder
,XSLT_TRIP_REQUEST
XSLT_SELTT_REQUEST
XSLT_CM_SHOWADDINFO_REQUEST
use kvv_efa_api::{self, request::{DepartureMonitorRequest, Request, StopFinderRequest}};
#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
{
// Search the station table for "Hauptbahnhof"
let request = StopFinderRequest::builder()
.name("Hauptbahnhof")
.build();
println!("Requesting {}...", request.url());
let response = request.get().await?;
println!("response: {:#?}", response);
}
{
// Fetch the departures of station 7000090 ("Karlsruhe Hauptbahnhof")
let request = DepartureMonitorRequest::builder()
.name(7000090)
.build();
println!("Requesting {}...", request.url());
let response = request.get().await?;
println!("response: {:#?}", response);
}
Ok(())
}
from
examples/basic.rs