diff --git a/src/activitystream/node.rs b/src/activitystream/node.rs index 4ebdffb0..f3e933ef 100644 --- a/src/activitystream/node.rs +++ b/src/activitystream/node.rs @@ -85,6 +85,18 @@ impl Node { } impl Node{ + pub fn link(uri: &str) -> Self { + Node::Link(Box::new(uri.to_string())) + } + + pub fn object(x: serde_json::Value) -> Self { + Node::Object(Box::new(x)) + } + + pub fn array(x: Vec) -> Self { + Node::Array(x.into_iter().map(|x| Node::object(x.underlying_json_object())).collect()) + } + pub async fn fetch(&mut self) -> reqwest::Result<()> { if let Node::Link(link) = self { *self = reqwest::Client::new()