#[derive(Clone, Debug, Eq, PartialEq)]
pub struct Type {
pub description: &'static str,
pub name: &'static str,
pub functions: Vec<Function>,
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct Function {
pub name: &'static str,
pub description: &'static str,
pub log_level: LogLevel,
pub db_access: DbAccess,
pub versions: Vec<FunctionVersion>,
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct FunctionVersion {
pub description: Option<&'static str>,
pub log_level: Option<LogLevel>,
pub db_access: Option<DbAccess>,
pub flags: Vec<Flag>,
pub parameters: Vec<Parameter>,
pub r#return: Option<ReturnType>,
pub errors: Vec<Error>,
}
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub enum LogLevel {
NoLog,
Verbose,
Info,
}
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub enum DbAccess {
NoAccess,
ReadOnly,
ReadWrite,
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct Flag {
pub name: &'static str,
pub description: &'static str,
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct Parameter {
pub name: &'static str,
pub r#type: &'static str,
pub description: &'static str,
pub log_level: LogLevel,
pub validations: Vec<ParameterValidation>,
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct ReturnType {
pub name: &'static str,
pub r#type: &'static str,
pub description: &'static str,
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct Error {
pub r#type: &'static str,
pub occurrences: Vec<&'static str>,
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct ParameterValidation {
pub r#type: ParameterValidationType,
pub flag_condition: Option<FlagCondition>,
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct FlagCondition {
pub inverted: bool,
pub flag: &'static str,
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum ParameterValidationType {
NotNull,
IdNotNull,
IdNotNone,
IdSpecified,
Exists,
PositionWithinBounds {
bounds_folder_object: &'static str,
},
Is {
expected_types: Vec<&'static str>,
},
ValidPath,
ValidUtf8,
NotBlank,
PathExists,
PathParentMustExist,
ValidPropertyValue {
type_source: &'static str,
settings_source: &'static str,
},
ValidPropertyValueDb {
property_source: &'static str,
},
ValidSettings {
type_source: &'static str,
},
ValidSettingsDb {
property_source: &'static str,
},
}