Document object fields

This commit is contained in:
asonix 2020-05-16 12:29:13 -05:00
parent f4a111b5e2
commit f0d8b27b23

View file

@ -1560,6 +1560,7 @@ pub struct Object<Kind> {
pub inner: Base<Kind>,
}
/// 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<Inner> {
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<XsdFloat>,
/// 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<XsdFloat>,
///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<XsdFloat>,
/// 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<XsdFloat>,
/// 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<XsdFloat>,
/// 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<Unit>,
/// The object being extended
#[serde(flatten)]
pub inner: Object<PlaceType>,
}
#[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<AnyBase>,
/// The object being extended
#[serde(flatten)]
pub inner: Object<ProfileType>,
}
#[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<AnyBase>,
/// 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<OneOrMany<AnyBase>>,
/// 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<OneOrMany<AnyBase>>,
/// The object being extended
#[serde(flatten)]
pub inner: Object<RelationshipType>,
}
#[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<OneOrMany<AnyBase>>,
/// 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<XsdDateTime>,
/// The object being extended
#[serde(flatten)]
pub inner: Object<TombstoneType>,
}
@ -1711,8 +1786,10 @@ impl<Kind> Object<Kind> {
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<Kind> Object<Kind> {
summary,
url,
generator,
icon,
image,
location,
tag,
start_time,
end_time,
duration,
@ -1764,8 +1843,10 @@ impl<Kind> Object<Kind> {
.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)?