notedeck

One damus client to rule them all
git clone git://jb55.com/notedeck
Log | Files | Refs | README | LICENSE

profile.rs (814B)


      1 use serde_json::Value;
      2 
      3 #[derive(Debug, Clone)]
      4 pub struct Profile(Value);
      5 
      6 impl Profile {
      7     pub fn new(value: Value) -> Profile {
      8         Profile(value)
      9     }
     10 
     11     pub fn name(&self) -> Option<&str> {
     12         return self.0["name"].as_str();
     13     }
     14 
     15     pub fn display_name(&self) -> Option<&str> {
     16         return self.0["display_name"].as_str();
     17     }
     18 
     19     pub fn lud06(&self) -> Option<&str> {
     20         return self.0["lud06"].as_str();
     21     }
     22 
     23     pub fn lud16(&self) -> Option<&str> {
     24         return self.0["lud16"].as_str();
     25     }
     26 
     27     pub fn about(&self) -> Option<&str> {
     28         return self.0["about"].as_str();
     29     }
     30 
     31     pub fn picture(&self) -> Option<&str> {
     32         return self.0["picture"].as_str();
     33     }
     34 
     35     pub fn website(&self) -> Option<&str> {
     36         return self.0["website"].as_str();
     37     }
     38 }