From c15dbc12344806f53d0e33b827dba85370196221 Mon Sep 17 00:00:00 2001 From: James Frost Date: Wed, 27 Apr 2022 10:13:55 +0100 Subject: [PATCH 1/3] Add featured image URL to StatsLastPostInsight --- WordPressKit/Insights/StatsLastPostInsight.swift | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/WordPressKit/Insights/StatsLastPostInsight.swift b/WordPressKit/Insights/StatsLastPostInsight.swift index a2dcbd5a..36cc9590 100644 --- a/WordPressKit/Insights/StatsLastPostInsight.swift +++ b/WordPressKit/Insights/StatsLastPostInsight.swift @@ -6,6 +6,7 @@ public struct StatsLastPostInsight { public let commentsCount: Int public let viewsCount: Int public let postID: Int + public let featuredImageURL: URL? public init(title: String, url: URL, @@ -13,7 +14,8 @@ public struct StatsLastPostInsight { likesCount: Int, commentsCount: Int, viewsCount: Int, - postID: Int) { + postID: Int, + featuredImageURL: URL?) { self.title = title self.url = url self.publishedDate = publishedDate @@ -21,6 +23,7 @@ public struct StatsLastPostInsight { self.commentsCount = commentsCount self.viewsCount = viewsCount self.postID = postID + self.featuredImageURL = featuredImageURL } } @@ -31,7 +34,7 @@ extension StatsLastPostInsight: StatsInsightData { return ["order_by": "date", "number": "1", "type": "post", - "fields": "ID, title, URL, discussion, like_count, date"] + "fields": "ID, title, URL, discussion, like_count, date, featured_image"] } public static var pathComponent: String { @@ -69,5 +72,12 @@ extension StatsLastPostInsight: StatsInsightData { self.commentsCount = commentsCount self.viewsCount = views self.postID = postID + + if let featuredImage = jsonDictionary["featured_image"] as? String, + let featuredURL = URL(string: featuredImage) { + self.featuredImageURL = featuredURL + } else { + self.featuredImageURL = nil + } } } From e2a9e16c9a9b2a6c7f46d22ed8187ea42a16244b Mon Sep 17 00:00:00 2001 From: James Frost Date: Thu, 28 Apr 2022 23:30:47 +0100 Subject: [PATCH 2/3] Updated podspec version --- WordPressKit.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPressKit.podspec b/WordPressKit.podspec index 6ed1361d..700fd158 100644 --- a/WordPressKit.podspec +++ b/WordPressKit.podspec @@ -2,7 +2,7 @@ Pod::Spec.new do |s| s.name = 'WordPressKit' - s.version = '4.50.0' + s.version = '4.51.0-beta.1' s.summary = 'WordPressKit offers a clean and simple WordPress.com and WordPress.org API.' s.description = <<-DESC From c87d14168294ecb804b3093b5550d0d382cbef23 Mon Sep 17 00:00:00 2001 From: Stephenie Harris Date: Mon, 2 May 2022 15:21:34 -0600 Subject: [PATCH 3/3] Update pod version. --- WordPressKit.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPressKit.podspec b/WordPressKit.podspec index 700fd158..8fcb6df6 100644 --- a/WordPressKit.podspec +++ b/WordPressKit.podspec @@ -2,7 +2,7 @@ Pod::Spec.new do |s| s.name = 'WordPressKit' - s.version = '4.51.0-beta.1' + s.version = '4.51.0-beta.2' s.summary = 'WordPressKit offers a clean and simple WordPress.com and WordPress.org API.' s.description = <<-DESC