class PostsModel { int? id; String? date; String? dateGmt; Guid? guid; String? modified; String? modifiedGmt; String? slug; String? status; String? type; String? link; Guid? title; Content? content; Content? excerpt; int? author; int? featuredMedia; String? commentStatus; String? pingStatus; bool? sticky; String? template; String? format; Meta? meta; List? categories; List? tags; List? classList; String? featuredImageSrc; AuthorInfo? authorInfo; Links? lLinks; PostsModel( {this.id, this.date, this.dateGmt, this.guid, this.modified, this.modifiedGmt, this.slug, this.status, this.type, this.link, this.title, this.content, this.excerpt, this.author, this.featuredMedia, this.commentStatus, this.pingStatus, this.sticky, this.template, this.format, this.meta, this.categories, this.tags, this.classList, this.featuredImageSrc, this.authorInfo, this.lLinks}); PostsModel.fromJson(Map json) { id = json['id']; date = json['date']; dateGmt = json['date_gmt']; guid = json['guid'] != null ? Guid.fromJson(json['guid']) : null; modified = json['modified']; modifiedGmt = json['modified_gmt']; slug = json['slug']; status = json['status']; type = json['type']; link = json['link']; title = json['title'] != null ? Guid.fromJson(json['title']) : null; content = json['content'] != null ? Content.fromJson(json['content']) : null; excerpt = json['excerpt'] != null ? Content.fromJson(json['excerpt']) : null; author = json['author']; featuredMedia = json['featured_media']; commentStatus = json['comment_status']; pingStatus = json['ping_status']; sticky = json['sticky']; template = json['template']; format = json['format']; meta = json['meta'] != null ? Meta.fromJson(json['meta']) : null; categories = json['categories'].cast(); tags = json['tags'].cast(); classList = json['class_list'].cast(); featuredImageSrc = json['featured_image_src']; authorInfo = json['author_info'] != null ? AuthorInfo.fromJson(json['author_info']) : null; lLinks = json['_links'] != null ? Links.fromJson(json['_links']) : null; } Map toJson() { final Map data = {}; data['id'] = id; data['date'] = date; data['date_gmt'] = dateGmt; if (guid != null) { data['guid'] = guid!.toJson(); } data['modified'] = modified; data['modified_gmt'] = modifiedGmt; data['slug'] = slug; data['status'] = status; data['type'] = type; data['link'] = link; if (title != null) { data['title'] = title!.toJson(); } if (content != null) { data['content'] = content!.toJson(); } if (excerpt != null) { data['excerpt'] = excerpt!.toJson(); } data['author'] = author; data['featured_media'] = featuredMedia; data['comment_status'] = commentStatus; data['ping_status'] = pingStatus; data['sticky'] = sticky; data['template'] = template; data['format'] = format; if (meta != null) { data['meta'] = meta!.toJson(); } data['categories'] = categories; data['tags'] = tags; data['class_list'] = classList; data['featured_image_src'] = featuredImageSrc; if (authorInfo != null) { data['author_info'] = authorInfo!.toJson(); } if (lLinks != null) { data['_links'] = lLinks!.toJson(); } return data; } } class Guid { String? rendered; Guid({this.rendered}); Guid.fromJson(Map json) { rendered = json['rendered']; } Map toJson() { final Map data = {}; data['rendered'] = rendered; return data; } } class Content { String? rendered; bool? protected; Content({this.rendered, this.protected}); Content.fromJson(Map json) { rendered = json['rendered']; protected = json['protected']; } Map toJson() { final Map data = {}; data['rendered'] = rendered; data['protected'] = protected; return data; } } class Meta { String? ubCttVia; String? footnotes; Meta({this.ubCttVia, this.footnotes}); Meta.fromJson(Map json) { ubCttVia = json['ub_ctt_via']; footnotes = json['footnotes']; } Map toJson() { final Map data = {}; data['ub_ctt_via'] = ubCttVia; data['footnotes'] = footnotes; return data; } } class AuthorInfo { String? displayName; String? authorLink; AuthorInfo({this.displayName, this.authorLink}); AuthorInfo.fromJson(Map json) { displayName = json['display_name']; authorLink = json['author_link']; } Map toJson() { final Map data = {}; data['display_name'] = displayName; data['author_link'] = authorLink; return data; } } class Links { List? self; List? collection; // List? about; List? author; // List? replies; List? versionHistory; List? predecessorVersion; // List? wpAttachment; List? wpTerm; List? curies; Links( {this.self, this.collection, // this.about, this.author, // this.replies, this.versionHistory, this.predecessorVersion, // this.wpAttachment, this.wpTerm, this.curies}); Links.fromJson(Map json) { if (json['self'] != null) { self = []; json['self'].forEach((v) { self!.add(Self.fromJson(v)); }); } if (json['collection'] != null) { collection = []; json['collection'].forEach((v) { collection!.add(Collection.fromJson(v)); }); } // if (json['about'] != null) { // about = []; // json['about'].forEach((v) { // about!.add(About.fromJson(v)); // }); // } if (json['author'] != null) { author = []; json['author'].forEach((v) { author!.add(Author.fromJson(v)); }); } // if (json['replies'] != null) { // replies = []; // json['replies'].forEach((v) { // replies!.add(Replies.fromJson(v)); // }); // } if (json['version-history'] != null) { versionHistory = []; json['version-history'].forEach((v) { versionHistory!.add(VersionHistory.fromJson(v)); }); } if (json['predecessor-version'] != null) { predecessorVersion = []; json['predecessor-version'].forEach((v) { predecessorVersion!.add(PredecessorVersion.fromJson(v)); }); } // if (json['wp:attachment'] != null) { // wpAttachment = []; // json['wp:attachment'].forEach((v) { // wpAttachment!.add(WpAttachment.fromJson(v)); // }); // } if (json['wp:term'] != null) { wpTerm = []; json['wp:term'].forEach((v) { wpTerm!.add(WpTerm.fromJson(v)); }); } if (json['curies'] != null) { curies = []; json['curies'].forEach((v) { curies!.add(Curies.fromJson(v)); }); } } Map toJson() { final Map data = {}; if (self != null) { data['self'] = self!.map((v) => v.toJson()).toList(); } if (collection != null) { data['collection'] = collection!.map((v) => v.toJson()).toList(); } // if (about != null) { // data['about'] = about!.map((v) => v.toJson()).toList(); // } if (author != null) { data['author'] = author!.map((v) => v.toJson()).toList(); } // if (replies != null) { // data['replies'] = replies!.map((v) => v.toJson()).toList(); // } if (versionHistory != null) { data['version-history'] = versionHistory!.map((v) => v.toJson()).toList(); } if (predecessorVersion != null) { data['predecessor-version'] = predecessorVersion!.map((v) => v.toJson()).toList(); } // if (wpAttachment != null) { // data['wp:attachment'] = wpAttachment!.map((v) => v.toJson()).toList(); // } if (wpTerm != null) { data['wp:term'] = wpTerm!.map((v) => v.toJson()).toList(); } if (curies != null) { data['curies'] = curies!.map((v) => v.toJson()).toList(); } return data; } } class Self { String? href; TargetHints? targetHints; Self({this.href, this.targetHints}); Self.fromJson(Map json) { href = json['href']; targetHints = json['targetHints'] != null ? TargetHints.fromJson(json['targetHints']) : null; } Map toJson() { final Map data = {}; data['href'] = href; if (targetHints != null) { data['targetHints'] = targetHints!.toJson(); } return data; } } class TargetHints { List? allow; TargetHints({this.allow}); TargetHints.fromJson(Map json) { allow = json['allow'].cast(); } Map toJson() { final Map data = {}; data['allow'] = allow; return data; } } class Collection { String? href; Collection({this.href}); Collection.fromJson(Map json) { href = json['href']; } Map toJson() { final Map data = {}; data['href'] = href; return data; } } class Author { bool? embeddable; String? href; Author({this.embeddable, this.href}); Author.fromJson(Map json) { embeddable = json['embeddable']; href = json['href']; } Map toJson() { final Map data = {}; data['embeddable'] = embeddable; data['href'] = href; return data; } } class VersionHistory { int? count; String? href; VersionHistory({this.count, this.href}); VersionHistory.fromJson(Map json) { count = json['count']; href = json['href']; } Map toJson() { final Map data = {}; data['count'] = count; data['href'] = href; return data; } } class PredecessorVersion { int? id; String? href; PredecessorVersion({this.id, this.href}); PredecessorVersion.fromJson(Map json) { id = json['id']; href = json['href']; } Map toJson() { final Map data = {}; data['id'] = id; data['href'] = href; return data; } } class WpTerm { String? taxonomy; bool? embeddable; String? href; WpTerm({this.taxonomy, this.embeddable, this.href}); WpTerm.fromJson(Map json) { taxonomy = json['taxonomy']; embeddable = json['embeddable']; href = json['href']; } Map toJson() { final Map data = {}; data['taxonomy'] = taxonomy; data['embeddable'] = embeddable; data['href'] = href; return data; } } class Curies { String? name; String? href; bool? templated; Curies({this.name, this.href, this.templated}); Curies.fromJson(Map json) { name = json['name']; href = json['href']; templated = json['templated']; } Map toJson() { final Map data = {}; data['name'] = name; data['href'] = href; data['templated'] = templated; return data; } }