latest pushes
This commit is contained in:
@@ -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"
|
||||
|
@@ -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<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 {
|
||||
if cfg!(target_os = "windows") {
|
||||
Path::new(env!("CARGO_MANIFEST_DIR")).join("Bellande_Step.exe")
|
||||
|
Reference in New Issue
Block a user