-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
546 additions
and
185 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
use crate::{rpc, Result}; | ||
use clap::Args; | ||
use serde_json::json; | ||
|
||
#[derive(Args)] | ||
pub struct AddAdminArgs { | ||
pub new_admin_name: String, | ||
pub new_admin_password: String, | ||
} | ||
|
||
pub fn add_admin(args: &AddAdminArgs) -> Result<()> { | ||
rpc::call( | ||
"add_admin", | ||
json!({"new_admin_name": args.new_admin_name, "new_admin_password": args.new_admin_password}), | ||
) | ||
} | ||
|
||
#[derive(Args)] | ||
pub struct AddAllowedActionArgs { | ||
pub admin_name: String, | ||
pub action: String, | ||
} | ||
|
||
pub fn add_allowed_action(args: &AddAllowedActionArgs) -> Result<()> { | ||
rpc::call( | ||
"add_allowed_action", | ||
json!({"admin_name": args.admin_name, "action": args.action}), | ||
) | ||
} | ||
|
||
#[derive(Args)] | ||
pub struct RemoveAllowedActionArgs { | ||
pub admin_name: String, | ||
pub action: String, | ||
} | ||
|
||
pub fn remove_allowed_action(args: &RemoveAllowedActionArgs) -> Result<()> { | ||
rpc::call( | ||
"remove_allowed_action", | ||
json!({"admin_name": args.admin_name, "action": args.action}), | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
use crate::{rpc, Result}; | ||
use clap::Args; | ||
use serde_json::json; | ||
|
||
#[derive(Args)] | ||
pub struct GetAreaArgs { | ||
pub id: String, | ||
} | ||
|
||
pub fn get_area(args: &GetAreaArgs) -> Result<()> { | ||
rpc::call("get_area", json!({"id": args.id})) | ||
} | ||
|
||
#[derive(Args)] | ||
pub struct SetAreaTagArgs { | ||
pub id: String, | ||
pub name: String, | ||
pub value: serde_json::Value, | ||
} | ||
|
||
pub fn set_area_tag(args: &SetAreaTagArgs) -> Result<()> { | ||
rpc::call( | ||
"set_area_tag", | ||
json!({"id": args.id,"name": args.name, "value": args.value}), | ||
) | ||
} | ||
|
||
#[derive(Args)] | ||
pub struct RemoveAreaTagArgs { | ||
pub id: String, | ||
pub tag: String, | ||
} | ||
|
||
pub fn remove_area_tag(args: &RemoveAreaTagArgs) -> Result<()> { | ||
rpc::call("remove_area_tag", json!({"id": args.id,"tag": args.tag})) | ||
} | ||
|
||
#[derive(Args)] | ||
pub struct SetAreaIconArgs { | ||
pub id: String, | ||
pub icon_base64: String, | ||
pub icon_ext: String, | ||
} | ||
|
||
pub fn set_area_icon(args: &SetAreaIconArgs) -> Result<()> { | ||
rpc::call( | ||
"set_area_icon", | ||
json!({"id": args.id,"icon_base64": args.icon_base64,"icon_ext": args.icon_ext}), | ||
) | ||
} | ||
|
||
#[derive(Args)] | ||
pub struct GenerateAreasElementsMappingArgs { | ||
pub from_element_id: i64, | ||
pub to_element_id: i64, | ||
} | ||
|
||
pub fn generate_areas_elements_mapping(args: &GenerateAreasElementsMappingArgs) -> Result<()> { | ||
rpc::call( | ||
"generate_areas_elements_mapping", | ||
json!({"from_element_id": args.from_element_id,"to_element_id": args.to_element_id}), | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
use crate::{rpc, Result}; | ||
use clap::Args; | ||
use serde_json::json; | ||
|
||
#[derive(Args)] | ||
pub struct SearchArgs { | ||
pub query: String, | ||
} | ||
|
||
pub fn search(args: &SearchArgs) -> Result<()> { | ||
rpc::call("search", json!({"query": args.query})) | ||
} |
Oops, something went wrong.