From f0d8b27b23f854388229bf22b5ed3f08f898e69f Mon Sep 17 00:00:00 2001 From: asonix Date: Sat, 16 May 2020 12:29:13 -0500 Subject: [PATCH] Document object fields --- src/object.rs | 89 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 85 insertions(+), 4 deletions(-) diff --git a/src/object.rs b/src/object.rs index 07a5dd2..d39397c 100644 --- a/src/object.rs +++ b/src/object.rs @@ -1560,6 +1560,7 @@ pub struct Object { pub inner: Base, } +/// Define activitypub properties for the Object type as described by the Activity Pub vocabulary. #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize, TypedBuilder)] #[serde(rename_all = "camelCase")] #[builder(doc)] @@ -1622,78 +1623,152 @@ pub struct ApObject { pub inner: Inner, } -#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, TypedBuilder)] +/// Define all the properties of the Location type as described by the Activity Streams vocabulary. +#[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize, TypedBuilder)] #[builder(doc)] pub struct Place { + /// Indicates the accuracy of position coordinates on a Place objects. + /// + /// Expressed in properties of percentage. e.g. "94.0"means "94.0% accurate". + /// + /// - Range: xsd:float [>= 0.0f, <= 100.0f] + /// - Functional: true #[serde(skip_serializing_if = "Option::is_none")] #[builder(default, setter(strip_option, into))] pub accuracy: Option, + /// Indicates the altitude of a place. The measurement units is indicated using the units + /// property. + /// + /// If units is not specified, the default is assumed to be "m" indicating meters. + /// + /// - Range: xsd:float + /// - Functional: true #[serde(skip_serializing_if = "Option::is_none")] #[builder(default, setter(strip_option, into))] pub altitude: Option, + ///The latitude of a place. + /// + /// - Range: xsd:float + /// - Functional: true #[serde(skip_serializing_if = "Option::is_none")] #[builder(default, setter(strip_option, into))] pub latitude: Option, + /// The longitude of a place. + /// + /// - Range: xsd:float + /// - Functional: true #[serde(skip_serializing_if = "Option::is_none")] #[builder(default, setter(strip_option, into))] pub longitude: Option, + /// The radius from the given latitude and longitude for a Place. + /// + /// The units is expressed by the units property. If units is not specified, the default is + /// assumed to be "m" indicating meters. + /// + /// - Range: xsd:float + /// - Functional: true #[serde(skip_serializing_if = "Option::is_none")] #[builder(default, setter(strip_option, into))] pub radius: Option, + /// Specifies the measurement units for the radius and altitude properties on a Place object. + /// + /// If not specified, the default is assumed to be "m" for meters. + /// + /// - Range: "cm" | "feet" | "inches" | "km" | "m" | xsd:anyUri | xsd:anyUri + /// - Functional: true #[serde(skip_serializing_if = "Option::is_none")] #[builder(default, setter(strip_option))] pub units: Option, + /// The object being extended #[serde(flatten)] pub inner: Object, } -#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, TypedBuilder)] +/// The object being extendedDefine all the properties of the Profile type as described by the +/// Activity Streams vocabulary. +#[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize, TypedBuilder)] #[builder(doc)] pub struct Profile { + /// On a Profile object, the describes property identifies the object described by the Profile. + /// + /// - Range: Object + /// - Functional: true #[serde(skip_serializing_if = "Option::is_none")] #[builder(default, setter(strip_option, into))] pub describes: Option, + /// The object being extended #[serde(flatten)] pub inner: Object, } -#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, TypedBuilder)] +/// Define all the properties of the Relationship type as described by the Activity Streams +/// vocabulary. +#[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize, TypedBuilder)] #[builder(doc)] pub struct Relationship { + /// On a Relationship object, the subject property identifies one of the connected individuals. + /// + /// For instance, for a Relationship object describing "John is related to Sally", subject + /// would refer to John. + /// + /// - Range: Object | Link + /// - Functional: true #[serde(skip_serializing_if = "Option::is_none")] #[builder(default, setter(strip_option, into))] pub subject: Option, + /// When used within a Relationship describes the entity to which the subject is related. + /// + /// - Range: Object | Link + /// - Functional: false #[serde(skip_serializing_if = "Option::is_none")] #[builder(default, setter(strip_option, into))] pub object: Option>, + /// On a Relationship object, the relationship property identifies the kind of relationship + /// that exists between subject and object. + /// + /// - Range: Object + /// - Functional: false #[serde(skip_serializing_if = "Option::is_none")] #[builder(default, setter(strip_option, into))] pub relationship: Option>, + /// The object being extended #[serde(flatten)] pub inner: Object, } -#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, TypedBuilder)] +/// Define all the properties of the Tombstone type as described by the Activity Streams +/// vocabulary. +#[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize, TypedBuilder)] #[builder(doc)] pub struct Tombstone { + /// On a Tombstone object, the formerType property identifies the type of the object that was + /// deleted. + /// + /// - Range: Object + /// - Functional: false #[serde(skip_serializing_if = "Option::is_none")] #[builder(default, setter(strip_option, into))] pub former_type: Option>, + /// On a Tombstone object, the deleted property is a timestamp for when the object was deleted. + /// + /// - Range: xsd:dateTime + /// - Functional: true #[serde(skip_serializing_if = "Option::is_none")] #[builder(default, setter(strip_option, into))] pub deleted: Option, + /// The object being extended #[serde(flatten)] pub inner: Object, } @@ -1711,8 +1786,10 @@ impl Object { summary: base.remove("summary")?, url: base.remove("url")?, generator: base.remove("generator")?, + icon: base.remove("image")?, image: base.remove("image")?, location: base.remove("location")?, + tag: base.remove("tag")?, start_time: base.remove("startTime")?, end_time: base.remove("endTime")?, duration: base.remove("duration")?, @@ -1740,8 +1817,10 @@ impl Object { summary, url, generator, + icon, image, location, + tag, start_time, end_time, duration, @@ -1764,8 +1843,10 @@ impl Object { .insert("summary", summary)? .insert("url", url)? .insert("generator", generator)? + .insert("icon", icon)? .insert("image", image)? .insert("location", location)? + .insert("tag", tag)? .insert("startTime", start_time)? .insert("endTime", end_time)? .insert("duration", duration)?