diff --git a/lib/Models/CoreTypes/object.dart b/lib/Models/CoreTypes/object.dart index 3d3db3a..0766033 100644 --- a/lib/Models/CoreTypes/object.dart +++ b/lib/Models/CoreTypes/object.dart @@ -1,3 +1,11 @@ class ActivityPubObject { - List? attachments; + final List? attachment; + final String? content; + final String? attributedTo; + + ActivityPubObject( + this.attachment, + this.content, + this.attributedTo, + ); } diff --git a/lib/Models/ObjectTypes/document.dart b/lib/Models/ObjectTypes/document.dart index 1ea2cdb..599502e 100644 --- a/lib/Models/ObjectTypes/document.dart +++ b/lib/Models/ObjectTypes/document.dart @@ -13,12 +13,21 @@ class Document extends ActivityPubObject { this.mediaType, this.context, this.url, - ); + ) : super( + null, + null, + null, + ); Document.fromJson(Map json) : type = json["type"], mediaType = json["mediaType"], url = Uri.tryParse(json["url"]), name = json["name"], - context = json["@context"]; + context = json["@context"], + super( + null, + null, + null, + ); } diff --git a/lib/Models/post.dart b/lib/Models/post.dart index 80c533d..8d24ae8 100644 --- a/lib/Models/post.dart +++ b/lib/Models/post.dart @@ -9,13 +9,10 @@ class Post extends ActivityPubObject { final String? summary; final bool? sensitive; final String? inReplyTo; - final String content; final String id; final String type; final DateTime published; - final String attributedTo; final Collection? replies; - final List? attachment; Post( this.to, @@ -23,14 +20,18 @@ class Post extends ActivityPubObject { this.summary, this.sensitive, this.inReplyTo, - this.content, + content, this.id, this.type, this.published, - this.attributedTo, + attributedTo, this.replies, - this.attachment, - ); + attachment, + ) : super( + attachment, + content, + attributedTo, + ); Post.fromJson(Map json) : to = convertToStringList(json["to"]), @@ -38,15 +39,17 @@ class Post extends ActivityPubObject { summary = json["summary"], sensitive = json["sensitive"], inReplyTo = json["inReplyTo"], - content = json["content"], id = json["id"], type = json["type"], published = DateTime.parse(json["published"]), - attributedTo = json["attributedTo"], - attachment = toListOfDocuments(json["attachment"]), replies = json["replies"] == null ? null - : Collection.fromJson(json["replies"]); + : Collection.fromJson(json["replies"]), + super( + json["attachment"], + json["content"], + json["attributedTo"], + ); static List convertToStringList(json) { List jsonList = []; diff --git a/pubspec.yaml b/pubspec.yaml index 737fa57..4276907 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: activitypub description: A library for the ActivityPub standard. Created an also used by Fedodo. -version: 1.2.4 +version: 1.2.5 repository: https://github.com/Fedodo/Fedodo.Pub.ActivityPub environment: