kvv-efa-api

Crates.iokvv-efa-api
lib.rskvv-efa-api
version0.1.1
sourcesrc
created_at2024-01-19 22:51:26.342643
updated_at2024-04-26 17:08:25.028917
descriptionRust bindings for the KVV (Karlsruher Verkehrs Verbund) "EFA"-API
homepage
repositoryhttps://github.com/spydr06/kvv-api-rs
max_upload_size
id1105797
size51,191
Spydr (Spydr06)

documentation

README

kvv-efa-api

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!

Examples

This crate includes a set of examples in the examples/ directory, run them with:

$ cargo run --example <example> --features reqwest

Supported Requests:

  • XSLT_DM_REQUEST: request::departure_monitor,
  • XSLT_STOPFINDER_REQUEST: request::stop_finder,
  • XSLT_TRIP_REQUEST
  • XSLT_SELTT_REQUEST
  • XSLT_CM_SHOWADDINFO_REQUEST
  • ...

Example Code:

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

Commit count: 15

cargo fmt