Skip to main content

ojak_vocab/
generated.rs

1//! Vocabulary types generated from Fedify's schemas.
2//!
3//! Do not edit this file. It is written by `cargo run -p ojak-vocab-gen`
4//! from *crates/ojak-vocab/schemas*, which are Fedify's work under the MIT
5//! license in that directory, and a test fails when it differs from what the
6//! generator would write now.
7//!
8//! Each type reads a document in the form [`crate::read`] produces and writes
9//! one in the same spelling. A property that may take several types takes an
10//! enum of them, with `Iri` for a reference and `Other` for anything no
11//! schema describes.
12
13use alloc::{boxed::Box, string::String, vec::Vec};
14use serde_json::Value;
15
16use crate::{
17    Iri, Reference,
18    json::{self, FromJson, JsonError, ProofPurpose, Text, ToJson, Units, serde_via_json},
19};
20
21/// Indicates that the `actor` accepts the `object`.  The `target` property can be
22/// used in certain circumstances to indicate the context into which the `object`
23/// has been accepted.
24///
25/// The type `https://www.w3.org/ns/activitystreams#Accept`.
26#[derive(Clone, Debug, Default, PartialEq)]
27pub struct Accept {
28    /// The IRI that identifies this object.
29    pub id: Option<Iri>,
30    /// See [`Object::attachments`].
31    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
32    /// See [`Object::attributions`].
33    pub attributions: Vec<AnyActor>,
34    /// See [`Object::audiences`].
35    pub audiences: Vec<AnyObject>,
36    /// See [`Object::content`].
37    pub content: Text,
38    /// See [`Object::contexts`].
39    pub contexts: Vec<LinkOrObject>,
40    /// See [`Object::name`].
41    pub name: Text,
42    /// See [`Object::end_time`].
43    pub end_time: Option<String>,
44    /// See [`Object::generators`].
45    pub generators: Vec<LinkOrObject>,
46    /// See [`Object::icons`].
47    pub icons: Vec<Reference<Image>>,
48    /// See [`Object::images`].
49    pub images: Vec<Reference<Image>>,
50    /// See [`Object::reply_targets`].
51    pub reply_targets: Vec<LinkOrObject>,
52    /// See [`Object::locations`].
53    pub locations: Vec<LinkOrObject>,
54    /// See [`Object::previews`].
55    pub previews: Vec<LinkOrObject>,
56    /// See [`Object::published`].
57    pub published: Option<String>,
58    /// See [`Object::replies`].
59    pub replies: Option<AnyCollection>,
60    /// See [`Object::shares`].
61    pub shares: Option<AnyCollection>,
62    /// See [`Object::likes`].
63    pub likes: Option<AnyCollection>,
64    /// See [`Object::emoji_reactions`].
65    pub emoji_reactions: Option<AnyCollection>,
66    /// See [`Object::start_time`].
67    pub start_time: Option<String>,
68    /// See [`Object::summary`].
69    pub summary: Text,
70    /// See [`Object::tags`].
71    pub tags: Vec<LinkOrObject>,
72    /// See [`Object::updated`].
73    pub updated: Option<String>,
74    /// See [`Object::urls`].
75    pub urls: Vec<LinkOrIri>,
76    /// See [`Object::tos`].
77    pub tos: Vec<AnyObject>,
78    /// See [`Object::btos`].
79    pub btos: Vec<AnyObject>,
80    /// See [`Object::ccs`].
81    pub ccs: Vec<AnyObject>,
82    /// See [`Object::bccs`].
83    pub bccs: Vec<AnyObject>,
84    /// See [`Object::media_type`].
85    pub media_type: Option<String>,
86    /// See [`Object::duration`].
87    pub duration: Option<String>,
88    /// See [`Object::sensitive`].
89    pub sensitive: Option<bool>,
90    /// See [`Object::source`].
91    pub source: Option<Box<Source>>,
92    /// See [`Object::proofs`].
93    pub proofs: Vec<Reference<DataIntegrityProof>>,
94    /// See [`Object::interaction_policy`].
95    pub interaction_policy: Option<Box<InteractionPolicy>>,
96    /// See [`Object::approved_by`].
97    pub approved_by: Option<Iri>,
98    /// See [`Object::like_authorization`].
99    pub like_authorization: Option<Reference<LikeAuthorization>>,
100    /// See [`Object::reply_authorization`].
101    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
102    /// See [`Object::announce_authorization`].
103    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
104    /// See [`Object::translations`].
105    pub translations: Vec<Translation>,
106    /// See [`Activity::actors`].
107    pub actors: Vec<AnyActor>,
108    /// See [`Activity::objects`].
109    pub objects: Vec<AnyObject>,
110    /// See [`Activity::targets`].
111    pub targets: Vec<AnyObject>,
112    /// See [`Activity::results`].
113    pub results: Vec<AnyObject>,
114    /// See [`Activity::origins`].
115    pub origins: Vec<AnyObject>,
116    /// See [`Activity::instruments`].
117    pub instruments: Vec<AnyObject>,
118}
119
120impl Accept {
121    /// The type's IRI.
122    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Accept";
123    /// The type's `type` in a normalised document.
124    pub const TYPE: &'static str = "Accept";
125}
126
127impl json::Typed for Accept {
128    const TYPE: &'static str = "Accept";
129}
130
131impl FromJson for Accept {
132    fn from_json(value: &Value) -> Result<Self, JsonError> {
133        let object = json::object(value)?;
134        json::expect_type(object, Self::TYPE)?;
135        Ok(Self {
136            id: json::id(object),
137            attachments: json::many(object, &["attachment"]),
138            attributions: json::many(object, &["attributedTo"]),
139            audiences: json::many(object, &["audience"]),
140            content: json::text(object, "content"),
141            contexts: json::many(object, &["context"]),
142            name: json::text(object, "name"),
143            end_time: json::one(object, &["endTime"]),
144            generators: json::many(object, &["generator"]),
145            icons: json::many_mapped(object, &["icon"], json::link_to_image),
146            images: json::many_mapped(object, &["image"], json::link_to_image),
147            reply_targets: json::many(object, &["inReplyTo"]),
148            locations: json::many(object, &["location"]),
149            previews: json::many(object, &["preview"]),
150            published: json::one(object, &["published"]),
151            replies: json::one(object, &["replies"]),
152            shares: json::one(object, &["shares"]),
153            likes: json::one(object, &["likes"]),
154            emoji_reactions: json::one(object, &["emojiReactions"]),
155            start_time: json::one(object, &["startTime"]),
156            summary: json::text(object, "summary"),
157            tags: json::many(object, &["tag"]),
158            updated: json::one(object, &["updated"]),
159            urls: json::many(object, &["url"]),
160            tos: json::many(object, &["to"]),
161            btos: json::many(object, &["bto"]),
162            ccs: json::many(object, &["cc"]),
163            bccs: json::many(object, &["bcc"]),
164            media_type: json::one(object, &["mediaType"]),
165            duration: json::one(object, &["duration"]),
166            sensitive: json::one(object, &["sensitive"]),
167            source: json::one(object, &["source"]),
168            proofs: json::many(object, &["proof"]),
169            interaction_policy: json::one(object, &["interactionPolicy"]),
170            approved_by: json::one(object, &["approvedBy"]),
171            like_authorization: json::one(object, &["likeAuthorization"]),
172            reply_authorization: json::one(object, &["replyAuthorization"]),
173            announce_authorization: json::one(object, &["announceAuthorization"]),
174            translations: json::many(object, &["translations"]),
175            actors: json::many(object, &["actor"]),
176            objects: json::many(object, &["object"]),
177            targets: json::many(object, &["target"]),
178            results: json::many(object, &["result"]),
179            origins: json::many(object, &["origin"]),
180            instruments: json::many(object, &["instrument"]),
181        })
182    }
183}
184
185impl ToJson for Accept {
186    fn to_json(&self) -> Value {
187        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
188        json::put_many(&mut object, &["attachment"], &self.attachments);
189        json::put_many(&mut object, &["attributedTo"], &self.attributions);
190        json::put_many(&mut object, &["audience"], &self.audiences);
191        json::put_text(&mut object, "content", &self.content);
192        json::put_many(&mut object, &["context"], &self.contexts);
193        json::put_text(&mut object, "name", &self.name);
194        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
195        json::put_many(&mut object, &["generator"], &self.generators);
196        json::put_many(&mut object, &["icon"], &self.icons);
197        json::put_many(&mut object, &["image"], &self.images);
198        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
199        json::put_many(&mut object, &["location"], &self.locations);
200        json::put_many(&mut object, &["preview"], &self.previews);
201        json::put_one(&mut object, &["published"], self.published.as_ref());
202        json::put_one(&mut object, &["replies"], self.replies.as_ref());
203        json::put_one(&mut object, &["shares"], self.shares.as_ref());
204        json::put_one(&mut object, &["likes"], self.likes.as_ref());
205        json::put_one(
206            &mut object,
207            &["emojiReactions"],
208            self.emoji_reactions.as_ref(),
209        );
210        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
211        json::put_text(&mut object, "summary", &self.summary);
212        json::put_many(&mut object, &["tag"], &self.tags);
213        json::put_one(&mut object, &["updated"], self.updated.as_ref());
214        json::put_many(&mut object, &["url"], &self.urls);
215        json::put_many(&mut object, &["to"], &self.tos);
216        json::put_many(&mut object, &["bto"], &self.btos);
217        json::put_many(&mut object, &["cc"], &self.ccs);
218        json::put_many(&mut object, &["bcc"], &self.bccs);
219        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
220        json::put_one(&mut object, &["duration"], self.duration.as_ref());
221        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
222        json::put_one(&mut object, &["source"], self.source.as_ref());
223        json::put_many(&mut object, &["proof"], &self.proofs);
224        json::put_one(
225            &mut object,
226            &["interactionPolicy"],
227            self.interaction_policy.as_ref(),
228        );
229        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
230        json::put_one(
231            &mut object,
232            &["likeAuthorization"],
233            self.like_authorization.as_ref(),
234        );
235        json::put_one(
236            &mut object,
237            &["replyAuthorization"],
238            self.reply_authorization.as_ref(),
239        );
240        json::put_one(
241            &mut object,
242            &["announceAuthorization"],
243            self.announce_authorization.as_ref(),
244        );
245        json::put_many(&mut object, &["translations"], &self.translations);
246        json::put_many(&mut object, &["actor"], &self.actors);
247        json::put_many(&mut object, &["object"], &self.objects);
248        json::put_many(&mut object, &["target"], &self.targets);
249        json::put_many(&mut object, &["result"], &self.results);
250        json::put_many(&mut object, &["origin"], &self.origins);
251        json::put_many(&mut object, &["instrument"], &self.instruments);
252        Value::Object(object)
253    }
254}
255
256/// An Activity is a subtype of {@link Object} that describes some form of action
257/// that may happen, is currently happening, or has already happened.
258/// The {@link Activity} type itself serves as an abstract base type for all types
259/// of activities.  It is important to note that the {@link Activity} type itself
260/// does not carry any specific semantics about the kind of action being taken.
261///
262/// The type `https://www.w3.org/ns/activitystreams#Activity`.
263#[derive(Clone, Debug, Default, PartialEq)]
264pub struct Activity {
265    /// The IRI that identifies this object.
266    pub id: Option<Iri>,
267    /// See [`Object::attachments`].
268    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
269    /// See [`Object::attributions`].
270    pub attributions: Vec<AnyActor>,
271    /// See [`Object::audiences`].
272    pub audiences: Vec<AnyObject>,
273    /// See [`Object::content`].
274    pub content: Text,
275    /// See [`Object::contexts`].
276    pub contexts: Vec<LinkOrObject>,
277    /// See [`Object::name`].
278    pub name: Text,
279    /// See [`Object::end_time`].
280    pub end_time: Option<String>,
281    /// See [`Object::generators`].
282    pub generators: Vec<LinkOrObject>,
283    /// See [`Object::icons`].
284    pub icons: Vec<Reference<Image>>,
285    /// See [`Object::images`].
286    pub images: Vec<Reference<Image>>,
287    /// See [`Object::reply_targets`].
288    pub reply_targets: Vec<LinkOrObject>,
289    /// See [`Object::locations`].
290    pub locations: Vec<LinkOrObject>,
291    /// See [`Object::previews`].
292    pub previews: Vec<LinkOrObject>,
293    /// See [`Object::published`].
294    pub published: Option<String>,
295    /// See [`Object::replies`].
296    pub replies: Option<AnyCollection>,
297    /// See [`Object::shares`].
298    pub shares: Option<AnyCollection>,
299    /// See [`Object::likes`].
300    pub likes: Option<AnyCollection>,
301    /// See [`Object::emoji_reactions`].
302    pub emoji_reactions: Option<AnyCollection>,
303    /// See [`Object::start_time`].
304    pub start_time: Option<String>,
305    /// See [`Object::summary`].
306    pub summary: Text,
307    /// See [`Object::tags`].
308    pub tags: Vec<LinkOrObject>,
309    /// See [`Object::updated`].
310    pub updated: Option<String>,
311    /// See [`Object::urls`].
312    pub urls: Vec<LinkOrIri>,
313    /// See [`Object::tos`].
314    pub tos: Vec<AnyObject>,
315    /// See [`Object::btos`].
316    pub btos: Vec<AnyObject>,
317    /// See [`Object::ccs`].
318    pub ccs: Vec<AnyObject>,
319    /// See [`Object::bccs`].
320    pub bccs: Vec<AnyObject>,
321    /// See [`Object::media_type`].
322    pub media_type: Option<String>,
323    /// See [`Object::duration`].
324    pub duration: Option<String>,
325    /// See [`Object::sensitive`].
326    pub sensitive: Option<bool>,
327    /// See [`Object::source`].
328    pub source: Option<Box<Source>>,
329    /// See [`Object::proofs`].
330    pub proofs: Vec<Reference<DataIntegrityProof>>,
331    /// See [`Object::interaction_policy`].
332    pub interaction_policy: Option<Box<InteractionPolicy>>,
333    /// See [`Object::approved_by`].
334    pub approved_by: Option<Iri>,
335    /// See [`Object::like_authorization`].
336    pub like_authorization: Option<Reference<LikeAuthorization>>,
337    /// See [`Object::reply_authorization`].
338    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
339    /// See [`Object::announce_authorization`].
340    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
341    /// See [`Object::translations`].
342    pub translations: Vec<Translation>,
343    /// Describes one or more entities that either performed or are expected to
344    /// perform the activity.  Any single activity can have multiple actors.
345    /// The actor MAY be specified using an indirect {@link Link}.
346    pub actors: Vec<AnyActor>,
347    /// When used within an {@link Activity}, describes the direct object of
348    /// the activity.  For instance, in the activity "John added a movie to his
349    /// wishlist", the object of the activity is the movie added.
350    pub objects: Vec<AnyObject>,
351    /// Describes the indirect object, or target, of the activity.  The precise
352    /// meaning of the target is largely dependent on the type of action being
353    /// described but will often be the object of the English preposition "to".
354    /// For instance, in the activity "John added a movie to his wishlist",
355    /// the target of the activity is John's wishlist.  An activity can have more
356    /// than one target.
357    pub targets: Vec<AnyObject>,
358    /// Describes the result of the activity.  For instance, if a particular action
359    /// results in the creation of a new resource, the result property can be used
360    /// to describe that new resource.
361    pub results: Vec<AnyObject>,
362    /// Describes an indirect object of the activity from which the activity is
363    /// directed.  The precise meaning of the origin is the object of the English
364    /// preposition "from". For instance, in the activity "John moved an item to
365    /// List B from List A", the origin of the activity is "List A".
366    pub origins: Vec<AnyObject>,
367    /// Identifies one or more objects used (or to be used) in the completion of
368    /// an {@link Activity}.
369    pub instruments: Vec<AnyObject>,
370}
371
372impl Activity {
373    /// The type's IRI.
374    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Activity";
375    /// The type's `type` in a normalised document.
376    pub const TYPE: &'static str = "Activity";
377}
378
379impl json::Typed for Activity {
380    const TYPE: &'static str = "Activity";
381}
382
383impl FromJson for Activity {
384    fn from_json(value: &Value) -> Result<Self, JsonError> {
385        let object = json::object(value)?;
386        json::expect_type(object, Self::TYPE)?;
387        Ok(Self {
388            id: json::id(object),
389            attachments: json::many(object, &["attachment"]),
390            attributions: json::many(object, &["attributedTo"]),
391            audiences: json::many(object, &["audience"]),
392            content: json::text(object, "content"),
393            contexts: json::many(object, &["context"]),
394            name: json::text(object, "name"),
395            end_time: json::one(object, &["endTime"]),
396            generators: json::many(object, &["generator"]),
397            icons: json::many_mapped(object, &["icon"], json::link_to_image),
398            images: json::many_mapped(object, &["image"], json::link_to_image),
399            reply_targets: json::many(object, &["inReplyTo"]),
400            locations: json::many(object, &["location"]),
401            previews: json::many(object, &["preview"]),
402            published: json::one(object, &["published"]),
403            replies: json::one(object, &["replies"]),
404            shares: json::one(object, &["shares"]),
405            likes: json::one(object, &["likes"]),
406            emoji_reactions: json::one(object, &["emojiReactions"]),
407            start_time: json::one(object, &["startTime"]),
408            summary: json::text(object, "summary"),
409            tags: json::many(object, &["tag"]),
410            updated: json::one(object, &["updated"]),
411            urls: json::many(object, &["url"]),
412            tos: json::many(object, &["to"]),
413            btos: json::many(object, &["bto"]),
414            ccs: json::many(object, &["cc"]),
415            bccs: json::many(object, &["bcc"]),
416            media_type: json::one(object, &["mediaType"]),
417            duration: json::one(object, &["duration"]),
418            sensitive: json::one(object, &["sensitive"]),
419            source: json::one(object, &["source"]),
420            proofs: json::many(object, &["proof"]),
421            interaction_policy: json::one(object, &["interactionPolicy"]),
422            approved_by: json::one(object, &["approvedBy"]),
423            like_authorization: json::one(object, &["likeAuthorization"]),
424            reply_authorization: json::one(object, &["replyAuthorization"]),
425            announce_authorization: json::one(object, &["announceAuthorization"]),
426            translations: json::many(object, &["translations"]),
427            actors: json::many(object, &["actor"]),
428            objects: json::many(object, &["object"]),
429            targets: json::many(object, &["target"]),
430            results: json::many(object, &["result"]),
431            origins: json::many(object, &["origin"]),
432            instruments: json::many(object, &["instrument"]),
433        })
434    }
435}
436
437impl ToJson for Activity {
438    fn to_json(&self) -> Value {
439        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
440        json::put_many(&mut object, &["attachment"], &self.attachments);
441        json::put_many(&mut object, &["attributedTo"], &self.attributions);
442        json::put_many(&mut object, &["audience"], &self.audiences);
443        json::put_text(&mut object, "content", &self.content);
444        json::put_many(&mut object, &["context"], &self.contexts);
445        json::put_text(&mut object, "name", &self.name);
446        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
447        json::put_many(&mut object, &["generator"], &self.generators);
448        json::put_many(&mut object, &["icon"], &self.icons);
449        json::put_many(&mut object, &["image"], &self.images);
450        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
451        json::put_many(&mut object, &["location"], &self.locations);
452        json::put_many(&mut object, &["preview"], &self.previews);
453        json::put_one(&mut object, &["published"], self.published.as_ref());
454        json::put_one(&mut object, &["replies"], self.replies.as_ref());
455        json::put_one(&mut object, &["shares"], self.shares.as_ref());
456        json::put_one(&mut object, &["likes"], self.likes.as_ref());
457        json::put_one(
458            &mut object,
459            &["emojiReactions"],
460            self.emoji_reactions.as_ref(),
461        );
462        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
463        json::put_text(&mut object, "summary", &self.summary);
464        json::put_many(&mut object, &["tag"], &self.tags);
465        json::put_one(&mut object, &["updated"], self.updated.as_ref());
466        json::put_many(&mut object, &["url"], &self.urls);
467        json::put_many(&mut object, &["to"], &self.tos);
468        json::put_many(&mut object, &["bto"], &self.btos);
469        json::put_many(&mut object, &["cc"], &self.ccs);
470        json::put_many(&mut object, &["bcc"], &self.bccs);
471        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
472        json::put_one(&mut object, &["duration"], self.duration.as_ref());
473        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
474        json::put_one(&mut object, &["source"], self.source.as_ref());
475        json::put_many(&mut object, &["proof"], &self.proofs);
476        json::put_one(
477            &mut object,
478            &["interactionPolicy"],
479            self.interaction_policy.as_ref(),
480        );
481        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
482        json::put_one(
483            &mut object,
484            &["likeAuthorization"],
485            self.like_authorization.as_ref(),
486        );
487        json::put_one(
488            &mut object,
489            &["replyAuthorization"],
490            self.reply_authorization.as_ref(),
491        );
492        json::put_one(
493            &mut object,
494            &["announceAuthorization"],
495            self.announce_authorization.as_ref(),
496        );
497        json::put_many(&mut object, &["translations"], &self.translations);
498        json::put_many(&mut object, &["actor"], &self.actors);
499        json::put_many(&mut object, &["object"], &self.objects);
500        json::put_many(&mut object, &["target"], &self.targets);
501        json::put_many(&mut object, &["result"], &self.results);
502        json::put_many(&mut object, &["origin"], &self.origins);
503        json::put_many(&mut object, &["instrument"], &self.instruments);
504        Value::Object(object)
505    }
506}
507
508/// Indicates that the `actor` has added the `object` to the `target`.
509/// If the `target` property is not explicitly specified, the target would need
510/// to be determined implicitly by context.  The `origin` can be used to identify
511/// the context from which the `object` originated.
512///
513/// The type `https://www.w3.org/ns/activitystreams#Add`.
514#[derive(Clone, Debug, Default, PartialEq)]
515pub struct Add {
516    /// The IRI that identifies this object.
517    pub id: Option<Iri>,
518    /// See [`Object::attachments`].
519    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
520    /// See [`Object::attributions`].
521    pub attributions: Vec<AnyActor>,
522    /// See [`Object::audiences`].
523    pub audiences: Vec<AnyObject>,
524    /// See [`Object::content`].
525    pub content: Text,
526    /// See [`Object::contexts`].
527    pub contexts: Vec<LinkOrObject>,
528    /// See [`Object::name`].
529    pub name: Text,
530    /// See [`Object::end_time`].
531    pub end_time: Option<String>,
532    /// See [`Object::generators`].
533    pub generators: Vec<LinkOrObject>,
534    /// See [`Object::icons`].
535    pub icons: Vec<Reference<Image>>,
536    /// See [`Object::images`].
537    pub images: Vec<Reference<Image>>,
538    /// See [`Object::reply_targets`].
539    pub reply_targets: Vec<LinkOrObject>,
540    /// See [`Object::locations`].
541    pub locations: Vec<LinkOrObject>,
542    /// See [`Object::previews`].
543    pub previews: Vec<LinkOrObject>,
544    /// See [`Object::published`].
545    pub published: Option<String>,
546    /// See [`Object::replies`].
547    pub replies: Option<AnyCollection>,
548    /// See [`Object::shares`].
549    pub shares: Option<AnyCollection>,
550    /// See [`Object::likes`].
551    pub likes: Option<AnyCollection>,
552    /// See [`Object::emoji_reactions`].
553    pub emoji_reactions: Option<AnyCollection>,
554    /// See [`Object::start_time`].
555    pub start_time: Option<String>,
556    /// See [`Object::summary`].
557    pub summary: Text,
558    /// See [`Object::tags`].
559    pub tags: Vec<LinkOrObject>,
560    /// See [`Object::updated`].
561    pub updated: Option<String>,
562    /// See [`Object::urls`].
563    pub urls: Vec<LinkOrIri>,
564    /// See [`Object::tos`].
565    pub tos: Vec<AnyObject>,
566    /// See [`Object::btos`].
567    pub btos: Vec<AnyObject>,
568    /// See [`Object::ccs`].
569    pub ccs: Vec<AnyObject>,
570    /// See [`Object::bccs`].
571    pub bccs: Vec<AnyObject>,
572    /// See [`Object::media_type`].
573    pub media_type: Option<String>,
574    /// See [`Object::duration`].
575    pub duration: Option<String>,
576    /// See [`Object::sensitive`].
577    pub sensitive: Option<bool>,
578    /// See [`Object::source`].
579    pub source: Option<Box<Source>>,
580    /// See [`Object::proofs`].
581    pub proofs: Vec<Reference<DataIntegrityProof>>,
582    /// See [`Object::interaction_policy`].
583    pub interaction_policy: Option<Box<InteractionPolicy>>,
584    /// See [`Object::approved_by`].
585    pub approved_by: Option<Iri>,
586    /// See [`Object::like_authorization`].
587    pub like_authorization: Option<Reference<LikeAuthorization>>,
588    /// See [`Object::reply_authorization`].
589    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
590    /// See [`Object::announce_authorization`].
591    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
592    /// See [`Object::translations`].
593    pub translations: Vec<Translation>,
594    /// See [`Activity::actors`].
595    pub actors: Vec<AnyActor>,
596    /// See [`Activity::objects`].
597    pub objects: Vec<AnyObject>,
598    /// See [`Activity::targets`].
599    pub targets: Vec<AnyObject>,
600    /// See [`Activity::results`].
601    pub results: Vec<AnyObject>,
602    /// See [`Activity::origins`].
603    pub origins: Vec<AnyObject>,
604    /// See [`Activity::instruments`].
605    pub instruments: Vec<AnyObject>,
606}
607
608impl Add {
609    /// The type's IRI.
610    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Add";
611    /// The type's `type` in a normalised document.
612    pub const TYPE: &'static str = "Add";
613}
614
615impl json::Typed for Add {
616    const TYPE: &'static str = "Add";
617}
618
619impl FromJson for Add {
620    fn from_json(value: &Value) -> Result<Self, JsonError> {
621        let object = json::object(value)?;
622        json::expect_type(object, Self::TYPE)?;
623        Ok(Self {
624            id: json::id(object),
625            attachments: json::many(object, &["attachment"]),
626            attributions: json::many(object, &["attributedTo"]),
627            audiences: json::many(object, &["audience"]),
628            content: json::text(object, "content"),
629            contexts: json::many(object, &["context"]),
630            name: json::text(object, "name"),
631            end_time: json::one(object, &["endTime"]),
632            generators: json::many(object, &["generator"]),
633            icons: json::many_mapped(object, &["icon"], json::link_to_image),
634            images: json::many_mapped(object, &["image"], json::link_to_image),
635            reply_targets: json::many(object, &["inReplyTo"]),
636            locations: json::many(object, &["location"]),
637            previews: json::many(object, &["preview"]),
638            published: json::one(object, &["published"]),
639            replies: json::one(object, &["replies"]),
640            shares: json::one(object, &["shares"]),
641            likes: json::one(object, &["likes"]),
642            emoji_reactions: json::one(object, &["emojiReactions"]),
643            start_time: json::one(object, &["startTime"]),
644            summary: json::text(object, "summary"),
645            tags: json::many(object, &["tag"]),
646            updated: json::one(object, &["updated"]),
647            urls: json::many(object, &["url"]),
648            tos: json::many(object, &["to"]),
649            btos: json::many(object, &["bto"]),
650            ccs: json::many(object, &["cc"]),
651            bccs: json::many(object, &["bcc"]),
652            media_type: json::one(object, &["mediaType"]),
653            duration: json::one(object, &["duration"]),
654            sensitive: json::one(object, &["sensitive"]),
655            source: json::one(object, &["source"]),
656            proofs: json::many(object, &["proof"]),
657            interaction_policy: json::one(object, &["interactionPolicy"]),
658            approved_by: json::one(object, &["approvedBy"]),
659            like_authorization: json::one(object, &["likeAuthorization"]),
660            reply_authorization: json::one(object, &["replyAuthorization"]),
661            announce_authorization: json::one(object, &["announceAuthorization"]),
662            translations: json::many(object, &["translations"]),
663            actors: json::many(object, &["actor"]),
664            objects: json::many(object, &["object"]),
665            targets: json::many(object, &["target"]),
666            results: json::many(object, &["result"]),
667            origins: json::many(object, &["origin"]),
668            instruments: json::many(object, &["instrument"]),
669        })
670    }
671}
672
673impl ToJson for Add {
674    fn to_json(&self) -> Value {
675        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
676        json::put_many(&mut object, &["attachment"], &self.attachments);
677        json::put_many(&mut object, &["attributedTo"], &self.attributions);
678        json::put_many(&mut object, &["audience"], &self.audiences);
679        json::put_text(&mut object, "content", &self.content);
680        json::put_many(&mut object, &["context"], &self.contexts);
681        json::put_text(&mut object, "name", &self.name);
682        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
683        json::put_many(&mut object, &["generator"], &self.generators);
684        json::put_many(&mut object, &["icon"], &self.icons);
685        json::put_many(&mut object, &["image"], &self.images);
686        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
687        json::put_many(&mut object, &["location"], &self.locations);
688        json::put_many(&mut object, &["preview"], &self.previews);
689        json::put_one(&mut object, &["published"], self.published.as_ref());
690        json::put_one(&mut object, &["replies"], self.replies.as_ref());
691        json::put_one(&mut object, &["shares"], self.shares.as_ref());
692        json::put_one(&mut object, &["likes"], self.likes.as_ref());
693        json::put_one(
694            &mut object,
695            &["emojiReactions"],
696            self.emoji_reactions.as_ref(),
697        );
698        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
699        json::put_text(&mut object, "summary", &self.summary);
700        json::put_many(&mut object, &["tag"], &self.tags);
701        json::put_one(&mut object, &["updated"], self.updated.as_ref());
702        json::put_many(&mut object, &["url"], &self.urls);
703        json::put_many(&mut object, &["to"], &self.tos);
704        json::put_many(&mut object, &["bto"], &self.btos);
705        json::put_many(&mut object, &["cc"], &self.ccs);
706        json::put_many(&mut object, &["bcc"], &self.bccs);
707        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
708        json::put_one(&mut object, &["duration"], self.duration.as_ref());
709        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
710        json::put_one(&mut object, &["source"], self.source.as_ref());
711        json::put_many(&mut object, &["proof"], &self.proofs);
712        json::put_one(
713            &mut object,
714            &["interactionPolicy"],
715            self.interaction_policy.as_ref(),
716        );
717        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
718        json::put_one(
719            &mut object,
720            &["likeAuthorization"],
721            self.like_authorization.as_ref(),
722        );
723        json::put_one(
724            &mut object,
725            &["replyAuthorization"],
726            self.reply_authorization.as_ref(),
727        );
728        json::put_one(
729            &mut object,
730            &["announceAuthorization"],
731            self.announce_authorization.as_ref(),
732        );
733        json::put_many(&mut object, &["translations"], &self.translations);
734        json::put_many(&mut object, &["actor"], &self.actors);
735        json::put_many(&mut object, &["object"], &self.objects);
736        json::put_many(&mut object, &["target"], &self.targets);
737        json::put_many(&mut object, &["result"], &self.results);
738        json::put_many(&mut object, &["origin"], &self.origins);
739        json::put_many(&mut object, &["instrument"], &self.instruments);
740        Value::Object(object)
741    }
742}
743
744/// The agreement reached between parties responding to a {@link Proposal}.
745///
746/// The type `https://w3id.org/valueflows/ont/vf#Agreement`.
747#[derive(Clone, Debug, Default, PartialEq)]
748pub struct Agreement {
749    /// The IRI that identifies this object.
750    pub id: Option<Iri>,
751    /// See [`Object::attachments`].
752    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
753    /// See [`Object::attributions`].
754    pub attributions: Vec<AnyActor>,
755    /// See [`Object::audiences`].
756    pub audiences: Vec<AnyObject>,
757    /// See [`Object::content`].
758    pub content: Text,
759    /// See [`Object::contexts`].
760    pub contexts: Vec<LinkOrObject>,
761    /// See [`Object::name`].
762    pub name: Text,
763    /// See [`Object::end_time`].
764    pub end_time: Option<String>,
765    /// See [`Object::generators`].
766    pub generators: Vec<LinkOrObject>,
767    /// See [`Object::icons`].
768    pub icons: Vec<Reference<Image>>,
769    /// See [`Object::images`].
770    pub images: Vec<Reference<Image>>,
771    /// See [`Object::reply_targets`].
772    pub reply_targets: Vec<LinkOrObject>,
773    /// See [`Object::locations`].
774    pub locations: Vec<LinkOrObject>,
775    /// See [`Object::previews`].
776    pub previews: Vec<LinkOrObject>,
777    /// See [`Object::published`].
778    pub published: Option<String>,
779    /// See [`Object::replies`].
780    pub replies: Option<AnyCollection>,
781    /// See [`Object::shares`].
782    pub shares: Option<AnyCollection>,
783    /// See [`Object::likes`].
784    pub likes: Option<AnyCollection>,
785    /// See [`Object::emoji_reactions`].
786    pub emoji_reactions: Option<AnyCollection>,
787    /// See [`Object::start_time`].
788    pub start_time: Option<String>,
789    /// See [`Object::summary`].
790    pub summary: Text,
791    /// See [`Object::tags`].
792    pub tags: Vec<LinkOrObject>,
793    /// See [`Object::updated`].
794    pub updated: Option<String>,
795    /// See [`Object::urls`].
796    pub urls: Vec<LinkOrIri>,
797    /// See [`Object::tos`].
798    pub tos: Vec<AnyObject>,
799    /// See [`Object::btos`].
800    pub btos: Vec<AnyObject>,
801    /// See [`Object::ccs`].
802    pub ccs: Vec<AnyObject>,
803    /// See [`Object::bccs`].
804    pub bccs: Vec<AnyObject>,
805    /// See [`Object::media_type`].
806    pub media_type: Option<String>,
807    /// See [`Object::duration`].
808    pub duration: Option<String>,
809    /// See [`Object::sensitive`].
810    pub sensitive: Option<bool>,
811    /// See [`Object::source`].
812    pub source: Option<Box<Source>>,
813    /// See [`Object::proofs`].
814    pub proofs: Vec<Reference<DataIntegrityProof>>,
815    /// See [`Object::interaction_policy`].
816    pub interaction_policy: Option<Box<InteractionPolicy>>,
817    /// See [`Object::approved_by`].
818    pub approved_by: Option<Iri>,
819    /// See [`Object::like_authorization`].
820    pub like_authorization: Option<Reference<LikeAuthorization>>,
821    /// See [`Object::reply_authorization`].
822    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
823    /// See [`Object::announce_authorization`].
824    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
825    /// See [`Object::translations`].
826    pub translations: Vec<Translation>,
827    /// The primary {@link Commitment} associated with the agreement.  This
828    /// commitment satisfies the primary {@link Intent} of the corresponding
829    /// {@link Proposal}.
830    pub stipulates: Option<Box<Commitment>>,
831    /// The reciprocal {@link Commitment} associated with the agreement.
832    /// Required if the corresponding {@link Proposal} has a reciprocal
833    /// {@link Intent}.
834    pub stipulates_reciprocal: Option<Box<Commitment>>,
835}
836
837impl Agreement {
838    /// The type's IRI.
839    pub const TYPE_IRI: &'static str = "https://w3id.org/valueflows/ont/vf#Agreement";
840    /// The type's `type` in a normalised document.
841    pub const TYPE: &'static str = "Agreement";
842}
843
844impl json::Typed for Agreement {
845    const TYPE: &'static str = "Agreement";
846}
847
848impl FromJson for Agreement {
849    fn from_json(value: &Value) -> Result<Self, JsonError> {
850        let object = json::object(value)?;
851        json::expect_type(object, Self::TYPE)?;
852        Ok(Self {
853            id: json::id(object),
854            attachments: json::many(object, &["attachment"]),
855            attributions: json::many(object, &["attributedTo"]),
856            audiences: json::many(object, &["audience"]),
857            content: json::text(object, "content"),
858            contexts: json::many(object, &["context"]),
859            name: json::text(object, "name"),
860            end_time: json::one(object, &["endTime"]),
861            generators: json::many(object, &["generator"]),
862            icons: json::many_mapped(object, &["icon"], json::link_to_image),
863            images: json::many_mapped(object, &["image"], json::link_to_image),
864            reply_targets: json::many(object, &["inReplyTo"]),
865            locations: json::many(object, &["location"]),
866            previews: json::many(object, &["preview"]),
867            published: json::one(object, &["published"]),
868            replies: json::one(object, &["replies"]),
869            shares: json::one(object, &["shares"]),
870            likes: json::one(object, &["likes"]),
871            emoji_reactions: json::one(object, &["emojiReactions"]),
872            start_time: json::one(object, &["startTime"]),
873            summary: json::text(object, "summary"),
874            tags: json::many(object, &["tag"]),
875            updated: json::one(object, &["updated"]),
876            urls: json::many(object, &["url"]),
877            tos: json::many(object, &["to"]),
878            btos: json::many(object, &["bto"]),
879            ccs: json::many(object, &["cc"]),
880            bccs: json::many(object, &["bcc"]),
881            media_type: json::one(object, &["mediaType"]),
882            duration: json::one(object, &["duration"]),
883            sensitive: json::one(object, &["sensitive"]),
884            source: json::one(object, &["source"]),
885            proofs: json::many(object, &["proof"]),
886            interaction_policy: json::one(object, &["interactionPolicy"]),
887            approved_by: json::one(object, &["approvedBy"]),
888            like_authorization: json::one(object, &["likeAuthorization"]),
889            reply_authorization: json::one(object, &["replyAuthorization"]),
890            announce_authorization: json::one(object, &["announceAuthorization"]),
891            translations: json::many(object, &["translations"]),
892            stipulates: json::one(object, &["stipulates"]),
893            stipulates_reciprocal: json::one(object, &["stipulatesReciprocal"]),
894        })
895    }
896}
897
898impl ToJson for Agreement {
899    fn to_json(&self) -> Value {
900        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
901        json::put_many(&mut object, &["attachment"], &self.attachments);
902        json::put_many(&mut object, &["attributedTo"], &self.attributions);
903        json::put_many(&mut object, &["audience"], &self.audiences);
904        json::put_text(&mut object, "content", &self.content);
905        json::put_many(&mut object, &["context"], &self.contexts);
906        json::put_text(&mut object, "name", &self.name);
907        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
908        json::put_many(&mut object, &["generator"], &self.generators);
909        json::put_many(&mut object, &["icon"], &self.icons);
910        json::put_many(&mut object, &["image"], &self.images);
911        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
912        json::put_many(&mut object, &["location"], &self.locations);
913        json::put_many(&mut object, &["preview"], &self.previews);
914        json::put_one(&mut object, &["published"], self.published.as_ref());
915        json::put_one(&mut object, &["replies"], self.replies.as_ref());
916        json::put_one(&mut object, &["shares"], self.shares.as_ref());
917        json::put_one(&mut object, &["likes"], self.likes.as_ref());
918        json::put_one(
919            &mut object,
920            &["emojiReactions"],
921            self.emoji_reactions.as_ref(),
922        );
923        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
924        json::put_text(&mut object, "summary", &self.summary);
925        json::put_many(&mut object, &["tag"], &self.tags);
926        json::put_one(&mut object, &["updated"], self.updated.as_ref());
927        json::put_many(&mut object, &["url"], &self.urls);
928        json::put_many(&mut object, &["to"], &self.tos);
929        json::put_many(&mut object, &["bto"], &self.btos);
930        json::put_many(&mut object, &["cc"], &self.ccs);
931        json::put_many(&mut object, &["bcc"], &self.bccs);
932        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
933        json::put_one(&mut object, &["duration"], self.duration.as_ref());
934        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
935        json::put_one(&mut object, &["source"], self.source.as_ref());
936        json::put_many(&mut object, &["proof"], &self.proofs);
937        json::put_one(
938            &mut object,
939            &["interactionPolicy"],
940            self.interaction_policy.as_ref(),
941        );
942        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
943        json::put_one(
944            &mut object,
945            &["likeAuthorization"],
946            self.like_authorization.as_ref(),
947        );
948        json::put_one(
949            &mut object,
950            &["replyAuthorization"],
951            self.reply_authorization.as_ref(),
952        );
953        json::put_one(
954            &mut object,
955            &["announceAuthorization"],
956            self.announce_authorization.as_ref(),
957        );
958        json::put_many(&mut object, &["translations"], &self.translations);
959        json::put_one(&mut object, &["stipulates"], self.stipulates.as_ref());
960        json::put_one(
961            &mut object,
962            &["stipulatesReciprocal"],
963            self.stipulates_reciprocal.as_ref(),
964        );
965        Value::Object(object)
966    }
967}
968
969/// Indicates that the `actor` is calling the `target`'s attention the `object`.
970///
971/// The type `https://www.w3.org/ns/activitystreams#Announce`.
972#[derive(Clone, Debug, Default, PartialEq)]
973pub struct Announce {
974    /// The IRI that identifies this object.
975    pub id: Option<Iri>,
976    /// See [`Object::attachments`].
977    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
978    /// See [`Object::attributions`].
979    pub attributions: Vec<AnyActor>,
980    /// See [`Object::audiences`].
981    pub audiences: Vec<AnyObject>,
982    /// See [`Object::content`].
983    pub content: Text,
984    /// See [`Object::contexts`].
985    pub contexts: Vec<LinkOrObject>,
986    /// See [`Object::name`].
987    pub name: Text,
988    /// See [`Object::end_time`].
989    pub end_time: Option<String>,
990    /// See [`Object::generators`].
991    pub generators: Vec<LinkOrObject>,
992    /// See [`Object::icons`].
993    pub icons: Vec<Reference<Image>>,
994    /// See [`Object::images`].
995    pub images: Vec<Reference<Image>>,
996    /// See [`Object::reply_targets`].
997    pub reply_targets: Vec<LinkOrObject>,
998    /// See [`Object::locations`].
999    pub locations: Vec<LinkOrObject>,
1000    /// See [`Object::previews`].
1001    pub previews: Vec<LinkOrObject>,
1002    /// See [`Object::published`].
1003    pub published: Option<String>,
1004    /// See [`Object::replies`].
1005    pub replies: Option<AnyCollection>,
1006    /// See [`Object::shares`].
1007    pub shares: Option<AnyCollection>,
1008    /// See [`Object::likes`].
1009    pub likes: Option<AnyCollection>,
1010    /// See [`Object::emoji_reactions`].
1011    pub emoji_reactions: Option<AnyCollection>,
1012    /// See [`Object::start_time`].
1013    pub start_time: Option<String>,
1014    /// See [`Object::summary`].
1015    pub summary: Text,
1016    /// See [`Object::tags`].
1017    pub tags: Vec<LinkOrObject>,
1018    /// See [`Object::updated`].
1019    pub updated: Option<String>,
1020    /// See [`Object::urls`].
1021    pub urls: Vec<LinkOrIri>,
1022    /// See [`Object::tos`].
1023    pub tos: Vec<AnyObject>,
1024    /// See [`Object::btos`].
1025    pub btos: Vec<AnyObject>,
1026    /// See [`Object::ccs`].
1027    pub ccs: Vec<AnyObject>,
1028    /// See [`Object::bccs`].
1029    pub bccs: Vec<AnyObject>,
1030    /// See [`Object::media_type`].
1031    pub media_type: Option<String>,
1032    /// See [`Object::duration`].
1033    pub duration: Option<String>,
1034    /// See [`Object::sensitive`].
1035    pub sensitive: Option<bool>,
1036    /// See [`Object::source`].
1037    pub source: Option<Box<Source>>,
1038    /// See [`Object::proofs`].
1039    pub proofs: Vec<Reference<DataIntegrityProof>>,
1040    /// See [`Object::interaction_policy`].
1041    pub interaction_policy: Option<Box<InteractionPolicy>>,
1042    /// See [`Object::approved_by`].
1043    pub approved_by: Option<Iri>,
1044    /// See [`Object::like_authorization`].
1045    pub like_authorization: Option<Reference<LikeAuthorization>>,
1046    /// See [`Object::reply_authorization`].
1047    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
1048    /// See [`Object::announce_authorization`].
1049    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
1050    /// See [`Object::translations`].
1051    pub translations: Vec<Translation>,
1052    /// See [`Activity::actors`].
1053    pub actors: Vec<AnyActor>,
1054    /// See [`Activity::objects`].
1055    pub objects: Vec<AnyObject>,
1056    /// See [`Activity::targets`].
1057    pub targets: Vec<AnyObject>,
1058    /// See [`Activity::results`].
1059    pub results: Vec<AnyObject>,
1060    /// See [`Activity::origins`].
1061    pub origins: Vec<AnyObject>,
1062    /// See [`Activity::instruments`].
1063    pub instruments: Vec<AnyObject>,
1064}
1065
1066impl Announce {
1067    /// The type's IRI.
1068    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Announce";
1069    /// The type's `type` in a normalised document.
1070    pub const TYPE: &'static str = "Announce";
1071}
1072
1073impl json::Typed for Announce {
1074    const TYPE: &'static str = "Announce";
1075}
1076
1077impl FromJson for Announce {
1078    fn from_json(value: &Value) -> Result<Self, JsonError> {
1079        let object = json::object(value)?;
1080        json::expect_type(object, Self::TYPE)?;
1081        Ok(Self {
1082            id: json::id(object),
1083            attachments: json::many(object, &["attachment"]),
1084            attributions: json::many(object, &["attributedTo"]),
1085            audiences: json::many(object, &["audience"]),
1086            content: json::text(object, "content"),
1087            contexts: json::many(object, &["context"]),
1088            name: json::text(object, "name"),
1089            end_time: json::one(object, &["endTime"]),
1090            generators: json::many(object, &["generator"]),
1091            icons: json::many_mapped(object, &["icon"], json::link_to_image),
1092            images: json::many_mapped(object, &["image"], json::link_to_image),
1093            reply_targets: json::many(object, &["inReplyTo"]),
1094            locations: json::many(object, &["location"]),
1095            previews: json::many(object, &["preview"]),
1096            published: json::one(object, &["published"]),
1097            replies: json::one(object, &["replies"]),
1098            shares: json::one(object, &["shares"]),
1099            likes: json::one(object, &["likes"]),
1100            emoji_reactions: json::one(object, &["emojiReactions"]),
1101            start_time: json::one(object, &["startTime"]),
1102            summary: json::text(object, "summary"),
1103            tags: json::many(object, &["tag"]),
1104            updated: json::one(object, &["updated"]),
1105            urls: json::many(object, &["url"]),
1106            tos: json::many(object, &["to"]),
1107            btos: json::many(object, &["bto"]),
1108            ccs: json::many(object, &["cc"]),
1109            bccs: json::many(object, &["bcc"]),
1110            media_type: json::one(object, &["mediaType"]),
1111            duration: json::one(object, &["duration"]),
1112            sensitive: json::one(object, &["sensitive"]),
1113            source: json::one(object, &["source"]),
1114            proofs: json::many(object, &["proof"]),
1115            interaction_policy: json::one(object, &["interactionPolicy"]),
1116            approved_by: json::one(object, &["approvedBy"]),
1117            like_authorization: json::one(object, &["likeAuthorization"]),
1118            reply_authorization: json::one(object, &["replyAuthorization"]),
1119            announce_authorization: json::one(object, &["announceAuthorization"]),
1120            translations: json::many(object, &["translations"]),
1121            actors: json::many(object, &["actor"]),
1122            objects: json::many(object, &["object"]),
1123            targets: json::many(object, &["target"]),
1124            results: json::many(object, &["result"]),
1125            origins: json::many(object, &["origin"]),
1126            instruments: json::many(object, &["instrument"]),
1127        })
1128    }
1129}
1130
1131impl ToJson for Announce {
1132    fn to_json(&self) -> Value {
1133        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
1134        json::put_many(&mut object, &["attachment"], &self.attachments);
1135        json::put_many(&mut object, &["attributedTo"], &self.attributions);
1136        json::put_many(&mut object, &["audience"], &self.audiences);
1137        json::put_text(&mut object, "content", &self.content);
1138        json::put_many(&mut object, &["context"], &self.contexts);
1139        json::put_text(&mut object, "name", &self.name);
1140        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
1141        json::put_many(&mut object, &["generator"], &self.generators);
1142        json::put_many(&mut object, &["icon"], &self.icons);
1143        json::put_many(&mut object, &["image"], &self.images);
1144        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
1145        json::put_many(&mut object, &["location"], &self.locations);
1146        json::put_many(&mut object, &["preview"], &self.previews);
1147        json::put_one(&mut object, &["published"], self.published.as_ref());
1148        json::put_one(&mut object, &["replies"], self.replies.as_ref());
1149        json::put_one(&mut object, &["shares"], self.shares.as_ref());
1150        json::put_one(&mut object, &["likes"], self.likes.as_ref());
1151        json::put_one(
1152            &mut object,
1153            &["emojiReactions"],
1154            self.emoji_reactions.as_ref(),
1155        );
1156        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
1157        json::put_text(&mut object, "summary", &self.summary);
1158        json::put_many(&mut object, &["tag"], &self.tags);
1159        json::put_one(&mut object, &["updated"], self.updated.as_ref());
1160        json::put_many(&mut object, &["url"], &self.urls);
1161        json::put_many(&mut object, &["to"], &self.tos);
1162        json::put_many(&mut object, &["bto"], &self.btos);
1163        json::put_many(&mut object, &["cc"], &self.ccs);
1164        json::put_many(&mut object, &["bcc"], &self.bccs);
1165        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
1166        json::put_one(&mut object, &["duration"], self.duration.as_ref());
1167        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
1168        json::put_one(&mut object, &["source"], self.source.as_ref());
1169        json::put_many(&mut object, &["proof"], &self.proofs);
1170        json::put_one(
1171            &mut object,
1172            &["interactionPolicy"],
1173            self.interaction_policy.as_ref(),
1174        );
1175        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
1176        json::put_one(
1177            &mut object,
1178            &["likeAuthorization"],
1179            self.like_authorization.as_ref(),
1180        );
1181        json::put_one(
1182            &mut object,
1183            &["replyAuthorization"],
1184            self.reply_authorization.as_ref(),
1185        );
1186        json::put_one(
1187            &mut object,
1188            &["announceAuthorization"],
1189            self.announce_authorization.as_ref(),
1190        );
1191        json::put_many(&mut object, &["translations"], &self.translations);
1192        json::put_many(&mut object, &["actor"], &self.actors);
1193        json::put_many(&mut object, &["object"], &self.objects);
1194        json::put_many(&mut object, &["target"], &self.targets);
1195        json::put_many(&mut object, &["result"], &self.results);
1196        json::put_many(&mut object, &["origin"], &self.origins);
1197        json::put_many(&mut object, &["instrument"], &self.instruments);
1198        Value::Object(object)
1199    }
1200}
1201
1202/// Proves that an {@link Announce} interaction has been approved by
1203/// the post author.
1204///
1205/// The type `https://gotosocial.org/ns#AnnounceAuthorization`.
1206#[derive(Clone, Debug, Default, PartialEq)]
1207pub struct AnnounceAuthorization {
1208    /// The IRI that identifies this object.
1209    pub id: Option<Iri>,
1210    /// See [`Object::attachments`].
1211    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
1212    /// See [`Object::attributions`].
1213    pub attributions: Vec<AnyActor>,
1214    /// See [`Object::audiences`].
1215    pub audiences: Vec<AnyObject>,
1216    /// See [`Object::content`].
1217    pub content: Text,
1218    /// See [`Object::contexts`].
1219    pub contexts: Vec<LinkOrObject>,
1220    /// See [`Object::name`].
1221    pub name: Text,
1222    /// See [`Object::end_time`].
1223    pub end_time: Option<String>,
1224    /// See [`Object::generators`].
1225    pub generators: Vec<LinkOrObject>,
1226    /// See [`Object::icons`].
1227    pub icons: Vec<Reference<Image>>,
1228    /// See [`Object::images`].
1229    pub images: Vec<Reference<Image>>,
1230    /// See [`Object::reply_targets`].
1231    pub reply_targets: Vec<LinkOrObject>,
1232    /// See [`Object::locations`].
1233    pub locations: Vec<LinkOrObject>,
1234    /// See [`Object::previews`].
1235    pub previews: Vec<LinkOrObject>,
1236    /// See [`Object::published`].
1237    pub published: Option<String>,
1238    /// See [`Object::replies`].
1239    pub replies: Option<AnyCollection>,
1240    /// See [`Object::shares`].
1241    pub shares: Option<AnyCollection>,
1242    /// See [`Object::likes`].
1243    pub likes: Option<AnyCollection>,
1244    /// See [`Object::emoji_reactions`].
1245    pub emoji_reactions: Option<AnyCollection>,
1246    /// See [`Object::start_time`].
1247    pub start_time: Option<String>,
1248    /// See [`Object::summary`].
1249    pub summary: Text,
1250    /// See [`Object::tags`].
1251    pub tags: Vec<LinkOrObject>,
1252    /// See [`Object::updated`].
1253    pub updated: Option<String>,
1254    /// See [`Object::urls`].
1255    pub urls: Vec<LinkOrIri>,
1256    /// See [`Object::tos`].
1257    pub tos: Vec<AnyObject>,
1258    /// See [`Object::btos`].
1259    pub btos: Vec<AnyObject>,
1260    /// See [`Object::ccs`].
1261    pub ccs: Vec<AnyObject>,
1262    /// See [`Object::bccs`].
1263    pub bccs: Vec<AnyObject>,
1264    /// See [`Object::media_type`].
1265    pub media_type: Option<String>,
1266    /// See [`Object::duration`].
1267    pub duration: Option<String>,
1268    /// See [`Object::sensitive`].
1269    pub sensitive: Option<bool>,
1270    /// See [`Object::source`].
1271    pub source: Option<Box<Source>>,
1272    /// See [`Object::proofs`].
1273    pub proofs: Vec<Reference<DataIntegrityProof>>,
1274    /// See [`Object::interaction_policy`].
1275    pub interaction_policy: Option<Box<InteractionPolicy>>,
1276    /// See [`Object::approved_by`].
1277    pub approved_by: Option<Iri>,
1278    /// See [`Object::like_authorization`].
1279    pub like_authorization: Option<Reference<LikeAuthorization>>,
1280    /// See [`Object::reply_authorization`].
1281    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
1282    /// See [`Object::announce_authorization`].
1283    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
1284    /// See [`Object::translations`].
1285    pub translations: Vec<Translation>,
1286    /// The URI of the interaction (e.g., an {@link Announce} activity) that
1287    /// has been authorized.
1288    pub interacting_object: Option<AnyObject>,
1289    /// The URI of the post that is the target of the authorized announce.
1290    pub interaction_target: Option<AnyObject>,
1291}
1292
1293impl AnnounceAuthorization {
1294    /// The type's IRI.
1295    pub const TYPE_IRI: &'static str = "https://gotosocial.org/ns#AnnounceAuthorization";
1296    /// The type's `type` in a normalised document.
1297    pub const TYPE: &'static str = "AnnounceAuthorization";
1298}
1299
1300impl json::Typed for AnnounceAuthorization {
1301    const TYPE: &'static str = "AnnounceAuthorization";
1302}
1303
1304impl FromJson for AnnounceAuthorization {
1305    fn from_json(value: &Value) -> Result<Self, JsonError> {
1306        let object = json::object(value)?;
1307        json::expect_type(object, Self::TYPE)?;
1308        Ok(Self {
1309            id: json::id(object),
1310            attachments: json::many(object, &["attachment"]),
1311            attributions: json::many(object, &["attributedTo"]),
1312            audiences: json::many(object, &["audience"]),
1313            content: json::text(object, "content"),
1314            contexts: json::many(object, &["context"]),
1315            name: json::text(object, "name"),
1316            end_time: json::one(object, &["endTime"]),
1317            generators: json::many(object, &["generator"]),
1318            icons: json::many_mapped(object, &["icon"], json::link_to_image),
1319            images: json::many_mapped(object, &["image"], json::link_to_image),
1320            reply_targets: json::many(object, &["inReplyTo"]),
1321            locations: json::many(object, &["location"]),
1322            previews: json::many(object, &["preview"]),
1323            published: json::one(object, &["published"]),
1324            replies: json::one(object, &["replies"]),
1325            shares: json::one(object, &["shares"]),
1326            likes: json::one(object, &["likes"]),
1327            emoji_reactions: json::one(object, &["emojiReactions"]),
1328            start_time: json::one(object, &["startTime"]),
1329            summary: json::text(object, "summary"),
1330            tags: json::many(object, &["tag"]),
1331            updated: json::one(object, &["updated"]),
1332            urls: json::many(object, &["url"]),
1333            tos: json::many(object, &["to"]),
1334            btos: json::many(object, &["bto"]),
1335            ccs: json::many(object, &["cc"]),
1336            bccs: json::many(object, &["bcc"]),
1337            media_type: json::one(object, &["mediaType"]),
1338            duration: json::one(object, &["duration"]),
1339            sensitive: json::one(object, &["sensitive"]),
1340            source: json::one(object, &["source"]),
1341            proofs: json::many(object, &["proof"]),
1342            interaction_policy: json::one(object, &["interactionPolicy"]),
1343            approved_by: json::one(object, &["approvedBy"]),
1344            like_authorization: json::one(object, &["likeAuthorization"]),
1345            reply_authorization: json::one(object, &["replyAuthorization"]),
1346            announce_authorization: json::one(object, &["announceAuthorization"]),
1347            translations: json::many(object, &["translations"]),
1348            interacting_object: json::one(object, &["interactingObject"]),
1349            interaction_target: json::one(object, &["interactionTarget"]),
1350        })
1351    }
1352}
1353
1354impl ToJson for AnnounceAuthorization {
1355    fn to_json(&self) -> Value {
1356        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
1357        json::put_many(&mut object, &["attachment"], &self.attachments);
1358        json::put_many(&mut object, &["attributedTo"], &self.attributions);
1359        json::put_many(&mut object, &["audience"], &self.audiences);
1360        json::put_text(&mut object, "content", &self.content);
1361        json::put_many(&mut object, &["context"], &self.contexts);
1362        json::put_text(&mut object, "name", &self.name);
1363        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
1364        json::put_many(&mut object, &["generator"], &self.generators);
1365        json::put_many(&mut object, &["icon"], &self.icons);
1366        json::put_many(&mut object, &["image"], &self.images);
1367        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
1368        json::put_many(&mut object, &["location"], &self.locations);
1369        json::put_many(&mut object, &["preview"], &self.previews);
1370        json::put_one(&mut object, &["published"], self.published.as_ref());
1371        json::put_one(&mut object, &["replies"], self.replies.as_ref());
1372        json::put_one(&mut object, &["shares"], self.shares.as_ref());
1373        json::put_one(&mut object, &["likes"], self.likes.as_ref());
1374        json::put_one(
1375            &mut object,
1376            &["emojiReactions"],
1377            self.emoji_reactions.as_ref(),
1378        );
1379        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
1380        json::put_text(&mut object, "summary", &self.summary);
1381        json::put_many(&mut object, &["tag"], &self.tags);
1382        json::put_one(&mut object, &["updated"], self.updated.as_ref());
1383        json::put_many(&mut object, &["url"], &self.urls);
1384        json::put_many(&mut object, &["to"], &self.tos);
1385        json::put_many(&mut object, &["bto"], &self.btos);
1386        json::put_many(&mut object, &["cc"], &self.ccs);
1387        json::put_many(&mut object, &["bcc"], &self.bccs);
1388        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
1389        json::put_one(&mut object, &["duration"], self.duration.as_ref());
1390        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
1391        json::put_one(&mut object, &["source"], self.source.as_ref());
1392        json::put_many(&mut object, &["proof"], &self.proofs);
1393        json::put_one(
1394            &mut object,
1395            &["interactionPolicy"],
1396            self.interaction_policy.as_ref(),
1397        );
1398        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
1399        json::put_one(
1400            &mut object,
1401            &["likeAuthorization"],
1402            self.like_authorization.as_ref(),
1403        );
1404        json::put_one(
1405            &mut object,
1406            &["replyAuthorization"],
1407            self.reply_authorization.as_ref(),
1408        );
1409        json::put_one(
1410            &mut object,
1411            &["announceAuthorization"],
1412            self.announce_authorization.as_ref(),
1413        );
1414        json::put_many(&mut object, &["translations"], &self.translations);
1415        json::put_one(
1416            &mut object,
1417            &["interactingObject"],
1418            self.interacting_object.as_ref(),
1419        );
1420        json::put_one(
1421            &mut object,
1422            &["interactionTarget"],
1423            self.interaction_target.as_ref(),
1424        );
1425        Value::Object(object)
1426    }
1427}
1428
1429/// A request to announce (boost) a post that requires approval from
1430/// the post author.
1431///
1432/// The type `https://gotosocial.org/ns#AnnounceRequest`.
1433#[derive(Clone, Debug, Default, PartialEq)]
1434pub struct AnnounceRequest {
1435    /// The IRI that identifies this object.
1436    pub id: Option<Iri>,
1437    /// See [`Object::attachments`].
1438    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
1439    /// See [`Object::attributions`].
1440    pub attributions: Vec<AnyActor>,
1441    /// See [`Object::audiences`].
1442    pub audiences: Vec<AnyObject>,
1443    /// See [`Object::content`].
1444    pub content: Text,
1445    /// See [`Object::contexts`].
1446    pub contexts: Vec<LinkOrObject>,
1447    /// See [`Object::name`].
1448    pub name: Text,
1449    /// See [`Object::end_time`].
1450    pub end_time: Option<String>,
1451    /// See [`Object::generators`].
1452    pub generators: Vec<LinkOrObject>,
1453    /// See [`Object::icons`].
1454    pub icons: Vec<Reference<Image>>,
1455    /// See [`Object::images`].
1456    pub images: Vec<Reference<Image>>,
1457    /// See [`Object::reply_targets`].
1458    pub reply_targets: Vec<LinkOrObject>,
1459    /// See [`Object::locations`].
1460    pub locations: Vec<LinkOrObject>,
1461    /// See [`Object::previews`].
1462    pub previews: Vec<LinkOrObject>,
1463    /// See [`Object::published`].
1464    pub published: Option<String>,
1465    /// See [`Object::replies`].
1466    pub replies: Option<AnyCollection>,
1467    /// See [`Object::shares`].
1468    pub shares: Option<AnyCollection>,
1469    /// See [`Object::likes`].
1470    pub likes: Option<AnyCollection>,
1471    /// See [`Object::emoji_reactions`].
1472    pub emoji_reactions: Option<AnyCollection>,
1473    /// See [`Object::start_time`].
1474    pub start_time: Option<String>,
1475    /// See [`Object::summary`].
1476    pub summary: Text,
1477    /// See [`Object::tags`].
1478    pub tags: Vec<LinkOrObject>,
1479    /// See [`Object::updated`].
1480    pub updated: Option<String>,
1481    /// See [`Object::urls`].
1482    pub urls: Vec<LinkOrIri>,
1483    /// See [`Object::tos`].
1484    pub tos: Vec<AnyObject>,
1485    /// See [`Object::btos`].
1486    pub btos: Vec<AnyObject>,
1487    /// See [`Object::ccs`].
1488    pub ccs: Vec<AnyObject>,
1489    /// See [`Object::bccs`].
1490    pub bccs: Vec<AnyObject>,
1491    /// See [`Object::media_type`].
1492    pub media_type: Option<String>,
1493    /// See [`Object::duration`].
1494    pub duration: Option<String>,
1495    /// See [`Object::sensitive`].
1496    pub sensitive: Option<bool>,
1497    /// See [`Object::source`].
1498    pub source: Option<Box<Source>>,
1499    /// See [`Object::proofs`].
1500    pub proofs: Vec<Reference<DataIntegrityProof>>,
1501    /// See [`Object::interaction_policy`].
1502    pub interaction_policy: Option<Box<InteractionPolicy>>,
1503    /// See [`Object::approved_by`].
1504    pub approved_by: Option<Iri>,
1505    /// See [`Object::like_authorization`].
1506    pub like_authorization: Option<Reference<LikeAuthorization>>,
1507    /// See [`Object::reply_authorization`].
1508    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
1509    /// See [`Object::announce_authorization`].
1510    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
1511    /// See [`Object::translations`].
1512    pub translations: Vec<Translation>,
1513    /// See [`Activity::actors`].
1514    pub actors: Vec<AnyActor>,
1515    /// See [`Activity::objects`].
1516    pub objects: Vec<AnyObject>,
1517    /// See [`Activity::targets`].
1518    pub targets: Vec<AnyObject>,
1519    /// See [`Activity::results`].
1520    pub results: Vec<AnyObject>,
1521    /// See [`Activity::origins`].
1522    pub origins: Vec<AnyObject>,
1523    /// See [`Activity::instruments`].
1524    pub instruments: Vec<AnyObject>,
1525}
1526
1527impl AnnounceRequest {
1528    /// The type's IRI.
1529    pub const TYPE_IRI: &'static str = "https://gotosocial.org/ns#AnnounceRequest";
1530    /// The type's `type` in a normalised document.
1531    pub const TYPE: &'static str = "AnnounceRequest";
1532}
1533
1534impl json::Typed for AnnounceRequest {
1535    const TYPE: &'static str = "AnnounceRequest";
1536}
1537
1538impl FromJson for AnnounceRequest {
1539    fn from_json(value: &Value) -> Result<Self, JsonError> {
1540        let object = json::object(value)?;
1541        json::expect_type(object, Self::TYPE)?;
1542        Ok(Self {
1543            id: json::id(object),
1544            attachments: json::many(object, &["attachment"]),
1545            attributions: json::many(object, &["attributedTo"]),
1546            audiences: json::many(object, &["audience"]),
1547            content: json::text(object, "content"),
1548            contexts: json::many(object, &["context"]),
1549            name: json::text(object, "name"),
1550            end_time: json::one(object, &["endTime"]),
1551            generators: json::many(object, &["generator"]),
1552            icons: json::many_mapped(object, &["icon"], json::link_to_image),
1553            images: json::many_mapped(object, &["image"], json::link_to_image),
1554            reply_targets: json::many(object, &["inReplyTo"]),
1555            locations: json::many(object, &["location"]),
1556            previews: json::many(object, &["preview"]),
1557            published: json::one(object, &["published"]),
1558            replies: json::one(object, &["replies"]),
1559            shares: json::one(object, &["shares"]),
1560            likes: json::one(object, &["likes"]),
1561            emoji_reactions: json::one(object, &["emojiReactions"]),
1562            start_time: json::one(object, &["startTime"]),
1563            summary: json::text(object, "summary"),
1564            tags: json::many(object, &["tag"]),
1565            updated: json::one(object, &["updated"]),
1566            urls: json::many(object, &["url"]),
1567            tos: json::many(object, &["to"]),
1568            btos: json::many(object, &["bto"]),
1569            ccs: json::many(object, &["cc"]),
1570            bccs: json::many(object, &["bcc"]),
1571            media_type: json::one(object, &["mediaType"]),
1572            duration: json::one(object, &["duration"]),
1573            sensitive: json::one(object, &["sensitive"]),
1574            source: json::one(object, &["source"]),
1575            proofs: json::many(object, &["proof"]),
1576            interaction_policy: json::one(object, &["interactionPolicy"]),
1577            approved_by: json::one(object, &["approvedBy"]),
1578            like_authorization: json::one(object, &["likeAuthorization"]),
1579            reply_authorization: json::one(object, &["replyAuthorization"]),
1580            announce_authorization: json::one(object, &["announceAuthorization"]),
1581            translations: json::many(object, &["translations"]),
1582            actors: json::many(object, &["actor"]),
1583            objects: json::many(object, &["object"]),
1584            targets: json::many(object, &["target"]),
1585            results: json::many(object, &["result"]),
1586            origins: json::many(object, &["origin"]),
1587            instruments: json::many(object, &["instrument"]),
1588        })
1589    }
1590}
1591
1592impl ToJson for AnnounceRequest {
1593    fn to_json(&self) -> Value {
1594        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
1595        json::put_many(&mut object, &["attachment"], &self.attachments);
1596        json::put_many(&mut object, &["attributedTo"], &self.attributions);
1597        json::put_many(&mut object, &["audience"], &self.audiences);
1598        json::put_text(&mut object, "content", &self.content);
1599        json::put_many(&mut object, &["context"], &self.contexts);
1600        json::put_text(&mut object, "name", &self.name);
1601        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
1602        json::put_many(&mut object, &["generator"], &self.generators);
1603        json::put_many(&mut object, &["icon"], &self.icons);
1604        json::put_many(&mut object, &["image"], &self.images);
1605        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
1606        json::put_many(&mut object, &["location"], &self.locations);
1607        json::put_many(&mut object, &["preview"], &self.previews);
1608        json::put_one(&mut object, &["published"], self.published.as_ref());
1609        json::put_one(&mut object, &["replies"], self.replies.as_ref());
1610        json::put_one(&mut object, &["shares"], self.shares.as_ref());
1611        json::put_one(&mut object, &["likes"], self.likes.as_ref());
1612        json::put_one(
1613            &mut object,
1614            &["emojiReactions"],
1615            self.emoji_reactions.as_ref(),
1616        );
1617        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
1618        json::put_text(&mut object, "summary", &self.summary);
1619        json::put_many(&mut object, &["tag"], &self.tags);
1620        json::put_one(&mut object, &["updated"], self.updated.as_ref());
1621        json::put_many(&mut object, &["url"], &self.urls);
1622        json::put_many(&mut object, &["to"], &self.tos);
1623        json::put_many(&mut object, &["bto"], &self.btos);
1624        json::put_many(&mut object, &["cc"], &self.ccs);
1625        json::put_many(&mut object, &["bcc"], &self.bccs);
1626        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
1627        json::put_one(&mut object, &["duration"], self.duration.as_ref());
1628        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
1629        json::put_one(&mut object, &["source"], self.source.as_ref());
1630        json::put_many(&mut object, &["proof"], &self.proofs);
1631        json::put_one(
1632            &mut object,
1633            &["interactionPolicy"],
1634            self.interaction_policy.as_ref(),
1635        );
1636        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
1637        json::put_one(
1638            &mut object,
1639            &["likeAuthorization"],
1640            self.like_authorization.as_ref(),
1641        );
1642        json::put_one(
1643            &mut object,
1644            &["replyAuthorization"],
1645            self.reply_authorization.as_ref(),
1646        );
1647        json::put_one(
1648            &mut object,
1649            &["announceAuthorization"],
1650            self.announce_authorization.as_ref(),
1651        );
1652        json::put_many(&mut object, &["translations"], &self.translations);
1653        json::put_many(&mut object, &["actor"], &self.actors);
1654        json::put_many(&mut object, &["object"], &self.objects);
1655        json::put_many(&mut object, &["target"], &self.targets);
1656        json::put_many(&mut object, &["result"], &self.results);
1657        json::put_many(&mut object, &["origin"], &self.origins);
1658        json::put_many(&mut object, &["instrument"], &self.instruments);
1659        Value::Object(object)
1660    }
1661}
1662
1663/// Describes a software application.
1664///
1665/// The type `https://www.w3.org/ns/activitystreams#Application`.
1666#[derive(Clone, Debug, Default, PartialEq)]
1667pub struct Application {
1668    /// The IRI that identifies this object.
1669    pub id: Option<Iri>,
1670    /// See [`Object::attachments`].
1671    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
1672    /// See [`Object::attributions`].
1673    pub attributions: Vec<AnyActor>,
1674    /// See [`Object::audiences`].
1675    pub audiences: Vec<AnyObject>,
1676    /// See [`Object::content`].
1677    pub content: Text,
1678    /// See [`Object::contexts`].
1679    pub contexts: Vec<LinkOrObject>,
1680    /// See [`Object::name`].
1681    pub name: Text,
1682    /// See [`Object::end_time`].
1683    pub end_time: Option<String>,
1684    /// See [`Object::generators`].
1685    pub generators: Vec<LinkOrObject>,
1686    /// See [`Object::icons`].
1687    pub icons: Vec<Reference<Image>>,
1688    /// See [`Object::images`].
1689    pub images: Vec<Reference<Image>>,
1690    /// See [`Object::reply_targets`].
1691    pub reply_targets: Vec<LinkOrObject>,
1692    /// See [`Object::locations`].
1693    pub locations: Vec<LinkOrObject>,
1694    /// See [`Object::previews`].
1695    pub previews: Vec<LinkOrObject>,
1696    /// See [`Object::published`].
1697    pub published: Option<String>,
1698    /// See [`Object::replies`].
1699    pub replies: Option<AnyCollection>,
1700    /// See [`Object::shares`].
1701    pub shares: Option<AnyCollection>,
1702    /// See [`Object::likes`].
1703    pub likes: Option<AnyCollection>,
1704    /// See [`Object::emoji_reactions`].
1705    pub emoji_reactions: Option<AnyCollection>,
1706    /// See [`Object::start_time`].
1707    pub start_time: Option<String>,
1708    /// See [`Object::summary`].
1709    pub summary: Text,
1710    /// See [`Object::tags`].
1711    pub tags: Vec<LinkOrObject>,
1712    /// See [`Object::updated`].
1713    pub updated: Option<String>,
1714    /// See [`Object::urls`].
1715    pub urls: Vec<LinkOrIri>,
1716    /// See [`Object::tos`].
1717    pub tos: Vec<AnyObject>,
1718    /// See [`Object::btos`].
1719    pub btos: Vec<AnyObject>,
1720    /// See [`Object::ccs`].
1721    pub ccs: Vec<AnyObject>,
1722    /// See [`Object::bccs`].
1723    pub bccs: Vec<AnyObject>,
1724    /// See [`Object::media_type`].
1725    pub media_type: Option<String>,
1726    /// See [`Object::duration`].
1727    pub duration: Option<String>,
1728    /// See [`Object::sensitive`].
1729    pub sensitive: Option<bool>,
1730    /// See [`Object::source`].
1731    pub source: Option<Box<Source>>,
1732    /// See [`Object::proofs`].
1733    pub proofs: Vec<Reference<DataIntegrityProof>>,
1734    /// See [`Object::interaction_policy`].
1735    pub interaction_policy: Option<Box<InteractionPolicy>>,
1736    /// See [`Object::approved_by`].
1737    pub approved_by: Option<Iri>,
1738    /// See [`Object::like_authorization`].
1739    pub like_authorization: Option<Reference<LikeAuthorization>>,
1740    /// See [`Object::reply_authorization`].
1741    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
1742    /// See [`Object::announce_authorization`].
1743    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
1744    /// See [`Object::translations`].
1745    pub translations: Vec<Translation>,
1746    /// A short username which may be used to refer to the actor,
1747    /// with no uniqueness guarantees.
1748    pub preferred_username: Text,
1749    /// A public part of the key pair owned by this actor.
1750    pub public_keys: Vec<Reference<CryptographicKey>>,
1751    /// Represents this actor's public keys.  It serves as equivalent to
1752    /// the `publicKeys` property, but is used for [FEP-521a](https://w3id.org/fep/521a) compliance.
1753    pub assertion_methods: Vec<Reference<Multikey>>,
1754    /// Gateways where the latest version of this portable actor object can be
1755    /// retrieved.
1756    pub gateways: Vec<Iri>,
1757    /// When `true`, conveys that for this actor, follow requests are not usually
1758    /// automatically approved, but instead are examined by a person who may accept
1759    /// or reject the request, at some time in the future.  Setting of `false`
1760    /// conveys no information and may be ignored.  This information is typically
1761    /// used to affect display of accounts, such as showing an account as private or
1762    /// locked.
1763    pub manually_approves_followers: Option<bool>,
1764    /// The inbox stream contains all activities received by the actor.  The server
1765    /// SHOULD filter content according to the requester's permission.  In general,
1766    /// the owner of an inbox is likely to be able to access all of their inbox
1767    /// contents.  Depending on access control, some other content may be public,
1768    /// whereas other content may require authentication for non-owner users,
1769    /// if they can access the inbox at all.
1770    pub inbox: Option<OrderedCollectionOrOrderedCollectionPage>,
1771    /// The outbox stream contains activities the user has published,
1772    /// subject to the ability of the requestor to retrieve the activity
1773    /// (that is, the contents of the outbox are filtered by the permissions of
1774    /// the person reading it).  If a user submits a request without
1775    /// [Authorization](https://www.w3.org/TR/activitypub/#authorization)
1776    /// the server should respond with all of the
1777    /// [Public](https://www.w3.org/TR/activitypub/#public-addressing) posts.
1778    /// This could potentially be all relevant objects published by the user,
1779    /// though the number of available items is left to the discretion of those
1780    /// implementing and deploying the server.
1781    pub outbox: Option<OrderedCollectionOrOrderedCollectionPage>,
1782    /// This is a list of everybody that the actor has followed, added as a
1783    /// [side effect](https://www.w3.org/TR/activitypub/#follow-activity-outbox).
1784    /// The `following` collection MUST be either an {@link OrderedCollection}
1785    /// or a {@link Collection} and MAY be filtered on privileges of
1786    /// an authenticated user or as appropriate when no authentication is given.
1787    pub following: Option<AnyCollection>,
1788    /// This is a list of everyone who has sent a {@link Follow} activity
1789    /// for the actor, added as a
1790    /// [side effect](https://www.w3.org/TR/activitypub/#follow-activity-outbox).
1791    /// This is where one would find a list of all the actors that are following
1792    /// the actor.  The `followers` collection MUST be either
1793    /// an {@link OrderedCollection} or a {@link Collection} and MAY be filtered on
1794    /// privileges of an authenticated user or as appropriate when no authentication
1795    /// is given.
1796    pub followers: Option<AnyCollection>,
1797    /// This is a list of every object from all of the actor's {@link Like}
1798    /// activities, added as a
1799    /// [side effect](https://www.w3.org/TR/activitypub/#like-activity-outbox).
1800    /// The `liked` collection MUST be either an {@link OrderedCollection} or
1801    /// a {@link Collection} and MAY be filtered on privileges of an authenticated
1802    /// user or as appropriate when no authentication is given.
1803    pub liked: Option<AnyCollection>,
1804    /// What is known in Mastodon as "pinned statuses", or statuses that are always
1805    /// featured at the top of people's profiles, is implemented using an extra
1806    /// property `featured` on the actor object that points to a {@link Collection}
1807    /// of objects.
1808    pub featured: Option<AnyCollection>,
1809    /// What is known in Mastodon as "featured hashtags", hashtags that are featured
1810    /// at people's profiles, is implemented using an extra property `featuredTags`
1811    /// on the actor object that points to a {@link Collection} of {@link Hashtag}
1812    /// objects specifically.
1813    pub featured_tags: Option<AnyCollection>,
1814    /// A collection of {@link FeaturedCollection}s created by this actor.
1815    pub featured_collections: Option<AnyCollection>,
1816    /// A list of supplementary Collections which may be of interest.
1817    pub streams: Vec<AnyCollection>,
1818    /// A JSON object which maps additional (typically server/domain-wide) endpoints
1819    /// which may be useful either for this actor or someone referencing this actor.
1820    /// This mapping may be nested inside the actor document as the value or may be
1821    /// a link to a JSON-LD document with these properties.
1822    pub endpoints: Option<Box<Endpoints>>,
1823    /// Allows users to opt-in or opt-out of discoverability features like
1824    /// the profile directory.  This flag may also be used as an indicator of
1825    /// the user's preferences toward being included in external discovery services,
1826    /// such as search engines or other indexing tools.
1827    pub discoverable: Option<bool>,
1828    /// Reports whether a user was locally suspended, for better handling of
1829    /// these accounts.
1830    pub suspended: Option<bool>,
1831    /// Whether the actor is in-memorial state.
1832    pub memorial: Option<bool>,
1833    /// Whether the actor allows to be indexed.
1834    pub indexable: Option<bool>,
1835    /// Signifies that an actor has been moved to a different ID. Used in Mastodon-style data portability with the {@link Move} activity; see [ActivityPub Data Portability/Move Action](https://swicg.github.io/activitypub-data-portability/#move-action) for more details.
1836    pub successor: Option<AnyActor>,
1837    /// The `aliases` (`alsoKnownAs`) property is used to specify alternative names
1838    /// or aliases for an entity.  It can be used to provide additional identifiers
1839    /// or labels for an entity, which can be useful in scenarios where an entity
1840    /// may have multiple names or aliases.
1841    pub aliases: Vec<AnyActor>,
1842    /// Means of communicating or interacting with the DID subject or associated
1843    /// entities via one or more service endpoints. Examples include discovery
1844    /// services, agent services, social networking services, file storage services,
1845    /// and verifiable credential repository services.
1846    pub services: Vec<AnyDidService>,
1847    /// This value is used for `Actor` type objects to show message on followed.
1848    pub followed_message: Option<String>,
1849    /// Used on actors to indicate that they in some way identify as a cat,
1850    /// expressed as a boolean value. If this property is set to `true`,
1851    /// displaying the actor or their notes will have some special effects
1852    /// attached in some clients.
1853    pub cat: Option<bool>,
1854    /// The actor's WebFinger handle, `user@host` (FEP-2c59).
1855    pub webfinger: Option<String>,
1856    /// The shared inbox, where Misskey writes it: on the actor rather than in
1857    /// its `endpoints`. Prefer `endpoints.sharedInbox` when both are there.
1858    pub shared_inbox: Option<Iri>,
1859}
1860
1861impl Application {
1862    /// The type's IRI.
1863    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Application";
1864    /// The type's `type` in a normalised document.
1865    pub const TYPE: &'static str = "Application";
1866}
1867
1868impl json::Typed for Application {
1869    const TYPE: &'static str = "Application";
1870}
1871
1872impl FromJson for Application {
1873    fn from_json(value: &Value) -> Result<Self, JsonError> {
1874        let object = json::object(value)?;
1875        json::expect_type(object, Self::TYPE)?;
1876        Ok(Self {
1877            id: json::id(object),
1878            attachments: json::many(object, &["attachment"]),
1879            attributions: json::many(object, &["attributedTo"]),
1880            audiences: json::many(object, &["audience"]),
1881            content: json::text(object, "content"),
1882            contexts: json::many(object, &["context"]),
1883            name: json::text(object, "name"),
1884            end_time: json::one(object, &["endTime"]),
1885            generators: json::many(object, &["generator"]),
1886            icons: json::many_mapped(object, &["icon"], json::link_to_image),
1887            images: json::many_mapped(object, &["image"], json::link_to_image),
1888            reply_targets: json::many(object, &["inReplyTo"]),
1889            locations: json::many(object, &["location"]),
1890            previews: json::many(object, &["preview"]),
1891            published: json::one(object, &["published"]),
1892            replies: json::one(object, &["replies"]),
1893            shares: json::one(object, &["shares"]),
1894            likes: json::one(object, &["likes"]),
1895            emoji_reactions: json::one(object, &["emojiReactions"]),
1896            start_time: json::one(object, &["startTime"]),
1897            summary: json::text(object, "summary"),
1898            tags: json::many(object, &["tag"]),
1899            updated: json::one(object, &["updated"]),
1900            urls: json::many(object, &["url"]),
1901            tos: json::many(object, &["to"]),
1902            btos: json::many(object, &["bto"]),
1903            ccs: json::many(object, &["cc"]),
1904            bccs: json::many(object, &["bcc"]),
1905            media_type: json::one(object, &["mediaType"]),
1906            duration: json::one(object, &["duration"]),
1907            sensitive: json::one(object, &["sensitive"]),
1908            source: json::one(object, &["source"]),
1909            proofs: json::many(object, &["proof"]),
1910            interaction_policy: json::one(object, &["interactionPolicy"]),
1911            approved_by: json::one(object, &["approvedBy"]),
1912            like_authorization: json::one(object, &["likeAuthorization"]),
1913            reply_authorization: json::one(object, &["replyAuthorization"]),
1914            announce_authorization: json::one(object, &["announceAuthorization"]),
1915            translations: json::many(object, &["translations"]),
1916            preferred_username: json::text(object, "preferredUsername"),
1917            public_keys: json::many_with(object, &["publicKey"], |value| {
1918                json::reference_with(value, CryptographicKey::from_json_untyped)
1919            }),
1920            assertion_methods: json::many(object, &["assertionMethod"]),
1921            gateways: json::many(object, &["gateways"]),
1922            manually_approves_followers: json::one(object, &["manuallyApprovesFollowers"]),
1923            inbox: json::one(object, &["inbox"]),
1924            outbox: json::one(object, &["outbox"]),
1925            following: json::one(object, &["following"]),
1926            followers: json::one(object, &["followers"]),
1927            liked: json::one(object, &["liked"]),
1928            featured: json::one(object, &["featured"]),
1929            featured_tags: json::one(object, &["featuredTags"]),
1930            featured_collections: json::one(
1931                object,
1932                &["https://w3id.org/fep/7aa9#featuredCollections"],
1933            ),
1934            streams: json::many(object, &["streams"]),
1935            endpoints: json::one(object, &["endpoints"]),
1936            discoverable: json::one(object, &["discoverable"]),
1937            suspended: json::one(object, &["suspended"]),
1938            memorial: json::one(object, &["memorial"]),
1939            indexable: json::one(object, &["indexable"]),
1940            successor: json::one(object, &["movedTo"]),
1941            aliases: json::many(object, &["alsoKnownAs"]),
1942            services: json::many(object, &["service"]),
1943            followed_message: json::one(object, &["_misskey_followedMessage"]),
1944            cat: json::one(object, &["isCat"]),
1945            webfinger: json::one(object, &["webfinger"]),
1946            shared_inbox: json::one(object, &["sharedInbox"]),
1947        })
1948    }
1949}
1950
1951impl ToJson for Application {
1952    fn to_json(&self) -> Value {
1953        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
1954        json::put_many(&mut object, &["attachment"], &self.attachments);
1955        json::put_many(&mut object, &["attributedTo"], &self.attributions);
1956        json::put_many(&mut object, &["audience"], &self.audiences);
1957        json::put_text(&mut object, "content", &self.content);
1958        json::put_many(&mut object, &["context"], &self.contexts);
1959        json::put_text(&mut object, "name", &self.name);
1960        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
1961        json::put_many(&mut object, &["generator"], &self.generators);
1962        json::put_many(&mut object, &["icon"], &self.icons);
1963        json::put_many(&mut object, &["image"], &self.images);
1964        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
1965        json::put_many(&mut object, &["location"], &self.locations);
1966        json::put_many(&mut object, &["preview"], &self.previews);
1967        json::put_one(&mut object, &["published"], self.published.as_ref());
1968        json::put_one(&mut object, &["replies"], self.replies.as_ref());
1969        json::put_one(&mut object, &["shares"], self.shares.as_ref());
1970        json::put_one(&mut object, &["likes"], self.likes.as_ref());
1971        json::put_one(
1972            &mut object,
1973            &["emojiReactions"],
1974            self.emoji_reactions.as_ref(),
1975        );
1976        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
1977        json::put_text(&mut object, "summary", &self.summary);
1978        json::put_many(&mut object, &["tag"], &self.tags);
1979        json::put_one(&mut object, &["updated"], self.updated.as_ref());
1980        json::put_many(&mut object, &["url"], &self.urls);
1981        json::put_many(&mut object, &["to"], &self.tos);
1982        json::put_many(&mut object, &["bto"], &self.btos);
1983        json::put_many(&mut object, &["cc"], &self.ccs);
1984        json::put_many(&mut object, &["bcc"], &self.bccs);
1985        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
1986        json::put_one(&mut object, &["duration"], self.duration.as_ref());
1987        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
1988        json::put_one(&mut object, &["source"], self.source.as_ref());
1989        json::put_many(&mut object, &["proof"], &self.proofs);
1990        json::put_one(
1991            &mut object,
1992            &["interactionPolicy"],
1993            self.interaction_policy.as_ref(),
1994        );
1995        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
1996        json::put_one(
1997            &mut object,
1998            &["likeAuthorization"],
1999            self.like_authorization.as_ref(),
2000        );
2001        json::put_one(
2002            &mut object,
2003            &["replyAuthorization"],
2004            self.reply_authorization.as_ref(),
2005        );
2006        json::put_one(
2007            &mut object,
2008            &["announceAuthorization"],
2009            self.announce_authorization.as_ref(),
2010        );
2011        json::put_many(&mut object, &["translations"], &self.translations);
2012        json::put_text(&mut object, "preferredUsername", &self.preferred_username);
2013        json::put_many_with(
2014            &mut object,
2015            &["publicKey"],
2016            &self.public_keys,
2017            |reference| json::write_reference(reference, CryptographicKey::to_json_untyped),
2018        );
2019        json::put_many(&mut object, &["assertionMethod"], &self.assertion_methods);
2020        json::put_many(&mut object, &["gateways"], &self.gateways);
2021        json::put_one(
2022            &mut object,
2023            &["manuallyApprovesFollowers"],
2024            self.manually_approves_followers.as_ref(),
2025        );
2026        json::put_one(&mut object, &["inbox"], self.inbox.as_ref());
2027        json::put_one(&mut object, &["outbox"], self.outbox.as_ref());
2028        json::put_one(&mut object, &["following"], self.following.as_ref());
2029        json::put_one(&mut object, &["followers"], self.followers.as_ref());
2030        json::put_one(&mut object, &["liked"], self.liked.as_ref());
2031        json::put_one(&mut object, &["featured"], self.featured.as_ref());
2032        json::put_one(&mut object, &["featuredTags"], self.featured_tags.as_ref());
2033        json::put_one(
2034            &mut object,
2035            &["https://w3id.org/fep/7aa9#featuredCollections"],
2036            self.featured_collections.as_ref(),
2037        );
2038        json::put_many(&mut object, &["streams"], &self.streams);
2039        json::put_one(&mut object, &["endpoints"], self.endpoints.as_ref());
2040        json::put_one(&mut object, &["discoverable"], self.discoverable.as_ref());
2041        json::put_one(&mut object, &["suspended"], self.suspended.as_ref());
2042        json::put_one(&mut object, &["memorial"], self.memorial.as_ref());
2043        json::put_one(&mut object, &["indexable"], self.indexable.as_ref());
2044        json::put_one(&mut object, &["movedTo"], self.successor.as_ref());
2045        json::put_many(&mut object, &["alsoKnownAs"], &self.aliases);
2046        json::put_many(&mut object, &["service"], &self.services);
2047        json::put_one(
2048            &mut object,
2049            &["_misskey_followedMessage"],
2050            self.followed_message.as_ref(),
2051        );
2052        json::put_one(&mut object, &["isCat"], self.cat.as_ref());
2053        json::put_one(&mut object, &["webfinger"], self.webfinger.as_ref());
2054        json::put_one(&mut object, &["sharedInbox"], self.shared_inbox.as_ref());
2055        Value::Object(object)
2056    }
2057}
2058
2059/// An `IntransitiveActivity` that indicates that the `actor` has arrived at the `location`.
2060/// The `origin` can be used to identify the context from which the `actor` originated.
2061/// The `target` typically has no defined meaning.
2062///
2063/// The type `https://www.w3.org/ns/activitystreams#Arrive`.
2064#[derive(Clone, Debug, Default, PartialEq)]
2065pub struct Arrive {
2066    /// The IRI that identifies this object.
2067    pub id: Option<Iri>,
2068    /// See [`Object::attachments`].
2069    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
2070    /// See [`Object::attributions`].
2071    pub attributions: Vec<AnyActor>,
2072    /// See [`Object::audiences`].
2073    pub audiences: Vec<AnyObject>,
2074    /// See [`Object::content`].
2075    pub content: Text,
2076    /// See [`Object::contexts`].
2077    pub contexts: Vec<LinkOrObject>,
2078    /// See [`Object::name`].
2079    pub name: Text,
2080    /// See [`Object::end_time`].
2081    pub end_time: Option<String>,
2082    /// See [`Object::generators`].
2083    pub generators: Vec<LinkOrObject>,
2084    /// See [`Object::icons`].
2085    pub icons: Vec<Reference<Image>>,
2086    /// See [`Object::images`].
2087    pub images: Vec<Reference<Image>>,
2088    /// See [`Object::reply_targets`].
2089    pub reply_targets: Vec<LinkOrObject>,
2090    /// See [`Object::locations`].
2091    pub locations: Vec<LinkOrObject>,
2092    /// See [`Object::previews`].
2093    pub previews: Vec<LinkOrObject>,
2094    /// See [`Object::published`].
2095    pub published: Option<String>,
2096    /// See [`Object::replies`].
2097    pub replies: Option<AnyCollection>,
2098    /// See [`Object::shares`].
2099    pub shares: Option<AnyCollection>,
2100    /// See [`Object::likes`].
2101    pub likes: Option<AnyCollection>,
2102    /// See [`Object::emoji_reactions`].
2103    pub emoji_reactions: Option<AnyCollection>,
2104    /// See [`Object::start_time`].
2105    pub start_time: Option<String>,
2106    /// See [`Object::summary`].
2107    pub summary: Text,
2108    /// See [`Object::tags`].
2109    pub tags: Vec<LinkOrObject>,
2110    /// See [`Object::updated`].
2111    pub updated: Option<String>,
2112    /// See [`Object::urls`].
2113    pub urls: Vec<LinkOrIri>,
2114    /// See [`Object::tos`].
2115    pub tos: Vec<AnyObject>,
2116    /// See [`Object::btos`].
2117    pub btos: Vec<AnyObject>,
2118    /// See [`Object::ccs`].
2119    pub ccs: Vec<AnyObject>,
2120    /// See [`Object::bccs`].
2121    pub bccs: Vec<AnyObject>,
2122    /// See [`Object::media_type`].
2123    pub media_type: Option<String>,
2124    /// See [`Object::duration`].
2125    pub duration: Option<String>,
2126    /// See [`Object::sensitive`].
2127    pub sensitive: Option<bool>,
2128    /// See [`Object::source`].
2129    pub source: Option<Box<Source>>,
2130    /// See [`Object::proofs`].
2131    pub proofs: Vec<Reference<DataIntegrityProof>>,
2132    /// See [`Object::interaction_policy`].
2133    pub interaction_policy: Option<Box<InteractionPolicy>>,
2134    /// See [`Object::approved_by`].
2135    pub approved_by: Option<Iri>,
2136    /// See [`Object::like_authorization`].
2137    pub like_authorization: Option<Reference<LikeAuthorization>>,
2138    /// See [`Object::reply_authorization`].
2139    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
2140    /// See [`Object::announce_authorization`].
2141    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
2142    /// See [`Object::translations`].
2143    pub translations: Vec<Translation>,
2144    /// See [`Activity::actors`].
2145    pub actors: Vec<AnyActor>,
2146    /// See [`Activity::objects`].
2147    pub objects: Vec<AnyObject>,
2148    /// See [`Activity::targets`].
2149    pub targets: Vec<AnyObject>,
2150    /// See [`Activity::results`].
2151    pub results: Vec<AnyObject>,
2152    /// See [`Activity::origins`].
2153    pub origins: Vec<AnyObject>,
2154    /// See [`Activity::instruments`].
2155    pub instruments: Vec<AnyObject>,
2156}
2157
2158impl Arrive {
2159    /// The type's IRI.
2160    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Arrive";
2161    /// The type's `type` in a normalised document.
2162    pub const TYPE: &'static str = "Arrive";
2163}
2164
2165impl json::Typed for Arrive {
2166    const TYPE: &'static str = "Arrive";
2167}
2168
2169impl FromJson for Arrive {
2170    fn from_json(value: &Value) -> Result<Self, JsonError> {
2171        let object = json::object(value)?;
2172        json::expect_type(object, Self::TYPE)?;
2173        Ok(Self {
2174            id: json::id(object),
2175            attachments: json::many(object, &["attachment"]),
2176            attributions: json::many(object, &["attributedTo"]),
2177            audiences: json::many(object, &["audience"]),
2178            content: json::text(object, "content"),
2179            contexts: json::many(object, &["context"]),
2180            name: json::text(object, "name"),
2181            end_time: json::one(object, &["endTime"]),
2182            generators: json::many(object, &["generator"]),
2183            icons: json::many_mapped(object, &["icon"], json::link_to_image),
2184            images: json::many_mapped(object, &["image"], json::link_to_image),
2185            reply_targets: json::many(object, &["inReplyTo"]),
2186            locations: json::many(object, &["location"]),
2187            previews: json::many(object, &["preview"]),
2188            published: json::one(object, &["published"]),
2189            replies: json::one(object, &["replies"]),
2190            shares: json::one(object, &["shares"]),
2191            likes: json::one(object, &["likes"]),
2192            emoji_reactions: json::one(object, &["emojiReactions"]),
2193            start_time: json::one(object, &["startTime"]),
2194            summary: json::text(object, "summary"),
2195            tags: json::many(object, &["tag"]),
2196            updated: json::one(object, &["updated"]),
2197            urls: json::many(object, &["url"]),
2198            tos: json::many(object, &["to"]),
2199            btos: json::many(object, &["bto"]),
2200            ccs: json::many(object, &["cc"]),
2201            bccs: json::many(object, &["bcc"]),
2202            media_type: json::one(object, &["mediaType"]),
2203            duration: json::one(object, &["duration"]),
2204            sensitive: json::one(object, &["sensitive"]),
2205            source: json::one(object, &["source"]),
2206            proofs: json::many(object, &["proof"]),
2207            interaction_policy: json::one(object, &["interactionPolicy"]),
2208            approved_by: json::one(object, &["approvedBy"]),
2209            like_authorization: json::one(object, &["likeAuthorization"]),
2210            reply_authorization: json::one(object, &["replyAuthorization"]),
2211            announce_authorization: json::one(object, &["announceAuthorization"]),
2212            translations: json::many(object, &["translations"]),
2213            actors: json::many(object, &["actor"]),
2214            objects: json::many(object, &["object"]),
2215            targets: json::many(object, &["target"]),
2216            results: json::many(object, &["result"]),
2217            origins: json::many(object, &["origin"]),
2218            instruments: json::many(object, &["instrument"]),
2219        })
2220    }
2221}
2222
2223impl ToJson for Arrive {
2224    fn to_json(&self) -> Value {
2225        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
2226        json::put_many(&mut object, &["attachment"], &self.attachments);
2227        json::put_many(&mut object, &["attributedTo"], &self.attributions);
2228        json::put_many(&mut object, &["audience"], &self.audiences);
2229        json::put_text(&mut object, "content", &self.content);
2230        json::put_many(&mut object, &["context"], &self.contexts);
2231        json::put_text(&mut object, "name", &self.name);
2232        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
2233        json::put_many(&mut object, &["generator"], &self.generators);
2234        json::put_many(&mut object, &["icon"], &self.icons);
2235        json::put_many(&mut object, &["image"], &self.images);
2236        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
2237        json::put_many(&mut object, &["location"], &self.locations);
2238        json::put_many(&mut object, &["preview"], &self.previews);
2239        json::put_one(&mut object, &["published"], self.published.as_ref());
2240        json::put_one(&mut object, &["replies"], self.replies.as_ref());
2241        json::put_one(&mut object, &["shares"], self.shares.as_ref());
2242        json::put_one(&mut object, &["likes"], self.likes.as_ref());
2243        json::put_one(
2244            &mut object,
2245            &["emojiReactions"],
2246            self.emoji_reactions.as_ref(),
2247        );
2248        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
2249        json::put_text(&mut object, "summary", &self.summary);
2250        json::put_many(&mut object, &["tag"], &self.tags);
2251        json::put_one(&mut object, &["updated"], self.updated.as_ref());
2252        json::put_many(&mut object, &["url"], &self.urls);
2253        json::put_many(&mut object, &["to"], &self.tos);
2254        json::put_many(&mut object, &["bto"], &self.btos);
2255        json::put_many(&mut object, &["cc"], &self.ccs);
2256        json::put_many(&mut object, &["bcc"], &self.bccs);
2257        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
2258        json::put_one(&mut object, &["duration"], self.duration.as_ref());
2259        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
2260        json::put_one(&mut object, &["source"], self.source.as_ref());
2261        json::put_many(&mut object, &["proof"], &self.proofs);
2262        json::put_one(
2263            &mut object,
2264            &["interactionPolicy"],
2265            self.interaction_policy.as_ref(),
2266        );
2267        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
2268        json::put_one(
2269            &mut object,
2270            &["likeAuthorization"],
2271            self.like_authorization.as_ref(),
2272        );
2273        json::put_one(
2274            &mut object,
2275            &["replyAuthorization"],
2276            self.reply_authorization.as_ref(),
2277        );
2278        json::put_one(
2279            &mut object,
2280            &["announceAuthorization"],
2281            self.announce_authorization.as_ref(),
2282        );
2283        json::put_many(&mut object, &["translations"], &self.translations);
2284        json::put_many(&mut object, &["actor"], &self.actors);
2285        json::put_many(&mut object, &["object"], &self.objects);
2286        json::put_many(&mut object, &["target"], &self.targets);
2287        json::put_many(&mut object, &["result"], &self.results);
2288        json::put_many(&mut object, &["origin"], &self.origins);
2289        json::put_many(&mut object, &["instrument"], &self.instruments);
2290        Value::Object(object)
2291    }
2292}
2293
2294/// Represents any kind of multi-paragraph written work.
2295///
2296/// The type `https://www.w3.org/ns/activitystreams#Article`.
2297#[derive(Clone, Debug, Default, PartialEq)]
2298pub struct Article {
2299    /// The IRI that identifies this object.
2300    pub id: Option<Iri>,
2301    /// See [`Object::attachments`].
2302    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
2303    /// See [`Object::attributions`].
2304    pub attributions: Vec<AnyActor>,
2305    /// See [`Object::audiences`].
2306    pub audiences: Vec<AnyObject>,
2307    /// See [`Object::content`].
2308    pub content: Text,
2309    /// See [`Object::contexts`].
2310    pub contexts: Vec<LinkOrObject>,
2311    /// See [`Object::name`].
2312    pub name: Text,
2313    /// See [`Object::end_time`].
2314    pub end_time: Option<String>,
2315    /// See [`Object::generators`].
2316    pub generators: Vec<LinkOrObject>,
2317    /// See [`Object::icons`].
2318    pub icons: Vec<Reference<Image>>,
2319    /// See [`Object::images`].
2320    pub images: Vec<Reference<Image>>,
2321    /// See [`Object::reply_targets`].
2322    pub reply_targets: Vec<LinkOrObject>,
2323    /// See [`Object::locations`].
2324    pub locations: Vec<LinkOrObject>,
2325    /// See [`Object::previews`].
2326    pub previews: Vec<LinkOrObject>,
2327    /// See [`Object::published`].
2328    pub published: Option<String>,
2329    /// See [`Object::replies`].
2330    pub replies: Option<AnyCollection>,
2331    /// See [`Object::shares`].
2332    pub shares: Option<AnyCollection>,
2333    /// See [`Object::likes`].
2334    pub likes: Option<AnyCollection>,
2335    /// See [`Object::emoji_reactions`].
2336    pub emoji_reactions: Option<AnyCollection>,
2337    /// See [`Object::start_time`].
2338    pub start_time: Option<String>,
2339    /// See [`Object::summary`].
2340    pub summary: Text,
2341    /// See [`Object::tags`].
2342    pub tags: Vec<LinkOrObject>,
2343    /// See [`Object::updated`].
2344    pub updated: Option<String>,
2345    /// See [`Object::urls`].
2346    pub urls: Vec<LinkOrIri>,
2347    /// See [`Object::tos`].
2348    pub tos: Vec<AnyObject>,
2349    /// See [`Object::btos`].
2350    pub btos: Vec<AnyObject>,
2351    /// See [`Object::ccs`].
2352    pub ccs: Vec<AnyObject>,
2353    /// See [`Object::bccs`].
2354    pub bccs: Vec<AnyObject>,
2355    /// See [`Object::media_type`].
2356    pub media_type: Option<String>,
2357    /// See [`Object::duration`].
2358    pub duration: Option<String>,
2359    /// See [`Object::sensitive`].
2360    pub sensitive: Option<bool>,
2361    /// See [`Object::source`].
2362    pub source: Option<Box<Source>>,
2363    /// See [`Object::proofs`].
2364    pub proofs: Vec<Reference<DataIntegrityProof>>,
2365    /// See [`Object::interaction_policy`].
2366    pub interaction_policy: Option<Box<InteractionPolicy>>,
2367    /// See [`Object::approved_by`].
2368    pub approved_by: Option<Iri>,
2369    /// See [`Object::like_authorization`].
2370    pub like_authorization: Option<Reference<LikeAuthorization>>,
2371    /// See [`Object::reply_authorization`].
2372    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
2373    /// See [`Object::announce_authorization`].
2374    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
2375    /// See [`Object::translations`].
2376    pub translations: Vec<Translation>,
2377    /// The quoted ActivityStreams object.
2378    pub quote: Option<AnyObject>,
2379    /// The URI of the ActivityStreams object that this object quotes.
2380    pub quote_url: Option<Iri>,
2381    /// A {@link QuoteAuthorization} object that proves this quote was approved
2382    /// by the quoted object's author.
2383    pub quote_authorization: Option<Reference<QuoteAuthorization>>,
2384    /// Whether replies are accepted: PeerTube's term, which Lemmy sends as
2385    /// the opposite of a post being locked.
2386    pub comments_enabled: Option<bool>,
2387}
2388
2389impl Article {
2390    /// The type's IRI.
2391    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Article";
2392    /// The type's `type` in a normalised document.
2393    pub const TYPE: &'static str = "Article";
2394}
2395
2396impl json::Typed for Article {
2397    const TYPE: &'static str = "Article";
2398}
2399
2400impl FromJson for Article {
2401    fn from_json(value: &Value) -> Result<Self, JsonError> {
2402        let object = json::object(value)?;
2403        json::expect_type(object, Self::TYPE)?;
2404        Ok(Self {
2405            id: json::id(object),
2406            attachments: json::many(object, &["attachment"]),
2407            attributions: json::many(object, &["attributedTo"]),
2408            audiences: json::many(object, &["audience"]),
2409            content: json::text(object, "content"),
2410            contexts: json::many(object, &["context"]),
2411            name: json::text(object, "name"),
2412            end_time: json::one(object, &["endTime"]),
2413            generators: json::many(object, &["generator"]),
2414            icons: json::many_mapped(object, &["icon"], json::link_to_image),
2415            images: json::many_mapped(object, &["image"], json::link_to_image),
2416            reply_targets: json::many(object, &["inReplyTo"]),
2417            locations: json::many(object, &["location"]),
2418            previews: json::many(object, &["preview"]),
2419            published: json::one(object, &["published"]),
2420            replies: json::one(object, &["replies"]),
2421            shares: json::one(object, &["shares"]),
2422            likes: json::one(object, &["likes"]),
2423            emoji_reactions: json::one(object, &["emojiReactions"]),
2424            start_time: json::one(object, &["startTime"]),
2425            summary: json::text(object, "summary"),
2426            tags: json::many(object, &["tag"]),
2427            updated: json::one(object, &["updated"]),
2428            urls: json::many(object, &["url"]),
2429            tos: json::many(object, &["to"]),
2430            btos: json::many(object, &["bto"]),
2431            ccs: json::many(object, &["cc"]),
2432            bccs: json::many(object, &["bcc"]),
2433            media_type: json::one(object, &["mediaType"]),
2434            duration: json::one(object, &["duration"]),
2435            sensitive: json::one(object, &["sensitive"]),
2436            source: json::one(object, &["source"]),
2437            proofs: json::many(object, &["proof"]),
2438            interaction_policy: json::one(object, &["interactionPolicy"]),
2439            approved_by: json::one(object, &["approvedBy"]),
2440            like_authorization: json::one(object, &["likeAuthorization"]),
2441            reply_authorization: json::one(object, &["replyAuthorization"]),
2442            announce_authorization: json::one(object, &["announceAuthorization"]),
2443            translations: json::many(object, &["translations"]),
2444            quote: json::one(object, &["quote"]),
2445            quote_url: json::one(object, &["quoteUrl", "_misskey_quote", "quoteUri"]),
2446            quote_authorization: json::one(object, &["quoteAuthorization"]),
2447            comments_enabled: json::one(object, &["commentsEnabled"]),
2448        })
2449    }
2450}
2451
2452impl ToJson for Article {
2453    fn to_json(&self) -> Value {
2454        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
2455        json::put_many(&mut object, &["attachment"], &self.attachments);
2456        json::put_many(&mut object, &["attributedTo"], &self.attributions);
2457        json::put_many(&mut object, &["audience"], &self.audiences);
2458        json::put_text(&mut object, "content", &self.content);
2459        json::put_many(&mut object, &["context"], &self.contexts);
2460        json::put_text(&mut object, "name", &self.name);
2461        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
2462        json::put_many(&mut object, &["generator"], &self.generators);
2463        json::put_many(&mut object, &["icon"], &self.icons);
2464        json::put_many(&mut object, &["image"], &self.images);
2465        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
2466        json::put_many(&mut object, &["location"], &self.locations);
2467        json::put_many(&mut object, &["preview"], &self.previews);
2468        json::put_one(&mut object, &["published"], self.published.as_ref());
2469        json::put_one(&mut object, &["replies"], self.replies.as_ref());
2470        json::put_one(&mut object, &["shares"], self.shares.as_ref());
2471        json::put_one(&mut object, &["likes"], self.likes.as_ref());
2472        json::put_one(
2473            &mut object,
2474            &["emojiReactions"],
2475            self.emoji_reactions.as_ref(),
2476        );
2477        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
2478        json::put_text(&mut object, "summary", &self.summary);
2479        json::put_many(&mut object, &["tag"], &self.tags);
2480        json::put_one(&mut object, &["updated"], self.updated.as_ref());
2481        json::put_many(&mut object, &["url"], &self.urls);
2482        json::put_many(&mut object, &["to"], &self.tos);
2483        json::put_many(&mut object, &["bto"], &self.btos);
2484        json::put_many(&mut object, &["cc"], &self.ccs);
2485        json::put_many(&mut object, &["bcc"], &self.bccs);
2486        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
2487        json::put_one(&mut object, &["duration"], self.duration.as_ref());
2488        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
2489        json::put_one(&mut object, &["source"], self.source.as_ref());
2490        json::put_many(&mut object, &["proof"], &self.proofs);
2491        json::put_one(
2492            &mut object,
2493            &["interactionPolicy"],
2494            self.interaction_policy.as_ref(),
2495        );
2496        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
2497        json::put_one(
2498            &mut object,
2499            &["likeAuthorization"],
2500            self.like_authorization.as_ref(),
2501        );
2502        json::put_one(
2503            &mut object,
2504            &["replyAuthorization"],
2505            self.reply_authorization.as_ref(),
2506        );
2507        json::put_one(
2508            &mut object,
2509            &["announceAuthorization"],
2510            self.announce_authorization.as_ref(),
2511        );
2512        json::put_many(&mut object, &["translations"], &self.translations);
2513        json::put_one(&mut object, &["quote"], self.quote.as_ref());
2514        json::put_one(
2515            &mut object,
2516            &["quoteUrl", "_misskey_quote", "quoteUri"],
2517            self.quote_url.as_ref(),
2518        );
2519        json::put_one(
2520            &mut object,
2521            &["quoteAuthorization"],
2522            self.quote_authorization.as_ref(),
2523        );
2524        json::put_one(
2525            &mut object,
2526            &["commentsEnabled"],
2527            self.comments_enabled.as_ref(),
2528        );
2529        Value::Object(object)
2530    }
2531}
2532
2533/// Represents an audio document of any kind.
2534///
2535/// The type `https://www.w3.org/ns/activitystreams#Audio`.
2536#[derive(Clone, Debug, Default, PartialEq)]
2537pub struct Audio {
2538    /// The IRI that identifies this object.
2539    pub id: Option<Iri>,
2540    /// See [`Object::attachments`].
2541    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
2542    /// See [`Object::attributions`].
2543    pub attributions: Vec<AnyActor>,
2544    /// See [`Object::audiences`].
2545    pub audiences: Vec<AnyObject>,
2546    /// See [`Object::content`].
2547    pub content: Text,
2548    /// See [`Object::contexts`].
2549    pub contexts: Vec<LinkOrObject>,
2550    /// See [`Object::name`].
2551    pub name: Text,
2552    /// See [`Object::end_time`].
2553    pub end_time: Option<String>,
2554    /// See [`Object::generators`].
2555    pub generators: Vec<LinkOrObject>,
2556    /// See [`Object::icons`].
2557    pub icons: Vec<Reference<Image>>,
2558    /// See [`Object::images`].
2559    pub images: Vec<Reference<Image>>,
2560    /// See [`Object::reply_targets`].
2561    pub reply_targets: Vec<LinkOrObject>,
2562    /// See [`Object::locations`].
2563    pub locations: Vec<LinkOrObject>,
2564    /// See [`Object::previews`].
2565    pub previews: Vec<LinkOrObject>,
2566    /// See [`Object::published`].
2567    pub published: Option<String>,
2568    /// See [`Object::replies`].
2569    pub replies: Option<AnyCollection>,
2570    /// See [`Object::shares`].
2571    pub shares: Option<AnyCollection>,
2572    /// See [`Object::likes`].
2573    pub likes: Option<AnyCollection>,
2574    /// See [`Object::emoji_reactions`].
2575    pub emoji_reactions: Option<AnyCollection>,
2576    /// See [`Object::start_time`].
2577    pub start_time: Option<String>,
2578    /// See [`Object::summary`].
2579    pub summary: Text,
2580    /// See [`Object::tags`].
2581    pub tags: Vec<LinkOrObject>,
2582    /// See [`Object::updated`].
2583    pub updated: Option<String>,
2584    /// See [`Object::urls`].
2585    pub urls: Vec<LinkOrIri>,
2586    /// See [`Object::tos`].
2587    pub tos: Vec<AnyObject>,
2588    /// See [`Object::btos`].
2589    pub btos: Vec<AnyObject>,
2590    /// See [`Object::ccs`].
2591    pub ccs: Vec<AnyObject>,
2592    /// See [`Object::bccs`].
2593    pub bccs: Vec<AnyObject>,
2594    /// See [`Object::media_type`].
2595    pub media_type: Option<String>,
2596    /// See [`Object::duration`].
2597    pub duration: Option<String>,
2598    /// See [`Object::sensitive`].
2599    pub sensitive: Option<bool>,
2600    /// See [`Object::source`].
2601    pub source: Option<Box<Source>>,
2602    /// See [`Object::proofs`].
2603    pub proofs: Vec<Reference<DataIntegrityProof>>,
2604    /// See [`Object::interaction_policy`].
2605    pub interaction_policy: Option<Box<InteractionPolicy>>,
2606    /// See [`Object::approved_by`].
2607    pub approved_by: Option<Iri>,
2608    /// See [`Object::like_authorization`].
2609    pub like_authorization: Option<Reference<LikeAuthorization>>,
2610    /// See [`Object::reply_authorization`].
2611    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
2612    /// See [`Object::announce_authorization`].
2613    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
2614    /// See [`Object::translations`].
2615    pub translations: Vec<Translation>,
2616    /// See [`Document::width`].
2617    pub width: Option<u64>,
2618    /// See [`Document::height`].
2619    pub height: Option<u64>,
2620    /// See [`Document::digest_multibase`].
2621    pub digest_multibase: Option<String>,
2622    /// See [`Document::blurhash`].
2623    pub blurhash: Option<String>,
2624    /// See [`Document::focal_point`].
2625    pub focal_point: Vec<f64>,
2626}
2627
2628impl Audio {
2629    /// The type's IRI.
2630    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Audio";
2631    /// The type's `type` in a normalised document.
2632    pub const TYPE: &'static str = "Audio";
2633}
2634
2635impl json::Typed for Audio {
2636    const TYPE: &'static str = "Audio";
2637}
2638
2639impl FromJson for Audio {
2640    fn from_json(value: &Value) -> Result<Self, JsonError> {
2641        let object = json::object(value)?;
2642        json::expect_type(object, Self::TYPE)?;
2643        Ok(Self {
2644            id: json::id(object),
2645            attachments: json::many(object, &["attachment"]),
2646            attributions: json::many(object, &["attributedTo"]),
2647            audiences: json::many(object, &["audience"]),
2648            content: json::text(object, "content"),
2649            contexts: json::many(object, &["context"]),
2650            name: json::text(object, "name"),
2651            end_time: json::one(object, &["endTime"]),
2652            generators: json::many(object, &["generator"]),
2653            icons: json::many_mapped(object, &["icon"], json::link_to_image),
2654            images: json::many_mapped(object, &["image"], json::link_to_image),
2655            reply_targets: json::many(object, &["inReplyTo"]),
2656            locations: json::many(object, &["location"]),
2657            previews: json::many(object, &["preview"]),
2658            published: json::one(object, &["published"]),
2659            replies: json::one(object, &["replies"]),
2660            shares: json::one(object, &["shares"]),
2661            likes: json::one(object, &["likes"]),
2662            emoji_reactions: json::one(object, &["emojiReactions"]),
2663            start_time: json::one(object, &["startTime"]),
2664            summary: json::text(object, "summary"),
2665            tags: json::many(object, &["tag"]),
2666            updated: json::one(object, &["updated"]),
2667            urls: json::many(object, &["url"]),
2668            tos: json::many(object, &["to"]),
2669            btos: json::many(object, &["bto"]),
2670            ccs: json::many(object, &["cc"]),
2671            bccs: json::many(object, &["bcc"]),
2672            media_type: json::one(object, &["mediaType"]),
2673            duration: json::one(object, &["duration"]),
2674            sensitive: json::one(object, &["sensitive"]),
2675            source: json::one(object, &["source"]),
2676            proofs: json::many(object, &["proof"]),
2677            interaction_policy: json::one(object, &["interactionPolicy"]),
2678            approved_by: json::one(object, &["approvedBy"]),
2679            like_authorization: json::one(object, &["likeAuthorization"]),
2680            reply_authorization: json::one(object, &["replyAuthorization"]),
2681            announce_authorization: json::one(object, &["announceAuthorization"]),
2682            translations: json::many(object, &["translations"]),
2683            width: json::one(object, &["width"]),
2684            height: json::one(object, &["height"]),
2685            digest_multibase: json::one(object, &["digestMultibase"]),
2686            blurhash: json::one(object, &["blurhash"]),
2687            focal_point: json::many(object, &["focalPoint"]),
2688        })
2689    }
2690}
2691
2692impl ToJson for Audio {
2693    fn to_json(&self) -> Value {
2694        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
2695        json::put_many(&mut object, &["attachment"], &self.attachments);
2696        json::put_many(&mut object, &["attributedTo"], &self.attributions);
2697        json::put_many(&mut object, &["audience"], &self.audiences);
2698        json::put_text(&mut object, "content", &self.content);
2699        json::put_many(&mut object, &["context"], &self.contexts);
2700        json::put_text(&mut object, "name", &self.name);
2701        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
2702        json::put_many(&mut object, &["generator"], &self.generators);
2703        json::put_many(&mut object, &["icon"], &self.icons);
2704        json::put_many(&mut object, &["image"], &self.images);
2705        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
2706        json::put_many(&mut object, &["location"], &self.locations);
2707        json::put_many(&mut object, &["preview"], &self.previews);
2708        json::put_one(&mut object, &["published"], self.published.as_ref());
2709        json::put_one(&mut object, &["replies"], self.replies.as_ref());
2710        json::put_one(&mut object, &["shares"], self.shares.as_ref());
2711        json::put_one(&mut object, &["likes"], self.likes.as_ref());
2712        json::put_one(
2713            &mut object,
2714            &["emojiReactions"],
2715            self.emoji_reactions.as_ref(),
2716        );
2717        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
2718        json::put_text(&mut object, "summary", &self.summary);
2719        json::put_many(&mut object, &["tag"], &self.tags);
2720        json::put_one(&mut object, &["updated"], self.updated.as_ref());
2721        json::put_many(&mut object, &["url"], &self.urls);
2722        json::put_many(&mut object, &["to"], &self.tos);
2723        json::put_many(&mut object, &["bto"], &self.btos);
2724        json::put_many(&mut object, &["cc"], &self.ccs);
2725        json::put_many(&mut object, &["bcc"], &self.bccs);
2726        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
2727        json::put_one(&mut object, &["duration"], self.duration.as_ref());
2728        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
2729        json::put_one(&mut object, &["source"], self.source.as_ref());
2730        json::put_many(&mut object, &["proof"], &self.proofs);
2731        json::put_one(
2732            &mut object,
2733            &["interactionPolicy"],
2734            self.interaction_policy.as_ref(),
2735        );
2736        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
2737        json::put_one(
2738            &mut object,
2739            &["likeAuthorization"],
2740            self.like_authorization.as_ref(),
2741        );
2742        json::put_one(
2743            &mut object,
2744            &["replyAuthorization"],
2745            self.reply_authorization.as_ref(),
2746        );
2747        json::put_one(
2748            &mut object,
2749            &["announceAuthorization"],
2750            self.announce_authorization.as_ref(),
2751        );
2752        json::put_many(&mut object, &["translations"], &self.translations);
2753        json::put_one(&mut object, &["width"], self.width.as_ref());
2754        json::put_one(&mut object, &["height"], self.height.as_ref());
2755        json::put_one(
2756            &mut object,
2757            &["digestMultibase"],
2758            self.digest_multibase.as_ref(),
2759        );
2760        json::put_one(&mut object, &["blurhash"], self.blurhash.as_ref());
2761        json::put_many(&mut object, &["focalPoint"], &self.focal_point);
2762        Value::Object(object)
2763    }
2764}
2765
2766/// Indicates that the `actor` is blocking the `object`.  Blocking is a stronger
2767/// form of {@link Ignore}.  The typical use is to support social systems that
2768/// allow one user to block activities or content of other users.  The `target`
2769/// and `origin` typically have no defined meaning.
2770///
2771/// The type `https://www.w3.org/ns/activitystreams#Block`.
2772#[derive(Clone, Debug, Default, PartialEq)]
2773pub struct Block {
2774    /// The IRI that identifies this object.
2775    pub id: Option<Iri>,
2776    /// See [`Object::attachments`].
2777    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
2778    /// See [`Object::attributions`].
2779    pub attributions: Vec<AnyActor>,
2780    /// See [`Object::audiences`].
2781    pub audiences: Vec<AnyObject>,
2782    /// See [`Object::content`].
2783    pub content: Text,
2784    /// See [`Object::contexts`].
2785    pub contexts: Vec<LinkOrObject>,
2786    /// See [`Object::name`].
2787    pub name: Text,
2788    /// See [`Object::end_time`].
2789    pub end_time: Option<String>,
2790    /// See [`Object::generators`].
2791    pub generators: Vec<LinkOrObject>,
2792    /// See [`Object::icons`].
2793    pub icons: Vec<Reference<Image>>,
2794    /// See [`Object::images`].
2795    pub images: Vec<Reference<Image>>,
2796    /// See [`Object::reply_targets`].
2797    pub reply_targets: Vec<LinkOrObject>,
2798    /// See [`Object::locations`].
2799    pub locations: Vec<LinkOrObject>,
2800    /// See [`Object::previews`].
2801    pub previews: Vec<LinkOrObject>,
2802    /// See [`Object::published`].
2803    pub published: Option<String>,
2804    /// See [`Object::replies`].
2805    pub replies: Option<AnyCollection>,
2806    /// See [`Object::shares`].
2807    pub shares: Option<AnyCollection>,
2808    /// See [`Object::likes`].
2809    pub likes: Option<AnyCollection>,
2810    /// See [`Object::emoji_reactions`].
2811    pub emoji_reactions: Option<AnyCollection>,
2812    /// See [`Object::start_time`].
2813    pub start_time: Option<String>,
2814    /// See [`Object::summary`].
2815    pub summary: Text,
2816    /// See [`Object::tags`].
2817    pub tags: Vec<LinkOrObject>,
2818    /// See [`Object::updated`].
2819    pub updated: Option<String>,
2820    /// See [`Object::urls`].
2821    pub urls: Vec<LinkOrIri>,
2822    /// See [`Object::tos`].
2823    pub tos: Vec<AnyObject>,
2824    /// See [`Object::btos`].
2825    pub btos: Vec<AnyObject>,
2826    /// See [`Object::ccs`].
2827    pub ccs: Vec<AnyObject>,
2828    /// See [`Object::bccs`].
2829    pub bccs: Vec<AnyObject>,
2830    /// See [`Object::media_type`].
2831    pub media_type: Option<String>,
2832    /// See [`Object::duration`].
2833    pub duration: Option<String>,
2834    /// See [`Object::sensitive`].
2835    pub sensitive: Option<bool>,
2836    /// See [`Object::source`].
2837    pub source: Option<Box<Source>>,
2838    /// See [`Object::proofs`].
2839    pub proofs: Vec<Reference<DataIntegrityProof>>,
2840    /// See [`Object::interaction_policy`].
2841    pub interaction_policy: Option<Box<InteractionPolicy>>,
2842    /// See [`Object::approved_by`].
2843    pub approved_by: Option<Iri>,
2844    /// See [`Object::like_authorization`].
2845    pub like_authorization: Option<Reference<LikeAuthorization>>,
2846    /// See [`Object::reply_authorization`].
2847    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
2848    /// See [`Object::announce_authorization`].
2849    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
2850    /// See [`Object::translations`].
2851    pub translations: Vec<Translation>,
2852    /// See [`Activity::actors`].
2853    pub actors: Vec<AnyActor>,
2854    /// See [`Activity::objects`].
2855    pub objects: Vec<AnyObject>,
2856    /// See [`Activity::targets`].
2857    pub targets: Vec<AnyObject>,
2858    /// See [`Activity::results`].
2859    pub results: Vec<AnyObject>,
2860    /// See [`Activity::origins`].
2861    pub origins: Vec<AnyObject>,
2862    /// See [`Activity::instruments`].
2863    pub instruments: Vec<AnyObject>,
2864    /// Whether what the blocked or deleted person posted is to be removed too.
2865    pub remove_data: Option<bool>,
2866}
2867
2868impl Block {
2869    /// The type's IRI.
2870    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Block";
2871    /// The type's `type` in a normalised document.
2872    pub const TYPE: &'static str = "Block";
2873}
2874
2875impl json::Typed for Block {
2876    const TYPE: &'static str = "Block";
2877}
2878
2879impl FromJson for Block {
2880    fn from_json(value: &Value) -> Result<Self, JsonError> {
2881        let object = json::object(value)?;
2882        json::expect_type(object, Self::TYPE)?;
2883        Ok(Self {
2884            id: json::id(object),
2885            attachments: json::many(object, &["attachment"]),
2886            attributions: json::many(object, &["attributedTo"]),
2887            audiences: json::many(object, &["audience"]),
2888            content: json::text(object, "content"),
2889            contexts: json::many(object, &["context"]),
2890            name: json::text(object, "name"),
2891            end_time: json::one(object, &["endTime"]),
2892            generators: json::many(object, &["generator"]),
2893            icons: json::many_mapped(object, &["icon"], json::link_to_image),
2894            images: json::many_mapped(object, &["image"], json::link_to_image),
2895            reply_targets: json::many(object, &["inReplyTo"]),
2896            locations: json::many(object, &["location"]),
2897            previews: json::many(object, &["preview"]),
2898            published: json::one(object, &["published"]),
2899            replies: json::one(object, &["replies"]),
2900            shares: json::one(object, &["shares"]),
2901            likes: json::one(object, &["likes"]),
2902            emoji_reactions: json::one(object, &["emojiReactions"]),
2903            start_time: json::one(object, &["startTime"]),
2904            summary: json::text(object, "summary"),
2905            tags: json::many(object, &["tag"]),
2906            updated: json::one(object, &["updated"]),
2907            urls: json::many(object, &["url"]),
2908            tos: json::many(object, &["to"]),
2909            btos: json::many(object, &["bto"]),
2910            ccs: json::many(object, &["cc"]),
2911            bccs: json::many(object, &["bcc"]),
2912            media_type: json::one(object, &["mediaType"]),
2913            duration: json::one(object, &["duration"]),
2914            sensitive: json::one(object, &["sensitive"]),
2915            source: json::one(object, &["source"]),
2916            proofs: json::many(object, &["proof"]),
2917            interaction_policy: json::one(object, &["interactionPolicy"]),
2918            approved_by: json::one(object, &["approvedBy"]),
2919            like_authorization: json::one(object, &["likeAuthorization"]),
2920            reply_authorization: json::one(object, &["replyAuthorization"]),
2921            announce_authorization: json::one(object, &["announceAuthorization"]),
2922            translations: json::many(object, &["translations"]),
2923            actors: json::many(object, &["actor"]),
2924            objects: json::many(object, &["object"]),
2925            targets: json::many(object, &["target"]),
2926            results: json::many(object, &["result"]),
2927            origins: json::many(object, &["origin"]),
2928            instruments: json::many(object, &["instrument"]),
2929            remove_data: json::one(object, &["removeData"]),
2930        })
2931    }
2932}
2933
2934impl ToJson for Block {
2935    fn to_json(&self) -> Value {
2936        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
2937        json::put_many(&mut object, &["attachment"], &self.attachments);
2938        json::put_many(&mut object, &["attributedTo"], &self.attributions);
2939        json::put_many(&mut object, &["audience"], &self.audiences);
2940        json::put_text(&mut object, "content", &self.content);
2941        json::put_many(&mut object, &["context"], &self.contexts);
2942        json::put_text(&mut object, "name", &self.name);
2943        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
2944        json::put_many(&mut object, &["generator"], &self.generators);
2945        json::put_many(&mut object, &["icon"], &self.icons);
2946        json::put_many(&mut object, &["image"], &self.images);
2947        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
2948        json::put_many(&mut object, &["location"], &self.locations);
2949        json::put_many(&mut object, &["preview"], &self.previews);
2950        json::put_one(&mut object, &["published"], self.published.as_ref());
2951        json::put_one(&mut object, &["replies"], self.replies.as_ref());
2952        json::put_one(&mut object, &["shares"], self.shares.as_ref());
2953        json::put_one(&mut object, &["likes"], self.likes.as_ref());
2954        json::put_one(
2955            &mut object,
2956            &["emojiReactions"],
2957            self.emoji_reactions.as_ref(),
2958        );
2959        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
2960        json::put_text(&mut object, "summary", &self.summary);
2961        json::put_many(&mut object, &["tag"], &self.tags);
2962        json::put_one(&mut object, &["updated"], self.updated.as_ref());
2963        json::put_many(&mut object, &["url"], &self.urls);
2964        json::put_many(&mut object, &["to"], &self.tos);
2965        json::put_many(&mut object, &["bto"], &self.btos);
2966        json::put_many(&mut object, &["cc"], &self.ccs);
2967        json::put_many(&mut object, &["bcc"], &self.bccs);
2968        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
2969        json::put_one(&mut object, &["duration"], self.duration.as_ref());
2970        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
2971        json::put_one(&mut object, &["source"], self.source.as_ref());
2972        json::put_many(&mut object, &["proof"], &self.proofs);
2973        json::put_one(
2974            &mut object,
2975            &["interactionPolicy"],
2976            self.interaction_policy.as_ref(),
2977        );
2978        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
2979        json::put_one(
2980            &mut object,
2981            &["likeAuthorization"],
2982            self.like_authorization.as_ref(),
2983        );
2984        json::put_one(
2985            &mut object,
2986            &["replyAuthorization"],
2987            self.reply_authorization.as_ref(),
2988        );
2989        json::put_one(
2990            &mut object,
2991            &["announceAuthorization"],
2992            self.announce_authorization.as_ref(),
2993        );
2994        json::put_many(&mut object, &["translations"], &self.translations);
2995        json::put_many(&mut object, &["actor"], &self.actors);
2996        json::put_many(&mut object, &["object"], &self.objects);
2997        json::put_many(&mut object, &["target"], &self.targets);
2998        json::put_many(&mut object, &["result"], &self.results);
2999        json::put_many(&mut object, &["origin"], &self.origins);
3000        json::put_many(&mut object, &["instrument"], &self.instruments);
3001        json::put_one(&mut object, &["removeData"], self.remove_data.as_ref());
3002        Value::Object(object)
3003    }
3004}
3005
3006/// `ChatMessage`s are the messages sent in 1-on-1 chats.  They are similar to
3007/// {@link Note}s, but the addressing is done by having a single AP actor in
3008/// the `to` field.  Addressing multiple actors is not allowed.  These messages
3009/// are always private, there is no public version of them.  They are created with
3010/// a {@link Create} activity.
3011///
3012/// The type `http://litepub.social/ns#ChatMessage`.
3013#[derive(Clone, Debug, Default, PartialEq)]
3014pub struct ChatMessage {
3015    /// The IRI that identifies this object.
3016    pub id: Option<Iri>,
3017    /// See [`Object::attachments`].
3018    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
3019    /// See [`Object::attributions`].
3020    pub attributions: Vec<AnyActor>,
3021    /// See [`Object::audiences`].
3022    pub audiences: Vec<AnyObject>,
3023    /// See [`Object::content`].
3024    pub content: Text,
3025    /// See [`Object::contexts`].
3026    pub contexts: Vec<LinkOrObject>,
3027    /// See [`Object::name`].
3028    pub name: Text,
3029    /// See [`Object::end_time`].
3030    pub end_time: Option<String>,
3031    /// See [`Object::generators`].
3032    pub generators: Vec<LinkOrObject>,
3033    /// See [`Object::icons`].
3034    pub icons: Vec<Reference<Image>>,
3035    /// See [`Object::images`].
3036    pub images: Vec<Reference<Image>>,
3037    /// See [`Object::reply_targets`].
3038    pub reply_targets: Vec<LinkOrObject>,
3039    /// See [`Object::locations`].
3040    pub locations: Vec<LinkOrObject>,
3041    /// See [`Object::previews`].
3042    pub previews: Vec<LinkOrObject>,
3043    /// See [`Object::published`].
3044    pub published: Option<String>,
3045    /// See [`Object::replies`].
3046    pub replies: Option<AnyCollection>,
3047    /// See [`Object::shares`].
3048    pub shares: Option<AnyCollection>,
3049    /// See [`Object::likes`].
3050    pub likes: Option<AnyCollection>,
3051    /// See [`Object::emoji_reactions`].
3052    pub emoji_reactions: Option<AnyCollection>,
3053    /// See [`Object::start_time`].
3054    pub start_time: Option<String>,
3055    /// See [`Object::summary`].
3056    pub summary: Text,
3057    /// See [`Object::tags`].
3058    pub tags: Vec<LinkOrObject>,
3059    /// See [`Object::updated`].
3060    pub updated: Option<String>,
3061    /// See [`Object::urls`].
3062    pub urls: Vec<LinkOrIri>,
3063    /// See [`Object::tos`].
3064    pub tos: Vec<AnyObject>,
3065    /// See [`Object::btos`].
3066    pub btos: Vec<AnyObject>,
3067    /// See [`Object::ccs`].
3068    pub ccs: Vec<AnyObject>,
3069    /// See [`Object::bccs`].
3070    pub bccs: Vec<AnyObject>,
3071    /// See [`Object::media_type`].
3072    pub media_type: Option<String>,
3073    /// See [`Object::duration`].
3074    pub duration: Option<String>,
3075    /// See [`Object::sensitive`].
3076    pub sensitive: Option<bool>,
3077    /// See [`Object::source`].
3078    pub source: Option<Box<Source>>,
3079    /// See [`Object::proofs`].
3080    pub proofs: Vec<Reference<DataIntegrityProof>>,
3081    /// See [`Object::interaction_policy`].
3082    pub interaction_policy: Option<Box<InteractionPolicy>>,
3083    /// See [`Object::approved_by`].
3084    pub approved_by: Option<Iri>,
3085    /// See [`Object::like_authorization`].
3086    pub like_authorization: Option<Reference<LikeAuthorization>>,
3087    /// See [`Object::reply_authorization`].
3088    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
3089    /// See [`Object::announce_authorization`].
3090    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
3091    /// See [`Object::translations`].
3092    pub translations: Vec<Translation>,
3093    /// The quoted ActivityStreams object.
3094    pub quote: Option<AnyObject>,
3095    /// The URI of the ActivityStreams object that this object quotes.
3096    pub quote_url: Option<Iri>,
3097    /// A {@link QuoteAuthorization} object that proves this quote was approved
3098    /// by the quoted object's author.
3099    pub quote_authorization: Option<Reference<QuoteAuthorization>>,
3100}
3101
3102impl ChatMessage {
3103    /// The type's IRI.
3104    pub const TYPE_IRI: &'static str = "http://litepub.social/ns#ChatMessage";
3105    /// The type's `type` in a normalised document.
3106    pub const TYPE: &'static str = "ChatMessage";
3107}
3108
3109impl json::Typed for ChatMessage {
3110    const TYPE: &'static str = "ChatMessage";
3111}
3112
3113impl FromJson for ChatMessage {
3114    fn from_json(value: &Value) -> Result<Self, JsonError> {
3115        let object = json::object(value)?;
3116        json::expect_type(object, Self::TYPE)?;
3117        Ok(Self {
3118            id: json::id(object),
3119            attachments: json::many(object, &["attachment"]),
3120            attributions: json::many(object, &["attributedTo"]),
3121            audiences: json::many(object, &["audience"]),
3122            content: json::text(object, "content"),
3123            contexts: json::many(object, &["context"]),
3124            name: json::text(object, "name"),
3125            end_time: json::one(object, &["endTime"]),
3126            generators: json::many(object, &["generator"]),
3127            icons: json::many_mapped(object, &["icon"], json::link_to_image),
3128            images: json::many_mapped(object, &["image"], json::link_to_image),
3129            reply_targets: json::many(object, &["inReplyTo"]),
3130            locations: json::many(object, &["location"]),
3131            previews: json::many(object, &["preview"]),
3132            published: json::one(object, &["published"]),
3133            replies: json::one(object, &["replies"]),
3134            shares: json::one(object, &["shares"]),
3135            likes: json::one(object, &["likes"]),
3136            emoji_reactions: json::one(object, &["emojiReactions"]),
3137            start_time: json::one(object, &["startTime"]),
3138            summary: json::text(object, "summary"),
3139            tags: json::many(object, &["tag"]),
3140            updated: json::one(object, &["updated"]),
3141            urls: json::many(object, &["url"]),
3142            tos: json::many(object, &["to"]),
3143            btos: json::many(object, &["bto"]),
3144            ccs: json::many(object, &["cc"]),
3145            bccs: json::many(object, &["bcc"]),
3146            media_type: json::one(object, &["mediaType"]),
3147            duration: json::one(object, &["duration"]),
3148            sensitive: json::one(object, &["sensitive"]),
3149            source: json::one(object, &["source"]),
3150            proofs: json::many(object, &["proof"]),
3151            interaction_policy: json::one(object, &["interactionPolicy"]),
3152            approved_by: json::one(object, &["approvedBy"]),
3153            like_authorization: json::one(object, &["likeAuthorization"]),
3154            reply_authorization: json::one(object, &["replyAuthorization"]),
3155            announce_authorization: json::one(object, &["announceAuthorization"]),
3156            translations: json::many(object, &["translations"]),
3157            quote: json::one(object, &["quote"]),
3158            quote_url: json::one(object, &["quoteUrl", "_misskey_quote", "quoteUri"]),
3159            quote_authorization: json::one(object, &["quoteAuthorization"]),
3160        })
3161    }
3162}
3163
3164impl ToJson for ChatMessage {
3165    fn to_json(&self) -> Value {
3166        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
3167        json::put_many(&mut object, &["attachment"], &self.attachments);
3168        json::put_many(&mut object, &["attributedTo"], &self.attributions);
3169        json::put_many(&mut object, &["audience"], &self.audiences);
3170        json::put_text(&mut object, "content", &self.content);
3171        json::put_many(&mut object, &["context"], &self.contexts);
3172        json::put_text(&mut object, "name", &self.name);
3173        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
3174        json::put_many(&mut object, &["generator"], &self.generators);
3175        json::put_many(&mut object, &["icon"], &self.icons);
3176        json::put_many(&mut object, &["image"], &self.images);
3177        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
3178        json::put_many(&mut object, &["location"], &self.locations);
3179        json::put_many(&mut object, &["preview"], &self.previews);
3180        json::put_one(&mut object, &["published"], self.published.as_ref());
3181        json::put_one(&mut object, &["replies"], self.replies.as_ref());
3182        json::put_one(&mut object, &["shares"], self.shares.as_ref());
3183        json::put_one(&mut object, &["likes"], self.likes.as_ref());
3184        json::put_one(
3185            &mut object,
3186            &["emojiReactions"],
3187            self.emoji_reactions.as_ref(),
3188        );
3189        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
3190        json::put_text(&mut object, "summary", &self.summary);
3191        json::put_many(&mut object, &["tag"], &self.tags);
3192        json::put_one(&mut object, &["updated"], self.updated.as_ref());
3193        json::put_many(&mut object, &["url"], &self.urls);
3194        json::put_many(&mut object, &["to"], &self.tos);
3195        json::put_many(&mut object, &["bto"], &self.btos);
3196        json::put_many(&mut object, &["cc"], &self.ccs);
3197        json::put_many(&mut object, &["bcc"], &self.bccs);
3198        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
3199        json::put_one(&mut object, &["duration"], self.duration.as_ref());
3200        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
3201        json::put_one(&mut object, &["source"], self.source.as_ref());
3202        json::put_many(&mut object, &["proof"], &self.proofs);
3203        json::put_one(
3204            &mut object,
3205            &["interactionPolicy"],
3206            self.interaction_policy.as_ref(),
3207        );
3208        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
3209        json::put_one(
3210            &mut object,
3211            &["likeAuthorization"],
3212            self.like_authorization.as_ref(),
3213        );
3214        json::put_one(
3215            &mut object,
3216            &["replyAuthorization"],
3217            self.reply_authorization.as_ref(),
3218        );
3219        json::put_one(
3220            &mut object,
3221            &["announceAuthorization"],
3222            self.announce_authorization.as_ref(),
3223        );
3224        json::put_many(&mut object, &["translations"], &self.translations);
3225        json::put_one(&mut object, &["quote"], self.quote.as_ref());
3226        json::put_one(
3227            &mut object,
3228            &["quoteUrl", "_misskey_quote", "quoteUri"],
3229            self.quote_url.as_ref(),
3230        );
3231        json::put_one(
3232            &mut object,
3233            &["quoteAuthorization"],
3234            self.quote_authorization.as_ref(),
3235        );
3236        Value::Object(object)
3237    }
3238}
3239
3240/// A `Collection` is a subtype of {@link Object} that represents ordered or
3241/// unordered sets of {@link Object} or {@link Link} instances.
3242///
3243/// The type `https://www.w3.org/ns/activitystreams#Collection`.
3244#[derive(Clone, Debug, Default, PartialEq)]
3245pub struct Collection {
3246    /// The IRI that identifies this object.
3247    pub id: Option<Iri>,
3248    /// See [`Object::attachments`].
3249    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
3250    /// See [`Object::attributions`].
3251    pub attributions: Vec<AnyActor>,
3252    /// See [`Object::audiences`].
3253    pub audiences: Vec<AnyObject>,
3254    /// See [`Object::content`].
3255    pub content: Text,
3256    /// See [`Object::contexts`].
3257    pub contexts: Vec<LinkOrObject>,
3258    /// See [`Object::name`].
3259    pub name: Text,
3260    /// See [`Object::end_time`].
3261    pub end_time: Option<String>,
3262    /// See [`Object::generators`].
3263    pub generators: Vec<LinkOrObject>,
3264    /// See [`Object::icons`].
3265    pub icons: Vec<Reference<Image>>,
3266    /// See [`Object::images`].
3267    pub images: Vec<Reference<Image>>,
3268    /// See [`Object::reply_targets`].
3269    pub reply_targets: Vec<LinkOrObject>,
3270    /// See [`Object::locations`].
3271    pub locations: Vec<LinkOrObject>,
3272    /// See [`Object::previews`].
3273    pub previews: Vec<LinkOrObject>,
3274    /// See [`Object::published`].
3275    pub published: Option<String>,
3276    /// See [`Object::replies`].
3277    pub replies: Option<AnyCollection>,
3278    /// See [`Object::shares`].
3279    pub shares: Option<AnyCollection>,
3280    /// See [`Object::likes`].
3281    pub likes: Option<AnyCollection>,
3282    /// See [`Object::emoji_reactions`].
3283    pub emoji_reactions: Option<AnyCollection>,
3284    /// See [`Object::start_time`].
3285    pub start_time: Option<String>,
3286    /// See [`Object::summary`].
3287    pub summary: Text,
3288    /// See [`Object::tags`].
3289    pub tags: Vec<LinkOrObject>,
3290    /// See [`Object::updated`].
3291    pub updated: Option<String>,
3292    /// See [`Object::urls`].
3293    pub urls: Vec<LinkOrIri>,
3294    /// See [`Object::tos`].
3295    pub tos: Vec<AnyObject>,
3296    /// See [`Object::btos`].
3297    pub btos: Vec<AnyObject>,
3298    /// See [`Object::ccs`].
3299    pub ccs: Vec<AnyObject>,
3300    /// See [`Object::bccs`].
3301    pub bccs: Vec<AnyObject>,
3302    /// See [`Object::media_type`].
3303    pub media_type: Option<String>,
3304    /// See [`Object::duration`].
3305    pub duration: Option<String>,
3306    /// See [`Object::sensitive`].
3307    pub sensitive: Option<bool>,
3308    /// See [`Object::source`].
3309    pub source: Option<Box<Source>>,
3310    /// See [`Object::proofs`].
3311    pub proofs: Vec<Reference<DataIntegrityProof>>,
3312    /// See [`Object::interaction_policy`].
3313    pub interaction_policy: Option<Box<InteractionPolicy>>,
3314    /// See [`Object::approved_by`].
3315    pub approved_by: Option<Iri>,
3316    /// See [`Object::like_authorization`].
3317    pub like_authorization: Option<Reference<LikeAuthorization>>,
3318    /// See [`Object::reply_authorization`].
3319    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
3320    /// See [`Object::announce_authorization`].
3321    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
3322    /// See [`Object::translations`].
3323    pub translations: Vec<Translation>,
3324    /// A non-negative integer specifying the total number of objects contained by
3325    /// the logical view of the collection. This number might not reflect the actual
3326    /// number of items serialized within the {@link Collection} object instance.
3327    pub total_items: Option<u64>,
3328    /// In a paged {@link Collection}, indicates the page that contains
3329    /// the most recently updated member items.
3330    pub current: Option<AnyCollectionPage>,
3331    /// In a paged {@link Collection}, indicates the furthest preceding page of
3332    /// items in the collection.
3333    pub first: Option<AnyCollectionPage>,
3334    /// In a paged {@link Collection}, indicates the furthest proceeding page of
3335    /// the collection.
3336    pub last: Option<AnyCollectionPage>,
3337    /// Identifies the items contained in a collection.  The items might be ordered
3338    /// or unordered.
3339    pub items: Vec<LinkOrObject>,
3340    /// Defines an object for which the collection is the value of the likes property.
3341    pub likes_of: Option<AnyObject>,
3342    /// Defines an object for which the collection is the value of the shares property.
3343    pub shares_of: Option<AnyObject>,
3344    /// Defines an object for which the collection is the value of the replies property.
3345    pub replies_of: Option<AnyObject>,
3346    /// Defines an actor for which the collection is the value of the inbox property.
3347    pub inbox_of: Option<AnyObject>,
3348    /// Defines an actor for which the collection is the value of the outbox property.
3349    pub outbox_of: Option<AnyObject>,
3350    /// Defines an actor for which the collection is the value of the followers property.
3351    pub followers_of: Option<AnyObject>,
3352    /// Defines an actor for which the collection is the value of the following property.
3353    pub following_of: Option<AnyObject>,
3354    /// Defines an actor for which the collection is the value of the liked property.
3355    pub liked_of: Option<AnyObject>,
3356}
3357
3358impl Collection {
3359    /// The type's IRI.
3360    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Collection";
3361    /// The type's `type` in a normalised document.
3362    pub const TYPE: &'static str = "Collection";
3363}
3364
3365impl json::Typed for Collection {
3366    const TYPE: &'static str = "Collection";
3367}
3368
3369impl FromJson for Collection {
3370    fn from_json(value: &Value) -> Result<Self, JsonError> {
3371        let object = json::object(value)?;
3372        json::expect_type(object, Self::TYPE)?;
3373        Ok(Self {
3374            id: json::id(object),
3375            attachments: json::many(object, &["attachment"]),
3376            attributions: json::many(object, &["attributedTo"]),
3377            audiences: json::many(object, &["audience"]),
3378            content: json::text(object, "content"),
3379            contexts: json::many(object, &["context"]),
3380            name: json::text(object, "name"),
3381            end_time: json::one(object, &["endTime"]),
3382            generators: json::many(object, &["generator"]),
3383            icons: json::many_mapped(object, &["icon"], json::link_to_image),
3384            images: json::many_mapped(object, &["image"], json::link_to_image),
3385            reply_targets: json::many(object, &["inReplyTo"]),
3386            locations: json::many(object, &["location"]),
3387            previews: json::many(object, &["preview"]),
3388            published: json::one(object, &["published"]),
3389            replies: json::one(object, &["replies"]),
3390            shares: json::one(object, &["shares"]),
3391            likes: json::one(object, &["likes"]),
3392            emoji_reactions: json::one(object, &["emojiReactions"]),
3393            start_time: json::one(object, &["startTime"]),
3394            summary: json::text(object, "summary"),
3395            tags: json::many(object, &["tag"]),
3396            updated: json::one(object, &["updated"]),
3397            urls: json::many(object, &["url"]),
3398            tos: json::many(object, &["to"]),
3399            btos: json::many(object, &["bto"]),
3400            ccs: json::many(object, &["cc"]),
3401            bccs: json::many(object, &["bcc"]),
3402            media_type: json::one(object, &["mediaType"]),
3403            duration: json::one(object, &["duration"]),
3404            sensitive: json::one(object, &["sensitive"]),
3405            source: json::one(object, &["source"]),
3406            proofs: json::many(object, &["proof"]),
3407            interaction_policy: json::one(object, &["interactionPolicy"]),
3408            approved_by: json::one(object, &["approvedBy"]),
3409            like_authorization: json::one(object, &["likeAuthorization"]),
3410            reply_authorization: json::one(object, &["replyAuthorization"]),
3411            announce_authorization: json::one(object, &["announceAuthorization"]),
3412            translations: json::many(object, &["translations"]),
3413            total_items: json::one(object, &["totalItems"]),
3414            current: json::one(object, &["current"]),
3415            first: json::one(object, &["first"]),
3416            last: json::one(object, &["last"]),
3417            items: json::many(object, &["items"]),
3418            likes_of: json::one(object, &["https://w3id.org/fep/5711#likesOf"]),
3419            shares_of: json::one(object, &["https://w3id.org/fep/5711#sharesOf"]),
3420            replies_of: json::one(object, &["https://w3id.org/fep/5711#repliesOf"]),
3421            inbox_of: json::one(object, &["https://w3id.org/fep/5711#inboxOf"]),
3422            outbox_of: json::one(object, &["https://w3id.org/fep/5711#outboxOf"]),
3423            followers_of: json::one(object, &["https://w3id.org/fep/5711#followersOf"]),
3424            following_of: json::one(object, &["https://w3id.org/fep/5711#followingOf"]),
3425            liked_of: json::one(object, &["https://w3id.org/fep/5711#likedOf"]),
3426        })
3427    }
3428}
3429
3430impl ToJson for Collection {
3431    fn to_json(&self) -> Value {
3432        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
3433        json::put_many(&mut object, &["attachment"], &self.attachments);
3434        json::put_many(&mut object, &["attributedTo"], &self.attributions);
3435        json::put_many(&mut object, &["audience"], &self.audiences);
3436        json::put_text(&mut object, "content", &self.content);
3437        json::put_many(&mut object, &["context"], &self.contexts);
3438        json::put_text(&mut object, "name", &self.name);
3439        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
3440        json::put_many(&mut object, &["generator"], &self.generators);
3441        json::put_many(&mut object, &["icon"], &self.icons);
3442        json::put_many(&mut object, &["image"], &self.images);
3443        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
3444        json::put_many(&mut object, &["location"], &self.locations);
3445        json::put_many(&mut object, &["preview"], &self.previews);
3446        json::put_one(&mut object, &["published"], self.published.as_ref());
3447        json::put_one(&mut object, &["replies"], self.replies.as_ref());
3448        json::put_one(&mut object, &["shares"], self.shares.as_ref());
3449        json::put_one(&mut object, &["likes"], self.likes.as_ref());
3450        json::put_one(
3451            &mut object,
3452            &["emojiReactions"],
3453            self.emoji_reactions.as_ref(),
3454        );
3455        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
3456        json::put_text(&mut object, "summary", &self.summary);
3457        json::put_many(&mut object, &["tag"], &self.tags);
3458        json::put_one(&mut object, &["updated"], self.updated.as_ref());
3459        json::put_many(&mut object, &["url"], &self.urls);
3460        json::put_many(&mut object, &["to"], &self.tos);
3461        json::put_many(&mut object, &["bto"], &self.btos);
3462        json::put_many(&mut object, &["cc"], &self.ccs);
3463        json::put_many(&mut object, &["bcc"], &self.bccs);
3464        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
3465        json::put_one(&mut object, &["duration"], self.duration.as_ref());
3466        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
3467        json::put_one(&mut object, &["source"], self.source.as_ref());
3468        json::put_many(&mut object, &["proof"], &self.proofs);
3469        json::put_one(
3470            &mut object,
3471            &["interactionPolicy"],
3472            self.interaction_policy.as_ref(),
3473        );
3474        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
3475        json::put_one(
3476            &mut object,
3477            &["likeAuthorization"],
3478            self.like_authorization.as_ref(),
3479        );
3480        json::put_one(
3481            &mut object,
3482            &["replyAuthorization"],
3483            self.reply_authorization.as_ref(),
3484        );
3485        json::put_one(
3486            &mut object,
3487            &["announceAuthorization"],
3488            self.announce_authorization.as_ref(),
3489        );
3490        json::put_many(&mut object, &["translations"], &self.translations);
3491        json::put_one(&mut object, &["totalItems"], self.total_items.as_ref());
3492        json::put_one(&mut object, &["current"], self.current.as_ref());
3493        json::put_one(&mut object, &["first"], self.first.as_ref());
3494        json::put_one(&mut object, &["last"], self.last.as_ref());
3495        json::put_many(&mut object, &["items"], &self.items);
3496        json::put_one(
3497            &mut object,
3498            &["https://w3id.org/fep/5711#likesOf"],
3499            self.likes_of.as_ref(),
3500        );
3501        json::put_one(
3502            &mut object,
3503            &["https://w3id.org/fep/5711#sharesOf"],
3504            self.shares_of.as_ref(),
3505        );
3506        json::put_one(
3507            &mut object,
3508            &["https://w3id.org/fep/5711#repliesOf"],
3509            self.replies_of.as_ref(),
3510        );
3511        json::put_one(
3512            &mut object,
3513            &["https://w3id.org/fep/5711#inboxOf"],
3514            self.inbox_of.as_ref(),
3515        );
3516        json::put_one(
3517            &mut object,
3518            &["https://w3id.org/fep/5711#outboxOf"],
3519            self.outbox_of.as_ref(),
3520        );
3521        json::put_one(
3522            &mut object,
3523            &["https://w3id.org/fep/5711#followersOf"],
3524            self.followers_of.as_ref(),
3525        );
3526        json::put_one(
3527            &mut object,
3528            &["https://w3id.org/fep/5711#followingOf"],
3529            self.following_of.as_ref(),
3530        );
3531        json::put_one(
3532            &mut object,
3533            &["https://w3id.org/fep/5711#likedOf"],
3534            self.liked_of.as_ref(),
3535        );
3536        Value::Object(object)
3537    }
3538}
3539
3540/// Used to represent distinct subsets of items from a `Collection`.
3541/// Refer to the Activity Streams 2.0 Core for a complete description of
3542/// the `CollectionPage` object.
3543///
3544/// The type `https://www.w3.org/ns/activitystreams#CollectionPage`.
3545#[derive(Clone, Debug, Default, PartialEq)]
3546pub struct CollectionPage {
3547    /// The IRI that identifies this object.
3548    pub id: Option<Iri>,
3549    /// See [`Object::attachments`].
3550    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
3551    /// See [`Object::attributions`].
3552    pub attributions: Vec<AnyActor>,
3553    /// See [`Object::audiences`].
3554    pub audiences: Vec<AnyObject>,
3555    /// See [`Object::content`].
3556    pub content: Text,
3557    /// See [`Object::contexts`].
3558    pub contexts: Vec<LinkOrObject>,
3559    /// See [`Object::name`].
3560    pub name: Text,
3561    /// See [`Object::end_time`].
3562    pub end_time: Option<String>,
3563    /// See [`Object::generators`].
3564    pub generators: Vec<LinkOrObject>,
3565    /// See [`Object::icons`].
3566    pub icons: Vec<Reference<Image>>,
3567    /// See [`Object::images`].
3568    pub images: Vec<Reference<Image>>,
3569    /// See [`Object::reply_targets`].
3570    pub reply_targets: Vec<LinkOrObject>,
3571    /// See [`Object::locations`].
3572    pub locations: Vec<LinkOrObject>,
3573    /// See [`Object::previews`].
3574    pub previews: Vec<LinkOrObject>,
3575    /// See [`Object::published`].
3576    pub published: Option<String>,
3577    /// See [`Object::replies`].
3578    pub replies: Option<AnyCollection>,
3579    /// See [`Object::shares`].
3580    pub shares: Option<AnyCollection>,
3581    /// See [`Object::likes`].
3582    pub likes: Option<AnyCollection>,
3583    /// See [`Object::emoji_reactions`].
3584    pub emoji_reactions: Option<AnyCollection>,
3585    /// See [`Object::start_time`].
3586    pub start_time: Option<String>,
3587    /// See [`Object::summary`].
3588    pub summary: Text,
3589    /// See [`Object::tags`].
3590    pub tags: Vec<LinkOrObject>,
3591    /// See [`Object::updated`].
3592    pub updated: Option<String>,
3593    /// See [`Object::urls`].
3594    pub urls: Vec<LinkOrIri>,
3595    /// See [`Object::tos`].
3596    pub tos: Vec<AnyObject>,
3597    /// See [`Object::btos`].
3598    pub btos: Vec<AnyObject>,
3599    /// See [`Object::ccs`].
3600    pub ccs: Vec<AnyObject>,
3601    /// See [`Object::bccs`].
3602    pub bccs: Vec<AnyObject>,
3603    /// See [`Object::media_type`].
3604    pub media_type: Option<String>,
3605    /// See [`Object::duration`].
3606    pub duration: Option<String>,
3607    /// See [`Object::sensitive`].
3608    pub sensitive: Option<bool>,
3609    /// See [`Object::source`].
3610    pub source: Option<Box<Source>>,
3611    /// See [`Object::proofs`].
3612    pub proofs: Vec<Reference<DataIntegrityProof>>,
3613    /// See [`Object::interaction_policy`].
3614    pub interaction_policy: Option<Box<InteractionPolicy>>,
3615    /// See [`Object::approved_by`].
3616    pub approved_by: Option<Iri>,
3617    /// See [`Object::like_authorization`].
3618    pub like_authorization: Option<Reference<LikeAuthorization>>,
3619    /// See [`Object::reply_authorization`].
3620    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
3621    /// See [`Object::announce_authorization`].
3622    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
3623    /// See [`Object::translations`].
3624    pub translations: Vec<Translation>,
3625    /// See [`Collection::total_items`].
3626    pub total_items: Option<u64>,
3627    /// See [`Collection::current`].
3628    pub current: Option<AnyCollectionPage>,
3629    /// See [`Collection::first`].
3630    pub first: Option<AnyCollectionPage>,
3631    /// See [`Collection::last`].
3632    pub last: Option<AnyCollectionPage>,
3633    /// See [`Collection::items`].
3634    pub items: Vec<LinkOrObject>,
3635    /// See [`Collection::likes_of`].
3636    pub likes_of: Option<AnyObject>,
3637    /// See [`Collection::shares_of`].
3638    pub shares_of: Option<AnyObject>,
3639    /// See [`Collection::replies_of`].
3640    pub replies_of: Option<AnyObject>,
3641    /// See [`Collection::inbox_of`].
3642    pub inbox_of: Option<AnyObject>,
3643    /// See [`Collection::outbox_of`].
3644    pub outbox_of: Option<AnyObject>,
3645    /// See [`Collection::followers_of`].
3646    pub followers_of: Option<AnyObject>,
3647    /// See [`Collection::following_of`].
3648    pub following_of: Option<AnyObject>,
3649    /// See [`Collection::liked_of`].
3650    pub liked_of: Option<AnyObject>,
3651    /// Identifies the {@link Collection} to which a {@link CollectionPage} objects
3652    /// items belong.
3653    pub part_of: Option<AnyCollection>,
3654    /// In a paged {@link Collection}, indicates the next page of items.
3655    pub next: Option<AnyCollectionPage>,
3656    /// In a paged {@link Collection}, identifies the previous page of items.
3657    pub prev: Option<AnyCollectionPage>,
3658}
3659
3660impl CollectionPage {
3661    /// The type's IRI.
3662    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#CollectionPage";
3663    /// The type's `type` in a normalised document.
3664    pub const TYPE: &'static str = "CollectionPage";
3665}
3666
3667impl json::Typed for CollectionPage {
3668    const TYPE: &'static str = "CollectionPage";
3669}
3670
3671impl FromJson for CollectionPage {
3672    fn from_json(value: &Value) -> Result<Self, JsonError> {
3673        let object = json::object(value)?;
3674        json::expect_type(object, Self::TYPE)?;
3675        Ok(Self {
3676            id: json::id(object),
3677            attachments: json::many(object, &["attachment"]),
3678            attributions: json::many(object, &["attributedTo"]),
3679            audiences: json::many(object, &["audience"]),
3680            content: json::text(object, "content"),
3681            contexts: json::many(object, &["context"]),
3682            name: json::text(object, "name"),
3683            end_time: json::one(object, &["endTime"]),
3684            generators: json::many(object, &["generator"]),
3685            icons: json::many_mapped(object, &["icon"], json::link_to_image),
3686            images: json::many_mapped(object, &["image"], json::link_to_image),
3687            reply_targets: json::many(object, &["inReplyTo"]),
3688            locations: json::many(object, &["location"]),
3689            previews: json::many(object, &["preview"]),
3690            published: json::one(object, &["published"]),
3691            replies: json::one(object, &["replies"]),
3692            shares: json::one(object, &["shares"]),
3693            likes: json::one(object, &["likes"]),
3694            emoji_reactions: json::one(object, &["emojiReactions"]),
3695            start_time: json::one(object, &["startTime"]),
3696            summary: json::text(object, "summary"),
3697            tags: json::many(object, &["tag"]),
3698            updated: json::one(object, &["updated"]),
3699            urls: json::many(object, &["url"]),
3700            tos: json::many(object, &["to"]),
3701            btos: json::many(object, &["bto"]),
3702            ccs: json::many(object, &["cc"]),
3703            bccs: json::many(object, &["bcc"]),
3704            media_type: json::one(object, &["mediaType"]),
3705            duration: json::one(object, &["duration"]),
3706            sensitive: json::one(object, &["sensitive"]),
3707            source: json::one(object, &["source"]),
3708            proofs: json::many(object, &["proof"]),
3709            interaction_policy: json::one(object, &["interactionPolicy"]),
3710            approved_by: json::one(object, &["approvedBy"]),
3711            like_authorization: json::one(object, &["likeAuthorization"]),
3712            reply_authorization: json::one(object, &["replyAuthorization"]),
3713            announce_authorization: json::one(object, &["announceAuthorization"]),
3714            translations: json::many(object, &["translations"]),
3715            total_items: json::one(object, &["totalItems"]),
3716            current: json::one(object, &["current"]),
3717            first: json::one(object, &["first"]),
3718            last: json::one(object, &["last"]),
3719            items: json::many(object, &["items"]),
3720            likes_of: json::one(object, &["https://w3id.org/fep/5711#likesOf"]),
3721            shares_of: json::one(object, &["https://w3id.org/fep/5711#sharesOf"]),
3722            replies_of: json::one(object, &["https://w3id.org/fep/5711#repliesOf"]),
3723            inbox_of: json::one(object, &["https://w3id.org/fep/5711#inboxOf"]),
3724            outbox_of: json::one(object, &["https://w3id.org/fep/5711#outboxOf"]),
3725            followers_of: json::one(object, &["https://w3id.org/fep/5711#followersOf"]),
3726            following_of: json::one(object, &["https://w3id.org/fep/5711#followingOf"]),
3727            liked_of: json::one(object, &["https://w3id.org/fep/5711#likedOf"]),
3728            part_of: json::one(object, &["partOf"]),
3729            next: json::one(object, &["next"]),
3730            prev: json::one(object, &["prev"]),
3731        })
3732    }
3733}
3734
3735impl ToJson for CollectionPage {
3736    fn to_json(&self) -> Value {
3737        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
3738        json::put_many(&mut object, &["attachment"], &self.attachments);
3739        json::put_many(&mut object, &["attributedTo"], &self.attributions);
3740        json::put_many(&mut object, &["audience"], &self.audiences);
3741        json::put_text(&mut object, "content", &self.content);
3742        json::put_many(&mut object, &["context"], &self.contexts);
3743        json::put_text(&mut object, "name", &self.name);
3744        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
3745        json::put_many(&mut object, &["generator"], &self.generators);
3746        json::put_many(&mut object, &["icon"], &self.icons);
3747        json::put_many(&mut object, &["image"], &self.images);
3748        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
3749        json::put_many(&mut object, &["location"], &self.locations);
3750        json::put_many(&mut object, &["preview"], &self.previews);
3751        json::put_one(&mut object, &["published"], self.published.as_ref());
3752        json::put_one(&mut object, &["replies"], self.replies.as_ref());
3753        json::put_one(&mut object, &["shares"], self.shares.as_ref());
3754        json::put_one(&mut object, &["likes"], self.likes.as_ref());
3755        json::put_one(
3756            &mut object,
3757            &["emojiReactions"],
3758            self.emoji_reactions.as_ref(),
3759        );
3760        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
3761        json::put_text(&mut object, "summary", &self.summary);
3762        json::put_many(&mut object, &["tag"], &self.tags);
3763        json::put_one(&mut object, &["updated"], self.updated.as_ref());
3764        json::put_many(&mut object, &["url"], &self.urls);
3765        json::put_many(&mut object, &["to"], &self.tos);
3766        json::put_many(&mut object, &["bto"], &self.btos);
3767        json::put_many(&mut object, &["cc"], &self.ccs);
3768        json::put_many(&mut object, &["bcc"], &self.bccs);
3769        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
3770        json::put_one(&mut object, &["duration"], self.duration.as_ref());
3771        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
3772        json::put_one(&mut object, &["source"], self.source.as_ref());
3773        json::put_many(&mut object, &["proof"], &self.proofs);
3774        json::put_one(
3775            &mut object,
3776            &["interactionPolicy"],
3777            self.interaction_policy.as_ref(),
3778        );
3779        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
3780        json::put_one(
3781            &mut object,
3782            &["likeAuthorization"],
3783            self.like_authorization.as_ref(),
3784        );
3785        json::put_one(
3786            &mut object,
3787            &["replyAuthorization"],
3788            self.reply_authorization.as_ref(),
3789        );
3790        json::put_one(
3791            &mut object,
3792            &["announceAuthorization"],
3793            self.announce_authorization.as_ref(),
3794        );
3795        json::put_many(&mut object, &["translations"], &self.translations);
3796        json::put_one(&mut object, &["totalItems"], self.total_items.as_ref());
3797        json::put_one(&mut object, &["current"], self.current.as_ref());
3798        json::put_one(&mut object, &["first"], self.first.as_ref());
3799        json::put_one(&mut object, &["last"], self.last.as_ref());
3800        json::put_many(&mut object, &["items"], &self.items);
3801        json::put_one(
3802            &mut object,
3803            &["https://w3id.org/fep/5711#likesOf"],
3804            self.likes_of.as_ref(),
3805        );
3806        json::put_one(
3807            &mut object,
3808            &["https://w3id.org/fep/5711#sharesOf"],
3809            self.shares_of.as_ref(),
3810        );
3811        json::put_one(
3812            &mut object,
3813            &["https://w3id.org/fep/5711#repliesOf"],
3814            self.replies_of.as_ref(),
3815        );
3816        json::put_one(
3817            &mut object,
3818            &["https://w3id.org/fep/5711#inboxOf"],
3819            self.inbox_of.as_ref(),
3820        );
3821        json::put_one(
3822            &mut object,
3823            &["https://w3id.org/fep/5711#outboxOf"],
3824            self.outbox_of.as_ref(),
3825        );
3826        json::put_one(
3827            &mut object,
3828            &["https://w3id.org/fep/5711#followersOf"],
3829            self.followers_of.as_ref(),
3830        );
3831        json::put_one(
3832            &mut object,
3833            &["https://w3id.org/fep/5711#followingOf"],
3834            self.following_of.as_ref(),
3835        );
3836        json::put_one(
3837            &mut object,
3838            &["https://w3id.org/fep/5711#likedOf"],
3839            self.liked_of.as_ref(),
3840        );
3841        json::put_one(&mut object, &["partOf"], self.part_of.as_ref());
3842        json::put_one(&mut object, &["next"], self.next.as_ref());
3843        json::put_one(&mut object, &["prev"], self.prev.as_ref());
3844        Value::Object(object)
3845    }
3846}
3847
3848/// A promised economic transaction, referenced by an {@link Agreement}.
3849///
3850/// The type `https://w3id.org/valueflows/ont/vf#Commitment`.
3851#[derive(Clone, Debug, Default, PartialEq)]
3852pub struct Commitment {
3853    /// The {@link Intent} of a {@link Proposal} that this commitment
3854    /// satisfies.  The value is the proposal's URI with a
3855    /// [fragment](https://developer.mozilla.org/en-US/docs/Web/URI/Reference/Fragment)
3856    /// appended to identify the intent. Recommended fragments are
3857    /// `primary` and `reciprocal`.
3858    pub satisfies: Option<Iri>,
3859    /// The amount and unit of the economic resource being committed.  The
3860    /// unit must match the unit specified in the corresponding {@link Intent}
3861    /// of the proposal.
3862    pub resource_quantity: Option<Box<Measure>>,
3863}
3864
3865impl Commitment {
3866    /// The type's IRI.
3867    pub const TYPE_IRI: &'static str = "https://w3id.org/valueflows/ont/vf#Commitment";
3868    /// The type's `type` in a normalised document.
3869    pub const TYPE: &'static str = "Commitment";
3870}
3871
3872impl json::Typed for Commitment {
3873    const TYPE: &'static str = "Commitment";
3874}
3875
3876impl FromJson for Commitment {
3877    fn from_json(value: &Value) -> Result<Self, JsonError> {
3878        let object = json::object(value)?;
3879        json::expect_type(object, Self::TYPE)?;
3880        Ok(Self {
3881            satisfies: json::one(object, &["satisfies"]),
3882            resource_quantity: json::one_with(object, &["resourceQuantity"], |value| {
3883                Measure::from_json_untyped(value).map(Box::new)
3884            }),
3885        })
3886    }
3887}
3888
3889impl ToJson for Commitment {
3890    fn to_json(&self) -> Value {
3891        let mut object = json::new_object(Some(Self::TYPE), None);
3892        json::put_one(&mut object, &["satisfies"], self.satisfies.as_ref());
3893        json::put_one_with(
3894            &mut object,
3895            &["resourceQuantity"],
3896            self.resource_quantity.as_ref(),
3897            |value| value.to_json_untyped(),
3898        );
3899        Value::Object(object)
3900    }
3901}
3902
3903/// Indicates that the `actor` has created the `object`.
3904///
3905/// The type `https://www.w3.org/ns/activitystreams#Create`.
3906#[derive(Clone, Debug, Default, PartialEq)]
3907pub struct Create {
3908    /// The IRI that identifies this object.
3909    pub id: Option<Iri>,
3910    /// See [`Object::attachments`].
3911    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
3912    /// See [`Object::attributions`].
3913    pub attributions: Vec<AnyActor>,
3914    /// See [`Object::audiences`].
3915    pub audiences: Vec<AnyObject>,
3916    /// See [`Object::content`].
3917    pub content: Text,
3918    /// See [`Object::contexts`].
3919    pub contexts: Vec<LinkOrObject>,
3920    /// See [`Object::name`].
3921    pub name: Text,
3922    /// See [`Object::end_time`].
3923    pub end_time: Option<String>,
3924    /// See [`Object::generators`].
3925    pub generators: Vec<LinkOrObject>,
3926    /// See [`Object::icons`].
3927    pub icons: Vec<Reference<Image>>,
3928    /// See [`Object::images`].
3929    pub images: Vec<Reference<Image>>,
3930    /// See [`Object::reply_targets`].
3931    pub reply_targets: Vec<LinkOrObject>,
3932    /// See [`Object::locations`].
3933    pub locations: Vec<LinkOrObject>,
3934    /// See [`Object::previews`].
3935    pub previews: Vec<LinkOrObject>,
3936    /// See [`Object::published`].
3937    pub published: Option<String>,
3938    /// See [`Object::replies`].
3939    pub replies: Option<AnyCollection>,
3940    /// See [`Object::shares`].
3941    pub shares: Option<AnyCollection>,
3942    /// See [`Object::likes`].
3943    pub likes: Option<AnyCollection>,
3944    /// See [`Object::emoji_reactions`].
3945    pub emoji_reactions: Option<AnyCollection>,
3946    /// See [`Object::start_time`].
3947    pub start_time: Option<String>,
3948    /// See [`Object::summary`].
3949    pub summary: Text,
3950    /// See [`Object::tags`].
3951    pub tags: Vec<LinkOrObject>,
3952    /// See [`Object::updated`].
3953    pub updated: Option<String>,
3954    /// See [`Object::urls`].
3955    pub urls: Vec<LinkOrIri>,
3956    /// See [`Object::tos`].
3957    pub tos: Vec<AnyObject>,
3958    /// See [`Object::btos`].
3959    pub btos: Vec<AnyObject>,
3960    /// See [`Object::ccs`].
3961    pub ccs: Vec<AnyObject>,
3962    /// See [`Object::bccs`].
3963    pub bccs: Vec<AnyObject>,
3964    /// See [`Object::media_type`].
3965    pub media_type: Option<String>,
3966    /// See [`Object::duration`].
3967    pub duration: Option<String>,
3968    /// See [`Object::sensitive`].
3969    pub sensitive: Option<bool>,
3970    /// See [`Object::source`].
3971    pub source: Option<Box<Source>>,
3972    /// See [`Object::proofs`].
3973    pub proofs: Vec<Reference<DataIntegrityProof>>,
3974    /// See [`Object::interaction_policy`].
3975    pub interaction_policy: Option<Box<InteractionPolicy>>,
3976    /// See [`Object::approved_by`].
3977    pub approved_by: Option<Iri>,
3978    /// See [`Object::like_authorization`].
3979    pub like_authorization: Option<Reference<LikeAuthorization>>,
3980    /// See [`Object::reply_authorization`].
3981    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
3982    /// See [`Object::announce_authorization`].
3983    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
3984    /// See [`Object::translations`].
3985    pub translations: Vec<Translation>,
3986    /// See [`Activity::actors`].
3987    pub actors: Vec<AnyActor>,
3988    /// See [`Activity::objects`].
3989    pub objects: Vec<AnyObject>,
3990    /// See [`Activity::targets`].
3991    pub targets: Vec<AnyObject>,
3992    /// See [`Activity::results`].
3993    pub results: Vec<AnyObject>,
3994    /// See [`Activity::origins`].
3995    pub origins: Vec<AnyObject>,
3996    /// See [`Activity::instruments`].
3997    pub instruments: Vec<AnyObject>,
3998}
3999
4000impl Create {
4001    /// The type's IRI.
4002    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Create";
4003    /// The type's `type` in a normalised document.
4004    pub const TYPE: &'static str = "Create";
4005}
4006
4007impl json::Typed for Create {
4008    const TYPE: &'static str = "Create";
4009}
4010
4011impl FromJson for Create {
4012    fn from_json(value: &Value) -> Result<Self, JsonError> {
4013        let object = json::object(value)?;
4014        json::expect_type(object, Self::TYPE)?;
4015        Ok(Self {
4016            id: json::id(object),
4017            attachments: json::many(object, &["attachment"]),
4018            attributions: json::many(object, &["attributedTo"]),
4019            audiences: json::many(object, &["audience"]),
4020            content: json::text(object, "content"),
4021            contexts: json::many(object, &["context"]),
4022            name: json::text(object, "name"),
4023            end_time: json::one(object, &["endTime"]),
4024            generators: json::many(object, &["generator"]),
4025            icons: json::many_mapped(object, &["icon"], json::link_to_image),
4026            images: json::many_mapped(object, &["image"], json::link_to_image),
4027            reply_targets: json::many(object, &["inReplyTo"]),
4028            locations: json::many(object, &["location"]),
4029            previews: json::many(object, &["preview"]),
4030            published: json::one(object, &["published"]),
4031            replies: json::one(object, &["replies"]),
4032            shares: json::one(object, &["shares"]),
4033            likes: json::one(object, &["likes"]),
4034            emoji_reactions: json::one(object, &["emojiReactions"]),
4035            start_time: json::one(object, &["startTime"]),
4036            summary: json::text(object, "summary"),
4037            tags: json::many(object, &["tag"]),
4038            updated: json::one(object, &["updated"]),
4039            urls: json::many(object, &["url"]),
4040            tos: json::many(object, &["to"]),
4041            btos: json::many(object, &["bto"]),
4042            ccs: json::many(object, &["cc"]),
4043            bccs: json::many(object, &["bcc"]),
4044            media_type: json::one(object, &["mediaType"]),
4045            duration: json::one(object, &["duration"]),
4046            sensitive: json::one(object, &["sensitive"]),
4047            source: json::one(object, &["source"]),
4048            proofs: json::many(object, &["proof"]),
4049            interaction_policy: json::one(object, &["interactionPolicy"]),
4050            approved_by: json::one(object, &["approvedBy"]),
4051            like_authorization: json::one(object, &["likeAuthorization"]),
4052            reply_authorization: json::one(object, &["replyAuthorization"]),
4053            announce_authorization: json::one(object, &["announceAuthorization"]),
4054            translations: json::many(object, &["translations"]),
4055            actors: json::many(object, &["actor"]),
4056            objects: json::many(object, &["object"]),
4057            targets: json::many(object, &["target"]),
4058            results: json::many(object, &["result"]),
4059            origins: json::many(object, &["origin"]),
4060            instruments: json::many(object, &["instrument"]),
4061        })
4062    }
4063}
4064
4065impl ToJson for Create {
4066    fn to_json(&self) -> Value {
4067        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
4068        json::put_many(&mut object, &["attachment"], &self.attachments);
4069        json::put_many(&mut object, &["attributedTo"], &self.attributions);
4070        json::put_many(&mut object, &["audience"], &self.audiences);
4071        json::put_text(&mut object, "content", &self.content);
4072        json::put_many(&mut object, &["context"], &self.contexts);
4073        json::put_text(&mut object, "name", &self.name);
4074        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
4075        json::put_many(&mut object, &["generator"], &self.generators);
4076        json::put_many(&mut object, &["icon"], &self.icons);
4077        json::put_many(&mut object, &["image"], &self.images);
4078        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
4079        json::put_many(&mut object, &["location"], &self.locations);
4080        json::put_many(&mut object, &["preview"], &self.previews);
4081        json::put_one(&mut object, &["published"], self.published.as_ref());
4082        json::put_one(&mut object, &["replies"], self.replies.as_ref());
4083        json::put_one(&mut object, &["shares"], self.shares.as_ref());
4084        json::put_one(&mut object, &["likes"], self.likes.as_ref());
4085        json::put_one(
4086            &mut object,
4087            &["emojiReactions"],
4088            self.emoji_reactions.as_ref(),
4089        );
4090        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
4091        json::put_text(&mut object, "summary", &self.summary);
4092        json::put_many(&mut object, &["tag"], &self.tags);
4093        json::put_one(&mut object, &["updated"], self.updated.as_ref());
4094        json::put_many(&mut object, &["url"], &self.urls);
4095        json::put_many(&mut object, &["to"], &self.tos);
4096        json::put_many(&mut object, &["bto"], &self.btos);
4097        json::put_many(&mut object, &["cc"], &self.ccs);
4098        json::put_many(&mut object, &["bcc"], &self.bccs);
4099        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
4100        json::put_one(&mut object, &["duration"], self.duration.as_ref());
4101        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
4102        json::put_one(&mut object, &["source"], self.source.as_ref());
4103        json::put_many(&mut object, &["proof"], &self.proofs);
4104        json::put_one(
4105            &mut object,
4106            &["interactionPolicy"],
4107            self.interaction_policy.as_ref(),
4108        );
4109        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
4110        json::put_one(
4111            &mut object,
4112            &["likeAuthorization"],
4113            self.like_authorization.as_ref(),
4114        );
4115        json::put_one(
4116            &mut object,
4117            &["replyAuthorization"],
4118            self.reply_authorization.as_ref(),
4119        );
4120        json::put_one(
4121            &mut object,
4122            &["announceAuthorization"],
4123            self.announce_authorization.as_ref(),
4124        );
4125        json::put_many(&mut object, &["translations"], &self.translations);
4126        json::put_many(&mut object, &["actor"], &self.actors);
4127        json::put_many(&mut object, &["object"], &self.objects);
4128        json::put_many(&mut object, &["target"], &self.targets);
4129        json::put_many(&mut object, &["result"], &self.results);
4130        json::put_many(&mut object, &["origin"], &self.origins);
4131        json::put_many(&mut object, &["instrument"], &self.instruments);
4132        Value::Object(object)
4133    }
4134}
4135
4136/// A key owned by an actor.
4137///
4138/// The type `https://w3id.org/security#Key`.
4139#[derive(Clone, Debug, Default, PartialEq)]
4140pub struct CryptographicKey {
4141    /// The IRI that identifies this object.
4142    pub id: Option<Iri>,
4143    /// An actor who owns this key.
4144    pub owner: Option<AnyActor>,
4145    /// A PEM-encoded public key.
4146    pub public_key: Option<String>,
4147}
4148
4149impl CryptographicKey {
4150    /// Read a `CryptographicKey` sent without its `type`, as some properties send it.
4151    ///
4152    /// # Errors
4153    ///
4154    /// When `value` is not an object.
4155    pub fn from_json_untyped(value: &Value) -> Result<Self, JsonError> {
4156        let object = json::object(value)?;
4157        Ok(Self {
4158            id: json::id(object),
4159            owner: json::one(object, &["owner"]),
4160            public_key: json::one(object, &["publicKeyPem"]),
4161        })
4162    }
4163
4164    /// Write a `CryptographicKey` without its `type`, as some properties send it.
4165    #[must_use]
4166    pub fn to_json_untyped(&self) -> Value {
4167        json::without_type(self.to_json())
4168    }
4169
4170    /// The type's IRI.
4171    pub const TYPE_IRI: &'static str = "https://w3id.org/security#Key";
4172    /// The type's `type` in a normalised document.
4173    pub const TYPE: &'static str = "CryptographicKey";
4174}
4175
4176impl json::Typed for CryptographicKey {
4177    const TYPE: &'static str = "CryptographicKey";
4178}
4179
4180impl FromJson for CryptographicKey {
4181    fn from_json(value: &Value) -> Result<Self, JsonError> {
4182        let object = json::object(value)?;
4183        json::expect_type(object, Self::TYPE)?;
4184        Ok(Self {
4185            id: json::id(object),
4186            owner: json::one(object, &["owner"]),
4187            public_key: json::one(object, &["publicKeyPem"]),
4188        })
4189    }
4190}
4191
4192impl ToJson for CryptographicKey {
4193    fn to_json(&self) -> Value {
4194        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
4195        json::put_one(&mut object, &["owner"], self.owner.as_ref());
4196        json::put_one(&mut object, &["publicKeyPem"], self.public_key.as_ref());
4197        Value::Object(object)
4198    }
4199}
4200
4201/// A proof that can be added to any activity or object, allowing recipients to
4202/// verify the identity of the actor and the integrity of the data.
4203///
4204/// The type `https://w3id.org/security#DataIntegrityProof`.
4205#[derive(Clone, Debug, Default, PartialEq)]
4206pub struct DataIntegrityProof {
4207    /// The IRI that identifies this object.
4208    pub id: Option<Iri>,
4209    /// The cryptographic suite used to create the proof.
4210    pub cryptosuite: Option<String>,
4211    /// A key owned by an actor according to [FEP-521a: Representing actor's public
4212    /// keys](https://w3id.org/fep/521a).
4213    pub verification_method: Option<Reference<Multikey>>,
4214    /// The reason the proof was created.
4215    pub proof_purpose: Option<ProofPurpose>,
4216    /// The proof value.
4217    pub proof_value: Option<String>,
4218    /// The date and time the proof was created.
4219    pub created: Option<String>,
4220}
4221
4222impl DataIntegrityProof {
4223    /// The type's IRI.
4224    pub const TYPE_IRI: &'static str = "https://w3id.org/security#DataIntegrityProof";
4225    /// The type's `type` in a normalised document.
4226    pub const TYPE: &'static str = "DataIntegrityProof";
4227}
4228
4229impl json::Typed for DataIntegrityProof {
4230    const TYPE: &'static str = "DataIntegrityProof";
4231}
4232
4233impl FromJson for DataIntegrityProof {
4234    fn from_json(value: &Value) -> Result<Self, JsonError> {
4235        let object = json::object(value)?;
4236        json::expect_type(object, Self::TYPE)?;
4237        Ok(Self {
4238            id: json::id(object),
4239            cryptosuite: json::one(object, &["cryptosuite"]),
4240            verification_method: json::one(object, &["verificationMethod"]),
4241            proof_purpose: json::one(object, &["proofPurpose"]),
4242            proof_value: json::one(object, &["proofValue"]),
4243            created: json::one(object, &["created"]),
4244        })
4245    }
4246}
4247
4248impl ToJson for DataIntegrityProof {
4249    fn to_json(&self) -> Value {
4250        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
4251        json::put_one(&mut object, &["cryptosuite"], self.cryptosuite.as_ref());
4252        json::put_one(
4253            &mut object,
4254            &["verificationMethod"],
4255            self.verification_method.as_ref(),
4256        );
4257        json::put_one(&mut object, &["proofPurpose"], self.proof_purpose.as_ref());
4258        json::put_one(&mut object, &["proofValue"], self.proof_value.as_ref());
4259        json::put_one(&mut object, &["created"], self.created.as_ref());
4260        Value::Object(object)
4261    }
4262}
4263
4264/// Indicates that the `actor` has deleted the `object`.  If specified,
4265/// the `origin` indicates the context from which the `object` was deleted.
4266///
4267/// The type `https://www.w3.org/ns/activitystreams#Delete`.
4268#[derive(Clone, Debug, Default, PartialEq)]
4269pub struct Delete {
4270    /// The IRI that identifies this object.
4271    pub id: Option<Iri>,
4272    /// See [`Object::attachments`].
4273    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
4274    /// See [`Object::attributions`].
4275    pub attributions: Vec<AnyActor>,
4276    /// See [`Object::audiences`].
4277    pub audiences: Vec<AnyObject>,
4278    /// See [`Object::content`].
4279    pub content: Text,
4280    /// See [`Object::contexts`].
4281    pub contexts: Vec<LinkOrObject>,
4282    /// See [`Object::name`].
4283    pub name: Text,
4284    /// See [`Object::end_time`].
4285    pub end_time: Option<String>,
4286    /// See [`Object::generators`].
4287    pub generators: Vec<LinkOrObject>,
4288    /// See [`Object::icons`].
4289    pub icons: Vec<Reference<Image>>,
4290    /// See [`Object::images`].
4291    pub images: Vec<Reference<Image>>,
4292    /// See [`Object::reply_targets`].
4293    pub reply_targets: Vec<LinkOrObject>,
4294    /// See [`Object::locations`].
4295    pub locations: Vec<LinkOrObject>,
4296    /// See [`Object::previews`].
4297    pub previews: Vec<LinkOrObject>,
4298    /// See [`Object::published`].
4299    pub published: Option<String>,
4300    /// See [`Object::replies`].
4301    pub replies: Option<AnyCollection>,
4302    /// See [`Object::shares`].
4303    pub shares: Option<AnyCollection>,
4304    /// See [`Object::likes`].
4305    pub likes: Option<AnyCollection>,
4306    /// See [`Object::emoji_reactions`].
4307    pub emoji_reactions: Option<AnyCollection>,
4308    /// See [`Object::start_time`].
4309    pub start_time: Option<String>,
4310    /// See [`Object::summary`].
4311    pub summary: Text,
4312    /// See [`Object::tags`].
4313    pub tags: Vec<LinkOrObject>,
4314    /// See [`Object::updated`].
4315    pub updated: Option<String>,
4316    /// See [`Object::urls`].
4317    pub urls: Vec<LinkOrIri>,
4318    /// See [`Object::tos`].
4319    pub tos: Vec<AnyObject>,
4320    /// See [`Object::btos`].
4321    pub btos: Vec<AnyObject>,
4322    /// See [`Object::ccs`].
4323    pub ccs: Vec<AnyObject>,
4324    /// See [`Object::bccs`].
4325    pub bccs: Vec<AnyObject>,
4326    /// See [`Object::media_type`].
4327    pub media_type: Option<String>,
4328    /// See [`Object::duration`].
4329    pub duration: Option<String>,
4330    /// See [`Object::sensitive`].
4331    pub sensitive: Option<bool>,
4332    /// See [`Object::source`].
4333    pub source: Option<Box<Source>>,
4334    /// See [`Object::proofs`].
4335    pub proofs: Vec<Reference<DataIntegrityProof>>,
4336    /// See [`Object::interaction_policy`].
4337    pub interaction_policy: Option<Box<InteractionPolicy>>,
4338    /// See [`Object::approved_by`].
4339    pub approved_by: Option<Iri>,
4340    /// See [`Object::like_authorization`].
4341    pub like_authorization: Option<Reference<LikeAuthorization>>,
4342    /// See [`Object::reply_authorization`].
4343    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
4344    /// See [`Object::announce_authorization`].
4345    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
4346    /// See [`Object::translations`].
4347    pub translations: Vec<Translation>,
4348    /// See [`Activity::actors`].
4349    pub actors: Vec<AnyActor>,
4350    /// See [`Activity::objects`].
4351    pub objects: Vec<AnyObject>,
4352    /// See [`Activity::targets`].
4353    pub targets: Vec<AnyObject>,
4354    /// See [`Activity::results`].
4355    pub results: Vec<AnyObject>,
4356    /// See [`Activity::origins`].
4357    pub origins: Vec<AnyObject>,
4358    /// See [`Activity::instruments`].
4359    pub instruments: Vec<AnyObject>,
4360    /// Whether what the blocked or deleted person posted is to be removed too.
4361    pub remove_data: Option<bool>,
4362}
4363
4364impl Delete {
4365    /// The type's IRI.
4366    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Delete";
4367    /// The type's `type` in a normalised document.
4368    pub const TYPE: &'static str = "Delete";
4369}
4370
4371impl json::Typed for Delete {
4372    const TYPE: &'static str = "Delete";
4373}
4374
4375impl FromJson for Delete {
4376    fn from_json(value: &Value) -> Result<Self, JsonError> {
4377        let object = json::object(value)?;
4378        json::expect_type(object, Self::TYPE)?;
4379        Ok(Self {
4380            id: json::id(object),
4381            attachments: json::many(object, &["attachment"]),
4382            attributions: json::many(object, &["attributedTo"]),
4383            audiences: json::many(object, &["audience"]),
4384            content: json::text(object, "content"),
4385            contexts: json::many(object, &["context"]),
4386            name: json::text(object, "name"),
4387            end_time: json::one(object, &["endTime"]),
4388            generators: json::many(object, &["generator"]),
4389            icons: json::many_mapped(object, &["icon"], json::link_to_image),
4390            images: json::many_mapped(object, &["image"], json::link_to_image),
4391            reply_targets: json::many(object, &["inReplyTo"]),
4392            locations: json::many(object, &["location"]),
4393            previews: json::many(object, &["preview"]),
4394            published: json::one(object, &["published"]),
4395            replies: json::one(object, &["replies"]),
4396            shares: json::one(object, &["shares"]),
4397            likes: json::one(object, &["likes"]),
4398            emoji_reactions: json::one(object, &["emojiReactions"]),
4399            start_time: json::one(object, &["startTime"]),
4400            summary: json::text(object, "summary"),
4401            tags: json::many(object, &["tag"]),
4402            updated: json::one(object, &["updated"]),
4403            urls: json::many(object, &["url"]),
4404            tos: json::many(object, &["to"]),
4405            btos: json::many(object, &["bto"]),
4406            ccs: json::many(object, &["cc"]),
4407            bccs: json::many(object, &["bcc"]),
4408            media_type: json::one(object, &["mediaType"]),
4409            duration: json::one(object, &["duration"]),
4410            sensitive: json::one(object, &["sensitive"]),
4411            source: json::one(object, &["source"]),
4412            proofs: json::many(object, &["proof"]),
4413            interaction_policy: json::one(object, &["interactionPolicy"]),
4414            approved_by: json::one(object, &["approvedBy"]),
4415            like_authorization: json::one(object, &["likeAuthorization"]),
4416            reply_authorization: json::one(object, &["replyAuthorization"]),
4417            announce_authorization: json::one(object, &["announceAuthorization"]),
4418            translations: json::many(object, &["translations"]),
4419            actors: json::many(object, &["actor"]),
4420            objects: json::many(object, &["object"]),
4421            targets: json::many(object, &["target"]),
4422            results: json::many(object, &["result"]),
4423            origins: json::many(object, &["origin"]),
4424            instruments: json::many(object, &["instrument"]),
4425            remove_data: json::one(object, &["removeData"]),
4426        })
4427    }
4428}
4429
4430impl ToJson for Delete {
4431    fn to_json(&self) -> Value {
4432        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
4433        json::put_many(&mut object, &["attachment"], &self.attachments);
4434        json::put_many(&mut object, &["attributedTo"], &self.attributions);
4435        json::put_many(&mut object, &["audience"], &self.audiences);
4436        json::put_text(&mut object, "content", &self.content);
4437        json::put_many(&mut object, &["context"], &self.contexts);
4438        json::put_text(&mut object, "name", &self.name);
4439        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
4440        json::put_many(&mut object, &["generator"], &self.generators);
4441        json::put_many(&mut object, &["icon"], &self.icons);
4442        json::put_many(&mut object, &["image"], &self.images);
4443        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
4444        json::put_many(&mut object, &["location"], &self.locations);
4445        json::put_many(&mut object, &["preview"], &self.previews);
4446        json::put_one(&mut object, &["published"], self.published.as_ref());
4447        json::put_one(&mut object, &["replies"], self.replies.as_ref());
4448        json::put_one(&mut object, &["shares"], self.shares.as_ref());
4449        json::put_one(&mut object, &["likes"], self.likes.as_ref());
4450        json::put_one(
4451            &mut object,
4452            &["emojiReactions"],
4453            self.emoji_reactions.as_ref(),
4454        );
4455        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
4456        json::put_text(&mut object, "summary", &self.summary);
4457        json::put_many(&mut object, &["tag"], &self.tags);
4458        json::put_one(&mut object, &["updated"], self.updated.as_ref());
4459        json::put_many(&mut object, &["url"], &self.urls);
4460        json::put_many(&mut object, &["to"], &self.tos);
4461        json::put_many(&mut object, &["bto"], &self.btos);
4462        json::put_many(&mut object, &["cc"], &self.ccs);
4463        json::put_many(&mut object, &["bcc"], &self.bccs);
4464        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
4465        json::put_one(&mut object, &["duration"], self.duration.as_ref());
4466        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
4467        json::put_one(&mut object, &["source"], self.source.as_ref());
4468        json::put_many(&mut object, &["proof"], &self.proofs);
4469        json::put_one(
4470            &mut object,
4471            &["interactionPolicy"],
4472            self.interaction_policy.as_ref(),
4473        );
4474        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
4475        json::put_one(
4476            &mut object,
4477            &["likeAuthorization"],
4478            self.like_authorization.as_ref(),
4479        );
4480        json::put_one(
4481            &mut object,
4482            &["replyAuthorization"],
4483            self.reply_authorization.as_ref(),
4484        );
4485        json::put_one(
4486            &mut object,
4487            &["announceAuthorization"],
4488            self.announce_authorization.as_ref(),
4489        );
4490        json::put_many(&mut object, &["translations"], &self.translations);
4491        json::put_many(&mut object, &["actor"], &self.actors);
4492        json::put_many(&mut object, &["object"], &self.objects);
4493        json::put_many(&mut object, &["target"], &self.targets);
4494        json::put_many(&mut object, &["result"], &self.results);
4495        json::put_many(&mut object, &["origin"], &self.origins);
4496        json::put_many(&mut object, &["instrument"], &self.instruments);
4497        json::put_one(&mut object, &["removeData"], self.remove_data.as_ref());
4498        Value::Object(object)
4499    }
4500}
4501
4502/// Means of communicating or interacting with the DID subject or associated
4503/// entities via one or more service endpoints. Examples include discovery
4504/// services, agent services, social networking services, file storage services,
4505/// and verifiable credential repository services.
4506///
4507/// The type `https://www.w3.org/ns/did#Service`.
4508#[derive(Clone, Debug, Default, PartialEq)]
4509pub struct DidService {
4510    /// The IRI that identifies this object.
4511    pub id: Option<Iri>,
4512    /// A network address, such as an HTTP URL, at which services operate on behalf
4513    /// of a DID subject.
4514    pub endpoints: Vec<Iri>,
4515}
4516
4517impl DidService {
4518    /// The type's IRI.
4519    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/did#Service";
4520    /// The type's `type` in a normalised document.
4521    pub const TYPE: &'static str = "https://www.w3.org/ns/did#Service";
4522}
4523
4524impl json::Typed for DidService {
4525    const TYPE: &'static str = "https://www.w3.org/ns/did#Service";
4526}
4527
4528impl FromJson for DidService {
4529    fn from_json(value: &Value) -> Result<Self, JsonError> {
4530        let object = json::object(value)?;
4531        json::expect_type(object, Self::TYPE)?;
4532        Ok(Self {
4533            id: json::id(object),
4534            endpoints: json::many(object, &["https://www.w3.org/ns/did#serviceEndpoint"]),
4535        })
4536    }
4537}
4538
4539impl ToJson for DidService {
4540    fn to_json(&self) -> Value {
4541        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
4542        json::put_many(
4543            &mut object,
4544            &["https://www.w3.org/ns/did#serviceEndpoint"],
4545            &self.endpoints,
4546        );
4547        Value::Object(object)
4548    }
4549}
4550
4551/// Indicates that the `actor` dislikes the `object`.
4552///
4553/// The type `https://www.w3.org/ns/activitystreams#Dislike`.
4554#[derive(Clone, Debug, Default, PartialEq)]
4555pub struct Dislike {
4556    /// The IRI that identifies this object.
4557    pub id: Option<Iri>,
4558    /// See [`Object::attachments`].
4559    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
4560    /// See [`Object::attributions`].
4561    pub attributions: Vec<AnyActor>,
4562    /// See [`Object::audiences`].
4563    pub audiences: Vec<AnyObject>,
4564    /// See [`Object::content`].
4565    pub content: Text,
4566    /// See [`Object::contexts`].
4567    pub contexts: Vec<LinkOrObject>,
4568    /// See [`Object::name`].
4569    pub name: Text,
4570    /// See [`Object::end_time`].
4571    pub end_time: Option<String>,
4572    /// See [`Object::generators`].
4573    pub generators: Vec<LinkOrObject>,
4574    /// See [`Object::icons`].
4575    pub icons: Vec<Reference<Image>>,
4576    /// See [`Object::images`].
4577    pub images: Vec<Reference<Image>>,
4578    /// See [`Object::reply_targets`].
4579    pub reply_targets: Vec<LinkOrObject>,
4580    /// See [`Object::locations`].
4581    pub locations: Vec<LinkOrObject>,
4582    /// See [`Object::previews`].
4583    pub previews: Vec<LinkOrObject>,
4584    /// See [`Object::published`].
4585    pub published: Option<String>,
4586    /// See [`Object::replies`].
4587    pub replies: Option<AnyCollection>,
4588    /// See [`Object::shares`].
4589    pub shares: Option<AnyCollection>,
4590    /// See [`Object::likes`].
4591    pub likes: Option<AnyCollection>,
4592    /// See [`Object::emoji_reactions`].
4593    pub emoji_reactions: Option<AnyCollection>,
4594    /// See [`Object::start_time`].
4595    pub start_time: Option<String>,
4596    /// See [`Object::summary`].
4597    pub summary: Text,
4598    /// See [`Object::tags`].
4599    pub tags: Vec<LinkOrObject>,
4600    /// See [`Object::updated`].
4601    pub updated: Option<String>,
4602    /// See [`Object::urls`].
4603    pub urls: Vec<LinkOrIri>,
4604    /// See [`Object::tos`].
4605    pub tos: Vec<AnyObject>,
4606    /// See [`Object::btos`].
4607    pub btos: Vec<AnyObject>,
4608    /// See [`Object::ccs`].
4609    pub ccs: Vec<AnyObject>,
4610    /// See [`Object::bccs`].
4611    pub bccs: Vec<AnyObject>,
4612    /// See [`Object::media_type`].
4613    pub media_type: Option<String>,
4614    /// See [`Object::duration`].
4615    pub duration: Option<String>,
4616    /// See [`Object::sensitive`].
4617    pub sensitive: Option<bool>,
4618    /// See [`Object::source`].
4619    pub source: Option<Box<Source>>,
4620    /// See [`Object::proofs`].
4621    pub proofs: Vec<Reference<DataIntegrityProof>>,
4622    /// See [`Object::interaction_policy`].
4623    pub interaction_policy: Option<Box<InteractionPolicy>>,
4624    /// See [`Object::approved_by`].
4625    pub approved_by: Option<Iri>,
4626    /// See [`Object::like_authorization`].
4627    pub like_authorization: Option<Reference<LikeAuthorization>>,
4628    /// See [`Object::reply_authorization`].
4629    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
4630    /// See [`Object::announce_authorization`].
4631    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
4632    /// See [`Object::translations`].
4633    pub translations: Vec<Translation>,
4634    /// See [`Activity::actors`].
4635    pub actors: Vec<AnyActor>,
4636    /// See [`Activity::objects`].
4637    pub objects: Vec<AnyObject>,
4638    /// See [`Activity::targets`].
4639    pub targets: Vec<AnyObject>,
4640    /// See [`Activity::results`].
4641    pub results: Vec<AnyObject>,
4642    /// See [`Activity::origins`].
4643    pub origins: Vec<AnyObject>,
4644    /// See [`Activity::instruments`].
4645    pub instruments: Vec<AnyObject>,
4646}
4647
4648impl Dislike {
4649    /// The type's IRI.
4650    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Dislike";
4651    /// The type's `type` in a normalised document.
4652    pub const TYPE: &'static str = "Dislike";
4653}
4654
4655impl json::Typed for Dislike {
4656    const TYPE: &'static str = "Dislike";
4657}
4658
4659impl FromJson for Dislike {
4660    fn from_json(value: &Value) -> Result<Self, JsonError> {
4661        let object = json::object(value)?;
4662        json::expect_type(object, Self::TYPE)?;
4663        Ok(Self {
4664            id: json::id(object),
4665            attachments: json::many(object, &["attachment"]),
4666            attributions: json::many(object, &["attributedTo"]),
4667            audiences: json::many(object, &["audience"]),
4668            content: json::text(object, "content"),
4669            contexts: json::many(object, &["context"]),
4670            name: json::text(object, "name"),
4671            end_time: json::one(object, &["endTime"]),
4672            generators: json::many(object, &["generator"]),
4673            icons: json::many_mapped(object, &["icon"], json::link_to_image),
4674            images: json::many_mapped(object, &["image"], json::link_to_image),
4675            reply_targets: json::many(object, &["inReplyTo"]),
4676            locations: json::many(object, &["location"]),
4677            previews: json::many(object, &["preview"]),
4678            published: json::one(object, &["published"]),
4679            replies: json::one(object, &["replies"]),
4680            shares: json::one(object, &["shares"]),
4681            likes: json::one(object, &["likes"]),
4682            emoji_reactions: json::one(object, &["emojiReactions"]),
4683            start_time: json::one(object, &["startTime"]),
4684            summary: json::text(object, "summary"),
4685            tags: json::many(object, &["tag"]),
4686            updated: json::one(object, &["updated"]),
4687            urls: json::many(object, &["url"]),
4688            tos: json::many(object, &["to"]),
4689            btos: json::many(object, &["bto"]),
4690            ccs: json::many(object, &["cc"]),
4691            bccs: json::many(object, &["bcc"]),
4692            media_type: json::one(object, &["mediaType"]),
4693            duration: json::one(object, &["duration"]),
4694            sensitive: json::one(object, &["sensitive"]),
4695            source: json::one(object, &["source"]),
4696            proofs: json::many(object, &["proof"]),
4697            interaction_policy: json::one(object, &["interactionPolicy"]),
4698            approved_by: json::one(object, &["approvedBy"]),
4699            like_authorization: json::one(object, &["likeAuthorization"]),
4700            reply_authorization: json::one(object, &["replyAuthorization"]),
4701            announce_authorization: json::one(object, &["announceAuthorization"]),
4702            translations: json::many(object, &["translations"]),
4703            actors: json::many(object, &["actor"]),
4704            objects: json::many(object, &["object"]),
4705            targets: json::many(object, &["target"]),
4706            results: json::many(object, &["result"]),
4707            origins: json::many(object, &["origin"]),
4708            instruments: json::many(object, &["instrument"]),
4709        })
4710    }
4711}
4712
4713impl ToJson for Dislike {
4714    fn to_json(&self) -> Value {
4715        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
4716        json::put_many(&mut object, &["attachment"], &self.attachments);
4717        json::put_many(&mut object, &["attributedTo"], &self.attributions);
4718        json::put_many(&mut object, &["audience"], &self.audiences);
4719        json::put_text(&mut object, "content", &self.content);
4720        json::put_many(&mut object, &["context"], &self.contexts);
4721        json::put_text(&mut object, "name", &self.name);
4722        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
4723        json::put_many(&mut object, &["generator"], &self.generators);
4724        json::put_many(&mut object, &["icon"], &self.icons);
4725        json::put_many(&mut object, &["image"], &self.images);
4726        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
4727        json::put_many(&mut object, &["location"], &self.locations);
4728        json::put_many(&mut object, &["preview"], &self.previews);
4729        json::put_one(&mut object, &["published"], self.published.as_ref());
4730        json::put_one(&mut object, &["replies"], self.replies.as_ref());
4731        json::put_one(&mut object, &["shares"], self.shares.as_ref());
4732        json::put_one(&mut object, &["likes"], self.likes.as_ref());
4733        json::put_one(
4734            &mut object,
4735            &["emojiReactions"],
4736            self.emoji_reactions.as_ref(),
4737        );
4738        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
4739        json::put_text(&mut object, "summary", &self.summary);
4740        json::put_many(&mut object, &["tag"], &self.tags);
4741        json::put_one(&mut object, &["updated"], self.updated.as_ref());
4742        json::put_many(&mut object, &["url"], &self.urls);
4743        json::put_many(&mut object, &["to"], &self.tos);
4744        json::put_many(&mut object, &["bto"], &self.btos);
4745        json::put_many(&mut object, &["cc"], &self.ccs);
4746        json::put_many(&mut object, &["bcc"], &self.bccs);
4747        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
4748        json::put_one(&mut object, &["duration"], self.duration.as_ref());
4749        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
4750        json::put_one(&mut object, &["source"], self.source.as_ref());
4751        json::put_many(&mut object, &["proof"], &self.proofs);
4752        json::put_one(
4753            &mut object,
4754            &["interactionPolicy"],
4755            self.interaction_policy.as_ref(),
4756        );
4757        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
4758        json::put_one(
4759            &mut object,
4760            &["likeAuthorization"],
4761            self.like_authorization.as_ref(),
4762        );
4763        json::put_one(
4764            &mut object,
4765            &["replyAuthorization"],
4766            self.reply_authorization.as_ref(),
4767        );
4768        json::put_one(
4769            &mut object,
4770            &["announceAuthorization"],
4771            self.announce_authorization.as_ref(),
4772        );
4773        json::put_many(&mut object, &["translations"], &self.translations);
4774        json::put_many(&mut object, &["actor"], &self.actors);
4775        json::put_many(&mut object, &["object"], &self.objects);
4776        json::put_many(&mut object, &["target"], &self.targets);
4777        json::put_many(&mut object, &["result"], &self.results);
4778        json::put_many(&mut object, &["origin"], &self.origins);
4779        json::put_many(&mut object, &["instrument"], &self.instruments);
4780        Value::Object(object)
4781    }
4782}
4783
4784/// Represents a document of any kind.
4785///
4786/// The type `https://www.w3.org/ns/activitystreams#Document`.
4787#[derive(Clone, Debug, Default, PartialEq)]
4788pub struct Document {
4789    /// The IRI that identifies this object.
4790    pub id: Option<Iri>,
4791    /// See [`Object::attachments`].
4792    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
4793    /// See [`Object::attributions`].
4794    pub attributions: Vec<AnyActor>,
4795    /// See [`Object::audiences`].
4796    pub audiences: Vec<AnyObject>,
4797    /// See [`Object::content`].
4798    pub content: Text,
4799    /// See [`Object::contexts`].
4800    pub contexts: Vec<LinkOrObject>,
4801    /// See [`Object::name`].
4802    pub name: Text,
4803    /// See [`Object::end_time`].
4804    pub end_time: Option<String>,
4805    /// See [`Object::generators`].
4806    pub generators: Vec<LinkOrObject>,
4807    /// See [`Object::icons`].
4808    pub icons: Vec<Reference<Image>>,
4809    /// See [`Object::images`].
4810    pub images: Vec<Reference<Image>>,
4811    /// See [`Object::reply_targets`].
4812    pub reply_targets: Vec<LinkOrObject>,
4813    /// See [`Object::locations`].
4814    pub locations: Vec<LinkOrObject>,
4815    /// See [`Object::previews`].
4816    pub previews: Vec<LinkOrObject>,
4817    /// See [`Object::published`].
4818    pub published: Option<String>,
4819    /// See [`Object::replies`].
4820    pub replies: Option<AnyCollection>,
4821    /// See [`Object::shares`].
4822    pub shares: Option<AnyCollection>,
4823    /// See [`Object::likes`].
4824    pub likes: Option<AnyCollection>,
4825    /// See [`Object::emoji_reactions`].
4826    pub emoji_reactions: Option<AnyCollection>,
4827    /// See [`Object::start_time`].
4828    pub start_time: Option<String>,
4829    /// See [`Object::summary`].
4830    pub summary: Text,
4831    /// See [`Object::tags`].
4832    pub tags: Vec<LinkOrObject>,
4833    /// See [`Object::updated`].
4834    pub updated: Option<String>,
4835    /// See [`Object::urls`].
4836    pub urls: Vec<LinkOrIri>,
4837    /// See [`Object::tos`].
4838    pub tos: Vec<AnyObject>,
4839    /// See [`Object::btos`].
4840    pub btos: Vec<AnyObject>,
4841    /// See [`Object::ccs`].
4842    pub ccs: Vec<AnyObject>,
4843    /// See [`Object::bccs`].
4844    pub bccs: Vec<AnyObject>,
4845    /// See [`Object::media_type`].
4846    pub media_type: Option<String>,
4847    /// See [`Object::duration`].
4848    pub duration: Option<String>,
4849    /// See [`Object::sensitive`].
4850    pub sensitive: Option<bool>,
4851    /// See [`Object::source`].
4852    pub source: Option<Box<Source>>,
4853    /// See [`Object::proofs`].
4854    pub proofs: Vec<Reference<DataIntegrityProof>>,
4855    /// See [`Object::interaction_policy`].
4856    pub interaction_policy: Option<Box<InteractionPolicy>>,
4857    /// See [`Object::approved_by`].
4858    pub approved_by: Option<Iri>,
4859    /// See [`Object::like_authorization`].
4860    pub like_authorization: Option<Reference<LikeAuthorization>>,
4861    /// See [`Object::reply_authorization`].
4862    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
4863    /// See [`Object::announce_authorization`].
4864    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
4865    /// See [`Object::translations`].
4866    pub translations: Vec<Translation>,
4867    /// Specifies a hint as to the rendering width in
4868    /// device-independent pixels of the linked resource.
4869    pub width: Option<u64>,
4870    /// Specifies a hint as to the rendering height in
4871    /// device-independent pixels of the linked resource.
4872    pub height: Option<u64>,
4873    /// The multibase-encoded integrity digest of an external resource represented
4874    /// by this document.
4875    pub digest_multibase: Option<String>,
4876    /// A BlurHash of the media, drawn while it loads.
4877    pub blurhash: Option<String>,
4878    /// The point a crop of the media keeps in view, as x and y from -1 to 1.
4879    pub focal_point: Vec<f64>,
4880}
4881
4882impl Document {
4883    /// The type's IRI.
4884    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Document";
4885    /// The type's `type` in a normalised document.
4886    pub const TYPE: &'static str = "Document";
4887}
4888
4889impl json::Typed for Document {
4890    const TYPE: &'static str = "Document";
4891}
4892
4893impl FromJson for Document {
4894    fn from_json(value: &Value) -> Result<Self, JsonError> {
4895        let object = json::object(value)?;
4896        json::expect_type(object, Self::TYPE)?;
4897        Ok(Self {
4898            id: json::id(object),
4899            attachments: json::many(object, &["attachment"]),
4900            attributions: json::many(object, &["attributedTo"]),
4901            audiences: json::many(object, &["audience"]),
4902            content: json::text(object, "content"),
4903            contexts: json::many(object, &["context"]),
4904            name: json::text(object, "name"),
4905            end_time: json::one(object, &["endTime"]),
4906            generators: json::many(object, &["generator"]),
4907            icons: json::many_mapped(object, &["icon"], json::link_to_image),
4908            images: json::many_mapped(object, &["image"], json::link_to_image),
4909            reply_targets: json::many(object, &["inReplyTo"]),
4910            locations: json::many(object, &["location"]),
4911            previews: json::many(object, &["preview"]),
4912            published: json::one(object, &["published"]),
4913            replies: json::one(object, &["replies"]),
4914            shares: json::one(object, &["shares"]),
4915            likes: json::one(object, &["likes"]),
4916            emoji_reactions: json::one(object, &["emojiReactions"]),
4917            start_time: json::one(object, &["startTime"]),
4918            summary: json::text(object, "summary"),
4919            tags: json::many(object, &["tag"]),
4920            updated: json::one(object, &["updated"]),
4921            urls: json::many(object, &["url"]),
4922            tos: json::many(object, &["to"]),
4923            btos: json::many(object, &["bto"]),
4924            ccs: json::many(object, &["cc"]),
4925            bccs: json::many(object, &["bcc"]),
4926            media_type: json::one(object, &["mediaType"]),
4927            duration: json::one(object, &["duration"]),
4928            sensitive: json::one(object, &["sensitive"]),
4929            source: json::one(object, &["source"]),
4930            proofs: json::many(object, &["proof"]),
4931            interaction_policy: json::one(object, &["interactionPolicy"]),
4932            approved_by: json::one(object, &["approvedBy"]),
4933            like_authorization: json::one(object, &["likeAuthorization"]),
4934            reply_authorization: json::one(object, &["replyAuthorization"]),
4935            announce_authorization: json::one(object, &["announceAuthorization"]),
4936            translations: json::many(object, &["translations"]),
4937            width: json::one(object, &["width"]),
4938            height: json::one(object, &["height"]),
4939            digest_multibase: json::one(object, &["digestMultibase"]),
4940            blurhash: json::one(object, &["blurhash"]),
4941            focal_point: json::many(object, &["focalPoint"]),
4942        })
4943    }
4944}
4945
4946impl ToJson for Document {
4947    fn to_json(&self) -> Value {
4948        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
4949        json::put_many(&mut object, &["attachment"], &self.attachments);
4950        json::put_many(&mut object, &["attributedTo"], &self.attributions);
4951        json::put_many(&mut object, &["audience"], &self.audiences);
4952        json::put_text(&mut object, "content", &self.content);
4953        json::put_many(&mut object, &["context"], &self.contexts);
4954        json::put_text(&mut object, "name", &self.name);
4955        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
4956        json::put_many(&mut object, &["generator"], &self.generators);
4957        json::put_many(&mut object, &["icon"], &self.icons);
4958        json::put_many(&mut object, &["image"], &self.images);
4959        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
4960        json::put_many(&mut object, &["location"], &self.locations);
4961        json::put_many(&mut object, &["preview"], &self.previews);
4962        json::put_one(&mut object, &["published"], self.published.as_ref());
4963        json::put_one(&mut object, &["replies"], self.replies.as_ref());
4964        json::put_one(&mut object, &["shares"], self.shares.as_ref());
4965        json::put_one(&mut object, &["likes"], self.likes.as_ref());
4966        json::put_one(
4967            &mut object,
4968            &["emojiReactions"],
4969            self.emoji_reactions.as_ref(),
4970        );
4971        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
4972        json::put_text(&mut object, "summary", &self.summary);
4973        json::put_many(&mut object, &["tag"], &self.tags);
4974        json::put_one(&mut object, &["updated"], self.updated.as_ref());
4975        json::put_many(&mut object, &["url"], &self.urls);
4976        json::put_many(&mut object, &["to"], &self.tos);
4977        json::put_many(&mut object, &["bto"], &self.btos);
4978        json::put_many(&mut object, &["cc"], &self.ccs);
4979        json::put_many(&mut object, &["bcc"], &self.bccs);
4980        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
4981        json::put_one(&mut object, &["duration"], self.duration.as_ref());
4982        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
4983        json::put_one(&mut object, &["source"], self.source.as_ref());
4984        json::put_many(&mut object, &["proof"], &self.proofs);
4985        json::put_one(
4986            &mut object,
4987            &["interactionPolicy"],
4988            self.interaction_policy.as_ref(),
4989        );
4990        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
4991        json::put_one(
4992            &mut object,
4993            &["likeAuthorization"],
4994            self.like_authorization.as_ref(),
4995        );
4996        json::put_one(
4997            &mut object,
4998            &["replyAuthorization"],
4999            self.reply_authorization.as_ref(),
5000        );
5001        json::put_one(
5002            &mut object,
5003            &["announceAuthorization"],
5004            self.announce_authorization.as_ref(),
5005        );
5006        json::put_many(&mut object, &["translations"], &self.translations);
5007        json::put_one(&mut object, &["width"], self.width.as_ref());
5008        json::put_one(&mut object, &["height"], self.height.as_ref());
5009        json::put_one(
5010            &mut object,
5011            &["digestMultibase"],
5012            self.digest_multibase.as_ref(),
5013        );
5014        json::put_one(&mut object, &["blurhash"], self.blurhash.as_ref());
5015        json::put_many(&mut object, &["focalPoint"], &self.focal_point);
5016        Value::Object(object)
5017    }
5018}
5019
5020/// Represents a custom emoji.
5021///
5022/// The type `http://joinmastodon.org/ns#Emoji`.
5023#[derive(Clone, Debug, Default, PartialEq)]
5024pub struct Emoji {
5025    /// The IRI that identifies this object.
5026    pub id: Option<Iri>,
5027    /// See [`Object::attachments`].
5028    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
5029    /// See [`Object::attributions`].
5030    pub attributions: Vec<AnyActor>,
5031    /// See [`Object::audiences`].
5032    pub audiences: Vec<AnyObject>,
5033    /// See [`Object::content`].
5034    pub content: Text,
5035    /// See [`Object::contexts`].
5036    pub contexts: Vec<LinkOrObject>,
5037    /// See [`Object::name`].
5038    pub name: Text,
5039    /// See [`Object::end_time`].
5040    pub end_time: Option<String>,
5041    /// See [`Object::generators`].
5042    pub generators: Vec<LinkOrObject>,
5043    /// See [`Object::icons`].
5044    pub icons: Vec<Reference<Image>>,
5045    /// See [`Object::images`].
5046    pub images: Vec<Reference<Image>>,
5047    /// See [`Object::reply_targets`].
5048    pub reply_targets: Vec<LinkOrObject>,
5049    /// See [`Object::locations`].
5050    pub locations: Vec<LinkOrObject>,
5051    /// See [`Object::previews`].
5052    pub previews: Vec<LinkOrObject>,
5053    /// See [`Object::published`].
5054    pub published: Option<String>,
5055    /// See [`Object::replies`].
5056    pub replies: Option<AnyCollection>,
5057    /// See [`Object::shares`].
5058    pub shares: Option<AnyCollection>,
5059    /// See [`Object::likes`].
5060    pub likes: Option<AnyCollection>,
5061    /// See [`Object::emoji_reactions`].
5062    pub emoji_reactions: Option<AnyCollection>,
5063    /// See [`Object::start_time`].
5064    pub start_time: Option<String>,
5065    /// See [`Object::summary`].
5066    pub summary: Text,
5067    /// See [`Object::tags`].
5068    pub tags: Vec<LinkOrObject>,
5069    /// See [`Object::updated`].
5070    pub updated: Option<String>,
5071    /// See [`Object::urls`].
5072    pub urls: Vec<LinkOrIri>,
5073    /// See [`Object::tos`].
5074    pub tos: Vec<AnyObject>,
5075    /// See [`Object::btos`].
5076    pub btos: Vec<AnyObject>,
5077    /// See [`Object::ccs`].
5078    pub ccs: Vec<AnyObject>,
5079    /// See [`Object::bccs`].
5080    pub bccs: Vec<AnyObject>,
5081    /// See [`Object::media_type`].
5082    pub media_type: Option<String>,
5083    /// See [`Object::duration`].
5084    pub duration: Option<String>,
5085    /// See [`Object::sensitive`].
5086    pub sensitive: Option<bool>,
5087    /// See [`Object::source`].
5088    pub source: Option<Box<Source>>,
5089    /// See [`Object::proofs`].
5090    pub proofs: Vec<Reference<DataIntegrityProof>>,
5091    /// See [`Object::interaction_policy`].
5092    pub interaction_policy: Option<Box<InteractionPolicy>>,
5093    /// See [`Object::approved_by`].
5094    pub approved_by: Option<Iri>,
5095    /// See [`Object::like_authorization`].
5096    pub like_authorization: Option<Reference<LikeAuthorization>>,
5097    /// See [`Object::reply_authorization`].
5098    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
5099    /// See [`Object::announce_authorization`].
5100    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
5101    /// See [`Object::translations`].
5102    pub translations: Vec<Translation>,
5103}
5104
5105impl Emoji {
5106    /// The type's IRI.
5107    pub const TYPE_IRI: &'static str = "http://joinmastodon.org/ns#Emoji";
5108    /// The type's `type` in a normalised document.
5109    pub const TYPE: &'static str = "Emoji";
5110}
5111
5112impl json::Typed for Emoji {
5113    const TYPE: &'static str = "Emoji";
5114}
5115
5116impl FromJson for Emoji {
5117    fn from_json(value: &Value) -> Result<Self, JsonError> {
5118        let object = json::object(value)?;
5119        json::expect_type(object, Self::TYPE)?;
5120        Ok(Self {
5121            id: json::id(object),
5122            attachments: json::many(object, &["attachment"]),
5123            attributions: json::many(object, &["attributedTo"]),
5124            audiences: json::many(object, &["audience"]),
5125            content: json::text(object, "content"),
5126            contexts: json::many(object, &["context"]),
5127            name: json::text(object, "name"),
5128            end_time: json::one(object, &["endTime"]),
5129            generators: json::many(object, &["generator"]),
5130            icons: json::many_mapped(object, &["icon"], json::link_to_image),
5131            images: json::many_mapped(object, &["image"], json::link_to_image),
5132            reply_targets: json::many(object, &["inReplyTo"]),
5133            locations: json::many(object, &["location"]),
5134            previews: json::many(object, &["preview"]),
5135            published: json::one(object, &["published"]),
5136            replies: json::one(object, &["replies"]),
5137            shares: json::one(object, &["shares"]),
5138            likes: json::one(object, &["likes"]),
5139            emoji_reactions: json::one(object, &["emojiReactions"]),
5140            start_time: json::one(object, &["startTime"]),
5141            summary: json::text(object, "summary"),
5142            tags: json::many(object, &["tag"]),
5143            updated: json::one(object, &["updated"]),
5144            urls: json::many(object, &["url"]),
5145            tos: json::many(object, &["to"]),
5146            btos: json::many(object, &["bto"]),
5147            ccs: json::many(object, &["cc"]),
5148            bccs: json::many(object, &["bcc"]),
5149            media_type: json::one(object, &["mediaType"]),
5150            duration: json::one(object, &["duration"]),
5151            sensitive: json::one(object, &["sensitive"]),
5152            source: json::one(object, &["source"]),
5153            proofs: json::many(object, &["proof"]),
5154            interaction_policy: json::one(object, &["interactionPolicy"]),
5155            approved_by: json::one(object, &["approvedBy"]),
5156            like_authorization: json::one(object, &["likeAuthorization"]),
5157            reply_authorization: json::one(object, &["replyAuthorization"]),
5158            announce_authorization: json::one(object, &["announceAuthorization"]),
5159            translations: json::many(object, &["translations"]),
5160        })
5161    }
5162}
5163
5164impl ToJson for Emoji {
5165    fn to_json(&self) -> Value {
5166        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
5167        json::put_many(&mut object, &["attachment"], &self.attachments);
5168        json::put_many(&mut object, &["attributedTo"], &self.attributions);
5169        json::put_many(&mut object, &["audience"], &self.audiences);
5170        json::put_text(&mut object, "content", &self.content);
5171        json::put_many(&mut object, &["context"], &self.contexts);
5172        json::put_text(&mut object, "name", &self.name);
5173        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
5174        json::put_many(&mut object, &["generator"], &self.generators);
5175        json::put_many(&mut object, &["icon"], &self.icons);
5176        json::put_many(&mut object, &["image"], &self.images);
5177        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
5178        json::put_many(&mut object, &["location"], &self.locations);
5179        json::put_many(&mut object, &["preview"], &self.previews);
5180        json::put_one(&mut object, &["published"], self.published.as_ref());
5181        json::put_one(&mut object, &["replies"], self.replies.as_ref());
5182        json::put_one(&mut object, &["shares"], self.shares.as_ref());
5183        json::put_one(&mut object, &["likes"], self.likes.as_ref());
5184        json::put_one(
5185            &mut object,
5186            &["emojiReactions"],
5187            self.emoji_reactions.as_ref(),
5188        );
5189        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
5190        json::put_text(&mut object, "summary", &self.summary);
5191        json::put_many(&mut object, &["tag"], &self.tags);
5192        json::put_one(&mut object, &["updated"], self.updated.as_ref());
5193        json::put_many(&mut object, &["url"], &self.urls);
5194        json::put_many(&mut object, &["to"], &self.tos);
5195        json::put_many(&mut object, &["bto"], &self.btos);
5196        json::put_many(&mut object, &["cc"], &self.ccs);
5197        json::put_many(&mut object, &["bcc"], &self.bccs);
5198        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
5199        json::put_one(&mut object, &["duration"], self.duration.as_ref());
5200        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
5201        json::put_one(&mut object, &["source"], self.source.as_ref());
5202        json::put_many(&mut object, &["proof"], &self.proofs);
5203        json::put_one(
5204            &mut object,
5205            &["interactionPolicy"],
5206            self.interaction_policy.as_ref(),
5207        );
5208        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
5209        json::put_one(
5210            &mut object,
5211            &["likeAuthorization"],
5212            self.like_authorization.as_ref(),
5213        );
5214        json::put_one(
5215            &mut object,
5216            &["replyAuthorization"],
5217            self.reply_authorization.as_ref(),
5218        );
5219        json::put_one(
5220            &mut object,
5221            &["announceAuthorization"],
5222            self.announce_authorization.as_ref(),
5223        );
5224        json::put_many(&mut object, &["translations"], &self.translations);
5225        Value::Object(object)
5226    }
5227}
5228
5229/// Represents an emoji reaction.  See also [FEP-c0e0](https://w3id.org/fep/c0e0).
5230///
5231/// The type `http://litepub.social/ns#EmojiReact`.
5232#[derive(Clone, Debug, Default, PartialEq)]
5233pub struct EmojiReact {
5234    /// The IRI that identifies this object.
5235    pub id: Option<Iri>,
5236    /// See [`Object::attachments`].
5237    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
5238    /// See [`Object::attributions`].
5239    pub attributions: Vec<AnyActor>,
5240    /// See [`Object::audiences`].
5241    pub audiences: Vec<AnyObject>,
5242    /// See [`Object::content`].
5243    pub content: Text,
5244    /// See [`Object::contexts`].
5245    pub contexts: Vec<LinkOrObject>,
5246    /// See [`Object::name`].
5247    pub name: Text,
5248    /// See [`Object::end_time`].
5249    pub end_time: Option<String>,
5250    /// See [`Object::generators`].
5251    pub generators: Vec<LinkOrObject>,
5252    /// See [`Object::icons`].
5253    pub icons: Vec<Reference<Image>>,
5254    /// See [`Object::images`].
5255    pub images: Vec<Reference<Image>>,
5256    /// See [`Object::reply_targets`].
5257    pub reply_targets: Vec<LinkOrObject>,
5258    /// See [`Object::locations`].
5259    pub locations: Vec<LinkOrObject>,
5260    /// See [`Object::previews`].
5261    pub previews: Vec<LinkOrObject>,
5262    /// See [`Object::published`].
5263    pub published: Option<String>,
5264    /// See [`Object::replies`].
5265    pub replies: Option<AnyCollection>,
5266    /// See [`Object::shares`].
5267    pub shares: Option<AnyCollection>,
5268    /// See [`Object::likes`].
5269    pub likes: Option<AnyCollection>,
5270    /// See [`Object::emoji_reactions`].
5271    pub emoji_reactions: Option<AnyCollection>,
5272    /// See [`Object::start_time`].
5273    pub start_time: Option<String>,
5274    /// See [`Object::summary`].
5275    pub summary: Text,
5276    /// See [`Object::tags`].
5277    pub tags: Vec<LinkOrObject>,
5278    /// See [`Object::updated`].
5279    pub updated: Option<String>,
5280    /// See [`Object::urls`].
5281    pub urls: Vec<LinkOrIri>,
5282    /// See [`Object::tos`].
5283    pub tos: Vec<AnyObject>,
5284    /// See [`Object::btos`].
5285    pub btos: Vec<AnyObject>,
5286    /// See [`Object::ccs`].
5287    pub ccs: Vec<AnyObject>,
5288    /// See [`Object::bccs`].
5289    pub bccs: Vec<AnyObject>,
5290    /// See [`Object::media_type`].
5291    pub media_type: Option<String>,
5292    /// See [`Object::duration`].
5293    pub duration: Option<String>,
5294    /// See [`Object::sensitive`].
5295    pub sensitive: Option<bool>,
5296    /// See [`Object::source`].
5297    pub source: Option<Box<Source>>,
5298    /// See [`Object::proofs`].
5299    pub proofs: Vec<Reference<DataIntegrityProof>>,
5300    /// See [`Object::interaction_policy`].
5301    pub interaction_policy: Option<Box<InteractionPolicy>>,
5302    /// See [`Object::approved_by`].
5303    pub approved_by: Option<Iri>,
5304    /// See [`Object::like_authorization`].
5305    pub like_authorization: Option<Reference<LikeAuthorization>>,
5306    /// See [`Object::reply_authorization`].
5307    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
5308    /// See [`Object::announce_authorization`].
5309    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
5310    /// See [`Object::translations`].
5311    pub translations: Vec<Translation>,
5312    /// See [`Activity::actors`].
5313    pub actors: Vec<AnyActor>,
5314    /// See [`Activity::objects`].
5315    pub objects: Vec<AnyObject>,
5316    /// See [`Activity::targets`].
5317    pub targets: Vec<AnyObject>,
5318    /// See [`Activity::results`].
5319    pub results: Vec<AnyObject>,
5320    /// See [`Activity::origins`].
5321    pub origins: Vec<AnyObject>,
5322    /// See [`Activity::instruments`].
5323    pub instruments: Vec<AnyObject>,
5324}
5325
5326impl EmojiReact {
5327    /// The type's IRI.
5328    pub const TYPE_IRI: &'static str = "http://litepub.social/ns#EmojiReact";
5329    /// The type's `type` in a normalised document.
5330    pub const TYPE: &'static str = "EmojiReact";
5331}
5332
5333impl json::Typed for EmojiReact {
5334    const TYPE: &'static str = "EmojiReact";
5335}
5336
5337impl FromJson for EmojiReact {
5338    fn from_json(value: &Value) -> Result<Self, JsonError> {
5339        let object = json::object(value)?;
5340        json::expect_type(object, Self::TYPE)?;
5341        Ok(Self {
5342            id: json::id(object),
5343            attachments: json::many(object, &["attachment"]),
5344            attributions: json::many(object, &["attributedTo"]),
5345            audiences: json::many(object, &["audience"]),
5346            content: json::text(object, "content"),
5347            contexts: json::many(object, &["context"]),
5348            name: json::text(object, "name"),
5349            end_time: json::one(object, &["endTime"]),
5350            generators: json::many(object, &["generator"]),
5351            icons: json::many_mapped(object, &["icon"], json::link_to_image),
5352            images: json::many_mapped(object, &["image"], json::link_to_image),
5353            reply_targets: json::many(object, &["inReplyTo"]),
5354            locations: json::many(object, &["location"]),
5355            previews: json::many(object, &["preview"]),
5356            published: json::one(object, &["published"]),
5357            replies: json::one(object, &["replies"]),
5358            shares: json::one(object, &["shares"]),
5359            likes: json::one(object, &["likes"]),
5360            emoji_reactions: json::one(object, &["emojiReactions"]),
5361            start_time: json::one(object, &["startTime"]),
5362            summary: json::text(object, "summary"),
5363            tags: json::many(object, &["tag"]),
5364            updated: json::one(object, &["updated"]),
5365            urls: json::many(object, &["url"]),
5366            tos: json::many(object, &["to"]),
5367            btos: json::many(object, &["bto"]),
5368            ccs: json::many(object, &["cc"]),
5369            bccs: json::many(object, &["bcc"]),
5370            media_type: json::one(object, &["mediaType"]),
5371            duration: json::one(object, &["duration"]),
5372            sensitive: json::one(object, &["sensitive"]),
5373            source: json::one(object, &["source"]),
5374            proofs: json::many(object, &["proof"]),
5375            interaction_policy: json::one(object, &["interactionPolicy"]),
5376            approved_by: json::one(object, &["approvedBy"]),
5377            like_authorization: json::one(object, &["likeAuthorization"]),
5378            reply_authorization: json::one(object, &["replyAuthorization"]),
5379            announce_authorization: json::one(object, &["announceAuthorization"]),
5380            translations: json::many(object, &["translations"]),
5381            actors: json::many(object, &["actor"]),
5382            objects: json::many(object, &["object"]),
5383            targets: json::many(object, &["target"]),
5384            results: json::many(object, &["result"]),
5385            origins: json::many(object, &["origin"]),
5386            instruments: json::many(object, &["instrument"]),
5387        })
5388    }
5389}
5390
5391impl ToJson for EmojiReact {
5392    fn to_json(&self) -> Value {
5393        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
5394        json::put_many(&mut object, &["attachment"], &self.attachments);
5395        json::put_many(&mut object, &["attributedTo"], &self.attributions);
5396        json::put_many(&mut object, &["audience"], &self.audiences);
5397        json::put_text(&mut object, "content", &self.content);
5398        json::put_many(&mut object, &["context"], &self.contexts);
5399        json::put_text(&mut object, "name", &self.name);
5400        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
5401        json::put_many(&mut object, &["generator"], &self.generators);
5402        json::put_many(&mut object, &["icon"], &self.icons);
5403        json::put_many(&mut object, &["image"], &self.images);
5404        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
5405        json::put_many(&mut object, &["location"], &self.locations);
5406        json::put_many(&mut object, &["preview"], &self.previews);
5407        json::put_one(&mut object, &["published"], self.published.as_ref());
5408        json::put_one(&mut object, &["replies"], self.replies.as_ref());
5409        json::put_one(&mut object, &["shares"], self.shares.as_ref());
5410        json::put_one(&mut object, &["likes"], self.likes.as_ref());
5411        json::put_one(
5412            &mut object,
5413            &["emojiReactions"],
5414            self.emoji_reactions.as_ref(),
5415        );
5416        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
5417        json::put_text(&mut object, "summary", &self.summary);
5418        json::put_many(&mut object, &["tag"], &self.tags);
5419        json::put_one(&mut object, &["updated"], self.updated.as_ref());
5420        json::put_many(&mut object, &["url"], &self.urls);
5421        json::put_many(&mut object, &["to"], &self.tos);
5422        json::put_many(&mut object, &["bto"], &self.btos);
5423        json::put_many(&mut object, &["cc"], &self.ccs);
5424        json::put_many(&mut object, &["bcc"], &self.bccs);
5425        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
5426        json::put_one(&mut object, &["duration"], self.duration.as_ref());
5427        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
5428        json::put_one(&mut object, &["source"], self.source.as_ref());
5429        json::put_many(&mut object, &["proof"], &self.proofs);
5430        json::put_one(
5431            &mut object,
5432            &["interactionPolicy"],
5433            self.interaction_policy.as_ref(),
5434        );
5435        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
5436        json::put_one(
5437            &mut object,
5438            &["likeAuthorization"],
5439            self.like_authorization.as_ref(),
5440        );
5441        json::put_one(
5442            &mut object,
5443            &["replyAuthorization"],
5444            self.reply_authorization.as_ref(),
5445        );
5446        json::put_one(
5447            &mut object,
5448            &["announceAuthorization"],
5449            self.announce_authorization.as_ref(),
5450        );
5451        json::put_many(&mut object, &["translations"], &self.translations);
5452        json::put_many(&mut object, &["actor"], &self.actors);
5453        json::put_many(&mut object, &["object"], &self.objects);
5454        json::put_many(&mut object, &["target"], &self.targets);
5455        json::put_many(&mut object, &["result"], &self.results);
5456        json::put_many(&mut object, &["origin"], &self.origins);
5457        json::put_many(&mut object, &["instrument"], &self.instruments);
5458        Value::Object(object)
5459    }
5460}
5461
5462/// Contents of {@link Actor}'s `endpoints`.
5463///
5464/// The type `https://www.w3.org/ns/activitystreams#Endpoints`.
5465#[derive(Clone, Debug, Default, PartialEq)]
5466pub struct Endpoints {
5467    /// Endpoint URI so this actor's clients may access remote ActivityStreams
5468    /// objects which require authentication to access.  To use this endpoint,
5469    /// the client posts an `x-www-form-urlencoded` `id` parameter with the value
5470    /// being the `id` of the requested ActivityStreams object.
5471    pub proxy_url: Option<Iri>,
5472    /// If OAuth 2.0 bearer tokens \[RFC 6749\] \[RFC 6750\] are being used for
5473    /// authenticating [client to server
5474    /// interactions](https://www.w3.org/TR/activitypub/#client-to-server-interactions),
5475    /// this endpoint specifies a URI at which a browser-authenticated user may
5476    /// obtain a new authorization grant.
5477    pub oauth_authorization_endpoint: Option<Iri>,
5478    /// If OAuth 2.0 bearer tokens \[RFC 6749\] \[RFC 6750\] are being used for
5479    /// authenticating [client to server
5480    /// interactions](https://www.w3.org/TR/activitypub/#client-to-server-interactions),
5481    /// this endpoint specifies a URI at which a client may acquire an access token.
5482    pub oauth_token_endpoint: Option<Iri>,
5483    /// If Linked Data Signatures and HTTP Signatures are being used for
5484    /// authentication and authorization, this endpoint specifies a URI at which
5485    /// browser-authenticated users may authorize a client's public key for [client
5486    /// to server interactions](https://www.w3.org/TR/activitypub/#client-to-server-interactions).
5487    pub provide_client_key: Option<Iri>,
5488    /// If Linked Data Signatures and HTTP Signatures are being used for
5489    /// authentication and authorization, this endpoint specifies a URI at which
5490    /// a client key may be signed by the actor's key for a time window to act on
5491    /// behalf of the actor in interacting with foreign servers.
5492    pub sign_client_key: Option<Iri>,
5493    /// An optional endpoint [used for wide delivery of publicly addressed
5494    /// activities and activities sent to
5495    /// followers](https://www.w3.org/TR/activitypub/#shared-inbox-delivery).
5496    /// `sharedInbox` endpoints SHOULD also be publicly readable
5497    /// {@link OrderedCollection} objects containing objects addressed to the
5498    /// [Public](https://www.w3.org/TR/activitypub/#public-addressing) special
5499    /// collection.  Reading from the `sharedInbox` endpoint MUST NOT present
5500    /// objects which are not addressed to the `Public`` endpoint.
5501    pub shared_inbox: Option<Iri>,
5502    /// Upload endpoint URI for this user for binary data, such as an image or
5503    /// video, as described in the [ActivityPub Media
5504    /// Upload](https://www.w3.org/wiki/SocialCG/ActivityPub/MediaUpload) extension.
5505    /// Clients `POST` a `multipart/form-data` request containing a `file` part
5506    /// (the binary payload) and an `object` part (an ActivityStreams object shell)
5507    /// to this endpoint.
5508    pub upload_media: Option<Iri>,
5509}
5510
5511impl Endpoints {
5512    /// The type's IRI.
5513    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Endpoints";
5514}
5515
5516impl FromJson for Endpoints {
5517    fn from_json(value: &Value) -> Result<Self, JsonError> {
5518        let object = json::object(value)?;
5519        Ok(Self {
5520            proxy_url: json::one(object, &["proxyUrl"]),
5521            oauth_authorization_endpoint: json::one(object, &["oauthAuthorizationEndpoint"]),
5522            oauth_token_endpoint: json::one(object, &["oauthTokenEndpoint"]),
5523            provide_client_key: json::one(object, &["provideClientKey"]),
5524            sign_client_key: json::one(object, &["signClientKey"]),
5525            shared_inbox: json::one(object, &["sharedInbox"]),
5526            upload_media: json::one(object, &["uploadMedia"]),
5527        })
5528    }
5529}
5530
5531impl ToJson for Endpoints {
5532    fn to_json(&self) -> Value {
5533        let mut object = json::new_object(None, None);
5534        json::put_one(&mut object, &["proxyUrl"], self.proxy_url.as_ref());
5535        json::put_one(
5536            &mut object,
5537            &["oauthAuthorizationEndpoint"],
5538            self.oauth_authorization_endpoint.as_ref(),
5539        );
5540        json::put_one(
5541            &mut object,
5542            &["oauthTokenEndpoint"],
5543            self.oauth_token_endpoint.as_ref(),
5544        );
5545        json::put_one(
5546            &mut object,
5547            &["provideClientKey"],
5548            self.provide_client_key.as_ref(),
5549        );
5550        json::put_one(
5551            &mut object,
5552            &["signClientKey"],
5553            self.sign_client_key.as_ref(),
5554        );
5555        json::put_one(&mut object, &["sharedInbox"], self.shared_inbox.as_ref());
5556        json::put_one(&mut object, &["uploadMedia"], self.upload_media.as_ref());
5557        Value::Object(object)
5558    }
5559}
5560
5561/// Represents any kind of event.
5562///
5563/// The type `https://www.w3.org/ns/activitystreams#Event`.
5564#[derive(Clone, Debug, Default, PartialEq)]
5565pub struct Event {
5566    /// The IRI that identifies this object.
5567    pub id: Option<Iri>,
5568    /// See [`Object::attachments`].
5569    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
5570    /// See [`Object::attributions`].
5571    pub attributions: Vec<AnyActor>,
5572    /// See [`Object::audiences`].
5573    pub audiences: Vec<AnyObject>,
5574    /// See [`Object::content`].
5575    pub content: Text,
5576    /// See [`Object::contexts`].
5577    pub contexts: Vec<LinkOrObject>,
5578    /// See [`Object::name`].
5579    pub name: Text,
5580    /// See [`Object::end_time`].
5581    pub end_time: Option<String>,
5582    /// See [`Object::generators`].
5583    pub generators: Vec<LinkOrObject>,
5584    /// See [`Object::icons`].
5585    pub icons: Vec<Reference<Image>>,
5586    /// See [`Object::images`].
5587    pub images: Vec<Reference<Image>>,
5588    /// See [`Object::reply_targets`].
5589    pub reply_targets: Vec<LinkOrObject>,
5590    /// See [`Object::locations`].
5591    pub locations: Vec<LinkOrObject>,
5592    /// See [`Object::previews`].
5593    pub previews: Vec<LinkOrObject>,
5594    /// See [`Object::published`].
5595    pub published: Option<String>,
5596    /// See [`Object::replies`].
5597    pub replies: Option<AnyCollection>,
5598    /// See [`Object::shares`].
5599    pub shares: Option<AnyCollection>,
5600    /// See [`Object::likes`].
5601    pub likes: Option<AnyCollection>,
5602    /// See [`Object::emoji_reactions`].
5603    pub emoji_reactions: Option<AnyCollection>,
5604    /// See [`Object::start_time`].
5605    pub start_time: Option<String>,
5606    /// See [`Object::summary`].
5607    pub summary: Text,
5608    /// See [`Object::tags`].
5609    pub tags: Vec<LinkOrObject>,
5610    /// See [`Object::updated`].
5611    pub updated: Option<String>,
5612    /// See [`Object::urls`].
5613    pub urls: Vec<LinkOrIri>,
5614    /// See [`Object::tos`].
5615    pub tos: Vec<AnyObject>,
5616    /// See [`Object::btos`].
5617    pub btos: Vec<AnyObject>,
5618    /// See [`Object::ccs`].
5619    pub ccs: Vec<AnyObject>,
5620    /// See [`Object::bccs`].
5621    pub bccs: Vec<AnyObject>,
5622    /// See [`Object::media_type`].
5623    pub media_type: Option<String>,
5624    /// See [`Object::duration`].
5625    pub duration: Option<String>,
5626    /// See [`Object::sensitive`].
5627    pub sensitive: Option<bool>,
5628    /// See [`Object::source`].
5629    pub source: Option<Box<Source>>,
5630    /// See [`Object::proofs`].
5631    pub proofs: Vec<Reference<DataIntegrityProof>>,
5632    /// See [`Object::interaction_policy`].
5633    pub interaction_policy: Option<Box<InteractionPolicy>>,
5634    /// See [`Object::approved_by`].
5635    pub approved_by: Option<Iri>,
5636    /// See [`Object::like_authorization`].
5637    pub like_authorization: Option<Reference<LikeAuthorization>>,
5638    /// See [`Object::reply_authorization`].
5639    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
5640    /// See [`Object::announce_authorization`].
5641    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
5642    /// See [`Object::translations`].
5643    pub translations: Vec<Translation>,
5644}
5645
5646impl Event {
5647    /// The type's IRI.
5648    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Event";
5649    /// The type's `type` in a normalised document.
5650    pub const TYPE: &'static str = "Event";
5651}
5652
5653impl json::Typed for Event {
5654    const TYPE: &'static str = "Event";
5655}
5656
5657impl FromJson for Event {
5658    fn from_json(value: &Value) -> Result<Self, JsonError> {
5659        let object = json::object(value)?;
5660        json::expect_type(object, Self::TYPE)?;
5661        Ok(Self {
5662            id: json::id(object),
5663            attachments: json::many(object, &["attachment"]),
5664            attributions: json::many(object, &["attributedTo"]),
5665            audiences: json::many(object, &["audience"]),
5666            content: json::text(object, "content"),
5667            contexts: json::many(object, &["context"]),
5668            name: json::text(object, "name"),
5669            end_time: json::one(object, &["endTime"]),
5670            generators: json::many(object, &["generator"]),
5671            icons: json::many_mapped(object, &["icon"], json::link_to_image),
5672            images: json::many_mapped(object, &["image"], json::link_to_image),
5673            reply_targets: json::many(object, &["inReplyTo"]),
5674            locations: json::many(object, &["location"]),
5675            previews: json::many(object, &["preview"]),
5676            published: json::one(object, &["published"]),
5677            replies: json::one(object, &["replies"]),
5678            shares: json::one(object, &["shares"]),
5679            likes: json::one(object, &["likes"]),
5680            emoji_reactions: json::one(object, &["emojiReactions"]),
5681            start_time: json::one(object, &["startTime"]),
5682            summary: json::text(object, "summary"),
5683            tags: json::many(object, &["tag"]),
5684            updated: json::one(object, &["updated"]),
5685            urls: json::many(object, &["url"]),
5686            tos: json::many(object, &["to"]),
5687            btos: json::many(object, &["bto"]),
5688            ccs: json::many(object, &["cc"]),
5689            bccs: json::many(object, &["bcc"]),
5690            media_type: json::one(object, &["mediaType"]),
5691            duration: json::one(object, &["duration"]),
5692            sensitive: json::one(object, &["sensitive"]),
5693            source: json::one(object, &["source"]),
5694            proofs: json::many(object, &["proof"]),
5695            interaction_policy: json::one(object, &["interactionPolicy"]),
5696            approved_by: json::one(object, &["approvedBy"]),
5697            like_authorization: json::one(object, &["likeAuthorization"]),
5698            reply_authorization: json::one(object, &["replyAuthorization"]),
5699            announce_authorization: json::one(object, &["announceAuthorization"]),
5700            translations: json::many(object, &["translations"]),
5701        })
5702    }
5703}
5704
5705impl ToJson for Event {
5706    fn to_json(&self) -> Value {
5707        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
5708        json::put_many(&mut object, &["attachment"], &self.attachments);
5709        json::put_many(&mut object, &["attributedTo"], &self.attributions);
5710        json::put_many(&mut object, &["audience"], &self.audiences);
5711        json::put_text(&mut object, "content", &self.content);
5712        json::put_many(&mut object, &["context"], &self.contexts);
5713        json::put_text(&mut object, "name", &self.name);
5714        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
5715        json::put_many(&mut object, &["generator"], &self.generators);
5716        json::put_many(&mut object, &["icon"], &self.icons);
5717        json::put_many(&mut object, &["image"], &self.images);
5718        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
5719        json::put_many(&mut object, &["location"], &self.locations);
5720        json::put_many(&mut object, &["preview"], &self.previews);
5721        json::put_one(&mut object, &["published"], self.published.as_ref());
5722        json::put_one(&mut object, &["replies"], self.replies.as_ref());
5723        json::put_one(&mut object, &["shares"], self.shares.as_ref());
5724        json::put_one(&mut object, &["likes"], self.likes.as_ref());
5725        json::put_one(
5726            &mut object,
5727            &["emojiReactions"],
5728            self.emoji_reactions.as_ref(),
5729        );
5730        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
5731        json::put_text(&mut object, "summary", &self.summary);
5732        json::put_many(&mut object, &["tag"], &self.tags);
5733        json::put_one(&mut object, &["updated"], self.updated.as_ref());
5734        json::put_many(&mut object, &["url"], &self.urls);
5735        json::put_many(&mut object, &["to"], &self.tos);
5736        json::put_many(&mut object, &["bto"], &self.btos);
5737        json::put_many(&mut object, &["cc"], &self.ccs);
5738        json::put_many(&mut object, &["bcc"], &self.bccs);
5739        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
5740        json::put_one(&mut object, &["duration"], self.duration.as_ref());
5741        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
5742        json::put_one(&mut object, &["source"], self.source.as_ref());
5743        json::put_many(&mut object, &["proof"], &self.proofs);
5744        json::put_one(
5745            &mut object,
5746            &["interactionPolicy"],
5747            self.interaction_policy.as_ref(),
5748        );
5749        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
5750        json::put_one(
5751            &mut object,
5752            &["likeAuthorization"],
5753            self.like_authorization.as_ref(),
5754        );
5755        json::put_one(
5756            &mut object,
5757            &["replyAuthorization"],
5758            self.reply_authorization.as_ref(),
5759        );
5760        json::put_one(
5761            &mut object,
5762            &["announceAuthorization"],
5763            self.announce_authorization.as_ref(),
5764        );
5765        json::put_many(&mut object, &["translations"], &self.translations);
5766        Value::Object(object)
5767    }
5768}
5769
5770/// "Export Actor" service.
5771///
5772/// The type `https://w3id.org/fep/9091#Export`.
5773#[derive(Clone, Debug, Default, PartialEq)]
5774pub struct Export {
5775    /// The IRI that identifies this object.
5776    pub id: Option<Iri>,
5777    /// See [`DidService::endpoints`].
5778    pub endpoints: Vec<Iri>,
5779}
5780
5781impl Export {
5782    /// The type's IRI.
5783    pub const TYPE_IRI: &'static str = "https://w3id.org/fep/9091#Export";
5784    /// The type's `type` in a normalised document.
5785    pub const TYPE: &'static str = "https://w3id.org/fep/9091#Export";
5786}
5787
5788impl json::Typed for Export {
5789    const TYPE: &'static str = "https://w3id.org/fep/9091#Export";
5790}
5791
5792impl FromJson for Export {
5793    fn from_json(value: &Value) -> Result<Self, JsonError> {
5794        let object = json::object(value)?;
5795        json::expect_type(object, Self::TYPE)?;
5796        Ok(Self {
5797            id: json::id(object),
5798            endpoints: json::many(object, &["https://www.w3.org/ns/did#serviceEndpoint"]),
5799        })
5800    }
5801}
5802
5803impl ToJson for Export {
5804    fn to_json(&self) -> Value {
5805        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
5806        json::put_many(
5807            &mut object,
5808            &["https://www.w3.org/ns/did#serviceEndpoint"],
5809            &self.endpoints,
5810        );
5811        Value::Object(object)
5812    }
5813}
5814
5815/// Proves that an actor consented to being included in a
5816/// {@link FeaturedCollection}.
5817///
5818/// The type `https://w3id.org/fep/7aa9#FeatureAuthorization`.
5819#[derive(Clone, Debug, Default, PartialEq)]
5820pub struct FeatureAuthorization {
5821    /// The IRI that identifies this object.
5822    pub id: Option<Iri>,
5823    /// See [`Object::attachments`].
5824    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
5825    /// See [`Object::attributions`].
5826    pub attributions: Vec<AnyActor>,
5827    /// See [`Object::audiences`].
5828    pub audiences: Vec<AnyObject>,
5829    /// See [`Object::content`].
5830    pub content: Text,
5831    /// See [`Object::contexts`].
5832    pub contexts: Vec<LinkOrObject>,
5833    /// See [`Object::name`].
5834    pub name: Text,
5835    /// See [`Object::end_time`].
5836    pub end_time: Option<String>,
5837    /// See [`Object::generators`].
5838    pub generators: Vec<LinkOrObject>,
5839    /// See [`Object::icons`].
5840    pub icons: Vec<Reference<Image>>,
5841    /// See [`Object::images`].
5842    pub images: Vec<Reference<Image>>,
5843    /// See [`Object::reply_targets`].
5844    pub reply_targets: Vec<LinkOrObject>,
5845    /// See [`Object::locations`].
5846    pub locations: Vec<LinkOrObject>,
5847    /// See [`Object::previews`].
5848    pub previews: Vec<LinkOrObject>,
5849    /// See [`Object::published`].
5850    pub published: Option<String>,
5851    /// See [`Object::replies`].
5852    pub replies: Option<AnyCollection>,
5853    /// See [`Object::shares`].
5854    pub shares: Option<AnyCollection>,
5855    /// See [`Object::likes`].
5856    pub likes: Option<AnyCollection>,
5857    /// See [`Object::emoji_reactions`].
5858    pub emoji_reactions: Option<AnyCollection>,
5859    /// See [`Object::start_time`].
5860    pub start_time: Option<String>,
5861    /// See [`Object::summary`].
5862    pub summary: Text,
5863    /// See [`Object::tags`].
5864    pub tags: Vec<LinkOrObject>,
5865    /// See [`Object::updated`].
5866    pub updated: Option<String>,
5867    /// See [`Object::urls`].
5868    pub urls: Vec<LinkOrIri>,
5869    /// See [`Object::tos`].
5870    pub tos: Vec<AnyObject>,
5871    /// See [`Object::btos`].
5872    pub btos: Vec<AnyObject>,
5873    /// See [`Object::ccs`].
5874    pub ccs: Vec<AnyObject>,
5875    /// See [`Object::bccs`].
5876    pub bccs: Vec<AnyObject>,
5877    /// See [`Object::media_type`].
5878    pub media_type: Option<String>,
5879    /// See [`Object::duration`].
5880    pub duration: Option<String>,
5881    /// See [`Object::sensitive`].
5882    pub sensitive: Option<bool>,
5883    /// See [`Object::source`].
5884    pub source: Option<Box<Source>>,
5885    /// See [`Object::proofs`].
5886    pub proofs: Vec<Reference<DataIntegrityProof>>,
5887    /// See [`Object::interaction_policy`].
5888    pub interaction_policy: Option<Box<InteractionPolicy>>,
5889    /// See [`Object::approved_by`].
5890    pub approved_by: Option<Iri>,
5891    /// See [`Object::like_authorization`].
5892    pub like_authorization: Option<Reference<LikeAuthorization>>,
5893    /// See [`Object::reply_authorization`].
5894    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
5895    /// See [`Object::announce_authorization`].
5896    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
5897    /// See [`Object::translations`].
5898    pub translations: Vec<Translation>,
5899    /// The featured collection for which the authorization was granted.
5900    pub interacting_object: Option<AnyObject>,
5901    /// The actor that was authorized to be featured.
5902    pub interaction_target: Option<AnyObject>,
5903}
5904
5905impl FeatureAuthorization {
5906    /// The type's IRI.
5907    pub const TYPE_IRI: &'static str = "https://w3id.org/fep/7aa9#FeatureAuthorization";
5908    /// The type's `type` in a normalised document.
5909    pub const TYPE: &'static str = "FeatureAuthorization";
5910}
5911
5912impl json::Typed for FeatureAuthorization {
5913    const TYPE: &'static str = "FeatureAuthorization";
5914}
5915
5916impl FromJson for FeatureAuthorization {
5917    fn from_json(value: &Value) -> Result<Self, JsonError> {
5918        let object = json::object(value)?;
5919        json::expect_type(object, Self::TYPE)?;
5920        Ok(Self {
5921            id: json::id(object),
5922            attachments: json::many(object, &["attachment"]),
5923            attributions: json::many(object, &["attributedTo"]),
5924            audiences: json::many(object, &["audience"]),
5925            content: json::text(object, "content"),
5926            contexts: json::many(object, &["context"]),
5927            name: json::text(object, "name"),
5928            end_time: json::one(object, &["endTime"]),
5929            generators: json::many(object, &["generator"]),
5930            icons: json::many_mapped(object, &["icon"], json::link_to_image),
5931            images: json::many_mapped(object, &["image"], json::link_to_image),
5932            reply_targets: json::many(object, &["inReplyTo"]),
5933            locations: json::many(object, &["location"]),
5934            previews: json::many(object, &["preview"]),
5935            published: json::one(object, &["published"]),
5936            replies: json::one(object, &["replies"]),
5937            shares: json::one(object, &["shares"]),
5938            likes: json::one(object, &["likes"]),
5939            emoji_reactions: json::one(object, &["emojiReactions"]),
5940            start_time: json::one(object, &["startTime"]),
5941            summary: json::text(object, "summary"),
5942            tags: json::many(object, &["tag"]),
5943            updated: json::one(object, &["updated"]),
5944            urls: json::many(object, &["url"]),
5945            tos: json::many(object, &["to"]),
5946            btos: json::many(object, &["bto"]),
5947            ccs: json::many(object, &["cc"]),
5948            bccs: json::many(object, &["bcc"]),
5949            media_type: json::one(object, &["mediaType"]),
5950            duration: json::one(object, &["duration"]),
5951            sensitive: json::one(object, &["sensitive"]),
5952            source: json::one(object, &["source"]),
5953            proofs: json::many(object, &["proof"]),
5954            interaction_policy: json::one(object, &["interactionPolicy"]),
5955            approved_by: json::one(object, &["approvedBy"]),
5956            like_authorization: json::one(object, &["likeAuthorization"]),
5957            reply_authorization: json::one(object, &["replyAuthorization"]),
5958            announce_authorization: json::one(object, &["announceAuthorization"]),
5959            translations: json::many(object, &["translations"]),
5960            interacting_object: json::one(object, &["interactingObject"]),
5961            interaction_target: json::one(object, &["interactionTarget"]),
5962        })
5963    }
5964}
5965
5966impl ToJson for FeatureAuthorization {
5967    fn to_json(&self) -> Value {
5968        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
5969        json::put_many(&mut object, &["attachment"], &self.attachments);
5970        json::put_many(&mut object, &["attributedTo"], &self.attributions);
5971        json::put_many(&mut object, &["audience"], &self.audiences);
5972        json::put_text(&mut object, "content", &self.content);
5973        json::put_many(&mut object, &["context"], &self.contexts);
5974        json::put_text(&mut object, "name", &self.name);
5975        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
5976        json::put_many(&mut object, &["generator"], &self.generators);
5977        json::put_many(&mut object, &["icon"], &self.icons);
5978        json::put_many(&mut object, &["image"], &self.images);
5979        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
5980        json::put_many(&mut object, &["location"], &self.locations);
5981        json::put_many(&mut object, &["preview"], &self.previews);
5982        json::put_one(&mut object, &["published"], self.published.as_ref());
5983        json::put_one(&mut object, &["replies"], self.replies.as_ref());
5984        json::put_one(&mut object, &["shares"], self.shares.as_ref());
5985        json::put_one(&mut object, &["likes"], self.likes.as_ref());
5986        json::put_one(
5987            &mut object,
5988            &["emojiReactions"],
5989            self.emoji_reactions.as_ref(),
5990        );
5991        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
5992        json::put_text(&mut object, "summary", &self.summary);
5993        json::put_many(&mut object, &["tag"], &self.tags);
5994        json::put_one(&mut object, &["updated"], self.updated.as_ref());
5995        json::put_many(&mut object, &["url"], &self.urls);
5996        json::put_many(&mut object, &["to"], &self.tos);
5997        json::put_many(&mut object, &["bto"], &self.btos);
5998        json::put_many(&mut object, &["cc"], &self.ccs);
5999        json::put_many(&mut object, &["bcc"], &self.bccs);
6000        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
6001        json::put_one(&mut object, &["duration"], self.duration.as_ref());
6002        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
6003        json::put_one(&mut object, &["source"], self.source.as_ref());
6004        json::put_many(&mut object, &["proof"], &self.proofs);
6005        json::put_one(
6006            &mut object,
6007            &["interactionPolicy"],
6008            self.interaction_policy.as_ref(),
6009        );
6010        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
6011        json::put_one(
6012            &mut object,
6013            &["likeAuthorization"],
6014            self.like_authorization.as_ref(),
6015        );
6016        json::put_one(
6017            &mut object,
6018            &["replyAuthorization"],
6019            self.reply_authorization.as_ref(),
6020        );
6021        json::put_one(
6022            &mut object,
6023            &["announceAuthorization"],
6024            self.announce_authorization.as_ref(),
6025        );
6026        json::put_many(&mut object, &["translations"], &self.translations);
6027        json::put_one(
6028            &mut object,
6029            &["interactingObject"],
6030            self.interacting_object.as_ref(),
6031        );
6032        json::put_one(
6033            &mut object,
6034            &["interactionTarget"],
6035            self.interaction_target.as_ref(),
6036        );
6037        Value::Object(object)
6038    }
6039}
6040
6041/// A request for consent before featuring an actor in a
6042/// {@link FeaturedCollection}.
6043///
6044/// The type `https://w3id.org/fep/7aa9#FeatureRequest`.
6045#[derive(Clone, Debug, Default, PartialEq)]
6046pub struct FeatureRequest {
6047    /// The IRI that identifies this object.
6048    pub id: Option<Iri>,
6049    /// See [`Object::attachments`].
6050    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
6051    /// See [`Object::attributions`].
6052    pub attributions: Vec<AnyActor>,
6053    /// See [`Object::audiences`].
6054    pub audiences: Vec<AnyObject>,
6055    /// See [`Object::content`].
6056    pub content: Text,
6057    /// See [`Object::contexts`].
6058    pub contexts: Vec<LinkOrObject>,
6059    /// See [`Object::name`].
6060    pub name: Text,
6061    /// See [`Object::end_time`].
6062    pub end_time: Option<String>,
6063    /// See [`Object::generators`].
6064    pub generators: Vec<LinkOrObject>,
6065    /// See [`Object::icons`].
6066    pub icons: Vec<Reference<Image>>,
6067    /// See [`Object::images`].
6068    pub images: Vec<Reference<Image>>,
6069    /// See [`Object::reply_targets`].
6070    pub reply_targets: Vec<LinkOrObject>,
6071    /// See [`Object::locations`].
6072    pub locations: Vec<LinkOrObject>,
6073    /// See [`Object::previews`].
6074    pub previews: Vec<LinkOrObject>,
6075    /// See [`Object::published`].
6076    pub published: Option<String>,
6077    /// See [`Object::replies`].
6078    pub replies: Option<AnyCollection>,
6079    /// See [`Object::shares`].
6080    pub shares: Option<AnyCollection>,
6081    /// See [`Object::likes`].
6082    pub likes: Option<AnyCollection>,
6083    /// See [`Object::emoji_reactions`].
6084    pub emoji_reactions: Option<AnyCollection>,
6085    /// See [`Object::start_time`].
6086    pub start_time: Option<String>,
6087    /// See [`Object::summary`].
6088    pub summary: Text,
6089    /// See [`Object::tags`].
6090    pub tags: Vec<LinkOrObject>,
6091    /// See [`Object::updated`].
6092    pub updated: Option<String>,
6093    /// See [`Object::urls`].
6094    pub urls: Vec<LinkOrIri>,
6095    /// See [`Object::tos`].
6096    pub tos: Vec<AnyObject>,
6097    /// See [`Object::btos`].
6098    pub btos: Vec<AnyObject>,
6099    /// See [`Object::ccs`].
6100    pub ccs: Vec<AnyObject>,
6101    /// See [`Object::bccs`].
6102    pub bccs: Vec<AnyObject>,
6103    /// See [`Object::media_type`].
6104    pub media_type: Option<String>,
6105    /// See [`Object::duration`].
6106    pub duration: Option<String>,
6107    /// See [`Object::sensitive`].
6108    pub sensitive: Option<bool>,
6109    /// See [`Object::source`].
6110    pub source: Option<Box<Source>>,
6111    /// See [`Object::proofs`].
6112    pub proofs: Vec<Reference<DataIntegrityProof>>,
6113    /// See [`Object::interaction_policy`].
6114    pub interaction_policy: Option<Box<InteractionPolicy>>,
6115    /// See [`Object::approved_by`].
6116    pub approved_by: Option<Iri>,
6117    /// See [`Object::like_authorization`].
6118    pub like_authorization: Option<Reference<LikeAuthorization>>,
6119    /// See [`Object::reply_authorization`].
6120    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
6121    /// See [`Object::announce_authorization`].
6122    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
6123    /// See [`Object::translations`].
6124    pub translations: Vec<Translation>,
6125    /// See [`Activity::actors`].
6126    pub actors: Vec<AnyActor>,
6127    /// See [`Activity::objects`].
6128    pub objects: Vec<AnyObject>,
6129    /// See [`Activity::targets`].
6130    pub targets: Vec<AnyObject>,
6131    /// See [`Activity::results`].
6132    pub results: Vec<AnyObject>,
6133    /// See [`Activity::origins`].
6134    pub origins: Vec<AnyObject>,
6135    /// See [`Activity::instruments`].
6136    pub instruments: Vec<AnyObject>,
6137}
6138
6139impl FeatureRequest {
6140    /// The type's IRI.
6141    pub const TYPE_IRI: &'static str = "https://w3id.org/fep/7aa9#FeatureRequest";
6142    /// The type's `type` in a normalised document.
6143    pub const TYPE: &'static str = "FeatureRequest";
6144}
6145
6146impl json::Typed for FeatureRequest {
6147    const TYPE: &'static str = "FeatureRequest";
6148}
6149
6150impl FromJson for FeatureRequest {
6151    fn from_json(value: &Value) -> Result<Self, JsonError> {
6152        let object = json::object(value)?;
6153        json::expect_type(object, Self::TYPE)?;
6154        Ok(Self {
6155            id: json::id(object),
6156            attachments: json::many(object, &["attachment"]),
6157            attributions: json::many(object, &["attributedTo"]),
6158            audiences: json::many(object, &["audience"]),
6159            content: json::text(object, "content"),
6160            contexts: json::many(object, &["context"]),
6161            name: json::text(object, "name"),
6162            end_time: json::one(object, &["endTime"]),
6163            generators: json::many(object, &["generator"]),
6164            icons: json::many_mapped(object, &["icon"], json::link_to_image),
6165            images: json::many_mapped(object, &["image"], json::link_to_image),
6166            reply_targets: json::many(object, &["inReplyTo"]),
6167            locations: json::many(object, &["location"]),
6168            previews: json::many(object, &["preview"]),
6169            published: json::one(object, &["published"]),
6170            replies: json::one(object, &["replies"]),
6171            shares: json::one(object, &["shares"]),
6172            likes: json::one(object, &["likes"]),
6173            emoji_reactions: json::one(object, &["emojiReactions"]),
6174            start_time: json::one(object, &["startTime"]),
6175            summary: json::text(object, "summary"),
6176            tags: json::many(object, &["tag"]),
6177            updated: json::one(object, &["updated"]),
6178            urls: json::many(object, &["url"]),
6179            tos: json::many(object, &["to"]),
6180            btos: json::many(object, &["bto"]),
6181            ccs: json::many(object, &["cc"]),
6182            bccs: json::many(object, &["bcc"]),
6183            media_type: json::one(object, &["mediaType"]),
6184            duration: json::one(object, &["duration"]),
6185            sensitive: json::one(object, &["sensitive"]),
6186            source: json::one(object, &["source"]),
6187            proofs: json::many(object, &["proof"]),
6188            interaction_policy: json::one(object, &["interactionPolicy"]),
6189            approved_by: json::one(object, &["approvedBy"]),
6190            like_authorization: json::one(object, &["likeAuthorization"]),
6191            reply_authorization: json::one(object, &["replyAuthorization"]),
6192            announce_authorization: json::one(object, &["announceAuthorization"]),
6193            translations: json::many(object, &["translations"]),
6194            actors: json::many(object, &["actor"]),
6195            objects: json::many(object, &["object"]),
6196            targets: json::many(object, &["target"]),
6197            results: json::many(object, &["result"]),
6198            origins: json::many(object, &["origin"]),
6199            instruments: json::many(object, &["instrument"]),
6200        })
6201    }
6202}
6203
6204impl ToJson for FeatureRequest {
6205    fn to_json(&self) -> Value {
6206        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
6207        json::put_many(&mut object, &["attachment"], &self.attachments);
6208        json::put_many(&mut object, &["attributedTo"], &self.attributions);
6209        json::put_many(&mut object, &["audience"], &self.audiences);
6210        json::put_text(&mut object, "content", &self.content);
6211        json::put_many(&mut object, &["context"], &self.contexts);
6212        json::put_text(&mut object, "name", &self.name);
6213        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
6214        json::put_many(&mut object, &["generator"], &self.generators);
6215        json::put_many(&mut object, &["icon"], &self.icons);
6216        json::put_many(&mut object, &["image"], &self.images);
6217        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
6218        json::put_many(&mut object, &["location"], &self.locations);
6219        json::put_many(&mut object, &["preview"], &self.previews);
6220        json::put_one(&mut object, &["published"], self.published.as_ref());
6221        json::put_one(&mut object, &["replies"], self.replies.as_ref());
6222        json::put_one(&mut object, &["shares"], self.shares.as_ref());
6223        json::put_one(&mut object, &["likes"], self.likes.as_ref());
6224        json::put_one(
6225            &mut object,
6226            &["emojiReactions"],
6227            self.emoji_reactions.as_ref(),
6228        );
6229        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
6230        json::put_text(&mut object, "summary", &self.summary);
6231        json::put_many(&mut object, &["tag"], &self.tags);
6232        json::put_one(&mut object, &["updated"], self.updated.as_ref());
6233        json::put_many(&mut object, &["url"], &self.urls);
6234        json::put_many(&mut object, &["to"], &self.tos);
6235        json::put_many(&mut object, &["bto"], &self.btos);
6236        json::put_many(&mut object, &["cc"], &self.ccs);
6237        json::put_many(&mut object, &["bcc"], &self.bccs);
6238        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
6239        json::put_one(&mut object, &["duration"], self.duration.as_ref());
6240        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
6241        json::put_one(&mut object, &["source"], self.source.as_ref());
6242        json::put_many(&mut object, &["proof"], &self.proofs);
6243        json::put_one(
6244            &mut object,
6245            &["interactionPolicy"],
6246            self.interaction_policy.as_ref(),
6247        );
6248        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
6249        json::put_one(
6250            &mut object,
6251            &["likeAuthorization"],
6252            self.like_authorization.as_ref(),
6253        );
6254        json::put_one(
6255            &mut object,
6256            &["replyAuthorization"],
6257            self.reply_authorization.as_ref(),
6258        );
6259        json::put_one(
6260            &mut object,
6261            &["announceAuthorization"],
6262            self.announce_authorization.as_ref(),
6263        );
6264        json::put_many(&mut object, &["translations"], &self.translations);
6265        json::put_many(&mut object, &["actor"], &self.actors);
6266        json::put_many(&mut object, &["object"], &self.objects);
6267        json::put_many(&mut object, &["target"], &self.targets);
6268        json::put_many(&mut object, &["result"], &self.results);
6269        json::put_many(&mut object, &["origin"], &self.origins);
6270        json::put_many(&mut object, &["instrument"], &self.instruments);
6271        Value::Object(object)
6272    }
6273}
6274
6275/// A curated collection of recommended actors or other objects.
6276///
6277/// The type `https://w3id.org/fep/7aa9#FeaturedCollection`.
6278#[derive(Clone, Debug, Default, PartialEq)]
6279pub struct FeaturedCollection {
6280    /// The IRI that identifies this object.
6281    pub id: Option<Iri>,
6282    /// See [`Object::attachments`].
6283    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
6284    /// See [`Object::attributions`].
6285    pub attributions: Vec<AnyActor>,
6286    /// See [`Object::audiences`].
6287    pub audiences: Vec<AnyObject>,
6288    /// See [`Object::content`].
6289    pub content: Text,
6290    /// See [`Object::contexts`].
6291    pub contexts: Vec<LinkOrObject>,
6292    /// See [`Object::name`].
6293    pub name: Text,
6294    /// See [`Object::end_time`].
6295    pub end_time: Option<String>,
6296    /// See [`Object::generators`].
6297    pub generators: Vec<LinkOrObject>,
6298    /// See [`Object::icons`].
6299    pub icons: Vec<Reference<Image>>,
6300    /// See [`Object::images`].
6301    pub images: Vec<Reference<Image>>,
6302    /// See [`Object::reply_targets`].
6303    pub reply_targets: Vec<LinkOrObject>,
6304    /// See [`Object::locations`].
6305    pub locations: Vec<LinkOrObject>,
6306    /// See [`Object::previews`].
6307    pub previews: Vec<LinkOrObject>,
6308    /// See [`Object::published`].
6309    pub published: Option<String>,
6310    /// See [`Object::replies`].
6311    pub replies: Option<AnyCollection>,
6312    /// See [`Object::shares`].
6313    pub shares: Option<AnyCollection>,
6314    /// See [`Object::likes`].
6315    pub likes: Option<AnyCollection>,
6316    /// See [`Object::emoji_reactions`].
6317    pub emoji_reactions: Option<AnyCollection>,
6318    /// See [`Object::start_time`].
6319    pub start_time: Option<String>,
6320    /// See [`Object::summary`].
6321    pub summary: Text,
6322    /// See [`Object::tags`].
6323    pub tags: Vec<LinkOrObject>,
6324    /// See [`Object::updated`].
6325    pub updated: Option<String>,
6326    /// See [`Object::urls`].
6327    pub urls: Vec<LinkOrIri>,
6328    /// See [`Object::tos`].
6329    pub tos: Vec<AnyObject>,
6330    /// See [`Object::btos`].
6331    pub btos: Vec<AnyObject>,
6332    /// See [`Object::ccs`].
6333    pub ccs: Vec<AnyObject>,
6334    /// See [`Object::bccs`].
6335    pub bccs: Vec<AnyObject>,
6336    /// See [`Object::media_type`].
6337    pub media_type: Option<String>,
6338    /// See [`Object::duration`].
6339    pub duration: Option<String>,
6340    /// See [`Object::sensitive`].
6341    pub sensitive: Option<bool>,
6342    /// See [`Object::source`].
6343    pub source: Option<Box<Source>>,
6344    /// See [`Object::proofs`].
6345    pub proofs: Vec<Reference<DataIntegrityProof>>,
6346    /// See [`Object::interaction_policy`].
6347    pub interaction_policy: Option<Box<InteractionPolicy>>,
6348    /// See [`Object::approved_by`].
6349    pub approved_by: Option<Iri>,
6350    /// See [`Object::like_authorization`].
6351    pub like_authorization: Option<Reference<LikeAuthorization>>,
6352    /// See [`Object::reply_authorization`].
6353    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
6354    /// See [`Object::announce_authorization`].
6355    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
6356    /// See [`Object::translations`].
6357    pub translations: Vec<Translation>,
6358    /// See [`Collection::total_items`].
6359    pub total_items: Option<u64>,
6360    /// See [`Collection::current`].
6361    pub current: Option<AnyCollectionPage>,
6362    /// See [`Collection::first`].
6363    pub first: Option<AnyCollectionPage>,
6364    /// See [`Collection::last`].
6365    pub last: Option<AnyCollectionPage>,
6366    /// See [`OrderedCollection::items`].
6367    pub items: Vec<LinkOrObject>,
6368    /// See [`Collection::likes_of`].
6369    pub likes_of: Option<AnyObject>,
6370    /// See [`Collection::shares_of`].
6371    pub shares_of: Option<AnyObject>,
6372    /// See [`Collection::replies_of`].
6373    pub replies_of: Option<AnyObject>,
6374    /// See [`Collection::inbox_of`].
6375    pub inbox_of: Option<AnyObject>,
6376    /// See [`Collection::outbox_of`].
6377    pub outbox_of: Option<AnyObject>,
6378    /// See [`Collection::followers_of`].
6379    pub followers_of: Option<AnyObject>,
6380    /// See [`Collection::following_of`].
6381    pub following_of: Option<AnyObject>,
6382    /// See [`Collection::liked_of`].
6383    pub liked_of: Option<AnyObject>,
6384    /// A single {@link Hashtag} object that represents the main topic or category
6385    /// of this featured collection.
6386    pub topic: Option<Box<Hashtag>>,
6387    /// When present and set to `false`, signals that this featured collection is
6388    /// not meant to be discovered by search, onboarding, or similar discovery
6389    /// features.
6390    pub discoverable: Option<bool>,
6391}
6392
6393impl FeaturedCollection {
6394    /// The type's IRI.
6395    pub const TYPE_IRI: &'static str = "https://w3id.org/fep/7aa9#FeaturedCollection";
6396    /// The type's `type` in a normalised document.
6397    pub const TYPE: &'static str = "FeaturedCollection";
6398}
6399
6400impl json::Typed for FeaturedCollection {
6401    const TYPE: &'static str = "FeaturedCollection";
6402}
6403
6404impl FromJson for FeaturedCollection {
6405    fn from_json(value: &Value) -> Result<Self, JsonError> {
6406        let object = json::object(value)?;
6407        json::expect_type(object, Self::TYPE)?;
6408        Ok(Self {
6409            id: json::id(object),
6410            attachments: json::many(object, &["attachment"]),
6411            attributions: json::many(object, &["attributedTo"]),
6412            audiences: json::many(object, &["audience"]),
6413            content: json::text(object, "content"),
6414            contexts: json::many(object, &["context"]),
6415            name: json::text(object, "name"),
6416            end_time: json::one(object, &["endTime"]),
6417            generators: json::many(object, &["generator"]),
6418            icons: json::many_mapped(object, &["icon"], json::link_to_image),
6419            images: json::many_mapped(object, &["image"], json::link_to_image),
6420            reply_targets: json::many(object, &["inReplyTo"]),
6421            locations: json::many(object, &["location"]),
6422            previews: json::many(object, &["preview"]),
6423            published: json::one(object, &["published"]),
6424            replies: json::one(object, &["replies"]),
6425            shares: json::one(object, &["shares"]),
6426            likes: json::one(object, &["likes"]),
6427            emoji_reactions: json::one(object, &["emojiReactions"]),
6428            start_time: json::one(object, &["startTime"]),
6429            summary: json::text(object, "summary"),
6430            tags: json::many(object, &["tag"]),
6431            updated: json::one(object, &["updated"]),
6432            urls: json::many(object, &["url"]),
6433            tos: json::many(object, &["to"]),
6434            btos: json::many(object, &["bto"]),
6435            ccs: json::many(object, &["cc"]),
6436            bccs: json::many(object, &["bcc"]),
6437            media_type: json::one(object, &["mediaType"]),
6438            duration: json::one(object, &["duration"]),
6439            sensitive: json::one(object, &["sensitive"]),
6440            source: json::one(object, &["source"]),
6441            proofs: json::many(object, &["proof"]),
6442            interaction_policy: json::one(object, &["interactionPolicy"]),
6443            approved_by: json::one(object, &["approvedBy"]),
6444            like_authorization: json::one(object, &["likeAuthorization"]),
6445            reply_authorization: json::one(object, &["replyAuthorization"]),
6446            announce_authorization: json::one(object, &["announceAuthorization"]),
6447            translations: json::many(object, &["translations"]),
6448            total_items: json::one(object, &["totalItems"]),
6449            current: json::one(object, &["current"]),
6450            first: json::one(object, &["first"]),
6451            last: json::one(object, &["last"]),
6452            items: json::many(object, &["orderedItems", "items"]),
6453            likes_of: json::one(object, &["https://w3id.org/fep/5711#likesOf"]),
6454            shares_of: json::one(object, &["https://w3id.org/fep/5711#sharesOf"]),
6455            replies_of: json::one(object, &["https://w3id.org/fep/5711#repliesOf"]),
6456            inbox_of: json::one(object, &["https://w3id.org/fep/5711#inboxOf"]),
6457            outbox_of: json::one(object, &["https://w3id.org/fep/5711#outboxOf"]),
6458            followers_of: json::one(object, &["https://w3id.org/fep/5711#followersOf"]),
6459            following_of: json::one(object, &["https://w3id.org/fep/5711#followingOf"]),
6460            liked_of: json::one(object, &["https://w3id.org/fep/5711#likedOf"]),
6461            topic: json::one(object, &["topic"]),
6462            discoverable: json::one(object, &["discoverable"]),
6463        })
6464    }
6465}
6466
6467impl ToJson for FeaturedCollection {
6468    fn to_json(&self) -> Value {
6469        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
6470        json::put_many(&mut object, &["attachment"], &self.attachments);
6471        json::put_many(&mut object, &["attributedTo"], &self.attributions);
6472        json::put_many(&mut object, &["audience"], &self.audiences);
6473        json::put_text(&mut object, "content", &self.content);
6474        json::put_many(&mut object, &["context"], &self.contexts);
6475        json::put_text(&mut object, "name", &self.name);
6476        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
6477        json::put_many(&mut object, &["generator"], &self.generators);
6478        json::put_many(&mut object, &["icon"], &self.icons);
6479        json::put_many(&mut object, &["image"], &self.images);
6480        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
6481        json::put_many(&mut object, &["location"], &self.locations);
6482        json::put_many(&mut object, &["preview"], &self.previews);
6483        json::put_one(&mut object, &["published"], self.published.as_ref());
6484        json::put_one(&mut object, &["replies"], self.replies.as_ref());
6485        json::put_one(&mut object, &["shares"], self.shares.as_ref());
6486        json::put_one(&mut object, &["likes"], self.likes.as_ref());
6487        json::put_one(
6488            &mut object,
6489            &["emojiReactions"],
6490            self.emoji_reactions.as_ref(),
6491        );
6492        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
6493        json::put_text(&mut object, "summary", &self.summary);
6494        json::put_many(&mut object, &["tag"], &self.tags);
6495        json::put_one(&mut object, &["updated"], self.updated.as_ref());
6496        json::put_many(&mut object, &["url"], &self.urls);
6497        json::put_many(&mut object, &["to"], &self.tos);
6498        json::put_many(&mut object, &["bto"], &self.btos);
6499        json::put_many(&mut object, &["cc"], &self.ccs);
6500        json::put_many(&mut object, &["bcc"], &self.bccs);
6501        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
6502        json::put_one(&mut object, &["duration"], self.duration.as_ref());
6503        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
6504        json::put_one(&mut object, &["source"], self.source.as_ref());
6505        json::put_many(&mut object, &["proof"], &self.proofs);
6506        json::put_one(
6507            &mut object,
6508            &["interactionPolicy"],
6509            self.interaction_policy.as_ref(),
6510        );
6511        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
6512        json::put_one(
6513            &mut object,
6514            &["likeAuthorization"],
6515            self.like_authorization.as_ref(),
6516        );
6517        json::put_one(
6518            &mut object,
6519            &["replyAuthorization"],
6520            self.reply_authorization.as_ref(),
6521        );
6522        json::put_one(
6523            &mut object,
6524            &["announceAuthorization"],
6525            self.announce_authorization.as_ref(),
6526        );
6527        json::put_many(&mut object, &["translations"], &self.translations);
6528        json::put_one(&mut object, &["totalItems"], self.total_items.as_ref());
6529        json::put_one(&mut object, &["current"], self.current.as_ref());
6530        json::put_one(&mut object, &["first"], self.first.as_ref());
6531        json::put_one(&mut object, &["last"], self.last.as_ref());
6532        json::put_many(&mut object, &["orderedItems"], &self.items);
6533        json::put_one(
6534            &mut object,
6535            &["https://w3id.org/fep/5711#likesOf"],
6536            self.likes_of.as_ref(),
6537        );
6538        json::put_one(
6539            &mut object,
6540            &["https://w3id.org/fep/5711#sharesOf"],
6541            self.shares_of.as_ref(),
6542        );
6543        json::put_one(
6544            &mut object,
6545            &["https://w3id.org/fep/5711#repliesOf"],
6546            self.replies_of.as_ref(),
6547        );
6548        json::put_one(
6549            &mut object,
6550            &["https://w3id.org/fep/5711#inboxOf"],
6551            self.inbox_of.as_ref(),
6552        );
6553        json::put_one(
6554            &mut object,
6555            &["https://w3id.org/fep/5711#outboxOf"],
6556            self.outbox_of.as_ref(),
6557        );
6558        json::put_one(
6559            &mut object,
6560            &["https://w3id.org/fep/5711#followersOf"],
6561            self.followers_of.as_ref(),
6562        );
6563        json::put_one(
6564            &mut object,
6565            &["https://w3id.org/fep/5711#followingOf"],
6566            self.following_of.as_ref(),
6567        );
6568        json::put_one(
6569            &mut object,
6570            &["https://w3id.org/fep/5711#likedOf"],
6571            self.liked_of.as_ref(),
6572        );
6573        json::put_one(&mut object, &["topic"], self.topic.as_ref());
6574        json::put_one(&mut object, &["discoverable"], self.discoverable.as_ref());
6575        Value::Object(object)
6576    }
6577}
6578
6579/// A single entry in a {@link FeaturedCollection}.
6580///
6581/// The type `https://w3id.org/fep/7aa9#FeaturedItem`.
6582#[derive(Clone, Debug, Default, PartialEq)]
6583pub struct FeaturedItem {
6584    /// The IRI that identifies this object.
6585    pub id: Option<Iri>,
6586    /// See [`Object::attachments`].
6587    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
6588    /// See [`Object::attributions`].
6589    pub attributions: Vec<AnyActor>,
6590    /// See [`Object::audiences`].
6591    pub audiences: Vec<AnyObject>,
6592    /// See [`Object::content`].
6593    pub content: Text,
6594    /// See [`Object::contexts`].
6595    pub contexts: Vec<LinkOrObject>,
6596    /// See [`Object::name`].
6597    pub name: Text,
6598    /// See [`Object::end_time`].
6599    pub end_time: Option<String>,
6600    /// See [`Object::generators`].
6601    pub generators: Vec<LinkOrObject>,
6602    /// See [`Object::icons`].
6603    pub icons: Vec<Reference<Image>>,
6604    /// See [`Object::images`].
6605    pub images: Vec<Reference<Image>>,
6606    /// See [`Object::reply_targets`].
6607    pub reply_targets: Vec<LinkOrObject>,
6608    /// See [`Object::locations`].
6609    pub locations: Vec<LinkOrObject>,
6610    /// See [`Object::previews`].
6611    pub previews: Vec<LinkOrObject>,
6612    /// See [`Object::published`].
6613    pub published: Option<String>,
6614    /// See [`Object::replies`].
6615    pub replies: Option<AnyCollection>,
6616    /// See [`Object::shares`].
6617    pub shares: Option<AnyCollection>,
6618    /// See [`Object::likes`].
6619    pub likes: Option<AnyCollection>,
6620    /// See [`Object::emoji_reactions`].
6621    pub emoji_reactions: Option<AnyCollection>,
6622    /// See [`Object::start_time`].
6623    pub start_time: Option<String>,
6624    /// See [`Object::summary`].
6625    pub summary: Text,
6626    /// See [`Object::tags`].
6627    pub tags: Vec<LinkOrObject>,
6628    /// See [`Object::updated`].
6629    pub updated: Option<String>,
6630    /// See [`Object::urls`].
6631    pub urls: Vec<LinkOrIri>,
6632    /// See [`Object::tos`].
6633    pub tos: Vec<AnyObject>,
6634    /// See [`Object::btos`].
6635    pub btos: Vec<AnyObject>,
6636    /// See [`Object::ccs`].
6637    pub ccs: Vec<AnyObject>,
6638    /// See [`Object::bccs`].
6639    pub bccs: Vec<AnyObject>,
6640    /// See [`Object::media_type`].
6641    pub media_type: Option<String>,
6642    /// See [`Object::duration`].
6643    pub duration: Option<String>,
6644    /// See [`Object::sensitive`].
6645    pub sensitive: Option<bool>,
6646    /// See [`Object::source`].
6647    pub source: Option<Box<Source>>,
6648    /// See [`Object::proofs`].
6649    pub proofs: Vec<Reference<DataIntegrityProof>>,
6650    /// See [`Object::interaction_policy`].
6651    pub interaction_policy: Option<Box<InteractionPolicy>>,
6652    /// See [`Object::approved_by`].
6653    pub approved_by: Option<Iri>,
6654    /// See [`Object::like_authorization`].
6655    pub like_authorization: Option<Reference<LikeAuthorization>>,
6656    /// See [`Object::reply_authorization`].
6657    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
6658    /// See [`Object::announce_authorization`].
6659    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
6660    /// See [`Object::translations`].
6661    pub translations: Vec<Translation>,
6662    /// The object being featured.
6663    pub featured_object: Option<AnyObject>,
6664    /// The {@link FeatureAuthorization} proving that the featured actor consented
6665    /// to inclusion in the featured collection.
6666    pub feature_authorization: Option<Reference<FeatureAuthorization>>,
6667}
6668
6669impl FeaturedItem {
6670    /// The type's IRI.
6671    pub const TYPE_IRI: &'static str = "https://w3id.org/fep/7aa9#FeaturedItem";
6672    /// The type's `type` in a normalised document.
6673    pub const TYPE: &'static str = "FeaturedItem";
6674}
6675
6676impl json::Typed for FeaturedItem {
6677    const TYPE: &'static str = "FeaturedItem";
6678}
6679
6680impl FromJson for FeaturedItem {
6681    fn from_json(value: &Value) -> Result<Self, JsonError> {
6682        let object = json::object(value)?;
6683        json::expect_type(object, Self::TYPE)?;
6684        Ok(Self {
6685            id: json::id(object),
6686            attachments: json::many(object, &["attachment"]),
6687            attributions: json::many(object, &["attributedTo"]),
6688            audiences: json::many(object, &["audience"]),
6689            content: json::text(object, "content"),
6690            contexts: json::many(object, &["context"]),
6691            name: json::text(object, "name"),
6692            end_time: json::one(object, &["endTime"]),
6693            generators: json::many(object, &["generator"]),
6694            icons: json::many_mapped(object, &["icon"], json::link_to_image),
6695            images: json::many_mapped(object, &["image"], json::link_to_image),
6696            reply_targets: json::many(object, &["inReplyTo"]),
6697            locations: json::many(object, &["location"]),
6698            previews: json::many(object, &["preview"]),
6699            published: json::one(object, &["published"]),
6700            replies: json::one(object, &["replies"]),
6701            shares: json::one(object, &["shares"]),
6702            likes: json::one(object, &["likes"]),
6703            emoji_reactions: json::one(object, &["emojiReactions"]),
6704            start_time: json::one(object, &["startTime"]),
6705            summary: json::text(object, "summary"),
6706            tags: json::many(object, &["tag"]),
6707            updated: json::one(object, &["updated"]),
6708            urls: json::many(object, &["url"]),
6709            tos: json::many(object, &["to"]),
6710            btos: json::many(object, &["bto"]),
6711            ccs: json::many(object, &["cc"]),
6712            bccs: json::many(object, &["bcc"]),
6713            media_type: json::one(object, &["mediaType"]),
6714            duration: json::one(object, &["duration"]),
6715            sensitive: json::one(object, &["sensitive"]),
6716            source: json::one(object, &["source"]),
6717            proofs: json::many(object, &["proof"]),
6718            interaction_policy: json::one(object, &["interactionPolicy"]),
6719            approved_by: json::one(object, &["approvedBy"]),
6720            like_authorization: json::one(object, &["likeAuthorization"]),
6721            reply_authorization: json::one(object, &["replyAuthorization"]),
6722            announce_authorization: json::one(object, &["announceAuthorization"]),
6723            translations: json::many(object, &["translations"]),
6724            featured_object: json::one(object, &["featuredObject"]),
6725            feature_authorization: json::one(object, &["featureAuthorization"]),
6726        })
6727    }
6728}
6729
6730impl ToJson for FeaturedItem {
6731    fn to_json(&self) -> Value {
6732        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
6733        json::put_many(&mut object, &["attachment"], &self.attachments);
6734        json::put_many(&mut object, &["attributedTo"], &self.attributions);
6735        json::put_many(&mut object, &["audience"], &self.audiences);
6736        json::put_text(&mut object, "content", &self.content);
6737        json::put_many(&mut object, &["context"], &self.contexts);
6738        json::put_text(&mut object, "name", &self.name);
6739        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
6740        json::put_many(&mut object, &["generator"], &self.generators);
6741        json::put_many(&mut object, &["icon"], &self.icons);
6742        json::put_many(&mut object, &["image"], &self.images);
6743        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
6744        json::put_many(&mut object, &["location"], &self.locations);
6745        json::put_many(&mut object, &["preview"], &self.previews);
6746        json::put_one(&mut object, &["published"], self.published.as_ref());
6747        json::put_one(&mut object, &["replies"], self.replies.as_ref());
6748        json::put_one(&mut object, &["shares"], self.shares.as_ref());
6749        json::put_one(&mut object, &["likes"], self.likes.as_ref());
6750        json::put_one(
6751            &mut object,
6752            &["emojiReactions"],
6753            self.emoji_reactions.as_ref(),
6754        );
6755        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
6756        json::put_text(&mut object, "summary", &self.summary);
6757        json::put_many(&mut object, &["tag"], &self.tags);
6758        json::put_one(&mut object, &["updated"], self.updated.as_ref());
6759        json::put_many(&mut object, &["url"], &self.urls);
6760        json::put_many(&mut object, &["to"], &self.tos);
6761        json::put_many(&mut object, &["bto"], &self.btos);
6762        json::put_many(&mut object, &["cc"], &self.ccs);
6763        json::put_many(&mut object, &["bcc"], &self.bccs);
6764        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
6765        json::put_one(&mut object, &["duration"], self.duration.as_ref());
6766        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
6767        json::put_one(&mut object, &["source"], self.source.as_ref());
6768        json::put_many(&mut object, &["proof"], &self.proofs);
6769        json::put_one(
6770            &mut object,
6771            &["interactionPolicy"],
6772            self.interaction_policy.as_ref(),
6773        );
6774        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
6775        json::put_one(
6776            &mut object,
6777            &["likeAuthorization"],
6778            self.like_authorization.as_ref(),
6779        );
6780        json::put_one(
6781            &mut object,
6782            &["replyAuthorization"],
6783            self.reply_authorization.as_ref(),
6784        );
6785        json::put_one(
6786            &mut object,
6787            &["announceAuthorization"],
6788            self.announce_authorization.as_ref(),
6789        );
6790        json::put_many(&mut object, &["translations"], &self.translations);
6791        json::put_one(
6792            &mut object,
6793            &["featuredObject"],
6794            self.featured_object.as_ref(),
6795        );
6796        json::put_one(
6797            &mut object,
6798            &["featureAuthorization"],
6799            self.feature_authorization.as_ref(),
6800        );
6801        Value::Object(object)
6802    }
6803}
6804
6805/// Indicates that the `actor` is "flagging" the `object`.  Flagging is defined
6806/// in the sense common to many social platforms as reporting content as being
6807/// inappropriate for any number of reasons.
6808///
6809/// The type `https://www.w3.org/ns/activitystreams#Flag`.
6810#[derive(Clone, Debug, Default, PartialEq)]
6811pub struct Flag {
6812    /// The IRI that identifies this object.
6813    pub id: Option<Iri>,
6814    /// See [`Object::attachments`].
6815    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
6816    /// See [`Object::attributions`].
6817    pub attributions: Vec<AnyActor>,
6818    /// See [`Object::audiences`].
6819    pub audiences: Vec<AnyObject>,
6820    /// See [`Object::content`].
6821    pub content: Text,
6822    /// See [`Object::contexts`].
6823    pub contexts: Vec<LinkOrObject>,
6824    /// See [`Object::name`].
6825    pub name: Text,
6826    /// See [`Object::end_time`].
6827    pub end_time: Option<String>,
6828    /// See [`Object::generators`].
6829    pub generators: Vec<LinkOrObject>,
6830    /// See [`Object::icons`].
6831    pub icons: Vec<Reference<Image>>,
6832    /// See [`Object::images`].
6833    pub images: Vec<Reference<Image>>,
6834    /// See [`Object::reply_targets`].
6835    pub reply_targets: Vec<LinkOrObject>,
6836    /// See [`Object::locations`].
6837    pub locations: Vec<LinkOrObject>,
6838    /// See [`Object::previews`].
6839    pub previews: Vec<LinkOrObject>,
6840    /// See [`Object::published`].
6841    pub published: Option<String>,
6842    /// See [`Object::replies`].
6843    pub replies: Option<AnyCollection>,
6844    /// See [`Object::shares`].
6845    pub shares: Option<AnyCollection>,
6846    /// See [`Object::likes`].
6847    pub likes: Option<AnyCollection>,
6848    /// See [`Object::emoji_reactions`].
6849    pub emoji_reactions: Option<AnyCollection>,
6850    /// See [`Object::start_time`].
6851    pub start_time: Option<String>,
6852    /// See [`Object::summary`].
6853    pub summary: Text,
6854    /// See [`Object::tags`].
6855    pub tags: Vec<LinkOrObject>,
6856    /// See [`Object::updated`].
6857    pub updated: Option<String>,
6858    /// See [`Object::urls`].
6859    pub urls: Vec<LinkOrIri>,
6860    /// See [`Object::tos`].
6861    pub tos: Vec<AnyObject>,
6862    /// See [`Object::btos`].
6863    pub btos: Vec<AnyObject>,
6864    /// See [`Object::ccs`].
6865    pub ccs: Vec<AnyObject>,
6866    /// See [`Object::bccs`].
6867    pub bccs: Vec<AnyObject>,
6868    /// See [`Object::media_type`].
6869    pub media_type: Option<String>,
6870    /// See [`Object::duration`].
6871    pub duration: Option<String>,
6872    /// See [`Object::sensitive`].
6873    pub sensitive: Option<bool>,
6874    /// See [`Object::source`].
6875    pub source: Option<Box<Source>>,
6876    /// See [`Object::proofs`].
6877    pub proofs: Vec<Reference<DataIntegrityProof>>,
6878    /// See [`Object::interaction_policy`].
6879    pub interaction_policy: Option<Box<InteractionPolicy>>,
6880    /// See [`Object::approved_by`].
6881    pub approved_by: Option<Iri>,
6882    /// See [`Object::like_authorization`].
6883    pub like_authorization: Option<Reference<LikeAuthorization>>,
6884    /// See [`Object::reply_authorization`].
6885    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
6886    /// See [`Object::announce_authorization`].
6887    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
6888    /// See [`Object::translations`].
6889    pub translations: Vec<Translation>,
6890    /// See [`Activity::actors`].
6891    pub actors: Vec<AnyActor>,
6892    /// See [`Activity::objects`].
6893    pub objects: Vec<AnyObject>,
6894    /// See [`Activity::targets`].
6895    pub targets: Vec<AnyObject>,
6896    /// See [`Activity::results`].
6897    pub results: Vec<AnyObject>,
6898    /// See [`Activity::origins`].
6899    pub origins: Vec<AnyObject>,
6900    /// See [`Activity::instruments`].
6901    pub instruments: Vec<AnyObject>,
6902}
6903
6904impl Flag {
6905    /// The type's IRI.
6906    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Flag";
6907    /// The type's `type` in a normalised document.
6908    pub const TYPE: &'static str = "Flag";
6909}
6910
6911impl json::Typed for Flag {
6912    const TYPE: &'static str = "Flag";
6913}
6914
6915impl FromJson for Flag {
6916    fn from_json(value: &Value) -> Result<Self, JsonError> {
6917        let object = json::object(value)?;
6918        json::expect_type(object, Self::TYPE)?;
6919        Ok(Self {
6920            id: json::id(object),
6921            attachments: json::many(object, &["attachment"]),
6922            attributions: json::many(object, &["attributedTo"]),
6923            audiences: json::many(object, &["audience"]),
6924            content: json::text(object, "content"),
6925            contexts: json::many(object, &["context"]),
6926            name: json::text(object, "name"),
6927            end_time: json::one(object, &["endTime"]),
6928            generators: json::many(object, &["generator"]),
6929            icons: json::many_mapped(object, &["icon"], json::link_to_image),
6930            images: json::many_mapped(object, &["image"], json::link_to_image),
6931            reply_targets: json::many(object, &["inReplyTo"]),
6932            locations: json::many(object, &["location"]),
6933            previews: json::many(object, &["preview"]),
6934            published: json::one(object, &["published"]),
6935            replies: json::one(object, &["replies"]),
6936            shares: json::one(object, &["shares"]),
6937            likes: json::one(object, &["likes"]),
6938            emoji_reactions: json::one(object, &["emojiReactions"]),
6939            start_time: json::one(object, &["startTime"]),
6940            summary: json::text(object, "summary"),
6941            tags: json::many(object, &["tag"]),
6942            updated: json::one(object, &["updated"]),
6943            urls: json::many(object, &["url"]),
6944            tos: json::many(object, &["to"]),
6945            btos: json::many(object, &["bto"]),
6946            ccs: json::many(object, &["cc"]),
6947            bccs: json::many(object, &["bcc"]),
6948            media_type: json::one(object, &["mediaType"]),
6949            duration: json::one(object, &["duration"]),
6950            sensitive: json::one(object, &["sensitive"]),
6951            source: json::one(object, &["source"]),
6952            proofs: json::many(object, &["proof"]),
6953            interaction_policy: json::one(object, &["interactionPolicy"]),
6954            approved_by: json::one(object, &["approvedBy"]),
6955            like_authorization: json::one(object, &["likeAuthorization"]),
6956            reply_authorization: json::one(object, &["replyAuthorization"]),
6957            announce_authorization: json::one(object, &["announceAuthorization"]),
6958            translations: json::many(object, &["translations"]),
6959            actors: json::many(object, &["actor"]),
6960            objects: json::many(object, &["object"]),
6961            targets: json::many(object, &["target"]),
6962            results: json::many(object, &["result"]),
6963            origins: json::many(object, &["origin"]),
6964            instruments: json::many(object, &["instrument"]),
6965        })
6966    }
6967}
6968
6969impl ToJson for Flag {
6970    fn to_json(&self) -> Value {
6971        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
6972        json::put_many(&mut object, &["attachment"], &self.attachments);
6973        json::put_many(&mut object, &["attributedTo"], &self.attributions);
6974        json::put_many(&mut object, &["audience"], &self.audiences);
6975        json::put_text(&mut object, "content", &self.content);
6976        json::put_many(&mut object, &["context"], &self.contexts);
6977        json::put_text(&mut object, "name", &self.name);
6978        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
6979        json::put_many(&mut object, &["generator"], &self.generators);
6980        json::put_many(&mut object, &["icon"], &self.icons);
6981        json::put_many(&mut object, &["image"], &self.images);
6982        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
6983        json::put_many(&mut object, &["location"], &self.locations);
6984        json::put_many(&mut object, &["preview"], &self.previews);
6985        json::put_one(&mut object, &["published"], self.published.as_ref());
6986        json::put_one(&mut object, &["replies"], self.replies.as_ref());
6987        json::put_one(&mut object, &["shares"], self.shares.as_ref());
6988        json::put_one(&mut object, &["likes"], self.likes.as_ref());
6989        json::put_one(
6990            &mut object,
6991            &["emojiReactions"],
6992            self.emoji_reactions.as_ref(),
6993        );
6994        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
6995        json::put_text(&mut object, "summary", &self.summary);
6996        json::put_many(&mut object, &["tag"], &self.tags);
6997        json::put_one(&mut object, &["updated"], self.updated.as_ref());
6998        json::put_many(&mut object, &["url"], &self.urls);
6999        json::put_many(&mut object, &["to"], &self.tos);
7000        json::put_many(&mut object, &["bto"], &self.btos);
7001        json::put_many(&mut object, &["cc"], &self.ccs);
7002        json::put_many(&mut object, &["bcc"], &self.bccs);
7003        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
7004        json::put_one(&mut object, &["duration"], self.duration.as_ref());
7005        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
7006        json::put_one(&mut object, &["source"], self.source.as_ref());
7007        json::put_many(&mut object, &["proof"], &self.proofs);
7008        json::put_one(
7009            &mut object,
7010            &["interactionPolicy"],
7011            self.interaction_policy.as_ref(),
7012        );
7013        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
7014        json::put_one(
7015            &mut object,
7016            &["likeAuthorization"],
7017            self.like_authorization.as_ref(),
7018        );
7019        json::put_one(
7020            &mut object,
7021            &["replyAuthorization"],
7022            self.reply_authorization.as_ref(),
7023        );
7024        json::put_one(
7025            &mut object,
7026            &["announceAuthorization"],
7027            self.announce_authorization.as_ref(),
7028        );
7029        json::put_many(&mut object, &["translations"], &self.translations);
7030        json::put_many(&mut object, &["actor"], &self.actors);
7031        json::put_many(&mut object, &["object"], &self.objects);
7032        json::put_many(&mut object, &["target"], &self.targets);
7033        json::put_many(&mut object, &["result"], &self.results);
7034        json::put_many(&mut object, &["origin"], &self.origins);
7035        json::put_many(&mut object, &["instrument"], &self.instruments);
7036        Value::Object(object)
7037    }
7038}
7039
7040/// Indicates that the `actor` is "following" the `object`.  Following is defined
7041/// in the sense typically used within Social systems in which the actor is
7042/// interested in any activity performed by or on the object.  The `target` and
7043/// `origin` typically have no defined meaning.
7044///
7045/// The type `https://www.w3.org/ns/activitystreams#Follow`.
7046#[derive(Clone, Debug, Default, PartialEq)]
7047pub struct Follow {
7048    /// The IRI that identifies this object.
7049    pub id: Option<Iri>,
7050    /// See [`Object::attachments`].
7051    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
7052    /// See [`Object::attributions`].
7053    pub attributions: Vec<AnyActor>,
7054    /// See [`Object::audiences`].
7055    pub audiences: Vec<AnyObject>,
7056    /// See [`Object::content`].
7057    pub content: Text,
7058    /// See [`Object::contexts`].
7059    pub contexts: Vec<LinkOrObject>,
7060    /// See [`Object::name`].
7061    pub name: Text,
7062    /// See [`Object::end_time`].
7063    pub end_time: Option<String>,
7064    /// See [`Object::generators`].
7065    pub generators: Vec<LinkOrObject>,
7066    /// See [`Object::icons`].
7067    pub icons: Vec<Reference<Image>>,
7068    /// See [`Object::images`].
7069    pub images: Vec<Reference<Image>>,
7070    /// See [`Object::reply_targets`].
7071    pub reply_targets: Vec<LinkOrObject>,
7072    /// See [`Object::locations`].
7073    pub locations: Vec<LinkOrObject>,
7074    /// See [`Object::previews`].
7075    pub previews: Vec<LinkOrObject>,
7076    /// See [`Object::published`].
7077    pub published: Option<String>,
7078    /// See [`Object::replies`].
7079    pub replies: Option<AnyCollection>,
7080    /// See [`Object::shares`].
7081    pub shares: Option<AnyCollection>,
7082    /// See [`Object::likes`].
7083    pub likes: Option<AnyCollection>,
7084    /// See [`Object::emoji_reactions`].
7085    pub emoji_reactions: Option<AnyCollection>,
7086    /// See [`Object::start_time`].
7087    pub start_time: Option<String>,
7088    /// See [`Object::summary`].
7089    pub summary: Text,
7090    /// See [`Object::tags`].
7091    pub tags: Vec<LinkOrObject>,
7092    /// See [`Object::updated`].
7093    pub updated: Option<String>,
7094    /// See [`Object::urls`].
7095    pub urls: Vec<LinkOrIri>,
7096    /// See [`Object::tos`].
7097    pub tos: Vec<AnyObject>,
7098    /// See [`Object::btos`].
7099    pub btos: Vec<AnyObject>,
7100    /// See [`Object::ccs`].
7101    pub ccs: Vec<AnyObject>,
7102    /// See [`Object::bccs`].
7103    pub bccs: Vec<AnyObject>,
7104    /// See [`Object::media_type`].
7105    pub media_type: Option<String>,
7106    /// See [`Object::duration`].
7107    pub duration: Option<String>,
7108    /// See [`Object::sensitive`].
7109    pub sensitive: Option<bool>,
7110    /// See [`Object::source`].
7111    pub source: Option<Box<Source>>,
7112    /// See [`Object::proofs`].
7113    pub proofs: Vec<Reference<DataIntegrityProof>>,
7114    /// See [`Object::interaction_policy`].
7115    pub interaction_policy: Option<Box<InteractionPolicy>>,
7116    /// See [`Object::approved_by`].
7117    pub approved_by: Option<Iri>,
7118    /// See [`Object::like_authorization`].
7119    pub like_authorization: Option<Reference<LikeAuthorization>>,
7120    /// See [`Object::reply_authorization`].
7121    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
7122    /// See [`Object::announce_authorization`].
7123    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
7124    /// See [`Object::translations`].
7125    pub translations: Vec<Translation>,
7126    /// See [`Activity::actors`].
7127    pub actors: Vec<AnyActor>,
7128    /// See [`Activity::objects`].
7129    pub objects: Vec<AnyObject>,
7130    /// See [`Activity::targets`].
7131    pub targets: Vec<AnyObject>,
7132    /// See [`Activity::results`].
7133    pub results: Vec<AnyObject>,
7134    /// See [`Activity::origins`].
7135    pub origins: Vec<AnyObject>,
7136    /// See [`Activity::instruments`].
7137    pub instruments: Vec<AnyObject>,
7138}
7139
7140impl Follow {
7141    /// The type's IRI.
7142    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Follow";
7143    /// The type's `type` in a normalised document.
7144    pub const TYPE: &'static str = "Follow";
7145}
7146
7147impl json::Typed for Follow {
7148    const TYPE: &'static str = "Follow";
7149}
7150
7151impl FromJson for Follow {
7152    fn from_json(value: &Value) -> Result<Self, JsonError> {
7153        let object = json::object(value)?;
7154        json::expect_type(object, Self::TYPE)?;
7155        Ok(Self {
7156            id: json::id(object),
7157            attachments: json::many(object, &["attachment"]),
7158            attributions: json::many(object, &["attributedTo"]),
7159            audiences: json::many(object, &["audience"]),
7160            content: json::text(object, "content"),
7161            contexts: json::many(object, &["context"]),
7162            name: json::text(object, "name"),
7163            end_time: json::one(object, &["endTime"]),
7164            generators: json::many(object, &["generator"]),
7165            icons: json::many_mapped(object, &["icon"], json::link_to_image),
7166            images: json::many_mapped(object, &["image"], json::link_to_image),
7167            reply_targets: json::many(object, &["inReplyTo"]),
7168            locations: json::many(object, &["location"]),
7169            previews: json::many(object, &["preview"]),
7170            published: json::one(object, &["published"]),
7171            replies: json::one(object, &["replies"]),
7172            shares: json::one(object, &["shares"]),
7173            likes: json::one(object, &["likes"]),
7174            emoji_reactions: json::one(object, &["emojiReactions"]),
7175            start_time: json::one(object, &["startTime"]),
7176            summary: json::text(object, "summary"),
7177            tags: json::many(object, &["tag"]),
7178            updated: json::one(object, &["updated"]),
7179            urls: json::many(object, &["url"]),
7180            tos: json::many(object, &["to"]),
7181            btos: json::many(object, &["bto"]),
7182            ccs: json::many(object, &["cc"]),
7183            bccs: json::many(object, &["bcc"]),
7184            media_type: json::one(object, &["mediaType"]),
7185            duration: json::one(object, &["duration"]),
7186            sensitive: json::one(object, &["sensitive"]),
7187            source: json::one(object, &["source"]),
7188            proofs: json::many(object, &["proof"]),
7189            interaction_policy: json::one(object, &["interactionPolicy"]),
7190            approved_by: json::one(object, &["approvedBy"]),
7191            like_authorization: json::one(object, &["likeAuthorization"]),
7192            reply_authorization: json::one(object, &["replyAuthorization"]),
7193            announce_authorization: json::one(object, &["announceAuthorization"]),
7194            translations: json::many(object, &["translations"]),
7195            actors: json::many(object, &["actor"]),
7196            objects: json::many(object, &["object"]),
7197            targets: json::many(object, &["target"]),
7198            results: json::many(object, &["result"]),
7199            origins: json::many(object, &["origin"]),
7200            instruments: json::many(object, &["instrument"]),
7201        })
7202    }
7203}
7204
7205impl ToJson for Follow {
7206    fn to_json(&self) -> Value {
7207        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
7208        json::put_many(&mut object, &["attachment"], &self.attachments);
7209        json::put_many(&mut object, &["attributedTo"], &self.attributions);
7210        json::put_many(&mut object, &["audience"], &self.audiences);
7211        json::put_text(&mut object, "content", &self.content);
7212        json::put_many(&mut object, &["context"], &self.contexts);
7213        json::put_text(&mut object, "name", &self.name);
7214        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
7215        json::put_many(&mut object, &["generator"], &self.generators);
7216        json::put_many(&mut object, &["icon"], &self.icons);
7217        json::put_many(&mut object, &["image"], &self.images);
7218        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
7219        json::put_many(&mut object, &["location"], &self.locations);
7220        json::put_many(&mut object, &["preview"], &self.previews);
7221        json::put_one(&mut object, &["published"], self.published.as_ref());
7222        json::put_one(&mut object, &["replies"], self.replies.as_ref());
7223        json::put_one(&mut object, &["shares"], self.shares.as_ref());
7224        json::put_one(&mut object, &["likes"], self.likes.as_ref());
7225        json::put_one(
7226            &mut object,
7227            &["emojiReactions"],
7228            self.emoji_reactions.as_ref(),
7229        );
7230        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
7231        json::put_text(&mut object, "summary", &self.summary);
7232        json::put_many(&mut object, &["tag"], &self.tags);
7233        json::put_one(&mut object, &["updated"], self.updated.as_ref());
7234        json::put_many(&mut object, &["url"], &self.urls);
7235        json::put_many(&mut object, &["to"], &self.tos);
7236        json::put_many(&mut object, &["bto"], &self.btos);
7237        json::put_many(&mut object, &["cc"], &self.ccs);
7238        json::put_many(&mut object, &["bcc"], &self.bccs);
7239        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
7240        json::put_one(&mut object, &["duration"], self.duration.as_ref());
7241        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
7242        json::put_one(&mut object, &["source"], self.source.as_ref());
7243        json::put_many(&mut object, &["proof"], &self.proofs);
7244        json::put_one(
7245            &mut object,
7246            &["interactionPolicy"],
7247            self.interaction_policy.as_ref(),
7248        );
7249        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
7250        json::put_one(
7251            &mut object,
7252            &["likeAuthorization"],
7253            self.like_authorization.as_ref(),
7254        );
7255        json::put_one(
7256            &mut object,
7257            &["replyAuthorization"],
7258            self.reply_authorization.as_ref(),
7259        );
7260        json::put_one(
7261            &mut object,
7262            &["announceAuthorization"],
7263            self.announce_authorization.as_ref(),
7264        );
7265        json::put_many(&mut object, &["translations"], &self.translations);
7266        json::put_many(&mut object, &["actor"], &self.actors);
7267        json::put_many(&mut object, &["object"], &self.objects);
7268        json::put_many(&mut object, &["target"], &self.targets);
7269        json::put_many(&mut object, &["result"], &self.results);
7270        json::put_many(&mut object, &["origin"], &self.origins);
7271        json::put_many(&mut object, &["instrument"], &self.instruments);
7272        Value::Object(object)
7273    }
7274}
7275
7276/// Represents a formal or informal collective of Actors.
7277///
7278/// The type `https://www.w3.org/ns/activitystreams#Group`.
7279#[derive(Clone, Debug, Default, PartialEq)]
7280pub struct Group {
7281    /// The IRI that identifies this object.
7282    pub id: Option<Iri>,
7283    /// See [`Object::attachments`].
7284    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
7285    /// See [`Object::attributions`].
7286    pub attributions: Vec<AnyActor>,
7287    /// See [`Object::audiences`].
7288    pub audiences: Vec<AnyObject>,
7289    /// See [`Object::content`].
7290    pub content: Text,
7291    /// See [`Object::contexts`].
7292    pub contexts: Vec<LinkOrObject>,
7293    /// See [`Object::name`].
7294    pub name: Text,
7295    /// See [`Object::end_time`].
7296    pub end_time: Option<String>,
7297    /// See [`Object::generators`].
7298    pub generators: Vec<LinkOrObject>,
7299    /// See [`Object::icons`].
7300    pub icons: Vec<Reference<Image>>,
7301    /// See [`Object::images`].
7302    pub images: Vec<Reference<Image>>,
7303    /// See [`Object::reply_targets`].
7304    pub reply_targets: Vec<LinkOrObject>,
7305    /// See [`Object::locations`].
7306    pub locations: Vec<LinkOrObject>,
7307    /// See [`Object::previews`].
7308    pub previews: Vec<LinkOrObject>,
7309    /// See [`Object::published`].
7310    pub published: Option<String>,
7311    /// See [`Object::replies`].
7312    pub replies: Option<AnyCollection>,
7313    /// See [`Object::shares`].
7314    pub shares: Option<AnyCollection>,
7315    /// See [`Object::likes`].
7316    pub likes: Option<AnyCollection>,
7317    /// See [`Object::emoji_reactions`].
7318    pub emoji_reactions: Option<AnyCollection>,
7319    /// See [`Object::start_time`].
7320    pub start_time: Option<String>,
7321    /// See [`Object::summary`].
7322    pub summary: Text,
7323    /// See [`Object::tags`].
7324    pub tags: Vec<LinkOrObject>,
7325    /// See [`Object::updated`].
7326    pub updated: Option<String>,
7327    /// See [`Object::urls`].
7328    pub urls: Vec<LinkOrIri>,
7329    /// See [`Object::tos`].
7330    pub tos: Vec<AnyObject>,
7331    /// See [`Object::btos`].
7332    pub btos: Vec<AnyObject>,
7333    /// See [`Object::ccs`].
7334    pub ccs: Vec<AnyObject>,
7335    /// See [`Object::bccs`].
7336    pub bccs: Vec<AnyObject>,
7337    /// See [`Object::media_type`].
7338    pub media_type: Option<String>,
7339    /// See [`Object::duration`].
7340    pub duration: Option<String>,
7341    /// See [`Object::sensitive`].
7342    pub sensitive: Option<bool>,
7343    /// See [`Object::source`].
7344    pub source: Option<Box<Source>>,
7345    /// See [`Object::proofs`].
7346    pub proofs: Vec<Reference<DataIntegrityProof>>,
7347    /// See [`Object::interaction_policy`].
7348    pub interaction_policy: Option<Box<InteractionPolicy>>,
7349    /// See [`Object::approved_by`].
7350    pub approved_by: Option<Iri>,
7351    /// See [`Object::like_authorization`].
7352    pub like_authorization: Option<Reference<LikeAuthorization>>,
7353    /// See [`Object::reply_authorization`].
7354    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
7355    /// See [`Object::announce_authorization`].
7356    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
7357    /// See [`Object::translations`].
7358    pub translations: Vec<Translation>,
7359    /// A short username which may be used to refer to the actor,
7360    /// with no uniqueness guarantees.
7361    pub preferred_username: Text,
7362    /// A public part of the key pair owned by this actor.
7363    pub public_keys: Vec<Reference<CryptographicKey>>,
7364    /// Represents this actor's public keys.  It serves as equivalent to
7365    /// the `publicKeys` property, but is used for [FEP-521a](https://w3id.org/fep/521a) compliance.
7366    pub assertion_methods: Vec<Reference<Multikey>>,
7367    /// Gateways where the latest version of this portable actor object can be
7368    /// retrieved.
7369    pub gateways: Vec<Iri>,
7370    /// When `true`, conveys that for this actor, follow requests are not usually
7371    /// automatically approved, but instead are examined by a person who may accept
7372    /// or reject the request, at some time in the future.  Setting of `false`
7373    /// conveys no information and may be ignored.  This information is typically
7374    /// used to affect display of accounts, such as showing an account as private or
7375    /// locked.
7376    pub manually_approves_followers: Option<bool>,
7377    /// The inbox stream contains all activities received by the actor.  The server
7378    /// SHOULD filter content according to the requester's permission.  In general,
7379    /// the owner of an inbox is likely to be able to access all of their inbox
7380    /// contents.  Depending on access control, some other content may be public,
7381    /// whereas other content may require authentication for non-owner users,
7382    /// if they can access the inbox at all.
7383    pub inbox: Option<OrderedCollectionOrOrderedCollectionPage>,
7384    /// The outbox stream contains activities the user has published,
7385    /// subject to the ability of the requestor to retrieve the activity
7386    /// (that is, the contents of the outbox are filtered by the permissions of
7387    /// the person reading it).  If a user submits a request without
7388    /// [Authorization](https://www.w3.org/TR/activitypub/#authorization)
7389    /// the server should respond with all of the
7390    /// [Public](https://www.w3.org/TR/activitypub/#public-addressing) posts.
7391    /// This could potentially be all relevant objects published by the user,
7392    /// though the number of available items is left to the discretion of those
7393    /// implementing and deploying the server.
7394    pub outbox: Option<OrderedCollectionOrOrderedCollectionPage>,
7395    /// This is a list of everybody that the actor has followed, added as a
7396    /// [side effect](https://www.w3.org/TR/activitypub/#follow-activity-outbox).
7397    /// The `following` collection MUST be either an {@link OrderedCollection}
7398    /// or a {@link Collection} and MAY be filtered on privileges of
7399    /// an authenticated user or as appropriate when no authentication is given.
7400    pub following: Option<AnyCollection>,
7401    /// This is a list of everyone who has sent a {@link Follow} activity
7402    /// for the actor, added as a
7403    /// [side effect](https://www.w3.org/TR/activitypub/#follow-activity-outbox).
7404    /// This is where one would find a list of all the actors that are following
7405    /// the actor.  The `followers` collection MUST be either
7406    /// an {@link OrderedCollection} or a {@link Collection} and MAY be filtered on
7407    /// privileges of an authenticated user or as appropriate when no authentication
7408    /// is given.
7409    pub followers: Option<AnyCollection>,
7410    /// This is a list of every object from all of the actor's {@link Like}
7411    /// activities, added as a
7412    /// [side effect](https://www.w3.org/TR/activitypub/#like-activity-outbox).
7413    /// The `liked` collection MUST be either an {@link OrderedCollection} or
7414    /// a {@link Collection} and MAY be filtered on privileges of an authenticated
7415    /// user or as appropriate when no authentication is given.
7416    pub liked: Option<AnyCollection>,
7417    /// What is known in Mastodon as "pinned statuses", or statuses that are always
7418    /// featured at the top of people's profiles, is implemented using an extra
7419    /// property `featured` on the actor object that points to a {@link Collection}
7420    /// of objects.
7421    pub featured: Option<AnyCollection>,
7422    /// What is known in Mastodon as "featured hashtags", hashtags that are featured
7423    /// at people's profiles, is implemented using an extra property `featuredTags`
7424    /// on the actor object that points to a {@link Collection} of {@link Hashtag}
7425    /// objects specifically.
7426    pub featured_tags: Option<AnyCollection>,
7427    /// A collection of {@link FeaturedCollection}s created by this actor.
7428    pub featured_collections: Option<AnyCollection>,
7429    /// A list of supplementary Collections which may be of interest.
7430    pub streams: Vec<AnyCollection>,
7431    /// A JSON object which maps additional (typically server/domain-wide) endpoints
7432    /// which may be useful either for this actor or someone referencing this actor.
7433    /// This mapping may be nested inside the actor document as the value or may be
7434    /// a link to a JSON-LD document with these properties.
7435    pub endpoints: Option<Box<Endpoints>>,
7436    /// Allows users to opt-in or opt-out of discoverability features like
7437    /// the profile directory.  This flag may also be used as an indicator of
7438    /// the user's preferences toward being included in external discovery services,
7439    /// such as search engines or other indexing tools.
7440    pub discoverable: Option<bool>,
7441    /// Reports whether a user was locally suspended, for better handling of
7442    /// these accounts.
7443    pub suspended: Option<bool>,
7444    /// Whether the actor is in-memorial state.
7445    pub memorial: Option<bool>,
7446    /// Whether the actor allows to be indexed.
7447    pub indexable: Option<bool>,
7448    /// Signifies that an actor has been moved to a different ID. Used in Mastodon-style data portability with the {@link Move} activity; see [ActivityPub Data Portability/Move Action](https://swicg.github.io/activitypub-data-portability/#move-action) for more details.
7449    pub successor: Option<AnyActor>,
7450    /// The `aliases` (`alsoKnownAs`) property is used to specify alternative names
7451    /// or aliases for an entity.  It can be used to provide additional identifiers
7452    /// or labels for an entity, which can be useful in scenarios where an entity
7453    /// may have multiple names or aliases.
7454    pub aliases: Vec<AnyActor>,
7455    /// Means of communicating or interacting with the DID subject or associated
7456    /// entities via one or more service endpoints. Examples include discovery
7457    /// services, agent services, social networking services, file storage services,
7458    /// and verifiable credential repository services.
7459    pub services: Vec<AnyDidService>,
7460    /// This value is used for `Actor` type objects to show message on followed.
7461    pub followed_message: Option<String>,
7462    /// Used on actors to indicate that they in some way identify as a cat,
7463    /// expressed as a boolean value. If this property is set to `true`,
7464    /// displaying the actor or their notes will have some special effects
7465    /// attached in some clients.
7466    pub cat: Option<bool>,
7467    /// The actor's WebFinger handle, `user@host` (FEP-2c59).
7468    pub webfinger: Option<String>,
7469    /// Whether only the community's moderators may post in it.
7470    pub posting_restricted_to_mods: Option<bool>,
7471    /// The collection of the community's moderators.
7472    pub moderators: Option<AnyOrderedCollection>,
7473    /// The shared inbox, where Misskey writes it: on the actor rather than in
7474    /// its `endpoints`. Prefer `endpoints.sharedInbox` when both are there.
7475    pub shared_inbox: Option<Iri>,
7476}
7477
7478impl Group {
7479    /// The type's IRI.
7480    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Group";
7481    /// The type's `type` in a normalised document.
7482    pub const TYPE: &'static str = "Group";
7483}
7484
7485impl json::Typed for Group {
7486    const TYPE: &'static str = "Group";
7487}
7488
7489impl FromJson for Group {
7490    fn from_json(value: &Value) -> Result<Self, JsonError> {
7491        let object = json::object(value)?;
7492        json::expect_type(object, Self::TYPE)?;
7493        Ok(Self {
7494            id: json::id(object),
7495            attachments: json::many(object, &["attachment"]),
7496            attributions: json::many(object, &["attributedTo"]),
7497            audiences: json::many(object, &["audience"]),
7498            content: json::text(object, "content"),
7499            contexts: json::many(object, &["context"]),
7500            name: json::text(object, "name"),
7501            end_time: json::one(object, &["endTime"]),
7502            generators: json::many(object, &["generator"]),
7503            icons: json::many_mapped(object, &["icon"], json::link_to_image),
7504            images: json::many_mapped(object, &["image"], json::link_to_image),
7505            reply_targets: json::many(object, &["inReplyTo"]),
7506            locations: json::many(object, &["location"]),
7507            previews: json::many(object, &["preview"]),
7508            published: json::one(object, &["published"]),
7509            replies: json::one(object, &["replies"]),
7510            shares: json::one(object, &["shares"]),
7511            likes: json::one(object, &["likes"]),
7512            emoji_reactions: json::one(object, &["emojiReactions"]),
7513            start_time: json::one(object, &["startTime"]),
7514            summary: json::text(object, "summary"),
7515            tags: json::many(object, &["tag"]),
7516            updated: json::one(object, &["updated"]),
7517            urls: json::many(object, &["url"]),
7518            tos: json::many(object, &["to"]),
7519            btos: json::many(object, &["bto"]),
7520            ccs: json::many(object, &["cc"]),
7521            bccs: json::many(object, &["bcc"]),
7522            media_type: json::one(object, &["mediaType"]),
7523            duration: json::one(object, &["duration"]),
7524            sensitive: json::one(object, &["sensitive"]),
7525            source: json::one(object, &["source"]),
7526            proofs: json::many(object, &["proof"]),
7527            interaction_policy: json::one(object, &["interactionPolicy"]),
7528            approved_by: json::one(object, &["approvedBy"]),
7529            like_authorization: json::one(object, &["likeAuthorization"]),
7530            reply_authorization: json::one(object, &["replyAuthorization"]),
7531            announce_authorization: json::one(object, &["announceAuthorization"]),
7532            translations: json::many(object, &["translations"]),
7533            preferred_username: json::text(object, "preferredUsername"),
7534            public_keys: json::many_with(object, &["publicKey"], |value| {
7535                json::reference_with(value, CryptographicKey::from_json_untyped)
7536            }),
7537            assertion_methods: json::many(object, &["assertionMethod"]),
7538            gateways: json::many(object, &["gateways"]),
7539            manually_approves_followers: json::one(object, &["manuallyApprovesFollowers"]),
7540            inbox: json::one(object, &["inbox"]),
7541            outbox: json::one(object, &["outbox"]),
7542            following: json::one(object, &["following"]),
7543            followers: json::one(object, &["followers"]),
7544            liked: json::one(object, &["liked"]),
7545            featured: json::one(object, &["featured"]),
7546            featured_tags: json::one(object, &["featuredTags"]),
7547            featured_collections: json::one(
7548                object,
7549                &["https://w3id.org/fep/7aa9#featuredCollections"],
7550            ),
7551            streams: json::many(object, &["streams"]),
7552            endpoints: json::one(object, &["endpoints"]),
7553            discoverable: json::one(object, &["discoverable"]),
7554            suspended: json::one(object, &["suspended"]),
7555            memorial: json::one(object, &["memorial"]),
7556            indexable: json::one(object, &["indexable"]),
7557            successor: json::one(object, &["movedTo"]),
7558            aliases: json::many(object, &["alsoKnownAs"]),
7559            services: json::many(object, &["service"]),
7560            followed_message: json::one(object, &["_misskey_followedMessage"]),
7561            cat: json::one(object, &["isCat"]),
7562            webfinger: json::one(object, &["webfinger"]),
7563            posting_restricted_to_mods: json::one(object, &["postingRestrictedToMods"]),
7564            moderators: json::one(object, &["moderators"]),
7565            shared_inbox: json::one(object, &["sharedInbox"]),
7566        })
7567    }
7568}
7569
7570impl ToJson for Group {
7571    fn to_json(&self) -> Value {
7572        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
7573        json::put_many(&mut object, &["attachment"], &self.attachments);
7574        json::put_many(&mut object, &["attributedTo"], &self.attributions);
7575        json::put_many(&mut object, &["audience"], &self.audiences);
7576        json::put_text(&mut object, "content", &self.content);
7577        json::put_many(&mut object, &["context"], &self.contexts);
7578        json::put_text(&mut object, "name", &self.name);
7579        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
7580        json::put_many(&mut object, &["generator"], &self.generators);
7581        json::put_many(&mut object, &["icon"], &self.icons);
7582        json::put_many(&mut object, &["image"], &self.images);
7583        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
7584        json::put_many(&mut object, &["location"], &self.locations);
7585        json::put_many(&mut object, &["preview"], &self.previews);
7586        json::put_one(&mut object, &["published"], self.published.as_ref());
7587        json::put_one(&mut object, &["replies"], self.replies.as_ref());
7588        json::put_one(&mut object, &["shares"], self.shares.as_ref());
7589        json::put_one(&mut object, &["likes"], self.likes.as_ref());
7590        json::put_one(
7591            &mut object,
7592            &["emojiReactions"],
7593            self.emoji_reactions.as_ref(),
7594        );
7595        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
7596        json::put_text(&mut object, "summary", &self.summary);
7597        json::put_many(&mut object, &["tag"], &self.tags);
7598        json::put_one(&mut object, &["updated"], self.updated.as_ref());
7599        json::put_many(&mut object, &["url"], &self.urls);
7600        json::put_many(&mut object, &["to"], &self.tos);
7601        json::put_many(&mut object, &["bto"], &self.btos);
7602        json::put_many(&mut object, &["cc"], &self.ccs);
7603        json::put_many(&mut object, &["bcc"], &self.bccs);
7604        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
7605        json::put_one(&mut object, &["duration"], self.duration.as_ref());
7606        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
7607        json::put_one(&mut object, &["source"], self.source.as_ref());
7608        json::put_many(&mut object, &["proof"], &self.proofs);
7609        json::put_one(
7610            &mut object,
7611            &["interactionPolicy"],
7612            self.interaction_policy.as_ref(),
7613        );
7614        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
7615        json::put_one(
7616            &mut object,
7617            &["likeAuthorization"],
7618            self.like_authorization.as_ref(),
7619        );
7620        json::put_one(
7621            &mut object,
7622            &["replyAuthorization"],
7623            self.reply_authorization.as_ref(),
7624        );
7625        json::put_one(
7626            &mut object,
7627            &["announceAuthorization"],
7628            self.announce_authorization.as_ref(),
7629        );
7630        json::put_many(&mut object, &["translations"], &self.translations);
7631        json::put_text(&mut object, "preferredUsername", &self.preferred_username);
7632        json::put_many_with(
7633            &mut object,
7634            &["publicKey"],
7635            &self.public_keys,
7636            |reference| json::write_reference(reference, CryptographicKey::to_json_untyped),
7637        );
7638        json::put_many(&mut object, &["assertionMethod"], &self.assertion_methods);
7639        json::put_many(&mut object, &["gateways"], &self.gateways);
7640        json::put_one(
7641            &mut object,
7642            &["manuallyApprovesFollowers"],
7643            self.manually_approves_followers.as_ref(),
7644        );
7645        json::put_one(&mut object, &["inbox"], self.inbox.as_ref());
7646        json::put_one(&mut object, &["outbox"], self.outbox.as_ref());
7647        json::put_one(&mut object, &["following"], self.following.as_ref());
7648        json::put_one(&mut object, &["followers"], self.followers.as_ref());
7649        json::put_one(&mut object, &["liked"], self.liked.as_ref());
7650        json::put_one(&mut object, &["featured"], self.featured.as_ref());
7651        json::put_one(&mut object, &["featuredTags"], self.featured_tags.as_ref());
7652        json::put_one(
7653            &mut object,
7654            &["https://w3id.org/fep/7aa9#featuredCollections"],
7655            self.featured_collections.as_ref(),
7656        );
7657        json::put_many(&mut object, &["streams"], &self.streams);
7658        json::put_one(&mut object, &["endpoints"], self.endpoints.as_ref());
7659        json::put_one(&mut object, &["discoverable"], self.discoverable.as_ref());
7660        json::put_one(&mut object, &["suspended"], self.suspended.as_ref());
7661        json::put_one(&mut object, &["memorial"], self.memorial.as_ref());
7662        json::put_one(&mut object, &["indexable"], self.indexable.as_ref());
7663        json::put_one(&mut object, &["movedTo"], self.successor.as_ref());
7664        json::put_many(&mut object, &["alsoKnownAs"], &self.aliases);
7665        json::put_many(&mut object, &["service"], &self.services);
7666        json::put_one(
7667            &mut object,
7668            &["_misskey_followedMessage"],
7669            self.followed_message.as_ref(),
7670        );
7671        json::put_one(&mut object, &["isCat"], self.cat.as_ref());
7672        json::put_one(&mut object, &["webfinger"], self.webfinger.as_ref());
7673        json::put_one(
7674            &mut object,
7675            &["postingRestrictedToMods"],
7676            self.posting_restricted_to_mods.as_ref(),
7677        );
7678        json::put_one(&mut object, &["moderators"], self.moderators.as_ref());
7679        json::put_one(&mut object, &["sharedInbox"], self.shared_inbox.as_ref());
7680        Value::Object(object)
7681    }
7682}
7683
7684/// A specialized {@link Link} that represents an #hashtag.
7685///
7686/// The type `https://www.w3.org/ns/activitystreams#Hashtag`.
7687#[derive(Clone, Debug, Default, PartialEq)]
7688pub struct Hashtag {
7689    /// See [`Link::href`].
7690    pub href: Option<Iri>,
7691    /// See [`Link::rels`].
7692    pub rels: Vec<String>,
7693    /// See [`Link::media_type`].
7694    pub media_type: Option<String>,
7695    /// See [`Link::digest_multibase`].
7696    pub digest_multibase: Option<String>,
7697    /// See [`Link::name`].
7698    pub name: Text,
7699    /// See [`Link::language`].
7700    pub language: Option<String>,
7701    /// See [`Link::height`].
7702    pub height: Option<u64>,
7703    /// See [`Link::width`].
7704    pub width: Option<u64>,
7705    /// See [`Link::previews`].
7706    pub previews: Vec<LinkOrObject>,
7707}
7708
7709impl Hashtag {
7710    /// The type's IRI.
7711    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Hashtag";
7712    /// The type's `type` in a normalised document.
7713    pub const TYPE: &'static str = "Hashtag";
7714}
7715
7716impl json::Typed for Hashtag {
7717    const TYPE: &'static str = "Hashtag";
7718}
7719
7720impl FromJson for Hashtag {
7721    fn from_json(value: &Value) -> Result<Self, JsonError> {
7722        let object = json::object(value)?;
7723        json::expect_type(object, Self::TYPE)?;
7724        Ok(Self {
7725            href: json::one(object, &["href"]),
7726            rels: json::many(object, &["rel"]),
7727            media_type: json::one(object, &["mediaType"]),
7728            digest_multibase: json::one(object, &["digestMultibase"]),
7729            name: json::text(object, "name"),
7730            language: json::one(object, &["hreflang"]),
7731            height: json::one(object, &["height"]),
7732            width: json::one(object, &["width"]),
7733            previews: json::many(object, &["preview"]),
7734        })
7735    }
7736}
7737
7738impl ToJson for Hashtag {
7739    fn to_json(&self) -> Value {
7740        let mut object = json::new_object(Some(Self::TYPE), None);
7741        json::put_one(&mut object, &["href"], self.href.as_ref());
7742        json::put_many(&mut object, &["rel"], &self.rels);
7743        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
7744        json::put_one(
7745            &mut object,
7746            &["digestMultibase"],
7747            self.digest_multibase.as_ref(),
7748        );
7749        json::put_text(&mut object, "name", &self.name);
7750        json::put_one(&mut object, &["hreflang"], self.language.as_ref());
7751        json::put_one(&mut object, &["height"], self.height.as_ref());
7752        json::put_one(&mut object, &["width"], self.width.as_ref());
7753        json::put_many(&mut object, &["preview"], &self.previews);
7754        Value::Object(object)
7755    }
7756}
7757
7758/// Indicates that the `actor` is ignoring the `object`.  The `target` and
7759/// `origin` typically have no defined meaning.
7760///
7761/// The type `https://www.w3.org/ns/activitystreams#Ignore`.
7762#[derive(Clone, Debug, Default, PartialEq)]
7763pub struct Ignore {
7764    /// The IRI that identifies this object.
7765    pub id: Option<Iri>,
7766    /// See [`Object::attachments`].
7767    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
7768    /// See [`Object::attributions`].
7769    pub attributions: Vec<AnyActor>,
7770    /// See [`Object::audiences`].
7771    pub audiences: Vec<AnyObject>,
7772    /// See [`Object::content`].
7773    pub content: Text,
7774    /// See [`Object::contexts`].
7775    pub contexts: Vec<LinkOrObject>,
7776    /// See [`Object::name`].
7777    pub name: Text,
7778    /// See [`Object::end_time`].
7779    pub end_time: Option<String>,
7780    /// See [`Object::generators`].
7781    pub generators: Vec<LinkOrObject>,
7782    /// See [`Object::icons`].
7783    pub icons: Vec<Reference<Image>>,
7784    /// See [`Object::images`].
7785    pub images: Vec<Reference<Image>>,
7786    /// See [`Object::reply_targets`].
7787    pub reply_targets: Vec<LinkOrObject>,
7788    /// See [`Object::locations`].
7789    pub locations: Vec<LinkOrObject>,
7790    /// See [`Object::previews`].
7791    pub previews: Vec<LinkOrObject>,
7792    /// See [`Object::published`].
7793    pub published: Option<String>,
7794    /// See [`Object::replies`].
7795    pub replies: Option<AnyCollection>,
7796    /// See [`Object::shares`].
7797    pub shares: Option<AnyCollection>,
7798    /// See [`Object::likes`].
7799    pub likes: Option<AnyCollection>,
7800    /// See [`Object::emoji_reactions`].
7801    pub emoji_reactions: Option<AnyCollection>,
7802    /// See [`Object::start_time`].
7803    pub start_time: Option<String>,
7804    /// See [`Object::summary`].
7805    pub summary: Text,
7806    /// See [`Object::tags`].
7807    pub tags: Vec<LinkOrObject>,
7808    /// See [`Object::updated`].
7809    pub updated: Option<String>,
7810    /// See [`Object::urls`].
7811    pub urls: Vec<LinkOrIri>,
7812    /// See [`Object::tos`].
7813    pub tos: Vec<AnyObject>,
7814    /// See [`Object::btos`].
7815    pub btos: Vec<AnyObject>,
7816    /// See [`Object::ccs`].
7817    pub ccs: Vec<AnyObject>,
7818    /// See [`Object::bccs`].
7819    pub bccs: Vec<AnyObject>,
7820    /// See [`Object::media_type`].
7821    pub media_type: Option<String>,
7822    /// See [`Object::duration`].
7823    pub duration: Option<String>,
7824    /// See [`Object::sensitive`].
7825    pub sensitive: Option<bool>,
7826    /// See [`Object::source`].
7827    pub source: Option<Box<Source>>,
7828    /// See [`Object::proofs`].
7829    pub proofs: Vec<Reference<DataIntegrityProof>>,
7830    /// See [`Object::interaction_policy`].
7831    pub interaction_policy: Option<Box<InteractionPolicy>>,
7832    /// See [`Object::approved_by`].
7833    pub approved_by: Option<Iri>,
7834    /// See [`Object::like_authorization`].
7835    pub like_authorization: Option<Reference<LikeAuthorization>>,
7836    /// See [`Object::reply_authorization`].
7837    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
7838    /// See [`Object::announce_authorization`].
7839    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
7840    /// See [`Object::translations`].
7841    pub translations: Vec<Translation>,
7842    /// See [`Activity::actors`].
7843    pub actors: Vec<AnyActor>,
7844    /// See [`Activity::objects`].
7845    pub objects: Vec<AnyObject>,
7846    /// See [`Activity::targets`].
7847    pub targets: Vec<AnyObject>,
7848    /// See [`Activity::results`].
7849    pub results: Vec<AnyObject>,
7850    /// See [`Activity::origins`].
7851    pub origins: Vec<AnyObject>,
7852    /// See [`Activity::instruments`].
7853    pub instruments: Vec<AnyObject>,
7854}
7855
7856impl Ignore {
7857    /// The type's IRI.
7858    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Ignore";
7859    /// The type's `type` in a normalised document.
7860    pub const TYPE: &'static str = "Ignore";
7861}
7862
7863impl json::Typed for Ignore {
7864    const TYPE: &'static str = "Ignore";
7865}
7866
7867impl FromJson for Ignore {
7868    fn from_json(value: &Value) -> Result<Self, JsonError> {
7869        let object = json::object(value)?;
7870        json::expect_type(object, Self::TYPE)?;
7871        Ok(Self {
7872            id: json::id(object),
7873            attachments: json::many(object, &["attachment"]),
7874            attributions: json::many(object, &["attributedTo"]),
7875            audiences: json::many(object, &["audience"]),
7876            content: json::text(object, "content"),
7877            contexts: json::many(object, &["context"]),
7878            name: json::text(object, "name"),
7879            end_time: json::one(object, &["endTime"]),
7880            generators: json::many(object, &["generator"]),
7881            icons: json::many_mapped(object, &["icon"], json::link_to_image),
7882            images: json::many_mapped(object, &["image"], json::link_to_image),
7883            reply_targets: json::many(object, &["inReplyTo"]),
7884            locations: json::many(object, &["location"]),
7885            previews: json::many(object, &["preview"]),
7886            published: json::one(object, &["published"]),
7887            replies: json::one(object, &["replies"]),
7888            shares: json::one(object, &["shares"]),
7889            likes: json::one(object, &["likes"]),
7890            emoji_reactions: json::one(object, &["emojiReactions"]),
7891            start_time: json::one(object, &["startTime"]),
7892            summary: json::text(object, "summary"),
7893            tags: json::many(object, &["tag"]),
7894            updated: json::one(object, &["updated"]),
7895            urls: json::many(object, &["url"]),
7896            tos: json::many(object, &["to"]),
7897            btos: json::many(object, &["bto"]),
7898            ccs: json::many(object, &["cc"]),
7899            bccs: json::many(object, &["bcc"]),
7900            media_type: json::one(object, &["mediaType"]),
7901            duration: json::one(object, &["duration"]),
7902            sensitive: json::one(object, &["sensitive"]),
7903            source: json::one(object, &["source"]),
7904            proofs: json::many(object, &["proof"]),
7905            interaction_policy: json::one(object, &["interactionPolicy"]),
7906            approved_by: json::one(object, &["approvedBy"]),
7907            like_authorization: json::one(object, &["likeAuthorization"]),
7908            reply_authorization: json::one(object, &["replyAuthorization"]),
7909            announce_authorization: json::one(object, &["announceAuthorization"]),
7910            translations: json::many(object, &["translations"]),
7911            actors: json::many(object, &["actor"]),
7912            objects: json::many(object, &["object"]),
7913            targets: json::many(object, &["target"]),
7914            results: json::many(object, &["result"]),
7915            origins: json::many(object, &["origin"]),
7916            instruments: json::many(object, &["instrument"]),
7917        })
7918    }
7919}
7920
7921impl ToJson for Ignore {
7922    fn to_json(&self) -> Value {
7923        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
7924        json::put_many(&mut object, &["attachment"], &self.attachments);
7925        json::put_many(&mut object, &["attributedTo"], &self.attributions);
7926        json::put_many(&mut object, &["audience"], &self.audiences);
7927        json::put_text(&mut object, "content", &self.content);
7928        json::put_many(&mut object, &["context"], &self.contexts);
7929        json::put_text(&mut object, "name", &self.name);
7930        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
7931        json::put_many(&mut object, &["generator"], &self.generators);
7932        json::put_many(&mut object, &["icon"], &self.icons);
7933        json::put_many(&mut object, &["image"], &self.images);
7934        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
7935        json::put_many(&mut object, &["location"], &self.locations);
7936        json::put_many(&mut object, &["preview"], &self.previews);
7937        json::put_one(&mut object, &["published"], self.published.as_ref());
7938        json::put_one(&mut object, &["replies"], self.replies.as_ref());
7939        json::put_one(&mut object, &["shares"], self.shares.as_ref());
7940        json::put_one(&mut object, &["likes"], self.likes.as_ref());
7941        json::put_one(
7942            &mut object,
7943            &["emojiReactions"],
7944            self.emoji_reactions.as_ref(),
7945        );
7946        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
7947        json::put_text(&mut object, "summary", &self.summary);
7948        json::put_many(&mut object, &["tag"], &self.tags);
7949        json::put_one(&mut object, &["updated"], self.updated.as_ref());
7950        json::put_many(&mut object, &["url"], &self.urls);
7951        json::put_many(&mut object, &["to"], &self.tos);
7952        json::put_many(&mut object, &["bto"], &self.btos);
7953        json::put_many(&mut object, &["cc"], &self.ccs);
7954        json::put_many(&mut object, &["bcc"], &self.bccs);
7955        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
7956        json::put_one(&mut object, &["duration"], self.duration.as_ref());
7957        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
7958        json::put_one(&mut object, &["source"], self.source.as_ref());
7959        json::put_many(&mut object, &["proof"], &self.proofs);
7960        json::put_one(
7961            &mut object,
7962            &["interactionPolicy"],
7963            self.interaction_policy.as_ref(),
7964        );
7965        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
7966        json::put_one(
7967            &mut object,
7968            &["likeAuthorization"],
7969            self.like_authorization.as_ref(),
7970        );
7971        json::put_one(
7972            &mut object,
7973            &["replyAuthorization"],
7974            self.reply_authorization.as_ref(),
7975        );
7976        json::put_one(
7977            &mut object,
7978            &["announceAuthorization"],
7979            self.announce_authorization.as_ref(),
7980        );
7981        json::put_many(&mut object, &["translations"], &self.translations);
7982        json::put_many(&mut object, &["actor"], &self.actors);
7983        json::put_many(&mut object, &["object"], &self.objects);
7984        json::put_many(&mut object, &["target"], &self.targets);
7985        json::put_many(&mut object, &["result"], &self.results);
7986        json::put_many(&mut object, &["origin"], &self.origins);
7987        json::put_many(&mut object, &["instrument"], &self.instruments);
7988        Value::Object(object)
7989    }
7990}
7991
7992/// An image document of any kind.
7993///
7994/// The type `https://www.w3.org/ns/activitystreams#Image`.
7995#[derive(Clone, Debug, Default, PartialEq)]
7996pub struct Image {
7997    /// The IRI that identifies this object.
7998    pub id: Option<Iri>,
7999    /// See [`Object::attachments`].
8000    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
8001    /// See [`Object::attributions`].
8002    pub attributions: Vec<AnyActor>,
8003    /// See [`Object::audiences`].
8004    pub audiences: Vec<AnyObject>,
8005    /// See [`Object::content`].
8006    pub content: Text,
8007    /// See [`Object::contexts`].
8008    pub contexts: Vec<LinkOrObject>,
8009    /// See [`Object::name`].
8010    pub name: Text,
8011    /// See [`Object::end_time`].
8012    pub end_time: Option<String>,
8013    /// See [`Object::generators`].
8014    pub generators: Vec<LinkOrObject>,
8015    /// See [`Object::icons`].
8016    pub icons: Vec<Reference<Image>>,
8017    /// See [`Object::images`].
8018    pub images: Vec<Reference<Image>>,
8019    /// See [`Object::reply_targets`].
8020    pub reply_targets: Vec<LinkOrObject>,
8021    /// See [`Object::locations`].
8022    pub locations: Vec<LinkOrObject>,
8023    /// See [`Object::previews`].
8024    pub previews: Vec<LinkOrObject>,
8025    /// See [`Object::published`].
8026    pub published: Option<String>,
8027    /// See [`Object::replies`].
8028    pub replies: Option<AnyCollection>,
8029    /// See [`Object::shares`].
8030    pub shares: Option<AnyCollection>,
8031    /// See [`Object::likes`].
8032    pub likes: Option<AnyCollection>,
8033    /// See [`Object::emoji_reactions`].
8034    pub emoji_reactions: Option<AnyCollection>,
8035    /// See [`Object::start_time`].
8036    pub start_time: Option<String>,
8037    /// See [`Object::summary`].
8038    pub summary: Text,
8039    /// See [`Object::tags`].
8040    pub tags: Vec<LinkOrObject>,
8041    /// See [`Object::updated`].
8042    pub updated: Option<String>,
8043    /// See [`Object::urls`].
8044    pub urls: Vec<LinkOrIri>,
8045    /// See [`Object::tos`].
8046    pub tos: Vec<AnyObject>,
8047    /// See [`Object::btos`].
8048    pub btos: Vec<AnyObject>,
8049    /// See [`Object::ccs`].
8050    pub ccs: Vec<AnyObject>,
8051    /// See [`Object::bccs`].
8052    pub bccs: Vec<AnyObject>,
8053    /// See [`Object::media_type`].
8054    pub media_type: Option<String>,
8055    /// See [`Object::duration`].
8056    pub duration: Option<String>,
8057    /// See [`Object::sensitive`].
8058    pub sensitive: Option<bool>,
8059    /// See [`Object::source`].
8060    pub source: Option<Box<Source>>,
8061    /// See [`Object::proofs`].
8062    pub proofs: Vec<Reference<DataIntegrityProof>>,
8063    /// See [`Object::interaction_policy`].
8064    pub interaction_policy: Option<Box<InteractionPolicy>>,
8065    /// See [`Object::approved_by`].
8066    pub approved_by: Option<Iri>,
8067    /// See [`Object::like_authorization`].
8068    pub like_authorization: Option<Reference<LikeAuthorization>>,
8069    /// See [`Object::reply_authorization`].
8070    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
8071    /// See [`Object::announce_authorization`].
8072    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
8073    /// See [`Object::translations`].
8074    pub translations: Vec<Translation>,
8075    /// See [`Document::width`].
8076    pub width: Option<u64>,
8077    /// See [`Document::height`].
8078    pub height: Option<u64>,
8079    /// See [`Document::digest_multibase`].
8080    pub digest_multibase: Option<String>,
8081    /// See [`Document::blurhash`].
8082    pub blurhash: Option<String>,
8083    /// See [`Document::focal_point`].
8084    pub focal_point: Vec<f64>,
8085}
8086
8087impl Image {
8088    /// The type's IRI.
8089    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Image";
8090    /// The type's `type` in a normalised document.
8091    pub const TYPE: &'static str = "Image";
8092}
8093
8094impl json::Typed for Image {
8095    const TYPE: &'static str = "Image";
8096}
8097
8098impl FromJson for Image {
8099    fn from_json(value: &Value) -> Result<Self, JsonError> {
8100        let object = json::object(value)?;
8101        json::expect_type(object, Self::TYPE)?;
8102        Ok(Self {
8103            id: json::id(object),
8104            attachments: json::many(object, &["attachment"]),
8105            attributions: json::many(object, &["attributedTo"]),
8106            audiences: json::many(object, &["audience"]),
8107            content: json::text(object, "content"),
8108            contexts: json::many(object, &["context"]),
8109            name: json::text(object, "name"),
8110            end_time: json::one(object, &["endTime"]),
8111            generators: json::many(object, &["generator"]),
8112            icons: json::many_mapped(object, &["icon"], json::link_to_image),
8113            images: json::many_mapped(object, &["image"], json::link_to_image),
8114            reply_targets: json::many(object, &["inReplyTo"]),
8115            locations: json::many(object, &["location"]),
8116            previews: json::many(object, &["preview"]),
8117            published: json::one(object, &["published"]),
8118            replies: json::one(object, &["replies"]),
8119            shares: json::one(object, &["shares"]),
8120            likes: json::one(object, &["likes"]),
8121            emoji_reactions: json::one(object, &["emojiReactions"]),
8122            start_time: json::one(object, &["startTime"]),
8123            summary: json::text(object, "summary"),
8124            tags: json::many(object, &["tag"]),
8125            updated: json::one(object, &["updated"]),
8126            urls: json::many(object, &["url"]),
8127            tos: json::many(object, &["to"]),
8128            btos: json::many(object, &["bto"]),
8129            ccs: json::many(object, &["cc"]),
8130            bccs: json::many(object, &["bcc"]),
8131            media_type: json::one(object, &["mediaType"]),
8132            duration: json::one(object, &["duration"]),
8133            sensitive: json::one(object, &["sensitive"]),
8134            source: json::one(object, &["source"]),
8135            proofs: json::many(object, &["proof"]),
8136            interaction_policy: json::one(object, &["interactionPolicy"]),
8137            approved_by: json::one(object, &["approvedBy"]),
8138            like_authorization: json::one(object, &["likeAuthorization"]),
8139            reply_authorization: json::one(object, &["replyAuthorization"]),
8140            announce_authorization: json::one(object, &["announceAuthorization"]),
8141            translations: json::many(object, &["translations"]),
8142            width: json::one(object, &["width"]),
8143            height: json::one(object, &["height"]),
8144            digest_multibase: json::one(object, &["digestMultibase"]),
8145            blurhash: json::one(object, &["blurhash"]),
8146            focal_point: json::many(object, &["focalPoint"]),
8147        })
8148    }
8149}
8150
8151impl ToJson for Image {
8152    fn to_json(&self) -> Value {
8153        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
8154        json::put_many(&mut object, &["attachment"], &self.attachments);
8155        json::put_many(&mut object, &["attributedTo"], &self.attributions);
8156        json::put_many(&mut object, &["audience"], &self.audiences);
8157        json::put_text(&mut object, "content", &self.content);
8158        json::put_many(&mut object, &["context"], &self.contexts);
8159        json::put_text(&mut object, "name", &self.name);
8160        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
8161        json::put_many(&mut object, &["generator"], &self.generators);
8162        json::put_many(&mut object, &["icon"], &self.icons);
8163        json::put_many(&mut object, &["image"], &self.images);
8164        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
8165        json::put_many(&mut object, &["location"], &self.locations);
8166        json::put_many(&mut object, &["preview"], &self.previews);
8167        json::put_one(&mut object, &["published"], self.published.as_ref());
8168        json::put_one(&mut object, &["replies"], self.replies.as_ref());
8169        json::put_one(&mut object, &["shares"], self.shares.as_ref());
8170        json::put_one(&mut object, &["likes"], self.likes.as_ref());
8171        json::put_one(
8172            &mut object,
8173            &["emojiReactions"],
8174            self.emoji_reactions.as_ref(),
8175        );
8176        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
8177        json::put_text(&mut object, "summary", &self.summary);
8178        json::put_many(&mut object, &["tag"], &self.tags);
8179        json::put_one(&mut object, &["updated"], self.updated.as_ref());
8180        json::put_many(&mut object, &["url"], &self.urls);
8181        json::put_many(&mut object, &["to"], &self.tos);
8182        json::put_many(&mut object, &["bto"], &self.btos);
8183        json::put_many(&mut object, &["cc"], &self.ccs);
8184        json::put_many(&mut object, &["bcc"], &self.bccs);
8185        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
8186        json::put_one(&mut object, &["duration"], self.duration.as_ref());
8187        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
8188        json::put_one(&mut object, &["source"], self.source.as_ref());
8189        json::put_many(&mut object, &["proof"], &self.proofs);
8190        json::put_one(
8191            &mut object,
8192            &["interactionPolicy"],
8193            self.interaction_policy.as_ref(),
8194        );
8195        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
8196        json::put_one(
8197            &mut object,
8198            &["likeAuthorization"],
8199            self.like_authorization.as_ref(),
8200        );
8201        json::put_one(
8202            &mut object,
8203            &["replyAuthorization"],
8204            self.reply_authorization.as_ref(),
8205        );
8206        json::put_one(
8207            &mut object,
8208            &["announceAuthorization"],
8209            self.announce_authorization.as_ref(),
8210        );
8211        json::put_many(&mut object, &["translations"], &self.translations);
8212        json::put_one(&mut object, &["width"], self.width.as_ref());
8213        json::put_one(&mut object, &["height"], self.height.as_ref());
8214        json::put_one(
8215            &mut object,
8216            &["digestMultibase"],
8217            self.digest_multibase.as_ref(),
8218        );
8219        json::put_one(&mut object, &["blurhash"], self.blurhash.as_ref());
8220        json::put_many(&mut object, &["focalPoint"], &self.focal_point);
8221        Value::Object(object)
8222    }
8223}
8224
8225/// A proposed economic transaction describing what is being offered or requested
8226/// in a {@link Proposal}.
8227///
8228/// The type `https://w3id.org/valueflows/ont/vf#Intent`.
8229#[derive(Clone, Debug, Default, PartialEq)]
8230pub struct Intent {
8231    /// The type of economic transaction.  The value of this property should be
8232    /// either `"deliverService"` or `"transfer"`.
8233    pub action: Option<String>,
8234    /// The type of an economic resource.  Could be any URI.
8235    pub resource_conforms_to: Option<Iri>,
8236    /// The amount and unit of the economic resource.
8237    pub resource_quantity: Option<Box<Measure>>,
8238    /// The quantity of the offered resource currently available.
8239    pub available_quantity: Option<Box<Measure>>,
8240    /// The minimum possible quantity of the resource.
8241    pub minimum_quantity: Option<Box<Measure>>,
8242}
8243
8244impl Intent {
8245    /// The type's IRI.
8246    pub const TYPE_IRI: &'static str = "https://w3id.org/valueflows/ont/vf#Intent";
8247    /// The type's `type` in a normalised document.
8248    pub const TYPE: &'static str = "Intent";
8249}
8250
8251impl json::Typed for Intent {
8252    const TYPE: &'static str = "Intent";
8253}
8254
8255impl FromJson for Intent {
8256    fn from_json(value: &Value) -> Result<Self, JsonError> {
8257        let object = json::object(value)?;
8258        json::expect_type(object, Self::TYPE)?;
8259        Ok(Self {
8260            action: json::one(object, &["action"]),
8261            resource_conforms_to: json::one(object, &["resourceConformsTo"]),
8262            resource_quantity: json::one_with(object, &["resourceQuantity"], |value| {
8263                Measure::from_json_untyped(value).map(Box::new)
8264            }),
8265            available_quantity: json::one_with(object, &["availableQuantity"], |value| {
8266                Measure::from_json_untyped(value).map(Box::new)
8267            }),
8268            minimum_quantity: json::one_with(object, &["minimumQuantity"], |value| {
8269                Measure::from_json_untyped(value).map(Box::new)
8270            }),
8271        })
8272    }
8273}
8274
8275impl ToJson for Intent {
8276    fn to_json(&self) -> Value {
8277        let mut object = json::new_object(Some(Self::TYPE), None);
8278        json::put_one(&mut object, &["action"], self.action.as_ref());
8279        json::put_one(
8280            &mut object,
8281            &["resourceConformsTo"],
8282            self.resource_conforms_to.as_ref(),
8283        );
8284        json::put_one_with(
8285            &mut object,
8286            &["resourceQuantity"],
8287            self.resource_quantity.as_ref(),
8288            |value| value.to_json_untyped(),
8289        );
8290        json::put_one_with(
8291            &mut object,
8292            &["availableQuantity"],
8293            self.available_quantity.as_ref(),
8294            |value| value.to_json_untyped(),
8295        );
8296        json::put_one_with(
8297            &mut object,
8298            &["minimumQuantity"],
8299            self.minimum_quantity.as_ref(),
8300            |value| value.to_json_untyped(),
8301        );
8302        Value::Object(object)
8303    }
8304}
8305
8306/// Represents an interaction policy attached to a post, specifying who can
8307/// like, reply to, announce, or quote it.  Each sub-policy
8308/// ({@link InteractionRule}) defines which actors receive automatic or manual
8309/// approval.
8310///
8311/// The type `https://gotosocial.org/ns#InteractionPolicy`.
8312#[derive(Clone, Debug, Default, PartialEq)]
8313pub struct InteractionPolicy {
8314    /// The sub-policy specifying who can feature the actor in a
8315    /// {@link FeaturedCollection}.
8316    pub can_feature: Option<Box<InteractionRule>>,
8317    /// The sub-policy specifying who can like the post.
8318    pub can_like: Option<Box<InteractionRule>>,
8319    /// The sub-policy specifying who can reply to the post.
8320    pub can_reply: Option<Box<InteractionRule>>,
8321    /// The sub-policy specifying who can announce (boost) the post.
8322    pub can_announce: Option<Box<InteractionRule>>,
8323    /// The sub-policy specifying who can quote the post.
8324    pub can_quote: Option<Box<InteractionRule>>,
8325}
8326
8327impl InteractionPolicy {
8328    /// The type's IRI.
8329    pub const TYPE_IRI: &'static str = "https://gotosocial.org/ns#InteractionPolicy";
8330}
8331
8332impl FromJson for InteractionPolicy {
8333    fn from_json(value: &Value) -> Result<Self, JsonError> {
8334        let object = json::object(value)?;
8335        Ok(Self {
8336            can_feature: json::one(object, &["canFeature"]),
8337            can_like: json::one(object, &["canLike"]),
8338            can_reply: json::one(object, &["canReply"]),
8339            can_announce: json::one(object, &["canAnnounce"]),
8340            can_quote: json::one(object, &["canQuote"]),
8341        })
8342    }
8343}
8344
8345impl ToJson for InteractionPolicy {
8346    fn to_json(&self) -> Value {
8347        let mut object = json::new_object(None, None);
8348        json::put_one(&mut object, &["canFeature"], self.can_feature.as_ref());
8349        json::put_one(&mut object, &["canLike"], self.can_like.as_ref());
8350        json::put_one(&mut object, &["canReply"], self.can_reply.as_ref());
8351        json::put_one(&mut object, &["canAnnounce"], self.can_announce.as_ref());
8352        json::put_one(&mut object, &["canQuote"], self.can_quote.as_ref());
8353        Value::Object(object)
8354    }
8355}
8356
8357/// Represents a sub-policy within an {@link InteractionPolicy}, defining which
8358/// actors receive automatic or manual approval for a specific interaction type
8359/// (like, reply, or announce).
8360///
8361/// The type `https://gotosocial.org/ns#InteractionRule`.
8362#[derive(Clone, Debug, Default, PartialEq)]
8363pub struct InteractionRule {
8364    /// URIs of actors or collections whose interactions are automatically
8365    /// approved without requiring manual review by the post author.
8366    pub automatic_approvals: Vec<Iri>,
8367    /// URIs of actors or collections whose interactions require manual approval
8368    /// by the post author.  The post author can accept or reject these
8369    /// interactions at their discretion.
8370    pub manual_approvals: Vec<Iri>,
8371}
8372
8373impl InteractionRule {
8374    /// The type's IRI.
8375    pub const TYPE_IRI: &'static str = "https://gotosocial.org/ns#InteractionRule";
8376}
8377
8378impl FromJson for InteractionRule {
8379    fn from_json(value: &Value) -> Result<Self, JsonError> {
8380        let object = json::object(value)?;
8381        Ok(Self {
8382            automatic_approvals: json::many(object, &["automaticApproval"]),
8383            manual_approvals: json::many(object, &["manualApproval"]),
8384        })
8385    }
8386}
8387
8388impl ToJson for InteractionRule {
8389    fn to_json(&self) -> Value {
8390        let mut object = json::new_object(None, None);
8391        json::put_many(
8392            &mut object,
8393            &["automaticApproval"],
8394            &self.automatic_approvals,
8395        );
8396        json::put_many(&mut object, &["manualApproval"], &self.manual_approvals);
8397        Value::Object(object)
8398    }
8399}
8400
8401/// Instances of `IntransitiveActivity` are a subtype of {@link Activity}
8402/// representing intransitive actions.  The `object` property is therefore
8403/// inappropriate for these activities.
8404///
8405/// The type `https://www.w3.org/ns/activitystreams#IntransitiveActivity`.
8406#[derive(Clone, Debug, Default, PartialEq)]
8407pub struct IntransitiveActivity {
8408    /// The IRI that identifies this object.
8409    pub id: Option<Iri>,
8410    /// See [`Object::attachments`].
8411    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
8412    /// See [`Object::attributions`].
8413    pub attributions: Vec<AnyActor>,
8414    /// See [`Object::audiences`].
8415    pub audiences: Vec<AnyObject>,
8416    /// See [`Object::content`].
8417    pub content: Text,
8418    /// See [`Object::contexts`].
8419    pub contexts: Vec<LinkOrObject>,
8420    /// See [`Object::name`].
8421    pub name: Text,
8422    /// See [`Object::end_time`].
8423    pub end_time: Option<String>,
8424    /// See [`Object::generators`].
8425    pub generators: Vec<LinkOrObject>,
8426    /// See [`Object::icons`].
8427    pub icons: Vec<Reference<Image>>,
8428    /// See [`Object::images`].
8429    pub images: Vec<Reference<Image>>,
8430    /// See [`Object::reply_targets`].
8431    pub reply_targets: Vec<LinkOrObject>,
8432    /// See [`Object::locations`].
8433    pub locations: Vec<LinkOrObject>,
8434    /// See [`Object::previews`].
8435    pub previews: Vec<LinkOrObject>,
8436    /// See [`Object::published`].
8437    pub published: Option<String>,
8438    /// See [`Object::replies`].
8439    pub replies: Option<AnyCollection>,
8440    /// See [`Object::shares`].
8441    pub shares: Option<AnyCollection>,
8442    /// See [`Object::likes`].
8443    pub likes: Option<AnyCollection>,
8444    /// See [`Object::emoji_reactions`].
8445    pub emoji_reactions: Option<AnyCollection>,
8446    /// See [`Object::start_time`].
8447    pub start_time: Option<String>,
8448    /// See [`Object::summary`].
8449    pub summary: Text,
8450    /// See [`Object::tags`].
8451    pub tags: Vec<LinkOrObject>,
8452    /// See [`Object::updated`].
8453    pub updated: Option<String>,
8454    /// See [`Object::urls`].
8455    pub urls: Vec<LinkOrIri>,
8456    /// See [`Object::tos`].
8457    pub tos: Vec<AnyObject>,
8458    /// See [`Object::btos`].
8459    pub btos: Vec<AnyObject>,
8460    /// See [`Object::ccs`].
8461    pub ccs: Vec<AnyObject>,
8462    /// See [`Object::bccs`].
8463    pub bccs: Vec<AnyObject>,
8464    /// See [`Object::media_type`].
8465    pub media_type: Option<String>,
8466    /// See [`Object::duration`].
8467    pub duration: Option<String>,
8468    /// See [`Object::sensitive`].
8469    pub sensitive: Option<bool>,
8470    /// See [`Object::source`].
8471    pub source: Option<Box<Source>>,
8472    /// See [`Object::proofs`].
8473    pub proofs: Vec<Reference<DataIntegrityProof>>,
8474    /// See [`Object::interaction_policy`].
8475    pub interaction_policy: Option<Box<InteractionPolicy>>,
8476    /// See [`Object::approved_by`].
8477    pub approved_by: Option<Iri>,
8478    /// See [`Object::like_authorization`].
8479    pub like_authorization: Option<Reference<LikeAuthorization>>,
8480    /// See [`Object::reply_authorization`].
8481    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
8482    /// See [`Object::announce_authorization`].
8483    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
8484    /// See [`Object::translations`].
8485    pub translations: Vec<Translation>,
8486    /// See [`Activity::actors`].
8487    pub actors: Vec<AnyActor>,
8488    /// See [`Activity::objects`].
8489    pub objects: Vec<AnyObject>,
8490    /// See [`Activity::targets`].
8491    pub targets: Vec<AnyObject>,
8492    /// See [`Activity::results`].
8493    pub results: Vec<AnyObject>,
8494    /// See [`Activity::origins`].
8495    pub origins: Vec<AnyObject>,
8496    /// See [`Activity::instruments`].
8497    pub instruments: Vec<AnyObject>,
8498}
8499
8500impl IntransitiveActivity {
8501    /// The type's IRI.
8502    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#IntransitiveActivity";
8503    /// The type's `type` in a normalised document.
8504    pub const TYPE: &'static str = "IntransitiveActivity";
8505}
8506
8507impl json::Typed for IntransitiveActivity {
8508    const TYPE: &'static str = "IntransitiveActivity";
8509}
8510
8511impl FromJson for IntransitiveActivity {
8512    fn from_json(value: &Value) -> Result<Self, JsonError> {
8513        let object = json::object(value)?;
8514        json::expect_type(object, Self::TYPE)?;
8515        Ok(Self {
8516            id: json::id(object),
8517            attachments: json::many(object, &["attachment"]),
8518            attributions: json::many(object, &["attributedTo"]),
8519            audiences: json::many(object, &["audience"]),
8520            content: json::text(object, "content"),
8521            contexts: json::many(object, &["context"]),
8522            name: json::text(object, "name"),
8523            end_time: json::one(object, &["endTime"]),
8524            generators: json::many(object, &["generator"]),
8525            icons: json::many_mapped(object, &["icon"], json::link_to_image),
8526            images: json::many_mapped(object, &["image"], json::link_to_image),
8527            reply_targets: json::many(object, &["inReplyTo"]),
8528            locations: json::many(object, &["location"]),
8529            previews: json::many(object, &["preview"]),
8530            published: json::one(object, &["published"]),
8531            replies: json::one(object, &["replies"]),
8532            shares: json::one(object, &["shares"]),
8533            likes: json::one(object, &["likes"]),
8534            emoji_reactions: json::one(object, &["emojiReactions"]),
8535            start_time: json::one(object, &["startTime"]),
8536            summary: json::text(object, "summary"),
8537            tags: json::many(object, &["tag"]),
8538            updated: json::one(object, &["updated"]),
8539            urls: json::many(object, &["url"]),
8540            tos: json::many(object, &["to"]),
8541            btos: json::many(object, &["bto"]),
8542            ccs: json::many(object, &["cc"]),
8543            bccs: json::many(object, &["bcc"]),
8544            media_type: json::one(object, &["mediaType"]),
8545            duration: json::one(object, &["duration"]),
8546            sensitive: json::one(object, &["sensitive"]),
8547            source: json::one(object, &["source"]),
8548            proofs: json::many(object, &["proof"]),
8549            interaction_policy: json::one(object, &["interactionPolicy"]),
8550            approved_by: json::one(object, &["approvedBy"]),
8551            like_authorization: json::one(object, &["likeAuthorization"]),
8552            reply_authorization: json::one(object, &["replyAuthorization"]),
8553            announce_authorization: json::one(object, &["announceAuthorization"]),
8554            translations: json::many(object, &["translations"]),
8555            actors: json::many(object, &["actor"]),
8556            objects: json::many(object, &["object"]),
8557            targets: json::many(object, &["target"]),
8558            results: json::many(object, &["result"]),
8559            origins: json::many(object, &["origin"]),
8560            instruments: json::many(object, &["instrument"]),
8561        })
8562    }
8563}
8564
8565impl ToJson for IntransitiveActivity {
8566    fn to_json(&self) -> Value {
8567        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
8568        json::put_many(&mut object, &["attachment"], &self.attachments);
8569        json::put_many(&mut object, &["attributedTo"], &self.attributions);
8570        json::put_many(&mut object, &["audience"], &self.audiences);
8571        json::put_text(&mut object, "content", &self.content);
8572        json::put_many(&mut object, &["context"], &self.contexts);
8573        json::put_text(&mut object, "name", &self.name);
8574        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
8575        json::put_many(&mut object, &["generator"], &self.generators);
8576        json::put_many(&mut object, &["icon"], &self.icons);
8577        json::put_many(&mut object, &["image"], &self.images);
8578        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
8579        json::put_many(&mut object, &["location"], &self.locations);
8580        json::put_many(&mut object, &["preview"], &self.previews);
8581        json::put_one(&mut object, &["published"], self.published.as_ref());
8582        json::put_one(&mut object, &["replies"], self.replies.as_ref());
8583        json::put_one(&mut object, &["shares"], self.shares.as_ref());
8584        json::put_one(&mut object, &["likes"], self.likes.as_ref());
8585        json::put_one(
8586            &mut object,
8587            &["emojiReactions"],
8588            self.emoji_reactions.as_ref(),
8589        );
8590        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
8591        json::put_text(&mut object, "summary", &self.summary);
8592        json::put_many(&mut object, &["tag"], &self.tags);
8593        json::put_one(&mut object, &["updated"], self.updated.as_ref());
8594        json::put_many(&mut object, &["url"], &self.urls);
8595        json::put_many(&mut object, &["to"], &self.tos);
8596        json::put_many(&mut object, &["bto"], &self.btos);
8597        json::put_many(&mut object, &["cc"], &self.ccs);
8598        json::put_many(&mut object, &["bcc"], &self.bccs);
8599        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
8600        json::put_one(&mut object, &["duration"], self.duration.as_ref());
8601        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
8602        json::put_one(&mut object, &["source"], self.source.as_ref());
8603        json::put_many(&mut object, &["proof"], &self.proofs);
8604        json::put_one(
8605            &mut object,
8606            &["interactionPolicy"],
8607            self.interaction_policy.as_ref(),
8608        );
8609        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
8610        json::put_one(
8611            &mut object,
8612            &["likeAuthorization"],
8613            self.like_authorization.as_ref(),
8614        );
8615        json::put_one(
8616            &mut object,
8617            &["replyAuthorization"],
8618            self.reply_authorization.as_ref(),
8619        );
8620        json::put_one(
8621            &mut object,
8622            &["announceAuthorization"],
8623            self.announce_authorization.as_ref(),
8624        );
8625        json::put_many(&mut object, &["translations"], &self.translations);
8626        json::put_many(&mut object, &["actor"], &self.actors);
8627        json::put_many(&mut object, &["object"], &self.objects);
8628        json::put_many(&mut object, &["target"], &self.targets);
8629        json::put_many(&mut object, &["result"], &self.results);
8630        json::put_many(&mut object, &["origin"], &self.origins);
8631        json::put_many(&mut object, &["instrument"], &self.instruments);
8632        Value::Object(object)
8633    }
8634}
8635
8636/// A specialization of `Offer` in which the `actor` is extending an invitation
8637/// for the `object` to the `target`.
8638///
8639/// The type `https://www.w3.org/ns/activitystreams#Invite`.
8640#[derive(Clone, Debug, Default, PartialEq)]
8641pub struct Invite {
8642    /// The IRI that identifies this object.
8643    pub id: Option<Iri>,
8644    /// See [`Object::attachments`].
8645    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
8646    /// See [`Object::attributions`].
8647    pub attributions: Vec<AnyActor>,
8648    /// See [`Object::audiences`].
8649    pub audiences: Vec<AnyObject>,
8650    /// See [`Object::content`].
8651    pub content: Text,
8652    /// See [`Object::contexts`].
8653    pub contexts: Vec<LinkOrObject>,
8654    /// See [`Object::name`].
8655    pub name: Text,
8656    /// See [`Object::end_time`].
8657    pub end_time: Option<String>,
8658    /// See [`Object::generators`].
8659    pub generators: Vec<LinkOrObject>,
8660    /// See [`Object::icons`].
8661    pub icons: Vec<Reference<Image>>,
8662    /// See [`Object::images`].
8663    pub images: Vec<Reference<Image>>,
8664    /// See [`Object::reply_targets`].
8665    pub reply_targets: Vec<LinkOrObject>,
8666    /// See [`Object::locations`].
8667    pub locations: Vec<LinkOrObject>,
8668    /// See [`Object::previews`].
8669    pub previews: Vec<LinkOrObject>,
8670    /// See [`Object::published`].
8671    pub published: Option<String>,
8672    /// See [`Object::replies`].
8673    pub replies: Option<AnyCollection>,
8674    /// See [`Object::shares`].
8675    pub shares: Option<AnyCollection>,
8676    /// See [`Object::likes`].
8677    pub likes: Option<AnyCollection>,
8678    /// See [`Object::emoji_reactions`].
8679    pub emoji_reactions: Option<AnyCollection>,
8680    /// See [`Object::start_time`].
8681    pub start_time: Option<String>,
8682    /// See [`Object::summary`].
8683    pub summary: Text,
8684    /// See [`Object::tags`].
8685    pub tags: Vec<LinkOrObject>,
8686    /// See [`Object::updated`].
8687    pub updated: Option<String>,
8688    /// See [`Object::urls`].
8689    pub urls: Vec<LinkOrIri>,
8690    /// See [`Object::tos`].
8691    pub tos: Vec<AnyObject>,
8692    /// See [`Object::btos`].
8693    pub btos: Vec<AnyObject>,
8694    /// See [`Object::ccs`].
8695    pub ccs: Vec<AnyObject>,
8696    /// See [`Object::bccs`].
8697    pub bccs: Vec<AnyObject>,
8698    /// See [`Object::media_type`].
8699    pub media_type: Option<String>,
8700    /// See [`Object::duration`].
8701    pub duration: Option<String>,
8702    /// See [`Object::sensitive`].
8703    pub sensitive: Option<bool>,
8704    /// See [`Object::source`].
8705    pub source: Option<Box<Source>>,
8706    /// See [`Object::proofs`].
8707    pub proofs: Vec<Reference<DataIntegrityProof>>,
8708    /// See [`Object::interaction_policy`].
8709    pub interaction_policy: Option<Box<InteractionPolicy>>,
8710    /// See [`Object::approved_by`].
8711    pub approved_by: Option<Iri>,
8712    /// See [`Object::like_authorization`].
8713    pub like_authorization: Option<Reference<LikeAuthorization>>,
8714    /// See [`Object::reply_authorization`].
8715    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
8716    /// See [`Object::announce_authorization`].
8717    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
8718    /// See [`Object::translations`].
8719    pub translations: Vec<Translation>,
8720    /// See [`Activity::actors`].
8721    pub actors: Vec<AnyActor>,
8722    /// See [`Activity::objects`].
8723    pub objects: Vec<AnyObject>,
8724    /// See [`Activity::targets`].
8725    pub targets: Vec<AnyObject>,
8726    /// See [`Activity::results`].
8727    pub results: Vec<AnyObject>,
8728    /// See [`Activity::origins`].
8729    pub origins: Vec<AnyObject>,
8730    /// See [`Activity::instruments`].
8731    pub instruments: Vec<AnyObject>,
8732}
8733
8734impl Invite {
8735    /// The type's IRI.
8736    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Invite";
8737    /// The type's `type` in a normalised document.
8738    pub const TYPE: &'static str = "Invite";
8739}
8740
8741impl json::Typed for Invite {
8742    const TYPE: &'static str = "Invite";
8743}
8744
8745impl FromJson for Invite {
8746    fn from_json(value: &Value) -> Result<Self, JsonError> {
8747        let object = json::object(value)?;
8748        json::expect_type(object, Self::TYPE)?;
8749        Ok(Self {
8750            id: json::id(object),
8751            attachments: json::many(object, &["attachment"]),
8752            attributions: json::many(object, &["attributedTo"]),
8753            audiences: json::many(object, &["audience"]),
8754            content: json::text(object, "content"),
8755            contexts: json::many(object, &["context"]),
8756            name: json::text(object, "name"),
8757            end_time: json::one(object, &["endTime"]),
8758            generators: json::many(object, &["generator"]),
8759            icons: json::many_mapped(object, &["icon"], json::link_to_image),
8760            images: json::many_mapped(object, &["image"], json::link_to_image),
8761            reply_targets: json::many(object, &["inReplyTo"]),
8762            locations: json::many(object, &["location"]),
8763            previews: json::many(object, &["preview"]),
8764            published: json::one(object, &["published"]),
8765            replies: json::one(object, &["replies"]),
8766            shares: json::one(object, &["shares"]),
8767            likes: json::one(object, &["likes"]),
8768            emoji_reactions: json::one(object, &["emojiReactions"]),
8769            start_time: json::one(object, &["startTime"]),
8770            summary: json::text(object, "summary"),
8771            tags: json::many(object, &["tag"]),
8772            updated: json::one(object, &["updated"]),
8773            urls: json::many(object, &["url"]),
8774            tos: json::many(object, &["to"]),
8775            btos: json::many(object, &["bto"]),
8776            ccs: json::many(object, &["cc"]),
8777            bccs: json::many(object, &["bcc"]),
8778            media_type: json::one(object, &["mediaType"]),
8779            duration: json::one(object, &["duration"]),
8780            sensitive: json::one(object, &["sensitive"]),
8781            source: json::one(object, &["source"]),
8782            proofs: json::many(object, &["proof"]),
8783            interaction_policy: json::one(object, &["interactionPolicy"]),
8784            approved_by: json::one(object, &["approvedBy"]),
8785            like_authorization: json::one(object, &["likeAuthorization"]),
8786            reply_authorization: json::one(object, &["replyAuthorization"]),
8787            announce_authorization: json::one(object, &["announceAuthorization"]),
8788            translations: json::many(object, &["translations"]),
8789            actors: json::many(object, &["actor"]),
8790            objects: json::many(object, &["object"]),
8791            targets: json::many(object, &["target"]),
8792            results: json::many(object, &["result"]),
8793            origins: json::many(object, &["origin"]),
8794            instruments: json::many(object, &["instrument"]),
8795        })
8796    }
8797}
8798
8799impl ToJson for Invite {
8800    fn to_json(&self) -> Value {
8801        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
8802        json::put_many(&mut object, &["attachment"], &self.attachments);
8803        json::put_many(&mut object, &["attributedTo"], &self.attributions);
8804        json::put_many(&mut object, &["audience"], &self.audiences);
8805        json::put_text(&mut object, "content", &self.content);
8806        json::put_many(&mut object, &["context"], &self.contexts);
8807        json::put_text(&mut object, "name", &self.name);
8808        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
8809        json::put_many(&mut object, &["generator"], &self.generators);
8810        json::put_many(&mut object, &["icon"], &self.icons);
8811        json::put_many(&mut object, &["image"], &self.images);
8812        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
8813        json::put_many(&mut object, &["location"], &self.locations);
8814        json::put_many(&mut object, &["preview"], &self.previews);
8815        json::put_one(&mut object, &["published"], self.published.as_ref());
8816        json::put_one(&mut object, &["replies"], self.replies.as_ref());
8817        json::put_one(&mut object, &["shares"], self.shares.as_ref());
8818        json::put_one(&mut object, &["likes"], self.likes.as_ref());
8819        json::put_one(
8820            &mut object,
8821            &["emojiReactions"],
8822            self.emoji_reactions.as_ref(),
8823        );
8824        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
8825        json::put_text(&mut object, "summary", &self.summary);
8826        json::put_many(&mut object, &["tag"], &self.tags);
8827        json::put_one(&mut object, &["updated"], self.updated.as_ref());
8828        json::put_many(&mut object, &["url"], &self.urls);
8829        json::put_many(&mut object, &["to"], &self.tos);
8830        json::put_many(&mut object, &["bto"], &self.btos);
8831        json::put_many(&mut object, &["cc"], &self.ccs);
8832        json::put_many(&mut object, &["bcc"], &self.bccs);
8833        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
8834        json::put_one(&mut object, &["duration"], self.duration.as_ref());
8835        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
8836        json::put_one(&mut object, &["source"], self.source.as_ref());
8837        json::put_many(&mut object, &["proof"], &self.proofs);
8838        json::put_one(
8839            &mut object,
8840            &["interactionPolicy"],
8841            self.interaction_policy.as_ref(),
8842        );
8843        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
8844        json::put_one(
8845            &mut object,
8846            &["likeAuthorization"],
8847            self.like_authorization.as_ref(),
8848        );
8849        json::put_one(
8850            &mut object,
8851            &["replyAuthorization"],
8852            self.reply_authorization.as_ref(),
8853        );
8854        json::put_one(
8855            &mut object,
8856            &["announceAuthorization"],
8857            self.announce_authorization.as_ref(),
8858        );
8859        json::put_many(&mut object, &["translations"], &self.translations);
8860        json::put_many(&mut object, &["actor"], &self.actors);
8861        json::put_many(&mut object, &["object"], &self.objects);
8862        json::put_many(&mut object, &["target"], &self.targets);
8863        json::put_many(&mut object, &["result"], &self.results);
8864        json::put_many(&mut object, &["origin"], &self.origins);
8865        json::put_many(&mut object, &["instrument"], &self.instruments);
8866        Value::Object(object)
8867    }
8868}
8869
8870/// Indicates that the `actor` has joined the `object`.
8871/// The `target` and `origin` typically have no defined meaning.
8872///
8873/// The type `https://www.w3.org/ns/activitystreams#Join`.
8874#[derive(Clone, Debug, Default, PartialEq)]
8875pub struct Join {
8876    /// The IRI that identifies this object.
8877    pub id: Option<Iri>,
8878    /// See [`Object::attachments`].
8879    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
8880    /// See [`Object::attributions`].
8881    pub attributions: Vec<AnyActor>,
8882    /// See [`Object::audiences`].
8883    pub audiences: Vec<AnyObject>,
8884    /// See [`Object::content`].
8885    pub content: Text,
8886    /// See [`Object::contexts`].
8887    pub contexts: Vec<LinkOrObject>,
8888    /// See [`Object::name`].
8889    pub name: Text,
8890    /// See [`Object::end_time`].
8891    pub end_time: Option<String>,
8892    /// See [`Object::generators`].
8893    pub generators: Vec<LinkOrObject>,
8894    /// See [`Object::icons`].
8895    pub icons: Vec<Reference<Image>>,
8896    /// See [`Object::images`].
8897    pub images: Vec<Reference<Image>>,
8898    /// See [`Object::reply_targets`].
8899    pub reply_targets: Vec<LinkOrObject>,
8900    /// See [`Object::locations`].
8901    pub locations: Vec<LinkOrObject>,
8902    /// See [`Object::previews`].
8903    pub previews: Vec<LinkOrObject>,
8904    /// See [`Object::published`].
8905    pub published: Option<String>,
8906    /// See [`Object::replies`].
8907    pub replies: Option<AnyCollection>,
8908    /// See [`Object::shares`].
8909    pub shares: Option<AnyCollection>,
8910    /// See [`Object::likes`].
8911    pub likes: Option<AnyCollection>,
8912    /// See [`Object::emoji_reactions`].
8913    pub emoji_reactions: Option<AnyCollection>,
8914    /// See [`Object::start_time`].
8915    pub start_time: Option<String>,
8916    /// See [`Object::summary`].
8917    pub summary: Text,
8918    /// See [`Object::tags`].
8919    pub tags: Vec<LinkOrObject>,
8920    /// See [`Object::updated`].
8921    pub updated: Option<String>,
8922    /// See [`Object::urls`].
8923    pub urls: Vec<LinkOrIri>,
8924    /// See [`Object::tos`].
8925    pub tos: Vec<AnyObject>,
8926    /// See [`Object::btos`].
8927    pub btos: Vec<AnyObject>,
8928    /// See [`Object::ccs`].
8929    pub ccs: Vec<AnyObject>,
8930    /// See [`Object::bccs`].
8931    pub bccs: Vec<AnyObject>,
8932    /// See [`Object::media_type`].
8933    pub media_type: Option<String>,
8934    /// See [`Object::duration`].
8935    pub duration: Option<String>,
8936    /// See [`Object::sensitive`].
8937    pub sensitive: Option<bool>,
8938    /// See [`Object::source`].
8939    pub source: Option<Box<Source>>,
8940    /// See [`Object::proofs`].
8941    pub proofs: Vec<Reference<DataIntegrityProof>>,
8942    /// See [`Object::interaction_policy`].
8943    pub interaction_policy: Option<Box<InteractionPolicy>>,
8944    /// See [`Object::approved_by`].
8945    pub approved_by: Option<Iri>,
8946    /// See [`Object::like_authorization`].
8947    pub like_authorization: Option<Reference<LikeAuthorization>>,
8948    /// See [`Object::reply_authorization`].
8949    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
8950    /// See [`Object::announce_authorization`].
8951    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
8952    /// See [`Object::translations`].
8953    pub translations: Vec<Translation>,
8954    /// See [`Activity::actors`].
8955    pub actors: Vec<AnyActor>,
8956    /// See [`Activity::objects`].
8957    pub objects: Vec<AnyObject>,
8958    /// See [`Activity::targets`].
8959    pub targets: Vec<AnyObject>,
8960    /// See [`Activity::results`].
8961    pub results: Vec<AnyObject>,
8962    /// See [`Activity::origins`].
8963    pub origins: Vec<AnyObject>,
8964    /// See [`Activity::instruments`].
8965    pub instruments: Vec<AnyObject>,
8966}
8967
8968impl Join {
8969    /// The type's IRI.
8970    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Join";
8971    /// The type's `type` in a normalised document.
8972    pub const TYPE: &'static str = "Join";
8973}
8974
8975impl json::Typed for Join {
8976    const TYPE: &'static str = "Join";
8977}
8978
8979impl FromJson for Join {
8980    fn from_json(value: &Value) -> Result<Self, JsonError> {
8981        let object = json::object(value)?;
8982        json::expect_type(object, Self::TYPE)?;
8983        Ok(Self {
8984            id: json::id(object),
8985            attachments: json::many(object, &["attachment"]),
8986            attributions: json::many(object, &["attributedTo"]),
8987            audiences: json::many(object, &["audience"]),
8988            content: json::text(object, "content"),
8989            contexts: json::many(object, &["context"]),
8990            name: json::text(object, "name"),
8991            end_time: json::one(object, &["endTime"]),
8992            generators: json::many(object, &["generator"]),
8993            icons: json::many_mapped(object, &["icon"], json::link_to_image),
8994            images: json::many_mapped(object, &["image"], json::link_to_image),
8995            reply_targets: json::many(object, &["inReplyTo"]),
8996            locations: json::many(object, &["location"]),
8997            previews: json::many(object, &["preview"]),
8998            published: json::one(object, &["published"]),
8999            replies: json::one(object, &["replies"]),
9000            shares: json::one(object, &["shares"]),
9001            likes: json::one(object, &["likes"]),
9002            emoji_reactions: json::one(object, &["emojiReactions"]),
9003            start_time: json::one(object, &["startTime"]),
9004            summary: json::text(object, "summary"),
9005            tags: json::many(object, &["tag"]),
9006            updated: json::one(object, &["updated"]),
9007            urls: json::many(object, &["url"]),
9008            tos: json::many(object, &["to"]),
9009            btos: json::many(object, &["bto"]),
9010            ccs: json::many(object, &["cc"]),
9011            bccs: json::many(object, &["bcc"]),
9012            media_type: json::one(object, &["mediaType"]),
9013            duration: json::one(object, &["duration"]),
9014            sensitive: json::one(object, &["sensitive"]),
9015            source: json::one(object, &["source"]),
9016            proofs: json::many(object, &["proof"]),
9017            interaction_policy: json::one(object, &["interactionPolicy"]),
9018            approved_by: json::one(object, &["approvedBy"]),
9019            like_authorization: json::one(object, &["likeAuthorization"]),
9020            reply_authorization: json::one(object, &["replyAuthorization"]),
9021            announce_authorization: json::one(object, &["announceAuthorization"]),
9022            translations: json::many(object, &["translations"]),
9023            actors: json::many(object, &["actor"]),
9024            objects: json::many(object, &["object"]),
9025            targets: json::many(object, &["target"]),
9026            results: json::many(object, &["result"]),
9027            origins: json::many(object, &["origin"]),
9028            instruments: json::many(object, &["instrument"]),
9029        })
9030    }
9031}
9032
9033impl ToJson for Join {
9034    fn to_json(&self) -> Value {
9035        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
9036        json::put_many(&mut object, &["attachment"], &self.attachments);
9037        json::put_many(&mut object, &["attributedTo"], &self.attributions);
9038        json::put_many(&mut object, &["audience"], &self.audiences);
9039        json::put_text(&mut object, "content", &self.content);
9040        json::put_many(&mut object, &["context"], &self.contexts);
9041        json::put_text(&mut object, "name", &self.name);
9042        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
9043        json::put_many(&mut object, &["generator"], &self.generators);
9044        json::put_many(&mut object, &["icon"], &self.icons);
9045        json::put_many(&mut object, &["image"], &self.images);
9046        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
9047        json::put_many(&mut object, &["location"], &self.locations);
9048        json::put_many(&mut object, &["preview"], &self.previews);
9049        json::put_one(&mut object, &["published"], self.published.as_ref());
9050        json::put_one(&mut object, &["replies"], self.replies.as_ref());
9051        json::put_one(&mut object, &["shares"], self.shares.as_ref());
9052        json::put_one(&mut object, &["likes"], self.likes.as_ref());
9053        json::put_one(
9054            &mut object,
9055            &["emojiReactions"],
9056            self.emoji_reactions.as_ref(),
9057        );
9058        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
9059        json::put_text(&mut object, "summary", &self.summary);
9060        json::put_many(&mut object, &["tag"], &self.tags);
9061        json::put_one(&mut object, &["updated"], self.updated.as_ref());
9062        json::put_many(&mut object, &["url"], &self.urls);
9063        json::put_many(&mut object, &["to"], &self.tos);
9064        json::put_many(&mut object, &["bto"], &self.btos);
9065        json::put_many(&mut object, &["cc"], &self.ccs);
9066        json::put_many(&mut object, &["bcc"], &self.bccs);
9067        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
9068        json::put_one(&mut object, &["duration"], self.duration.as_ref());
9069        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
9070        json::put_one(&mut object, &["source"], self.source.as_ref());
9071        json::put_many(&mut object, &["proof"], &self.proofs);
9072        json::put_one(
9073            &mut object,
9074            &["interactionPolicy"],
9075            self.interaction_policy.as_ref(),
9076        );
9077        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
9078        json::put_one(
9079            &mut object,
9080            &["likeAuthorization"],
9081            self.like_authorization.as_ref(),
9082        );
9083        json::put_one(
9084            &mut object,
9085            &["replyAuthorization"],
9086            self.reply_authorization.as_ref(),
9087        );
9088        json::put_one(
9089            &mut object,
9090            &["announceAuthorization"],
9091            self.announce_authorization.as_ref(),
9092        );
9093        json::put_many(&mut object, &["translations"], &self.translations);
9094        json::put_many(&mut object, &["actor"], &self.actors);
9095        json::put_many(&mut object, &["object"], &self.objects);
9096        json::put_many(&mut object, &["target"], &self.targets);
9097        json::put_many(&mut object, &["result"], &self.results);
9098        json::put_many(&mut object, &["origin"], &self.origins);
9099        json::put_many(&mut object, &["instrument"], &self.instruments);
9100        Value::Object(object)
9101    }
9102}
9103
9104/// Indicates that the `actor` has left the `object`.
9105/// The `target` and `origin` typically have no meaning.
9106///
9107/// The type `https://www.w3.org/ns/activitystreams#Leave`.
9108#[derive(Clone, Debug, Default, PartialEq)]
9109pub struct Leave {
9110    /// The IRI that identifies this object.
9111    pub id: Option<Iri>,
9112    /// See [`Object::attachments`].
9113    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
9114    /// See [`Object::attributions`].
9115    pub attributions: Vec<AnyActor>,
9116    /// See [`Object::audiences`].
9117    pub audiences: Vec<AnyObject>,
9118    /// See [`Object::content`].
9119    pub content: Text,
9120    /// See [`Object::contexts`].
9121    pub contexts: Vec<LinkOrObject>,
9122    /// See [`Object::name`].
9123    pub name: Text,
9124    /// See [`Object::end_time`].
9125    pub end_time: Option<String>,
9126    /// See [`Object::generators`].
9127    pub generators: Vec<LinkOrObject>,
9128    /// See [`Object::icons`].
9129    pub icons: Vec<Reference<Image>>,
9130    /// See [`Object::images`].
9131    pub images: Vec<Reference<Image>>,
9132    /// See [`Object::reply_targets`].
9133    pub reply_targets: Vec<LinkOrObject>,
9134    /// See [`Object::locations`].
9135    pub locations: Vec<LinkOrObject>,
9136    /// See [`Object::previews`].
9137    pub previews: Vec<LinkOrObject>,
9138    /// See [`Object::published`].
9139    pub published: Option<String>,
9140    /// See [`Object::replies`].
9141    pub replies: Option<AnyCollection>,
9142    /// See [`Object::shares`].
9143    pub shares: Option<AnyCollection>,
9144    /// See [`Object::likes`].
9145    pub likes: Option<AnyCollection>,
9146    /// See [`Object::emoji_reactions`].
9147    pub emoji_reactions: Option<AnyCollection>,
9148    /// See [`Object::start_time`].
9149    pub start_time: Option<String>,
9150    /// See [`Object::summary`].
9151    pub summary: Text,
9152    /// See [`Object::tags`].
9153    pub tags: Vec<LinkOrObject>,
9154    /// See [`Object::updated`].
9155    pub updated: Option<String>,
9156    /// See [`Object::urls`].
9157    pub urls: Vec<LinkOrIri>,
9158    /// See [`Object::tos`].
9159    pub tos: Vec<AnyObject>,
9160    /// See [`Object::btos`].
9161    pub btos: Vec<AnyObject>,
9162    /// See [`Object::ccs`].
9163    pub ccs: Vec<AnyObject>,
9164    /// See [`Object::bccs`].
9165    pub bccs: Vec<AnyObject>,
9166    /// See [`Object::media_type`].
9167    pub media_type: Option<String>,
9168    /// See [`Object::duration`].
9169    pub duration: Option<String>,
9170    /// See [`Object::sensitive`].
9171    pub sensitive: Option<bool>,
9172    /// See [`Object::source`].
9173    pub source: Option<Box<Source>>,
9174    /// See [`Object::proofs`].
9175    pub proofs: Vec<Reference<DataIntegrityProof>>,
9176    /// See [`Object::interaction_policy`].
9177    pub interaction_policy: Option<Box<InteractionPolicy>>,
9178    /// See [`Object::approved_by`].
9179    pub approved_by: Option<Iri>,
9180    /// See [`Object::like_authorization`].
9181    pub like_authorization: Option<Reference<LikeAuthorization>>,
9182    /// See [`Object::reply_authorization`].
9183    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
9184    /// See [`Object::announce_authorization`].
9185    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
9186    /// See [`Object::translations`].
9187    pub translations: Vec<Translation>,
9188    /// See [`Activity::actors`].
9189    pub actors: Vec<AnyActor>,
9190    /// See [`Activity::objects`].
9191    pub objects: Vec<AnyObject>,
9192    /// See [`Activity::targets`].
9193    pub targets: Vec<AnyObject>,
9194    /// See [`Activity::results`].
9195    pub results: Vec<AnyObject>,
9196    /// See [`Activity::origins`].
9197    pub origins: Vec<AnyObject>,
9198    /// See [`Activity::instruments`].
9199    pub instruments: Vec<AnyObject>,
9200}
9201
9202impl Leave {
9203    /// The type's IRI.
9204    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Leave";
9205    /// The type's `type` in a normalised document.
9206    pub const TYPE: &'static str = "Leave";
9207}
9208
9209impl json::Typed for Leave {
9210    const TYPE: &'static str = "Leave";
9211}
9212
9213impl FromJson for Leave {
9214    fn from_json(value: &Value) -> Result<Self, JsonError> {
9215        let object = json::object(value)?;
9216        json::expect_type(object, Self::TYPE)?;
9217        Ok(Self {
9218            id: json::id(object),
9219            attachments: json::many(object, &["attachment"]),
9220            attributions: json::many(object, &["attributedTo"]),
9221            audiences: json::many(object, &["audience"]),
9222            content: json::text(object, "content"),
9223            contexts: json::many(object, &["context"]),
9224            name: json::text(object, "name"),
9225            end_time: json::one(object, &["endTime"]),
9226            generators: json::many(object, &["generator"]),
9227            icons: json::many_mapped(object, &["icon"], json::link_to_image),
9228            images: json::many_mapped(object, &["image"], json::link_to_image),
9229            reply_targets: json::many(object, &["inReplyTo"]),
9230            locations: json::many(object, &["location"]),
9231            previews: json::many(object, &["preview"]),
9232            published: json::one(object, &["published"]),
9233            replies: json::one(object, &["replies"]),
9234            shares: json::one(object, &["shares"]),
9235            likes: json::one(object, &["likes"]),
9236            emoji_reactions: json::one(object, &["emojiReactions"]),
9237            start_time: json::one(object, &["startTime"]),
9238            summary: json::text(object, "summary"),
9239            tags: json::many(object, &["tag"]),
9240            updated: json::one(object, &["updated"]),
9241            urls: json::many(object, &["url"]),
9242            tos: json::many(object, &["to"]),
9243            btos: json::many(object, &["bto"]),
9244            ccs: json::many(object, &["cc"]),
9245            bccs: json::many(object, &["bcc"]),
9246            media_type: json::one(object, &["mediaType"]),
9247            duration: json::one(object, &["duration"]),
9248            sensitive: json::one(object, &["sensitive"]),
9249            source: json::one(object, &["source"]),
9250            proofs: json::many(object, &["proof"]),
9251            interaction_policy: json::one(object, &["interactionPolicy"]),
9252            approved_by: json::one(object, &["approvedBy"]),
9253            like_authorization: json::one(object, &["likeAuthorization"]),
9254            reply_authorization: json::one(object, &["replyAuthorization"]),
9255            announce_authorization: json::one(object, &["announceAuthorization"]),
9256            translations: json::many(object, &["translations"]),
9257            actors: json::many(object, &["actor"]),
9258            objects: json::many(object, &["object"]),
9259            targets: json::many(object, &["target"]),
9260            results: json::many(object, &["result"]),
9261            origins: json::many(object, &["origin"]),
9262            instruments: json::many(object, &["instrument"]),
9263        })
9264    }
9265}
9266
9267impl ToJson for Leave {
9268    fn to_json(&self) -> Value {
9269        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
9270        json::put_many(&mut object, &["attachment"], &self.attachments);
9271        json::put_many(&mut object, &["attributedTo"], &self.attributions);
9272        json::put_many(&mut object, &["audience"], &self.audiences);
9273        json::put_text(&mut object, "content", &self.content);
9274        json::put_many(&mut object, &["context"], &self.contexts);
9275        json::put_text(&mut object, "name", &self.name);
9276        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
9277        json::put_many(&mut object, &["generator"], &self.generators);
9278        json::put_many(&mut object, &["icon"], &self.icons);
9279        json::put_many(&mut object, &["image"], &self.images);
9280        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
9281        json::put_many(&mut object, &["location"], &self.locations);
9282        json::put_many(&mut object, &["preview"], &self.previews);
9283        json::put_one(&mut object, &["published"], self.published.as_ref());
9284        json::put_one(&mut object, &["replies"], self.replies.as_ref());
9285        json::put_one(&mut object, &["shares"], self.shares.as_ref());
9286        json::put_one(&mut object, &["likes"], self.likes.as_ref());
9287        json::put_one(
9288            &mut object,
9289            &["emojiReactions"],
9290            self.emoji_reactions.as_ref(),
9291        );
9292        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
9293        json::put_text(&mut object, "summary", &self.summary);
9294        json::put_many(&mut object, &["tag"], &self.tags);
9295        json::put_one(&mut object, &["updated"], self.updated.as_ref());
9296        json::put_many(&mut object, &["url"], &self.urls);
9297        json::put_many(&mut object, &["to"], &self.tos);
9298        json::put_many(&mut object, &["bto"], &self.btos);
9299        json::put_many(&mut object, &["cc"], &self.ccs);
9300        json::put_many(&mut object, &["bcc"], &self.bccs);
9301        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
9302        json::put_one(&mut object, &["duration"], self.duration.as_ref());
9303        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
9304        json::put_one(&mut object, &["source"], self.source.as_ref());
9305        json::put_many(&mut object, &["proof"], &self.proofs);
9306        json::put_one(
9307            &mut object,
9308            &["interactionPolicy"],
9309            self.interaction_policy.as_ref(),
9310        );
9311        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
9312        json::put_one(
9313            &mut object,
9314            &["likeAuthorization"],
9315            self.like_authorization.as_ref(),
9316        );
9317        json::put_one(
9318            &mut object,
9319            &["replyAuthorization"],
9320            self.reply_authorization.as_ref(),
9321        );
9322        json::put_one(
9323            &mut object,
9324            &["announceAuthorization"],
9325            self.announce_authorization.as_ref(),
9326        );
9327        json::put_many(&mut object, &["translations"], &self.translations);
9328        json::put_many(&mut object, &["actor"], &self.actors);
9329        json::put_many(&mut object, &["object"], &self.objects);
9330        json::put_many(&mut object, &["target"], &self.targets);
9331        json::put_many(&mut object, &["result"], &self.results);
9332        json::put_many(&mut object, &["origin"], &self.origins);
9333        json::put_many(&mut object, &["instrument"], &self.instruments);
9334        Value::Object(object)
9335    }
9336}
9337
9338/// Indicates that the `actor` likes, recommends or endorses the `object`.
9339/// The `target` and `origin` typically have no defined meaning.
9340///
9341/// The type `https://www.w3.org/ns/activitystreams#Like`.
9342#[derive(Clone, Debug, Default, PartialEq)]
9343pub struct Like {
9344    /// The IRI that identifies this object.
9345    pub id: Option<Iri>,
9346    /// See [`Object::attachments`].
9347    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
9348    /// See [`Object::attributions`].
9349    pub attributions: Vec<AnyActor>,
9350    /// See [`Object::audiences`].
9351    pub audiences: Vec<AnyObject>,
9352    /// See [`Object::content`].
9353    pub content: Text,
9354    /// See [`Object::contexts`].
9355    pub contexts: Vec<LinkOrObject>,
9356    /// See [`Object::name`].
9357    pub name: Text,
9358    /// See [`Object::end_time`].
9359    pub end_time: Option<String>,
9360    /// See [`Object::generators`].
9361    pub generators: Vec<LinkOrObject>,
9362    /// See [`Object::icons`].
9363    pub icons: Vec<Reference<Image>>,
9364    /// See [`Object::images`].
9365    pub images: Vec<Reference<Image>>,
9366    /// See [`Object::reply_targets`].
9367    pub reply_targets: Vec<LinkOrObject>,
9368    /// See [`Object::locations`].
9369    pub locations: Vec<LinkOrObject>,
9370    /// See [`Object::previews`].
9371    pub previews: Vec<LinkOrObject>,
9372    /// See [`Object::published`].
9373    pub published: Option<String>,
9374    /// See [`Object::replies`].
9375    pub replies: Option<AnyCollection>,
9376    /// See [`Object::shares`].
9377    pub shares: Option<AnyCollection>,
9378    /// See [`Object::likes`].
9379    pub likes: Option<AnyCollection>,
9380    /// See [`Object::emoji_reactions`].
9381    pub emoji_reactions: Option<AnyCollection>,
9382    /// See [`Object::start_time`].
9383    pub start_time: Option<String>,
9384    /// See [`Object::summary`].
9385    pub summary: Text,
9386    /// See [`Object::tags`].
9387    pub tags: Vec<LinkOrObject>,
9388    /// See [`Object::updated`].
9389    pub updated: Option<String>,
9390    /// See [`Object::urls`].
9391    pub urls: Vec<LinkOrIri>,
9392    /// See [`Object::tos`].
9393    pub tos: Vec<AnyObject>,
9394    /// See [`Object::btos`].
9395    pub btos: Vec<AnyObject>,
9396    /// See [`Object::ccs`].
9397    pub ccs: Vec<AnyObject>,
9398    /// See [`Object::bccs`].
9399    pub bccs: Vec<AnyObject>,
9400    /// See [`Object::media_type`].
9401    pub media_type: Option<String>,
9402    /// See [`Object::duration`].
9403    pub duration: Option<String>,
9404    /// See [`Object::sensitive`].
9405    pub sensitive: Option<bool>,
9406    /// See [`Object::source`].
9407    pub source: Option<Box<Source>>,
9408    /// See [`Object::proofs`].
9409    pub proofs: Vec<Reference<DataIntegrityProof>>,
9410    /// See [`Object::interaction_policy`].
9411    pub interaction_policy: Option<Box<InteractionPolicy>>,
9412    /// See [`Object::approved_by`].
9413    pub approved_by: Option<Iri>,
9414    /// See [`Object::like_authorization`].
9415    pub like_authorization: Option<Reference<LikeAuthorization>>,
9416    /// See [`Object::reply_authorization`].
9417    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
9418    /// See [`Object::announce_authorization`].
9419    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
9420    /// See [`Object::translations`].
9421    pub translations: Vec<Translation>,
9422    /// See [`Activity::actors`].
9423    pub actors: Vec<AnyActor>,
9424    /// See [`Activity::objects`].
9425    pub objects: Vec<AnyObject>,
9426    /// See [`Activity::targets`].
9427    pub targets: Vec<AnyObject>,
9428    /// See [`Activity::results`].
9429    pub results: Vec<AnyObject>,
9430    /// See [`Activity::origins`].
9431    pub origins: Vec<AnyObject>,
9432    /// See [`Activity::instruments`].
9433    pub instruments: Vec<AnyObject>,
9434}
9435
9436impl Like {
9437    /// The type's IRI.
9438    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Like";
9439    /// The type's `type` in a normalised document.
9440    pub const TYPE: &'static str = "Like";
9441}
9442
9443impl json::Typed for Like {
9444    const TYPE: &'static str = "Like";
9445}
9446
9447impl FromJson for Like {
9448    fn from_json(value: &Value) -> Result<Self, JsonError> {
9449        let object = json::object(value)?;
9450        json::expect_type(object, Self::TYPE)?;
9451        Ok(Self {
9452            id: json::id(object),
9453            attachments: json::many(object, &["attachment"]),
9454            attributions: json::many(object, &["attributedTo"]),
9455            audiences: json::many(object, &["audience"]),
9456            content: json::text(object, "content"),
9457            contexts: json::many(object, &["context"]),
9458            name: json::text(object, "name"),
9459            end_time: json::one(object, &["endTime"]),
9460            generators: json::many(object, &["generator"]),
9461            icons: json::many_mapped(object, &["icon"], json::link_to_image),
9462            images: json::many_mapped(object, &["image"], json::link_to_image),
9463            reply_targets: json::many(object, &["inReplyTo"]),
9464            locations: json::many(object, &["location"]),
9465            previews: json::many(object, &["preview"]),
9466            published: json::one(object, &["published"]),
9467            replies: json::one(object, &["replies"]),
9468            shares: json::one(object, &["shares"]),
9469            likes: json::one(object, &["likes"]),
9470            emoji_reactions: json::one(object, &["emojiReactions"]),
9471            start_time: json::one(object, &["startTime"]),
9472            summary: json::text(object, "summary"),
9473            tags: json::many(object, &["tag"]),
9474            updated: json::one(object, &["updated"]),
9475            urls: json::many(object, &["url"]),
9476            tos: json::many(object, &["to"]),
9477            btos: json::many(object, &["bto"]),
9478            ccs: json::many(object, &["cc"]),
9479            bccs: json::many(object, &["bcc"]),
9480            media_type: json::one(object, &["mediaType"]),
9481            duration: json::one(object, &["duration"]),
9482            sensitive: json::one(object, &["sensitive"]),
9483            source: json::one(object, &["source"]),
9484            proofs: json::many(object, &["proof"]),
9485            interaction_policy: json::one(object, &["interactionPolicy"]),
9486            approved_by: json::one(object, &["approvedBy"]),
9487            like_authorization: json::one(object, &["likeAuthorization"]),
9488            reply_authorization: json::one(object, &["replyAuthorization"]),
9489            announce_authorization: json::one(object, &["announceAuthorization"]),
9490            translations: json::many(object, &["translations"]),
9491            actors: json::many(object, &["actor"]),
9492            objects: json::many(object, &["object"]),
9493            targets: json::many(object, &["target"]),
9494            results: json::many(object, &["result"]),
9495            origins: json::many(object, &["origin"]),
9496            instruments: json::many(object, &["instrument"]),
9497        })
9498    }
9499}
9500
9501impl ToJson for Like {
9502    fn to_json(&self) -> Value {
9503        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
9504        json::put_many(&mut object, &["attachment"], &self.attachments);
9505        json::put_many(&mut object, &["attributedTo"], &self.attributions);
9506        json::put_many(&mut object, &["audience"], &self.audiences);
9507        json::put_text(&mut object, "content", &self.content);
9508        json::put_many(&mut object, &["context"], &self.contexts);
9509        json::put_text(&mut object, "name", &self.name);
9510        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
9511        json::put_many(&mut object, &["generator"], &self.generators);
9512        json::put_many(&mut object, &["icon"], &self.icons);
9513        json::put_many(&mut object, &["image"], &self.images);
9514        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
9515        json::put_many(&mut object, &["location"], &self.locations);
9516        json::put_many(&mut object, &["preview"], &self.previews);
9517        json::put_one(&mut object, &["published"], self.published.as_ref());
9518        json::put_one(&mut object, &["replies"], self.replies.as_ref());
9519        json::put_one(&mut object, &["shares"], self.shares.as_ref());
9520        json::put_one(&mut object, &["likes"], self.likes.as_ref());
9521        json::put_one(
9522            &mut object,
9523            &["emojiReactions"],
9524            self.emoji_reactions.as_ref(),
9525        );
9526        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
9527        json::put_text(&mut object, "summary", &self.summary);
9528        json::put_many(&mut object, &["tag"], &self.tags);
9529        json::put_one(&mut object, &["updated"], self.updated.as_ref());
9530        json::put_many(&mut object, &["url"], &self.urls);
9531        json::put_many(&mut object, &["to"], &self.tos);
9532        json::put_many(&mut object, &["bto"], &self.btos);
9533        json::put_many(&mut object, &["cc"], &self.ccs);
9534        json::put_many(&mut object, &["bcc"], &self.bccs);
9535        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
9536        json::put_one(&mut object, &["duration"], self.duration.as_ref());
9537        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
9538        json::put_one(&mut object, &["source"], self.source.as_ref());
9539        json::put_many(&mut object, &["proof"], &self.proofs);
9540        json::put_one(
9541            &mut object,
9542            &["interactionPolicy"],
9543            self.interaction_policy.as_ref(),
9544        );
9545        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
9546        json::put_one(
9547            &mut object,
9548            &["likeAuthorization"],
9549            self.like_authorization.as_ref(),
9550        );
9551        json::put_one(
9552            &mut object,
9553            &["replyAuthorization"],
9554            self.reply_authorization.as_ref(),
9555        );
9556        json::put_one(
9557            &mut object,
9558            &["announceAuthorization"],
9559            self.announce_authorization.as_ref(),
9560        );
9561        json::put_many(&mut object, &["translations"], &self.translations);
9562        json::put_many(&mut object, &["actor"], &self.actors);
9563        json::put_many(&mut object, &["object"], &self.objects);
9564        json::put_many(&mut object, &["target"], &self.targets);
9565        json::put_many(&mut object, &["result"], &self.results);
9566        json::put_many(&mut object, &["origin"], &self.origins);
9567        json::put_many(&mut object, &["instrument"], &self.instruments);
9568        Value::Object(object)
9569    }
9570}
9571
9572/// Proves that a {@link Like} interaction has been approved by the post author.
9573///
9574/// The type `https://gotosocial.org/ns#LikeApproval`.
9575#[derive(Clone, Debug, Default, PartialEq)]
9576pub struct LikeAuthorization {
9577    /// The IRI that identifies this object.
9578    pub id: Option<Iri>,
9579    /// See [`Object::attachments`].
9580    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
9581    /// See [`Object::attributions`].
9582    pub attributions: Vec<AnyActor>,
9583    /// See [`Object::audiences`].
9584    pub audiences: Vec<AnyObject>,
9585    /// See [`Object::content`].
9586    pub content: Text,
9587    /// See [`Object::contexts`].
9588    pub contexts: Vec<LinkOrObject>,
9589    /// See [`Object::name`].
9590    pub name: Text,
9591    /// See [`Object::end_time`].
9592    pub end_time: Option<String>,
9593    /// See [`Object::generators`].
9594    pub generators: Vec<LinkOrObject>,
9595    /// See [`Object::icons`].
9596    pub icons: Vec<Reference<Image>>,
9597    /// See [`Object::images`].
9598    pub images: Vec<Reference<Image>>,
9599    /// See [`Object::reply_targets`].
9600    pub reply_targets: Vec<LinkOrObject>,
9601    /// See [`Object::locations`].
9602    pub locations: Vec<LinkOrObject>,
9603    /// See [`Object::previews`].
9604    pub previews: Vec<LinkOrObject>,
9605    /// See [`Object::published`].
9606    pub published: Option<String>,
9607    /// See [`Object::replies`].
9608    pub replies: Option<AnyCollection>,
9609    /// See [`Object::shares`].
9610    pub shares: Option<AnyCollection>,
9611    /// See [`Object::likes`].
9612    pub likes: Option<AnyCollection>,
9613    /// See [`Object::emoji_reactions`].
9614    pub emoji_reactions: Option<AnyCollection>,
9615    /// See [`Object::start_time`].
9616    pub start_time: Option<String>,
9617    /// See [`Object::summary`].
9618    pub summary: Text,
9619    /// See [`Object::tags`].
9620    pub tags: Vec<LinkOrObject>,
9621    /// See [`Object::updated`].
9622    pub updated: Option<String>,
9623    /// See [`Object::urls`].
9624    pub urls: Vec<LinkOrIri>,
9625    /// See [`Object::tos`].
9626    pub tos: Vec<AnyObject>,
9627    /// See [`Object::btos`].
9628    pub btos: Vec<AnyObject>,
9629    /// See [`Object::ccs`].
9630    pub ccs: Vec<AnyObject>,
9631    /// See [`Object::bccs`].
9632    pub bccs: Vec<AnyObject>,
9633    /// See [`Object::media_type`].
9634    pub media_type: Option<String>,
9635    /// See [`Object::duration`].
9636    pub duration: Option<String>,
9637    /// See [`Object::sensitive`].
9638    pub sensitive: Option<bool>,
9639    /// See [`Object::source`].
9640    pub source: Option<Box<Source>>,
9641    /// See [`Object::proofs`].
9642    pub proofs: Vec<Reference<DataIntegrityProof>>,
9643    /// See [`Object::interaction_policy`].
9644    pub interaction_policy: Option<Box<InteractionPolicy>>,
9645    /// See [`Object::approved_by`].
9646    pub approved_by: Option<Iri>,
9647    /// See [`Object::like_authorization`].
9648    pub like_authorization: Option<Reference<LikeAuthorization>>,
9649    /// See [`Object::reply_authorization`].
9650    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
9651    /// See [`Object::announce_authorization`].
9652    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
9653    /// See [`Object::translations`].
9654    pub translations: Vec<Translation>,
9655    /// The URI of the interaction (e.g., a {@link Like} activity) that
9656    /// has been authorized.
9657    pub interacting_object: Option<AnyObject>,
9658    /// The URI of the post that is the target of the authorized interaction.
9659    pub interaction_target: Option<AnyObject>,
9660}
9661
9662impl LikeAuthorization {
9663    /// The type's IRI.
9664    pub const TYPE_IRI: &'static str = "https://gotosocial.org/ns#LikeApproval";
9665    /// The type's `type` in a normalised document.
9666    pub const TYPE: &'static str = "LikeAuthorization";
9667}
9668
9669impl json::Typed for LikeAuthorization {
9670    const TYPE: &'static str = "LikeAuthorization";
9671}
9672
9673impl FromJson for LikeAuthorization {
9674    fn from_json(value: &Value) -> Result<Self, JsonError> {
9675        let object = json::object(value)?;
9676        json::expect_type(object, Self::TYPE)?;
9677        Ok(Self {
9678            id: json::id(object),
9679            attachments: json::many(object, &["attachment"]),
9680            attributions: json::many(object, &["attributedTo"]),
9681            audiences: json::many(object, &["audience"]),
9682            content: json::text(object, "content"),
9683            contexts: json::many(object, &["context"]),
9684            name: json::text(object, "name"),
9685            end_time: json::one(object, &["endTime"]),
9686            generators: json::many(object, &["generator"]),
9687            icons: json::many_mapped(object, &["icon"], json::link_to_image),
9688            images: json::many_mapped(object, &["image"], json::link_to_image),
9689            reply_targets: json::many(object, &["inReplyTo"]),
9690            locations: json::many(object, &["location"]),
9691            previews: json::many(object, &["preview"]),
9692            published: json::one(object, &["published"]),
9693            replies: json::one(object, &["replies"]),
9694            shares: json::one(object, &["shares"]),
9695            likes: json::one(object, &["likes"]),
9696            emoji_reactions: json::one(object, &["emojiReactions"]),
9697            start_time: json::one(object, &["startTime"]),
9698            summary: json::text(object, "summary"),
9699            tags: json::many(object, &["tag"]),
9700            updated: json::one(object, &["updated"]),
9701            urls: json::many(object, &["url"]),
9702            tos: json::many(object, &["to"]),
9703            btos: json::many(object, &["bto"]),
9704            ccs: json::many(object, &["cc"]),
9705            bccs: json::many(object, &["bcc"]),
9706            media_type: json::one(object, &["mediaType"]),
9707            duration: json::one(object, &["duration"]),
9708            sensitive: json::one(object, &["sensitive"]),
9709            source: json::one(object, &["source"]),
9710            proofs: json::many(object, &["proof"]),
9711            interaction_policy: json::one(object, &["interactionPolicy"]),
9712            approved_by: json::one(object, &["approvedBy"]),
9713            like_authorization: json::one(object, &["likeAuthorization"]),
9714            reply_authorization: json::one(object, &["replyAuthorization"]),
9715            announce_authorization: json::one(object, &["announceAuthorization"]),
9716            translations: json::many(object, &["translations"]),
9717            interacting_object: json::one(object, &["interactingObject"]),
9718            interaction_target: json::one(object, &["interactionTarget"]),
9719        })
9720    }
9721}
9722
9723impl ToJson for LikeAuthorization {
9724    fn to_json(&self) -> Value {
9725        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
9726        json::put_many(&mut object, &["attachment"], &self.attachments);
9727        json::put_many(&mut object, &["attributedTo"], &self.attributions);
9728        json::put_many(&mut object, &["audience"], &self.audiences);
9729        json::put_text(&mut object, "content", &self.content);
9730        json::put_many(&mut object, &["context"], &self.contexts);
9731        json::put_text(&mut object, "name", &self.name);
9732        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
9733        json::put_many(&mut object, &["generator"], &self.generators);
9734        json::put_many(&mut object, &["icon"], &self.icons);
9735        json::put_many(&mut object, &["image"], &self.images);
9736        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
9737        json::put_many(&mut object, &["location"], &self.locations);
9738        json::put_many(&mut object, &["preview"], &self.previews);
9739        json::put_one(&mut object, &["published"], self.published.as_ref());
9740        json::put_one(&mut object, &["replies"], self.replies.as_ref());
9741        json::put_one(&mut object, &["shares"], self.shares.as_ref());
9742        json::put_one(&mut object, &["likes"], self.likes.as_ref());
9743        json::put_one(
9744            &mut object,
9745            &["emojiReactions"],
9746            self.emoji_reactions.as_ref(),
9747        );
9748        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
9749        json::put_text(&mut object, "summary", &self.summary);
9750        json::put_many(&mut object, &["tag"], &self.tags);
9751        json::put_one(&mut object, &["updated"], self.updated.as_ref());
9752        json::put_many(&mut object, &["url"], &self.urls);
9753        json::put_many(&mut object, &["to"], &self.tos);
9754        json::put_many(&mut object, &["bto"], &self.btos);
9755        json::put_many(&mut object, &["cc"], &self.ccs);
9756        json::put_many(&mut object, &["bcc"], &self.bccs);
9757        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
9758        json::put_one(&mut object, &["duration"], self.duration.as_ref());
9759        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
9760        json::put_one(&mut object, &["source"], self.source.as_ref());
9761        json::put_many(&mut object, &["proof"], &self.proofs);
9762        json::put_one(
9763            &mut object,
9764            &["interactionPolicy"],
9765            self.interaction_policy.as_ref(),
9766        );
9767        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
9768        json::put_one(
9769            &mut object,
9770            &["likeAuthorization"],
9771            self.like_authorization.as_ref(),
9772        );
9773        json::put_one(
9774            &mut object,
9775            &["replyAuthorization"],
9776            self.reply_authorization.as_ref(),
9777        );
9778        json::put_one(
9779            &mut object,
9780            &["announceAuthorization"],
9781            self.announce_authorization.as_ref(),
9782        );
9783        json::put_many(&mut object, &["translations"], &self.translations);
9784        json::put_one(
9785            &mut object,
9786            &["interactingObject"],
9787            self.interacting_object.as_ref(),
9788        );
9789        json::put_one(
9790            &mut object,
9791            &["interactionTarget"],
9792            self.interaction_target.as_ref(),
9793        );
9794        Value::Object(object)
9795    }
9796}
9797
9798/// A request to like a post that requires approval from the post author.
9799///
9800/// The type `https://gotosocial.org/ns#LikeRequest`.
9801#[derive(Clone, Debug, Default, PartialEq)]
9802pub struct LikeRequest {
9803    /// The IRI that identifies this object.
9804    pub id: Option<Iri>,
9805    /// See [`Object::attachments`].
9806    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
9807    /// See [`Object::attributions`].
9808    pub attributions: Vec<AnyActor>,
9809    /// See [`Object::audiences`].
9810    pub audiences: Vec<AnyObject>,
9811    /// See [`Object::content`].
9812    pub content: Text,
9813    /// See [`Object::contexts`].
9814    pub contexts: Vec<LinkOrObject>,
9815    /// See [`Object::name`].
9816    pub name: Text,
9817    /// See [`Object::end_time`].
9818    pub end_time: Option<String>,
9819    /// See [`Object::generators`].
9820    pub generators: Vec<LinkOrObject>,
9821    /// See [`Object::icons`].
9822    pub icons: Vec<Reference<Image>>,
9823    /// See [`Object::images`].
9824    pub images: Vec<Reference<Image>>,
9825    /// See [`Object::reply_targets`].
9826    pub reply_targets: Vec<LinkOrObject>,
9827    /// See [`Object::locations`].
9828    pub locations: Vec<LinkOrObject>,
9829    /// See [`Object::previews`].
9830    pub previews: Vec<LinkOrObject>,
9831    /// See [`Object::published`].
9832    pub published: Option<String>,
9833    /// See [`Object::replies`].
9834    pub replies: Option<AnyCollection>,
9835    /// See [`Object::shares`].
9836    pub shares: Option<AnyCollection>,
9837    /// See [`Object::likes`].
9838    pub likes: Option<AnyCollection>,
9839    /// See [`Object::emoji_reactions`].
9840    pub emoji_reactions: Option<AnyCollection>,
9841    /// See [`Object::start_time`].
9842    pub start_time: Option<String>,
9843    /// See [`Object::summary`].
9844    pub summary: Text,
9845    /// See [`Object::tags`].
9846    pub tags: Vec<LinkOrObject>,
9847    /// See [`Object::updated`].
9848    pub updated: Option<String>,
9849    /// See [`Object::urls`].
9850    pub urls: Vec<LinkOrIri>,
9851    /// See [`Object::tos`].
9852    pub tos: Vec<AnyObject>,
9853    /// See [`Object::btos`].
9854    pub btos: Vec<AnyObject>,
9855    /// See [`Object::ccs`].
9856    pub ccs: Vec<AnyObject>,
9857    /// See [`Object::bccs`].
9858    pub bccs: Vec<AnyObject>,
9859    /// See [`Object::media_type`].
9860    pub media_type: Option<String>,
9861    /// See [`Object::duration`].
9862    pub duration: Option<String>,
9863    /// See [`Object::sensitive`].
9864    pub sensitive: Option<bool>,
9865    /// See [`Object::source`].
9866    pub source: Option<Box<Source>>,
9867    /// See [`Object::proofs`].
9868    pub proofs: Vec<Reference<DataIntegrityProof>>,
9869    /// See [`Object::interaction_policy`].
9870    pub interaction_policy: Option<Box<InteractionPolicy>>,
9871    /// See [`Object::approved_by`].
9872    pub approved_by: Option<Iri>,
9873    /// See [`Object::like_authorization`].
9874    pub like_authorization: Option<Reference<LikeAuthorization>>,
9875    /// See [`Object::reply_authorization`].
9876    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
9877    /// See [`Object::announce_authorization`].
9878    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
9879    /// See [`Object::translations`].
9880    pub translations: Vec<Translation>,
9881    /// See [`Activity::actors`].
9882    pub actors: Vec<AnyActor>,
9883    /// See [`Activity::objects`].
9884    pub objects: Vec<AnyObject>,
9885    /// See [`Activity::targets`].
9886    pub targets: Vec<AnyObject>,
9887    /// See [`Activity::results`].
9888    pub results: Vec<AnyObject>,
9889    /// See [`Activity::origins`].
9890    pub origins: Vec<AnyObject>,
9891    /// See [`Activity::instruments`].
9892    pub instruments: Vec<AnyObject>,
9893}
9894
9895impl LikeRequest {
9896    /// The type's IRI.
9897    pub const TYPE_IRI: &'static str = "https://gotosocial.org/ns#LikeRequest";
9898    /// The type's `type` in a normalised document.
9899    pub const TYPE: &'static str = "LikeRequest";
9900}
9901
9902impl json::Typed for LikeRequest {
9903    const TYPE: &'static str = "LikeRequest";
9904}
9905
9906impl FromJson for LikeRequest {
9907    fn from_json(value: &Value) -> Result<Self, JsonError> {
9908        let object = json::object(value)?;
9909        json::expect_type(object, Self::TYPE)?;
9910        Ok(Self {
9911            id: json::id(object),
9912            attachments: json::many(object, &["attachment"]),
9913            attributions: json::many(object, &["attributedTo"]),
9914            audiences: json::many(object, &["audience"]),
9915            content: json::text(object, "content"),
9916            contexts: json::many(object, &["context"]),
9917            name: json::text(object, "name"),
9918            end_time: json::one(object, &["endTime"]),
9919            generators: json::many(object, &["generator"]),
9920            icons: json::many_mapped(object, &["icon"], json::link_to_image),
9921            images: json::many_mapped(object, &["image"], json::link_to_image),
9922            reply_targets: json::many(object, &["inReplyTo"]),
9923            locations: json::many(object, &["location"]),
9924            previews: json::many(object, &["preview"]),
9925            published: json::one(object, &["published"]),
9926            replies: json::one(object, &["replies"]),
9927            shares: json::one(object, &["shares"]),
9928            likes: json::one(object, &["likes"]),
9929            emoji_reactions: json::one(object, &["emojiReactions"]),
9930            start_time: json::one(object, &["startTime"]),
9931            summary: json::text(object, "summary"),
9932            tags: json::many(object, &["tag"]),
9933            updated: json::one(object, &["updated"]),
9934            urls: json::many(object, &["url"]),
9935            tos: json::many(object, &["to"]),
9936            btos: json::many(object, &["bto"]),
9937            ccs: json::many(object, &["cc"]),
9938            bccs: json::many(object, &["bcc"]),
9939            media_type: json::one(object, &["mediaType"]),
9940            duration: json::one(object, &["duration"]),
9941            sensitive: json::one(object, &["sensitive"]),
9942            source: json::one(object, &["source"]),
9943            proofs: json::many(object, &["proof"]),
9944            interaction_policy: json::one(object, &["interactionPolicy"]),
9945            approved_by: json::one(object, &["approvedBy"]),
9946            like_authorization: json::one(object, &["likeAuthorization"]),
9947            reply_authorization: json::one(object, &["replyAuthorization"]),
9948            announce_authorization: json::one(object, &["announceAuthorization"]),
9949            translations: json::many(object, &["translations"]),
9950            actors: json::many(object, &["actor"]),
9951            objects: json::many(object, &["object"]),
9952            targets: json::many(object, &["target"]),
9953            results: json::many(object, &["result"]),
9954            origins: json::many(object, &["origin"]),
9955            instruments: json::many(object, &["instrument"]),
9956        })
9957    }
9958}
9959
9960impl ToJson for LikeRequest {
9961    fn to_json(&self) -> Value {
9962        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
9963        json::put_many(&mut object, &["attachment"], &self.attachments);
9964        json::put_many(&mut object, &["attributedTo"], &self.attributions);
9965        json::put_many(&mut object, &["audience"], &self.audiences);
9966        json::put_text(&mut object, "content", &self.content);
9967        json::put_many(&mut object, &["context"], &self.contexts);
9968        json::put_text(&mut object, "name", &self.name);
9969        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
9970        json::put_many(&mut object, &["generator"], &self.generators);
9971        json::put_many(&mut object, &["icon"], &self.icons);
9972        json::put_many(&mut object, &["image"], &self.images);
9973        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
9974        json::put_many(&mut object, &["location"], &self.locations);
9975        json::put_many(&mut object, &["preview"], &self.previews);
9976        json::put_one(&mut object, &["published"], self.published.as_ref());
9977        json::put_one(&mut object, &["replies"], self.replies.as_ref());
9978        json::put_one(&mut object, &["shares"], self.shares.as_ref());
9979        json::put_one(&mut object, &["likes"], self.likes.as_ref());
9980        json::put_one(
9981            &mut object,
9982            &["emojiReactions"],
9983            self.emoji_reactions.as_ref(),
9984        );
9985        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
9986        json::put_text(&mut object, "summary", &self.summary);
9987        json::put_many(&mut object, &["tag"], &self.tags);
9988        json::put_one(&mut object, &["updated"], self.updated.as_ref());
9989        json::put_many(&mut object, &["url"], &self.urls);
9990        json::put_many(&mut object, &["to"], &self.tos);
9991        json::put_many(&mut object, &["bto"], &self.btos);
9992        json::put_many(&mut object, &["cc"], &self.ccs);
9993        json::put_many(&mut object, &["bcc"], &self.bccs);
9994        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
9995        json::put_one(&mut object, &["duration"], self.duration.as_ref());
9996        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
9997        json::put_one(&mut object, &["source"], self.source.as_ref());
9998        json::put_many(&mut object, &["proof"], &self.proofs);
9999        json::put_one(
10000            &mut object,
10001            &["interactionPolicy"],
10002            self.interaction_policy.as_ref(),
10003        );
10004        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
10005        json::put_one(
10006            &mut object,
10007            &["likeAuthorization"],
10008            self.like_authorization.as_ref(),
10009        );
10010        json::put_one(
10011            &mut object,
10012            &["replyAuthorization"],
10013            self.reply_authorization.as_ref(),
10014        );
10015        json::put_one(
10016            &mut object,
10017            &["announceAuthorization"],
10018            self.announce_authorization.as_ref(),
10019        );
10020        json::put_many(&mut object, &["translations"], &self.translations);
10021        json::put_many(&mut object, &["actor"], &self.actors);
10022        json::put_many(&mut object, &["object"], &self.objects);
10023        json::put_many(&mut object, &["target"], &self.targets);
10024        json::put_many(&mut object, &["result"], &self.results);
10025        json::put_many(&mut object, &["origin"], &self.origins);
10026        json::put_many(&mut object, &["instrument"], &self.instruments);
10027        Value::Object(object)
10028    }
10029}
10030
10031/// A Link is an indirect, qualified reference to a resource identified by a URL.
10032/// The fundamental model for links is established by RFC 5988. Many of the
10033/// properties defined by the Activity Vocabulary allow values that are either
10034/// instances of {@link Object} or {@link Link}. When a {@link Link} is used,
10035/// it establishes a qualified relation connecting the subject (the containing
10036/// object) to the resource identified by the `href`. Properties of
10037/// the {@link Link} are properties of the reference as opposed to properties of
10038/// the resource.
10039///
10040/// The type `https://www.w3.org/ns/activitystreams#Link`.
10041#[derive(Clone, Debug, Default, PartialEq)]
10042pub struct Link {
10043    /// The target resource pointed to by a {@link Link}.
10044    pub href: Option<Iri>,
10045    /// A link relation associated with a {@link Link}. The value MUST conform to
10046    /// both the HTML5 and RFC 5988 "link relation" definitions.
10047    pub rels: Vec<String>,
10048    /// When used on a {@link Link}, identifies the MIME media type of the
10049    /// referenced resource.
10050    pub media_type: Option<String>,
10051    /// The multibase-encoded integrity digest of the linked resource.
10052    pub digest_multibase: Option<String>,
10053    /// A simple, human-readable, plain-text name for the object. HTML markup MUST
10054    /// NOT be included. The name MAY be expressed using multiple language-tagged
10055    /// values.
10056    pub name: Text,
10057    /// Hints as to the language used by the target resource.
10058    /// Value MUST be a BCP 47 Language-Tag.
10059    pub language: Option<String>,
10060    /// On a {@link Link}, specifies a hint as to the rendering height in
10061    /// device-independent pixels of the linked resource.
10062    pub height: Option<u64>,
10063    /// On a {@link Link}, specifies a hint as to the rendering width in
10064    /// device-independent pixels of the linked resource.
10065    pub width: Option<u64>,
10066    /// Identifies an entity that provides a preview of this object.
10067    pub previews: Vec<LinkOrObject>,
10068}
10069
10070impl Link {
10071    /// The type's IRI.
10072    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Link";
10073    /// The type's `type` in a normalised document.
10074    pub const TYPE: &'static str = "Link";
10075}
10076
10077impl json::Typed for Link {
10078    const TYPE: &'static str = "Link";
10079}
10080
10081impl FromJson for Link {
10082    fn from_json(value: &Value) -> Result<Self, JsonError> {
10083        let object = json::object(value)?;
10084        json::expect_type(object, Self::TYPE)?;
10085        Ok(Self {
10086            href: json::one(object, &["href"]),
10087            rels: json::many(object, &["rel"]),
10088            media_type: json::one(object, &["mediaType"]),
10089            digest_multibase: json::one(object, &["digestMultibase"]),
10090            name: json::text(object, "name"),
10091            language: json::one(object, &["hreflang"]),
10092            height: json::one(object, &["height"]),
10093            width: json::one(object, &["width"]),
10094            previews: json::many(object, &["preview"]),
10095        })
10096    }
10097}
10098
10099impl ToJson for Link {
10100    fn to_json(&self) -> Value {
10101        let mut object = json::new_object(Some(Self::TYPE), None);
10102        json::put_one(&mut object, &["href"], self.href.as_ref());
10103        json::put_many(&mut object, &["rel"], &self.rels);
10104        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
10105        json::put_one(
10106            &mut object,
10107            &["digestMultibase"],
10108            self.digest_multibase.as_ref(),
10109        );
10110        json::put_text(&mut object, "name", &self.name);
10111        json::put_one(&mut object, &["hreflang"], self.language.as_ref());
10112        json::put_one(&mut object, &["height"], self.height.as_ref());
10113        json::put_one(&mut object, &["width"], self.width.as_ref());
10114        json::put_many(&mut object, &["preview"], &self.previews);
10115        Value::Object(object)
10116    }
10117}
10118
10119/// Indicates that the `actor` has listened to the `object`.
10120///
10121/// The type `https://www.w3.org/ns/activitystreams#Listen`.
10122#[derive(Clone, Debug, Default, PartialEq)]
10123pub struct Listen {
10124    /// The IRI that identifies this object.
10125    pub id: Option<Iri>,
10126    /// See [`Object::attachments`].
10127    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
10128    /// See [`Object::attributions`].
10129    pub attributions: Vec<AnyActor>,
10130    /// See [`Object::audiences`].
10131    pub audiences: Vec<AnyObject>,
10132    /// See [`Object::content`].
10133    pub content: Text,
10134    /// See [`Object::contexts`].
10135    pub contexts: Vec<LinkOrObject>,
10136    /// See [`Object::name`].
10137    pub name: Text,
10138    /// See [`Object::end_time`].
10139    pub end_time: Option<String>,
10140    /// See [`Object::generators`].
10141    pub generators: Vec<LinkOrObject>,
10142    /// See [`Object::icons`].
10143    pub icons: Vec<Reference<Image>>,
10144    /// See [`Object::images`].
10145    pub images: Vec<Reference<Image>>,
10146    /// See [`Object::reply_targets`].
10147    pub reply_targets: Vec<LinkOrObject>,
10148    /// See [`Object::locations`].
10149    pub locations: Vec<LinkOrObject>,
10150    /// See [`Object::previews`].
10151    pub previews: Vec<LinkOrObject>,
10152    /// See [`Object::published`].
10153    pub published: Option<String>,
10154    /// See [`Object::replies`].
10155    pub replies: Option<AnyCollection>,
10156    /// See [`Object::shares`].
10157    pub shares: Option<AnyCollection>,
10158    /// See [`Object::likes`].
10159    pub likes: Option<AnyCollection>,
10160    /// See [`Object::emoji_reactions`].
10161    pub emoji_reactions: Option<AnyCollection>,
10162    /// See [`Object::start_time`].
10163    pub start_time: Option<String>,
10164    /// See [`Object::summary`].
10165    pub summary: Text,
10166    /// See [`Object::tags`].
10167    pub tags: Vec<LinkOrObject>,
10168    /// See [`Object::updated`].
10169    pub updated: Option<String>,
10170    /// See [`Object::urls`].
10171    pub urls: Vec<LinkOrIri>,
10172    /// See [`Object::tos`].
10173    pub tos: Vec<AnyObject>,
10174    /// See [`Object::btos`].
10175    pub btos: Vec<AnyObject>,
10176    /// See [`Object::ccs`].
10177    pub ccs: Vec<AnyObject>,
10178    /// See [`Object::bccs`].
10179    pub bccs: Vec<AnyObject>,
10180    /// See [`Object::media_type`].
10181    pub media_type: Option<String>,
10182    /// See [`Object::duration`].
10183    pub duration: Option<String>,
10184    /// See [`Object::sensitive`].
10185    pub sensitive: Option<bool>,
10186    /// See [`Object::source`].
10187    pub source: Option<Box<Source>>,
10188    /// See [`Object::proofs`].
10189    pub proofs: Vec<Reference<DataIntegrityProof>>,
10190    /// See [`Object::interaction_policy`].
10191    pub interaction_policy: Option<Box<InteractionPolicy>>,
10192    /// See [`Object::approved_by`].
10193    pub approved_by: Option<Iri>,
10194    /// See [`Object::like_authorization`].
10195    pub like_authorization: Option<Reference<LikeAuthorization>>,
10196    /// See [`Object::reply_authorization`].
10197    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
10198    /// See [`Object::announce_authorization`].
10199    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
10200    /// See [`Object::translations`].
10201    pub translations: Vec<Translation>,
10202    /// See [`Activity::actors`].
10203    pub actors: Vec<AnyActor>,
10204    /// See [`Activity::objects`].
10205    pub objects: Vec<AnyObject>,
10206    /// See [`Activity::targets`].
10207    pub targets: Vec<AnyObject>,
10208    /// See [`Activity::results`].
10209    pub results: Vec<AnyObject>,
10210    /// See [`Activity::origins`].
10211    pub origins: Vec<AnyObject>,
10212    /// See [`Activity::instruments`].
10213    pub instruments: Vec<AnyObject>,
10214}
10215
10216impl Listen {
10217    /// The type's IRI.
10218    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Listen";
10219    /// The type's `type` in a normalised document.
10220    pub const TYPE: &'static str = "Listen";
10221}
10222
10223impl json::Typed for Listen {
10224    const TYPE: &'static str = "Listen";
10225}
10226
10227impl FromJson for Listen {
10228    fn from_json(value: &Value) -> Result<Self, JsonError> {
10229        let object = json::object(value)?;
10230        json::expect_type(object, Self::TYPE)?;
10231        Ok(Self {
10232            id: json::id(object),
10233            attachments: json::many(object, &["attachment"]),
10234            attributions: json::many(object, &["attributedTo"]),
10235            audiences: json::many(object, &["audience"]),
10236            content: json::text(object, "content"),
10237            contexts: json::many(object, &["context"]),
10238            name: json::text(object, "name"),
10239            end_time: json::one(object, &["endTime"]),
10240            generators: json::many(object, &["generator"]),
10241            icons: json::many_mapped(object, &["icon"], json::link_to_image),
10242            images: json::many_mapped(object, &["image"], json::link_to_image),
10243            reply_targets: json::many(object, &["inReplyTo"]),
10244            locations: json::many(object, &["location"]),
10245            previews: json::many(object, &["preview"]),
10246            published: json::one(object, &["published"]),
10247            replies: json::one(object, &["replies"]),
10248            shares: json::one(object, &["shares"]),
10249            likes: json::one(object, &["likes"]),
10250            emoji_reactions: json::one(object, &["emojiReactions"]),
10251            start_time: json::one(object, &["startTime"]),
10252            summary: json::text(object, "summary"),
10253            tags: json::many(object, &["tag"]),
10254            updated: json::one(object, &["updated"]),
10255            urls: json::many(object, &["url"]),
10256            tos: json::many(object, &["to"]),
10257            btos: json::many(object, &["bto"]),
10258            ccs: json::many(object, &["cc"]),
10259            bccs: json::many(object, &["bcc"]),
10260            media_type: json::one(object, &["mediaType"]),
10261            duration: json::one(object, &["duration"]),
10262            sensitive: json::one(object, &["sensitive"]),
10263            source: json::one(object, &["source"]),
10264            proofs: json::many(object, &["proof"]),
10265            interaction_policy: json::one(object, &["interactionPolicy"]),
10266            approved_by: json::one(object, &["approvedBy"]),
10267            like_authorization: json::one(object, &["likeAuthorization"]),
10268            reply_authorization: json::one(object, &["replyAuthorization"]),
10269            announce_authorization: json::one(object, &["announceAuthorization"]),
10270            translations: json::many(object, &["translations"]),
10271            actors: json::many(object, &["actor"]),
10272            objects: json::many(object, &["object"]),
10273            targets: json::many(object, &["target"]),
10274            results: json::many(object, &["result"]),
10275            origins: json::many(object, &["origin"]),
10276            instruments: json::many(object, &["instrument"]),
10277        })
10278    }
10279}
10280
10281impl ToJson for Listen {
10282    fn to_json(&self) -> Value {
10283        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
10284        json::put_many(&mut object, &["attachment"], &self.attachments);
10285        json::put_many(&mut object, &["attributedTo"], &self.attributions);
10286        json::put_many(&mut object, &["audience"], &self.audiences);
10287        json::put_text(&mut object, "content", &self.content);
10288        json::put_many(&mut object, &["context"], &self.contexts);
10289        json::put_text(&mut object, "name", &self.name);
10290        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
10291        json::put_many(&mut object, &["generator"], &self.generators);
10292        json::put_many(&mut object, &["icon"], &self.icons);
10293        json::put_many(&mut object, &["image"], &self.images);
10294        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
10295        json::put_many(&mut object, &["location"], &self.locations);
10296        json::put_many(&mut object, &["preview"], &self.previews);
10297        json::put_one(&mut object, &["published"], self.published.as_ref());
10298        json::put_one(&mut object, &["replies"], self.replies.as_ref());
10299        json::put_one(&mut object, &["shares"], self.shares.as_ref());
10300        json::put_one(&mut object, &["likes"], self.likes.as_ref());
10301        json::put_one(
10302            &mut object,
10303            &["emojiReactions"],
10304            self.emoji_reactions.as_ref(),
10305        );
10306        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
10307        json::put_text(&mut object, "summary", &self.summary);
10308        json::put_many(&mut object, &["tag"], &self.tags);
10309        json::put_one(&mut object, &["updated"], self.updated.as_ref());
10310        json::put_many(&mut object, &["url"], &self.urls);
10311        json::put_many(&mut object, &["to"], &self.tos);
10312        json::put_many(&mut object, &["bto"], &self.btos);
10313        json::put_many(&mut object, &["cc"], &self.ccs);
10314        json::put_many(&mut object, &["bcc"], &self.bccs);
10315        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
10316        json::put_one(&mut object, &["duration"], self.duration.as_ref());
10317        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
10318        json::put_one(&mut object, &["source"], self.source.as_ref());
10319        json::put_many(&mut object, &["proof"], &self.proofs);
10320        json::put_one(
10321            &mut object,
10322            &["interactionPolicy"],
10323            self.interaction_policy.as_ref(),
10324        );
10325        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
10326        json::put_one(
10327            &mut object,
10328            &["likeAuthorization"],
10329            self.like_authorization.as_ref(),
10330        );
10331        json::put_one(
10332            &mut object,
10333            &["replyAuthorization"],
10334            self.reply_authorization.as_ref(),
10335        );
10336        json::put_one(
10337            &mut object,
10338            &["announceAuthorization"],
10339            self.announce_authorization.as_ref(),
10340        );
10341        json::put_many(&mut object, &["translations"], &self.translations);
10342        json::put_many(&mut object, &["actor"], &self.actors);
10343        json::put_many(&mut object, &["object"], &self.objects);
10344        json::put_many(&mut object, &["target"], &self.targets);
10345        json::put_many(&mut object, &["result"], &self.results);
10346        json::put_many(&mut object, &["origin"], &self.origins);
10347        json::put_many(&mut object, &["instrument"], &self.instruments);
10348        Value::Object(object)
10349    }
10350}
10351
10352/// A quantity with a unit of measure.
10353///
10354/// The type `http://www.ontology-of-units-of-measure.org/resource/om-2/Measure`.
10355#[derive(Clone, Debug, Default, PartialEq)]
10356pub struct Measure {
10357    /// The name of the unit, according to the Ontology of units of Measure
10358    /// classification.  The recommended unit for countable items is `"one"`.
10359    pub unit: Option<String>,
10360    /// The amount of the resource.  If not specified, arbitrary amounts can be
10361    /// used when responding to the proposal.
10362    pub numerical_value: Option<String>,
10363}
10364
10365impl Measure {
10366    /// Read a `Measure` sent without its `type`, as some properties send it.
10367    ///
10368    /// # Errors
10369    ///
10370    /// When `value` is not an object.
10371    pub fn from_json_untyped(value: &Value) -> Result<Self, JsonError> {
10372        let object = json::object(value)?;
10373        Ok(Self {
10374            unit: json::one(object, &["hasUnit"]),
10375            numerical_value: json::one(object, &["hasNumericalValue"]),
10376        })
10377    }
10378
10379    /// Write a `Measure` without its `type`, as some properties send it.
10380    #[must_use]
10381    pub fn to_json_untyped(&self) -> Value {
10382        json::without_type(self.to_json())
10383    }
10384
10385    /// The type's IRI.
10386    pub const TYPE_IRI: &'static str =
10387        "http://www.ontology-of-units-of-measure.org/resource/om-2/Measure";
10388    /// The type's `type` in a normalised document.
10389    pub const TYPE: &'static str = "om2:Measure";
10390}
10391
10392impl json::Typed for Measure {
10393    const TYPE: &'static str = "om2:Measure";
10394}
10395
10396impl FromJson for Measure {
10397    fn from_json(value: &Value) -> Result<Self, JsonError> {
10398        let object = json::object(value)?;
10399        json::expect_type(object, Self::TYPE)?;
10400        Ok(Self {
10401            unit: json::one(object, &["hasUnit"]),
10402            numerical_value: json::one(object, &["hasNumericalValue"]),
10403        })
10404    }
10405}
10406
10407impl ToJson for Measure {
10408    fn to_json(&self) -> Value {
10409        let mut object = json::new_object(Some(Self::TYPE), None);
10410        json::put_one(&mut object, &["hasUnit"], self.unit.as_ref());
10411        json::put_one(
10412            &mut object,
10413            &["hasNumericalValue"],
10414            self.numerical_value.as_ref(),
10415        );
10416        Value::Object(object)
10417    }
10418}
10419
10420/// A specialized {@link Link} that represents an @mention.
10421///
10422/// The type `https://www.w3.org/ns/activitystreams#Mention`.
10423#[derive(Clone, Debug, Default, PartialEq)]
10424pub struct Mention {
10425    /// See [`Link::href`].
10426    pub href: Option<Iri>,
10427    /// See [`Link::rels`].
10428    pub rels: Vec<String>,
10429    /// See [`Link::media_type`].
10430    pub media_type: Option<String>,
10431    /// See [`Link::digest_multibase`].
10432    pub digest_multibase: Option<String>,
10433    /// See [`Link::name`].
10434    pub name: Text,
10435    /// See [`Link::language`].
10436    pub language: Option<String>,
10437    /// See [`Link::height`].
10438    pub height: Option<u64>,
10439    /// See [`Link::width`].
10440    pub width: Option<u64>,
10441    /// See [`Link::previews`].
10442    pub previews: Vec<LinkOrObject>,
10443}
10444
10445impl Mention {
10446    /// The type's IRI.
10447    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Mention";
10448    /// The type's `type` in a normalised document.
10449    pub const TYPE: &'static str = "Mention";
10450}
10451
10452impl json::Typed for Mention {
10453    const TYPE: &'static str = "Mention";
10454}
10455
10456impl FromJson for Mention {
10457    fn from_json(value: &Value) -> Result<Self, JsonError> {
10458        let object = json::object(value)?;
10459        json::expect_type(object, Self::TYPE)?;
10460        Ok(Self {
10461            href: json::one(object, &["href"]),
10462            rels: json::many(object, &["rel"]),
10463            media_type: json::one(object, &["mediaType"]),
10464            digest_multibase: json::one(object, &["digestMultibase"]),
10465            name: json::text(object, "name"),
10466            language: json::one(object, &["hreflang"]),
10467            height: json::one(object, &["height"]),
10468            width: json::one(object, &["width"]),
10469            previews: json::many(object, &["preview"]),
10470        })
10471    }
10472}
10473
10474impl ToJson for Mention {
10475    fn to_json(&self) -> Value {
10476        let mut object = json::new_object(Some(Self::TYPE), None);
10477        json::put_one(&mut object, &["href"], self.href.as_ref());
10478        json::put_many(&mut object, &["rel"], &self.rels);
10479        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
10480        json::put_one(
10481            &mut object,
10482            &["digestMultibase"],
10483            self.digest_multibase.as_ref(),
10484        );
10485        json::put_text(&mut object, "name", &self.name);
10486        json::put_one(&mut object, &["hreflang"], self.language.as_ref());
10487        json::put_one(&mut object, &["height"], self.height.as_ref());
10488        json::put_one(&mut object, &["width"], self.width.as_ref());
10489        json::put_many(&mut object, &["preview"], &self.previews);
10490        Value::Object(object)
10491    }
10492}
10493
10494/// Indicates that the `actor` has moved `object` from `origin` to `target`.
10495/// If the `origin` or `target` are not specified,
10496/// either can be determined by context.
10497///
10498/// The type `https://www.w3.org/ns/activitystreams#Move`.
10499#[derive(Clone, Debug, Default, PartialEq)]
10500pub struct Move {
10501    /// The IRI that identifies this object.
10502    pub id: Option<Iri>,
10503    /// See [`Object::attachments`].
10504    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
10505    /// See [`Object::attributions`].
10506    pub attributions: Vec<AnyActor>,
10507    /// See [`Object::audiences`].
10508    pub audiences: Vec<AnyObject>,
10509    /// See [`Object::content`].
10510    pub content: Text,
10511    /// See [`Object::contexts`].
10512    pub contexts: Vec<LinkOrObject>,
10513    /// See [`Object::name`].
10514    pub name: Text,
10515    /// See [`Object::end_time`].
10516    pub end_time: Option<String>,
10517    /// See [`Object::generators`].
10518    pub generators: Vec<LinkOrObject>,
10519    /// See [`Object::icons`].
10520    pub icons: Vec<Reference<Image>>,
10521    /// See [`Object::images`].
10522    pub images: Vec<Reference<Image>>,
10523    /// See [`Object::reply_targets`].
10524    pub reply_targets: Vec<LinkOrObject>,
10525    /// See [`Object::locations`].
10526    pub locations: Vec<LinkOrObject>,
10527    /// See [`Object::previews`].
10528    pub previews: Vec<LinkOrObject>,
10529    /// See [`Object::published`].
10530    pub published: Option<String>,
10531    /// See [`Object::replies`].
10532    pub replies: Option<AnyCollection>,
10533    /// See [`Object::shares`].
10534    pub shares: Option<AnyCollection>,
10535    /// See [`Object::likes`].
10536    pub likes: Option<AnyCollection>,
10537    /// See [`Object::emoji_reactions`].
10538    pub emoji_reactions: Option<AnyCollection>,
10539    /// See [`Object::start_time`].
10540    pub start_time: Option<String>,
10541    /// See [`Object::summary`].
10542    pub summary: Text,
10543    /// See [`Object::tags`].
10544    pub tags: Vec<LinkOrObject>,
10545    /// See [`Object::updated`].
10546    pub updated: Option<String>,
10547    /// See [`Object::urls`].
10548    pub urls: Vec<LinkOrIri>,
10549    /// See [`Object::tos`].
10550    pub tos: Vec<AnyObject>,
10551    /// See [`Object::btos`].
10552    pub btos: Vec<AnyObject>,
10553    /// See [`Object::ccs`].
10554    pub ccs: Vec<AnyObject>,
10555    /// See [`Object::bccs`].
10556    pub bccs: Vec<AnyObject>,
10557    /// See [`Object::media_type`].
10558    pub media_type: Option<String>,
10559    /// See [`Object::duration`].
10560    pub duration: Option<String>,
10561    /// See [`Object::sensitive`].
10562    pub sensitive: Option<bool>,
10563    /// See [`Object::source`].
10564    pub source: Option<Box<Source>>,
10565    /// See [`Object::proofs`].
10566    pub proofs: Vec<Reference<DataIntegrityProof>>,
10567    /// See [`Object::interaction_policy`].
10568    pub interaction_policy: Option<Box<InteractionPolicy>>,
10569    /// See [`Object::approved_by`].
10570    pub approved_by: Option<Iri>,
10571    /// See [`Object::like_authorization`].
10572    pub like_authorization: Option<Reference<LikeAuthorization>>,
10573    /// See [`Object::reply_authorization`].
10574    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
10575    /// See [`Object::announce_authorization`].
10576    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
10577    /// See [`Object::translations`].
10578    pub translations: Vec<Translation>,
10579    /// See [`Activity::actors`].
10580    pub actors: Vec<AnyActor>,
10581    /// See [`Activity::objects`].
10582    pub objects: Vec<AnyObject>,
10583    /// See [`Activity::targets`].
10584    pub targets: Vec<AnyObject>,
10585    /// See [`Activity::results`].
10586    pub results: Vec<AnyObject>,
10587    /// See [`Activity::origins`].
10588    pub origins: Vec<AnyObject>,
10589    /// See [`Activity::instruments`].
10590    pub instruments: Vec<AnyObject>,
10591}
10592
10593impl Move {
10594    /// The type's IRI.
10595    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Move";
10596    /// The type's `type` in a normalised document.
10597    pub const TYPE: &'static str = "Move";
10598}
10599
10600impl json::Typed for Move {
10601    const TYPE: &'static str = "Move";
10602}
10603
10604impl FromJson for Move {
10605    fn from_json(value: &Value) -> Result<Self, JsonError> {
10606        let object = json::object(value)?;
10607        json::expect_type(object, Self::TYPE)?;
10608        Ok(Self {
10609            id: json::id(object),
10610            attachments: json::many(object, &["attachment"]),
10611            attributions: json::many(object, &["attributedTo"]),
10612            audiences: json::many(object, &["audience"]),
10613            content: json::text(object, "content"),
10614            contexts: json::many(object, &["context"]),
10615            name: json::text(object, "name"),
10616            end_time: json::one(object, &["endTime"]),
10617            generators: json::many(object, &["generator"]),
10618            icons: json::many_mapped(object, &["icon"], json::link_to_image),
10619            images: json::many_mapped(object, &["image"], json::link_to_image),
10620            reply_targets: json::many(object, &["inReplyTo"]),
10621            locations: json::many(object, &["location"]),
10622            previews: json::many(object, &["preview"]),
10623            published: json::one(object, &["published"]),
10624            replies: json::one(object, &["replies"]),
10625            shares: json::one(object, &["shares"]),
10626            likes: json::one(object, &["likes"]),
10627            emoji_reactions: json::one(object, &["emojiReactions"]),
10628            start_time: json::one(object, &["startTime"]),
10629            summary: json::text(object, "summary"),
10630            tags: json::many(object, &["tag"]),
10631            updated: json::one(object, &["updated"]),
10632            urls: json::many(object, &["url"]),
10633            tos: json::many(object, &["to"]),
10634            btos: json::many(object, &["bto"]),
10635            ccs: json::many(object, &["cc"]),
10636            bccs: json::many(object, &["bcc"]),
10637            media_type: json::one(object, &["mediaType"]),
10638            duration: json::one(object, &["duration"]),
10639            sensitive: json::one(object, &["sensitive"]),
10640            source: json::one(object, &["source"]),
10641            proofs: json::many(object, &["proof"]),
10642            interaction_policy: json::one(object, &["interactionPolicy"]),
10643            approved_by: json::one(object, &["approvedBy"]),
10644            like_authorization: json::one(object, &["likeAuthorization"]),
10645            reply_authorization: json::one(object, &["replyAuthorization"]),
10646            announce_authorization: json::one(object, &["announceAuthorization"]),
10647            translations: json::many(object, &["translations"]),
10648            actors: json::many(object, &["actor"]),
10649            objects: json::many(object, &["object"]),
10650            targets: json::many(object, &["target"]),
10651            results: json::many(object, &["result"]),
10652            origins: json::many(object, &["origin"]),
10653            instruments: json::many(object, &["instrument"]),
10654        })
10655    }
10656}
10657
10658impl ToJson for Move {
10659    fn to_json(&self) -> Value {
10660        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
10661        json::put_many(&mut object, &["attachment"], &self.attachments);
10662        json::put_many(&mut object, &["attributedTo"], &self.attributions);
10663        json::put_many(&mut object, &["audience"], &self.audiences);
10664        json::put_text(&mut object, "content", &self.content);
10665        json::put_many(&mut object, &["context"], &self.contexts);
10666        json::put_text(&mut object, "name", &self.name);
10667        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
10668        json::put_many(&mut object, &["generator"], &self.generators);
10669        json::put_many(&mut object, &["icon"], &self.icons);
10670        json::put_many(&mut object, &["image"], &self.images);
10671        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
10672        json::put_many(&mut object, &["location"], &self.locations);
10673        json::put_many(&mut object, &["preview"], &self.previews);
10674        json::put_one(&mut object, &["published"], self.published.as_ref());
10675        json::put_one(&mut object, &["replies"], self.replies.as_ref());
10676        json::put_one(&mut object, &["shares"], self.shares.as_ref());
10677        json::put_one(&mut object, &["likes"], self.likes.as_ref());
10678        json::put_one(
10679            &mut object,
10680            &["emojiReactions"],
10681            self.emoji_reactions.as_ref(),
10682        );
10683        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
10684        json::put_text(&mut object, "summary", &self.summary);
10685        json::put_many(&mut object, &["tag"], &self.tags);
10686        json::put_one(&mut object, &["updated"], self.updated.as_ref());
10687        json::put_many(&mut object, &["url"], &self.urls);
10688        json::put_many(&mut object, &["to"], &self.tos);
10689        json::put_many(&mut object, &["bto"], &self.btos);
10690        json::put_many(&mut object, &["cc"], &self.ccs);
10691        json::put_many(&mut object, &["bcc"], &self.bccs);
10692        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
10693        json::put_one(&mut object, &["duration"], self.duration.as_ref());
10694        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
10695        json::put_one(&mut object, &["source"], self.source.as_ref());
10696        json::put_many(&mut object, &["proof"], &self.proofs);
10697        json::put_one(
10698            &mut object,
10699            &["interactionPolicy"],
10700            self.interaction_policy.as_ref(),
10701        );
10702        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
10703        json::put_one(
10704            &mut object,
10705            &["likeAuthorization"],
10706            self.like_authorization.as_ref(),
10707        );
10708        json::put_one(
10709            &mut object,
10710            &["replyAuthorization"],
10711            self.reply_authorization.as_ref(),
10712        );
10713        json::put_one(
10714            &mut object,
10715            &["announceAuthorization"],
10716            self.announce_authorization.as_ref(),
10717        );
10718        json::put_many(&mut object, &["translations"], &self.translations);
10719        json::put_many(&mut object, &["actor"], &self.actors);
10720        json::put_many(&mut object, &["object"], &self.objects);
10721        json::put_many(&mut object, &["target"], &self.targets);
10722        json::put_many(&mut object, &["result"], &self.results);
10723        json::put_many(&mut object, &["origin"], &self.origins);
10724        json::put_many(&mut object, &["instrument"], &self.instruments);
10725        Value::Object(object)
10726    }
10727}
10728
10729/// Represents a key owned by an actor according to [FEP-521a: Representing
10730/// actor's public keys.](https://w3id.org/fep/521a)
10731///
10732/// The type `https://w3id.org/security#Multikey`.
10733#[derive(Clone, Debug, Default, PartialEq)]
10734pub struct Multikey {
10735    /// The IRI that identifies this object.
10736    pub id: Option<Iri>,
10737    /// An actor who owns this key.
10738    pub controller: Option<AnyActor>,
10739    /// A [Multibase](https://www.w3.org/TR/vc-data-integrity/#multibase-0)-encoded value of a [Multicodec](https://github.com/multiformats/multicodec/) prefix and the key.
10740    pub public_key: Option<String>,
10741}
10742
10743impl Multikey {
10744    /// The type's IRI.
10745    pub const TYPE_IRI: &'static str = "https://w3id.org/security#Multikey";
10746    /// The type's `type` in a normalised document.
10747    pub const TYPE: &'static str = "Multikey";
10748}
10749
10750impl json::Typed for Multikey {
10751    const TYPE: &'static str = "Multikey";
10752}
10753
10754impl FromJson for Multikey {
10755    fn from_json(value: &Value) -> Result<Self, JsonError> {
10756        let object = json::object(value)?;
10757        json::expect_type(object, Self::TYPE)?;
10758        Ok(Self {
10759            id: json::id(object),
10760            controller: json::one(object, &["controller"]),
10761            public_key: json::one(object, &["publicKeyMultibase"]),
10762        })
10763    }
10764}
10765
10766impl ToJson for Multikey {
10767    fn to_json(&self) -> Value {
10768        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
10769        json::put_one(&mut object, &["controller"], self.controller.as_ref());
10770        json::put_one(
10771            &mut object,
10772            &["publicKeyMultibase"],
10773            self.public_key.as_ref(),
10774        );
10775        Value::Object(object)
10776    }
10777}
10778
10779/// Represents a short written work typically less than a single paragraph in
10780/// length.
10781///
10782/// The type `https://www.w3.org/ns/activitystreams#Note`.
10783#[derive(Clone, Debug, Default, PartialEq)]
10784pub struct Note {
10785    /// The IRI that identifies this object.
10786    pub id: Option<Iri>,
10787    /// See [`Object::attachments`].
10788    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
10789    /// See [`Object::attributions`].
10790    pub attributions: Vec<AnyActor>,
10791    /// See [`Object::audiences`].
10792    pub audiences: Vec<AnyObject>,
10793    /// See [`Object::content`].
10794    pub content: Text,
10795    /// See [`Object::contexts`].
10796    pub contexts: Vec<LinkOrObject>,
10797    /// See [`Object::name`].
10798    pub name: Text,
10799    /// See [`Object::end_time`].
10800    pub end_time: Option<String>,
10801    /// See [`Object::generators`].
10802    pub generators: Vec<LinkOrObject>,
10803    /// See [`Object::icons`].
10804    pub icons: Vec<Reference<Image>>,
10805    /// See [`Object::images`].
10806    pub images: Vec<Reference<Image>>,
10807    /// See [`Object::reply_targets`].
10808    pub reply_targets: Vec<LinkOrObject>,
10809    /// See [`Object::locations`].
10810    pub locations: Vec<LinkOrObject>,
10811    /// See [`Object::previews`].
10812    pub previews: Vec<LinkOrObject>,
10813    /// See [`Object::published`].
10814    pub published: Option<String>,
10815    /// See [`Object::replies`].
10816    pub replies: Option<AnyCollection>,
10817    /// See [`Object::shares`].
10818    pub shares: Option<AnyCollection>,
10819    /// See [`Object::likes`].
10820    pub likes: Option<AnyCollection>,
10821    /// See [`Object::emoji_reactions`].
10822    pub emoji_reactions: Option<AnyCollection>,
10823    /// See [`Object::start_time`].
10824    pub start_time: Option<String>,
10825    /// See [`Object::summary`].
10826    pub summary: Text,
10827    /// See [`Object::tags`].
10828    pub tags: Vec<LinkOrObject>,
10829    /// See [`Object::updated`].
10830    pub updated: Option<String>,
10831    /// See [`Object::urls`].
10832    pub urls: Vec<LinkOrIri>,
10833    /// See [`Object::tos`].
10834    pub tos: Vec<AnyObject>,
10835    /// See [`Object::btos`].
10836    pub btos: Vec<AnyObject>,
10837    /// See [`Object::ccs`].
10838    pub ccs: Vec<AnyObject>,
10839    /// See [`Object::bccs`].
10840    pub bccs: Vec<AnyObject>,
10841    /// See [`Object::media_type`].
10842    pub media_type: Option<String>,
10843    /// See [`Object::duration`].
10844    pub duration: Option<String>,
10845    /// See [`Object::sensitive`].
10846    pub sensitive: Option<bool>,
10847    /// See [`Object::source`].
10848    pub source: Option<Box<Source>>,
10849    /// See [`Object::proofs`].
10850    pub proofs: Vec<Reference<DataIntegrityProof>>,
10851    /// See [`Object::interaction_policy`].
10852    pub interaction_policy: Option<Box<InteractionPolicy>>,
10853    /// See [`Object::approved_by`].
10854    pub approved_by: Option<Iri>,
10855    /// See [`Object::like_authorization`].
10856    pub like_authorization: Option<Reference<LikeAuthorization>>,
10857    /// See [`Object::reply_authorization`].
10858    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
10859    /// See [`Object::announce_authorization`].
10860    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
10861    /// See [`Object::translations`].
10862    pub translations: Vec<Translation>,
10863    /// The quoted ActivityStreams object.
10864    pub quote: Option<AnyObject>,
10865    /// The URI of the ActivityStreams object that this object quotes.
10866    pub quote_url: Option<Iri>,
10867    /// A {@link QuoteAuthorization} object that proves this quote was approved
10868    /// by the quoted object's author.
10869    pub quote_authorization: Option<Reference<QuoteAuthorization>>,
10870    /// Whether replies are accepted: PeerTube's term, which Lemmy sends as
10871    /// the opposite of a post being locked.
10872    pub comments_enabled: Option<bool>,
10873    /// Whether a moderator marked the comment as speaking for the community.
10874    pub distinguished: Option<bool>,
10875}
10876
10877impl Note {
10878    /// The type's IRI.
10879    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Note";
10880    /// The type's `type` in a normalised document.
10881    pub const TYPE: &'static str = "Note";
10882}
10883
10884impl json::Typed for Note {
10885    const TYPE: &'static str = "Note";
10886}
10887
10888impl FromJson for Note {
10889    fn from_json(value: &Value) -> Result<Self, JsonError> {
10890        let object = json::object(value)?;
10891        json::expect_type(object, Self::TYPE)?;
10892        Ok(Self {
10893            id: json::id(object),
10894            attachments: json::many(object, &["attachment"]),
10895            attributions: json::many(object, &["attributedTo"]),
10896            audiences: json::many(object, &["audience"]),
10897            content: json::text(object, "content"),
10898            contexts: json::many(object, &["context"]),
10899            name: json::text(object, "name"),
10900            end_time: json::one(object, &["endTime"]),
10901            generators: json::many(object, &["generator"]),
10902            icons: json::many_mapped(object, &["icon"], json::link_to_image),
10903            images: json::many_mapped(object, &["image"], json::link_to_image),
10904            reply_targets: json::many(object, &["inReplyTo"]),
10905            locations: json::many(object, &["location"]),
10906            previews: json::many(object, &["preview"]),
10907            published: json::one(object, &["published"]),
10908            replies: json::one(object, &["replies"]),
10909            shares: json::one(object, &["shares"]),
10910            likes: json::one(object, &["likes"]),
10911            emoji_reactions: json::one(object, &["emojiReactions"]),
10912            start_time: json::one(object, &["startTime"]),
10913            summary: json::text(object, "summary"),
10914            tags: json::many(object, &["tag"]),
10915            updated: json::one(object, &["updated"]),
10916            urls: json::many(object, &["url"]),
10917            tos: json::many(object, &["to"]),
10918            btos: json::many(object, &["bto"]),
10919            ccs: json::many(object, &["cc"]),
10920            bccs: json::many(object, &["bcc"]),
10921            media_type: json::one(object, &["mediaType"]),
10922            duration: json::one(object, &["duration"]),
10923            sensitive: json::one(object, &["sensitive"]),
10924            source: json::one(object, &["source"]),
10925            proofs: json::many(object, &["proof"]),
10926            interaction_policy: json::one(object, &["interactionPolicy"]),
10927            approved_by: json::one(object, &["approvedBy"]),
10928            like_authorization: json::one(object, &["likeAuthorization"]),
10929            reply_authorization: json::one(object, &["replyAuthorization"]),
10930            announce_authorization: json::one(object, &["announceAuthorization"]),
10931            translations: json::many(object, &["translations"]),
10932            quote: json::one(object, &["quote"]),
10933            quote_url: json::one(object, &["quoteUrl", "_misskey_quote", "quoteUri"]),
10934            quote_authorization: json::one(object, &["quoteAuthorization"]),
10935            comments_enabled: json::one(object, &["commentsEnabled"]),
10936            distinguished: json::one(object, &["distinguished"]),
10937        })
10938    }
10939}
10940
10941impl ToJson for Note {
10942    fn to_json(&self) -> Value {
10943        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
10944        json::put_many(&mut object, &["attachment"], &self.attachments);
10945        json::put_many(&mut object, &["attributedTo"], &self.attributions);
10946        json::put_many(&mut object, &["audience"], &self.audiences);
10947        json::put_text(&mut object, "content", &self.content);
10948        json::put_many(&mut object, &["context"], &self.contexts);
10949        json::put_text(&mut object, "name", &self.name);
10950        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
10951        json::put_many(&mut object, &["generator"], &self.generators);
10952        json::put_many(&mut object, &["icon"], &self.icons);
10953        json::put_many(&mut object, &["image"], &self.images);
10954        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
10955        json::put_many(&mut object, &["location"], &self.locations);
10956        json::put_many(&mut object, &["preview"], &self.previews);
10957        json::put_one(&mut object, &["published"], self.published.as_ref());
10958        json::put_one(&mut object, &["replies"], self.replies.as_ref());
10959        json::put_one(&mut object, &["shares"], self.shares.as_ref());
10960        json::put_one(&mut object, &["likes"], self.likes.as_ref());
10961        json::put_one(
10962            &mut object,
10963            &["emojiReactions"],
10964            self.emoji_reactions.as_ref(),
10965        );
10966        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
10967        json::put_text(&mut object, "summary", &self.summary);
10968        json::put_many(&mut object, &["tag"], &self.tags);
10969        json::put_one(&mut object, &["updated"], self.updated.as_ref());
10970        json::put_many(&mut object, &["url"], &self.urls);
10971        json::put_many(&mut object, &["to"], &self.tos);
10972        json::put_many(&mut object, &["bto"], &self.btos);
10973        json::put_many(&mut object, &["cc"], &self.ccs);
10974        json::put_many(&mut object, &["bcc"], &self.bccs);
10975        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
10976        json::put_one(&mut object, &["duration"], self.duration.as_ref());
10977        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
10978        json::put_one(&mut object, &["source"], self.source.as_ref());
10979        json::put_many(&mut object, &["proof"], &self.proofs);
10980        json::put_one(
10981            &mut object,
10982            &["interactionPolicy"],
10983            self.interaction_policy.as_ref(),
10984        );
10985        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
10986        json::put_one(
10987            &mut object,
10988            &["likeAuthorization"],
10989            self.like_authorization.as_ref(),
10990        );
10991        json::put_one(
10992            &mut object,
10993            &["replyAuthorization"],
10994            self.reply_authorization.as_ref(),
10995        );
10996        json::put_one(
10997            &mut object,
10998            &["announceAuthorization"],
10999            self.announce_authorization.as_ref(),
11000        );
11001        json::put_many(&mut object, &["translations"], &self.translations);
11002        json::put_one(&mut object, &["quote"], self.quote.as_ref());
11003        json::put_one(
11004            &mut object,
11005            &["quoteUrl", "_misskey_quote", "quoteUri"],
11006            self.quote_url.as_ref(),
11007        );
11008        json::put_one(
11009            &mut object,
11010            &["quoteAuthorization"],
11011            self.quote_authorization.as_ref(),
11012        );
11013        json::put_one(
11014            &mut object,
11015            &["commentsEnabled"],
11016            self.comments_enabled.as_ref(),
11017        );
11018        json::put_one(&mut object, &["distinguished"], self.distinguished.as_ref());
11019        Value::Object(object)
11020    }
11021}
11022
11023/// Describes an object of any kind. The Object type serves as the base type for
11024/// most of the other kinds of objects defined in the Activity Vocabulary,
11025/// including other Core types such as {@link Activity},
11026/// {@link IntransitiveActivity}, {@link Collection} and
11027/// {@link OrderedCollection}.
11028///
11029/// The type `https://www.w3.org/ns/activitystreams#Object`.
11030#[derive(Clone, Debug, Default, PartialEq)]
11031pub struct Object {
11032    /// The IRI that identifies this object.
11033    pub id: Option<Iri>,
11034    /// Identifies a resource attached or related to an object that potentially
11035    /// requires special handling.  The intent is to provide a model that is at
11036    /// least semantically similar to attachments in email.
11037    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
11038    /// Identifies one or more entities to which this object is attributed.
11039    /// The attributed entities might not be Actors.  For instance,
11040    /// an object might be attributed to the completion of another activity.
11041    pub attributions: Vec<AnyActor>,
11042    /// Identifies one or more entities that represent the total population of
11043    /// entities for which the object can considered to be relevant.
11044    pub audiences: Vec<AnyObject>,
11045    /// The content or textual representation of the Object encoded as a JSON
11046    /// string.  By default, the value of `content` is HTML.  The `mediaType`
11047    /// property can be used in the object to indicate a different content type.
11048    pub content: Text,
11049    /// Identifies the context within which the object exists or an activity was
11050    /// performed.
11051    pub contexts: Vec<LinkOrObject>,
11052    /// A simple, human-readable, plain-text name for the object. HTML markup MUST
11053    /// NOT be included. The name MAY be expressed using multiple language-tagged
11054    /// values.
11055    pub name: Text,
11056    /// The date and time describing the actual or expected ending time of
11057    /// the object.  When used with an {@link Activity} object, for instance,
11058    /// the `endTime`` property specifies the moment the activity concluded
11059    /// or is expected to conclude.
11060    pub end_time: Option<String>,
11061    /// Identifies the entity (e.g. an application) that generated the object.
11062    pub generators: Vec<LinkOrObject>,
11063    /// Indicates an entity that describes an icon for this object.
11064    /// The image should have an aspect ratio of one (horizontal) to one
11065    /// (vertical) and should be suitable for presentation at a small size.
11066    pub icons: Vec<Reference<Image>>,
11067    /// Indicates an entity that describes an image for this object.
11068    /// Unlike the icon property, there are no aspect ratio or display size
11069    /// limitations assumed.
11070    pub images: Vec<Reference<Image>>,
11071    /// Indicates one or more entities for which this object is considered
11072    /// a response.
11073    pub reply_targets: Vec<LinkOrObject>,
11074    /// Indicates one or more physical or logical locations associated with
11075    /// the object.
11076    pub locations: Vec<LinkOrObject>,
11077    /// Identifies an entity that provides a preview of this object.
11078    pub previews: Vec<LinkOrObject>,
11079    /// The date and time at which the object was published.
11080    pub published: Option<String>,
11081    /// Identifies a {@link Collection} containing objects considered to be
11082    /// responses to this object.
11083    pub replies: Option<AnyCollection>,
11084    /// Every object *may* have a `shares` collection. This is a list of all
11085    /// {@link Announce} activities with this object as the `object` property,
11086    /// added as a [side effect](https://www.w3.org/TR/activitypub/#announce-activity-inbox). The `shares` collection *must* be either
11087    /// an {@link OrderedCollection} or a {@link Collection} and *may* be filtered
11088    /// on privileges of an authenticated user or as appropriate
11089    /// when no authentication is given.
11090    pub shares: Option<AnyCollection>,
11091    /// Every object *may* have a `likes` collection. This is a list of all
11092    /// {@link Like} activities with this object as the `object` property,
11093    /// added as a [side effect](https://www.w3.org/TR/activitypub/#announce-activity-inbox). The `likes` collection *must* be either
11094    /// an {@link OrderedCollection} or a {@link Collection} and *may* be filtered
11095    /// on privileges of an authenticated user or as appropriate
11096    /// when no authentication is given.
11097    pub likes: Option<AnyCollection>,
11098    /// Identifies a {@link Collection} containing objects considered to be
11099    /// emoji reactions to this object.
11100    pub emoji_reactions: Option<AnyCollection>,
11101    /// The date and time describing the actual or expected starting time of
11102    /// the object.  When used with an {@link Activity} object, for instance,
11103    /// the `startTime` property specifies the moment the activity began or
11104    /// is scheduled to begin.
11105    pub start_time: Option<String>,
11106    /// A natural language summarization of the object encoded as HTML.
11107    /// Multiple language tagged summaries MAY be provided.
11108    pub summary: Text,
11109    /// One or more "tags" that have been associated with an objects.
11110    /// A tag can be any kind of Object.  The key difference between `attachment`
11111    /// and `tag` is that the former implies association by inclusion,
11112    /// while the latter implies associated by reference.
11113    pub tags: Vec<LinkOrObject>,
11114    /// The date and time at which the object was updated.
11115    pub updated: Option<String>,
11116    /// Identifies one or more links to representations of the object.
11117    pub urls: Vec<LinkOrIri>,
11118    /// Identifies an entity considered to be part of the public primary audience
11119    /// of an Object.
11120    pub tos: Vec<AnyObject>,
11121    /// Identifies an Object that is part of the private primary audience of
11122    /// this Object.
11123    pub btos: Vec<AnyObject>,
11124    /// Identifies an Object that is part of the public secondary audience of
11125    /// this Object.
11126    pub ccs: Vec<AnyObject>,
11127    /// Identifies one or more Objects that are part of the private secondary
11128    /// audience of this Object.
11129    pub bccs: Vec<AnyObject>,
11130    /// When used on an {@link Object}, identifies the MIME media type of the value
11131    /// of the `content` property.  If not specified, the `content` property is
11132    /// assumed to contain `text/html` content.
11133    pub media_type: Option<String>,
11134    /// When the object describes a time-bound resource, such as an audio or video,
11135    /// a meeting, etc, the `duration` property indicates the object's approximate
11136    /// duration.  The value MUST be expressed as an `xsd:duration` as defined by
11137    /// W3C XML Schema Definition Language (XSD) 1.1 Part 2: DataTypes, section
11138    /// 3.3.6 (e.g. a period of 5 seconds is represented as `PT5S`).
11139    pub duration: Option<String>,
11140    /// Whether it contains any sensitive contents.
11141    pub sensitive: Option<bool>,
11142    /// The `source` property is intended to convey some sort of source from which
11143    /// the `content` markup was derived, as a form of provenance, or to support
11144    /// future editing by clients.  In general, clients do the conversion from
11145    /// `source` to `content`, not the other way around.
11146    pub source: Option<Box<Source>>,
11147    /// A cryptographic proof that can be used to verify the integrity of an object.
11148    pub proofs: Vec<Reference<DataIntegrityProof>>,
11149    /// The interaction policy for this object, specifying who can like, reply to,
11150    /// announce, or quote it.  Contains sub-policies (`canLike`, `canReply`,
11151    /// `canAnnounce`, `canQuote`) each defining `automaticApproval` and
11152    /// `manualApproval` lists.
11153    pub interaction_policy: Option<Box<InteractionPolicy>>,
11154    /// A URI referencing an authorization object that proves this interaction
11155    /// was approved by the target post's author.
11156    pub approved_by: Option<Iri>,
11157    /// A {@link LikeAuthorization} object that proves this like interaction
11158    /// was approved by the target post's author.
11159    pub like_authorization: Option<Reference<LikeAuthorization>>,
11160    /// A {@link ReplyAuthorization} object that proves this reply was approved
11161    /// by the target post's author.
11162    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
11163    /// An {@link AnnounceAuthorization} object that proves this announce
11164    /// (boost) was approved by the target post's author.
11165    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
11166    /// Translation metadata for the language versions in this object's content,
11167    /// name, or summary maps, as defined by the draft
11168    /// [FEP-22cd](https://w3id.org/fep/22cd).  Each entry describes one translated
11169    /// language; directly authored languages have no entry.  The entries share
11170    /// this object's identity, replies, and reactions.  Translator credit grants
11171    /// no authority to update the object.
11172    pub translations: Vec<Translation>,
11173}
11174
11175impl Object {
11176    /// The type's IRI.
11177    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Object";
11178    /// The type's `type` in a normalised document.
11179    pub const TYPE: &'static str = "Object";
11180}
11181
11182impl json::Typed for Object {
11183    const TYPE: &'static str = "Object";
11184}
11185
11186impl FromJson for Object {
11187    fn from_json(value: &Value) -> Result<Self, JsonError> {
11188        let object = json::object(value)?;
11189        json::expect_type(object, Self::TYPE)?;
11190        Ok(Self {
11191            id: json::id(object),
11192            attachments: json::many(object, &["attachment"]),
11193            attributions: json::many(object, &["attributedTo"]),
11194            audiences: json::many(object, &["audience"]),
11195            content: json::text(object, "content"),
11196            contexts: json::many(object, &["context"]),
11197            name: json::text(object, "name"),
11198            end_time: json::one(object, &["endTime"]),
11199            generators: json::many(object, &["generator"]),
11200            icons: json::many_mapped(object, &["icon"], json::link_to_image),
11201            images: json::many_mapped(object, &["image"], json::link_to_image),
11202            reply_targets: json::many(object, &["inReplyTo"]),
11203            locations: json::many(object, &["location"]),
11204            previews: json::many(object, &["preview"]),
11205            published: json::one(object, &["published"]),
11206            replies: json::one(object, &["replies"]),
11207            shares: json::one(object, &["shares"]),
11208            likes: json::one(object, &["likes"]),
11209            emoji_reactions: json::one(object, &["emojiReactions"]),
11210            start_time: json::one(object, &["startTime"]),
11211            summary: json::text(object, "summary"),
11212            tags: json::many(object, &["tag"]),
11213            updated: json::one(object, &["updated"]),
11214            urls: json::many(object, &["url"]),
11215            tos: json::many(object, &["to"]),
11216            btos: json::many(object, &["bto"]),
11217            ccs: json::many(object, &["cc"]),
11218            bccs: json::many(object, &["bcc"]),
11219            media_type: json::one(object, &["mediaType"]),
11220            duration: json::one(object, &["duration"]),
11221            sensitive: json::one(object, &["sensitive"]),
11222            source: json::one(object, &["source"]),
11223            proofs: json::many(object, &["proof"]),
11224            interaction_policy: json::one(object, &["interactionPolicy"]),
11225            approved_by: json::one(object, &["approvedBy"]),
11226            like_authorization: json::one(object, &["likeAuthorization"]),
11227            reply_authorization: json::one(object, &["replyAuthorization"]),
11228            announce_authorization: json::one(object, &["announceAuthorization"]),
11229            translations: json::many(object, &["translations"]),
11230        })
11231    }
11232}
11233
11234impl ToJson for Object {
11235    fn to_json(&self) -> Value {
11236        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
11237        json::put_many(&mut object, &["attachment"], &self.attachments);
11238        json::put_many(&mut object, &["attributedTo"], &self.attributions);
11239        json::put_many(&mut object, &["audience"], &self.audiences);
11240        json::put_text(&mut object, "content", &self.content);
11241        json::put_many(&mut object, &["context"], &self.contexts);
11242        json::put_text(&mut object, "name", &self.name);
11243        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
11244        json::put_many(&mut object, &["generator"], &self.generators);
11245        json::put_many(&mut object, &["icon"], &self.icons);
11246        json::put_many(&mut object, &["image"], &self.images);
11247        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
11248        json::put_many(&mut object, &["location"], &self.locations);
11249        json::put_many(&mut object, &["preview"], &self.previews);
11250        json::put_one(&mut object, &["published"], self.published.as_ref());
11251        json::put_one(&mut object, &["replies"], self.replies.as_ref());
11252        json::put_one(&mut object, &["shares"], self.shares.as_ref());
11253        json::put_one(&mut object, &["likes"], self.likes.as_ref());
11254        json::put_one(
11255            &mut object,
11256            &["emojiReactions"],
11257            self.emoji_reactions.as_ref(),
11258        );
11259        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
11260        json::put_text(&mut object, "summary", &self.summary);
11261        json::put_many(&mut object, &["tag"], &self.tags);
11262        json::put_one(&mut object, &["updated"], self.updated.as_ref());
11263        json::put_many(&mut object, &["url"], &self.urls);
11264        json::put_many(&mut object, &["to"], &self.tos);
11265        json::put_many(&mut object, &["bto"], &self.btos);
11266        json::put_many(&mut object, &["cc"], &self.ccs);
11267        json::put_many(&mut object, &["bcc"], &self.bccs);
11268        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
11269        json::put_one(&mut object, &["duration"], self.duration.as_ref());
11270        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
11271        json::put_one(&mut object, &["source"], self.source.as_ref());
11272        json::put_many(&mut object, &["proof"], &self.proofs);
11273        json::put_one(
11274            &mut object,
11275            &["interactionPolicy"],
11276            self.interaction_policy.as_ref(),
11277        );
11278        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
11279        json::put_one(
11280            &mut object,
11281            &["likeAuthorization"],
11282            self.like_authorization.as_ref(),
11283        );
11284        json::put_one(
11285            &mut object,
11286            &["replyAuthorization"],
11287            self.reply_authorization.as_ref(),
11288        );
11289        json::put_one(
11290            &mut object,
11291            &["announceAuthorization"],
11292            self.announce_authorization.as_ref(),
11293        );
11294        json::put_many(&mut object, &["translations"], &self.translations);
11295        Value::Object(object)
11296    }
11297}
11298
11299/// Indicates that the actor is offering the object.
11300/// If specified, the target indicates the entity to which
11301/// the object is being offered.
11302///
11303/// The type `https://www.w3.org/ns/activitystreams#Offer`.
11304#[derive(Clone, Debug, Default, PartialEq)]
11305pub struct Offer {
11306    /// The IRI that identifies this object.
11307    pub id: Option<Iri>,
11308    /// See [`Object::attachments`].
11309    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
11310    /// See [`Object::attributions`].
11311    pub attributions: Vec<AnyActor>,
11312    /// See [`Object::audiences`].
11313    pub audiences: Vec<AnyObject>,
11314    /// See [`Object::content`].
11315    pub content: Text,
11316    /// See [`Object::contexts`].
11317    pub contexts: Vec<LinkOrObject>,
11318    /// See [`Object::name`].
11319    pub name: Text,
11320    /// See [`Object::end_time`].
11321    pub end_time: Option<String>,
11322    /// See [`Object::generators`].
11323    pub generators: Vec<LinkOrObject>,
11324    /// See [`Object::icons`].
11325    pub icons: Vec<Reference<Image>>,
11326    /// See [`Object::images`].
11327    pub images: Vec<Reference<Image>>,
11328    /// See [`Object::reply_targets`].
11329    pub reply_targets: Vec<LinkOrObject>,
11330    /// See [`Object::locations`].
11331    pub locations: Vec<LinkOrObject>,
11332    /// See [`Object::previews`].
11333    pub previews: Vec<LinkOrObject>,
11334    /// See [`Object::published`].
11335    pub published: Option<String>,
11336    /// See [`Object::replies`].
11337    pub replies: Option<AnyCollection>,
11338    /// See [`Object::shares`].
11339    pub shares: Option<AnyCollection>,
11340    /// See [`Object::likes`].
11341    pub likes: Option<AnyCollection>,
11342    /// See [`Object::emoji_reactions`].
11343    pub emoji_reactions: Option<AnyCollection>,
11344    /// See [`Object::start_time`].
11345    pub start_time: Option<String>,
11346    /// See [`Object::summary`].
11347    pub summary: Text,
11348    /// See [`Object::tags`].
11349    pub tags: Vec<LinkOrObject>,
11350    /// See [`Object::updated`].
11351    pub updated: Option<String>,
11352    /// See [`Object::urls`].
11353    pub urls: Vec<LinkOrIri>,
11354    /// See [`Object::tos`].
11355    pub tos: Vec<AnyObject>,
11356    /// See [`Object::btos`].
11357    pub btos: Vec<AnyObject>,
11358    /// See [`Object::ccs`].
11359    pub ccs: Vec<AnyObject>,
11360    /// See [`Object::bccs`].
11361    pub bccs: Vec<AnyObject>,
11362    /// See [`Object::media_type`].
11363    pub media_type: Option<String>,
11364    /// See [`Object::duration`].
11365    pub duration: Option<String>,
11366    /// See [`Object::sensitive`].
11367    pub sensitive: Option<bool>,
11368    /// See [`Object::source`].
11369    pub source: Option<Box<Source>>,
11370    /// See [`Object::proofs`].
11371    pub proofs: Vec<Reference<DataIntegrityProof>>,
11372    /// See [`Object::interaction_policy`].
11373    pub interaction_policy: Option<Box<InteractionPolicy>>,
11374    /// See [`Object::approved_by`].
11375    pub approved_by: Option<Iri>,
11376    /// See [`Object::like_authorization`].
11377    pub like_authorization: Option<Reference<LikeAuthorization>>,
11378    /// See [`Object::reply_authorization`].
11379    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
11380    /// See [`Object::announce_authorization`].
11381    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
11382    /// See [`Object::translations`].
11383    pub translations: Vec<Translation>,
11384    /// See [`Activity::actors`].
11385    pub actors: Vec<AnyActor>,
11386    /// See [`Activity::objects`].
11387    pub objects: Vec<AnyObject>,
11388    /// See [`Activity::targets`].
11389    pub targets: Vec<AnyObject>,
11390    /// See [`Activity::results`].
11391    pub results: Vec<AnyObject>,
11392    /// See [`Activity::origins`].
11393    pub origins: Vec<AnyObject>,
11394    /// See [`Activity::instruments`].
11395    pub instruments: Vec<AnyObject>,
11396}
11397
11398impl Offer {
11399    /// The type's IRI.
11400    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Offer";
11401    /// The type's `type` in a normalised document.
11402    pub const TYPE: &'static str = "Offer";
11403}
11404
11405impl json::Typed for Offer {
11406    const TYPE: &'static str = "Offer";
11407}
11408
11409impl FromJson for Offer {
11410    fn from_json(value: &Value) -> Result<Self, JsonError> {
11411        let object = json::object(value)?;
11412        json::expect_type(object, Self::TYPE)?;
11413        Ok(Self {
11414            id: json::id(object),
11415            attachments: json::many(object, &["attachment"]),
11416            attributions: json::many(object, &["attributedTo"]),
11417            audiences: json::many(object, &["audience"]),
11418            content: json::text(object, "content"),
11419            contexts: json::many(object, &["context"]),
11420            name: json::text(object, "name"),
11421            end_time: json::one(object, &["endTime"]),
11422            generators: json::many(object, &["generator"]),
11423            icons: json::many_mapped(object, &["icon"], json::link_to_image),
11424            images: json::many_mapped(object, &["image"], json::link_to_image),
11425            reply_targets: json::many(object, &["inReplyTo"]),
11426            locations: json::many(object, &["location"]),
11427            previews: json::many(object, &["preview"]),
11428            published: json::one(object, &["published"]),
11429            replies: json::one(object, &["replies"]),
11430            shares: json::one(object, &["shares"]),
11431            likes: json::one(object, &["likes"]),
11432            emoji_reactions: json::one(object, &["emojiReactions"]),
11433            start_time: json::one(object, &["startTime"]),
11434            summary: json::text(object, "summary"),
11435            tags: json::many(object, &["tag"]),
11436            updated: json::one(object, &["updated"]),
11437            urls: json::many(object, &["url"]),
11438            tos: json::many(object, &["to"]),
11439            btos: json::many(object, &["bto"]),
11440            ccs: json::many(object, &["cc"]),
11441            bccs: json::many(object, &["bcc"]),
11442            media_type: json::one(object, &["mediaType"]),
11443            duration: json::one(object, &["duration"]),
11444            sensitive: json::one(object, &["sensitive"]),
11445            source: json::one(object, &["source"]),
11446            proofs: json::many(object, &["proof"]),
11447            interaction_policy: json::one(object, &["interactionPolicy"]),
11448            approved_by: json::one(object, &["approvedBy"]),
11449            like_authorization: json::one(object, &["likeAuthorization"]),
11450            reply_authorization: json::one(object, &["replyAuthorization"]),
11451            announce_authorization: json::one(object, &["announceAuthorization"]),
11452            translations: json::many(object, &["translations"]),
11453            actors: json::many(object, &["actor"]),
11454            objects: json::many(object, &["object"]),
11455            targets: json::many(object, &["target"]),
11456            results: json::many(object, &["result"]),
11457            origins: json::many(object, &["origin"]),
11458            instruments: json::many(object, &["instrument"]),
11459        })
11460    }
11461}
11462
11463impl ToJson for Offer {
11464    fn to_json(&self) -> Value {
11465        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
11466        json::put_many(&mut object, &["attachment"], &self.attachments);
11467        json::put_many(&mut object, &["attributedTo"], &self.attributions);
11468        json::put_many(&mut object, &["audience"], &self.audiences);
11469        json::put_text(&mut object, "content", &self.content);
11470        json::put_many(&mut object, &["context"], &self.contexts);
11471        json::put_text(&mut object, "name", &self.name);
11472        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
11473        json::put_many(&mut object, &["generator"], &self.generators);
11474        json::put_many(&mut object, &["icon"], &self.icons);
11475        json::put_many(&mut object, &["image"], &self.images);
11476        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
11477        json::put_many(&mut object, &["location"], &self.locations);
11478        json::put_many(&mut object, &["preview"], &self.previews);
11479        json::put_one(&mut object, &["published"], self.published.as_ref());
11480        json::put_one(&mut object, &["replies"], self.replies.as_ref());
11481        json::put_one(&mut object, &["shares"], self.shares.as_ref());
11482        json::put_one(&mut object, &["likes"], self.likes.as_ref());
11483        json::put_one(
11484            &mut object,
11485            &["emojiReactions"],
11486            self.emoji_reactions.as_ref(),
11487        );
11488        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
11489        json::put_text(&mut object, "summary", &self.summary);
11490        json::put_many(&mut object, &["tag"], &self.tags);
11491        json::put_one(&mut object, &["updated"], self.updated.as_ref());
11492        json::put_many(&mut object, &["url"], &self.urls);
11493        json::put_many(&mut object, &["to"], &self.tos);
11494        json::put_many(&mut object, &["bto"], &self.btos);
11495        json::put_many(&mut object, &["cc"], &self.ccs);
11496        json::put_many(&mut object, &["bcc"], &self.bccs);
11497        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
11498        json::put_one(&mut object, &["duration"], self.duration.as_ref());
11499        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
11500        json::put_one(&mut object, &["source"], self.source.as_ref());
11501        json::put_many(&mut object, &["proof"], &self.proofs);
11502        json::put_one(
11503            &mut object,
11504            &["interactionPolicy"],
11505            self.interaction_policy.as_ref(),
11506        );
11507        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
11508        json::put_one(
11509            &mut object,
11510            &["likeAuthorization"],
11511            self.like_authorization.as_ref(),
11512        );
11513        json::put_one(
11514            &mut object,
11515            &["replyAuthorization"],
11516            self.reply_authorization.as_ref(),
11517        );
11518        json::put_one(
11519            &mut object,
11520            &["announceAuthorization"],
11521            self.announce_authorization.as_ref(),
11522        );
11523        json::put_many(&mut object, &["translations"], &self.translations);
11524        json::put_many(&mut object, &["actor"], &self.actors);
11525        json::put_many(&mut object, &["object"], &self.objects);
11526        json::put_many(&mut object, &["target"], &self.targets);
11527        json::put_many(&mut object, &["result"], &self.results);
11528        json::put_many(&mut object, &["origin"], &self.origins);
11529        json::put_many(&mut object, &["instrument"], &self.instruments);
11530        Value::Object(object)
11531    }
11532}
11533
11534/// A subtype of {@link Collection} in which members of the logical collection
11535/// are assumed to always be strictly ordered.
11536///
11537/// The type `https://www.w3.org/ns/activitystreams#OrderedCollection`.
11538#[derive(Clone, Debug, Default, PartialEq)]
11539pub struct OrderedCollection {
11540    /// The IRI that identifies this object.
11541    pub id: Option<Iri>,
11542    /// See [`Object::attachments`].
11543    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
11544    /// See [`Object::attributions`].
11545    pub attributions: Vec<AnyActor>,
11546    /// See [`Object::audiences`].
11547    pub audiences: Vec<AnyObject>,
11548    /// See [`Object::content`].
11549    pub content: Text,
11550    /// See [`Object::contexts`].
11551    pub contexts: Vec<LinkOrObject>,
11552    /// See [`Object::name`].
11553    pub name: Text,
11554    /// See [`Object::end_time`].
11555    pub end_time: Option<String>,
11556    /// See [`Object::generators`].
11557    pub generators: Vec<LinkOrObject>,
11558    /// See [`Object::icons`].
11559    pub icons: Vec<Reference<Image>>,
11560    /// See [`Object::images`].
11561    pub images: Vec<Reference<Image>>,
11562    /// See [`Object::reply_targets`].
11563    pub reply_targets: Vec<LinkOrObject>,
11564    /// See [`Object::locations`].
11565    pub locations: Vec<LinkOrObject>,
11566    /// See [`Object::previews`].
11567    pub previews: Vec<LinkOrObject>,
11568    /// See [`Object::published`].
11569    pub published: Option<String>,
11570    /// See [`Object::replies`].
11571    pub replies: Option<AnyCollection>,
11572    /// See [`Object::shares`].
11573    pub shares: Option<AnyCollection>,
11574    /// See [`Object::likes`].
11575    pub likes: Option<AnyCollection>,
11576    /// See [`Object::emoji_reactions`].
11577    pub emoji_reactions: Option<AnyCollection>,
11578    /// See [`Object::start_time`].
11579    pub start_time: Option<String>,
11580    /// See [`Object::summary`].
11581    pub summary: Text,
11582    /// See [`Object::tags`].
11583    pub tags: Vec<LinkOrObject>,
11584    /// See [`Object::updated`].
11585    pub updated: Option<String>,
11586    /// See [`Object::urls`].
11587    pub urls: Vec<LinkOrIri>,
11588    /// See [`Object::tos`].
11589    pub tos: Vec<AnyObject>,
11590    /// See [`Object::btos`].
11591    pub btos: Vec<AnyObject>,
11592    /// See [`Object::ccs`].
11593    pub ccs: Vec<AnyObject>,
11594    /// See [`Object::bccs`].
11595    pub bccs: Vec<AnyObject>,
11596    /// See [`Object::media_type`].
11597    pub media_type: Option<String>,
11598    /// See [`Object::duration`].
11599    pub duration: Option<String>,
11600    /// See [`Object::sensitive`].
11601    pub sensitive: Option<bool>,
11602    /// See [`Object::source`].
11603    pub source: Option<Box<Source>>,
11604    /// See [`Object::proofs`].
11605    pub proofs: Vec<Reference<DataIntegrityProof>>,
11606    /// See [`Object::interaction_policy`].
11607    pub interaction_policy: Option<Box<InteractionPolicy>>,
11608    /// See [`Object::approved_by`].
11609    pub approved_by: Option<Iri>,
11610    /// See [`Object::like_authorization`].
11611    pub like_authorization: Option<Reference<LikeAuthorization>>,
11612    /// See [`Object::reply_authorization`].
11613    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
11614    /// See [`Object::announce_authorization`].
11615    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
11616    /// See [`Object::translations`].
11617    pub translations: Vec<Translation>,
11618    /// See [`Collection::total_items`].
11619    pub total_items: Option<u64>,
11620    /// See [`Collection::current`].
11621    pub current: Option<AnyCollectionPage>,
11622    /// See [`Collection::first`].
11623    pub first: Option<AnyCollectionPage>,
11624    /// See [`Collection::last`].
11625    pub last: Option<AnyCollectionPage>,
11626    /// Identifies the items contained in a collection.  The items might be ordered
11627    /// or unordered.
11628    pub items: Vec<LinkOrObject>,
11629    /// See [`Collection::likes_of`].
11630    pub likes_of: Option<AnyObject>,
11631    /// See [`Collection::shares_of`].
11632    pub shares_of: Option<AnyObject>,
11633    /// See [`Collection::replies_of`].
11634    pub replies_of: Option<AnyObject>,
11635    /// See [`Collection::inbox_of`].
11636    pub inbox_of: Option<AnyObject>,
11637    /// See [`Collection::outbox_of`].
11638    pub outbox_of: Option<AnyObject>,
11639    /// See [`Collection::followers_of`].
11640    pub followers_of: Option<AnyObject>,
11641    /// See [`Collection::following_of`].
11642    pub following_of: Option<AnyObject>,
11643    /// See [`Collection::liked_of`].
11644    pub liked_of: Option<AnyObject>,
11645}
11646
11647impl OrderedCollection {
11648    /// The type's IRI.
11649    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#OrderedCollection";
11650    /// The type's `type` in a normalised document.
11651    pub const TYPE: &'static str = "OrderedCollection";
11652}
11653
11654impl json::Typed for OrderedCollection {
11655    const TYPE: &'static str = "OrderedCollection";
11656}
11657
11658impl FromJson for OrderedCollection {
11659    fn from_json(value: &Value) -> Result<Self, JsonError> {
11660        let object = json::object(value)?;
11661        json::expect_type(object, Self::TYPE)?;
11662        Ok(Self {
11663            id: json::id(object),
11664            attachments: json::many(object, &["attachment"]),
11665            attributions: json::many(object, &["attributedTo"]),
11666            audiences: json::many(object, &["audience"]),
11667            content: json::text(object, "content"),
11668            contexts: json::many(object, &["context"]),
11669            name: json::text(object, "name"),
11670            end_time: json::one(object, &["endTime"]),
11671            generators: json::many(object, &["generator"]),
11672            icons: json::many_mapped(object, &["icon"], json::link_to_image),
11673            images: json::many_mapped(object, &["image"], json::link_to_image),
11674            reply_targets: json::many(object, &["inReplyTo"]),
11675            locations: json::many(object, &["location"]),
11676            previews: json::many(object, &["preview"]),
11677            published: json::one(object, &["published"]),
11678            replies: json::one(object, &["replies"]),
11679            shares: json::one(object, &["shares"]),
11680            likes: json::one(object, &["likes"]),
11681            emoji_reactions: json::one(object, &["emojiReactions"]),
11682            start_time: json::one(object, &["startTime"]),
11683            summary: json::text(object, "summary"),
11684            tags: json::many(object, &["tag"]),
11685            updated: json::one(object, &["updated"]),
11686            urls: json::many(object, &["url"]),
11687            tos: json::many(object, &["to"]),
11688            btos: json::many(object, &["bto"]),
11689            ccs: json::many(object, &["cc"]),
11690            bccs: json::many(object, &["bcc"]),
11691            media_type: json::one(object, &["mediaType"]),
11692            duration: json::one(object, &["duration"]),
11693            sensitive: json::one(object, &["sensitive"]),
11694            source: json::one(object, &["source"]),
11695            proofs: json::many(object, &["proof"]),
11696            interaction_policy: json::one(object, &["interactionPolicy"]),
11697            approved_by: json::one(object, &["approvedBy"]),
11698            like_authorization: json::one(object, &["likeAuthorization"]),
11699            reply_authorization: json::one(object, &["replyAuthorization"]),
11700            announce_authorization: json::one(object, &["announceAuthorization"]),
11701            translations: json::many(object, &["translations"]),
11702            total_items: json::one(object, &["totalItems"]),
11703            current: json::one(object, &["current"]),
11704            first: json::one(object, &["first"]),
11705            last: json::one(object, &["last"]),
11706            items: json::many(object, &["orderedItems", "items"]),
11707            likes_of: json::one(object, &["https://w3id.org/fep/5711#likesOf"]),
11708            shares_of: json::one(object, &["https://w3id.org/fep/5711#sharesOf"]),
11709            replies_of: json::one(object, &["https://w3id.org/fep/5711#repliesOf"]),
11710            inbox_of: json::one(object, &["https://w3id.org/fep/5711#inboxOf"]),
11711            outbox_of: json::one(object, &["https://w3id.org/fep/5711#outboxOf"]),
11712            followers_of: json::one(object, &["https://w3id.org/fep/5711#followersOf"]),
11713            following_of: json::one(object, &["https://w3id.org/fep/5711#followingOf"]),
11714            liked_of: json::one(object, &["https://w3id.org/fep/5711#likedOf"]),
11715        })
11716    }
11717}
11718
11719impl ToJson for OrderedCollection {
11720    fn to_json(&self) -> Value {
11721        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
11722        json::put_many(&mut object, &["attachment"], &self.attachments);
11723        json::put_many(&mut object, &["attributedTo"], &self.attributions);
11724        json::put_many(&mut object, &["audience"], &self.audiences);
11725        json::put_text(&mut object, "content", &self.content);
11726        json::put_many(&mut object, &["context"], &self.contexts);
11727        json::put_text(&mut object, "name", &self.name);
11728        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
11729        json::put_many(&mut object, &["generator"], &self.generators);
11730        json::put_many(&mut object, &["icon"], &self.icons);
11731        json::put_many(&mut object, &["image"], &self.images);
11732        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
11733        json::put_many(&mut object, &["location"], &self.locations);
11734        json::put_many(&mut object, &["preview"], &self.previews);
11735        json::put_one(&mut object, &["published"], self.published.as_ref());
11736        json::put_one(&mut object, &["replies"], self.replies.as_ref());
11737        json::put_one(&mut object, &["shares"], self.shares.as_ref());
11738        json::put_one(&mut object, &["likes"], self.likes.as_ref());
11739        json::put_one(
11740            &mut object,
11741            &["emojiReactions"],
11742            self.emoji_reactions.as_ref(),
11743        );
11744        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
11745        json::put_text(&mut object, "summary", &self.summary);
11746        json::put_many(&mut object, &["tag"], &self.tags);
11747        json::put_one(&mut object, &["updated"], self.updated.as_ref());
11748        json::put_many(&mut object, &["url"], &self.urls);
11749        json::put_many(&mut object, &["to"], &self.tos);
11750        json::put_many(&mut object, &["bto"], &self.btos);
11751        json::put_many(&mut object, &["cc"], &self.ccs);
11752        json::put_many(&mut object, &["bcc"], &self.bccs);
11753        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
11754        json::put_one(&mut object, &["duration"], self.duration.as_ref());
11755        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
11756        json::put_one(&mut object, &["source"], self.source.as_ref());
11757        json::put_many(&mut object, &["proof"], &self.proofs);
11758        json::put_one(
11759            &mut object,
11760            &["interactionPolicy"],
11761            self.interaction_policy.as_ref(),
11762        );
11763        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
11764        json::put_one(
11765            &mut object,
11766            &["likeAuthorization"],
11767            self.like_authorization.as_ref(),
11768        );
11769        json::put_one(
11770            &mut object,
11771            &["replyAuthorization"],
11772            self.reply_authorization.as_ref(),
11773        );
11774        json::put_one(
11775            &mut object,
11776            &["announceAuthorization"],
11777            self.announce_authorization.as_ref(),
11778        );
11779        json::put_many(&mut object, &["translations"], &self.translations);
11780        json::put_one(&mut object, &["totalItems"], self.total_items.as_ref());
11781        json::put_one(&mut object, &["current"], self.current.as_ref());
11782        json::put_one(&mut object, &["first"], self.first.as_ref());
11783        json::put_one(&mut object, &["last"], self.last.as_ref());
11784        json::put_many(&mut object, &["orderedItems"], &self.items);
11785        json::put_one(
11786            &mut object,
11787            &["https://w3id.org/fep/5711#likesOf"],
11788            self.likes_of.as_ref(),
11789        );
11790        json::put_one(
11791            &mut object,
11792            &["https://w3id.org/fep/5711#sharesOf"],
11793            self.shares_of.as_ref(),
11794        );
11795        json::put_one(
11796            &mut object,
11797            &["https://w3id.org/fep/5711#repliesOf"],
11798            self.replies_of.as_ref(),
11799        );
11800        json::put_one(
11801            &mut object,
11802            &["https://w3id.org/fep/5711#inboxOf"],
11803            self.inbox_of.as_ref(),
11804        );
11805        json::put_one(
11806            &mut object,
11807            &["https://w3id.org/fep/5711#outboxOf"],
11808            self.outbox_of.as_ref(),
11809        );
11810        json::put_one(
11811            &mut object,
11812            &["https://w3id.org/fep/5711#followersOf"],
11813            self.followers_of.as_ref(),
11814        );
11815        json::put_one(
11816            &mut object,
11817            &["https://w3id.org/fep/5711#followingOf"],
11818            self.following_of.as_ref(),
11819        );
11820        json::put_one(
11821            &mut object,
11822            &["https://w3id.org/fep/5711#likedOf"],
11823            self.liked_of.as_ref(),
11824        );
11825        Value::Object(object)
11826    }
11827}
11828
11829/// Used to represent ordered subsets of items from an `OrderedCollection`.
11830/// Refer to the Activity Streams 2.0 Core for a complete description of
11831/// the `OrderedCollectionPage` object.
11832///
11833/// The type `https://www.w3.org/ns/activitystreams#OrderedCollectionPage`.
11834#[derive(Clone, Debug, Default, PartialEq)]
11835pub struct OrderedCollectionPage {
11836    /// The IRI that identifies this object.
11837    pub id: Option<Iri>,
11838    /// See [`Object::attachments`].
11839    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
11840    /// See [`Object::attributions`].
11841    pub attributions: Vec<AnyActor>,
11842    /// See [`Object::audiences`].
11843    pub audiences: Vec<AnyObject>,
11844    /// See [`Object::content`].
11845    pub content: Text,
11846    /// See [`Object::contexts`].
11847    pub contexts: Vec<LinkOrObject>,
11848    /// See [`Object::name`].
11849    pub name: Text,
11850    /// See [`Object::end_time`].
11851    pub end_time: Option<String>,
11852    /// See [`Object::generators`].
11853    pub generators: Vec<LinkOrObject>,
11854    /// See [`Object::icons`].
11855    pub icons: Vec<Reference<Image>>,
11856    /// See [`Object::images`].
11857    pub images: Vec<Reference<Image>>,
11858    /// See [`Object::reply_targets`].
11859    pub reply_targets: Vec<LinkOrObject>,
11860    /// See [`Object::locations`].
11861    pub locations: Vec<LinkOrObject>,
11862    /// See [`Object::previews`].
11863    pub previews: Vec<LinkOrObject>,
11864    /// See [`Object::published`].
11865    pub published: Option<String>,
11866    /// See [`Object::replies`].
11867    pub replies: Option<AnyCollection>,
11868    /// See [`Object::shares`].
11869    pub shares: Option<AnyCollection>,
11870    /// See [`Object::likes`].
11871    pub likes: Option<AnyCollection>,
11872    /// See [`Object::emoji_reactions`].
11873    pub emoji_reactions: Option<AnyCollection>,
11874    /// See [`Object::start_time`].
11875    pub start_time: Option<String>,
11876    /// See [`Object::summary`].
11877    pub summary: Text,
11878    /// See [`Object::tags`].
11879    pub tags: Vec<LinkOrObject>,
11880    /// See [`Object::updated`].
11881    pub updated: Option<String>,
11882    /// See [`Object::urls`].
11883    pub urls: Vec<LinkOrIri>,
11884    /// See [`Object::tos`].
11885    pub tos: Vec<AnyObject>,
11886    /// See [`Object::btos`].
11887    pub btos: Vec<AnyObject>,
11888    /// See [`Object::ccs`].
11889    pub ccs: Vec<AnyObject>,
11890    /// See [`Object::bccs`].
11891    pub bccs: Vec<AnyObject>,
11892    /// See [`Object::media_type`].
11893    pub media_type: Option<String>,
11894    /// See [`Object::duration`].
11895    pub duration: Option<String>,
11896    /// See [`Object::sensitive`].
11897    pub sensitive: Option<bool>,
11898    /// See [`Object::source`].
11899    pub source: Option<Box<Source>>,
11900    /// See [`Object::proofs`].
11901    pub proofs: Vec<Reference<DataIntegrityProof>>,
11902    /// See [`Object::interaction_policy`].
11903    pub interaction_policy: Option<Box<InteractionPolicy>>,
11904    /// See [`Object::approved_by`].
11905    pub approved_by: Option<Iri>,
11906    /// See [`Object::like_authorization`].
11907    pub like_authorization: Option<Reference<LikeAuthorization>>,
11908    /// See [`Object::reply_authorization`].
11909    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
11910    /// See [`Object::announce_authorization`].
11911    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
11912    /// See [`Object::translations`].
11913    pub translations: Vec<Translation>,
11914    /// See [`Collection::total_items`].
11915    pub total_items: Option<u64>,
11916    /// See [`Collection::current`].
11917    pub current: Option<AnyCollectionPage>,
11918    /// See [`Collection::first`].
11919    pub first: Option<AnyCollectionPage>,
11920    /// See [`Collection::last`].
11921    pub last: Option<AnyCollectionPage>,
11922    /// Identifies the items contained in a collection.  The items might be ordered
11923    /// or unordered.
11924    pub items: Vec<LinkOrObject>,
11925    /// See [`Collection::likes_of`].
11926    pub likes_of: Option<AnyObject>,
11927    /// See [`Collection::shares_of`].
11928    pub shares_of: Option<AnyObject>,
11929    /// See [`Collection::replies_of`].
11930    pub replies_of: Option<AnyObject>,
11931    /// See [`Collection::inbox_of`].
11932    pub inbox_of: Option<AnyObject>,
11933    /// See [`Collection::outbox_of`].
11934    pub outbox_of: Option<AnyObject>,
11935    /// See [`Collection::followers_of`].
11936    pub followers_of: Option<AnyObject>,
11937    /// See [`Collection::following_of`].
11938    pub following_of: Option<AnyObject>,
11939    /// See [`Collection::liked_of`].
11940    pub liked_of: Option<AnyObject>,
11941    /// See [`CollectionPage::part_of`].
11942    pub part_of: Option<AnyCollection>,
11943    /// See [`CollectionPage::next`].
11944    pub next: Option<AnyCollectionPage>,
11945    /// See [`CollectionPage::prev`].
11946    pub prev: Option<AnyCollectionPage>,
11947    /// A non-negative integer value identifying the relative position within
11948    /// the logical view of a strictly ordered collection.
11949    pub start_index: Option<u64>,
11950}
11951
11952impl OrderedCollectionPage {
11953    /// The type's IRI.
11954    pub const TYPE_IRI: &'static str =
11955        "https://www.w3.org/ns/activitystreams#OrderedCollectionPage";
11956    /// The type's `type` in a normalised document.
11957    pub const TYPE: &'static str = "OrderedCollectionPage";
11958}
11959
11960impl json::Typed for OrderedCollectionPage {
11961    const TYPE: &'static str = "OrderedCollectionPage";
11962}
11963
11964impl FromJson for OrderedCollectionPage {
11965    fn from_json(value: &Value) -> Result<Self, JsonError> {
11966        let object = json::object(value)?;
11967        json::expect_type(object, Self::TYPE)?;
11968        Ok(Self {
11969            id: json::id(object),
11970            attachments: json::many(object, &["attachment"]),
11971            attributions: json::many(object, &["attributedTo"]),
11972            audiences: json::many(object, &["audience"]),
11973            content: json::text(object, "content"),
11974            contexts: json::many(object, &["context"]),
11975            name: json::text(object, "name"),
11976            end_time: json::one(object, &["endTime"]),
11977            generators: json::many(object, &["generator"]),
11978            icons: json::many_mapped(object, &["icon"], json::link_to_image),
11979            images: json::many_mapped(object, &["image"], json::link_to_image),
11980            reply_targets: json::many(object, &["inReplyTo"]),
11981            locations: json::many(object, &["location"]),
11982            previews: json::many(object, &["preview"]),
11983            published: json::one(object, &["published"]),
11984            replies: json::one(object, &["replies"]),
11985            shares: json::one(object, &["shares"]),
11986            likes: json::one(object, &["likes"]),
11987            emoji_reactions: json::one(object, &["emojiReactions"]),
11988            start_time: json::one(object, &["startTime"]),
11989            summary: json::text(object, "summary"),
11990            tags: json::many(object, &["tag"]),
11991            updated: json::one(object, &["updated"]),
11992            urls: json::many(object, &["url"]),
11993            tos: json::many(object, &["to"]),
11994            btos: json::many(object, &["bto"]),
11995            ccs: json::many(object, &["cc"]),
11996            bccs: json::many(object, &["bcc"]),
11997            media_type: json::one(object, &["mediaType"]),
11998            duration: json::one(object, &["duration"]),
11999            sensitive: json::one(object, &["sensitive"]),
12000            source: json::one(object, &["source"]),
12001            proofs: json::many(object, &["proof"]),
12002            interaction_policy: json::one(object, &["interactionPolicy"]),
12003            approved_by: json::one(object, &["approvedBy"]),
12004            like_authorization: json::one(object, &["likeAuthorization"]),
12005            reply_authorization: json::one(object, &["replyAuthorization"]),
12006            announce_authorization: json::one(object, &["announceAuthorization"]),
12007            translations: json::many(object, &["translations"]),
12008            total_items: json::one(object, &["totalItems"]),
12009            current: json::one(object, &["current"]),
12010            first: json::one(object, &["first"]),
12011            last: json::one(object, &["last"]),
12012            items: json::many(object, &["orderedItems", "items"]),
12013            likes_of: json::one(object, &["https://w3id.org/fep/5711#likesOf"]),
12014            shares_of: json::one(object, &["https://w3id.org/fep/5711#sharesOf"]),
12015            replies_of: json::one(object, &["https://w3id.org/fep/5711#repliesOf"]),
12016            inbox_of: json::one(object, &["https://w3id.org/fep/5711#inboxOf"]),
12017            outbox_of: json::one(object, &["https://w3id.org/fep/5711#outboxOf"]),
12018            followers_of: json::one(object, &["https://w3id.org/fep/5711#followersOf"]),
12019            following_of: json::one(object, &["https://w3id.org/fep/5711#followingOf"]),
12020            liked_of: json::one(object, &["https://w3id.org/fep/5711#likedOf"]),
12021            part_of: json::one(object, &["partOf"]),
12022            next: json::one(object, &["next"]),
12023            prev: json::one(object, &["prev"]),
12024            start_index: json::one(object, &["startIndex"]),
12025        })
12026    }
12027}
12028
12029impl ToJson for OrderedCollectionPage {
12030    fn to_json(&self) -> Value {
12031        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
12032        json::put_many(&mut object, &["attachment"], &self.attachments);
12033        json::put_many(&mut object, &["attributedTo"], &self.attributions);
12034        json::put_many(&mut object, &["audience"], &self.audiences);
12035        json::put_text(&mut object, "content", &self.content);
12036        json::put_many(&mut object, &["context"], &self.contexts);
12037        json::put_text(&mut object, "name", &self.name);
12038        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
12039        json::put_many(&mut object, &["generator"], &self.generators);
12040        json::put_many(&mut object, &["icon"], &self.icons);
12041        json::put_many(&mut object, &["image"], &self.images);
12042        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
12043        json::put_many(&mut object, &["location"], &self.locations);
12044        json::put_many(&mut object, &["preview"], &self.previews);
12045        json::put_one(&mut object, &["published"], self.published.as_ref());
12046        json::put_one(&mut object, &["replies"], self.replies.as_ref());
12047        json::put_one(&mut object, &["shares"], self.shares.as_ref());
12048        json::put_one(&mut object, &["likes"], self.likes.as_ref());
12049        json::put_one(
12050            &mut object,
12051            &["emojiReactions"],
12052            self.emoji_reactions.as_ref(),
12053        );
12054        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
12055        json::put_text(&mut object, "summary", &self.summary);
12056        json::put_many(&mut object, &["tag"], &self.tags);
12057        json::put_one(&mut object, &["updated"], self.updated.as_ref());
12058        json::put_many(&mut object, &["url"], &self.urls);
12059        json::put_many(&mut object, &["to"], &self.tos);
12060        json::put_many(&mut object, &["bto"], &self.btos);
12061        json::put_many(&mut object, &["cc"], &self.ccs);
12062        json::put_many(&mut object, &["bcc"], &self.bccs);
12063        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
12064        json::put_one(&mut object, &["duration"], self.duration.as_ref());
12065        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
12066        json::put_one(&mut object, &["source"], self.source.as_ref());
12067        json::put_many(&mut object, &["proof"], &self.proofs);
12068        json::put_one(
12069            &mut object,
12070            &["interactionPolicy"],
12071            self.interaction_policy.as_ref(),
12072        );
12073        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
12074        json::put_one(
12075            &mut object,
12076            &["likeAuthorization"],
12077            self.like_authorization.as_ref(),
12078        );
12079        json::put_one(
12080            &mut object,
12081            &["replyAuthorization"],
12082            self.reply_authorization.as_ref(),
12083        );
12084        json::put_one(
12085            &mut object,
12086            &["announceAuthorization"],
12087            self.announce_authorization.as_ref(),
12088        );
12089        json::put_many(&mut object, &["translations"], &self.translations);
12090        json::put_one(&mut object, &["totalItems"], self.total_items.as_ref());
12091        json::put_one(&mut object, &["current"], self.current.as_ref());
12092        json::put_one(&mut object, &["first"], self.first.as_ref());
12093        json::put_one(&mut object, &["last"], self.last.as_ref());
12094        json::put_many(&mut object, &["orderedItems"], &self.items);
12095        json::put_one(
12096            &mut object,
12097            &["https://w3id.org/fep/5711#likesOf"],
12098            self.likes_of.as_ref(),
12099        );
12100        json::put_one(
12101            &mut object,
12102            &["https://w3id.org/fep/5711#sharesOf"],
12103            self.shares_of.as_ref(),
12104        );
12105        json::put_one(
12106            &mut object,
12107            &["https://w3id.org/fep/5711#repliesOf"],
12108            self.replies_of.as_ref(),
12109        );
12110        json::put_one(
12111            &mut object,
12112            &["https://w3id.org/fep/5711#inboxOf"],
12113            self.inbox_of.as_ref(),
12114        );
12115        json::put_one(
12116            &mut object,
12117            &["https://w3id.org/fep/5711#outboxOf"],
12118            self.outbox_of.as_ref(),
12119        );
12120        json::put_one(
12121            &mut object,
12122            &["https://w3id.org/fep/5711#followersOf"],
12123            self.followers_of.as_ref(),
12124        );
12125        json::put_one(
12126            &mut object,
12127            &["https://w3id.org/fep/5711#followingOf"],
12128            self.following_of.as_ref(),
12129        );
12130        json::put_one(
12131            &mut object,
12132            &["https://w3id.org/fep/5711#likedOf"],
12133            self.liked_of.as_ref(),
12134        );
12135        json::put_one(&mut object, &["partOf"], self.part_of.as_ref());
12136        json::put_one(&mut object, &["next"], self.next.as_ref());
12137        json::put_one(&mut object, &["prev"], self.prev.as_ref());
12138        json::put_one(&mut object, &["startIndex"], self.start_index.as_ref());
12139        Value::Object(object)
12140    }
12141}
12142
12143/// Represents an organization.
12144///
12145/// The type `https://www.w3.org/ns/activitystreams#Organization`.
12146#[derive(Clone, Debug, Default, PartialEq)]
12147pub struct Organization {
12148    /// The IRI that identifies this object.
12149    pub id: Option<Iri>,
12150    /// See [`Object::attachments`].
12151    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
12152    /// See [`Object::attributions`].
12153    pub attributions: Vec<AnyActor>,
12154    /// See [`Object::audiences`].
12155    pub audiences: Vec<AnyObject>,
12156    /// See [`Object::content`].
12157    pub content: Text,
12158    /// See [`Object::contexts`].
12159    pub contexts: Vec<LinkOrObject>,
12160    /// See [`Object::name`].
12161    pub name: Text,
12162    /// See [`Object::end_time`].
12163    pub end_time: Option<String>,
12164    /// See [`Object::generators`].
12165    pub generators: Vec<LinkOrObject>,
12166    /// See [`Object::icons`].
12167    pub icons: Vec<Reference<Image>>,
12168    /// See [`Object::images`].
12169    pub images: Vec<Reference<Image>>,
12170    /// See [`Object::reply_targets`].
12171    pub reply_targets: Vec<LinkOrObject>,
12172    /// See [`Object::locations`].
12173    pub locations: Vec<LinkOrObject>,
12174    /// See [`Object::previews`].
12175    pub previews: Vec<LinkOrObject>,
12176    /// See [`Object::published`].
12177    pub published: Option<String>,
12178    /// See [`Object::replies`].
12179    pub replies: Option<AnyCollection>,
12180    /// See [`Object::shares`].
12181    pub shares: Option<AnyCollection>,
12182    /// See [`Object::likes`].
12183    pub likes: Option<AnyCollection>,
12184    /// See [`Object::emoji_reactions`].
12185    pub emoji_reactions: Option<AnyCollection>,
12186    /// See [`Object::start_time`].
12187    pub start_time: Option<String>,
12188    /// See [`Object::summary`].
12189    pub summary: Text,
12190    /// See [`Object::tags`].
12191    pub tags: Vec<LinkOrObject>,
12192    /// See [`Object::updated`].
12193    pub updated: Option<String>,
12194    /// See [`Object::urls`].
12195    pub urls: Vec<LinkOrIri>,
12196    /// See [`Object::tos`].
12197    pub tos: Vec<AnyObject>,
12198    /// See [`Object::btos`].
12199    pub btos: Vec<AnyObject>,
12200    /// See [`Object::ccs`].
12201    pub ccs: Vec<AnyObject>,
12202    /// See [`Object::bccs`].
12203    pub bccs: Vec<AnyObject>,
12204    /// See [`Object::media_type`].
12205    pub media_type: Option<String>,
12206    /// See [`Object::duration`].
12207    pub duration: Option<String>,
12208    /// See [`Object::sensitive`].
12209    pub sensitive: Option<bool>,
12210    /// See [`Object::source`].
12211    pub source: Option<Box<Source>>,
12212    /// See [`Object::proofs`].
12213    pub proofs: Vec<Reference<DataIntegrityProof>>,
12214    /// See [`Object::interaction_policy`].
12215    pub interaction_policy: Option<Box<InteractionPolicy>>,
12216    /// See [`Object::approved_by`].
12217    pub approved_by: Option<Iri>,
12218    /// See [`Object::like_authorization`].
12219    pub like_authorization: Option<Reference<LikeAuthorization>>,
12220    /// See [`Object::reply_authorization`].
12221    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
12222    /// See [`Object::announce_authorization`].
12223    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
12224    /// See [`Object::translations`].
12225    pub translations: Vec<Translation>,
12226    /// A short username which may be used to refer to the actor,
12227    /// with no uniqueness guarantees.
12228    pub preferred_username: Text,
12229    /// A public part of the key pair owned by this actor.
12230    pub public_keys: Vec<Reference<CryptographicKey>>,
12231    /// Represents this actor's public keys.  It serves as equivalent to
12232    /// the `publicKeys` property, but is used for [FEP-521a](https://w3id.org/fep/521a) compliance.
12233    pub assertion_methods: Vec<Reference<Multikey>>,
12234    /// Gateways where the latest version of this portable actor object can be
12235    /// retrieved.
12236    pub gateways: Vec<Iri>,
12237    /// When `true`, conveys that for this actor, follow requests are not usually
12238    /// automatically approved, but instead are examined by a person who may accept
12239    /// or reject the request, at some time in the future.  Setting of `false`
12240    /// conveys no information and may be ignored.  This information is typically
12241    /// used to affect display of accounts, such as showing an account as private or
12242    /// locked.
12243    pub manually_approves_followers: Option<bool>,
12244    /// The inbox stream contains all activities received by the actor.  The server
12245    /// SHOULD filter content according to the requester's permission.  In general,
12246    /// the owner of an inbox is likely to be able to access all of their inbox
12247    /// contents.  Depending on access control, some other content may be public,
12248    /// whereas other content may require authentication for non-owner users,
12249    /// if they can access the inbox at all.
12250    pub inbox: Option<OrderedCollectionOrOrderedCollectionPage>,
12251    /// The outbox stream contains activities the user has published,
12252    /// subject to the ability of the requestor to retrieve the activity
12253    /// (that is, the contents of the outbox are filtered by the permissions of
12254    /// the person reading it).  If a user submits a request without
12255    /// [Authorization](https://www.w3.org/TR/activitypub/#authorization)
12256    /// the server should respond with all of the
12257    /// [Public](https://www.w3.org/TR/activitypub/#public-addressing) posts.
12258    /// This could potentially be all relevant objects published by the user,
12259    /// though the number of available items is left to the discretion of those
12260    /// implementing and deploying the server.
12261    pub outbox: Option<OrderedCollectionOrOrderedCollectionPage>,
12262    /// This is a list of everybody that the actor has followed, added as a
12263    /// [side effect](https://www.w3.org/TR/activitypub/#follow-activity-outbox).
12264    /// The `following` collection MUST be either an {@link OrderedCollection}
12265    /// or a {@link Collection} and MAY be filtered on privileges of
12266    /// an authenticated user or as appropriate when no authentication is given.
12267    pub following: Option<AnyCollection>,
12268    /// This is a list of everyone who has sent a {@link Follow} activity
12269    /// for the actor, added as a
12270    /// [side effect](https://www.w3.org/TR/activitypub/#follow-activity-outbox).
12271    /// This is where one would find a list of all the actors that are following
12272    /// the actor.  The `followers` collection MUST be either
12273    /// an {@link OrderedCollection} or a {@link Collection} and MAY be filtered on
12274    /// privileges of an authenticated user or as appropriate when no authentication
12275    /// is given.
12276    pub followers: Option<AnyCollection>,
12277    /// This is a list of every object from all of the actor's {@link Like}
12278    /// activities, added as a
12279    /// [side effect](https://www.w3.org/TR/activitypub/#like-activity-outbox).
12280    /// The `liked` collection MUST be either an {@link OrderedCollection} or
12281    /// a {@link Collection} and MAY be filtered on privileges of an authenticated
12282    /// user or as appropriate when no authentication is given.
12283    pub liked: Option<AnyCollection>,
12284    /// What is known in Mastodon as "pinned statuses", or statuses that are always
12285    /// featured at the top of people's profiles, is implemented using an extra
12286    /// property `featured` on the actor object that points to a {@link Collection}
12287    /// of objects.
12288    pub featured: Option<AnyCollection>,
12289    /// What is known in Mastodon as "featured hashtags", hashtags that are featured
12290    /// at people's profiles, is implemented using an extra property `featuredTags`
12291    /// on the actor object that points to a {@link Collection} of {@link Hashtag}
12292    /// objects specifically.
12293    pub featured_tags: Option<AnyCollection>,
12294    /// A collection of {@link FeaturedCollection}s created by this actor.
12295    pub featured_collections: Option<AnyCollection>,
12296    /// A list of supplementary Collections which may be of interest.
12297    pub streams: Vec<AnyCollection>,
12298    /// A JSON object which maps additional (typically server/domain-wide) endpoints
12299    /// which may be useful either for this actor or someone referencing this actor.
12300    /// This mapping may be nested inside the actor document as the value or may be
12301    /// a link to a JSON-LD document with these properties.
12302    pub endpoints: Option<Box<Endpoints>>,
12303    /// Allows users to opt-in or opt-out of discoverability features like
12304    /// the profile directory.  This flag may also be used as an indicator of
12305    /// the user's preferences toward being included in external discovery services,
12306    /// such as search engines or other indexing tools.
12307    pub discoverable: Option<bool>,
12308    /// Reports whether a user was locally suspended, for better handling of
12309    /// these accounts.
12310    pub suspended: Option<bool>,
12311    /// Whether the actor is in-memorial state.
12312    pub memorial: Option<bool>,
12313    /// Whether the actor allows to be indexed.
12314    pub indexable: Option<bool>,
12315    /// Signifies that an actor has been moved to a different ID. Used in Mastodon-style data portability with the {@link Move} activity; see [ActivityPub Data Portability/Move Action](https://swicg.github.io/activitypub-data-portability/#move-action) for more details.
12316    pub successor: Option<AnyActor>,
12317    /// The `aliases` (`alsoKnownAs`) property is used to specify alternative names
12318    /// or aliases for an entity.  It can be used to provide additional identifiers
12319    /// or labels for an entity, which can be useful in scenarios where an entity
12320    /// may have multiple names or aliases.
12321    pub aliases: Vec<AnyActor>,
12322    /// Means of communicating or interacting with the DID subject or associated
12323    /// entities via one or more service endpoints. Examples include discovery
12324    /// services, agent services, social networking services, file storage services,
12325    /// and verifiable credential repository services.
12326    pub services: Vec<AnyDidService>,
12327    /// This value is used for `Actor` type objects to show message on followed.
12328    pub followed_message: Option<String>,
12329    /// Used on actors to indicate that they in some way identify as a cat,
12330    /// expressed as a boolean value. If this property is set to `true`,
12331    /// displaying the actor or their notes will have some special effects
12332    /// attached in some clients.
12333    pub cat: Option<bool>,
12334    /// The actor's WebFinger handle, `user@host` (FEP-2c59).
12335    pub webfinger: Option<String>,
12336    /// The shared inbox, where Misskey writes it: on the actor rather than in
12337    /// its `endpoints`. Prefer `endpoints.sharedInbox` when both are there.
12338    pub shared_inbox: Option<Iri>,
12339}
12340
12341impl Organization {
12342    /// The type's IRI.
12343    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Organization";
12344    /// The type's `type` in a normalised document.
12345    pub const TYPE: &'static str = "Organization";
12346}
12347
12348impl json::Typed for Organization {
12349    const TYPE: &'static str = "Organization";
12350}
12351
12352impl FromJson for Organization {
12353    fn from_json(value: &Value) -> Result<Self, JsonError> {
12354        let object = json::object(value)?;
12355        json::expect_type(object, Self::TYPE)?;
12356        Ok(Self {
12357            id: json::id(object),
12358            attachments: json::many(object, &["attachment"]),
12359            attributions: json::many(object, &["attributedTo"]),
12360            audiences: json::many(object, &["audience"]),
12361            content: json::text(object, "content"),
12362            contexts: json::many(object, &["context"]),
12363            name: json::text(object, "name"),
12364            end_time: json::one(object, &["endTime"]),
12365            generators: json::many(object, &["generator"]),
12366            icons: json::many_mapped(object, &["icon"], json::link_to_image),
12367            images: json::many_mapped(object, &["image"], json::link_to_image),
12368            reply_targets: json::many(object, &["inReplyTo"]),
12369            locations: json::many(object, &["location"]),
12370            previews: json::many(object, &["preview"]),
12371            published: json::one(object, &["published"]),
12372            replies: json::one(object, &["replies"]),
12373            shares: json::one(object, &["shares"]),
12374            likes: json::one(object, &["likes"]),
12375            emoji_reactions: json::one(object, &["emojiReactions"]),
12376            start_time: json::one(object, &["startTime"]),
12377            summary: json::text(object, "summary"),
12378            tags: json::many(object, &["tag"]),
12379            updated: json::one(object, &["updated"]),
12380            urls: json::many(object, &["url"]),
12381            tos: json::many(object, &["to"]),
12382            btos: json::many(object, &["bto"]),
12383            ccs: json::many(object, &["cc"]),
12384            bccs: json::many(object, &["bcc"]),
12385            media_type: json::one(object, &["mediaType"]),
12386            duration: json::one(object, &["duration"]),
12387            sensitive: json::one(object, &["sensitive"]),
12388            source: json::one(object, &["source"]),
12389            proofs: json::many(object, &["proof"]),
12390            interaction_policy: json::one(object, &["interactionPolicy"]),
12391            approved_by: json::one(object, &["approvedBy"]),
12392            like_authorization: json::one(object, &["likeAuthorization"]),
12393            reply_authorization: json::one(object, &["replyAuthorization"]),
12394            announce_authorization: json::one(object, &["announceAuthorization"]),
12395            translations: json::many(object, &["translations"]),
12396            preferred_username: json::text(object, "preferredUsername"),
12397            public_keys: json::many_with(object, &["publicKey"], |value| {
12398                json::reference_with(value, CryptographicKey::from_json_untyped)
12399            }),
12400            assertion_methods: json::many(object, &["assertionMethod"]),
12401            gateways: json::many(object, &["gateways"]),
12402            manually_approves_followers: json::one(object, &["manuallyApprovesFollowers"]),
12403            inbox: json::one(object, &["inbox"]),
12404            outbox: json::one(object, &["outbox"]),
12405            following: json::one(object, &["following"]),
12406            followers: json::one(object, &["followers"]),
12407            liked: json::one(object, &["liked"]),
12408            featured: json::one(object, &["featured"]),
12409            featured_tags: json::one(object, &["featuredTags"]),
12410            featured_collections: json::one(
12411                object,
12412                &["https://w3id.org/fep/7aa9#featuredCollections"],
12413            ),
12414            streams: json::many(object, &["streams"]),
12415            endpoints: json::one(object, &["endpoints"]),
12416            discoverable: json::one(object, &["discoverable"]),
12417            suspended: json::one(object, &["suspended"]),
12418            memorial: json::one(object, &["memorial"]),
12419            indexable: json::one(object, &["indexable"]),
12420            successor: json::one(object, &["movedTo"]),
12421            aliases: json::many(object, &["alsoKnownAs"]),
12422            services: json::many(object, &["service"]),
12423            followed_message: json::one(object, &["_misskey_followedMessage"]),
12424            cat: json::one(object, &["isCat"]),
12425            webfinger: json::one(object, &["webfinger"]),
12426            shared_inbox: json::one(object, &["sharedInbox"]),
12427        })
12428    }
12429}
12430
12431impl ToJson for Organization {
12432    fn to_json(&self) -> Value {
12433        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
12434        json::put_many(&mut object, &["attachment"], &self.attachments);
12435        json::put_many(&mut object, &["attributedTo"], &self.attributions);
12436        json::put_many(&mut object, &["audience"], &self.audiences);
12437        json::put_text(&mut object, "content", &self.content);
12438        json::put_many(&mut object, &["context"], &self.contexts);
12439        json::put_text(&mut object, "name", &self.name);
12440        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
12441        json::put_many(&mut object, &["generator"], &self.generators);
12442        json::put_many(&mut object, &["icon"], &self.icons);
12443        json::put_many(&mut object, &["image"], &self.images);
12444        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
12445        json::put_many(&mut object, &["location"], &self.locations);
12446        json::put_many(&mut object, &["preview"], &self.previews);
12447        json::put_one(&mut object, &["published"], self.published.as_ref());
12448        json::put_one(&mut object, &["replies"], self.replies.as_ref());
12449        json::put_one(&mut object, &["shares"], self.shares.as_ref());
12450        json::put_one(&mut object, &["likes"], self.likes.as_ref());
12451        json::put_one(
12452            &mut object,
12453            &["emojiReactions"],
12454            self.emoji_reactions.as_ref(),
12455        );
12456        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
12457        json::put_text(&mut object, "summary", &self.summary);
12458        json::put_many(&mut object, &["tag"], &self.tags);
12459        json::put_one(&mut object, &["updated"], self.updated.as_ref());
12460        json::put_many(&mut object, &["url"], &self.urls);
12461        json::put_many(&mut object, &["to"], &self.tos);
12462        json::put_many(&mut object, &["bto"], &self.btos);
12463        json::put_many(&mut object, &["cc"], &self.ccs);
12464        json::put_many(&mut object, &["bcc"], &self.bccs);
12465        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
12466        json::put_one(&mut object, &["duration"], self.duration.as_ref());
12467        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
12468        json::put_one(&mut object, &["source"], self.source.as_ref());
12469        json::put_many(&mut object, &["proof"], &self.proofs);
12470        json::put_one(
12471            &mut object,
12472            &["interactionPolicy"],
12473            self.interaction_policy.as_ref(),
12474        );
12475        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
12476        json::put_one(
12477            &mut object,
12478            &["likeAuthorization"],
12479            self.like_authorization.as_ref(),
12480        );
12481        json::put_one(
12482            &mut object,
12483            &["replyAuthorization"],
12484            self.reply_authorization.as_ref(),
12485        );
12486        json::put_one(
12487            &mut object,
12488            &["announceAuthorization"],
12489            self.announce_authorization.as_ref(),
12490        );
12491        json::put_many(&mut object, &["translations"], &self.translations);
12492        json::put_text(&mut object, "preferredUsername", &self.preferred_username);
12493        json::put_many_with(
12494            &mut object,
12495            &["publicKey"],
12496            &self.public_keys,
12497            |reference| json::write_reference(reference, CryptographicKey::to_json_untyped),
12498        );
12499        json::put_many(&mut object, &["assertionMethod"], &self.assertion_methods);
12500        json::put_many(&mut object, &["gateways"], &self.gateways);
12501        json::put_one(
12502            &mut object,
12503            &["manuallyApprovesFollowers"],
12504            self.manually_approves_followers.as_ref(),
12505        );
12506        json::put_one(&mut object, &["inbox"], self.inbox.as_ref());
12507        json::put_one(&mut object, &["outbox"], self.outbox.as_ref());
12508        json::put_one(&mut object, &["following"], self.following.as_ref());
12509        json::put_one(&mut object, &["followers"], self.followers.as_ref());
12510        json::put_one(&mut object, &["liked"], self.liked.as_ref());
12511        json::put_one(&mut object, &["featured"], self.featured.as_ref());
12512        json::put_one(&mut object, &["featuredTags"], self.featured_tags.as_ref());
12513        json::put_one(
12514            &mut object,
12515            &["https://w3id.org/fep/7aa9#featuredCollections"],
12516            self.featured_collections.as_ref(),
12517        );
12518        json::put_many(&mut object, &["streams"], &self.streams);
12519        json::put_one(&mut object, &["endpoints"], self.endpoints.as_ref());
12520        json::put_one(&mut object, &["discoverable"], self.discoverable.as_ref());
12521        json::put_one(&mut object, &["suspended"], self.suspended.as_ref());
12522        json::put_one(&mut object, &["memorial"], self.memorial.as_ref());
12523        json::put_one(&mut object, &["indexable"], self.indexable.as_ref());
12524        json::put_one(&mut object, &["movedTo"], self.successor.as_ref());
12525        json::put_many(&mut object, &["alsoKnownAs"], &self.aliases);
12526        json::put_many(&mut object, &["service"], &self.services);
12527        json::put_one(
12528            &mut object,
12529            &["_misskey_followedMessage"],
12530            self.followed_message.as_ref(),
12531        );
12532        json::put_one(&mut object, &["isCat"], self.cat.as_ref());
12533        json::put_one(&mut object, &["webfinger"], self.webfinger.as_ref());
12534        json::put_one(&mut object, &["sharedInbox"], self.shared_inbox.as_ref());
12535        Value::Object(object)
12536    }
12537}
12538
12539/// Represents a Web Page.
12540///
12541/// The type `https://www.w3.org/ns/activitystreams#Page`.
12542#[derive(Clone, Debug, Default, PartialEq)]
12543pub struct Page {
12544    /// The IRI that identifies this object.
12545    pub id: Option<Iri>,
12546    /// See [`Object::attachments`].
12547    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
12548    /// See [`Object::attributions`].
12549    pub attributions: Vec<AnyActor>,
12550    /// See [`Object::audiences`].
12551    pub audiences: Vec<AnyObject>,
12552    /// See [`Object::content`].
12553    pub content: Text,
12554    /// See [`Object::contexts`].
12555    pub contexts: Vec<LinkOrObject>,
12556    /// See [`Object::name`].
12557    pub name: Text,
12558    /// See [`Object::end_time`].
12559    pub end_time: Option<String>,
12560    /// See [`Object::generators`].
12561    pub generators: Vec<LinkOrObject>,
12562    /// See [`Object::icons`].
12563    pub icons: Vec<Reference<Image>>,
12564    /// See [`Object::images`].
12565    pub images: Vec<Reference<Image>>,
12566    /// See [`Object::reply_targets`].
12567    pub reply_targets: Vec<LinkOrObject>,
12568    /// See [`Object::locations`].
12569    pub locations: Vec<LinkOrObject>,
12570    /// See [`Object::previews`].
12571    pub previews: Vec<LinkOrObject>,
12572    /// See [`Object::published`].
12573    pub published: Option<String>,
12574    /// See [`Object::replies`].
12575    pub replies: Option<AnyCollection>,
12576    /// See [`Object::shares`].
12577    pub shares: Option<AnyCollection>,
12578    /// See [`Object::likes`].
12579    pub likes: Option<AnyCollection>,
12580    /// See [`Object::emoji_reactions`].
12581    pub emoji_reactions: Option<AnyCollection>,
12582    /// See [`Object::start_time`].
12583    pub start_time: Option<String>,
12584    /// See [`Object::summary`].
12585    pub summary: Text,
12586    /// See [`Object::tags`].
12587    pub tags: Vec<LinkOrObject>,
12588    /// See [`Object::updated`].
12589    pub updated: Option<String>,
12590    /// See [`Object::urls`].
12591    pub urls: Vec<LinkOrIri>,
12592    /// See [`Object::tos`].
12593    pub tos: Vec<AnyObject>,
12594    /// See [`Object::btos`].
12595    pub btos: Vec<AnyObject>,
12596    /// See [`Object::ccs`].
12597    pub ccs: Vec<AnyObject>,
12598    /// See [`Object::bccs`].
12599    pub bccs: Vec<AnyObject>,
12600    /// See [`Object::media_type`].
12601    pub media_type: Option<String>,
12602    /// See [`Object::duration`].
12603    pub duration: Option<String>,
12604    /// See [`Object::sensitive`].
12605    pub sensitive: Option<bool>,
12606    /// See [`Object::source`].
12607    pub source: Option<Box<Source>>,
12608    /// See [`Object::proofs`].
12609    pub proofs: Vec<Reference<DataIntegrityProof>>,
12610    /// See [`Object::interaction_policy`].
12611    pub interaction_policy: Option<Box<InteractionPolicy>>,
12612    /// See [`Object::approved_by`].
12613    pub approved_by: Option<Iri>,
12614    /// See [`Object::like_authorization`].
12615    pub like_authorization: Option<Reference<LikeAuthorization>>,
12616    /// See [`Object::reply_authorization`].
12617    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
12618    /// See [`Object::announce_authorization`].
12619    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
12620    /// See [`Object::translations`].
12621    pub translations: Vec<Translation>,
12622    /// See [`Document::width`].
12623    pub width: Option<u64>,
12624    /// See [`Document::height`].
12625    pub height: Option<u64>,
12626    /// See [`Document::digest_multibase`].
12627    pub digest_multibase: Option<String>,
12628    /// See [`Document::blurhash`].
12629    pub blurhash: Option<String>,
12630    /// See [`Document::focal_point`].
12631    pub focal_point: Vec<f64>,
12632    /// Whether replies are accepted: PeerTube's term, which Lemmy sends as
12633    /// the opposite of a post being locked.
12634    pub comments_enabled: Option<bool>,
12635    /// Whether the post is pinned to the top of its community.
12636    pub stickied: Option<bool>,
12637}
12638
12639impl Page {
12640    /// The type's IRI.
12641    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Page";
12642    /// The type's `type` in a normalised document.
12643    pub const TYPE: &'static str = "Page";
12644}
12645
12646impl json::Typed for Page {
12647    const TYPE: &'static str = "Page";
12648}
12649
12650impl FromJson for Page {
12651    fn from_json(value: &Value) -> Result<Self, JsonError> {
12652        let object = json::object(value)?;
12653        json::expect_type(object, Self::TYPE)?;
12654        Ok(Self {
12655            id: json::id(object),
12656            attachments: json::many(object, &["attachment"]),
12657            attributions: json::many(object, &["attributedTo"]),
12658            audiences: json::many(object, &["audience"]),
12659            content: json::text(object, "content"),
12660            contexts: json::many(object, &["context"]),
12661            name: json::text(object, "name"),
12662            end_time: json::one(object, &["endTime"]),
12663            generators: json::many(object, &["generator"]),
12664            icons: json::many_mapped(object, &["icon"], json::link_to_image),
12665            images: json::many_mapped(object, &["image"], json::link_to_image),
12666            reply_targets: json::many(object, &["inReplyTo"]),
12667            locations: json::many(object, &["location"]),
12668            previews: json::many(object, &["preview"]),
12669            published: json::one(object, &["published"]),
12670            replies: json::one(object, &["replies"]),
12671            shares: json::one(object, &["shares"]),
12672            likes: json::one(object, &["likes"]),
12673            emoji_reactions: json::one(object, &["emojiReactions"]),
12674            start_time: json::one(object, &["startTime"]),
12675            summary: json::text(object, "summary"),
12676            tags: json::many(object, &["tag"]),
12677            updated: json::one(object, &["updated"]),
12678            urls: json::many(object, &["url"]),
12679            tos: json::many(object, &["to"]),
12680            btos: json::many(object, &["bto"]),
12681            ccs: json::many(object, &["cc"]),
12682            bccs: json::many(object, &["bcc"]),
12683            media_type: json::one(object, &["mediaType"]),
12684            duration: json::one(object, &["duration"]),
12685            sensitive: json::one(object, &["sensitive"]),
12686            source: json::one(object, &["source"]),
12687            proofs: json::many(object, &["proof"]),
12688            interaction_policy: json::one(object, &["interactionPolicy"]),
12689            approved_by: json::one(object, &["approvedBy"]),
12690            like_authorization: json::one(object, &["likeAuthorization"]),
12691            reply_authorization: json::one(object, &["replyAuthorization"]),
12692            announce_authorization: json::one(object, &["announceAuthorization"]),
12693            translations: json::many(object, &["translations"]),
12694            width: json::one(object, &["width"]),
12695            height: json::one(object, &["height"]),
12696            digest_multibase: json::one(object, &["digestMultibase"]),
12697            blurhash: json::one(object, &["blurhash"]),
12698            focal_point: json::many(object, &["focalPoint"]),
12699            comments_enabled: json::one(object, &["commentsEnabled"]),
12700            stickied: json::one(object, &["stickied"]),
12701        })
12702    }
12703}
12704
12705impl ToJson for Page {
12706    fn to_json(&self) -> Value {
12707        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
12708        json::put_many(&mut object, &["attachment"], &self.attachments);
12709        json::put_many(&mut object, &["attributedTo"], &self.attributions);
12710        json::put_many(&mut object, &["audience"], &self.audiences);
12711        json::put_text(&mut object, "content", &self.content);
12712        json::put_many(&mut object, &["context"], &self.contexts);
12713        json::put_text(&mut object, "name", &self.name);
12714        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
12715        json::put_many(&mut object, &["generator"], &self.generators);
12716        json::put_many(&mut object, &["icon"], &self.icons);
12717        json::put_many(&mut object, &["image"], &self.images);
12718        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
12719        json::put_many(&mut object, &["location"], &self.locations);
12720        json::put_many(&mut object, &["preview"], &self.previews);
12721        json::put_one(&mut object, &["published"], self.published.as_ref());
12722        json::put_one(&mut object, &["replies"], self.replies.as_ref());
12723        json::put_one(&mut object, &["shares"], self.shares.as_ref());
12724        json::put_one(&mut object, &["likes"], self.likes.as_ref());
12725        json::put_one(
12726            &mut object,
12727            &["emojiReactions"],
12728            self.emoji_reactions.as_ref(),
12729        );
12730        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
12731        json::put_text(&mut object, "summary", &self.summary);
12732        json::put_many(&mut object, &["tag"], &self.tags);
12733        json::put_one(&mut object, &["updated"], self.updated.as_ref());
12734        json::put_many(&mut object, &["url"], &self.urls);
12735        json::put_many(&mut object, &["to"], &self.tos);
12736        json::put_many(&mut object, &["bto"], &self.btos);
12737        json::put_many(&mut object, &["cc"], &self.ccs);
12738        json::put_many(&mut object, &["bcc"], &self.bccs);
12739        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
12740        json::put_one(&mut object, &["duration"], self.duration.as_ref());
12741        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
12742        json::put_one(&mut object, &["source"], self.source.as_ref());
12743        json::put_many(&mut object, &["proof"], &self.proofs);
12744        json::put_one(
12745            &mut object,
12746            &["interactionPolicy"],
12747            self.interaction_policy.as_ref(),
12748        );
12749        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
12750        json::put_one(
12751            &mut object,
12752            &["likeAuthorization"],
12753            self.like_authorization.as_ref(),
12754        );
12755        json::put_one(
12756            &mut object,
12757            &["replyAuthorization"],
12758            self.reply_authorization.as_ref(),
12759        );
12760        json::put_one(
12761            &mut object,
12762            &["announceAuthorization"],
12763            self.announce_authorization.as_ref(),
12764        );
12765        json::put_many(&mut object, &["translations"], &self.translations);
12766        json::put_one(&mut object, &["width"], self.width.as_ref());
12767        json::put_one(&mut object, &["height"], self.height.as_ref());
12768        json::put_one(
12769            &mut object,
12770            &["digestMultibase"],
12771            self.digest_multibase.as_ref(),
12772        );
12773        json::put_one(&mut object, &["blurhash"], self.blurhash.as_ref());
12774        json::put_many(&mut object, &["focalPoint"], &self.focal_point);
12775        json::put_one(
12776            &mut object,
12777            &["commentsEnabled"],
12778            self.comments_enabled.as_ref(),
12779        );
12780        json::put_one(&mut object, &["stickied"], self.stickied.as_ref());
12781        Value::Object(object)
12782    }
12783}
12784
12785/// Represents an individual person.
12786///
12787/// The type `https://www.w3.org/ns/activitystreams#Person`.
12788#[derive(Clone, Debug, Default, PartialEq)]
12789pub struct Person {
12790    /// The IRI that identifies this object.
12791    pub id: Option<Iri>,
12792    /// See [`Object::attachments`].
12793    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
12794    /// See [`Object::attributions`].
12795    pub attributions: Vec<AnyActor>,
12796    /// See [`Object::audiences`].
12797    pub audiences: Vec<AnyObject>,
12798    /// See [`Object::content`].
12799    pub content: Text,
12800    /// See [`Object::contexts`].
12801    pub contexts: Vec<LinkOrObject>,
12802    /// See [`Object::name`].
12803    pub name: Text,
12804    /// See [`Object::end_time`].
12805    pub end_time: Option<String>,
12806    /// See [`Object::generators`].
12807    pub generators: Vec<LinkOrObject>,
12808    /// See [`Object::icons`].
12809    pub icons: Vec<Reference<Image>>,
12810    /// See [`Object::images`].
12811    pub images: Vec<Reference<Image>>,
12812    /// See [`Object::reply_targets`].
12813    pub reply_targets: Vec<LinkOrObject>,
12814    /// See [`Object::locations`].
12815    pub locations: Vec<LinkOrObject>,
12816    /// See [`Object::previews`].
12817    pub previews: Vec<LinkOrObject>,
12818    /// See [`Object::published`].
12819    pub published: Option<String>,
12820    /// See [`Object::replies`].
12821    pub replies: Option<AnyCollection>,
12822    /// See [`Object::shares`].
12823    pub shares: Option<AnyCollection>,
12824    /// See [`Object::likes`].
12825    pub likes: Option<AnyCollection>,
12826    /// See [`Object::emoji_reactions`].
12827    pub emoji_reactions: Option<AnyCollection>,
12828    /// See [`Object::start_time`].
12829    pub start_time: Option<String>,
12830    /// See [`Object::summary`].
12831    pub summary: Text,
12832    /// See [`Object::tags`].
12833    pub tags: Vec<LinkOrObject>,
12834    /// See [`Object::updated`].
12835    pub updated: Option<String>,
12836    /// See [`Object::urls`].
12837    pub urls: Vec<LinkOrIri>,
12838    /// See [`Object::tos`].
12839    pub tos: Vec<AnyObject>,
12840    /// See [`Object::btos`].
12841    pub btos: Vec<AnyObject>,
12842    /// See [`Object::ccs`].
12843    pub ccs: Vec<AnyObject>,
12844    /// See [`Object::bccs`].
12845    pub bccs: Vec<AnyObject>,
12846    /// See [`Object::media_type`].
12847    pub media_type: Option<String>,
12848    /// See [`Object::duration`].
12849    pub duration: Option<String>,
12850    /// See [`Object::sensitive`].
12851    pub sensitive: Option<bool>,
12852    /// See [`Object::source`].
12853    pub source: Option<Box<Source>>,
12854    /// See [`Object::proofs`].
12855    pub proofs: Vec<Reference<DataIntegrityProof>>,
12856    /// See [`Object::interaction_policy`].
12857    pub interaction_policy: Option<Box<InteractionPolicy>>,
12858    /// See [`Object::approved_by`].
12859    pub approved_by: Option<Iri>,
12860    /// See [`Object::like_authorization`].
12861    pub like_authorization: Option<Reference<LikeAuthorization>>,
12862    /// See [`Object::reply_authorization`].
12863    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
12864    /// See [`Object::announce_authorization`].
12865    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
12866    /// See [`Object::translations`].
12867    pub translations: Vec<Translation>,
12868    /// A short username which may be used to refer to the actor,
12869    /// with no uniqueness guarantees.
12870    pub preferred_username: Text,
12871    /// A public part of the key pair owned by this actor.
12872    pub public_keys: Vec<Reference<CryptographicKey>>,
12873    /// Represents this actor's public keys.  It serves as equivalent to
12874    /// the `publicKeys` property, but is used for [FEP-521a](https://w3id.org/fep/521a) compliance.
12875    pub assertion_methods: Vec<Reference<Multikey>>,
12876    /// Gateways where the latest version of this portable actor object can be
12877    /// retrieved.
12878    pub gateways: Vec<Iri>,
12879    /// When `true`, conveys that for this actor, follow requests are not usually
12880    /// automatically approved, but instead are examined by a person who may accept
12881    /// or reject the request, at some time in the future.  Setting of `false`
12882    /// conveys no information and may be ignored.  This information is typically
12883    /// used to affect display of accounts, such as showing an account as private or
12884    /// locked.
12885    pub manually_approves_followers: Option<bool>,
12886    /// The inbox stream contains all activities received by the actor.  The server
12887    /// SHOULD filter content according to the requester's permission.  In general,
12888    /// the owner of an inbox is likely to be able to access all of their inbox
12889    /// contents.  Depending on access control, some other content may be public,
12890    /// whereas other content may require authentication for non-owner users,
12891    /// if they can access the inbox at all.
12892    pub inbox: Option<OrderedCollectionOrOrderedCollectionPage>,
12893    /// The outbox stream contains activities the user has published,
12894    /// subject to the ability of the requestor to retrieve the activity
12895    /// (that is, the contents of the outbox are filtered by the permissions of
12896    /// the person reading it).  If a user submits a request without
12897    /// [Authorization](https://www.w3.org/TR/activitypub/#authorization)
12898    /// the server should respond with all of the
12899    /// [Public](https://www.w3.org/TR/activitypub/#public-addressing) posts.
12900    /// This could potentially be all relevant objects published by the user,
12901    /// though the number of available items is left to the discretion of those
12902    /// implementing and deploying the server.
12903    pub outbox: Option<OrderedCollectionOrOrderedCollectionPage>,
12904    /// This is a list of everybody that the actor has followed, added as a
12905    /// [side effect](https://www.w3.org/TR/activitypub/#follow-activity-outbox).
12906    /// The `following` collection MUST be either an {@link OrderedCollection}
12907    /// or a {@link Collection} and MAY be filtered on privileges of
12908    /// an authenticated user or as appropriate when no authentication is given.
12909    pub following: Option<AnyCollection>,
12910    /// This is a list of everyone who has sent a {@link Follow} activity
12911    /// for the actor, added as a
12912    /// [side effect](https://www.w3.org/TR/activitypub/#follow-activity-outbox).
12913    /// This is where one would find a list of all the actors that are following
12914    /// the actor.  The `followers` collection MUST be either
12915    /// an {@link OrderedCollection} or a {@link Collection} and MAY be filtered on
12916    /// privileges of an authenticated user or as appropriate when no authentication
12917    /// is given.
12918    pub followers: Option<AnyCollection>,
12919    /// This is a list of every object from all of the actor's {@link Like}
12920    /// activities, added as a
12921    /// [side effect](https://www.w3.org/TR/activitypub/#like-activity-outbox).
12922    /// The `liked` collection MUST be either an {@link OrderedCollection} or
12923    /// a {@link Collection} and MAY be filtered on privileges of an authenticated
12924    /// user or as appropriate when no authentication is given.
12925    pub liked: Option<AnyCollection>,
12926    /// What is known in Mastodon as "pinned statuses", or statuses that are always
12927    /// featured at the top of people's profiles, is implemented using an extra
12928    /// property `featured` on the actor object that points to a {@link Collection}
12929    /// of objects.
12930    pub featured: Option<AnyCollection>,
12931    /// What is known in Mastodon as "featured hashtags", hashtags that are featured
12932    /// at people's profiles, is implemented using an extra property `featuredTags`
12933    /// on the actor object that points to a {@link Collection} of {@link Hashtag}
12934    /// objects specifically.
12935    pub featured_tags: Option<AnyCollection>,
12936    /// A collection of {@link FeaturedCollection}s created by this actor.
12937    pub featured_collections: Option<AnyCollection>,
12938    /// A list of supplementary Collections which may be of interest.
12939    pub streams: Vec<AnyCollection>,
12940    /// A JSON object which maps additional (typically server/domain-wide) endpoints
12941    /// which may be useful either for this actor or someone referencing this actor.
12942    /// This mapping may be nested inside the actor document as the value or may be
12943    /// a link to a JSON-LD document with these properties.
12944    pub endpoints: Option<Box<Endpoints>>,
12945    /// Allows users to opt-in or opt-out of discoverability features like
12946    /// the profile directory.  This flag may also be used as an indicator of
12947    /// the user's preferences toward being included in external discovery services,
12948    /// such as search engines or other indexing tools.
12949    pub discoverable: Option<bool>,
12950    /// Reports whether a user was locally suspended, for better handling of
12951    /// these accounts.
12952    pub suspended: Option<bool>,
12953    /// Whether the actor is in-memorial state.
12954    pub memorial: Option<bool>,
12955    /// Whether the actor allows to be indexed.
12956    pub indexable: Option<bool>,
12957    /// Signifies that an actor has been moved to a different ID. Used in Mastodon-style data portability with the {@link Move} activity; see [ActivityPub Data Portability/Move Action](https://swicg.github.io/activitypub-data-portability/#move-action) for more details.
12958    pub successor: Option<AnyActor>,
12959    /// The `aliases` (`alsoKnownAs`) property is used to specify alternative names
12960    /// or aliases for an entity.  It can be used to provide additional identifiers
12961    /// or labels for an entity, which can be useful in scenarios where an entity
12962    /// may have multiple names or aliases.
12963    pub aliases: Vec<AnyActor>,
12964    /// Means of communicating or interacting with the DID subject or associated
12965    /// entities via one or more service endpoints. Examples include discovery
12966    /// services, agent services, social networking services, file storage services,
12967    /// and verifiable credential repository services.
12968    pub services: Vec<AnyDidService>,
12969    /// This value is used for `Actor` type objects to show message on followed.
12970    pub followed_message: Option<String>,
12971    /// Used on actors to indicate that they in some way identify as a cat,
12972    /// expressed as a boolean value. If this property is set to `true`,
12973    /// displaying the actor or their notes will have some special effects
12974    /// attached in some clients.
12975    pub cat: Option<bool>,
12976    /// The actor's WebFinger handle, `user@host` (FEP-2c59).
12977    pub webfinger: Option<String>,
12978    /// The person's Matrix user ID.
12979    pub matrix_user_id: Option<String>,
12980    /// The shared inbox, where Misskey writes it: on the actor rather than in
12981    /// its `endpoints`. Prefer `endpoints.sharedInbox` when both are there.
12982    pub shared_inbox: Option<Iri>,
12983}
12984
12985impl Person {
12986    /// The type's IRI.
12987    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Person";
12988    /// The type's `type` in a normalised document.
12989    pub const TYPE: &'static str = "Person";
12990}
12991
12992impl json::Typed for Person {
12993    const TYPE: &'static str = "Person";
12994}
12995
12996impl FromJson for Person {
12997    fn from_json(value: &Value) -> Result<Self, JsonError> {
12998        let object = json::object(value)?;
12999        json::expect_type(object, Self::TYPE)?;
13000        Ok(Self {
13001            id: json::id(object),
13002            attachments: json::many(object, &["attachment"]),
13003            attributions: json::many(object, &["attributedTo"]),
13004            audiences: json::many(object, &["audience"]),
13005            content: json::text(object, "content"),
13006            contexts: json::many(object, &["context"]),
13007            name: json::text(object, "name"),
13008            end_time: json::one(object, &["endTime"]),
13009            generators: json::many(object, &["generator"]),
13010            icons: json::many_mapped(object, &["icon"], json::link_to_image),
13011            images: json::many_mapped(object, &["image"], json::link_to_image),
13012            reply_targets: json::many(object, &["inReplyTo"]),
13013            locations: json::many(object, &["location"]),
13014            previews: json::many(object, &["preview"]),
13015            published: json::one(object, &["published"]),
13016            replies: json::one(object, &["replies"]),
13017            shares: json::one(object, &["shares"]),
13018            likes: json::one(object, &["likes"]),
13019            emoji_reactions: json::one(object, &["emojiReactions"]),
13020            start_time: json::one(object, &["startTime"]),
13021            summary: json::text(object, "summary"),
13022            tags: json::many(object, &["tag"]),
13023            updated: json::one(object, &["updated"]),
13024            urls: json::many(object, &["url"]),
13025            tos: json::many(object, &["to"]),
13026            btos: json::many(object, &["bto"]),
13027            ccs: json::many(object, &["cc"]),
13028            bccs: json::many(object, &["bcc"]),
13029            media_type: json::one(object, &["mediaType"]),
13030            duration: json::one(object, &["duration"]),
13031            sensitive: json::one(object, &["sensitive"]),
13032            source: json::one(object, &["source"]),
13033            proofs: json::many(object, &["proof"]),
13034            interaction_policy: json::one(object, &["interactionPolicy"]),
13035            approved_by: json::one(object, &["approvedBy"]),
13036            like_authorization: json::one(object, &["likeAuthorization"]),
13037            reply_authorization: json::one(object, &["replyAuthorization"]),
13038            announce_authorization: json::one(object, &["announceAuthorization"]),
13039            translations: json::many(object, &["translations"]),
13040            preferred_username: json::text(object, "preferredUsername"),
13041            public_keys: json::many_with(object, &["publicKey"], |value| {
13042                json::reference_with(value, CryptographicKey::from_json_untyped)
13043            }),
13044            assertion_methods: json::many(object, &["assertionMethod"]),
13045            gateways: json::many(object, &["gateways"]),
13046            manually_approves_followers: json::one(object, &["manuallyApprovesFollowers"]),
13047            inbox: json::one(object, &["inbox"]),
13048            outbox: json::one(object, &["outbox"]),
13049            following: json::one(object, &["following"]),
13050            followers: json::one(object, &["followers"]),
13051            liked: json::one(object, &["liked"]),
13052            featured: json::one(object, &["featured"]),
13053            featured_tags: json::one(object, &["featuredTags"]),
13054            featured_collections: json::one(
13055                object,
13056                &["https://w3id.org/fep/7aa9#featuredCollections"],
13057            ),
13058            streams: json::many(object, &["streams"]),
13059            endpoints: json::one(object, &["endpoints"]),
13060            discoverable: json::one(object, &["discoverable"]),
13061            suspended: json::one(object, &["suspended"]),
13062            memorial: json::one(object, &["memorial"]),
13063            indexable: json::one(object, &["indexable"]),
13064            successor: json::one(object, &["movedTo"]),
13065            aliases: json::many(object, &["alsoKnownAs"]),
13066            services: json::many(object, &["service"]),
13067            followed_message: json::one(object, &["_misskey_followedMessage"]),
13068            cat: json::one(object, &["isCat"]),
13069            webfinger: json::one(object, &["webfinger"]),
13070            matrix_user_id: json::one(object, &["matrixUserId"]),
13071            shared_inbox: json::one(object, &["sharedInbox"]),
13072        })
13073    }
13074}
13075
13076impl ToJson for Person {
13077    fn to_json(&self) -> Value {
13078        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
13079        json::put_many(&mut object, &["attachment"], &self.attachments);
13080        json::put_many(&mut object, &["attributedTo"], &self.attributions);
13081        json::put_many(&mut object, &["audience"], &self.audiences);
13082        json::put_text(&mut object, "content", &self.content);
13083        json::put_many(&mut object, &["context"], &self.contexts);
13084        json::put_text(&mut object, "name", &self.name);
13085        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
13086        json::put_many(&mut object, &["generator"], &self.generators);
13087        json::put_many(&mut object, &["icon"], &self.icons);
13088        json::put_many(&mut object, &["image"], &self.images);
13089        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
13090        json::put_many(&mut object, &["location"], &self.locations);
13091        json::put_many(&mut object, &["preview"], &self.previews);
13092        json::put_one(&mut object, &["published"], self.published.as_ref());
13093        json::put_one(&mut object, &["replies"], self.replies.as_ref());
13094        json::put_one(&mut object, &["shares"], self.shares.as_ref());
13095        json::put_one(&mut object, &["likes"], self.likes.as_ref());
13096        json::put_one(
13097            &mut object,
13098            &["emojiReactions"],
13099            self.emoji_reactions.as_ref(),
13100        );
13101        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
13102        json::put_text(&mut object, "summary", &self.summary);
13103        json::put_many(&mut object, &["tag"], &self.tags);
13104        json::put_one(&mut object, &["updated"], self.updated.as_ref());
13105        json::put_many(&mut object, &["url"], &self.urls);
13106        json::put_many(&mut object, &["to"], &self.tos);
13107        json::put_many(&mut object, &["bto"], &self.btos);
13108        json::put_many(&mut object, &["cc"], &self.ccs);
13109        json::put_many(&mut object, &["bcc"], &self.bccs);
13110        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
13111        json::put_one(&mut object, &["duration"], self.duration.as_ref());
13112        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
13113        json::put_one(&mut object, &["source"], self.source.as_ref());
13114        json::put_many(&mut object, &["proof"], &self.proofs);
13115        json::put_one(
13116            &mut object,
13117            &["interactionPolicy"],
13118            self.interaction_policy.as_ref(),
13119        );
13120        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
13121        json::put_one(
13122            &mut object,
13123            &["likeAuthorization"],
13124            self.like_authorization.as_ref(),
13125        );
13126        json::put_one(
13127            &mut object,
13128            &["replyAuthorization"],
13129            self.reply_authorization.as_ref(),
13130        );
13131        json::put_one(
13132            &mut object,
13133            &["announceAuthorization"],
13134            self.announce_authorization.as_ref(),
13135        );
13136        json::put_many(&mut object, &["translations"], &self.translations);
13137        json::put_text(&mut object, "preferredUsername", &self.preferred_username);
13138        json::put_many_with(
13139            &mut object,
13140            &["publicKey"],
13141            &self.public_keys,
13142            |reference| json::write_reference(reference, CryptographicKey::to_json_untyped),
13143        );
13144        json::put_many(&mut object, &["assertionMethod"], &self.assertion_methods);
13145        json::put_many(&mut object, &["gateways"], &self.gateways);
13146        json::put_one(
13147            &mut object,
13148            &["manuallyApprovesFollowers"],
13149            self.manually_approves_followers.as_ref(),
13150        );
13151        json::put_one(&mut object, &["inbox"], self.inbox.as_ref());
13152        json::put_one(&mut object, &["outbox"], self.outbox.as_ref());
13153        json::put_one(&mut object, &["following"], self.following.as_ref());
13154        json::put_one(&mut object, &["followers"], self.followers.as_ref());
13155        json::put_one(&mut object, &["liked"], self.liked.as_ref());
13156        json::put_one(&mut object, &["featured"], self.featured.as_ref());
13157        json::put_one(&mut object, &["featuredTags"], self.featured_tags.as_ref());
13158        json::put_one(
13159            &mut object,
13160            &["https://w3id.org/fep/7aa9#featuredCollections"],
13161            self.featured_collections.as_ref(),
13162        );
13163        json::put_many(&mut object, &["streams"], &self.streams);
13164        json::put_one(&mut object, &["endpoints"], self.endpoints.as_ref());
13165        json::put_one(&mut object, &["discoverable"], self.discoverable.as_ref());
13166        json::put_one(&mut object, &["suspended"], self.suspended.as_ref());
13167        json::put_one(&mut object, &["memorial"], self.memorial.as_ref());
13168        json::put_one(&mut object, &["indexable"], self.indexable.as_ref());
13169        json::put_one(&mut object, &["movedTo"], self.successor.as_ref());
13170        json::put_many(&mut object, &["alsoKnownAs"], &self.aliases);
13171        json::put_many(&mut object, &["service"], &self.services);
13172        json::put_one(
13173            &mut object,
13174            &["_misskey_followedMessage"],
13175            self.followed_message.as_ref(),
13176        );
13177        json::put_one(&mut object, &["isCat"], self.cat.as_ref());
13178        json::put_one(&mut object, &["webfinger"], self.webfinger.as_ref());
13179        json::put_one(&mut object, &["matrixUserId"], self.matrix_user_id.as_ref());
13180        json::put_one(&mut object, &["sharedInbox"], self.shared_inbox.as_ref());
13181        Value::Object(object)
13182    }
13183}
13184
13185/// Represents a logical or physical location.  See [5.3 Representing
13186/// Places](https://www.w3.org/TR/activitystreams-vocabulary/#places)
13187/// for additional information.
13188///
13189/// The type `https://www.w3.org/ns/activitystreams#Place`.
13190#[derive(Clone, Debug, Default, PartialEq)]
13191pub struct Place {
13192    /// The IRI that identifies this object.
13193    pub id: Option<Iri>,
13194    /// See [`Object::attachments`].
13195    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
13196    /// See [`Object::attributions`].
13197    pub attributions: Vec<AnyActor>,
13198    /// See [`Object::audiences`].
13199    pub audiences: Vec<AnyObject>,
13200    /// See [`Object::content`].
13201    pub content: Text,
13202    /// See [`Object::contexts`].
13203    pub contexts: Vec<LinkOrObject>,
13204    /// See [`Object::name`].
13205    pub name: Text,
13206    /// See [`Object::end_time`].
13207    pub end_time: Option<String>,
13208    /// See [`Object::generators`].
13209    pub generators: Vec<LinkOrObject>,
13210    /// See [`Object::icons`].
13211    pub icons: Vec<Reference<Image>>,
13212    /// See [`Object::images`].
13213    pub images: Vec<Reference<Image>>,
13214    /// See [`Object::reply_targets`].
13215    pub reply_targets: Vec<LinkOrObject>,
13216    /// See [`Object::locations`].
13217    pub locations: Vec<LinkOrObject>,
13218    /// See [`Object::previews`].
13219    pub previews: Vec<LinkOrObject>,
13220    /// See [`Object::published`].
13221    pub published: Option<String>,
13222    /// See [`Object::replies`].
13223    pub replies: Option<AnyCollection>,
13224    /// See [`Object::shares`].
13225    pub shares: Option<AnyCollection>,
13226    /// See [`Object::likes`].
13227    pub likes: Option<AnyCollection>,
13228    /// See [`Object::emoji_reactions`].
13229    pub emoji_reactions: Option<AnyCollection>,
13230    /// See [`Object::start_time`].
13231    pub start_time: Option<String>,
13232    /// See [`Object::summary`].
13233    pub summary: Text,
13234    /// See [`Object::tags`].
13235    pub tags: Vec<LinkOrObject>,
13236    /// See [`Object::updated`].
13237    pub updated: Option<String>,
13238    /// See [`Object::urls`].
13239    pub urls: Vec<LinkOrIri>,
13240    /// See [`Object::tos`].
13241    pub tos: Vec<AnyObject>,
13242    /// See [`Object::btos`].
13243    pub btos: Vec<AnyObject>,
13244    /// See [`Object::ccs`].
13245    pub ccs: Vec<AnyObject>,
13246    /// See [`Object::bccs`].
13247    pub bccs: Vec<AnyObject>,
13248    /// See [`Object::media_type`].
13249    pub media_type: Option<String>,
13250    /// See [`Object::duration`].
13251    pub duration: Option<String>,
13252    /// See [`Object::sensitive`].
13253    pub sensitive: Option<bool>,
13254    /// See [`Object::source`].
13255    pub source: Option<Box<Source>>,
13256    /// See [`Object::proofs`].
13257    pub proofs: Vec<Reference<DataIntegrityProof>>,
13258    /// See [`Object::interaction_policy`].
13259    pub interaction_policy: Option<Box<InteractionPolicy>>,
13260    /// See [`Object::approved_by`].
13261    pub approved_by: Option<Iri>,
13262    /// See [`Object::like_authorization`].
13263    pub like_authorization: Option<Reference<LikeAuthorization>>,
13264    /// See [`Object::reply_authorization`].
13265    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
13266    /// See [`Object::announce_authorization`].
13267    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
13268    /// See [`Object::translations`].
13269    pub translations: Vec<Translation>,
13270    /// Indicates the accuracy of position coordinates on a {@link Place} objects.
13271    /// Expressed in properties of percentage. e.g. "94.0" means "94.0% accurate".
13272    pub accuracy: Option<f64>,
13273    /// Indicates the altitude of a place.  The measurement units is indicated
13274    /// using the {@link Place.units} property.  If {@link Place.units} is not
13275    /// specified, the default is assumed to be "`m`" indicating meters.
13276    pub altitude: Option<f64>,
13277    /// The latitude of a place.
13278    pub latitude: Option<f64>,
13279    /// The longitude of a place.
13280    pub longitude: Option<f64>,
13281    /// The radius from the given latitude and longitude for a {@link Place}.
13282    /// The units is expressed by the {@link Place.units} property.
13283    /// If {@link Place.units} is not specified, the default is assumed to be
13284    /// "`m`" indicating "meters".
13285    pub radius: Option<f64>,
13286    /// Specifies the measurement units for the {@link Place.radius} and
13287    /// {@link Place.altitude} properties on a {@link Place} object.
13288    /// If not specified, the default is assumed to be "`m`" for "meters".
13289    pub units: Option<IriOrUnits>,
13290}
13291
13292impl Place {
13293    /// The type's IRI.
13294    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Place";
13295    /// The type's `type` in a normalised document.
13296    pub const TYPE: &'static str = "Place";
13297}
13298
13299impl json::Typed for Place {
13300    const TYPE: &'static str = "Place";
13301}
13302
13303impl FromJson for Place {
13304    fn from_json(value: &Value) -> Result<Self, JsonError> {
13305        let object = json::object(value)?;
13306        json::expect_type(object, Self::TYPE)?;
13307        Ok(Self {
13308            id: json::id(object),
13309            attachments: json::many(object, &["attachment"]),
13310            attributions: json::many(object, &["attributedTo"]),
13311            audiences: json::many(object, &["audience"]),
13312            content: json::text(object, "content"),
13313            contexts: json::many(object, &["context"]),
13314            name: json::text(object, "name"),
13315            end_time: json::one(object, &["endTime"]),
13316            generators: json::many(object, &["generator"]),
13317            icons: json::many_mapped(object, &["icon"], json::link_to_image),
13318            images: json::many_mapped(object, &["image"], json::link_to_image),
13319            reply_targets: json::many(object, &["inReplyTo"]),
13320            locations: json::many(object, &["location"]),
13321            previews: json::many(object, &["preview"]),
13322            published: json::one(object, &["published"]),
13323            replies: json::one(object, &["replies"]),
13324            shares: json::one(object, &["shares"]),
13325            likes: json::one(object, &["likes"]),
13326            emoji_reactions: json::one(object, &["emojiReactions"]),
13327            start_time: json::one(object, &["startTime"]),
13328            summary: json::text(object, "summary"),
13329            tags: json::many(object, &["tag"]),
13330            updated: json::one(object, &["updated"]),
13331            urls: json::many(object, &["url"]),
13332            tos: json::many(object, &["to"]),
13333            btos: json::many(object, &["bto"]),
13334            ccs: json::many(object, &["cc"]),
13335            bccs: json::many(object, &["bcc"]),
13336            media_type: json::one(object, &["mediaType"]),
13337            duration: json::one(object, &["duration"]),
13338            sensitive: json::one(object, &["sensitive"]),
13339            source: json::one(object, &["source"]),
13340            proofs: json::many(object, &["proof"]),
13341            interaction_policy: json::one(object, &["interactionPolicy"]),
13342            approved_by: json::one(object, &["approvedBy"]),
13343            like_authorization: json::one(object, &["likeAuthorization"]),
13344            reply_authorization: json::one(object, &["replyAuthorization"]),
13345            announce_authorization: json::one(object, &["announceAuthorization"]),
13346            translations: json::many(object, &["translations"]),
13347            accuracy: json::one(object, &["accuracy"]),
13348            altitude: json::one(object, &["altitude"]),
13349            latitude: json::one(object, &["latitude"]),
13350            longitude: json::one(object, &["longitude"]),
13351            radius: json::one(object, &["radius"]),
13352            units: json::one(object, &["units"]),
13353        })
13354    }
13355}
13356
13357impl ToJson for Place {
13358    fn to_json(&self) -> Value {
13359        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
13360        json::put_many(&mut object, &["attachment"], &self.attachments);
13361        json::put_many(&mut object, &["attributedTo"], &self.attributions);
13362        json::put_many(&mut object, &["audience"], &self.audiences);
13363        json::put_text(&mut object, "content", &self.content);
13364        json::put_many(&mut object, &["context"], &self.contexts);
13365        json::put_text(&mut object, "name", &self.name);
13366        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
13367        json::put_many(&mut object, &["generator"], &self.generators);
13368        json::put_many(&mut object, &["icon"], &self.icons);
13369        json::put_many(&mut object, &["image"], &self.images);
13370        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
13371        json::put_many(&mut object, &["location"], &self.locations);
13372        json::put_many(&mut object, &["preview"], &self.previews);
13373        json::put_one(&mut object, &["published"], self.published.as_ref());
13374        json::put_one(&mut object, &["replies"], self.replies.as_ref());
13375        json::put_one(&mut object, &["shares"], self.shares.as_ref());
13376        json::put_one(&mut object, &["likes"], self.likes.as_ref());
13377        json::put_one(
13378            &mut object,
13379            &["emojiReactions"],
13380            self.emoji_reactions.as_ref(),
13381        );
13382        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
13383        json::put_text(&mut object, "summary", &self.summary);
13384        json::put_many(&mut object, &["tag"], &self.tags);
13385        json::put_one(&mut object, &["updated"], self.updated.as_ref());
13386        json::put_many(&mut object, &["url"], &self.urls);
13387        json::put_many(&mut object, &["to"], &self.tos);
13388        json::put_many(&mut object, &["bto"], &self.btos);
13389        json::put_many(&mut object, &["cc"], &self.ccs);
13390        json::put_many(&mut object, &["bcc"], &self.bccs);
13391        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
13392        json::put_one(&mut object, &["duration"], self.duration.as_ref());
13393        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
13394        json::put_one(&mut object, &["source"], self.source.as_ref());
13395        json::put_many(&mut object, &["proof"], &self.proofs);
13396        json::put_one(
13397            &mut object,
13398            &["interactionPolicy"],
13399            self.interaction_policy.as_ref(),
13400        );
13401        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
13402        json::put_one(
13403            &mut object,
13404            &["likeAuthorization"],
13405            self.like_authorization.as_ref(),
13406        );
13407        json::put_one(
13408            &mut object,
13409            &["replyAuthorization"],
13410            self.reply_authorization.as_ref(),
13411        );
13412        json::put_one(
13413            &mut object,
13414            &["announceAuthorization"],
13415            self.announce_authorization.as_ref(),
13416        );
13417        json::put_many(&mut object, &["translations"], &self.translations);
13418        json::put_one(&mut object, &["accuracy"], self.accuracy.as_ref());
13419        json::put_one(&mut object, &["altitude"], self.altitude.as_ref());
13420        json::put_one(&mut object, &["latitude"], self.latitude.as_ref());
13421        json::put_one(&mut object, &["longitude"], self.longitude.as_ref());
13422        json::put_one(&mut object, &["radius"], self.radius.as_ref());
13423        json::put_one(&mut object, &["units"], self.units.as_ref());
13424        Value::Object(object)
13425    }
13426}
13427
13428/// A {@link Profile} is a content object that describes another {@link Object},
13429/// typically used to describe [Actor
13430/// Type](https://www.w3.org/TR/activitystreams-vocabulary/#actor-types) objects.
13431/// The {@link Profile.describes} property is used to reference the object being
13432/// described by the profile.
13433///
13434/// The type `https://www.w3.org/ns/activitystreams#Profile`.
13435#[derive(Clone, Debug, Default, PartialEq)]
13436pub struct Profile {
13437    /// The IRI that identifies this object.
13438    pub id: Option<Iri>,
13439    /// See [`Object::attachments`].
13440    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
13441    /// See [`Object::attributions`].
13442    pub attributions: Vec<AnyActor>,
13443    /// See [`Object::audiences`].
13444    pub audiences: Vec<AnyObject>,
13445    /// See [`Object::content`].
13446    pub content: Text,
13447    /// See [`Object::contexts`].
13448    pub contexts: Vec<LinkOrObject>,
13449    /// See [`Object::name`].
13450    pub name: Text,
13451    /// See [`Object::end_time`].
13452    pub end_time: Option<String>,
13453    /// See [`Object::generators`].
13454    pub generators: Vec<LinkOrObject>,
13455    /// See [`Object::icons`].
13456    pub icons: Vec<Reference<Image>>,
13457    /// See [`Object::images`].
13458    pub images: Vec<Reference<Image>>,
13459    /// See [`Object::reply_targets`].
13460    pub reply_targets: Vec<LinkOrObject>,
13461    /// See [`Object::locations`].
13462    pub locations: Vec<LinkOrObject>,
13463    /// See [`Object::previews`].
13464    pub previews: Vec<LinkOrObject>,
13465    /// See [`Object::published`].
13466    pub published: Option<String>,
13467    /// See [`Object::replies`].
13468    pub replies: Option<AnyCollection>,
13469    /// See [`Object::shares`].
13470    pub shares: Option<AnyCollection>,
13471    /// See [`Object::likes`].
13472    pub likes: Option<AnyCollection>,
13473    /// See [`Object::emoji_reactions`].
13474    pub emoji_reactions: Option<AnyCollection>,
13475    /// See [`Object::start_time`].
13476    pub start_time: Option<String>,
13477    /// See [`Object::summary`].
13478    pub summary: Text,
13479    /// See [`Object::tags`].
13480    pub tags: Vec<LinkOrObject>,
13481    /// See [`Object::updated`].
13482    pub updated: Option<String>,
13483    /// See [`Object::urls`].
13484    pub urls: Vec<LinkOrIri>,
13485    /// See [`Object::tos`].
13486    pub tos: Vec<AnyObject>,
13487    /// See [`Object::btos`].
13488    pub btos: Vec<AnyObject>,
13489    /// See [`Object::ccs`].
13490    pub ccs: Vec<AnyObject>,
13491    /// See [`Object::bccs`].
13492    pub bccs: Vec<AnyObject>,
13493    /// See [`Object::media_type`].
13494    pub media_type: Option<String>,
13495    /// See [`Object::duration`].
13496    pub duration: Option<String>,
13497    /// See [`Object::sensitive`].
13498    pub sensitive: Option<bool>,
13499    /// See [`Object::source`].
13500    pub source: Option<Box<Source>>,
13501    /// See [`Object::proofs`].
13502    pub proofs: Vec<Reference<DataIntegrityProof>>,
13503    /// See [`Object::interaction_policy`].
13504    pub interaction_policy: Option<Box<InteractionPolicy>>,
13505    /// See [`Object::approved_by`].
13506    pub approved_by: Option<Iri>,
13507    /// See [`Object::like_authorization`].
13508    pub like_authorization: Option<Reference<LikeAuthorization>>,
13509    /// See [`Object::reply_authorization`].
13510    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
13511    /// See [`Object::announce_authorization`].
13512    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
13513    /// See [`Object::translations`].
13514    pub translations: Vec<Translation>,
13515    /// On a {@link Profile} object, the {@link Profile.describes} property
13516    /// identifies the object described by the {@link Profile}.
13517    pub describes: Option<AnyObject>,
13518}
13519
13520impl Profile {
13521    /// The type's IRI.
13522    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Profile";
13523    /// The type's `type` in a normalised document.
13524    pub const TYPE: &'static str = "Profile";
13525}
13526
13527impl json::Typed for Profile {
13528    const TYPE: &'static str = "Profile";
13529}
13530
13531impl FromJson for Profile {
13532    fn from_json(value: &Value) -> Result<Self, JsonError> {
13533        let object = json::object(value)?;
13534        json::expect_type(object, Self::TYPE)?;
13535        Ok(Self {
13536            id: json::id(object),
13537            attachments: json::many(object, &["attachment"]),
13538            attributions: json::many(object, &["attributedTo"]),
13539            audiences: json::many(object, &["audience"]),
13540            content: json::text(object, "content"),
13541            contexts: json::many(object, &["context"]),
13542            name: json::text(object, "name"),
13543            end_time: json::one(object, &["endTime"]),
13544            generators: json::many(object, &["generator"]),
13545            icons: json::many_mapped(object, &["icon"], json::link_to_image),
13546            images: json::many_mapped(object, &["image"], json::link_to_image),
13547            reply_targets: json::many(object, &["inReplyTo"]),
13548            locations: json::many(object, &["location"]),
13549            previews: json::many(object, &["preview"]),
13550            published: json::one(object, &["published"]),
13551            replies: json::one(object, &["replies"]),
13552            shares: json::one(object, &["shares"]),
13553            likes: json::one(object, &["likes"]),
13554            emoji_reactions: json::one(object, &["emojiReactions"]),
13555            start_time: json::one(object, &["startTime"]),
13556            summary: json::text(object, "summary"),
13557            tags: json::many(object, &["tag"]),
13558            updated: json::one(object, &["updated"]),
13559            urls: json::many(object, &["url"]),
13560            tos: json::many(object, &["to"]),
13561            btos: json::many(object, &["bto"]),
13562            ccs: json::many(object, &["cc"]),
13563            bccs: json::many(object, &["bcc"]),
13564            media_type: json::one(object, &["mediaType"]),
13565            duration: json::one(object, &["duration"]),
13566            sensitive: json::one(object, &["sensitive"]),
13567            source: json::one(object, &["source"]),
13568            proofs: json::many(object, &["proof"]),
13569            interaction_policy: json::one(object, &["interactionPolicy"]),
13570            approved_by: json::one(object, &["approvedBy"]),
13571            like_authorization: json::one(object, &["likeAuthorization"]),
13572            reply_authorization: json::one(object, &["replyAuthorization"]),
13573            announce_authorization: json::one(object, &["announceAuthorization"]),
13574            translations: json::many(object, &["translations"]),
13575            describes: json::one(object, &["describes"]),
13576        })
13577    }
13578}
13579
13580impl ToJson for Profile {
13581    fn to_json(&self) -> Value {
13582        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
13583        json::put_many(&mut object, &["attachment"], &self.attachments);
13584        json::put_many(&mut object, &["attributedTo"], &self.attributions);
13585        json::put_many(&mut object, &["audience"], &self.audiences);
13586        json::put_text(&mut object, "content", &self.content);
13587        json::put_many(&mut object, &["context"], &self.contexts);
13588        json::put_text(&mut object, "name", &self.name);
13589        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
13590        json::put_many(&mut object, &["generator"], &self.generators);
13591        json::put_many(&mut object, &["icon"], &self.icons);
13592        json::put_many(&mut object, &["image"], &self.images);
13593        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
13594        json::put_many(&mut object, &["location"], &self.locations);
13595        json::put_many(&mut object, &["preview"], &self.previews);
13596        json::put_one(&mut object, &["published"], self.published.as_ref());
13597        json::put_one(&mut object, &["replies"], self.replies.as_ref());
13598        json::put_one(&mut object, &["shares"], self.shares.as_ref());
13599        json::put_one(&mut object, &["likes"], self.likes.as_ref());
13600        json::put_one(
13601            &mut object,
13602            &["emojiReactions"],
13603            self.emoji_reactions.as_ref(),
13604        );
13605        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
13606        json::put_text(&mut object, "summary", &self.summary);
13607        json::put_many(&mut object, &["tag"], &self.tags);
13608        json::put_one(&mut object, &["updated"], self.updated.as_ref());
13609        json::put_many(&mut object, &["url"], &self.urls);
13610        json::put_many(&mut object, &["to"], &self.tos);
13611        json::put_many(&mut object, &["bto"], &self.btos);
13612        json::put_many(&mut object, &["cc"], &self.ccs);
13613        json::put_many(&mut object, &["bcc"], &self.bccs);
13614        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
13615        json::put_one(&mut object, &["duration"], self.duration.as_ref());
13616        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
13617        json::put_one(&mut object, &["source"], self.source.as_ref());
13618        json::put_many(&mut object, &["proof"], &self.proofs);
13619        json::put_one(
13620            &mut object,
13621            &["interactionPolicy"],
13622            self.interaction_policy.as_ref(),
13623        );
13624        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
13625        json::put_one(
13626            &mut object,
13627            &["likeAuthorization"],
13628            self.like_authorization.as_ref(),
13629        );
13630        json::put_one(
13631            &mut object,
13632            &["replyAuthorization"],
13633            self.reply_authorization.as_ref(),
13634        );
13635        json::put_one(
13636            &mut object,
13637            &["announceAuthorization"],
13638            self.announce_authorization.as_ref(),
13639        );
13640        json::put_many(&mut object, &["translations"], &self.translations);
13641        json::put_one(&mut object, &["describes"], self.describes.as_ref());
13642        Value::Object(object)
13643    }
13644}
13645
13646/// A pair of property name and value.
13647///
13648/// The type `http://schema.org#PropertyValue`.
13649#[derive(Clone, Debug, Default, PartialEq)]
13650pub struct PropertyValue {
13651    /// The name of a property.
13652    pub name: Text,
13653    /// The value of a property.
13654    pub value: Text,
13655}
13656
13657impl PropertyValue {
13658    /// The type's IRI.
13659    pub const TYPE_IRI: &'static str = "http://schema.org#PropertyValue";
13660    /// The type's `type` in a normalised document.
13661    pub const TYPE: &'static str = "PropertyValue";
13662}
13663
13664impl json::Typed for PropertyValue {
13665    const TYPE: &'static str = "PropertyValue";
13666}
13667
13668impl FromJson for PropertyValue {
13669    fn from_json(value: &Value) -> Result<Self, JsonError> {
13670        let object = json::object(value)?;
13671        json::expect_type(object, Self::TYPE)?;
13672        Ok(Self {
13673            name: json::text(object, "name"),
13674            value: json::text(object, "value"),
13675        })
13676    }
13677}
13678
13679impl ToJson for PropertyValue {
13680    fn to_json(&self) -> Value {
13681        let mut object = json::new_object(Some(Self::TYPE), None);
13682        json::put_text(&mut object, "name", &self.name);
13683        json::put_text(&mut object, "value", &self.value);
13684        Value::Object(object)
13685    }
13686}
13687
13688/// A published request or offer, sometimes with what is expected in return.
13689///
13690/// The type `https://w3id.org/valueflows/ont/vf#Proposal`.
13691#[derive(Clone, Debug, Default, PartialEq)]
13692pub struct Proposal {
13693    /// The IRI that identifies this object.
13694    pub id: Option<Iri>,
13695    /// See [`Object::attachments`].
13696    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
13697    /// See [`Object::attributions`].
13698    pub attributions: Vec<AnyActor>,
13699    /// See [`Object::audiences`].
13700    pub audiences: Vec<AnyObject>,
13701    /// See [`Object::content`].
13702    pub content: Text,
13703    /// See [`Object::contexts`].
13704    pub contexts: Vec<LinkOrObject>,
13705    /// See [`Object::name`].
13706    pub name: Text,
13707    /// See [`Object::end_time`].
13708    pub end_time: Option<String>,
13709    /// See [`Object::generators`].
13710    pub generators: Vec<LinkOrObject>,
13711    /// See [`Object::icons`].
13712    pub icons: Vec<Reference<Image>>,
13713    /// See [`Object::images`].
13714    pub images: Vec<Reference<Image>>,
13715    /// See [`Object::reply_targets`].
13716    pub reply_targets: Vec<LinkOrObject>,
13717    /// See [`Object::locations`].
13718    pub locations: Vec<LinkOrObject>,
13719    /// See [`Object::previews`].
13720    pub previews: Vec<LinkOrObject>,
13721    /// See [`Object::published`].
13722    pub published: Option<String>,
13723    /// See [`Object::replies`].
13724    pub replies: Option<AnyCollection>,
13725    /// See [`Object::shares`].
13726    pub shares: Option<AnyCollection>,
13727    /// See [`Object::likes`].
13728    pub likes: Option<AnyCollection>,
13729    /// See [`Object::emoji_reactions`].
13730    pub emoji_reactions: Option<AnyCollection>,
13731    /// See [`Object::start_time`].
13732    pub start_time: Option<String>,
13733    /// See [`Object::summary`].
13734    pub summary: Text,
13735    /// See [`Object::tags`].
13736    pub tags: Vec<LinkOrObject>,
13737    /// See [`Object::updated`].
13738    pub updated: Option<String>,
13739    /// See [`Object::urls`].
13740    pub urls: Vec<LinkOrIri>,
13741    /// See [`Object::tos`].
13742    pub tos: Vec<AnyObject>,
13743    /// See [`Object::btos`].
13744    pub btos: Vec<AnyObject>,
13745    /// See [`Object::ccs`].
13746    pub ccs: Vec<AnyObject>,
13747    /// See [`Object::bccs`].
13748    pub bccs: Vec<AnyObject>,
13749    /// See [`Object::media_type`].
13750    pub media_type: Option<String>,
13751    /// See [`Object::duration`].
13752    pub duration: Option<String>,
13753    /// See [`Object::sensitive`].
13754    pub sensitive: Option<bool>,
13755    /// See [`Object::source`].
13756    pub source: Option<Box<Source>>,
13757    /// See [`Object::proofs`].
13758    pub proofs: Vec<Reference<DataIntegrityProof>>,
13759    /// See [`Object::interaction_policy`].
13760    pub interaction_policy: Option<Box<InteractionPolicy>>,
13761    /// See [`Object::approved_by`].
13762    pub approved_by: Option<Iri>,
13763    /// See [`Object::like_authorization`].
13764    pub like_authorization: Option<Reference<LikeAuthorization>>,
13765    /// See [`Object::reply_authorization`].
13766    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
13767    /// See [`Object::announce_authorization`].
13768    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
13769    /// See [`Object::translations`].
13770    pub translations: Vec<Translation>,
13771    /// The type of proposal.  Possible values are `"offer"` and `"request"`.
13772    pub purpose: Option<String>,
13773    /// The primary intent of this proposal, describing what is being offered
13774    /// or requested.
13775    pub publishes: Option<Box<Intent>>,
13776    /// The reciprocal intent of this proposal, describing what is expected
13777    /// or offered in return.
13778    pub reciprocal: Option<Box<Intent>>,
13779    /// Indicates whether the quantities expressed in the proposal can be
13780    /// multiplied or not.  The default is `false`.
13781    pub unit_based: Option<bool>,
13782}
13783
13784impl Proposal {
13785    /// The type's IRI.
13786    pub const TYPE_IRI: &'static str = "https://w3id.org/valueflows/ont/vf#Proposal";
13787    /// The type's `type` in a normalised document.
13788    pub const TYPE: &'static str = "Proposal";
13789}
13790
13791impl json::Typed for Proposal {
13792    const TYPE: &'static str = "Proposal";
13793}
13794
13795impl FromJson for Proposal {
13796    fn from_json(value: &Value) -> Result<Self, JsonError> {
13797        let object = json::object(value)?;
13798        json::expect_type(object, Self::TYPE)?;
13799        Ok(Self {
13800            id: json::id(object),
13801            attachments: json::many(object, &["attachment"]),
13802            attributions: json::many(object, &["attributedTo"]),
13803            audiences: json::many(object, &["audience"]),
13804            content: json::text(object, "content"),
13805            contexts: json::many(object, &["context"]),
13806            name: json::text(object, "name"),
13807            end_time: json::one(object, &["endTime"]),
13808            generators: json::many(object, &["generator"]),
13809            icons: json::many_mapped(object, &["icon"], json::link_to_image),
13810            images: json::many_mapped(object, &["image"], json::link_to_image),
13811            reply_targets: json::many(object, &["inReplyTo"]),
13812            locations: json::many(object, &["location"]),
13813            previews: json::many(object, &["preview"]),
13814            published: json::one(object, &["published"]),
13815            replies: json::one(object, &["replies"]),
13816            shares: json::one(object, &["shares"]),
13817            likes: json::one(object, &["likes"]),
13818            emoji_reactions: json::one(object, &["emojiReactions"]),
13819            start_time: json::one(object, &["startTime"]),
13820            summary: json::text(object, "summary"),
13821            tags: json::many(object, &["tag"]),
13822            updated: json::one(object, &["updated"]),
13823            urls: json::many(object, &["url"]),
13824            tos: json::many(object, &["to"]),
13825            btos: json::many(object, &["bto"]),
13826            ccs: json::many(object, &["cc"]),
13827            bccs: json::many(object, &["bcc"]),
13828            media_type: json::one(object, &["mediaType"]),
13829            duration: json::one(object, &["duration"]),
13830            sensitive: json::one(object, &["sensitive"]),
13831            source: json::one(object, &["source"]),
13832            proofs: json::many(object, &["proof"]),
13833            interaction_policy: json::one(object, &["interactionPolicy"]),
13834            approved_by: json::one(object, &["approvedBy"]),
13835            like_authorization: json::one(object, &["likeAuthorization"]),
13836            reply_authorization: json::one(object, &["replyAuthorization"]),
13837            announce_authorization: json::one(object, &["announceAuthorization"]),
13838            translations: json::many(object, &["translations"]),
13839            purpose: json::one(object, &["purpose"]),
13840            publishes: json::one(object, &["publishes"]),
13841            reciprocal: json::one(object, &["reciprocal"]),
13842            unit_based: json::one(object, &["unitBased"]),
13843        })
13844    }
13845}
13846
13847impl ToJson for Proposal {
13848    fn to_json(&self) -> Value {
13849        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
13850        json::put_many(&mut object, &["attachment"], &self.attachments);
13851        json::put_many(&mut object, &["attributedTo"], &self.attributions);
13852        json::put_many(&mut object, &["audience"], &self.audiences);
13853        json::put_text(&mut object, "content", &self.content);
13854        json::put_many(&mut object, &["context"], &self.contexts);
13855        json::put_text(&mut object, "name", &self.name);
13856        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
13857        json::put_many(&mut object, &["generator"], &self.generators);
13858        json::put_many(&mut object, &["icon"], &self.icons);
13859        json::put_many(&mut object, &["image"], &self.images);
13860        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
13861        json::put_many(&mut object, &["location"], &self.locations);
13862        json::put_many(&mut object, &["preview"], &self.previews);
13863        json::put_one(&mut object, &["published"], self.published.as_ref());
13864        json::put_one(&mut object, &["replies"], self.replies.as_ref());
13865        json::put_one(&mut object, &["shares"], self.shares.as_ref());
13866        json::put_one(&mut object, &["likes"], self.likes.as_ref());
13867        json::put_one(
13868            &mut object,
13869            &["emojiReactions"],
13870            self.emoji_reactions.as_ref(),
13871        );
13872        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
13873        json::put_text(&mut object, "summary", &self.summary);
13874        json::put_many(&mut object, &["tag"], &self.tags);
13875        json::put_one(&mut object, &["updated"], self.updated.as_ref());
13876        json::put_many(&mut object, &["url"], &self.urls);
13877        json::put_many(&mut object, &["to"], &self.tos);
13878        json::put_many(&mut object, &["bto"], &self.btos);
13879        json::put_many(&mut object, &["cc"], &self.ccs);
13880        json::put_many(&mut object, &["bcc"], &self.bccs);
13881        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
13882        json::put_one(&mut object, &["duration"], self.duration.as_ref());
13883        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
13884        json::put_one(&mut object, &["source"], self.source.as_ref());
13885        json::put_many(&mut object, &["proof"], &self.proofs);
13886        json::put_one(
13887            &mut object,
13888            &["interactionPolicy"],
13889            self.interaction_policy.as_ref(),
13890        );
13891        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
13892        json::put_one(
13893            &mut object,
13894            &["likeAuthorization"],
13895            self.like_authorization.as_ref(),
13896        );
13897        json::put_one(
13898            &mut object,
13899            &["replyAuthorization"],
13900            self.reply_authorization.as_ref(),
13901        );
13902        json::put_one(
13903            &mut object,
13904            &["announceAuthorization"],
13905            self.announce_authorization.as_ref(),
13906        );
13907        json::put_many(&mut object, &["translations"], &self.translations);
13908        json::put_one(&mut object, &["purpose"], self.purpose.as_ref());
13909        json::put_one(&mut object, &["publishes"], self.publishes.as_ref());
13910        json::put_one(&mut object, &["reciprocal"], self.reciprocal.as_ref());
13911        json::put_one(&mut object, &["unitBased"], self.unit_based.as_ref());
13912        Value::Object(object)
13913    }
13914}
13915
13916/// Represents a question being asked.  Question objects are an extension of
13917/// {@link IntransitiveActivity}.  That is, the Question object is an Activity,
13918/// but the direct object is the question itself and therefore it would not
13919/// contain an `object` property.
13920///
13921/// The type `https://www.w3.org/ns/activitystreams#Question`.
13922#[derive(Clone, Debug, Default, PartialEq)]
13923pub struct Question {
13924    /// The IRI that identifies this object.
13925    pub id: Option<Iri>,
13926    /// See [`Object::attachments`].
13927    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
13928    /// See [`Object::attributions`].
13929    pub attributions: Vec<AnyActor>,
13930    /// See [`Object::audiences`].
13931    pub audiences: Vec<AnyObject>,
13932    /// See [`Object::content`].
13933    pub content: Text,
13934    /// See [`Object::contexts`].
13935    pub contexts: Vec<LinkOrObject>,
13936    /// See [`Object::name`].
13937    pub name: Text,
13938    /// See [`Object::end_time`].
13939    pub end_time: Option<String>,
13940    /// See [`Object::generators`].
13941    pub generators: Vec<LinkOrObject>,
13942    /// See [`Object::icons`].
13943    pub icons: Vec<Reference<Image>>,
13944    /// See [`Object::images`].
13945    pub images: Vec<Reference<Image>>,
13946    /// See [`Object::reply_targets`].
13947    pub reply_targets: Vec<LinkOrObject>,
13948    /// See [`Object::locations`].
13949    pub locations: Vec<LinkOrObject>,
13950    /// See [`Object::previews`].
13951    pub previews: Vec<LinkOrObject>,
13952    /// See [`Object::published`].
13953    pub published: Option<String>,
13954    /// See [`Object::replies`].
13955    pub replies: Option<AnyCollection>,
13956    /// See [`Object::shares`].
13957    pub shares: Option<AnyCollection>,
13958    /// See [`Object::likes`].
13959    pub likes: Option<AnyCollection>,
13960    /// See [`Object::emoji_reactions`].
13961    pub emoji_reactions: Option<AnyCollection>,
13962    /// See [`Object::start_time`].
13963    pub start_time: Option<String>,
13964    /// See [`Object::summary`].
13965    pub summary: Text,
13966    /// See [`Object::tags`].
13967    pub tags: Vec<LinkOrObject>,
13968    /// See [`Object::updated`].
13969    pub updated: Option<String>,
13970    /// See [`Object::urls`].
13971    pub urls: Vec<LinkOrIri>,
13972    /// See [`Object::tos`].
13973    pub tos: Vec<AnyObject>,
13974    /// See [`Object::btos`].
13975    pub btos: Vec<AnyObject>,
13976    /// See [`Object::ccs`].
13977    pub ccs: Vec<AnyObject>,
13978    /// See [`Object::bccs`].
13979    pub bccs: Vec<AnyObject>,
13980    /// See [`Object::media_type`].
13981    pub media_type: Option<String>,
13982    /// See [`Object::duration`].
13983    pub duration: Option<String>,
13984    /// See [`Object::sensitive`].
13985    pub sensitive: Option<bool>,
13986    /// See [`Object::source`].
13987    pub source: Option<Box<Source>>,
13988    /// See [`Object::proofs`].
13989    pub proofs: Vec<Reference<DataIntegrityProof>>,
13990    /// See [`Object::interaction_policy`].
13991    pub interaction_policy: Option<Box<InteractionPolicy>>,
13992    /// See [`Object::approved_by`].
13993    pub approved_by: Option<Iri>,
13994    /// See [`Object::like_authorization`].
13995    pub like_authorization: Option<Reference<LikeAuthorization>>,
13996    /// See [`Object::reply_authorization`].
13997    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
13998    /// See [`Object::announce_authorization`].
13999    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
14000    /// See [`Object::translations`].
14001    pub translations: Vec<Translation>,
14002    /// See [`Activity::actors`].
14003    pub actors: Vec<AnyActor>,
14004    /// See [`Activity::objects`].
14005    pub objects: Vec<AnyObject>,
14006    /// See [`Activity::targets`].
14007    pub targets: Vec<AnyObject>,
14008    /// See [`Activity::results`].
14009    pub results: Vec<AnyObject>,
14010    /// See [`Activity::origins`].
14011    pub origins: Vec<AnyObject>,
14012    /// See [`Activity::instruments`].
14013    pub instruments: Vec<AnyObject>,
14014    /// Identifies an exclusive option for a Question.  Use of `exclusiveOptions`
14015    /// implies that the Question can have only a single answer.  To indicate that
14016    /// a Question can have multiple answers, use `inclusiveOptions`.
14017    pub exclusive_options: Vec<AnyObject>,
14018    /// Identifies an inclusive option for a Question.  Use of `inclusiveOptions`
14019    /// implies that the Question can have multiple answers.  To indicate that
14020    /// a Question can have only one answer, use `exclusiveOptions`.
14021    pub inclusive_options: Vec<AnyObject>,
14022    /// Indicates that a question has been closed, and answers are no longer
14023    /// accepted.
14024    pub closed: Option<BooleanOrDateTime>,
14025    /// How many people have voted in the poll.  Distinct from how many votes have
14026    /// been cast (in the case of multiple-choice polls).
14027    pub voters: Option<u64>,
14028    /// The quoted ActivityStreams object.
14029    pub quote: Option<AnyObject>,
14030    /// The URI of the ActivityStreams object that this object quotes.
14031    pub quote_url: Option<Iri>,
14032    /// A {@link QuoteAuthorization} object that proves this quote was approved
14033    /// by the quoted object's author.
14034    pub quote_authorization: Option<Reference<QuoteAuthorization>>,
14035}
14036
14037impl Question {
14038    /// The type's IRI.
14039    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Question";
14040    /// The type's `type` in a normalised document.
14041    pub const TYPE: &'static str = "Question";
14042}
14043
14044impl json::Typed for Question {
14045    const TYPE: &'static str = "Question";
14046}
14047
14048impl FromJson for Question {
14049    fn from_json(value: &Value) -> Result<Self, JsonError> {
14050        let object = json::object(value)?;
14051        json::expect_type(object, Self::TYPE)?;
14052        Ok(Self {
14053            id: json::id(object),
14054            attachments: json::many(object, &["attachment"]),
14055            attributions: json::many(object, &["attributedTo"]),
14056            audiences: json::many(object, &["audience"]),
14057            content: json::text(object, "content"),
14058            contexts: json::many(object, &["context"]),
14059            name: json::text(object, "name"),
14060            end_time: json::one(object, &["endTime"]),
14061            generators: json::many(object, &["generator"]),
14062            icons: json::many_mapped(object, &["icon"], json::link_to_image),
14063            images: json::many_mapped(object, &["image"], json::link_to_image),
14064            reply_targets: json::many(object, &["inReplyTo"]),
14065            locations: json::many(object, &["location"]),
14066            previews: json::many(object, &["preview"]),
14067            published: json::one(object, &["published"]),
14068            replies: json::one(object, &["replies"]),
14069            shares: json::one(object, &["shares"]),
14070            likes: json::one(object, &["likes"]),
14071            emoji_reactions: json::one(object, &["emojiReactions"]),
14072            start_time: json::one(object, &["startTime"]),
14073            summary: json::text(object, "summary"),
14074            tags: json::many(object, &["tag"]),
14075            updated: json::one(object, &["updated"]),
14076            urls: json::many(object, &["url"]),
14077            tos: json::many(object, &["to"]),
14078            btos: json::many(object, &["bto"]),
14079            ccs: json::many(object, &["cc"]),
14080            bccs: json::many(object, &["bcc"]),
14081            media_type: json::one(object, &["mediaType"]),
14082            duration: json::one(object, &["duration"]),
14083            sensitive: json::one(object, &["sensitive"]),
14084            source: json::one(object, &["source"]),
14085            proofs: json::many(object, &["proof"]),
14086            interaction_policy: json::one(object, &["interactionPolicy"]),
14087            approved_by: json::one(object, &["approvedBy"]),
14088            like_authorization: json::one(object, &["likeAuthorization"]),
14089            reply_authorization: json::one(object, &["replyAuthorization"]),
14090            announce_authorization: json::one(object, &["announceAuthorization"]),
14091            translations: json::many(object, &["translations"]),
14092            actors: json::many(object, &["actor"]),
14093            objects: json::many(object, &["object"]),
14094            targets: json::many(object, &["target"]),
14095            results: json::many(object, &["result"]),
14096            origins: json::many(object, &["origin"]),
14097            instruments: json::many(object, &["instrument"]),
14098            exclusive_options: json::many(object, &["oneOf"]),
14099            inclusive_options: json::many(object, &["anyOf"]),
14100            closed: json::one(object, &["closed"]),
14101            voters: json::one(object, &["votersCount"]),
14102            quote: json::one(object, &["quote"]),
14103            quote_url: json::one(object, &["quoteUrl", "_misskey_quote", "quoteUri"]),
14104            quote_authorization: json::one(object, &["quoteAuthorization"]),
14105        })
14106    }
14107}
14108
14109impl ToJson for Question {
14110    fn to_json(&self) -> Value {
14111        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
14112        json::put_many(&mut object, &["attachment"], &self.attachments);
14113        json::put_many(&mut object, &["attributedTo"], &self.attributions);
14114        json::put_many(&mut object, &["audience"], &self.audiences);
14115        json::put_text(&mut object, "content", &self.content);
14116        json::put_many(&mut object, &["context"], &self.contexts);
14117        json::put_text(&mut object, "name", &self.name);
14118        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
14119        json::put_many(&mut object, &["generator"], &self.generators);
14120        json::put_many(&mut object, &["icon"], &self.icons);
14121        json::put_many(&mut object, &["image"], &self.images);
14122        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
14123        json::put_many(&mut object, &["location"], &self.locations);
14124        json::put_many(&mut object, &["preview"], &self.previews);
14125        json::put_one(&mut object, &["published"], self.published.as_ref());
14126        json::put_one(&mut object, &["replies"], self.replies.as_ref());
14127        json::put_one(&mut object, &["shares"], self.shares.as_ref());
14128        json::put_one(&mut object, &["likes"], self.likes.as_ref());
14129        json::put_one(
14130            &mut object,
14131            &["emojiReactions"],
14132            self.emoji_reactions.as_ref(),
14133        );
14134        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
14135        json::put_text(&mut object, "summary", &self.summary);
14136        json::put_many(&mut object, &["tag"], &self.tags);
14137        json::put_one(&mut object, &["updated"], self.updated.as_ref());
14138        json::put_many(&mut object, &["url"], &self.urls);
14139        json::put_many(&mut object, &["to"], &self.tos);
14140        json::put_many(&mut object, &["bto"], &self.btos);
14141        json::put_many(&mut object, &["cc"], &self.ccs);
14142        json::put_many(&mut object, &["bcc"], &self.bccs);
14143        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
14144        json::put_one(&mut object, &["duration"], self.duration.as_ref());
14145        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
14146        json::put_one(&mut object, &["source"], self.source.as_ref());
14147        json::put_many(&mut object, &["proof"], &self.proofs);
14148        json::put_one(
14149            &mut object,
14150            &["interactionPolicy"],
14151            self.interaction_policy.as_ref(),
14152        );
14153        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
14154        json::put_one(
14155            &mut object,
14156            &["likeAuthorization"],
14157            self.like_authorization.as_ref(),
14158        );
14159        json::put_one(
14160            &mut object,
14161            &["replyAuthorization"],
14162            self.reply_authorization.as_ref(),
14163        );
14164        json::put_one(
14165            &mut object,
14166            &["announceAuthorization"],
14167            self.announce_authorization.as_ref(),
14168        );
14169        json::put_many(&mut object, &["translations"], &self.translations);
14170        json::put_many(&mut object, &["actor"], &self.actors);
14171        json::put_many(&mut object, &["object"], &self.objects);
14172        json::put_many(&mut object, &["target"], &self.targets);
14173        json::put_many(&mut object, &["result"], &self.results);
14174        json::put_many(&mut object, &["origin"], &self.origins);
14175        json::put_many(&mut object, &["instrument"], &self.instruments);
14176        json::put_many(&mut object, &["oneOf"], &self.exclusive_options);
14177        json::put_many(&mut object, &["anyOf"], &self.inclusive_options);
14178        json::put_one(&mut object, &["closed"], self.closed.as_ref());
14179        json::put_one(&mut object, &["votersCount"], self.voters.as_ref());
14180        json::put_one(&mut object, &["quote"], self.quote.as_ref());
14181        json::put_one(
14182            &mut object,
14183            &["quoteUrl", "_misskey_quote", "quoteUri"],
14184            self.quote_url.as_ref(),
14185        );
14186        json::put_one(
14187            &mut object,
14188            &["quoteAuthorization"],
14189            self.quote_authorization.as_ref(),
14190        );
14191        Value::Object(object)
14192    }
14193}
14194
14195/// Proves that a quote interaction has been approved by the quoted object's
14196/// author.
14197///
14198/// The type `https://w3id.org/fep/044f#QuoteAuthorization`.
14199#[derive(Clone, Debug, Default, PartialEq)]
14200pub struct QuoteAuthorization {
14201    /// The IRI that identifies this object.
14202    pub id: Option<Iri>,
14203    /// See [`Object::attachments`].
14204    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
14205    /// See [`Object::attributions`].
14206    pub attributions: Vec<AnyActor>,
14207    /// See [`Object::audiences`].
14208    pub audiences: Vec<AnyObject>,
14209    /// See [`Object::content`].
14210    pub content: Text,
14211    /// See [`Object::contexts`].
14212    pub contexts: Vec<LinkOrObject>,
14213    /// See [`Object::name`].
14214    pub name: Text,
14215    /// See [`Object::end_time`].
14216    pub end_time: Option<String>,
14217    /// See [`Object::generators`].
14218    pub generators: Vec<LinkOrObject>,
14219    /// See [`Object::icons`].
14220    pub icons: Vec<Reference<Image>>,
14221    /// See [`Object::images`].
14222    pub images: Vec<Reference<Image>>,
14223    /// See [`Object::reply_targets`].
14224    pub reply_targets: Vec<LinkOrObject>,
14225    /// See [`Object::locations`].
14226    pub locations: Vec<LinkOrObject>,
14227    /// See [`Object::previews`].
14228    pub previews: Vec<LinkOrObject>,
14229    /// See [`Object::published`].
14230    pub published: Option<String>,
14231    /// See [`Object::replies`].
14232    pub replies: Option<AnyCollection>,
14233    /// See [`Object::shares`].
14234    pub shares: Option<AnyCollection>,
14235    /// See [`Object::likes`].
14236    pub likes: Option<AnyCollection>,
14237    /// See [`Object::emoji_reactions`].
14238    pub emoji_reactions: Option<AnyCollection>,
14239    /// See [`Object::start_time`].
14240    pub start_time: Option<String>,
14241    /// See [`Object::summary`].
14242    pub summary: Text,
14243    /// See [`Object::tags`].
14244    pub tags: Vec<LinkOrObject>,
14245    /// See [`Object::updated`].
14246    pub updated: Option<String>,
14247    /// See [`Object::urls`].
14248    pub urls: Vec<LinkOrIri>,
14249    /// See [`Object::tos`].
14250    pub tos: Vec<AnyObject>,
14251    /// See [`Object::btos`].
14252    pub btos: Vec<AnyObject>,
14253    /// See [`Object::ccs`].
14254    pub ccs: Vec<AnyObject>,
14255    /// See [`Object::bccs`].
14256    pub bccs: Vec<AnyObject>,
14257    /// See [`Object::media_type`].
14258    pub media_type: Option<String>,
14259    /// See [`Object::duration`].
14260    pub duration: Option<String>,
14261    /// See [`Object::sensitive`].
14262    pub sensitive: Option<bool>,
14263    /// See [`Object::source`].
14264    pub source: Option<Box<Source>>,
14265    /// See [`Object::proofs`].
14266    pub proofs: Vec<Reference<DataIntegrityProof>>,
14267    /// See [`Object::interaction_policy`].
14268    pub interaction_policy: Option<Box<InteractionPolicy>>,
14269    /// See [`Object::approved_by`].
14270    pub approved_by: Option<Iri>,
14271    /// See [`Object::like_authorization`].
14272    pub like_authorization: Option<Reference<LikeAuthorization>>,
14273    /// See [`Object::reply_authorization`].
14274    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
14275    /// See [`Object::announce_authorization`].
14276    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
14277    /// See [`Object::translations`].
14278    pub translations: Vec<Translation>,
14279    /// The URI of the quote object that has been authorized.
14280    pub interacting_object: Option<AnyObject>,
14281    /// The URI of the object that is the target of the authorized quote.
14282    pub interaction_target: Option<AnyObject>,
14283}
14284
14285impl QuoteAuthorization {
14286    /// The type's IRI.
14287    pub const TYPE_IRI: &'static str = "https://w3id.org/fep/044f#QuoteAuthorization";
14288    /// The type's `type` in a normalised document.
14289    pub const TYPE: &'static str = "QuoteAuthorization";
14290}
14291
14292impl json::Typed for QuoteAuthorization {
14293    const TYPE: &'static str = "QuoteAuthorization";
14294}
14295
14296impl FromJson for QuoteAuthorization {
14297    fn from_json(value: &Value) -> Result<Self, JsonError> {
14298        let object = json::object(value)?;
14299        json::expect_type(object, Self::TYPE)?;
14300        Ok(Self {
14301            id: json::id(object),
14302            attachments: json::many(object, &["attachment"]),
14303            attributions: json::many(object, &["attributedTo"]),
14304            audiences: json::many(object, &["audience"]),
14305            content: json::text(object, "content"),
14306            contexts: json::many(object, &["context"]),
14307            name: json::text(object, "name"),
14308            end_time: json::one(object, &["endTime"]),
14309            generators: json::many(object, &["generator"]),
14310            icons: json::many_mapped(object, &["icon"], json::link_to_image),
14311            images: json::many_mapped(object, &["image"], json::link_to_image),
14312            reply_targets: json::many(object, &["inReplyTo"]),
14313            locations: json::many(object, &["location"]),
14314            previews: json::many(object, &["preview"]),
14315            published: json::one(object, &["published"]),
14316            replies: json::one(object, &["replies"]),
14317            shares: json::one(object, &["shares"]),
14318            likes: json::one(object, &["likes"]),
14319            emoji_reactions: json::one(object, &["emojiReactions"]),
14320            start_time: json::one(object, &["startTime"]),
14321            summary: json::text(object, "summary"),
14322            tags: json::many(object, &["tag"]),
14323            updated: json::one(object, &["updated"]),
14324            urls: json::many(object, &["url"]),
14325            tos: json::many(object, &["to"]),
14326            btos: json::many(object, &["bto"]),
14327            ccs: json::many(object, &["cc"]),
14328            bccs: json::many(object, &["bcc"]),
14329            media_type: json::one(object, &["mediaType"]),
14330            duration: json::one(object, &["duration"]),
14331            sensitive: json::one(object, &["sensitive"]),
14332            source: json::one(object, &["source"]),
14333            proofs: json::many(object, &["proof"]),
14334            interaction_policy: json::one(object, &["interactionPolicy"]),
14335            approved_by: json::one(object, &["approvedBy"]),
14336            like_authorization: json::one(object, &["likeAuthorization"]),
14337            reply_authorization: json::one(object, &["replyAuthorization"]),
14338            announce_authorization: json::one(object, &["announceAuthorization"]),
14339            translations: json::many(object, &["translations"]),
14340            interacting_object: json::one(object, &["interactingObject"]),
14341            interaction_target: json::one(object, &["interactionTarget"]),
14342        })
14343    }
14344}
14345
14346impl ToJson for QuoteAuthorization {
14347    fn to_json(&self) -> Value {
14348        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
14349        json::put_many(&mut object, &["attachment"], &self.attachments);
14350        json::put_many(&mut object, &["attributedTo"], &self.attributions);
14351        json::put_many(&mut object, &["audience"], &self.audiences);
14352        json::put_text(&mut object, "content", &self.content);
14353        json::put_many(&mut object, &["context"], &self.contexts);
14354        json::put_text(&mut object, "name", &self.name);
14355        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
14356        json::put_many(&mut object, &["generator"], &self.generators);
14357        json::put_many(&mut object, &["icon"], &self.icons);
14358        json::put_many(&mut object, &["image"], &self.images);
14359        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
14360        json::put_many(&mut object, &["location"], &self.locations);
14361        json::put_many(&mut object, &["preview"], &self.previews);
14362        json::put_one(&mut object, &["published"], self.published.as_ref());
14363        json::put_one(&mut object, &["replies"], self.replies.as_ref());
14364        json::put_one(&mut object, &["shares"], self.shares.as_ref());
14365        json::put_one(&mut object, &["likes"], self.likes.as_ref());
14366        json::put_one(
14367            &mut object,
14368            &["emojiReactions"],
14369            self.emoji_reactions.as_ref(),
14370        );
14371        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
14372        json::put_text(&mut object, "summary", &self.summary);
14373        json::put_many(&mut object, &["tag"], &self.tags);
14374        json::put_one(&mut object, &["updated"], self.updated.as_ref());
14375        json::put_many(&mut object, &["url"], &self.urls);
14376        json::put_many(&mut object, &["to"], &self.tos);
14377        json::put_many(&mut object, &["bto"], &self.btos);
14378        json::put_many(&mut object, &["cc"], &self.ccs);
14379        json::put_many(&mut object, &["bcc"], &self.bccs);
14380        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
14381        json::put_one(&mut object, &["duration"], self.duration.as_ref());
14382        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
14383        json::put_one(&mut object, &["source"], self.source.as_ref());
14384        json::put_many(&mut object, &["proof"], &self.proofs);
14385        json::put_one(
14386            &mut object,
14387            &["interactionPolicy"],
14388            self.interaction_policy.as_ref(),
14389        );
14390        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
14391        json::put_one(
14392            &mut object,
14393            &["likeAuthorization"],
14394            self.like_authorization.as_ref(),
14395        );
14396        json::put_one(
14397            &mut object,
14398            &["replyAuthorization"],
14399            self.reply_authorization.as_ref(),
14400        );
14401        json::put_one(
14402            &mut object,
14403            &["announceAuthorization"],
14404            self.announce_authorization.as_ref(),
14405        );
14406        json::put_many(&mut object, &["translations"], &self.translations);
14407        json::put_one(
14408            &mut object,
14409            &["interactingObject"],
14410            self.interacting_object.as_ref(),
14411        );
14412        json::put_one(
14413            &mut object,
14414            &["interactionTarget"],
14415            self.interaction_target.as_ref(),
14416        );
14417        Value::Object(object)
14418    }
14419}
14420
14421/// A request to quote an object that requires approval from the quoted object's
14422/// author.
14423///
14424/// The type `https://w3id.org/fep/044f#QuoteRequest`.
14425#[derive(Clone, Debug, Default, PartialEq)]
14426pub struct QuoteRequest {
14427    /// The IRI that identifies this object.
14428    pub id: Option<Iri>,
14429    /// See [`Object::attachments`].
14430    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
14431    /// See [`Object::attributions`].
14432    pub attributions: Vec<AnyActor>,
14433    /// See [`Object::audiences`].
14434    pub audiences: Vec<AnyObject>,
14435    /// See [`Object::content`].
14436    pub content: Text,
14437    /// See [`Object::contexts`].
14438    pub contexts: Vec<LinkOrObject>,
14439    /// See [`Object::name`].
14440    pub name: Text,
14441    /// See [`Object::end_time`].
14442    pub end_time: Option<String>,
14443    /// See [`Object::generators`].
14444    pub generators: Vec<LinkOrObject>,
14445    /// See [`Object::icons`].
14446    pub icons: Vec<Reference<Image>>,
14447    /// See [`Object::images`].
14448    pub images: Vec<Reference<Image>>,
14449    /// See [`Object::reply_targets`].
14450    pub reply_targets: Vec<LinkOrObject>,
14451    /// See [`Object::locations`].
14452    pub locations: Vec<LinkOrObject>,
14453    /// See [`Object::previews`].
14454    pub previews: Vec<LinkOrObject>,
14455    /// See [`Object::published`].
14456    pub published: Option<String>,
14457    /// See [`Object::replies`].
14458    pub replies: Option<AnyCollection>,
14459    /// See [`Object::shares`].
14460    pub shares: Option<AnyCollection>,
14461    /// See [`Object::likes`].
14462    pub likes: Option<AnyCollection>,
14463    /// See [`Object::emoji_reactions`].
14464    pub emoji_reactions: Option<AnyCollection>,
14465    /// See [`Object::start_time`].
14466    pub start_time: Option<String>,
14467    /// See [`Object::summary`].
14468    pub summary: Text,
14469    /// See [`Object::tags`].
14470    pub tags: Vec<LinkOrObject>,
14471    /// See [`Object::updated`].
14472    pub updated: Option<String>,
14473    /// See [`Object::urls`].
14474    pub urls: Vec<LinkOrIri>,
14475    /// See [`Object::tos`].
14476    pub tos: Vec<AnyObject>,
14477    /// See [`Object::btos`].
14478    pub btos: Vec<AnyObject>,
14479    /// See [`Object::ccs`].
14480    pub ccs: Vec<AnyObject>,
14481    /// See [`Object::bccs`].
14482    pub bccs: Vec<AnyObject>,
14483    /// See [`Object::media_type`].
14484    pub media_type: Option<String>,
14485    /// See [`Object::duration`].
14486    pub duration: Option<String>,
14487    /// See [`Object::sensitive`].
14488    pub sensitive: Option<bool>,
14489    /// See [`Object::source`].
14490    pub source: Option<Box<Source>>,
14491    /// See [`Object::proofs`].
14492    pub proofs: Vec<Reference<DataIntegrityProof>>,
14493    /// See [`Object::interaction_policy`].
14494    pub interaction_policy: Option<Box<InteractionPolicy>>,
14495    /// See [`Object::approved_by`].
14496    pub approved_by: Option<Iri>,
14497    /// See [`Object::like_authorization`].
14498    pub like_authorization: Option<Reference<LikeAuthorization>>,
14499    /// See [`Object::reply_authorization`].
14500    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
14501    /// See [`Object::announce_authorization`].
14502    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
14503    /// See [`Object::translations`].
14504    pub translations: Vec<Translation>,
14505    /// See [`Activity::actors`].
14506    pub actors: Vec<AnyActor>,
14507    /// See [`Activity::objects`].
14508    pub objects: Vec<AnyObject>,
14509    /// See [`Activity::targets`].
14510    pub targets: Vec<AnyObject>,
14511    /// See [`Activity::results`].
14512    pub results: Vec<AnyObject>,
14513    /// See [`Activity::origins`].
14514    pub origins: Vec<AnyObject>,
14515    /// See [`Activity::instruments`].
14516    pub instruments: Vec<AnyObject>,
14517}
14518
14519impl QuoteRequest {
14520    /// The type's IRI.
14521    pub const TYPE_IRI: &'static str = "https://w3id.org/fep/044f#QuoteRequest";
14522    /// The type's `type` in a normalised document.
14523    pub const TYPE: &'static str = "QuoteRequest";
14524}
14525
14526impl json::Typed for QuoteRequest {
14527    const TYPE: &'static str = "QuoteRequest";
14528}
14529
14530impl FromJson for QuoteRequest {
14531    fn from_json(value: &Value) -> Result<Self, JsonError> {
14532        let object = json::object(value)?;
14533        json::expect_type(object, Self::TYPE)?;
14534        Ok(Self {
14535            id: json::id(object),
14536            attachments: json::many(object, &["attachment"]),
14537            attributions: json::many(object, &["attributedTo"]),
14538            audiences: json::many(object, &["audience"]),
14539            content: json::text(object, "content"),
14540            contexts: json::many(object, &["context"]),
14541            name: json::text(object, "name"),
14542            end_time: json::one(object, &["endTime"]),
14543            generators: json::many(object, &["generator"]),
14544            icons: json::many_mapped(object, &["icon"], json::link_to_image),
14545            images: json::many_mapped(object, &["image"], json::link_to_image),
14546            reply_targets: json::many(object, &["inReplyTo"]),
14547            locations: json::many(object, &["location"]),
14548            previews: json::many(object, &["preview"]),
14549            published: json::one(object, &["published"]),
14550            replies: json::one(object, &["replies"]),
14551            shares: json::one(object, &["shares"]),
14552            likes: json::one(object, &["likes"]),
14553            emoji_reactions: json::one(object, &["emojiReactions"]),
14554            start_time: json::one(object, &["startTime"]),
14555            summary: json::text(object, "summary"),
14556            tags: json::many(object, &["tag"]),
14557            updated: json::one(object, &["updated"]),
14558            urls: json::many(object, &["url"]),
14559            tos: json::many(object, &["to"]),
14560            btos: json::many(object, &["bto"]),
14561            ccs: json::many(object, &["cc"]),
14562            bccs: json::many(object, &["bcc"]),
14563            media_type: json::one(object, &["mediaType"]),
14564            duration: json::one(object, &["duration"]),
14565            sensitive: json::one(object, &["sensitive"]),
14566            source: json::one(object, &["source"]),
14567            proofs: json::many(object, &["proof"]),
14568            interaction_policy: json::one(object, &["interactionPolicy"]),
14569            approved_by: json::one(object, &["approvedBy"]),
14570            like_authorization: json::one(object, &["likeAuthorization"]),
14571            reply_authorization: json::one(object, &["replyAuthorization"]),
14572            announce_authorization: json::one(object, &["announceAuthorization"]),
14573            translations: json::many(object, &["translations"]),
14574            actors: json::many(object, &["actor"]),
14575            objects: json::many(object, &["object"]),
14576            targets: json::many(object, &["target"]),
14577            results: json::many(object, &["result"]),
14578            origins: json::many(object, &["origin"]),
14579            instruments: json::many(object, &["instrument"]),
14580        })
14581    }
14582}
14583
14584impl ToJson for QuoteRequest {
14585    fn to_json(&self) -> Value {
14586        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
14587        json::put_many(&mut object, &["attachment"], &self.attachments);
14588        json::put_many(&mut object, &["attributedTo"], &self.attributions);
14589        json::put_many(&mut object, &["audience"], &self.audiences);
14590        json::put_text(&mut object, "content", &self.content);
14591        json::put_many(&mut object, &["context"], &self.contexts);
14592        json::put_text(&mut object, "name", &self.name);
14593        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
14594        json::put_many(&mut object, &["generator"], &self.generators);
14595        json::put_many(&mut object, &["icon"], &self.icons);
14596        json::put_many(&mut object, &["image"], &self.images);
14597        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
14598        json::put_many(&mut object, &["location"], &self.locations);
14599        json::put_many(&mut object, &["preview"], &self.previews);
14600        json::put_one(&mut object, &["published"], self.published.as_ref());
14601        json::put_one(&mut object, &["replies"], self.replies.as_ref());
14602        json::put_one(&mut object, &["shares"], self.shares.as_ref());
14603        json::put_one(&mut object, &["likes"], self.likes.as_ref());
14604        json::put_one(
14605            &mut object,
14606            &["emojiReactions"],
14607            self.emoji_reactions.as_ref(),
14608        );
14609        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
14610        json::put_text(&mut object, "summary", &self.summary);
14611        json::put_many(&mut object, &["tag"], &self.tags);
14612        json::put_one(&mut object, &["updated"], self.updated.as_ref());
14613        json::put_many(&mut object, &["url"], &self.urls);
14614        json::put_many(&mut object, &["to"], &self.tos);
14615        json::put_many(&mut object, &["bto"], &self.btos);
14616        json::put_many(&mut object, &["cc"], &self.ccs);
14617        json::put_many(&mut object, &["bcc"], &self.bccs);
14618        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
14619        json::put_one(&mut object, &["duration"], self.duration.as_ref());
14620        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
14621        json::put_one(&mut object, &["source"], self.source.as_ref());
14622        json::put_many(&mut object, &["proof"], &self.proofs);
14623        json::put_one(
14624            &mut object,
14625            &["interactionPolicy"],
14626            self.interaction_policy.as_ref(),
14627        );
14628        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
14629        json::put_one(
14630            &mut object,
14631            &["likeAuthorization"],
14632            self.like_authorization.as_ref(),
14633        );
14634        json::put_one(
14635            &mut object,
14636            &["replyAuthorization"],
14637            self.reply_authorization.as_ref(),
14638        );
14639        json::put_one(
14640            &mut object,
14641            &["announceAuthorization"],
14642            self.announce_authorization.as_ref(),
14643        );
14644        json::put_many(&mut object, &["translations"], &self.translations);
14645        json::put_many(&mut object, &["actor"], &self.actors);
14646        json::put_many(&mut object, &["object"], &self.objects);
14647        json::put_many(&mut object, &["target"], &self.targets);
14648        json::put_many(&mut object, &["result"], &self.results);
14649        json::put_many(&mut object, &["origin"], &self.origins);
14650        json::put_many(&mut object, &["instrument"], &self.instruments);
14651        Value::Object(object)
14652    }
14653}
14654
14655/// Indicates that the `actor` has read the `object`.
14656///
14657/// The type `https://www.w3.org/ns/activitystreams#Read`.
14658#[derive(Clone, Debug, Default, PartialEq)]
14659pub struct Read {
14660    /// The IRI that identifies this object.
14661    pub id: Option<Iri>,
14662    /// See [`Object::attachments`].
14663    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
14664    /// See [`Object::attributions`].
14665    pub attributions: Vec<AnyActor>,
14666    /// See [`Object::audiences`].
14667    pub audiences: Vec<AnyObject>,
14668    /// See [`Object::content`].
14669    pub content: Text,
14670    /// See [`Object::contexts`].
14671    pub contexts: Vec<LinkOrObject>,
14672    /// See [`Object::name`].
14673    pub name: Text,
14674    /// See [`Object::end_time`].
14675    pub end_time: Option<String>,
14676    /// See [`Object::generators`].
14677    pub generators: Vec<LinkOrObject>,
14678    /// See [`Object::icons`].
14679    pub icons: Vec<Reference<Image>>,
14680    /// See [`Object::images`].
14681    pub images: Vec<Reference<Image>>,
14682    /// See [`Object::reply_targets`].
14683    pub reply_targets: Vec<LinkOrObject>,
14684    /// See [`Object::locations`].
14685    pub locations: Vec<LinkOrObject>,
14686    /// See [`Object::previews`].
14687    pub previews: Vec<LinkOrObject>,
14688    /// See [`Object::published`].
14689    pub published: Option<String>,
14690    /// See [`Object::replies`].
14691    pub replies: Option<AnyCollection>,
14692    /// See [`Object::shares`].
14693    pub shares: Option<AnyCollection>,
14694    /// See [`Object::likes`].
14695    pub likes: Option<AnyCollection>,
14696    /// See [`Object::emoji_reactions`].
14697    pub emoji_reactions: Option<AnyCollection>,
14698    /// See [`Object::start_time`].
14699    pub start_time: Option<String>,
14700    /// See [`Object::summary`].
14701    pub summary: Text,
14702    /// See [`Object::tags`].
14703    pub tags: Vec<LinkOrObject>,
14704    /// See [`Object::updated`].
14705    pub updated: Option<String>,
14706    /// See [`Object::urls`].
14707    pub urls: Vec<LinkOrIri>,
14708    /// See [`Object::tos`].
14709    pub tos: Vec<AnyObject>,
14710    /// See [`Object::btos`].
14711    pub btos: Vec<AnyObject>,
14712    /// See [`Object::ccs`].
14713    pub ccs: Vec<AnyObject>,
14714    /// See [`Object::bccs`].
14715    pub bccs: Vec<AnyObject>,
14716    /// See [`Object::media_type`].
14717    pub media_type: Option<String>,
14718    /// See [`Object::duration`].
14719    pub duration: Option<String>,
14720    /// See [`Object::sensitive`].
14721    pub sensitive: Option<bool>,
14722    /// See [`Object::source`].
14723    pub source: Option<Box<Source>>,
14724    /// See [`Object::proofs`].
14725    pub proofs: Vec<Reference<DataIntegrityProof>>,
14726    /// See [`Object::interaction_policy`].
14727    pub interaction_policy: Option<Box<InteractionPolicy>>,
14728    /// See [`Object::approved_by`].
14729    pub approved_by: Option<Iri>,
14730    /// See [`Object::like_authorization`].
14731    pub like_authorization: Option<Reference<LikeAuthorization>>,
14732    /// See [`Object::reply_authorization`].
14733    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
14734    /// See [`Object::announce_authorization`].
14735    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
14736    /// See [`Object::translations`].
14737    pub translations: Vec<Translation>,
14738    /// See [`Activity::actors`].
14739    pub actors: Vec<AnyActor>,
14740    /// See [`Activity::objects`].
14741    pub objects: Vec<AnyObject>,
14742    /// See [`Activity::targets`].
14743    pub targets: Vec<AnyObject>,
14744    /// See [`Activity::results`].
14745    pub results: Vec<AnyObject>,
14746    /// See [`Activity::origins`].
14747    pub origins: Vec<AnyObject>,
14748    /// See [`Activity::instruments`].
14749    pub instruments: Vec<AnyObject>,
14750}
14751
14752impl Read {
14753    /// The type's IRI.
14754    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Read";
14755    /// The type's `type` in a normalised document.
14756    pub const TYPE: &'static str = "Read";
14757}
14758
14759impl json::Typed for Read {
14760    const TYPE: &'static str = "Read";
14761}
14762
14763impl FromJson for Read {
14764    fn from_json(value: &Value) -> Result<Self, JsonError> {
14765        let object = json::object(value)?;
14766        json::expect_type(object, Self::TYPE)?;
14767        Ok(Self {
14768            id: json::id(object),
14769            attachments: json::many(object, &["attachment"]),
14770            attributions: json::many(object, &["attributedTo"]),
14771            audiences: json::many(object, &["audience"]),
14772            content: json::text(object, "content"),
14773            contexts: json::many(object, &["context"]),
14774            name: json::text(object, "name"),
14775            end_time: json::one(object, &["endTime"]),
14776            generators: json::many(object, &["generator"]),
14777            icons: json::many_mapped(object, &["icon"], json::link_to_image),
14778            images: json::many_mapped(object, &["image"], json::link_to_image),
14779            reply_targets: json::many(object, &["inReplyTo"]),
14780            locations: json::many(object, &["location"]),
14781            previews: json::many(object, &["preview"]),
14782            published: json::one(object, &["published"]),
14783            replies: json::one(object, &["replies"]),
14784            shares: json::one(object, &["shares"]),
14785            likes: json::one(object, &["likes"]),
14786            emoji_reactions: json::one(object, &["emojiReactions"]),
14787            start_time: json::one(object, &["startTime"]),
14788            summary: json::text(object, "summary"),
14789            tags: json::many(object, &["tag"]),
14790            updated: json::one(object, &["updated"]),
14791            urls: json::many(object, &["url"]),
14792            tos: json::many(object, &["to"]),
14793            btos: json::many(object, &["bto"]),
14794            ccs: json::many(object, &["cc"]),
14795            bccs: json::many(object, &["bcc"]),
14796            media_type: json::one(object, &["mediaType"]),
14797            duration: json::one(object, &["duration"]),
14798            sensitive: json::one(object, &["sensitive"]),
14799            source: json::one(object, &["source"]),
14800            proofs: json::many(object, &["proof"]),
14801            interaction_policy: json::one(object, &["interactionPolicy"]),
14802            approved_by: json::one(object, &["approvedBy"]),
14803            like_authorization: json::one(object, &["likeAuthorization"]),
14804            reply_authorization: json::one(object, &["replyAuthorization"]),
14805            announce_authorization: json::one(object, &["announceAuthorization"]),
14806            translations: json::many(object, &["translations"]),
14807            actors: json::many(object, &["actor"]),
14808            objects: json::many(object, &["object"]),
14809            targets: json::many(object, &["target"]),
14810            results: json::many(object, &["result"]),
14811            origins: json::many(object, &["origin"]),
14812            instruments: json::many(object, &["instrument"]),
14813        })
14814    }
14815}
14816
14817impl ToJson for Read {
14818    fn to_json(&self) -> Value {
14819        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
14820        json::put_many(&mut object, &["attachment"], &self.attachments);
14821        json::put_many(&mut object, &["attributedTo"], &self.attributions);
14822        json::put_many(&mut object, &["audience"], &self.audiences);
14823        json::put_text(&mut object, "content", &self.content);
14824        json::put_many(&mut object, &["context"], &self.contexts);
14825        json::put_text(&mut object, "name", &self.name);
14826        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
14827        json::put_many(&mut object, &["generator"], &self.generators);
14828        json::put_many(&mut object, &["icon"], &self.icons);
14829        json::put_many(&mut object, &["image"], &self.images);
14830        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
14831        json::put_many(&mut object, &["location"], &self.locations);
14832        json::put_many(&mut object, &["preview"], &self.previews);
14833        json::put_one(&mut object, &["published"], self.published.as_ref());
14834        json::put_one(&mut object, &["replies"], self.replies.as_ref());
14835        json::put_one(&mut object, &["shares"], self.shares.as_ref());
14836        json::put_one(&mut object, &["likes"], self.likes.as_ref());
14837        json::put_one(
14838            &mut object,
14839            &["emojiReactions"],
14840            self.emoji_reactions.as_ref(),
14841        );
14842        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
14843        json::put_text(&mut object, "summary", &self.summary);
14844        json::put_many(&mut object, &["tag"], &self.tags);
14845        json::put_one(&mut object, &["updated"], self.updated.as_ref());
14846        json::put_many(&mut object, &["url"], &self.urls);
14847        json::put_many(&mut object, &["to"], &self.tos);
14848        json::put_many(&mut object, &["bto"], &self.btos);
14849        json::put_many(&mut object, &["cc"], &self.ccs);
14850        json::put_many(&mut object, &["bcc"], &self.bccs);
14851        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
14852        json::put_one(&mut object, &["duration"], self.duration.as_ref());
14853        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
14854        json::put_one(&mut object, &["source"], self.source.as_ref());
14855        json::put_many(&mut object, &["proof"], &self.proofs);
14856        json::put_one(
14857            &mut object,
14858            &["interactionPolicy"],
14859            self.interaction_policy.as_ref(),
14860        );
14861        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
14862        json::put_one(
14863            &mut object,
14864            &["likeAuthorization"],
14865            self.like_authorization.as_ref(),
14866        );
14867        json::put_one(
14868            &mut object,
14869            &["replyAuthorization"],
14870            self.reply_authorization.as_ref(),
14871        );
14872        json::put_one(
14873            &mut object,
14874            &["announceAuthorization"],
14875            self.announce_authorization.as_ref(),
14876        );
14877        json::put_many(&mut object, &["translations"], &self.translations);
14878        json::put_many(&mut object, &["actor"], &self.actors);
14879        json::put_many(&mut object, &["object"], &self.objects);
14880        json::put_many(&mut object, &["target"], &self.targets);
14881        json::put_many(&mut object, &["result"], &self.results);
14882        json::put_many(&mut object, &["origin"], &self.origins);
14883        json::put_many(&mut object, &["instrument"], &self.instruments);
14884        Value::Object(object)
14885    }
14886}
14887
14888/// Indicates that the `actor` is rejecting the `object`.  The `target` and
14889/// `origin` typically have no defined meaning.
14890///
14891/// The type `https://www.w3.org/ns/activitystreams#Reject`.
14892#[derive(Clone, Debug, Default, PartialEq)]
14893pub struct Reject {
14894    /// The IRI that identifies this object.
14895    pub id: Option<Iri>,
14896    /// See [`Object::attachments`].
14897    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
14898    /// See [`Object::attributions`].
14899    pub attributions: Vec<AnyActor>,
14900    /// See [`Object::audiences`].
14901    pub audiences: Vec<AnyObject>,
14902    /// See [`Object::content`].
14903    pub content: Text,
14904    /// See [`Object::contexts`].
14905    pub contexts: Vec<LinkOrObject>,
14906    /// See [`Object::name`].
14907    pub name: Text,
14908    /// See [`Object::end_time`].
14909    pub end_time: Option<String>,
14910    /// See [`Object::generators`].
14911    pub generators: Vec<LinkOrObject>,
14912    /// See [`Object::icons`].
14913    pub icons: Vec<Reference<Image>>,
14914    /// See [`Object::images`].
14915    pub images: Vec<Reference<Image>>,
14916    /// See [`Object::reply_targets`].
14917    pub reply_targets: Vec<LinkOrObject>,
14918    /// See [`Object::locations`].
14919    pub locations: Vec<LinkOrObject>,
14920    /// See [`Object::previews`].
14921    pub previews: Vec<LinkOrObject>,
14922    /// See [`Object::published`].
14923    pub published: Option<String>,
14924    /// See [`Object::replies`].
14925    pub replies: Option<AnyCollection>,
14926    /// See [`Object::shares`].
14927    pub shares: Option<AnyCollection>,
14928    /// See [`Object::likes`].
14929    pub likes: Option<AnyCollection>,
14930    /// See [`Object::emoji_reactions`].
14931    pub emoji_reactions: Option<AnyCollection>,
14932    /// See [`Object::start_time`].
14933    pub start_time: Option<String>,
14934    /// See [`Object::summary`].
14935    pub summary: Text,
14936    /// See [`Object::tags`].
14937    pub tags: Vec<LinkOrObject>,
14938    /// See [`Object::updated`].
14939    pub updated: Option<String>,
14940    /// See [`Object::urls`].
14941    pub urls: Vec<LinkOrIri>,
14942    /// See [`Object::tos`].
14943    pub tos: Vec<AnyObject>,
14944    /// See [`Object::btos`].
14945    pub btos: Vec<AnyObject>,
14946    /// See [`Object::ccs`].
14947    pub ccs: Vec<AnyObject>,
14948    /// See [`Object::bccs`].
14949    pub bccs: Vec<AnyObject>,
14950    /// See [`Object::media_type`].
14951    pub media_type: Option<String>,
14952    /// See [`Object::duration`].
14953    pub duration: Option<String>,
14954    /// See [`Object::sensitive`].
14955    pub sensitive: Option<bool>,
14956    /// See [`Object::source`].
14957    pub source: Option<Box<Source>>,
14958    /// See [`Object::proofs`].
14959    pub proofs: Vec<Reference<DataIntegrityProof>>,
14960    /// See [`Object::interaction_policy`].
14961    pub interaction_policy: Option<Box<InteractionPolicy>>,
14962    /// See [`Object::approved_by`].
14963    pub approved_by: Option<Iri>,
14964    /// See [`Object::like_authorization`].
14965    pub like_authorization: Option<Reference<LikeAuthorization>>,
14966    /// See [`Object::reply_authorization`].
14967    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
14968    /// See [`Object::announce_authorization`].
14969    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
14970    /// See [`Object::translations`].
14971    pub translations: Vec<Translation>,
14972    /// See [`Activity::actors`].
14973    pub actors: Vec<AnyActor>,
14974    /// See [`Activity::objects`].
14975    pub objects: Vec<AnyObject>,
14976    /// See [`Activity::targets`].
14977    pub targets: Vec<AnyObject>,
14978    /// See [`Activity::results`].
14979    pub results: Vec<AnyObject>,
14980    /// See [`Activity::origins`].
14981    pub origins: Vec<AnyObject>,
14982    /// See [`Activity::instruments`].
14983    pub instruments: Vec<AnyObject>,
14984}
14985
14986impl Reject {
14987    /// The type's IRI.
14988    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Reject";
14989    /// The type's `type` in a normalised document.
14990    pub const TYPE: &'static str = "Reject";
14991}
14992
14993impl json::Typed for Reject {
14994    const TYPE: &'static str = "Reject";
14995}
14996
14997impl FromJson for Reject {
14998    fn from_json(value: &Value) -> Result<Self, JsonError> {
14999        let object = json::object(value)?;
15000        json::expect_type(object, Self::TYPE)?;
15001        Ok(Self {
15002            id: json::id(object),
15003            attachments: json::many(object, &["attachment"]),
15004            attributions: json::many(object, &["attributedTo"]),
15005            audiences: json::many(object, &["audience"]),
15006            content: json::text(object, "content"),
15007            contexts: json::many(object, &["context"]),
15008            name: json::text(object, "name"),
15009            end_time: json::one(object, &["endTime"]),
15010            generators: json::many(object, &["generator"]),
15011            icons: json::many_mapped(object, &["icon"], json::link_to_image),
15012            images: json::many_mapped(object, &["image"], json::link_to_image),
15013            reply_targets: json::many(object, &["inReplyTo"]),
15014            locations: json::many(object, &["location"]),
15015            previews: json::many(object, &["preview"]),
15016            published: json::one(object, &["published"]),
15017            replies: json::one(object, &["replies"]),
15018            shares: json::one(object, &["shares"]),
15019            likes: json::one(object, &["likes"]),
15020            emoji_reactions: json::one(object, &["emojiReactions"]),
15021            start_time: json::one(object, &["startTime"]),
15022            summary: json::text(object, "summary"),
15023            tags: json::many(object, &["tag"]),
15024            updated: json::one(object, &["updated"]),
15025            urls: json::many(object, &["url"]),
15026            tos: json::many(object, &["to"]),
15027            btos: json::many(object, &["bto"]),
15028            ccs: json::many(object, &["cc"]),
15029            bccs: json::many(object, &["bcc"]),
15030            media_type: json::one(object, &["mediaType"]),
15031            duration: json::one(object, &["duration"]),
15032            sensitive: json::one(object, &["sensitive"]),
15033            source: json::one(object, &["source"]),
15034            proofs: json::many(object, &["proof"]),
15035            interaction_policy: json::one(object, &["interactionPolicy"]),
15036            approved_by: json::one(object, &["approvedBy"]),
15037            like_authorization: json::one(object, &["likeAuthorization"]),
15038            reply_authorization: json::one(object, &["replyAuthorization"]),
15039            announce_authorization: json::one(object, &["announceAuthorization"]),
15040            translations: json::many(object, &["translations"]),
15041            actors: json::many(object, &["actor"]),
15042            objects: json::many(object, &["object"]),
15043            targets: json::many(object, &["target"]),
15044            results: json::many(object, &["result"]),
15045            origins: json::many(object, &["origin"]),
15046            instruments: json::many(object, &["instrument"]),
15047        })
15048    }
15049}
15050
15051impl ToJson for Reject {
15052    fn to_json(&self) -> Value {
15053        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
15054        json::put_many(&mut object, &["attachment"], &self.attachments);
15055        json::put_many(&mut object, &["attributedTo"], &self.attributions);
15056        json::put_many(&mut object, &["audience"], &self.audiences);
15057        json::put_text(&mut object, "content", &self.content);
15058        json::put_many(&mut object, &["context"], &self.contexts);
15059        json::put_text(&mut object, "name", &self.name);
15060        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
15061        json::put_many(&mut object, &["generator"], &self.generators);
15062        json::put_many(&mut object, &["icon"], &self.icons);
15063        json::put_many(&mut object, &["image"], &self.images);
15064        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
15065        json::put_many(&mut object, &["location"], &self.locations);
15066        json::put_many(&mut object, &["preview"], &self.previews);
15067        json::put_one(&mut object, &["published"], self.published.as_ref());
15068        json::put_one(&mut object, &["replies"], self.replies.as_ref());
15069        json::put_one(&mut object, &["shares"], self.shares.as_ref());
15070        json::put_one(&mut object, &["likes"], self.likes.as_ref());
15071        json::put_one(
15072            &mut object,
15073            &["emojiReactions"],
15074            self.emoji_reactions.as_ref(),
15075        );
15076        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
15077        json::put_text(&mut object, "summary", &self.summary);
15078        json::put_many(&mut object, &["tag"], &self.tags);
15079        json::put_one(&mut object, &["updated"], self.updated.as_ref());
15080        json::put_many(&mut object, &["url"], &self.urls);
15081        json::put_many(&mut object, &["to"], &self.tos);
15082        json::put_many(&mut object, &["bto"], &self.btos);
15083        json::put_many(&mut object, &["cc"], &self.ccs);
15084        json::put_many(&mut object, &["bcc"], &self.bccs);
15085        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
15086        json::put_one(&mut object, &["duration"], self.duration.as_ref());
15087        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
15088        json::put_one(&mut object, &["source"], self.source.as_ref());
15089        json::put_many(&mut object, &["proof"], &self.proofs);
15090        json::put_one(
15091            &mut object,
15092            &["interactionPolicy"],
15093            self.interaction_policy.as_ref(),
15094        );
15095        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
15096        json::put_one(
15097            &mut object,
15098            &["likeAuthorization"],
15099            self.like_authorization.as_ref(),
15100        );
15101        json::put_one(
15102            &mut object,
15103            &["replyAuthorization"],
15104            self.reply_authorization.as_ref(),
15105        );
15106        json::put_one(
15107            &mut object,
15108            &["announceAuthorization"],
15109            self.announce_authorization.as_ref(),
15110        );
15111        json::put_many(&mut object, &["translations"], &self.translations);
15112        json::put_many(&mut object, &["actor"], &self.actors);
15113        json::put_many(&mut object, &["object"], &self.objects);
15114        json::put_many(&mut object, &["target"], &self.targets);
15115        json::put_many(&mut object, &["result"], &self.results);
15116        json::put_many(&mut object, &["origin"], &self.origins);
15117        json::put_many(&mut object, &["instrument"], &self.instruments);
15118        Value::Object(object)
15119    }
15120}
15121
15122/// Describes a relationship between two individuals.
15123/// The {@link Relationship.subject} and {@link Relationship.object} properties
15124/// are used to identify the connected individuals.
15125///
15126/// The type `https://www.w3.org/ns/activitystreams#Relationship`.
15127#[derive(Clone, Debug, Default, PartialEq)]
15128pub struct Relationship {
15129    /// The IRI that identifies this object.
15130    pub id: Option<Iri>,
15131    /// See [`Object::attachments`].
15132    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
15133    /// See [`Object::attributions`].
15134    pub attributions: Vec<AnyActor>,
15135    /// See [`Object::audiences`].
15136    pub audiences: Vec<AnyObject>,
15137    /// See [`Object::content`].
15138    pub content: Text,
15139    /// See [`Object::contexts`].
15140    pub contexts: Vec<LinkOrObject>,
15141    /// See [`Object::name`].
15142    pub name: Text,
15143    /// See [`Object::end_time`].
15144    pub end_time: Option<String>,
15145    /// See [`Object::generators`].
15146    pub generators: Vec<LinkOrObject>,
15147    /// See [`Object::icons`].
15148    pub icons: Vec<Reference<Image>>,
15149    /// See [`Object::images`].
15150    pub images: Vec<Reference<Image>>,
15151    /// See [`Object::reply_targets`].
15152    pub reply_targets: Vec<LinkOrObject>,
15153    /// See [`Object::locations`].
15154    pub locations: Vec<LinkOrObject>,
15155    /// See [`Object::previews`].
15156    pub previews: Vec<LinkOrObject>,
15157    /// See [`Object::published`].
15158    pub published: Option<String>,
15159    /// See [`Object::replies`].
15160    pub replies: Option<AnyCollection>,
15161    /// See [`Object::shares`].
15162    pub shares: Option<AnyCollection>,
15163    /// See [`Object::likes`].
15164    pub likes: Option<AnyCollection>,
15165    /// See [`Object::emoji_reactions`].
15166    pub emoji_reactions: Option<AnyCollection>,
15167    /// See [`Object::start_time`].
15168    pub start_time: Option<String>,
15169    /// See [`Object::summary`].
15170    pub summary: Text,
15171    /// See [`Object::tags`].
15172    pub tags: Vec<LinkOrObject>,
15173    /// See [`Object::updated`].
15174    pub updated: Option<String>,
15175    /// See [`Object::urls`].
15176    pub urls: Vec<LinkOrIri>,
15177    /// See [`Object::tos`].
15178    pub tos: Vec<AnyObject>,
15179    /// See [`Object::btos`].
15180    pub btos: Vec<AnyObject>,
15181    /// See [`Object::ccs`].
15182    pub ccs: Vec<AnyObject>,
15183    /// See [`Object::bccs`].
15184    pub bccs: Vec<AnyObject>,
15185    /// See [`Object::media_type`].
15186    pub media_type: Option<String>,
15187    /// See [`Object::duration`].
15188    pub duration: Option<String>,
15189    /// See [`Object::sensitive`].
15190    pub sensitive: Option<bool>,
15191    /// See [`Object::source`].
15192    pub source: Option<Box<Source>>,
15193    /// See [`Object::proofs`].
15194    pub proofs: Vec<Reference<DataIntegrityProof>>,
15195    /// See [`Object::interaction_policy`].
15196    pub interaction_policy: Option<Box<InteractionPolicy>>,
15197    /// See [`Object::approved_by`].
15198    pub approved_by: Option<Iri>,
15199    /// See [`Object::like_authorization`].
15200    pub like_authorization: Option<Reference<LikeAuthorization>>,
15201    /// See [`Object::reply_authorization`].
15202    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
15203    /// See [`Object::announce_authorization`].
15204    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
15205    /// See [`Object::translations`].
15206    pub translations: Vec<Translation>,
15207    /// On a {@link Relationship} object, the {@link Relationship.subject} property
15208    /// identifies one of the connected individuals.  For instance,
15209    /// for a {@link Relationship} object describing "John is related to Sally",
15210    /// the {@link Relationship.subject} property would refer to John.
15211    pub subject: Option<AnyObject>,
15212    /// Describes the entity to which the {@link Relationship.subject} is related.
15213    pub objects: Vec<AnyObject>,
15214    /// On a {@link Relationship} object, the {@link Relationship.relationship}
15215    /// property identifies the kind of relationship that exists between
15216    /// {@link Relationship.subject} and {@link Relationship.object}.
15217    pub relationships: Vec<AnyObject>,
15218}
15219
15220impl Relationship {
15221    /// The type's IRI.
15222    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Relationship";
15223    /// The type's `type` in a normalised document.
15224    pub const TYPE: &'static str = "Relationship";
15225}
15226
15227impl json::Typed for Relationship {
15228    const TYPE: &'static str = "Relationship";
15229}
15230
15231impl FromJson for Relationship {
15232    fn from_json(value: &Value) -> Result<Self, JsonError> {
15233        let object = json::object(value)?;
15234        json::expect_type(object, Self::TYPE)?;
15235        Ok(Self {
15236            id: json::id(object),
15237            attachments: json::many(object, &["attachment"]),
15238            attributions: json::many(object, &["attributedTo"]),
15239            audiences: json::many(object, &["audience"]),
15240            content: json::text(object, "content"),
15241            contexts: json::many(object, &["context"]),
15242            name: json::text(object, "name"),
15243            end_time: json::one(object, &["endTime"]),
15244            generators: json::many(object, &["generator"]),
15245            icons: json::many_mapped(object, &["icon"], json::link_to_image),
15246            images: json::many_mapped(object, &["image"], json::link_to_image),
15247            reply_targets: json::many(object, &["inReplyTo"]),
15248            locations: json::many(object, &["location"]),
15249            previews: json::many(object, &["preview"]),
15250            published: json::one(object, &["published"]),
15251            replies: json::one(object, &["replies"]),
15252            shares: json::one(object, &["shares"]),
15253            likes: json::one(object, &["likes"]),
15254            emoji_reactions: json::one(object, &["emojiReactions"]),
15255            start_time: json::one(object, &["startTime"]),
15256            summary: json::text(object, "summary"),
15257            tags: json::many(object, &["tag"]),
15258            updated: json::one(object, &["updated"]),
15259            urls: json::many(object, &["url"]),
15260            tos: json::many(object, &["to"]),
15261            btos: json::many(object, &["bto"]),
15262            ccs: json::many(object, &["cc"]),
15263            bccs: json::many(object, &["bcc"]),
15264            media_type: json::one(object, &["mediaType"]),
15265            duration: json::one(object, &["duration"]),
15266            sensitive: json::one(object, &["sensitive"]),
15267            source: json::one(object, &["source"]),
15268            proofs: json::many(object, &["proof"]),
15269            interaction_policy: json::one(object, &["interactionPolicy"]),
15270            approved_by: json::one(object, &["approvedBy"]),
15271            like_authorization: json::one(object, &["likeAuthorization"]),
15272            reply_authorization: json::one(object, &["replyAuthorization"]),
15273            announce_authorization: json::one(object, &["announceAuthorization"]),
15274            translations: json::many(object, &["translations"]),
15275            subject: json::one(object, &["subject"]),
15276            objects: json::many(object, &["object"]),
15277            relationships: json::many(object, &["relationship"]),
15278        })
15279    }
15280}
15281
15282impl ToJson for Relationship {
15283    fn to_json(&self) -> Value {
15284        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
15285        json::put_many(&mut object, &["attachment"], &self.attachments);
15286        json::put_many(&mut object, &["attributedTo"], &self.attributions);
15287        json::put_many(&mut object, &["audience"], &self.audiences);
15288        json::put_text(&mut object, "content", &self.content);
15289        json::put_many(&mut object, &["context"], &self.contexts);
15290        json::put_text(&mut object, "name", &self.name);
15291        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
15292        json::put_many(&mut object, &["generator"], &self.generators);
15293        json::put_many(&mut object, &["icon"], &self.icons);
15294        json::put_many(&mut object, &["image"], &self.images);
15295        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
15296        json::put_many(&mut object, &["location"], &self.locations);
15297        json::put_many(&mut object, &["preview"], &self.previews);
15298        json::put_one(&mut object, &["published"], self.published.as_ref());
15299        json::put_one(&mut object, &["replies"], self.replies.as_ref());
15300        json::put_one(&mut object, &["shares"], self.shares.as_ref());
15301        json::put_one(&mut object, &["likes"], self.likes.as_ref());
15302        json::put_one(
15303            &mut object,
15304            &["emojiReactions"],
15305            self.emoji_reactions.as_ref(),
15306        );
15307        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
15308        json::put_text(&mut object, "summary", &self.summary);
15309        json::put_many(&mut object, &["tag"], &self.tags);
15310        json::put_one(&mut object, &["updated"], self.updated.as_ref());
15311        json::put_many(&mut object, &["url"], &self.urls);
15312        json::put_many(&mut object, &["to"], &self.tos);
15313        json::put_many(&mut object, &["bto"], &self.btos);
15314        json::put_many(&mut object, &["cc"], &self.ccs);
15315        json::put_many(&mut object, &["bcc"], &self.bccs);
15316        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
15317        json::put_one(&mut object, &["duration"], self.duration.as_ref());
15318        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
15319        json::put_one(&mut object, &["source"], self.source.as_ref());
15320        json::put_many(&mut object, &["proof"], &self.proofs);
15321        json::put_one(
15322            &mut object,
15323            &["interactionPolicy"],
15324            self.interaction_policy.as_ref(),
15325        );
15326        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
15327        json::put_one(
15328            &mut object,
15329            &["likeAuthorization"],
15330            self.like_authorization.as_ref(),
15331        );
15332        json::put_one(
15333            &mut object,
15334            &["replyAuthorization"],
15335            self.reply_authorization.as_ref(),
15336        );
15337        json::put_one(
15338            &mut object,
15339            &["announceAuthorization"],
15340            self.announce_authorization.as_ref(),
15341        );
15342        json::put_many(&mut object, &["translations"], &self.translations);
15343        json::put_one(&mut object, &["subject"], self.subject.as_ref());
15344        json::put_many(&mut object, &["object"], &self.objects);
15345        json::put_many(&mut object, &["relationship"], &self.relationships);
15346        Value::Object(object)
15347    }
15348}
15349
15350/// Indicates that the `actor` is removing the `object`.  If specified,
15351/// the `origin` indicates the context from which the `object` is being removed.
15352///
15353/// The type `https://www.w3.org/ns/activitystreams#Remove`.
15354#[derive(Clone, Debug, Default, PartialEq)]
15355pub struct Remove {
15356    /// The IRI that identifies this object.
15357    pub id: Option<Iri>,
15358    /// See [`Object::attachments`].
15359    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
15360    /// See [`Object::attributions`].
15361    pub attributions: Vec<AnyActor>,
15362    /// See [`Object::audiences`].
15363    pub audiences: Vec<AnyObject>,
15364    /// See [`Object::content`].
15365    pub content: Text,
15366    /// See [`Object::contexts`].
15367    pub contexts: Vec<LinkOrObject>,
15368    /// See [`Object::name`].
15369    pub name: Text,
15370    /// See [`Object::end_time`].
15371    pub end_time: Option<String>,
15372    /// See [`Object::generators`].
15373    pub generators: Vec<LinkOrObject>,
15374    /// See [`Object::icons`].
15375    pub icons: Vec<Reference<Image>>,
15376    /// See [`Object::images`].
15377    pub images: Vec<Reference<Image>>,
15378    /// See [`Object::reply_targets`].
15379    pub reply_targets: Vec<LinkOrObject>,
15380    /// See [`Object::locations`].
15381    pub locations: Vec<LinkOrObject>,
15382    /// See [`Object::previews`].
15383    pub previews: Vec<LinkOrObject>,
15384    /// See [`Object::published`].
15385    pub published: Option<String>,
15386    /// See [`Object::replies`].
15387    pub replies: Option<AnyCollection>,
15388    /// See [`Object::shares`].
15389    pub shares: Option<AnyCollection>,
15390    /// See [`Object::likes`].
15391    pub likes: Option<AnyCollection>,
15392    /// See [`Object::emoji_reactions`].
15393    pub emoji_reactions: Option<AnyCollection>,
15394    /// See [`Object::start_time`].
15395    pub start_time: Option<String>,
15396    /// See [`Object::summary`].
15397    pub summary: Text,
15398    /// See [`Object::tags`].
15399    pub tags: Vec<LinkOrObject>,
15400    /// See [`Object::updated`].
15401    pub updated: Option<String>,
15402    /// See [`Object::urls`].
15403    pub urls: Vec<LinkOrIri>,
15404    /// See [`Object::tos`].
15405    pub tos: Vec<AnyObject>,
15406    /// See [`Object::btos`].
15407    pub btos: Vec<AnyObject>,
15408    /// See [`Object::ccs`].
15409    pub ccs: Vec<AnyObject>,
15410    /// See [`Object::bccs`].
15411    pub bccs: Vec<AnyObject>,
15412    /// See [`Object::media_type`].
15413    pub media_type: Option<String>,
15414    /// See [`Object::duration`].
15415    pub duration: Option<String>,
15416    /// See [`Object::sensitive`].
15417    pub sensitive: Option<bool>,
15418    /// See [`Object::source`].
15419    pub source: Option<Box<Source>>,
15420    /// See [`Object::proofs`].
15421    pub proofs: Vec<Reference<DataIntegrityProof>>,
15422    /// See [`Object::interaction_policy`].
15423    pub interaction_policy: Option<Box<InteractionPolicy>>,
15424    /// See [`Object::approved_by`].
15425    pub approved_by: Option<Iri>,
15426    /// See [`Object::like_authorization`].
15427    pub like_authorization: Option<Reference<LikeAuthorization>>,
15428    /// See [`Object::reply_authorization`].
15429    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
15430    /// See [`Object::announce_authorization`].
15431    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
15432    /// See [`Object::translations`].
15433    pub translations: Vec<Translation>,
15434    /// See [`Activity::actors`].
15435    pub actors: Vec<AnyActor>,
15436    /// See [`Activity::objects`].
15437    pub objects: Vec<AnyObject>,
15438    /// See [`Activity::targets`].
15439    pub targets: Vec<AnyObject>,
15440    /// See [`Activity::results`].
15441    pub results: Vec<AnyObject>,
15442    /// See [`Activity::origins`].
15443    pub origins: Vec<AnyObject>,
15444    /// See [`Activity::instruments`].
15445    pub instruments: Vec<AnyObject>,
15446}
15447
15448impl Remove {
15449    /// The type's IRI.
15450    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Remove";
15451    /// The type's `type` in a normalised document.
15452    pub const TYPE: &'static str = "Remove";
15453}
15454
15455impl json::Typed for Remove {
15456    const TYPE: &'static str = "Remove";
15457}
15458
15459impl FromJson for Remove {
15460    fn from_json(value: &Value) -> Result<Self, JsonError> {
15461        let object = json::object(value)?;
15462        json::expect_type(object, Self::TYPE)?;
15463        Ok(Self {
15464            id: json::id(object),
15465            attachments: json::many(object, &["attachment"]),
15466            attributions: json::many(object, &["attributedTo"]),
15467            audiences: json::many(object, &["audience"]),
15468            content: json::text(object, "content"),
15469            contexts: json::many(object, &["context"]),
15470            name: json::text(object, "name"),
15471            end_time: json::one(object, &["endTime"]),
15472            generators: json::many(object, &["generator"]),
15473            icons: json::many_mapped(object, &["icon"], json::link_to_image),
15474            images: json::many_mapped(object, &["image"], json::link_to_image),
15475            reply_targets: json::many(object, &["inReplyTo"]),
15476            locations: json::many(object, &["location"]),
15477            previews: json::many(object, &["preview"]),
15478            published: json::one(object, &["published"]),
15479            replies: json::one(object, &["replies"]),
15480            shares: json::one(object, &["shares"]),
15481            likes: json::one(object, &["likes"]),
15482            emoji_reactions: json::one(object, &["emojiReactions"]),
15483            start_time: json::one(object, &["startTime"]),
15484            summary: json::text(object, "summary"),
15485            tags: json::many(object, &["tag"]),
15486            updated: json::one(object, &["updated"]),
15487            urls: json::many(object, &["url"]),
15488            tos: json::many(object, &["to"]),
15489            btos: json::many(object, &["bto"]),
15490            ccs: json::many(object, &["cc"]),
15491            bccs: json::many(object, &["bcc"]),
15492            media_type: json::one(object, &["mediaType"]),
15493            duration: json::one(object, &["duration"]),
15494            sensitive: json::one(object, &["sensitive"]),
15495            source: json::one(object, &["source"]),
15496            proofs: json::many(object, &["proof"]),
15497            interaction_policy: json::one(object, &["interactionPolicy"]),
15498            approved_by: json::one(object, &["approvedBy"]),
15499            like_authorization: json::one(object, &["likeAuthorization"]),
15500            reply_authorization: json::one(object, &["replyAuthorization"]),
15501            announce_authorization: json::one(object, &["announceAuthorization"]),
15502            translations: json::many(object, &["translations"]),
15503            actors: json::many(object, &["actor"]),
15504            objects: json::many(object, &["object"]),
15505            targets: json::many(object, &["target"]),
15506            results: json::many(object, &["result"]),
15507            origins: json::many(object, &["origin"]),
15508            instruments: json::many(object, &["instrument"]),
15509        })
15510    }
15511}
15512
15513impl ToJson for Remove {
15514    fn to_json(&self) -> Value {
15515        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
15516        json::put_many(&mut object, &["attachment"], &self.attachments);
15517        json::put_many(&mut object, &["attributedTo"], &self.attributions);
15518        json::put_many(&mut object, &["audience"], &self.audiences);
15519        json::put_text(&mut object, "content", &self.content);
15520        json::put_many(&mut object, &["context"], &self.contexts);
15521        json::put_text(&mut object, "name", &self.name);
15522        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
15523        json::put_many(&mut object, &["generator"], &self.generators);
15524        json::put_many(&mut object, &["icon"], &self.icons);
15525        json::put_many(&mut object, &["image"], &self.images);
15526        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
15527        json::put_many(&mut object, &["location"], &self.locations);
15528        json::put_many(&mut object, &["preview"], &self.previews);
15529        json::put_one(&mut object, &["published"], self.published.as_ref());
15530        json::put_one(&mut object, &["replies"], self.replies.as_ref());
15531        json::put_one(&mut object, &["shares"], self.shares.as_ref());
15532        json::put_one(&mut object, &["likes"], self.likes.as_ref());
15533        json::put_one(
15534            &mut object,
15535            &["emojiReactions"],
15536            self.emoji_reactions.as_ref(),
15537        );
15538        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
15539        json::put_text(&mut object, "summary", &self.summary);
15540        json::put_many(&mut object, &["tag"], &self.tags);
15541        json::put_one(&mut object, &["updated"], self.updated.as_ref());
15542        json::put_many(&mut object, &["url"], &self.urls);
15543        json::put_many(&mut object, &["to"], &self.tos);
15544        json::put_many(&mut object, &["bto"], &self.btos);
15545        json::put_many(&mut object, &["cc"], &self.ccs);
15546        json::put_many(&mut object, &["bcc"], &self.bccs);
15547        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
15548        json::put_one(&mut object, &["duration"], self.duration.as_ref());
15549        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
15550        json::put_one(&mut object, &["source"], self.source.as_ref());
15551        json::put_many(&mut object, &["proof"], &self.proofs);
15552        json::put_one(
15553            &mut object,
15554            &["interactionPolicy"],
15555            self.interaction_policy.as_ref(),
15556        );
15557        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
15558        json::put_one(
15559            &mut object,
15560            &["likeAuthorization"],
15561            self.like_authorization.as_ref(),
15562        );
15563        json::put_one(
15564            &mut object,
15565            &["replyAuthorization"],
15566            self.reply_authorization.as_ref(),
15567        );
15568        json::put_one(
15569            &mut object,
15570            &["announceAuthorization"],
15571            self.announce_authorization.as_ref(),
15572        );
15573        json::put_many(&mut object, &["translations"], &self.translations);
15574        json::put_many(&mut object, &["actor"], &self.actors);
15575        json::put_many(&mut object, &["object"], &self.objects);
15576        json::put_many(&mut object, &["target"], &self.targets);
15577        json::put_many(&mut object, &["result"], &self.results);
15578        json::put_many(&mut object, &["origin"], &self.origins);
15579        json::put_many(&mut object, &["instrument"], &self.instruments);
15580        Value::Object(object)
15581    }
15582}
15583
15584/// Proves that a reply interaction has been approved by the post author.
15585///
15586/// The type `https://gotosocial.org/ns#ReplyAuthorization`.
15587#[derive(Clone, Debug, Default, PartialEq)]
15588pub struct ReplyAuthorization {
15589    /// The IRI that identifies this object.
15590    pub id: Option<Iri>,
15591    /// See [`Object::attachments`].
15592    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
15593    /// See [`Object::attributions`].
15594    pub attributions: Vec<AnyActor>,
15595    /// See [`Object::audiences`].
15596    pub audiences: Vec<AnyObject>,
15597    /// See [`Object::content`].
15598    pub content: Text,
15599    /// See [`Object::contexts`].
15600    pub contexts: Vec<LinkOrObject>,
15601    /// See [`Object::name`].
15602    pub name: Text,
15603    /// See [`Object::end_time`].
15604    pub end_time: Option<String>,
15605    /// See [`Object::generators`].
15606    pub generators: Vec<LinkOrObject>,
15607    /// See [`Object::icons`].
15608    pub icons: Vec<Reference<Image>>,
15609    /// See [`Object::images`].
15610    pub images: Vec<Reference<Image>>,
15611    /// See [`Object::reply_targets`].
15612    pub reply_targets: Vec<LinkOrObject>,
15613    /// See [`Object::locations`].
15614    pub locations: Vec<LinkOrObject>,
15615    /// See [`Object::previews`].
15616    pub previews: Vec<LinkOrObject>,
15617    /// See [`Object::published`].
15618    pub published: Option<String>,
15619    /// See [`Object::replies`].
15620    pub replies: Option<AnyCollection>,
15621    /// See [`Object::shares`].
15622    pub shares: Option<AnyCollection>,
15623    /// See [`Object::likes`].
15624    pub likes: Option<AnyCollection>,
15625    /// See [`Object::emoji_reactions`].
15626    pub emoji_reactions: Option<AnyCollection>,
15627    /// See [`Object::start_time`].
15628    pub start_time: Option<String>,
15629    /// See [`Object::summary`].
15630    pub summary: Text,
15631    /// See [`Object::tags`].
15632    pub tags: Vec<LinkOrObject>,
15633    /// See [`Object::updated`].
15634    pub updated: Option<String>,
15635    /// See [`Object::urls`].
15636    pub urls: Vec<LinkOrIri>,
15637    /// See [`Object::tos`].
15638    pub tos: Vec<AnyObject>,
15639    /// See [`Object::btos`].
15640    pub btos: Vec<AnyObject>,
15641    /// See [`Object::ccs`].
15642    pub ccs: Vec<AnyObject>,
15643    /// See [`Object::bccs`].
15644    pub bccs: Vec<AnyObject>,
15645    /// See [`Object::media_type`].
15646    pub media_type: Option<String>,
15647    /// See [`Object::duration`].
15648    pub duration: Option<String>,
15649    /// See [`Object::sensitive`].
15650    pub sensitive: Option<bool>,
15651    /// See [`Object::source`].
15652    pub source: Option<Box<Source>>,
15653    /// See [`Object::proofs`].
15654    pub proofs: Vec<Reference<DataIntegrityProof>>,
15655    /// See [`Object::interaction_policy`].
15656    pub interaction_policy: Option<Box<InteractionPolicy>>,
15657    /// See [`Object::approved_by`].
15658    pub approved_by: Option<Iri>,
15659    /// See [`Object::like_authorization`].
15660    pub like_authorization: Option<Reference<LikeAuthorization>>,
15661    /// See [`Object::reply_authorization`].
15662    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
15663    /// See [`Object::announce_authorization`].
15664    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
15665    /// See [`Object::translations`].
15666    pub translations: Vec<Translation>,
15667    /// The URI of the reply object (e.g., a {@link Note}) that has been
15668    /// authorized.
15669    pub interacting_object: Option<AnyObject>,
15670    /// The URI of the post that is the target of the authorized reply.
15671    pub interaction_target: Option<AnyObject>,
15672}
15673
15674impl ReplyAuthorization {
15675    /// The type's IRI.
15676    pub const TYPE_IRI: &'static str = "https://gotosocial.org/ns#ReplyAuthorization";
15677    /// The type's `type` in a normalised document.
15678    pub const TYPE: &'static str = "ReplyAuthorization";
15679}
15680
15681impl json::Typed for ReplyAuthorization {
15682    const TYPE: &'static str = "ReplyAuthorization";
15683}
15684
15685impl FromJson for ReplyAuthorization {
15686    fn from_json(value: &Value) -> Result<Self, JsonError> {
15687        let object = json::object(value)?;
15688        json::expect_type(object, Self::TYPE)?;
15689        Ok(Self {
15690            id: json::id(object),
15691            attachments: json::many(object, &["attachment"]),
15692            attributions: json::many(object, &["attributedTo"]),
15693            audiences: json::many(object, &["audience"]),
15694            content: json::text(object, "content"),
15695            contexts: json::many(object, &["context"]),
15696            name: json::text(object, "name"),
15697            end_time: json::one(object, &["endTime"]),
15698            generators: json::many(object, &["generator"]),
15699            icons: json::many_mapped(object, &["icon"], json::link_to_image),
15700            images: json::many_mapped(object, &["image"], json::link_to_image),
15701            reply_targets: json::many(object, &["inReplyTo"]),
15702            locations: json::many(object, &["location"]),
15703            previews: json::many(object, &["preview"]),
15704            published: json::one(object, &["published"]),
15705            replies: json::one(object, &["replies"]),
15706            shares: json::one(object, &["shares"]),
15707            likes: json::one(object, &["likes"]),
15708            emoji_reactions: json::one(object, &["emojiReactions"]),
15709            start_time: json::one(object, &["startTime"]),
15710            summary: json::text(object, "summary"),
15711            tags: json::many(object, &["tag"]),
15712            updated: json::one(object, &["updated"]),
15713            urls: json::many(object, &["url"]),
15714            tos: json::many(object, &["to"]),
15715            btos: json::many(object, &["bto"]),
15716            ccs: json::many(object, &["cc"]),
15717            bccs: json::many(object, &["bcc"]),
15718            media_type: json::one(object, &["mediaType"]),
15719            duration: json::one(object, &["duration"]),
15720            sensitive: json::one(object, &["sensitive"]),
15721            source: json::one(object, &["source"]),
15722            proofs: json::many(object, &["proof"]),
15723            interaction_policy: json::one(object, &["interactionPolicy"]),
15724            approved_by: json::one(object, &["approvedBy"]),
15725            like_authorization: json::one(object, &["likeAuthorization"]),
15726            reply_authorization: json::one(object, &["replyAuthorization"]),
15727            announce_authorization: json::one(object, &["announceAuthorization"]),
15728            translations: json::many(object, &["translations"]),
15729            interacting_object: json::one(object, &["interactingObject"]),
15730            interaction_target: json::one(object, &["interactionTarget"]),
15731        })
15732    }
15733}
15734
15735impl ToJson for ReplyAuthorization {
15736    fn to_json(&self) -> Value {
15737        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
15738        json::put_many(&mut object, &["attachment"], &self.attachments);
15739        json::put_many(&mut object, &["attributedTo"], &self.attributions);
15740        json::put_many(&mut object, &["audience"], &self.audiences);
15741        json::put_text(&mut object, "content", &self.content);
15742        json::put_many(&mut object, &["context"], &self.contexts);
15743        json::put_text(&mut object, "name", &self.name);
15744        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
15745        json::put_many(&mut object, &["generator"], &self.generators);
15746        json::put_many(&mut object, &["icon"], &self.icons);
15747        json::put_many(&mut object, &["image"], &self.images);
15748        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
15749        json::put_many(&mut object, &["location"], &self.locations);
15750        json::put_many(&mut object, &["preview"], &self.previews);
15751        json::put_one(&mut object, &["published"], self.published.as_ref());
15752        json::put_one(&mut object, &["replies"], self.replies.as_ref());
15753        json::put_one(&mut object, &["shares"], self.shares.as_ref());
15754        json::put_one(&mut object, &["likes"], self.likes.as_ref());
15755        json::put_one(
15756            &mut object,
15757            &["emojiReactions"],
15758            self.emoji_reactions.as_ref(),
15759        );
15760        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
15761        json::put_text(&mut object, "summary", &self.summary);
15762        json::put_many(&mut object, &["tag"], &self.tags);
15763        json::put_one(&mut object, &["updated"], self.updated.as_ref());
15764        json::put_many(&mut object, &["url"], &self.urls);
15765        json::put_many(&mut object, &["to"], &self.tos);
15766        json::put_many(&mut object, &["bto"], &self.btos);
15767        json::put_many(&mut object, &["cc"], &self.ccs);
15768        json::put_many(&mut object, &["bcc"], &self.bccs);
15769        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
15770        json::put_one(&mut object, &["duration"], self.duration.as_ref());
15771        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
15772        json::put_one(&mut object, &["source"], self.source.as_ref());
15773        json::put_many(&mut object, &["proof"], &self.proofs);
15774        json::put_one(
15775            &mut object,
15776            &["interactionPolicy"],
15777            self.interaction_policy.as_ref(),
15778        );
15779        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
15780        json::put_one(
15781            &mut object,
15782            &["likeAuthorization"],
15783            self.like_authorization.as_ref(),
15784        );
15785        json::put_one(
15786            &mut object,
15787            &["replyAuthorization"],
15788            self.reply_authorization.as_ref(),
15789        );
15790        json::put_one(
15791            &mut object,
15792            &["announceAuthorization"],
15793            self.announce_authorization.as_ref(),
15794        );
15795        json::put_many(&mut object, &["translations"], &self.translations);
15796        json::put_one(
15797            &mut object,
15798            &["interactingObject"],
15799            self.interacting_object.as_ref(),
15800        );
15801        json::put_one(
15802            &mut object,
15803            &["interactionTarget"],
15804            self.interaction_target.as_ref(),
15805        );
15806        Value::Object(object)
15807    }
15808}
15809
15810/// A request to reply to a post that requires approval from the post author.
15811///
15812/// The type `https://gotosocial.org/ns#ReplyRequest`.
15813#[derive(Clone, Debug, Default, PartialEq)]
15814pub struct ReplyRequest {
15815    /// The IRI that identifies this object.
15816    pub id: Option<Iri>,
15817    /// See [`Object::attachments`].
15818    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
15819    /// See [`Object::attributions`].
15820    pub attributions: Vec<AnyActor>,
15821    /// See [`Object::audiences`].
15822    pub audiences: Vec<AnyObject>,
15823    /// See [`Object::content`].
15824    pub content: Text,
15825    /// See [`Object::contexts`].
15826    pub contexts: Vec<LinkOrObject>,
15827    /// See [`Object::name`].
15828    pub name: Text,
15829    /// See [`Object::end_time`].
15830    pub end_time: Option<String>,
15831    /// See [`Object::generators`].
15832    pub generators: Vec<LinkOrObject>,
15833    /// See [`Object::icons`].
15834    pub icons: Vec<Reference<Image>>,
15835    /// See [`Object::images`].
15836    pub images: Vec<Reference<Image>>,
15837    /// See [`Object::reply_targets`].
15838    pub reply_targets: Vec<LinkOrObject>,
15839    /// See [`Object::locations`].
15840    pub locations: Vec<LinkOrObject>,
15841    /// See [`Object::previews`].
15842    pub previews: Vec<LinkOrObject>,
15843    /// See [`Object::published`].
15844    pub published: Option<String>,
15845    /// See [`Object::replies`].
15846    pub replies: Option<AnyCollection>,
15847    /// See [`Object::shares`].
15848    pub shares: Option<AnyCollection>,
15849    /// See [`Object::likes`].
15850    pub likes: Option<AnyCollection>,
15851    /// See [`Object::emoji_reactions`].
15852    pub emoji_reactions: Option<AnyCollection>,
15853    /// See [`Object::start_time`].
15854    pub start_time: Option<String>,
15855    /// See [`Object::summary`].
15856    pub summary: Text,
15857    /// See [`Object::tags`].
15858    pub tags: Vec<LinkOrObject>,
15859    /// See [`Object::updated`].
15860    pub updated: Option<String>,
15861    /// See [`Object::urls`].
15862    pub urls: Vec<LinkOrIri>,
15863    /// See [`Object::tos`].
15864    pub tos: Vec<AnyObject>,
15865    /// See [`Object::btos`].
15866    pub btos: Vec<AnyObject>,
15867    /// See [`Object::ccs`].
15868    pub ccs: Vec<AnyObject>,
15869    /// See [`Object::bccs`].
15870    pub bccs: Vec<AnyObject>,
15871    /// See [`Object::media_type`].
15872    pub media_type: Option<String>,
15873    /// See [`Object::duration`].
15874    pub duration: Option<String>,
15875    /// See [`Object::sensitive`].
15876    pub sensitive: Option<bool>,
15877    /// See [`Object::source`].
15878    pub source: Option<Box<Source>>,
15879    /// See [`Object::proofs`].
15880    pub proofs: Vec<Reference<DataIntegrityProof>>,
15881    /// See [`Object::interaction_policy`].
15882    pub interaction_policy: Option<Box<InteractionPolicy>>,
15883    /// See [`Object::approved_by`].
15884    pub approved_by: Option<Iri>,
15885    /// See [`Object::like_authorization`].
15886    pub like_authorization: Option<Reference<LikeAuthorization>>,
15887    /// See [`Object::reply_authorization`].
15888    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
15889    /// See [`Object::announce_authorization`].
15890    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
15891    /// See [`Object::translations`].
15892    pub translations: Vec<Translation>,
15893    /// See [`Activity::actors`].
15894    pub actors: Vec<AnyActor>,
15895    /// See [`Activity::objects`].
15896    pub objects: Vec<AnyObject>,
15897    /// See [`Activity::targets`].
15898    pub targets: Vec<AnyObject>,
15899    /// See [`Activity::results`].
15900    pub results: Vec<AnyObject>,
15901    /// See [`Activity::origins`].
15902    pub origins: Vec<AnyObject>,
15903    /// See [`Activity::instruments`].
15904    pub instruments: Vec<AnyObject>,
15905}
15906
15907impl ReplyRequest {
15908    /// The type's IRI.
15909    pub const TYPE_IRI: &'static str = "https://gotosocial.org/ns#ReplyRequest";
15910    /// The type's `type` in a normalised document.
15911    pub const TYPE: &'static str = "ReplyRequest";
15912}
15913
15914impl json::Typed for ReplyRequest {
15915    const TYPE: &'static str = "ReplyRequest";
15916}
15917
15918impl FromJson for ReplyRequest {
15919    fn from_json(value: &Value) -> Result<Self, JsonError> {
15920        let object = json::object(value)?;
15921        json::expect_type(object, Self::TYPE)?;
15922        Ok(Self {
15923            id: json::id(object),
15924            attachments: json::many(object, &["attachment"]),
15925            attributions: json::many(object, &["attributedTo"]),
15926            audiences: json::many(object, &["audience"]),
15927            content: json::text(object, "content"),
15928            contexts: json::many(object, &["context"]),
15929            name: json::text(object, "name"),
15930            end_time: json::one(object, &["endTime"]),
15931            generators: json::many(object, &["generator"]),
15932            icons: json::many_mapped(object, &["icon"], json::link_to_image),
15933            images: json::many_mapped(object, &["image"], json::link_to_image),
15934            reply_targets: json::many(object, &["inReplyTo"]),
15935            locations: json::many(object, &["location"]),
15936            previews: json::many(object, &["preview"]),
15937            published: json::one(object, &["published"]),
15938            replies: json::one(object, &["replies"]),
15939            shares: json::one(object, &["shares"]),
15940            likes: json::one(object, &["likes"]),
15941            emoji_reactions: json::one(object, &["emojiReactions"]),
15942            start_time: json::one(object, &["startTime"]),
15943            summary: json::text(object, "summary"),
15944            tags: json::many(object, &["tag"]),
15945            updated: json::one(object, &["updated"]),
15946            urls: json::many(object, &["url"]),
15947            tos: json::many(object, &["to"]),
15948            btos: json::many(object, &["bto"]),
15949            ccs: json::many(object, &["cc"]),
15950            bccs: json::many(object, &["bcc"]),
15951            media_type: json::one(object, &["mediaType"]),
15952            duration: json::one(object, &["duration"]),
15953            sensitive: json::one(object, &["sensitive"]),
15954            source: json::one(object, &["source"]),
15955            proofs: json::many(object, &["proof"]),
15956            interaction_policy: json::one(object, &["interactionPolicy"]),
15957            approved_by: json::one(object, &["approvedBy"]),
15958            like_authorization: json::one(object, &["likeAuthorization"]),
15959            reply_authorization: json::one(object, &["replyAuthorization"]),
15960            announce_authorization: json::one(object, &["announceAuthorization"]),
15961            translations: json::many(object, &["translations"]),
15962            actors: json::many(object, &["actor"]),
15963            objects: json::many(object, &["object"]),
15964            targets: json::many(object, &["target"]),
15965            results: json::many(object, &["result"]),
15966            origins: json::many(object, &["origin"]),
15967            instruments: json::many(object, &["instrument"]),
15968        })
15969    }
15970}
15971
15972impl ToJson for ReplyRequest {
15973    fn to_json(&self) -> Value {
15974        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
15975        json::put_many(&mut object, &["attachment"], &self.attachments);
15976        json::put_many(&mut object, &["attributedTo"], &self.attributions);
15977        json::put_many(&mut object, &["audience"], &self.audiences);
15978        json::put_text(&mut object, "content", &self.content);
15979        json::put_many(&mut object, &["context"], &self.contexts);
15980        json::put_text(&mut object, "name", &self.name);
15981        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
15982        json::put_many(&mut object, &["generator"], &self.generators);
15983        json::put_many(&mut object, &["icon"], &self.icons);
15984        json::put_many(&mut object, &["image"], &self.images);
15985        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
15986        json::put_many(&mut object, &["location"], &self.locations);
15987        json::put_many(&mut object, &["preview"], &self.previews);
15988        json::put_one(&mut object, &["published"], self.published.as_ref());
15989        json::put_one(&mut object, &["replies"], self.replies.as_ref());
15990        json::put_one(&mut object, &["shares"], self.shares.as_ref());
15991        json::put_one(&mut object, &["likes"], self.likes.as_ref());
15992        json::put_one(
15993            &mut object,
15994            &["emojiReactions"],
15995            self.emoji_reactions.as_ref(),
15996        );
15997        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
15998        json::put_text(&mut object, "summary", &self.summary);
15999        json::put_many(&mut object, &["tag"], &self.tags);
16000        json::put_one(&mut object, &["updated"], self.updated.as_ref());
16001        json::put_many(&mut object, &["url"], &self.urls);
16002        json::put_many(&mut object, &["to"], &self.tos);
16003        json::put_many(&mut object, &["bto"], &self.btos);
16004        json::put_many(&mut object, &["cc"], &self.ccs);
16005        json::put_many(&mut object, &["bcc"], &self.bccs);
16006        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
16007        json::put_one(&mut object, &["duration"], self.duration.as_ref());
16008        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
16009        json::put_one(&mut object, &["source"], self.source.as_ref());
16010        json::put_many(&mut object, &["proof"], &self.proofs);
16011        json::put_one(
16012            &mut object,
16013            &["interactionPolicy"],
16014            self.interaction_policy.as_ref(),
16015        );
16016        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
16017        json::put_one(
16018            &mut object,
16019            &["likeAuthorization"],
16020            self.like_authorization.as_ref(),
16021        );
16022        json::put_one(
16023            &mut object,
16024            &["replyAuthorization"],
16025            self.reply_authorization.as_ref(),
16026        );
16027        json::put_one(
16028            &mut object,
16029            &["announceAuthorization"],
16030            self.announce_authorization.as_ref(),
16031        );
16032        json::put_many(&mut object, &["translations"], &self.translations);
16033        json::put_many(&mut object, &["actor"], &self.actors);
16034        json::put_many(&mut object, &["object"], &self.objects);
16035        json::put_many(&mut object, &["target"], &self.targets);
16036        json::put_many(&mut object, &["result"], &self.results);
16037        json::put_many(&mut object, &["origin"], &self.origins);
16038        json::put_many(&mut object, &["instrument"], &self.instruments);
16039        Value::Object(object)
16040    }
16041}
16042
16043/// Represents a service of any kind.
16044///
16045/// The type `https://www.w3.org/ns/activitystreams#Service`.
16046#[derive(Clone, Debug, Default, PartialEq)]
16047pub struct Service {
16048    /// The IRI that identifies this object.
16049    pub id: Option<Iri>,
16050    /// See [`Object::attachments`].
16051    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
16052    /// See [`Object::attributions`].
16053    pub attributions: Vec<AnyActor>,
16054    /// See [`Object::audiences`].
16055    pub audiences: Vec<AnyObject>,
16056    /// See [`Object::content`].
16057    pub content: Text,
16058    /// See [`Object::contexts`].
16059    pub contexts: Vec<LinkOrObject>,
16060    /// See [`Object::name`].
16061    pub name: Text,
16062    /// See [`Object::end_time`].
16063    pub end_time: Option<String>,
16064    /// See [`Object::generators`].
16065    pub generators: Vec<LinkOrObject>,
16066    /// See [`Object::icons`].
16067    pub icons: Vec<Reference<Image>>,
16068    /// See [`Object::images`].
16069    pub images: Vec<Reference<Image>>,
16070    /// See [`Object::reply_targets`].
16071    pub reply_targets: Vec<LinkOrObject>,
16072    /// See [`Object::locations`].
16073    pub locations: Vec<LinkOrObject>,
16074    /// See [`Object::previews`].
16075    pub previews: Vec<LinkOrObject>,
16076    /// See [`Object::published`].
16077    pub published: Option<String>,
16078    /// See [`Object::replies`].
16079    pub replies: Option<AnyCollection>,
16080    /// See [`Object::shares`].
16081    pub shares: Option<AnyCollection>,
16082    /// See [`Object::likes`].
16083    pub likes: Option<AnyCollection>,
16084    /// See [`Object::emoji_reactions`].
16085    pub emoji_reactions: Option<AnyCollection>,
16086    /// See [`Object::start_time`].
16087    pub start_time: Option<String>,
16088    /// See [`Object::summary`].
16089    pub summary: Text,
16090    /// See [`Object::tags`].
16091    pub tags: Vec<LinkOrObject>,
16092    /// See [`Object::updated`].
16093    pub updated: Option<String>,
16094    /// See [`Object::urls`].
16095    pub urls: Vec<LinkOrIri>,
16096    /// See [`Object::tos`].
16097    pub tos: Vec<AnyObject>,
16098    /// See [`Object::btos`].
16099    pub btos: Vec<AnyObject>,
16100    /// See [`Object::ccs`].
16101    pub ccs: Vec<AnyObject>,
16102    /// See [`Object::bccs`].
16103    pub bccs: Vec<AnyObject>,
16104    /// See [`Object::media_type`].
16105    pub media_type: Option<String>,
16106    /// See [`Object::duration`].
16107    pub duration: Option<String>,
16108    /// See [`Object::sensitive`].
16109    pub sensitive: Option<bool>,
16110    /// See [`Object::source`].
16111    pub source: Option<Box<Source>>,
16112    /// See [`Object::proofs`].
16113    pub proofs: Vec<Reference<DataIntegrityProof>>,
16114    /// See [`Object::interaction_policy`].
16115    pub interaction_policy: Option<Box<InteractionPolicy>>,
16116    /// See [`Object::approved_by`].
16117    pub approved_by: Option<Iri>,
16118    /// See [`Object::like_authorization`].
16119    pub like_authorization: Option<Reference<LikeAuthorization>>,
16120    /// See [`Object::reply_authorization`].
16121    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
16122    /// See [`Object::announce_authorization`].
16123    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
16124    /// See [`Object::translations`].
16125    pub translations: Vec<Translation>,
16126    /// A short username which may be used to refer to the actor,
16127    /// with no uniqueness guarantees.
16128    pub preferred_username: Text,
16129    /// A public part of the key pair owned by this actor.
16130    pub public_keys: Vec<Reference<CryptographicKey>>,
16131    /// Represents this actor's public keys.  It serves as equivalent to
16132    /// the `publicKeys` property, but is used for [FEP-521a](https://w3id.org/fep/521a) compliance.
16133    pub assertion_methods: Vec<Reference<Multikey>>,
16134    /// Gateways where the latest version of this portable actor object can be
16135    /// retrieved.
16136    pub gateways: Vec<Iri>,
16137    /// When `true`, conveys that for this actor, follow requests are not usually
16138    /// automatically approved, but instead are examined by a person who may accept
16139    /// or reject the request, at some time in the future.  Setting of `false`
16140    /// conveys no information and may be ignored.  This information is typically
16141    /// used to affect display of accounts, such as showing an account as private or
16142    /// locked.
16143    pub manually_approves_followers: Option<bool>,
16144    /// The inbox stream contains all activities received by the actor.  The server
16145    /// SHOULD filter content according to the requester's permission.  In general,
16146    /// the owner of an inbox is likely to be able to access all of their inbox
16147    /// contents.  Depending on access control, some other content may be public,
16148    /// whereas other content may require authentication for non-owner users,
16149    /// if they can access the inbox at all.
16150    pub inbox: Option<OrderedCollectionOrOrderedCollectionPage>,
16151    /// The outbox stream contains activities the user has published,
16152    /// subject to the ability of the requestor to retrieve the activity
16153    /// (that is, the contents of the outbox are filtered by the permissions of
16154    /// the person reading it).  If a user submits a request without
16155    /// [Authorization](https://www.w3.org/TR/activitypub/#authorization)
16156    /// the server should respond with all of the
16157    /// [Public](https://www.w3.org/TR/activitypub/#public-addressing) posts.
16158    /// This could potentially be all relevant objects published by the user,
16159    /// though the number of available items is left to the discretion of those
16160    /// implementing and deploying the server.
16161    pub outbox: Option<OrderedCollectionOrOrderedCollectionPage>,
16162    /// This is a list of everybody that the actor has followed, added as a
16163    /// [side effect](https://www.w3.org/TR/activitypub/#follow-activity-outbox).
16164    /// The `following` collection MUST be either an {@link OrderedCollection}
16165    /// or a {@link Collection} and MAY be filtered on privileges of
16166    /// an authenticated user or as appropriate when no authentication is given.
16167    pub following: Option<AnyCollection>,
16168    /// This is a list of everyone who has sent a {@link Follow} activity
16169    /// for the actor, added as a
16170    /// [side effect](https://www.w3.org/TR/activitypub/#follow-activity-outbox).
16171    /// This is where one would find a list of all the actors that are following
16172    /// the actor.  The `followers` collection MUST be either
16173    /// an {@link OrderedCollection} or a {@link Collection} and MAY be filtered on
16174    /// privileges of an authenticated user or as appropriate when no authentication
16175    /// is given.
16176    pub followers: Option<AnyCollection>,
16177    /// This is a list of every object from all of the actor's {@link Like}
16178    /// activities, added as a
16179    /// [side effect](https://www.w3.org/TR/activitypub/#like-activity-outbox).
16180    /// The `liked` collection MUST be either an {@link OrderedCollection} or
16181    /// a {@link Collection} and MAY be filtered on privileges of an authenticated
16182    /// user or as appropriate when no authentication is given.
16183    pub liked: Option<AnyCollection>,
16184    /// What is known in Mastodon as "pinned statuses", or statuses that are always
16185    /// featured at the top of people's profiles, is implemented using an extra
16186    /// property `featured` on the actor object that points to a {@link Collection}
16187    /// of objects.
16188    pub featured: Option<AnyCollection>,
16189    /// What is known in Mastodon as "featured hashtags", hashtags that are featured
16190    /// at people's profiles, is implemented using an extra property `featuredTags`
16191    /// on the actor object that points to a {@link Collection} of {@link Hashtag}
16192    /// objects specifically.
16193    pub featured_tags: Option<AnyCollection>,
16194    /// A collection of {@link FeaturedCollection}s created by this actor.
16195    pub featured_collections: Option<AnyCollection>,
16196    /// A list of supplementary Collections which may be of interest.
16197    pub streams: Vec<AnyCollection>,
16198    /// A JSON object which maps additional (typically server/domain-wide) endpoints
16199    /// which may be useful either for this actor or someone referencing this actor.
16200    /// This mapping may be nested inside the actor document as the value or may be
16201    /// a link to a JSON-LD document with these properties.
16202    pub endpoints: Option<Box<Endpoints>>,
16203    /// Allows users to opt-in or opt-out of discoverability features like
16204    /// the profile directory.  This flag may also be used as an indicator of
16205    /// the user's preferences toward being included in external discovery services,
16206    /// such as search engines or other indexing tools.
16207    pub discoverable: Option<bool>,
16208    /// Reports whether a user was locally suspended, for better handling of
16209    /// these accounts.
16210    pub suspended: Option<bool>,
16211    /// Whether the actor is in-memorial state.
16212    pub memorial: Option<bool>,
16213    /// Whether the actor allows to be indexed.
16214    pub indexable: Option<bool>,
16215    /// Signifies that an actor has been moved to a different ID. Used in Mastodon-style data portability with the {@link Move} activity; see [ActivityPub Data Portability/Move Action](https://swicg.github.io/activitypub-data-portability/#move-action) for more details.
16216    pub successor: Option<AnyActor>,
16217    /// The `aliases` (`alsoKnownAs`) property is used to specify alternative names
16218    /// or aliases for an entity.  It can be used to provide additional identifiers
16219    /// or labels for an entity, which can be useful in scenarios where an entity
16220    /// may have multiple names or aliases.
16221    pub aliases: Vec<AnyActor>,
16222    /// Means of communicating or interacting with the DID subject or associated
16223    /// entities via one or more service endpoints. Examples include discovery
16224    /// services, agent services, social networking services, file storage services,
16225    /// and verifiable credential repository services.
16226    pub services: Vec<AnyDidService>,
16227    /// This value is used for `Actor` type objects to show message on followed.
16228    pub followed_message: Option<String>,
16229    /// Used on actors to indicate that they in some way identify as a cat,
16230    /// expressed as a boolean value. If this property is set to `true`,
16231    /// displaying the actor or their notes will have some special effects
16232    /// attached in some clients.
16233    pub cat: Option<bool>,
16234    /// The actor's WebFinger handle, `user@host` (FEP-2c59).
16235    pub webfinger: Option<String>,
16236    /// The shared inbox, where Misskey writes it: on the actor rather than in
16237    /// its `endpoints`. Prefer `endpoints.sharedInbox` when both are there.
16238    pub shared_inbox: Option<Iri>,
16239}
16240
16241impl Service {
16242    /// The type's IRI.
16243    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Service";
16244    /// The type's `type` in a normalised document.
16245    pub const TYPE: &'static str = "Service";
16246}
16247
16248impl json::Typed for Service {
16249    const TYPE: &'static str = "Service";
16250}
16251
16252impl FromJson for Service {
16253    fn from_json(value: &Value) -> Result<Self, JsonError> {
16254        let object = json::object(value)?;
16255        json::expect_type(object, Self::TYPE)?;
16256        Ok(Self {
16257            id: json::id(object),
16258            attachments: json::many(object, &["attachment"]),
16259            attributions: json::many(object, &["attributedTo"]),
16260            audiences: json::many(object, &["audience"]),
16261            content: json::text(object, "content"),
16262            contexts: json::many(object, &["context"]),
16263            name: json::text(object, "name"),
16264            end_time: json::one(object, &["endTime"]),
16265            generators: json::many(object, &["generator"]),
16266            icons: json::many_mapped(object, &["icon"], json::link_to_image),
16267            images: json::many_mapped(object, &["image"], json::link_to_image),
16268            reply_targets: json::many(object, &["inReplyTo"]),
16269            locations: json::many(object, &["location"]),
16270            previews: json::many(object, &["preview"]),
16271            published: json::one(object, &["published"]),
16272            replies: json::one(object, &["replies"]),
16273            shares: json::one(object, &["shares"]),
16274            likes: json::one(object, &["likes"]),
16275            emoji_reactions: json::one(object, &["emojiReactions"]),
16276            start_time: json::one(object, &["startTime"]),
16277            summary: json::text(object, "summary"),
16278            tags: json::many(object, &["tag"]),
16279            updated: json::one(object, &["updated"]),
16280            urls: json::many(object, &["url"]),
16281            tos: json::many(object, &["to"]),
16282            btos: json::many(object, &["bto"]),
16283            ccs: json::many(object, &["cc"]),
16284            bccs: json::many(object, &["bcc"]),
16285            media_type: json::one(object, &["mediaType"]),
16286            duration: json::one(object, &["duration"]),
16287            sensitive: json::one(object, &["sensitive"]),
16288            source: json::one(object, &["source"]),
16289            proofs: json::many(object, &["proof"]),
16290            interaction_policy: json::one(object, &["interactionPolicy"]),
16291            approved_by: json::one(object, &["approvedBy"]),
16292            like_authorization: json::one(object, &["likeAuthorization"]),
16293            reply_authorization: json::one(object, &["replyAuthorization"]),
16294            announce_authorization: json::one(object, &["announceAuthorization"]),
16295            translations: json::many(object, &["translations"]),
16296            preferred_username: json::text(object, "preferredUsername"),
16297            public_keys: json::many_with(object, &["publicKey"], |value| {
16298                json::reference_with(value, CryptographicKey::from_json_untyped)
16299            }),
16300            assertion_methods: json::many(object, &["assertionMethod"]),
16301            gateways: json::many(object, &["gateways"]),
16302            manually_approves_followers: json::one(object, &["manuallyApprovesFollowers"]),
16303            inbox: json::one(object, &["inbox"]),
16304            outbox: json::one(object, &["outbox"]),
16305            following: json::one(object, &["following"]),
16306            followers: json::one(object, &["followers"]),
16307            liked: json::one(object, &["liked"]),
16308            featured: json::one(object, &["featured"]),
16309            featured_tags: json::one(object, &["featuredTags"]),
16310            featured_collections: json::one(
16311                object,
16312                &["https://w3id.org/fep/7aa9#featuredCollections"],
16313            ),
16314            streams: json::many(object, &["streams"]),
16315            endpoints: json::one(object, &["endpoints"]),
16316            discoverable: json::one(object, &["discoverable"]),
16317            suspended: json::one(object, &["suspended"]),
16318            memorial: json::one(object, &["memorial"]),
16319            indexable: json::one(object, &["indexable"]),
16320            successor: json::one(object, &["movedTo"]),
16321            aliases: json::many(object, &["alsoKnownAs"]),
16322            services: json::many(object, &["service"]),
16323            followed_message: json::one(object, &["_misskey_followedMessage"]),
16324            cat: json::one(object, &["isCat"]),
16325            webfinger: json::one(object, &["webfinger"]),
16326            shared_inbox: json::one(object, &["sharedInbox"]),
16327        })
16328    }
16329}
16330
16331impl ToJson for Service {
16332    fn to_json(&self) -> Value {
16333        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
16334        json::put_many(&mut object, &["attachment"], &self.attachments);
16335        json::put_many(&mut object, &["attributedTo"], &self.attributions);
16336        json::put_many(&mut object, &["audience"], &self.audiences);
16337        json::put_text(&mut object, "content", &self.content);
16338        json::put_many(&mut object, &["context"], &self.contexts);
16339        json::put_text(&mut object, "name", &self.name);
16340        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
16341        json::put_many(&mut object, &["generator"], &self.generators);
16342        json::put_many(&mut object, &["icon"], &self.icons);
16343        json::put_many(&mut object, &["image"], &self.images);
16344        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
16345        json::put_many(&mut object, &["location"], &self.locations);
16346        json::put_many(&mut object, &["preview"], &self.previews);
16347        json::put_one(&mut object, &["published"], self.published.as_ref());
16348        json::put_one(&mut object, &["replies"], self.replies.as_ref());
16349        json::put_one(&mut object, &["shares"], self.shares.as_ref());
16350        json::put_one(&mut object, &["likes"], self.likes.as_ref());
16351        json::put_one(
16352            &mut object,
16353            &["emojiReactions"],
16354            self.emoji_reactions.as_ref(),
16355        );
16356        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
16357        json::put_text(&mut object, "summary", &self.summary);
16358        json::put_many(&mut object, &["tag"], &self.tags);
16359        json::put_one(&mut object, &["updated"], self.updated.as_ref());
16360        json::put_many(&mut object, &["url"], &self.urls);
16361        json::put_many(&mut object, &["to"], &self.tos);
16362        json::put_many(&mut object, &["bto"], &self.btos);
16363        json::put_many(&mut object, &["cc"], &self.ccs);
16364        json::put_many(&mut object, &["bcc"], &self.bccs);
16365        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
16366        json::put_one(&mut object, &["duration"], self.duration.as_ref());
16367        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
16368        json::put_one(&mut object, &["source"], self.source.as_ref());
16369        json::put_many(&mut object, &["proof"], &self.proofs);
16370        json::put_one(
16371            &mut object,
16372            &["interactionPolicy"],
16373            self.interaction_policy.as_ref(),
16374        );
16375        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
16376        json::put_one(
16377            &mut object,
16378            &["likeAuthorization"],
16379            self.like_authorization.as_ref(),
16380        );
16381        json::put_one(
16382            &mut object,
16383            &["replyAuthorization"],
16384            self.reply_authorization.as_ref(),
16385        );
16386        json::put_one(
16387            &mut object,
16388            &["announceAuthorization"],
16389            self.announce_authorization.as_ref(),
16390        );
16391        json::put_many(&mut object, &["translations"], &self.translations);
16392        json::put_text(&mut object, "preferredUsername", &self.preferred_username);
16393        json::put_many_with(
16394            &mut object,
16395            &["publicKey"],
16396            &self.public_keys,
16397            |reference| json::write_reference(reference, CryptographicKey::to_json_untyped),
16398        );
16399        json::put_many(&mut object, &["assertionMethod"], &self.assertion_methods);
16400        json::put_many(&mut object, &["gateways"], &self.gateways);
16401        json::put_one(
16402            &mut object,
16403            &["manuallyApprovesFollowers"],
16404            self.manually_approves_followers.as_ref(),
16405        );
16406        json::put_one(&mut object, &["inbox"], self.inbox.as_ref());
16407        json::put_one(&mut object, &["outbox"], self.outbox.as_ref());
16408        json::put_one(&mut object, &["following"], self.following.as_ref());
16409        json::put_one(&mut object, &["followers"], self.followers.as_ref());
16410        json::put_one(&mut object, &["liked"], self.liked.as_ref());
16411        json::put_one(&mut object, &["featured"], self.featured.as_ref());
16412        json::put_one(&mut object, &["featuredTags"], self.featured_tags.as_ref());
16413        json::put_one(
16414            &mut object,
16415            &["https://w3id.org/fep/7aa9#featuredCollections"],
16416            self.featured_collections.as_ref(),
16417        );
16418        json::put_many(&mut object, &["streams"], &self.streams);
16419        json::put_one(&mut object, &["endpoints"], self.endpoints.as_ref());
16420        json::put_one(&mut object, &["discoverable"], self.discoverable.as_ref());
16421        json::put_one(&mut object, &["suspended"], self.suspended.as_ref());
16422        json::put_one(&mut object, &["memorial"], self.memorial.as_ref());
16423        json::put_one(&mut object, &["indexable"], self.indexable.as_ref());
16424        json::put_one(&mut object, &["movedTo"], self.successor.as_ref());
16425        json::put_many(&mut object, &["alsoKnownAs"], &self.aliases);
16426        json::put_many(&mut object, &["service"], &self.services);
16427        json::put_one(
16428            &mut object,
16429            &["_misskey_followedMessage"],
16430            self.followed_message.as_ref(),
16431        );
16432        json::put_one(&mut object, &["isCat"], self.cat.as_ref());
16433        json::put_one(&mut object, &["webfinger"], self.webfinger.as_ref());
16434        json::put_one(&mut object, &["sharedInbox"], self.shared_inbox.as_ref());
16435        Value::Object(object)
16436    }
16437}
16438
16439/// Contents of {@link Object}'s `source`.
16440///
16441/// The type `https://www.w3.org/ns/activitystreams#Source`.
16442#[derive(Clone, Debug, Default, PartialEq)]
16443pub struct Source {
16444    /// The source content.
16445    pub content: Text,
16446    /// The MIME media type of the source content.
16447    pub media_type: Option<String>,
16448}
16449
16450impl Source {
16451    /// The type's IRI.
16452    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Source";
16453}
16454
16455impl FromJson for Source {
16456    fn from_json(value: &Value) -> Result<Self, JsonError> {
16457        let object = json::object(value)?;
16458        Ok(Self {
16459            content: json::text(object, "content"),
16460            media_type: json::one(object, &["mediaType"]),
16461        })
16462    }
16463}
16464
16465impl ToJson for Source {
16466    fn to_json(&self) -> Value {
16467        let mut object = json::new_object(None, None);
16468        json::put_text(&mut object, "content", &self.content);
16469        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
16470        Value::Object(object)
16471    }
16472}
16473
16474/// A specialization of {@link Accept} indicating that
16475/// the acceptance is tentative.
16476///
16477/// The type `https://www.w3.org/ns/activitystreams#TentativeAccept`.
16478#[derive(Clone, Debug, Default, PartialEq)]
16479pub struct TentativeAccept {
16480    /// The IRI that identifies this object.
16481    pub id: Option<Iri>,
16482    /// See [`Object::attachments`].
16483    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
16484    /// See [`Object::attributions`].
16485    pub attributions: Vec<AnyActor>,
16486    /// See [`Object::audiences`].
16487    pub audiences: Vec<AnyObject>,
16488    /// See [`Object::content`].
16489    pub content: Text,
16490    /// See [`Object::contexts`].
16491    pub contexts: Vec<LinkOrObject>,
16492    /// See [`Object::name`].
16493    pub name: Text,
16494    /// See [`Object::end_time`].
16495    pub end_time: Option<String>,
16496    /// See [`Object::generators`].
16497    pub generators: Vec<LinkOrObject>,
16498    /// See [`Object::icons`].
16499    pub icons: Vec<Reference<Image>>,
16500    /// See [`Object::images`].
16501    pub images: Vec<Reference<Image>>,
16502    /// See [`Object::reply_targets`].
16503    pub reply_targets: Vec<LinkOrObject>,
16504    /// See [`Object::locations`].
16505    pub locations: Vec<LinkOrObject>,
16506    /// See [`Object::previews`].
16507    pub previews: Vec<LinkOrObject>,
16508    /// See [`Object::published`].
16509    pub published: Option<String>,
16510    /// See [`Object::replies`].
16511    pub replies: Option<AnyCollection>,
16512    /// See [`Object::shares`].
16513    pub shares: Option<AnyCollection>,
16514    /// See [`Object::likes`].
16515    pub likes: Option<AnyCollection>,
16516    /// See [`Object::emoji_reactions`].
16517    pub emoji_reactions: Option<AnyCollection>,
16518    /// See [`Object::start_time`].
16519    pub start_time: Option<String>,
16520    /// See [`Object::summary`].
16521    pub summary: Text,
16522    /// See [`Object::tags`].
16523    pub tags: Vec<LinkOrObject>,
16524    /// See [`Object::updated`].
16525    pub updated: Option<String>,
16526    /// See [`Object::urls`].
16527    pub urls: Vec<LinkOrIri>,
16528    /// See [`Object::tos`].
16529    pub tos: Vec<AnyObject>,
16530    /// See [`Object::btos`].
16531    pub btos: Vec<AnyObject>,
16532    /// See [`Object::ccs`].
16533    pub ccs: Vec<AnyObject>,
16534    /// See [`Object::bccs`].
16535    pub bccs: Vec<AnyObject>,
16536    /// See [`Object::media_type`].
16537    pub media_type: Option<String>,
16538    /// See [`Object::duration`].
16539    pub duration: Option<String>,
16540    /// See [`Object::sensitive`].
16541    pub sensitive: Option<bool>,
16542    /// See [`Object::source`].
16543    pub source: Option<Box<Source>>,
16544    /// See [`Object::proofs`].
16545    pub proofs: Vec<Reference<DataIntegrityProof>>,
16546    /// See [`Object::interaction_policy`].
16547    pub interaction_policy: Option<Box<InteractionPolicy>>,
16548    /// See [`Object::approved_by`].
16549    pub approved_by: Option<Iri>,
16550    /// See [`Object::like_authorization`].
16551    pub like_authorization: Option<Reference<LikeAuthorization>>,
16552    /// See [`Object::reply_authorization`].
16553    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
16554    /// See [`Object::announce_authorization`].
16555    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
16556    /// See [`Object::translations`].
16557    pub translations: Vec<Translation>,
16558    /// See [`Activity::actors`].
16559    pub actors: Vec<AnyActor>,
16560    /// See [`Activity::objects`].
16561    pub objects: Vec<AnyObject>,
16562    /// See [`Activity::targets`].
16563    pub targets: Vec<AnyObject>,
16564    /// See [`Activity::results`].
16565    pub results: Vec<AnyObject>,
16566    /// See [`Activity::origins`].
16567    pub origins: Vec<AnyObject>,
16568    /// See [`Activity::instruments`].
16569    pub instruments: Vec<AnyObject>,
16570}
16571
16572impl TentativeAccept {
16573    /// The type's IRI.
16574    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#TentativeAccept";
16575    /// The type's `type` in a normalised document.
16576    pub const TYPE: &'static str = "TentativeAccept";
16577}
16578
16579impl json::Typed for TentativeAccept {
16580    const TYPE: &'static str = "TentativeAccept";
16581}
16582
16583impl FromJson for TentativeAccept {
16584    fn from_json(value: &Value) -> Result<Self, JsonError> {
16585        let object = json::object(value)?;
16586        json::expect_type(object, Self::TYPE)?;
16587        Ok(Self {
16588            id: json::id(object),
16589            attachments: json::many(object, &["attachment"]),
16590            attributions: json::many(object, &["attributedTo"]),
16591            audiences: json::many(object, &["audience"]),
16592            content: json::text(object, "content"),
16593            contexts: json::many(object, &["context"]),
16594            name: json::text(object, "name"),
16595            end_time: json::one(object, &["endTime"]),
16596            generators: json::many(object, &["generator"]),
16597            icons: json::many_mapped(object, &["icon"], json::link_to_image),
16598            images: json::many_mapped(object, &["image"], json::link_to_image),
16599            reply_targets: json::many(object, &["inReplyTo"]),
16600            locations: json::many(object, &["location"]),
16601            previews: json::many(object, &["preview"]),
16602            published: json::one(object, &["published"]),
16603            replies: json::one(object, &["replies"]),
16604            shares: json::one(object, &["shares"]),
16605            likes: json::one(object, &["likes"]),
16606            emoji_reactions: json::one(object, &["emojiReactions"]),
16607            start_time: json::one(object, &["startTime"]),
16608            summary: json::text(object, "summary"),
16609            tags: json::many(object, &["tag"]),
16610            updated: json::one(object, &["updated"]),
16611            urls: json::many(object, &["url"]),
16612            tos: json::many(object, &["to"]),
16613            btos: json::many(object, &["bto"]),
16614            ccs: json::many(object, &["cc"]),
16615            bccs: json::many(object, &["bcc"]),
16616            media_type: json::one(object, &["mediaType"]),
16617            duration: json::one(object, &["duration"]),
16618            sensitive: json::one(object, &["sensitive"]),
16619            source: json::one(object, &["source"]),
16620            proofs: json::many(object, &["proof"]),
16621            interaction_policy: json::one(object, &["interactionPolicy"]),
16622            approved_by: json::one(object, &["approvedBy"]),
16623            like_authorization: json::one(object, &["likeAuthorization"]),
16624            reply_authorization: json::one(object, &["replyAuthorization"]),
16625            announce_authorization: json::one(object, &["announceAuthorization"]),
16626            translations: json::many(object, &["translations"]),
16627            actors: json::many(object, &["actor"]),
16628            objects: json::many(object, &["object"]),
16629            targets: json::many(object, &["target"]),
16630            results: json::many(object, &["result"]),
16631            origins: json::many(object, &["origin"]),
16632            instruments: json::many(object, &["instrument"]),
16633        })
16634    }
16635}
16636
16637impl ToJson for TentativeAccept {
16638    fn to_json(&self) -> Value {
16639        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
16640        json::put_many(&mut object, &["attachment"], &self.attachments);
16641        json::put_many(&mut object, &["attributedTo"], &self.attributions);
16642        json::put_many(&mut object, &["audience"], &self.audiences);
16643        json::put_text(&mut object, "content", &self.content);
16644        json::put_many(&mut object, &["context"], &self.contexts);
16645        json::put_text(&mut object, "name", &self.name);
16646        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
16647        json::put_many(&mut object, &["generator"], &self.generators);
16648        json::put_many(&mut object, &["icon"], &self.icons);
16649        json::put_many(&mut object, &["image"], &self.images);
16650        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
16651        json::put_many(&mut object, &["location"], &self.locations);
16652        json::put_many(&mut object, &["preview"], &self.previews);
16653        json::put_one(&mut object, &["published"], self.published.as_ref());
16654        json::put_one(&mut object, &["replies"], self.replies.as_ref());
16655        json::put_one(&mut object, &["shares"], self.shares.as_ref());
16656        json::put_one(&mut object, &["likes"], self.likes.as_ref());
16657        json::put_one(
16658            &mut object,
16659            &["emojiReactions"],
16660            self.emoji_reactions.as_ref(),
16661        );
16662        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
16663        json::put_text(&mut object, "summary", &self.summary);
16664        json::put_many(&mut object, &["tag"], &self.tags);
16665        json::put_one(&mut object, &["updated"], self.updated.as_ref());
16666        json::put_many(&mut object, &["url"], &self.urls);
16667        json::put_many(&mut object, &["to"], &self.tos);
16668        json::put_many(&mut object, &["bto"], &self.btos);
16669        json::put_many(&mut object, &["cc"], &self.ccs);
16670        json::put_many(&mut object, &["bcc"], &self.bccs);
16671        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
16672        json::put_one(&mut object, &["duration"], self.duration.as_ref());
16673        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
16674        json::put_one(&mut object, &["source"], self.source.as_ref());
16675        json::put_many(&mut object, &["proof"], &self.proofs);
16676        json::put_one(
16677            &mut object,
16678            &["interactionPolicy"],
16679            self.interaction_policy.as_ref(),
16680        );
16681        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
16682        json::put_one(
16683            &mut object,
16684            &["likeAuthorization"],
16685            self.like_authorization.as_ref(),
16686        );
16687        json::put_one(
16688            &mut object,
16689            &["replyAuthorization"],
16690            self.reply_authorization.as_ref(),
16691        );
16692        json::put_one(
16693            &mut object,
16694            &["announceAuthorization"],
16695            self.announce_authorization.as_ref(),
16696        );
16697        json::put_many(&mut object, &["translations"], &self.translations);
16698        json::put_many(&mut object, &["actor"], &self.actors);
16699        json::put_many(&mut object, &["object"], &self.objects);
16700        json::put_many(&mut object, &["target"], &self.targets);
16701        json::put_many(&mut object, &["result"], &self.results);
16702        json::put_many(&mut object, &["origin"], &self.origins);
16703        json::put_many(&mut object, &["instrument"], &self.instruments);
16704        Value::Object(object)
16705    }
16706}
16707
16708/// A specialization of {@link Reject} in which
16709/// the rejection is considered tentative.
16710///
16711/// The type `https://www.w3.org/ns/activitystreams#TentativeReject`.
16712#[derive(Clone, Debug, Default, PartialEq)]
16713pub struct TentativeReject {
16714    /// The IRI that identifies this object.
16715    pub id: Option<Iri>,
16716    /// See [`Object::attachments`].
16717    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
16718    /// See [`Object::attributions`].
16719    pub attributions: Vec<AnyActor>,
16720    /// See [`Object::audiences`].
16721    pub audiences: Vec<AnyObject>,
16722    /// See [`Object::content`].
16723    pub content: Text,
16724    /// See [`Object::contexts`].
16725    pub contexts: Vec<LinkOrObject>,
16726    /// See [`Object::name`].
16727    pub name: Text,
16728    /// See [`Object::end_time`].
16729    pub end_time: Option<String>,
16730    /// See [`Object::generators`].
16731    pub generators: Vec<LinkOrObject>,
16732    /// See [`Object::icons`].
16733    pub icons: Vec<Reference<Image>>,
16734    /// See [`Object::images`].
16735    pub images: Vec<Reference<Image>>,
16736    /// See [`Object::reply_targets`].
16737    pub reply_targets: Vec<LinkOrObject>,
16738    /// See [`Object::locations`].
16739    pub locations: Vec<LinkOrObject>,
16740    /// See [`Object::previews`].
16741    pub previews: Vec<LinkOrObject>,
16742    /// See [`Object::published`].
16743    pub published: Option<String>,
16744    /// See [`Object::replies`].
16745    pub replies: Option<AnyCollection>,
16746    /// See [`Object::shares`].
16747    pub shares: Option<AnyCollection>,
16748    /// See [`Object::likes`].
16749    pub likes: Option<AnyCollection>,
16750    /// See [`Object::emoji_reactions`].
16751    pub emoji_reactions: Option<AnyCollection>,
16752    /// See [`Object::start_time`].
16753    pub start_time: Option<String>,
16754    /// See [`Object::summary`].
16755    pub summary: Text,
16756    /// See [`Object::tags`].
16757    pub tags: Vec<LinkOrObject>,
16758    /// See [`Object::updated`].
16759    pub updated: Option<String>,
16760    /// See [`Object::urls`].
16761    pub urls: Vec<LinkOrIri>,
16762    /// See [`Object::tos`].
16763    pub tos: Vec<AnyObject>,
16764    /// See [`Object::btos`].
16765    pub btos: Vec<AnyObject>,
16766    /// See [`Object::ccs`].
16767    pub ccs: Vec<AnyObject>,
16768    /// See [`Object::bccs`].
16769    pub bccs: Vec<AnyObject>,
16770    /// See [`Object::media_type`].
16771    pub media_type: Option<String>,
16772    /// See [`Object::duration`].
16773    pub duration: Option<String>,
16774    /// See [`Object::sensitive`].
16775    pub sensitive: Option<bool>,
16776    /// See [`Object::source`].
16777    pub source: Option<Box<Source>>,
16778    /// See [`Object::proofs`].
16779    pub proofs: Vec<Reference<DataIntegrityProof>>,
16780    /// See [`Object::interaction_policy`].
16781    pub interaction_policy: Option<Box<InteractionPolicy>>,
16782    /// See [`Object::approved_by`].
16783    pub approved_by: Option<Iri>,
16784    /// See [`Object::like_authorization`].
16785    pub like_authorization: Option<Reference<LikeAuthorization>>,
16786    /// See [`Object::reply_authorization`].
16787    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
16788    /// See [`Object::announce_authorization`].
16789    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
16790    /// See [`Object::translations`].
16791    pub translations: Vec<Translation>,
16792    /// See [`Activity::actors`].
16793    pub actors: Vec<AnyActor>,
16794    /// See [`Activity::objects`].
16795    pub objects: Vec<AnyObject>,
16796    /// See [`Activity::targets`].
16797    pub targets: Vec<AnyObject>,
16798    /// See [`Activity::results`].
16799    pub results: Vec<AnyObject>,
16800    /// See [`Activity::origins`].
16801    pub origins: Vec<AnyObject>,
16802    /// See [`Activity::instruments`].
16803    pub instruments: Vec<AnyObject>,
16804}
16805
16806impl TentativeReject {
16807    /// The type's IRI.
16808    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#TentativeReject";
16809    /// The type's `type` in a normalised document.
16810    pub const TYPE: &'static str = "TentativeReject";
16811}
16812
16813impl json::Typed for TentativeReject {
16814    const TYPE: &'static str = "TentativeReject";
16815}
16816
16817impl FromJson for TentativeReject {
16818    fn from_json(value: &Value) -> Result<Self, JsonError> {
16819        let object = json::object(value)?;
16820        json::expect_type(object, Self::TYPE)?;
16821        Ok(Self {
16822            id: json::id(object),
16823            attachments: json::many(object, &["attachment"]),
16824            attributions: json::many(object, &["attributedTo"]),
16825            audiences: json::many(object, &["audience"]),
16826            content: json::text(object, "content"),
16827            contexts: json::many(object, &["context"]),
16828            name: json::text(object, "name"),
16829            end_time: json::one(object, &["endTime"]),
16830            generators: json::many(object, &["generator"]),
16831            icons: json::many_mapped(object, &["icon"], json::link_to_image),
16832            images: json::many_mapped(object, &["image"], json::link_to_image),
16833            reply_targets: json::many(object, &["inReplyTo"]),
16834            locations: json::many(object, &["location"]),
16835            previews: json::many(object, &["preview"]),
16836            published: json::one(object, &["published"]),
16837            replies: json::one(object, &["replies"]),
16838            shares: json::one(object, &["shares"]),
16839            likes: json::one(object, &["likes"]),
16840            emoji_reactions: json::one(object, &["emojiReactions"]),
16841            start_time: json::one(object, &["startTime"]),
16842            summary: json::text(object, "summary"),
16843            tags: json::many(object, &["tag"]),
16844            updated: json::one(object, &["updated"]),
16845            urls: json::many(object, &["url"]),
16846            tos: json::many(object, &["to"]),
16847            btos: json::many(object, &["bto"]),
16848            ccs: json::many(object, &["cc"]),
16849            bccs: json::many(object, &["bcc"]),
16850            media_type: json::one(object, &["mediaType"]),
16851            duration: json::one(object, &["duration"]),
16852            sensitive: json::one(object, &["sensitive"]),
16853            source: json::one(object, &["source"]),
16854            proofs: json::many(object, &["proof"]),
16855            interaction_policy: json::one(object, &["interactionPolicy"]),
16856            approved_by: json::one(object, &["approvedBy"]),
16857            like_authorization: json::one(object, &["likeAuthorization"]),
16858            reply_authorization: json::one(object, &["replyAuthorization"]),
16859            announce_authorization: json::one(object, &["announceAuthorization"]),
16860            translations: json::many(object, &["translations"]),
16861            actors: json::many(object, &["actor"]),
16862            objects: json::many(object, &["object"]),
16863            targets: json::many(object, &["target"]),
16864            results: json::many(object, &["result"]),
16865            origins: json::many(object, &["origin"]),
16866            instruments: json::many(object, &["instrument"]),
16867        })
16868    }
16869}
16870
16871impl ToJson for TentativeReject {
16872    fn to_json(&self) -> Value {
16873        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
16874        json::put_many(&mut object, &["attachment"], &self.attachments);
16875        json::put_many(&mut object, &["attributedTo"], &self.attributions);
16876        json::put_many(&mut object, &["audience"], &self.audiences);
16877        json::put_text(&mut object, "content", &self.content);
16878        json::put_many(&mut object, &["context"], &self.contexts);
16879        json::put_text(&mut object, "name", &self.name);
16880        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
16881        json::put_many(&mut object, &["generator"], &self.generators);
16882        json::put_many(&mut object, &["icon"], &self.icons);
16883        json::put_many(&mut object, &["image"], &self.images);
16884        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
16885        json::put_many(&mut object, &["location"], &self.locations);
16886        json::put_many(&mut object, &["preview"], &self.previews);
16887        json::put_one(&mut object, &["published"], self.published.as_ref());
16888        json::put_one(&mut object, &["replies"], self.replies.as_ref());
16889        json::put_one(&mut object, &["shares"], self.shares.as_ref());
16890        json::put_one(&mut object, &["likes"], self.likes.as_ref());
16891        json::put_one(
16892            &mut object,
16893            &["emojiReactions"],
16894            self.emoji_reactions.as_ref(),
16895        );
16896        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
16897        json::put_text(&mut object, "summary", &self.summary);
16898        json::put_many(&mut object, &["tag"], &self.tags);
16899        json::put_one(&mut object, &["updated"], self.updated.as_ref());
16900        json::put_many(&mut object, &["url"], &self.urls);
16901        json::put_many(&mut object, &["to"], &self.tos);
16902        json::put_many(&mut object, &["bto"], &self.btos);
16903        json::put_many(&mut object, &["cc"], &self.ccs);
16904        json::put_many(&mut object, &["bcc"], &self.bccs);
16905        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
16906        json::put_one(&mut object, &["duration"], self.duration.as_ref());
16907        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
16908        json::put_one(&mut object, &["source"], self.source.as_ref());
16909        json::put_many(&mut object, &["proof"], &self.proofs);
16910        json::put_one(
16911            &mut object,
16912            &["interactionPolicy"],
16913            self.interaction_policy.as_ref(),
16914        );
16915        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
16916        json::put_one(
16917            &mut object,
16918            &["likeAuthorization"],
16919            self.like_authorization.as_ref(),
16920        );
16921        json::put_one(
16922            &mut object,
16923            &["replyAuthorization"],
16924            self.reply_authorization.as_ref(),
16925        );
16926        json::put_one(
16927            &mut object,
16928            &["announceAuthorization"],
16929            self.announce_authorization.as_ref(),
16930        );
16931        json::put_many(&mut object, &["translations"], &self.translations);
16932        json::put_many(&mut object, &["actor"], &self.actors);
16933        json::put_many(&mut object, &["object"], &self.objects);
16934        json::put_many(&mut object, &["target"], &self.targets);
16935        json::put_many(&mut object, &["result"], &self.results);
16936        json::put_many(&mut object, &["origin"], &self.origins);
16937        json::put_many(&mut object, &["instrument"], &self.instruments);
16938        Value::Object(object)
16939    }
16940}
16941
16942/// A `Tombstone` represents a content object that has been deleted.
16943/// It can be used in {@link Collection}s to signify that there used to be
16944/// an object at this position, but it has been deleted.
16945///
16946/// The type `https://www.w3.org/ns/activitystreams#Tombstone`.
16947#[derive(Clone, Debug, Default, PartialEq)]
16948pub struct Tombstone {
16949    /// The IRI that identifies this object.
16950    pub id: Option<Iri>,
16951    /// See [`Object::attachments`].
16952    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
16953    /// See [`Object::attributions`].
16954    pub attributions: Vec<AnyActor>,
16955    /// See [`Object::audiences`].
16956    pub audiences: Vec<AnyObject>,
16957    /// See [`Object::content`].
16958    pub content: Text,
16959    /// See [`Object::contexts`].
16960    pub contexts: Vec<LinkOrObject>,
16961    /// See [`Object::name`].
16962    pub name: Text,
16963    /// See [`Object::end_time`].
16964    pub end_time: Option<String>,
16965    /// See [`Object::generators`].
16966    pub generators: Vec<LinkOrObject>,
16967    /// See [`Object::icons`].
16968    pub icons: Vec<Reference<Image>>,
16969    /// See [`Object::images`].
16970    pub images: Vec<Reference<Image>>,
16971    /// See [`Object::reply_targets`].
16972    pub reply_targets: Vec<LinkOrObject>,
16973    /// See [`Object::locations`].
16974    pub locations: Vec<LinkOrObject>,
16975    /// See [`Object::previews`].
16976    pub previews: Vec<LinkOrObject>,
16977    /// See [`Object::published`].
16978    pub published: Option<String>,
16979    /// See [`Object::replies`].
16980    pub replies: Option<AnyCollection>,
16981    /// See [`Object::shares`].
16982    pub shares: Option<AnyCollection>,
16983    /// See [`Object::likes`].
16984    pub likes: Option<AnyCollection>,
16985    /// See [`Object::emoji_reactions`].
16986    pub emoji_reactions: Option<AnyCollection>,
16987    /// See [`Object::start_time`].
16988    pub start_time: Option<String>,
16989    /// See [`Object::summary`].
16990    pub summary: Text,
16991    /// See [`Object::tags`].
16992    pub tags: Vec<LinkOrObject>,
16993    /// See [`Object::updated`].
16994    pub updated: Option<String>,
16995    /// See [`Object::urls`].
16996    pub urls: Vec<LinkOrIri>,
16997    /// See [`Object::tos`].
16998    pub tos: Vec<AnyObject>,
16999    /// See [`Object::btos`].
17000    pub btos: Vec<AnyObject>,
17001    /// See [`Object::ccs`].
17002    pub ccs: Vec<AnyObject>,
17003    /// See [`Object::bccs`].
17004    pub bccs: Vec<AnyObject>,
17005    /// See [`Object::media_type`].
17006    pub media_type: Option<String>,
17007    /// See [`Object::duration`].
17008    pub duration: Option<String>,
17009    /// See [`Object::sensitive`].
17010    pub sensitive: Option<bool>,
17011    /// See [`Object::source`].
17012    pub source: Option<Box<Source>>,
17013    /// See [`Object::proofs`].
17014    pub proofs: Vec<Reference<DataIntegrityProof>>,
17015    /// See [`Object::interaction_policy`].
17016    pub interaction_policy: Option<Box<InteractionPolicy>>,
17017    /// See [`Object::approved_by`].
17018    pub approved_by: Option<Iri>,
17019    /// See [`Object::like_authorization`].
17020    pub like_authorization: Option<Reference<LikeAuthorization>>,
17021    /// See [`Object::reply_authorization`].
17022    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
17023    /// See [`Object::announce_authorization`].
17024    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
17025    /// See [`Object::translations`].
17026    pub translations: Vec<Translation>,
17027    /// On a `Tombstone` object, the `formerType` property identifies the type of
17028    /// the object that was deleted.
17029    pub former_types: Vec<Iri>,
17030    /// On a `Tombstone` object, the `deleted` property is a timestamp for when
17031    /// the object was deleted.
17032    pub deleted: Option<String>,
17033}
17034
17035impl Tombstone {
17036    /// The type's IRI.
17037    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Tombstone";
17038    /// The type's `type` in a normalised document.
17039    pub const TYPE: &'static str = "Tombstone";
17040}
17041
17042impl json::Typed for Tombstone {
17043    const TYPE: &'static str = "Tombstone";
17044}
17045
17046impl FromJson for Tombstone {
17047    fn from_json(value: &Value) -> Result<Self, JsonError> {
17048        let object = json::object(value)?;
17049        json::expect_type(object, Self::TYPE)?;
17050        Ok(Self {
17051            id: json::id(object),
17052            attachments: json::many(object, &["attachment"]),
17053            attributions: json::many(object, &["attributedTo"]),
17054            audiences: json::many(object, &["audience"]),
17055            content: json::text(object, "content"),
17056            contexts: json::many(object, &["context"]),
17057            name: json::text(object, "name"),
17058            end_time: json::one(object, &["endTime"]),
17059            generators: json::many(object, &["generator"]),
17060            icons: json::many_mapped(object, &["icon"], json::link_to_image),
17061            images: json::many_mapped(object, &["image"], json::link_to_image),
17062            reply_targets: json::many(object, &["inReplyTo"]),
17063            locations: json::many(object, &["location"]),
17064            previews: json::many(object, &["preview"]),
17065            published: json::one(object, &["published"]),
17066            replies: json::one(object, &["replies"]),
17067            shares: json::one(object, &["shares"]),
17068            likes: json::one(object, &["likes"]),
17069            emoji_reactions: json::one(object, &["emojiReactions"]),
17070            start_time: json::one(object, &["startTime"]),
17071            summary: json::text(object, "summary"),
17072            tags: json::many(object, &["tag"]),
17073            updated: json::one(object, &["updated"]),
17074            urls: json::many(object, &["url"]),
17075            tos: json::many(object, &["to"]),
17076            btos: json::many(object, &["bto"]),
17077            ccs: json::many(object, &["cc"]),
17078            bccs: json::many(object, &["bcc"]),
17079            media_type: json::one(object, &["mediaType"]),
17080            duration: json::one(object, &["duration"]),
17081            sensitive: json::one(object, &["sensitive"]),
17082            source: json::one(object, &["source"]),
17083            proofs: json::many(object, &["proof"]),
17084            interaction_policy: json::one(object, &["interactionPolicy"]),
17085            approved_by: json::one(object, &["approvedBy"]),
17086            like_authorization: json::one(object, &["likeAuthorization"]),
17087            reply_authorization: json::one(object, &["replyAuthorization"]),
17088            announce_authorization: json::one(object, &["announceAuthorization"]),
17089            translations: json::many(object, &["translations"]),
17090            former_types: json::many(object, &["formerType"]),
17091            deleted: json::one(object, &["deleted"]),
17092        })
17093    }
17094}
17095
17096impl ToJson for Tombstone {
17097    fn to_json(&self) -> Value {
17098        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
17099        json::put_many(&mut object, &["attachment"], &self.attachments);
17100        json::put_many(&mut object, &["attributedTo"], &self.attributions);
17101        json::put_many(&mut object, &["audience"], &self.audiences);
17102        json::put_text(&mut object, "content", &self.content);
17103        json::put_many(&mut object, &["context"], &self.contexts);
17104        json::put_text(&mut object, "name", &self.name);
17105        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
17106        json::put_many(&mut object, &["generator"], &self.generators);
17107        json::put_many(&mut object, &["icon"], &self.icons);
17108        json::put_many(&mut object, &["image"], &self.images);
17109        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
17110        json::put_many(&mut object, &["location"], &self.locations);
17111        json::put_many(&mut object, &["preview"], &self.previews);
17112        json::put_one(&mut object, &["published"], self.published.as_ref());
17113        json::put_one(&mut object, &["replies"], self.replies.as_ref());
17114        json::put_one(&mut object, &["shares"], self.shares.as_ref());
17115        json::put_one(&mut object, &["likes"], self.likes.as_ref());
17116        json::put_one(
17117            &mut object,
17118            &["emojiReactions"],
17119            self.emoji_reactions.as_ref(),
17120        );
17121        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
17122        json::put_text(&mut object, "summary", &self.summary);
17123        json::put_many(&mut object, &["tag"], &self.tags);
17124        json::put_one(&mut object, &["updated"], self.updated.as_ref());
17125        json::put_many(&mut object, &["url"], &self.urls);
17126        json::put_many(&mut object, &["to"], &self.tos);
17127        json::put_many(&mut object, &["bto"], &self.btos);
17128        json::put_many(&mut object, &["cc"], &self.ccs);
17129        json::put_many(&mut object, &["bcc"], &self.bccs);
17130        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
17131        json::put_one(&mut object, &["duration"], self.duration.as_ref());
17132        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
17133        json::put_one(&mut object, &["source"], self.source.as_ref());
17134        json::put_many(&mut object, &["proof"], &self.proofs);
17135        json::put_one(
17136            &mut object,
17137            &["interactionPolicy"],
17138            self.interaction_policy.as_ref(),
17139        );
17140        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
17141        json::put_one(
17142            &mut object,
17143            &["likeAuthorization"],
17144            self.like_authorization.as_ref(),
17145        );
17146        json::put_one(
17147            &mut object,
17148            &["replyAuthorization"],
17149            self.reply_authorization.as_ref(),
17150        );
17151        json::put_one(
17152            &mut object,
17153            &["announceAuthorization"],
17154            self.announce_authorization.as_ref(),
17155        );
17156        json::put_many(&mut object, &["translations"], &self.translations);
17157        json::put_many(&mut object, &["formerType"], &self.former_types);
17158        json::put_one(&mut object, &["deleted"], self.deleted.as_ref());
17159        Value::Object(object)
17160    }
17161}
17162
17163/// Translator credit and source freshness for one language version of an
17164/// {@link Object}, as defined by the draft
17165/// [FEP-22cd](https://w3id.org/fep/22cd).  This is embedded metadata, not an
17166/// independent post or activity target.  Its optional identifier need not be
17167/// dereferenceable and does not establish trust in embedded translator actors.
17168///
17169/// The type `https://w3id.org/fep/22cd#Translation`.
17170#[derive(Clone, Debug, Default, PartialEq)]
17171pub struct Translation {
17172    /// The translated language.  Publishers must match a language in the
17173    /// containing object's content, name, or summary map.
17174    pub language: Option<String>,
17175    /// The actors credited for this language version.  Their order has no
17176    /// meaning.  Human actors credit translation or review; Application and
17177    /// Service actors credit machine output.  If any actor cannot be resolved,
17178    /// the entry's human-or-machine status is unknown.  Credit is asserted by
17179    /// the publisher and grants no publishing authority.  Embedded actors with
17180    /// identifiers are fetched before being returned unless explicitly trusted.
17181    pub translators: Vec<AnyActor>,
17182    /// The identifier of the containing object.  FEP-22cd translations share
17183    /// that object's identity rather than introducing separate posts.
17184    pub original: Option<Iri>,
17185    /// The source object's updated timestamp (or published timestamp if it has
17186    /// no updated timestamp) at the last human review of this translation.
17187    /// An absent value makes no freshness claim.  A value earlier than the
17188    /// current source timestamp indicates a potentially stale translation;
17189    /// an equal or later value reflects the current source.
17190    pub source_updated: Option<String>,
17191    /// An optional public revision resource identifying the source reviewed.
17192    /// Supplements sourceUpdated without requiring private revision history
17193    /// to be exposed.
17194    pub basis: Option<Iri>,
17195    /// Links to renderings of this specific language version.
17196    pub urls: Vec<LinkOrIri>,
17197}
17198
17199impl Translation {
17200    /// The type's IRI.
17201    pub const TYPE_IRI: &'static str = "https://w3id.org/fep/22cd#Translation";
17202    /// The type's `type` in a normalised document.
17203    pub const TYPE: &'static str = "Translation";
17204}
17205
17206impl json::Typed for Translation {
17207    const TYPE: &'static str = "Translation";
17208}
17209
17210impl FromJson for Translation {
17211    fn from_json(value: &Value) -> Result<Self, JsonError> {
17212        let object = json::object(value)?;
17213        json::expect_type(object, Self::TYPE)?;
17214        Ok(Self {
17215            language: json::one(object, &["inLanguage"]),
17216            translators: json::many(object, &["translator"]),
17217            original: json::one(object, &["translationOfWork"]),
17218            source_updated: json::one(object, &["sourceUpdated"]),
17219            basis: json::one(object, &["isBasedOn"]),
17220            urls: json::many(object, &["url"]),
17221        })
17222    }
17223}
17224
17225impl ToJson for Translation {
17226    fn to_json(&self) -> Value {
17227        let mut object = json::new_object(Some(Self::TYPE), None);
17228        json::put_one(&mut object, &["inLanguage"], self.language.as_ref());
17229        json::put_many(&mut object, &["translator"], &self.translators);
17230        json::put_one(&mut object, &["translationOfWork"], self.original.as_ref());
17231        json::put_one(
17232            &mut object,
17233            &["sourceUpdated"],
17234            self.source_updated.as_ref(),
17235        );
17236        json::put_one(&mut object, &["isBasedOn"], self.basis.as_ref());
17237        json::put_many(&mut object, &["url"], &self.urls);
17238        Value::Object(object)
17239    }
17240}
17241
17242/// Indicates that the `actor` is traveling to `target` from `origin`.
17243/// `Travel` is an `IntransitiveObject` whose `actor` specifies the direct object.
17244/// If the `target` or `origin` are not specified,
17245/// either can be determined by context.
17246///
17247/// The type `https://www.w3.org/ns/activitystreams#Travel`.
17248#[derive(Clone, Debug, Default, PartialEq)]
17249pub struct Travel {
17250    /// The IRI that identifies this object.
17251    pub id: Option<Iri>,
17252    /// See [`Object::attachments`].
17253    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
17254    /// See [`Object::attributions`].
17255    pub attributions: Vec<AnyActor>,
17256    /// See [`Object::audiences`].
17257    pub audiences: Vec<AnyObject>,
17258    /// See [`Object::content`].
17259    pub content: Text,
17260    /// See [`Object::contexts`].
17261    pub contexts: Vec<LinkOrObject>,
17262    /// See [`Object::name`].
17263    pub name: Text,
17264    /// See [`Object::end_time`].
17265    pub end_time: Option<String>,
17266    /// See [`Object::generators`].
17267    pub generators: Vec<LinkOrObject>,
17268    /// See [`Object::icons`].
17269    pub icons: Vec<Reference<Image>>,
17270    /// See [`Object::images`].
17271    pub images: Vec<Reference<Image>>,
17272    /// See [`Object::reply_targets`].
17273    pub reply_targets: Vec<LinkOrObject>,
17274    /// See [`Object::locations`].
17275    pub locations: Vec<LinkOrObject>,
17276    /// See [`Object::previews`].
17277    pub previews: Vec<LinkOrObject>,
17278    /// See [`Object::published`].
17279    pub published: Option<String>,
17280    /// See [`Object::replies`].
17281    pub replies: Option<AnyCollection>,
17282    /// See [`Object::shares`].
17283    pub shares: Option<AnyCollection>,
17284    /// See [`Object::likes`].
17285    pub likes: Option<AnyCollection>,
17286    /// See [`Object::emoji_reactions`].
17287    pub emoji_reactions: Option<AnyCollection>,
17288    /// See [`Object::start_time`].
17289    pub start_time: Option<String>,
17290    /// See [`Object::summary`].
17291    pub summary: Text,
17292    /// See [`Object::tags`].
17293    pub tags: Vec<LinkOrObject>,
17294    /// See [`Object::updated`].
17295    pub updated: Option<String>,
17296    /// See [`Object::urls`].
17297    pub urls: Vec<LinkOrIri>,
17298    /// See [`Object::tos`].
17299    pub tos: Vec<AnyObject>,
17300    /// See [`Object::btos`].
17301    pub btos: Vec<AnyObject>,
17302    /// See [`Object::ccs`].
17303    pub ccs: Vec<AnyObject>,
17304    /// See [`Object::bccs`].
17305    pub bccs: Vec<AnyObject>,
17306    /// See [`Object::media_type`].
17307    pub media_type: Option<String>,
17308    /// See [`Object::duration`].
17309    pub duration: Option<String>,
17310    /// See [`Object::sensitive`].
17311    pub sensitive: Option<bool>,
17312    /// See [`Object::source`].
17313    pub source: Option<Box<Source>>,
17314    /// See [`Object::proofs`].
17315    pub proofs: Vec<Reference<DataIntegrityProof>>,
17316    /// See [`Object::interaction_policy`].
17317    pub interaction_policy: Option<Box<InteractionPolicy>>,
17318    /// See [`Object::approved_by`].
17319    pub approved_by: Option<Iri>,
17320    /// See [`Object::like_authorization`].
17321    pub like_authorization: Option<Reference<LikeAuthorization>>,
17322    /// See [`Object::reply_authorization`].
17323    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
17324    /// See [`Object::announce_authorization`].
17325    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
17326    /// See [`Object::translations`].
17327    pub translations: Vec<Translation>,
17328    /// See [`Activity::actors`].
17329    pub actors: Vec<AnyActor>,
17330    /// See [`Activity::objects`].
17331    pub objects: Vec<AnyObject>,
17332    /// See [`Activity::targets`].
17333    pub targets: Vec<AnyObject>,
17334    /// See [`Activity::results`].
17335    pub results: Vec<AnyObject>,
17336    /// See [`Activity::origins`].
17337    pub origins: Vec<AnyObject>,
17338    /// See [`Activity::instruments`].
17339    pub instruments: Vec<AnyObject>,
17340}
17341
17342impl Travel {
17343    /// The type's IRI.
17344    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Travel";
17345    /// The type's `type` in a normalised document.
17346    pub const TYPE: &'static str = "Travel";
17347}
17348
17349impl json::Typed for Travel {
17350    const TYPE: &'static str = "Travel";
17351}
17352
17353impl FromJson for Travel {
17354    fn from_json(value: &Value) -> Result<Self, JsonError> {
17355        let object = json::object(value)?;
17356        json::expect_type(object, Self::TYPE)?;
17357        Ok(Self {
17358            id: json::id(object),
17359            attachments: json::many(object, &["attachment"]),
17360            attributions: json::many(object, &["attributedTo"]),
17361            audiences: json::many(object, &["audience"]),
17362            content: json::text(object, "content"),
17363            contexts: json::many(object, &["context"]),
17364            name: json::text(object, "name"),
17365            end_time: json::one(object, &["endTime"]),
17366            generators: json::many(object, &["generator"]),
17367            icons: json::many_mapped(object, &["icon"], json::link_to_image),
17368            images: json::many_mapped(object, &["image"], json::link_to_image),
17369            reply_targets: json::many(object, &["inReplyTo"]),
17370            locations: json::many(object, &["location"]),
17371            previews: json::many(object, &["preview"]),
17372            published: json::one(object, &["published"]),
17373            replies: json::one(object, &["replies"]),
17374            shares: json::one(object, &["shares"]),
17375            likes: json::one(object, &["likes"]),
17376            emoji_reactions: json::one(object, &["emojiReactions"]),
17377            start_time: json::one(object, &["startTime"]),
17378            summary: json::text(object, "summary"),
17379            tags: json::many(object, &["tag"]),
17380            updated: json::one(object, &["updated"]),
17381            urls: json::many(object, &["url"]),
17382            tos: json::many(object, &["to"]),
17383            btos: json::many(object, &["bto"]),
17384            ccs: json::many(object, &["cc"]),
17385            bccs: json::many(object, &["bcc"]),
17386            media_type: json::one(object, &["mediaType"]),
17387            duration: json::one(object, &["duration"]),
17388            sensitive: json::one(object, &["sensitive"]),
17389            source: json::one(object, &["source"]),
17390            proofs: json::many(object, &["proof"]),
17391            interaction_policy: json::one(object, &["interactionPolicy"]),
17392            approved_by: json::one(object, &["approvedBy"]),
17393            like_authorization: json::one(object, &["likeAuthorization"]),
17394            reply_authorization: json::one(object, &["replyAuthorization"]),
17395            announce_authorization: json::one(object, &["announceAuthorization"]),
17396            translations: json::many(object, &["translations"]),
17397            actors: json::many(object, &["actor"]),
17398            objects: json::many(object, &["object"]),
17399            targets: json::many(object, &["target"]),
17400            results: json::many(object, &["result"]),
17401            origins: json::many(object, &["origin"]),
17402            instruments: json::many(object, &["instrument"]),
17403        })
17404    }
17405}
17406
17407impl ToJson for Travel {
17408    fn to_json(&self) -> Value {
17409        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
17410        json::put_many(&mut object, &["attachment"], &self.attachments);
17411        json::put_many(&mut object, &["attributedTo"], &self.attributions);
17412        json::put_many(&mut object, &["audience"], &self.audiences);
17413        json::put_text(&mut object, "content", &self.content);
17414        json::put_many(&mut object, &["context"], &self.contexts);
17415        json::put_text(&mut object, "name", &self.name);
17416        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
17417        json::put_many(&mut object, &["generator"], &self.generators);
17418        json::put_many(&mut object, &["icon"], &self.icons);
17419        json::put_many(&mut object, &["image"], &self.images);
17420        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
17421        json::put_many(&mut object, &["location"], &self.locations);
17422        json::put_many(&mut object, &["preview"], &self.previews);
17423        json::put_one(&mut object, &["published"], self.published.as_ref());
17424        json::put_one(&mut object, &["replies"], self.replies.as_ref());
17425        json::put_one(&mut object, &["shares"], self.shares.as_ref());
17426        json::put_one(&mut object, &["likes"], self.likes.as_ref());
17427        json::put_one(
17428            &mut object,
17429            &["emojiReactions"],
17430            self.emoji_reactions.as_ref(),
17431        );
17432        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
17433        json::put_text(&mut object, "summary", &self.summary);
17434        json::put_many(&mut object, &["tag"], &self.tags);
17435        json::put_one(&mut object, &["updated"], self.updated.as_ref());
17436        json::put_many(&mut object, &["url"], &self.urls);
17437        json::put_many(&mut object, &["to"], &self.tos);
17438        json::put_many(&mut object, &["bto"], &self.btos);
17439        json::put_many(&mut object, &["cc"], &self.ccs);
17440        json::put_many(&mut object, &["bcc"], &self.bccs);
17441        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
17442        json::put_one(&mut object, &["duration"], self.duration.as_ref());
17443        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
17444        json::put_one(&mut object, &["source"], self.source.as_ref());
17445        json::put_many(&mut object, &["proof"], &self.proofs);
17446        json::put_one(
17447            &mut object,
17448            &["interactionPolicy"],
17449            self.interaction_policy.as_ref(),
17450        );
17451        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
17452        json::put_one(
17453            &mut object,
17454            &["likeAuthorization"],
17455            self.like_authorization.as_ref(),
17456        );
17457        json::put_one(
17458            &mut object,
17459            &["replyAuthorization"],
17460            self.reply_authorization.as_ref(),
17461        );
17462        json::put_one(
17463            &mut object,
17464            &["announceAuthorization"],
17465            self.announce_authorization.as_ref(),
17466        );
17467        json::put_many(&mut object, &["translations"], &self.translations);
17468        json::put_many(&mut object, &["actor"], &self.actors);
17469        json::put_many(&mut object, &["object"], &self.objects);
17470        json::put_many(&mut object, &["target"], &self.targets);
17471        json::put_many(&mut object, &["result"], &self.results);
17472        json::put_many(&mut object, &["origin"], &self.origins);
17473        json::put_many(&mut object, &["instrument"], &self.instruments);
17474        Value::Object(object)
17475    }
17476}
17477
17478/// Indicates that the `actor` is undoing the `object`.  In most cases,
17479/// the `object` will be an {@link Activity} describing some previously performed
17480/// action (for instance, a person may have previously "liked" an article but,
17481/// for whatever reason, might choose to undo that like at some later point in
17482/// time).
17483///
17484/// The type `https://www.w3.org/ns/activitystreams#Undo`.
17485#[derive(Clone, Debug, Default, PartialEq)]
17486pub struct Undo {
17487    /// The IRI that identifies this object.
17488    pub id: Option<Iri>,
17489    /// See [`Object::attachments`].
17490    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
17491    /// See [`Object::attributions`].
17492    pub attributions: Vec<AnyActor>,
17493    /// See [`Object::audiences`].
17494    pub audiences: Vec<AnyObject>,
17495    /// See [`Object::content`].
17496    pub content: Text,
17497    /// See [`Object::contexts`].
17498    pub contexts: Vec<LinkOrObject>,
17499    /// See [`Object::name`].
17500    pub name: Text,
17501    /// See [`Object::end_time`].
17502    pub end_time: Option<String>,
17503    /// See [`Object::generators`].
17504    pub generators: Vec<LinkOrObject>,
17505    /// See [`Object::icons`].
17506    pub icons: Vec<Reference<Image>>,
17507    /// See [`Object::images`].
17508    pub images: Vec<Reference<Image>>,
17509    /// See [`Object::reply_targets`].
17510    pub reply_targets: Vec<LinkOrObject>,
17511    /// See [`Object::locations`].
17512    pub locations: Vec<LinkOrObject>,
17513    /// See [`Object::previews`].
17514    pub previews: Vec<LinkOrObject>,
17515    /// See [`Object::published`].
17516    pub published: Option<String>,
17517    /// See [`Object::replies`].
17518    pub replies: Option<AnyCollection>,
17519    /// See [`Object::shares`].
17520    pub shares: Option<AnyCollection>,
17521    /// See [`Object::likes`].
17522    pub likes: Option<AnyCollection>,
17523    /// See [`Object::emoji_reactions`].
17524    pub emoji_reactions: Option<AnyCollection>,
17525    /// See [`Object::start_time`].
17526    pub start_time: Option<String>,
17527    /// See [`Object::summary`].
17528    pub summary: Text,
17529    /// See [`Object::tags`].
17530    pub tags: Vec<LinkOrObject>,
17531    /// See [`Object::updated`].
17532    pub updated: Option<String>,
17533    /// See [`Object::urls`].
17534    pub urls: Vec<LinkOrIri>,
17535    /// See [`Object::tos`].
17536    pub tos: Vec<AnyObject>,
17537    /// See [`Object::btos`].
17538    pub btos: Vec<AnyObject>,
17539    /// See [`Object::ccs`].
17540    pub ccs: Vec<AnyObject>,
17541    /// See [`Object::bccs`].
17542    pub bccs: Vec<AnyObject>,
17543    /// See [`Object::media_type`].
17544    pub media_type: Option<String>,
17545    /// See [`Object::duration`].
17546    pub duration: Option<String>,
17547    /// See [`Object::sensitive`].
17548    pub sensitive: Option<bool>,
17549    /// See [`Object::source`].
17550    pub source: Option<Box<Source>>,
17551    /// See [`Object::proofs`].
17552    pub proofs: Vec<Reference<DataIntegrityProof>>,
17553    /// See [`Object::interaction_policy`].
17554    pub interaction_policy: Option<Box<InteractionPolicy>>,
17555    /// See [`Object::approved_by`].
17556    pub approved_by: Option<Iri>,
17557    /// See [`Object::like_authorization`].
17558    pub like_authorization: Option<Reference<LikeAuthorization>>,
17559    /// See [`Object::reply_authorization`].
17560    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
17561    /// See [`Object::announce_authorization`].
17562    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
17563    /// See [`Object::translations`].
17564    pub translations: Vec<Translation>,
17565    /// See [`Activity::actors`].
17566    pub actors: Vec<AnyActor>,
17567    /// See [`Activity::objects`].
17568    pub objects: Vec<AnyObject>,
17569    /// See [`Activity::targets`].
17570    pub targets: Vec<AnyObject>,
17571    /// See [`Activity::results`].
17572    pub results: Vec<AnyObject>,
17573    /// See [`Activity::origins`].
17574    pub origins: Vec<AnyObject>,
17575    /// See [`Activity::instruments`].
17576    pub instruments: Vec<AnyObject>,
17577}
17578
17579impl Undo {
17580    /// The type's IRI.
17581    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Undo";
17582    /// The type's `type` in a normalised document.
17583    pub const TYPE: &'static str = "Undo";
17584}
17585
17586impl json::Typed for Undo {
17587    const TYPE: &'static str = "Undo";
17588}
17589
17590impl FromJson for Undo {
17591    fn from_json(value: &Value) -> Result<Self, JsonError> {
17592        let object = json::object(value)?;
17593        json::expect_type(object, Self::TYPE)?;
17594        Ok(Self {
17595            id: json::id(object),
17596            attachments: json::many(object, &["attachment"]),
17597            attributions: json::many(object, &["attributedTo"]),
17598            audiences: json::many(object, &["audience"]),
17599            content: json::text(object, "content"),
17600            contexts: json::many(object, &["context"]),
17601            name: json::text(object, "name"),
17602            end_time: json::one(object, &["endTime"]),
17603            generators: json::many(object, &["generator"]),
17604            icons: json::many_mapped(object, &["icon"], json::link_to_image),
17605            images: json::many_mapped(object, &["image"], json::link_to_image),
17606            reply_targets: json::many(object, &["inReplyTo"]),
17607            locations: json::many(object, &["location"]),
17608            previews: json::many(object, &["preview"]),
17609            published: json::one(object, &["published"]),
17610            replies: json::one(object, &["replies"]),
17611            shares: json::one(object, &["shares"]),
17612            likes: json::one(object, &["likes"]),
17613            emoji_reactions: json::one(object, &["emojiReactions"]),
17614            start_time: json::one(object, &["startTime"]),
17615            summary: json::text(object, "summary"),
17616            tags: json::many(object, &["tag"]),
17617            updated: json::one(object, &["updated"]),
17618            urls: json::many(object, &["url"]),
17619            tos: json::many(object, &["to"]),
17620            btos: json::many(object, &["bto"]),
17621            ccs: json::many(object, &["cc"]),
17622            bccs: json::many(object, &["bcc"]),
17623            media_type: json::one(object, &["mediaType"]),
17624            duration: json::one(object, &["duration"]),
17625            sensitive: json::one(object, &["sensitive"]),
17626            source: json::one(object, &["source"]),
17627            proofs: json::many(object, &["proof"]),
17628            interaction_policy: json::one(object, &["interactionPolicy"]),
17629            approved_by: json::one(object, &["approvedBy"]),
17630            like_authorization: json::one(object, &["likeAuthorization"]),
17631            reply_authorization: json::one(object, &["replyAuthorization"]),
17632            announce_authorization: json::one(object, &["announceAuthorization"]),
17633            translations: json::many(object, &["translations"]),
17634            actors: json::many(object, &["actor"]),
17635            objects: json::many(object, &["object"]),
17636            targets: json::many(object, &["target"]),
17637            results: json::many(object, &["result"]),
17638            origins: json::many(object, &["origin"]),
17639            instruments: json::many(object, &["instrument"]),
17640        })
17641    }
17642}
17643
17644impl ToJson for Undo {
17645    fn to_json(&self) -> Value {
17646        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
17647        json::put_many(&mut object, &["attachment"], &self.attachments);
17648        json::put_many(&mut object, &["attributedTo"], &self.attributions);
17649        json::put_many(&mut object, &["audience"], &self.audiences);
17650        json::put_text(&mut object, "content", &self.content);
17651        json::put_many(&mut object, &["context"], &self.contexts);
17652        json::put_text(&mut object, "name", &self.name);
17653        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
17654        json::put_many(&mut object, &["generator"], &self.generators);
17655        json::put_many(&mut object, &["icon"], &self.icons);
17656        json::put_many(&mut object, &["image"], &self.images);
17657        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
17658        json::put_many(&mut object, &["location"], &self.locations);
17659        json::put_many(&mut object, &["preview"], &self.previews);
17660        json::put_one(&mut object, &["published"], self.published.as_ref());
17661        json::put_one(&mut object, &["replies"], self.replies.as_ref());
17662        json::put_one(&mut object, &["shares"], self.shares.as_ref());
17663        json::put_one(&mut object, &["likes"], self.likes.as_ref());
17664        json::put_one(
17665            &mut object,
17666            &["emojiReactions"],
17667            self.emoji_reactions.as_ref(),
17668        );
17669        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
17670        json::put_text(&mut object, "summary", &self.summary);
17671        json::put_many(&mut object, &["tag"], &self.tags);
17672        json::put_one(&mut object, &["updated"], self.updated.as_ref());
17673        json::put_many(&mut object, &["url"], &self.urls);
17674        json::put_many(&mut object, &["to"], &self.tos);
17675        json::put_many(&mut object, &["bto"], &self.btos);
17676        json::put_many(&mut object, &["cc"], &self.ccs);
17677        json::put_many(&mut object, &["bcc"], &self.bccs);
17678        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
17679        json::put_one(&mut object, &["duration"], self.duration.as_ref());
17680        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
17681        json::put_one(&mut object, &["source"], self.source.as_ref());
17682        json::put_many(&mut object, &["proof"], &self.proofs);
17683        json::put_one(
17684            &mut object,
17685            &["interactionPolicy"],
17686            self.interaction_policy.as_ref(),
17687        );
17688        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
17689        json::put_one(
17690            &mut object,
17691            &["likeAuthorization"],
17692            self.like_authorization.as_ref(),
17693        );
17694        json::put_one(
17695            &mut object,
17696            &["replyAuthorization"],
17697            self.reply_authorization.as_ref(),
17698        );
17699        json::put_one(
17700            &mut object,
17701            &["announceAuthorization"],
17702            self.announce_authorization.as_ref(),
17703        );
17704        json::put_many(&mut object, &["translations"], &self.translations);
17705        json::put_many(&mut object, &["actor"], &self.actors);
17706        json::put_many(&mut object, &["object"], &self.objects);
17707        json::put_many(&mut object, &["target"], &self.targets);
17708        json::put_many(&mut object, &["result"], &self.results);
17709        json::put_many(&mut object, &["origin"], &self.origins);
17710        json::put_many(&mut object, &["instrument"], &self.instruments);
17711        Value::Object(object)
17712    }
17713}
17714
17715/// Indicates that the `actor` has updated the `object`.  Note, however,
17716/// that this vocabulary does not define a mechanism for describing the actual
17717/// set of modifications made to `object`.
17718///
17719/// The type `https://www.w3.org/ns/activitystreams#Update`.
17720#[derive(Clone, Debug, Default, PartialEq)]
17721pub struct Update {
17722    /// The IRI that identifies this object.
17723    pub id: Option<Iri>,
17724    /// See [`Object::attachments`].
17725    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
17726    /// See [`Object::attributions`].
17727    pub attributions: Vec<AnyActor>,
17728    /// See [`Object::audiences`].
17729    pub audiences: Vec<AnyObject>,
17730    /// See [`Object::content`].
17731    pub content: Text,
17732    /// See [`Object::contexts`].
17733    pub contexts: Vec<LinkOrObject>,
17734    /// See [`Object::name`].
17735    pub name: Text,
17736    /// See [`Object::end_time`].
17737    pub end_time: Option<String>,
17738    /// See [`Object::generators`].
17739    pub generators: Vec<LinkOrObject>,
17740    /// See [`Object::icons`].
17741    pub icons: Vec<Reference<Image>>,
17742    /// See [`Object::images`].
17743    pub images: Vec<Reference<Image>>,
17744    /// See [`Object::reply_targets`].
17745    pub reply_targets: Vec<LinkOrObject>,
17746    /// See [`Object::locations`].
17747    pub locations: Vec<LinkOrObject>,
17748    /// See [`Object::previews`].
17749    pub previews: Vec<LinkOrObject>,
17750    /// See [`Object::published`].
17751    pub published: Option<String>,
17752    /// See [`Object::replies`].
17753    pub replies: Option<AnyCollection>,
17754    /// See [`Object::shares`].
17755    pub shares: Option<AnyCollection>,
17756    /// See [`Object::likes`].
17757    pub likes: Option<AnyCollection>,
17758    /// See [`Object::emoji_reactions`].
17759    pub emoji_reactions: Option<AnyCollection>,
17760    /// See [`Object::start_time`].
17761    pub start_time: Option<String>,
17762    /// See [`Object::summary`].
17763    pub summary: Text,
17764    /// See [`Object::tags`].
17765    pub tags: Vec<LinkOrObject>,
17766    /// See [`Object::updated`].
17767    pub updated: Option<String>,
17768    /// See [`Object::urls`].
17769    pub urls: Vec<LinkOrIri>,
17770    /// See [`Object::tos`].
17771    pub tos: Vec<AnyObject>,
17772    /// See [`Object::btos`].
17773    pub btos: Vec<AnyObject>,
17774    /// See [`Object::ccs`].
17775    pub ccs: Vec<AnyObject>,
17776    /// See [`Object::bccs`].
17777    pub bccs: Vec<AnyObject>,
17778    /// See [`Object::media_type`].
17779    pub media_type: Option<String>,
17780    /// See [`Object::duration`].
17781    pub duration: Option<String>,
17782    /// See [`Object::sensitive`].
17783    pub sensitive: Option<bool>,
17784    /// See [`Object::source`].
17785    pub source: Option<Box<Source>>,
17786    /// See [`Object::proofs`].
17787    pub proofs: Vec<Reference<DataIntegrityProof>>,
17788    /// See [`Object::interaction_policy`].
17789    pub interaction_policy: Option<Box<InteractionPolicy>>,
17790    /// See [`Object::approved_by`].
17791    pub approved_by: Option<Iri>,
17792    /// See [`Object::like_authorization`].
17793    pub like_authorization: Option<Reference<LikeAuthorization>>,
17794    /// See [`Object::reply_authorization`].
17795    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
17796    /// See [`Object::announce_authorization`].
17797    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
17798    /// See [`Object::translations`].
17799    pub translations: Vec<Translation>,
17800    /// See [`Activity::actors`].
17801    pub actors: Vec<AnyActor>,
17802    /// See [`Activity::objects`].
17803    pub objects: Vec<AnyObject>,
17804    /// See [`Activity::targets`].
17805    pub targets: Vec<AnyObject>,
17806    /// See [`Activity::results`].
17807    pub results: Vec<AnyObject>,
17808    /// See [`Activity::origins`].
17809    pub origins: Vec<AnyObject>,
17810    /// See [`Activity::instruments`].
17811    pub instruments: Vec<AnyObject>,
17812}
17813
17814impl Update {
17815    /// The type's IRI.
17816    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Update";
17817    /// The type's `type` in a normalised document.
17818    pub const TYPE: &'static str = "Update";
17819}
17820
17821impl json::Typed for Update {
17822    const TYPE: &'static str = "Update";
17823}
17824
17825impl FromJson for Update {
17826    fn from_json(value: &Value) -> Result<Self, JsonError> {
17827        let object = json::object(value)?;
17828        json::expect_type(object, Self::TYPE)?;
17829        Ok(Self {
17830            id: json::id(object),
17831            attachments: json::many(object, &["attachment"]),
17832            attributions: json::many(object, &["attributedTo"]),
17833            audiences: json::many(object, &["audience"]),
17834            content: json::text(object, "content"),
17835            contexts: json::many(object, &["context"]),
17836            name: json::text(object, "name"),
17837            end_time: json::one(object, &["endTime"]),
17838            generators: json::many(object, &["generator"]),
17839            icons: json::many_mapped(object, &["icon"], json::link_to_image),
17840            images: json::many_mapped(object, &["image"], json::link_to_image),
17841            reply_targets: json::many(object, &["inReplyTo"]),
17842            locations: json::many(object, &["location"]),
17843            previews: json::many(object, &["preview"]),
17844            published: json::one(object, &["published"]),
17845            replies: json::one(object, &["replies"]),
17846            shares: json::one(object, &["shares"]),
17847            likes: json::one(object, &["likes"]),
17848            emoji_reactions: json::one(object, &["emojiReactions"]),
17849            start_time: json::one(object, &["startTime"]),
17850            summary: json::text(object, "summary"),
17851            tags: json::many(object, &["tag"]),
17852            updated: json::one(object, &["updated"]),
17853            urls: json::many(object, &["url"]),
17854            tos: json::many(object, &["to"]),
17855            btos: json::many(object, &["bto"]),
17856            ccs: json::many(object, &["cc"]),
17857            bccs: json::many(object, &["bcc"]),
17858            media_type: json::one(object, &["mediaType"]),
17859            duration: json::one(object, &["duration"]),
17860            sensitive: json::one(object, &["sensitive"]),
17861            source: json::one(object, &["source"]),
17862            proofs: json::many(object, &["proof"]),
17863            interaction_policy: json::one(object, &["interactionPolicy"]),
17864            approved_by: json::one(object, &["approvedBy"]),
17865            like_authorization: json::one(object, &["likeAuthorization"]),
17866            reply_authorization: json::one(object, &["replyAuthorization"]),
17867            announce_authorization: json::one(object, &["announceAuthorization"]),
17868            translations: json::many(object, &["translations"]),
17869            actors: json::many(object, &["actor"]),
17870            objects: json::many(object, &["object"]),
17871            targets: json::many(object, &["target"]),
17872            results: json::many(object, &["result"]),
17873            origins: json::many(object, &["origin"]),
17874            instruments: json::many(object, &["instrument"]),
17875        })
17876    }
17877}
17878
17879impl ToJson for Update {
17880    fn to_json(&self) -> Value {
17881        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
17882        json::put_many(&mut object, &["attachment"], &self.attachments);
17883        json::put_many(&mut object, &["attributedTo"], &self.attributions);
17884        json::put_many(&mut object, &["audience"], &self.audiences);
17885        json::put_text(&mut object, "content", &self.content);
17886        json::put_many(&mut object, &["context"], &self.contexts);
17887        json::put_text(&mut object, "name", &self.name);
17888        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
17889        json::put_many(&mut object, &["generator"], &self.generators);
17890        json::put_many(&mut object, &["icon"], &self.icons);
17891        json::put_many(&mut object, &["image"], &self.images);
17892        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
17893        json::put_many(&mut object, &["location"], &self.locations);
17894        json::put_many(&mut object, &["preview"], &self.previews);
17895        json::put_one(&mut object, &["published"], self.published.as_ref());
17896        json::put_one(&mut object, &["replies"], self.replies.as_ref());
17897        json::put_one(&mut object, &["shares"], self.shares.as_ref());
17898        json::put_one(&mut object, &["likes"], self.likes.as_ref());
17899        json::put_one(
17900            &mut object,
17901            &["emojiReactions"],
17902            self.emoji_reactions.as_ref(),
17903        );
17904        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
17905        json::put_text(&mut object, "summary", &self.summary);
17906        json::put_many(&mut object, &["tag"], &self.tags);
17907        json::put_one(&mut object, &["updated"], self.updated.as_ref());
17908        json::put_many(&mut object, &["url"], &self.urls);
17909        json::put_many(&mut object, &["to"], &self.tos);
17910        json::put_many(&mut object, &["bto"], &self.btos);
17911        json::put_many(&mut object, &["cc"], &self.ccs);
17912        json::put_many(&mut object, &["bcc"], &self.bccs);
17913        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
17914        json::put_one(&mut object, &["duration"], self.duration.as_ref());
17915        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
17916        json::put_one(&mut object, &["source"], self.source.as_ref());
17917        json::put_many(&mut object, &["proof"], &self.proofs);
17918        json::put_one(
17919            &mut object,
17920            &["interactionPolicy"],
17921            self.interaction_policy.as_ref(),
17922        );
17923        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
17924        json::put_one(
17925            &mut object,
17926            &["likeAuthorization"],
17927            self.like_authorization.as_ref(),
17928        );
17929        json::put_one(
17930            &mut object,
17931            &["replyAuthorization"],
17932            self.reply_authorization.as_ref(),
17933        );
17934        json::put_one(
17935            &mut object,
17936            &["announceAuthorization"],
17937            self.announce_authorization.as_ref(),
17938        );
17939        json::put_many(&mut object, &["translations"], &self.translations);
17940        json::put_many(&mut object, &["actor"], &self.actors);
17941        json::put_many(&mut object, &["object"], &self.objects);
17942        json::put_many(&mut object, &["target"], &self.targets);
17943        json::put_many(&mut object, &["result"], &self.results);
17944        json::put_many(&mut object, &["origin"], &self.origins);
17945        json::put_many(&mut object, &["instrument"], &self.instruments);
17946        Value::Object(object)
17947    }
17948}
17949
17950/// Represents a video document of any kind.
17951///
17952/// The type `https://www.w3.org/ns/activitystreams#Video`.
17953#[derive(Clone, Debug, Default, PartialEq)]
17954pub struct Video {
17955    /// The IRI that identifies this object.
17956    pub id: Option<Iri>,
17957    /// See [`Object::attachments`].
17958    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
17959    /// See [`Object::attributions`].
17960    pub attributions: Vec<AnyActor>,
17961    /// See [`Object::audiences`].
17962    pub audiences: Vec<AnyObject>,
17963    /// See [`Object::content`].
17964    pub content: Text,
17965    /// See [`Object::contexts`].
17966    pub contexts: Vec<LinkOrObject>,
17967    /// See [`Object::name`].
17968    pub name: Text,
17969    /// See [`Object::end_time`].
17970    pub end_time: Option<String>,
17971    /// See [`Object::generators`].
17972    pub generators: Vec<LinkOrObject>,
17973    /// See [`Object::icons`].
17974    pub icons: Vec<Reference<Image>>,
17975    /// See [`Object::images`].
17976    pub images: Vec<Reference<Image>>,
17977    /// See [`Object::reply_targets`].
17978    pub reply_targets: Vec<LinkOrObject>,
17979    /// See [`Object::locations`].
17980    pub locations: Vec<LinkOrObject>,
17981    /// See [`Object::previews`].
17982    pub previews: Vec<LinkOrObject>,
17983    /// See [`Object::published`].
17984    pub published: Option<String>,
17985    /// See [`Object::replies`].
17986    pub replies: Option<AnyCollection>,
17987    /// See [`Object::shares`].
17988    pub shares: Option<AnyCollection>,
17989    /// See [`Object::likes`].
17990    pub likes: Option<AnyCollection>,
17991    /// See [`Object::emoji_reactions`].
17992    pub emoji_reactions: Option<AnyCollection>,
17993    /// See [`Object::start_time`].
17994    pub start_time: Option<String>,
17995    /// See [`Object::summary`].
17996    pub summary: Text,
17997    /// See [`Object::tags`].
17998    pub tags: Vec<LinkOrObject>,
17999    /// See [`Object::updated`].
18000    pub updated: Option<String>,
18001    /// See [`Object::urls`].
18002    pub urls: Vec<LinkOrIri>,
18003    /// See [`Object::tos`].
18004    pub tos: Vec<AnyObject>,
18005    /// See [`Object::btos`].
18006    pub btos: Vec<AnyObject>,
18007    /// See [`Object::ccs`].
18008    pub ccs: Vec<AnyObject>,
18009    /// See [`Object::bccs`].
18010    pub bccs: Vec<AnyObject>,
18011    /// See [`Object::media_type`].
18012    pub media_type: Option<String>,
18013    /// See [`Object::duration`].
18014    pub duration: Option<String>,
18015    /// See [`Object::sensitive`].
18016    pub sensitive: Option<bool>,
18017    /// See [`Object::source`].
18018    pub source: Option<Box<Source>>,
18019    /// See [`Object::proofs`].
18020    pub proofs: Vec<Reference<DataIntegrityProof>>,
18021    /// See [`Object::interaction_policy`].
18022    pub interaction_policy: Option<Box<InteractionPolicy>>,
18023    /// See [`Object::approved_by`].
18024    pub approved_by: Option<Iri>,
18025    /// See [`Object::like_authorization`].
18026    pub like_authorization: Option<Reference<LikeAuthorization>>,
18027    /// See [`Object::reply_authorization`].
18028    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
18029    /// See [`Object::announce_authorization`].
18030    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
18031    /// See [`Object::translations`].
18032    pub translations: Vec<Translation>,
18033    /// See [`Document::width`].
18034    pub width: Option<u64>,
18035    /// See [`Document::height`].
18036    pub height: Option<u64>,
18037    /// See [`Document::digest_multibase`].
18038    pub digest_multibase: Option<String>,
18039    /// See [`Document::blurhash`].
18040    pub blurhash: Option<String>,
18041    /// See [`Document::focal_point`].
18042    pub focal_point: Vec<f64>,
18043    /// Whether replies are accepted: PeerTube's term, which Lemmy sends as
18044    /// the opposite of a post being locked.
18045    pub comments_enabled: Option<bool>,
18046}
18047
18048impl Video {
18049    /// The type's IRI.
18050    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#Video";
18051    /// The type's `type` in a normalised document.
18052    pub const TYPE: &'static str = "Video";
18053}
18054
18055impl json::Typed for Video {
18056    const TYPE: &'static str = "Video";
18057}
18058
18059impl FromJson for Video {
18060    fn from_json(value: &Value) -> Result<Self, JsonError> {
18061        let object = json::object(value)?;
18062        json::expect_type(object, Self::TYPE)?;
18063        Ok(Self {
18064            id: json::id(object),
18065            attachments: json::many(object, &["attachment"]),
18066            attributions: json::many(object, &["attributedTo"]),
18067            audiences: json::many(object, &["audience"]),
18068            content: json::text(object, "content"),
18069            contexts: json::many(object, &["context"]),
18070            name: json::text(object, "name"),
18071            end_time: json::one(object, &["endTime"]),
18072            generators: json::many(object, &["generator"]),
18073            icons: json::many_mapped(object, &["icon"], json::link_to_image),
18074            images: json::many_mapped(object, &["image"], json::link_to_image),
18075            reply_targets: json::many(object, &["inReplyTo"]),
18076            locations: json::many(object, &["location"]),
18077            previews: json::many(object, &["preview"]),
18078            published: json::one(object, &["published"]),
18079            replies: json::one(object, &["replies"]),
18080            shares: json::one(object, &["shares"]),
18081            likes: json::one(object, &["likes"]),
18082            emoji_reactions: json::one(object, &["emojiReactions"]),
18083            start_time: json::one(object, &["startTime"]),
18084            summary: json::text(object, "summary"),
18085            tags: json::many(object, &["tag"]),
18086            updated: json::one(object, &["updated"]),
18087            urls: json::many(object, &["url"]),
18088            tos: json::many(object, &["to"]),
18089            btos: json::many(object, &["bto"]),
18090            ccs: json::many(object, &["cc"]),
18091            bccs: json::many(object, &["bcc"]),
18092            media_type: json::one(object, &["mediaType"]),
18093            duration: json::one(object, &["duration"]),
18094            sensitive: json::one(object, &["sensitive"]),
18095            source: json::one(object, &["source"]),
18096            proofs: json::many(object, &["proof"]),
18097            interaction_policy: json::one(object, &["interactionPolicy"]),
18098            approved_by: json::one(object, &["approvedBy"]),
18099            like_authorization: json::one(object, &["likeAuthorization"]),
18100            reply_authorization: json::one(object, &["replyAuthorization"]),
18101            announce_authorization: json::one(object, &["announceAuthorization"]),
18102            translations: json::many(object, &["translations"]),
18103            width: json::one(object, &["width"]),
18104            height: json::one(object, &["height"]),
18105            digest_multibase: json::one(object, &["digestMultibase"]),
18106            blurhash: json::one(object, &["blurhash"]),
18107            focal_point: json::many(object, &["focalPoint"]),
18108            comments_enabled: json::one(object, &["commentsEnabled"]),
18109        })
18110    }
18111}
18112
18113impl ToJson for Video {
18114    fn to_json(&self) -> Value {
18115        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
18116        json::put_many(&mut object, &["attachment"], &self.attachments);
18117        json::put_many(&mut object, &["attributedTo"], &self.attributions);
18118        json::put_many(&mut object, &["audience"], &self.audiences);
18119        json::put_text(&mut object, "content", &self.content);
18120        json::put_many(&mut object, &["context"], &self.contexts);
18121        json::put_text(&mut object, "name", &self.name);
18122        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
18123        json::put_many(&mut object, &["generator"], &self.generators);
18124        json::put_many(&mut object, &["icon"], &self.icons);
18125        json::put_many(&mut object, &["image"], &self.images);
18126        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
18127        json::put_many(&mut object, &["location"], &self.locations);
18128        json::put_many(&mut object, &["preview"], &self.previews);
18129        json::put_one(&mut object, &["published"], self.published.as_ref());
18130        json::put_one(&mut object, &["replies"], self.replies.as_ref());
18131        json::put_one(&mut object, &["shares"], self.shares.as_ref());
18132        json::put_one(&mut object, &["likes"], self.likes.as_ref());
18133        json::put_one(
18134            &mut object,
18135            &["emojiReactions"],
18136            self.emoji_reactions.as_ref(),
18137        );
18138        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
18139        json::put_text(&mut object, "summary", &self.summary);
18140        json::put_many(&mut object, &["tag"], &self.tags);
18141        json::put_one(&mut object, &["updated"], self.updated.as_ref());
18142        json::put_many(&mut object, &["url"], &self.urls);
18143        json::put_many(&mut object, &["to"], &self.tos);
18144        json::put_many(&mut object, &["bto"], &self.btos);
18145        json::put_many(&mut object, &["cc"], &self.ccs);
18146        json::put_many(&mut object, &["bcc"], &self.bccs);
18147        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
18148        json::put_one(&mut object, &["duration"], self.duration.as_ref());
18149        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
18150        json::put_one(&mut object, &["source"], self.source.as_ref());
18151        json::put_many(&mut object, &["proof"], &self.proofs);
18152        json::put_one(
18153            &mut object,
18154            &["interactionPolicy"],
18155            self.interaction_policy.as_ref(),
18156        );
18157        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
18158        json::put_one(
18159            &mut object,
18160            &["likeAuthorization"],
18161            self.like_authorization.as_ref(),
18162        );
18163        json::put_one(
18164            &mut object,
18165            &["replyAuthorization"],
18166            self.reply_authorization.as_ref(),
18167        );
18168        json::put_one(
18169            &mut object,
18170            &["announceAuthorization"],
18171            self.announce_authorization.as_ref(),
18172        );
18173        json::put_many(&mut object, &["translations"], &self.translations);
18174        json::put_one(&mut object, &["width"], self.width.as_ref());
18175        json::put_one(&mut object, &["height"], self.height.as_ref());
18176        json::put_one(
18177            &mut object,
18178            &["digestMultibase"],
18179            self.digest_multibase.as_ref(),
18180        );
18181        json::put_one(&mut object, &["blurhash"], self.blurhash.as_ref());
18182        json::put_many(&mut object, &["focalPoint"], &self.focal_point);
18183        json::put_one(
18184            &mut object,
18185            &["commentsEnabled"],
18186            self.comments_enabled.as_ref(),
18187        );
18188        Value::Object(object)
18189    }
18190}
18191
18192/// Indicates that the `actor` has viewed the object.
18193///
18194/// The type `https://www.w3.org/ns/activitystreams#View`.
18195#[derive(Clone, Debug, Default, PartialEq)]
18196pub struct View {
18197    /// The IRI that identifies this object.
18198    pub id: Option<Iri>,
18199    /// See [`Object::attachments`].
18200    pub attachments: Vec<LinkOrObjectOrPropertyValue>,
18201    /// See [`Object::attributions`].
18202    pub attributions: Vec<AnyActor>,
18203    /// See [`Object::audiences`].
18204    pub audiences: Vec<AnyObject>,
18205    /// See [`Object::content`].
18206    pub content: Text,
18207    /// See [`Object::contexts`].
18208    pub contexts: Vec<LinkOrObject>,
18209    /// See [`Object::name`].
18210    pub name: Text,
18211    /// See [`Object::end_time`].
18212    pub end_time: Option<String>,
18213    /// See [`Object::generators`].
18214    pub generators: Vec<LinkOrObject>,
18215    /// See [`Object::icons`].
18216    pub icons: Vec<Reference<Image>>,
18217    /// See [`Object::images`].
18218    pub images: Vec<Reference<Image>>,
18219    /// See [`Object::reply_targets`].
18220    pub reply_targets: Vec<LinkOrObject>,
18221    /// See [`Object::locations`].
18222    pub locations: Vec<LinkOrObject>,
18223    /// See [`Object::previews`].
18224    pub previews: Vec<LinkOrObject>,
18225    /// See [`Object::published`].
18226    pub published: Option<String>,
18227    /// See [`Object::replies`].
18228    pub replies: Option<AnyCollection>,
18229    /// See [`Object::shares`].
18230    pub shares: Option<AnyCollection>,
18231    /// See [`Object::likes`].
18232    pub likes: Option<AnyCollection>,
18233    /// See [`Object::emoji_reactions`].
18234    pub emoji_reactions: Option<AnyCollection>,
18235    /// See [`Object::start_time`].
18236    pub start_time: Option<String>,
18237    /// See [`Object::summary`].
18238    pub summary: Text,
18239    /// See [`Object::tags`].
18240    pub tags: Vec<LinkOrObject>,
18241    /// See [`Object::updated`].
18242    pub updated: Option<String>,
18243    /// See [`Object::urls`].
18244    pub urls: Vec<LinkOrIri>,
18245    /// See [`Object::tos`].
18246    pub tos: Vec<AnyObject>,
18247    /// See [`Object::btos`].
18248    pub btos: Vec<AnyObject>,
18249    /// See [`Object::ccs`].
18250    pub ccs: Vec<AnyObject>,
18251    /// See [`Object::bccs`].
18252    pub bccs: Vec<AnyObject>,
18253    /// See [`Object::media_type`].
18254    pub media_type: Option<String>,
18255    /// See [`Object::duration`].
18256    pub duration: Option<String>,
18257    /// See [`Object::sensitive`].
18258    pub sensitive: Option<bool>,
18259    /// See [`Object::source`].
18260    pub source: Option<Box<Source>>,
18261    /// See [`Object::proofs`].
18262    pub proofs: Vec<Reference<DataIntegrityProof>>,
18263    /// See [`Object::interaction_policy`].
18264    pub interaction_policy: Option<Box<InteractionPolicy>>,
18265    /// See [`Object::approved_by`].
18266    pub approved_by: Option<Iri>,
18267    /// See [`Object::like_authorization`].
18268    pub like_authorization: Option<Reference<LikeAuthorization>>,
18269    /// See [`Object::reply_authorization`].
18270    pub reply_authorization: Option<Reference<ReplyAuthorization>>,
18271    /// See [`Object::announce_authorization`].
18272    pub announce_authorization: Option<Reference<AnnounceAuthorization>>,
18273    /// See [`Object::translations`].
18274    pub translations: Vec<Translation>,
18275    /// See [`Activity::actors`].
18276    pub actors: Vec<AnyActor>,
18277    /// See [`Activity::objects`].
18278    pub objects: Vec<AnyObject>,
18279    /// See [`Activity::targets`].
18280    pub targets: Vec<AnyObject>,
18281    /// See [`Activity::results`].
18282    pub results: Vec<AnyObject>,
18283    /// See [`Activity::origins`].
18284    pub origins: Vec<AnyObject>,
18285    /// See [`Activity::instruments`].
18286    pub instruments: Vec<AnyObject>,
18287}
18288
18289impl View {
18290    /// The type's IRI.
18291    pub const TYPE_IRI: &'static str = "https://www.w3.org/ns/activitystreams#View";
18292    /// The type's `type` in a normalised document.
18293    pub const TYPE: &'static str = "View";
18294}
18295
18296impl json::Typed for View {
18297    const TYPE: &'static str = "View";
18298}
18299
18300impl FromJson for View {
18301    fn from_json(value: &Value) -> Result<Self, JsonError> {
18302        let object = json::object(value)?;
18303        json::expect_type(object, Self::TYPE)?;
18304        Ok(Self {
18305            id: json::id(object),
18306            attachments: json::many(object, &["attachment"]),
18307            attributions: json::many(object, &["attributedTo"]),
18308            audiences: json::many(object, &["audience"]),
18309            content: json::text(object, "content"),
18310            contexts: json::many(object, &["context"]),
18311            name: json::text(object, "name"),
18312            end_time: json::one(object, &["endTime"]),
18313            generators: json::many(object, &["generator"]),
18314            icons: json::many_mapped(object, &["icon"], json::link_to_image),
18315            images: json::many_mapped(object, &["image"], json::link_to_image),
18316            reply_targets: json::many(object, &["inReplyTo"]),
18317            locations: json::many(object, &["location"]),
18318            previews: json::many(object, &["preview"]),
18319            published: json::one(object, &["published"]),
18320            replies: json::one(object, &["replies"]),
18321            shares: json::one(object, &["shares"]),
18322            likes: json::one(object, &["likes"]),
18323            emoji_reactions: json::one(object, &["emojiReactions"]),
18324            start_time: json::one(object, &["startTime"]),
18325            summary: json::text(object, "summary"),
18326            tags: json::many(object, &["tag"]),
18327            updated: json::one(object, &["updated"]),
18328            urls: json::many(object, &["url"]),
18329            tos: json::many(object, &["to"]),
18330            btos: json::many(object, &["bto"]),
18331            ccs: json::many(object, &["cc"]),
18332            bccs: json::many(object, &["bcc"]),
18333            media_type: json::one(object, &["mediaType"]),
18334            duration: json::one(object, &["duration"]),
18335            sensitive: json::one(object, &["sensitive"]),
18336            source: json::one(object, &["source"]),
18337            proofs: json::many(object, &["proof"]),
18338            interaction_policy: json::one(object, &["interactionPolicy"]),
18339            approved_by: json::one(object, &["approvedBy"]),
18340            like_authorization: json::one(object, &["likeAuthorization"]),
18341            reply_authorization: json::one(object, &["replyAuthorization"]),
18342            announce_authorization: json::one(object, &["announceAuthorization"]),
18343            translations: json::many(object, &["translations"]),
18344            actors: json::many(object, &["actor"]),
18345            objects: json::many(object, &["object"]),
18346            targets: json::many(object, &["target"]),
18347            results: json::many(object, &["result"]),
18348            origins: json::many(object, &["origin"]),
18349            instruments: json::many(object, &["instrument"]),
18350        })
18351    }
18352}
18353
18354impl ToJson for View {
18355    fn to_json(&self) -> Value {
18356        let mut object = json::new_object(Some(Self::TYPE), self.id.as_ref());
18357        json::put_many(&mut object, &["attachment"], &self.attachments);
18358        json::put_many(&mut object, &["attributedTo"], &self.attributions);
18359        json::put_many(&mut object, &["audience"], &self.audiences);
18360        json::put_text(&mut object, "content", &self.content);
18361        json::put_many(&mut object, &["context"], &self.contexts);
18362        json::put_text(&mut object, "name", &self.name);
18363        json::put_one(&mut object, &["endTime"], self.end_time.as_ref());
18364        json::put_many(&mut object, &["generator"], &self.generators);
18365        json::put_many(&mut object, &["icon"], &self.icons);
18366        json::put_many(&mut object, &["image"], &self.images);
18367        json::put_many(&mut object, &["inReplyTo"], &self.reply_targets);
18368        json::put_many(&mut object, &["location"], &self.locations);
18369        json::put_many(&mut object, &["preview"], &self.previews);
18370        json::put_one(&mut object, &["published"], self.published.as_ref());
18371        json::put_one(&mut object, &["replies"], self.replies.as_ref());
18372        json::put_one(&mut object, &["shares"], self.shares.as_ref());
18373        json::put_one(&mut object, &["likes"], self.likes.as_ref());
18374        json::put_one(
18375            &mut object,
18376            &["emojiReactions"],
18377            self.emoji_reactions.as_ref(),
18378        );
18379        json::put_one(&mut object, &["startTime"], self.start_time.as_ref());
18380        json::put_text(&mut object, "summary", &self.summary);
18381        json::put_many(&mut object, &["tag"], &self.tags);
18382        json::put_one(&mut object, &["updated"], self.updated.as_ref());
18383        json::put_many(&mut object, &["url"], &self.urls);
18384        json::put_many(&mut object, &["to"], &self.tos);
18385        json::put_many(&mut object, &["bto"], &self.btos);
18386        json::put_many(&mut object, &["cc"], &self.ccs);
18387        json::put_many(&mut object, &["bcc"], &self.bccs);
18388        json::put_one(&mut object, &["mediaType"], self.media_type.as_ref());
18389        json::put_one(&mut object, &["duration"], self.duration.as_ref());
18390        json::put_one(&mut object, &["sensitive"], self.sensitive.as_ref());
18391        json::put_one(&mut object, &["source"], self.source.as_ref());
18392        json::put_many(&mut object, &["proof"], &self.proofs);
18393        json::put_one(
18394            &mut object,
18395            &["interactionPolicy"],
18396            self.interaction_policy.as_ref(),
18397        );
18398        json::put_one(&mut object, &["approvedBy"], self.approved_by.as_ref());
18399        json::put_one(
18400            &mut object,
18401            &["likeAuthorization"],
18402            self.like_authorization.as_ref(),
18403        );
18404        json::put_one(
18405            &mut object,
18406            &["replyAuthorization"],
18407            self.reply_authorization.as_ref(),
18408        );
18409        json::put_one(
18410            &mut object,
18411            &["announceAuthorization"],
18412            self.announce_authorization.as_ref(),
18413        );
18414        json::put_many(&mut object, &["translations"], &self.translations);
18415        json::put_many(&mut object, &["actor"], &self.actors);
18416        json::put_many(&mut object, &["object"], &self.objects);
18417        json::put_many(&mut object, &["target"], &self.targets);
18418        json::put_many(&mut object, &["result"], &self.results);
18419        json::put_many(&mut object, &["origin"], &self.origins);
18420        json::put_many(&mut object, &["instrument"], &self.instruments);
18421        Value::Object(object)
18422    }
18423}
18424
18425/// A value of [`Application`], [`Group`], [`Organization`], [`Person`], [`Service`], or of a type extending one of them.
18426#[derive(Clone, Debug, PartialEq)]
18427pub enum AnyActor {
18428    /// A reference, by IRI.
18429    Iri(Iri),
18430    Application(Box<Application>),
18431    Group(Box<Group>),
18432    Organization(Box<Organization>),
18433    Person(Box<Person>),
18434    Service(Box<Service>),
18435    /// Anything no schema describes, as it was.
18436    Other(Value),
18437}
18438
18439impl AnyActor {
18440    /// The IRI of the value: the reference itself, or the object's `id`.
18441    #[must_use]
18442    pub fn id(&self) -> Option<&Iri> {
18443        match self {
18444            Self::Iri(iri) => Some(iri),
18445            Self::Application(object) => object.id.as_ref(),
18446            Self::Group(object) => object.id.as_ref(),
18447            Self::Organization(object) => object.id.as_ref(),
18448            Self::Person(object) => object.id.as_ref(),
18449            Self::Service(object) => object.id.as_ref(),
18450            _ => None,
18451        }
18452    }
18453}
18454
18455impl FromJson for AnyActor {
18456    fn from_json(value: &Value) -> Result<Self, JsonError> {
18457        Ok(match value {
18458            Value::String(_) => {
18459                if let Ok(v) = Iri::from_json(value) {
18460                    return Ok(Self::Iri(v));
18461                }
18462                Self::Other(value.clone())
18463            }
18464            Value::Object(object) => {
18465                if object.len() == 1
18466                    && object.contains_key("id")
18467                    && let Ok(v) = Iri::from_json(value)
18468                {
18469                    return Ok(Self::Iri(v));
18470                }
18471                if json::has_type(object, Application::TYPE) {
18472                    return Ok(Application::from_json(value).map_or_else(
18473                        |_| Self::Other(value.clone()),
18474                        |v| Self::Application(Box::new(v)),
18475                    ));
18476                }
18477                if json::has_type(object, Group::TYPE) {
18478                    return Ok(Group::from_json(value).map_or_else(
18479                        |_| Self::Other(value.clone()),
18480                        |v| Self::Group(Box::new(v)),
18481                    ));
18482                }
18483                if json::has_type(object, Organization::TYPE) {
18484                    return Ok(Organization::from_json(value).map_or_else(
18485                        |_| Self::Other(value.clone()),
18486                        |v| Self::Organization(Box::new(v)),
18487                    ));
18488                }
18489                if json::has_type(object, Person::TYPE) {
18490                    return Ok(Person::from_json(value).map_or_else(
18491                        |_| Self::Other(value.clone()),
18492                        |v| Self::Person(Box::new(v)),
18493                    ));
18494                }
18495                if json::has_type(object, Service::TYPE) {
18496                    return Ok(Service::from_json(value).map_or_else(
18497                        |_| Self::Other(value.clone()),
18498                        |v| Self::Service(Box::new(v)),
18499                    ));
18500                }
18501                Self::Other(value.clone())
18502            }
18503            _ => Self::Other(value.clone()),
18504        })
18505    }
18506}
18507
18508impl ToJson for AnyActor {
18509    fn to_json(&self) -> Value {
18510        match self {
18511            Self::Iri(v) => v.to_json(),
18512            Self::Application(v) => v.to_json(),
18513            Self::Group(v) => v.to_json(),
18514            Self::Organization(v) => v.to_json(),
18515            Self::Person(v) => v.to_json(),
18516            Self::Service(v) => v.to_json(),
18517            Self::Other(v) => v.clone(),
18518        }
18519    }
18520}
18521
18522/// A value of [`Collection`], or of a type extending one of them.
18523#[derive(Clone, Debug, PartialEq)]
18524pub enum AnyCollection {
18525    /// A reference, by IRI.
18526    Iri(Iri),
18527    Collection(Box<Collection>),
18528    CollectionPage(Box<CollectionPage>),
18529    FeaturedCollection(Box<FeaturedCollection>),
18530    OrderedCollection(Box<OrderedCollection>),
18531    OrderedCollectionPage(Box<OrderedCollectionPage>),
18532    /// Anything no schema describes, as it was.
18533    Other(Value),
18534}
18535
18536impl AnyCollection {
18537    /// The IRI of the value: the reference itself, or the object's `id`.
18538    #[must_use]
18539    pub fn id(&self) -> Option<&Iri> {
18540        match self {
18541            Self::Iri(iri) => Some(iri),
18542            Self::Collection(object) => object.id.as_ref(),
18543            Self::CollectionPage(object) => object.id.as_ref(),
18544            Self::FeaturedCollection(object) => object.id.as_ref(),
18545            Self::OrderedCollection(object) => object.id.as_ref(),
18546            Self::OrderedCollectionPage(object) => object.id.as_ref(),
18547            _ => None,
18548        }
18549    }
18550}
18551
18552impl FromJson for AnyCollection {
18553    fn from_json(value: &Value) -> Result<Self, JsonError> {
18554        Ok(match value {
18555            Value::String(_) => {
18556                if let Ok(v) = Iri::from_json(value) {
18557                    return Ok(Self::Iri(v));
18558                }
18559                Self::Other(value.clone())
18560            }
18561            Value::Object(object) => {
18562                if object.len() == 1
18563                    && object.contains_key("id")
18564                    && let Ok(v) = Iri::from_json(value)
18565                {
18566                    return Ok(Self::Iri(v));
18567                }
18568                if json::has_type(object, Collection::TYPE) {
18569                    return Ok(Collection::from_json(value).map_or_else(
18570                        |_| Self::Other(value.clone()),
18571                        |v| Self::Collection(Box::new(v)),
18572                    ));
18573                }
18574                if json::has_type(object, CollectionPage::TYPE) {
18575                    return Ok(CollectionPage::from_json(value).map_or_else(
18576                        |_| Self::Other(value.clone()),
18577                        |v| Self::CollectionPage(Box::new(v)),
18578                    ));
18579                }
18580                if json::has_type(object, FeaturedCollection::TYPE) {
18581                    return Ok(FeaturedCollection::from_json(value).map_or_else(
18582                        |_| Self::Other(value.clone()),
18583                        |v| Self::FeaturedCollection(Box::new(v)),
18584                    ));
18585                }
18586                if json::has_type(object, OrderedCollection::TYPE) {
18587                    return Ok(OrderedCollection::from_json(value).map_or_else(
18588                        |_| Self::Other(value.clone()),
18589                        |v| Self::OrderedCollection(Box::new(v)),
18590                    ));
18591                }
18592                if json::has_type(object, OrderedCollectionPage::TYPE) {
18593                    return Ok(OrderedCollectionPage::from_json(value).map_or_else(
18594                        |_| Self::Other(value.clone()),
18595                        |v| Self::OrderedCollectionPage(Box::new(v)),
18596                    ));
18597                }
18598                Self::Other(value.clone())
18599            }
18600            _ => Self::Other(value.clone()),
18601        })
18602    }
18603}
18604
18605impl ToJson for AnyCollection {
18606    fn to_json(&self) -> Value {
18607        match self {
18608            Self::Iri(v) => v.to_json(),
18609            Self::Collection(v) => v.to_json(),
18610            Self::CollectionPage(v) => v.to_json(),
18611            Self::FeaturedCollection(v) => v.to_json(),
18612            Self::OrderedCollection(v) => v.to_json(),
18613            Self::OrderedCollectionPage(v) => v.to_json(),
18614            Self::Other(v) => v.clone(),
18615        }
18616    }
18617}
18618
18619/// A value of [`CollectionPage`], or of a type extending one of them.
18620#[derive(Clone, Debug, PartialEq)]
18621pub enum AnyCollectionPage {
18622    /// A reference, by IRI.
18623    Iri(Iri),
18624    CollectionPage(Box<CollectionPage>),
18625    OrderedCollectionPage(Box<OrderedCollectionPage>),
18626    /// Anything no schema describes, as it was.
18627    Other(Value),
18628}
18629
18630impl AnyCollectionPage {
18631    /// The IRI of the value: the reference itself, or the object's `id`.
18632    #[must_use]
18633    pub fn id(&self) -> Option<&Iri> {
18634        match self {
18635            Self::Iri(iri) => Some(iri),
18636            Self::CollectionPage(object) => object.id.as_ref(),
18637            Self::OrderedCollectionPage(object) => object.id.as_ref(),
18638            _ => None,
18639        }
18640    }
18641}
18642
18643impl FromJson for AnyCollectionPage {
18644    fn from_json(value: &Value) -> Result<Self, JsonError> {
18645        Ok(match value {
18646            Value::String(_) => {
18647                if let Ok(v) = Iri::from_json(value) {
18648                    return Ok(Self::Iri(v));
18649                }
18650                Self::Other(value.clone())
18651            }
18652            Value::Object(object) => {
18653                if object.len() == 1
18654                    && object.contains_key("id")
18655                    && let Ok(v) = Iri::from_json(value)
18656                {
18657                    return Ok(Self::Iri(v));
18658                }
18659                if json::has_type(object, CollectionPage::TYPE) {
18660                    return Ok(CollectionPage::from_json(value).map_or_else(
18661                        |_| Self::Other(value.clone()),
18662                        |v| Self::CollectionPage(Box::new(v)),
18663                    ));
18664                }
18665                if json::has_type(object, OrderedCollectionPage::TYPE) {
18666                    return Ok(OrderedCollectionPage::from_json(value).map_or_else(
18667                        |_| Self::Other(value.clone()),
18668                        |v| Self::OrderedCollectionPage(Box::new(v)),
18669                    ));
18670                }
18671                Self::Other(value.clone())
18672            }
18673            _ => Self::Other(value.clone()),
18674        })
18675    }
18676}
18677
18678impl ToJson for AnyCollectionPage {
18679    fn to_json(&self) -> Value {
18680        match self {
18681            Self::Iri(v) => v.to_json(),
18682            Self::CollectionPage(v) => v.to_json(),
18683            Self::OrderedCollectionPage(v) => v.to_json(),
18684            Self::Other(v) => v.clone(),
18685        }
18686    }
18687}
18688
18689/// A value of [`DidService`], or of a type extending one of them.
18690#[derive(Clone, Debug, PartialEq)]
18691pub enum AnyDidService {
18692    /// A reference, by IRI.
18693    Iri(Iri),
18694    DidService(Box<DidService>),
18695    Export(Box<Export>),
18696    /// Anything no schema describes, as it was.
18697    Other(Value),
18698}
18699
18700impl AnyDidService {
18701    /// The IRI of the value: the reference itself, or the object's `id`.
18702    #[must_use]
18703    pub fn id(&self) -> Option<&Iri> {
18704        match self {
18705            Self::Iri(iri) => Some(iri),
18706            Self::DidService(object) => object.id.as_ref(),
18707            Self::Export(object) => object.id.as_ref(),
18708            _ => None,
18709        }
18710    }
18711}
18712
18713impl FromJson for AnyDidService {
18714    fn from_json(value: &Value) -> Result<Self, JsonError> {
18715        Ok(match value {
18716            Value::String(_) => {
18717                if let Ok(v) = Iri::from_json(value) {
18718                    return Ok(Self::Iri(v));
18719                }
18720                Self::Other(value.clone())
18721            }
18722            Value::Object(object) => {
18723                if object.len() == 1
18724                    && object.contains_key("id")
18725                    && let Ok(v) = Iri::from_json(value)
18726                {
18727                    return Ok(Self::Iri(v));
18728                }
18729                if json::has_type(object, DidService::TYPE) {
18730                    return Ok(DidService::from_json(value).map_or_else(
18731                        |_| Self::Other(value.clone()),
18732                        |v| Self::DidService(Box::new(v)),
18733                    ));
18734                }
18735                if json::has_type(object, Export::TYPE) {
18736                    return Ok(Export::from_json(value).map_or_else(
18737                        |_| Self::Other(value.clone()),
18738                        |v| Self::Export(Box::new(v)),
18739                    ));
18740                }
18741                Self::Other(value.clone())
18742            }
18743            _ => Self::Other(value.clone()),
18744        })
18745    }
18746}
18747
18748impl ToJson for AnyDidService {
18749    fn to_json(&self) -> Value {
18750        match self {
18751            Self::Iri(v) => v.to_json(),
18752            Self::DidService(v) => v.to_json(),
18753            Self::Export(v) => v.to_json(),
18754            Self::Other(v) => v.clone(),
18755        }
18756    }
18757}
18758
18759/// A value of [`Object`], or of a type extending one of them.
18760#[derive(Clone, Debug, PartialEq)]
18761pub enum AnyObject {
18762    /// A reference, by IRI.
18763    Iri(Iri),
18764    Accept(Box<Accept>),
18765    Activity(Box<Activity>),
18766    Add(Box<Add>),
18767    Agreement(Box<Agreement>),
18768    Announce(Box<Announce>),
18769    AnnounceAuthorization(Box<AnnounceAuthorization>),
18770    AnnounceRequest(Box<AnnounceRequest>),
18771    Application(Box<Application>),
18772    Arrive(Box<Arrive>),
18773    Article(Box<Article>),
18774    Audio(Box<Audio>),
18775    Block(Box<Block>),
18776    ChatMessage(Box<ChatMessage>),
18777    Collection(Box<Collection>),
18778    CollectionPage(Box<CollectionPage>),
18779    Create(Box<Create>),
18780    Delete(Box<Delete>),
18781    Dislike(Box<Dislike>),
18782    Document(Box<Document>),
18783    Emoji(Box<Emoji>),
18784    EmojiReact(Box<EmojiReact>),
18785    Event(Box<Event>),
18786    FeatureAuthorization(Box<FeatureAuthorization>),
18787    FeatureRequest(Box<FeatureRequest>),
18788    FeaturedCollection(Box<FeaturedCollection>),
18789    FeaturedItem(Box<FeaturedItem>),
18790    Flag(Box<Flag>),
18791    Follow(Box<Follow>),
18792    Group(Box<Group>),
18793    Ignore(Box<Ignore>),
18794    Image(Box<Image>),
18795    IntransitiveActivity(Box<IntransitiveActivity>),
18796    Invite(Box<Invite>),
18797    Join(Box<Join>),
18798    Leave(Box<Leave>),
18799    Like(Box<Like>),
18800    LikeAuthorization(Box<LikeAuthorization>),
18801    LikeRequest(Box<LikeRequest>),
18802    Listen(Box<Listen>),
18803    Move(Box<Move>),
18804    Note(Box<Note>),
18805    Object(Box<Object>),
18806    Offer(Box<Offer>),
18807    OrderedCollection(Box<OrderedCollection>),
18808    OrderedCollectionPage(Box<OrderedCollectionPage>),
18809    Organization(Box<Organization>),
18810    Page(Box<Page>),
18811    Person(Box<Person>),
18812    Place(Box<Place>),
18813    Profile(Box<Profile>),
18814    Proposal(Box<Proposal>),
18815    Question(Box<Question>),
18816    QuoteAuthorization(Box<QuoteAuthorization>),
18817    QuoteRequest(Box<QuoteRequest>),
18818    Read(Box<Read>),
18819    Reject(Box<Reject>),
18820    Relationship(Box<Relationship>),
18821    Remove(Box<Remove>),
18822    ReplyAuthorization(Box<ReplyAuthorization>),
18823    ReplyRequest(Box<ReplyRequest>),
18824    Service(Box<Service>),
18825    TentativeAccept(Box<TentativeAccept>),
18826    TentativeReject(Box<TentativeReject>),
18827    Tombstone(Box<Tombstone>),
18828    Travel(Box<Travel>),
18829    Undo(Box<Undo>),
18830    Update(Box<Update>),
18831    Video(Box<Video>),
18832    View(Box<View>),
18833    /// Anything no schema describes, as it was.
18834    Other(Value),
18835}
18836
18837impl AnyObject {
18838    /// The IRI of the value: the reference itself, or the object's `id`.
18839    #[must_use]
18840    pub fn id(&self) -> Option<&Iri> {
18841        match self {
18842            Self::Iri(iri) => Some(iri),
18843            Self::Accept(object) => object.id.as_ref(),
18844            Self::Activity(object) => object.id.as_ref(),
18845            Self::Add(object) => object.id.as_ref(),
18846            Self::Agreement(object) => object.id.as_ref(),
18847            Self::Announce(object) => object.id.as_ref(),
18848            Self::AnnounceAuthorization(object) => object.id.as_ref(),
18849            Self::AnnounceRequest(object) => object.id.as_ref(),
18850            Self::Application(object) => object.id.as_ref(),
18851            Self::Arrive(object) => object.id.as_ref(),
18852            Self::Article(object) => object.id.as_ref(),
18853            Self::Audio(object) => object.id.as_ref(),
18854            Self::Block(object) => object.id.as_ref(),
18855            Self::ChatMessage(object) => object.id.as_ref(),
18856            Self::Collection(object) => object.id.as_ref(),
18857            Self::CollectionPage(object) => object.id.as_ref(),
18858            Self::Create(object) => object.id.as_ref(),
18859            Self::Delete(object) => object.id.as_ref(),
18860            Self::Dislike(object) => object.id.as_ref(),
18861            Self::Document(object) => object.id.as_ref(),
18862            Self::Emoji(object) => object.id.as_ref(),
18863            Self::EmojiReact(object) => object.id.as_ref(),
18864            Self::Event(object) => object.id.as_ref(),
18865            Self::FeatureAuthorization(object) => object.id.as_ref(),
18866            Self::FeatureRequest(object) => object.id.as_ref(),
18867            Self::FeaturedCollection(object) => object.id.as_ref(),
18868            Self::FeaturedItem(object) => object.id.as_ref(),
18869            Self::Flag(object) => object.id.as_ref(),
18870            Self::Follow(object) => object.id.as_ref(),
18871            Self::Group(object) => object.id.as_ref(),
18872            Self::Ignore(object) => object.id.as_ref(),
18873            Self::Image(object) => object.id.as_ref(),
18874            Self::IntransitiveActivity(object) => object.id.as_ref(),
18875            Self::Invite(object) => object.id.as_ref(),
18876            Self::Join(object) => object.id.as_ref(),
18877            Self::Leave(object) => object.id.as_ref(),
18878            Self::Like(object) => object.id.as_ref(),
18879            Self::LikeAuthorization(object) => object.id.as_ref(),
18880            Self::LikeRequest(object) => object.id.as_ref(),
18881            Self::Listen(object) => object.id.as_ref(),
18882            Self::Move(object) => object.id.as_ref(),
18883            Self::Note(object) => object.id.as_ref(),
18884            Self::Object(object) => object.id.as_ref(),
18885            Self::Offer(object) => object.id.as_ref(),
18886            Self::OrderedCollection(object) => object.id.as_ref(),
18887            Self::OrderedCollectionPage(object) => object.id.as_ref(),
18888            Self::Organization(object) => object.id.as_ref(),
18889            Self::Page(object) => object.id.as_ref(),
18890            Self::Person(object) => object.id.as_ref(),
18891            Self::Place(object) => object.id.as_ref(),
18892            Self::Profile(object) => object.id.as_ref(),
18893            Self::Proposal(object) => object.id.as_ref(),
18894            Self::Question(object) => object.id.as_ref(),
18895            Self::QuoteAuthorization(object) => object.id.as_ref(),
18896            Self::QuoteRequest(object) => object.id.as_ref(),
18897            Self::Read(object) => object.id.as_ref(),
18898            Self::Reject(object) => object.id.as_ref(),
18899            Self::Relationship(object) => object.id.as_ref(),
18900            Self::Remove(object) => object.id.as_ref(),
18901            Self::ReplyAuthorization(object) => object.id.as_ref(),
18902            Self::ReplyRequest(object) => object.id.as_ref(),
18903            Self::Service(object) => object.id.as_ref(),
18904            Self::TentativeAccept(object) => object.id.as_ref(),
18905            Self::TentativeReject(object) => object.id.as_ref(),
18906            Self::Tombstone(object) => object.id.as_ref(),
18907            Self::Travel(object) => object.id.as_ref(),
18908            Self::Undo(object) => object.id.as_ref(),
18909            Self::Update(object) => object.id.as_ref(),
18910            Self::Video(object) => object.id.as_ref(),
18911            Self::View(object) => object.id.as_ref(),
18912            _ => None,
18913        }
18914    }
18915}
18916
18917impl FromJson for AnyObject {
18918    fn from_json(value: &Value) -> Result<Self, JsonError> {
18919        Ok(match value {
18920            Value::String(_) => {
18921                if let Ok(v) = Iri::from_json(value) {
18922                    return Ok(Self::Iri(v));
18923                }
18924                Self::Other(value.clone())
18925            }
18926            Value::Object(object) => {
18927                if object.len() == 1
18928                    && object.contains_key("id")
18929                    && let Ok(v) = Iri::from_json(value)
18930                {
18931                    return Ok(Self::Iri(v));
18932                }
18933                if json::has_type(object, Accept::TYPE) {
18934                    return Ok(Accept::from_json(value).map_or_else(
18935                        |_| Self::Other(value.clone()),
18936                        |v| Self::Accept(Box::new(v)),
18937                    ));
18938                }
18939                if json::has_type(object, Activity::TYPE) {
18940                    return Ok(Activity::from_json(value).map_or_else(
18941                        |_| Self::Other(value.clone()),
18942                        |v| Self::Activity(Box::new(v)),
18943                    ));
18944                }
18945                if json::has_type(object, Add::TYPE) {
18946                    return Ok(Add::from_json(value)
18947                        .map_or_else(|_| Self::Other(value.clone()), |v| Self::Add(Box::new(v))));
18948                }
18949                if json::has_type(object, Agreement::TYPE) {
18950                    return Ok(Agreement::from_json(value).map_or_else(
18951                        |_| Self::Other(value.clone()),
18952                        |v| Self::Agreement(Box::new(v)),
18953                    ));
18954                }
18955                if json::has_type(object, Announce::TYPE) {
18956                    return Ok(Announce::from_json(value).map_or_else(
18957                        |_| Self::Other(value.clone()),
18958                        |v| Self::Announce(Box::new(v)),
18959                    ));
18960                }
18961                if json::has_type(object, AnnounceAuthorization::TYPE) {
18962                    return Ok(AnnounceAuthorization::from_json(value).map_or_else(
18963                        |_| Self::Other(value.clone()),
18964                        |v| Self::AnnounceAuthorization(Box::new(v)),
18965                    ));
18966                }
18967                if json::has_type(object, AnnounceRequest::TYPE) {
18968                    return Ok(AnnounceRequest::from_json(value).map_or_else(
18969                        |_| Self::Other(value.clone()),
18970                        |v| Self::AnnounceRequest(Box::new(v)),
18971                    ));
18972                }
18973                if json::has_type(object, Application::TYPE) {
18974                    return Ok(Application::from_json(value).map_or_else(
18975                        |_| Self::Other(value.clone()),
18976                        |v| Self::Application(Box::new(v)),
18977                    ));
18978                }
18979                if json::has_type(object, Arrive::TYPE) {
18980                    return Ok(Arrive::from_json(value).map_or_else(
18981                        |_| Self::Other(value.clone()),
18982                        |v| Self::Arrive(Box::new(v)),
18983                    ));
18984                }
18985                if json::has_type(object, Article::TYPE) {
18986                    return Ok(Article::from_json(value).map_or_else(
18987                        |_| Self::Other(value.clone()),
18988                        |v| Self::Article(Box::new(v)),
18989                    ));
18990                }
18991                if json::has_type(object, Audio::TYPE) {
18992                    return Ok(Audio::from_json(value).map_or_else(
18993                        |_| Self::Other(value.clone()),
18994                        |v| Self::Audio(Box::new(v)),
18995                    ));
18996                }
18997                if json::has_type(object, Block::TYPE) {
18998                    return Ok(Block::from_json(value).map_or_else(
18999                        |_| Self::Other(value.clone()),
19000                        |v| Self::Block(Box::new(v)),
19001                    ));
19002                }
19003                if json::has_type(object, ChatMessage::TYPE) {
19004                    return Ok(ChatMessage::from_json(value).map_or_else(
19005                        |_| Self::Other(value.clone()),
19006                        |v| Self::ChatMessage(Box::new(v)),
19007                    ));
19008                }
19009                if json::has_type(object, Collection::TYPE) {
19010                    return Ok(Collection::from_json(value).map_or_else(
19011                        |_| Self::Other(value.clone()),
19012                        |v| Self::Collection(Box::new(v)),
19013                    ));
19014                }
19015                if json::has_type(object, CollectionPage::TYPE) {
19016                    return Ok(CollectionPage::from_json(value).map_or_else(
19017                        |_| Self::Other(value.clone()),
19018                        |v| Self::CollectionPage(Box::new(v)),
19019                    ));
19020                }
19021                if json::has_type(object, Create::TYPE) {
19022                    return Ok(Create::from_json(value).map_or_else(
19023                        |_| Self::Other(value.clone()),
19024                        |v| Self::Create(Box::new(v)),
19025                    ));
19026                }
19027                if json::has_type(object, Delete::TYPE) {
19028                    return Ok(Delete::from_json(value).map_or_else(
19029                        |_| Self::Other(value.clone()),
19030                        |v| Self::Delete(Box::new(v)),
19031                    ));
19032                }
19033                if json::has_type(object, Dislike::TYPE) {
19034                    return Ok(Dislike::from_json(value).map_or_else(
19035                        |_| Self::Other(value.clone()),
19036                        |v| Self::Dislike(Box::new(v)),
19037                    ));
19038                }
19039                if json::has_type(object, Document::TYPE) {
19040                    return Ok(Document::from_json(value).map_or_else(
19041                        |_| Self::Other(value.clone()),
19042                        |v| Self::Document(Box::new(v)),
19043                    ));
19044                }
19045                if json::has_type(object, Emoji::TYPE) {
19046                    return Ok(Emoji::from_json(value).map_or_else(
19047                        |_| Self::Other(value.clone()),
19048                        |v| Self::Emoji(Box::new(v)),
19049                    ));
19050                }
19051                if json::has_type(object, EmojiReact::TYPE) {
19052                    return Ok(EmojiReact::from_json(value).map_or_else(
19053                        |_| Self::Other(value.clone()),
19054                        |v| Self::EmojiReact(Box::new(v)),
19055                    ));
19056                }
19057                if json::has_type(object, Event::TYPE) {
19058                    return Ok(Event::from_json(value).map_or_else(
19059                        |_| Self::Other(value.clone()),
19060                        |v| Self::Event(Box::new(v)),
19061                    ));
19062                }
19063                if json::has_type(object, FeatureAuthorization::TYPE) {
19064                    return Ok(FeatureAuthorization::from_json(value).map_or_else(
19065                        |_| Self::Other(value.clone()),
19066                        |v| Self::FeatureAuthorization(Box::new(v)),
19067                    ));
19068                }
19069                if json::has_type(object, FeatureRequest::TYPE) {
19070                    return Ok(FeatureRequest::from_json(value).map_or_else(
19071                        |_| Self::Other(value.clone()),
19072                        |v| Self::FeatureRequest(Box::new(v)),
19073                    ));
19074                }
19075                if json::has_type(object, FeaturedCollection::TYPE) {
19076                    return Ok(FeaturedCollection::from_json(value).map_or_else(
19077                        |_| Self::Other(value.clone()),
19078                        |v| Self::FeaturedCollection(Box::new(v)),
19079                    ));
19080                }
19081                if json::has_type(object, FeaturedItem::TYPE) {
19082                    return Ok(FeaturedItem::from_json(value).map_or_else(
19083                        |_| Self::Other(value.clone()),
19084                        |v| Self::FeaturedItem(Box::new(v)),
19085                    ));
19086                }
19087                if json::has_type(object, Flag::TYPE) {
19088                    return Ok(Flag::from_json(value)
19089                        .map_or_else(|_| Self::Other(value.clone()), |v| Self::Flag(Box::new(v))));
19090                }
19091                if json::has_type(object, Follow::TYPE) {
19092                    return Ok(Follow::from_json(value).map_or_else(
19093                        |_| Self::Other(value.clone()),
19094                        |v| Self::Follow(Box::new(v)),
19095                    ));
19096                }
19097                if json::has_type(object, Group::TYPE) {
19098                    return Ok(Group::from_json(value).map_or_else(
19099                        |_| Self::Other(value.clone()),
19100                        |v| Self::Group(Box::new(v)),
19101                    ));
19102                }
19103                if json::has_type(object, Ignore::TYPE) {
19104                    return Ok(Ignore::from_json(value).map_or_else(
19105                        |_| Self::Other(value.clone()),
19106                        |v| Self::Ignore(Box::new(v)),
19107                    ));
19108                }
19109                if json::has_type(object, Image::TYPE) {
19110                    return Ok(Image::from_json(value).map_or_else(
19111                        |_| Self::Other(value.clone()),
19112                        |v| Self::Image(Box::new(v)),
19113                    ));
19114                }
19115                if json::has_type(object, IntransitiveActivity::TYPE) {
19116                    return Ok(IntransitiveActivity::from_json(value).map_or_else(
19117                        |_| Self::Other(value.clone()),
19118                        |v| Self::IntransitiveActivity(Box::new(v)),
19119                    ));
19120                }
19121                if json::has_type(object, Invite::TYPE) {
19122                    return Ok(Invite::from_json(value).map_or_else(
19123                        |_| Self::Other(value.clone()),
19124                        |v| Self::Invite(Box::new(v)),
19125                    ));
19126                }
19127                if json::has_type(object, Join::TYPE) {
19128                    return Ok(Join::from_json(value)
19129                        .map_or_else(|_| Self::Other(value.clone()), |v| Self::Join(Box::new(v))));
19130                }
19131                if json::has_type(object, Leave::TYPE) {
19132                    return Ok(Leave::from_json(value).map_or_else(
19133                        |_| Self::Other(value.clone()),
19134                        |v| Self::Leave(Box::new(v)),
19135                    ));
19136                }
19137                if json::has_type(object, Like::TYPE) {
19138                    return Ok(Like::from_json(value)
19139                        .map_or_else(|_| Self::Other(value.clone()), |v| Self::Like(Box::new(v))));
19140                }
19141                if json::has_type(object, LikeAuthorization::TYPE) {
19142                    return Ok(LikeAuthorization::from_json(value).map_or_else(
19143                        |_| Self::Other(value.clone()),
19144                        |v| Self::LikeAuthorization(Box::new(v)),
19145                    ));
19146                }
19147                if json::has_type(object, LikeRequest::TYPE) {
19148                    return Ok(LikeRequest::from_json(value).map_or_else(
19149                        |_| Self::Other(value.clone()),
19150                        |v| Self::LikeRequest(Box::new(v)),
19151                    ));
19152                }
19153                if json::has_type(object, Listen::TYPE) {
19154                    return Ok(Listen::from_json(value).map_or_else(
19155                        |_| Self::Other(value.clone()),
19156                        |v| Self::Listen(Box::new(v)),
19157                    ));
19158                }
19159                if json::has_type(object, Move::TYPE) {
19160                    return Ok(Move::from_json(value)
19161                        .map_or_else(|_| Self::Other(value.clone()), |v| Self::Move(Box::new(v))));
19162                }
19163                if json::has_type(object, Note::TYPE) {
19164                    return Ok(Note::from_json(value)
19165                        .map_or_else(|_| Self::Other(value.clone()), |v| Self::Note(Box::new(v))));
19166                }
19167                if json::has_type(object, Object::TYPE) {
19168                    return Ok(Object::from_json(value).map_or_else(
19169                        |_| Self::Other(value.clone()),
19170                        |v| Self::Object(Box::new(v)),
19171                    ));
19172                }
19173                if json::has_type(object, Offer::TYPE) {
19174                    return Ok(Offer::from_json(value).map_or_else(
19175                        |_| Self::Other(value.clone()),
19176                        |v| Self::Offer(Box::new(v)),
19177                    ));
19178                }
19179                if json::has_type(object, OrderedCollection::TYPE) {
19180                    return Ok(OrderedCollection::from_json(value).map_or_else(
19181                        |_| Self::Other(value.clone()),
19182                        |v| Self::OrderedCollection(Box::new(v)),
19183                    ));
19184                }
19185                if json::has_type(object, OrderedCollectionPage::TYPE) {
19186                    return Ok(OrderedCollectionPage::from_json(value).map_or_else(
19187                        |_| Self::Other(value.clone()),
19188                        |v| Self::OrderedCollectionPage(Box::new(v)),
19189                    ));
19190                }
19191                if json::has_type(object, Organization::TYPE) {
19192                    return Ok(Organization::from_json(value).map_or_else(
19193                        |_| Self::Other(value.clone()),
19194                        |v| Self::Organization(Box::new(v)),
19195                    ));
19196                }
19197                if json::has_type(object, Page::TYPE) {
19198                    return Ok(Page::from_json(value)
19199                        .map_or_else(|_| Self::Other(value.clone()), |v| Self::Page(Box::new(v))));
19200                }
19201                if json::has_type(object, Person::TYPE) {
19202                    return Ok(Person::from_json(value).map_or_else(
19203                        |_| Self::Other(value.clone()),
19204                        |v| Self::Person(Box::new(v)),
19205                    ));
19206                }
19207                if json::has_type(object, Place::TYPE) {
19208                    return Ok(Place::from_json(value).map_or_else(
19209                        |_| Self::Other(value.clone()),
19210                        |v| Self::Place(Box::new(v)),
19211                    ));
19212                }
19213                if json::has_type(object, Profile::TYPE) {
19214                    return Ok(Profile::from_json(value).map_or_else(
19215                        |_| Self::Other(value.clone()),
19216                        |v| Self::Profile(Box::new(v)),
19217                    ));
19218                }
19219                if json::has_type(object, Proposal::TYPE) {
19220                    return Ok(Proposal::from_json(value).map_or_else(
19221                        |_| Self::Other(value.clone()),
19222                        |v| Self::Proposal(Box::new(v)),
19223                    ));
19224                }
19225                if json::has_type(object, Question::TYPE) {
19226                    return Ok(Question::from_json(value).map_or_else(
19227                        |_| Self::Other(value.clone()),
19228                        |v| Self::Question(Box::new(v)),
19229                    ));
19230                }
19231                if json::has_type(object, QuoteAuthorization::TYPE) {
19232                    return Ok(QuoteAuthorization::from_json(value).map_or_else(
19233                        |_| Self::Other(value.clone()),
19234                        |v| Self::QuoteAuthorization(Box::new(v)),
19235                    ));
19236                }
19237                if json::has_type(object, QuoteRequest::TYPE) {
19238                    return Ok(QuoteRequest::from_json(value).map_or_else(
19239                        |_| Self::Other(value.clone()),
19240                        |v| Self::QuoteRequest(Box::new(v)),
19241                    ));
19242                }
19243                if json::has_type(object, Read::TYPE) {
19244                    return Ok(Read::from_json(value)
19245                        .map_or_else(|_| Self::Other(value.clone()), |v| Self::Read(Box::new(v))));
19246                }
19247                if json::has_type(object, Reject::TYPE) {
19248                    return Ok(Reject::from_json(value).map_or_else(
19249                        |_| Self::Other(value.clone()),
19250                        |v| Self::Reject(Box::new(v)),
19251                    ));
19252                }
19253                if json::has_type(object, Relationship::TYPE) {
19254                    return Ok(Relationship::from_json(value).map_or_else(
19255                        |_| Self::Other(value.clone()),
19256                        |v| Self::Relationship(Box::new(v)),
19257                    ));
19258                }
19259                if json::has_type(object, Remove::TYPE) {
19260                    return Ok(Remove::from_json(value).map_or_else(
19261                        |_| Self::Other(value.clone()),
19262                        |v| Self::Remove(Box::new(v)),
19263                    ));
19264                }
19265                if json::has_type(object, ReplyAuthorization::TYPE) {
19266                    return Ok(ReplyAuthorization::from_json(value).map_or_else(
19267                        |_| Self::Other(value.clone()),
19268                        |v| Self::ReplyAuthorization(Box::new(v)),
19269                    ));
19270                }
19271                if json::has_type(object, ReplyRequest::TYPE) {
19272                    return Ok(ReplyRequest::from_json(value).map_or_else(
19273                        |_| Self::Other(value.clone()),
19274                        |v| Self::ReplyRequest(Box::new(v)),
19275                    ));
19276                }
19277                if json::has_type(object, Service::TYPE) {
19278                    return Ok(Service::from_json(value).map_or_else(
19279                        |_| Self::Other(value.clone()),
19280                        |v| Self::Service(Box::new(v)),
19281                    ));
19282                }
19283                if json::has_type(object, TentativeAccept::TYPE) {
19284                    return Ok(TentativeAccept::from_json(value).map_or_else(
19285                        |_| Self::Other(value.clone()),
19286                        |v| Self::TentativeAccept(Box::new(v)),
19287                    ));
19288                }
19289                if json::has_type(object, TentativeReject::TYPE) {
19290                    return Ok(TentativeReject::from_json(value).map_or_else(
19291                        |_| Self::Other(value.clone()),
19292                        |v| Self::TentativeReject(Box::new(v)),
19293                    ));
19294                }
19295                if json::has_type(object, Tombstone::TYPE) {
19296                    return Ok(Tombstone::from_json(value).map_or_else(
19297                        |_| Self::Other(value.clone()),
19298                        |v| Self::Tombstone(Box::new(v)),
19299                    ));
19300                }
19301                if json::has_type(object, Travel::TYPE) {
19302                    return Ok(Travel::from_json(value).map_or_else(
19303                        |_| Self::Other(value.clone()),
19304                        |v| Self::Travel(Box::new(v)),
19305                    ));
19306                }
19307                if json::has_type(object, Undo::TYPE) {
19308                    return Ok(Undo::from_json(value)
19309                        .map_or_else(|_| Self::Other(value.clone()), |v| Self::Undo(Box::new(v))));
19310                }
19311                if json::has_type(object, Update::TYPE) {
19312                    return Ok(Update::from_json(value).map_or_else(
19313                        |_| Self::Other(value.clone()),
19314                        |v| Self::Update(Box::new(v)),
19315                    ));
19316                }
19317                if json::has_type(object, Video::TYPE) {
19318                    return Ok(Video::from_json(value).map_or_else(
19319                        |_| Self::Other(value.clone()),
19320                        |v| Self::Video(Box::new(v)),
19321                    ));
19322                }
19323                if json::has_type(object, View::TYPE) {
19324                    return Ok(View::from_json(value)
19325                        .map_or_else(|_| Self::Other(value.clone()), |v| Self::View(Box::new(v))));
19326                }
19327                Self::Other(value.clone())
19328            }
19329            _ => Self::Other(value.clone()),
19330        })
19331    }
19332}
19333
19334impl ToJson for AnyObject {
19335    fn to_json(&self) -> Value {
19336        match self {
19337            Self::Iri(v) => v.to_json(),
19338            Self::Accept(v) => v.to_json(),
19339            Self::Activity(v) => v.to_json(),
19340            Self::Add(v) => v.to_json(),
19341            Self::Agreement(v) => v.to_json(),
19342            Self::Announce(v) => v.to_json(),
19343            Self::AnnounceAuthorization(v) => v.to_json(),
19344            Self::AnnounceRequest(v) => v.to_json(),
19345            Self::Application(v) => v.to_json(),
19346            Self::Arrive(v) => v.to_json(),
19347            Self::Article(v) => v.to_json(),
19348            Self::Audio(v) => v.to_json(),
19349            Self::Block(v) => v.to_json(),
19350            Self::ChatMessage(v) => v.to_json(),
19351            Self::Collection(v) => v.to_json(),
19352            Self::CollectionPage(v) => v.to_json(),
19353            Self::Create(v) => v.to_json(),
19354            Self::Delete(v) => v.to_json(),
19355            Self::Dislike(v) => v.to_json(),
19356            Self::Document(v) => v.to_json(),
19357            Self::Emoji(v) => v.to_json(),
19358            Self::EmojiReact(v) => v.to_json(),
19359            Self::Event(v) => v.to_json(),
19360            Self::FeatureAuthorization(v) => v.to_json(),
19361            Self::FeatureRequest(v) => v.to_json(),
19362            Self::FeaturedCollection(v) => v.to_json(),
19363            Self::FeaturedItem(v) => v.to_json(),
19364            Self::Flag(v) => v.to_json(),
19365            Self::Follow(v) => v.to_json(),
19366            Self::Group(v) => v.to_json(),
19367            Self::Ignore(v) => v.to_json(),
19368            Self::Image(v) => v.to_json(),
19369            Self::IntransitiveActivity(v) => v.to_json(),
19370            Self::Invite(v) => v.to_json(),
19371            Self::Join(v) => v.to_json(),
19372            Self::Leave(v) => v.to_json(),
19373            Self::Like(v) => v.to_json(),
19374            Self::LikeAuthorization(v) => v.to_json(),
19375            Self::LikeRequest(v) => v.to_json(),
19376            Self::Listen(v) => v.to_json(),
19377            Self::Move(v) => v.to_json(),
19378            Self::Note(v) => v.to_json(),
19379            Self::Object(v) => v.to_json(),
19380            Self::Offer(v) => v.to_json(),
19381            Self::OrderedCollection(v) => v.to_json(),
19382            Self::OrderedCollectionPage(v) => v.to_json(),
19383            Self::Organization(v) => v.to_json(),
19384            Self::Page(v) => v.to_json(),
19385            Self::Person(v) => v.to_json(),
19386            Self::Place(v) => v.to_json(),
19387            Self::Profile(v) => v.to_json(),
19388            Self::Proposal(v) => v.to_json(),
19389            Self::Question(v) => v.to_json(),
19390            Self::QuoteAuthorization(v) => v.to_json(),
19391            Self::QuoteRequest(v) => v.to_json(),
19392            Self::Read(v) => v.to_json(),
19393            Self::Reject(v) => v.to_json(),
19394            Self::Relationship(v) => v.to_json(),
19395            Self::Remove(v) => v.to_json(),
19396            Self::ReplyAuthorization(v) => v.to_json(),
19397            Self::ReplyRequest(v) => v.to_json(),
19398            Self::Service(v) => v.to_json(),
19399            Self::TentativeAccept(v) => v.to_json(),
19400            Self::TentativeReject(v) => v.to_json(),
19401            Self::Tombstone(v) => v.to_json(),
19402            Self::Travel(v) => v.to_json(),
19403            Self::Undo(v) => v.to_json(),
19404            Self::Update(v) => v.to_json(),
19405            Self::Video(v) => v.to_json(),
19406            Self::View(v) => v.to_json(),
19407            Self::Other(v) => v.clone(),
19408        }
19409    }
19410}
19411
19412/// A value of [`OrderedCollection`], or of a type extending one of them.
19413#[derive(Clone, Debug, PartialEq)]
19414pub enum AnyOrderedCollection {
19415    /// A reference, by IRI.
19416    Iri(Iri),
19417    FeaturedCollection(Box<FeaturedCollection>),
19418    OrderedCollection(Box<OrderedCollection>),
19419    /// Anything no schema describes, as it was.
19420    Other(Value),
19421}
19422
19423impl AnyOrderedCollection {
19424    /// The IRI of the value: the reference itself, or the object's `id`.
19425    #[must_use]
19426    pub fn id(&self) -> Option<&Iri> {
19427        match self {
19428            Self::Iri(iri) => Some(iri),
19429            Self::FeaturedCollection(object) => object.id.as_ref(),
19430            Self::OrderedCollection(object) => object.id.as_ref(),
19431            _ => None,
19432        }
19433    }
19434}
19435
19436impl FromJson for AnyOrderedCollection {
19437    fn from_json(value: &Value) -> Result<Self, JsonError> {
19438        Ok(match value {
19439            Value::String(_) => {
19440                if let Ok(v) = Iri::from_json(value) {
19441                    return Ok(Self::Iri(v));
19442                }
19443                Self::Other(value.clone())
19444            }
19445            Value::Object(object) => {
19446                if object.len() == 1
19447                    && object.contains_key("id")
19448                    && let Ok(v) = Iri::from_json(value)
19449                {
19450                    return Ok(Self::Iri(v));
19451                }
19452                if json::has_type(object, FeaturedCollection::TYPE) {
19453                    return Ok(FeaturedCollection::from_json(value).map_or_else(
19454                        |_| Self::Other(value.clone()),
19455                        |v| Self::FeaturedCollection(Box::new(v)),
19456                    ));
19457                }
19458                if json::has_type(object, OrderedCollection::TYPE) {
19459                    return Ok(OrderedCollection::from_json(value).map_or_else(
19460                        |_| Self::Other(value.clone()),
19461                        |v| Self::OrderedCollection(Box::new(v)),
19462                    ));
19463                }
19464                Self::Other(value.clone())
19465            }
19466            _ => Self::Other(value.clone()),
19467        })
19468    }
19469}
19470
19471impl ToJson for AnyOrderedCollection {
19472    fn to_json(&self) -> Value {
19473        match self {
19474            Self::Iri(v) => v.to_json(),
19475            Self::FeaturedCollection(v) => v.to_json(),
19476            Self::OrderedCollection(v) => v.to_json(),
19477            Self::Other(v) => v.clone(),
19478        }
19479    }
19480}
19481
19482/// A value of `Boolean`, `DateTime`, or of a type extending one of them.
19483#[derive(Clone, Debug, PartialEq)]
19484pub enum BooleanOrDateTime {
19485    Boolean(bool),
19486    DateTime(String),
19487    /// Anything no schema describes, as it was.
19488    Other(Value),
19489}
19490
19491impl FromJson for BooleanOrDateTime {
19492    fn from_json(value: &Value) -> Result<Self, JsonError> {
19493        Ok(match value {
19494            Value::String(_) => {
19495                String::from_json(value).map_or_else(|_| Self::Other(value.clone()), Self::DateTime)
19496            }
19497            Value::Bool(_) => {
19498                bool::from_json(value).map_or_else(|_| Self::Other(value.clone()), Self::Boolean)
19499            }
19500            Value::Object(_) => Self::Other(value.clone()),
19501            _ => Self::Other(value.clone()),
19502        })
19503    }
19504}
19505
19506impl ToJson for BooleanOrDateTime {
19507    fn to_json(&self) -> Value {
19508        match self {
19509            Self::Boolean(v) => v.to_json(),
19510            Self::DateTime(v) => v.to_json(),
19511            Self::Other(v) => v.clone(),
19512        }
19513    }
19514}
19515
19516/// A value of `Iri`, `Units`, or of a type extending one of them.
19517#[derive(Clone, Debug, PartialEq)]
19518pub enum IriOrUnits {
19519    /// A reference, by IRI.
19520    Iri(Iri),
19521    Units(Units),
19522    /// Anything no schema describes, as it was.
19523    Other(Value),
19524}
19525
19526impl IriOrUnits {
19527    /// The IRI of the value: the reference itself, or the object's `id`.
19528    #[must_use]
19529    pub fn id(&self) -> Option<&Iri> {
19530        match self {
19531            Self::Iri(iri) => Some(iri),
19532            _ => None,
19533        }
19534    }
19535}
19536
19537impl FromJson for IriOrUnits {
19538    fn from_json(value: &Value) -> Result<Self, JsonError> {
19539        Ok(match value {
19540            Value::String(_) => {
19541                if let Ok(v) = Units::from_json(value) {
19542                    return Ok(Self::Units(v));
19543                }
19544                if let Ok(v) = Iri::from_json(value) {
19545                    return Ok(Self::Iri(v));
19546                }
19547                Self::Other(value.clone())
19548            }
19549            Value::Object(object) => {
19550                if object.len() == 1
19551                    && object.contains_key("id")
19552                    && let Ok(v) = Iri::from_json(value)
19553                {
19554                    return Ok(Self::Iri(v));
19555                }
19556                Self::Other(value.clone())
19557            }
19558            _ => Self::Other(value.clone()),
19559        })
19560    }
19561}
19562
19563impl ToJson for IriOrUnits {
19564    fn to_json(&self) -> Value {
19565        match self {
19566            Self::Iri(v) => v.to_json(),
19567            Self::Units(v) => v.to_json(),
19568            Self::Other(v) => v.clone(),
19569        }
19570    }
19571}
19572
19573/// A value of `Iri`, [`Link`], or of a type extending one of them.
19574#[derive(Clone, Debug, PartialEq)]
19575pub enum LinkOrIri {
19576    /// A reference, by IRI.
19577    Iri(Iri),
19578    Hashtag(Box<Hashtag>),
19579    Link(Box<Link>),
19580    Mention(Box<Mention>),
19581    /// Anything no schema describes, as it was.
19582    Other(Value),
19583}
19584
19585impl LinkOrIri {
19586    /// The IRI of the value: the reference itself, or the object's `id`.
19587    #[must_use]
19588    pub fn id(&self) -> Option<&Iri> {
19589        match self {
19590            Self::Iri(iri) => Some(iri),
19591            _ => None,
19592        }
19593    }
19594}
19595
19596impl FromJson for LinkOrIri {
19597    fn from_json(value: &Value) -> Result<Self, JsonError> {
19598        Ok(match value {
19599            Value::String(_) => {
19600                if let Ok(v) = Iri::from_json(value) {
19601                    return Ok(Self::Iri(v));
19602                }
19603                Self::Other(value.clone())
19604            }
19605            Value::Object(object) => {
19606                if object.len() == 1
19607                    && object.contains_key("id")
19608                    && let Ok(v) = Iri::from_json(value)
19609                {
19610                    return Ok(Self::Iri(v));
19611                }
19612                if json::has_type(object, Hashtag::TYPE) {
19613                    return Ok(Hashtag::from_json(value).map_or_else(
19614                        |_| Self::Other(value.clone()),
19615                        |v| Self::Hashtag(Box::new(v)),
19616                    ));
19617                }
19618                if json::has_type(object, Link::TYPE) {
19619                    return Ok(Link::from_json(value)
19620                        .map_or_else(|_| Self::Other(value.clone()), |v| Self::Link(Box::new(v))));
19621                }
19622                if json::has_type(object, Mention::TYPE) {
19623                    return Ok(Mention::from_json(value).map_or_else(
19624                        |_| Self::Other(value.clone()),
19625                        |v| Self::Mention(Box::new(v)),
19626                    ));
19627                }
19628                Self::Other(value.clone())
19629            }
19630            _ => Self::Other(value.clone()),
19631        })
19632    }
19633}
19634
19635impl ToJson for LinkOrIri {
19636    fn to_json(&self) -> Value {
19637        match self {
19638            Self::Iri(v) => v.to_json(),
19639            Self::Hashtag(v) => v.to_json(),
19640            Self::Link(v) => v.to_json(),
19641            Self::Mention(v) => v.to_json(),
19642            Self::Other(v) => v.clone(),
19643        }
19644    }
19645}
19646
19647/// A value of [`Link`], [`Object`], or of a type extending one of them.
19648#[derive(Clone, Debug, PartialEq)]
19649pub enum LinkOrObject {
19650    /// A reference, by IRI.
19651    Iri(Iri),
19652    Accept(Box<Accept>),
19653    Activity(Box<Activity>),
19654    Add(Box<Add>),
19655    Agreement(Box<Agreement>),
19656    Announce(Box<Announce>),
19657    AnnounceAuthorization(Box<AnnounceAuthorization>),
19658    AnnounceRequest(Box<AnnounceRequest>),
19659    Application(Box<Application>),
19660    Arrive(Box<Arrive>),
19661    Article(Box<Article>),
19662    Audio(Box<Audio>),
19663    Block(Box<Block>),
19664    ChatMessage(Box<ChatMessage>),
19665    Collection(Box<Collection>),
19666    CollectionPage(Box<CollectionPage>),
19667    Create(Box<Create>),
19668    Delete(Box<Delete>),
19669    Dislike(Box<Dislike>),
19670    Document(Box<Document>),
19671    Emoji(Box<Emoji>),
19672    EmojiReact(Box<EmojiReact>),
19673    Event(Box<Event>),
19674    FeatureAuthorization(Box<FeatureAuthorization>),
19675    FeatureRequest(Box<FeatureRequest>),
19676    FeaturedCollection(Box<FeaturedCollection>),
19677    FeaturedItem(Box<FeaturedItem>),
19678    Flag(Box<Flag>),
19679    Follow(Box<Follow>),
19680    Group(Box<Group>),
19681    Hashtag(Box<Hashtag>),
19682    Ignore(Box<Ignore>),
19683    Image(Box<Image>),
19684    IntransitiveActivity(Box<IntransitiveActivity>),
19685    Invite(Box<Invite>),
19686    Join(Box<Join>),
19687    Leave(Box<Leave>),
19688    Like(Box<Like>),
19689    LikeAuthorization(Box<LikeAuthorization>),
19690    LikeRequest(Box<LikeRequest>),
19691    Link(Box<Link>),
19692    Listen(Box<Listen>),
19693    Mention(Box<Mention>),
19694    Move(Box<Move>),
19695    Note(Box<Note>),
19696    Object(Box<Object>),
19697    Offer(Box<Offer>),
19698    OrderedCollection(Box<OrderedCollection>),
19699    OrderedCollectionPage(Box<OrderedCollectionPage>),
19700    Organization(Box<Organization>),
19701    Page(Box<Page>),
19702    Person(Box<Person>),
19703    Place(Box<Place>),
19704    Profile(Box<Profile>),
19705    Proposal(Box<Proposal>),
19706    Question(Box<Question>),
19707    QuoteAuthorization(Box<QuoteAuthorization>),
19708    QuoteRequest(Box<QuoteRequest>),
19709    Read(Box<Read>),
19710    Reject(Box<Reject>),
19711    Relationship(Box<Relationship>),
19712    Remove(Box<Remove>),
19713    ReplyAuthorization(Box<ReplyAuthorization>),
19714    ReplyRequest(Box<ReplyRequest>),
19715    Service(Box<Service>),
19716    TentativeAccept(Box<TentativeAccept>),
19717    TentativeReject(Box<TentativeReject>),
19718    Tombstone(Box<Tombstone>),
19719    Travel(Box<Travel>),
19720    Undo(Box<Undo>),
19721    Update(Box<Update>),
19722    Video(Box<Video>),
19723    View(Box<View>),
19724    /// Anything no schema describes, as it was.
19725    Other(Value),
19726}
19727
19728impl LinkOrObject {
19729    /// The IRI of the value: the reference itself, or the object's `id`.
19730    #[must_use]
19731    pub fn id(&self) -> Option<&Iri> {
19732        match self {
19733            Self::Iri(iri) => Some(iri),
19734            Self::Accept(object) => object.id.as_ref(),
19735            Self::Activity(object) => object.id.as_ref(),
19736            Self::Add(object) => object.id.as_ref(),
19737            Self::Agreement(object) => object.id.as_ref(),
19738            Self::Announce(object) => object.id.as_ref(),
19739            Self::AnnounceAuthorization(object) => object.id.as_ref(),
19740            Self::AnnounceRequest(object) => object.id.as_ref(),
19741            Self::Application(object) => object.id.as_ref(),
19742            Self::Arrive(object) => object.id.as_ref(),
19743            Self::Article(object) => object.id.as_ref(),
19744            Self::Audio(object) => object.id.as_ref(),
19745            Self::Block(object) => object.id.as_ref(),
19746            Self::ChatMessage(object) => object.id.as_ref(),
19747            Self::Collection(object) => object.id.as_ref(),
19748            Self::CollectionPage(object) => object.id.as_ref(),
19749            Self::Create(object) => object.id.as_ref(),
19750            Self::Delete(object) => object.id.as_ref(),
19751            Self::Dislike(object) => object.id.as_ref(),
19752            Self::Document(object) => object.id.as_ref(),
19753            Self::Emoji(object) => object.id.as_ref(),
19754            Self::EmojiReact(object) => object.id.as_ref(),
19755            Self::Event(object) => object.id.as_ref(),
19756            Self::FeatureAuthorization(object) => object.id.as_ref(),
19757            Self::FeatureRequest(object) => object.id.as_ref(),
19758            Self::FeaturedCollection(object) => object.id.as_ref(),
19759            Self::FeaturedItem(object) => object.id.as_ref(),
19760            Self::Flag(object) => object.id.as_ref(),
19761            Self::Follow(object) => object.id.as_ref(),
19762            Self::Group(object) => object.id.as_ref(),
19763            Self::Ignore(object) => object.id.as_ref(),
19764            Self::Image(object) => object.id.as_ref(),
19765            Self::IntransitiveActivity(object) => object.id.as_ref(),
19766            Self::Invite(object) => object.id.as_ref(),
19767            Self::Join(object) => object.id.as_ref(),
19768            Self::Leave(object) => object.id.as_ref(),
19769            Self::Like(object) => object.id.as_ref(),
19770            Self::LikeAuthorization(object) => object.id.as_ref(),
19771            Self::LikeRequest(object) => object.id.as_ref(),
19772            Self::Listen(object) => object.id.as_ref(),
19773            Self::Move(object) => object.id.as_ref(),
19774            Self::Note(object) => object.id.as_ref(),
19775            Self::Object(object) => object.id.as_ref(),
19776            Self::Offer(object) => object.id.as_ref(),
19777            Self::OrderedCollection(object) => object.id.as_ref(),
19778            Self::OrderedCollectionPage(object) => object.id.as_ref(),
19779            Self::Organization(object) => object.id.as_ref(),
19780            Self::Page(object) => object.id.as_ref(),
19781            Self::Person(object) => object.id.as_ref(),
19782            Self::Place(object) => object.id.as_ref(),
19783            Self::Profile(object) => object.id.as_ref(),
19784            Self::Proposal(object) => object.id.as_ref(),
19785            Self::Question(object) => object.id.as_ref(),
19786            Self::QuoteAuthorization(object) => object.id.as_ref(),
19787            Self::QuoteRequest(object) => object.id.as_ref(),
19788            Self::Read(object) => object.id.as_ref(),
19789            Self::Reject(object) => object.id.as_ref(),
19790            Self::Relationship(object) => object.id.as_ref(),
19791            Self::Remove(object) => object.id.as_ref(),
19792            Self::ReplyAuthorization(object) => object.id.as_ref(),
19793            Self::ReplyRequest(object) => object.id.as_ref(),
19794            Self::Service(object) => object.id.as_ref(),
19795            Self::TentativeAccept(object) => object.id.as_ref(),
19796            Self::TentativeReject(object) => object.id.as_ref(),
19797            Self::Tombstone(object) => object.id.as_ref(),
19798            Self::Travel(object) => object.id.as_ref(),
19799            Self::Undo(object) => object.id.as_ref(),
19800            Self::Update(object) => object.id.as_ref(),
19801            Self::Video(object) => object.id.as_ref(),
19802            Self::View(object) => object.id.as_ref(),
19803            _ => None,
19804        }
19805    }
19806}
19807
19808impl FromJson for LinkOrObject {
19809    fn from_json(value: &Value) -> Result<Self, JsonError> {
19810        Ok(match value {
19811            Value::String(_) => {
19812                if let Ok(v) = Iri::from_json(value) {
19813                    return Ok(Self::Iri(v));
19814                }
19815                Self::Other(value.clone())
19816            }
19817            Value::Object(object) => {
19818                if object.len() == 1
19819                    && object.contains_key("id")
19820                    && let Ok(v) = Iri::from_json(value)
19821                {
19822                    return Ok(Self::Iri(v));
19823                }
19824                if json::has_type(object, Accept::TYPE) {
19825                    return Ok(Accept::from_json(value).map_or_else(
19826                        |_| Self::Other(value.clone()),
19827                        |v| Self::Accept(Box::new(v)),
19828                    ));
19829                }
19830                if json::has_type(object, Activity::TYPE) {
19831                    return Ok(Activity::from_json(value).map_or_else(
19832                        |_| Self::Other(value.clone()),
19833                        |v| Self::Activity(Box::new(v)),
19834                    ));
19835                }
19836                if json::has_type(object, Add::TYPE) {
19837                    return Ok(Add::from_json(value)
19838                        .map_or_else(|_| Self::Other(value.clone()), |v| Self::Add(Box::new(v))));
19839                }
19840                if json::has_type(object, Agreement::TYPE) {
19841                    return Ok(Agreement::from_json(value).map_or_else(
19842                        |_| Self::Other(value.clone()),
19843                        |v| Self::Agreement(Box::new(v)),
19844                    ));
19845                }
19846                if json::has_type(object, Announce::TYPE) {
19847                    return Ok(Announce::from_json(value).map_or_else(
19848                        |_| Self::Other(value.clone()),
19849                        |v| Self::Announce(Box::new(v)),
19850                    ));
19851                }
19852                if json::has_type(object, AnnounceAuthorization::TYPE) {
19853                    return Ok(AnnounceAuthorization::from_json(value).map_or_else(
19854                        |_| Self::Other(value.clone()),
19855                        |v| Self::AnnounceAuthorization(Box::new(v)),
19856                    ));
19857                }
19858                if json::has_type(object, AnnounceRequest::TYPE) {
19859                    return Ok(AnnounceRequest::from_json(value).map_or_else(
19860                        |_| Self::Other(value.clone()),
19861                        |v| Self::AnnounceRequest(Box::new(v)),
19862                    ));
19863                }
19864                if json::has_type(object, Application::TYPE) {
19865                    return Ok(Application::from_json(value).map_or_else(
19866                        |_| Self::Other(value.clone()),
19867                        |v| Self::Application(Box::new(v)),
19868                    ));
19869                }
19870                if json::has_type(object, Arrive::TYPE) {
19871                    return Ok(Arrive::from_json(value).map_or_else(
19872                        |_| Self::Other(value.clone()),
19873                        |v| Self::Arrive(Box::new(v)),
19874                    ));
19875                }
19876                if json::has_type(object, Article::TYPE) {
19877                    return Ok(Article::from_json(value).map_or_else(
19878                        |_| Self::Other(value.clone()),
19879                        |v| Self::Article(Box::new(v)),
19880                    ));
19881                }
19882                if json::has_type(object, Audio::TYPE) {
19883                    return Ok(Audio::from_json(value).map_or_else(
19884                        |_| Self::Other(value.clone()),
19885                        |v| Self::Audio(Box::new(v)),
19886                    ));
19887                }
19888                if json::has_type(object, Block::TYPE) {
19889                    return Ok(Block::from_json(value).map_or_else(
19890                        |_| Self::Other(value.clone()),
19891                        |v| Self::Block(Box::new(v)),
19892                    ));
19893                }
19894                if json::has_type(object, ChatMessage::TYPE) {
19895                    return Ok(ChatMessage::from_json(value).map_or_else(
19896                        |_| Self::Other(value.clone()),
19897                        |v| Self::ChatMessage(Box::new(v)),
19898                    ));
19899                }
19900                if json::has_type(object, Collection::TYPE) {
19901                    return Ok(Collection::from_json(value).map_or_else(
19902                        |_| Self::Other(value.clone()),
19903                        |v| Self::Collection(Box::new(v)),
19904                    ));
19905                }
19906                if json::has_type(object, CollectionPage::TYPE) {
19907                    return Ok(CollectionPage::from_json(value).map_or_else(
19908                        |_| Self::Other(value.clone()),
19909                        |v| Self::CollectionPage(Box::new(v)),
19910                    ));
19911                }
19912                if json::has_type(object, Create::TYPE) {
19913                    return Ok(Create::from_json(value).map_or_else(
19914                        |_| Self::Other(value.clone()),
19915                        |v| Self::Create(Box::new(v)),
19916                    ));
19917                }
19918                if json::has_type(object, Delete::TYPE) {
19919                    return Ok(Delete::from_json(value).map_or_else(
19920                        |_| Self::Other(value.clone()),
19921                        |v| Self::Delete(Box::new(v)),
19922                    ));
19923                }
19924                if json::has_type(object, Dislike::TYPE) {
19925                    return Ok(Dislike::from_json(value).map_or_else(
19926                        |_| Self::Other(value.clone()),
19927                        |v| Self::Dislike(Box::new(v)),
19928                    ));
19929                }
19930                if json::has_type(object, Document::TYPE) {
19931                    return Ok(Document::from_json(value).map_or_else(
19932                        |_| Self::Other(value.clone()),
19933                        |v| Self::Document(Box::new(v)),
19934                    ));
19935                }
19936                if json::has_type(object, Emoji::TYPE) {
19937                    return Ok(Emoji::from_json(value).map_or_else(
19938                        |_| Self::Other(value.clone()),
19939                        |v| Self::Emoji(Box::new(v)),
19940                    ));
19941                }
19942                if json::has_type(object, EmojiReact::TYPE) {
19943                    return Ok(EmojiReact::from_json(value).map_or_else(
19944                        |_| Self::Other(value.clone()),
19945                        |v| Self::EmojiReact(Box::new(v)),
19946                    ));
19947                }
19948                if json::has_type(object, Event::TYPE) {
19949                    return Ok(Event::from_json(value).map_or_else(
19950                        |_| Self::Other(value.clone()),
19951                        |v| Self::Event(Box::new(v)),
19952                    ));
19953                }
19954                if json::has_type(object, FeatureAuthorization::TYPE) {
19955                    return Ok(FeatureAuthorization::from_json(value).map_or_else(
19956                        |_| Self::Other(value.clone()),
19957                        |v| Self::FeatureAuthorization(Box::new(v)),
19958                    ));
19959                }
19960                if json::has_type(object, FeatureRequest::TYPE) {
19961                    return Ok(FeatureRequest::from_json(value).map_or_else(
19962                        |_| Self::Other(value.clone()),
19963                        |v| Self::FeatureRequest(Box::new(v)),
19964                    ));
19965                }
19966                if json::has_type(object, FeaturedCollection::TYPE) {
19967                    return Ok(FeaturedCollection::from_json(value).map_or_else(
19968                        |_| Self::Other(value.clone()),
19969                        |v| Self::FeaturedCollection(Box::new(v)),
19970                    ));
19971                }
19972                if json::has_type(object, FeaturedItem::TYPE) {
19973                    return Ok(FeaturedItem::from_json(value).map_or_else(
19974                        |_| Self::Other(value.clone()),
19975                        |v| Self::FeaturedItem(Box::new(v)),
19976                    ));
19977                }
19978                if json::has_type(object, Flag::TYPE) {
19979                    return Ok(Flag::from_json(value)
19980                        .map_or_else(|_| Self::Other(value.clone()), |v| Self::Flag(Box::new(v))));
19981                }
19982                if json::has_type(object, Follow::TYPE) {
19983                    return Ok(Follow::from_json(value).map_or_else(
19984                        |_| Self::Other(value.clone()),
19985                        |v| Self::Follow(Box::new(v)),
19986                    ));
19987                }
19988                if json::has_type(object, Group::TYPE) {
19989                    return Ok(Group::from_json(value).map_or_else(
19990                        |_| Self::Other(value.clone()),
19991                        |v| Self::Group(Box::new(v)),
19992                    ));
19993                }
19994                if json::has_type(object, Hashtag::TYPE) {
19995                    return Ok(Hashtag::from_json(value).map_or_else(
19996                        |_| Self::Other(value.clone()),
19997                        |v| Self::Hashtag(Box::new(v)),
19998                    ));
19999                }
20000                if json::has_type(object, Ignore::TYPE) {
20001                    return Ok(Ignore::from_json(value).map_or_else(
20002                        |_| Self::Other(value.clone()),
20003                        |v| Self::Ignore(Box::new(v)),
20004                    ));
20005                }
20006                if json::has_type(object, Image::TYPE) {
20007                    return Ok(Image::from_json(value).map_or_else(
20008                        |_| Self::Other(value.clone()),
20009                        |v| Self::Image(Box::new(v)),
20010                    ));
20011                }
20012                if json::has_type(object, IntransitiveActivity::TYPE) {
20013                    return Ok(IntransitiveActivity::from_json(value).map_or_else(
20014                        |_| Self::Other(value.clone()),
20015                        |v| Self::IntransitiveActivity(Box::new(v)),
20016                    ));
20017                }
20018                if json::has_type(object, Invite::TYPE) {
20019                    return Ok(Invite::from_json(value).map_or_else(
20020                        |_| Self::Other(value.clone()),
20021                        |v| Self::Invite(Box::new(v)),
20022                    ));
20023                }
20024                if json::has_type(object, Join::TYPE) {
20025                    return Ok(Join::from_json(value)
20026                        .map_or_else(|_| Self::Other(value.clone()), |v| Self::Join(Box::new(v))));
20027                }
20028                if json::has_type(object, Leave::TYPE) {
20029                    return Ok(Leave::from_json(value).map_or_else(
20030                        |_| Self::Other(value.clone()),
20031                        |v| Self::Leave(Box::new(v)),
20032                    ));
20033                }
20034                if json::has_type(object, Like::TYPE) {
20035                    return Ok(Like::from_json(value)
20036                        .map_or_else(|_| Self::Other(value.clone()), |v| Self::Like(Box::new(v))));
20037                }
20038                if json::has_type(object, LikeAuthorization::TYPE) {
20039                    return Ok(LikeAuthorization::from_json(value).map_or_else(
20040                        |_| Self::Other(value.clone()),
20041                        |v| Self::LikeAuthorization(Box::new(v)),
20042                    ));
20043                }
20044                if json::has_type(object, LikeRequest::TYPE) {
20045                    return Ok(LikeRequest::from_json(value).map_or_else(
20046                        |_| Self::Other(value.clone()),
20047                        |v| Self::LikeRequest(Box::new(v)),
20048                    ));
20049                }
20050                if json::has_type(object, Link::TYPE) {
20051                    return Ok(Link::from_json(value)
20052                        .map_or_else(|_| Self::Other(value.clone()), |v| Self::Link(Box::new(v))));
20053                }
20054                if json::has_type(object, Listen::TYPE) {
20055                    return Ok(Listen::from_json(value).map_or_else(
20056                        |_| Self::Other(value.clone()),
20057                        |v| Self::Listen(Box::new(v)),
20058                    ));
20059                }
20060                if json::has_type(object, Mention::TYPE) {
20061                    return Ok(Mention::from_json(value).map_or_else(
20062                        |_| Self::Other(value.clone()),
20063                        |v| Self::Mention(Box::new(v)),
20064                    ));
20065                }
20066                if json::has_type(object, Move::TYPE) {
20067                    return Ok(Move::from_json(value)
20068                        .map_or_else(|_| Self::Other(value.clone()), |v| Self::Move(Box::new(v))));
20069                }
20070                if json::has_type(object, Note::TYPE) {
20071                    return Ok(Note::from_json(value)
20072                        .map_or_else(|_| Self::Other(value.clone()), |v| Self::Note(Box::new(v))));
20073                }
20074                if json::has_type(object, Object::TYPE) {
20075                    return Ok(Object::from_json(value).map_or_else(
20076                        |_| Self::Other(value.clone()),
20077                        |v| Self::Object(Box::new(v)),
20078                    ));
20079                }
20080                if json::has_type(object, Offer::TYPE) {
20081                    return Ok(Offer::from_json(value).map_or_else(
20082                        |_| Self::Other(value.clone()),
20083                        |v| Self::Offer(Box::new(v)),
20084                    ));
20085                }
20086                if json::has_type(object, OrderedCollection::TYPE) {
20087                    return Ok(OrderedCollection::from_json(value).map_or_else(
20088                        |_| Self::Other(value.clone()),
20089                        |v| Self::OrderedCollection(Box::new(v)),
20090                    ));
20091                }
20092                if json::has_type(object, OrderedCollectionPage::TYPE) {
20093                    return Ok(OrderedCollectionPage::from_json(value).map_or_else(
20094                        |_| Self::Other(value.clone()),
20095                        |v| Self::OrderedCollectionPage(Box::new(v)),
20096                    ));
20097                }
20098                if json::has_type(object, Organization::TYPE) {
20099                    return Ok(Organization::from_json(value).map_or_else(
20100                        |_| Self::Other(value.clone()),
20101                        |v| Self::Organization(Box::new(v)),
20102                    ));
20103                }
20104                if json::has_type(object, Page::TYPE) {
20105                    return Ok(Page::from_json(value)
20106                        .map_or_else(|_| Self::Other(value.clone()), |v| Self::Page(Box::new(v))));
20107                }
20108                if json::has_type(object, Person::TYPE) {
20109                    return Ok(Person::from_json(value).map_or_else(
20110                        |_| Self::Other(value.clone()),
20111                        |v| Self::Person(Box::new(v)),
20112                    ));
20113                }
20114                if json::has_type(object, Place::TYPE) {
20115                    return Ok(Place::from_json(value).map_or_else(
20116                        |_| Self::Other(value.clone()),
20117                        |v| Self::Place(Box::new(v)),
20118                    ));
20119                }
20120                if json::has_type(object, Profile::TYPE) {
20121                    return Ok(Profile::from_json(value).map_or_else(
20122                        |_| Self::Other(value.clone()),
20123                        |v| Self::Profile(Box::new(v)),
20124                    ));
20125                }
20126                if json::has_type(object, Proposal::TYPE) {
20127                    return Ok(Proposal::from_json(value).map_or_else(
20128                        |_| Self::Other(value.clone()),
20129                        |v| Self::Proposal(Box::new(v)),
20130                    ));
20131                }
20132                if json::has_type(object, Question::TYPE) {
20133                    return Ok(Question::from_json(value).map_or_else(
20134                        |_| Self::Other(value.clone()),
20135                        |v| Self::Question(Box::new(v)),
20136                    ));
20137                }
20138                if json::has_type(object, QuoteAuthorization::TYPE) {
20139                    return Ok(QuoteAuthorization::from_json(value).map_or_else(
20140                        |_| Self::Other(value.clone()),
20141                        |v| Self::QuoteAuthorization(Box::new(v)),
20142                    ));
20143                }
20144                if json::has_type(object, QuoteRequest::TYPE) {
20145                    return Ok(QuoteRequest::from_json(value).map_or_else(
20146                        |_| Self::Other(value.clone()),
20147                        |v| Self::QuoteRequest(Box::new(v)),
20148                    ));
20149                }
20150                if json::has_type(object, Read::TYPE) {
20151                    return Ok(Read::from_json(value)
20152                        .map_or_else(|_| Self::Other(value.clone()), |v| Self::Read(Box::new(v))));
20153                }
20154                if json::has_type(object, Reject::TYPE) {
20155                    return Ok(Reject::from_json(value).map_or_else(
20156                        |_| Self::Other(value.clone()),
20157                        |v| Self::Reject(Box::new(v)),
20158                    ));
20159                }
20160                if json::has_type(object, Relationship::TYPE) {
20161                    return Ok(Relationship::from_json(value).map_or_else(
20162                        |_| Self::Other(value.clone()),
20163                        |v| Self::Relationship(Box::new(v)),
20164                    ));
20165                }
20166                if json::has_type(object, Remove::TYPE) {
20167                    return Ok(Remove::from_json(value).map_or_else(
20168                        |_| Self::Other(value.clone()),
20169                        |v| Self::Remove(Box::new(v)),
20170                    ));
20171                }
20172                if json::has_type(object, ReplyAuthorization::TYPE) {
20173                    return Ok(ReplyAuthorization::from_json(value).map_or_else(
20174                        |_| Self::Other(value.clone()),
20175                        |v| Self::ReplyAuthorization(Box::new(v)),
20176                    ));
20177                }
20178                if json::has_type(object, ReplyRequest::TYPE) {
20179                    return Ok(ReplyRequest::from_json(value).map_or_else(
20180                        |_| Self::Other(value.clone()),
20181                        |v| Self::ReplyRequest(Box::new(v)),
20182                    ));
20183                }
20184                if json::has_type(object, Service::TYPE) {
20185                    return Ok(Service::from_json(value).map_or_else(
20186                        |_| Self::Other(value.clone()),
20187                        |v| Self::Service(Box::new(v)),
20188                    ));
20189                }
20190                if json::has_type(object, TentativeAccept::TYPE) {
20191                    return Ok(TentativeAccept::from_json(value).map_or_else(
20192                        |_| Self::Other(value.clone()),
20193                        |v| Self::TentativeAccept(Box::new(v)),
20194                    ));
20195                }
20196                if json::has_type(object, TentativeReject::TYPE) {
20197                    return Ok(TentativeReject::from_json(value).map_or_else(
20198                        |_| Self::Other(value.clone()),
20199                        |v| Self::TentativeReject(Box::new(v)),
20200                    ));
20201                }
20202                if json::has_type(object, Tombstone::TYPE) {
20203                    return Ok(Tombstone::from_json(value).map_or_else(
20204                        |_| Self::Other(value.clone()),
20205                        |v| Self::Tombstone(Box::new(v)),
20206                    ));
20207                }
20208                if json::has_type(object, Travel::TYPE) {
20209                    return Ok(Travel::from_json(value).map_or_else(
20210                        |_| Self::Other(value.clone()),
20211                        |v| Self::Travel(Box::new(v)),
20212                    ));
20213                }
20214                if json::has_type(object, Undo::TYPE) {
20215                    return Ok(Undo::from_json(value)
20216                        .map_or_else(|_| Self::Other(value.clone()), |v| Self::Undo(Box::new(v))));
20217                }
20218                if json::has_type(object, Update::TYPE) {
20219                    return Ok(Update::from_json(value).map_or_else(
20220                        |_| Self::Other(value.clone()),
20221                        |v| Self::Update(Box::new(v)),
20222                    ));
20223                }
20224                if json::has_type(object, Video::TYPE) {
20225                    return Ok(Video::from_json(value).map_or_else(
20226                        |_| Self::Other(value.clone()),
20227                        |v| Self::Video(Box::new(v)),
20228                    ));
20229                }
20230                if json::has_type(object, View::TYPE) {
20231                    return Ok(View::from_json(value)
20232                        .map_or_else(|_| Self::Other(value.clone()), |v| Self::View(Box::new(v))));
20233                }
20234                Self::Other(value.clone())
20235            }
20236            _ => Self::Other(value.clone()),
20237        })
20238    }
20239}
20240
20241impl ToJson for LinkOrObject {
20242    fn to_json(&self) -> Value {
20243        match self {
20244            Self::Iri(v) => v.to_json(),
20245            Self::Accept(v) => v.to_json(),
20246            Self::Activity(v) => v.to_json(),
20247            Self::Add(v) => v.to_json(),
20248            Self::Agreement(v) => v.to_json(),
20249            Self::Announce(v) => v.to_json(),
20250            Self::AnnounceAuthorization(v) => v.to_json(),
20251            Self::AnnounceRequest(v) => v.to_json(),
20252            Self::Application(v) => v.to_json(),
20253            Self::Arrive(v) => v.to_json(),
20254            Self::Article(v) => v.to_json(),
20255            Self::Audio(v) => v.to_json(),
20256            Self::Block(v) => v.to_json(),
20257            Self::ChatMessage(v) => v.to_json(),
20258            Self::Collection(v) => v.to_json(),
20259            Self::CollectionPage(v) => v.to_json(),
20260            Self::Create(v) => v.to_json(),
20261            Self::Delete(v) => v.to_json(),
20262            Self::Dislike(v) => v.to_json(),
20263            Self::Document(v) => v.to_json(),
20264            Self::Emoji(v) => v.to_json(),
20265            Self::EmojiReact(v) => v.to_json(),
20266            Self::Event(v) => v.to_json(),
20267            Self::FeatureAuthorization(v) => v.to_json(),
20268            Self::FeatureRequest(v) => v.to_json(),
20269            Self::FeaturedCollection(v) => v.to_json(),
20270            Self::FeaturedItem(v) => v.to_json(),
20271            Self::Flag(v) => v.to_json(),
20272            Self::Follow(v) => v.to_json(),
20273            Self::Group(v) => v.to_json(),
20274            Self::Hashtag(v) => v.to_json(),
20275            Self::Ignore(v) => v.to_json(),
20276            Self::Image(v) => v.to_json(),
20277            Self::IntransitiveActivity(v) => v.to_json(),
20278            Self::Invite(v) => v.to_json(),
20279            Self::Join(v) => v.to_json(),
20280            Self::Leave(v) => v.to_json(),
20281            Self::Like(v) => v.to_json(),
20282            Self::LikeAuthorization(v) => v.to_json(),
20283            Self::LikeRequest(v) => v.to_json(),
20284            Self::Link(v) => v.to_json(),
20285            Self::Listen(v) => v.to_json(),
20286            Self::Mention(v) => v.to_json(),
20287            Self::Move(v) => v.to_json(),
20288            Self::Note(v) => v.to_json(),
20289            Self::Object(v) => v.to_json(),
20290            Self::Offer(v) => v.to_json(),
20291            Self::OrderedCollection(v) => v.to_json(),
20292            Self::OrderedCollectionPage(v) => v.to_json(),
20293            Self::Organization(v) => v.to_json(),
20294            Self::Page(v) => v.to_json(),
20295            Self::Person(v) => v.to_json(),
20296            Self::Place(v) => v.to_json(),
20297            Self::Profile(v) => v.to_json(),
20298            Self::Proposal(v) => v.to_json(),
20299            Self::Question(v) => v.to_json(),
20300            Self::QuoteAuthorization(v) => v.to_json(),
20301            Self::QuoteRequest(v) => v.to_json(),
20302            Self::Read(v) => v.to_json(),
20303            Self::Reject(v) => v.to_json(),
20304            Self::Relationship(v) => v.to_json(),
20305            Self::Remove(v) => v.to_json(),
20306            Self::ReplyAuthorization(v) => v.to_json(),
20307            Self::ReplyRequest(v) => v.to_json(),
20308            Self::Service(v) => v.to_json(),
20309            Self::TentativeAccept(v) => v.to_json(),
20310            Self::TentativeReject(v) => v.to_json(),
20311            Self::Tombstone(v) => v.to_json(),
20312            Self::Travel(v) => v.to_json(),
20313            Self::Undo(v) => v.to_json(),
20314            Self::Update(v) => v.to_json(),
20315            Self::Video(v) => v.to_json(),
20316            Self::View(v) => v.to_json(),
20317            Self::Other(v) => v.clone(),
20318        }
20319    }
20320}
20321
20322/// A value of [`PropertyValue`], [`Link`], [`Object`], or of a type extending one of them.
20323#[derive(Clone, Debug, PartialEq)]
20324pub enum LinkOrObjectOrPropertyValue {
20325    /// A reference, by IRI.
20326    Iri(Iri),
20327    Accept(Box<Accept>),
20328    Activity(Box<Activity>),
20329    Add(Box<Add>),
20330    Agreement(Box<Agreement>),
20331    Announce(Box<Announce>),
20332    AnnounceAuthorization(Box<AnnounceAuthorization>),
20333    AnnounceRequest(Box<AnnounceRequest>),
20334    Application(Box<Application>),
20335    Arrive(Box<Arrive>),
20336    Article(Box<Article>),
20337    Audio(Box<Audio>),
20338    Block(Box<Block>),
20339    ChatMessage(Box<ChatMessage>),
20340    Collection(Box<Collection>),
20341    CollectionPage(Box<CollectionPage>),
20342    Create(Box<Create>),
20343    Delete(Box<Delete>),
20344    Dislike(Box<Dislike>),
20345    Document(Box<Document>),
20346    Emoji(Box<Emoji>),
20347    EmojiReact(Box<EmojiReact>),
20348    Event(Box<Event>),
20349    FeatureAuthorization(Box<FeatureAuthorization>),
20350    FeatureRequest(Box<FeatureRequest>),
20351    FeaturedCollection(Box<FeaturedCollection>),
20352    FeaturedItem(Box<FeaturedItem>),
20353    Flag(Box<Flag>),
20354    Follow(Box<Follow>),
20355    Group(Box<Group>),
20356    Hashtag(Box<Hashtag>),
20357    Ignore(Box<Ignore>),
20358    Image(Box<Image>),
20359    IntransitiveActivity(Box<IntransitiveActivity>),
20360    Invite(Box<Invite>),
20361    Join(Box<Join>),
20362    Leave(Box<Leave>),
20363    Like(Box<Like>),
20364    LikeAuthorization(Box<LikeAuthorization>),
20365    LikeRequest(Box<LikeRequest>),
20366    Link(Box<Link>),
20367    Listen(Box<Listen>),
20368    Mention(Box<Mention>),
20369    Move(Box<Move>),
20370    Note(Box<Note>),
20371    Object(Box<Object>),
20372    Offer(Box<Offer>),
20373    OrderedCollection(Box<OrderedCollection>),
20374    OrderedCollectionPage(Box<OrderedCollectionPage>),
20375    Organization(Box<Organization>),
20376    Page(Box<Page>),
20377    Person(Box<Person>),
20378    Place(Box<Place>),
20379    Profile(Box<Profile>),
20380    PropertyValue(Box<PropertyValue>),
20381    Proposal(Box<Proposal>),
20382    Question(Box<Question>),
20383    QuoteAuthorization(Box<QuoteAuthorization>),
20384    QuoteRequest(Box<QuoteRequest>),
20385    Read(Box<Read>),
20386    Reject(Box<Reject>),
20387    Relationship(Box<Relationship>),
20388    Remove(Box<Remove>),
20389    ReplyAuthorization(Box<ReplyAuthorization>),
20390    ReplyRequest(Box<ReplyRequest>),
20391    Service(Box<Service>),
20392    TentativeAccept(Box<TentativeAccept>),
20393    TentativeReject(Box<TentativeReject>),
20394    Tombstone(Box<Tombstone>),
20395    Travel(Box<Travel>),
20396    Undo(Box<Undo>),
20397    Update(Box<Update>),
20398    Video(Box<Video>),
20399    View(Box<View>),
20400    /// Anything no schema describes, as it was.
20401    Other(Value),
20402}
20403
20404impl LinkOrObjectOrPropertyValue {
20405    /// The IRI of the value: the reference itself, or the object's `id`.
20406    #[must_use]
20407    pub fn id(&self) -> Option<&Iri> {
20408        match self {
20409            Self::Iri(iri) => Some(iri),
20410            Self::Accept(object) => object.id.as_ref(),
20411            Self::Activity(object) => object.id.as_ref(),
20412            Self::Add(object) => object.id.as_ref(),
20413            Self::Agreement(object) => object.id.as_ref(),
20414            Self::Announce(object) => object.id.as_ref(),
20415            Self::AnnounceAuthorization(object) => object.id.as_ref(),
20416            Self::AnnounceRequest(object) => object.id.as_ref(),
20417            Self::Application(object) => object.id.as_ref(),
20418            Self::Arrive(object) => object.id.as_ref(),
20419            Self::Article(object) => object.id.as_ref(),
20420            Self::Audio(object) => object.id.as_ref(),
20421            Self::Block(object) => object.id.as_ref(),
20422            Self::ChatMessage(object) => object.id.as_ref(),
20423            Self::Collection(object) => object.id.as_ref(),
20424            Self::CollectionPage(object) => object.id.as_ref(),
20425            Self::Create(object) => object.id.as_ref(),
20426            Self::Delete(object) => object.id.as_ref(),
20427            Self::Dislike(object) => object.id.as_ref(),
20428            Self::Document(object) => object.id.as_ref(),
20429            Self::Emoji(object) => object.id.as_ref(),
20430            Self::EmojiReact(object) => object.id.as_ref(),
20431            Self::Event(object) => object.id.as_ref(),
20432            Self::FeatureAuthorization(object) => object.id.as_ref(),
20433            Self::FeatureRequest(object) => object.id.as_ref(),
20434            Self::FeaturedCollection(object) => object.id.as_ref(),
20435            Self::FeaturedItem(object) => object.id.as_ref(),
20436            Self::Flag(object) => object.id.as_ref(),
20437            Self::Follow(object) => object.id.as_ref(),
20438            Self::Group(object) => object.id.as_ref(),
20439            Self::Ignore(object) => object.id.as_ref(),
20440            Self::Image(object) => object.id.as_ref(),
20441            Self::IntransitiveActivity(object) => object.id.as_ref(),
20442            Self::Invite(object) => object.id.as_ref(),
20443            Self::Join(object) => object.id.as_ref(),
20444            Self::Leave(object) => object.id.as_ref(),
20445            Self::Like(object) => object.id.as_ref(),
20446            Self::LikeAuthorization(object) => object.id.as_ref(),
20447            Self::LikeRequest(object) => object.id.as_ref(),
20448            Self::Listen(object) => object.id.as_ref(),
20449            Self::Move(object) => object.id.as_ref(),
20450            Self::Note(object) => object.id.as_ref(),
20451            Self::Object(object) => object.id.as_ref(),
20452            Self::Offer(object) => object.id.as_ref(),
20453            Self::OrderedCollection(object) => object.id.as_ref(),
20454            Self::OrderedCollectionPage(object) => object.id.as_ref(),
20455            Self::Organization(object) => object.id.as_ref(),
20456            Self::Page(object) => object.id.as_ref(),
20457            Self::Person(object) => object.id.as_ref(),
20458            Self::Place(object) => object.id.as_ref(),
20459            Self::Profile(object) => object.id.as_ref(),
20460            Self::Proposal(object) => object.id.as_ref(),
20461            Self::Question(object) => object.id.as_ref(),
20462            Self::QuoteAuthorization(object) => object.id.as_ref(),
20463            Self::QuoteRequest(object) => object.id.as_ref(),
20464            Self::Read(object) => object.id.as_ref(),
20465            Self::Reject(object) => object.id.as_ref(),
20466            Self::Relationship(object) => object.id.as_ref(),
20467            Self::Remove(object) => object.id.as_ref(),
20468            Self::ReplyAuthorization(object) => object.id.as_ref(),
20469            Self::ReplyRequest(object) => object.id.as_ref(),
20470            Self::Service(object) => object.id.as_ref(),
20471            Self::TentativeAccept(object) => object.id.as_ref(),
20472            Self::TentativeReject(object) => object.id.as_ref(),
20473            Self::Tombstone(object) => object.id.as_ref(),
20474            Self::Travel(object) => object.id.as_ref(),
20475            Self::Undo(object) => object.id.as_ref(),
20476            Self::Update(object) => object.id.as_ref(),
20477            Self::Video(object) => object.id.as_ref(),
20478            Self::View(object) => object.id.as_ref(),
20479            _ => None,
20480        }
20481    }
20482}
20483
20484impl FromJson for LinkOrObjectOrPropertyValue {
20485    fn from_json(value: &Value) -> Result<Self, JsonError> {
20486        Ok(match value {
20487            Value::String(_) => {
20488                if let Ok(v) = Iri::from_json(value) {
20489                    return Ok(Self::Iri(v));
20490                }
20491                Self::Other(value.clone())
20492            }
20493            Value::Object(object) => {
20494                if object.len() == 1
20495                    && object.contains_key("id")
20496                    && let Ok(v) = Iri::from_json(value)
20497                {
20498                    return Ok(Self::Iri(v));
20499                }
20500                if json::has_type(object, Accept::TYPE) {
20501                    return Ok(Accept::from_json(value).map_or_else(
20502                        |_| Self::Other(value.clone()),
20503                        |v| Self::Accept(Box::new(v)),
20504                    ));
20505                }
20506                if json::has_type(object, Activity::TYPE) {
20507                    return Ok(Activity::from_json(value).map_or_else(
20508                        |_| Self::Other(value.clone()),
20509                        |v| Self::Activity(Box::new(v)),
20510                    ));
20511                }
20512                if json::has_type(object, Add::TYPE) {
20513                    return Ok(Add::from_json(value)
20514                        .map_or_else(|_| Self::Other(value.clone()), |v| Self::Add(Box::new(v))));
20515                }
20516                if json::has_type(object, Agreement::TYPE) {
20517                    return Ok(Agreement::from_json(value).map_or_else(
20518                        |_| Self::Other(value.clone()),
20519                        |v| Self::Agreement(Box::new(v)),
20520                    ));
20521                }
20522                if json::has_type(object, Announce::TYPE) {
20523                    return Ok(Announce::from_json(value).map_or_else(
20524                        |_| Self::Other(value.clone()),
20525                        |v| Self::Announce(Box::new(v)),
20526                    ));
20527                }
20528                if json::has_type(object, AnnounceAuthorization::TYPE) {
20529                    return Ok(AnnounceAuthorization::from_json(value).map_or_else(
20530                        |_| Self::Other(value.clone()),
20531                        |v| Self::AnnounceAuthorization(Box::new(v)),
20532                    ));
20533                }
20534                if json::has_type(object, AnnounceRequest::TYPE) {
20535                    return Ok(AnnounceRequest::from_json(value).map_or_else(
20536                        |_| Self::Other(value.clone()),
20537                        |v| Self::AnnounceRequest(Box::new(v)),
20538                    ));
20539                }
20540                if json::has_type(object, Application::TYPE) {
20541                    return Ok(Application::from_json(value).map_or_else(
20542                        |_| Self::Other(value.clone()),
20543                        |v| Self::Application(Box::new(v)),
20544                    ));
20545                }
20546                if json::has_type(object, Arrive::TYPE) {
20547                    return Ok(Arrive::from_json(value).map_or_else(
20548                        |_| Self::Other(value.clone()),
20549                        |v| Self::Arrive(Box::new(v)),
20550                    ));
20551                }
20552                if json::has_type(object, Article::TYPE) {
20553                    return Ok(Article::from_json(value).map_or_else(
20554                        |_| Self::Other(value.clone()),
20555                        |v| Self::Article(Box::new(v)),
20556                    ));
20557                }
20558                if json::has_type(object, Audio::TYPE) {
20559                    return Ok(Audio::from_json(value).map_or_else(
20560                        |_| Self::Other(value.clone()),
20561                        |v| Self::Audio(Box::new(v)),
20562                    ));
20563                }
20564                if json::has_type(object, Block::TYPE) {
20565                    return Ok(Block::from_json(value).map_or_else(
20566                        |_| Self::Other(value.clone()),
20567                        |v| Self::Block(Box::new(v)),
20568                    ));
20569                }
20570                if json::has_type(object, ChatMessage::TYPE) {
20571                    return Ok(ChatMessage::from_json(value).map_or_else(
20572                        |_| Self::Other(value.clone()),
20573                        |v| Self::ChatMessage(Box::new(v)),
20574                    ));
20575                }
20576                if json::has_type(object, Collection::TYPE) {
20577                    return Ok(Collection::from_json(value).map_or_else(
20578                        |_| Self::Other(value.clone()),
20579                        |v| Self::Collection(Box::new(v)),
20580                    ));
20581                }
20582                if json::has_type(object, CollectionPage::TYPE) {
20583                    return Ok(CollectionPage::from_json(value).map_or_else(
20584                        |_| Self::Other(value.clone()),
20585                        |v| Self::CollectionPage(Box::new(v)),
20586                    ));
20587                }
20588                if json::has_type(object, Create::TYPE) {
20589                    return Ok(Create::from_json(value).map_or_else(
20590                        |_| Self::Other(value.clone()),
20591                        |v| Self::Create(Box::new(v)),
20592                    ));
20593                }
20594                if json::has_type(object, Delete::TYPE) {
20595                    return Ok(Delete::from_json(value).map_or_else(
20596                        |_| Self::Other(value.clone()),
20597                        |v| Self::Delete(Box::new(v)),
20598                    ));
20599                }
20600                if json::has_type(object, Dislike::TYPE) {
20601                    return Ok(Dislike::from_json(value).map_or_else(
20602                        |_| Self::Other(value.clone()),
20603                        |v| Self::Dislike(Box::new(v)),
20604                    ));
20605                }
20606                if json::has_type(object, Document::TYPE) {
20607                    return Ok(Document::from_json(value).map_or_else(
20608                        |_| Self::Other(value.clone()),
20609                        |v| Self::Document(Box::new(v)),
20610                    ));
20611                }
20612                if json::has_type(object, Emoji::TYPE) {
20613                    return Ok(Emoji::from_json(value).map_or_else(
20614                        |_| Self::Other(value.clone()),
20615                        |v| Self::Emoji(Box::new(v)),
20616                    ));
20617                }
20618                if json::has_type(object, EmojiReact::TYPE) {
20619                    return Ok(EmojiReact::from_json(value).map_or_else(
20620                        |_| Self::Other(value.clone()),
20621                        |v| Self::EmojiReact(Box::new(v)),
20622                    ));
20623                }
20624                if json::has_type(object, Event::TYPE) {
20625                    return Ok(Event::from_json(value).map_or_else(
20626                        |_| Self::Other(value.clone()),
20627                        |v| Self::Event(Box::new(v)),
20628                    ));
20629                }
20630                if json::has_type(object, FeatureAuthorization::TYPE) {
20631                    return Ok(FeatureAuthorization::from_json(value).map_or_else(
20632                        |_| Self::Other(value.clone()),
20633                        |v| Self::FeatureAuthorization(Box::new(v)),
20634                    ));
20635                }
20636                if json::has_type(object, FeatureRequest::TYPE) {
20637                    return Ok(FeatureRequest::from_json(value).map_or_else(
20638                        |_| Self::Other(value.clone()),
20639                        |v| Self::FeatureRequest(Box::new(v)),
20640                    ));
20641                }
20642                if json::has_type(object, FeaturedCollection::TYPE) {
20643                    return Ok(FeaturedCollection::from_json(value).map_or_else(
20644                        |_| Self::Other(value.clone()),
20645                        |v| Self::FeaturedCollection(Box::new(v)),
20646                    ));
20647                }
20648                if json::has_type(object, FeaturedItem::TYPE) {
20649                    return Ok(FeaturedItem::from_json(value).map_or_else(
20650                        |_| Self::Other(value.clone()),
20651                        |v| Self::FeaturedItem(Box::new(v)),
20652                    ));
20653                }
20654                if json::has_type(object, Flag::TYPE) {
20655                    return Ok(Flag::from_json(value)
20656                        .map_or_else(|_| Self::Other(value.clone()), |v| Self::Flag(Box::new(v))));
20657                }
20658                if json::has_type(object, Follow::TYPE) {
20659                    return Ok(Follow::from_json(value).map_or_else(
20660                        |_| Self::Other(value.clone()),
20661                        |v| Self::Follow(Box::new(v)),
20662                    ));
20663                }
20664                if json::has_type(object, Group::TYPE) {
20665                    return Ok(Group::from_json(value).map_or_else(
20666                        |_| Self::Other(value.clone()),
20667                        |v| Self::Group(Box::new(v)),
20668                    ));
20669                }
20670                if json::has_type(object, Hashtag::TYPE) {
20671                    return Ok(Hashtag::from_json(value).map_or_else(
20672                        |_| Self::Other(value.clone()),
20673                        |v| Self::Hashtag(Box::new(v)),
20674                    ));
20675                }
20676                if json::has_type(object, Ignore::TYPE) {
20677                    return Ok(Ignore::from_json(value).map_or_else(
20678                        |_| Self::Other(value.clone()),
20679                        |v| Self::Ignore(Box::new(v)),
20680                    ));
20681                }
20682                if json::has_type(object, Image::TYPE) {
20683                    return Ok(Image::from_json(value).map_or_else(
20684                        |_| Self::Other(value.clone()),
20685                        |v| Self::Image(Box::new(v)),
20686                    ));
20687                }
20688                if json::has_type(object, IntransitiveActivity::TYPE) {
20689                    return Ok(IntransitiveActivity::from_json(value).map_or_else(
20690                        |_| Self::Other(value.clone()),
20691                        |v| Self::IntransitiveActivity(Box::new(v)),
20692                    ));
20693                }
20694                if json::has_type(object, Invite::TYPE) {
20695                    return Ok(Invite::from_json(value).map_or_else(
20696                        |_| Self::Other(value.clone()),
20697                        |v| Self::Invite(Box::new(v)),
20698                    ));
20699                }
20700                if json::has_type(object, Join::TYPE) {
20701                    return Ok(Join::from_json(value)
20702                        .map_or_else(|_| Self::Other(value.clone()), |v| Self::Join(Box::new(v))));
20703                }
20704                if json::has_type(object, Leave::TYPE) {
20705                    return Ok(Leave::from_json(value).map_or_else(
20706                        |_| Self::Other(value.clone()),
20707                        |v| Self::Leave(Box::new(v)),
20708                    ));
20709                }
20710                if json::has_type(object, Like::TYPE) {
20711                    return Ok(Like::from_json(value)
20712                        .map_or_else(|_| Self::Other(value.clone()), |v| Self::Like(Box::new(v))));
20713                }
20714                if json::has_type(object, LikeAuthorization::TYPE) {
20715                    return Ok(LikeAuthorization::from_json(value).map_or_else(
20716                        |_| Self::Other(value.clone()),
20717                        |v| Self::LikeAuthorization(Box::new(v)),
20718                    ));
20719                }
20720                if json::has_type(object, LikeRequest::TYPE) {
20721                    return Ok(LikeRequest::from_json(value).map_or_else(
20722                        |_| Self::Other(value.clone()),
20723                        |v| Self::LikeRequest(Box::new(v)),
20724                    ));
20725                }
20726                if json::has_type(object, Link::TYPE) {
20727                    return Ok(Link::from_json(value)
20728                        .map_or_else(|_| Self::Other(value.clone()), |v| Self::Link(Box::new(v))));
20729                }
20730                if json::has_type(object, Listen::TYPE) {
20731                    return Ok(Listen::from_json(value).map_or_else(
20732                        |_| Self::Other(value.clone()),
20733                        |v| Self::Listen(Box::new(v)),
20734                    ));
20735                }
20736                if json::has_type(object, Mention::TYPE) {
20737                    return Ok(Mention::from_json(value).map_or_else(
20738                        |_| Self::Other(value.clone()),
20739                        |v| Self::Mention(Box::new(v)),
20740                    ));
20741                }
20742                if json::has_type(object, Move::TYPE) {
20743                    return Ok(Move::from_json(value)
20744                        .map_or_else(|_| Self::Other(value.clone()), |v| Self::Move(Box::new(v))));
20745                }
20746                if json::has_type(object, Note::TYPE) {
20747                    return Ok(Note::from_json(value)
20748                        .map_or_else(|_| Self::Other(value.clone()), |v| Self::Note(Box::new(v))));
20749                }
20750                if json::has_type(object, Object::TYPE) {
20751                    return Ok(Object::from_json(value).map_or_else(
20752                        |_| Self::Other(value.clone()),
20753                        |v| Self::Object(Box::new(v)),
20754                    ));
20755                }
20756                if json::has_type(object, Offer::TYPE) {
20757                    return Ok(Offer::from_json(value).map_or_else(
20758                        |_| Self::Other(value.clone()),
20759                        |v| Self::Offer(Box::new(v)),
20760                    ));
20761                }
20762                if json::has_type(object, OrderedCollection::TYPE) {
20763                    return Ok(OrderedCollection::from_json(value).map_or_else(
20764                        |_| Self::Other(value.clone()),
20765                        |v| Self::OrderedCollection(Box::new(v)),
20766                    ));
20767                }
20768                if json::has_type(object, OrderedCollectionPage::TYPE) {
20769                    return Ok(OrderedCollectionPage::from_json(value).map_or_else(
20770                        |_| Self::Other(value.clone()),
20771                        |v| Self::OrderedCollectionPage(Box::new(v)),
20772                    ));
20773                }
20774                if json::has_type(object, Organization::TYPE) {
20775                    return Ok(Organization::from_json(value).map_or_else(
20776                        |_| Self::Other(value.clone()),
20777                        |v| Self::Organization(Box::new(v)),
20778                    ));
20779                }
20780                if json::has_type(object, Page::TYPE) {
20781                    return Ok(Page::from_json(value)
20782                        .map_or_else(|_| Self::Other(value.clone()), |v| Self::Page(Box::new(v))));
20783                }
20784                if json::has_type(object, Person::TYPE) {
20785                    return Ok(Person::from_json(value).map_or_else(
20786                        |_| Self::Other(value.clone()),
20787                        |v| Self::Person(Box::new(v)),
20788                    ));
20789                }
20790                if json::has_type(object, Place::TYPE) {
20791                    return Ok(Place::from_json(value).map_or_else(
20792                        |_| Self::Other(value.clone()),
20793                        |v| Self::Place(Box::new(v)),
20794                    ));
20795                }
20796                if json::has_type(object, Profile::TYPE) {
20797                    return Ok(Profile::from_json(value).map_or_else(
20798                        |_| Self::Other(value.clone()),
20799                        |v| Self::Profile(Box::new(v)),
20800                    ));
20801                }
20802                if json::has_type(object, PropertyValue::TYPE) {
20803                    return Ok(PropertyValue::from_json(value).map_or_else(
20804                        |_| Self::Other(value.clone()),
20805                        |v| Self::PropertyValue(Box::new(v)),
20806                    ));
20807                }
20808                if json::has_type(object, Proposal::TYPE) {
20809                    return Ok(Proposal::from_json(value).map_or_else(
20810                        |_| Self::Other(value.clone()),
20811                        |v| Self::Proposal(Box::new(v)),
20812                    ));
20813                }
20814                if json::has_type(object, Question::TYPE) {
20815                    return Ok(Question::from_json(value).map_or_else(
20816                        |_| Self::Other(value.clone()),
20817                        |v| Self::Question(Box::new(v)),
20818                    ));
20819                }
20820                if json::has_type(object, QuoteAuthorization::TYPE) {
20821                    return Ok(QuoteAuthorization::from_json(value).map_or_else(
20822                        |_| Self::Other(value.clone()),
20823                        |v| Self::QuoteAuthorization(Box::new(v)),
20824                    ));
20825                }
20826                if json::has_type(object, QuoteRequest::TYPE) {
20827                    return Ok(QuoteRequest::from_json(value).map_or_else(
20828                        |_| Self::Other(value.clone()),
20829                        |v| Self::QuoteRequest(Box::new(v)),
20830                    ));
20831                }
20832                if json::has_type(object, Read::TYPE) {
20833                    return Ok(Read::from_json(value)
20834                        .map_or_else(|_| Self::Other(value.clone()), |v| Self::Read(Box::new(v))));
20835                }
20836                if json::has_type(object, Reject::TYPE) {
20837                    return Ok(Reject::from_json(value).map_or_else(
20838                        |_| Self::Other(value.clone()),
20839                        |v| Self::Reject(Box::new(v)),
20840                    ));
20841                }
20842                if json::has_type(object, Relationship::TYPE) {
20843                    return Ok(Relationship::from_json(value).map_or_else(
20844                        |_| Self::Other(value.clone()),
20845                        |v| Self::Relationship(Box::new(v)),
20846                    ));
20847                }
20848                if json::has_type(object, Remove::TYPE) {
20849                    return Ok(Remove::from_json(value).map_or_else(
20850                        |_| Self::Other(value.clone()),
20851                        |v| Self::Remove(Box::new(v)),
20852                    ));
20853                }
20854                if json::has_type(object, ReplyAuthorization::TYPE) {
20855                    return Ok(ReplyAuthorization::from_json(value).map_or_else(
20856                        |_| Self::Other(value.clone()),
20857                        |v| Self::ReplyAuthorization(Box::new(v)),
20858                    ));
20859                }
20860                if json::has_type(object, ReplyRequest::TYPE) {
20861                    return Ok(ReplyRequest::from_json(value).map_or_else(
20862                        |_| Self::Other(value.clone()),
20863                        |v| Self::ReplyRequest(Box::new(v)),
20864                    ));
20865                }
20866                if json::has_type(object, Service::TYPE) {
20867                    return Ok(Service::from_json(value).map_or_else(
20868                        |_| Self::Other(value.clone()),
20869                        |v| Self::Service(Box::new(v)),
20870                    ));
20871                }
20872                if json::has_type(object, TentativeAccept::TYPE) {
20873                    return Ok(TentativeAccept::from_json(value).map_or_else(
20874                        |_| Self::Other(value.clone()),
20875                        |v| Self::TentativeAccept(Box::new(v)),
20876                    ));
20877                }
20878                if json::has_type(object, TentativeReject::TYPE) {
20879                    return Ok(TentativeReject::from_json(value).map_or_else(
20880                        |_| Self::Other(value.clone()),
20881                        |v| Self::TentativeReject(Box::new(v)),
20882                    ));
20883                }
20884                if json::has_type(object, Tombstone::TYPE) {
20885                    return Ok(Tombstone::from_json(value).map_or_else(
20886                        |_| Self::Other(value.clone()),
20887                        |v| Self::Tombstone(Box::new(v)),
20888                    ));
20889                }
20890                if json::has_type(object, Travel::TYPE) {
20891                    return Ok(Travel::from_json(value).map_or_else(
20892                        |_| Self::Other(value.clone()),
20893                        |v| Self::Travel(Box::new(v)),
20894                    ));
20895                }
20896                if json::has_type(object, Undo::TYPE) {
20897                    return Ok(Undo::from_json(value)
20898                        .map_or_else(|_| Self::Other(value.clone()), |v| Self::Undo(Box::new(v))));
20899                }
20900                if json::has_type(object, Update::TYPE) {
20901                    return Ok(Update::from_json(value).map_or_else(
20902                        |_| Self::Other(value.clone()),
20903                        |v| Self::Update(Box::new(v)),
20904                    ));
20905                }
20906                if json::has_type(object, Video::TYPE) {
20907                    return Ok(Video::from_json(value).map_or_else(
20908                        |_| Self::Other(value.clone()),
20909                        |v| Self::Video(Box::new(v)),
20910                    ));
20911                }
20912                if json::has_type(object, View::TYPE) {
20913                    return Ok(View::from_json(value)
20914                        .map_or_else(|_| Self::Other(value.clone()), |v| Self::View(Box::new(v))));
20915                }
20916                Self::Other(value.clone())
20917            }
20918            _ => Self::Other(value.clone()),
20919        })
20920    }
20921}
20922
20923impl ToJson for LinkOrObjectOrPropertyValue {
20924    fn to_json(&self) -> Value {
20925        match self {
20926            Self::Iri(v) => v.to_json(),
20927            Self::Accept(v) => v.to_json(),
20928            Self::Activity(v) => v.to_json(),
20929            Self::Add(v) => v.to_json(),
20930            Self::Agreement(v) => v.to_json(),
20931            Self::Announce(v) => v.to_json(),
20932            Self::AnnounceAuthorization(v) => v.to_json(),
20933            Self::AnnounceRequest(v) => v.to_json(),
20934            Self::Application(v) => v.to_json(),
20935            Self::Arrive(v) => v.to_json(),
20936            Self::Article(v) => v.to_json(),
20937            Self::Audio(v) => v.to_json(),
20938            Self::Block(v) => v.to_json(),
20939            Self::ChatMessage(v) => v.to_json(),
20940            Self::Collection(v) => v.to_json(),
20941            Self::CollectionPage(v) => v.to_json(),
20942            Self::Create(v) => v.to_json(),
20943            Self::Delete(v) => v.to_json(),
20944            Self::Dislike(v) => v.to_json(),
20945            Self::Document(v) => v.to_json(),
20946            Self::Emoji(v) => v.to_json(),
20947            Self::EmojiReact(v) => v.to_json(),
20948            Self::Event(v) => v.to_json(),
20949            Self::FeatureAuthorization(v) => v.to_json(),
20950            Self::FeatureRequest(v) => v.to_json(),
20951            Self::FeaturedCollection(v) => v.to_json(),
20952            Self::FeaturedItem(v) => v.to_json(),
20953            Self::Flag(v) => v.to_json(),
20954            Self::Follow(v) => v.to_json(),
20955            Self::Group(v) => v.to_json(),
20956            Self::Hashtag(v) => v.to_json(),
20957            Self::Ignore(v) => v.to_json(),
20958            Self::Image(v) => v.to_json(),
20959            Self::IntransitiveActivity(v) => v.to_json(),
20960            Self::Invite(v) => v.to_json(),
20961            Self::Join(v) => v.to_json(),
20962            Self::Leave(v) => v.to_json(),
20963            Self::Like(v) => v.to_json(),
20964            Self::LikeAuthorization(v) => v.to_json(),
20965            Self::LikeRequest(v) => v.to_json(),
20966            Self::Link(v) => v.to_json(),
20967            Self::Listen(v) => v.to_json(),
20968            Self::Mention(v) => v.to_json(),
20969            Self::Move(v) => v.to_json(),
20970            Self::Note(v) => v.to_json(),
20971            Self::Object(v) => v.to_json(),
20972            Self::Offer(v) => v.to_json(),
20973            Self::OrderedCollection(v) => v.to_json(),
20974            Self::OrderedCollectionPage(v) => v.to_json(),
20975            Self::Organization(v) => v.to_json(),
20976            Self::Page(v) => v.to_json(),
20977            Self::Person(v) => v.to_json(),
20978            Self::Place(v) => v.to_json(),
20979            Self::Profile(v) => v.to_json(),
20980            Self::PropertyValue(v) => v.to_json(),
20981            Self::Proposal(v) => v.to_json(),
20982            Self::Question(v) => v.to_json(),
20983            Self::QuoteAuthorization(v) => v.to_json(),
20984            Self::QuoteRequest(v) => v.to_json(),
20985            Self::Read(v) => v.to_json(),
20986            Self::Reject(v) => v.to_json(),
20987            Self::Relationship(v) => v.to_json(),
20988            Self::Remove(v) => v.to_json(),
20989            Self::ReplyAuthorization(v) => v.to_json(),
20990            Self::ReplyRequest(v) => v.to_json(),
20991            Self::Service(v) => v.to_json(),
20992            Self::TentativeAccept(v) => v.to_json(),
20993            Self::TentativeReject(v) => v.to_json(),
20994            Self::Tombstone(v) => v.to_json(),
20995            Self::Travel(v) => v.to_json(),
20996            Self::Undo(v) => v.to_json(),
20997            Self::Update(v) => v.to_json(),
20998            Self::Video(v) => v.to_json(),
20999            Self::View(v) => v.to_json(),
21000            Self::Other(v) => v.clone(),
21001        }
21002    }
21003}
21004
21005/// A value of [`OrderedCollection`], [`OrderedCollectionPage`], or of a type extending one of them.
21006#[derive(Clone, Debug, PartialEq)]
21007pub enum OrderedCollectionOrOrderedCollectionPage {
21008    /// A reference, by IRI.
21009    Iri(Iri),
21010    FeaturedCollection(Box<FeaturedCollection>),
21011    OrderedCollection(Box<OrderedCollection>),
21012    OrderedCollectionPage(Box<OrderedCollectionPage>),
21013    /// Anything no schema describes, as it was.
21014    Other(Value),
21015}
21016
21017impl OrderedCollectionOrOrderedCollectionPage {
21018    /// The IRI of the value: the reference itself, or the object's `id`.
21019    #[must_use]
21020    pub fn id(&self) -> Option<&Iri> {
21021        match self {
21022            Self::Iri(iri) => Some(iri),
21023            Self::FeaturedCollection(object) => object.id.as_ref(),
21024            Self::OrderedCollection(object) => object.id.as_ref(),
21025            Self::OrderedCollectionPage(object) => object.id.as_ref(),
21026            _ => None,
21027        }
21028    }
21029}
21030
21031impl FromJson for OrderedCollectionOrOrderedCollectionPage {
21032    fn from_json(value: &Value) -> Result<Self, JsonError> {
21033        Ok(match value {
21034            Value::String(_) => {
21035                if let Ok(v) = Iri::from_json(value) {
21036                    return Ok(Self::Iri(v));
21037                }
21038                Self::Other(value.clone())
21039            }
21040            Value::Object(object) => {
21041                if object.len() == 1
21042                    && object.contains_key("id")
21043                    && let Ok(v) = Iri::from_json(value)
21044                {
21045                    return Ok(Self::Iri(v));
21046                }
21047                if json::has_type(object, FeaturedCollection::TYPE) {
21048                    return Ok(FeaturedCollection::from_json(value).map_or_else(
21049                        |_| Self::Other(value.clone()),
21050                        |v| Self::FeaturedCollection(Box::new(v)),
21051                    ));
21052                }
21053                if json::has_type(object, OrderedCollection::TYPE) {
21054                    return Ok(OrderedCollection::from_json(value).map_or_else(
21055                        |_| Self::Other(value.clone()),
21056                        |v| Self::OrderedCollection(Box::new(v)),
21057                    ));
21058                }
21059                if json::has_type(object, OrderedCollectionPage::TYPE) {
21060                    return Ok(OrderedCollectionPage::from_json(value).map_or_else(
21061                        |_| Self::Other(value.clone()),
21062                        |v| Self::OrderedCollectionPage(Box::new(v)),
21063                    ));
21064                }
21065                Self::Other(value.clone())
21066            }
21067            _ => Self::Other(value.clone()),
21068        })
21069    }
21070}
21071
21072impl ToJson for OrderedCollectionOrOrderedCollectionPage {
21073    fn to_json(&self) -> Value {
21074        match self {
21075            Self::Iri(v) => v.to_json(),
21076            Self::FeaturedCollection(v) => v.to_json(),
21077            Self::OrderedCollection(v) => v.to_json(),
21078            Self::OrderedCollectionPage(v) => v.to_json(),
21079            Self::Other(v) => v.clone(),
21080        }
21081    }
21082}
21083
21084serde_via_json!(
21085    Accept,
21086    Activity,
21087    Add,
21088    Agreement,
21089    Announce,
21090    AnnounceAuthorization,
21091    AnnounceRequest,
21092    Application,
21093    Arrive,
21094    Article,
21095    Audio,
21096    Block,
21097    ChatMessage,
21098    Collection,
21099    CollectionPage,
21100    Commitment,
21101    Create,
21102    CryptographicKey,
21103    DataIntegrityProof,
21104    Delete,
21105    DidService,
21106    Dislike,
21107    Document,
21108    Emoji,
21109    EmojiReact,
21110    Endpoints,
21111    Event,
21112    Export,
21113    FeatureAuthorization,
21114    FeatureRequest,
21115    FeaturedCollection,
21116    FeaturedItem,
21117    Flag,
21118    Follow,
21119    Group,
21120    Hashtag,
21121    Ignore,
21122    Image,
21123    Intent,
21124    InteractionPolicy,
21125    InteractionRule,
21126    IntransitiveActivity,
21127    Invite,
21128    Join,
21129    Leave,
21130    Like,
21131    LikeAuthorization,
21132    LikeRequest,
21133    Link,
21134    Listen,
21135    Measure,
21136    Mention,
21137    Move,
21138    Multikey,
21139    Note,
21140    Object,
21141    Offer,
21142    OrderedCollection,
21143    OrderedCollectionPage,
21144    Organization,
21145    Page,
21146    Person,
21147    Place,
21148    Profile,
21149    PropertyValue,
21150    Proposal,
21151    Question,
21152    QuoteAuthorization,
21153    QuoteRequest,
21154    Read,
21155    Reject,
21156    Relationship,
21157    Remove,
21158    ReplyAuthorization,
21159    ReplyRequest,
21160    Service,
21161    Source,
21162    TentativeAccept,
21163    TentativeReject,
21164    Tombstone,
21165    Translation,
21166    Travel,
21167    Undo,
21168    Update,
21169    Video,
21170    View,
21171    AnyActor,
21172    AnyCollection,
21173    AnyCollectionPage,
21174    AnyDidService,
21175    AnyObject,
21176    AnyOrderedCollection,
21177    BooleanOrDateTime,
21178    IriOrUnits,
21179    LinkOrIri,
21180    LinkOrObject,
21181    LinkOrObjectOrPropertyValue,
21182    OrderedCollectionOrOrderedCollectionPage
21183);