Api v2
This commit is contained in:
28
Sources/OpenFoodFactsSDK/Schemas/NutrientLevels.swift
Normal file
28
Sources/OpenFoodFactsSDK/Schemas/NutrientLevels.swift
Normal file
@@ -0,0 +1,28 @@
|
||||
public struct NutrientLevels: Sendable, Codable {
|
||||
|
||||
public enum Level: String, Sendable, Codable {
|
||||
case high, moderate, low
|
||||
}
|
||||
|
||||
public var fat: Level? = nil
|
||||
public var salt: Level? = nil
|
||||
public var saturatedFat: Level? = nil
|
||||
public var sugars: Level? = nil
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case fat
|
||||
case salt
|
||||
case saturatedFat = "saturated-fat"
|
||||
case sugars
|
||||
}
|
||||
|
||||
public subscript(_ key: CodingKeys) -> Level? {
|
||||
switch key {
|
||||
case .fat: fat
|
||||
case .salt: salt
|
||||
case .saturatedFat: saturatedFat
|
||||
case .sugars: sugars
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user