improve usability of Account struct #1

Merged
epilys merged 3 commits from proxy-updates into main 4 months ago
  1. 29
      src/rfc8620.rs

29
src/rfc8620.rs

@ -244,15 +244,32 @@ pub struct CapabilitiesObject {
collation_algorithms: Vec<String>,
}
#[derive(Deserialize, Serialize, Debug)]
#[derive(Deserialize, Serialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct Account {
name: String,
is_personal: bool,
is_read_only: bool,
account_capabilities: HashMap<String, Value>,
pub name: String,
pub is_personal: bool,
pub is_read_only: bool,
pub account_capabilities: HashMap<String, Value>,
#[serde(flatten)]
extra_properties: HashMap<String, Value>,
pub extra_properties: HashMap<String, Value>,
}
impl Account {
pub fn new(
name: String,
is_personal: bool,
is_read_only: bool,
capabilities: Option<HashMap<String, Value>>,
) -> Self {
Self {
name,
is_personal,
is_read_only,
account_capabilities: capabilities.unwrap_or_default(),
extra_properties: HashMap::default(),
}
}
}
impl Object for Account {

Loading…
Cancel
Save