fedimovies/src/activitypub/collections.rs

28 lines
595 B
Rust
Raw Normal View History

2021-12-23 00:32:00 +00:00
use serde::Serialize;
use serde_json::{json, Value};
use super::constants::AP_CONTEXT;
use super::vocabulary::ORDERED_COLLECTION;
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub struct OrderedCollection {
#[serde(rename = "@context")]
pub context: Value,
pub id: String,
#[serde(rename = "type")]
pub object_type: String,
}
impl OrderedCollection {
pub fn new(collection_id: String) -> Self {
Self {
context: json!(AP_CONTEXT),
id: collection_id,
object_type: ORDERED_COLLECTION.to_string(),
}
}
}