You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

51 lines
1.4 KiB

class Post {
String postID;
DateTime timestamp;
String playbackID;
String publisherID;
String title;
String assetID;
String aspect;
String rendition;
Post({
this.postID,
this.playbackID,
this.publisherID,
this.title,
this.timestamp,
this.assetID,
this.aspect,
this.rendition,
});
factory Post.fromJSON(Map<String, dynamic> json) {
return Post(
publisherID: json["publisherId"],
postID: json["postId"],
title: json["title"],
playbackID: json["playbackID"],
assetID: json["assetID"],
aspect: json["aspect"],
rendition: json["rendition"],
timestamp: DateTime.tryParse(json["timestamp"].toString()));
}
Map<dynamic, dynamic> toJson() {
final Map<dynamic, dynamic> data = Map<dynamic, dynamic>();
data['publisherId'] = this.publisherID;
data['postId'] = this.postID;
data['playbackID'] = this.playbackID;
data['title'] = this.title;
data['timestamp'] = this.timestamp.toIso8601String();
data['assetID'] = this.assetID;
data['aspect'] = this.aspect;
data['rendition'] = this.rendition;
return data;
}
@override
String toString() {
return '{"publisherId": "$publisherID", "postId": "$postID", "playbackID": "$playbackID","title":"$title","timestamp":' +
'"$timestamp","assetID":"$assetID","aspect":"$aspect","rendition":"$rendition"}';
}
}