From f08e36e3bf70f219acc98943f263bb96f3e33677 Mon Sep 17 00:00:00 2001 From: "Tanner W. Stokes" Date: Tue, 17 May 2022 13:13:14 -0400 Subject: [PATCH 1/2] Add optional groups array for remote site designs. --- WordPressKit/RemoteSiteDesign.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/WordPressKit/RemoteSiteDesign.swift b/WordPressKit/RemoteSiteDesign.swift index 078f14ae..fabe9217 100644 --- a/WordPressKit/RemoteSiteDesign.swift +++ b/WordPressKit/RemoteSiteDesign.swift @@ -33,6 +33,7 @@ public struct RemoteSiteDesign: Codable { public let mobileScreenshot: String? public let tabletScreenshot: String? public let themeSlug: String? + public let groups: [String]? public let segmentID: Int64? public let categories: [RemoteSiteDesignCategory] @@ -44,6 +45,7 @@ public struct RemoteSiteDesign: Codable { case mobileScreenshot = "preview_mobile" case tabletScreenshot = "preview_tablet" case themeSlug = "theme" + case groups case segmentID = "segment_id" case categories } @@ -57,6 +59,7 @@ public struct RemoteSiteDesign: Codable { mobileScreenshot = try? map.decode(String.self, forKey: .mobileScreenshot) tabletScreenshot = try? map.decode(String.self, forKey: .tabletScreenshot) themeSlug = try? map.decode(String.self, forKey: .themeSlug) + groups = try? map.decode([String].self, forKey: .groups) segmentID = try? map.decode(Int64.self, forKey: .segmentID) categories = try map.decode([RemoteSiteDesignCategory].self, forKey: .categories) } From 92e47d917005a1277ab4fd2ad8191377cbf1c760 Mon Sep 17 00:00:00 2001 From: "Tanner W. Stokes" Date: Wed, 18 May 2022 21:24:22 -0400 Subject: [PATCH 2/2] Match API property name. --- WordPressKit/RemoteSiteDesign.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/WordPressKit/RemoteSiteDesign.swift b/WordPressKit/RemoteSiteDesign.swift index fabe9217..594448c6 100644 --- a/WordPressKit/RemoteSiteDesign.swift +++ b/WordPressKit/RemoteSiteDesign.swift @@ -33,7 +33,7 @@ public struct RemoteSiteDesign: Codable { public let mobileScreenshot: String? public let tabletScreenshot: String? public let themeSlug: String? - public let groups: [String]? + public let group: [String]? public let segmentID: Int64? public let categories: [RemoteSiteDesignCategory] @@ -45,7 +45,7 @@ public struct RemoteSiteDesign: Codable { case mobileScreenshot = "preview_mobile" case tabletScreenshot = "preview_tablet" case themeSlug = "theme" - case groups + case group case segmentID = "segment_id" case categories } @@ -59,7 +59,7 @@ public struct RemoteSiteDesign: Codable { mobileScreenshot = try? map.decode(String.self, forKey: .mobileScreenshot) tabletScreenshot = try? map.decode(String.self, forKey: .tabletScreenshot) themeSlug = try? map.decode(String.self, forKey: .themeSlug) - groups = try? map.decode([String].self, forKey: .groups) + group = try? map.decode([String].self, forKey: .group) segmentID = try? map.decode(Int64.self, forKey: .segmentID) categories = try map.decode([RemoteSiteDesignCategory].self, forKey: .categories) }