Should work
This commit is contained in:
@@ -137,13 +137,15 @@ public struct ProductResponseEnvelope: Sendable, Decodable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public struct SearchResponseEnvelope: Sendable, Decodable {
|
public struct SearchResponseEnvelope: Sendable, Decodable {
|
||||||
public let count: Int?
|
public let count: Int
|
||||||
public let page: Int?
|
public let page: Int
|
||||||
public let pageSize: Int?
|
public let pageSize: Int
|
||||||
public let products: [Product]?
|
public let products: [Product]
|
||||||
|
public let pageCount: Int
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case count, page, products
|
case count, page, products
|
||||||
case pageSize = "page_size"
|
case pageSize = "page_size"
|
||||||
|
case pageCount = "page_count"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ final class OpenFoodFactsTests: XCTestCase {
|
|||||||
.sort(.popularity),
|
.sort(.popularity),
|
||||||
)
|
)
|
||||||
|
|
||||||
let results = response.products ?? []
|
let results = response.products
|
||||||
|
|
||||||
let jsonResults = try JSONEncoder().encode(results)
|
let jsonResults = try JSONEncoder().encode(results)
|
||||||
try jsonResults.write(to: .init(filePath: "./jsonResults.json"))
|
try jsonResults.write(to: .init(filePath: "./jsonResults.json"))
|
||||||
|
|||||||
Reference in New Issue
Block a user