4 releases

0.2.1 Oct 13, 2024
0.2.0 Sep 29, 2024
0.1.1 Aug 27, 2024
0.1.0 Jun 14, 2024

#453 in Hardware support

Download history 133/week @ 2024-08-24 10/week @ 2024-08-31 14/week @ 2024-09-14 18/week @ 2024-09-21 233/week @ 2024-09-28 15/week @ 2024-10-05 164/week @ 2024-10-12 9/week @ 2024-10-19

294 downloads per month

GPL-3.0 license

18KB
286 lines

rzap

This library provides an interface to controll shocker devices via OpenShock's API

NOTE: This is an un-official API iterface created by someone who has just started learning rust, no guarantees are made and contributions are greatly welcomed

[dependencies]
reqwest = { version = "0.11.27" }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
strum_macros = "0.26.4"
strum = "0.26.2"
tokio = { version = "1.21.2", features = ["macros", "rt-multi-thread"] }

Example

A simple request to retrieve the API key user's id

    dotenv().ok();
    let openshock_token = dotenv::var("OPENSHOCK_TOKEN").expect("missing OPENSHOCK_TOKEN");
    let app_name = env!("CARGO_PKG_NAME");
    let app_version = env!("CARGO_PKG_VERSION");

    assert_ne!(openshock_token, "");

    openshock_api = OpenShockAPIBuilder::new()
        .with_app(app_name.to_string(), Some(app_version.to_string()))
        .with_default_api_token(openshock_token)
        .build()
        .unwrap();
    
    println!(openshock_api.get_user_info(None).await.unwrap().id);

Dependencies

~6–18MB
~247K SLoC