From 69c06f8a741b8d9bbecbfccc2efe2923a8142b44 Mon Sep 17 00:00:00 2001 From: Lukas Nagel Date: Tue, 11 Jul 2023 06:46:58 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Added=20props=20to=20object?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/Models/CoreTypes/object.dart | 8 ++++++-- lib/Models/ObjectTypes/document.dart | 12 ++++++++++-- lib/Models/post.dart | 24 +++++++++++++----------- pubspec.yaml | 2 +- 4 files changed, 30 insertions(+), 16 deletions(-) diff --git a/lib/Models/CoreTypes/object.dart b/lib/Models/CoreTypes/object.dart index ed4a390..0766033 100644 --- a/lib/Models/CoreTypes/object.dart +++ b/lib/Models/CoreTypes/object.dart @@ -1,7 +1,11 @@ class ActivityPubObject { - final List? attachments; + final List? attachment; + final String? content; + final String? attributedTo; ActivityPubObject( - this.attachments, + this.attachment, + this.content, + this.attributedTo, ); } diff --git a/lib/Models/ObjectTypes/document.dart b/lib/Models/ObjectTypes/document.dart index fb16697..599502e 100644 --- a/lib/Models/ObjectTypes/document.dart +++ b/lib/Models/ObjectTypes/document.dart @@ -13,7 +13,11 @@ class Document extends ActivityPubObject { this.mediaType, this.context, this.url, - ) : super(null); + ) : super( + null, + null, + null, + ); Document.fromJson(Map json) : type = json["type"], @@ -21,5 +25,9 @@ class Document extends ActivityPubObject { url = Uri.tryParse(json["url"]), name = json["name"], context = json["@context"], - super(null); + super( + null, + null, + null, + ); } diff --git a/lib/Models/post.dart b/lib/Models/post.dart index 2612992..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, - ) : super(attachment); + attachment, + ) : super( + attachment, + content, + attributedTo, + ); Post.fromJson(Map json) : to = convertToStringList(json["to"]), @@ -38,16 +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"]), - super(json["attachment"]); + 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: