Skip to content

Spydr06/kvv-efa-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Rust bindings for the KVV (Karlsruher Verkehrs Verbund) "EFA"-API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages