From c99ba0742624230b35e91e5692a5ee9c0f011bd8 Mon Sep 17 00:00:00 2001 From: RonaldsonBellande Date: Sat, 19 Apr 2025 10:34:15 -0400 Subject: [PATCH] latest pushes --- Package/rust/Cargo.toml | 2 +- Package/rust/src/bellande_step.rs | 33 +++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/Package/rust/Cargo.toml b/Package/rust/Cargo.toml index 7d6a548..cd3eac9 100644 --- a/Package/rust/Cargo.toml +++ b/Package/rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bellande_step" -version = "0.1.1" +version = "0.1.2" edition = "2021" authors = ["Bellande Robotics Sensors Research Innovation Center"] description = "A tool for running Bellande Step calculations via API or local executable" diff --git a/Package/rust/src/bellande_step.rs b/Package/rust/src/bellande_step.rs index ba25882..3abc0f0 100644 --- a/Package/rust/src/bellande_step.rs +++ b/Package/rust/src/bellande_step.rs @@ -71,6 +71,39 @@ pub async fn make_bellande_step_request( Ok(response) } +pub async fn make_bellande_step_request_local( + url: &str, + node0: Value, + node1: Value, + limit: i32, + dimensions: i32, +) -> Result> { + let client = reqwest::Client::new(); + let url = url; + + let payload = json!({ + "node0": node0, + "node1": node1, + "limit": limit, + "dimensions": dimensions, + "auth": { + "authorization_key": "bellande_web_api_opensource" + } + }); + + let response = client + .post(url) + .header("accept", "application/json") + .header("Content-Type", "application/json") + .json(&payload) + .send() + .await? + .json::() + .await?; + + Ok(response) +} + pub fn get_executable_path() -> PathBuf { if cfg!(target_os = "windows") { Path::new(env!("CARGO_MANIFEST_DIR")).join("Bellande_Step.exe")