Improved add links

This commit is contained in:
Juan Gilsanz Polo
2024-02-23 22:30:39 +01:00
parent ca15b8a445
commit d689fd0eaa
13 changed files with 228 additions and 72 deletions

View File

@@ -5,7 +5,7 @@ class PostBookmark {
final bool isArchived;
final bool unread;
final bool shared;
final List<String> tagNames;
final String tagNames;
const PostBookmark({
required this.url,
@@ -21,9 +21,9 @@ class PostBookmark {
"url": url,
"title": title,
"description": description,
"isArchived": isArchived,
"is_archived": isArchived,
"unread": unread,
"shared": shared,
"tagNames": tagNames,
"tag_names": tagNames,
};
}

51
lib/models/data/tags.dart Normal file
View File

@@ -0,0 +1,51 @@
class Tags {
final int? count;
final int? next;
final int? previous;
final List<Result>? results;
Tags({
this.count,
this.next,
this.previous,
this.results,
});
factory Tags.fromJson(Map<String, dynamic> json) => Tags(
count: json["count"],
next: json["next"],
previous: json["previous"],
results: json["results"] == null ? [] : List<Result>.from(json["results"]!.map((x) => Result.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"count": count,
"next": next,
"previous": previous,
"results": results == null ? [] : List<dynamic>.from(results!.map((x) => x.toJson())),
};
}
class Result {
final int? id;
final String? name;
final DateTime? dateAdded;
Result({
this.id,
this.name,
this.dateAdded,
});
factory Result.fromJson(Map<String, dynamic> json) => Result(
id: json["id"],
name: json["name"],
dateAdded: json["date_added"] == null ? null : DateTime.parse(json["date_added"]),
);
Map<String, dynamic> toJson() => {
"id": id,
"name": name,
"date_added": dateAdded?.toIso8601String(),
};
}