use rustpub::complex::core::*;
use rustpub::complex::properties::*;
fn main() {
let person = PersonBuilder::default()
.id(Id::String("https://c95.pw/api/users/feddy".into()))
.name(Name::String("csos95".into()))
.build()
.unwrap();
println!("{:#?}", person);
match &person.name {
Name::String(name) => println!("their name is {}", name),
Name::Strings(names) => println!("their names are {:#?}", names),
Name::Map(name_map) => println!("their names are {:#?}", name_map),
Name::None => println!("they have no name"),
}
println!("{}", serde_json::to_string(&person).unwrap());
let input = r#"{
"@context": "https://www.w3.org/ns/activitystreams",
"summary": "Activities in context 1",
"type": "Collection",
"items": [
{
"type": "Offer",
"actor": "http://sally.example.org",
"object": "http://example.org/posts/1",
"target": "http://john.example.org",
"context": "http://example.org/contexts/1"
},
{
"type": "Like",
"actor": "http://joe.example.org",
"object": "http://example.org/posts/2",
"context": "http://example.org/contexts/1"
}
]
}"#;
let collection: CollectionEnum = serde_json::from_str(input).unwrap();
println!("{:?}", collection);
}