1 use serde::{Deserialize, Serialize};
4 pub(crate) mod chat_message;
6 pub(crate) mod instance;
10 pub(crate) mod tombstone;
12 #[derive(Clone, Debug, Deserialize, Serialize)]
13 #[serde(rename_all = "camelCase")]
14 pub struct Endpoints {
15 pub shared_inbox: Url,
20 use crate::protocol::{
22 chat_message::ChatMessage,
30 tests::{test_json, test_parse_lemmy_item},
34 fn test_parse_objects_lemmy() {
35 test_parse_lemmy_item::<Instance>("assets/lemmy/objects/instance.json").unwrap();
36 test_parse_lemmy_item::<Group>("assets/lemmy/objects/group.json").unwrap();
37 test_parse_lemmy_item::<Person>("assets/lemmy/objects/person.json").unwrap();
38 test_parse_lemmy_item::<Page>("assets/lemmy/objects/page.json").unwrap();
39 test_parse_lemmy_item::<Note>("assets/lemmy/objects/note.json").unwrap();
40 test_parse_lemmy_item::<ChatMessage>("assets/lemmy/objects/chat_message.json").unwrap();
41 test_parse_lemmy_item::<Tombstone>("assets/lemmy/objects/tombstone.json").unwrap();
45 fn test_parse_objects_pleroma() {
46 test_json::<Person>("assets/pleroma/objects/person.json").unwrap();
47 test_json::<Note>("assets/pleroma/objects/note.json").unwrap();
48 test_json::<ChatMessage>("assets/pleroma/objects/chat_message.json").unwrap();
52 fn test_parse_objects_smithereen() {
53 test_json::<Person>("assets/smithereen/objects/person.json").unwrap();
54 test_json::<Note>("assets/smithereen/objects/note.json").unwrap();
58 fn test_parse_objects_mastodon() {
59 test_json::<Person>("assets/mastodon/objects/person.json").unwrap();
60 test_json::<Note>("assets/mastodon/objects/note.json").unwrap();
64 fn test_parse_objects_lotide() {
65 test_json::<Group>("assets/lotide/objects/group.json").unwrap();
66 test_json::<Person>("assets/lotide/objects/person.json").unwrap();
67 test_json::<Note>("assets/lotide/objects/note.json").unwrap();
68 test_json::<Page>("assets/lotide/objects/page.json").unwrap();
69 test_json::<Tombstone>("assets/lotide/objects/tombstone.json").unwrap();
73 fn test_parse_object_friendica() {
74 test_json::<Person>("assets/friendica/objects/person.json").unwrap();
75 test_json::<Page>("assets/friendica/objects/page_1.json").unwrap();
76 test_json::<Page>("assets/friendica/objects/page_2.json").unwrap();
77 test_json::<Note>("assets/friendica/objects/note.json").unwrap();
81 fn test_parse_object_gnusocial() {
82 test_json::<Person>("assets/gnusocial/objects/person.json").unwrap();
83 test_json::<Group>("assets/gnusocial/objects/group.json").unwrap();
84 test_json::<Page>("assets/gnusocial/objects/page.json").unwrap();
85 test_json::<Note>("assets/gnusocial/objects/note.json").unwrap();