Skip to content
This repository was archived by the owner on Sep 15, 2025. It is now read-only.

Commit ae2227b

Browse files
committed
Fix problems with site creation.
1 parent 5451f4d commit ae2227b

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

WordPressKit/DomainsServiceRemote.swift

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,17 @@ import CocoaLumberjack
33

44
public struct DomainSuggestion: Codable {
55
public let domainName: String
6-
public let productID: Int
7-
public let supportsPrivacy: Bool
6+
public let productID: Int?
7+
public let supportsPrivacy: Bool?
88

99
public init(json: [String: AnyObject]) throws {
10-
guard let domain = json["domain_name"] as? String,
11-
let product = json["product_id"] as? Int,
12-
let privacy = json["supports_privacy"] as? Bool else {
13-
throw DomainsServiceRemote.ResponseError.decodingFailed
10+
guard let domain = json["domain_name"] as? String else {
11+
throw DomainsServiceRemote.ResponseError.decodingFailed
1412
}
1513

1614
self.domainName = domain
17-
self.productID = product
18-
self.supportsPrivacy = privacy
15+
self.productID = json["product_id"] as? Int ?? nil
16+
self.supportsPrivacy = json["supports_privacy"] as? Bool ?? nil
1917
}
2018
}
2119

@@ -37,8 +35,7 @@ public class DomainsServiceRemote: ServiceRemoteWordPressComREST {
3735
return ["include_wordpressdotcom": true as AnyObject,
3836
"only_wordpressdotcom": false as AnyObject]
3937
case .onlyWordPressDotCom:
40-
return ["include_wordpressdotcom": true as AnyObject,
41-
"only_wordpressdotcom": true as AnyObject]
38+
return ["only_wordpressdotcom": true as AnyObject]
4239
}
4340
}
4441
}

0 commit comments

Comments
 (0)