Skip to content

Commit

Permalink
🔀 Merge pull request #11 from Fedodo/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
LNA-DEV authored Jul 11, 2023
2 parents 212d34f + 69c06f8 commit fc5a5aa
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 15 deletions.
10 changes: 9 additions & 1 deletion lib/Models/CoreTypes/object.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
class ActivityPubObject {
List<ActivityPubObject>? attachments;
final List<ActivityPubObject>? attachment;
final String? content;
final String? attributedTo;

ActivityPubObject(
this.attachment,
this.content,
this.attributedTo,
);
}
13 changes: 11 additions & 2 deletions lib/Models/ObjectTypes/document.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,21 @@ class Document extends ActivityPubObject {
this.mediaType,
this.context,
this.url,
);
) : super(
null,
null,
null,
);

Document.fromJson(Map<String, dynamic> 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,
);
}
25 changes: 14 additions & 11 deletions lib/Models/post.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,44 +9,47 @@ 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<Document>? attachment;

Post(
this.to,
this.name,
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<String, dynamic> json)
: to = convertToStringList(json["to"]),
name = json["name"],
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<String> convertToStringList(json) {
List<String> jsonList = [];
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down

0 comments on commit fc5a5aa

Please sign in to comment.