h3poteto / megalodon-rs

Fediverse API client library for Rust
Apache License 2.0
108 stars 22 forks source link

missing fields `birthday_min_age` and `birthday_required` on some Pleroma/Akkoma instances #196

Closed adryzz closed 7 months ago

adryzz commented 7 months ago

Hi! Thanks for this awesome crate!

While testing a few things on my akkoma instance, i noticed that running the pleroma_instance example, the API call fails because the fields birthday_min_age and birthday_required are missing.

I thought it was an Akkoma-specific thing, but after going to the Pleroma featured instances, 2/3 instances have the same issue.

It should be pretty simple to fix, like this.

#[derive(Debug, Deserialize, Serialize, Clone)]
pub struct PleromaMetadata {
    pub account_activation_required: bool,
+    #[serde(default)]
    pub birthday_min_age: u32,
+    #[serde(default)]
    pub birthday_required: bool,
    pub features: Vec<String>,
    pub federation: Federation,
    pub fields_limits: FieldsLimits,
    pub post_formats: Vec<String>,
}