Skip to content

Commit fc5a5aa

Browse files
authored
🔀 Merge pull request #11 from Fedodo/dev
Dev
2 parents 212d34f + 69c06f8 commit fc5a5aa

File tree

4 files changed

+35
-15
lines changed

4 files changed

+35
-15
lines changed

‎lib/Models/CoreTypes/object.dart

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
class ActivityPubObject {
2-
List<ActivityPubObject>? attachments;
2+
final List<ActivityPubObject>? attachment;
3+
final String? content;
4+
final String? attributedTo;
5+
6+
ActivityPubObject(
7+
this.attachment,
8+
this.content,
9+
this.attributedTo,
10+
);
311
}

‎lib/Models/ObjectTypes/document.dart

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,21 @@ class Document extends ActivityPubObject {
1313
this.mediaType,
1414
this.context,
1515
this.url,
16-
);
16+
) : super(
17+
null,
18+
null,
19+
null,
20+
);
1721

1822
Document.fromJson(Map<String, dynamic> json)
1923
: type = json["type"],
2024
mediaType = json["mediaType"],
2125
url = Uri.tryParse(json["url"]),
2226
name = json["name"],
23-
context = json["@context"];
27+
context = json["@context"],
28+
super(
29+
null,
30+
null,
31+
null,
32+
);
2433
}

‎lib/Models/post.dart

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,44 +9,47 @@ class Post extends ActivityPubObject {
99
final String? summary;
1010
final bool? sensitive;
1111
final String? inReplyTo;
12-
final String content;
1312
final String id;
1413
final String type;
1514
final DateTime published;
16-
final String attributedTo;
1715
final Collection? replies;
18-
final List<Document>? attachment;
1916

2017
Post(
2118
this.to,
2219
this.name,
2320
this.summary,
2421
this.sensitive,
2522
this.inReplyTo,
26-
this.content,
23+
content,
2724
this.id,
2825
this.type,
2926
this.published,
30-
this.attributedTo,
27+
attributedTo,
3128
this.replies,
32-
this.attachment,
33-
);
29+
attachment,
30+
) : super(
31+
attachment,
32+
content,
33+
attributedTo,
34+
);
3435

3536
Post.fromJson(Map<String, dynamic> json)
3637
: to = convertToStringList(json["to"]),
3738
name = json["name"],
3839
summary = json["summary"],
3940
sensitive = json["sensitive"],
4041
inReplyTo = json["inReplyTo"],
41-
content = json["content"],
4242
id = json["id"],
4343
type = json["type"],
4444
published = DateTime.parse(json["published"]),
45-
attributedTo = json["attributedTo"],
46-
attachment = toListOfDocuments(json["attachment"]),
4745
replies = json["replies"] == null
4846
? null
49-
: Collection.fromJson(json["replies"]);
47+
: Collection.fromJson(json["replies"]),
48+
super(
49+
json["attachment"],
50+
json["content"],
51+
json["attributedTo"],
52+
);
5053

5154
static List<String> convertToStringList(json) {
5255
List<String> jsonList = [];

‎pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: activitypub
22
description: A library for the ActivityPub standard. Created an also used by Fedodo.
3-
version: 1.2.4
3+
version: 1.2.5
44
repository: https://github.com/Fedodo/Fedodo.Pub.ActivityPub
55

66
environment:

0 commit comments

Comments
 (0)