latest pushes

This commit is contained in:
2025-04-19 10:34:15 -04:00
parent 274ece33af
commit c99ba07426
2 changed files with 34 additions and 1 deletions

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "bellande_step" name = "bellande_step"
version = "0.1.1" version = "0.1.2"
edition = "2021" edition = "2021"
authors = ["Bellande Robotics Sensors Research Innovation Center"] authors = ["Bellande Robotics Sensors Research Innovation Center"]
description = "A tool for running Bellande Step calculations via API or local executable" description = "A tool for running Bellande Step calculations via API or local executable"

View File

@@ -71,6 +71,39 @@ pub async fn make_bellande_step_request(
Ok(response) Ok(response)
} }
pub async fn make_bellande_step_request_local(
url: &str,
node0: Value,
node1: Value,
limit: i32,
dimensions: i32,
) -> Result<Value, Box<dyn Error>> {
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::<Value>()
.await?;
Ok(response)
}
pub fn get_executable_path() -> PathBuf { pub fn get_executable_path() -> PathBuf {
if cfg!(target_os = "windows") { if cfg!(target_os = "windows") {
Path::new(env!("CARGO_MANIFEST_DIR")).join("Bellande_Step.exe") Path::new(env!("CARGO_MANIFEST_DIR")).join("Bellande_Step.exe")