use std::fmt::Debug; use serde::{Deserialize, Serialize}; use serde_json::Value; use thiserror::Error; use crate::{object::GiteratedObject, operation::GiteratedOperation}; #[derive(Serialize, Deserialize, Debug, Clone)] pub struct GetSetting { pub setting_name: String, } impl GiteratedOperation for GetSetting { fn operation_name() -> &'static str { "get_setting" } type Success = Value; type Failure = GetSettingError; } #[derive(Error, Debug, Serialize, Deserialize, Clone)] pub enum GetSettingError {} #[derive(Serialize, Deserialize, Debug, Clone)] pub struct SetSetting { pub setting_name: String, pub value: Value, } impl GiteratedOperation for SetSetting { fn operation_name() -> &'static str { "set_setting" } type Success = (); type Failure = SetSettingError; } #[derive(Error, Debug, Serialize, Deserialize, Clone)] pub enum SetSettingError { #[error("Invalid setting `{0}` on object `{0}`")] InvalidSetting(String, String), }