xnode_manager_sdk/os/
handlers.rs

1use crate::{
2    os::models::{OSChange, OSConfiguration},
3    request::RequestIdResponse,
4    utils::{
5        Empty, SessionGetInput, SessionGetOutput, SessionPostInput, SessionPostOutput, session_get,
6        session_post,
7    },
8};
9
10pub fn scope() -> String {
11    "/os".to_string()
12}
13
14pub type GetInput<'a> = SessionGetInput<'a, Empty, Empty>;
15pub type GetOutput = OSConfiguration;
16pub async fn get(input: GetInput<'_>) -> SessionGetOutput<GetOutput> {
17    session_get(input, scope(), |_path| "/get").await
18}
19
20pub type SetInput<'a> = SessionPostInput<'a, Empty, OSChange>;
21pub type SetOutput = RequestIdResponse;
22pub async fn set(input: SetInput<'_>) -> SessionPostOutput<SetOutput> {
23    session_post(input, scope(), |_path| "/set").await
24}
25
26pub type RebootInput<'a> = SessionPostInput<'a, Empty, Empty>;
27pub type RebootOutput = RequestIdResponse;
28pub async fn reboot(input: RebootInput<'_>) -> SessionPostOutput<RebootOutput> {
29    session_post(input, scope(), |_path| "/reboot").await
30}