Skip to content

Commit

Permalink
Fix issue with JSON handling
Browse files Browse the repository at this point in the history
  • Loading branch information
bubelov committed Oct 11, 2024
1 parent 9452867 commit 93776c8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions src/command/area.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{rpc, Result};
use clap::Args;
use serde_json::json;
use serde_json::{json, Value};

#[derive(Args)]
pub struct GetAreaArgs {
Expand All @@ -15,13 +15,14 @@ pub fn get_area(args: &GetAreaArgs) -> Result<()> {
pub struct SetAreaTagArgs {
pub id: String,
pub name: String,
pub value: serde_json::Value,
pub value: String,
}

pub fn set_area_tag(args: &SetAreaTagArgs) -> Result<()> {
let value: Value = serde_json::from_str(&args.value)?;
rpc::call(
"set_area_tag",
json!({"id": args.id,"name": args.name, "value": args.value}),
json!({"id": args.id,"name": args.name, "value": value}),
)
}

Expand Down
7 changes: 4 additions & 3 deletions src/command/element.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{rpc, Result};
use clap::Args;
use serde_json::json;
use serde_json::{json, Value};

#[derive(Args)]
pub struct GetElementArgs {
Expand All @@ -15,13 +15,14 @@ pub fn get_element(args: &GetElementArgs) -> Result<()> {
pub struct SetElementTagArgs {
pub id: String,
pub name: String,
pub value: serde_json::Value,
pub value: String,
}

pub fn set_element_tag(args: &SetElementTagArgs) -> Result<()> {
let value: Value = serde_json::from_str(&args.value)?;
rpc::call(
"set_element_tag",
json!({"id": args.id,"name": args.name, "value": args.value}),
json!({"id": args.id,"name": args.name, "value": value}),
)
}

Expand Down

0 comments on commit 93776c8

Please sign in to comment.