Crate motis_openapi_progenitor

Crate motis_openapi_progenitor 

Source
Expand description

§API client for motis v3

This API-client was automatically generated to support the motis v3 api. It was generated (mostly, some manual editing was done).

See https://github.com/oxidecomputer/progenitor for docs on the generator used

The following code can generate the client:

wget https://raw.githubusercontent.com/motis-project/motis/refs/heads/master/openapi.yaml
sed -i 's/openapi: 3.1.0/openapi: 3.0.0/' openapi.yaml

rm -fr src Cargo.*
cargo progenitor -i openapi.yaml -o motis-openapi-progenitor -n motis-openapi-progenitor -v 0.3.1  --interface builder
mv motis-openapi-progenitor/* .
rm -fr motis-openapi-progenitor

(
  echo '#![forbid(unsafe_code)]'
  echo '#![doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/README.md"))]'
  cat src/lib.rs
) > tmpfile
mv tmpfile src/lib.rs
rm openapi.yaml

To use it, you can use the Client as following

async fn foo() {
    let res = motis_openapi_progenitor::Client::new("https://api.transitous.org").plan()
        .from_place("de-DELFI_000010073203") // landshut süd trains station
        .to_place("48.1371079,11.5753822,0") // munich coordinate at level 0
        .detailed_transfers(false)
        .send().await.unwrap();
    println!("{res:?}");
}

Modules§

builder
Types for composing operation parameters.
prelude
Items consumers will typically use such as the Client.
types
Types used as operation parameters and responses.

Structs§

ByteStream
Untyped byte stream used for both success and error responses.
Client
Client for MOTIS API
ResponseValue
Typed value returned by generated client methods.

Enums§

Error
Error produced by generated client methods.

Traits§

ClientInfo
Interface for which an implementation is generated for all clients.