use std::collections::HashMap;
use serde::{Deserialize, Serialize};
use serde_json::Value;
#[derive(Clone)]
pub struct MethodArgument {
pub name: String,
pub description: String,
pub help: String,
pub value: Option<Value>,
pub required: bool,
}
#[derive(Clone)]
pub struct Method {
pub name: String,
pub description: String,
pub help: String,
pub arguments: Vec<MethodArgument>,
}
pub struct MethodArguments {
arguments: HashMap<String, Value>
}
impl MethodArguments {
pub fn empty() -> Self {
Self::new(HashMap::new())
}
pub fn new(arguments: HashMap<String, Value>) -> Self {
Self {
arguments
}
}
pub fn get_argument(&self, name: &String) -> Option<Value> {
match self.arguments.get(name) {
Some(value) => Some(value.clone()),
_ => None
}
}
}
#[derive(Clone, Deserialize, Serialize)]
pub struct MethodResult {
pub code: i8,
pub message: Option<Value>,
}