😑 using search-a-licious API now...

This commit is contained in:
cdricms
2025-12-06 18:43:14 +01:00
parent 44420002c7
commit dd191b585d
7 changed files with 35 additions and 23 deletions

View File

@@ -35,10 +35,10 @@ public struct NutriscoreData: Sendable, Codable {
isBeverage = try container.decodeIfPresent(
Int.self, forKey: .isBeverage)
isCheese = try container.decodeStringOrInt(forKey: .isCheese)
isWater = try container.decodeStringOrInt(forKey: .isWater)
isFat = try container.decodeStringOrInt(forKey: .isFat)
energy = try container.decodeStringOrInt(forKey: .energy)
isCheese = try container.decodeIntOrString(forKey: .isCheese)
isWater = try container.decodeIntOrString(forKey: .isWater)
isFat = try container.decodeIntOrString(forKey: .isFat)
energy = try container.decodeIntOrString(forKey: .energy)
}

View File

@@ -147,7 +147,7 @@ public struct Product: Codable, Sendable, Identifiable {
String.self, forKey: .productName)
genericName = try container.decodeIfPresent(
String.self, forKey: .genericName)
brands = try container.decodeIfPresent(String.self, forKey: .brands)
brands = try container.decodeStringOrArray(forKey: .brands)
brandsTags = try container.decodeIfPresent(
[String].self, forKey: .brandsTags)
quantity = try container.decodeIfPresent(String.self, forKey: .quantity)

View File

@@ -2,10 +2,10 @@ import Foundation
public enum SearchParameter: Sendable, Hashable {
case query(String)
case tag(tag: SearchTagType, value: String)
// case tag(tag: SearchTagType, value: String)
case page(Int)
case pageSize(Int)
case sort(SearchSort)
// case sort(SearchSort)
}
public enum SearchTagType: String, Sendable {