forked from lavina/lavina
1
0
Fork 0
lavina/crates/mgmt-api/src/lib.rs

38 lines
924 B
Rust
Raw Normal View History

2023-09-24 20:59:34 +00:00
use serde::{Deserialize, Serialize};
2024-05-01 15:30:31 +00:00
pub mod rooms;
2023-09-24 20:59:34 +00:00
#[derive(Serialize, Deserialize)]
pub struct ErrorResponse<'a> {
pub code: &'a str,
pub message: &'a str,
}
#[derive(Serialize, Deserialize)]
pub struct CreatePlayerRequest<'a> {
pub name: &'a str,
}
#[derive(Serialize, Deserialize)]
pub struct StopPlayerRequest<'a> {
pub name: &'a str,
}
2023-09-24 20:59:34 +00:00
#[derive(Serialize, Deserialize)]
pub struct ChangePasswordRequest<'a> {
pub player_name: &'a str,
pub password: &'a str,
}
pub mod paths {
pub const CREATE_PLAYER: &'static str = "/mgmt/create_player";
pub const STOP_PLAYER: &'static str = "/mgmt/stop_player";
2023-09-24 20:59:34 +00:00
pub const SET_PASSWORD: &'static str = "/mgmt/set_password";
}
pub mod errors {
pub const INVALID_PATH: &'static str = "invalid_path";
pub const MALFORMED_REQUEST: &'static str = "malformed_request";
pub const PLAYER_NOT_FOUND: &'static str = "player_not_found";
}