From bdcdf656daf395f2ce285747c2036c02afaaa614 Mon Sep 17 00:00:00 2001 From: Henadzi Rabkin Date: Thu, 15 Feb 2024 00:18:30 +0100 Subject: [PATCH 1/9] Wrapping into nav view --- Package.resolved | 6 +- Sources/ProductPage.swift | 132 +++++++++++---------- Sources/ViewModels/ProductPageConfig.swift | 3 - 3 files changed, 70 insertions(+), 71 deletions(-) diff --git a/Package.resolved b/Package.resolved index 85197c0..91ff31f 100644 --- a/Package.resolved +++ b/Package.resolved @@ -3,10 +3,10 @@ { "identity" : "barcodeview", "kind" : "remoteSourceControl", - "location" : "https://github.com/nrivard/BarcodeView.git", + "location" : "https://github.com/hrabkin/BarcodeView.git", "state" : { - "revision" : "ba08384079911583d0fe1d684141eefdef77a777", - "version" : "0.1.4" + "branch" : "master", + "revision" : "1c18b3236db7ac03146981d26a8258b5e62117c8" } }, { diff --git a/Sources/ProductPage.swift b/Sources/ProductPage.swift index b5bde01..9a17447 100644 --- a/Sources/ProductPage.swift +++ b/Sources/ProductPage.swift @@ -37,74 +37,76 @@ public struct ProductPage: View { } public var body: some View { - Group { - switch pageConfig.pageState { - case .loading, .completed, .error: - PageOverlay(state: $pageConfig.pageState) - case .productDetails: - ProductDetails(barcode: barcode) - .environmentObject(pageConfig) - .environmentObject(imagesHelper) - .actionSheet(isPresented: $imagesHelper.isPresentedSourcePicker) { () -> ActionSheet in - ActionSheet( - title: Text("Choose source"), - message: Text("Please choose your preferred source to add product's image"), - buttons: [ - .default(Text("Camera"), action: { - self.imagesHelper.isPresented = true - self.imagesHelper.source = .camera - }), - .default(Text("Gallery"), action: { - self.imagesHelper.isPresented = true - self.imagesHelper.source = .photoLibrary - }), - .cancel() - ] - ) - } - .fullScreenCover(isPresented: $imagesHelper.isPresentedImagePreview, content: { - ImageViewer( - viewerShown: $imagesHelper.isPresentedImagePreview, - image: $imagesHelper.previewImage, - closeButtonTopRight: true - ) - }) - .fullScreenCover(isPresented: $imagesHelper.isPresented) { - ImagePickerView( - isPresented: $imagesHelper.isPresented, - image: pageConfig.binding(for: imagesHelper.imageFieldToEdit), - source: $imagesHelper.source - ) { withImage in - imagesHelper.showingCropper = withImage - }.ignoresSafeArea() - } - .fullScreenCover(isPresented: $imagesHelper.showingCropper, content: { - ImageCropper( - image: pageConfig.binding(for: imagesHelper.imageFieldToEdit), - isPresented: $imagesHelper.showingCropper, - errorMessage: $pageConfig.errorMessage - ).ignoresSafeArea() - }) - .toolbar { - ToolbarItem(placement: .topBarLeading) { - Button("Cancel") { - dismiss() - } + NavigationView { + Group { + switch pageConfig.pageState { + case .loading, .completed, .error: + PageOverlay(state: $pageConfig.pageState) + case .productDetails: + ProductDetails(barcode: barcode) + .environmentObject(pageConfig) + .environmentObject(imagesHelper) + .actionSheet(isPresented: $imagesHelper.isPresentedSourcePicker) { () -> ActionSheet in + ActionSheet( + title: Text("Choose source"), + message: Text("Please choose your preferred source to add product's image"), + buttons: [ + .default(Text("Camera"), action: { + self.imagesHelper.isPresented = true + self.imagesHelper.source = .camera + }), + .default(Text("Gallery"), action: { + self.imagesHelper.isPresented = true + self.imagesHelper.source = .photoLibrary + }), + .cancel() + ] + ) } - ToolbarItem(placement: .topBarTrailing) { - Button("Submit") { - if (pageConfig.getMissingFields().isEmpty) { - Task { - await pageConfig.uploadAllProductData(barcode: barcode) - } - } else { - pageConfig.errorMessage = ErrorAlert( - message: "Fields: \(self.pageConfig.getMissingFieldsMessage())", - title: "Missing required data") + .fullScreenCover(isPresented: $imagesHelper.isPresentedImagePreview, content: { + ImageViewer( + viewerShown: $imagesHelper.isPresentedImagePreview, + image: $imagesHelper.previewImage, + closeButtonTopRight: true + ) + }) + .fullScreenCover(isPresented: $imagesHelper.isPresented) { + ImagePickerView( + isPresented: $imagesHelper.isPresented, + image: pageConfig.binding(for: imagesHelper.imageFieldToEdit), + source: $imagesHelper.source + ) { withImage in + imagesHelper.showingCropper = withImage + }.ignoresSafeArea() + } + .fullScreenCover(isPresented: $imagesHelper.showingCropper, content: { + ImageCropper( + image: pageConfig.binding(for: imagesHelper.imageFieldToEdit), + isPresented: $imagesHelper.showingCropper, + errorMessage: $pageConfig.errorMessage + ).ignoresSafeArea() + }) + .toolbar { + ToolbarItem(placement: .topBarLeading) { + Button("Cancel") { + dismiss() } - }.disabled(!pageConfig.isInitialised) + } + ToolbarItem(placement: .topBarTrailing) { + Button("Submit") { + if (pageConfig.getMissingFields().isEmpty) { + Task { + await pageConfig.uploadAllProductData(barcode: barcode) + } + } else { + pageConfig.errorMessage = ErrorAlert( + message: "Fields: \(self.pageConfig.getMissingFieldsMessage())", + title: "Missing required data") + } + }.disabled(!pageConfig.isInitialised) + } } - } + } } } .navigationBarBackButtonHidden() diff --git a/Sources/ViewModels/ProductPageConfig.swift b/Sources/ViewModels/ProductPageConfig.swift index b72b374..93ca69d 100644 --- a/Sources/ViewModels/ProductPageConfig.swift +++ b/Sources/ViewModels/ProductPageConfig.swift @@ -81,11 +81,8 @@ final class ProductPageConfig: ObservableObject { self.orderedNutrients = orderedNutrients self.nutrientsMeta = nutrientsMeta - self.pageState = .completed self.isInitialised = true self.pageType = await determinePageType(response: productResponse) - // FIXME: find a way to show animation states without such workarounds - try await Task.sleep(nanoseconds: 1_000_000_000 * UInt64(PageOverlay.completedAnimDuration)) self.pageState = .productDetails } catch { From 13b41262ca65064af23dda759902f3d248b69969 Mon Sep 17 00:00:00 2001 From: Henadzi Rabkin Date: Mon, 13 May 2024 20:16:30 +0200 Subject: [PATCH 2/9] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 3cf7d5d..122315b 100644 --- a/README.md +++ b/README.md @@ -115,3 +115,5 @@ You can check the terms of use here : [Terms of use](https://world.openfoodfacts If you use this SDK, feel free to open a PR to add your application in this list. ## Authors +Written by FoodIntake. Used by FoodIntake iOS app +Checkout here https://foodintake.space From fa936c1a4c9049f3e8c4a729c597aaf72fd53f6d Mon Sep 17 00:00:00 2001 From: Henadzi Rabkin Date: Mon, 13 May 2024 20:18:44 +0200 Subject: [PATCH 3/9] Update README.md --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 122315b..256defc 100644 --- a/README.md +++ b/README.md @@ -115,5 +115,7 @@ You can check the terms of use here : [Terms of use](https://world.openfoodfacts If you use this SDK, feel free to open a PR to add your application in this list. ## Authors -Written by FoodIntake. Used by FoodIntake iOS app -Checkout here https://foodintake.space +This project is sponsored by [FoodIntake](https://foodintake.space) + +![Foodintake-AI-Calorie-Pal-Reddit](https://github.com/hrabkin/openfoodfacts-swift/assets/2230377/60a84e1e-2d16-42a2-9694-4d673cd67b95) + From 7ffbec5a4c97a7b216f4170aa610663c3734fd28 Mon Sep 17 00:00:00 2001 From: Henadzi Rabkin Date: Tue, 8 Oct 2024 00:52:20 +0200 Subject: [PATCH 4/9] OFF API generation --- OpenFoodFactsService/.gitignore | 8 + OpenFoodFactsService/Package.resolved | 96 + OpenFoodFactsService/Package.swift | 27 + OpenFoodFactsService/README.md | 3 + OpenFoodFactsService/Sources/main.swift | 12 + .../Sources/openapi-generator-config.yaml | 3 + OpenFoodFactsService/Sources/openapi.yaml | 13740 ++++++++++++++++ OpenFoodFactsService/merge_yamls.py | 99 + Sources/openapi-generator-config.yaml | 3 + Sources/openapi.yaml | 599 + 10 files changed, 14590 insertions(+) create mode 100644 OpenFoodFactsService/.gitignore create mode 100644 OpenFoodFactsService/Package.resolved create mode 100644 OpenFoodFactsService/Package.swift create mode 100644 OpenFoodFactsService/README.md create mode 100644 OpenFoodFactsService/Sources/main.swift create mode 100644 OpenFoodFactsService/Sources/openapi-generator-config.yaml create mode 100644 OpenFoodFactsService/Sources/openapi.yaml create mode 100644 OpenFoodFactsService/merge_yamls.py create mode 100644 Sources/openapi-generator-config.yaml create mode 100644 Sources/openapi.yaml diff --git a/OpenFoodFactsService/.gitignore b/OpenFoodFactsService/.gitignore new file mode 100644 index 0000000..0023a53 --- /dev/null +++ b/OpenFoodFactsService/.gitignore @@ -0,0 +1,8 @@ +.DS_Store +/.build +/Packages +xcuserdata/ +DerivedData/ +.swiftpm/configuration/registries.json +.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata +.netrc diff --git a/OpenFoodFactsService/Package.resolved b/OpenFoodFactsService/Package.resolved new file mode 100644 index 0000000..c50a510 --- /dev/null +++ b/OpenFoodFactsService/Package.resolved @@ -0,0 +1,96 @@ +{ + "originHash" : "c8377a5ea306c72d0bd00c56d93f4bbdd637a27affb09403f9a5c8e87eff15b7", + "pins" : [ + { + "identity" : "openapikit", + "kind" : "remoteSourceControl", + "location" : "https://github.com/mattpolzin/OpenAPIKit", + "state" : { + "revision" : "35dd374038497a8118d89300851861fb40c36209", + "version" : "3.2.2" + } + }, + { + "identity" : "swift-algorithms", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-algorithms", + "state" : { + "revision" : "f6919dfc309e7f1b56224378b11e28bab5bccc42", + "version" : "1.2.0" + } + }, + { + "identity" : "swift-argument-parser", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-argument-parser", + "state" : { + "revision" : "41982a3656a71c768319979febd796c6fd111d5c", + "version" : "1.5.0" + } + }, + { + "identity" : "swift-collections", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-collections", + "state" : { + "revision" : "671108c96644956dddcd89dd59c203dcdb36cec7", + "version" : "1.1.4" + } + }, + { + "identity" : "swift-http-types", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-http-types", + "state" : { + "revision" : "ae67c8178eb46944fd85e4dc6dd970e1f3ed6ccd", + "version" : "1.3.0" + } + }, + { + "identity" : "swift-numerics", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-numerics.git", + "state" : { + "revision" : "0a5bc04095a675662cf24757cc0640aa2204253b", + "version" : "1.0.2" + } + }, + { + "identity" : "swift-openapi-generator", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-openapi-generator", + "state" : { + "revision" : "d5f6a6abf18549c8bae6526bf2c9d5773269c570", + "version" : "1.3.1" + } + }, + { + "identity" : "swift-openapi-runtime", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-openapi-runtime", + "state" : { + "revision" : "26e8ae3515d1ff3607e924ac96fc0094775f55e8", + "version" : "1.5.0" + } + }, + { + "identity" : "swift-openapi-urlsession", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-openapi-urlsession", + "state" : { + "revision" : "9bf4c712ad7989d6a91dbe68748b8829a50837e4", + "version" : "1.0.2" + } + }, + { + "identity" : "yams", + "kind" : "remoteSourceControl", + "location" : "https://github.com/jpsim/Yams", + "state" : { + "revision" : "3036ba9d69cf1fd04d433527bc339dc0dc75433d", + "version" : "5.1.3" + } + } + ], + "version" : 3 +} diff --git a/OpenFoodFactsService/Package.swift b/OpenFoodFactsService/Package.swift new file mode 100644 index 0000000..2056449 --- /dev/null +++ b/OpenFoodFactsService/Package.swift @@ -0,0 +1,27 @@ +// swift-tools-version: 5.10 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "OpenFoodFactsServiceClient", + platforms: [.macOS(.v10_15), .iOS(.v13), .tvOS(.v13), .watchOS(.v6), .visionOS(.v1)], + dependencies: [ + .package(url: "https://github.com/apple/swift-openapi-generator", from: "1.0.0"), + .package(url: "https://github.com/apple/swift-openapi-runtime", from: "1.0.0"), + .package(url: "https://github.com/apple/swift-openapi-urlsession", from: "1.0.0"), + ], + targets: [ + .executableTarget( + name: "OpenFoodFactsServiceClient", + dependencies: [ + .product(name: "OpenAPIRuntime", package: "swift-openapi-runtime"), + .product(name: "OpenAPIURLSession", package: "swift-openapi-urlsession"), + ], + plugins: [ + .plugin(name: "OpenAPIGenerator", package: "swift-openapi-generator"), + ] + ) + ] +) + diff --git a/OpenFoodFactsService/README.md b/OpenFoodFactsService/README.md new file mode 100644 index 0000000..62d9568 --- /dev/null +++ b/OpenFoodFactsService/README.md @@ -0,0 +1,3 @@ +curl -s https://api.github.com/repos/openfoodfacts/openfoodfacts-server/contents/docs/api/ref | jq -r '.[].download_url' > file_urls.txt + +wget https://raw.githubusercontent.com/openfoodfacts/openfoodfacts-server/main/docs/api/ref/api.yml \ No newline at end of file diff --git a/OpenFoodFactsService/Sources/main.swift b/OpenFoodFactsService/Sources/main.swift new file mode 100644 index 0000000..18f528a --- /dev/null +++ b/OpenFoodFactsService/Sources/main.swift @@ -0,0 +1,12 @@ +import OpenAPIRuntime +import OpenAPIURLSession + + +let client = Client( + serverURL: try Servers.server2(), + transport: URLSessionTransport() +) + + +let response = try await client.getGreeting(query: .init(name: "CLI")) +print(response) diff --git a/OpenFoodFactsService/Sources/openapi-generator-config.yaml b/OpenFoodFactsService/Sources/openapi-generator-config.yaml new file mode 100644 index 0000000..ecefb47 --- /dev/null +++ b/OpenFoodFactsService/Sources/openapi-generator-config.yaml @@ -0,0 +1,3 @@ +generate: + - types + - client diff --git a/OpenFoodFactsService/Sources/openapi.yaml b/OpenFoodFactsService/Sources/openapi.yaml new file mode 100644 index 0000000..994efe9 --- /dev/null +++ b/OpenFoodFactsService/Sources/openapi.yaml @@ -0,0 +1,13740 @@ +openapi: 3.1.0 +info: + title: Open Food Facts Open API + description: > + As a developer, the Open Food Facts API allows you to get information + + and contribute to the products database. You can create great apps to + + help people make better food choices and also provide data to enhance the + database. + termsOfService: 'https://world.openfoodfacts.org/terms-of-use' + contact: + name: Open Food Facts + url: 'https://slack.openfoodfacts.org/' + email: reuse@openfoodfacts.org + license: + name: 'data: ODbL' + url: 'https://opendatacommons.org/licenses/odbl/summary/index.html' + x-identifier: ODbL-1.0 + version: '2' +externalDocs: + description: | + Please read the API introduction before using this API. + url: 'https://openfoodfacts.github.io/openfoodfacts-server/api/' +servers: + - description: dev + url: 'https://world.openfoodfacts.net' + - url: 'https://world.openfoodfacts.org' + description: prod +paths: + '/api/v2/product/{barcode}': + get: + tags: + - Read Requests + summary: Get information for a specific product by barcode + parameters: + - name: barcode + in: path + description: | + The barcode of the product to be fetched + required: true + style: simple + explode: false + schema: + type: string + example: '3017620422003' + responses: + '200': + description: OK + content: + application/json: + schema: + x-stoplight: + id: cfk5obotr63sa + type: object + allOf: + - type: object + x-stoplight: + id: s4gz59htj4gc3 + properties: + code: + type: string + description: > + Barcode of the product + + (can be EAN-13 or internal codes for some food + stores). + + For products without a barcode, Open Food Facts + assigns a + + number starting with the 200 reserved prefix. + status: + type: integer + status_verbose: + type: string + - type: object + properties: + product: + type: object + allOf: + - type: object + description: > + This is all the fields describing a product and + how to display it on a page. + + + Refer to the different sub schema for more + readable entries: + + + * [Product Base](#cmp--schemas-product-base): Base + fields of a product + + * [Product Misc](#cmp--schemas-product-misc): + Miscellaneous but important fields of a product + + * [Product Tags](#cmp--schemas-product-tags): Tags + fields on a product + + * [Product + Nutrition](#cmp--schemas-product-nutrition): + Nutrition fields of a product + + * [Product + Ingredients](#cmp--schemas-product-ingredients): + Fields about ingredients of a product + + * [Product Images](#cmp--schemas-product-images): + Information about Images of a product + + * [Product + Eco-Score](#cmp--schemas-product-images): Fields + related to Eco-Score for a product + + * [Product + Metadata](#cmp--schemas-product-ecoscore): + Metadata of a product (author, editors, etc.) + + * [Product Data + Quality](#cmp--schemas-product-quality): fields + related to data quality for a product + + * [Product Knowledge + Panels](#cmp--schemas-product-knowledge-panels): + Knowledge panels for a product + + * [Product Attribute + Groups](#cmp--schemas-product-attribute-groups): + Attribute groups for personal product matching + allOf: + - type: object + description: | + Base product data + properties: + abbreviated_product_name: + type: string + description: Abbreviated name in requested language + code: + type: string + description: > + barcode of the product (can be EAN-13 or + internal codes for some food stores), + + for products without a barcode, + + Open Food Facts assigns a number starting + with the 200 reserved prefix + codes_tags: + type: array + items: + type: string + description: > + A value which is the type of barcode + "code-13" or "code-8" + + and + + A series of mask for the barcode + + It helps retrieve barcodes starting by + example: > + ["code-13","3017620422xxx","301762042xxxx","30176204xxxxx","3017620xxxxxx","301762xxxxxxx","30176xxxxxxxx","3017xxxxxxxxx","301xxxxxxxxxx","30xxxxxxxxxxx","3xxxxxxxxxxxx"] + generic_name: + type: string + description: | + Legal name of the product as regulated + by the European authorities. + id: + description: > + internal identifier for the product, + usually set to the value of `code`, + + except on the producers platform where it + is prefixed by the owner + type: string + lc: + type: string + description: > + Main language of the product. + + This is a duplicate of `lang` property + (for historical reasons). + lang: + type: string + description: > + Main language of the product. + + + This should be the main language of + product packaging (if one is predominant). + + + Main language is also used to decide which + ingredients list to parse. + nova_group: + type: integer + description: > + Nova group as an integer from 1 to 4. See + https://world.openfoodfacts.org/nova + nova_groups: + type: string + obsolete: + type: string + obsolete_since_date: + description: > + A date at which the product was declared + obsolete. + + This means it's not produced any more. + type: string + product_name: + type: string + description: | + The name of the product + product_name_en: + type: string + description: | + The name of the product can also + be in many other languages like + product_name_fr (for French). + product_quantity: + type: string + description: > + The size in g or ml for the whole product. + + It's a normalized version of the quantity + field. + example: '500' + product_quantity_unit: + type: string + description: > + The unit (either g or ml) for the + correponding product_quantity. + example: g + quantity: + type: string + description: | + Quantity and Unit. + patternProperties: + abbreviated_product_name_(?\w\w): + type: string + description: >- + Abbreviated name in language + `language_code`. + generic_name_(?\w\w): + type: string + description: > + This can be returned in many other + languages + + like generic_name_fr (for French). + - type: object + description: > + Miscellaneous but important fields of a + product + properties: + additives_n: + type: integer + description: | + Number of food additives. + checked: + type: string + complete: + type: integer + completeness: + type: number + ecoscore_grade: + type: string + description: | + See also: `ecoscore_tags` + ecoscore_score: + type: integer + description: | + See also: `ecoscore_tags` + food_groups: + type: string + food_groups_tags: + type: array + items: + type: string + nutrient_levels: + description: > + Traffic light indicators on main nutrients + levels + type: object + properties: + fat: + type: string + enum: + - low + - moderate + - high + salt: + type: string + enum: + - low + - moderate + - high + saturated-fat: + type: string + enum: + - low + - moderate + - high + sugars: + type: string + enum: + - low + - moderate + - high + packaging_text: + type: string + description: > + Recycling instructions as raw text, e.g. + Plastic + + bottle to recycle, Plastic cap to recycle. + + This will get automatically parsed and + + will be used to compute the Eco-Score. + + You can either request it (if it exists) + or + + send it in a specific language. + example: packaging_text_en + packagings: + type: array + x-stoplight: + id: 1cyz4qo9njog7 + title: Packagings (READ) + description: >- + The packagings object is an array of + individual packaging component objects. + + + The Packaging data document explains how + packaging data is structured in Open Food + Facts: + https://openfoodfacts.github.io/openfoodfacts-server/dev/explain-packaging-data/ + + + The shape, material and recycling + properties of each packaging component are + linked to entries in the packaging_shapes, + packaging_materials and + packaging_recycling taxonomies: + + + https://world.openfoodfacts.org/data/taxonomies/packaging_shapes.json + + https://world.openfoodfacts.org/data/taxonomies/packaging_materials.json + + https://world.openfoodfacts.org/data/taxonomies/packaging_recycling.json + + + If the tags_lc field is set, the + properties will include a lc_name field + with the translation in the requested + language. + examples: + - - number_of_units: 6 + shape: + id: 'en:bottle' + lc_name: bouteille + material: + id: 'en:bottle' + lc_name: bouteille + recycling: + id: 'en:bottle' + lc_name: bouteille + quantity_per_unit: 25 cl + quantity_per_unit_value: 25 + quantity_per_unit_unit: cl + weight_specified: 30 + weight_measured: 32 + weight_estimated: 26 + weight: 30 + weight_source_id: specified + items: + description: >- + Each packaging component has different + properties to specify how many there + are, its shape, material etc. + + + The shape, material and recycling + properties are mapped to one entry in + the packaging_shapes, + packaging_materials and + packaging_recycling taxonomies, and the + value of the property is the canonical + name of the taxonomy entry (e.g. + en:bottle). + + + They may contain values that could not + yet get matched to their respective + taxonomy, in which case they will + contain a free text value prefixed with + the language code of this text value + (e.g. "fr:Bouteille sphérique" might + have been entered by a French user to + indicate it is a spherical bottle). + title: Packaging component (READ) + type: object + examples: + - number_of_units: 6 + shape: + id: 'en:bottle' + lc_name: bouteille + material: + id: 'en:bottle' + lc_name: bouteille + recycling: + id: 'en:bottle' + lc_name: bouteille + quantity_per_unit: 25 cl + quantity_per_unit_value: 25 + quantity_per_unit_unit: cl + weight_specified: 30 + weight_measured: 32 + weight_estimated: 26 + weight: 30 + weight_source_id: specified + properties: + number_of_units: + type: integer + description: >- + umber of units of this packaging + component contained in the product (e.g. + 6 for a pack of 6 bottles) + shape: + title: Packaging component shape + x-stoplight: + id: xrj8agza3dwgf + type: object + description: >- + The shape property is canonicalized + using the packaging_shapes taxonomy. + examples: + - id: 'en:bottle' + lc_name: bouteille + properties: + id: + type: string + description: >- + Canonical id of the entry in the + taxonomy. If the value cannot be mapped + to a taxonomy entry, the value will be + the name of the entry in its original + language prefixed by the language 2 + letter code and a colon. + lc_name: + type: string + description: >- + Name of the entry in the language + requested in the tags_lc field of the + request. This field is returned only of + tags_lc is specified. If the translation + is not available, or if the entry does + not exist in the taxonomy, the value + will be the name of the entry in its + original language prefixed by the + language 2 letter code and a colon. + material: + title: Packaging component material + x-stoplight: + id: n6umazgqmwrd5 + type: object + description: >- + The material property is canonicalized + using the packaging_materials taxonomy. + examples: + - id: 'en:bottle' + lc_name: bouteille + properties: + id: + type: string + description: >- + Canonical id of the entry in the + taxonomy. If the value cannot be mapped + to a taxonomy entry, the value will be + the name of the entry in its original + language prefixed by the language 2 + letter code and a colon. + lc_name: + type: string + description: >- + Name of the entry in the language + requested in the tags_lc field of the + request. This field is returned only of + tags_lc is specified. If the translation + is not available, or if the entry does + not exist in the taxonomy, the value + will be the name of the entry in its + original language prefixed by the + language 2 letter code and a colon. + recycling: + title: >- + Packaging component recycling + instruction + x-stoplight: + id: 376tk8e2cmyh2 + type: object + description: >- + The recycling property is canonicalized + using the packaging_recycling taxonomy. + examples: + - id: 'en:bottle' + lc_name: bouteille + properties: + id: + type: string + description: >- + Canonical id of the entry in the + taxonomy. If the value cannot be mapped + to a taxonomy entry, the value will be + the name of the entry in its original + language prefixed by the language 2 + letter code and a colon. + lc_name: + type: string + description: >- + Name of the entry in the language + requested in the tags_lc field of the + request. This field is returned only of + tags_lc is specified. If the translation + is not available, or if the entry does + not exist in the taxonomy, the value + will be the name of the entry in its + original language prefixed by the + language 2 letter code and a colon. + quantity_per_unit: + type: string + description: >- + Quantity (weight or volume) of food + product contained in the packaging + component. (e.g. 75cl for a wine bottle) + quantity_per_unit_value: + type: number + description: Value parsed from the quantity field. + quantity_per_unit_unit: + type: string + description: >- + Unit parsed and normalized from the + quantity field. + weight_specified: + type: number + description: >- + Weight (as specified by the + manufacturer) of one unit of the empty + packaging component (in grams). (e.g. + for a 6 pack of 1.5l water bottles, it + might be 30, the weight in grams of 1 + empty water bottle without its cap which + is a different packaging component). + weight_measured: + type: number + description: >- + Weight (as measured by one or more + users) of one unit of the empty + packaging component (in grams). (e.g. + for a 6 pack of 1.5l water bottles, it + might be 30, the weight in grams of 1 + empty water bottle without its cap which + is a different packaging component). + weight_estimated: + type: number + description: >- + Weight (as estimated from similar + products) of one unit of the empty + packaging component (in grams). (e.g. + for a 6 pack of 1.5l water bottles, it + might be 30, the weight in grams of 1 + empty water bottle without its cap which + is a different packaging component). + weight: + type: number + description: >- + Weight of one unit of the empty + packaging component. + weight_source_id: + type: string + description: >- + Indicates which field was used to + populate the "weight" field. Either + "specified", "measured", or "estimated" + readOnly: true + packagings_complete: + title: packagings_complete + x-stoplight: + id: hxnnsy954q1ey + type: integer + minimum: 0 + maximum: 1 + description: >- + Indicate if the packagings array contains + all the packaging parts of the product. + This field can be set by users when they + enter or verify packaging data. Possible + values are 0 or 1. + pnns_groups_1: + description: > + Category of food according to [French + Nutrition and Health + Program](https://fr.wikipedia.org/wiki/Programme_national_nutrition_sant%C3%A9) + type: string + pnns_groups_1_tags: + type: array + items: + type: string + pnns_groups_2: + description: > + Sub Category of food according to [French + Nutrition and Health + Program](https://fr.wikipedia.org/wiki/Programme_national_nutrition_sant%C3%A9) + type: string + pnns_groups_2_tags: + type: array + items: + type: string + popularity_key: + description: > + An imprecise measurement of popularity + based on Scan statistics. A higher value + means higher popularity. + type: integer + popularity_tags: + description: > + Indicators for the popularity of a + product, like the amount of scans in a + specific year. + type: array + items: + type: string + scans_n: + type: integer + unique_scans_n: + type: integer + serving_quantity: + type: string + description: > + Normalized version of serving_size. + + Note that this is NOT the number of + servings by product. + + (in perl, see + `normalize_serving_size`) + serving_quantity_unit: + type: string + description: > + The unit (either g or ml) for the + correponding serving_quantity. + example: g + serving_size: + type: string + description: > + Serving size text (generally in g or ml). + + We expect a quantity + unit but the user + is free to input any string. + patternProperties: + food_groups_(?\w\w): + type: string + description: see `food_groups` + packaging_text_(?\w\w): + type: string + description: > + Packaging text in language designated by + `language_code` + - type: object + description: > + Data about a product which is represented as + tags + properties: + brands: + type: string + description: List of brands (not taxonomized) + brands_tags: + type: array + items: + type: string + description: 'List of brands (tags, not taxonomized)' + categories: + type: string + categories_hierarchy: + type: array + items: + type: string + categories_lc: + type: string + description: Categories language code + categories_tags: + type: array + items: + type: string + checkers_tags: + type: array + items: + type: string + description: >- + List of checkers (users who checked the + product) tags + cities: + type: string + cities_tags: + type: array + items: + type: object + correctors_tags: + type: array + items: + type: string + countries: + type: string + description: > + List of countries where the product is + sold. + countries_hierarchy: + type: array + items: + type: string + countries_lc: + type: string + description: Countries language code + countries_tags: + type: array + items: + type: string + ecoscore_tags: + description: > + All ecoscore of a product. + + Most of the time it's only one value, + + but it might eventually be more for + products composed of sub-products. + + See also: `ecoscore_score`, + `ecoscore_grade`. + type: array + items: + type: string + emb_codes: + type: string + description: > + Packager code. EMB is the French system of + traceability codes for packager. + example: EMB 2013330 + emb_codes_orig: + type: string + emb_codes_tags: + type: array + items: + type: object + labels: + type: string + labels_hierarchy: + type: array + items: + type: string + labels_lc: + type: string + labels_tags: + type: array + items: + type: string + entry_dates_tags: + description: > + The data as a series of tag: `yyyy-mm-dd`, + `yyyy-mm`, `yyyy` + type: array + items: + type: string + example: + - '2016-03-11' + - 2016-03 + - '2016' + manufacturing_places: + type: string + description: > + Places where the product was manufactured + or transformed. + manufacturing_places_tags: + type: array + items: + type: object + nova_groups_tags: + type: array + items: + type: string + nutrient_levels_tags: + type: array + items: + type: string + - type: object + description: > + Information about Images of a product. + + + Images ensure the reliability of Open Food + Facts data. + + It provides a primary source and proof of all + the structured data. + + You may therefore want to display it along the + structured information. + + + See also tutorials about images: + + * [Getting + images](https://openfoodfacts.github.io/openfoodfacts-server/api/how-to-download-images/) + + * [Uploading + images](https://openfoodfacts.github.io/openfoodfacts-server/api/tutorial-uploading-photo-to-a-product/) + properties: + images: + description: > + This contains properties for all images + contained on the product. + type: object + properties: + '1': + type: object + description: > + This object represent an image that was + uploaded to a product. + + "imgid" is an integer which is a + sequential number unique to each + picture. + properties: + sizes: + type: object + description: > + The available image sizes for the + product (both reduced and full). + + The reduced images are the ones with + numbers as the key( 100, 200 etc) + + while the full images have `full` as the + key. + properties: + full: + description: | + properties of fullsize image + **TODO** explain how to compute name + type: object + properties: + h: + type: integer + example: 400 + description: > + The height of the reduced/full image in + pixels. + w: + type: integer + example: 255 + description: >- + The width of the reduced/full image in + pixels. + patternProperties: + (?100|400): + description: > + properties of thumbnail of size + `image_size`. + + **TODO** explain how to compute name + + + For real type: see description of + property `full`. + + (Put this way because of a [bug in + rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) + type: string + uploaded_t: + type: string + example: '1457680652' + description: > + The time the image was uploaded (as unix + timestamp). + uploader: + type: string + example: openfoodfacts-contributors + description: | + The contributor that uploaded the image. + front: + description: > + property of an image (or part thereof) + selected for a particular role and a + particular language. + type: object + properties: + angle: + type: integer + example: 0 + description: >- + The angle of the image rotation (if it + was rotated). + coordinates_image_size: + type: string + example: full + geometry: + type: string + example: 0x0--1--1 + imgid: + type: string + example: '121' + description: >- + The id of the original/source image that + was selected to edit(rotate, normalize + etc) to produce this new image. + normalize: + type: 'null' + example: null + description: Normalize colors. + rev: + type: string + example: '420' + sizes: + type: object + description: > + The available image sizes for the + product (both reduced and full). + + The reduced images are the ones with + numbers as the key( 100, 200 etc) + + while the full images have `full` as the + key. + properties: + '100': + type: object + properties: + h: + type: integer + example: 400 + description: > + The height of the reduced/full image in + pixels. + w: + type: integer + example: 255 + description: >- + The width of the reduced/full image in + pixels. + '200': + type: object + properties: + h: + type: integer + example: 400 + description: > + The height of the reduced/full image in + pixels. + w: + type: integer + example: 255 + description: >- + The width of the reduced/full image in + pixels. + '400': + type: object + properties: + h: + type: integer + example: 400 + description: > + The height of the reduced/full image in + pixels. + w: + type: integer + example: 255 + description: >- + The width of the reduced/full image in + pixels. + full: + type: object + properties: + h: + type: integer + example: 400 + description: > + The height of the reduced/full image in + pixels. + w: + type: integer + example: 255 + description: >- + The width of the reduced/full image in + pixels. + white_magic: + type: 'null' + example: null + description: > + Photo on white background : Try to + remove the background. + x1: + type: string + example: '-1' + x2: + type: string + example: '-1' + y1: + type: string + example: '-1' + y2: + type: string + example: '-1' + patternProperties: + (?\d+): + description: > + See property `1` to get the real type of + those objects + + (Put this way because of a [bug in + rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) + type: string + (?front|nutrition|ingredients|packaging|other)_(?\w\w): + description: > + See property `front` to get the real + type of those objects + + (Put this way because of a [bug in + rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) + type: string + last_image_dates_tags: + type: array + items: + type: string + last_image_t: + description: >- + timestamp of last image upload (or + update?) + type: integer + selected_images: + type: object + description: > + URL for selected (important) images of the + product. + + + This is very handy if you display the + product to users. + properties: + front: + type: object + description: >- + URLs of thumbnails image of image of + type `image_type` + properties: + display: + description: > + Thumbnail urls of product image (front) + adapted to display on product page + type: object + patternProperties: + (?\w\w): + type: string + description: >- + url of the image for language + `language_code` + small: + description: > + Thumbnail urls of product image (front) + adapted to display on product list page + type: object + patternProperties: + (?\w\w): + type: string + description: >- + url of the image for language + `language_code` + thumb: + description: > + Thumbnail urls of product image (front) + in smallest format + type: object + patternProperties: + (?\w\w): + type: string + description: >- + url of the image for language + `language_code` + patternProperties: + (?front|packaging|ingredients|nutrition|other): + description: > + See property `front` to get the real + type of those objects + + (Put this way because of a [bug in + rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) + type: string + image_small_url: + type: string + image_thumb_url: + type: string + image_url: + type: string + patternProperties: + image(_(?front|packaging|ingredients|nutrition|other))?(_(?small|thumb))?_url: + description: > + the URL of image of type `image_type` in + size `image_size` (or full size if not + given). + + + The `image_type` tells which image the + url correspond to. `image_type` is + `front` if not provided. + + + The image is the one for current + language (affected by `lc` parameter) if + an image exists for this language, the + image in main product language + otherwise. + + + **IMPORTANT:** you should use + `selected_images` field instead of this + one. + type: string + - type: object + description: > + Fields related to Eco-Score for a product. + + + See also: `ecoscore_score`, `ecoscore_grade` + and `ecoscore_tags`. + properties: + ecoscore_data: + type: object + description: > + An object about a lot of details about + data needed for Eco-Score computation + + and complementary data of interest. + properties: + adjustments: + type: object + properties: + origins_of_ingredients: + type: object + properties: + aggregated_origins: + type: array + items: + type: object + properties: + origin: + type: string + percent: + type: integer + epi_score: + type: integer + epi_value: + type: integer + origins_from_origins_field: + type: array + items: + type: string + transportation_scores: + type: object + patternProperties: + (?\w\w): + type: integer + transportation_values: + type: object + patternProperties: + (?\w\w): + type: integer + values: + type: object + patternProperties: + (?\w\w): + type: integer + warning: + type: string + packaging: + type: object + properties: + non_recyclable_and_non_biodegradable_materials: + type: integer + packagings: + type: array + items: + type: object + properties: + ecoscore_material_score: + type: integer + ecoscore_shape_ratio: + type: integer + material: + type: string + shape: + type: string + score: + type: integer + value: + type: integer + warning: + type: string + production_system: + type: object + properties: + labels: + type: array + example: 'vegan, fat free, Kosher' + items: + type: string + value: + type: integer + warning: + type: string + threatened_species: + type: object + properties: + ingredient: + type: string + value: + type: integer + agribalyse: + type: object + properties: + agribalyse_food_code: + type: string + co2_agriculture: + type: number + co2_consumption: + type: integer + co2_distribution: + type: number + co2_packaging: + type: number + co2_processing: + type: number + co2_total: + type: number + co2_transportation: + type: number + code: + type: string + dqr: + type: string + ef_agriculture: + type: number + ef_consumption: + type: integer + ef_distribution: + type: number + ef_packaging: + type: number + ef_processing: + type: number + ef_total: + type: number + ef_transportation: + type: number + is_beverage: + type: integer + name_en: + type: string + description: > + This can be returned in many other + languages + + like name_fr (for french). + score: + type: integer + version: + type: string + grade: + type: string + grades: + type: object + patternProperties: + (?\w\w): + type: string + missing: + type: object + properties: + labels: + type: integer + origins: + type: integer + packagings: + type: integer + missing_data_warning: + type: integer + previous_data: + type: object + properties: + grade: + type: string + score: + type: integer + agribalyse: + type: object + properties: + agribalyse_food_code: + type: string + co2_agriculture: + type: number + co2_consumption: + type: integer + co2_distribution: + type: number + co2_packaging: + type: number + co2_processing: + type: number + co2_total: + type: number + co2_transportation: + type: number + code: + type: string + dqr: + type: string + ef_agriculture: + type: number + ef_consumption: + type: integer + ef_distribution: + type: number + ef_packaging: + type: number + ef_processing: + type: number + ef_total: + type: number + ef_transportation: + type: number + is_beverage: + type: integer + name_en: + type: string + description: > + This can be returned in many other + languages + + like name_fr (for french). + score: + type: integer + version: + type: string + score: + type: integer + scores: + type: object + patternProperties: + (?\w\w): + type: integer + status: + type: string + ecoscore_extended_data_version: + type: string + environment_impact_level: + type: string + environment_impact_level_tags: + type: array + items: + type: object + - type: object + description: Fields about ingredients of a product + properties: + additives_tags: + type: array + items: + type: string + allergens: + type: string + description: comma separated list of allergens + allergens_lc: + type: string + description: language in which `allergens` where input + allergens_hierarchy: + type: array + items: + type: string + allergens_tags: + type: array + items: + type: string + ingredients: + type: array + description: > + This structure gives the different + ingredients and some information about + them, + + like estimate on their quantity. + items: + type: object + properties: + id: + type: string + ingredients: + description: > + Sub ingredients composing this + ingredients. + $ref: '#' + percent: + type: integer + percent_estimate: + type: + - number + percent_max: + type: + - number + percent_min: + type: integer + text: + type: string + vegan: + type: string + vegetarian: + type: string + ingredients_analysis: + type: object + properties: + 'en:palm-oil': + type: array + items: + type: string + 'en:vegan-status-unknown': + type: array + items: + type: string + 'en:vegetarian-status-unknown': + type: array + items: + type: string + ingredients_analysis_tags: + type: array + items: + type: string + ingredients_from_or_that_may_be_from_palm_oil_n: + type: integer + ingredients_from_palm_oil_n: + type: integer + ingredients_from_palm_oil_tags: + type: array + items: + type: object + ingredients_hierarchy: + type: array + items: + type: string + ingredients_n: + type: integer + ingredients_n_tags: + type: array + items: + type: string + ingredients_original_tags: + type: array + items: + type: string + ingredients_percent_analysis: + type: integer + ingredients_sweeteners_n: + type: integer + description: > + Number of sweeteners additives in the + ingredients. Undefined if ingredients are + not specified. + ingredients_non_nutritive_sweeteners_n: + type: integer + description: > + Number of non-nutritive sweeteners + additives (as specified in the Nutri-Score + formula) in the ingredients. Undefined if + ingredients are not specified. + ingredients_tags: + type: array + items: + type: string + ingredients_lc: + type: string + description: > + Language that was used to parse the + ingredient list. If `ingredients_text` is + available + + for the product main language (`lang`), + `ingredients_lc=lang`, otherwise we look + at + + `ingredients_text` fields for other + languages and set `ingredients_lc` to the + first + + non-empty `ingredient_text`. + ingredients_text: + type: string + description: > + Raw list of ingredients. This will get + automatically + + parsed and get used to compute the + Eco-Score or find allergens, etc.. + + + It's a copy of ingredients_text in the + main language of the product (see `lang` + proprety). + example: > + Farine de blé* 67,4%, sucre de canne*, + huile de tournesol oléique*, graines de + chia* 5,2%, son de blé*, oranges + déshydratées * 0,9%, farine de riz*, + poudres à lever (acide citrique, + carbonates de sodium), arôme naturel + d'orange. + ingredients_text_with_allergens: + type: string + description: > + Same text as `ingredients_text` but where + allergens have HTML elements around them + to identify them + example: > + Farine de blé* 67,4%, sucre + de canne*, huile de tournesol oléique*, + graines de chia* 5,2%, son de blé*, + oranges déshydratées * 0,9%, farine de + riz*, poudres à lever (acide citrique, + carbonates de sodium), arôme naturel + d'orange. + ingredients_that_may_be_from_palm_oil_n: + type: integer + ingredients_that_may_be_from_palm_oil_tags: + type: array + items: + type: object + ingredients_with_specified_percent_n: + type: integer + ingredients_with_specified_percent_sum: + type: integer + ingredients_with_unspecified_percent_n: + type: integer + ingredients_with_unspecified_percent_sum: + type: integer + known_ingredients_n: + type: integer + origins: + type: string + description: | + Origins of ingredients + origins_hierarchy: + type: array + items: + type: object + origins_lc: + type: string + origins_tags: + type: array + items: + type: object + traces: + type: string + description: > + List of substances that might cause + allergies + + that are present in trace amounts in the + product + + (this does not include the ingredients, as + they + + are not only present in trace amounts). + + It is taxonomized with the allergens + taxonomy. + traces_hierarchy: + type: array + items: + type: object + traces_lc: + type: string + traces_tags: + type: array + items: + type: object + unknown_ingredients_n: + type: integer + patternProperties: + ingredients_text_(?\w\w): + type: string + description: > + Raw list of ingredients in language given + by 'language_code'. + + + See `ingredients_text` + ingredients_text_with_allergens_(?\w\w): + description: > + Like `ingredients_text_with_allergens` for + a particular language + type: string + - type: object + description: > + Nutrition fields of a product + + + Most of these properties are read-only. + + + See [how to add nutrition + data](https://openfoodfacts.github.io/openfoodfacts-server/api/ref-cheatsheet/#add-nutrition-facts-values-units-and-base) + properties: + no_nutrition_data: + type: string + description: > + When a product does not have nutrition + data displayed on the + + packaging, the user can check the field + "Nutrition facts are + + not specified on the product". + + By doing so, the no_nutrition_data field + takes the value "on". + + This case is frequent (thousands of + products). + example: 'on' + nutrition_data_per: + type: string + enum: + - serving + - 100g + description: > + The nutrition data on the package can be + per serving or per 100g. + + + This is essential to understand if + `_value` and `` + + values in `nutriments` applies for a + serving or for 100g. + + + **IMPORTANT:** + + When writing products, + + this setting applies to all existing + nutrients values for the product, + + not only the nutrient values sent in the + write request. + + So it should not be changed unless all + nutrients values are provided + + with values that match the + nutrition_data_per field. + nutrition_data_prepared_per: + type: string + enum: + - serving + - 100g + description: > + The nutrition data for prepared product on + the package (if any) can be per serving or + per 100g. + + + This is essential to understand if + `_prepared_value` and + `_prepared` + + values in `nutriments` applies for a + serving or for 100g. + + + See also important note on + `nutrition_data_per`. + nutriments: + type: object + description: > + All known nutrients for the product. + + + Note that each nutrients are declined with + a variety of suffixes like `_100g`, + `_serving`, + + see patternProperties below. + + + A specific `_unit` is the unit used to + measure the nutrient. + + + Beware that some properties are to be + interpreted based upon + `nutrition_data_per` value. + + + Also for products that have a nutrition + table for prepared product + + (eg. the nutrition facts for a bowl of + milk with cocoa powder), + + a `_prepared` suffix is added (before + other suffixes). + + + You can get all possible nutrients from + the + + [nutrients + taxonomy](https://static.openfoodfacts.org/data/taxonomies/nutrients.json) + + + **FIXME** add more nutrients with + description. + properties: + alcohol: + description: > + Quantity of alcohol + + + (per 100g or per serving) in a standard + unit (g or ml) + type: number + carbohydrates: + type: number + energy: + type: number + description: > + It is the same as `energy-kj` if we have + it, or computed from `energy-kcal` + otherwise + + + (per 100g or per serving) in kj + energy_value: + type: number + description: > + energy_value will be equal to + energy-kj_value if we have it or to + energy-kcal_value otherwise + energy_unit: + type: string + enum: + - kcal + - kj + description: > + Equal to energy-kj_unit if we have it or + to energy-kcal_unit otherwise + energy-kcal: + type: number + description: > + energy in kcal, if it is specified + + + (per 100g or per serving) in a standard + unit (g or ml) + energy-kj: + type: number + description: > + energy in kj, if it is specified + + + (per 100g or per serving) in a standard + unit (g or ml) + fat: + type: number + fruits-vegetables-legumes-estimate-from-ingredients: + type: number + description: > + An estimate, from the ingredients list + of the percentage of fruits, vegetable + and legumes. + + This is an important information for + Nutri-Score (2023 version) computation. + fruits-vegetables-nuts-estimate-from-ingredients: + type: number + description: > + An estimate, from the ingredients list + of the percentage of fruits, vegetable + and nuts. + + This is an important information for + Nutri-Score (2021 version) computation. + nova-group: + type: integer + nutrition-score-fr: + description: > + Experimental nutrition score derived + from + + the UK FSA score and adapted for the + French market + + (formula defined by the team of + Professor Hercberg). + proteins: + type: number + salt: + type: number + saturated-fat: + type: number + sodium: + type: number + sugars: + type: number + carbon-footprint-from-known-ingredients_product: + type: integer + carbon-footprint-from-known-ingredients_serving: + type: number + erythritol: + type: number + description: > + erythritol is a polyol which is not + providing any energy. + + As such, it needs not be taken into + account when computing + + the energy of a product. Eryhtritol is + now displayed on + + nutrition facts sheet of some products, + mainly in the USA. + + This value is entered either by + contributors, either by + + imports. + example: 12.5 + patternProperties: + '(?[\w-]+)_unit': + description: "The unit in which the nutrient for 100g or per serving is measured.\n\nThe possible values depends on the nutrient.\n\n* `g` for grams\n* `mg` for milligrams\n* `μg` for micrograms\n* `cl` for centiliters\n* `ml` for mililiters\n* `dv` for recommended daily intakes (aka [Dietary Reference Intake](https://en.wikipedia.org/wiki/Dietary_Reference_Intake))\n* `% vol` for alcohol vol per 100 ml\n\n\U0001F913 code: see the [Units module][units-module],\nand [Food:default_unit_for_nid function][default-unit]\n\n[units-module]: https://openfoodfacts.github.io/openfoodfacts-server/dev/ref-perl-pod/ProductOpener/Units.html\n[default-unit]: https://openfoodfacts.github.io/openfoodfacts-server/dev/ref-perl-pod/ProductOpener/Food.html#default_unit_for_nid_(_%24nid)\n" + type: string + enum: + - 公斤 + - 公升 + - kg + - кг + - l + - л + - 毫克 + - mg + - мг + - mcg + - µg + - oz + - fl oz + - dl + - дл + - cl + - кл + - 斤 + - g + - '' + - ' ' + - kj + - 克 + - 公克 + - г + - мл + - ml + - mmol/l + - 毫升 + - '% vol' + - ph + - '%' + - '% dv' + - '% vol (alcohol)' + - iu + - mol/l + - mval/l + - ppm + - �rh + - �fh + - �e + - �dh + - gpg + '(?[\w-]+)_100g': + description: > + The standardized value of a serving of + 100g (or 100ml for liquids) + + for the nutrient. + + + This is computed from the `nutrient` + property, + + the serving size (if needed), and the + `nutrient`_unit field. + + + **Note**: + + If you want to characterize products in + a uniform way, this is the value you + should use. + type: number + readOnly: true + '(?[\w-]+)_serving': + description: > + The standardized value of a serving for + this product. + type: number + readOnly: true + '(?[\w-]+)_value': + description: > + The value input by the user / displayed + on the product for the nutrient. + + + * per 100g or serving, depending on + `nutrition_data_per` + + * in the unit of corresponding + _unit field. + type: number + readOnly: true + '(?[\w-]+)_prepared': + description: > + The value for nutrient for **prepared** + product. + type: number + '(?[\w-]+)_prepared_unit': + description: > + The unit in which the nutrient of + **prepared** product is measured. + type: string + '(?[\w-]+)_prepared_100g': + description: > + The standardized value of a serving of + 100g (or 100ml for liquids) + + for the nutrient, for **prepared** + product. + type: number + readOnly: true + '(?[\w-]+)_prepared_serving': + description: > + The standardized value of a serving for + the **prepared** product. + type: number + readOnly: true + '(?[\w-]+)_prepared_value': + description: > + The standardized value for a serving or + 100g (or 100ml for liquids), + + depending on + `nutrition_data_prepared_per` + + for the nutrient for **prepared** + product. + type: number + readOnly: true + nutriscore_data: + description: > + Detail of data the Nutri-Score was + computed upon. + + + **Note**: this might not be stable, don't + rely too much on this, or, at least, tell + us ! + + + **TODO** document each property + type: object + properties: + energy: + type: integer + energy_points: + type: integer + energy_value: + type: integer + fiber: + type: integer + fiber_points: + type: integer + fiber_value: + type: integer + fruits_vegetables_nuts_colza_walnut_olive_oils: + type: integer + fruits_vegetables_nuts_colza_walnut_olive_oils_points: + type: integer + fruits_vegetables_nuts_colza_walnut_olive_oils_value: + type: integer + grade: + type: string + is_beverage: + type: integer + is_cheese: + type: integer + is_fat: + type: integer + is_water: + type: integer + negative_points: + type: integer + positive_points: + type: integer + proteins: + type: number + proteins_points: + type: integer + proteins_value: + type: number + saturated_fat: + type: number + saturated_fat_points: + type: integer + saturated_fat_ratio: + type: number + saturated_fat_ratio_points: + type: integer + saturated_fat_ratio_value: + type: number + saturated_fat_value: + type: number + score: + type: integer + sodium: + type: number + sodium_points: + type: integer + sodium_value: + type: number + sugars: + type: number + sugars_points: + type: integer + sugars_value: + type: number + nutriscore_grade: + description: > + Nutri-Score for the product as a letter. + + + See + https://world.openfoodfacts.org/nutriscore. + type: string + enum: + - a + - b + - c + - d + - e + nutriscore_score: + description: > + Nutri-Score for the product as an integer + (see also `nutriscore_grade`). + type: integer + nutriscore_score_opposite: + type: integer + nutrition_grade_fr: + type: string + description: > + Nutrition grade (‘a’ to ‘e’), + + https://world.openfoodfacts.org/nutriscore. + nutrition_grades: + description: > + Nutrition grades as a comma separated + list. + + + Some products with multiple components + might have multiple Nutri-Score + type: string + nutrition_grades_tags: + type: array + items: + type: string + nutrition_score_beverage: + type: integer + nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients: + type: integer + nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients_value: + type: integer + nutrition_score_warning_no_fiber: + type: integer + other_nutritional_substances_tags: + type: array + items: + type: object + unknown_nutrients_tags: + type: array + items: + type: object + vitamins_tags: + type: array + items: + type: object + - type: object + description: > + This is data that is linked to products data + quality + properties: + data_quality_bugs_tags: + type: array + items: + type: object + data_quality_errors_tags: + type: array + items: + type: object + data_quality_info_tags: + type: array + items: + type: string + data_quality_tags: + type: array + items: + type: string + data_quality_warnings_tags: + type: array + items: + type: string + data_sources: + type: string + description: | + Source of data imported from producers. + data_sources_tags: + type: array + items: + type: string + last_check_dates_tags: + type: array + items: + type: string + last_checked_t: + type: integer + last_checker: + type: string + states: + description: > + comma separated list of values indicating + some states of the product, + + like things to be done, or to be + completed. + + See [states + taxonomy](https://static.openfoodfacts.net/data/taxonomies/states.json) + type: string + states_hierarchy: + type: array + items: + type: string + states_tags: + type: array + items: + description: > + Each state describe something that is + completed or is to be done or improved + on the product. + + + Refer to [states + taxonomy](https://static.openfoodfacts.net/data/taxonomies/states.json) + type: string + misc_tags: + description: > + Information about different aspect of the + product + type: array + items: + type: string + - type: object + properties: + additives_original_tags: + type: array + items: + type: string + additives_prev_original_tags: + type: array + items: + type: string + added_countries_tags: + type: array + items: + type: object + allergens_from_ingredients: + type: string + allergens_from_user: + type: string + amino_acids_prev_tags: + type: array + items: + type: object + amino_acids_tags: + type: array + items: + type: object + carbon_footprint_percent_of_known_ingredients: + type: integer + categories_properties: + type: object + properties: + 'agribalyse_food_code:en': + type: string + 'agribalyse_proxy_food_code:en': + type: string + 'ciqual_food_code:en': + type: string + categories_properties_tags: + type: array + items: + type: string + category_properties: + type: object + additionalProperties: + description: >- + those are properties taken from the + category taxonomy + type: string + ciqual_food_name_tags: + type: array + items: + type: string + compared_to_category: + type: string + description: | + the category to use for comparison. + + **TODO** explain how it is chosen. + conservation_conditions: + type: string + customer_service: + type: string + description: | + Contact info of customer service. + expiration_date: + type: string + link: + type: string + description: > + link to the product on the website of the + producer + main_countries_tags: + type: array + items: + type: object + minerals_prev_tags: + type: array + items: + type: object + minerals_tags: + type: array + items: + type: object + owner_fields: + type: object + description: > + Those are fields provided by the producer + (through producers platform), + + and the value he provided. + properties: + additionalProperties: + description: > + you can retrieve all kind of properties, + the same as on the parent object (the + product). + + It's not processed entries (like tags + for example) but raw ones. + oneOf: + - type: integer + - type: string + - type: object + nova_groups_markers: + type: object + description: > + Detail of ingredients or processing that + makes the products having Nova 3 or 4 + properties: + '3': + description: | + Markers of level 3 + type: array + items: + type: array + description: > + This array has two element for each + marker. + + One + items: + type: string + '4': + description: | + Markers of level 4 + type: array + items: + $ref: >- + #/properties/nova_groups_markers/properties/3/items + nucleotides_tags: + type: array + items: + type: object + origin: + type: string + purchase_places: + type: string + description: > + Country, state, or city where the product + can be purchased. + example: Paris + purchase_places_tags: + type: array + items: + type: string + stores: + type: string + description: | + Distributor name. + example: Walmart + stores_tags: + type: array + items: + type: string + traces_from_ingredients: + type: string + traces_from_user: + type: string + patternProperties: + conservation_conditions_(?\w\w): + type: string + customer_service_(?\w\w): + type: string + origin_(?\w\w): + type: string + description: > + `origin` in language indicated by + `language_code` + - type: object + description: > + Metadata of a product (author, editors, + creation date, etc.) + properties: + created_t: + type: integer + description: > + Date when the product was added (UNIX + timestamp format). + + See also `entry_dates_tags` + example: | + 1457680652 + creator: + type: string + description: > + The contributor who added the product + first. + editors_tags: + description: | + List of editors who edited the product. + type: array + items: + type: string + informers_tags: + type: array + items: + type: string + interface_version_created: + type: string + interface_version_modified: + type: string + languages: + type: object + patternProperties: + 'en:(?\w\w)': + type: integer + description: | + **TODO** explain ! + languages_codes: + type: object + patternProperties: + (?\w\w): + type: integer + description: > + Same as `languages` but by language code, + instead of language tags + languages_hierarchy: + type: array + items: + type: string + languages_tags: + type: array + items: + type: string + last_edit_dates_tags: + type: array + items: + type: string + last_editor: + type: string + last_modified_by: + type: string + description: > + The username of the user who last modified + the product. + example: sebleouf + last_modified_t: + type: integer + description: > + Date when the product page was last + modified. + owner: + description: > + Id of the producer in case he provides his + own data about a product (producer + platform). + type: string + owners_tags: + description: | + Tagyfied version of owner + type: string + photographers_tags: + type: array + items: + type: string + rev: + description: >- + revision number of this product version + (each edit adds a revision) + type: integer + sources: + type: array + items: + type: object + properties: + fields: + type: array + items: + type: string + id: + type: string + images: + type: array + items: + type: object + import_t: + type: integer + manufacturer: + type: + - integer + - string + name: + type: string + source_licence: + type: string + source_licence_url: + type: string + url: + type: + - 'null' + - string + sources_fields: + type: object + properties: + org-gs1: + type: object + properties: + gln: + type: string + gpcCategoryCode: + type: string + gpcCategoryName: + type: string + isAllergenRelevantDataProvided: + type: string + lastChangeDateTime: + type: string + partyName: + type: string + productionVariantDescription: + type: string + publicationDateTime: + type: string + teams: + type: string + teams_tags: + type: array + items: + type: string + update_key: + type: string + - type: object + description: | + Knowledge panels for a product + properties: + knowledge_panels: + type: object + x-stoplight: + id: bcq3fkbtnwr5t + title: panels + description: >- + The panels object is a dictionary of + individual panel objects. + + Each key of the dictionary is the id of + the panel, and the value is the panel + object. + + + Apps typically display a number of root + panels with known panel ids (e.g. + health_card and environment_card). Panels + can reference other panels and display + them as sub-panels. + examples: + - additionalProperties: string + properties: + additionalProperties: + title: panel + x-stoplight: + id: mj9nhz3mqn05c + type: object + description: >- + Each panel contains an optional title + and an optional array of elements. + properties: + type: + type: string + description: >- + Type of the panel. If set to "card", the + panel and its sub-panels should be + displayed in a card. If set to "inline", + the panel should have its content always + displayed. + expanded: + type: boolean + description: >- + If true, the panel is to be displayed + already expanded. If false, only the + title should be displayed, and the user + should be able to click or tap it to + open the panel and display the elements. + expand_for: + type: string + description: >- + If set to "large", the content of the + panel should be expanded on large + screens, but it should still be possible + to unexpand it. + evaluation: + type: string + description: >- + A simple assessment of the panel value, + typically used to format fonts, et.c + e.g. bad = red + enum: + - good + - average + - neutral + - bad + - unknown + title_element: + title: title_element + x-stoplight: + id: lox0wvl9bdgy2 + type: object + description: The title of a panel. + properties: + name: + type: string + description: >- + A short name of this panel, not + including any actual values + title: + type: string + type: + type: string + enum: + - grade + - percentage + description: >- + Used to indicate how the value of this + item is measured, such as "grade" for + Nutri-Score and Eco-Score or + "percentage" for Salt + grade: + type: string + description: >- + The value for this panel where it + corresponds to a A to E grade such as + the Nutri-Score of the Eco-Score. + enum: + - a + - b + - c + - d + - e + - unknown + value: + type: number + description: >- + The numeric value of the panel, where + the type is "percentage" + icon_url: + type: string + icon_color_from_evaluation: + type: string + icon_size: + type: string + description: > + If set to "small", the icon should be + displayed at a small size. + elements: + type: array + description: >- + An ordered list of elements to display + in the content of the panel. + items: + title: element + x-stoplight: + id: e2ybdrtmx0tme + type: object + description: > + Each element object contains one + specific element object such as a text + element or an image element. + properties: + type: + element_type: string + enum: + - text + - image + - action + - panel + - panel_group + - table + description: > + The type of the included element object. + + The type also indicates which field + contains the included element object. + + e.g. if the type is "text", the included + element object will be in the + "text_element" field. + + + Note that in the future, new type of + element may be added, + + so your code should ignore unrecognized + types, and unknown properties. + + + TODO: add Map type + text_element: + title: text_element + x-stoplight: + id: vdwxlt73qnqfa + type: object + description: >- + A text in simple HTML format to display. + + + For some specific texts that correspond + to a product field (e.g. a product name, + the ingredients list of a product),the + edit_field_* fields are used to indicate + how to edit the field value. + properties: + type: + type: string + description: > + the type of text, might influence the + way you display it. + enum: + - summary + - warning + - notes + html: + type: string + description: Text to display in HTML format. + language: + type: string + description: >- + Language of the text. The name of the + language is returned in the language + requested when making the API call. e.g. + if the text is in Polish, and the + requested language is French, the + language field will contain "Polonais" + (French for "Polish"). Only set for + specific fields such as the list of + ingredients of a product. + lc: + type: string + description: >- + 2 letter language code for the text. + Only set for specific fields such as the + list of ingredients of a product. + edit_field_id: + type: string + description: >- + id of the field used to edit this text + in the product edit API. + edit_field_type: + type: string + description: Type of the product field. + edit_field_value: + type: string + description: >- + Current value of the product field. This + may differ from the html field which can + contain extra formating. + source_url: + type: string + description: Link to the source + example: >- + https://en.wikipedia.org/wiki/Sodium + acetate + source_text: + type: string + description: name of the source + example: Wikipedia + source_lc: + type: string + description: Source locale name + example: en + source_language: + type: string + description: Human readable source locale name + example: English + image_element: + title: image_element + x-stoplight: + id: k4v4kwt489q3j + type: object + properties: + url: + type: string + description: full URL of the image + width: + type: integer + description: > + Width of the image. + + + This is just a suggestion coming from + the server, + + the client may choose to use its own + dimensions for the image. + height: + type: integer + description: > + Height of the image. + + + This is just a suggestion coming from + the server, + + the client may choose to use its own + dimensions for the image. + alt_text: + type: string + description: Alt Text of the image. + action_element: + type: string + panel_element: + title: panel_element + x-stoplight: + id: ymx41elz4yrnj + type: object + description: >- + Panels can include other panels as + sub-panels using the panel_element. + properties: + panel_id: + type: string + description: >- + The id of the panel to include. The id + is the key of the panel in the panels + object returned in the knowledge_panels + field. + panel_group_element: + title: panel_group_element + x-stoplight: + id: b7emlfrgiuue2 + type: object + properties: + title: + type: string + panel_ids: + type: array + description: >- + The ids of the panels to include. The + ids are the keys of the panels in the + panels object returned in the + knowledge_panels field. + items: + type: string + description: >- + The panel group element is used to + display an optional title followed by a + number of sub-panels. + table_element: + title: table_element + x-stoplight: + id: 38zu3z4sruqo7 + type: object + description: Element to display a table. + properties: + id: + type: string + description: An id for the table. + title: + type: string + description: | + Title of the column. + rows: + type: string + columns: + type: array + items: + type: object + properties: + type: + type: string + text: + type: string + text_for_small_screens: + type: string + style: + type: string + column_group_id: + type: string + shown_by_default: + type: boolean + required: + - type + level: + type: string + description: > + a message level, as levels we use in + log. + + It might help theming the panel visualy + example: info + size: + type: string + enum: + - small + description: > + size is either empty (normal display) + + or small to indicate a panel that should + have a smaller font size + example: small + topics: + type: array + items: + type: string + example: health + readOnly: true + - type: object + description: > + Specific data about a product to enable + personal ranking + properties: + attribute_groups: + type: array + description: >- + Each element is an attribute that can help + compute a personal ranking for the product + items: + type: object + properties: + id: + type: string + description: > + Unique id of the attribute. + + + It will be use to match against + preferences parameters. + status: + type: string + enum: + - known + - unknown + description: >- + wether we have the information to really + compute this criteria or not. + title: + type: string + description: > + A descriptive sentence about the + situation of the product concerning + attribute + example: 'Does not contain: Molluscs' + match: + type: number + format: float + minimum: 0 + maximum: 100 + description: > + a numeric value for the match, + + telling how much the products ranks well + for this particular attribute. + + The higher the value, the better the + match. + grade: + description: every attribute as a grade for a to e + type: string + enum: + - unknown + - a + - b + - c + - d + - e + name: + type: string + description: >- + The name of attribute, for eventual + display + icon_url: + type: string + description: >- + an icon representing the attribute match + (often using a color) + description: + type: string + description: >- + An eventual description of the value of + the property upon which this attribute + is based + description_short: + type: string + description: >- + An eventual short description of the + value of the property upon which this + attribute is based + examples: + spread-example: + summary: retrieved values for a well known chocolate and nut spread + value: + code: '3017620422003' + product: + _id: '3017620422003' + _keywords: + - et + - pate + - cacao + - produit + - ferrero + - gluten + - petit-dejeuner + - san + - au + - aux + - sucre + - nutella + abbreviated_product_name: Nutella t.400 + abbreviated_product_name_fr: Nutella t.400 + added_countries_tags: [] + additives_n: 1 + additives_original_tags: + - 'en:e322' + additives_prev_original_tags: + - 'en:e322' + additives_tags: + - 'en:e322' + allergens: 'en:milk,en:nuts,en:soybeans' + allergens_from_ingredients: 'en:nuts, hazelnuts' + allergens_from_user: '(fr) en:milk,en:nuts,en:soybeans' + allergens_hierarchy: + - 'en:milk' + - 'en:nuts' + - 'en:soybeans' + allergens_lc: fr + allergens_tags: + - 'en:milk' + - 'en:nuts' + - 'en:soybeans' + amino_acids_prev_tags: [] + amino_acids_tags: [] + brands: Ferrero + brands_tags: + - ferrero + carbon_footprint_percent_of_known_ingredients: 13 + categories: >- + Produits à tartiner,Petit-déjeuners,Produits à tartiner + sucrés,Pâtes à tartiner,Pâtes à tartiner aux + noisettes,Pâtes à tartiner aux noisettes et au cacao + categories_hierarchy: + - 'en:breakfasts' + - 'en:spreads' + - 'en:sweet-spreads' + - 'en:hazelnut-spreads' + - 'en:chocolate-spreads' + - 'en:cocoa-and-hazelnuts-spreads' + categories_lc: fr + categories_properties: + 'agribalyse_food_code:en': '31032' + 'agribalyse_proxy_food_code:en': '31032' + 'ciqual_food_code:en': '31032' + categories_properties_tags: + - all-products + - categories-known + - agribalyse-food-code-31032 + - agribalyse-food-code-known + - agribalyse-proxy-food-code-31032 + - agribalyse-proxy-food-code-known + - ciqual-food-code-31032 + - ciqual-food-code-known + - agribalyse-known + - agribalyse-31032 + categories_tags: + - 'en:breakfasts' + - 'en:spreads' + - 'en:sweet-spreads' + - 'fr:pates-a-tartiner' + - 'en:hazelnut-spreads' + - 'en:chocolate-spreads' + - 'en:cocoa-and-hazelnuts-spreads' + category_properties: + 'ciqual_food_name:en': Chocolate spread with hazelnuts + checked: 'on' + checkers_tags: + - moon-rabbit + ciqual_food_name_tags: + - chocolate-spread-with-hazelnuts + cities_tags: [] + code: '3017620422003' + codes_tags: + - code-13 + - 3017620422xxx + - 301762042xxxx + - 30176204xxxxx + - 3017620xxxxxx + - 301762xxxxxxx + - 30176xxxxxxxx + - 3017xxxxxxxxx + - 301xxxxxxxxxx + - 30xxxxxxxxxxx + - 3xxxxxxxxxxxx + compared_to_category: 'en:cocoa-and-hazelnuts-spreads' + complete: 0 + completeness: 0.875 + conservation_conditions: >- + A conserver au sec et à l'abri de la chaleur. Ne pas + mettre au réfrigérateur. + conservation_conditions_fr: >- + A conserver au sec et à l'abri de la chaleur. Ne pas + mettre au réfrigérateur. + correctors_tags: + - user1 + - user2 + - user3 + - user4 + countries: >- + en:Algeria Austria Belgium Canada France Germany + Italy Luxembourg Mexico Morocco Netherlands + Portugal Senegal Spain Switzerland Tunisia United + Kingdom United States + countries_beforescanbot: 'Belgium,France' + countries_hierarchy: + - >- + en:Algeria Austria Belgium Canada France Germany + Italy Luxembourg Mexico Morocco Netherlands + Portugal Senegal Spain Switzerland Tunisia United + Kingdom United States + countries_lc: fr + countries_tags: + - >- + en:algeria-austria-belgium-canada-france-germany-italy-luxembourg-mexico-morocco-netherlands-portugal-senegal-spain-switzerland-tunisia-united-kingdom-united-states + created_t: 1457680652 + creator: openfoodfacts-contributors + customer_service: >- + FERRERO FRANCE COMMERCIALE - Service Consommateurs, CS + 90058 - 76136 MONT SAINT AIGNAN Cedex + customer_service_fr: >- + FERRERO FRANCE COMMERCIALE - Service Consommateurs, CS + 90058 - 76136 MONT SAINT AIGNAN Cedex + data_quality_bugs_tags: [] + data_quality_errors_tags: [] + data_quality_info_tags: + - 'en:packaging-data-incomplete' + - 'en:ingredients-percent-analysis-ok' + - 'en:ecoscore-extended-data-computed' + - 'en:ecoscore-extended-data-less-precise-than-agribalyse' + - 'en:food-groups-1-known' + - 'en:food-groups-2-known' + - 'en:food-groups-3-unknown' + data_quality_tags: + - 'en:packaging-data-incomplete' + - 'en:ingredients-percent-analysis-ok' + - 'en:ecoscore-extended-data-computed' + - 'en:ecoscore-extended-data-less-precise-than-agribalyse' + - 'en:food-groups-1-known' + - 'en:food-groups-2-known' + - 'en:food-groups-3-unknown' + - >- + en:ecoscore-origins-of-ingredients-origins-are-100-percent-unknown + - 'en:ecoscore-packaging-unspecified-shape' + - 'en:ecoscore-production-system-no-label' + data_quality_warnings_tags: + - >- + en:ecoscore-origins-of-ingredients-origins-are-100-percent-unknown + - 'en:ecoscore-packaging-unspecified-shape' + - 'en:ecoscore-production-system-no-label' + data_sources: >- + Database - FoodRepo / openfood.ch, Databases, Producer - + Ferrero, Producers, App - yuka, Apps, Producer - + ferrero-france-commerciale, Database - Equadis, Database + - GDSN, App - InFood, App - Open Food Facts, App - + halal-healthy, App - smoothie-openfoodfacts + data_sources_tags: + - database-foodrepo-openfood-ch + - databases + - producer-ferrero + - producers + - app-yuka + - apps + - producer-ferrero-france-commerciale + - database-equadis + - database-gdsn + - app-infood + - app-open-food-facts + - app-halal-healthy + - app-smoothie-openfoodfacts + ecoscore_data: + adjustments: + origins_of_ingredients: + aggregated_origins: + - origin: 'en:unknown' + percent: 100 + epi_score: 0 + epi_value: -5 + origins_from_origins_field: + - 'en:unknown' + transportation_scores: + fr: 0 + 'no': 0 + uk: 0 + us: 0 + world: 0 + transportation_values: + fr: 0 + 'no': 0 + uk: 0 + us: 0 + world: 0 + values: + fr: -5 + 'no': -5 + uk: -5 + us: -5 + world: -5 + warning: origins_are_100_percent_unknown + packaging: + non_recyclable_and_non_biodegradable_materials: 0 + packagings: + - ecoscore_material_score: 81 + ecoscore_shape_ratio: 1 + material: 'en:clear-glass' + shape: 'en:unknown' + score: 81 + value: -2 + warning: unspecified_shape + production_system: + labels: [] + value: 0 + warning: no_label + threatened_species: + ingredient: 'en:palm-oil' + value: -10 + agribalyse: + agribalyse_food_code: '31032' + co2_agriculture: 8.7770996 + co2_consumption: 0 + co2_distribution: 0.014104999 + co2_packaging: 0.18864842 + co2_processing: 0.69167973 + co2_total: 9.8742343 + co2_transportation: 0.19708507 + code: '31032' + dqr: '2.54' + ef_agriculture: 0.61477708 + ef_consumption: 0 + ef_distribution: 0.0045906531 + ef_packaging: 0.020453714 + ef_processing: 0.085674643 + ef_total: 0.74366703 + ef_transportation: 0.017824104 + is_beverage: 0 + name_en: Chocolate spread with hazelnuts + name_fr: Pâte à tartiner chocolat et noisette + score: 40 + grade: d + grades: + fr: d + 'no': d + uk: d + us: d + world: d + missing: + labels: 1 + origins: 1 + packagings: 1 + missing_data_warning: 1 + score: 23 + scores: + fr: 23 + 'no': 23 + uk: 23 + us: 23 + world: 23 + status: known + ecoscore_extended_data: + impact: + ef_single_score_log_stddev: 0.0539895633164057 + likeliest_impacts: + Climate_change: 0.172717449218484 + EF_single_score: 0.023255035815491 + likeliest_recipe: + 'en:emulsifier': 0.388589430098073 + 'en:hazelnut_oil': 12.806852015349 + 'en:palm_oil': 16.6103749736231 + 'en:sugar': 52.9709312507153 + 'en:water': 4.90093151221936 + 'fr:Cacao_Maigre_7': 3.94056985087663 + 'fr:Lait__cr_m__En_Poudre_8': 6.8959972390341 + mass_ratio_uncharacterized: 0.11 + uncharacterized_ingredients: + impact: + - 'fr:Lait Écrémé En Poudre 8' + - 'fr:Cacao Maigre 7' + nutrition: + - 'fr:Lait Écrémé En Poudre 8' + - 'fr:Cacao Maigre 7' + uncharacterized_ingredients_mass_proportion: + impact: 0.11 + nutrition: 0.11 + uncharacterized_ingredients_ratio: + impact: 0.333333333333333 + nutrition: 0.333333333333333 + warnings: + - >- + The product has a high number of nutrition + uncharacterized ingredients: 33% + - >- + The product has a high number of impact + uncharacterized ingredients: 33% + - >- + The estimated mass of nutrition uncharacterized + ingredients in the product is high: 11% + - >- + The estimated mass of impact uncharacterized + ingredients in the product is high: 11% + ecoscore_extended_data_version: '4' + ecoscore_grade: d + ecoscore_score: 23 + ecoscore_tags: + - d + editors_tags: + - user1 + - user2 + - user3 + - user4 + emb_codes: '' + emb_codes_20141016: '' + emb_codes_orig: '' + emb_codes_tags: [] + entry_dates_tags: + - '2016-03-11' + - 2016-03 + - '2016' + environment_impact_level: '' + environment_impact_level_tags: [] + expiration_date: 09/2021 + food_groups: 'en:sweets' + food_groups_tags: + - 'en:sugary-snacks' + - 'en:sweets' + fruits-vegetables-nuts_100g_estimate: 0 + generic_name: '' + generic_name_ar: نوتلا + generic_name_de: Nuss-Nougat-Creme + generic_name_en: '' + generic_name_es: Crema de Avellanas con cacao + generic_name_fr: Pâte à tartiner aux noisettes + generic_name_id: '' + generic_name_it: Nutella + generic_name_nl: '' + grades: {} + id: '3017620422003' + image_front_small_url: >- + https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.200.jpg + image_front_thumb_url: >- + https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.100.jpg + image_front_url: >- + https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.400.jpg + image_nutrition_small_url: >- + https://images.openfoodfacts.org/images/products/301/762/042/2003/nutrition_en.400.200.jpg + image_nutrition_thumb_url: >- + https://images.openfoodfacts.org/images/products/301/762/042/2003/nutrition_en.400.100.jpg + image_nutrition_url: >- + https://images.openfoodfacts.org/images/products/301/762/042/2003/nutrition_en.400.400.jpg + image_small_url: >- + https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.200.jpg + image_thumb_url: >- + https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.100.jpg + image_url: >- + https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.400.jpg + images: + '1': + sizes: + '100': + h: 100 + w: 56 + '400': + h: 400 + w: 225 + full: + h: 2000 + w: 1125 + uploaded_t: '1457680652' + uploader: openfoodfacts-contributors + '2': + sizes: + '100': + h: 100 + w: 75 + '400': + h: 400 + w: 300 + full: + h: 3264 + w: 2448 + uploaded_t: '1462829284' + uploader: openfoodfacts-contributors + '3': + sizes: + '100': + h: 100 + w: 56 + '400': + h: 400 + w: 225 + full: + h: 2000 + w: 1125 + uploaded_t: '1468510986' + uploader: user3 + front_en: + angle: '0' + coordinates_image_size: full + geometry: 0x0-0-0 + imgid: '1' + normalize: 'false' + rev: '399' + sizes: + '100': + h: 100 + w: 77 + '200': + h: 200 + w: 155 + '400': + h: 400 + w: 310 + full: + h: 1808 + w: 1400 + white_magic: 'false' + x1: '0' + x2: '0' + y1: '0' + y2: '0' + front_fr: + angle: 0 + coordinates_image_size: '400' + geometry: 0x0--5--5 + imgid: '2' + normalize: 'false' + rev: '415' + sizes: + '100': + h: 100 + w: 77 + '200': + h: 200 + w: 155 + '400': + h: 400 + w: 310 + full: + h: 1808 + w: 1400 + white_magic: 'false' + x1: '-1' + x2: '-1' + y1: '-1' + y2: '-1' + ingredients_fr: + angle: null + coordinates_image_size: '400' + geometry: 0x0-0-0 + imgid: '3' + normalize: null + rev: '299' + sizes: + '100': + h: 16 + w: 100 + '200': + h: 33 + w: 200 + '400': + h: 65 + w: 400 + full: + h: 334 + w: 2046 + white_magic: null + x1: null + x2: null + y1: null + y2: null + nutrition_en: + angle: '0' + coordinates_image_size: full + geometry: 0x0-0-0 + imgid: '3' + normalize: 'false' + rev: '400' + sizes: + '100': + h: 100 + w: 96 + '200': + h: 200 + w: 192 + '400': + h: 400 + w: 383 + full: + h: 572 + w: 548 + white_magic: 'false' + x1: '0' + x2: '0' + y1: '0' + y2: '0' + packaging_fr: + angle: 0 + coordinates_image_size: full + geometry: 0x0--1--1 + imgid: '3' + normalize: null + rev: '420' + sizes: + '100': + h: 31 + w: 100 + '200': + h: 61 + w: 200 + '400': + h: 122 + w: 400 + full: + h: 638 + w: 2084 + white_magic: null + x1: '-1' + x2: '-1' + y1: '-1' + y2: '-1' + informers_tags: + - user1 + - user2 + - user3 + - user4 + ingredients: + - id: 'en:sugar' + percent_estimate: 46.5 + percent_max: 63 + percent_min: 30 + text: sugar + vegan: 'yes' + vegetarian: 'yes' + - from_palm_oil: 'yes' + id: 'en:palm-oil' + percent_estimate: 25.5 + percent_max: 38 + percent_min: 13 + text: palm oil + vegan: 'yes' + vegetarian: 'yes' + - id: 'en:hazelnut' + percent: 13 + percent_estimate: 13 + percent_max: 13 + percent_min: 13 + text: hazelnuts + vegan: 'yes' + vegetarian: 'yes' + - id: 'en:skim-milk-powder-8' + percent: 7 + percent_estimate: 7 + percent_max: 7 + percent_min: 7 + text: skim milk powder 8 + - id: 'en:lean-cocoa-7' + percent: 4 + percent_estimate: 4 + percent_max: 4 + percent_min: 4 + text: lean cocoa 7 + - id: 'en:emulsifier' + ingredients: + - id: 'en:soya-lecithin' + percent_estimate: 2 + percent_max: 4 + percent_min: 0 + text: soy lecithins + vegan: 'yes' + vegetarian: 'yes' + percent_estimate: 2 + percent_max: 4 + percent_min: 0 + text: emulsifiers + - id: 'en:vanillin' + percent_estimate: 2 + percent_max: 4 + percent_min: 0 + text: vanillin + ingredients_analysis: + 'en:palm-oil': + - 'en:palm-oil' + 'en:vegan-status-unknown': + - 'en:skim-milk-powder-8' + - 'en:lean-cocoa-7' + - 'en:vanillin' + 'en:vegetarian-status-unknown': + - 'en:skim-milk-powder-8' + - 'en:lean-cocoa-7' + - 'en:vanillin' + ingredients_analysis_tags: + - 'en:palm-oil' + - 'en:vegan-status-unknown' + - 'en:vegetarian-status-unknown' + ingredients_from_or_that_may_be_from_palm_oil_n: 0 + ingredients_from_palm_oil_n: 0 + ingredients_from_palm_oil_tags: [] + ingredients_hierarchy: + - 'en:sugar' + - 'en:added-sugar' + - 'en:disaccharide' + - 'en:palm-oil' + - 'en:oil-and-fat' + - 'en:vegetable-oil-and-fat' + - 'en:palm-oil-and-fat' + - 'en:hazelnut' + - 'en:nut' + - 'en:tree-nut' + - 'en:skim-milk-powder-8' + - 'en:lean-cocoa-7' + - 'en:emulsifier' + - 'en:vanillin' + - 'en:soya-lecithin' + - 'en:e322' + - 'en:e322i' + ingredients_n: 8 + ingredients_n_tags: + - '8' + - 1-10 + ingredients_original_tags: + - 'en:sugar' + - 'en:palm-oil' + - 'en:hazelnut' + - 'en:skim-milk-powder-8' + - 'en:lean-cocoa-7' + - 'en:emulsifier' + - 'en:vanillin' + - 'en:soya-lecithin' + ingredients_percent_analysis: 1 + ingredients_tags: + - 'en:sugar' + - 'en:added-sugar' + - 'en:disaccharide' + - 'en:palm-oil' + - 'en:oil-and-fat' + - 'en:vegetable-oil-and-fat' + - 'en:palm-oil-and-fat' + - 'en:hazelnut' + - 'en:nut' + - 'en:tree-nut' + - 'en:skim-milk-powder-8' + - 'en:lean-cocoa-7' + - 'en:emulsifier' + - 'en:vanillin' + - 'en:soya-lecithin' + - 'en:e322' + - 'en:e322i' + ingredients_text: >- + sugar, palm oil, hazelnuts 13%, skim milk powder 8, 7%, + lean cocoa 7, 4%, emulsifiers: soy lecithins, vanillin + ingredients_text_en: >- + sugar, palm oil, hazelnuts 13%, skim milk powder 8, 7%, + lean cocoa 7, 4%, emulsifiers: soy lecithins, vanillin + ingredients_text_fr: >- + Sucre, huile de palme, _NOISETTES_ 13%, _LAIT_ écrémé en + poudre 8,7%, cacao maigre 7,4%, émulsifiants: lécithine + [SOJA]; vanilline. Sans gluten + ingredients_text_with_allergens: >- + sugar, palm oil, hazelnuts 13%, skim milk powder + 8, 7%, lean cocoa 7, 4%, emulsifiers: soy lecithins, + vanillin + ingredients_text_with_allergens_en: >- + sugar, palm oil, hazelnuts 13%, skim milk powder + 8, 7%, lean cocoa 7, 4%, emulsifiers: soy lecithins, + vanillin + ingredients_text_with_allergens_fr: >- + Sucre, huile de palme, NOISETTES 13%, LAIT écrémé en poudre 8,7%, + cacao maigre 7,4%, émulsifiants: lécithine [SOJA]; vanilline. Sans gluten + ingredients_that_may_be_from_palm_oil_n: 0 + ingredients_that_may_be_from_palm_oil_tags: [] + ingredients_with_specified_percent_n: 3 + ingredients_with_specified_percent_sum: 24 + ingredients_with_unspecified_percent_n: 4 + ingredients_with_unspecified_percent_sum: 76 + interface_version_created: '20120622' + interface_version_modified: 20150316.jqm2 + known_ingredients_n: 15 + labels: 'Sans gluten,en:nonorganic' + labels_hierarchy: + - 'en:no-gluten' + - 'en:nonorganic' + labels_lc: fr + labels_tags: + - 'en:no-gluten' + - 'en:nonorganic' + lang: en + languages: + 'en:arabic': 2 + 'en:english': 4 + 'en:french': 10 + 'en:german': 3 + 'en:italian': 3 + 'en:spanish': 7 + languages_codes: + en: 4 + fr: 10 + languages_hierarchy: + - 'en:english' + - 'en:french' + languages_tags: + - 'en:english' + - 'en:french' + - 'en:multilingual' + last_check_dates_tags: + - '2021-07-21' + - 2021-07 + - '2021' + last_checked_t: 1626872806 + last_checker: user3 + last_edit_dates_tags: + - '2022-07-29' + - 2022-07 + - '2022' + last_editor: user4 + last_image_dates_tags: + - '2022-07-29' + - 2022-07 + - '2022' + last_image_t: 1659084293 + last_modified_by: user4 + last_modified_t: 1659084329 + lc: en + link: '' + main_countries_tags: [] + manufacturing_places: '' + manufacturing_places_tags: [] + max_imgid: '121' + minerals_prev_tags: [] + minerals_tags: [] + misc_tags: + - 'en:nutrition-no-fiber' + - >- + en:nutrition-fruits-vegetables-nuts-estimate-from-ingredients + - 'en:nutrition-no-fiber-or-fruits-vegetables-nuts' + - 'en:nutriscore-computed' + - 'en:ecoscore-extended-data-computed' + - 'en:ecoscore-extended-data-version-4' + - 'en:ecoscore-missing-data-warning' + - 'en:ecoscore-missing-data-labels' + - 'en:ecoscore-missing-data-origins' + - 'en:ecoscore-missing-data-packagings' + - 'en:ecoscore-computed' + no_nutrition_data: 'null' + nova_group: 4 + nova_groups: '4' + nova_groups_markers: + '3': + - - ingredients + - 'en:sugar' + '4': + - - additives + - 'en:e322' + - - ingredients + - 'en:emulsifier' + nova_groups_tags: + - 'en:4-ultra-processed-food-and-drink-products' + nucleotides_prev_tags: [] + nucleotides_tags: [] + nutrient_levels: + fat: high + salt: low + saturated-fat: high + sugars: high + nutrient_levels_tags: + - 'en:fat-in-high-quantity' + - 'en:saturated-fat-in-high-quantity' + - 'en:sugars-in-high-quantity' + - 'en:salt-in-low-quantity' + nutriments: + alcohol: 0 + alcohol_100g: 0 + alcohol_serving: 0 + alcohol_unit: '% vol' + alcohol_value: 0 + carbohydrates: 57.5 + carbohydrates_100g: 57.5 + carbohydrates_serving: 8.62 + carbohydrates_unit: g + carbohydrates_value: 57.5 + carbon-footprint-from-known-ingredients_product: 135 + carbon-footprint-from-known-ingredients_serving: 5.07 + energy: 2252 + energy-kcal: 539 + energy-kcal_100g: 539 + energy-kcal_serving: 80.8 + energy-kcal_unit: kcal + energy-kcal_value: 539 + energy-kj: 2252 + energy-kj_100g: 2252 + energy-kj_serving: 338 + energy-kj_unit: kJ + energy-kj_value: 2252 + energy_100g: 2252 + energy_serving: 338 + energy_unit: kJ + energy_value: 2252 + fat: 30.9 + fat_100g: 30.9 + fat_serving: 4.63 + fat_unit: g + fat_value: 30.9 + fruits-vegetables-nuts-estimate-from-ingredients_100g: 13 + fruits-vegetables-nuts-estimate-from-ingredients_serving: 13 + nova-group: 4 + nova-group_100g: 4 + nova-group_serving: 4 + nutrition-score-fr: 26 + nutrition-score-fr_100g: 26 + proteins: 6.3 + proteins_100g: 6.3 + proteins_serving: 0.945 + proteins_unit: g + proteins_value: 6.3 + salt: 0.107 + salt_100g: 0.107 + salt_serving: 0.016 + salt_unit: g + salt_value: 0.107 + saturated-fat: 10.6 + saturated-fat_100g: 10.6 + saturated-fat_serving: 1.59 + saturated-fat_unit: g + saturated-fat_value: 10.6 + sodium: 0.0428 + sodium_100g: 0.0428 + sodium_serving: 0.00642 + sodium_unit: g + sodium_value: 0.0428 + sugars: 56.3 + sugars_100g: 56.3 + sugars_serving: 8.44 + sugars_unit: g + sugars_value: 56.3 + nutriscore_data: + energy: 2252 + energy_points: 6 + energy_value: 2252 + fiber: 0 + fiber_points: 0 + fiber_value: 0 + fruits_vegetables_nuts_colza_walnut_olive_oils: 13 + fruits_vegetables_nuts_colza_walnut_olive_oils_points: 0 + fruits_vegetables_nuts_colza_walnut_olive_oils_value: 13 + grade: e + is_beverage: 0 + is_cheese: 0 + is_fat: 0 + is_water: 0 + negative_points: 26 + positive_points: 0 + proteins: 6.3 + proteins_points: 3 + proteins_value: 6.3 + saturated_fat: 10.6 + saturated_fat_points: 10 + saturated_fat_ratio: 34.3042071197411 + saturated_fat_ratio_points: 5 + saturated_fat_ratio_value: 34.3 + saturated_fat_value: 10.6 + score: 26 + sodium: 42.8 + sodium_points: 0 + sodium_value: 42.8 + sugars: 56.3 + sugars_points: 10 + sugars_value: 56.3 + nutriscore_grade: e + nutriscore_score: 26 + nutriscore_score_opposite: -26 + nutrition_data: 'on' + nutrition_data_per: 100g + nutrition_data_prepared: '' + nutrition_data_prepared_per: 100g + nutrition_grade_fr: e + nutrition_grades: e + nutrition_grades_tags: + - e + nutrition_score_beverage: 0 + nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients: 1 + nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients_value: 13 + nutrition_score_warning_no_fiber: 1 + obsolete: '' + obsolete_since_date: '' + origin: '' + origins: '' + origins_hierarchy: [] + origins_lc: fr + origins_tags: [] + other_nutritional_substances_tags: [] + owner: org-ferrero-france-commerciale + owners_tags: org-ferrero-france-commerciale + packaging: >- + PP 5 Ummi PLASTIQUE / PLASTIEK PAP 27 WWW PAPIER / + PAPIER CIPAP 82 PANNEAU DE FIBRE COMPOSITES/ COMPOSIET + VEZELPLAAT GL 70 VERRE / GLAS + packaging_hierarchy: + - >- + fr:PP 5 Ummi PLASTIQUE / PLASTIEK PAP 27 WWW PAPIER / + PAPIER CIPAP 82 PANNEAU DE FIBRE COMPOSITES/ COMPOSIET + VEZELPLAAT GL 70 VERRE / GLAS + packaging_lc: fr + packaging_tags: + - >- + fr:pp-5-ummi-plastique-plastiek-pap-27-www-papier-papier-cipap-82-panneau-de-fibre-composites-composiet-vezelplaat-gl-70-verre-glas + packaging_text: '' + packaging_text_ar: '' + packaging_text_de: '' + packaging_text_en: '' + packaging_text_es: 'Pot en verre, couvercle en plastique.' + packaging_text_fr: "1 couvercle plastique blanc opaque PP à jeter,\r\n1 plaque en carton PAP 21 à recycler,\r\n1 opercule en carton C/PAP 82 à recycler,\r\n1 pot en verre à recycler" + packaging_text_id: '' + packaging_text_it: '' + packaging_text_nl: '' + packagings: + - material: 'en:clear-glass' + photographers_tags: + - user1 + - user2 + - user3 + - user4 + pnns_groups_1: Sugary snacks + pnns_groups_1_tags: + - sugary-snacks + - known + pnns_groups_2: Sweets + pnns_groups_2_tags: + - sweets + - known + popularity_key: 20999992556 + popularity_tags: + - top-10-scans-2021 + - top-50-scans-2021 + - top-100-scans-2021 + - top-500-scans-2021 + - top-1000-scans-2021 + - top-5000-scans-2021 + - top-10000-scans-2021 + - top-50000-scans-2021 + - top-100000-scans-2021 + - top-10-fr-scans-2021 + - top-50-fr-scans-2021 + - top-100-fr-scans-2021 + - top-500-fr-scans-2021 + - top-1000-fr-scans-2021 + - top-5000-fr-scans-2021 + - top-10000-fr-scans-2021 + - top-50000-fr-scans-2021 + - top-100000-fr-scans-2021 + - top-country-fr-scans-2021 + - at-least-5-fr-scans-2021 + - at-least-10-fr-scans-2021 + product_name: Nutella + product_name_ar: نوتيلا + product_name_de: Nutella + product_name_en: Nutella + product_name_es: Nutella + product_name_fr: Pâte à tartiner Nutella noisettes et cacao - 400g + product_name_id: '' + product_name_it: Nutella + product_name_nl: '' + product_quantity: '400' + purchase_places: F - 77480 Mousseaux les Bray France + purchase_places_tags: + - f-77480-mousseaux-les-bray-france + quantity: 400g + removed_countries_tags: [] + rev: 421 + scans_n: 3713 + scores: {} + selected_images: + front: + display: + en: >- + https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.400.jpg + fr: >- + https://images.openfoodfacts.org/images/products/301/762/042/2003/front_fr.415.400.jpg + small: + en: >- + https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.200.jpg + fr: >- + https://images.openfoodfacts.org/images/products/301/762/042/2003/front_fr.415.200.jpg + thumb: + en: >- + https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.100.jpg + fr: >- + https://images.openfoodfacts.org/images/products/301/762/042/2003/front_fr.415.100.jpg + ingredients: + display: + fr: >- + https://images.openfoodfacts.org/images/products/301/762/042/2003/ingredients_fr.299.400.jpg + small: + fr: >- + https://images.openfoodfacts.org/images/products/301/762/042/2003/ingredients_fr.299.200.jpg + thumb: + fr: >- + https://images.openfoodfacts.org/images/products/301/762/042/2003/ingredients_fr.299.100.jpg + nutrition: + display: + en: >- + https://images.openfoodfacts.org/images/products/301/762/042/2003/nutrition_en.400.400.jpg + small: + en: >- + https://images.openfoodfacts.org/images/products/301/762/042/2003/nutrition_en.400.200.jpg + thumb: + en: >- + https://images.openfoodfacts.org/images/products/301/762/042/2003/nutrition_en.400.100.jpg + packaging: + display: + fr: >- + https://images.openfoodfacts.org/images/products/301/762/042/2003/packaging_fr.420.400.jpg + small: + fr: >- + https://images.openfoodfacts.org/images/products/301/762/042/2003/packaging_fr.420.200.jpg + thumb: + fr: >- + https://images.openfoodfacts.org/images/products/301/762/042/2003/packaging_fr.420.100.jpg + serving_quantity: '15' + serving_size: 15g + sortkey: 1610877517 + sources: + - fields: + - product_name_de + - product_name_it + - brands + - countries + id: openfood-ch + images: [] + import_t: 1548767279 + manufacturer: '0' + name: FoodRepo + source_licence: >- + Creative Commons Attribution 4.0 International + License + source_licence_url: 'https://creativecommons.org/licenses/by/4.0/' + url: 'https://www.foodrepo.org/ch/products/19413' + - fields: + - packaging + - ingredients_text_fr + id: ferrero + images: [] + import_t: 1552318840 + manufacturer: '1' + name: Ferrero + url: 'https://www.ferrero.fr' + sources_fields: + org-gs1: + gln: '3010176200101' + gpcCategoryCode: '10000187' + gpcCategoryName: Pâtes à Tartiner Sucrées (Longue Conservation) + isAllergenRelevantDataProvided: 'true' + lastChangeDateTime: '2022-07-13T16:01:41+02:00' + partyName: FERRERO FRANCE COMMERCIALE + productionVariantDescription: '2014' + publicationDateTime: '2022-07-13T16:01:41+02:00' + states: >- + en:to-be-completed, en:nutrition-facts-completed, + en:ingredients-completed, en:expiration-date-completed, + en:packaging-code-to-be-completed, + en:characteristics-to-be-completed, + en:origins-to-be-completed, en:categories-completed, + en:brands-completed, en:packaging-completed, + en:quantity-completed, en:product-name-completed, + en:photos-to-be-validated, + en:packaging-photo-to-be-selected, + en:nutrition-photo-selected, + en:ingredients-photo-to-be-selected, + en:front-photo-selected, en:photos-uploaded + states_hierarchy: + - 'en:to-be-completed' + - 'en:nutrition-facts-completed' + - 'en:ingredients-completed' + - 'en:expiration-date-completed' + - 'en:packaging-code-to-be-completed' + - 'en:characteristics-to-be-completed' + - 'en:origins-to-be-completed' + - 'en:categories-completed' + - 'en:brands-completed' + - 'en:packaging-completed' + - 'en:quantity-completed' + - 'en:product-name-completed' + - 'en:photos-to-be-validated' + - 'en:packaging-photo-to-be-selected' + - 'en:nutrition-photo-selected' + - 'en:ingredients-photo-to-be-selected' + - 'en:front-photo-selected' + - 'en:photos-uploaded' + states_tags: + - 'en:to-be-completed' + - 'en:nutrition-facts-completed' + - 'en:ingredients-completed' + - 'en:expiration-date-completed' + - 'en:packaging-code-to-be-completed' + - 'en:characteristics-to-be-completed' + - 'en:origins-to-be-completed' + - 'en:categories-completed' + - 'en:brands-completed' + - 'en:packaging-completed' + - 'en:quantity-completed' + - 'en:product-name-completed' + - 'en:photos-to-be-validated' + - 'en:packaging-photo-to-be-selected' + - 'en:nutrition-photo-selected' + - 'en:ingredients-photo-to-be-selected' + - 'en:front-photo-selected' + - 'en:photos-uploaded' + stores: >- + Bi1 Magasins U Carrefour Franprix Auchan Casino + Intermarché,carrefour.fr + stores_tags: + - >- + bi1-magasins-u-carrefour-franprix-auchan-casino-intermarche + - carrefour-fr + teams: >- + pain-au-chocolat,shark-attack,stakano,chocolatine,la-robe-est-bleue,vegan,m,b,c,vegancheck + teams_tags: + - pain-au-chocolat + - shark-attack + - stakano + - chocolatine + - la-robe-est-bleue + - vegan + - m + - b + - c + - vegancheck + traces: '' + traces_from_ingredients: '' + traces_from_user: '(fr) ' + traces_hierarchy: [] + traces_lc: fr + traces_tags: [] + unique_scans_n: 2544 + unknown_ingredients_n: 2 + unknown_nutrients_tags: [] + update_key: ing20220322 + vitamins_prev_tags: [] + vitamins_tags: [] + status: 1 + status_verbose: product found + description: | + A product can be fetched via its unique barcode. + It returns all the details of that product response. + operationId: get-product-by-barcode + '/api/v2/product/{barcode}?fields=knowledge_panels': + get: + tags: + - Read Requests + summary: | + Get Knowledge panels for a specific product by barcode + (special case of get product) + parameters: + - name: barcode + in: path + description: | + The barcode of the product to be fetched + required: true + style: simple + explode: false + schema: + type: string + example: '3017620422003' + responses: + '200': + description: OK + content: + application/json: + schema: + allOf: + - type: object + x-stoplight: + id: s4gz59htj4gc3 + properties: + code: + type: string + description: > + Barcode of the product + + (can be EAN-13 or internal codes for some food + stores). + + For products without a barcode, Open Food Facts + assigns a + + number starting with the 200 reserved prefix. + status: + type: integer + status_verbose: + type: string + - type: object + properties: + product: + type: object + description: | + Knowledge panels for a product + properties: + knowledge_panels: + type: object + x-stoplight: + id: bcq3fkbtnwr5t + title: panels + description: >- + The panels object is a dictionary of individual + panel objects. + + Each key of the dictionary is the id of the panel, + and the value is the panel object. + + + Apps typically display a number of root panels + with known panel ids (e.g. health_card and + environment_card). Panels can reference other + panels and display them as sub-panels. + examples: + - additionalProperties: string + properties: + additionalProperties: + title: panel + x-stoplight: + id: mj9nhz3mqn05c + type: object + description: >- + Each panel contains an optional title and an + optional array of elements. + properties: + type: + type: string + description: >- + Type of the panel. If set to "card", the + panel and its sub-panels should be + displayed in a card. If set to "inline", + the panel should have its content always + displayed. + expanded: + type: boolean + description: >- + If true, the panel is to be displayed + already expanded. If false, only the title + should be displayed, and the user should + be able to click or tap it to open the + panel and display the elements. + expand_for: + type: string + description: >- + If set to "large", the content of the + panel should be expanded on large screens, + but it should still be possible to + unexpand it. + evaluation: + type: string + description: >- + A simple assessment of the panel value, + typically used to format fonts, et.c e.g. + bad = red + enum: + - good + - average + - neutral + - bad + - unknown + title_element: + title: title_element + x-stoplight: + id: lox0wvl9bdgy2 + type: object + description: The title of a panel. + properties: + name: + type: string + description: >- + A short name of this panel, not + including any actual values + title: + type: string + type: + type: string + enum: + - grade + - percentage + description: >- + Used to indicate how the value of this + item is measured, such as "grade" for + Nutri-Score and Eco-Score or + "percentage" for Salt + grade: + type: string + description: >- + The value for this panel where it + corresponds to a A to E grade such as + the Nutri-Score of the Eco-Score. + enum: + - a + - b + - c + - d + - e + - unknown + value: + type: number + description: >- + The numeric value of the panel, where + the type is "percentage" + icon_url: + type: string + icon_color_from_evaluation: + type: string + icon_size: + type: string + description: > + If set to "small", the icon should be + displayed at a small size. + elements: + type: array + description: >- + An ordered list of elements to display in + the content of the panel. + items: + title: element + x-stoplight: + id: e2ybdrtmx0tme + type: object + description: > + Each element object contains one + specific element object such as a text + element or an image element. + properties: + type: + element_type: string + enum: + - text + - image + - action + - panel + - panel_group + - table + description: > + The type of the included element object. + + The type also indicates which field + contains the included element object. + + e.g. if the type is "text", the included + element object will be in the + "text_element" field. + + + Note that in the future, new type of + element may be added, + + so your code should ignore unrecognized + types, and unknown properties. + + + TODO: add Map type + text_element: + title: text_element + x-stoplight: + id: vdwxlt73qnqfa + type: object + description: >- + A text in simple HTML format to display. + + + For some specific texts that correspond + to a product field (e.g. a product name, + the ingredients list of a product),the + edit_field_* fields are used to indicate + how to edit the field value. + properties: + type: + type: string + description: > + the type of text, might influence the + way you display it. + enum: + - summary + - warning + - notes + html: + type: string + description: Text to display in HTML format. + language: + type: string + description: >- + Language of the text. The name of the + language is returned in the language + requested when making the API call. e.g. + if the text is in Polish, and the + requested language is French, the + language field will contain "Polonais" + (French for "Polish"). Only set for + specific fields such as the list of + ingredients of a product. + lc: + type: string + description: >- + 2 letter language code for the text. + Only set for specific fields such as the + list of ingredients of a product. + edit_field_id: + type: string + description: >- + id of the field used to edit this text + in the product edit API. + edit_field_type: + type: string + description: Type of the product field. + edit_field_value: + type: string + description: >- + Current value of the product field. This + may differ from the html field which can + contain extra formating. + source_url: + type: string + description: Link to the source + example: >- + https://en.wikipedia.org/wiki/Sodium + acetate + source_text: + type: string + description: name of the source + example: Wikipedia + source_lc: + type: string + description: Source locale name + example: en + source_language: + type: string + description: Human readable source locale name + example: English + image_element: + title: image_element + x-stoplight: + id: k4v4kwt489q3j + type: object + properties: + url: + type: string + description: full URL of the image + width: + type: integer + description: > + Width of the image. + + + This is just a suggestion coming from + the server, + + the client may choose to use its own + dimensions for the image. + height: + type: integer + description: > + Height of the image. + + + This is just a suggestion coming from + the server, + + the client may choose to use its own + dimensions for the image. + alt_text: + type: string + description: Alt Text of the image. + action_element: + type: string + panel_element: + title: panel_element + x-stoplight: + id: ymx41elz4yrnj + type: object + description: >- + Panels can include other panels as + sub-panels using the panel_element. + properties: + panel_id: + type: string + description: >- + The id of the panel to include. The id + is the key of the panel in the panels + object returned in the knowledge_panels + field. + panel_group_element: + title: panel_group_element + x-stoplight: + id: b7emlfrgiuue2 + type: object + properties: + title: + type: string + panel_ids: + type: array + description: >- + The ids of the panels to include. The + ids are the keys of the panels in the + panels object returned in the + knowledge_panels field. + items: + type: string + description: >- + The panel group element is used to + display an optional title followed by a + number of sub-panels. + table_element: + title: table_element + x-stoplight: + id: 38zu3z4sruqo7 + type: object + description: Element to display a table. + properties: + id: + type: string + description: An id for the table. + title: + type: string + description: | + Title of the column. + rows: + type: string + columns: + type: array + items: + type: object + properties: + type: + type: string + text: + type: string + text_for_small_screens: + type: string + style: + type: string + column_group_id: + type: string + shown_by_default: + type: boolean + required: + - type + level: + type: string + description: | + a message level, as levels we use in log. + It might help theming the panel visualy + example: info + size: + type: string + enum: + - small + description: > + size is either empty (normal display) + + or small to indicate a panel that should + have a smaller font size + example: small + topics: + type: array + items: + type: string + example: health + readOnly: true + description: | + Knowledge panels gives high leve informations about a product, + ready to display. + This is used by open food facts website, + and by the official mobile application + operationId: get-product-by-barcode-knowledge-panels + /cgi/product_image_upload.pl: + post: + tags: + - Write Requests + summary: Add a Photo to an Existing Product + operationId: get-cgi-product_image_upload.pl + description: | + Photos are source and proof of data. + The first photo uploaded for a product is + auto-selected as the product’s “front” photo.' + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + files: + type: array + items: + type: object + properties: + url: + type: string + example: /product/3017620422003/nutella-ferrero + filename: + type: string + example: '' + name: + type: string + example: Nutella - Ferrero - 400g + thumbnailUrl: + type: string + example: /images/products/301/762/042/2003/123.100.jpg + code: + type: string + example: '3017620422003' + image: + type: object + properties: + thumb_url: + type: string + example: 123.100.jpg + imgid: + type: integer + example: 123 + crop_url: + type: string + example: 123.400.jpg + imgid: + type: integer + example: 123 + status: + type: string + example: status ok + imagefield: + type: string + example: front_en + code: + type: string + example: '3017620422003' + requestBody: + content: + multipart/form-data: + schema: + type: object + properties: + code: + type: string + description: | + Barcode of the product + example: '3017620422003' + imagefield: + type: string + description: > + Indicates the type of the image and the corresponding + language. It should + + be in the format `{IMAGE_TYPE}_{LANG}` format, where + `IMAGE_TYPE` is one + + of `front|ingredients|nutrition|packaging|other` and `LANG` + is the 2 + + letter language code. Use `other` if you don't want the + image to be + + selected. Note that the first image of a product is always + selected as front + + picture. + example: front_en + imgupload_front_en: + type: string + format: binary + description: > + This field must contain image binary content. + + The format and extension must be one of + gif|jpeg|jpg|png|heic. + + This field is dynamic and dependent on the value of + imagefield in the + + request body. It wil be imgupload_the value of the + imagefield stated + + earlier. For example, if `imagefield=front_en`, the name of + this field + + should be `imageupload_front_en`. + required: + - code + - imagefield + - imgupload_front_en + description: '' + /cgi/ingredients.pl: + parameters: [] + get: + summary: Performing OCR on a Product + operationId: get-cgi-ingredients.pl + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + status: + type: integer + example: 1 + description: > + Open Food Facts uses optical character recognition (OCR) to retrieve + nutritional data and other information from the product labels. + parameters: + - $ref: '#/components/parameters/id' + - $ref: '#/components/parameters/code' + - $ref: '#/components/parameters/process_image' + - $ref: '#/components/parameters/ocr_engine' + tags: + - Read Requests + /cgi/product_image_crop.pl: + post: + summary: Crop A Photo + operationId: post-cgi-product_image_crop.pl + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: {} + description: | + Cropping is only relevant for editing existing products. + You cannot crop an image the first time you upload it to the system. + parameters: [] + requestBody: + content: + multipart/form-data: + schema: + type: object + description: > + Select a photo and optionally crop/rotate it. + + The origin of the cropping coordinates is the top-left corner. + + Note that rotation is applied *before* cropping, so the cropping + bounding box + + is relative to the rotated image. + required: + - id + - code + - imgid + properties: + code: + type: string + description: Barcode of the product. + example: 04963406 + imgid: + type: integer + description: 'identifier of the image to select, it should be a number' + example: 2 + id: + type: string + description: > + identifier of the selected image field, should be in the + format + + `{IMAGE_TYPE}_{LANG}` format, where `IMAGE_TYPE` is one of + + `front|ingredients|nutrition|packaging|other` and `LANG` is + the 2 letter + + language code. + + Note that if you select an image for the main language of + the product (ex: + + `ingredients_it` if `it` is the main language), this image + will be + + displayed on Product Opener for all languages (ex: on + + `https://fr.openfoodfacts.org`, unless `ingredients_fr` + exists). + example: front_en + x1: + type: integer + example: 0 + description: 'X origin coordinate of the crop, it must be lower than x2' + y1: + type: integer + example: 0 + description: 'Y origin coordinate of the crop, it must be lower than y2' + x2: + type: integer + example: 145 + description: 'X end coordinate of the crop, it must be higher than x1' + y2: + type: integer + example: 145 + description: 'Y end coordinate of the crop, it must be higher than y1' + angle: + type: integer + example: 0 + description: > + angle of the rotation to apply on the selected image. + + passing `90` as value rotate the image 90 degrees + counter-clockwise. + normalize: + type: string + example: 'false' + description: >- + whether the selected image should be normalized using + ImageMagick + enum: + - 'true' + - 'false' + white_magic: + type: string + default: 'false' + description: > + whether the source image should be white magiced (background + removal) using + + ImageMagick. + enum: + - 'true' + - 'false' + required: true + tags: + - Write Requests + get: + summary: Rotate A Photo + operationId: get-cgi-product_image_crop.pl + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + status: + type: string + example: status ok + imagefield: + type: string + example: nutrition_fr + image: + type: object + properties: + display_url: + type: string + example: nutrition_fr.67.400.jpg + description: > + Although we recommend rotating photos manually and uploading a new + version of the image, + + the OFF API allows you to make api calls to automate this process. + + You can rotate existing photos by setting the angle to 90º, 180º, or + 270º clockwise. + parameters: + - $ref: '#/components/parameters/code' + - $ref: '#/components/parameters/id' + - $ref: '#/components/parameters/imgid' + - $ref: '#/components/parameters/angle' + tags: + - Write Requests + /cgi/product_image_unselect.pl: + post: + summary: Unselect A Photo + requestBody: + content: + multipart/form-data: + schema: + type: object + properties: + code: + type: string + description: code of the product + example: '4251105501381' + id: + type: string + description: image field (image id) of the photo to unselect + example: front_fr + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + status: + type: string + description: status of the unselect operation + example: status ok + status_code: + type: number + description: status code of the operation + example: 0 + imagefield: + type: string + example: front_fr + description: image field that was unselected + /cgi/product_jqm2.pl: + post: + summary: Add or Edit A Product + operationId: post-cgi-product_jqm2.pl + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + status_verbose: + type: string + example: fields saved + status: + type: integer + example: 1 + parameters: [] + requestBody: + content: + multipart/form-data: + schema: + allOf: + - type: object + description: > + You can provide most of the properties defined in the + product schema. + properties: + code: + type: string + description: The barcode of the product to be added or edited + example: '0074570036004' + user_id: + type: string + description: A valid username. + example: myusername + password: + type: string + description: A valid corresponding password. + example: mypassword + comment: + type: string + description: >- + A comment for the change. It will be shown in product + changes history. + example: new packaging from super-app + brands: + schema: + type: array + items: + type: string + style: form + explode: false + description: >- + The brands of the product (comma separated list of + values). + example: 'Häagen-Dazs,General-mills' + labels: + schema: + type: array + items: + type: string + style: form + explode: false + description: >- + The labels of the product (comma separated list of + values). + example: 'Kosher,Ferroro' + categories: + schema: + type: array + items: + type: string + style: form + explode: false + description: >- + The categories of the product (comma separated list of + values). + example: 'Desserts,Frozen foods' + packaging: + type: string + description: > + Packaging type, format, material. + + The [v3 API + documentation](https://openfoodfacts.github.io/openfoodfacts-server/api/ref-v3/#operation/post-api-v3-product-barcode) + + has a more structured data for `packaging`. + example: Frozen + required: + - code + - user_id + - password + - type: object + description: | + Properties that goes in change ref + properties: + comment: + type: string + description: > + A comment on the contribution. + + Adding meaningful comments help moderators and users + understand a single product history. + app_name: + type: string + description: | + Name of the app providing the information + app_version: + type: string + description: | + Version of the app providing the information + app_uuid: + type: string + description: > + When an app uses a single user to log its contributions, + + it might be interesting to know which user of the app is + providing the information. + + You can use this field to provide an identifier (eg: an + sha1 of the username) that's privacy preserving. Make + sure that your salt is strong, perfectly random and + secret + + + In case we have trouble with one of your user, it helps + our moderators revert edits. + User-Agent: + type: string + description: > + It is required that you pass a specific User-Agent + header when you do an API request. + + But some times it's not possible to modify such a header + + (eg. request using JavaScript in a browser). + + In such cases, you can override it with this parameter. + required: true + tags: + - Write Requests + description: > + This updates a product. + + + Note: If the barcode exists then you will be editing the existing + product, + + However if it doesn''t you will be creating a new product with that + unique barcode, + + and adding properties to the product. + /api/v2/search: + get: + summary: Search for Products + tags: + - Read Requests + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + count: + type: integer + description: | + Total number of products found + example: 2701 + page: + type: integer + description: > + Page number of returned results. + + + You can get a different page, by using the `page` query + parameter. + example: 1 + page_count: + type: integer + description: | + Number of products in this page. + + This will differ from page_size only on the last page. + example: 24 + page_size: + type: integer + description: | + Requested number of products per pages + + To get the number of pages, divide count by page_size + (eg. `Math.floor( count / page_size) + 1 `) + example: 24 + products: + type: array + description: > + The products matching the query corresponding to current + page + items: + type: object + description: > + This is all the fields describing a product and how to + display it on a page. + + + Refer to the different sub schema for more readable + entries: + + + * [Product Base](#cmp--schemas-product-base): Base + fields of a product + + * [Product Misc](#cmp--schemas-product-misc): + Miscellaneous but important fields of a product + + * [Product Tags](#cmp--schemas-product-tags): Tags + fields on a product + + * [Product Nutrition](#cmp--schemas-product-nutrition): + Nutrition fields of a product + + * [Product + Ingredients](#cmp--schemas-product-ingredients): Fields + about ingredients of a product + + * [Product Images](#cmp--schemas-product-images): + Information about Images of a product + + * [Product Eco-Score](#cmp--schemas-product-images): + Fields related to Eco-Score for a product + + * [Product Metadata](#cmp--schemas-product-ecoscore): + Metadata of a product (author, editors, etc.) + + * [Product Data Quality](#cmp--schemas-product-quality): + fields related to data quality for a product + + * [Product Knowledge + Panels](#cmp--schemas-product-knowledge-panels): + Knowledge panels for a product + + * [Product Attribute + Groups](#cmp--schemas-product-attribute-groups): + Attribute groups for personal product matching + allOf: + - type: object + description: | + Base product data + properties: + abbreviated_product_name: + type: string + description: Abbreviated name in requested language + code: + type: string + description: > + barcode of the product (can be EAN-13 or + internal codes for some food stores), + + for products without a barcode, + + Open Food Facts assigns a number starting with + the 200 reserved prefix + codes_tags: + type: array + items: + type: string + description: > + A value which is the type of barcode "code-13" + or "code-8" + + and + + A series of mask for the barcode + + It helps retrieve barcodes starting by + example: > + ["code-13","3017620422xxx","301762042xxxx","30176204xxxxx","3017620xxxxxx","301762xxxxxxx","30176xxxxxxxx","3017xxxxxxxxx","301xxxxxxxxxx","30xxxxxxxxxxx","3xxxxxxxxxxxx"] + generic_name: + type: string + description: | + Legal name of the product as regulated + by the European authorities. + id: + description: > + internal identifier for the product, usually set + to the value of `code`, + + except on the producers platform where it is + prefixed by the owner + type: string + lc: + type: string + description: > + Main language of the product. + + This is a duplicate of `lang` property (for + historical reasons). + lang: + type: string + description: > + Main language of the product. + + + This should be the main language of product + packaging (if one is predominant). + + + Main language is also used to decide which + ingredients list to parse. + nova_group: + type: integer + description: > + Nova group as an integer from 1 to 4. See + https://world.openfoodfacts.org/nova + nova_groups: + type: string + obsolete: + type: string + obsolete_since_date: + description: > + A date at which the product was declared + obsolete. + + This means it's not produced any more. + type: string + product_name: + type: string + description: | + The name of the product + product_name_en: + type: string + description: | + The name of the product can also + be in many other languages like + product_name_fr (for French). + product_quantity: + type: string + description: | + The size in g or ml for the whole product. + It's a normalized version of the quantity field. + example: '500' + product_quantity_unit: + type: string + description: > + The unit (either g or ml) for the correponding + product_quantity. + example: g + quantity: + type: string + description: | + Quantity and Unit. + patternProperties: + abbreviated_product_name_(?\w\w): + type: string + description: Abbreviated name in language `language_code`. + generic_name_(?\w\w): + type: string + description: | + This can be returned in many other languages + like generic_name_fr (for French). + - type: object + description: | + Miscellaneous but important fields of a product + properties: + additives_n: + type: integer + description: | + Number of food additives. + checked: + type: string + complete: + type: integer + completeness: + type: number + ecoscore_grade: + type: string + description: | + See also: `ecoscore_tags` + ecoscore_score: + type: integer + description: | + See also: `ecoscore_tags` + food_groups: + type: string + food_groups_tags: + type: array + items: + type: string + nutrient_levels: + description: > + Traffic light indicators on main nutrients + levels + type: object + properties: + fat: + type: string + enum: + - low + - moderate + - high + salt: + type: string + enum: + - low + - moderate + - high + saturated-fat: + type: string + enum: + - low + - moderate + - high + sugars: + type: string + enum: + - low + - moderate + - high + packaging_text: + type: string + description: | + Recycling instructions as raw text, e.g. Plastic + bottle to recycle, Plastic cap to recycle. + This will get automatically parsed and + will be used to compute the Eco-Score. + You can either request it (if it exists) or + send it in a specific language. + example: packaging_text_en + packagings: + type: array + x-stoplight: + id: 1cyz4qo9njog7 + title: Packagings (READ) + description: >- + The packagings object is an array of individual + packaging component objects. + + + The Packaging data document explains how + packaging data is structured in Open Food Facts: + https://openfoodfacts.github.io/openfoodfacts-server/dev/explain-packaging-data/ + + + The shape, material and recycling properties of + each packaging component are linked to entries + in the packaging_shapes, packaging_materials and + packaging_recycling taxonomies: + + + https://world.openfoodfacts.org/data/taxonomies/packaging_shapes.json + + https://world.openfoodfacts.org/data/taxonomies/packaging_materials.json + + https://world.openfoodfacts.org/data/taxonomies/packaging_recycling.json + + + If the tags_lc field is set, the properties will + include a lc_name field with the translation in + the requested language. + examples: + - - number_of_units: 6 + shape: + id: 'en:bottle' + lc_name: bouteille + material: + id: 'en:bottle' + lc_name: bouteille + recycling: + id: 'en:bottle' + lc_name: bouteille + quantity_per_unit: 25 cl + quantity_per_unit_value: 25 + quantity_per_unit_unit: cl + weight_specified: 30 + weight_measured: 32 + weight_estimated: 26 + weight: 30 + weight_source_id: specified + items: + description: >- + Each packaging component has different + properties to specify how many there are, its + shape, material etc. + + + The shape, material and recycling properties + are mapped to one entry in the + packaging_shapes, packaging_materials and + packaging_recycling taxonomies, and the value + of the property is the canonical name of the + taxonomy entry (e.g. en:bottle). + + + They may contain values that could not yet get + matched to their respective taxonomy, in which + case they will contain a free text value + prefixed with the language code of this text + value (e.g. "fr:Bouteille sphérique" might + have been entered by a French user to indicate + it is a spherical bottle). + title: Packaging component (READ) + type: object + examples: + - number_of_units: 6 + shape: + id: 'en:bottle' + lc_name: bouteille + material: + id: 'en:bottle' + lc_name: bouteille + recycling: + id: 'en:bottle' + lc_name: bouteille + quantity_per_unit: 25 cl + quantity_per_unit_value: 25 + quantity_per_unit_unit: cl + weight_specified: 30 + weight_measured: 32 + weight_estimated: 26 + weight: 30 + weight_source_id: specified + properties: + number_of_units: + type: integer + description: >- + umber of units of this packaging component + contained in the product (e.g. 6 for a + pack of 6 bottles) + shape: + title: Packaging component shape + x-stoplight: + id: xrj8agza3dwgf + type: object + description: >- + The shape property is canonicalized using + the packaging_shapes taxonomy. + examples: + - id: 'en:bottle' + lc_name: bouteille + properties: + id: + type: string + description: >- + Canonical id of the entry in the + taxonomy. If the value cannot be mapped + to a taxonomy entry, the value will be + the name of the entry in its original + language prefixed by the language 2 + letter code and a colon. + lc_name: + type: string + description: >- + Name of the entry in the language + requested in the tags_lc field of the + request. This field is returned only of + tags_lc is specified. If the translation + is not available, or if the entry does + not exist in the taxonomy, the value + will be the name of the entry in its + original language prefixed by the + language 2 letter code and a colon. + material: + title: Packaging component material + x-stoplight: + id: n6umazgqmwrd5 + type: object + description: >- + The material property is canonicalized + using the packaging_materials taxonomy. + examples: + - id: 'en:bottle' + lc_name: bouteille + properties: + id: + type: string + description: >- + Canonical id of the entry in the + taxonomy. If the value cannot be mapped + to a taxonomy entry, the value will be + the name of the entry in its original + language prefixed by the language 2 + letter code and a colon. + lc_name: + type: string + description: >- + Name of the entry in the language + requested in the tags_lc field of the + request. This field is returned only of + tags_lc is specified. If the translation + is not available, or if the entry does + not exist in the taxonomy, the value + will be the name of the entry in its + original language prefixed by the + language 2 letter code and a colon. + recycling: + title: Packaging component recycling instruction + x-stoplight: + id: 376tk8e2cmyh2 + type: object + description: >- + The recycling property is canonicalized + using the packaging_recycling taxonomy. + examples: + - id: 'en:bottle' + lc_name: bouteille + properties: + id: + type: string + description: >- + Canonical id of the entry in the + taxonomy. If the value cannot be mapped + to a taxonomy entry, the value will be + the name of the entry in its original + language prefixed by the language 2 + letter code and a colon. + lc_name: + type: string + description: >- + Name of the entry in the language + requested in the tags_lc field of the + request. This field is returned only of + tags_lc is specified. If the translation + is not available, or if the entry does + not exist in the taxonomy, the value + will be the name of the entry in its + original language prefixed by the + language 2 letter code and a colon. + quantity_per_unit: + type: string + description: >- + Quantity (weight or volume) of food + product contained in the packaging + component. (e.g. 75cl for a wine bottle) + quantity_per_unit_value: + type: number + description: Value parsed from the quantity field. + quantity_per_unit_unit: + type: string + description: >- + Unit parsed and normalized from the + quantity field. + weight_specified: + type: number + description: >- + Weight (as specified by the manufacturer) + of one unit of the empty packaging + component (in grams). (e.g. for a 6 pack + of 1.5l water bottles, it might be 30, the + weight in grams of 1 empty water bottle + without its cap which is a different + packaging component). + weight_measured: + type: number + description: >- + Weight (as measured by one or more users) + of one unit of the empty packaging + component (in grams). (e.g. for a 6 pack + of 1.5l water bottles, it might be 30, the + weight in grams of 1 empty water bottle + without its cap which is a different + packaging component). + weight_estimated: + type: number + description: >- + Weight (as estimated from similar + products) of one unit of the empty + packaging component (in grams). (e.g. for + a 6 pack of 1.5l water bottles, it might + be 30, the weight in grams of 1 empty + water bottle without its cap which is a + different packaging component). + weight: + type: number + description: >- + Weight of one unit of the empty packaging + component. + weight_source_id: + type: string + description: >- + Indicates which field was used to populate + the "weight" field. Either "specified", + "measured", or "estimated" + readOnly: true + packagings_complete: + title: packagings_complete + x-stoplight: + id: hxnnsy954q1ey + type: integer + minimum: 0 + maximum: 1 + description: >- + Indicate if the packagings array contains all + the packaging parts of the product. This field + can be set by users when they enter or verify + packaging data. Possible values are 0 or 1. + pnns_groups_1: + description: > + Category of food according to [French Nutrition + and Health + Program](https://fr.wikipedia.org/wiki/Programme_national_nutrition_sant%C3%A9) + type: string + pnns_groups_1_tags: + type: array + items: + type: string + pnns_groups_2: + description: > + Sub Category of food according to [French + Nutrition and Health + Program](https://fr.wikipedia.org/wiki/Programme_national_nutrition_sant%C3%A9) + type: string + pnns_groups_2_tags: + type: array + items: + type: string + popularity_key: + description: > + An imprecise measurement of popularity based on + Scan statistics. A higher value means higher + popularity. + type: integer + popularity_tags: + description: > + Indicators for the popularity of a product, like + the amount of scans in a specific year. + type: array + items: + type: string + scans_n: + type: integer + unique_scans_n: + type: integer + serving_quantity: + type: string + description: > + Normalized version of serving_size. + + Note that this is NOT the number of servings by + product. + + (in perl, see + `normalize_serving_size`) + serving_quantity_unit: + type: string + description: > + The unit (either g or ml) for the correponding + serving_quantity. + example: g + serving_size: + type: string + description: > + Serving size text (generally in g or ml). + + We expect a quantity + unit but the user is free + to input any string. + patternProperties: + food_groups_(?\w\w): + type: string + description: see `food_groups` + packaging_text_(?\w\w): + type: string + description: > + Packaging text in language designated by + `language_code` + - type: object + description: | + Data about a product which is represented as tags + properties: + brands: + type: string + description: List of brands (not taxonomized) + brands_tags: + type: array + items: + type: string + description: 'List of brands (tags, not taxonomized)' + categories: + type: string + categories_hierarchy: + type: array + items: + type: string + categories_lc: + type: string + description: Categories language code + categories_tags: + type: array + items: + type: string + checkers_tags: + type: array + items: + type: string + description: >- + List of checkers (users who checked the + product) tags + cities: + type: string + cities_tags: + type: array + items: + type: object + correctors_tags: + type: array + items: + type: string + countries: + type: string + description: | + List of countries where the product is sold. + countries_hierarchy: + type: array + items: + type: string + countries_lc: + type: string + description: Countries language code + countries_tags: + type: array + items: + type: string + ecoscore_tags: + description: > + All ecoscore of a product. + + Most of the time it's only one value, + + but it might eventually be more for products + composed of sub-products. + + See also: `ecoscore_score`, `ecoscore_grade`. + type: array + items: + type: string + emb_codes: + type: string + description: > + Packager code. EMB is the French system of + traceability codes for packager. + example: EMB 2013330 + emb_codes_orig: + type: string + emb_codes_tags: + type: array + items: + type: object + labels: + type: string + labels_hierarchy: + type: array + items: + type: string + labels_lc: + type: string + labels_tags: + type: array + items: + type: string + entry_dates_tags: + description: > + The data as a series of tag: `yyyy-mm-dd`, + `yyyy-mm`, `yyyy` + type: array + items: + type: string + example: + - '2016-03-11' + - 2016-03 + - '2016' + manufacturing_places: + type: string + description: > + Places where the product was manufactured or + transformed. + manufacturing_places_tags: + type: array + items: + type: object + nova_groups_tags: + type: array + items: + type: string + nutrient_levels_tags: + type: array + items: + type: string + - type: object + description: > + Information about Images of a product. + + + Images ensure the reliability of Open Food Facts + data. + + It provides a primary source and proof of all the + structured data. + + You may therefore want to display it along the + structured information. + + + See also tutorials about images: + + * [Getting + images](https://openfoodfacts.github.io/openfoodfacts-server/api/how-to-download-images/) + + * [Uploading + images](https://openfoodfacts.github.io/openfoodfacts-server/api/tutorial-uploading-photo-to-a-product/) + properties: + images: + description: > + This contains properties for all images + contained on the product. + type: object + properties: + '1': + type: object + description: > + This object represent an image that was + uploaded to a product. + + "imgid" is an integer which is a sequential + number unique to each picture. + properties: + sizes: + type: object + description: > + The available image sizes for the + product (both reduced and full). + + The reduced images are the ones with + numbers as the key( 100, 200 etc) + + while the full images have `full` as the + key. + properties: + full: + description: | + properties of fullsize image + **TODO** explain how to compute name + type: object + properties: + h: + type: integer + example: 400 + description: > + The height of the reduced/full image in + pixels. + w: + type: integer + example: 255 + description: >- + The width of the reduced/full image in + pixels. + patternProperties: + (?100|400): + description: > + properties of thumbnail of size + `image_size`. + + **TODO** explain how to compute name + + + For real type: see description of + property `full`. + + (Put this way because of a [bug in + rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) + type: string + uploaded_t: + type: string + example: '1457680652' + description: > + The time the image was uploaded (as unix + timestamp). + uploader: + type: string + example: openfoodfacts-contributors + description: | + The contributor that uploaded the image. + front: + description: > + property of an image (or part thereof) + selected for a particular role and a + particular language. + type: object + properties: + angle: + type: integer + example: 0 + description: >- + The angle of the image rotation (if it + was rotated). + coordinates_image_size: + type: string + example: full + geometry: + type: string + example: 0x0--1--1 + imgid: + type: string + example: '121' + description: >- + The id of the original/source image that + was selected to edit(rotate, normalize + etc) to produce this new image. + normalize: + type: 'null' + example: null + description: Normalize colors. + rev: + type: string + example: '420' + sizes: + type: object + description: > + The available image sizes for the + product (both reduced and full). + + The reduced images are the ones with + numbers as the key( 100, 200 etc) + + while the full images have `full` as the + key. + properties: + '100': + type: object + properties: + h: + type: integer + example: 400 + description: > + The height of the reduced/full image in + pixels. + w: + type: integer + example: 255 + description: >- + The width of the reduced/full image in + pixels. + '200': + type: object + properties: + h: + type: integer + example: 400 + description: > + The height of the reduced/full image in + pixels. + w: + type: integer + example: 255 + description: >- + The width of the reduced/full image in + pixels. + '400': + type: object + properties: + h: + type: integer + example: 400 + description: > + The height of the reduced/full image in + pixels. + w: + type: integer + example: 255 + description: >- + The width of the reduced/full image in + pixels. + full: + type: object + properties: + h: + type: integer + example: 400 + description: > + The height of the reduced/full image in + pixels. + w: + type: integer + example: 255 + description: >- + The width of the reduced/full image in + pixels. + white_magic: + type: 'null' + example: null + description: > + Photo on white background : Try to + remove the background. + x1: + type: string + example: '-1' + x2: + type: string + example: '-1' + y1: + type: string + example: '-1' + y2: + type: string + example: '-1' + patternProperties: + (?\d+): + description: > + See property `1` to get the real type of + those objects + + (Put this way because of a [bug in + rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) + type: string + (?front|nutrition|ingredients|packaging|other)_(?\w\w): + description: > + See property `front` to get the real type of + those objects + + (Put this way because of a [bug in + rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) + type: string + last_image_dates_tags: + type: array + items: + type: string + last_image_t: + description: timestamp of last image upload (or update?) + type: integer + selected_images: + type: object + description: > + URL for selected (important) images of the + product. + + + This is very handy if you display the product to + users. + properties: + front: + type: object + description: >- + URLs of thumbnails image of image of type + `image_type` + properties: + display: + description: > + Thumbnail urls of product image (front) + adapted to display on product page + type: object + patternProperties: + (?\w\w): + type: string + description: >- + url of the image for language + `language_code` + small: + description: > + Thumbnail urls of product image (front) + adapted to display on product list page + type: object + patternProperties: + (?\w\w): + type: string + description: >- + url of the image for language + `language_code` + thumb: + description: > + Thumbnail urls of product image (front) + in smallest format + type: object + patternProperties: + (?\w\w): + type: string + description: >- + url of the image for language + `language_code` + patternProperties: + (?front|packaging|ingredients|nutrition|other): + description: > + See property `front` to get the real type of + those objects + + (Put this way because of a [bug in + rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) + type: string + image_small_url: + type: string + image_thumb_url: + type: string + image_url: + type: string + patternProperties: + image(_(?front|packaging|ingredients|nutrition|other))?(_(?small|thumb))?_url: + description: > + the URL of image of type `image_type` in size + `image_size` (or full size if not given). + + + The `image_type` tells which image the url + correspond to. `image_type` is `front` if not + provided. + + + The image is the one for current language + (affected by `lc` parameter) if an image + exists for this language, the image in main + product language otherwise. + + + **IMPORTANT:** you should use + `selected_images` field instead of this one. + type: string + - type: object + description: > + Fields related to Eco-Score for a product. + + + See also: `ecoscore_score`, `ecoscore_grade` and + `ecoscore_tags`. + properties: + ecoscore_data: + type: object + description: > + An object about a lot of details about data + needed for Eco-Score computation + + and complementary data of interest. + properties: + adjustments: + type: object + properties: + origins_of_ingredients: + type: object + properties: + aggregated_origins: + type: array + items: + type: object + properties: + origin: + type: string + percent: + type: integer + epi_score: + type: integer + epi_value: + type: integer + origins_from_origins_field: + type: array + items: + type: string + transportation_scores: + type: object + patternProperties: + (?\w\w): + type: integer + transportation_values: + type: object + patternProperties: + (?\w\w): + type: integer + values: + type: object + patternProperties: + (?\w\w): + type: integer + warning: + type: string + packaging: + type: object + properties: + non_recyclable_and_non_biodegradable_materials: + type: integer + packagings: + type: array + items: + type: object + properties: + ecoscore_material_score: + type: integer + ecoscore_shape_ratio: + type: integer + material: + type: string + shape: + type: string + score: + type: integer + value: + type: integer + warning: + type: string + production_system: + type: object + properties: + labels: + type: array + example: 'vegan, fat free, Kosher' + items: + type: string + value: + type: integer + warning: + type: string + threatened_species: + type: object + properties: + ingredient: + type: string + value: + type: integer + agribalyse: + type: object + properties: + agribalyse_food_code: + type: string + co2_agriculture: + type: number + co2_consumption: + type: integer + co2_distribution: + type: number + co2_packaging: + type: number + co2_processing: + type: number + co2_total: + type: number + co2_transportation: + type: number + code: + type: string + dqr: + type: string + ef_agriculture: + type: number + ef_consumption: + type: integer + ef_distribution: + type: number + ef_packaging: + type: number + ef_processing: + type: number + ef_total: + type: number + ef_transportation: + type: number + is_beverage: + type: integer + name_en: + type: string + description: > + This can be returned in many other + languages + + like name_fr (for french). + score: + type: integer + version: + type: string + grade: + type: string + grades: + type: object + patternProperties: + (?\w\w): + type: string + missing: + type: object + properties: + labels: + type: integer + origins: + type: integer + packagings: + type: integer + missing_data_warning: + type: integer + previous_data: + type: object + properties: + grade: + type: string + score: + type: integer + agribalyse: + type: object + properties: + agribalyse_food_code: + type: string + co2_agriculture: + type: number + co2_consumption: + type: integer + co2_distribution: + type: number + co2_packaging: + type: number + co2_processing: + type: number + co2_total: + type: number + co2_transportation: + type: number + code: + type: string + dqr: + type: string + ef_agriculture: + type: number + ef_consumption: + type: integer + ef_distribution: + type: number + ef_packaging: + type: number + ef_processing: + type: number + ef_total: + type: number + ef_transportation: + type: number + is_beverage: + type: integer + name_en: + type: string + description: > + This can be returned in many other + languages + + like name_fr (for french). + score: + type: integer + version: + type: string + score: + type: integer + scores: + type: object + patternProperties: + (?\w\w): + type: integer + status: + type: string + ecoscore_extended_data_version: + type: string + environment_impact_level: + type: string + environment_impact_level_tags: + type: array + items: + type: object + - type: object + description: Fields about ingredients of a product + properties: + additives_tags: + type: array + items: + type: string + allergens: + type: string + description: comma separated list of allergens + allergens_lc: + type: string + description: language in which `allergens` where input + allergens_hierarchy: + type: array + items: + type: string + allergens_tags: + type: array + items: + type: string + ingredients: + type: array + description: > + This structure gives the different ingredients + and some information about them, + + like estimate on their quantity. + items: + type: object + properties: + id: + type: string + ingredients: + description: > + Sub ingredients composing this + ingredients. + $ref: '#' + percent: + type: integer + percent_estimate: + type: + - number + percent_max: + type: + - number + percent_min: + type: integer + text: + type: string + vegan: + type: string + vegetarian: + type: string + ingredients_analysis: + type: object + properties: + 'en:palm-oil': + type: array + items: + type: string + 'en:vegan-status-unknown': + type: array + items: + type: string + 'en:vegetarian-status-unknown': + type: array + items: + type: string + ingredients_analysis_tags: + type: array + items: + type: string + ingredients_from_or_that_may_be_from_palm_oil_n: + type: integer + ingredients_from_palm_oil_n: + type: integer + ingredients_from_palm_oil_tags: + type: array + items: + type: object + ingredients_hierarchy: + type: array + items: + type: string + ingredients_n: + type: integer + ingredients_n_tags: + type: array + items: + type: string + ingredients_original_tags: + type: array + items: + type: string + ingredients_percent_analysis: + type: integer + ingredients_sweeteners_n: + type: integer + description: > + Number of sweeteners additives in the + ingredients. Undefined if ingredients are not + specified. + ingredients_non_nutritive_sweeteners_n: + type: integer + description: > + Number of non-nutritive sweeteners additives (as + specified in the Nutri-Score formula) in the + ingredients. Undefined if ingredients are not + specified. + ingredients_tags: + type: array + items: + type: string + ingredients_lc: + type: string + description: > + Language that was used to parse the ingredient + list. If `ingredients_text` is available + + for the product main language (`lang`), + `ingredients_lc=lang`, otherwise we look at + + `ingredients_text` fields for other languages + and set `ingredients_lc` to the first + + non-empty `ingredient_text`. + ingredients_text: + type: string + description: > + Raw list of ingredients. This will get + automatically + + parsed and get used to compute the Eco-Score or + find allergens, etc.. + + + It's a copy of ingredients_text in the main + language of the product (see `lang` proprety). + example: > + Farine de blé* 67,4%, sucre de canne*, huile de + tournesol oléique*, graines de chia* 5,2%, son + de blé*, oranges déshydratées * 0,9%, farine de + riz*, poudres à lever (acide citrique, + carbonates de sodium), arôme naturel d'orange. + ingredients_text_with_allergens: + type: string + description: > + Same text as `ingredients_text` but where + allergens have HTML elements around them to + identify them + example: > + Farine de blé* + 67,4%, sucre de canne*, huile de tournesol + oléique*, graines de chia* 5,2%, son de blé*, oranges + déshydratées * 0,9%, farine de riz*, poudres à + lever (acide citrique, carbonates de sodium), + arôme naturel d'orange. + ingredients_that_may_be_from_palm_oil_n: + type: integer + ingredients_that_may_be_from_palm_oil_tags: + type: array + items: + type: object + ingredients_with_specified_percent_n: + type: integer + ingredients_with_specified_percent_sum: + type: integer + ingredients_with_unspecified_percent_n: + type: integer + ingredients_with_unspecified_percent_sum: + type: integer + known_ingredients_n: + type: integer + origins: + type: string + description: | + Origins of ingredients + origins_hierarchy: + type: array + items: + type: object + origins_lc: + type: string + origins_tags: + type: array + items: + type: object + traces: + type: string + description: | + List of substances that might cause allergies + that are present in trace amounts in the product + (this does not include the ingredients, as they + are not only present in trace amounts). + It is taxonomized with the allergens taxonomy. + traces_hierarchy: + type: array + items: + type: object + traces_lc: + type: string + traces_tags: + type: array + items: + type: object + unknown_ingredients_n: + type: integer + patternProperties: + ingredients_text_(?\w\w): + type: string + description: > + Raw list of ingredients in language given by + 'language_code'. + + + See `ingredients_text` + ingredients_text_with_allergens_(?\w\w): + description: > + Like `ingredients_text_with_allergens` for a + particular language + type: string + - type: object + description: > + Nutrition fields of a product + + + Most of these properties are read-only. + + + See [how to add nutrition + data](https://openfoodfacts.github.io/openfoodfacts-server/api/ref-cheatsheet/#add-nutrition-facts-values-units-and-base) + properties: + no_nutrition_data: + type: string + description: > + When a product does not have nutrition data + displayed on the + + packaging, the user can check the field + "Nutrition facts are + + not specified on the product". + + By doing so, the no_nutrition_data field takes + the value "on". + + This case is frequent (thousands of products). + example: 'on' + nutrition_data_per: + type: string + enum: + - serving + - 100g + description: > + The nutrition data on the package can be per + serving or per 100g. + + + This is essential to understand if + `_value` and `` + + values in `nutriments` applies for a serving or + for 100g. + + + **IMPORTANT:** + + When writing products, + + this setting applies to all existing nutrients + values for the product, + + not only the nutrient values sent in the write + request. + + So it should not be changed unless all nutrients + values are provided + + with values that match the nutrition_data_per + field. + nutrition_data_prepared_per: + type: string + enum: + - serving + - 100g + description: > + The nutrition data for prepared product on the + package (if any) can be per serving or per 100g. + + + This is essential to understand if + `_prepared_value` and + `_prepared` + + values in `nutriments` applies for a serving or + for 100g. + + + See also important note on `nutrition_data_per`. + nutriments: + type: object + description: > + All known nutrients for the product. + + + Note that each nutrients are declined with a + variety of suffixes like `_100g`, `_serving`, + + see patternProperties below. + + + A specific `_unit` is the unit used to measure + the nutrient. + + + Beware that some properties are to be + interpreted based upon `nutrition_data_per` + value. + + + Also for products that have a nutrition table + for prepared product + + (eg. the nutrition facts for a bowl of milk with + cocoa powder), + + a `_prepared` suffix is added (before other + suffixes). + + + You can get all possible nutrients from the + + [nutrients + taxonomy](https://static.openfoodfacts.org/data/taxonomies/nutrients.json) + + + **FIXME** add more nutrients with description. + properties: + alcohol: + description: > + Quantity of alcohol + + + (per 100g or per serving) in a standard unit + (g or ml) + type: number + carbohydrates: + type: number + energy: + type: number + description: > + It is the same as `energy-kj` if we have it, + or computed from `energy-kcal` otherwise + + + (per 100g or per serving) in kj + energy_value: + type: number + description: > + energy_value will be equal to + energy-kj_value if we have it or to + energy-kcal_value otherwise + energy_unit: + type: string + enum: + - kcal + - kj + description: > + Equal to energy-kj_unit if we have it or to + energy-kcal_unit otherwise + energy-kcal: + type: number + description: > + energy in kcal, if it is specified + + + (per 100g or per serving) in a standard unit + (g or ml) + energy-kj: + type: number + description: > + energy in kj, if it is specified + + + (per 100g or per serving) in a standard unit + (g or ml) + fat: + type: number + fruits-vegetables-legumes-estimate-from-ingredients: + type: number + description: > + An estimate, from the ingredients list of + the percentage of fruits, vegetable and + legumes. + + This is an important information for + Nutri-Score (2023 version) computation. + fruits-vegetables-nuts-estimate-from-ingredients: + type: number + description: > + An estimate, from the ingredients list of + the percentage of fruits, vegetable and + nuts. + + This is an important information for + Nutri-Score (2021 version) computation. + nova-group: + type: integer + nutrition-score-fr: + description: > + Experimental nutrition score derived from + + the UK FSA score and adapted for the French + market + + (formula defined by the team of Professor + Hercberg). + proteins: + type: number + salt: + type: number + saturated-fat: + type: number + sodium: + type: number + sugars: + type: number + carbon-footprint-from-known-ingredients_product: + type: integer + carbon-footprint-from-known-ingredients_serving: + type: number + erythritol: + type: number + description: > + erythritol is a polyol which is not + providing any energy. + + As such, it needs not be taken into account + when computing + + the energy of a product. Eryhtritol is now + displayed on + + nutrition facts sheet of some products, + mainly in the USA. + + This value is entered either by + contributors, either by + + imports. + example: 12.5 + patternProperties: + '(?[\w-]+)_unit': + description: "The unit in which the nutrient for 100g or per serving is measured.\n\nThe possible values depends on the nutrient.\n\n* `g` for grams\n* `mg` for milligrams\n* `μg` for micrograms\n* `cl` for centiliters\n* `ml` for mililiters\n* `dv` for recommended daily intakes (aka [Dietary Reference Intake](https://en.wikipedia.org/wiki/Dietary_Reference_Intake))\n* `% vol` for alcohol vol per 100 ml\n\n\U0001F913 code: see the [Units module][units-module],\nand [Food:default_unit_for_nid function][default-unit]\n\n[units-module]: https://openfoodfacts.github.io/openfoodfacts-server/dev/ref-perl-pod/ProductOpener/Units.html\n[default-unit]: https://openfoodfacts.github.io/openfoodfacts-server/dev/ref-perl-pod/ProductOpener/Food.html#default_unit_for_nid_(_%24nid)\n" + type: string + enum: + - 公斤 + - 公升 + - kg + - кг + - l + - л + - 毫克 + - mg + - мг + - mcg + - µg + - oz + - fl oz + - dl + - дл + - cl + - кл + - 斤 + - g + - '' + - ' ' + - kj + - 克 + - 公克 + - г + - мл + - ml + - mmol/l + - 毫升 + - '% vol' + - ph + - '%' + - '% dv' + - '% vol (alcohol)' + - iu + - mol/l + - mval/l + - ppm + - �rh + - �fh + - �e + - �dh + - gpg + '(?[\w-]+)_100g': + description: > + The standardized value of a serving of 100g + (or 100ml for liquids) + + for the nutrient. + + + This is computed from the `nutrient` + property, + + the serving size (if needed), and the + `nutrient`_unit field. + + + **Note**: + + If you want to characterize products in a + uniform way, this is the value you should + use. + type: number + readOnly: true + '(?[\w-]+)_serving': + description: > + The standardized value of a serving for this + product. + type: number + readOnly: true + '(?[\w-]+)_value': + description: > + The value input by the user / displayed on + the product for the nutrient. + + + * per 100g or serving, depending on + `nutrition_data_per` + + * in the unit of corresponding + _unit field. + type: number + readOnly: true + '(?[\w-]+)_prepared': + description: > + The value for nutrient for **prepared** + product. + type: number + '(?[\w-]+)_prepared_unit': + description: > + The unit in which the nutrient of + **prepared** product is measured. + type: string + '(?[\w-]+)_prepared_100g': + description: > + The standardized value of a serving of 100g + (or 100ml for liquids) + + for the nutrient, for **prepared** product. + type: number + readOnly: true + '(?[\w-]+)_prepared_serving': + description: > + The standardized value of a serving for the + **prepared** product. + type: number + readOnly: true + '(?[\w-]+)_prepared_value': + description: > + The standardized value for a serving or 100g + (or 100ml for liquids), + + depending on `nutrition_data_prepared_per` + + for the nutrient for **prepared** product. + type: number + readOnly: true + nutriscore_data: + description: > + Detail of data the Nutri-Score was computed + upon. + + + **Note**: this might not be stable, don't rely + too much on this, or, at least, tell us ! + + + **TODO** document each property + type: object + properties: + energy: + type: integer + energy_points: + type: integer + energy_value: + type: integer + fiber: + type: integer + fiber_points: + type: integer + fiber_value: + type: integer + fruits_vegetables_nuts_colza_walnut_olive_oils: + type: integer + fruits_vegetables_nuts_colza_walnut_olive_oils_points: + type: integer + fruits_vegetables_nuts_colza_walnut_olive_oils_value: + type: integer + grade: + type: string + is_beverage: + type: integer + is_cheese: + type: integer + is_fat: + type: integer + is_water: + type: integer + negative_points: + type: integer + positive_points: + type: integer + proteins: + type: number + proteins_points: + type: integer + proteins_value: + type: number + saturated_fat: + type: number + saturated_fat_points: + type: integer + saturated_fat_ratio: + type: number + saturated_fat_ratio_points: + type: integer + saturated_fat_ratio_value: + type: number + saturated_fat_value: + type: number + score: + type: integer + sodium: + type: number + sodium_points: + type: integer + sodium_value: + type: number + sugars: + type: number + sugars_points: + type: integer + sugars_value: + type: number + nutriscore_grade: + description: | + Nutri-Score for the product as a letter. + + See https://world.openfoodfacts.org/nutriscore. + type: string + enum: + - a + - b + - c + - d + - e + nutriscore_score: + description: > + Nutri-Score for the product as an integer (see + also `nutriscore_grade`). + type: integer + nutriscore_score_opposite: + type: integer + nutrition_grade_fr: + type: string + description: | + Nutrition grade (‘a’ to ‘e’), + https://world.openfoodfacts.org/nutriscore. + nutrition_grades: + description: > + Nutrition grades as a comma separated list. + + + Some products with multiple components might + have multiple Nutri-Score + type: string + nutrition_grades_tags: + type: array + items: + type: string + nutrition_score_beverage: + type: integer + nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients: + type: integer + nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients_value: + type: integer + nutrition_score_warning_no_fiber: + type: integer + other_nutritional_substances_tags: + type: array + items: + type: object + unknown_nutrients_tags: + type: array + items: + type: object + vitamins_tags: + type: array + items: + type: object + - type: object + description: | + This is data that is linked to products data quality + properties: + data_quality_bugs_tags: + type: array + items: + type: object + data_quality_errors_tags: + type: array + items: + type: object + data_quality_info_tags: + type: array + items: + type: string + data_quality_tags: + type: array + items: + type: string + data_quality_warnings_tags: + type: array + items: + type: string + data_sources: + type: string + description: | + Source of data imported from producers. + data_sources_tags: + type: array + items: + type: string + last_check_dates_tags: + type: array + items: + type: string + last_checked_t: + type: integer + last_checker: + type: string + states: + description: > + comma separated list of values indicating some + states of the product, + + like things to be done, or to be completed. + + See [states + taxonomy](https://static.openfoodfacts.net/data/taxonomies/states.json) + type: string + states_hierarchy: + type: array + items: + type: string + states_tags: + type: array + items: + description: > + Each state describe something that is + completed or is to be done or improved on the + product. + + + Refer to [states + taxonomy](https://static.openfoodfacts.net/data/taxonomies/states.json) + type: string + misc_tags: + description: > + Information about different aspect of the + product + type: array + items: + type: string + - type: object + properties: + additives_original_tags: + type: array + items: + type: string + additives_prev_original_tags: + type: array + items: + type: string + added_countries_tags: + type: array + items: + type: object + allergens_from_ingredients: + type: string + allergens_from_user: + type: string + amino_acids_prev_tags: + type: array + items: + type: object + amino_acids_tags: + type: array + items: + type: object + carbon_footprint_percent_of_known_ingredients: + type: integer + categories_properties: + type: object + properties: + 'agribalyse_food_code:en': + type: string + 'agribalyse_proxy_food_code:en': + type: string + 'ciqual_food_code:en': + type: string + categories_properties_tags: + type: array + items: + type: string + category_properties: + type: object + additionalProperties: + description: >- + those are properties taken from the category + taxonomy + type: string + ciqual_food_name_tags: + type: array + items: + type: string + compared_to_category: + type: string + description: | + the category to use for comparison. + + **TODO** explain how it is chosen. + conservation_conditions: + type: string + customer_service: + type: string + description: | + Contact info of customer service. + expiration_date: + type: string + link: + type: string + description: > + link to the product on the website of the + producer + main_countries_tags: + type: array + items: + type: object + minerals_prev_tags: + type: array + items: + type: object + minerals_tags: + type: array + items: + type: object + owner_fields: + type: object + description: > + Those are fields provided by the producer + (through producers platform), + + and the value he provided. + properties: + additionalProperties: + description: > + you can retrieve all kind of properties, the + same as on the parent object (the product). + + It's not processed entries (like tags for + example) but raw ones. + oneOf: + - type: integer + - type: string + - type: object + nova_groups_markers: + type: object + description: > + Detail of ingredients or processing that makes + the products having Nova 3 or 4 + properties: + '3': + description: | + Markers of level 3 + type: array + items: + type: array + description: > + This array has two element for each + marker. + + One + items: + type: string + '4': + description: | + Markers of level 4 + type: array + items: + $ref: >- + #/properties/nova_groups_markers/properties/3/items + nucleotides_tags: + type: array + items: + type: object + origin: + type: string + purchase_places: + type: string + description: > + Country, state, or city where the product can be + purchased. + example: Paris + purchase_places_tags: + type: array + items: + type: string + stores: + type: string + description: | + Distributor name. + example: Walmart + stores_tags: + type: array + items: + type: string + traces_from_ingredients: + type: string + traces_from_user: + type: string + patternProperties: + conservation_conditions_(?\w\w): + type: string + customer_service_(?\w\w): + type: string + origin_(?\w\w): + type: string + description: > + `origin` in language indicated by + `language_code` + - type: object + description: > + Metadata of a product (author, editors, creation + date, etc.) + properties: + created_t: + type: integer + description: > + Date when the product was added (UNIX timestamp + format). + + See also `entry_dates_tags` + example: | + 1457680652 + creator: + type: string + description: | + The contributor who added the product first. + editors_tags: + description: | + List of editors who edited the product. + type: array + items: + type: string + informers_tags: + type: array + items: + type: string + interface_version_created: + type: string + interface_version_modified: + type: string + languages: + type: object + patternProperties: + 'en:(?\w\w)': + type: integer + description: | + **TODO** explain ! + languages_codes: + type: object + patternProperties: + (?\w\w): + type: integer + description: > + Same as `languages` but by language code, + instead of language tags + languages_hierarchy: + type: array + items: + type: string + languages_tags: + type: array + items: + type: string + last_edit_dates_tags: + type: array + items: + type: string + last_editor: + type: string + last_modified_by: + type: string + description: > + The username of the user who last modified the + product. + example: sebleouf + last_modified_t: + type: integer + description: | + Date when the product page was last modified. + owner: + description: > + Id of the producer in case he provides his own + data about a product (producer platform). + type: string + owners_tags: + description: | + Tagyfied version of owner + type: string + photographers_tags: + type: array + items: + type: string + rev: + description: >- + revision number of this product version (each + edit adds a revision) + type: integer + sources: + type: array + items: + type: object + properties: + fields: + type: array + items: + type: string + id: + type: string + images: + type: array + items: + type: object + import_t: + type: integer + manufacturer: + type: + - integer + - string + name: + type: string + source_licence: + type: string + source_licence_url: + type: string + url: + type: + - 'null' + - string + sources_fields: + type: object + properties: + org-gs1: + type: object + properties: + gln: + type: string + gpcCategoryCode: + type: string + gpcCategoryName: + type: string + isAllergenRelevantDataProvided: + type: string + lastChangeDateTime: + type: string + partyName: + type: string + productionVariantDescription: + type: string + publicationDateTime: + type: string + teams: + type: string + teams_tags: + type: array + items: + type: string + update_key: + type: string + - type: object + description: | + Knowledge panels for a product + properties: + knowledge_panels: + type: object + x-stoplight: + id: bcq3fkbtnwr5t + title: panels + description: >- + The panels object is a dictionary of individual + panel objects. + + Each key of the dictionary is the id of the + panel, and the value is the panel object. + + + Apps typically display a number of root panels + with known panel ids (e.g. health_card and + environment_card). Panels can reference other + panels and display them as sub-panels. + examples: + - additionalProperties: string + properties: + additionalProperties: + title: panel + x-stoplight: + id: mj9nhz3mqn05c + type: object + description: >- + Each panel contains an optional title and an + optional array of elements. + properties: + type: + type: string + description: >- + Type of the panel. If set to "card", the + panel and its sub-panels should be + displayed in a card. If set to "inline", + the panel should have its content always + displayed. + expanded: + type: boolean + description: >- + If true, the panel is to be displayed + already expanded. If false, only the + title should be displayed, and the user + should be able to click or tap it to + open the panel and display the elements. + expand_for: + type: string + description: >- + If set to "large", the content of the + panel should be expanded on large + screens, but it should still be possible + to unexpand it. + evaluation: + type: string + description: >- + A simple assessment of the panel value, + typically used to format fonts, et.c + e.g. bad = red + enum: + - good + - average + - neutral + - bad + - unknown + title_element: + title: title_element + x-stoplight: + id: lox0wvl9bdgy2 + type: object + description: The title of a panel. + properties: + name: + type: string + description: >- + A short name of this panel, not + including any actual values + title: + type: string + type: + type: string + enum: + - grade + - percentage + description: >- + Used to indicate how the value of this + item is measured, such as "grade" for + Nutri-Score and Eco-Score or + "percentage" for Salt + grade: + type: string + description: >- + The value for this panel where it + corresponds to a A to E grade such as + the Nutri-Score of the Eco-Score. + enum: + - a + - b + - c + - d + - e + - unknown + value: + type: number + description: >- + The numeric value of the panel, where + the type is "percentage" + icon_url: + type: string + icon_color_from_evaluation: + type: string + icon_size: + type: string + description: > + If set to "small", the icon should be + displayed at a small size. + elements: + type: array + description: >- + An ordered list of elements to display + in the content of the panel. + items: + title: element + x-stoplight: + id: e2ybdrtmx0tme + type: object + description: > + Each element object contains one + specific element object such as a text + element or an image element. + properties: + type: + element_type: string + enum: + - text + - image + - action + - panel + - panel_group + - table + description: > + The type of the included element object. + + The type also indicates which field + contains the included element object. + + e.g. if the type is "text", the included + element object will be in the + "text_element" field. + + + Note that in the future, new type of + element may be added, + + so your code should ignore unrecognized + types, and unknown properties. + + + TODO: add Map type + text_element: + title: text_element + x-stoplight: + id: vdwxlt73qnqfa + type: object + description: >- + A text in simple HTML format to display. + + + For some specific texts that correspond + to a product field (e.g. a product name, + the ingredients list of a product),the + edit_field_* fields are used to indicate + how to edit the field value. + properties: + type: + type: string + description: > + the type of text, might influence the + way you display it. + enum: + - summary + - warning + - notes + html: + type: string + description: Text to display in HTML format. + language: + type: string + description: >- + Language of the text. The name of the + language is returned in the language + requested when making the API call. e.g. + if the text is in Polish, and the + requested language is French, the + language field will contain "Polonais" + (French for "Polish"). Only set for + specific fields such as the list of + ingredients of a product. + lc: + type: string + description: >- + 2 letter language code for the text. + Only set for specific fields such as the + list of ingredients of a product. + edit_field_id: + type: string + description: >- + id of the field used to edit this text + in the product edit API. + edit_field_type: + type: string + description: Type of the product field. + edit_field_value: + type: string + description: >- + Current value of the product field. This + may differ from the html field which can + contain extra formating. + source_url: + type: string + description: Link to the source + example: >- + https://en.wikipedia.org/wiki/Sodium + acetate + source_text: + type: string + description: name of the source + example: Wikipedia + source_lc: + type: string + description: Source locale name + example: en + source_language: + type: string + description: Human readable source locale name + example: English + image_element: + title: image_element + x-stoplight: + id: k4v4kwt489q3j + type: object + properties: + url: + type: string + description: full URL of the image + width: + type: integer + description: > + Width of the image. + + + This is just a suggestion coming from + the server, + + the client may choose to use its own + dimensions for the image. + height: + type: integer + description: > + Height of the image. + + + This is just a suggestion coming from + the server, + + the client may choose to use its own + dimensions for the image. + alt_text: + type: string + description: Alt Text of the image. + action_element: + type: string + panel_element: + title: panel_element + x-stoplight: + id: ymx41elz4yrnj + type: object + description: >- + Panels can include other panels as + sub-panels using the panel_element. + properties: + panel_id: + type: string + description: >- + The id of the panel to include. The id + is the key of the panel in the panels + object returned in the knowledge_panels + field. + panel_group_element: + title: panel_group_element + x-stoplight: + id: b7emlfrgiuue2 + type: object + properties: + title: + type: string + panel_ids: + type: array + description: >- + The ids of the panels to include. The + ids are the keys of the panels in the + panels object returned in the + knowledge_panels field. + items: + type: string + description: >- + The panel group element is used to + display an optional title followed by a + number of sub-panels. + table_element: + title: table_element + x-stoplight: + id: 38zu3z4sruqo7 + type: object + description: Element to display a table. + properties: + id: + type: string + description: An id for the table. + title: + type: string + description: | + Title of the column. + rows: + type: string + columns: + type: array + items: + type: object + properties: + type: + type: string + text: + type: string + text_for_small_screens: + type: string + style: + type: string + column_group_id: + type: string + shown_by_default: + type: boolean + required: + - type + level: + type: string + description: > + a message level, as levels we use in + log. + + It might help theming the panel visualy + example: info + size: + type: string + enum: + - small + description: > + size is either empty (normal display) + + or small to indicate a panel that should + have a smaller font size + example: small + topics: + type: array + items: + type: string + example: health + readOnly: true + - type: object + description: > + Specific data about a product to enable personal + ranking + properties: + attribute_groups: + type: array + description: >- + Each element is an attribute that can help + compute a personal ranking for the product + items: + type: object + properties: + id: + type: string + description: > + Unique id of the attribute. + + + It will be use to match against + preferences parameters. + status: + type: string + enum: + - known + - unknown + description: >- + wether we have the information to really + compute this criteria or not. + title: + type: string + description: > + A descriptive sentence about the situation + of the product concerning attribute + example: 'Does not contain: Molluscs' + match: + type: number + format: float + minimum: 0 + maximum: 100 + description: > + a numeric value for the match, + + telling how much the products ranks well + for this particular attribute. + + The higher the value, the better the + match. + grade: + description: every attribute as a grade for a to e + type: string + enum: + - unknown + - a + - b + - c + - d + - e + name: + type: string + description: >- + The name of attribute, for eventual + display + icon_url: + type: string + description: >- + an icon representing the attribute match + (often using a color) + description: + type: string + description: >- + An eventual description of the value of + the property upon which this attribute is + based + description_short: + type: string + description: >- + An eventual short description of the value + of the property upon which this attribute + is based + skip: + type: integer + example: 0 + operationId: get-search + description: > + Search request allows you to get products that match your search + criteria. + + + It allows you create many custom APIs for your use case. + + + If the search query parameter has 2 possible values, they are seperated + by a comma(,). + + When filtering via a parameter that has different language codes like + `fr`, `de` or `en`, specify the language code in the parameter name e.g + `categories_tags_en` + + + **Important:** search API v2 does not support full text request + (search_term), + + you have to use [search API + v1](https://wiki.openfoodfacts.org/API/Read/Search) for that. + + Upcoming [search-a-licious + project](https://github.com/openfoodfacts/search-a-licious) will fix + that. + + + ### Limiting results + + + You can limit the size of returned objects thanks to the `fields` object + (see below). + + + eg: `fields=code,product_name,brands,attribute_groups`` + + + Please use it as much as possible to avoid overloading the servers. + + + The search use pagination, see `page` and `page_size` parameters. + + + **Beware:** the `page_count` data in item is a bit counter intuitive…, + read the description. + + + ### Conditions on tags + + + All `_tags`` parameters accepts either: + + + * a single value + + * or a comma-separated list of values (doing a AND) + + * or a pipe separated list of values (doing a OR) + + + You can exclude terms by using a "-" prefix. + + + For taxonomized entries, you might either use the tag id (recommended), + + or a known synonym (without language prefix) + + + * `labels_tags=en:organic,en:fair-trade` find items that are fair-trade + AND organic + + * `labels_tags=en:organic|en:fair-trade` find items that are fair-trade + OR organic + + * `labels_tags=en:organic,en:-fair-trade` find items that are organic + BUT NOT fair-trade + + + + ### Conditions on nutriments + + + To get a list of nutrients + + + You can either query on nutrient per 100g (`_100g` suffix) + + or per serving (`serving` suffix). + + + You can also add `_prepared_` + + to get the nutrients in the prepared product instead of as sold. + + + You can add a comparison operator and value to the parameter name + + to get products with nutrient above or bellow a value. + + If you use a parameter value it exactly match it. + + + * `energy-kj_100g<200` products where energy in kj for 100g is less than + 200kj + + * `sugars_serving>10` products where sugar per serving is greater than + 10g + + * `saturated-fat_100g=1` products where saturated fat per 100g is + exactly 10g + + * `salt_prepared_serving<0.1` products where salt per serving for + prepared product is less than 0.1g + + + ### More references + + + See also [wiki + page](https://wiki.openfoodfacts.org/Open_Food_Facts_Search_API_Version_2) + parameters: + - style: form + explode: false + schema: + type: string + example: e322 + in: query + name: additives_tags + description: > + The additives_tags in english of product(s) you are searching for. + + The [OFF App](https://world.openfoodfacts.org/additives) has a list + of possible values for `additives`. + + + You can use multiple values by using a comma separated list. + + You can add a "-" before values to avoid matching a tag. + - style: form + explode: false + schema: + type: string + example: m + in: query + name: allergens_tags + description: > + The allergens_tags in english of product(s) you are searching for. + + The [OFF App](https://world.openfoodfacts.org/allergens) has a list + of possible values for `allergens`. + + + You can use multiple values by using a comma separated list. + + You can add a "-" before values to avoid matching a tag. + - style: form + explode: false + schema: + type: string + example: ferrero + in: query + name: brands_tags + description: > + The brands_tags of product(s) you are searching for. + + The [OFF App](https://world.openfoodfacts.org/brands) has a list of + possible values for `brands`. + + + You can use multiple values by using a comma separated list. + + You can add a "-" before values to avoid matching a tag. + - style: form + explode: false + schema: + type: string + example: chocolates + in: query + name: categories_tags + description: > + The category of product(s) you are searching for. + + The [OFF App](https://world.openfoodfacts.org/categories) has a list + of possible values for `categories`. + + + You can use multiple values by using a comma separated list. + + You can add a "-" before values to avoid matching a tag. + - style: form + explode: false + schema: + type: string + example: united-kingdom + in: query + name: countries_tags_en + description: > + The countries_tags_en of product(s) you are searching for. + + The [OFF App](https://world.openfoodfacts.org/countries) shows a + list of possible values for `countries`. + + + You can use multiple values by using a comma separated list. + + You can add a "-" before values to avoid matching a tag. + - style: form + explode: false + schema: + type: string + in: query + name: emb_codes_tags + description: | + The emb_codes_tags of product(s) you are searching for. + + You can use multiple values by using a comma separated list. + You can add a "-" before values to avoid matching a tag. + - style: form + explode: false + schema: + type: string + example: organic + in: query + name: labels_tags + description: > + The labels_tags in english of product(s) you are searching for. + + The [OFF App](https://world.openfoodfacts.org/labels) has a list of + possible values for `labels`. + + + You can use multiple values by using a comma separated list. + + You can add a "-" before values to avoid matching a tag. + - style: form + explode: false + schema: + type: string + in: query + name: manufacturing_places_tags + description: > + The manufacturing_places_tags of product(s) you are searching for. + + The [OFF App](https://world.openfoodfacts.org/manufacturing-places) + has a list of possible values for `manufacturing-places`. + + + You can use multiple values by using a comma separated list. + + You can add a "-" before values to avoid matching a tag. + - style: form + explode: false + schema: + type: string + example: e + in: query + name: nutrition_grades_tags + description: > + The nutrition_grades_tags of product(s) you are searching for. + + The [OFF App](https://world.openfoodfacts.org/nutrition-grades) has + a list of possible values for `nutrition-grades`. + + + You can use multiple values by using a comma separated list. + + You can add a "-" before values to avoid matching a tag. + - style: form + explode: false + schema: + type: string + in: query + name: origins_tags + description: | + The origins_tags of product(s) you are searching for. + + You can use multiple values by using a comma separated list. + You can add a "-" before values to avoid matching a tag. + - style: form + explode: false + schema: + type: string + example: 1-jar-aus-klarglas + in: query + name: packaging_tags_de + description: > + The packaging_tag in german of product(s) you are searching for. + + The [OFF App](https://world.openfoodfacts.org/packaging) has a list + of possible values for `packaging`. + + + You can use multiple values by using a comma separated list. + + You can add a "-" before values to avoid matching a tag. + - style: form + explode: false + schema: + type: string + in: query + name: purchase_places_tags + description: | + The purchase_places_tags of product(s) you are searching for. + + You can use multiple values by using a comma separated list. + You can add a "-" before values to avoid matching a tag. + - style: form + explode: false + schema: + type: string + example: nutrition-facts-completed + in: query + name: states_tags + description: > + The states_tags in english of product(s) you are searching for. + + The [OFF App](https://world.openfoodfacts.org/states) has a list of + possible values for `states`. + + + You can use multiple values by using a comma separated list. + + You can add a "-" before values to avoid matching a tag. + - style: form + explode: false + schema: + type: string + example: aldi + in: query + name: stores_tags + description: | + The stores_tags of product(s) you are searching for. + + You can use multiple values by using a comma separated list. + You can add a "-" before values to avoid matching a tag. + - style: form + explode: false + schema: + type: string + in: query + name: traces_tags + description: > + The traces_tags of product(s) you are searching for. + + The [OFF App](https://world.openfoodfacts.org/traces) shows a list + of possible values for `traces`. + + + You can use multiple values by using a comma separated list. + + You can add a "-" before values to avoid matching a tag. + - in: query + name: _tags_ + description: > + You can add a language code to a specific tag to query it in a + specific language + style: form + explode: false + schema: + type: object + patternProperties: + (?\w+)_tags_(?\w\w): + type: string + description: > + Will search in the tags corresponding to `tag_name`, + + in the language corresponding to `language_code. + + + `tag_name` is one of the field above which have the `_tags`` + suffix: + + categories, nutrition_grades, etc. + + + `language_code` is a two letter iso language `language_code. + + + You can use multiple values by using a comma separated list. + + You can add a "-" before values to avoid matching a tag. + examples: + - packaging_tags_de: null + summary: packaging in german + value: + packaging_tags_de: 'de:Flasche' + - origins_tags_fr: null + summary: origins in french + value: + origins_tags_fr: 'fr:France' + - categories_tags_en: null + summary: categories in english + value: + categories_tags_en: 'en:Beer' + - in: query + name: _lt_ + description: | + Search on nutrient lower than a value + schema: + type: object + patternProperties: + (?\w+)(?_prepared)?(?100g|serving)<(?\d+): + type: string + description: > + Will search for products with nutrients lower than `value` + + per `portion` (100g or serving). + + + If `prepared` is "prepared" search in prepared product instead + of "as sold". + + + Important: the parameter value is discarded and should be + empty + examples: + - salt_100g_lt_2: null + summary: salt per 100g is lower than 2g (in product as sold) + value: + salt_100g<2: 1 + - in: query + name: _gt_ + description: | + Search on nutrient greater than a value + schema: + type: object + patternProperties: + (?\w+)(?_prepared)?(?100g|serving)>(?\d+): + type: string + description: > + Will search for products with nutrients more than `value` + + per `portion` (100g or serving). + + + If `prepared` is "prepared" search in prepared product instead + of "as sold". + + + Important: the parameter value is discarded and should be + empty + examples: + - carbohydrates_prepared_serving_gt_10: null + summary: >- + carbohydrates per serving is greater than 10g in prepared + product + value: + salt_100g>10: 1 + - in: query + name: _eq_ + description: | + Search on nutrient for an exact quantity + schema: + type: object + patternProperties: + (?\w+)(?_prepared)?(?100g|serving): + type: string + description: > + Will search for products with nutrients exactl the parameter + value + + per `portion` (100g or serving). + + + If `prepared` is "prepared" search in prepared product instead + of "as sold". + examples: + - fat_100g_eq_5: null + summary: fat per 100g is exactly equal to 5g (in product as sold) + value: + fat_100g: 5 + - $ref: '#/components/parameters/fields' + - $ref: '#/components/parameters/sort_by' + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/page_size' + parameters: [] + /cgi/suggest.pl: + get: + summary: Get Suggestions to Aid Adding/Editing Products + tags: + - Read Requests + responses: + '200': + description: OK + content: + application/json: + schema: + type: array + operationId: get-cgi-suggest.pl + parameters: + - $ref: '#/components/parameters/tagtype' + - $ref: '#/components/parameters/term' + description: > + For example , Dave is looking for packaging_shapes that contain the term + "fe", + + all packaging_shapes containing "fe" will be returned. + + This is useful if you have a search in your application, + + for a specific product field. + /cgi/nutrients.pl: + get: + summary: >- + Get a nested list of nutrients that can be displayed in the nutrition + facts table for a specific country and language + tags: + - Read Requests + responses: + '200': + description: OK + content: + application/json: + schema: + type: array + description: > + Nutrients and sub-nutrients of a product, with their name and + default unit. + items: + type: object + properties: + id: + type: string + description: id of the nutrient + name: + type: string + description: Name of the nutrient in the requested language + important: + type: boolean + description: >- + Indicates if the nutrient is always shown on the + nutrition facts table + display_in_edit_form: + type: boolean + description: >- + Indicates if the nutrient should be shown in the + nutrition facts edit form + unit: + description: "The unit in which the nutrient for 100g or per serving is measured.\n\nThe possible values depends on the nutrient.\n\n* `g` for grams\n* `mg` for milligrams\n* `μg` for micrograms\n* `cl` for centiliters\n* `ml` for mililiters\n* `dv` for recommended daily intakes (aka [Dietary Reference Intake](https://en.wikipedia.org/wiki/Dietary_Reference_Intake))\n* `% vol` for percentage per volume (e.g. alcohol vol per 100 ml)\n* `%` for percentage\n\n\U0001F913 code: see the [Units module][units-module],\nand [Food:default_unit_for_nid function][default-unit]\n\n[units-module]: https://openfoodfacts.github.io/openfoodfacts-server/dev/ref-perl-pod/ProductOpener/Units.html\n[default-unit]: https://openfoodfacts.github.io/openfoodfacts-server/dev/ref-perl-pod/ProductOpener/Food.html#default_unit_for_nid_(_%24nid)\n" + type: string + enum: + - g + - mg + - μg + - cl + - ml + - dv + - '% vol' + - '%' + nutrients: + description: > + Sub-nutrients (e.g. saturated-fat is a sub-nutrient of + fat). + $ref: '#/' + operationId: get-cgi-nutrients.pl + parameters: + - $ref: '#/components/parameters/cc' + - $ref: '#/components/parameters/lc' + description: > + Used to display the nutrition facts table of a product, or to display a + form to input those nutrition facts. + /api/v2/attribute_groups: + get: + summary: Get the list of attributes available for personal search. + description: > + Attributes are at the heart of personal search. + + They score the products according to different criterias, + + which could then be matched to a user's preferences. + + + This API helps you list attributes and display them in your application, + + for the user to choose the importance of each criteria. + + + note: /api/v2/attribute_groups_{lc} is also a valid route, but consider + it deprecated + tags: + - Read Requests + - Personal search + operationId: get-attribute-groups + responses: + '200': + description: OK + content: + application/json: + schema: + type: array + description: > + List of groups of attributes for personal search in a specific + language. + items: + type: object + properties: + id: + type: string + description: unique id of the group + name: + type: string + description: Name of the group + attributes: + type: array + description: | + Attributes that are part of this group + items: + type: object + properties: + id: + type: string + description: unique id of the attribute + name: + type: string + description: Name of the attribute + icon_url: + type: string + description: >- + url of icon to display next to the settings for + this attribute + setting_name: + type: string + description: a description of the attribute to display to users + setting_note: + type: string + description: a complementary note on the attribute + default: + type: string + enum: + - mandatory + - very_important + - important + - not_important + description: Indicates the default setting for this attribute + panel_id: + type: string + description: Linked knowledge panel (optional) + parameters: + - $ref: '#/components/parameters/lc' + /api/v2/preferences: + get: + summary: | + Get the weights corresponding to attributes preferences + to compute personal product + tags: + - Read Requests + - Personal search + operationId: get-preferences + parameters: + - $ref: '#/components/parameters/lc' + responses: + '200': + description: OK + content: + application/json: + schema: + type: array + description: | + Rules to apply to compute personal ranking of a product, + based upon the setting value of each attribute. + items: + type: object + properties: + id: + type: string + description: id for the setting value + enum: + - not_important + - important + - very_important + - mandatory + name: + type: string + description: >- + name for the setting value, translated according to `lc` + parameter + factor: + type: integer + description: > + factor to apply to the property of the product + corresponding to attributes + + having this setting value + minimum_match: + type: integer + description: | + FIXME +components: + schemas: + Product-Base: + type: object + description: | + Base product data + properties: + abbreviated_product_name: + type: string + description: Abbreviated name in requested language + code: + type: string + description: > + barcode of the product (can be EAN-13 or internal codes for some + food stores), + + for products without a barcode, + + Open Food Facts assigns a number starting with the 200 reserved + prefix + codes_tags: + type: array + items: + type: string + description: | + A value which is the type of barcode "code-13" or "code-8" + and + A series of mask for the barcode + It helps retrieve barcodes starting by + example: > + ["code-13","3017620422xxx","301762042xxxx","30176204xxxxx","3017620xxxxxx","301762xxxxxxx","30176xxxxxxxx","3017xxxxxxxxx","301xxxxxxxxxx","30xxxxxxxxxxx","3xxxxxxxxxxxx"] + generic_name: + type: string + description: | + Legal name of the product as regulated + by the European authorities. + id: + description: > + internal identifier for the product, usually set to the value of + `code`, + + except on the producers platform where it is prefixed by the owner + type: string + lc: + type: string + description: | + Main language of the product. + This is a duplicate of `lang` property (for historical reasons). + lang: + type: string + description: > + Main language of the product. + + + This should be the main language of product packaging (if one is + predominant). + + + Main language is also used to decide which ingredients list to + parse. + nova_group: + type: integer + description: > + Nova group as an integer from 1 to 4. See + https://world.openfoodfacts.org/nova + nova_groups: + type: string + obsolete: + type: string + obsolete_since_date: + description: | + A date at which the product was declared obsolete. + This means it's not produced any more. + type: string + product_name: + type: string + description: | + The name of the product + product_name_en: + type: string + description: | + The name of the product can also + be in many other languages like + product_name_fr (for French). + product_quantity: + type: string + description: | + The size in g or ml for the whole product. + It's a normalized version of the quantity field. + example: '500' + product_quantity_unit: + type: string + description: | + The unit (either g or ml) for the correponding product_quantity. + example: g + quantity: + type: string + description: | + Quantity and Unit. + patternProperties: + abbreviated_product_name_(?\w\w): + type: string + description: Abbreviated name in language `language_code`. + generic_name_(?\w\w): + type: string + description: | + This can be returned in many other languages + like generic_name_fr (for French). + Product-Misc: + type: object + description: | + Miscellaneous but important fields of a product + properties: + additives_n: + type: integer + description: | + Number of food additives. + checked: + type: string + complete: + type: integer + completeness: + type: number + ecoscore_grade: + type: string + description: | + See also: `ecoscore_tags` + ecoscore_score: + type: integer + description: | + See also: `ecoscore_tags` + food_groups: + type: string + food_groups_tags: + type: array + items: + type: string + nutrient_levels: + description: | + Traffic light indicators on main nutrients levels + type: object + properties: + fat: + type: string + enum: + - low + - moderate + - high + salt: + type: string + enum: + - low + - moderate + - high + saturated-fat: + type: string + enum: + - low + - moderate + - high + sugars: + type: string + enum: + - low + - moderate + - high + packaging_text: + type: string + description: | + Recycling instructions as raw text, e.g. Plastic + bottle to recycle, Plastic cap to recycle. + This will get automatically parsed and + will be used to compute the Eco-Score. + You can either request it (if it exists) or + send it in a specific language. + example: packaging_text_en + packagings: + type: array + x-stoplight: + id: 1cyz4qo9njog7 + title: Packagings (READ) + description: >- + The packagings object is an array of individual packaging component + objects. + + + The Packaging data document explains how packaging data is + structured in Open Food Facts: + https://openfoodfacts.github.io/openfoodfacts-server/dev/explain-packaging-data/ + + + The shape, material and recycling properties of each packaging + component are linked to entries in the packaging_shapes, + packaging_materials and packaging_recycling taxonomies: + + + https://world.openfoodfacts.org/data/taxonomies/packaging_shapes.json + + https://world.openfoodfacts.org/data/taxonomies/packaging_materials.json + + https://world.openfoodfacts.org/data/taxonomies/packaging_recycling.json + + + If the tags_lc field is set, the properties will include a lc_name + field with the translation in the requested language. + examples: + - - number_of_units: 6 + shape: + id: 'en:bottle' + lc_name: bouteille + material: + id: 'en:bottle' + lc_name: bouteille + recycling: + id: 'en:bottle' + lc_name: bouteille + quantity_per_unit: 25 cl + quantity_per_unit_value: 25 + quantity_per_unit_unit: cl + weight_specified: 30 + weight_measured: 32 + weight_estimated: 26 + weight: 30 + weight_source_id: specified + items: + description: >- + Each packaging component has different properties to specify how + many there are, its shape, material etc. + + + The shape, material and recycling properties are mapped to one + entry in the packaging_shapes, packaging_materials and + packaging_recycling taxonomies, and the value of the property is + the canonical name of the taxonomy entry (e.g. en:bottle). + + + They may contain values that could not yet get matched to their + respective taxonomy, in which case they will contain a free text + value prefixed with the language code of this text value (e.g. + "fr:Bouteille sphérique" might have been entered by a French user + to indicate it is a spherical bottle). + title: Packaging component (READ) + type: object + examples: + - number_of_units: 6 + shape: + id: 'en:bottle' + lc_name: bouteille + material: + id: 'en:bottle' + lc_name: bouteille + recycling: + id: 'en:bottle' + lc_name: bouteille + quantity_per_unit: 25 cl + quantity_per_unit_value: 25 + quantity_per_unit_unit: cl + weight_specified: 30 + weight_measured: 32 + weight_estimated: 26 + weight: 30 + weight_source_id: specified + properties: + number_of_units: + type: integer + description: >- + umber of units of this packaging component contained in the + product (e.g. 6 for a pack of 6 bottles) + shape: + title: Packaging component shape + x-stoplight: + id: xrj8agza3dwgf + type: object + description: >- + The shape property is canonicalized using the packaging_shapes + taxonomy. + examples: + - id: 'en:bottle' + lc_name: bouteille + properties: + id: + type: string + description: >- + Canonical id of the entry in the taxonomy. If the value + cannot be mapped to a taxonomy entry, the value will be + the name of the entry in its original language prefixed by + the language 2 letter code and a colon. + lc_name: + type: string + description: >- + Name of the entry in the language requested in the tags_lc + field of the request. This field is returned only of + tags_lc is specified. If the translation is not available, + or if the entry does not exist in the taxonomy, the value + will be the name of the entry in its original language + prefixed by the language 2 letter code and a colon. + material: + title: Packaging component material + x-stoplight: + id: n6umazgqmwrd5 + type: object + description: >- + The material property is canonicalized using the + packaging_materials taxonomy. + examples: + - id: 'en:bottle' + lc_name: bouteille + properties: + id: + type: string + description: >- + Canonical id of the entry in the taxonomy. If the value + cannot be mapped to a taxonomy entry, the value will be + the name of the entry in its original language prefixed by + the language 2 letter code and a colon. + lc_name: + type: string + description: >- + Name of the entry in the language requested in the tags_lc + field of the request. This field is returned only of + tags_lc is specified. If the translation is not available, + or if the entry does not exist in the taxonomy, the value + will be the name of the entry in its original language + prefixed by the language 2 letter code and a colon. + recycling: + title: Packaging component recycling instruction + x-stoplight: + id: 376tk8e2cmyh2 + type: object + description: >- + The recycling property is canonicalized using the + packaging_recycling taxonomy. + examples: + - id: 'en:bottle' + lc_name: bouteille + properties: + id: + type: string + description: >- + Canonical id of the entry in the taxonomy. If the value + cannot be mapped to a taxonomy entry, the value will be + the name of the entry in its original language prefixed by + the language 2 letter code and a colon. + lc_name: + type: string + description: >- + Name of the entry in the language requested in the tags_lc + field of the request. This field is returned only of + tags_lc is specified. If the translation is not available, + or if the entry does not exist in the taxonomy, the value + will be the name of the entry in its original language + prefixed by the language 2 letter code and a colon. + quantity_per_unit: + type: string + description: >- + Quantity (weight or volume) of food product contained in the + packaging component. (e.g. 75cl for a wine bottle) + quantity_per_unit_value: + type: number + description: Value parsed from the quantity field. + quantity_per_unit_unit: + type: string + description: Unit parsed and normalized from the quantity field. + weight_specified: + type: number + description: >- + Weight (as specified by the manufacturer) of one unit of the + empty packaging component (in grams). (e.g. for a 6 pack of + 1.5l water bottles, it might be 30, the weight in grams of 1 + empty water bottle without its cap which is a different + packaging component). + weight_measured: + type: number + description: >- + Weight (as measured by one or more users) of one unit of the + empty packaging component (in grams). (e.g. for a 6 pack of + 1.5l water bottles, it might be 30, the weight in grams of 1 + empty water bottle without its cap which is a different + packaging component). + weight_estimated: + type: number + description: >- + Weight (as estimated from similar products) of one unit of the + empty packaging component (in grams). (e.g. for a 6 pack of + 1.5l water bottles, it might be 30, the weight in grams of 1 + empty water bottle without its cap which is a different + packaging component). + weight: + type: number + description: Weight of one unit of the empty packaging component. + weight_source_id: + type: string + description: >- + Indicates which field was used to populate the "weight" field. + Either "specified", "measured", or "estimated" + readOnly: true + packagings_complete: + title: packagings_complete + x-stoplight: + id: hxnnsy954q1ey + type: integer + minimum: 0 + maximum: 1 + description: >- + Indicate if the packagings array contains all the packaging parts of + the product. This field can be set by users when they enter or + verify packaging data. Possible values are 0 or 1. + pnns_groups_1: + description: > + Category of food according to [French Nutrition and Health + Program](https://fr.wikipedia.org/wiki/Programme_national_nutrition_sant%C3%A9) + type: string + pnns_groups_1_tags: + type: array + items: + type: string + pnns_groups_2: + description: > + Sub Category of food according to [French Nutrition and Health + Program](https://fr.wikipedia.org/wiki/Programme_national_nutrition_sant%C3%A9) + type: string + pnns_groups_2_tags: + type: array + items: + type: string + popularity_key: + description: > + An imprecise measurement of popularity based on Scan statistics. A + higher value means higher popularity. + type: integer + popularity_tags: + description: > + Indicators for the popularity of a product, like the amount of scans + in a specific year. + type: array + items: + type: string + scans_n: + type: integer + unique_scans_n: + type: integer + serving_quantity: + type: string + description: | + Normalized version of serving_size. + Note that this is NOT the number of servings by product. + (in perl, see `normalize_serving_size`) + serving_quantity_unit: + type: string + description: | + The unit (either g or ml) for the correponding serving_quantity. + example: g + serving_size: + type: string + description: > + Serving size text (generally in g or ml). + + We expect a quantity + unit but the user is free to input any + string. + patternProperties: + food_groups_(?\w\w): + type: string + description: see `food_groups` + packaging_text_(?\w\w): + type: string + description: | + Packaging text in language designated by `language_code` + Product-Tags: + type: object + description: | + Data about a product which is represented as tags + properties: + brands: + type: string + description: List of brands (not taxonomized) + brands_tags: + type: array + items: + type: string + description: 'List of brands (tags, not taxonomized)' + categories: + type: string + categories_hierarchy: + type: array + items: + type: string + categories_lc: + type: string + description: Categories language code + categories_tags: + type: array + items: + type: string + checkers_tags: + type: array + items: + type: string + description: List of checkers (users who checked the product) tags + cities: + type: string + cities_tags: + type: array + items: + type: object + correctors_tags: + type: array + items: + type: string + countries: + type: string + description: | + List of countries where the product is sold. + countries_hierarchy: + type: array + items: + type: string + countries_lc: + type: string + description: Countries language code + countries_tags: + type: array + items: + type: string + ecoscore_tags: + description: > + All ecoscore of a product. + + Most of the time it's only one value, + + but it might eventually be more for products composed of + sub-products. + + See also: `ecoscore_score`, `ecoscore_grade`. + type: array + items: + type: string + emb_codes: + type: string + description: > + Packager code. EMB is the French system of traceability codes for + packager. + example: EMB 2013330 + emb_codes_orig: + type: string + emb_codes_tags: + type: array + items: + type: object + labels: + type: string + labels_hierarchy: + type: array + items: + type: string + labels_lc: + type: string + labels_tags: + type: array + items: + type: string + entry_dates_tags: + description: | + The data as a series of tag: `yyyy-mm-dd`, `yyyy-mm`, `yyyy` + type: array + items: + type: string + example: + - '2016-03-11' + - 2016-03 + - '2016' + manufacturing_places: + type: string + description: | + Places where the product was manufactured or transformed. + manufacturing_places_tags: + type: array + items: + type: object + nova_groups_tags: + type: array + items: + type: string + nutrient_levels_tags: + type: array + items: + type: string + Product-Nutrition: + type: object + description: > + Nutrition fields of a product + + + Most of these properties are read-only. + + + See [how to add nutrition + data](https://openfoodfacts.github.io/openfoodfacts-server/api/ref-cheatsheet/#add-nutrition-facts-values-units-and-base) + properties: + no_nutrition_data: + type: string + description: | + When a product does not have nutrition data displayed on the + packaging, the user can check the field "Nutrition facts are + not specified on the product". + By doing so, the no_nutrition_data field takes the value "on". + This case is frequent (thousands of products). + example: 'on' + nutrition_data_per: + type: string + enum: + - serving + - 100g + description: > + The nutrition data on the package can be per serving or per 100g. + + + This is essential to understand if `_value` and + `` + + values in `nutriments` applies for a serving or for 100g. + + + **IMPORTANT:** + + When writing products, + + this setting applies to all existing nutrients values for the + product, + + not only the nutrient values sent in the write request. + + So it should not be changed unless all nutrients values are provided + + with values that match the nutrition_data_per field. + nutrition_data_prepared_per: + type: string + enum: + - serving + - 100g + description: > + The nutrition data for prepared product on the package (if any) can + be per serving or per 100g. + + + This is essential to understand if `_prepared_value` and + `_prepared` + + values in `nutriments` applies for a serving or for 100g. + + + See also important note on `nutrition_data_per`. + nutriments: + type: object + description: > + All known nutrients for the product. + + + Note that each nutrients are declined with a variety of suffixes + like `_100g`, `_serving`, + + see patternProperties below. + + + A specific `_unit` is the unit used to measure the nutrient. + + + Beware that some properties are to be interpreted based upon + `nutrition_data_per` value. + + + Also for products that have a nutrition table for prepared product + + (eg. the nutrition facts for a bowl of milk with cocoa powder), + + a `_prepared` suffix is added (before other suffixes). + + + You can get all possible nutrients from the + + [nutrients + taxonomy](https://static.openfoodfacts.org/data/taxonomies/nutrients.json) + + + **FIXME** add more nutrients with description. + properties: + alcohol: + description: | + Quantity of alcohol + + (per 100g or per serving) in a standard unit (g or ml) + type: number + carbohydrates: + type: number + energy: + type: number + description: > + It is the same as `energy-kj` if we have it, or computed from + `energy-kcal` otherwise + + + (per 100g or per serving) in kj + energy_value: + type: number + description: > + energy_value will be equal to energy-kj_value if we have it or + to energy-kcal_value otherwise + energy_unit: + type: string + enum: + - kcal + - kj + description: > + Equal to energy-kj_unit if we have it or to energy-kcal_unit + otherwise + energy-kcal: + type: number + description: | + energy in kcal, if it is specified + + (per 100g or per serving) in a standard unit (g or ml) + energy-kj: + type: number + description: | + energy in kj, if it is specified + + (per 100g or per serving) in a standard unit (g or ml) + fat: + type: number + fruits-vegetables-legumes-estimate-from-ingredients: + type: number + description: > + An estimate, from the ingredients list of the percentage of + fruits, vegetable and legumes. + + This is an important information for Nutri-Score (2023 version) + computation. + fruits-vegetables-nuts-estimate-from-ingredients: + type: number + description: > + An estimate, from the ingredients list of the percentage of + fruits, vegetable and nuts. + + This is an important information for Nutri-Score (2021 version) + computation. + nova-group: + type: integer + nutrition-score-fr: + description: | + Experimental nutrition score derived from + the UK FSA score and adapted for the French market + (formula defined by the team of Professor Hercberg). + proteins: + type: number + salt: + type: number + saturated-fat: + type: number + sodium: + type: number + sugars: + type: number + carbon-footprint-from-known-ingredients_product: + type: integer + carbon-footprint-from-known-ingredients_serving: + type: number + erythritol: + type: number + description: | + erythritol is a polyol which is not providing any energy. + As such, it needs not be taken into account when computing + the energy of a product. Eryhtritol is now displayed on + nutrition facts sheet of some products, mainly in the USA. + This value is entered either by contributors, either by + imports. + example: 12.5 + patternProperties: + '(?[\w-]+)_unit': + description: "The unit in which the nutrient for 100g or per serving is measured.\n\nThe possible values depends on the nutrient.\n\n* `g` for grams\n* `mg` for milligrams\n* `μg` for micrograms\n* `cl` for centiliters\n* `ml` for mililiters\n* `dv` for recommended daily intakes (aka [Dietary Reference Intake](https://en.wikipedia.org/wiki/Dietary_Reference_Intake))\n* `% vol` for alcohol vol per 100 ml\n\n\U0001F913 code: see the [Units module][units-module],\nand [Food:default_unit_for_nid function][default-unit]\n\n[units-module]: https://openfoodfacts.github.io/openfoodfacts-server/dev/ref-perl-pod/ProductOpener/Units.html\n[default-unit]: https://openfoodfacts.github.io/openfoodfacts-server/dev/ref-perl-pod/ProductOpener/Food.html#default_unit_for_nid_(_%24nid)\n" + type: string + enum: + - 公斤 + - 公升 + - kg + - кг + - l + - л + - 毫克 + - mg + - мг + - mcg + - µg + - oz + - fl oz + - dl + - дл + - cl + - кл + - 斤 + - g + - '' + - ' ' + - kj + - 克 + - 公克 + - г + - мл + - ml + - mmol/l + - 毫升 + - '% vol' + - ph + - '%' + - '% dv' + - '% vol (alcohol)' + - iu + - mol/l + - mval/l + - ppm + - �rh + - �fh + - �e + - �dh + - gpg + '(?[\w-]+)_100g': + description: > + The standardized value of a serving of 100g (or 100ml for + liquids) + + for the nutrient. + + + This is computed from the `nutrient` property, + + the serving size (if needed), and the `nutrient`_unit field. + + + **Note**: + + If you want to characterize products in a uniform way, this is + the value you should use. + type: number + readOnly: true + '(?[\w-]+)_serving': + description: | + The standardized value of a serving for this product. + type: number + readOnly: true + '(?[\w-]+)_value': + description: > + The value input by the user / displayed on the product for the + nutrient. + + + * per 100g or serving, depending on `nutrition_data_per` + + * in the unit of corresponding _unit field. + type: number + readOnly: true + '(?[\w-]+)_prepared': + description: | + The value for nutrient for **prepared** product. + type: number + '(?[\w-]+)_prepared_unit': + description: > + The unit in which the nutrient of **prepared** product is + measured. + type: string + '(?[\w-]+)_prepared_100g': + description: > + The standardized value of a serving of 100g (or 100ml for + liquids) + + for the nutrient, for **prepared** product. + type: number + readOnly: true + '(?[\w-]+)_prepared_serving': + description: > + The standardized value of a serving for the **prepared** + product. + type: number + readOnly: true + '(?[\w-]+)_prepared_value': + description: > + The standardized value for a serving or 100g (or 100ml for + liquids), + + depending on `nutrition_data_prepared_per` + + for the nutrient for **prepared** product. + type: number + readOnly: true + nutriscore_data: + description: > + Detail of data the Nutri-Score was computed upon. + + + **Note**: this might not be stable, don't rely too much on this, or, + at least, tell us ! + + + **TODO** document each property + type: object + properties: + energy: + type: integer + energy_points: + type: integer + energy_value: + type: integer + fiber: + type: integer + fiber_points: + type: integer + fiber_value: + type: integer + fruits_vegetables_nuts_colza_walnut_olive_oils: + type: integer + fruits_vegetables_nuts_colza_walnut_olive_oils_points: + type: integer + fruits_vegetables_nuts_colza_walnut_olive_oils_value: + type: integer + grade: + type: string + is_beverage: + type: integer + is_cheese: + type: integer + is_fat: + type: integer + is_water: + type: integer + negative_points: + type: integer + positive_points: + type: integer + proteins: + type: number + proteins_points: + type: integer + proteins_value: + type: number + saturated_fat: + type: number + saturated_fat_points: + type: integer + saturated_fat_ratio: + type: number + saturated_fat_ratio_points: + type: integer + saturated_fat_ratio_value: + type: number + saturated_fat_value: + type: number + score: + type: integer + sodium: + type: number + sodium_points: + type: integer + sodium_value: + type: number + sugars: + type: number + sugars_points: + type: integer + sugars_value: + type: number + nutriscore_grade: + description: | + Nutri-Score for the product as a letter. + + See https://world.openfoodfacts.org/nutriscore. + type: string + enum: + - a + - b + - c + - d + - e + nutriscore_score: + description: > + Nutri-Score for the product as an integer (see also + `nutriscore_grade`). + type: integer + nutriscore_score_opposite: + type: integer + nutrition_grade_fr: + type: string + description: | + Nutrition grade (‘a’ to ‘e’), + https://world.openfoodfacts.org/nutriscore. + nutrition_grades: + description: > + Nutrition grades as a comma separated list. + + + Some products with multiple components might have multiple + Nutri-Score + type: string + nutrition_grades_tags: + type: array + items: + type: string + nutrition_score_beverage: + type: integer + nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients: + type: integer + nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients_value: + type: integer + nutrition_score_warning_no_fiber: + type: integer + other_nutritional_substances_tags: + type: array + items: + type: object + unknown_nutrients_tags: + type: array + items: + type: object + vitamins_tags: + type: array + items: + type: object + Product-Ingredients: + type: object + description: Fields about ingredients of a product + properties: + additives_tags: + type: array + items: + type: string + allergens: + type: string + description: comma separated list of allergens + allergens_lc: + type: string + description: language in which `allergens` where input + allergens_hierarchy: + type: array + items: + type: string + allergens_tags: + type: array + items: + type: string + ingredients: + type: array + description: > + This structure gives the different ingredients and some information + about them, + + like estimate on their quantity. + items: + type: object + properties: + id: + type: string + ingredients: + description: | + Sub ingredients composing this ingredients. + $ref: '#' + percent: + type: integer + percent_estimate: + type: + - number + percent_max: + type: + - number + percent_min: + type: integer + text: + type: string + vegan: + type: string + vegetarian: + type: string + ingredients_analysis: + type: object + properties: + 'en:palm-oil': + type: array + items: + type: string + 'en:vegan-status-unknown': + type: array + items: + type: string + 'en:vegetarian-status-unknown': + type: array + items: + type: string + ingredients_analysis_tags: + type: array + items: + type: string + ingredients_from_or_that_may_be_from_palm_oil_n: + type: integer + ingredients_from_palm_oil_n: + type: integer + ingredients_from_palm_oil_tags: + type: array + items: + type: object + ingredients_hierarchy: + type: array + items: + type: string + ingredients_n: + type: integer + ingredients_n_tags: + type: array + items: + type: string + ingredients_original_tags: + type: array + items: + type: string + ingredients_percent_analysis: + type: integer + ingredients_sweeteners_n: + type: integer + description: > + Number of sweeteners additives in the ingredients. Undefined if + ingredients are not specified. + ingredients_non_nutritive_sweeteners_n: + type: integer + description: > + Number of non-nutritive sweeteners additives (as specified in the + Nutri-Score formula) in the ingredients. Undefined if ingredients + are not specified. + ingredients_tags: + type: array + items: + type: string + ingredients_lc: + type: string + description: > + Language that was used to parse the ingredient list. If + `ingredients_text` is available + + for the product main language (`lang`), `ingredients_lc=lang`, + otherwise we look at + + `ingredients_text` fields for other languages and set + `ingredients_lc` to the first + + non-empty `ingredient_text`. + ingredients_text: + type: string + description: > + Raw list of ingredients. This will get automatically + + parsed and get used to compute the Eco-Score or find allergens, + etc.. + + + It's a copy of ingredients_text in the main language of the product + (see `lang` proprety). + example: > + Farine de blé* 67,4%, sucre de canne*, huile de tournesol oléique*, + graines de chia* 5,2%, son de blé*, oranges déshydratées * 0,9%, + farine de riz*, poudres à lever (acide citrique, carbonates de + sodium), arôme naturel d'orange. + ingredients_text_with_allergens: + type: string + description: > + Same text as `ingredients_text` but where allergens have HTML + elements around them to identify them + example: > + Farine de blé* 67,4%, sucre de canne*, + huile de tournesol oléique*, graines de chia* 5,2%, son de blé*, oranges déshydratées * 0,9%, + farine de riz*, poudres à lever (acide citrique, carbonates de + sodium), arôme naturel d'orange. + ingredients_that_may_be_from_palm_oil_n: + type: integer + ingredients_that_may_be_from_palm_oil_tags: + type: array + items: + type: object + ingredients_with_specified_percent_n: + type: integer + ingredients_with_specified_percent_sum: + type: integer + ingredients_with_unspecified_percent_n: + type: integer + ingredients_with_unspecified_percent_sum: + type: integer + known_ingredients_n: + type: integer + origins: + type: string + description: | + Origins of ingredients + origins_hierarchy: + type: array + items: + type: object + origins_lc: + type: string + origins_tags: + type: array + items: + type: object + traces: + type: string + description: | + List of substances that might cause allergies + that are present in trace amounts in the product + (this does not include the ingredients, as they + are not only present in trace amounts). + It is taxonomized with the allergens taxonomy. + traces_hierarchy: + type: array + items: + type: object + traces_lc: + type: string + traces_tags: + type: array + items: + type: object + unknown_ingredients_n: + type: integer + patternProperties: + ingredients_text_(?\w\w): + type: string + description: | + Raw list of ingredients in language given by 'language_code'. + + See `ingredients_text` + ingredients_text_with_allergens_(?\w\w): + description: | + Like `ingredients_text_with_allergens` for a particular language + type: string + Product-Images: + type: object + description: > + Information about Images of a product. + + + Images ensure the reliability of Open Food Facts data. + + It provides a primary source and proof of all the structured data. + + You may therefore want to display it along the structured information. + + + See also tutorials about images: + + * [Getting + images](https://openfoodfacts.github.io/openfoodfacts-server/api/how-to-download-images/) + + * [Uploading + images](https://openfoodfacts.github.io/openfoodfacts-server/api/tutorial-uploading-photo-to-a-product/) + properties: + images: + description: | + This contains properties for all images contained on the product. + type: object + properties: + '1': + type: object + description: > + This object represent an image that was uploaded to a product. + + "imgid" is an integer which is a sequential number unique to + each picture. + properties: + sizes: + type: object + description: > + The available image sizes for the product (both reduced and + full). + + The reduced images are the ones with numbers as the key( + 100, 200 etc) + + while the full images have `full` as the key. + properties: + full: + description: | + properties of fullsize image + **TODO** explain how to compute name + type: object + properties: + h: + type: integer + example: 400 + description: | + The height of the reduced/full image in pixels. + w: + type: integer + example: 255 + description: The width of the reduced/full image in pixels. + patternProperties: + (?100|400): + description: > + properties of thumbnail of size `image_size`. + + **TODO** explain how to compute name + + + For real type: see description of property `full`. + + (Put this way because of a [bug in + rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) + type: string + uploaded_t: + type: string + example: '1457680652' + description: | + The time the image was uploaded (as unix timestamp). + uploader: + type: string + example: openfoodfacts-contributors + description: | + The contributor that uploaded the image. + front: + description: > + property of an image (or part thereof) selected for a particular + role and a particular language. + type: object + properties: + angle: + type: integer + example: 0 + description: The angle of the image rotation (if it was rotated). + coordinates_image_size: + type: string + example: full + geometry: + type: string + example: 0x0--1--1 + imgid: + type: string + example: '121' + description: >- + The id of the original/source image that was selected to + edit(rotate, normalize etc) to produce this new image. + normalize: + type: 'null' + example: null + description: Normalize colors. + rev: + type: string + example: '420' + sizes: + type: object + description: > + The available image sizes for the product (both reduced and + full). + + The reduced images are the ones with numbers as the key( + 100, 200 etc) + + while the full images have `full` as the key. + properties: + '100': + type: object + properties: + h: + type: integer + example: 400 + description: | + The height of the reduced/full image in pixels. + w: + type: integer + example: 255 + description: The width of the reduced/full image in pixels. + '200': + type: object + properties: + h: + type: integer + example: 400 + description: | + The height of the reduced/full image in pixels. + w: + type: integer + example: 255 + description: The width of the reduced/full image in pixels. + '400': + type: object + properties: + h: + type: integer + example: 400 + description: | + The height of the reduced/full image in pixels. + w: + type: integer + example: 255 + description: The width of the reduced/full image in pixels. + full: + type: object + properties: + h: + type: integer + example: 400 + description: | + The height of the reduced/full image in pixels. + w: + type: integer + example: 255 + description: The width of the reduced/full image in pixels. + white_magic: + type: 'null' + example: null + description: | + Photo on white background : Try to remove the background. + x1: + type: string + example: '-1' + x2: + type: string + example: '-1' + y1: + type: string + example: '-1' + y2: + type: string + example: '-1' + patternProperties: + (?\d+): + description: > + See property `1` to get the real type of those objects + + (Put this way because of a [bug in + rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) + type: string + (?front|nutrition|ingredients|packaging|other)_(?\w\w): + description: > + See property `front` to get the real type of those objects + + (Put this way because of a [bug in + rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) + type: string + last_image_dates_tags: + type: array + items: + type: string + last_image_t: + description: timestamp of last image upload (or update?) + type: integer + selected_images: + type: object + description: | + URL for selected (important) images of the product. + + This is very handy if you display the product to users. + properties: + front: + type: object + description: URLs of thumbnails image of image of type `image_type` + properties: + display: + description: > + Thumbnail urls of product image (front) adapted to display + on product page + type: object + patternProperties: + (?\w\w): + type: string + description: url of the image for language `language_code` + small: + description: > + Thumbnail urls of product image (front) adapted to display + on product list page + type: object + patternProperties: + (?\w\w): + type: string + description: url of the image for language `language_code` + thumb: + description: | + Thumbnail urls of product image (front) in smallest format + type: object + patternProperties: + (?\w\w): + type: string + description: url of the image for language `language_code` + patternProperties: + (?front|packaging|ingredients|nutrition|other): + description: > + See property `front` to get the real type of those objects + + (Put this way because of a [bug in + rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) + type: string + image_small_url: + type: string + image_thumb_url: + type: string + image_url: + type: string + patternProperties: + image(_(?front|packaging|ingredients|nutrition|other))?(_(?small|thumb))?_url: + description: > + the URL of image of type `image_type` in size `image_size` (or + full size if not given). + + + The `image_type` tells which image the url correspond to. + `image_type` is `front` if not provided. + + + The image is the one for current language (affected by `lc` + parameter) if an image exists for this language, the image in main + product language otherwise. + + + **IMPORTANT:** you should use `selected_images` field instead of + this one. + type: string + Product-Eco-Score: + type: object + description: | + Fields related to Eco-Score for a product. + + See also: `ecoscore_score`, `ecoscore_grade` and `ecoscore_tags`. + properties: + ecoscore_data: + type: object + description: > + An object about a lot of details about data needed for Eco-Score + computation + + and complementary data of interest. + properties: + adjustments: + type: object + properties: + origins_of_ingredients: + type: object + properties: + aggregated_origins: + type: array + items: + type: object + properties: + origin: + type: string + percent: + type: integer + epi_score: + type: integer + epi_value: + type: integer + origins_from_origins_field: + type: array + items: + type: string + transportation_scores: + type: object + patternProperties: + (?\w\w): + type: integer + transportation_values: + type: object + patternProperties: + (?\w\w): + type: integer + values: + type: object + patternProperties: + (?\w\w): + type: integer + warning: + type: string + packaging: + type: object + properties: + non_recyclable_and_non_biodegradable_materials: + type: integer + packagings: + type: array + items: + type: object + properties: + ecoscore_material_score: + type: integer + ecoscore_shape_ratio: + type: integer + material: + type: string + shape: + type: string + score: + type: integer + value: + type: integer + warning: + type: string + production_system: + type: object + properties: + labels: + type: array + example: 'vegan, fat free, Kosher' + items: + type: string + value: + type: integer + warning: + type: string + threatened_species: + type: object + properties: + ingredient: + type: string + value: + type: integer + agribalyse: + type: object + properties: + agribalyse_food_code: + type: string + co2_agriculture: + type: number + co2_consumption: + type: integer + co2_distribution: + type: number + co2_packaging: + type: number + co2_processing: + type: number + co2_total: + type: number + co2_transportation: + type: number + code: + type: string + dqr: + type: string + ef_agriculture: + type: number + ef_consumption: + type: integer + ef_distribution: + type: number + ef_packaging: + type: number + ef_processing: + type: number + ef_total: + type: number + ef_transportation: + type: number + is_beverage: + type: integer + name_en: + type: string + description: | + This can be returned in many other languages + like name_fr (for french). + score: + type: integer + version: + type: string + grade: + type: string + grades: + type: object + patternProperties: + (?\w\w): + type: string + missing: + type: object + properties: + labels: + type: integer + origins: + type: integer + packagings: + type: integer + missing_data_warning: + type: integer + previous_data: + type: object + properties: + grade: + type: string + score: + type: integer + agribalyse: + type: object + properties: + agribalyse_food_code: + type: string + co2_agriculture: + type: number + co2_consumption: + type: integer + co2_distribution: + type: number + co2_packaging: + type: number + co2_processing: + type: number + co2_total: + type: number + co2_transportation: + type: number + code: + type: string + dqr: + type: string + ef_agriculture: + type: number + ef_consumption: + type: integer + ef_distribution: + type: number + ef_packaging: + type: number + ef_processing: + type: number + ef_total: + type: number + ef_transportation: + type: number + is_beverage: + type: integer + name_en: + type: string + description: | + This can be returned in many other languages + like name_fr (for french). + score: + type: integer + version: + type: string + score: + type: integer + scores: + type: object + patternProperties: + (?\w\w): + type: integer + status: + type: string + ecoscore_extended_data_version: + type: string + environment_impact_level: + type: string + environment_impact_level_tags: + type: array + items: + type: object + Product-Metadata: + type: object + description: | + Metadata of a product (author, editors, creation date, etc.) + properties: + created_t: + type: integer + description: | + Date when the product was added (UNIX timestamp format). + See also `entry_dates_tags` + example: | + 1457680652 + creator: + type: string + description: | + The contributor who added the product first. + editors_tags: + description: | + List of editors who edited the product. + type: array + items: + type: string + informers_tags: + type: array + items: + type: string + interface_version_created: + type: string + interface_version_modified: + type: string + languages: + type: object + patternProperties: + 'en:(?\w\w)': + type: integer + description: | + **TODO** explain ! + languages_codes: + type: object + patternProperties: + (?\w\w): + type: integer + description: | + Same as `languages` but by language code, instead of language tags + languages_hierarchy: + type: array + items: + type: string + languages_tags: + type: array + items: + type: string + last_edit_dates_tags: + type: array + items: + type: string + last_editor: + type: string + last_modified_by: + type: string + description: | + The username of the user who last modified the product. + example: sebleouf + last_modified_t: + type: integer + description: | + Date when the product page was last modified. + owner: + description: > + Id of the producer in case he provides his own data about a product + (producer platform). + type: string + owners_tags: + description: | + Tagyfied version of owner + type: string + photographers_tags: + type: array + items: + type: string + rev: + description: revision number of this product version (each edit adds a revision) + type: integer + sources: + type: array + items: + type: object + properties: + fields: + type: array + items: + type: string + id: + type: string + images: + type: array + items: + type: object + import_t: + type: integer + manufacturer: + type: + - integer + - string + name: + type: string + source_licence: + type: string + source_licence_url: + type: string + url: + type: + - 'null' + - string + sources_fields: + type: object + properties: + org-gs1: + type: object + properties: + gln: + type: string + gpcCategoryCode: + type: string + gpcCategoryName: + type: string + isAllergenRelevantDataProvided: + type: string + lastChangeDateTime: + type: string + partyName: + type: string + productionVariantDescription: + type: string + publicationDateTime: + type: string + teams: + type: string + teams_tags: + type: array + items: + type: string + update_key: + type: string + Product-Data-Quality: + type: object + description: | + This is data that is linked to products data quality + properties: + data_quality_bugs_tags: + type: array + items: + type: object + data_quality_errors_tags: + type: array + items: + type: object + data_quality_info_tags: + type: array + items: + type: string + data_quality_tags: + type: array + items: + type: string + data_quality_warnings_tags: + type: array + items: + type: string + data_sources: + type: string + description: | + Source of data imported from producers. + data_sources_tags: + type: array + items: + type: string + last_check_dates_tags: + type: array + items: + type: string + last_checked_t: + type: integer + last_checker: + type: string + states: + description: > + comma separated list of values indicating some states of the + product, + + like things to be done, or to be completed. + + See [states + taxonomy](https://static.openfoodfacts.net/data/taxonomies/states.json) + type: string + states_hierarchy: + type: array + items: + type: string + states_tags: + type: array + items: + description: > + Each state describe something that is completed or is to be done + or improved on the product. + + + Refer to [states + taxonomy](https://static.openfoodfacts.net/data/taxonomies/states.json) + type: string + misc_tags: + description: | + Information about different aspect of the product + type: array + items: + type: string + Product-Knowledge-Panels: + type: object + description: | + Knowledge panels for a product + properties: + knowledge_panels: + type: object + x-stoplight: + id: bcq3fkbtnwr5t + title: panels + description: >- + The panels object is a dictionary of individual panel objects. + + Each key of the dictionary is the id of the panel, and the value is + the panel object. + + + Apps typically display a number of root panels with known panel ids + (e.g. health_card and environment_card). Panels can reference other + panels and display them as sub-panels. + examples: + - additionalProperties: string + properties: + additionalProperties: + title: panel + x-stoplight: + id: mj9nhz3mqn05c + type: object + description: >- + Each panel contains an optional title and an optional array of + elements. + properties: + type: + type: string + description: >- + Type of the panel. If set to "card", the panel and its + sub-panels should be displayed in a card. If set to + "inline", the panel should have its content always + displayed. + expanded: + type: boolean + description: >- + If true, the panel is to be displayed already expanded. If + false, only the title should be displayed, and the user + should be able to click or tap it to open the panel and + display the elements. + expand_for: + type: string + description: >- + If set to "large", the content of the panel should be + expanded on large screens, but it should still be possible + to unexpand it. + evaluation: + type: string + description: >- + A simple assessment of the panel value, typically used to + format fonts, et.c e.g. bad = red + enum: + - good + - average + - neutral + - bad + - unknown + title_element: + title: title_element + x-stoplight: + id: lox0wvl9bdgy2 + type: object + description: The title of a panel. + properties: + name: + type: string + description: >- + A short name of this panel, not including any actual + values + title: + type: string + type: + type: string + enum: + - grade + - percentage + description: >- + Used to indicate how the value of this item is measured, + such as "grade" for Nutri-Score and Eco-Score or + "percentage" for Salt + grade: + type: string + description: >- + The value for this panel where it corresponds to a A to + E grade such as the Nutri-Score of the Eco-Score. + enum: + - a + - b + - c + - d + - e + - unknown + value: + type: number + description: >- + The numeric value of the panel, where the type is + "percentage" + icon_url: + type: string + icon_color_from_evaluation: + type: string + icon_size: + type: string + description: > + If set to "small", the icon should be displayed at a + small size. + elements: + type: array + description: >- + An ordered list of elements to display in the content of the + panel. + items: + title: element + x-stoplight: + id: e2ybdrtmx0tme + type: object + description: > + Each element object contains one specific element object + such as a text element or an image element. + properties: + type: + element_type: string + enum: + - text + - image + - action + - panel + - panel_group + - table + description: > + The type of the included element object. + + The type also indicates which field contains the + included element object. + + e.g. if the type is "text", the included element + object will be in the "text_element" field. + + + Note that in the future, new type of element may be + added, + + so your code should ignore unrecognized types, and + unknown properties. + + + TODO: add Map type + text_element: + title: text_element + x-stoplight: + id: vdwxlt73qnqfa + type: object + description: >- + A text in simple HTML format to display. + + + For some specific texts that correspond to a product + field (e.g. a product name, the ingredients list of a + product),the edit_field_* fields are used to indicate + how to edit the field value. + properties: + type: + type: string + description: > + the type of text, might influence the way you + display it. + enum: + - summary + - warning + - notes + html: + type: string + description: Text to display in HTML format. + language: + type: string + description: >- + Language of the text. The name of the language is + returned in the language requested when making the + API call. e.g. if the text is in Polish, and the + requested language is French, the language field + will contain "Polonais" (French for "Polish"). + Only set for specific fields such as the list of + ingredients of a product. + lc: + type: string + description: >- + 2 letter language code for the text. Only set for + specific fields such as the list of ingredients of + a product. + edit_field_id: + type: string + description: >- + id of the field used to edit this text in the + product edit API. + edit_field_type: + type: string + description: Type of the product field. + edit_field_value: + type: string + description: >- + Current value of the product field. This may + differ from the html field which can contain extra + formating. + source_url: + type: string + description: Link to the source + example: 'https://en.wikipedia.org/wiki/Sodium acetate' + source_text: + type: string + description: name of the source + example: Wikipedia + source_lc: + type: string + description: Source locale name + example: en + source_language: + type: string + description: Human readable source locale name + example: English + image_element: + title: image_element + x-stoplight: + id: k4v4kwt489q3j + type: object + properties: + url: + type: string + description: full URL of the image + width: + type: integer + description: > + Width of the image. + + + This is just a suggestion coming from the server, + + the client may choose to use its own dimensions + for the image. + height: + type: integer + description: > + Height of the image. + + + This is just a suggestion coming from the server, + + the client may choose to use its own dimensions + for the image. + alt_text: + type: string + description: Alt Text of the image. + action_element: + type: string + panel_element: + title: panel_element + x-stoplight: + id: ymx41elz4yrnj + type: object + description: >- + Panels can include other panels as sub-panels using + the panel_element. + properties: + panel_id: + type: string + description: >- + The id of the panel to include. The id is the key + of the panel in the panels object returned in the + knowledge_panels field. + panel_group_element: + title: panel_group_element + x-stoplight: + id: b7emlfrgiuue2 + type: object + properties: + title: + type: string + panel_ids: + type: array + description: >- + The ids of the panels to include. The ids are the + keys of the panels in the panels object returned + in the knowledge_panels field. + items: + type: string + description: >- + The panel group element is used to display an optional + title followed by a number of sub-panels. + table_element: + title: table_element + x-stoplight: + id: 38zu3z4sruqo7 + type: object + description: Element to display a table. + properties: + id: + type: string + description: An id for the table. + title: + type: string + description: | + Title of the column. + rows: + type: string + columns: + type: array + items: + type: object + properties: + type: + type: string + text: + type: string + text_for_small_screens: + type: string + style: + type: string + column_group_id: + type: string + shown_by_default: + type: boolean + required: + - type + level: + type: string + description: | + a message level, as levels we use in log. + It might help theming the panel visualy + example: info + size: + type: string + enum: + - small + description: > + size is either empty (normal display) + + or small to indicate a panel that should have a smaller font + size + example: small + topics: + type: array + items: + type: string + example: health + readOnly: true + Product-Attribute-Groups: + type: object + description: | + Specific data about a product to enable personal ranking + properties: + attribute_groups: + type: array + description: >- + Each element is an attribute that can help compute a personal + ranking for the product + items: + type: object + properties: + id: + type: string + description: | + Unique id of the attribute. + + It will be use to match against preferences parameters. + status: + type: string + enum: + - known + - unknown + description: >- + wether we have the information to really compute this criteria + or not. + title: + type: string + description: > + A descriptive sentence about the situation of the product + concerning attribute + example: 'Does not contain: Molluscs' + match: + type: number + format: float + minimum: 0 + maximum: 100 + description: > + a numeric value for the match, + + telling how much the products ranks well for this particular + attribute. + + The higher the value, the better the match. + grade: + description: every attribute as a grade for a to e + type: string + enum: + - unknown + - a + - b + - c + - d + - e + name: + type: string + description: 'The name of attribute, for eventual display' + icon_url: + type: string + description: an icon representing the attribute match (often using a color) + description: + type: string + description: >- + An eventual description of the value of the property upon + which this attribute is based + description_short: + type: string + description: >- + An eventual short description of the value of the property + upon which this attribute is based + Product: + type: object + description: > + This is all the fields describing a product and how to display it on a + page. + + + Refer to the different sub schema for more readable entries: + + + * [Product Base](#cmp--schemas-product-base): Base fields of a product + + * [Product Misc](#cmp--schemas-product-misc): Miscellaneous but + important fields of a product + + * [Product Tags](#cmp--schemas-product-tags): Tags fields on a product + + * [Product Nutrition](#cmp--schemas-product-nutrition): Nutrition fields + of a product + + * [Product Ingredients](#cmp--schemas-product-ingredients): Fields about + ingredients of a product + + * [Product Images](#cmp--schemas-product-images): Information about + Images of a product + + * [Product Eco-Score](#cmp--schemas-product-images): Fields related to + Eco-Score for a product + + * [Product Metadata](#cmp--schemas-product-ecoscore): Metadata of a + product (author, editors, etc.) + + * [Product Data Quality](#cmp--schemas-product-quality): fields related + to data quality for a product + + * [Product Knowledge Panels](#cmp--schemas-product-knowledge-panels): + Knowledge panels for a product + + * [Product Attribute Groups](#cmp--schemas-product-attribute-groups): + Attribute groups for personal product matching + allOf: + - type: object + description: | + Base product data + properties: + abbreviated_product_name: + type: string + description: Abbreviated name in requested language + code: + type: string + description: > + barcode of the product (can be EAN-13 or internal codes for some + food stores), + + for products without a barcode, + + Open Food Facts assigns a number starting with the 200 reserved + prefix + codes_tags: + type: array + items: + type: string + description: | + A value which is the type of barcode "code-13" or "code-8" + and + A series of mask for the barcode + It helps retrieve barcodes starting by + example: > + ["code-13","3017620422xxx","301762042xxxx","30176204xxxxx","3017620xxxxxx","301762xxxxxxx","30176xxxxxxxx","3017xxxxxxxxx","301xxxxxxxxxx","30xxxxxxxxxxx","3xxxxxxxxxxxx"] + generic_name: + type: string + description: | + Legal name of the product as regulated + by the European authorities. + id: + description: > + internal identifier for the product, usually set to the value of + `code`, + + except on the producers platform where it is prefixed by the + owner + type: string + lc: + type: string + description: | + Main language of the product. + This is a duplicate of `lang` property (for historical reasons). + lang: + type: string + description: > + Main language of the product. + + + This should be the main language of product packaging (if one is + predominant). + + + Main language is also used to decide which ingredients list to + parse. + nova_group: + type: integer + description: > + Nova group as an integer from 1 to 4. See + https://world.openfoodfacts.org/nova + nova_groups: + type: string + obsolete: + type: string + obsolete_since_date: + description: | + A date at which the product was declared obsolete. + This means it's not produced any more. + type: string + product_name: + type: string + description: | + The name of the product + product_name_en: + type: string + description: | + The name of the product can also + be in many other languages like + product_name_fr (for French). + product_quantity: + type: string + description: | + The size in g or ml for the whole product. + It's a normalized version of the quantity field. + example: '500' + product_quantity_unit: + type: string + description: | + The unit (either g or ml) for the correponding product_quantity. + example: g + quantity: + type: string + description: | + Quantity and Unit. + patternProperties: + abbreviated_product_name_(?\w\w): + type: string + description: Abbreviated name in language `language_code`. + generic_name_(?\w\w): + type: string + description: | + This can be returned in many other languages + like generic_name_fr (for French). + - type: object + description: | + Miscellaneous but important fields of a product + properties: + additives_n: + type: integer + description: | + Number of food additives. + checked: + type: string + complete: + type: integer + completeness: + type: number + ecoscore_grade: + type: string + description: | + See also: `ecoscore_tags` + ecoscore_score: + type: integer + description: | + See also: `ecoscore_tags` + food_groups: + type: string + food_groups_tags: + type: array + items: + type: string + nutrient_levels: + description: | + Traffic light indicators on main nutrients levels + type: object + properties: + fat: + type: string + enum: + - low + - moderate + - high + salt: + type: string + enum: + - low + - moderate + - high + saturated-fat: + type: string + enum: + - low + - moderate + - high + sugars: + type: string + enum: + - low + - moderate + - high + packaging_text: + type: string + description: | + Recycling instructions as raw text, e.g. Plastic + bottle to recycle, Plastic cap to recycle. + This will get automatically parsed and + will be used to compute the Eco-Score. + You can either request it (if it exists) or + send it in a specific language. + example: packaging_text_en + packagings: + type: array + x-stoplight: + id: 1cyz4qo9njog7 + title: Packagings (READ) + description: >- + The packagings object is an array of individual packaging + component objects. + + + The Packaging data document explains how packaging data is + structured in Open Food Facts: + https://openfoodfacts.github.io/openfoodfacts-server/dev/explain-packaging-data/ + + + The shape, material and recycling properties of each packaging + component are linked to entries in the packaging_shapes, + packaging_materials and packaging_recycling taxonomies: + + + https://world.openfoodfacts.org/data/taxonomies/packaging_shapes.json + + https://world.openfoodfacts.org/data/taxonomies/packaging_materials.json + + https://world.openfoodfacts.org/data/taxonomies/packaging_recycling.json + + + If the tags_lc field is set, the properties will include a + lc_name field with the translation in the requested language. + examples: + - - number_of_units: 6 + shape: + id: 'en:bottle' + lc_name: bouteille + material: + id: 'en:bottle' + lc_name: bouteille + recycling: + id: 'en:bottle' + lc_name: bouteille + quantity_per_unit: 25 cl + quantity_per_unit_value: 25 + quantity_per_unit_unit: cl + weight_specified: 30 + weight_measured: 32 + weight_estimated: 26 + weight: 30 + weight_source_id: specified + items: + description: >- + Each packaging component has different properties to specify + how many there are, its shape, material etc. + + + The shape, material and recycling properties are mapped to one + entry in the packaging_shapes, packaging_materials and + packaging_recycling taxonomies, and the value of the property + is the canonical name of the taxonomy entry (e.g. en:bottle). + + + They may contain values that could not yet get matched to + their respective taxonomy, in which case they will contain a + free text value prefixed with the language code of this text + value (e.g. "fr:Bouteille sphérique" might have been entered + by a French user to indicate it is a spherical bottle). + title: Packaging component (READ) + type: object + examples: + - number_of_units: 6 + shape: + id: 'en:bottle' + lc_name: bouteille + material: + id: 'en:bottle' + lc_name: bouteille + recycling: + id: 'en:bottle' + lc_name: bouteille + quantity_per_unit: 25 cl + quantity_per_unit_value: 25 + quantity_per_unit_unit: cl + weight_specified: 30 + weight_measured: 32 + weight_estimated: 26 + weight: 30 + weight_source_id: specified + properties: + number_of_units: + type: integer + description: >- + umber of units of this packaging component contained in + the product (e.g. 6 for a pack of 6 bottles) + shape: + title: Packaging component shape + x-stoplight: + id: xrj8agza3dwgf + type: object + description: >- + The shape property is canonicalized using the + packaging_shapes taxonomy. + examples: + - id: 'en:bottle' + lc_name: bouteille + properties: + id: + type: string + description: >- + Canonical id of the entry in the taxonomy. If the + value cannot be mapped to a taxonomy entry, the value + will be the name of the entry in its original language + prefixed by the language 2 letter code and a colon. + lc_name: + type: string + description: >- + Name of the entry in the language requested in the + tags_lc field of the request. This field is returned + only of tags_lc is specified. If the translation is + not available, or if the entry does not exist in the + taxonomy, the value will be the name of the entry in + its original language prefixed by the language 2 + letter code and a colon. + material: + title: Packaging component material + x-stoplight: + id: n6umazgqmwrd5 + type: object + description: >- + The material property is canonicalized using the + packaging_materials taxonomy. + examples: + - id: 'en:bottle' + lc_name: bouteille + properties: + id: + type: string + description: >- + Canonical id of the entry in the taxonomy. If the + value cannot be mapped to a taxonomy entry, the value + will be the name of the entry in its original language + prefixed by the language 2 letter code and a colon. + lc_name: + type: string + description: >- + Name of the entry in the language requested in the + tags_lc field of the request. This field is returned + only of tags_lc is specified. If the translation is + not available, or if the entry does not exist in the + taxonomy, the value will be the name of the entry in + its original language prefixed by the language 2 + letter code and a colon. + recycling: + title: Packaging component recycling instruction + x-stoplight: + id: 376tk8e2cmyh2 + type: object + description: >- + The recycling property is canonicalized using the + packaging_recycling taxonomy. + examples: + - id: 'en:bottle' + lc_name: bouteille + properties: + id: + type: string + description: >- + Canonical id of the entry in the taxonomy. If the + value cannot be mapped to a taxonomy entry, the value + will be the name of the entry in its original language + prefixed by the language 2 letter code and a colon. + lc_name: + type: string + description: >- + Name of the entry in the language requested in the + tags_lc field of the request. This field is returned + only of tags_lc is specified. If the translation is + not available, or if the entry does not exist in the + taxonomy, the value will be the name of the entry in + its original language prefixed by the language 2 + letter code and a colon. + quantity_per_unit: + type: string + description: >- + Quantity (weight or volume) of food product contained in + the packaging component. (e.g. 75cl for a wine bottle) + quantity_per_unit_value: + type: number + description: Value parsed from the quantity field. + quantity_per_unit_unit: + type: string + description: Unit parsed and normalized from the quantity field. + weight_specified: + type: number + description: >- + Weight (as specified by the manufacturer) of one unit of + the empty packaging component (in grams). (e.g. for a 6 + pack of 1.5l water bottles, it might be 30, the weight in + grams of 1 empty water bottle without its cap which is a + different packaging component). + weight_measured: + type: number + description: >- + Weight (as measured by one or more users) of one unit of + the empty packaging component (in grams). (e.g. for a 6 + pack of 1.5l water bottles, it might be 30, the weight in + grams of 1 empty water bottle without its cap which is a + different packaging component). + weight_estimated: + type: number + description: >- + Weight (as estimated from similar products) of one unit of + the empty packaging component (in grams). (e.g. for a 6 + pack of 1.5l water bottles, it might be 30, the weight in + grams of 1 empty water bottle without its cap which is a + different packaging component). + weight: + type: number + description: Weight of one unit of the empty packaging component. + weight_source_id: + type: string + description: >- + Indicates which field was used to populate the "weight" + field. Either "specified", "measured", or "estimated" + readOnly: true + packagings_complete: + title: packagings_complete + x-stoplight: + id: hxnnsy954q1ey + type: integer + minimum: 0 + maximum: 1 + description: >- + Indicate if the packagings array contains all the packaging + parts of the product. This field can be set by users when they + enter or verify packaging data. Possible values are 0 or 1. + pnns_groups_1: + description: > + Category of food according to [French Nutrition and Health + Program](https://fr.wikipedia.org/wiki/Programme_national_nutrition_sant%C3%A9) + type: string + pnns_groups_1_tags: + type: array + items: + type: string + pnns_groups_2: + description: > + Sub Category of food according to [French Nutrition and Health + Program](https://fr.wikipedia.org/wiki/Programme_national_nutrition_sant%C3%A9) + type: string + pnns_groups_2_tags: + type: array + items: + type: string + popularity_key: + description: > + An imprecise measurement of popularity based on Scan statistics. + A higher value means higher popularity. + type: integer + popularity_tags: + description: > + Indicators for the popularity of a product, like the amount of + scans in a specific year. + type: array + items: + type: string + scans_n: + type: integer + unique_scans_n: + type: integer + serving_quantity: + type: string + description: | + Normalized version of serving_size. + Note that this is NOT the number of servings by product. + (in perl, see `normalize_serving_size`) + serving_quantity_unit: + type: string + description: | + The unit (either g or ml) for the correponding serving_quantity. + example: g + serving_size: + type: string + description: > + Serving size text (generally in g or ml). + + We expect a quantity + unit but the user is free to input any + string. + patternProperties: + food_groups_(?\w\w): + type: string + description: see `food_groups` + packaging_text_(?\w\w): + type: string + description: | + Packaging text in language designated by `language_code` + - type: object + description: | + Data about a product which is represented as tags + properties: + brands: + type: string + description: List of brands (not taxonomized) + brands_tags: + type: array + items: + type: string + description: 'List of brands (tags, not taxonomized)' + categories: + type: string + categories_hierarchy: + type: array + items: + type: string + categories_lc: + type: string + description: Categories language code + categories_tags: + type: array + items: + type: string + checkers_tags: + type: array + items: + type: string + description: List of checkers (users who checked the product) tags + cities: + type: string + cities_tags: + type: array + items: + type: object + correctors_tags: + type: array + items: + type: string + countries: + type: string + description: | + List of countries where the product is sold. + countries_hierarchy: + type: array + items: + type: string + countries_lc: + type: string + description: Countries language code + countries_tags: + type: array + items: + type: string + ecoscore_tags: + description: > + All ecoscore of a product. + + Most of the time it's only one value, + + but it might eventually be more for products composed of + sub-products. + + See also: `ecoscore_score`, `ecoscore_grade`. + type: array + items: + type: string + emb_codes: + type: string + description: > + Packager code. EMB is the French system of traceability codes + for packager. + example: EMB 2013330 + emb_codes_orig: + type: string + emb_codes_tags: + type: array + items: + type: object + labels: + type: string + labels_hierarchy: + type: array + items: + type: string + labels_lc: + type: string + labels_tags: + type: array + items: + type: string + entry_dates_tags: + description: | + The data as a series of tag: `yyyy-mm-dd`, `yyyy-mm`, `yyyy` + type: array + items: + type: string + example: + - '2016-03-11' + - 2016-03 + - '2016' + manufacturing_places: + type: string + description: | + Places where the product was manufactured or transformed. + manufacturing_places_tags: + type: array + items: + type: object + nova_groups_tags: + type: array + items: + type: string + nutrient_levels_tags: + type: array + items: + type: string + - type: object + description: > + Information about Images of a product. + + + Images ensure the reliability of Open Food Facts data. + + It provides a primary source and proof of all the structured data. + + You may therefore want to display it along the structured + information. + + + See also tutorials about images: + + * [Getting + images](https://openfoodfacts.github.io/openfoodfacts-server/api/how-to-download-images/) + + * [Uploading + images](https://openfoodfacts.github.io/openfoodfacts-server/api/tutorial-uploading-photo-to-a-product/) + properties: + images: + description: > + This contains properties for all images contained on the + product. + type: object + properties: + '1': + type: object + description: > + This object represent an image that was uploaded to a + product. + + "imgid" is an integer which is a sequential number unique to + each picture. + properties: + sizes: + type: object + description: > + The available image sizes for the product (both reduced + and full). + + The reduced images are the ones with numbers as the key( + 100, 200 etc) + + while the full images have `full` as the key. + properties: + full: + description: | + properties of fullsize image + **TODO** explain how to compute name + type: object + properties: + h: + type: integer + example: 400 + description: | + The height of the reduced/full image in pixels. + w: + type: integer + example: 255 + description: The width of the reduced/full image in pixels. + patternProperties: + (?100|400): + description: > + properties of thumbnail of size `image_size`. + + **TODO** explain how to compute name + + + For real type: see description of property `full`. + + (Put this way because of a [bug in + rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) + type: string + uploaded_t: + type: string + example: '1457680652' + description: | + The time the image was uploaded (as unix timestamp). + uploader: + type: string + example: openfoodfacts-contributors + description: | + The contributor that uploaded the image. + front: + description: > + property of an image (or part thereof) selected for a + particular role and a particular language. + type: object + properties: + angle: + type: integer + example: 0 + description: The angle of the image rotation (if it was rotated). + coordinates_image_size: + type: string + example: full + geometry: + type: string + example: 0x0--1--1 + imgid: + type: string + example: '121' + description: >- + The id of the original/source image that was selected to + edit(rotate, normalize etc) to produce this new image. + normalize: + type: 'null' + example: null + description: Normalize colors. + rev: + type: string + example: '420' + sizes: + type: object + description: > + The available image sizes for the product (both reduced + and full). + + The reduced images are the ones with numbers as the key( + 100, 200 etc) + + while the full images have `full` as the key. + properties: + '100': + type: object + properties: + h: + type: integer + example: 400 + description: | + The height of the reduced/full image in pixels. + w: + type: integer + example: 255 + description: The width of the reduced/full image in pixels. + '200': + type: object + properties: + h: + type: integer + example: 400 + description: | + The height of the reduced/full image in pixels. + w: + type: integer + example: 255 + description: The width of the reduced/full image in pixels. + '400': + type: object + properties: + h: + type: integer + example: 400 + description: | + The height of the reduced/full image in pixels. + w: + type: integer + example: 255 + description: The width of the reduced/full image in pixels. + full: + type: object + properties: + h: + type: integer + example: 400 + description: | + The height of the reduced/full image in pixels. + w: + type: integer + example: 255 + description: The width of the reduced/full image in pixels. + white_magic: + type: 'null' + example: null + description: > + Photo on white background : Try to remove the + background. + x1: + type: string + example: '-1' + x2: + type: string + example: '-1' + y1: + type: string + example: '-1' + y2: + type: string + example: '-1' + patternProperties: + (?\d+): + description: > + See property `1` to get the real type of those objects + + (Put this way because of a [bug in + rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) + type: string + (?front|nutrition|ingredients|packaging|other)_(?\w\w): + description: > + See property `front` to get the real type of those objects + + (Put this way because of a [bug in + rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) + type: string + last_image_dates_tags: + type: array + items: + type: string + last_image_t: + description: timestamp of last image upload (or update?) + type: integer + selected_images: + type: object + description: | + URL for selected (important) images of the product. + + This is very handy if you display the product to users. + properties: + front: + type: object + description: URLs of thumbnails image of image of type `image_type` + properties: + display: + description: > + Thumbnail urls of product image (front) adapted to + display on product page + type: object + patternProperties: + (?\w\w): + type: string + description: url of the image for language `language_code` + small: + description: > + Thumbnail urls of product image (front) adapted to + display on product list page + type: object + patternProperties: + (?\w\w): + type: string + description: url of the image for language `language_code` + thumb: + description: > + Thumbnail urls of product image (front) in smallest + format + type: object + patternProperties: + (?\w\w): + type: string + description: url of the image for language `language_code` + patternProperties: + (?front|packaging|ingredients|nutrition|other): + description: > + See property `front` to get the real type of those objects + + (Put this way because of a [bug in + rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) + type: string + image_small_url: + type: string + image_thumb_url: + type: string + image_url: + type: string + patternProperties: + image(_(?front|packaging|ingredients|nutrition|other))?(_(?small|thumb))?_url: + description: > + the URL of image of type `image_type` in size `image_size` (or + full size if not given). + + + The `image_type` tells which image the url correspond to. + `image_type` is `front` if not provided. + + + The image is the one for current language (affected by `lc` + parameter) if an image exists for this language, the image in + main product language otherwise. + + + **IMPORTANT:** you should use `selected_images` field instead + of this one. + type: string + - type: object + description: | + Fields related to Eco-Score for a product. + + See also: `ecoscore_score`, `ecoscore_grade` and `ecoscore_tags`. + properties: + ecoscore_data: + type: object + description: > + An object about a lot of details about data needed for Eco-Score + computation + + and complementary data of interest. + properties: + adjustments: + type: object + properties: + origins_of_ingredients: + type: object + properties: + aggregated_origins: + type: array + items: + type: object + properties: + origin: + type: string + percent: + type: integer + epi_score: + type: integer + epi_value: + type: integer + origins_from_origins_field: + type: array + items: + type: string + transportation_scores: + type: object + patternProperties: + (?\w\w): + type: integer + transportation_values: + type: object + patternProperties: + (?\w\w): + type: integer + values: + type: object + patternProperties: + (?\w\w): + type: integer + warning: + type: string + packaging: + type: object + properties: + non_recyclable_and_non_biodegradable_materials: + type: integer + packagings: + type: array + items: + type: object + properties: + ecoscore_material_score: + type: integer + ecoscore_shape_ratio: + type: integer + material: + type: string + shape: + type: string + score: + type: integer + value: + type: integer + warning: + type: string + production_system: + type: object + properties: + labels: + type: array + example: 'vegan, fat free, Kosher' + items: + type: string + value: + type: integer + warning: + type: string + threatened_species: + type: object + properties: + ingredient: + type: string + value: + type: integer + agribalyse: + type: object + properties: + agribalyse_food_code: + type: string + co2_agriculture: + type: number + co2_consumption: + type: integer + co2_distribution: + type: number + co2_packaging: + type: number + co2_processing: + type: number + co2_total: + type: number + co2_transportation: + type: number + code: + type: string + dqr: + type: string + ef_agriculture: + type: number + ef_consumption: + type: integer + ef_distribution: + type: number + ef_packaging: + type: number + ef_processing: + type: number + ef_total: + type: number + ef_transportation: + type: number + is_beverage: + type: integer + name_en: + type: string + description: | + This can be returned in many other languages + like name_fr (for french). + score: + type: integer + version: + type: string + grade: + type: string + grades: + type: object + patternProperties: + (?\w\w): + type: string + missing: + type: object + properties: + labels: + type: integer + origins: + type: integer + packagings: + type: integer + missing_data_warning: + type: integer + previous_data: + type: object + properties: + grade: + type: string + score: + type: integer + agribalyse: + type: object + properties: + agribalyse_food_code: + type: string + co2_agriculture: + type: number + co2_consumption: + type: integer + co2_distribution: + type: number + co2_packaging: + type: number + co2_processing: + type: number + co2_total: + type: number + co2_transportation: + type: number + code: + type: string + dqr: + type: string + ef_agriculture: + type: number + ef_consumption: + type: integer + ef_distribution: + type: number + ef_packaging: + type: number + ef_processing: + type: number + ef_total: + type: number + ef_transportation: + type: number + is_beverage: + type: integer + name_en: + type: string + description: | + This can be returned in many other languages + like name_fr (for french). + score: + type: integer + version: + type: string + score: + type: integer + scores: + type: object + patternProperties: + (?\w\w): + type: integer + status: + type: string + ecoscore_extended_data_version: + type: string + environment_impact_level: + type: string + environment_impact_level_tags: + type: array + items: + type: object + - type: object + description: Fields about ingredients of a product + properties: + additives_tags: + type: array + items: + type: string + allergens: + type: string + description: comma separated list of allergens + allergens_lc: + type: string + description: language in which `allergens` where input + allergens_hierarchy: + type: array + items: + type: string + allergens_tags: + type: array + items: + type: string + ingredients: + type: array + description: > + This structure gives the different ingredients and some + information about them, + + like estimate on their quantity. + items: + type: object + properties: + id: + type: string + ingredients: + description: | + Sub ingredients composing this ingredients. + $ref: '#' + percent: + type: integer + percent_estimate: + type: + - number + percent_max: + type: + - number + percent_min: + type: integer + text: + type: string + vegan: + type: string + vegetarian: + type: string + ingredients_analysis: + type: object + properties: + 'en:palm-oil': + type: array + items: + type: string + 'en:vegan-status-unknown': + type: array + items: + type: string + 'en:vegetarian-status-unknown': + type: array + items: + type: string + ingredients_analysis_tags: + type: array + items: + type: string + ingredients_from_or_that_may_be_from_palm_oil_n: + type: integer + ingredients_from_palm_oil_n: + type: integer + ingredients_from_palm_oil_tags: + type: array + items: + type: object + ingredients_hierarchy: + type: array + items: + type: string + ingredients_n: + type: integer + ingredients_n_tags: + type: array + items: + type: string + ingredients_original_tags: + type: array + items: + type: string + ingredients_percent_analysis: + type: integer + ingredients_sweeteners_n: + type: integer + description: > + Number of sweeteners additives in the ingredients. Undefined if + ingredients are not specified. + ingredients_non_nutritive_sweeteners_n: + type: integer + description: > + Number of non-nutritive sweeteners additives (as specified in + the Nutri-Score formula) in the ingredients. Undefined if + ingredients are not specified. + ingredients_tags: + type: array + items: + type: string + ingredients_lc: + type: string + description: > + Language that was used to parse the ingredient list. If + `ingredients_text` is available + + for the product main language (`lang`), `ingredients_lc=lang`, + otherwise we look at + + `ingredients_text` fields for other languages and set + `ingredients_lc` to the first + + non-empty `ingredient_text`. + ingredients_text: + type: string + description: > + Raw list of ingredients. This will get automatically + + parsed and get used to compute the Eco-Score or find allergens, + etc.. + + + It's a copy of ingredients_text in the main language of the + product (see `lang` proprety). + example: > + Farine de blé* 67,4%, sucre de canne*, huile de tournesol + oléique*, graines de chia* 5,2%, son de blé*, oranges + déshydratées * 0,9%, farine de riz*, poudres à lever (acide + citrique, carbonates de sodium), arôme naturel d'orange. + ingredients_text_with_allergens: + type: string + description: > + Same text as `ingredients_text` but where allergens have HTML + elements around them to identify them + example: > + Farine de blé* 67,4%, sucre de + canne*, huile de tournesol oléique*, graines de chia* 5,2%, + son de blé*, oranges déshydratées + * 0,9%, farine de riz*, poudres à lever (acide citrique, + carbonates de sodium), arôme naturel d'orange. + ingredients_that_may_be_from_palm_oil_n: + type: integer + ingredients_that_may_be_from_palm_oil_tags: + type: array + items: + type: object + ingredients_with_specified_percent_n: + type: integer + ingredients_with_specified_percent_sum: + type: integer + ingredients_with_unspecified_percent_n: + type: integer + ingredients_with_unspecified_percent_sum: + type: integer + known_ingredients_n: + type: integer + origins: + type: string + description: | + Origins of ingredients + origins_hierarchy: + type: array + items: + type: object + origins_lc: + type: string + origins_tags: + type: array + items: + type: object + traces: + type: string + description: | + List of substances that might cause allergies + that are present in trace amounts in the product + (this does not include the ingredients, as they + are not only present in trace amounts). + It is taxonomized with the allergens taxonomy. + traces_hierarchy: + type: array + items: + type: object + traces_lc: + type: string + traces_tags: + type: array + items: + type: object + unknown_ingredients_n: + type: integer + patternProperties: + ingredients_text_(?\w\w): + type: string + description: | + Raw list of ingredients in language given by 'language_code'. + + See `ingredients_text` + ingredients_text_with_allergens_(?\w\w): + description: | + Like `ingredients_text_with_allergens` for a particular language + type: string + - type: object + description: > + Nutrition fields of a product + + + Most of these properties are read-only. + + + See [how to add nutrition + data](https://openfoodfacts.github.io/openfoodfacts-server/api/ref-cheatsheet/#add-nutrition-facts-values-units-and-base) + properties: + no_nutrition_data: + type: string + description: | + When a product does not have nutrition data displayed on the + packaging, the user can check the field "Nutrition facts are + not specified on the product". + By doing so, the no_nutrition_data field takes the value "on". + This case is frequent (thousands of products). + example: 'on' + nutrition_data_per: + type: string + enum: + - serving + - 100g + description: > + The nutrition data on the package can be per serving or per + 100g. + + + This is essential to understand if `_value` and + `` + + values in `nutriments` applies for a serving or for 100g. + + + **IMPORTANT:** + + When writing products, + + this setting applies to all existing nutrients values for the + product, + + not only the nutrient values sent in the write request. + + So it should not be changed unless all nutrients values are + provided + + with values that match the nutrition_data_per field. + nutrition_data_prepared_per: + type: string + enum: + - serving + - 100g + description: > + The nutrition data for prepared product on the package (if any) + can be per serving or per 100g. + + + This is essential to understand if `_prepared_value` + and `_prepared` + + values in `nutriments` applies for a serving or for 100g. + + + See also important note on `nutrition_data_per`. + nutriments: + type: object + description: > + All known nutrients for the product. + + + Note that each nutrients are declined with a variety of suffixes + like `_100g`, `_serving`, + + see patternProperties below. + + + A specific `_unit` is the unit used to measure the nutrient. + + + Beware that some properties are to be interpreted based upon + `nutrition_data_per` value. + + + Also for products that have a nutrition table for prepared + product + + (eg. the nutrition facts for a bowl of milk with cocoa powder), + + a `_prepared` suffix is added (before other suffixes). + + + You can get all possible nutrients from the + + [nutrients + taxonomy](https://static.openfoodfacts.org/data/taxonomies/nutrients.json) + + + **FIXME** add more nutrients with description. + properties: + alcohol: + description: | + Quantity of alcohol + + (per 100g or per serving) in a standard unit (g or ml) + type: number + carbohydrates: + type: number + energy: + type: number + description: > + It is the same as `energy-kj` if we have it, or computed + from `energy-kcal` otherwise + + + (per 100g or per serving) in kj + energy_value: + type: number + description: > + energy_value will be equal to energy-kj_value if we have it + or to energy-kcal_value otherwise + energy_unit: + type: string + enum: + - kcal + - kj + description: > + Equal to energy-kj_unit if we have it or to energy-kcal_unit + otherwise + energy-kcal: + type: number + description: | + energy in kcal, if it is specified + + (per 100g or per serving) in a standard unit (g or ml) + energy-kj: + type: number + description: | + energy in kj, if it is specified + + (per 100g or per serving) in a standard unit (g or ml) + fat: + type: number + fruits-vegetables-legumes-estimate-from-ingredients: + type: number + description: > + An estimate, from the ingredients list of the percentage of + fruits, vegetable and legumes. + + This is an important information for Nutri-Score (2023 + version) computation. + fruits-vegetables-nuts-estimate-from-ingredients: + type: number + description: > + An estimate, from the ingredients list of the percentage of + fruits, vegetable and nuts. + + This is an important information for Nutri-Score (2021 + version) computation. + nova-group: + type: integer + nutrition-score-fr: + description: | + Experimental nutrition score derived from + the UK FSA score and adapted for the French market + (formula defined by the team of Professor Hercberg). + proteins: + type: number + salt: + type: number + saturated-fat: + type: number + sodium: + type: number + sugars: + type: number + carbon-footprint-from-known-ingredients_product: + type: integer + carbon-footprint-from-known-ingredients_serving: + type: number + erythritol: + type: number + description: | + erythritol is a polyol which is not providing any energy. + As such, it needs not be taken into account when computing + the energy of a product. Eryhtritol is now displayed on + nutrition facts sheet of some products, mainly in the USA. + This value is entered either by contributors, either by + imports. + example: 12.5 + patternProperties: + '(?[\w-]+)_unit': + description: "The unit in which the nutrient for 100g or per serving is measured.\n\nThe possible values depends on the nutrient.\n\n* `g` for grams\n* `mg` for milligrams\n* `μg` for micrograms\n* `cl` for centiliters\n* `ml` for mililiters\n* `dv` for recommended daily intakes (aka [Dietary Reference Intake](https://en.wikipedia.org/wiki/Dietary_Reference_Intake))\n* `% vol` for alcohol vol per 100 ml\n\n\U0001F913 code: see the [Units module][units-module],\nand [Food:default_unit_for_nid function][default-unit]\n\n[units-module]: https://openfoodfacts.github.io/openfoodfacts-server/dev/ref-perl-pod/ProductOpener/Units.html\n[default-unit]: https://openfoodfacts.github.io/openfoodfacts-server/dev/ref-perl-pod/ProductOpener/Food.html#default_unit_for_nid_(_%24nid)\n" + type: string + enum: + - 公斤 + - 公升 + - kg + - кг + - l + - л + - 毫克 + - mg + - мг + - mcg + - µg + - oz + - fl oz + - dl + - дл + - cl + - кл + - 斤 + - g + - '' + - ' ' + - kj + - 克 + - 公克 + - г + - мл + - ml + - mmol/l + - 毫升 + - '% vol' + - ph + - '%' + - '% dv' + - '% vol (alcohol)' + - iu + - mol/l + - mval/l + - ppm + - �rh + - �fh + - �e + - �dh + - gpg + '(?[\w-]+)_100g': + description: > + The standardized value of a serving of 100g (or 100ml for + liquids) + + for the nutrient. + + + This is computed from the `nutrient` property, + + the serving size (if needed), and the `nutrient`_unit field. + + + **Note**: + + If you want to characterize products in a uniform way, this + is the value you should use. + type: number + readOnly: true + '(?[\w-]+)_serving': + description: | + The standardized value of a serving for this product. + type: number + readOnly: true + '(?[\w-]+)_value': + description: > + The value input by the user / displayed on the product for + the nutrient. + + + * per 100g or serving, depending on `nutrition_data_per` + + * in the unit of corresponding _unit field. + type: number + readOnly: true + '(?[\w-]+)_prepared': + description: | + The value for nutrient for **prepared** product. + type: number + '(?[\w-]+)_prepared_unit': + description: > + The unit in which the nutrient of **prepared** product is + measured. + type: string + '(?[\w-]+)_prepared_100g': + description: > + The standardized value of a serving of 100g (or 100ml for + liquids) + + for the nutrient, for **prepared** product. + type: number + readOnly: true + '(?[\w-]+)_prepared_serving': + description: > + The standardized value of a serving for the **prepared** + product. + type: number + readOnly: true + '(?[\w-]+)_prepared_value': + description: > + The standardized value for a serving or 100g (or 100ml for + liquids), + + depending on `nutrition_data_prepared_per` + + for the nutrient for **prepared** product. + type: number + readOnly: true + nutriscore_data: + description: > + Detail of data the Nutri-Score was computed upon. + + + **Note**: this might not be stable, don't rely too much on this, + or, at least, tell us ! + + + **TODO** document each property + type: object + properties: + energy: + type: integer + energy_points: + type: integer + energy_value: + type: integer + fiber: + type: integer + fiber_points: + type: integer + fiber_value: + type: integer + fruits_vegetables_nuts_colza_walnut_olive_oils: + type: integer + fruits_vegetables_nuts_colza_walnut_olive_oils_points: + type: integer + fruits_vegetables_nuts_colza_walnut_olive_oils_value: + type: integer + grade: + type: string + is_beverage: + type: integer + is_cheese: + type: integer + is_fat: + type: integer + is_water: + type: integer + negative_points: + type: integer + positive_points: + type: integer + proteins: + type: number + proteins_points: + type: integer + proteins_value: + type: number + saturated_fat: + type: number + saturated_fat_points: + type: integer + saturated_fat_ratio: + type: number + saturated_fat_ratio_points: + type: integer + saturated_fat_ratio_value: + type: number + saturated_fat_value: + type: number + score: + type: integer + sodium: + type: number + sodium_points: + type: integer + sodium_value: + type: number + sugars: + type: number + sugars_points: + type: integer + sugars_value: + type: number + nutriscore_grade: + description: | + Nutri-Score for the product as a letter. + + See https://world.openfoodfacts.org/nutriscore. + type: string + enum: + - a + - b + - c + - d + - e + nutriscore_score: + description: > + Nutri-Score for the product as an integer (see also + `nutriscore_grade`). + type: integer + nutriscore_score_opposite: + type: integer + nutrition_grade_fr: + type: string + description: | + Nutrition grade (‘a’ to ‘e’), + https://world.openfoodfacts.org/nutriscore. + nutrition_grades: + description: > + Nutrition grades as a comma separated list. + + + Some products with multiple components might have multiple + Nutri-Score + type: string + nutrition_grades_tags: + type: array + items: + type: string + nutrition_score_beverage: + type: integer + nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients: + type: integer + nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients_value: + type: integer + nutrition_score_warning_no_fiber: + type: integer + other_nutritional_substances_tags: + type: array + items: + type: object + unknown_nutrients_tags: + type: array + items: + type: object + vitamins_tags: + type: array + items: + type: object + - type: object + description: | + This is data that is linked to products data quality + properties: + data_quality_bugs_tags: + type: array + items: + type: object + data_quality_errors_tags: + type: array + items: + type: object + data_quality_info_tags: + type: array + items: + type: string + data_quality_tags: + type: array + items: + type: string + data_quality_warnings_tags: + type: array + items: + type: string + data_sources: + type: string + description: | + Source of data imported from producers. + data_sources_tags: + type: array + items: + type: string + last_check_dates_tags: + type: array + items: + type: string + last_checked_t: + type: integer + last_checker: + type: string + states: + description: > + comma separated list of values indicating some states of the + product, + + like things to be done, or to be completed. + + See [states + taxonomy](https://static.openfoodfacts.net/data/taxonomies/states.json) + type: string + states_hierarchy: + type: array + items: + type: string + states_tags: + type: array + items: + description: > + Each state describe something that is completed or is to be + done or improved on the product. + + + Refer to [states + taxonomy](https://static.openfoodfacts.net/data/taxonomies/states.json) + type: string + misc_tags: + description: | + Information about different aspect of the product + type: array + items: + type: string + - type: object + properties: + additives_original_tags: + type: array + items: + type: string + additives_prev_original_tags: + type: array + items: + type: string + added_countries_tags: + type: array + items: + type: object + allergens_from_ingredients: + type: string + allergens_from_user: + type: string + amino_acids_prev_tags: + type: array + items: + type: object + amino_acids_tags: + type: array + items: + type: object + carbon_footprint_percent_of_known_ingredients: + type: integer + categories_properties: + type: object + properties: + 'agribalyse_food_code:en': + type: string + 'agribalyse_proxy_food_code:en': + type: string + 'ciqual_food_code:en': + type: string + categories_properties_tags: + type: array + items: + type: string + category_properties: + type: object + additionalProperties: + description: those are properties taken from the category taxonomy + type: string + ciqual_food_name_tags: + type: array + items: + type: string + compared_to_category: + type: string + description: | + the category to use for comparison. + + **TODO** explain how it is chosen. + conservation_conditions: + type: string + customer_service: + type: string + description: | + Contact info of customer service. + expiration_date: + type: string + link: + type: string + description: | + link to the product on the website of the producer + main_countries_tags: + type: array + items: + type: object + minerals_prev_tags: + type: array + items: + type: object + minerals_tags: + type: array + items: + type: object + owner_fields: + type: object + description: > + Those are fields provided by the producer (through producers + platform), + + and the value he provided. + properties: + additionalProperties: + description: > + you can retrieve all kind of properties, the same as on the + parent object (the product). + + It's not processed entries (like tags for example) but raw + ones. + oneOf: + - type: integer + - type: string + - type: object + nova_groups_markers: + type: object + description: > + Detail of ingredients or processing that makes the products + having Nova 3 or 4 + properties: + '3': + description: | + Markers of level 3 + type: array + items: + type: array + description: | + This array has two element for each marker. + One + items: + type: string + '4': + description: | + Markers of level 4 + type: array + items: + $ref: '#/properties/nova_groups_markers/properties/3/items' + nucleotides_tags: + type: array + items: + type: object + origin: + type: string + purchase_places: + type: string + description: | + Country, state, or city where the product can be purchased. + example: Paris + purchase_places_tags: + type: array + items: + type: string + stores: + type: string + description: | + Distributor name. + example: Walmart + stores_tags: + type: array + items: + type: string + traces_from_ingredients: + type: string + traces_from_user: + type: string + patternProperties: + conservation_conditions_(?\w\w): + type: string + customer_service_(?\w\w): + type: string + origin_(?\w\w): + type: string + description: | + `origin` in language indicated by `language_code` + - type: object + description: | + Metadata of a product (author, editors, creation date, etc.) + properties: + created_t: + type: integer + description: | + Date when the product was added (UNIX timestamp format). + See also `entry_dates_tags` + example: | + 1457680652 + creator: + type: string + description: | + The contributor who added the product first. + editors_tags: + description: | + List of editors who edited the product. + type: array + items: + type: string + informers_tags: + type: array + items: + type: string + interface_version_created: + type: string + interface_version_modified: + type: string + languages: + type: object + patternProperties: + 'en:(?\w\w)': + type: integer + description: | + **TODO** explain ! + languages_codes: + type: object + patternProperties: + (?\w\w): + type: integer + description: > + Same as `languages` but by language code, instead of language + tags + languages_hierarchy: + type: array + items: + type: string + languages_tags: + type: array + items: + type: string + last_edit_dates_tags: + type: array + items: + type: string + last_editor: + type: string + last_modified_by: + type: string + description: | + The username of the user who last modified the product. + example: sebleouf + last_modified_t: + type: integer + description: | + Date when the product page was last modified. + owner: + description: > + Id of the producer in case he provides his own data about a + product (producer platform). + type: string + owners_tags: + description: | + Tagyfied version of owner + type: string + photographers_tags: + type: array + items: + type: string + rev: + description: >- + revision number of this product version (each edit adds a + revision) + type: integer + sources: + type: array + items: + type: object + properties: + fields: + type: array + items: + type: string + id: + type: string + images: + type: array + items: + type: object + import_t: + type: integer + manufacturer: + type: + - integer + - string + name: + type: string + source_licence: + type: string + source_licence_url: + type: string + url: + type: + - 'null' + - string + sources_fields: + type: object + properties: + org-gs1: + type: object + properties: + gln: + type: string + gpcCategoryCode: + type: string + gpcCategoryName: + type: string + isAllergenRelevantDataProvided: + type: string + lastChangeDateTime: + type: string + partyName: + type: string + productionVariantDescription: + type: string + publicationDateTime: + type: string + teams: + type: string + teams_tags: + type: array + items: + type: string + update_key: + type: string + - type: object + description: | + Knowledge panels for a product + properties: + knowledge_panels: + type: object + x-stoplight: + id: bcq3fkbtnwr5t + title: panels + description: >- + The panels object is a dictionary of individual panel objects. + + Each key of the dictionary is the id of the panel, and the value + is the panel object. + + + Apps typically display a number of root panels with known panel + ids (e.g. health_card and environment_card). Panels can + reference other panels and display them as sub-panels. + examples: + - additionalProperties: string + properties: + additionalProperties: + title: panel + x-stoplight: + id: mj9nhz3mqn05c + type: object + description: >- + Each panel contains an optional title and an optional array + of elements. + properties: + type: + type: string + description: >- + Type of the panel. If set to "card", the panel and its + sub-panels should be displayed in a card. If set to + "inline", the panel should have its content always + displayed. + expanded: + type: boolean + description: >- + If true, the panel is to be displayed already expanded. + If false, only the title should be displayed, and the + user should be able to click or tap it to open the panel + and display the elements. + expand_for: + type: string + description: >- + If set to "large", the content of the panel should be + expanded on large screens, but it should still be + possible to unexpand it. + evaluation: + type: string + description: >- + A simple assessment of the panel value, typically used + to format fonts, et.c e.g. bad = red + enum: + - good + - average + - neutral + - bad + - unknown + title_element: + title: title_element + x-stoplight: + id: lox0wvl9bdgy2 + type: object + description: The title of a panel. + properties: + name: + type: string + description: >- + A short name of this panel, not including any actual + values + title: + type: string + type: + type: string + enum: + - grade + - percentage + description: >- + Used to indicate how the value of this item is + measured, such as "grade" for Nutri-Score and + Eco-Score or "percentage" for Salt + grade: + type: string + description: >- + The value for this panel where it corresponds to a A + to E grade such as the Nutri-Score of the Eco-Score. + enum: + - a + - b + - c + - d + - e + - unknown + value: + type: number + description: >- + The numeric value of the panel, where the type is + "percentage" + icon_url: + type: string + icon_color_from_evaluation: + type: string + icon_size: + type: string + description: > + If set to "small", the icon should be displayed at a + small size. + elements: + type: array + description: >- + An ordered list of elements to display in the content of + the panel. + items: + title: element + x-stoplight: + id: e2ybdrtmx0tme + type: object + description: > + Each element object contains one specific element + object such as a text element or an image element. + properties: + type: + element_type: string + enum: + - text + - image + - action + - panel + - panel_group + - table + description: > + The type of the included element object. + + The type also indicates which field contains the + included element object. + + e.g. if the type is "text", the included element + object will be in the "text_element" field. + + + Note that in the future, new type of element may + be added, + + so your code should ignore unrecognized types, and + unknown properties. + + + TODO: add Map type + text_element: + title: text_element + x-stoplight: + id: vdwxlt73qnqfa + type: object + description: >- + A text in simple HTML format to display. + + + For some specific texts that correspond to a + product field (e.g. a product name, the + ingredients list of a product),the edit_field_* + fields are used to indicate how to edit the field + value. + properties: + type: + type: string + description: > + the type of text, might influence the way you + display it. + enum: + - summary + - warning + - notes + html: + type: string + description: Text to display in HTML format. + language: + type: string + description: >- + Language of the text. The name of the language + is returned in the language requested when + making the API call. e.g. if the text is in + Polish, and the requested language is French, + the language field will contain "Polonais" + (French for "Polish"). Only set for specific + fields such as the list of ingredients of a + product. + lc: + type: string + description: >- + 2 letter language code for the text. Only set + for specific fields such as the list of + ingredients of a product. + edit_field_id: + type: string + description: >- + id of the field used to edit this text in the + product edit API. + edit_field_type: + type: string + description: Type of the product field. + edit_field_value: + type: string + description: >- + Current value of the product field. This may + differ from the html field which can contain + extra formating. + source_url: + type: string + description: Link to the source + example: 'https://en.wikipedia.org/wiki/Sodium acetate' + source_text: + type: string + description: name of the source + example: Wikipedia + source_lc: + type: string + description: Source locale name + example: en + source_language: + type: string + description: Human readable source locale name + example: English + image_element: + title: image_element + x-stoplight: + id: k4v4kwt489q3j + type: object + properties: + url: + type: string + description: full URL of the image + width: + type: integer + description: > + Width of the image. + + + This is just a suggestion coming from the + server, + + the client may choose to use its own + dimensions for the image. + height: + type: integer + description: > + Height of the image. + + + This is just a suggestion coming from the + server, + + the client may choose to use its own + dimensions for the image. + alt_text: + type: string + description: Alt Text of the image. + action_element: + type: string + panel_element: + title: panel_element + x-stoplight: + id: ymx41elz4yrnj + type: object + description: >- + Panels can include other panels as sub-panels + using the panel_element. + properties: + panel_id: + type: string + description: >- + The id of the panel to include. The id is the + key of the panel in the panels object returned + in the knowledge_panels field. + panel_group_element: + title: panel_group_element + x-stoplight: + id: b7emlfrgiuue2 + type: object + properties: + title: + type: string + panel_ids: + type: array + description: >- + The ids of the panels to include. The ids are + the keys of the panels in the panels object + returned in the knowledge_panels field. + items: + type: string + description: >- + The panel group element is used to display an + optional title followed by a number of sub-panels. + table_element: + title: table_element + x-stoplight: + id: 38zu3z4sruqo7 + type: object + description: Element to display a table. + properties: + id: + type: string + description: An id for the table. + title: + type: string + description: | + Title of the column. + rows: + type: string + columns: + type: array + items: + type: object + properties: + type: + type: string + text: + type: string + text_for_small_screens: + type: string + style: + type: string + column_group_id: + type: string + shown_by_default: + type: boolean + required: + - type + level: + type: string + description: | + a message level, as levels we use in log. + It might help theming the panel visualy + example: info + size: + type: string + enum: + - small + description: > + size is either empty (normal display) + + or small to indicate a panel that should have a smaller + font size + example: small + topics: + type: array + items: + type: string + example: health + readOnly: true + - type: object + description: | + Specific data about a product to enable personal ranking + properties: + attribute_groups: + type: array + description: >- + Each element is an attribute that can help compute a personal + ranking for the product + items: + type: object + properties: + id: + type: string + description: | + Unique id of the attribute. + + It will be use to match against preferences parameters. + status: + type: string + enum: + - known + - unknown + description: >- + wether we have the information to really compute this + criteria or not. + title: + type: string + description: > + A descriptive sentence about the situation of the product + concerning attribute + example: 'Does not contain: Molluscs' + match: + type: number + format: float + minimum: 0 + maximum: 100 + description: > + a numeric value for the match, + + telling how much the products ranks well for this + particular attribute. + + The higher the value, the better the match. + grade: + description: every attribute as a grade for a to e + type: string + enum: + - unknown + - a + - b + - c + - d + - e + name: + type: string + description: 'The name of attribute, for eventual display' + icon_url: + type: string + description: >- + an icon representing the attribute match (often using a + color) + description: + type: string + description: >- + An eventual description of the value of the property upon + which this attribute is based + description_short: + type: string + description: >- + An eventual short description of the value of the property + upon which this attribute is based + parameters: + id: + schema: + type: string + example: ingredients_en + in: query + name: id + required: true + cc: + schema: + type: string + example: us + in: query + name: cc + required: false + description: >- + 2 letter code of the country of the user. Used for localizing some + fields in returned values (e.g. knowledge panels). If not passed, the + country may be inferred by the IP address of the request. + lc: + schema: + type: string + example: fr + in: query + name: lc + required: false + description: > + 2 letter code of the language of the user. + + Used for localizing some fields in returned values (e.g. knowledge + panels). + + If not passed, the language may be inferred by the Accept-Language + header of the request, + + or from the domain name prefix. + code: + schema: + type: string + example: '4251105501381' + in: query + name: code + description: Barcode of the product + required: true + process_image: + schema: + type: string + example: '1' + in: query + name: process_image + required: true + ocr_engine: + schema: + type: string + example: google_cloud_vision + in: query + name: ocr_engine + required: true + imgid: + schema: + type: string + example: '1' + in: query + name: imgid + required: true + angle: + schema: + type: string + example: '90' + in: query + name: angle + required: true + page: + schema: + type: integer + example: 24 + in: query + name: page + description: > + The page number you request to view (eg. in search results spanning + multiple pages) + page_size: + schema: + type: integer + example: 24 + in: query + name: page_size + description: | + The number of elements should be sent per page + sort_by: + schema: + type: string + example: product_name + enum: + - product_name + - last_modified_t + - scans_n + - unique_scans_n + - created_t + - completeness + - popularity_key + - nutriscore_score + - nova_score + - nothing + - ecoscore_score + in: query + name: sort_by + description: > + The allowed values used to sort/order the search results. + + + * `product_name` sorts on name + + * `ecoscore_score`, `nova_score`, `nutriscore_score` rank on the + [Eco-Score](https://world.openfoodfacts.org/eco-score-the-environmental-impact-of-food-products), + [Nova](https://world.openfoodfacts.org/nova), or + [Nutri-Score](https://world.openfoodfacts.org/nutriscore) + + * `scans_n`, `unique_scans_n` and `popularity_key` are about product + popularity: number of scans on unique scans, rank of product + + * `created_t`, `last_modified_t`, are about creation and modification + dates + + * `nothing`, tells not to sort at all (because if you do not provide the + sort_by argument we default to sorting on popularity (for food) or last + modification date) + fields: + schema: + type: string + example: 'code,product_name' + in: query + name: fields + description: | + The fields to be returned from the product object can also be limited. + If not specified, it returns the entire product object response. + knowledge_panels_included: + schema: + type: string + example: 'heatlh_card, environment_card' + in: query + name: knowledge_panels_included + description: > + When knowledge_panels are requested, you can specify which panels should + be in the response. All the others will be excluded. + knowledge_panels_excluded: + schema: + type: string + example: 'heatlh_card, environment_card' + in: query + name: knowledge_panels_excluded + description: > + When knowledge_panels are requested, you can specify which panels to + exclude from the response. All the others will be included. + + If a panel is both excluded and included (with the + knowledge_panels_excluded parameter), it will be excluded. + tagtype: + schema: + type: string + example: additives + in: query + name: tagtype + term: + schema: + type: string + example: f + in: query + name: term +tags: + - name: Read Requests + - name: Write Requests \ No newline at end of file diff --git a/OpenFoodFactsService/merge_yamls.py b/OpenFoodFactsService/merge_yamls.py new file mode 100644 index 0000000..9a54385 --- /dev/null +++ b/OpenFoodFactsService/merge_yamls.py @@ -0,0 +1,99 @@ +import os +import yaml +import re + +def load_yaml(file_path): + if os.path.isdir(file_path): + print(f"Error: {file_path} is a directory, not a file.") + return None + print(f"Loading YAML file: {file_path}") + with open(file_path, 'r') as file: + return yaml.safe_load(file) + +def replace_references_bottom_up(openapi_data, current_file_path): + base_path = os.path.dirname(current_file_path) + # Find all references and replace them in a bottom-up manner + references_to_replace = [] + if isinstance(openapi_data, dict): + for key, value in openapi_data.items(): + if key == '$ref' and isinstance(value, str): + references_to_replace.append((key, value)) + else: + replace_references_bottom_up(value, current_file_path) + elif isinstance(openapi_data, list): + for item in openapi_data: + replace_references_bottom_up(item, current_file_path) + + # Replace references after traversing deeply + for key, value in references_to_replace: + ref_file_path, ref_anchor = parse_reference(value, base_path) + print(f"Resolving reference for key: {key}, from file: {ref_file_path}, anchor: {ref_anchor}") + if os.path.exists(ref_file_path) and not os.path.isdir(ref_file_path): + referenced_data = load_yaml(ref_file_path) + if referenced_data is None: + continue + # Traverse to the desired anchor (property) if present + if ref_anchor: + referenced_data = traverse_to_anchor(referenced_data, ref_anchor) + replace_references_bottom_up(referenced_data, ref_file_path) + if isinstance(referenced_data, dict): + openapi_data.update(referenced_data) + else: + openapi_data[key] = referenced_data + del openapi_data[key] + else: + print(f"Reference file not found or is a directory: {ref_file_path}") + +def parse_reference(ref_value, base_path): + # Split the reference into the file path and anchor (if any) + ref_parts = ref_value.split('#') + ref_file_path = os.path.join(base_path, ref_parts[0]) + ref_file_path = os.path.normpath(ref_file_path) + ref_anchor = ref_parts[1] if len(ref_parts) > 1 else None + return ref_file_path, ref_anchor + +def traverse_to_anchor(data, anchor): + # Traverse the data structure to find the anchor location + parts = anchor.strip('/').split('/') + for part in parts: + if isinstance(data, dict) and part in data: + data = data[part] + else: + print(f"Anchor part '{part}' not found in data.") + return None + return data + +def dereference_yaml(input_file): + yaml_data = load_yaml(input_file) + if yaml_data is None: + print(f"Error: Failed to load YAML file: {input_file}") + return + while True: + references_before = count_references(yaml_data) + replace_references_bottom_up(yaml_data, input_file) + references_after = count_references(yaml_data) + if references_before == references_after: + break + + # Save the fully dereferenced YAML data + with open(input_file, 'w') as file: + print(f"Saving dereferenced file: {input_file}") + yaml.dump(yaml_data, file, sort_keys=False) + +def count_references(openapi_data): + if isinstance(openapi_data, dict): + return sum(1 for key, value in openapi_data.items() if key == '$ref') + sum(count_references(value) for value in openapi_data.values()) + elif isinstance(openapi_data, list): + return sum(count_references(item) for item in openapi_data) + return 0 + +if __name__ == "__main__": + import sys + if len(sys.argv) != 2: + print("Usage: python script.py ") + sys.exit(1) + + input_file = sys.argv[1] + print(f"Starting to dereference YAML file: {input_file}") + dereference_yaml(input_file) + print(f"All references have been dereferenced in the YAML file: {input_file}") \ No newline at end of file diff --git a/Sources/openapi-generator-config.yaml b/Sources/openapi-generator-config.yaml new file mode 100644 index 0000000..ecefb47 --- /dev/null +++ b/Sources/openapi-generator-config.yaml @@ -0,0 +1,3 @@ +generate: + - types + - client diff --git a/Sources/openapi.yaml b/Sources/openapi.yaml new file mode 100644 index 0000000..8320beb --- /dev/null +++ b/Sources/openapi.yaml @@ -0,0 +1,599 @@ +openapi: 3.1.0 +info: + title: Open Food Facts Open API + description: | + As a developer, the Open Food Facts API allows you to get information + and contribute to the products database. You can create great apps to + help people make better food choices and also provide data to enhance the database. + termsOfService: "https://world.openfoodfacts.org/terms-of-use" + contact: + name: Open Food Facts + url: "https://slack.openfoodfacts.org/" + email: reuse@openfoodfacts.org + license: + name: "data: ODbL" + url: "https://opendatacommons.org/licenses/odbl/summary/index.html" + # can't use url and identifier - use x-identifier + x-identifier: "ODbL-1.0" + version: "2" +externalDocs: + description: | + Please read the API introduction before using this API. + url: https://openfoodfacts.github.io/openfoodfacts-server/api/ +servers: + - description: dev + url: "https://world.openfoodfacts.net" + - url: "https://world.openfoodfacts.org" + description: prod +paths: + "/api/v2/product/{barcode}": + get: + tags: + - Read Requests + summary: Get information for a specific product by barcode + parameters: + - name: barcode + in: path + description: | + The barcode of the product to be fetched + required: true + style: simple + explode: false + schema: + type: string + example: "3017620422003" + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: ./responses/get_product_by_barcode.yaml + examples: + spread-example: + $ref: ./examples/get_product_by_barcode_spread.yaml + + description: | + A product can be fetched via its unique barcode. + It returns all the details of that product response. + operationId: get-product-by-barcode + "/api/v2/product/{barcode}?fields=knowledge_panels": + get: + tags: + - Read Requests + summary: | + Get Knowledge panels for a specific product by barcode + (special case of get product) + parameters: + - name: barcode + in: path + description: | + The barcode of the product to be fetched + required: true + style: simple + explode: false + schema: + type: string + example: "3017620422003" + responses: + "200": + description: OK + content: + application/json: + schema: + allOf: + - $ref: ./responses/get_product_by_barcode_base.yaml + - type: object + properties: + product: + $ref: ./schemas/product_knowledge_panels.yaml + description: | + Knowledge panels gives high leve informations about a product, + ready to display. + This is used by open food facts website, + and by the official mobile application + operationId: get-product-by-barcode-knowledge-panels + /cgi/product_image_upload.pl: + post: + tags: + - Write Requests + summary: Add a Photo to an Existing Product + operationId: get-cgi-product_image_upload.pl + description: | + Photos are source and proof of data. + The first photo uploaded for a product is + auto-selected as the product’s “front” photo.' + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: ./responses/add_photo_to_existing_product.yaml + requestBody: + content: + multipart/form-data: + schema: + $ref: ./requestBodies/add_photo_to_existing_product.yaml + description: "" + /cgi/ingredients.pl: + parameters: [] + get: + summary: Performing OCR on a Product + operationId: get-cgi-ingredients.pl + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: ./responses/ocr_on_product.yaml + description: | + Open Food Facts uses optical character recognition (OCR) to retrieve nutritional data and other information from the product labels. + parameters: + - $ref: "#/components/parameters/id" + - $ref: "#/components/parameters/code" + - $ref: "#/components/parameters/process_image" + - $ref: "#/components/parameters/ocr_engine" + tags: + - Read Requests + /cgi/product_image_crop.pl: + post: + summary: Crop A Photo + operationId: post-cgi-product_image_crop.pl + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: {} + description: | + Cropping is only relevant for editing existing products. + You cannot crop an image the first time you upload it to the system. + parameters: [] + requestBody: + content: + multipart/form-data: + schema: + $ref: ./requestBodies/crop_a_photo.yaml + required: true + tags: + - Write Requests + get: + summary: Rotate A Photo + operationId: get-cgi-product_image_crop.pl + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: ./responses/rotate_a_photo.yaml + description: | + Although we recommend rotating photos manually and uploading a new version of the image, + the OFF API allows you to make api calls to automate this process. + You can rotate existing photos by setting the angle to 90º, 180º, or 270º clockwise. + parameters: + - $ref: "#/components/parameters/code" + - $ref: "#/components/parameters/id" + - $ref: "#/components/parameters/imgid" + - $ref: "#/components/parameters/angle" + tags: + - Write Requests + /cgi/product_image_unselect.pl: + post: + summary: Unselect A Photo + requestBody: + content: + multipart/form-data: + schema: + $ref: ./requestBodies/unselect_a_photo.yaml + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + status: + type: string + description: status of the unselect operation + example: status ok + status_code: + type: number + description: status code of the operation + example: 0 + imagefield: + type: string + example: front_fr + description: image field that was unselected + + /cgi/product_jqm2.pl: + post: + summary: Add or Edit A Product + operationId: post-cgi-product_jqm2.pl + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: ./responses/add_or_edit_a_product.yaml + parameters: [] + requestBody: + content: + multipart/form-data: + schema: + allOf: + - $ref: ./requestBodies/add_or_edit_a_product.yaml + - $ref: ./requestBodies/change_ref_properties.yaml + tags: + - Write Requests + description: | + This updates a product. + + Note: If the barcode exists then you will be editing the existing product, + However if it doesn''t you will be creating a new product with that unique barcode, + and adding properties to the product. + /api/v2/search: + get: + summary: Search for Products + tags: + - Read Requests + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: ./responses/search_for_products.yaml + operationId: get-search + description: | + Search request allows you to get products that match your search criteria. + + It allows you create many custom APIs for your use case. + + If the search query parameter has 2 possible values, they are seperated by a comma(,). + When filtering via a parameter that has different language codes like `fr`, `de` or `en`, specify the language code in the parameter name e.g `categories_tags_en` + + **Important:** search API v2 does not support full text request (search_term), + you have to use [search API v1](https://wiki.openfoodfacts.org/API/Read/Search) for that. + Upcoming [search-a-licious project](https://github.com/openfoodfacts/search-a-licious) will fix that. + + ### Limiting results + + You can limit the size of returned objects thanks to the `fields` object (see below). + + eg: `fields=code,product_name,brands,attribute_groups`` + + Please use it as much as possible to avoid overloading the servers. + + The search use pagination, see `page` and `page_size` parameters. + + **Beware:** the `page_count` data in item is a bit counter intuitive…, read the description. + + ### Conditions on tags + + All `_tags`` parameters accepts either: + + * a single value + * or a comma-separated list of values (doing a AND) + * or a pipe separated list of values (doing a OR) + + You can exclude terms by using a "-" prefix. + + For taxonomized entries, you might either use the tag id (recommended), + or a known synonym (without language prefix) + + * `labels_tags=en:organic,en:fair-trade` find items that are fair-trade AND organic + * `labels_tags=en:organic|en:fair-trade` find items that are fair-trade OR organic + * `labels_tags=en:organic,en:-fair-trade` find items that are organic BUT NOT fair-trade + + + ### Conditions on nutriments + + To get a list of nutrients + + You can either query on nutrient per 100g (`_100g` suffix) + or per serving (`serving` suffix). + + You can also add `_prepared_` + to get the nutrients in the prepared product instead of as sold. + + You can add a comparison operator and value to the parameter name + to get products with nutrient above or bellow a value. + If you use a parameter value it exactly match it. + + * `energy-kj_100g<200` products where energy in kj for 100g is less than 200kj + * `sugars_serving>10` products where sugar per serving is greater than 10g + * `saturated-fat_100g=1` products where saturated fat per 100g is exactly 10g + * `salt_prepared_serving<0.1` products where salt per serving for prepared product is less than 0.1g + + ### More references + + See also [wiki page](https://wiki.openfoodfacts.org/Open_Food_Facts_Search_API_Version_2) + + parameters: + # all tags parameters + - $ref: "./schemas/tags_parameters.yaml#/properties/additives_tags" + - $ref: "./schemas/tags_parameters.yaml#/properties/allergens_tags" + - $ref: "./schemas/tags_parameters.yaml#/properties/brands_tags" + - $ref: "./schemas/tags_parameters.yaml#/properties/categories_tags" + - $ref: "./schemas/tags_parameters.yaml#/properties/countries_tags" + - $ref: "./schemas/tags_parameters.yaml#/properties/emb_codes_tags" + - $ref: "./schemas/tags_parameters.yaml#/properties/labels_tags" + - $ref: "./schemas/tags_parameters.yaml#/properties/manufacturing_places_tags" + - $ref: "./schemas/tags_parameters.yaml#/properties/nutrition_grades_tags" + - $ref: "./schemas/tags_parameters.yaml#/properties/origins_tags" + - $ref: "./schemas/tags_parameters.yaml#/properties/packaging_tags" + - $ref: "./schemas/tags_parameters.yaml#/properties/purchase_places_tags" + - $ref: "./schemas/tags_parameters.yaml#/properties/states_tags" + - $ref: "./schemas/tags_parameters.yaml#/properties/stores_tags" + - $ref: "./schemas/tags_parameters.yaml#/properties/traces_tags" + - $ref: "./schemas/tags_parameters.yaml#/properties/tag_name_with_language_code" + - $ref: "./schemas/nutrition_search.yaml#/properties/nutrient_lower_than" + - $ref: "./schemas/nutrition_search.yaml#/properties/nutrient_greater_than" + - $ref: "./schemas/nutrition_search.yaml#/properties/nutrient_equal" + - $ref: "#/components/parameters/fields" + - $ref: "#/components/parameters/sort_by" + - $ref: "#/components/parameters/page" + - $ref: "#/components/parameters/page_size" + parameters: [] + /cgi/suggest.pl: + get: + summary: Get Suggestions to Aid Adding/Editing Products + tags: + - Read Requests + responses: + "200": + description: OK + content: + application/json: + schema: + type: array + operationId: get-cgi-suggest.pl + parameters: + - $ref: "#/components/parameters/tagtype" + - $ref: "#/components/parameters/term" + description: | + For example , Dave is looking for packaging_shapes that contain the term "fe", + all packaging_shapes containing "fe" will be returned. + This is useful if you have a search in your application, + for a specific product field. + /cgi/nutrients.pl: + get: + summary: Get a nested list of nutrients that can be displayed in the nutrition facts table for a specific country and language + tags: + - Read Requests + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: ./responses/get_nutrients.yaml + operationId: get-cgi-nutrients.pl + parameters: + - $ref: "#/components/parameters/cc" + - $ref: "#/components/parameters/lc" + description: | + Used to display the nutrition facts table of a product, or to display a form to input those nutrition facts. + /api/v2/attribute_groups: + get: + summary: Get the list of attributes available for personal search. + description: | + Attributes are at the heart of personal search. + They score the products according to different criterias, + which could then be matched to a user's preferences. + + This API helps you list attributes and display them in your application, + for the user to choose the importance of each criteria. + + note: /api/v2/attribute_groups_{lc} is also a valid route, but consider it deprecated + tags: + - Read Requests + - Personal search + operationId: get-attribute-groups + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: ./responses/get_attribute_groups.yaml + parameters: + - $ref: "#/components/parameters/lc" + /api/v2/preferences: + get: + summary: | + Get the weights corresponding to attributes preferences + to compute personal product + tags: + - Read Requests + - Personal search + operationId: get-preferences + parameters: + - $ref: "#/components/parameters/lc" + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: ./responses/get_preferences.yaml +components: + schemas: + "Product-Base": + $ref: ./schemas/product_base.yaml + "Product-Misc": + $ref: ./schemas/product_misc.yaml + "Product-Tags": + $ref: ./schemas/product_tags.yaml + "Product-Nutrition": + $ref: ./schemas/product_nutrition.yaml + "Product-Ingredients": + $ref: ./schemas/product_ingredients.yaml + "Product-Images": + $ref: ./schemas/product_images.yaml + "Product-Eco-Score": + $ref: ./schemas/product_ecoscore.yaml + "Product-Metadata": + $ref: ./schemas/product_meta.yaml + "Product-Data-Quality": + $ref: ./schemas/product_quality.yaml + "Product-Knowledge-Panels": + $ref: ./schemas/product_knowledge_panels.yaml + "Product-Attribute-Groups": + $ref: "./schemas/product_attribute_groups.yaml" + Product: + $ref: ./schemas/product.yaml + parameters: + id: + schema: + type: string + example: ingredients_en + in: query + name: id + required: true + cc: + schema: + type: string + example: "us" + in: query + name: cc + required: false + description: "2 letter code of the country of the user. Used for localizing some fields in returned values (e.g. knowledge panels). If not passed, the country may be inferred by the IP address of the request." + lc: + schema: + type: string + example: "fr" + in: query + name: lc + required: false + description: | + 2 letter code of the language of the user. + Used for localizing some fields in returned values (e.g. knowledge panels). + If not passed, the language may be inferred by the Accept-Language header of the request, + or from the domain name prefix. + code: + schema: + type: string + example: "4251105501381" + in: query + name: code + description: Barcode of the product + required: true + process_image: + schema: + type: string + example: "1" + in: query + name: process_image + required: true + ocr_engine: + schema: + type: string + example: google_cloud_vision + in: query + name: ocr_engine + required: true + imgid: + schema: + type: string + example: "1" + in: query + name: imgid + required: true + angle: + schema: + type: string + example: "90" + in: query + name: angle + required: true + page: + schema: + type: int + example: 24 + in: query + name: page + description: | + The page number you request to view (eg. in search results spanning multiple pages) + page_size: + schema: + type: int + example: 24 + in: query + name: page_size + description: | + The number of elements should be sent per page + sort_by: + schema: + type: string + example: product_name + enum: + - product_name + - last_modified_t + - scans_n + - unique_scans_n + - created_t + - completeness + - popularity_key + - nutriscore_score + - nova_score + - nothing + - ecoscore_score + in: query + name: sort_by + description: | + The allowed values used to sort/order the search results. + + * `product_name` sorts on name + * `ecoscore_score`, `nova_score`, `nutriscore_score` rank on the [Eco-Score](https://world.openfoodfacts.org/eco-score-the-environmental-impact-of-food-products), [Nova](https://world.openfoodfacts.org/nova), or [Nutri-Score](https://world.openfoodfacts.org/nutriscore) + * `scans_n`, `unique_scans_n` and `popularity_key` are about product popularity: number of scans on unique scans, rank of product + * `created_t`, `last_modified_t`, are about creation and modification dates + * `nothing`, tells not to sort at all (because if you do not provide the sort_by argument we default to sorting on popularity (for food) or last modification date) + fields: + schema: + type: string + example: "code,product_name" + in: query + name: fields + description: | + The fields to be returned from the product object can also be limited. + If not specified, it returns the entire product object response. + knowledge_panels_included: + schema: + type: string + example: "heatlh_card, environment_card" + in: query + name: knowledge_panels_included + description: | + When knowledge_panels are requested, you can specify which panels should be in the response. All the others will be excluded. + knowledge_panels_excluded: + schema: + type: string + example: "heatlh_card, environment_card" + in: query + name: knowledge_panels_excluded + description: | + When knowledge_panels are requested, you can specify which panels to exclude from the response. All the others will be included. + If a panel is both excluded and included (with the knowledge_panels_excluded parameter), it will be excluded. + tagtype: + schema: + type: string + example: additives + in: query + name: tagtype + term: + schema: + type: string + example: f + in: query + name: term +tags: + - name: Read Requests + - name: Write Requests From f0849e1b1100d2f3ba69491885df2d03394b6fb8 Mon Sep 17 00:00:00 2001 From: Henadzi Rabkin Date: Tue, 8 Oct 2024 22:56:57 +0200 Subject: [PATCH 5/9] Generating OpenFoodFactsClient from v2 openapi OFF yaml --- OpenFoodFactsService/Sources/Client.swift | 1585 ++ OpenFoodFactsService/Sources/Types.swift | 8662 +++++++++ OpenFoodFactsService/Sources/main.swift | 10 - .../Sources/openapi-generator-config.yaml | 1 + OpenFoodFactsService/Sources/openapi.yaml | 15924 ++++------------ OpenFoodFactsService/merge_yamls.py | 99 - Tools/clear_and_process.sh | 4 + Tools/generate.sh | 5 + Tools/process_yamls.py | 216 + Tools/ref/api-v3.yml | 443 + Tools/ref/api.yml | 599 + .../get_product_by_barcode_spread.yaml | 1055 + .../requestBodies/add_or_edit_a_product.yaml | 58 + .../add_photo_to_existing_product.yaml | 31 + .../requestBodies/change_ref_properties.yaml | 32 + Tools/ref/requestBodies/crop_a_photo.yaml | 69 + Tools/ref/requestBodies/fields_tags_lc.yaml | 22 + Tools/ref/requestBodies/lc_cc.yaml | 15 + Tools/ref/requestBodies/unselect_a_photo.yaml | 10 + .../ref/responses/add_or_edit_a_product.yaml | 8 + .../add_photo_to_existing_product.yaml | 47 + .../ref/responses/change_ref_properties.yaml | 8 + Tools/ref/responses/get_attribute_groups.yaml | 45 + Tools/ref/responses/get_nutrients.yaml | 1 + Tools/ref/responses/get_preferences.yaml | 27 + .../ref/responses/get_product_by_barcode.yaml | 11 + .../get_product_by_barcode_base.yaml | 15 + Tools/ref/responses/ocr_on_product.yaml | 5 + .../response-status/response_status.yaml | 61 + .../response-status/warning-or-error.yaml | 64 + Tools/ref/responses/rotate_a_photo.yaml | 17 + Tools/ref/responses/search_for_products.yaml | 38 + Tools/ref/schemas/agribalyse.yaml | 47 + Tools/ref/schemas/image.yaml | 36 + Tools/ref/schemas/image_role.yaml | 57 + Tools/ref/schemas/image_size.yaml | 12 + Tools/ref/schemas/image_urls.yaml | 5 + Tools/ref/schemas/ingredient.yaml | 30 + .../knowledge_panels/elements/element.yaml | 39 + .../elements/image_element.yaml | 26 + .../elements/panel_element.yaml | 9 + .../elements/panel_group_element.yaml | 13 + .../elements/table_element.yaml | 32 + .../elements/text_element.yaml | 51 + .../elements/title_element.yaml | 38 + Tools/ref/schemas/knowledge_panels/panel.yaml | 50 + .../ref/schemas/knowledge_panels/panels.yaml | 15 + Tools/ref/schemas/nutrient_unit.yaml | 21 + Tools/ref/schemas/nutrients.yaml | 26 + Tools/ref/schemas/nutrition_search.yaml | 67 + .../packagings/input_taxonomy_tag.yaml | 14 + .../schemas/packagings/material-write.yaml | 17 + Tools/ref/schemas/packagings/material.yaml | 15 + .../packagings/packaging_component-write.yaml | 53 + .../packagings/packaging_component.yaml | 61 + .../schemas/packagings/packagings-write.yaml | 11 + Tools/ref/schemas/packagings/packagings.yaml | 38 + .../packagings/packagings_complete.yaml | 7 + .../schemas/packagings/recycling-write.yaml | 17 + Tools/ref/schemas/packagings/recycling.yaml | 15 + Tools/ref/schemas/packagings/shape-write.yaml | 17 + Tools/ref/schemas/packagings/shape.yaml | 15 + Tools/ref/schemas/product.yaml | 31 + .../ref/schemas/product_attribute_groups.yaml | 51 + Tools/ref/schemas/product_base.yaml | 96 + Tools/ref/schemas/product_ecoscore.yaml | 146 + Tools/ref/schemas/product_extended.yaml | 161 + Tools/ref/schemas/product_hidden.yaml | 105 + Tools/ref/schemas/product_images.yaml | 98 + Tools/ref/schemas/product_ingredients.yaml | 167 + .../ref/schemas/product_knowledge_panels.yaml | 6 + Tools/ref/schemas/product_meta.yaml | 145 + Tools/ref/schemas/product_misc.yaml | 115 + Tools/ref/schemas/product_nutrition.yaml | 339 + Tools/ref/schemas/product_quality.yaml | 66 + Tools/ref/schemas/product_tags.yaml | 119 + Tools/ref/schemas/product_update_api_v3.yaml | 28 + Tools/ref/schemas/tags_parameters.yaml | 240 + Tools/ref/schemas/taxonomies/tagtype.yaml | 45 + 79 files changed, 19589 insertions(+), 12410 deletions(-) create mode 100644 OpenFoodFactsService/Sources/Client.swift create mode 100644 OpenFoodFactsService/Sources/Types.swift delete mode 100644 OpenFoodFactsService/merge_yamls.py create mode 100644 Tools/clear_and_process.sh create mode 100644 Tools/generate.sh create mode 100644 Tools/process_yamls.py create mode 100644 Tools/ref/api-v3.yml create mode 100644 Tools/ref/api.yml create mode 100644 Tools/ref/examples/get_product_by_barcode_spread.yaml create mode 100644 Tools/ref/requestBodies/add_or_edit_a_product.yaml create mode 100644 Tools/ref/requestBodies/add_photo_to_existing_product.yaml create mode 100644 Tools/ref/requestBodies/change_ref_properties.yaml create mode 100644 Tools/ref/requestBodies/crop_a_photo.yaml create mode 100644 Tools/ref/requestBodies/fields_tags_lc.yaml create mode 100644 Tools/ref/requestBodies/lc_cc.yaml create mode 100644 Tools/ref/requestBodies/unselect_a_photo.yaml create mode 100644 Tools/ref/responses/add_or_edit_a_product.yaml create mode 100644 Tools/ref/responses/add_photo_to_existing_product.yaml create mode 100644 Tools/ref/responses/change_ref_properties.yaml create mode 100644 Tools/ref/responses/get_attribute_groups.yaml create mode 100644 Tools/ref/responses/get_nutrients.yaml create mode 100644 Tools/ref/responses/get_preferences.yaml create mode 100644 Tools/ref/responses/get_product_by_barcode.yaml create mode 100644 Tools/ref/responses/get_product_by_barcode_base.yaml create mode 100644 Tools/ref/responses/ocr_on_product.yaml create mode 100644 Tools/ref/responses/response-status/response_status.yaml create mode 100644 Tools/ref/responses/response-status/warning-or-error.yaml create mode 100644 Tools/ref/responses/rotate_a_photo.yaml create mode 100644 Tools/ref/responses/search_for_products.yaml create mode 100644 Tools/ref/schemas/agribalyse.yaml create mode 100644 Tools/ref/schemas/image.yaml create mode 100644 Tools/ref/schemas/image_role.yaml create mode 100644 Tools/ref/schemas/image_size.yaml create mode 100644 Tools/ref/schemas/image_urls.yaml create mode 100644 Tools/ref/schemas/ingredient.yaml create mode 100644 Tools/ref/schemas/knowledge_panels/elements/element.yaml create mode 100644 Tools/ref/schemas/knowledge_panels/elements/image_element.yaml create mode 100644 Tools/ref/schemas/knowledge_panels/elements/panel_element.yaml create mode 100644 Tools/ref/schemas/knowledge_panels/elements/panel_group_element.yaml create mode 100644 Tools/ref/schemas/knowledge_panels/elements/table_element.yaml create mode 100644 Tools/ref/schemas/knowledge_panels/elements/text_element.yaml create mode 100644 Tools/ref/schemas/knowledge_panels/elements/title_element.yaml create mode 100644 Tools/ref/schemas/knowledge_panels/panel.yaml create mode 100644 Tools/ref/schemas/knowledge_panels/panels.yaml create mode 100644 Tools/ref/schemas/nutrient_unit.yaml create mode 100644 Tools/ref/schemas/nutrients.yaml create mode 100644 Tools/ref/schemas/nutrition_search.yaml create mode 100644 Tools/ref/schemas/packagings/input_taxonomy_tag.yaml create mode 100644 Tools/ref/schemas/packagings/material-write.yaml create mode 100644 Tools/ref/schemas/packagings/material.yaml create mode 100644 Tools/ref/schemas/packagings/packaging_component-write.yaml create mode 100644 Tools/ref/schemas/packagings/packaging_component.yaml create mode 100644 Tools/ref/schemas/packagings/packagings-write.yaml create mode 100644 Tools/ref/schemas/packagings/packagings.yaml create mode 100644 Tools/ref/schemas/packagings/packagings_complete.yaml create mode 100644 Tools/ref/schemas/packagings/recycling-write.yaml create mode 100644 Tools/ref/schemas/packagings/recycling.yaml create mode 100644 Tools/ref/schemas/packagings/shape-write.yaml create mode 100644 Tools/ref/schemas/packagings/shape.yaml create mode 100644 Tools/ref/schemas/product.yaml create mode 100644 Tools/ref/schemas/product_attribute_groups.yaml create mode 100644 Tools/ref/schemas/product_base.yaml create mode 100644 Tools/ref/schemas/product_ecoscore.yaml create mode 100644 Tools/ref/schemas/product_extended.yaml create mode 100644 Tools/ref/schemas/product_hidden.yaml create mode 100644 Tools/ref/schemas/product_images.yaml create mode 100644 Tools/ref/schemas/product_ingredients.yaml create mode 100644 Tools/ref/schemas/product_knowledge_panels.yaml create mode 100644 Tools/ref/schemas/product_meta.yaml create mode 100644 Tools/ref/schemas/product_misc.yaml create mode 100644 Tools/ref/schemas/product_nutrition.yaml create mode 100644 Tools/ref/schemas/product_quality.yaml create mode 100644 Tools/ref/schemas/product_tags.yaml create mode 100644 Tools/ref/schemas/product_update_api_v3.yaml create mode 100644 Tools/ref/schemas/tags_parameters.yaml create mode 100644 Tools/ref/schemas/taxonomies/tagtype.yaml diff --git a/OpenFoodFactsService/Sources/Client.swift b/OpenFoodFactsService/Sources/Client.swift new file mode 100644 index 0000000..1baeedc --- /dev/null +++ b/OpenFoodFactsService/Sources/Client.swift @@ -0,0 +1,1585 @@ +// Generated by swift-openapi-generator, do not modify. +@_spi(Generated) import OpenAPIRuntime +#if os(Linux) +@preconcurrency import struct Foundation.URL +@preconcurrency import struct Foundation.Data +@preconcurrency import struct Foundation.Date +#else +import struct Foundation.URL +import struct Foundation.Data +import struct Foundation.Date +#endif +import HTTPTypes +/// As a developer, the Open Food Facts API allows you to get information +/// and contribute to the products database. You can create great apps to +/// help people make better food choices and also provide data to enhance the database. +/// +public struct Client: APIProtocol { + /// The underlying HTTP client. + private let client: UniversalClient + /// Creates a new client. + /// - Parameters: + /// - serverURL: The server URL that the client connects to. Any server + /// URLs defined in the OpenAPI document are available as static methods + /// on the ``Servers`` type. + /// - configuration: A set of configuration values for the client. + /// - transport: A transport that performs HTTP operations. + /// - middlewares: A list of middlewares to call before the transport. + public init( + serverURL: Foundation.URL, + configuration: Configuration = .init(), + transport: any ClientTransport, + middlewares: [any ClientMiddleware] = [] + ) { + self.client = .init( + serverURL: serverURL, + configuration: configuration, + transport: transport, + middlewares: middlewares + ) + } + private var converter: Converter { + client.converter + } + /// Get information for a specific product by barcode + /// + /// A product can be fetched via its unique barcode. + /// It returns all the details of that product response. + /// + /// + /// - Remark: HTTP `GET /api/v2/product/{barcode}`. + /// - Remark: Generated from `#/paths//api/v2/product/{barcode}/get(get-product-by-barcode)`. + public func get_hyphen_product_hyphen_by_hyphen_barcode(_ input: Operations.get_hyphen_product_hyphen_by_hyphen_barcode.Input) async throws -> Operations.get_hyphen_product_hyphen_by_hyphen_barcode.Output { + try await client.send( + input: input, + forOperation: Operations.get_hyphen_product_hyphen_by_hyphen_barcode.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/api/v2/product/{}", + parameters: [ + input.path.barcode + ] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .get + ) + suppressMutabilityWarning(&request) + converter.setAcceptHeader( + in: &request.headerFields, + contentTypes: input.headers.accept + ) + return (request, nil) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 200: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.get_hyphen_product_hyphen_by_hyphen_barcode.Output.Ok.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.get_product_by_barcode.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .ok(.init(body: body)) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + /// Get Knowledge panels for a specific product by barcode + /// (special case of get product) + /// + /// + /// Knowledge panels gives high leve informations about a product, + /// ready to display. + /// This is used by open food facts website, + /// and by the official mobile application + /// + /// + /// - Remark: HTTP `GET /api/v2/product/{barcode}?fields=knowledge_panels`. + /// - Remark: Generated from `#/paths//api/v2/product/{barcode}?fields=knowledge_panels/get(get-product-by-barcode-knowledge-panels)`. + public func get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels(_ input: Operations.get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels.Input) async throws -> Operations.get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels.Output { + try await client.send( + input: input, + forOperation: Operations.get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/api/v2/product/{}?fields=knowledge_panels", + parameters: [ + input.path.barcode + ] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .get + ) + suppressMutabilityWarning(&request) + converter.setAcceptHeader( + in: &request.headerFields, + contentTypes: input.headers.accept + ) + return (request, nil) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 200: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels.Output.Ok.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Operations.get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels.Output.Ok.Body.jsonPayload.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .ok(.init(body: body)) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + /// Performing OCR on a Product + /// + /// Open Food Facts uses optical character recognition (OCR) to retrieve nutritional data and other information from the product labels. + /// + /// + /// - Remark: HTTP `GET /cgi/ingredients.pl`. + /// - Remark: Generated from `#/paths//cgi/ingredients.pl/get(get-cgi-ingredients.pl)`. + public func get_hyphen_cgi_hyphen_ingredients_period_pl(_ input: Operations.get_hyphen_cgi_hyphen_ingredients_period_pl.Input) async throws -> Operations.get_hyphen_cgi_hyphen_ingredients_period_pl.Output { + try await client.send( + input: input, + forOperation: Operations.get_hyphen_cgi_hyphen_ingredients_period_pl.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/cgi/ingredients.pl", + parameters: [] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .get + ) + suppressMutabilityWarning(&request) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "id", + value: input.query.id + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "code", + value: input.query.code + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "process_image", + value: input.query.process_image + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "ocr_engine", + value: input.query.ocr_engine + ) + converter.setAcceptHeader( + in: &request.headerFields, + contentTypes: input.headers.accept + ) + return (request, nil) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 200: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.get_hyphen_cgi_hyphen_ingredients_period_pl.Output.Ok.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.ocr_on_product.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .ok(.init(body: body)) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + /// Rotate A Photo + /// + /// Although we recommend rotating photos manually and uploading a new version of the image, + /// the OFF API allows you to make api calls to automate this process. + /// You can rotate existing photos by setting the angle to 90º, 180º, or 270º clockwise. + /// + /// + /// - Remark: HTTP `GET /cgi/product_image_crop.pl`. + /// - Remark: Generated from `#/paths//cgi/product_image_crop.pl/get(get-cgi-product_image_crop.pl)`. + public func get_hyphen_cgi_hyphen_product_image_crop_period_pl(_ input: Operations.get_hyphen_cgi_hyphen_product_image_crop_period_pl.Input) async throws -> Operations.get_hyphen_cgi_hyphen_product_image_crop_period_pl.Output { + try await client.send( + input: input, + forOperation: Operations.get_hyphen_cgi_hyphen_product_image_crop_period_pl.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/cgi/product_image_crop.pl", + parameters: [] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .get + ) + suppressMutabilityWarning(&request) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "code", + value: input.query.code + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "id", + value: input.query.id + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "imgid", + value: input.query.imgid + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "angle", + value: input.query.angle + ) + converter.setAcceptHeader( + in: &request.headerFields, + contentTypes: input.headers.accept + ) + return (request, nil) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 200: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.get_hyphen_cgi_hyphen_product_image_crop_period_pl.Output.Ok.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.rotate_a_photo.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .ok(.init(body: body)) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + /// Crop A Photo + /// + /// Cropping is only relevant for editing existing products. + /// You cannot crop an image the first time you upload it to the system. + /// + /// + /// - Remark: HTTP `POST /cgi/product_image_crop.pl`. + /// - Remark: Generated from `#/paths//cgi/product_image_crop.pl/post(post-cgi-product_image_crop.pl)`. + public func post_hyphen_cgi_hyphen_product_image_crop_period_pl(_ input: Operations.post_hyphen_cgi_hyphen_product_image_crop_period_pl.Input) async throws -> Operations.post_hyphen_cgi_hyphen_product_image_crop_period_pl.Output { + try await client.send( + input: input, + forOperation: Operations.post_hyphen_cgi_hyphen_product_image_crop_period_pl.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/cgi/product_image_crop.pl", + parameters: [] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .post + ) + suppressMutabilityWarning(&request) + converter.setAcceptHeader( + in: &request.headerFields, + contentTypes: input.headers.accept + ) + let body: OpenAPIRuntime.HTTPBody? + switch input.body { + case let .multipartForm(value): + body = try converter.setRequiredRequestBodyAsMultipart( + value, + headerFields: &request.headerFields, + contentType: "multipart/form-data", + allowsUnknownParts: true, + requiredExactlyOncePartNames: [ + "code", + "id", + "imgid" + ], + requiredAtLeastOncePartNames: [], + atMostOncePartNames: [ + "angle", + "normalize", + "white_magic", + "x1", + "x2", + "y1", + "y2" + ], + zeroOrMoreTimesPartNames: [], + encoding: { part in + switch part { + case let .code(wrapped): + var headerFields: HTTPTypes.HTTPFields = .init() + let value = wrapped.payload + let body = try converter.setRequiredRequestBodyAsBinary( + value.body, + headerFields: &headerFields, + contentType: "text/plain" + ) + return .init( + name: "code", + filename: wrapped.filename, + headerFields: headerFields, + body: body + ) + case let .imgid(wrapped): + var headerFields: HTTPTypes.HTTPFields = .init() + let value = wrapped.payload + let body = try converter.setRequiredRequestBodyAsBinary( + value.body, + headerFields: &headerFields, + contentType: "text/plain" + ) + return .init( + name: "imgid", + filename: wrapped.filename, + headerFields: headerFields, + body: body + ) + case let .id(wrapped): + var headerFields: HTTPTypes.HTTPFields = .init() + let value = wrapped.payload + let body = try converter.setRequiredRequestBodyAsBinary( + value.body, + headerFields: &headerFields, + contentType: "text/plain" + ) + return .init( + name: "id", + filename: wrapped.filename, + headerFields: headerFields, + body: body + ) + case let .x1(wrapped): + var headerFields: HTTPTypes.HTTPFields = .init() + let value = wrapped.payload + let body = try converter.setRequiredRequestBodyAsBinary( + value.body, + headerFields: &headerFields, + contentType: "text/plain" + ) + return .init( + name: "x1", + filename: wrapped.filename, + headerFields: headerFields, + body: body + ) + case let .y1(wrapped): + var headerFields: HTTPTypes.HTTPFields = .init() + let value = wrapped.payload + let body = try converter.setRequiredRequestBodyAsBinary( + value.body, + headerFields: &headerFields, + contentType: "text/plain" + ) + return .init( + name: "y1", + filename: wrapped.filename, + headerFields: headerFields, + body: body + ) + case let .x2(wrapped): + var headerFields: HTTPTypes.HTTPFields = .init() + let value = wrapped.payload + let body = try converter.setRequiredRequestBodyAsBinary( + value.body, + headerFields: &headerFields, + contentType: "text/plain" + ) + return .init( + name: "x2", + filename: wrapped.filename, + headerFields: headerFields, + body: body + ) + case let .y2(wrapped): + var headerFields: HTTPTypes.HTTPFields = .init() + let value = wrapped.payload + let body = try converter.setRequiredRequestBodyAsBinary( + value.body, + headerFields: &headerFields, + contentType: "text/plain" + ) + return .init( + name: "y2", + filename: wrapped.filename, + headerFields: headerFields, + body: body + ) + case let .angle(wrapped): + var headerFields: HTTPTypes.HTTPFields = .init() + let value = wrapped.payload + let body = try converter.setRequiredRequestBodyAsBinary( + value.body, + headerFields: &headerFields, + contentType: "text/plain" + ) + return .init( + name: "angle", + filename: wrapped.filename, + headerFields: headerFields, + body: body + ) + case let .normalize(wrapped): + var headerFields: HTTPTypes.HTTPFields = .init() + let value = wrapped.payload + let body = try converter.setRequiredRequestBodyAsBinary( + value.body, + headerFields: &headerFields, + contentType: "text/plain" + ) + return .init( + name: "normalize", + filename: wrapped.filename, + headerFields: headerFields, + body: body + ) + case let .white_magic(wrapped): + var headerFields: HTTPTypes.HTTPFields = .init() + let value = wrapped.payload + let body = try converter.setRequiredRequestBodyAsBinary( + value.body, + headerFields: &headerFields, + contentType: "text/plain" + ) + return .init( + name: "white_magic", + filename: wrapped.filename, + headerFields: headerFields, + body: body + ) + case let .undocumented(value): + return value + } + } + ) + } + return (request, body) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 200: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.post_hyphen_cgi_hyphen_product_image_crop_period_pl.Output.Ok.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + OpenAPIRuntime.OpenAPIObjectContainer.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .ok(.init(body: body)) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + /// Unselect A Photo + /// + /// - Remark: HTTP `POST /cgi/product_image_unselect.pl`. + /// - Remark: Generated from `#/paths//cgi/product_image_unselect.pl/post`. + public func post_sol_cgi_sol_product_image_unselect_period_pl(_ input: Operations.post_sol_cgi_sol_product_image_unselect_period_pl.Input) async throws -> Operations.post_sol_cgi_sol_product_image_unselect_period_pl.Output { + try await client.send( + input: input, + forOperation: Operations.post_sol_cgi_sol_product_image_unselect_period_pl.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/cgi/product_image_unselect.pl", + parameters: [] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .post + ) + suppressMutabilityWarning(&request) + converter.setAcceptHeader( + in: &request.headerFields, + contentTypes: input.headers.accept + ) + let body: OpenAPIRuntime.HTTPBody? + switch input.body { + case let .multipartForm(value): + body = try converter.setRequiredRequestBodyAsMultipart( + value, + headerFields: &request.headerFields, + contentType: "multipart/form-data", + allowsUnknownParts: true, + requiredExactlyOncePartNames: [], + requiredAtLeastOncePartNames: [], + atMostOncePartNames: [ + "code", + "id" + ], + zeroOrMoreTimesPartNames: [], + encoding: { part in + switch part { + case let .code(wrapped): + var headerFields: HTTPTypes.HTTPFields = .init() + let value = wrapped.payload + let body = try converter.setRequiredRequestBodyAsBinary( + value.body, + headerFields: &headerFields, + contentType: "text/plain" + ) + return .init( + name: "code", + filename: wrapped.filename, + headerFields: headerFields, + body: body + ) + case let .id(wrapped): + var headerFields: HTTPTypes.HTTPFields = .init() + let value = wrapped.payload + let body = try converter.setRequiredRequestBodyAsBinary( + value.body, + headerFields: &headerFields, + contentType: "text/plain" + ) + return .init( + name: "id", + filename: wrapped.filename, + headerFields: headerFields, + body: body + ) + case let .undocumented(value): + return value + } + } + ) + } + return (request, body) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 200: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.post_sol_cgi_sol_product_image_unselect_period_pl.Output.Ok.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Operations.post_sol_cgi_sol_product_image_unselect_period_pl.Output.Ok.Body.jsonPayload.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .ok(.init(body: body)) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + /// Add or Edit A Product + /// + /// This updates a product. + /// + /// Note: If the barcode exists then you will be editing the existing product, + /// However if it doesn''t you will be creating a new product with that unique barcode, + /// and adding properties to the product. + /// + /// + /// - Remark: HTTP `POST /cgi/product_jqm2.pl`. + /// - Remark: Generated from `#/paths//cgi/product_jqm2.pl/post(post-cgi-product_jqm2.pl)`. + public func post_hyphen_cgi_hyphen_product_jqm2_period_pl(_ input: Operations.post_hyphen_cgi_hyphen_product_jqm2_period_pl.Input) async throws -> Operations.post_hyphen_cgi_hyphen_product_jqm2_period_pl.Output { + try await client.send( + input: input, + forOperation: Operations.post_hyphen_cgi_hyphen_product_jqm2_period_pl.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/cgi/product_jqm2.pl", + parameters: [] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .post + ) + suppressMutabilityWarning(&request) + converter.setAcceptHeader( + in: &request.headerFields, + contentTypes: input.headers.accept + ) + let body: OpenAPIRuntime.HTTPBody? + switch input.body { + case let .multipartForm(value): + body = try converter.setRequiredRequestBodyAsMultipart( + value, + headerFields: &request.headerFields, + contentType: "multipart/form-data", + allowsUnknownParts: true, + requiredExactlyOncePartNames: [ + "code", + "imagefield", + "password", + "user_id" + ], + requiredAtLeastOncePartNames: [], + atMostOncePartNames: [ + "app_name", + "app_uuid", + "app_version", + "comment", + "packaging", + "user_agent" + ], + zeroOrMoreTimesPartNames: [ + "brands", + "categories", + "labels" + ], + encoding: { part in + switch part { + case let .code(wrapped): + var headerFields: HTTPTypes.HTTPFields = .init() + let value = wrapped.payload + let body = try converter.setRequiredRequestBodyAsBinary( + value.body, + headerFields: &headerFields, + contentType: "text/plain" + ) + return .init( + name: "code", + filename: wrapped.filename, + headerFields: headerFields, + body: body + ) + case let .user_id(wrapped): + var headerFields: HTTPTypes.HTTPFields = .init() + let value = wrapped.payload + let body = try converter.setRequiredRequestBodyAsBinary( + value.body, + headerFields: &headerFields, + contentType: "text/plain" + ) + return .init( + name: "user_id", + filename: wrapped.filename, + headerFields: headerFields, + body: body + ) + case let .password(wrapped): + var headerFields: HTTPTypes.HTTPFields = .init() + let value = wrapped.payload + let body = try converter.setRequiredRequestBodyAsBinary( + value.body, + headerFields: &headerFields, + contentType: "text/plain" + ) + return .init( + name: "password", + filename: wrapped.filename, + headerFields: headerFields, + body: body + ) + case let .comment(wrapped): + var headerFields: HTTPTypes.HTTPFields = .init() + let value = wrapped.payload + let body = try converter.setRequiredRequestBodyAsBinary( + value.body, + headerFields: &headerFields, + contentType: "text/plain" + ) + return .init( + name: "comment", + filename: wrapped.filename, + headerFields: headerFields, + body: body + ) + case let .brands(wrapped): + var headerFields: HTTPTypes.HTTPFields = .init() + let value = wrapped.payload + let body = try converter.setRequiredRequestBodyAsBinary( + value.body, + headerFields: &headerFields, + contentType: "text/plain" + ) + return .init( + name: "brands", + filename: wrapped.filename, + headerFields: headerFields, + body: body + ) + case let .labels(wrapped): + var headerFields: HTTPTypes.HTTPFields = .init() + let value = wrapped.payload + let body = try converter.setRequiredRequestBodyAsBinary( + value.body, + headerFields: &headerFields, + contentType: "text/plain" + ) + return .init( + name: "labels", + filename: wrapped.filename, + headerFields: headerFields, + body: body + ) + case let .categories(wrapped): + var headerFields: HTTPTypes.HTTPFields = .init() + let value = wrapped.payload + let body = try converter.setRequiredRequestBodyAsBinary( + value.body, + headerFields: &headerFields, + contentType: "text/plain" + ) + return .init( + name: "categories", + filename: wrapped.filename, + headerFields: headerFields, + body: body + ) + case let .packaging(wrapped): + var headerFields: HTTPTypes.HTTPFields = .init() + let value = wrapped.payload + let body = try converter.setRequiredRequestBodyAsBinary( + value.body, + headerFields: &headerFields, + contentType: "text/plain" + ) + return .init( + name: "packaging", + filename: wrapped.filename, + headerFields: headerFields, + body: body + ) + case let .app_name(wrapped): + var headerFields: HTTPTypes.HTTPFields = .init() + let value = wrapped.payload + let body = try converter.setRequiredRequestBodyAsBinary( + value.body, + headerFields: &headerFields, + contentType: "text/plain" + ) + return .init( + name: "app_name", + filename: wrapped.filename, + headerFields: headerFields, + body: body + ) + case let .app_version(wrapped): + var headerFields: HTTPTypes.HTTPFields = .init() + let value = wrapped.payload + let body = try converter.setRequiredRequestBodyAsBinary( + value.body, + headerFields: &headerFields, + contentType: "text/plain" + ) + return .init( + name: "app_version", + filename: wrapped.filename, + headerFields: headerFields, + body: body + ) + case let .app_uuid(wrapped): + var headerFields: HTTPTypes.HTTPFields = .init() + let value = wrapped.payload + let body = try converter.setRequiredRequestBodyAsBinary( + value.body, + headerFields: &headerFields, + contentType: "text/plain" + ) + return .init( + name: "app_uuid", + filename: wrapped.filename, + headerFields: headerFields, + body: body + ) + case let .user_agent(wrapped): + var headerFields: HTTPTypes.HTTPFields = .init() + let value = wrapped.payload + let body = try converter.setRequiredRequestBodyAsBinary( + value.body, + headerFields: &headerFields, + contentType: "text/plain" + ) + return .init( + name: "user_agent", + filename: wrapped.filename, + headerFields: headerFields, + body: body + ) + case let .imagefield(wrapped): + var headerFields: HTTPTypes.HTTPFields = .init() + let value = wrapped.payload + let body = try converter.setRequiredRequestBodyAsJSON( + value.body, + headerFields: &headerFields, + contentType: "application/json; charset=utf-8" + ) + return .init( + name: "imagefield", + filename: wrapped.filename, + headerFields: headerFields, + body: body + ) + case let .undocumented(value): + return value + } + } + ) + } + return (request, body) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 200: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.post_hyphen_cgi_hyphen_product_jqm2_period_pl.Output.Ok.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.add_or_edit_a_product.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .ok(.init(body: body)) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + /// Search for Products + /// + /// Search request allows you to get products that match your search criteria. + /// + /// It allows you create many custom APIs for your use case. + /// + /// If the search query parameter has 2 possible values, they are seperated by a comma(,). + /// When filtering via a parameter that has different language codes like `fr`, `de` or `en`, specify the language code in the parameter name e.g `categories_tags_en` + /// + /// **Important:** search API v2 does not support full text request (search_term), + /// you have to use [search API v1](https://wiki.openfoodfacts.org/API/Read/Search) for that. + /// Upcoming [search-a-licious project](https://github.com/openfoodfacts/search-a-licious) will fix that. + /// + /// ### Limiting results + /// + /// You can limit the size of returned objects thanks to the `fields` object (see below). + /// + /// eg: `fields=code,product_name,brands,attribute_groups`` + /// + /// Please use it as much as possible to avoid overloading the servers. + /// + /// The search use pagination, see `page` and `page_size` parameters. + /// + /// **Beware:** the `page_count` data in item is a bit counter intuitive…, read the description. + /// + /// ### Conditions on tags + /// + /// All `_tags`` parameters accepts either: + /// + /// * a single value + /// * or a comma-separated list of values (doing a AND) + /// * or a pipe separated list of values (doing a OR) + /// + /// You can exclude terms by using a "-" prefix. + /// + /// For taxonomized entries, you might either use the tag id (recommended), + /// or a known synonym (without language prefix) + /// + /// * `labels_tags=en:organic,en:fair-trade` find items that are fair-trade AND organic + /// * `labels_tags=en:organic|en:fair-trade` find items that are fair-trade OR organic + /// * `labels_tags=en:organic,en:-fair-trade` find items that are organic BUT NOT fair-trade + /// + /// + /// ### Conditions on nutriments + /// + /// To get a list of nutrients + /// + /// You can either query on nutrient per 100g (`_100g` suffix) + /// or per serving (`serving` suffix). + /// + /// You can also add `_prepared_` + /// to get the nutrients in the prepared product instead of as sold. + /// + /// You can add a comparison operator and value to the parameter name + /// to get products with nutrient above or bellow a value. + /// If you use a parameter value it exactly match it. + /// + /// * `energy-kj_100g<200` products where energy in kj for 100g is less than 200kj + /// * `sugars_serving>10` products where sugar per serving is greater than 10g + /// * `saturated-fat_100g=1` products where saturated fat per 100g is exactly 10g + /// * `salt_prepared_serving<0.1` products where salt per serving for prepared product is less than 0.1g + /// + /// ### More references + /// + /// See also [wiki page](https://wiki.openfoodfacts.org/Open_Food_Facts_Search_API_Version_2) + /// + /// + /// - Remark: HTTP `GET /api/v2/search`. + /// - Remark: Generated from `#/paths//api/v2/search/get(get-search)`. + public func get_hyphen_search(_ input: Operations.get_hyphen_search.Input) async throws -> Operations.get_hyphen_search.Output { + try await client.send( + input: input, + forOperation: Operations.get_hyphen_search.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/api/v2/search", + parameters: [] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .get + ) + suppressMutabilityWarning(&request) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: false, + name: "additives_tags", + value: input.query.additives_tags + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: false, + name: "allergens_tags", + value: input.query.allergens_tags + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: false, + name: "brands_tags", + value: input.query.brands_tags + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: false, + name: "categories_tags", + value: input.query.categories_tags + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: false, + name: "countries_tags_en", + value: input.query.countries_tags_en + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: false, + name: "emb_codes_tags", + value: input.query.emb_codes_tags + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: false, + name: "labels_tags", + value: input.query.labels_tags + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: false, + name: "manufacturing_places_tags", + value: input.query.manufacturing_places_tags + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: false, + name: "nutrition_grades_tags", + value: input.query.nutrition_grades_tags + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: false, + name: "origins_tags", + value: input.query.origins_tags + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: false, + name: "packaging_tags_de", + value: input.query.packaging_tags_de + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: false, + name: "purchase_places_tags", + value: input.query.purchase_places_tags + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: false, + name: "states_tags", + value: input.query.states_tags + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: false, + name: "stores_tags", + value: input.query.stores_tags + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: false, + name: "traces_tags", + value: input.query.traces_tags + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: false, + name: "_tags_", + value: input.query._lt_tag_name_gt__tags__lt_language_code_gt_ + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "_lt_", + value: input.query._lt_nutrient_gt__lt__lt_value_gt_ + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "_gt_", + value: input.query._lt_nutrient_gt__gt__lt_value_gt_ + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "_eq_", + value: input.query._lt_nutrient_gt__eq__lt_value_gt_ + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "fields", + value: input.query.fields + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "sort_by", + value: input.query.sort_by + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "page", + value: input.query.page + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "page_size", + value: input.query.page_size + ) + converter.setAcceptHeader( + in: &request.headerFields, + contentTypes: input.headers.accept + ) + return (request, nil) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 200: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.get_hyphen_search.Output.Ok.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.search_for_products.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .ok(.init(body: body)) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + /// Get Suggestions to Aid Adding/Editing Products + /// + /// For example , Dave is looking for packaging_shapes that contain the term "fe", + /// all packaging_shapes containing "fe" will be returned. + /// This is useful if you have a search in your application, + /// for a specific product field. + /// + /// + /// - Remark: HTTP `GET /cgi/suggest.pl`. + /// - Remark: Generated from `#/paths//cgi/suggest.pl/get(get-cgi-suggest.pl)`. + public func get_hyphen_cgi_hyphen_suggest_period_pl(_ input: Operations.get_hyphen_cgi_hyphen_suggest_period_pl.Input) async throws -> Operations.get_hyphen_cgi_hyphen_suggest_period_pl.Output { + try await client.send( + input: input, + forOperation: Operations.get_hyphen_cgi_hyphen_suggest_period_pl.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/cgi/suggest.pl", + parameters: [] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .get + ) + suppressMutabilityWarning(&request) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "tagtype", + value: input.query.tagtype + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "term", + value: input.query.term + ) + converter.setAcceptHeader( + in: &request.headerFields, + contentTypes: input.headers.accept + ) + return (request, nil) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 200: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.get_hyphen_cgi_hyphen_suggest_period_pl.Output.Ok.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + OpenAPIRuntime.OpenAPIArrayContainer.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .ok(.init(body: body)) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + /// Get a nested list of nutrients that can be displayed in the nutrition facts table for a specific country and language + /// + /// Used to display the nutrition facts table of a product, or to display a form to input those nutrition facts. + /// + /// + /// - Remark: HTTP `GET /cgi/nutrients.pl`. + /// - Remark: Generated from `#/paths//cgi/nutrients.pl/get(get-cgi-nutrients.pl)`. + public func get_hyphen_cgi_hyphen_nutrients_period_pl(_ input: Operations.get_hyphen_cgi_hyphen_nutrients_period_pl.Input) async throws -> Operations.get_hyphen_cgi_hyphen_nutrients_period_pl.Output { + try await client.send( + input: input, + forOperation: Operations.get_hyphen_cgi_hyphen_nutrients_period_pl.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/cgi/nutrients.pl", + parameters: [] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .get + ) + suppressMutabilityWarning(&request) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "cc", + value: input.query.cc + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "lc", + value: input.query.lc + ) + converter.setAcceptHeader( + in: &request.headerFields, + contentTypes: input.headers.accept + ) + return (request, nil) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 200: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.get_hyphen_cgi_hyphen_nutrients_period_pl.Output.Ok.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.get_nutrients.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .ok(.init(body: body)) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + /// Get the list of attributes available for personal search. + /// + /// Attributes are at the heart of personal search. + /// They score the products according to different criterias, + /// which could then be matched to a user's preferences. + /// + /// This API helps you list attributes and display them in your application, + /// for the user to choose the importance of each criteria. + /// + /// note: /api/v2/attribute_groups_{lc} is also a valid route, but consider it deprecated + /// + /// + /// - Remark: HTTP `GET /api/v2/attribute_groups`. + /// - Remark: Generated from `#/paths//api/v2/attribute_groups/get(get-attribute-groups)`. + public func get_hyphen_attribute_hyphen_groups(_ input: Operations.get_hyphen_attribute_hyphen_groups.Input) async throws -> Operations.get_hyphen_attribute_hyphen_groups.Output { + try await client.send( + input: input, + forOperation: Operations.get_hyphen_attribute_hyphen_groups.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/api/v2/attribute_groups", + parameters: [] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .get + ) + suppressMutabilityWarning(&request) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "lc", + value: input.query.lc + ) + converter.setAcceptHeader( + in: &request.headerFields, + contentTypes: input.headers.accept + ) + return (request, nil) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 200: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.get_hyphen_attribute_hyphen_groups.Output.Ok.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.get_attribute_groups.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .ok(.init(body: body)) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + /// Get the weights corresponding to attributes preferences + /// to compute personal product + /// + /// + /// - Remark: HTTP `GET /api/v2/preferences`. + /// - Remark: Generated from `#/paths//api/v2/preferences/get(get-preferences)`. + public func get_hyphen_preferences(_ input: Operations.get_hyphen_preferences.Input) async throws -> Operations.get_hyphen_preferences.Output { + try await client.send( + input: input, + forOperation: Operations.get_hyphen_preferences.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/api/v2/preferences", + parameters: [] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .get + ) + suppressMutabilityWarning(&request) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "lc", + value: input.query.lc + ) + converter.setAcceptHeader( + in: &request.headerFields, + contentTypes: input.headers.accept + ) + return (request, nil) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 200: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.get_hyphen_preferences.Output.Ok.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.get_preferences.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .ok(.init(body: body)) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } +} diff --git a/OpenFoodFactsService/Sources/Types.swift b/OpenFoodFactsService/Sources/Types.swift new file mode 100644 index 0000000..3d08c51 --- /dev/null +++ b/OpenFoodFactsService/Sources/Types.swift @@ -0,0 +1,8662 @@ +// Generated by swift-openapi-generator, do not modify. +@_spi(Generated) import OpenAPIRuntime +#if os(Linux) +@preconcurrency import struct Foundation.URL +@preconcurrency import struct Foundation.Data +@preconcurrency import struct Foundation.Date +#else +import struct Foundation.URL +import struct Foundation.Data +import struct Foundation.Date +#endif +/// A type that performs HTTP operations defined by the OpenAPI document. +public protocol APIProtocol: Sendable { + /// Get information for a specific product by barcode + /// + /// A product can be fetched via its unique barcode. + /// It returns all the details of that product response. + /// + /// + /// - Remark: HTTP `GET /api/v2/product/{barcode}`. + /// - Remark: Generated from `#/paths//api/v2/product/{barcode}/get(get-product-by-barcode)`. + func get_hyphen_product_hyphen_by_hyphen_barcode(_ input: Operations.get_hyphen_product_hyphen_by_hyphen_barcode.Input) async throws -> Operations.get_hyphen_product_hyphen_by_hyphen_barcode.Output + /// Get Knowledge panels for a specific product by barcode + /// (special case of get product) + /// + /// + /// Knowledge panels gives high leve informations about a product, + /// ready to display. + /// This is used by open food facts website, + /// and by the official mobile application + /// + /// + /// - Remark: HTTP `GET /api/v2/product/{barcode}?fields=knowledge_panels`. + /// - Remark: Generated from `#/paths//api/v2/product/{barcode}?fields=knowledge_panels/get(get-product-by-barcode-knowledge-panels)`. + func get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels(_ input: Operations.get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels.Input) async throws -> Operations.get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels.Output + /// Performing OCR on a Product + /// + /// Open Food Facts uses optical character recognition (OCR) to retrieve nutritional data and other information from the product labels. + /// + /// + /// - Remark: HTTP `GET /cgi/ingredients.pl`. + /// - Remark: Generated from `#/paths//cgi/ingredients.pl/get(get-cgi-ingredients.pl)`. + func get_hyphen_cgi_hyphen_ingredients_period_pl(_ input: Operations.get_hyphen_cgi_hyphen_ingredients_period_pl.Input) async throws -> Operations.get_hyphen_cgi_hyphen_ingredients_period_pl.Output + /// Rotate A Photo + /// + /// Although we recommend rotating photos manually and uploading a new version of the image, + /// the OFF API allows you to make api calls to automate this process. + /// You can rotate existing photos by setting the angle to 90º, 180º, or 270º clockwise. + /// + /// + /// - Remark: HTTP `GET /cgi/product_image_crop.pl`. + /// - Remark: Generated from `#/paths//cgi/product_image_crop.pl/get(get-cgi-product_image_crop.pl)`. + func get_hyphen_cgi_hyphen_product_image_crop_period_pl(_ input: Operations.get_hyphen_cgi_hyphen_product_image_crop_period_pl.Input) async throws -> Operations.get_hyphen_cgi_hyphen_product_image_crop_period_pl.Output + /// Crop A Photo + /// + /// Cropping is only relevant for editing existing products. + /// You cannot crop an image the first time you upload it to the system. + /// + /// + /// - Remark: HTTP `POST /cgi/product_image_crop.pl`. + /// - Remark: Generated from `#/paths//cgi/product_image_crop.pl/post(post-cgi-product_image_crop.pl)`. + func post_hyphen_cgi_hyphen_product_image_crop_period_pl(_ input: Operations.post_hyphen_cgi_hyphen_product_image_crop_period_pl.Input) async throws -> Operations.post_hyphen_cgi_hyphen_product_image_crop_period_pl.Output + /// Unselect A Photo + /// + /// - Remark: HTTP `POST /cgi/product_image_unselect.pl`. + /// - Remark: Generated from `#/paths//cgi/product_image_unselect.pl/post`. + func post_sol_cgi_sol_product_image_unselect_period_pl(_ input: Operations.post_sol_cgi_sol_product_image_unselect_period_pl.Input) async throws -> Operations.post_sol_cgi_sol_product_image_unselect_period_pl.Output + /// Add or Edit A Product + /// + /// This updates a product. + /// + /// Note: If the barcode exists then you will be editing the existing product, + /// However if it doesn''t you will be creating a new product with that unique barcode, + /// and adding properties to the product. + /// + /// + /// - Remark: HTTP `POST /cgi/product_jqm2.pl`. + /// - Remark: Generated from `#/paths//cgi/product_jqm2.pl/post(post-cgi-product_jqm2.pl)`. + func post_hyphen_cgi_hyphen_product_jqm2_period_pl(_ input: Operations.post_hyphen_cgi_hyphen_product_jqm2_period_pl.Input) async throws -> Operations.post_hyphen_cgi_hyphen_product_jqm2_period_pl.Output + /// Search for Products + /// + /// Search request allows you to get products that match your search criteria. + /// + /// It allows you create many custom APIs for your use case. + /// + /// If the search query parameter has 2 possible values, they are seperated by a comma(,). + /// When filtering via a parameter that has different language codes like `fr`, `de` or `en`, specify the language code in the parameter name e.g `categories_tags_en` + /// + /// **Important:** search API v2 does not support full text request (search_term), + /// you have to use [search API v1](https://wiki.openfoodfacts.org/API/Read/Search) for that. + /// Upcoming [search-a-licious project](https://github.com/openfoodfacts/search-a-licious) will fix that. + /// + /// ### Limiting results + /// + /// You can limit the size of returned objects thanks to the `fields` object (see below). + /// + /// eg: `fields=code,product_name,brands,attribute_groups`` + /// + /// Please use it as much as possible to avoid overloading the servers. + /// + /// The search use pagination, see `page` and `page_size` parameters. + /// + /// **Beware:** the `page_count` data in item is a bit counter intuitive…, read the description. + /// + /// ### Conditions on tags + /// + /// All `_tags`` parameters accepts either: + /// + /// * a single value + /// * or a comma-separated list of values (doing a AND) + /// * or a pipe separated list of values (doing a OR) + /// + /// You can exclude terms by using a "-" prefix. + /// + /// For taxonomized entries, you might either use the tag id (recommended), + /// or a known synonym (without language prefix) + /// + /// * `labels_tags=en:organic,en:fair-trade` find items that are fair-trade AND organic + /// * `labels_tags=en:organic|en:fair-trade` find items that are fair-trade OR organic + /// * `labels_tags=en:organic,en:-fair-trade` find items that are organic BUT NOT fair-trade + /// + /// + /// ### Conditions on nutriments + /// + /// To get a list of nutrients + /// + /// You can either query on nutrient per 100g (`_100g` suffix) + /// or per serving (`serving` suffix). + /// + /// You can also add `_prepared_` + /// to get the nutrients in the prepared product instead of as sold. + /// + /// You can add a comparison operator and value to the parameter name + /// to get products with nutrient above or bellow a value. + /// If you use a parameter value it exactly match it. + /// + /// * `energy-kj_100g<200` products where energy in kj for 100g is less than 200kj + /// * `sugars_serving>10` products where sugar per serving is greater than 10g + /// * `saturated-fat_100g=1` products where saturated fat per 100g is exactly 10g + /// * `salt_prepared_serving<0.1` products where salt per serving for prepared product is less than 0.1g + /// + /// ### More references + /// + /// See also [wiki page](https://wiki.openfoodfacts.org/Open_Food_Facts_Search_API_Version_2) + /// + /// + /// - Remark: HTTP `GET /api/v2/search`. + /// - Remark: Generated from `#/paths//api/v2/search/get(get-search)`. + func get_hyphen_search(_ input: Operations.get_hyphen_search.Input) async throws -> Operations.get_hyphen_search.Output + /// Get Suggestions to Aid Adding/Editing Products + /// + /// For example , Dave is looking for packaging_shapes that contain the term "fe", + /// all packaging_shapes containing "fe" will be returned. + /// This is useful if you have a search in your application, + /// for a specific product field. + /// + /// + /// - Remark: HTTP `GET /cgi/suggest.pl`. + /// - Remark: Generated from `#/paths//cgi/suggest.pl/get(get-cgi-suggest.pl)`. + func get_hyphen_cgi_hyphen_suggest_period_pl(_ input: Operations.get_hyphen_cgi_hyphen_suggest_period_pl.Input) async throws -> Operations.get_hyphen_cgi_hyphen_suggest_period_pl.Output + /// Get a nested list of nutrients that can be displayed in the nutrition facts table for a specific country and language + /// + /// Used to display the nutrition facts table of a product, or to display a form to input those nutrition facts. + /// + /// + /// - Remark: HTTP `GET /cgi/nutrients.pl`. + /// - Remark: Generated from `#/paths//cgi/nutrients.pl/get(get-cgi-nutrients.pl)`. + func get_hyphen_cgi_hyphen_nutrients_period_pl(_ input: Operations.get_hyphen_cgi_hyphen_nutrients_period_pl.Input) async throws -> Operations.get_hyphen_cgi_hyphen_nutrients_period_pl.Output + /// Get the list of attributes available for personal search. + /// + /// Attributes are at the heart of personal search. + /// They score the products according to different criterias, + /// which could then be matched to a user's preferences. + /// + /// This API helps you list attributes and display them in your application, + /// for the user to choose the importance of each criteria. + /// + /// note: /api/v2/attribute_groups_{lc} is also a valid route, but consider it deprecated + /// + /// + /// - Remark: HTTP `GET /api/v2/attribute_groups`. + /// - Remark: Generated from `#/paths//api/v2/attribute_groups/get(get-attribute-groups)`. + func get_hyphen_attribute_hyphen_groups(_ input: Operations.get_hyphen_attribute_hyphen_groups.Input) async throws -> Operations.get_hyphen_attribute_hyphen_groups.Output + /// Get the weights corresponding to attributes preferences + /// to compute personal product + /// + /// + /// - Remark: HTTP `GET /api/v2/preferences`. + /// - Remark: Generated from `#/paths//api/v2/preferences/get(get-preferences)`. + func get_hyphen_preferences(_ input: Operations.get_hyphen_preferences.Input) async throws -> Operations.get_hyphen_preferences.Output +} + +/// Convenience overloads for operation inputs. +extension APIProtocol { + /// Get information for a specific product by barcode + /// + /// A product can be fetched via its unique barcode. + /// It returns all the details of that product response. + /// + /// + /// - Remark: HTTP `GET /api/v2/product/{barcode}`. + /// - Remark: Generated from `#/paths//api/v2/product/{barcode}/get(get-product-by-barcode)`. + public func get_hyphen_product_hyphen_by_hyphen_barcode( + path: Operations.get_hyphen_product_hyphen_by_hyphen_barcode.Input.Path, + headers: Operations.get_hyphen_product_hyphen_by_hyphen_barcode.Input.Headers = .init() + ) async throws -> Operations.get_hyphen_product_hyphen_by_hyphen_barcode.Output { + try await get_hyphen_product_hyphen_by_hyphen_barcode(Operations.get_hyphen_product_hyphen_by_hyphen_barcode.Input( + path: path, + headers: headers + )) + } + /// Get Knowledge panels for a specific product by barcode + /// (special case of get product) + /// + /// + /// Knowledge panels gives high leve informations about a product, + /// ready to display. + /// This is used by open food facts website, + /// and by the official mobile application + /// + /// + /// - Remark: HTTP `GET /api/v2/product/{barcode}?fields=knowledge_panels`. + /// - Remark: Generated from `#/paths//api/v2/product/{barcode}?fields=knowledge_panels/get(get-product-by-barcode-knowledge-panels)`. + public func get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels( + path: Operations.get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels.Input.Path, + headers: Operations.get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels.Input.Headers = .init() + ) async throws -> Operations.get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels.Output { + try await get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels(Operations.get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels.Input( + path: path, + headers: headers + )) + } + /// Performing OCR on a Product + /// + /// Open Food Facts uses optical character recognition (OCR) to retrieve nutritional data and other information from the product labels. + /// + /// + /// - Remark: HTTP `GET /cgi/ingredients.pl`. + /// - Remark: Generated from `#/paths//cgi/ingredients.pl/get(get-cgi-ingredients.pl)`. + public func get_hyphen_cgi_hyphen_ingredients_period_pl( + query: Operations.get_hyphen_cgi_hyphen_ingredients_period_pl.Input.Query, + headers: Operations.get_hyphen_cgi_hyphen_ingredients_period_pl.Input.Headers = .init() + ) async throws -> Operations.get_hyphen_cgi_hyphen_ingredients_period_pl.Output { + try await get_hyphen_cgi_hyphen_ingredients_period_pl(Operations.get_hyphen_cgi_hyphen_ingredients_period_pl.Input( + query: query, + headers: headers + )) + } + /// Rotate A Photo + /// + /// Although we recommend rotating photos manually and uploading a new version of the image, + /// the OFF API allows you to make api calls to automate this process. + /// You can rotate existing photos by setting the angle to 90º, 180º, or 270º clockwise. + /// + /// + /// - Remark: HTTP `GET /cgi/product_image_crop.pl`. + /// - Remark: Generated from `#/paths//cgi/product_image_crop.pl/get(get-cgi-product_image_crop.pl)`. + public func get_hyphen_cgi_hyphen_product_image_crop_period_pl( + query: Operations.get_hyphen_cgi_hyphen_product_image_crop_period_pl.Input.Query, + headers: Operations.get_hyphen_cgi_hyphen_product_image_crop_period_pl.Input.Headers = .init() + ) async throws -> Operations.get_hyphen_cgi_hyphen_product_image_crop_period_pl.Output { + try await get_hyphen_cgi_hyphen_product_image_crop_period_pl(Operations.get_hyphen_cgi_hyphen_product_image_crop_period_pl.Input( + query: query, + headers: headers + )) + } + /// Crop A Photo + /// + /// Cropping is only relevant for editing existing products. + /// You cannot crop an image the first time you upload it to the system. + /// + /// + /// - Remark: HTTP `POST /cgi/product_image_crop.pl`. + /// - Remark: Generated from `#/paths//cgi/product_image_crop.pl/post(post-cgi-product_image_crop.pl)`. + public func post_hyphen_cgi_hyphen_product_image_crop_period_pl( + headers: Operations.post_hyphen_cgi_hyphen_product_image_crop_period_pl.Input.Headers = .init(), + body: Operations.post_hyphen_cgi_hyphen_product_image_crop_period_pl.Input.Body + ) async throws -> Operations.post_hyphen_cgi_hyphen_product_image_crop_period_pl.Output { + try await post_hyphen_cgi_hyphen_product_image_crop_period_pl(Operations.post_hyphen_cgi_hyphen_product_image_crop_period_pl.Input( + headers: headers, + body: body + )) + } + /// Unselect A Photo + /// + /// - Remark: HTTP `POST /cgi/product_image_unselect.pl`. + /// - Remark: Generated from `#/paths//cgi/product_image_unselect.pl/post`. + public func post_sol_cgi_sol_product_image_unselect_period_pl( + headers: Operations.post_sol_cgi_sol_product_image_unselect_period_pl.Input.Headers = .init(), + body: Operations.post_sol_cgi_sol_product_image_unselect_period_pl.Input.Body + ) async throws -> Operations.post_sol_cgi_sol_product_image_unselect_period_pl.Output { + try await post_sol_cgi_sol_product_image_unselect_period_pl(Operations.post_sol_cgi_sol_product_image_unselect_period_pl.Input( + headers: headers, + body: body + )) + } + /// Add or Edit A Product + /// + /// This updates a product. + /// + /// Note: If the barcode exists then you will be editing the existing product, + /// However if it doesn''t you will be creating a new product with that unique barcode, + /// and adding properties to the product. + /// + /// + /// - Remark: HTTP `POST /cgi/product_jqm2.pl`. + /// - Remark: Generated from `#/paths//cgi/product_jqm2.pl/post(post-cgi-product_jqm2.pl)`. + public func post_hyphen_cgi_hyphen_product_jqm2_period_pl( + headers: Operations.post_hyphen_cgi_hyphen_product_jqm2_period_pl.Input.Headers = .init(), + body: Operations.post_hyphen_cgi_hyphen_product_jqm2_period_pl.Input.Body + ) async throws -> Operations.post_hyphen_cgi_hyphen_product_jqm2_period_pl.Output { + try await post_hyphen_cgi_hyphen_product_jqm2_period_pl(Operations.post_hyphen_cgi_hyphen_product_jqm2_period_pl.Input( + headers: headers, + body: body + )) + } + /// Search for Products + /// + /// Search request allows you to get products that match your search criteria. + /// + /// It allows you create many custom APIs for your use case. + /// + /// If the search query parameter has 2 possible values, they are seperated by a comma(,). + /// When filtering via a parameter that has different language codes like `fr`, `de` or `en`, specify the language code in the parameter name e.g `categories_tags_en` + /// + /// **Important:** search API v2 does not support full text request (search_term), + /// you have to use [search API v1](https://wiki.openfoodfacts.org/API/Read/Search) for that. + /// Upcoming [search-a-licious project](https://github.com/openfoodfacts/search-a-licious) will fix that. + /// + /// ### Limiting results + /// + /// You can limit the size of returned objects thanks to the `fields` object (see below). + /// + /// eg: `fields=code,product_name,brands,attribute_groups`` + /// + /// Please use it as much as possible to avoid overloading the servers. + /// + /// The search use pagination, see `page` and `page_size` parameters. + /// + /// **Beware:** the `page_count` data in item is a bit counter intuitive…, read the description. + /// + /// ### Conditions on tags + /// + /// All `_tags`` parameters accepts either: + /// + /// * a single value + /// * or a comma-separated list of values (doing a AND) + /// * or a pipe separated list of values (doing a OR) + /// + /// You can exclude terms by using a "-" prefix. + /// + /// For taxonomized entries, you might either use the tag id (recommended), + /// or a known synonym (without language prefix) + /// + /// * `labels_tags=en:organic,en:fair-trade` find items that are fair-trade AND organic + /// * `labels_tags=en:organic|en:fair-trade` find items that are fair-trade OR organic + /// * `labels_tags=en:organic,en:-fair-trade` find items that are organic BUT NOT fair-trade + /// + /// + /// ### Conditions on nutriments + /// + /// To get a list of nutrients + /// + /// You can either query on nutrient per 100g (`_100g` suffix) + /// or per serving (`serving` suffix). + /// + /// You can also add `_prepared_` + /// to get the nutrients in the prepared product instead of as sold. + /// + /// You can add a comparison operator and value to the parameter name + /// to get products with nutrient above or bellow a value. + /// If you use a parameter value it exactly match it. + /// + /// * `energy-kj_100g<200` products where energy in kj for 100g is less than 200kj + /// * `sugars_serving>10` products where sugar per serving is greater than 10g + /// * `saturated-fat_100g=1` products where saturated fat per 100g is exactly 10g + /// * `salt_prepared_serving<0.1` products where salt per serving for prepared product is less than 0.1g + /// + /// ### More references + /// + /// See also [wiki page](https://wiki.openfoodfacts.org/Open_Food_Facts_Search_API_Version_2) + /// + /// + /// - Remark: HTTP `GET /api/v2/search`. + /// - Remark: Generated from `#/paths//api/v2/search/get(get-search)`. + public func get_hyphen_search( + query: Operations.get_hyphen_search.Input.Query = .init(), + headers: Operations.get_hyphen_search.Input.Headers = .init() + ) async throws -> Operations.get_hyphen_search.Output { + try await get_hyphen_search(Operations.get_hyphen_search.Input( + query: query, + headers: headers + )) + } + /// Get Suggestions to Aid Adding/Editing Products + /// + /// For example , Dave is looking for packaging_shapes that contain the term "fe", + /// all packaging_shapes containing "fe" will be returned. + /// This is useful if you have a search in your application, + /// for a specific product field. + /// + /// + /// - Remark: HTTP `GET /cgi/suggest.pl`. + /// - Remark: Generated from `#/paths//cgi/suggest.pl/get(get-cgi-suggest.pl)`. + public func get_hyphen_cgi_hyphen_suggest_period_pl( + query: Operations.get_hyphen_cgi_hyphen_suggest_period_pl.Input.Query = .init(), + headers: Operations.get_hyphen_cgi_hyphen_suggest_period_pl.Input.Headers = .init() + ) async throws -> Operations.get_hyphen_cgi_hyphen_suggest_period_pl.Output { + try await get_hyphen_cgi_hyphen_suggest_period_pl(Operations.get_hyphen_cgi_hyphen_suggest_period_pl.Input( + query: query, + headers: headers + )) + } + /// Get a nested list of nutrients that can be displayed in the nutrition facts table for a specific country and language + /// + /// Used to display the nutrition facts table of a product, or to display a form to input those nutrition facts. + /// + /// + /// - Remark: HTTP `GET /cgi/nutrients.pl`. + /// - Remark: Generated from `#/paths//cgi/nutrients.pl/get(get-cgi-nutrients.pl)`. + public func get_hyphen_cgi_hyphen_nutrients_period_pl( + query: Operations.get_hyphen_cgi_hyphen_nutrients_period_pl.Input.Query = .init(), + headers: Operations.get_hyphen_cgi_hyphen_nutrients_period_pl.Input.Headers = .init() + ) async throws -> Operations.get_hyphen_cgi_hyphen_nutrients_period_pl.Output { + try await get_hyphen_cgi_hyphen_nutrients_period_pl(Operations.get_hyphen_cgi_hyphen_nutrients_period_pl.Input( + query: query, + headers: headers + )) + } + /// Get the list of attributes available for personal search. + /// + /// Attributes are at the heart of personal search. + /// They score the products according to different criterias, + /// which could then be matched to a user's preferences. + /// + /// This API helps you list attributes and display them in your application, + /// for the user to choose the importance of each criteria. + /// + /// note: /api/v2/attribute_groups_{lc} is also a valid route, but consider it deprecated + /// + /// + /// - Remark: HTTP `GET /api/v2/attribute_groups`. + /// - Remark: Generated from `#/paths//api/v2/attribute_groups/get(get-attribute-groups)`. + public func get_hyphen_attribute_hyphen_groups( + query: Operations.get_hyphen_attribute_hyphen_groups.Input.Query = .init(), + headers: Operations.get_hyphen_attribute_hyphen_groups.Input.Headers = .init() + ) async throws -> Operations.get_hyphen_attribute_hyphen_groups.Output { + try await get_hyphen_attribute_hyphen_groups(Operations.get_hyphen_attribute_hyphen_groups.Input( + query: query, + headers: headers + )) + } + /// Get the weights corresponding to attributes preferences + /// to compute personal product + /// + /// + /// - Remark: HTTP `GET /api/v2/preferences`. + /// - Remark: Generated from `#/paths//api/v2/preferences/get(get-preferences)`. + public func get_hyphen_preferences( + query: Operations.get_hyphen_preferences.Input.Query = .init(), + headers: Operations.get_hyphen_preferences.Input.Headers = .init() + ) async throws -> Operations.get_hyphen_preferences.Output { + try await get_hyphen_preferences(Operations.get_hyphen_preferences.Input( + query: query, + headers: headers + )) + } +} + +/// Server URLs defined in the OpenAPI document. +public enum Servers { + /// dev + public static func server1() throws -> Foundation.URL { + try Foundation.URL( + validatingOpenAPIServerURL: "https://world.openfoodfacts.net", + variables: [] + ) + } + /// prod + public static func server2() throws -> Foundation.URL { + try Foundation.URL( + validatingOpenAPIServerURL: "https://world.openfoodfacts.org", + variables: [] + ) + } +} + +/// Types generated from the components section of the OpenAPI document. +public enum Components { + /// Types generated from the `#/components/schemas` section of the OpenAPI document. + public enum Schemas { + /// - Remark: Generated from `#/components/schemas/Product-Base`. + public typealias Product_hyphen_Base = Components.Schemas.product_base + /// - Remark: Generated from `#/components/schemas/Product-Misc`. + public typealias Product_hyphen_Misc = Components.Schemas.product_misc + /// - Remark: Generated from `#/components/schemas/Product-Tags`. + public typealias Product_hyphen_Tags = Components.Schemas.product_tags + /// - Remark: Generated from `#/components/schemas/Product-Nutrition`. + public typealias Product_hyphen_Nutrition = Components.Schemas.product_nutrition + /// - Remark: Generated from `#/components/schemas/Product-Ingredients`. + public typealias Product_hyphen_Ingredients = Components.Schemas.product_ingredients + /// - Remark: Generated from `#/components/schemas/Product-Images`. + public typealias Product_hyphen_Images = Components.Schemas.product_images + /// - Remark: Generated from `#/components/schemas/Product-Eco-Score`. + public typealias Product_hyphen_Eco_hyphen_Score = Components.Schemas.product_ecoscore + /// - Remark: Generated from `#/components/schemas/Product-Metadata`. + public typealias Product_hyphen_Metadata = Components.Schemas.product_meta + /// - Remark: Generated from `#/components/schemas/Product-Data-Quality`. + public typealias Product_hyphen_Data_hyphen_Quality = Components.Schemas.product_quality + /// - Remark: Generated from `#/components/schemas/Product-Knowledge-Panels`. + public typealias Product_hyphen_Knowledge_hyphen_Panels = Components.Schemas.product_knowledge_panels + /// - Remark: Generated from `#/components/schemas/Product-Attribute-Groups`. + public typealias Product_hyphen_Attribute_hyphen_Groups = Components.Schemas.product_attribute_groups + /// - Remark: Generated from `#/components/schemas/Product`. + public typealias Product = Components.Schemas.product + /// - Remark: Generated from `#/components/schemas/get_product_by_barcode_base`. + public struct get_product_by_barcode_base: Codable, Hashable, Sendable { + /// Barcode of the product + /// (can be EAN-13 or internal codes for some food stores). + /// For products without a barcode, Open Food Facts assigns a + /// number starting with the 200 reserved prefix. + /// + /// + /// - Remark: Generated from `#/components/schemas/get_product_by_barcode_base/code`. + public var code: Swift.String? + /// - Remark: Generated from `#/components/schemas/get_product_by_barcode_base/status`. + public var status: Swift.Int? + /// - Remark: Generated from `#/components/schemas/get_product_by_barcode_base/status_verbose`. + public var status_verbose: Swift.String? + /// Creates a new `get_product_by_barcode_base`. + /// + /// - Parameters: + /// - code: Barcode of the product + /// - status: + /// - status_verbose: + public init( + code: Swift.String? = nil, + status: Swift.Int? = nil, + status_verbose: Swift.String? = nil + ) { + self.code = code + self.status = status + self.status_verbose = status_verbose + } + public enum CodingKeys: String, CodingKey { + case code + case status + case status_verbose + } + } + /// Base product data + /// + /// + /// - Remark: Generated from `#/components/schemas/product_base`. + public struct product_base: Codable, Hashable, Sendable { + /// Abbreviated name in requested language + /// + /// - Remark: Generated from `#/components/schemas/product_base/abbreviated_product_name`. + public var abbreviated_product_name: Swift.String? + /// barcode of the product (can be EAN-13 or internal codes for some food stores), + /// for products without a barcode, + /// Open Food Facts assigns a number starting with the 200 reserved prefix + /// + /// + /// - Remark: Generated from `#/components/schemas/product_base/code`. + public var code: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_base/codes_tags`. + public var codes_tags: [Swift.String]? + /// Legal name of the product as regulated + /// by the European authorities. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_base/generic_name`. + public var generic_name: Swift.String? + /// internal identifier for the product, usually set to the value of `code`, + /// except on the producers platform where it is prefixed by the owner + /// + /// + /// - Remark: Generated from `#/components/schemas/product_base/id`. + public var id: Swift.String? + /// Main language of the product. + /// This is a duplicate of `lang` property (for historical reasons). + /// + /// + /// - Remark: Generated from `#/components/schemas/product_base/lc`. + public var lc: Swift.String? + /// Main language of the product. + /// + /// This should be the main language of product packaging (if one is predominant). + /// + /// Main language is also used to decide which ingredients list to parse. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_base/lang`. + public var lang: Swift.String? + /// Nova group as an integer from 1 to 4. See https://world.openfoodfacts.org/nova + /// + /// + /// - Remark: Generated from `#/components/schemas/product_base/nova_group`. + public var nova_group: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_base/nova_groups`. + public var nova_groups: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_base/obsolete`. + public var obsolete: Swift.String? + /// A date at which the product was declared obsolete. + /// This means it's not produced any more. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_base/obsolete_since_date`. + public var obsolete_since_date: Swift.String? + /// The name of the product + /// + /// + /// - Remark: Generated from `#/components/schemas/product_base/product_name`. + public var product_name: Swift.String? + /// The name of the product can also + /// be in many other languages like + /// product_name_fr (for French). + /// + /// + /// - Remark: Generated from `#/components/schemas/product_base/product_name_en`. + public var product_name_en: Swift.String? + /// The size in g or ml for the whole product. + /// It's a normalized version of the quantity field. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_base/product_quantity`. + public var product_quantity: Swift.String? + /// The unit (either g or ml) for the correponding product_quantity. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_base/product_quantity_unit`. + public var product_quantity_unit: Swift.String? + /// Quantity and Unit. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_base/quantity`. + public var quantity: Swift.String? + /// Abbreviated name in language `language_code`. + /// + /// - Remark: Generated from `#/components/schemas/product_base/abbreviated_product_name_(?\w\w)`. + public var abbreviated_product_name__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: Swift.String? + /// This can be returned in many other languages + /// like generic_name_fr (for French). + /// + /// + /// - Remark: Generated from `#/components/schemas/product_base/generic_name_(?\w\w)`. + public var generic_name__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: Swift.String? + /// Creates a new `product_base`. + /// + /// - Parameters: + /// - abbreviated_product_name: Abbreviated name in requested language + /// - code: barcode of the product (can be EAN-13 or internal codes for some food stores), + /// - codes_tags: + /// - generic_name: Legal name of the product as regulated + /// - id: internal identifier for the product, usually set to the value of `code`, + /// - lc: Main language of the product. + /// - lang: Main language of the product. + /// - nova_group: Nova group as an integer from 1 to 4. See https://world.openfoodfacts.org/nova + /// - nova_groups: + /// - obsolete: + /// - obsolete_since_date: A date at which the product was declared obsolete. + /// - product_name: The name of the product + /// - product_name_en: The name of the product can also + /// - product_quantity: The size in g or ml for the whole product. + /// - product_quantity_unit: The unit (either g or ml) for the correponding product_quantity. + /// - quantity: Quantity and Unit. + /// - abbreviated_product_name__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: Abbreviated name in language `language_code`. + /// - generic_name__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: This can be returned in many other languages + public init( + abbreviated_product_name: Swift.String? = nil, + code: Swift.String? = nil, + codes_tags: [Swift.String]? = nil, + generic_name: Swift.String? = nil, + id: Swift.String? = nil, + lc: Swift.String? = nil, + lang: Swift.String? = nil, + nova_group: Swift.Int? = nil, + nova_groups: Swift.String? = nil, + obsolete: Swift.String? = nil, + obsolete_since_date: Swift.String? = nil, + product_name: Swift.String? = nil, + product_name_en: Swift.String? = nil, + product_quantity: Swift.String? = nil, + product_quantity_unit: Swift.String? = nil, + quantity: Swift.String? = nil, + abbreviated_product_name__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: Swift.String? = nil, + generic_name__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: Swift.String? = nil + ) { + self.abbreviated_product_name = abbreviated_product_name + self.code = code + self.codes_tags = codes_tags + self.generic_name = generic_name + self.id = id + self.lc = lc + self.lang = lang + self.nova_group = nova_group + self.nova_groups = nova_groups + self.obsolete = obsolete + self.obsolete_since_date = obsolete_since_date + self.product_name = product_name + self.product_name_en = product_name_en + self.product_quantity = product_quantity + self.product_quantity_unit = product_quantity_unit + self.quantity = quantity + self.abbreviated_product_name__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ = abbreviated_product_name__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ + self.generic_name__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ = generic_name__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ + } + public enum CodingKeys: String, CodingKey { + case abbreviated_product_name + case code + case codes_tags + case generic_name + case id + case lc + case lang + case nova_group + case nova_groups + case obsolete + case obsolete_since_date + case product_name + case product_name_en + case product_quantity + case product_quantity_unit + case quantity + case abbreviated_product_name__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ = #"abbreviated_product_name_(?\w\w)"# + case generic_name__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ = #"generic_name_(?\w\w)"# + } + } + /// The shape property is canonicalized using the packaging_shapes taxonomy. + /// + /// - Remark: Generated from `#/components/schemas/shape`. + public struct shape: Codable, Hashable, Sendable { + /// Canonical id of the entry in the taxonomy. If the value cannot be mapped to a taxonomy entry, the value will be the name of the entry in its original language prefixed by the language 2 letter code and a colon. + /// + /// - Remark: Generated from `#/components/schemas/shape/id`. + public var id: Swift.String? + /// Name of the entry in the language requested in the tags_lc field of the request. This field is returned only of tags_lc is specified. If the translation is not available, or if the entry does not exist in the taxonomy, the value will be the name of the entry in its original language prefixed by the language 2 letter code and a colon. + /// + /// - Remark: Generated from `#/components/schemas/shape/lc_name`. + public var lc_name: Swift.String? + /// Creates a new `shape`. + /// + /// - Parameters: + /// - id: Canonical id of the entry in the taxonomy. If the value cannot be mapped to a taxonomy entry, the value will be the name of the entry in its original language prefixed by the language 2 letter code and a colon. + /// - lc_name: Name of the entry in the language requested in the tags_lc field of the request. This field is returned only of tags_lc is specified. If the translation is not available, or if the entry does not exist in the taxonomy, the value will be the name of the entry in its original language prefixed by the language 2 letter code and a colon. + public init( + id: Swift.String? = nil, + lc_name: Swift.String? = nil + ) { + self.id = id + self.lc_name = lc_name + } + public enum CodingKeys: String, CodingKey { + case id + case lc_name + } + } + /// The material property is canonicalized using the packaging_materials taxonomy. + /// + /// - Remark: Generated from `#/components/schemas/material`. + public struct material: Codable, Hashable, Sendable { + /// Canonical id of the entry in the taxonomy. If the value cannot be mapped to a taxonomy entry, the value will be the name of the entry in its original language prefixed by the language 2 letter code and a colon. + /// + /// - Remark: Generated from `#/components/schemas/material/id`. + public var id: Swift.String? + /// Name of the entry in the language requested in the tags_lc field of the request. This field is returned only of tags_lc is specified. If the translation is not available, or if the entry does not exist in the taxonomy, the value will be the name of the entry in its original language prefixed by the language 2 letter code and a colon. + /// + /// - Remark: Generated from `#/components/schemas/material/lc_name`. + public var lc_name: Swift.String? + /// Creates a new `material`. + /// + /// - Parameters: + /// - id: Canonical id of the entry in the taxonomy. If the value cannot be mapped to a taxonomy entry, the value will be the name of the entry in its original language prefixed by the language 2 letter code and a colon. + /// - lc_name: Name of the entry in the language requested in the tags_lc field of the request. This field is returned only of tags_lc is specified. If the translation is not available, or if the entry does not exist in the taxonomy, the value will be the name of the entry in its original language prefixed by the language 2 letter code and a colon. + public init( + id: Swift.String? = nil, + lc_name: Swift.String? = nil + ) { + self.id = id + self.lc_name = lc_name + } + public enum CodingKeys: String, CodingKey { + case id + case lc_name + } + } + /// The recycling property is canonicalized using the packaging_recycling taxonomy. + /// + /// - Remark: Generated from `#/components/schemas/recycling`. + public struct recycling: Codable, Hashable, Sendable { + /// Canonical id of the entry in the taxonomy. If the value cannot be mapped to a taxonomy entry, the value will be the name of the entry in its original language prefixed by the language 2 letter code and a colon. + /// + /// - Remark: Generated from `#/components/schemas/recycling/id`. + public var id: Swift.String? + /// Name of the entry in the language requested in the tags_lc field of the request. This field is returned only of tags_lc is specified. If the translation is not available, or if the entry does not exist in the taxonomy, the value will be the name of the entry in its original language prefixed by the language 2 letter code and a colon. + /// + /// - Remark: Generated from `#/components/schemas/recycling/lc_name`. + public var lc_name: Swift.String? + /// Creates a new `recycling`. + /// + /// - Parameters: + /// - id: Canonical id of the entry in the taxonomy. If the value cannot be mapped to a taxonomy entry, the value will be the name of the entry in its original language prefixed by the language 2 letter code and a colon. + /// - lc_name: Name of the entry in the language requested in the tags_lc field of the request. This field is returned only of tags_lc is specified. If the translation is not available, or if the entry does not exist in the taxonomy, the value will be the name of the entry in its original language prefixed by the language 2 letter code and a colon. + public init( + id: Swift.String? = nil, + lc_name: Swift.String? = nil + ) { + self.id = id + self.lc_name = lc_name + } + public enum CodingKeys: String, CodingKey { + case id + case lc_name + } + } + /// Each packaging component has different properties to specify how many there are, its shape, material etc. + /// + /// The shape, material and recycling properties are mapped to one entry in the packaging_shapes, packaging_materials and packaging_recycling taxonomies, and the value of the property is the canonical name of the taxonomy entry (e.g. en:bottle). + /// + /// They may contain values that could not yet get matched to their respective taxonomy, in which case they will contain a free text value prefixed with the language code of this text value (e.g. "fr:Bouteille sphérique" might have been entered by a French user to indicate it is a spherical bottle). + /// + /// - Remark: Generated from `#/components/schemas/packaging_component`. + public struct packaging_component: Codable, Hashable, Sendable { + /// umber of units of this packaging component contained in the product (e.g. 6 for a pack of 6 bottles) + /// + /// - Remark: Generated from `#/components/schemas/packaging_component/number_of_units`. + public var number_of_units: Swift.Int? + /// - Remark: Generated from `#/components/schemas/packaging_component/shape`. + public var shape: Components.Schemas.shape? + /// - Remark: Generated from `#/components/schemas/packaging_component/material`. + public var material: Components.Schemas.material? + /// - Remark: Generated from `#/components/schemas/packaging_component/recycling`. + public var recycling: Components.Schemas.recycling? + /// Quantity (weight or volume) of food product contained in the packaging component. (e.g. 75cl for a wine bottle) + /// + /// - Remark: Generated from `#/components/schemas/packaging_component/quantity_per_unit`. + public var quantity_per_unit: Swift.String? + /// Value parsed from the quantity field. + /// + /// - Remark: Generated from `#/components/schemas/packaging_component/quantity_per_unit_value`. + public var quantity_per_unit_value: Swift.Double? + /// Unit parsed and normalized from the quantity field. + /// + /// - Remark: Generated from `#/components/schemas/packaging_component/quantity_per_unit_unit`. + public var quantity_per_unit_unit: Swift.String? + /// Weight (as specified by the manufacturer) of one unit of the empty packaging component (in grams). (e.g. for a 6 pack of 1.5l water bottles, it might be 30, the weight in grams of 1 empty water bottle without its cap which is a different packaging component). + /// + /// - Remark: Generated from `#/components/schemas/packaging_component/weight_specified`. + public var weight_specified: Swift.Double? + /// Weight (as measured by one or more users) of one unit of the empty packaging component (in grams). (e.g. for a 6 pack of 1.5l water bottles, it might be 30, the weight in grams of 1 empty water bottle without its cap which is a different packaging component). + /// + /// - Remark: Generated from `#/components/schemas/packaging_component/weight_measured`. + public var weight_measured: Swift.Double? + /// Weight (as estimated from similar products) of one unit of the empty packaging component (in grams). (e.g. for a 6 pack of 1.5l water bottles, it might be 30, the weight in grams of 1 empty water bottle without its cap which is a different packaging component). + /// + /// - Remark: Generated from `#/components/schemas/packaging_component/weight_estimated`. + public var weight_estimated: Swift.Double? + /// Weight of one unit of the empty packaging component. + /// + /// - Remark: Generated from `#/components/schemas/packaging_component/weight`. + public var weight: Swift.Double? + /// Indicates which field was used to populate the "weight" field. Either "specified", "measured", or "estimated" + /// + /// - Remark: Generated from `#/components/schemas/packaging_component/weight_source_id`. + public var weight_source_id: Swift.String? + /// Creates a new `packaging_component`. + /// + /// - Parameters: + /// - number_of_units: umber of units of this packaging component contained in the product (e.g. 6 for a pack of 6 bottles) + /// - shape: + /// - material: + /// - recycling: + /// - quantity_per_unit: Quantity (weight or volume) of food product contained in the packaging component. (e.g. 75cl for a wine bottle) + /// - quantity_per_unit_value: Value parsed from the quantity field. + /// - quantity_per_unit_unit: Unit parsed and normalized from the quantity field. + /// - weight_specified: Weight (as specified by the manufacturer) of one unit of the empty packaging component (in grams). (e.g. for a 6 pack of 1.5l water bottles, it might be 30, the weight in grams of 1 empty water bottle without its cap which is a different packaging component). + /// - weight_measured: Weight (as measured by one or more users) of one unit of the empty packaging component (in grams). (e.g. for a 6 pack of 1.5l water bottles, it might be 30, the weight in grams of 1 empty water bottle without its cap which is a different packaging component). + /// - weight_estimated: Weight (as estimated from similar products) of one unit of the empty packaging component (in grams). (e.g. for a 6 pack of 1.5l water bottles, it might be 30, the weight in grams of 1 empty water bottle without its cap which is a different packaging component). + /// - weight: Weight of one unit of the empty packaging component. + /// - weight_source_id: Indicates which field was used to populate the "weight" field. Either "specified", "measured", or "estimated" + public init( + number_of_units: Swift.Int? = nil, + shape: Components.Schemas.shape? = nil, + material: Components.Schemas.material? = nil, + recycling: Components.Schemas.recycling? = nil, + quantity_per_unit: Swift.String? = nil, + quantity_per_unit_value: Swift.Double? = nil, + quantity_per_unit_unit: Swift.String? = nil, + weight_specified: Swift.Double? = nil, + weight_measured: Swift.Double? = nil, + weight_estimated: Swift.Double? = nil, + weight: Swift.Double? = nil, + weight_source_id: Swift.String? = nil + ) { + self.number_of_units = number_of_units + self.shape = shape + self.material = material + self.recycling = recycling + self.quantity_per_unit = quantity_per_unit + self.quantity_per_unit_value = quantity_per_unit_value + self.quantity_per_unit_unit = quantity_per_unit_unit + self.weight_specified = weight_specified + self.weight_measured = weight_measured + self.weight_estimated = weight_estimated + self.weight = weight + self.weight_source_id = weight_source_id + } + public enum CodingKeys: String, CodingKey { + case number_of_units + case shape + case material + case recycling + case quantity_per_unit + case quantity_per_unit_value + case quantity_per_unit_unit + case weight_specified + case weight_measured + case weight_estimated + case weight + case weight_source_id + } + } + /// The packagings object is an array of individual packaging component objects. + /// + /// The Packaging data document explains how packaging data is structured in Open Food Facts: https://openfoodfacts.github.io/openfoodfacts-server/dev/explain-packaging-data/ + /// + /// The shape, material and recycling properties of each packaging component are linked to entries in the packaging_shapes, packaging_materials and packaging_recycling taxonomies: + /// + /// https://world.openfoodfacts.org/data/taxonomies/packaging_shapes.json + /// https://world.openfoodfacts.org/data/taxonomies/packaging_materials.json + /// https://world.openfoodfacts.org/data/taxonomies/packaging_recycling.json + /// + /// If the tags_lc field is set, the properties will include a lc_name field with the translation in the requested language. + /// + /// - Remark: Generated from `#/components/schemas/packagings`. + public typealias packagings = [Components.Schemas.packaging_component] + /// Indicate if the packagings array contains all the packaging parts of the product. This field can be set by users when they enter or verify packaging data. Possible values are 0 or 1. + /// + /// - Remark: Generated from `#/components/schemas/packagings_complete`. + public typealias packagings_complete = Swift.Int + /// Miscellaneous but important fields of a product + /// + /// + /// - Remark: Generated from `#/components/schemas/product_misc`. + public struct product_misc: Codable, Hashable, Sendable { + /// Number of food additives. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_misc/additives_n`. + public var additives_n: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_misc/checked`. + public var checked: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_misc/complete`. + public var complete: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_misc/completeness`. + public var completeness: Swift.Double? + /// See also: `ecoscore_tags` + /// + /// + /// - Remark: Generated from `#/components/schemas/product_misc/ecoscore_grade`. + public var ecoscore_grade: Swift.String? + /// See also: `ecoscore_tags` + /// + /// + /// - Remark: Generated from `#/components/schemas/product_misc/ecoscore_score`. + public var ecoscore_score: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_misc/food_groups`. + public var food_groups: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_misc/food_groups_tags`. + public var food_groups_tags: [Swift.String]? + /// Traffic light indicators on main nutrients levels + /// + /// + /// - Remark: Generated from `#/components/schemas/product_misc/nutrient_levels`. + public struct nutrient_levelsPayload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/product_misc/nutrient_levels/fat`. + @frozen public enum fatPayload: String, Codable, Hashable, Sendable, CaseIterable { + case low = "low" + case moderate = "moderate" + case high = "high" + } + /// - Remark: Generated from `#/components/schemas/product_misc/nutrient_levels/fat`. + public var fat: Components.Schemas.product_misc.nutrient_levelsPayload.fatPayload? + /// - Remark: Generated from `#/components/schemas/product_misc/nutrient_levels/salt`. + @frozen public enum saltPayload: String, Codable, Hashable, Sendable, CaseIterable { + case low = "low" + case moderate = "moderate" + case high = "high" + } + /// - Remark: Generated from `#/components/schemas/product_misc/nutrient_levels/salt`. + public var salt: Components.Schemas.product_misc.nutrient_levelsPayload.saltPayload? + /// - Remark: Generated from `#/components/schemas/product_misc/nutrient_levels/saturated-fat`. + @frozen public enum saturated_hyphen_fatPayload: String, Codable, Hashable, Sendable, CaseIterable { + case low = "low" + case moderate = "moderate" + case high = "high" + } + /// - Remark: Generated from `#/components/schemas/product_misc/nutrient_levels/saturated-fat`. + public var saturated_hyphen_fat: Components.Schemas.product_misc.nutrient_levelsPayload.saturated_hyphen_fatPayload? + /// - Remark: Generated from `#/components/schemas/product_misc/nutrient_levels/sugars`. + @frozen public enum sugarsPayload: String, Codable, Hashable, Sendable, CaseIterable { + case low = "low" + case moderate = "moderate" + case high = "high" + } + /// - Remark: Generated from `#/components/schemas/product_misc/nutrient_levels/sugars`. + public var sugars: Components.Schemas.product_misc.nutrient_levelsPayload.sugarsPayload? + /// Creates a new `nutrient_levelsPayload`. + /// + /// - Parameters: + /// - fat: + /// - salt: + /// - saturated_hyphen_fat: + /// - sugars: + public init( + fat: Components.Schemas.product_misc.nutrient_levelsPayload.fatPayload? = nil, + salt: Components.Schemas.product_misc.nutrient_levelsPayload.saltPayload? = nil, + saturated_hyphen_fat: Components.Schemas.product_misc.nutrient_levelsPayload.saturated_hyphen_fatPayload? = nil, + sugars: Components.Schemas.product_misc.nutrient_levelsPayload.sugarsPayload? = nil + ) { + self.fat = fat + self.salt = salt + self.saturated_hyphen_fat = saturated_hyphen_fat + self.sugars = sugars + } + public enum CodingKeys: String, CodingKey { + case fat + case salt + case saturated_hyphen_fat = "saturated-fat" + case sugars + } + } + /// Traffic light indicators on main nutrients levels + /// + /// + /// - Remark: Generated from `#/components/schemas/product_misc/nutrient_levels`. + public var nutrient_levels: Components.Schemas.product_misc.nutrient_levelsPayload? + /// Recycling instructions as raw text, e.g. Plastic + /// bottle to recycle, Plastic cap to recycle. + /// This will get automatically parsed and + /// will be used to compute the Eco-Score. + /// You can either request it (if it exists) or + /// send it in a specific language. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_misc/packaging_text`. + public var packaging_text: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_misc/packagings`. + public var packagings: Components.Schemas.packagings? + /// - Remark: Generated from `#/components/schemas/product_misc/packagings_complete`. + public var packagings_complete: Components.Schemas.packagings_complete? + /// Category of food according to [French Nutrition and Health Program](https://fr.wikipedia.org/wiki/Programme_national_nutrition_sant%C3%A9) + /// + /// + /// - Remark: Generated from `#/components/schemas/product_misc/pnns_groups_1`. + public var pnns_groups_1: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_misc/pnns_groups_1_tags`. + public var pnns_groups_1_tags: [Swift.String]? + /// Sub Category of food according to [French Nutrition and Health Program](https://fr.wikipedia.org/wiki/Programme_national_nutrition_sant%C3%A9) + /// + /// + /// - Remark: Generated from `#/components/schemas/product_misc/pnns_groups_2`. + public var pnns_groups_2: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_misc/pnns_groups_2_tags`. + public var pnns_groups_2_tags: [Swift.String]? + /// An imprecise measurement of popularity based on Scan statistics. A higher value means higher popularity. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_misc/popularity_key`. + public var popularity_key: Swift.Int? + /// Indicators for the popularity of a product, like the amount of scans in a specific year. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_misc/popularity_tags`. + public var popularity_tags: [Swift.String]? + /// - Remark: Generated from `#/components/schemas/product_misc/scans_n`. + public var scans_n: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_misc/unique_scans_n`. + public var unique_scans_n: Swift.Int? + /// Normalized version of serving_size. + /// Note that this is NOT the number of servings by product. + /// (in perl, see `normalize_serving_size`) + /// + /// + /// - Remark: Generated from `#/components/schemas/product_misc/serving_quantity`. + public var serving_quantity: Swift.String? + /// The unit (either g or ml) for the correponding serving_quantity. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_misc/serving_quantity_unit`. + public var serving_quantity_unit: Swift.String? + /// Serving size text (generally in g or ml). + /// We expect a quantity + unit but the user is free to input any string. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_misc/serving_size`. + public var serving_size: Swift.String? + /// see `food_groups` + /// + /// - Remark: Generated from `#/components/schemas/product_misc/food_groups_(?\w\w)`. + public var food_groups__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: Swift.String? + /// Packaging text in language designated by `language_code` + /// + /// + /// - Remark: Generated from `#/components/schemas/product_misc/packaging_text_(?\w\w)`. + public var packaging_text__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: Swift.String? + /// Creates a new `product_misc`. + /// + /// - Parameters: + /// - additives_n: Number of food additives. + /// - checked: + /// - complete: + /// - completeness: + /// - ecoscore_grade: See also: `ecoscore_tags` + /// - ecoscore_score: See also: `ecoscore_tags` + /// - food_groups: + /// - food_groups_tags: + /// - nutrient_levels: Traffic light indicators on main nutrients levels + /// - packaging_text: Recycling instructions as raw text, e.g. Plastic + /// - packagings: + /// - packagings_complete: + /// - pnns_groups_1: Category of food according to [French Nutrition and Health Program](https://fr.wikipedia.org/wiki/Programme_national_nutrition_sant%C3%A9) + /// - pnns_groups_1_tags: + /// - pnns_groups_2: Sub Category of food according to [French Nutrition and Health Program](https://fr.wikipedia.org/wiki/Programme_national_nutrition_sant%C3%A9) + /// - pnns_groups_2_tags: + /// - popularity_key: An imprecise measurement of popularity based on Scan statistics. A higher value means higher popularity. + /// - popularity_tags: Indicators for the popularity of a product, like the amount of scans in a specific year. + /// - scans_n: + /// - unique_scans_n: + /// - serving_quantity: Normalized version of serving_size. + /// - serving_quantity_unit: The unit (either g or ml) for the correponding serving_quantity. + /// - serving_size: Serving size text (generally in g or ml). + /// - food_groups__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: see `food_groups` + /// - packaging_text__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: Packaging text in language designated by `language_code` + public init( + additives_n: Swift.Int? = nil, + checked: Swift.String? = nil, + complete: Swift.Int? = nil, + completeness: Swift.Double? = nil, + ecoscore_grade: Swift.String? = nil, + ecoscore_score: Swift.Int? = nil, + food_groups: Swift.String? = nil, + food_groups_tags: [Swift.String]? = nil, + nutrient_levels: Components.Schemas.product_misc.nutrient_levelsPayload? = nil, + packaging_text: Swift.String? = nil, + packagings: Components.Schemas.packagings? = nil, + packagings_complete: Components.Schemas.packagings_complete? = nil, + pnns_groups_1: Swift.String? = nil, + pnns_groups_1_tags: [Swift.String]? = nil, + pnns_groups_2: Swift.String? = nil, + pnns_groups_2_tags: [Swift.String]? = nil, + popularity_key: Swift.Int? = nil, + popularity_tags: [Swift.String]? = nil, + scans_n: Swift.Int? = nil, + unique_scans_n: Swift.Int? = nil, + serving_quantity: Swift.String? = nil, + serving_quantity_unit: Swift.String? = nil, + serving_size: Swift.String? = nil, + food_groups__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: Swift.String? = nil, + packaging_text__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: Swift.String? = nil + ) { + self.additives_n = additives_n + self.checked = checked + self.complete = complete + self.completeness = completeness + self.ecoscore_grade = ecoscore_grade + self.ecoscore_score = ecoscore_score + self.food_groups = food_groups + self.food_groups_tags = food_groups_tags + self.nutrient_levels = nutrient_levels + self.packaging_text = packaging_text + self.packagings = packagings + self.packagings_complete = packagings_complete + self.pnns_groups_1 = pnns_groups_1 + self.pnns_groups_1_tags = pnns_groups_1_tags + self.pnns_groups_2 = pnns_groups_2 + self.pnns_groups_2_tags = pnns_groups_2_tags + self.popularity_key = popularity_key + self.popularity_tags = popularity_tags + self.scans_n = scans_n + self.unique_scans_n = unique_scans_n + self.serving_quantity = serving_quantity + self.serving_quantity_unit = serving_quantity_unit + self.serving_size = serving_size + self.food_groups__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ = food_groups__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ + self.packaging_text__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ = packaging_text__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ + } + public enum CodingKeys: String, CodingKey { + case additives_n + case checked + case complete + case completeness + case ecoscore_grade + case ecoscore_score + case food_groups + case food_groups_tags + case nutrient_levels + case packaging_text + case packagings + case packagings_complete + case pnns_groups_1 + case pnns_groups_1_tags + case pnns_groups_2 + case pnns_groups_2_tags + case popularity_key + case popularity_tags + case scans_n + case unique_scans_n + case serving_quantity + case serving_quantity_unit + case serving_size + case food_groups__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ = #"food_groups_(?\w\w)"# + case packaging_text__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ = #"packaging_text_(?\w\w)"# + } + } + /// Data about a product which is represented as tags + /// + /// + /// - Remark: Generated from `#/components/schemas/product_tags`. + public struct product_tags: Codable, Hashable, Sendable { + /// List of brands (not taxonomized) + /// + /// - Remark: Generated from `#/components/schemas/product_tags/brands`. + public var brands: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_tags/brands_tags`. + public var brands_tags: [Swift.String]? + /// - Remark: Generated from `#/components/schemas/product_tags/categories`. + public var categories: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_tags/categories_hierarchy`. + public var categories_hierarchy: [Swift.String]? + /// Categories language code + /// + /// - Remark: Generated from `#/components/schemas/product_tags/categories_lc`. + public var categories_lc: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_tags/categories_tags`. + public var categories_tags: [Swift.String]? + /// - Remark: Generated from `#/components/schemas/product_tags/checkers_tags`. + public var checkers_tags: [Swift.String]? + /// - Remark: Generated from `#/components/schemas/product_tags/cities`. + public var cities: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_tags/cities_tags`. + public var cities_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? + /// - Remark: Generated from `#/components/schemas/product_tags/correctors_tags`. + public var correctors_tags: [Swift.String]? + /// List of countries where the product is sold. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_tags/countries`. + public var countries: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_tags/countries_hierarchy`. + public var countries_hierarchy: [Swift.String]? + /// Countries language code + /// + /// - Remark: Generated from `#/components/schemas/product_tags/countries_lc`. + public var countries_lc: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_tags/countries_tags`. + public var countries_tags: [Swift.String]? + /// All ecoscore of a product. + /// Most of the time it's only one value, + /// but it might eventually be more for products composed of sub-products. + /// See also: `ecoscore_score`, `ecoscore_grade`. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_tags/ecoscore_tags`. + public var ecoscore_tags: [Swift.String]? + /// Packager code. EMB is the French system of traceability codes for packager. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_tags/emb_codes`. + public var emb_codes: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_tags/emb_codes_orig`. + public var emb_codes_orig: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_tags/emb_codes_tags`. + public var emb_codes_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? + /// - Remark: Generated from `#/components/schemas/product_tags/labels`. + public var labels: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_tags/labels_hierarchy`. + public var labels_hierarchy: [Swift.String]? + /// - Remark: Generated from `#/components/schemas/product_tags/labels_lc`. + public var labels_lc: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_tags/labels_tags`. + public var labels_tags: [Swift.String]? + /// The data as a series of tag: `yyyy-mm-dd`, `yyyy-mm`, `yyyy` + /// + /// + /// - Remark: Generated from `#/components/schemas/product_tags/entry_dates_tags`. + public var entry_dates_tags: [Swift.String]? + /// Places where the product was manufactured or transformed. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_tags/manufacturing_places`. + public var manufacturing_places: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_tags/manufacturing_places_tags`. + public var manufacturing_places_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? + /// - Remark: Generated from `#/components/schemas/product_tags/nova_groups_tags`. + public var nova_groups_tags: [Swift.String]? + /// - Remark: Generated from `#/components/schemas/product_tags/nutrient_levels_tags`. + public var nutrient_levels_tags: [Swift.String]? + /// Creates a new `product_tags`. + /// + /// - Parameters: + /// - brands: List of brands (not taxonomized) + /// - brands_tags: + /// - categories: + /// - categories_hierarchy: + /// - categories_lc: Categories language code + /// - categories_tags: + /// - checkers_tags: + /// - cities: + /// - cities_tags: + /// - correctors_tags: + /// - countries: List of countries where the product is sold. + /// - countries_hierarchy: + /// - countries_lc: Countries language code + /// - countries_tags: + /// - ecoscore_tags: All ecoscore of a product. + /// - emb_codes: Packager code. EMB is the French system of traceability codes for packager. + /// - emb_codes_orig: + /// - emb_codes_tags: + /// - labels: + /// - labels_hierarchy: + /// - labels_lc: + /// - labels_tags: + /// - entry_dates_tags: The data as a series of tag: `yyyy-mm-dd`, `yyyy-mm`, `yyyy` + /// - manufacturing_places: Places where the product was manufactured or transformed. + /// - manufacturing_places_tags: + /// - nova_groups_tags: + /// - nutrient_levels_tags: + public init( + brands: Swift.String? = nil, + brands_tags: [Swift.String]? = nil, + categories: Swift.String? = nil, + categories_hierarchy: [Swift.String]? = nil, + categories_lc: Swift.String? = nil, + categories_tags: [Swift.String]? = nil, + checkers_tags: [Swift.String]? = nil, + cities: Swift.String? = nil, + cities_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? = nil, + correctors_tags: [Swift.String]? = nil, + countries: Swift.String? = nil, + countries_hierarchy: [Swift.String]? = nil, + countries_lc: Swift.String? = nil, + countries_tags: [Swift.String]? = nil, + ecoscore_tags: [Swift.String]? = nil, + emb_codes: Swift.String? = nil, + emb_codes_orig: Swift.String? = nil, + emb_codes_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? = nil, + labels: Swift.String? = nil, + labels_hierarchy: [Swift.String]? = nil, + labels_lc: Swift.String? = nil, + labels_tags: [Swift.String]? = nil, + entry_dates_tags: [Swift.String]? = nil, + manufacturing_places: Swift.String? = nil, + manufacturing_places_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? = nil, + nova_groups_tags: [Swift.String]? = nil, + nutrient_levels_tags: [Swift.String]? = nil + ) { + self.brands = brands + self.brands_tags = brands_tags + self.categories = categories + self.categories_hierarchy = categories_hierarchy + self.categories_lc = categories_lc + self.categories_tags = categories_tags + self.checkers_tags = checkers_tags + self.cities = cities + self.cities_tags = cities_tags + self.correctors_tags = correctors_tags + self.countries = countries + self.countries_hierarchy = countries_hierarchy + self.countries_lc = countries_lc + self.countries_tags = countries_tags + self.ecoscore_tags = ecoscore_tags + self.emb_codes = emb_codes + self.emb_codes_orig = emb_codes_orig + self.emb_codes_tags = emb_codes_tags + self.labels = labels + self.labels_hierarchy = labels_hierarchy + self.labels_lc = labels_lc + self.labels_tags = labels_tags + self.entry_dates_tags = entry_dates_tags + self.manufacturing_places = manufacturing_places + self.manufacturing_places_tags = manufacturing_places_tags + self.nova_groups_tags = nova_groups_tags + self.nutrient_levels_tags = nutrient_levels_tags + } + public enum CodingKeys: String, CodingKey { + case brands + case brands_tags + case categories + case categories_hierarchy + case categories_lc + case categories_tags + case checkers_tags + case cities + case cities_tags + case correctors_tags + case countries + case countries_hierarchy + case countries_lc + case countries_tags + case ecoscore_tags + case emb_codes + case emb_codes_orig + case emb_codes_tags + case labels + case labels_hierarchy + case labels_lc + case labels_tags + case entry_dates_tags + case manufacturing_places + case manufacturing_places_tags + case nova_groups_tags + case nutrient_levels_tags + } + } + /// - Remark: Generated from `#/components/schemas/image_size`. + public struct image_size: Codable, Hashable, Sendable { + /// The height of the reduced/full image in pixels. + /// + /// + /// - Remark: Generated from `#/components/schemas/image_size/h`. + public var h: Swift.Int? + /// The width of the reduced/full image in pixels. + /// + /// - Remark: Generated from `#/components/schemas/image_size/w`. + public var w: Swift.Int? + /// Creates a new `image_size`. + /// + /// - Parameters: + /// - h: The height of the reduced/full image in pixels. + /// - w: The width of the reduced/full image in pixels. + public init( + h: Swift.Int? = nil, + w: Swift.Int? = nil + ) { + self.h = h + self.w = w + } + public enum CodingKeys: String, CodingKey { + case h + case w + } + } + /// This object represent an image that was uploaded to a product. + /// "imgid" is an integer which is a sequential number unique to each picture. + /// + /// + /// - Remark: Generated from `#/components/schemas/image`. + public struct image: Codable, Hashable, Sendable { + /// The available image sizes for the product (both reduced and full). + /// The reduced images are the ones with numbers as the key( 100, 200 etc) + /// while the full images have `full` as the key. + /// + /// + /// - Remark: Generated from `#/components/schemas/image/sizes`. + public struct sizesPayload: Codable, Hashable, Sendable { + /// properties of fullsize image + /// **TODO** explain how to compute name + /// + /// + /// - Remark: Generated from `#/components/schemas/image/sizes/full`. + public var full: Components.Schemas.image_size? + /// properties of thumbnail of size `image_size`. + /// **TODO** explain how to compute name + /// + /// For real type: see description of property `full`. + /// (Put this way because of a [bug in rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) + /// + /// + /// - Remark: Generated from `#/components/schemas/image/sizes/image_size_example`. + public var image_size_example: Swift.String? + /// Creates a new `sizesPayload`. + /// + /// - Parameters: + /// - full: properties of fullsize image + /// - image_size_example: properties of thumbnail of size `image_size`. + public init( + full: Components.Schemas.image_size? = nil, + image_size_example: Swift.String? = nil + ) { + self.full = full + self.image_size_example = image_size_example + } + public enum CodingKeys: String, CodingKey { + case full + case image_size_example + } + } + /// The available image sizes for the product (both reduced and full). + /// The reduced images are the ones with numbers as the key( 100, 200 etc) + /// while the full images have `full` as the key. + /// + /// + /// - Remark: Generated from `#/components/schemas/image/sizes`. + public var sizes: Components.Schemas.image.sizesPayload? + /// The time the image was uploaded (as unix timestamp). + /// + /// + /// - Remark: Generated from `#/components/schemas/image/uploaded_t`. + public var uploaded_t: Swift.String? + /// The contributor that uploaded the image. + /// + /// + /// - Remark: Generated from `#/components/schemas/image/uploader`. + public var uploader: Swift.String? + /// Creates a new `image`. + /// + /// - Parameters: + /// - sizes: The available image sizes for the product (both reduced and full). + /// - uploaded_t: The time the image was uploaded (as unix timestamp). + /// - uploader: The contributor that uploaded the image. + public init( + sizes: Components.Schemas.image.sizesPayload? = nil, + uploaded_t: Swift.String? = nil, + uploader: Swift.String? = nil + ) { + self.sizes = sizes + self.uploaded_t = uploaded_t + self.uploader = uploader + } + public enum CodingKeys: String, CodingKey { + case sizes + case uploaded_t + case uploader + } + } + /// property of an image (or part thereof) selected for a particular role and a particular language. + /// + /// + /// - Remark: Generated from `#/components/schemas/image_role`. + public struct image_role: Codable, Hashable, Sendable { + /// The angle of the image rotation (if it was rotated). + /// + /// - Remark: Generated from `#/components/schemas/image_role/angle`. + public var angle: Swift.Int? + /// - Remark: Generated from `#/components/schemas/image_role/coordinates_image_size`. + public var coordinates_image_size: Swift.String? + /// - Remark: Generated from `#/components/schemas/image_role/geometry`. + public var geometry: Swift.String? + /// The id of the original/source image that was selected to edit(rotate, normalize etc) to produce this new image. + /// + /// - Remark: Generated from `#/components/schemas/image_role/imgid`. + public var imgid: Swift.String? + /// - Remark: Generated from `#/components/schemas/image_role/rev`. + public var rev: Swift.String? + /// The available image sizes for the product (both reduced and full). + /// The reduced images are the ones with numbers as the key( 100, 200 etc) + /// while the full images have `full` as the key. + /// + /// + /// - Remark: Generated from `#/components/schemas/image_role/sizes`. + public struct sizesPayload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/image_role/sizes/100`. + public var _100: Components.Schemas.image_size? + /// - Remark: Generated from `#/components/schemas/image_role/sizes/200`. + public var _200: Components.Schemas.image_size? + /// - Remark: Generated from `#/components/schemas/image_role/sizes/400`. + public var _400: Components.Schemas.image_size? + /// - Remark: Generated from `#/components/schemas/image_role/sizes/full`. + public var full: Components.Schemas.image_size? + /// Creates a new `sizesPayload`. + /// + /// - Parameters: + /// - _100: + /// - _200: + /// - _400: + /// - full: + public init( + _100: Components.Schemas.image_size? = nil, + _200: Components.Schemas.image_size? = nil, + _400: Components.Schemas.image_size? = nil, + full: Components.Schemas.image_size? = nil + ) { + self._100 = _100 + self._200 = _200 + self._400 = _400 + self.full = full + } + public enum CodingKeys: String, CodingKey { + case _100 = "100" + case _200 = "200" + case _400 = "400" + case full + } + } + /// The available image sizes for the product (both reduced and full). + /// The reduced images are the ones with numbers as the key( 100, 200 etc) + /// while the full images have `full` as the key. + /// + /// + /// - Remark: Generated from `#/components/schemas/image_role/sizes`. + public var sizes: Components.Schemas.image_role.sizesPayload? + /// - Remark: Generated from `#/components/schemas/image_role/x1`. + public var x1: Swift.String? + /// - Remark: Generated from `#/components/schemas/image_role/x2`. + public var x2: Swift.String? + /// - Remark: Generated from `#/components/schemas/image_role/y1`. + public var y1: Swift.String? + /// - Remark: Generated from `#/components/schemas/image_role/y2`. + public var y2: Swift.String? + /// Creates a new `image_role`. + /// + /// - Parameters: + /// - angle: The angle of the image rotation (if it was rotated). + /// - coordinates_image_size: + /// - geometry: + /// - imgid: The id of the original/source image that was selected to edit(rotate, normalize etc) to produce this new image. + /// - rev: + /// - sizes: The available image sizes for the product (both reduced and full). + /// - x1: + /// - x2: + /// - y1: + /// - y2: + public init( + angle: Swift.Int? = nil, + coordinates_image_size: Swift.String? = nil, + geometry: Swift.String? = nil, + imgid: Swift.String? = nil, + rev: Swift.String? = nil, + sizes: Components.Schemas.image_role.sizesPayload? = nil, + x1: Swift.String? = nil, + x2: Swift.String? = nil, + y1: Swift.String? = nil, + y2: Swift.String? = nil + ) { + self.angle = angle + self.coordinates_image_size = coordinates_image_size + self.geometry = geometry + self.imgid = imgid + self.rev = rev + self.sizes = sizes + self.x1 = x1 + self.x2 = x2 + self.y1 = y1 + self.y2 = y2 + } + public enum CodingKeys: String, CodingKey { + case angle + case coordinates_image_size + case geometry + case imgid + case rev + case sizes + case x1 + case x2 + case y1 + case y2 + } + } + /// - Remark: Generated from `#/components/schemas/image_urls`. + public struct image_urls: Codable, Hashable, Sendable { + /// url of the image for language `language_code` + /// + /// - Remark: Generated from `#/components/schemas/image_urls/language_code_example`. + public var language_code_example: Swift.String? + /// Creates a new `image_urls`. + /// + /// - Parameters: + /// - language_code_example: url of the image for language `language_code` + public init(language_code_example: Swift.String? = nil) { + self.language_code_example = language_code_example + } + public enum CodingKeys: String, CodingKey { + case language_code_example + } + } + /// Information about Images of a product. + /// + /// Images ensure the reliability of Open Food Facts data. + /// It provides a primary source and proof of all the structured data. + /// You may therefore want to display it along the structured information. + /// + /// See also tutorials about images: + /// * [Getting images](https://openfoodfacts.github.io/openfoodfacts-server/api/how-to-download-images/) + /// * [Uploading images](https://openfoodfacts.github.io/openfoodfacts-server/api/tutorial-uploading-photo-to-a-product/) + /// + /// + /// - Remark: Generated from `#/components/schemas/product_images`. + public struct product_images: Codable, Hashable, Sendable { + /// This contains properties for all images contained on the product. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_images/images`. + public struct imagesPayload: Codable, Hashable, Sendable { + /// This represents an image uploaded for this product. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_images/images/1`. + public var _1: Components.Schemas.image? + /// This represents an image (or part of it) selected for a specific role on this product. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_images/images/front`. + public var front: Components.Schemas.image_role? + /// See property `1` to get the real type of those objects + /// (Put this way because of a [bug in rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) + /// + /// + /// - Remark: Generated from `#/components/schemas/product_images/images/imgid_example`. + public var imgid_example: Swift.String? + /// See property `front` to get the real type of those objects + /// (Put this way because of a [bug in rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) + /// + /// + /// - Remark: Generated from `#/components/schemas/product_images/images/image_type_example`. + public var image_type_example: Swift.String? + /// Creates a new `imagesPayload`. + /// + /// - Parameters: + /// - _1: This represents an image uploaded for this product. + /// - front: This represents an image (or part of it) selected for a specific role on this product. + /// - imgid_example: See property `1` to get the real type of those objects + /// - image_type_example: See property `front` to get the real type of those objects + public init( + _1: Components.Schemas.image? = nil, + front: Components.Schemas.image_role? = nil, + imgid_example: Swift.String? = nil, + image_type_example: Swift.String? = nil + ) { + self._1 = _1 + self.front = front + self.imgid_example = imgid_example + self.image_type_example = image_type_example + } + public enum CodingKeys: String, CodingKey { + case _1 = "1" + case front + case imgid_example + case image_type_example + } + } + /// This contains properties for all images contained on the product. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_images/images`. + public var images: Components.Schemas.product_images.imagesPayload? + /// - Remark: Generated from `#/components/schemas/product_images/last_image_dates_tags`. + public var last_image_dates_tags: [Swift.String]? + /// timestamp of last image upload (or update?) + /// + /// - Remark: Generated from `#/components/schemas/product_images/last_image_t`. + public var last_image_t: Swift.Int? + /// URL for selected (important) images of the product. + /// + /// This is very handy if you display the product to users. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_images/selected_images`. + public struct selected_imagesPayload: Codable, Hashable, Sendable { + /// URLs of thumbnails image of image of type `image_type` + /// + /// - Remark: Generated from `#/components/schemas/product_images/selected_images/front`. + public struct frontPayload: Codable, Hashable, Sendable { + /// Thumbnail urls of product image (front) adapted to display on product page + /// + /// + /// - Remark: Generated from `#/components/schemas/product_images/selected_images/front/display`. + public var display: Components.Schemas.image_urls? + /// Thumbnail urls of product image (front) adapted to display on product list page + /// + /// + /// - Remark: Generated from `#/components/schemas/product_images/selected_images/front/small`. + public var small: Components.Schemas.image_urls? + /// Thumbnail urls of product image (front) in smallest format + /// + /// + /// - Remark: Generated from `#/components/schemas/product_images/selected_images/front/thumb`. + public var thumb: Components.Schemas.image_urls? + /// Creates a new `frontPayload`. + /// + /// - Parameters: + /// - display: Thumbnail urls of product image (front) adapted to display on product page + /// - small: Thumbnail urls of product image (front) adapted to display on product list page + /// - thumb: Thumbnail urls of product image (front) in smallest format + public init( + display: Components.Schemas.image_urls? = nil, + small: Components.Schemas.image_urls? = nil, + thumb: Components.Schemas.image_urls? = nil + ) { + self.display = display + self.small = small + self.thumb = thumb + } + public enum CodingKeys: String, CodingKey { + case display + case small + case thumb + } + } + /// URLs of thumbnails image of image of type `image_type` + /// + /// - Remark: Generated from `#/components/schemas/product_images/selected_images/front`. + public var front: Components.Schemas.product_images.selected_imagesPayload.frontPayload? + /// See property `front` to get the real type of those objects + /// (Put this way because of a [bug in rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) + /// + /// + /// - Remark: Generated from `#/components/schemas/product_images/selected_images/image_type_example`. + public var image_type_example: Swift.String? + /// Creates a new `selected_imagesPayload`. + /// + /// - Parameters: + /// - front: URLs of thumbnails image of image of type `image_type` + /// - image_type_example: See property `front` to get the real type of those objects + public init( + front: Components.Schemas.product_images.selected_imagesPayload.frontPayload? = nil, + image_type_example: Swift.String? = nil + ) { + self.front = front + self.image_type_example = image_type_example + } + public enum CodingKeys: String, CodingKey { + case front + case image_type_example + } + } + /// URL for selected (important) images of the product. + /// + /// This is very handy if you display the product to users. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_images/selected_images`. + public var selected_images: Components.Schemas.product_images.selected_imagesPayload? + /// - Remark: Generated from `#/components/schemas/product_images/image_small_url`. + public var image_small_url: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_images/image_thumb_url`. + public var image_thumb_url: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_images/image_url`. + public var image_url: Swift.String? + /// Creates a new `product_images`. + /// + /// - Parameters: + /// - images: This contains properties for all images contained on the product. + /// - last_image_dates_tags: + /// - last_image_t: timestamp of last image upload (or update?) + /// - selected_images: URL for selected (important) images of the product. + /// - image_small_url: + /// - image_thumb_url: + /// - image_url: + public init( + images: Components.Schemas.product_images.imagesPayload? = nil, + last_image_dates_tags: [Swift.String]? = nil, + last_image_t: Swift.Int? = nil, + selected_images: Components.Schemas.product_images.selected_imagesPayload? = nil, + image_small_url: Swift.String? = nil, + image_thumb_url: Swift.String? = nil, + image_url: Swift.String? = nil + ) { + self.images = images + self.last_image_dates_tags = last_image_dates_tags + self.last_image_t = last_image_t + self.selected_images = selected_images + self.image_small_url = image_small_url + self.image_thumb_url = image_thumb_url + self.image_url = image_url + } + public enum CodingKeys: String, CodingKey { + case images + case last_image_dates_tags + case last_image_t + case selected_images + case image_small_url + case image_thumb_url + case image_url + } + } + /// - Remark: Generated from `#/components/schemas/agribalyse`. + public struct agribalyse: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/agribalyse/agribalyse_food_code`. + public var agribalyse_food_code: Swift.String? + /// - Remark: Generated from `#/components/schemas/agribalyse/co2_agriculture`. + public var co2_agriculture: Swift.Double? + /// - Remark: Generated from `#/components/schemas/agribalyse/co2_consumption`. + public var co2_consumption: Swift.Int? + /// - Remark: Generated from `#/components/schemas/agribalyse/co2_distribution`. + public var co2_distribution: Swift.Double? + /// - Remark: Generated from `#/components/schemas/agribalyse/co2_packaging`. + public var co2_packaging: Swift.Double? + /// - Remark: Generated from `#/components/schemas/agribalyse/co2_processing`. + public var co2_processing: Swift.Double? + /// - Remark: Generated from `#/components/schemas/agribalyse/co2_total`. + public var co2_total: Swift.Double? + /// - Remark: Generated from `#/components/schemas/agribalyse/co2_transportation`. + public var co2_transportation: Swift.Double? + /// - Remark: Generated from `#/components/schemas/agribalyse/code`. + public var code: Swift.String? + /// - Remark: Generated from `#/components/schemas/agribalyse/dqr`. + public var dqr: Swift.String? + /// - Remark: Generated from `#/components/schemas/agribalyse/ef_agriculture`. + public var ef_agriculture: Swift.Double? + /// - Remark: Generated from `#/components/schemas/agribalyse/ef_consumption`. + public var ef_consumption: Swift.Int? + /// - Remark: Generated from `#/components/schemas/agribalyse/ef_distribution`. + public var ef_distribution: Swift.Double? + /// - Remark: Generated from `#/components/schemas/agribalyse/ef_packaging`. + public var ef_packaging: Swift.Double? + /// - Remark: Generated from `#/components/schemas/agribalyse/ef_processing`. + public var ef_processing: Swift.Double? + /// - Remark: Generated from `#/components/schemas/agribalyse/ef_total`. + public var ef_total: Swift.Double? + /// - Remark: Generated from `#/components/schemas/agribalyse/ef_transportation`. + public var ef_transportation: Swift.Double? + /// - Remark: Generated from `#/components/schemas/agribalyse/is_beverage`. + public var is_beverage: Swift.Int? + /// This can be returned in many other languages + /// like name_fr (for french). + /// + /// + /// - Remark: Generated from `#/components/schemas/agribalyse/name_en`. + public var name_en: Swift.String? + /// - Remark: Generated from `#/components/schemas/agribalyse/score`. + public var score: Swift.Int? + /// - Remark: Generated from `#/components/schemas/agribalyse/version`. + public var version: Swift.String? + /// Creates a new `agribalyse`. + /// + /// - Parameters: + /// - agribalyse_food_code: + /// - co2_agriculture: + /// - co2_consumption: + /// - co2_distribution: + /// - co2_packaging: + /// - co2_processing: + /// - co2_total: + /// - co2_transportation: + /// - code: + /// - dqr: + /// - ef_agriculture: + /// - ef_consumption: + /// - ef_distribution: + /// - ef_packaging: + /// - ef_processing: + /// - ef_total: + /// - ef_transportation: + /// - is_beverage: + /// - name_en: This can be returned in many other languages + /// - score: + /// - version: + public init( + agribalyse_food_code: Swift.String? = nil, + co2_agriculture: Swift.Double? = nil, + co2_consumption: Swift.Int? = nil, + co2_distribution: Swift.Double? = nil, + co2_packaging: Swift.Double? = nil, + co2_processing: Swift.Double? = nil, + co2_total: Swift.Double? = nil, + co2_transportation: Swift.Double? = nil, + code: Swift.String? = nil, + dqr: Swift.String? = nil, + ef_agriculture: Swift.Double? = nil, + ef_consumption: Swift.Int? = nil, + ef_distribution: Swift.Double? = nil, + ef_packaging: Swift.Double? = nil, + ef_processing: Swift.Double? = nil, + ef_total: Swift.Double? = nil, + ef_transportation: Swift.Double? = nil, + is_beverage: Swift.Int? = nil, + name_en: Swift.String? = nil, + score: Swift.Int? = nil, + version: Swift.String? = nil + ) { + self.agribalyse_food_code = agribalyse_food_code + self.co2_agriculture = co2_agriculture + self.co2_consumption = co2_consumption + self.co2_distribution = co2_distribution + self.co2_packaging = co2_packaging + self.co2_processing = co2_processing + self.co2_total = co2_total + self.co2_transportation = co2_transportation + self.code = code + self.dqr = dqr + self.ef_agriculture = ef_agriculture + self.ef_consumption = ef_consumption + self.ef_distribution = ef_distribution + self.ef_packaging = ef_packaging + self.ef_processing = ef_processing + self.ef_total = ef_total + self.ef_transportation = ef_transportation + self.is_beverage = is_beverage + self.name_en = name_en + self.score = score + self.version = version + } + public enum CodingKeys: String, CodingKey { + case agribalyse_food_code + case co2_agriculture + case co2_consumption + case co2_distribution + case co2_packaging + case co2_processing + case co2_total + case co2_transportation + case code + case dqr + case ef_agriculture + case ef_consumption + case ef_distribution + case ef_packaging + case ef_processing + case ef_total + case ef_transportation + case is_beverage + case name_en + case score + case version + } + } + /// Fields related to Eco-Score for a product. + /// + /// See also: `ecoscore_score`, `ecoscore_grade` and `ecoscore_tags`. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_ecoscore`. + public struct product_ecoscore: Codable, Hashable, Sendable { + /// An object about a lot of details about data needed for Eco-Score computation + /// and complementary data of interest. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data`. + public struct ecoscore_dataPayload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments`. + public struct adjustmentsPayload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/origins_of_ingredients`. + public struct origins_of_ingredientsPayload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/origins_of_ingredients/aggregated_originsPayload`. + public struct aggregated_originsPayloadPayload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/origins_of_ingredients/aggregated_originsPayload/origin`. + public var origin: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/origins_of_ingredients/aggregated_originsPayload/percent`. + public var percent: Swift.Int? + /// Creates a new `aggregated_originsPayloadPayload`. + /// + /// - Parameters: + /// - origin: + /// - percent: + public init( + origin: Swift.String? = nil, + percent: Swift.Int? = nil + ) { + self.origin = origin + self.percent = percent + } + public enum CodingKeys: String, CodingKey { + case origin + case percent + } + } + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/origins_of_ingredients/aggregated_origins`. + public typealias aggregated_originsPayload = [Components.Schemas.product_ecoscore.ecoscore_dataPayload.adjustmentsPayload.origins_of_ingredientsPayload.aggregated_originsPayloadPayload] + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/origins_of_ingredients/aggregated_origins`. + public var aggregated_origins: Components.Schemas.product_ecoscore.ecoscore_dataPayload.adjustmentsPayload.origins_of_ingredientsPayload.aggregated_originsPayload? + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/origins_of_ingredients/epi_score`. + public var epi_score: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/origins_of_ingredients/epi_value`. + public var epi_value: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/origins_of_ingredients/origins_from_origins_field`. + public var origins_from_origins_field: [Swift.String]? + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/origins_of_ingredients/transportation_scores`. + public struct transportation_scoresPayload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/origins_of_ingredients/transportation_scores/language_code_example`. + public var language_code_example: Swift.Int? + /// Creates a new `transportation_scoresPayload`. + /// + /// - Parameters: + /// - language_code_example: + public init(language_code_example: Swift.Int? = nil) { + self.language_code_example = language_code_example + } + public enum CodingKeys: String, CodingKey { + case language_code_example + } + } + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/origins_of_ingredients/transportation_scores`. + public var transportation_scores: Components.Schemas.product_ecoscore.ecoscore_dataPayload.adjustmentsPayload.origins_of_ingredientsPayload.transportation_scoresPayload? + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/origins_of_ingredients/transportation_values`. + public struct transportation_valuesPayload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/origins_of_ingredients/transportation_values/language_code_example`. + public var language_code_example: Swift.Int? + /// Creates a new `transportation_valuesPayload`. + /// + /// - Parameters: + /// - language_code_example: + public init(language_code_example: Swift.Int? = nil) { + self.language_code_example = language_code_example + } + public enum CodingKeys: String, CodingKey { + case language_code_example + } + } + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/origins_of_ingredients/transportation_values`. + public var transportation_values: Components.Schemas.product_ecoscore.ecoscore_dataPayload.adjustmentsPayload.origins_of_ingredientsPayload.transportation_valuesPayload? + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/origins_of_ingredients/values`. + public struct valuesPayload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/origins_of_ingredients/values/language_code_example`. + public var language_code_example: Swift.Int? + /// Creates a new `valuesPayload`. + /// + /// - Parameters: + /// - language_code_example: + public init(language_code_example: Swift.Int? = nil) { + self.language_code_example = language_code_example + } + public enum CodingKeys: String, CodingKey { + case language_code_example + } + } + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/origins_of_ingredients/values`. + public var values: Components.Schemas.product_ecoscore.ecoscore_dataPayload.adjustmentsPayload.origins_of_ingredientsPayload.valuesPayload? + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/origins_of_ingredients/warning`. + public var warning: Swift.String? + /// Creates a new `origins_of_ingredientsPayload`. + /// + /// - Parameters: + /// - aggregated_origins: + /// - epi_score: + /// - epi_value: + /// - origins_from_origins_field: + /// - transportation_scores: + /// - transportation_values: + /// - values: + /// - warning: + public init( + aggregated_origins: Components.Schemas.product_ecoscore.ecoscore_dataPayload.adjustmentsPayload.origins_of_ingredientsPayload.aggregated_originsPayload? = nil, + epi_score: Swift.Int? = nil, + epi_value: Swift.Int? = nil, + origins_from_origins_field: [Swift.String]? = nil, + transportation_scores: Components.Schemas.product_ecoscore.ecoscore_dataPayload.adjustmentsPayload.origins_of_ingredientsPayload.transportation_scoresPayload? = nil, + transportation_values: Components.Schemas.product_ecoscore.ecoscore_dataPayload.adjustmentsPayload.origins_of_ingredientsPayload.transportation_valuesPayload? = nil, + values: Components.Schemas.product_ecoscore.ecoscore_dataPayload.adjustmentsPayload.origins_of_ingredientsPayload.valuesPayload? = nil, + warning: Swift.String? = nil + ) { + self.aggregated_origins = aggregated_origins + self.epi_score = epi_score + self.epi_value = epi_value + self.origins_from_origins_field = origins_from_origins_field + self.transportation_scores = transportation_scores + self.transportation_values = transportation_values + self.values = values + self.warning = warning + } + public enum CodingKeys: String, CodingKey { + case aggregated_origins + case epi_score + case epi_value + case origins_from_origins_field + case transportation_scores + case transportation_values + case values + case warning + } + } + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/origins_of_ingredients`. + public var origins_of_ingredients: Components.Schemas.product_ecoscore.ecoscore_dataPayload.adjustmentsPayload.origins_of_ingredientsPayload? + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/packaging`. + public struct packagingPayload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/packaging/non_recyclable_and_non_biodegradable_materials`. + public var non_recyclable_and_non_biodegradable_materials: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/packaging/packagingsPayload`. + public struct packagingsPayloadPayload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/packaging/packagingsPayload/ecoscore_material_score`. + public var ecoscore_material_score: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/packaging/packagingsPayload/ecoscore_shape_ratio`. + public var ecoscore_shape_ratio: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/packaging/packagingsPayload/material`. + public var material: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/packaging/packagingsPayload/shape`. + public var shape: Swift.String? + /// Creates a new `packagingsPayloadPayload`. + /// + /// - Parameters: + /// - ecoscore_material_score: + /// - ecoscore_shape_ratio: + /// - material: + /// - shape: + public init( + ecoscore_material_score: Swift.Int? = nil, + ecoscore_shape_ratio: Swift.Int? = nil, + material: Swift.String? = nil, + shape: Swift.String? = nil + ) { + self.ecoscore_material_score = ecoscore_material_score + self.ecoscore_shape_ratio = ecoscore_shape_ratio + self.material = material + self.shape = shape + } + public enum CodingKeys: String, CodingKey { + case ecoscore_material_score + case ecoscore_shape_ratio + case material + case shape + } + } + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/packaging/packagings`. + public typealias packagingsPayload = [Components.Schemas.product_ecoscore.ecoscore_dataPayload.adjustmentsPayload.packagingPayload.packagingsPayloadPayload] + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/packaging/packagings`. + public var packagings: Components.Schemas.product_ecoscore.ecoscore_dataPayload.adjustmentsPayload.packagingPayload.packagingsPayload? + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/packaging/score`. + public var score: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/packaging/value`. + public var value: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/packaging/warning`. + public var warning: Swift.String? + /// Creates a new `packagingPayload`. + /// + /// - Parameters: + /// - non_recyclable_and_non_biodegradable_materials: + /// - packagings: + /// - score: + /// - value: + /// - warning: + public init( + non_recyclable_and_non_biodegradable_materials: Swift.Int? = nil, + packagings: Components.Schemas.product_ecoscore.ecoscore_dataPayload.adjustmentsPayload.packagingPayload.packagingsPayload? = nil, + score: Swift.Int? = nil, + value: Swift.Int? = nil, + warning: Swift.String? = nil + ) { + self.non_recyclable_and_non_biodegradable_materials = non_recyclable_and_non_biodegradable_materials + self.packagings = packagings + self.score = score + self.value = value + self.warning = warning + } + public enum CodingKeys: String, CodingKey { + case non_recyclable_and_non_biodegradable_materials + case packagings + case score + case value + case warning + } + } + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/packaging`. + public var packaging: Components.Schemas.product_ecoscore.ecoscore_dataPayload.adjustmentsPayload.packagingPayload? + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/production_system`. + public struct production_systemPayload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/production_system/labels`. + public var labels: [Swift.String]? + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/production_system/value`. + public var value: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/production_system/warning`. + public var warning: Swift.String? + /// Creates a new `production_systemPayload`. + /// + /// - Parameters: + /// - labels: + /// - value: + /// - warning: + public init( + labels: [Swift.String]? = nil, + value: Swift.Int? = nil, + warning: Swift.String? = nil + ) { + self.labels = labels + self.value = value + self.warning = warning + } + public enum CodingKeys: String, CodingKey { + case labels + case value + case warning + } + } + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/production_system`. + public var production_system: Components.Schemas.product_ecoscore.ecoscore_dataPayload.adjustmentsPayload.production_systemPayload? + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/threatened_species`. + public struct threatened_speciesPayload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/threatened_species/ingredient`. + public var ingredient: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/threatened_species/value`. + public var value: Swift.Int? + /// Creates a new `threatened_speciesPayload`. + /// + /// - Parameters: + /// - ingredient: + /// - value: + public init( + ingredient: Swift.String? = nil, + value: Swift.Int? = nil + ) { + self.ingredient = ingredient + self.value = value + } + public enum CodingKeys: String, CodingKey { + case ingredient + case value + } + } + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/threatened_species`. + public var threatened_species: Components.Schemas.product_ecoscore.ecoscore_dataPayload.adjustmentsPayload.threatened_speciesPayload? + /// Creates a new `adjustmentsPayload`. + /// + /// - Parameters: + /// - origins_of_ingredients: + /// - packaging: + /// - production_system: + /// - threatened_species: + public init( + origins_of_ingredients: Components.Schemas.product_ecoscore.ecoscore_dataPayload.adjustmentsPayload.origins_of_ingredientsPayload? = nil, + packaging: Components.Schemas.product_ecoscore.ecoscore_dataPayload.adjustmentsPayload.packagingPayload? = nil, + production_system: Components.Schemas.product_ecoscore.ecoscore_dataPayload.adjustmentsPayload.production_systemPayload? = nil, + threatened_species: Components.Schemas.product_ecoscore.ecoscore_dataPayload.adjustmentsPayload.threatened_speciesPayload? = nil + ) { + self.origins_of_ingredients = origins_of_ingredients + self.packaging = packaging + self.production_system = production_system + self.threatened_species = threatened_species + } + public enum CodingKeys: String, CodingKey { + case origins_of_ingredients + case packaging + case production_system + case threatened_species + } + } + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments`. + public var adjustments: Components.Schemas.product_ecoscore.ecoscore_dataPayload.adjustmentsPayload? + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/agribalyse`. + public var agribalyse: Components.Schemas.agribalyse? + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/grade`. + public var grade: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/grades`. + public struct gradesPayload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/grades/language_code_example`. + public var language_code_example: Swift.String? + /// Creates a new `gradesPayload`. + /// + /// - Parameters: + /// - language_code_example: + public init(language_code_example: Swift.String? = nil) { + self.language_code_example = language_code_example + } + public enum CodingKeys: String, CodingKey { + case language_code_example + } + } + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/grades`. + public var grades: Components.Schemas.product_ecoscore.ecoscore_dataPayload.gradesPayload? + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/missing`. + public struct missingPayload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/missing/labels`. + public var labels: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/missing/origins`. + public var origins: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/missing/packagings`. + public var packagings: Swift.Int? + /// Creates a new `missingPayload`. + /// + /// - Parameters: + /// - labels: + /// - origins: + /// - packagings: + public init( + labels: Swift.Int? = nil, + origins: Swift.Int? = nil, + packagings: Swift.Int? = nil + ) { + self.labels = labels + self.origins = origins + self.packagings = packagings + } + public enum CodingKeys: String, CodingKey { + case labels + case origins + case packagings + } + } + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/missing`. + public var missing: Components.Schemas.product_ecoscore.ecoscore_dataPayload.missingPayload? + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/missing_data_warning`. + public var missing_data_warning: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/previous_data`. + public struct previous_dataPayload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/previous_data/grade`. + public var grade: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/previous_data/score`. + public var score: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/previous_data/agribalyse`. + public var agribalyse: Components.Schemas.agribalyse? + /// Creates a new `previous_dataPayload`. + /// + /// - Parameters: + /// - grade: + /// - score: + /// - agribalyse: + public init( + grade: Swift.String? = nil, + score: Swift.Int? = nil, + agribalyse: Components.Schemas.agribalyse? = nil + ) { + self.grade = grade + self.score = score + self.agribalyse = agribalyse + } + public enum CodingKeys: String, CodingKey { + case grade + case score + case agribalyse + } + } + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/previous_data`. + public var previous_data: Components.Schemas.product_ecoscore.ecoscore_dataPayload.previous_dataPayload? + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/score`. + public var score: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/scores`. + public struct scoresPayload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/scores/language_code_example`. + public var language_code_example: Swift.Int? + /// Creates a new `scoresPayload`. + /// + /// - Parameters: + /// - language_code_example: + public init(language_code_example: Swift.Int? = nil) { + self.language_code_example = language_code_example + } + public enum CodingKeys: String, CodingKey { + case language_code_example + } + } + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/scores`. + public var scores: Components.Schemas.product_ecoscore.ecoscore_dataPayload.scoresPayload? + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/status`. + public var status: Swift.String? + /// Creates a new `ecoscore_dataPayload`. + /// + /// - Parameters: + /// - adjustments: + /// - agribalyse: + /// - grade: + /// - grades: + /// - missing: + /// - missing_data_warning: + /// - previous_data: + /// - score: + /// - scores: + /// - status: + public init( + adjustments: Components.Schemas.product_ecoscore.ecoscore_dataPayload.adjustmentsPayload? = nil, + agribalyse: Components.Schemas.agribalyse? = nil, + grade: Swift.String? = nil, + grades: Components.Schemas.product_ecoscore.ecoscore_dataPayload.gradesPayload? = nil, + missing: Components.Schemas.product_ecoscore.ecoscore_dataPayload.missingPayload? = nil, + missing_data_warning: Swift.Int? = nil, + previous_data: Components.Schemas.product_ecoscore.ecoscore_dataPayload.previous_dataPayload? = nil, + score: Swift.Int? = nil, + scores: Components.Schemas.product_ecoscore.ecoscore_dataPayload.scoresPayload? = nil, + status: Swift.String? = nil + ) { + self.adjustments = adjustments + self.agribalyse = agribalyse + self.grade = grade + self.grades = grades + self.missing = missing + self.missing_data_warning = missing_data_warning + self.previous_data = previous_data + self.score = score + self.scores = scores + self.status = status + } + public enum CodingKeys: String, CodingKey { + case adjustments + case agribalyse + case grade + case grades + case missing + case missing_data_warning + case previous_data + case score + case scores + case status + } + } + /// An object about a lot of details about data needed for Eco-Score computation + /// and complementary data of interest. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data`. + public var ecoscore_data: Components.Schemas.product_ecoscore.ecoscore_dataPayload? + /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_extended_data_version`. + public var ecoscore_extended_data_version: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_ecoscore/environment_impact_level`. + public var environment_impact_level: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_ecoscore/environment_impact_level_tags`. + public var environment_impact_level_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? + /// Creates a new `product_ecoscore`. + /// + /// - Parameters: + /// - ecoscore_data: An object about a lot of details about data needed for Eco-Score computation + /// - ecoscore_extended_data_version: + /// - environment_impact_level: + /// - environment_impact_level_tags: + public init( + ecoscore_data: Components.Schemas.product_ecoscore.ecoscore_dataPayload? = nil, + ecoscore_extended_data_version: Swift.String? = nil, + environment_impact_level: Swift.String? = nil, + environment_impact_level_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? = nil + ) { + self.ecoscore_data = ecoscore_data + self.ecoscore_extended_data_version = ecoscore_extended_data_version + self.environment_impact_level = environment_impact_level + self.environment_impact_level_tags = environment_impact_level_tags + } + public enum CodingKeys: String, CodingKey { + case ecoscore_data + case ecoscore_extended_data_version + case environment_impact_level + case environment_impact_level_tags + } + } + /// - Remark: Generated from `#/components/schemas/ingredient`. + public struct ingredientPayload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/ingredient/id`. + public var id: Swift.String? + /// - Remark: Generated from `#/components/schemas/ingredient/percent`. + public var percent: Swift.Int? + /// - Remark: Generated from `#/components/schemas/ingredient/percent_estimate`. + public var percent_estimate: Swift.Double? + /// - Remark: Generated from `#/components/schemas/ingredient/percent_max`. + public var percent_max: Swift.Double? + /// - Remark: Generated from `#/components/schemas/ingredient/percent_min`. + public var percent_min: Swift.Int? + /// - Remark: Generated from `#/components/schemas/ingredient/text`. + public var text: Swift.String? + /// - Remark: Generated from `#/components/schemas/ingredient/vegan`. + public var vegan: Swift.String? + /// - Remark: Generated from `#/components/schemas/ingredient/vegetarian`. + public var vegetarian: Swift.String? + /// Creates a new `ingredientPayload`. + /// + /// - Parameters: + /// - id: + /// - percent: + /// - percent_estimate: + /// - percent_max: + /// - percent_min: + /// - text: + /// - vegan: + /// - vegetarian: + public init( + id: Swift.String? = nil, + percent: Swift.Int? = nil, + percent_estimate: Swift.Double? = nil, + percent_max: Swift.Double? = nil, + percent_min: Swift.Int? = nil, + text: Swift.String? = nil, + vegan: Swift.String? = nil, + vegetarian: Swift.String? = nil + ) { + self.id = id + self.percent = percent + self.percent_estimate = percent_estimate + self.percent_max = percent_max + self.percent_min = percent_min + self.text = text + self.vegan = vegan + self.vegetarian = vegetarian + } + public enum CodingKeys: String, CodingKey { + case id + case percent + case percent_estimate + case percent_max + case percent_min + case text + case vegan + case vegetarian + } + } + /// This structure gives the different ingredients and some information about them, + /// like estimate on their quantity. + /// + /// + /// - Remark: Generated from `#/components/schemas/ingredient`. + public typealias ingredient = [Components.Schemas.ingredientPayload] + /// Fields about ingredients of a product + /// + /// - Remark: Generated from `#/components/schemas/product_ingredients`. + public struct product_ingredients: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/product_ingredients/additives_tags`. + public var additives_tags: [Swift.String]? + /// comma separated list of allergens + /// + /// - Remark: Generated from `#/components/schemas/product_ingredients/allergens`. + public var allergens: Swift.String? + /// language in which `allergens` where input + /// + /// - Remark: Generated from `#/components/schemas/product_ingredients/allergens_lc`. + public var allergens_lc: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_ingredients/allergens_hierarchy`. + public var allergens_hierarchy: [Swift.String]? + /// - Remark: Generated from `#/components/schemas/product_ingredients/allergens_tags`. + public var allergens_tags: [Swift.String]? + /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients`. + public var ingredients: Components.Schemas.ingredient? + /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_analysis`. + public struct ingredients_analysisPayload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_analysis/en:palm-oil`. + public var en_colon_palm_hyphen_oil: [Swift.String]? + /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_analysis/en:vegan-status-unknown`. + public var en_colon_vegan_hyphen_status_hyphen_unknown: [Swift.String]? + /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_analysis/en:vegetarian-status-unknown`. + public var en_colon_vegetarian_hyphen_status_hyphen_unknown: [Swift.String]? + /// Creates a new `ingredients_analysisPayload`. + /// + /// - Parameters: + /// - en_colon_palm_hyphen_oil: + /// - en_colon_vegan_hyphen_status_hyphen_unknown: + /// - en_colon_vegetarian_hyphen_status_hyphen_unknown: + public init( + en_colon_palm_hyphen_oil: [Swift.String]? = nil, + en_colon_vegan_hyphen_status_hyphen_unknown: [Swift.String]? = nil, + en_colon_vegetarian_hyphen_status_hyphen_unknown: [Swift.String]? = nil + ) { + self.en_colon_palm_hyphen_oil = en_colon_palm_hyphen_oil + self.en_colon_vegan_hyphen_status_hyphen_unknown = en_colon_vegan_hyphen_status_hyphen_unknown + self.en_colon_vegetarian_hyphen_status_hyphen_unknown = en_colon_vegetarian_hyphen_status_hyphen_unknown + } + public enum CodingKeys: String, CodingKey { + case en_colon_palm_hyphen_oil = "en:palm-oil" + case en_colon_vegan_hyphen_status_hyphen_unknown = "en:vegan-status-unknown" + case en_colon_vegetarian_hyphen_status_hyphen_unknown = "en:vegetarian-status-unknown" + } + } + /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_analysis`. + public var ingredients_analysis: Components.Schemas.product_ingredients.ingredients_analysisPayload? + /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_analysis_tags`. + public var ingredients_analysis_tags: [Swift.String]? + /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_from_or_that_may_be_from_palm_oil_n`. + public var ingredients_from_or_that_may_be_from_palm_oil_n: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_from_palm_oil_n`. + public var ingredients_from_palm_oil_n: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_from_palm_oil_tags`. + public var ingredients_from_palm_oil_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? + /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_hierarchy`. + public var ingredients_hierarchy: [Swift.String]? + /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_n`. + public var ingredients_n: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_n_tags`. + public var ingredients_n_tags: [Swift.String]? + /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_original_tags`. + public var ingredients_original_tags: [Swift.String]? + /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_percent_analysis`. + public var ingredients_percent_analysis: Swift.Int? + /// Number of sweeteners additives in the ingredients. Undefined if ingredients are not specified. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_sweeteners_n`. + public var ingredients_sweeteners_n: Swift.Int? + /// Number of non-nutritive sweeteners additives (as specified in the Nutri-Score formula) in the ingredients. Undefined if ingredients are not specified. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_non_nutritive_sweeteners_n`. + public var ingredients_non_nutritive_sweeteners_n: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_tags`. + public var ingredients_tags: [Swift.String]? + /// Language that was used to parse the ingredient list. If `ingredients_text` is available + /// for the product main language (`lang`), `ingredients_lc=lang`, otherwise we look at + /// `ingredients_text` fields for other languages and set `ingredients_lc` to the first + /// non-empty `ingredient_text`. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_lc`. + public var ingredients_lc: Swift.String? + /// Raw list of ingredients. This will get automatically + /// parsed and get used to compute the Eco-Score or find allergens, etc.. + /// + /// It's a copy of ingredients_text in the main language of the product (see `lang` proprety). + /// + /// + /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_text`. + public var ingredients_text: Swift.String? + /// Same text as `ingredients_text` but where allergens have HTML elements around them to identify them + /// + /// + /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_text_with_allergens`. + public var ingredients_text_with_allergens: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_that_may_be_from_palm_oil_n`. + public var ingredients_that_may_be_from_palm_oil_n: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_that_may_be_from_palm_oil_tags`. + public var ingredients_that_may_be_from_palm_oil_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? + /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_with_specified_percent_n`. + public var ingredients_with_specified_percent_n: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_with_specified_percent_sum`. + public var ingredients_with_specified_percent_sum: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_with_unspecified_percent_n`. + public var ingredients_with_unspecified_percent_n: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_with_unspecified_percent_sum`. + public var ingredients_with_unspecified_percent_sum: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_ingredients/known_ingredients_n`. + public var known_ingredients_n: Swift.Int? + /// Origins of ingredients + /// + /// + /// - Remark: Generated from `#/components/schemas/product_ingredients/origins`. + public var origins: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_ingredients/origins_hierarchy`. + public var origins_hierarchy: [OpenAPIRuntime.OpenAPIObjectContainer]? + /// - Remark: Generated from `#/components/schemas/product_ingredients/origins_lc`. + public var origins_lc: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_ingredients/origins_tags`. + public var origins_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? + /// List of substances that might cause allergies + /// that are present in trace amounts in the product + /// (this does not include the ingredients, as they + /// are not only present in trace amounts). + /// It is taxonomized with the allergens taxonomy. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_ingredients/traces`. + public var traces: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_ingredients/traces_hierarchy`. + public var traces_hierarchy: [OpenAPIRuntime.OpenAPIObjectContainer]? + /// - Remark: Generated from `#/components/schemas/product_ingredients/traces_lc`. + public var traces_lc: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_ingredients/traces_tags`. + public var traces_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? + /// - Remark: Generated from `#/components/schemas/product_ingredients/unknown_ingredients_n`. + public var unknown_ingredients_n: Swift.Int? + /// Raw list of ingredients in language given by 'language_code'. + /// + /// See `ingredients_text` + /// + /// + /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_text_(?\w\w)`. + public var ingredients_text__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: Swift.String? + /// Like `ingredients_text_with_allergens` for a particular language + /// + /// + /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_text_with_allergens_(?\w\w)`. + public var ingredients_text_with_allergens__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: Swift.String? + /// Creates a new `product_ingredients`. + /// + /// - Parameters: + /// - additives_tags: + /// - allergens: comma separated list of allergens + /// - allergens_lc: language in which `allergens` where input + /// - allergens_hierarchy: + /// - allergens_tags: + /// - ingredients: + /// - ingredients_analysis: + /// - ingredients_analysis_tags: + /// - ingredients_from_or_that_may_be_from_palm_oil_n: + /// - ingredients_from_palm_oil_n: + /// - ingredients_from_palm_oil_tags: + /// - ingredients_hierarchy: + /// - ingredients_n: + /// - ingredients_n_tags: + /// - ingredients_original_tags: + /// - ingredients_percent_analysis: + /// - ingredients_sweeteners_n: Number of sweeteners additives in the ingredients. Undefined if ingredients are not specified. + /// - ingredients_non_nutritive_sweeteners_n: Number of non-nutritive sweeteners additives (as specified in the Nutri-Score formula) in the ingredients. Undefined if ingredients are not specified. + /// - ingredients_tags: + /// - ingredients_lc: Language that was used to parse the ingredient list. If `ingredients_text` is available + /// - ingredients_text: Raw list of ingredients. This will get automatically + /// - ingredients_text_with_allergens: Same text as `ingredients_text` but where allergens have HTML elements around them to identify them + /// - ingredients_that_may_be_from_palm_oil_n: + /// - ingredients_that_may_be_from_palm_oil_tags: + /// - ingredients_with_specified_percent_n: + /// - ingredients_with_specified_percent_sum: + /// - ingredients_with_unspecified_percent_n: + /// - ingredients_with_unspecified_percent_sum: + /// - known_ingredients_n: + /// - origins: Origins of ingredients + /// - origins_hierarchy: + /// - origins_lc: + /// - origins_tags: + /// - traces: List of substances that might cause allergies + /// - traces_hierarchy: + /// - traces_lc: + /// - traces_tags: + /// - unknown_ingredients_n: + /// - ingredients_text__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: Raw list of ingredients in language given by 'language_code'. + /// - ingredients_text_with_allergens__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: Like `ingredients_text_with_allergens` for a particular language + public init( + additives_tags: [Swift.String]? = nil, + allergens: Swift.String? = nil, + allergens_lc: Swift.String? = nil, + allergens_hierarchy: [Swift.String]? = nil, + allergens_tags: [Swift.String]? = nil, + ingredients: Components.Schemas.ingredient? = nil, + ingredients_analysis: Components.Schemas.product_ingredients.ingredients_analysisPayload? = nil, + ingredients_analysis_tags: [Swift.String]? = nil, + ingredients_from_or_that_may_be_from_palm_oil_n: Swift.Int? = nil, + ingredients_from_palm_oil_n: Swift.Int? = nil, + ingredients_from_palm_oil_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? = nil, + ingredients_hierarchy: [Swift.String]? = nil, + ingredients_n: Swift.Int? = nil, + ingredients_n_tags: [Swift.String]? = nil, + ingredients_original_tags: [Swift.String]? = nil, + ingredients_percent_analysis: Swift.Int? = nil, + ingredients_sweeteners_n: Swift.Int? = nil, + ingredients_non_nutritive_sweeteners_n: Swift.Int? = nil, + ingredients_tags: [Swift.String]? = nil, + ingredients_lc: Swift.String? = nil, + ingredients_text: Swift.String? = nil, + ingredients_text_with_allergens: Swift.String? = nil, + ingredients_that_may_be_from_palm_oil_n: Swift.Int? = nil, + ingredients_that_may_be_from_palm_oil_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? = nil, + ingredients_with_specified_percent_n: Swift.Int? = nil, + ingredients_with_specified_percent_sum: Swift.Int? = nil, + ingredients_with_unspecified_percent_n: Swift.Int? = nil, + ingredients_with_unspecified_percent_sum: Swift.Int? = nil, + known_ingredients_n: Swift.Int? = nil, + origins: Swift.String? = nil, + origins_hierarchy: [OpenAPIRuntime.OpenAPIObjectContainer]? = nil, + origins_lc: Swift.String? = nil, + origins_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? = nil, + traces: Swift.String? = nil, + traces_hierarchy: [OpenAPIRuntime.OpenAPIObjectContainer]? = nil, + traces_lc: Swift.String? = nil, + traces_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? = nil, + unknown_ingredients_n: Swift.Int? = nil, + ingredients_text__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: Swift.String? = nil, + ingredients_text_with_allergens__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: Swift.String? = nil + ) { + self.additives_tags = additives_tags + self.allergens = allergens + self.allergens_lc = allergens_lc + self.allergens_hierarchy = allergens_hierarchy + self.allergens_tags = allergens_tags + self.ingredients = ingredients + self.ingredients_analysis = ingredients_analysis + self.ingredients_analysis_tags = ingredients_analysis_tags + self.ingredients_from_or_that_may_be_from_palm_oil_n = ingredients_from_or_that_may_be_from_palm_oil_n + self.ingredients_from_palm_oil_n = ingredients_from_palm_oil_n + self.ingredients_from_palm_oil_tags = ingredients_from_palm_oil_tags + self.ingredients_hierarchy = ingredients_hierarchy + self.ingredients_n = ingredients_n + self.ingredients_n_tags = ingredients_n_tags + self.ingredients_original_tags = ingredients_original_tags + self.ingredients_percent_analysis = ingredients_percent_analysis + self.ingredients_sweeteners_n = ingredients_sweeteners_n + self.ingredients_non_nutritive_sweeteners_n = ingredients_non_nutritive_sweeteners_n + self.ingredients_tags = ingredients_tags + self.ingredients_lc = ingredients_lc + self.ingredients_text = ingredients_text + self.ingredients_text_with_allergens = ingredients_text_with_allergens + self.ingredients_that_may_be_from_palm_oil_n = ingredients_that_may_be_from_palm_oil_n + self.ingredients_that_may_be_from_palm_oil_tags = ingredients_that_may_be_from_palm_oil_tags + self.ingredients_with_specified_percent_n = ingredients_with_specified_percent_n + self.ingredients_with_specified_percent_sum = ingredients_with_specified_percent_sum + self.ingredients_with_unspecified_percent_n = ingredients_with_unspecified_percent_n + self.ingredients_with_unspecified_percent_sum = ingredients_with_unspecified_percent_sum + self.known_ingredients_n = known_ingredients_n + self.origins = origins + self.origins_hierarchy = origins_hierarchy + self.origins_lc = origins_lc + self.origins_tags = origins_tags + self.traces = traces + self.traces_hierarchy = traces_hierarchy + self.traces_lc = traces_lc + self.traces_tags = traces_tags + self.unknown_ingredients_n = unknown_ingredients_n + self.ingredients_text__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ = ingredients_text__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ + self.ingredients_text_with_allergens__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ = ingredients_text_with_allergens__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ + } + public enum CodingKeys: String, CodingKey { + case additives_tags + case allergens + case allergens_lc + case allergens_hierarchy + case allergens_tags + case ingredients + case ingredients_analysis + case ingredients_analysis_tags + case ingredients_from_or_that_may_be_from_palm_oil_n + case ingredients_from_palm_oil_n + case ingredients_from_palm_oil_tags + case ingredients_hierarchy + case ingredients_n + case ingredients_n_tags + case ingredients_original_tags + case ingredients_percent_analysis + case ingredients_sweeteners_n + case ingredients_non_nutritive_sweeteners_n + case ingredients_tags + case ingredients_lc + case ingredients_text + case ingredients_text_with_allergens + case ingredients_that_may_be_from_palm_oil_n + case ingredients_that_may_be_from_palm_oil_tags + case ingredients_with_specified_percent_n + case ingredients_with_specified_percent_sum + case ingredients_with_unspecified_percent_n + case ingredients_with_unspecified_percent_sum + case known_ingredients_n + case origins + case origins_hierarchy + case origins_lc + case origins_tags + case traces + case traces_hierarchy + case traces_lc + case traces_tags + case unknown_ingredients_n + case ingredients_text__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ = #"ingredients_text_(?\w\w)"# + case ingredients_text_with_allergens__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ = #"ingredients_text_with_allergens_(?\w\w)"# + } + } + /// Nutrition fields of a product + /// + /// Most of these properties are read-only. + /// + /// See [how to add nutrition data](https://openfoodfacts.github.io/openfoodfacts-server/api/ref-cheatsheet/#add-nutrition-facts-values-units-and-base) + /// + /// + /// - Remark: Generated from `#/components/schemas/product_nutrition`. + public struct product_nutrition: Codable, Hashable, Sendable { + /// When a product does not have nutrition data displayed on the + /// packaging, the user can check the field "Nutrition facts are + /// not specified on the product". + /// By doing so, the no_nutrition_data field takes the value "on". + /// This case is frequent (thousands of products). + /// + /// + /// - Remark: Generated from `#/components/schemas/product_nutrition/no_nutrition_data`. + public var no_nutrition_data: Swift.String? + /// The nutrition data on the package can be per serving or per 100g. + /// + /// This is essential to understand if `_value` and `` + /// values in `nutriments` applies for a serving or for 100g. + /// + /// **IMPORTANT:** + /// When writing products, + /// this setting applies to all existing nutrients values for the product, + /// not only the nutrient values sent in the write request. + /// So it should not be changed unless all nutrients values are provided + /// with values that match the nutrition_data_per field. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutrition_data_per`. + @frozen public enum nutrition_data_perPayload: String, Codable, Hashable, Sendable, CaseIterable { + case serving = "serving" + case _100g = "100g" + } + /// The nutrition data on the package can be per serving or per 100g. + /// + /// This is essential to understand if `_value` and `` + /// values in `nutriments` applies for a serving or for 100g. + /// + /// **IMPORTANT:** + /// When writing products, + /// this setting applies to all existing nutrients values for the product, + /// not only the nutrient values sent in the write request. + /// So it should not be changed unless all nutrients values are provided + /// with values that match the nutrition_data_per field. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutrition_data_per`. + public var nutrition_data_per: Components.Schemas.product_nutrition.nutrition_data_perPayload? + /// The nutrition data for prepared product on the package (if any) can be per serving or per 100g. + /// + /// This is essential to understand if `_prepared_value` and `_prepared` + /// values in `nutriments` applies for a serving or for 100g. + /// + /// See also important note on `nutrition_data_per`. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutrition_data_prepared_per`. + @frozen public enum nutrition_data_prepared_perPayload: String, Codable, Hashable, Sendable, CaseIterable { + case serving = "serving" + case _100g = "100g" + } + /// The nutrition data for prepared product on the package (if any) can be per serving or per 100g. + /// + /// This is essential to understand if `_prepared_value` and `_prepared` + /// values in `nutriments` applies for a serving or for 100g. + /// + /// See also important note on `nutrition_data_per`. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutrition_data_prepared_per`. + public var nutrition_data_prepared_per: Components.Schemas.product_nutrition.nutrition_data_prepared_perPayload? + /// All known nutrients for the product. + /// + /// Note that each nutrients are declined with a variety of suffixes like `_100g`, `_serving`, + /// see patternProperties below. + /// + /// A specific `_unit` is the unit used to measure the nutrient. + /// + /// Beware that some properties are to be interpreted based upon `nutrition_data_per` value. + /// + /// Also for products that have a nutrition table for prepared product + /// (eg. the nutrition facts for a bowl of milk with cocoa powder), + /// a `_prepared` suffix is added (before other suffixes). + /// + /// You can get all possible nutrients from the + /// [nutrients taxonomy](https://static.openfoodfacts.org/data/taxonomies/nutrients.json) + /// + /// **FIXME** add more nutrients with description. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriments`. + public struct nutrimentsPayload: Codable, Hashable, Sendable { + /// Quantity of alcohol + /// + /// (per 100g or per serving) in a standard unit (g or ml) + /// + /// + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriments/alcohol`. + public var alcohol: Swift.Double? + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriments/carbohydrates`. + public var carbohydrates: Swift.Double? + /// It is the same as `energy-kj` if we have it, or computed from `energy-kcal` otherwise + /// + /// (per 100g or per serving) in kj + /// + /// + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriments/energy`. + public var energy: Swift.Double? + /// energy_value will be equal to energy-kj_value if we have it or to energy-kcal_value otherwise + /// + /// + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriments/energy_value`. + public var energy_value: Swift.Double? + /// Equal to energy-kj_unit if we have it or to energy-kcal_unit otherwise + /// + /// + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriments/energy_unit`. + @frozen public enum energy_unitPayload: String, Codable, Hashable, Sendable, CaseIterable { + case kcal = "kcal" + case kj = "kj" + } + /// Equal to energy-kj_unit if we have it or to energy-kcal_unit otherwise + /// + /// + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriments/energy_unit`. + public var energy_unit: Components.Schemas.product_nutrition.nutrimentsPayload.energy_unitPayload? + /// energy in kcal, if it is specified + /// + /// (per 100g or per serving) in a standard unit (g or ml) + /// + /// + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriments/energy-kcal`. + public var energy_hyphen_kcal: Swift.Double? + /// energy in kj, if it is specified + /// + /// (per 100g or per serving) in a standard unit (g or ml) + /// + /// + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriments/energy-kj`. + public var energy_hyphen_kj: Swift.Double? + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriments/fat`. + public var fat: Swift.Double? + /// An estimate, from the ingredients list of the percentage of fruits, vegetable and legumes. + /// This is an important information for Nutri-Score (2023 version) computation. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriments/fruits-vegetables-legumes-estimate-from-ingredients`. + public var fruits_hyphen_vegetables_hyphen_legumes_hyphen_estimate_hyphen_from_hyphen_ingredients: Swift.Double? + /// An estimate, from the ingredients list of the percentage of fruits, vegetable and nuts. + /// This is an important information for Nutri-Score (2021 version) computation. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriments/fruits-vegetables-nuts-estimate-from-ingredients`. + public var fruits_hyphen_vegetables_hyphen_nuts_hyphen_estimate_hyphen_from_hyphen_ingredients: Swift.Double? + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriments/nova-group`. + public var nova_hyphen_group: Swift.Int? + /// Experimental nutrition score derived from + /// the UK FSA score and adapted for the French market + /// (formula defined by the team of Professor Hercberg). + /// + /// + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriments/nutrition-score-fr`. + public var nutrition_hyphen_score_hyphen_fr: OpenAPIRuntime.OpenAPIValueContainer? + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriments/proteins`. + public var proteins: Swift.Double? + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriments/salt`. + public var salt: Swift.Double? + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriments/saturated-fat`. + public var saturated_hyphen_fat: Swift.Double? + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriments/sodium`. + public var sodium: Swift.Double? + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriments/sugars`. + public var sugars: Swift.Double? + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriments/carbon-footprint-from-known-ingredients_product`. + public var carbon_hyphen_footprint_hyphen_from_hyphen_known_hyphen_ingredients_product: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriments/carbon-footprint-from-known-ingredients_serving`. + public var carbon_hyphen_footprint_hyphen_from_hyphen_known_hyphen_ingredients_serving: Swift.Double? + /// erythritol is a polyol which is not providing any energy. + /// As such, it needs not be taken into account when computing + /// the energy of a product. Eryhtritol is now displayed on + /// nutrition facts sheet of some products, mainly in the USA. + /// This value is entered either by contributors, either by + /// imports. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriments/erythritol`. + public var erythritol: Swift.Double? + /// The standardized value for a serving or 100g (or 100ml for liquids), + /// depending on `nutrition_data_prepared_per` + /// for the nutrient for **prepared** product. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriments/nutrient_example`. + public var nutrient_example: Swift.Double? + /// Creates a new `nutrimentsPayload`. + /// + /// - Parameters: + /// - alcohol: Quantity of alcohol + /// - carbohydrates: + /// - energy: It is the same as `energy-kj` if we have it, or computed from `energy-kcal` otherwise + /// - energy_value: energy_value will be equal to energy-kj_value if we have it or to energy-kcal_value otherwise + /// - energy_unit: Equal to energy-kj_unit if we have it or to energy-kcal_unit otherwise + /// - energy_hyphen_kcal: energy in kcal, if it is specified + /// - energy_hyphen_kj: energy in kj, if it is specified + /// - fat: + /// - fruits_hyphen_vegetables_hyphen_legumes_hyphen_estimate_hyphen_from_hyphen_ingredients: An estimate, from the ingredients list of the percentage of fruits, vegetable and legumes. + /// - fruits_hyphen_vegetables_hyphen_nuts_hyphen_estimate_hyphen_from_hyphen_ingredients: An estimate, from the ingredients list of the percentage of fruits, vegetable and nuts. + /// - nova_hyphen_group: + /// - nutrition_hyphen_score_hyphen_fr: Experimental nutrition score derived from + /// - proteins: + /// - salt: + /// - saturated_hyphen_fat: + /// - sodium: + /// - sugars: + /// - carbon_hyphen_footprint_hyphen_from_hyphen_known_hyphen_ingredients_product: + /// - carbon_hyphen_footprint_hyphen_from_hyphen_known_hyphen_ingredients_serving: + /// - erythritol: erythritol is a polyol which is not providing any energy. + /// - nutrient_example: The standardized value for a serving or 100g (or 100ml for liquids), + public init( + alcohol: Swift.Double? = nil, + carbohydrates: Swift.Double? = nil, + energy: Swift.Double? = nil, + energy_value: Swift.Double? = nil, + energy_unit: Components.Schemas.product_nutrition.nutrimentsPayload.energy_unitPayload? = nil, + energy_hyphen_kcal: Swift.Double? = nil, + energy_hyphen_kj: Swift.Double? = nil, + fat: Swift.Double? = nil, + fruits_hyphen_vegetables_hyphen_legumes_hyphen_estimate_hyphen_from_hyphen_ingredients: Swift.Double? = nil, + fruits_hyphen_vegetables_hyphen_nuts_hyphen_estimate_hyphen_from_hyphen_ingredients: Swift.Double? = nil, + nova_hyphen_group: Swift.Int? = nil, + nutrition_hyphen_score_hyphen_fr: OpenAPIRuntime.OpenAPIValueContainer? = nil, + proteins: Swift.Double? = nil, + salt: Swift.Double? = nil, + saturated_hyphen_fat: Swift.Double? = nil, + sodium: Swift.Double? = nil, + sugars: Swift.Double? = nil, + carbon_hyphen_footprint_hyphen_from_hyphen_known_hyphen_ingredients_product: Swift.Int? = nil, + carbon_hyphen_footprint_hyphen_from_hyphen_known_hyphen_ingredients_serving: Swift.Double? = nil, + erythritol: Swift.Double? = nil, + nutrient_example: Swift.Double? = nil + ) { + self.alcohol = alcohol + self.carbohydrates = carbohydrates + self.energy = energy + self.energy_value = energy_value + self.energy_unit = energy_unit + self.energy_hyphen_kcal = energy_hyphen_kcal + self.energy_hyphen_kj = energy_hyphen_kj + self.fat = fat + self.fruits_hyphen_vegetables_hyphen_legumes_hyphen_estimate_hyphen_from_hyphen_ingredients = fruits_hyphen_vegetables_hyphen_legumes_hyphen_estimate_hyphen_from_hyphen_ingredients + self.fruits_hyphen_vegetables_hyphen_nuts_hyphen_estimate_hyphen_from_hyphen_ingredients = fruits_hyphen_vegetables_hyphen_nuts_hyphen_estimate_hyphen_from_hyphen_ingredients + self.nova_hyphen_group = nova_hyphen_group + self.nutrition_hyphen_score_hyphen_fr = nutrition_hyphen_score_hyphen_fr + self.proteins = proteins + self.salt = salt + self.saturated_hyphen_fat = saturated_hyphen_fat + self.sodium = sodium + self.sugars = sugars + self.carbon_hyphen_footprint_hyphen_from_hyphen_known_hyphen_ingredients_product = carbon_hyphen_footprint_hyphen_from_hyphen_known_hyphen_ingredients_product + self.carbon_hyphen_footprint_hyphen_from_hyphen_known_hyphen_ingredients_serving = carbon_hyphen_footprint_hyphen_from_hyphen_known_hyphen_ingredients_serving + self.erythritol = erythritol + self.nutrient_example = nutrient_example + } + public enum CodingKeys: String, CodingKey { + case alcohol + case carbohydrates + case energy + case energy_value + case energy_unit + case energy_hyphen_kcal = "energy-kcal" + case energy_hyphen_kj = "energy-kj" + case fat + case fruits_hyphen_vegetables_hyphen_legumes_hyphen_estimate_hyphen_from_hyphen_ingredients = "fruits-vegetables-legumes-estimate-from-ingredients" + case fruits_hyphen_vegetables_hyphen_nuts_hyphen_estimate_hyphen_from_hyphen_ingredients = "fruits-vegetables-nuts-estimate-from-ingredients" + case nova_hyphen_group = "nova-group" + case nutrition_hyphen_score_hyphen_fr = "nutrition-score-fr" + case proteins + case salt + case saturated_hyphen_fat = "saturated-fat" + case sodium + case sugars + case carbon_hyphen_footprint_hyphen_from_hyphen_known_hyphen_ingredients_product = "carbon-footprint-from-known-ingredients_product" + case carbon_hyphen_footprint_hyphen_from_hyphen_known_hyphen_ingredients_serving = "carbon-footprint-from-known-ingredients_serving" + case erythritol + case nutrient_example + } + } + /// All known nutrients for the product. + /// + /// Note that each nutrients are declined with a variety of suffixes like `_100g`, `_serving`, + /// see patternProperties below. + /// + /// A specific `_unit` is the unit used to measure the nutrient. + /// + /// Beware that some properties are to be interpreted based upon `nutrition_data_per` value. + /// + /// Also for products that have a nutrition table for prepared product + /// (eg. the nutrition facts for a bowl of milk with cocoa powder), + /// a `_prepared` suffix is added (before other suffixes). + /// + /// You can get all possible nutrients from the + /// [nutrients taxonomy](https://static.openfoodfacts.org/data/taxonomies/nutrients.json) + /// + /// **FIXME** add more nutrients with description. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriments`. + public var nutriments: Components.Schemas.product_nutrition.nutrimentsPayload? + /// Detail of data the Nutri-Score was computed upon. + /// + /// **Note**: this might not be stable, don't rely too much on this, or, at least, tell us ! + /// + /// **TODO** document each property + /// + /// + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data`. + public struct nutriscore_dataPayload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/energy`. + public var energy: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/energy_points`. + public var energy_points: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/energy_value`. + public var energy_value: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/fiber`. + public var fiber: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/fiber_points`. + public var fiber_points: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/fiber_value`. + public var fiber_value: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/fruits_vegetables_nuts_colza_walnut_olive_oils`. + public var fruits_vegetables_nuts_colza_walnut_olive_oils: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/fruits_vegetables_nuts_colza_walnut_olive_oils_points`. + public var fruits_vegetables_nuts_colza_walnut_olive_oils_points: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/fruits_vegetables_nuts_colza_walnut_olive_oils_value`. + public var fruits_vegetables_nuts_colza_walnut_olive_oils_value: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/grade`. + public var grade: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/is_beverage`. + public var is_beverage: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/is_cheese`. + public var is_cheese: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/is_fat`. + public var is_fat: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/is_water`. + public var is_water: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/negative_points`. + public var negative_points: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/positive_points`. + public var positive_points: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/proteins`. + public var proteins: Swift.Double? + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/proteins_points`. + public var proteins_points: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/proteins_value`. + public var proteins_value: Swift.Double? + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/saturated_fat`. + public var saturated_fat: Swift.Double? + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/saturated_fat_points`. + public var saturated_fat_points: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/saturated_fat_ratio`. + public var saturated_fat_ratio: Swift.Double? + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/saturated_fat_ratio_points`. + public var saturated_fat_ratio_points: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/saturated_fat_ratio_value`. + public var saturated_fat_ratio_value: Swift.Double? + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/saturated_fat_value`. + public var saturated_fat_value: Swift.Double? + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/score`. + public var score: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/sodium`. + public var sodium: Swift.Double? + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/sodium_points`. + public var sodium_points: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/sodium_value`. + public var sodium_value: Swift.Double? + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/sugars`. + public var sugars: Swift.Double? + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/sugars_points`. + public var sugars_points: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/sugars_value`. + public var sugars_value: Swift.Double? + /// Creates a new `nutriscore_dataPayload`. + /// + /// - Parameters: + /// - energy: + /// - energy_points: + /// - energy_value: + /// - fiber: + /// - fiber_points: + /// - fiber_value: + /// - fruits_vegetables_nuts_colza_walnut_olive_oils: + /// - fruits_vegetables_nuts_colza_walnut_olive_oils_points: + /// - fruits_vegetables_nuts_colza_walnut_olive_oils_value: + /// - grade: + /// - is_beverage: + /// - is_cheese: + /// - is_fat: + /// - is_water: + /// - negative_points: + /// - positive_points: + /// - proteins: + /// - proteins_points: + /// - proteins_value: + /// - saturated_fat: + /// - saturated_fat_points: + /// - saturated_fat_ratio: + /// - saturated_fat_ratio_points: + /// - saturated_fat_ratio_value: + /// - saturated_fat_value: + /// - score: + /// - sodium: + /// - sodium_points: + /// - sodium_value: + /// - sugars: + /// - sugars_points: + /// - sugars_value: + public init( + energy: Swift.Int? = nil, + energy_points: Swift.Int? = nil, + energy_value: Swift.Int? = nil, + fiber: Swift.Int? = nil, + fiber_points: Swift.Int? = nil, + fiber_value: Swift.Int? = nil, + fruits_vegetables_nuts_colza_walnut_olive_oils: Swift.Int? = nil, + fruits_vegetables_nuts_colza_walnut_olive_oils_points: Swift.Int? = nil, + fruits_vegetables_nuts_colza_walnut_olive_oils_value: Swift.Int? = nil, + grade: Swift.String? = nil, + is_beverage: Swift.Int? = nil, + is_cheese: Swift.Int? = nil, + is_fat: Swift.Int? = nil, + is_water: Swift.Int? = nil, + negative_points: Swift.Int? = nil, + positive_points: Swift.Int? = nil, + proteins: Swift.Double? = nil, + proteins_points: Swift.Int? = nil, + proteins_value: Swift.Double? = nil, + saturated_fat: Swift.Double? = nil, + saturated_fat_points: Swift.Int? = nil, + saturated_fat_ratio: Swift.Double? = nil, + saturated_fat_ratio_points: Swift.Int? = nil, + saturated_fat_ratio_value: Swift.Double? = nil, + saturated_fat_value: Swift.Double? = nil, + score: Swift.Int? = nil, + sodium: Swift.Double? = nil, + sodium_points: Swift.Int? = nil, + sodium_value: Swift.Double? = nil, + sugars: Swift.Double? = nil, + sugars_points: Swift.Int? = nil, + sugars_value: Swift.Double? = nil + ) { + self.energy = energy + self.energy_points = energy_points + self.energy_value = energy_value + self.fiber = fiber + self.fiber_points = fiber_points + self.fiber_value = fiber_value + self.fruits_vegetables_nuts_colza_walnut_olive_oils = fruits_vegetables_nuts_colza_walnut_olive_oils + self.fruits_vegetables_nuts_colza_walnut_olive_oils_points = fruits_vegetables_nuts_colza_walnut_olive_oils_points + self.fruits_vegetables_nuts_colza_walnut_olive_oils_value = fruits_vegetables_nuts_colza_walnut_olive_oils_value + self.grade = grade + self.is_beverage = is_beverage + self.is_cheese = is_cheese + self.is_fat = is_fat + self.is_water = is_water + self.negative_points = negative_points + self.positive_points = positive_points + self.proteins = proteins + self.proteins_points = proteins_points + self.proteins_value = proteins_value + self.saturated_fat = saturated_fat + self.saturated_fat_points = saturated_fat_points + self.saturated_fat_ratio = saturated_fat_ratio + self.saturated_fat_ratio_points = saturated_fat_ratio_points + self.saturated_fat_ratio_value = saturated_fat_ratio_value + self.saturated_fat_value = saturated_fat_value + self.score = score + self.sodium = sodium + self.sodium_points = sodium_points + self.sodium_value = sodium_value + self.sugars = sugars + self.sugars_points = sugars_points + self.sugars_value = sugars_value + } + public enum CodingKeys: String, CodingKey { + case energy + case energy_points + case energy_value + case fiber + case fiber_points + case fiber_value + case fruits_vegetables_nuts_colza_walnut_olive_oils + case fruits_vegetables_nuts_colza_walnut_olive_oils_points + case fruits_vegetables_nuts_colza_walnut_olive_oils_value + case grade + case is_beverage + case is_cheese + case is_fat + case is_water + case negative_points + case positive_points + case proteins + case proteins_points + case proteins_value + case saturated_fat + case saturated_fat_points + case saturated_fat_ratio + case saturated_fat_ratio_points + case saturated_fat_ratio_value + case saturated_fat_value + case score + case sodium + case sodium_points + case sodium_value + case sugars + case sugars_points + case sugars_value + } + } + /// Detail of data the Nutri-Score was computed upon. + /// + /// **Note**: this might not be stable, don't rely too much on this, or, at least, tell us ! + /// + /// **TODO** document each property + /// + /// + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data`. + public var nutriscore_data: Components.Schemas.product_nutrition.nutriscore_dataPayload? + /// Nutri-Score for the product as a letter. + /// + /// See https://world.openfoodfacts.org/nutriscore. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_grade`. + @frozen public enum nutriscore_gradePayload: String, Codable, Hashable, Sendable, CaseIterable { + case a = "a" + case b = "b" + case c = "c" + case d = "d" + case e = "e" + } + /// Nutri-Score for the product as a letter. + /// + /// See https://world.openfoodfacts.org/nutriscore. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_grade`. + public var nutriscore_grade: Components.Schemas.product_nutrition.nutriscore_gradePayload? + /// Nutri-Score for the product as an integer (see also `nutriscore_grade`). + /// + /// + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_score`. + public var nutriscore_score: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_score_opposite`. + public var nutriscore_score_opposite: Swift.Int? + /// Nutrition grade (‘a’ to ‘e’), + /// https://world.openfoodfacts.org/nutriscore. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutrition_grade_fr`. + public var nutrition_grade_fr: Swift.String? + /// Nutrition grades as a comma separated list. + /// + /// Some products with multiple components might have multiple Nutri-Score + /// + /// + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutrition_grades`. + public var nutrition_grades: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutrition_grades_tags`. + public var nutrition_grades_tags: [Swift.String]? + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutrition_score_beverage`. + public var nutrition_score_beverage: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients`. + public var nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients_value`. + public var nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients_value: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_nutrition/nutrition_score_warning_no_fiber`. + public var nutrition_score_warning_no_fiber: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_nutrition/other_nutritional_substances_tags`. + public var other_nutritional_substances_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? + /// - Remark: Generated from `#/components/schemas/product_nutrition/unknown_nutrients_tags`. + public var unknown_nutrients_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? + /// - Remark: Generated from `#/components/schemas/product_nutrition/vitamins_tags`. + public var vitamins_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? + /// Creates a new `product_nutrition`. + /// + /// - Parameters: + /// - no_nutrition_data: When a product does not have nutrition data displayed on the + /// - nutrition_data_per: The nutrition data on the package can be per serving or per 100g. + /// - nutrition_data_prepared_per: The nutrition data for prepared product on the package (if any) can be per serving or per 100g. + /// - nutriments: All known nutrients for the product. + /// - nutriscore_data: Detail of data the Nutri-Score was computed upon. + /// - nutriscore_grade: Nutri-Score for the product as a letter. + /// - nutriscore_score: Nutri-Score for the product as an integer (see also `nutriscore_grade`). + /// - nutriscore_score_opposite: + /// - nutrition_grade_fr: Nutrition grade (‘a’ to ‘e’), + /// - nutrition_grades: Nutrition grades as a comma separated list. + /// - nutrition_grades_tags: + /// - nutrition_score_beverage: + /// - nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients: + /// - nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients_value: + /// - nutrition_score_warning_no_fiber: + /// - other_nutritional_substances_tags: + /// - unknown_nutrients_tags: + /// - vitamins_tags: + public init( + no_nutrition_data: Swift.String? = nil, + nutrition_data_per: Components.Schemas.product_nutrition.nutrition_data_perPayload? = nil, + nutrition_data_prepared_per: Components.Schemas.product_nutrition.nutrition_data_prepared_perPayload? = nil, + nutriments: Components.Schemas.product_nutrition.nutrimentsPayload? = nil, + nutriscore_data: Components.Schemas.product_nutrition.nutriscore_dataPayload? = nil, + nutriscore_grade: Components.Schemas.product_nutrition.nutriscore_gradePayload? = nil, + nutriscore_score: Swift.Int? = nil, + nutriscore_score_opposite: Swift.Int? = nil, + nutrition_grade_fr: Swift.String? = nil, + nutrition_grades: Swift.String? = nil, + nutrition_grades_tags: [Swift.String]? = nil, + nutrition_score_beverage: Swift.Int? = nil, + nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients: Swift.Int? = nil, + nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients_value: Swift.Int? = nil, + nutrition_score_warning_no_fiber: Swift.Int? = nil, + other_nutritional_substances_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? = nil, + unknown_nutrients_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? = nil, + vitamins_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? = nil + ) { + self.no_nutrition_data = no_nutrition_data + self.nutrition_data_per = nutrition_data_per + self.nutrition_data_prepared_per = nutrition_data_prepared_per + self.nutriments = nutriments + self.nutriscore_data = nutriscore_data + self.nutriscore_grade = nutriscore_grade + self.nutriscore_score = nutriscore_score + self.nutriscore_score_opposite = nutriscore_score_opposite + self.nutrition_grade_fr = nutrition_grade_fr + self.nutrition_grades = nutrition_grades + self.nutrition_grades_tags = nutrition_grades_tags + self.nutrition_score_beverage = nutrition_score_beverage + self.nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients = nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients + self.nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients_value = nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients_value + self.nutrition_score_warning_no_fiber = nutrition_score_warning_no_fiber + self.other_nutritional_substances_tags = other_nutritional_substances_tags + self.unknown_nutrients_tags = unknown_nutrients_tags + self.vitamins_tags = vitamins_tags + } + public enum CodingKeys: String, CodingKey { + case no_nutrition_data + case nutrition_data_per + case nutrition_data_prepared_per + case nutriments + case nutriscore_data + case nutriscore_grade + case nutriscore_score + case nutriscore_score_opposite + case nutrition_grade_fr + case nutrition_grades + case nutrition_grades_tags + case nutrition_score_beverage + case nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients + case nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients_value + case nutrition_score_warning_no_fiber + case other_nutritional_substances_tags + case unknown_nutrients_tags + case vitamins_tags + } + } + /// This is data that is linked to products data quality + /// + /// + /// - Remark: Generated from `#/components/schemas/product_quality`. + public struct product_quality: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/product_quality/data_quality_bugs_tags`. + public var data_quality_bugs_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? + /// - Remark: Generated from `#/components/schemas/product_quality/data_quality_errors_tags`. + public var data_quality_errors_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? + /// - Remark: Generated from `#/components/schemas/product_quality/data_quality_info_tags`. + public var data_quality_info_tags: [Swift.String]? + /// - Remark: Generated from `#/components/schemas/product_quality/data_quality_tags`. + public var data_quality_tags: [Swift.String]? + /// - Remark: Generated from `#/components/schemas/product_quality/data_quality_warnings_tags`. + public var data_quality_warnings_tags: [Swift.String]? + /// Source of data imported from producers. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_quality/data_sources`. + public var data_sources: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_quality/data_sources_tags`. + public var data_sources_tags: [Swift.String]? + /// - Remark: Generated from `#/components/schemas/product_quality/last_check_dates_tags`. + public var last_check_dates_tags: [Swift.String]? + /// - Remark: Generated from `#/components/schemas/product_quality/last_checked_t`. + public var last_checked_t: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_quality/last_checker`. + public var last_checker: Swift.String? + /// comma separated list of values indicating some states of the product, + /// like things to be done, or to be completed. + /// See [states taxonomy](https://static.openfoodfacts.net/data/taxonomies/states.json) + /// + /// + /// - Remark: Generated from `#/components/schemas/product_quality/states`. + public var states: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_quality/states_hierarchy`. + public var states_hierarchy: [Swift.String]? + /// - Remark: Generated from `#/components/schemas/product_quality/states_tags`. + public var states_tags: [Swift.String]? + /// Information about different aspect of the product + /// + /// + /// - Remark: Generated from `#/components/schemas/product_quality/misc_tags`. + public var misc_tags: [Swift.String]? + /// Creates a new `product_quality`. + /// + /// - Parameters: + /// - data_quality_bugs_tags: + /// - data_quality_errors_tags: + /// - data_quality_info_tags: + /// - data_quality_tags: + /// - data_quality_warnings_tags: + /// - data_sources: Source of data imported from producers. + /// - data_sources_tags: + /// - last_check_dates_tags: + /// - last_checked_t: + /// - last_checker: + /// - states: comma separated list of values indicating some states of the product, + /// - states_hierarchy: + /// - states_tags: + /// - misc_tags: Information about different aspect of the product + public init( + data_quality_bugs_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? = nil, + data_quality_errors_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? = nil, + data_quality_info_tags: [Swift.String]? = nil, + data_quality_tags: [Swift.String]? = nil, + data_quality_warnings_tags: [Swift.String]? = nil, + data_sources: Swift.String? = nil, + data_sources_tags: [Swift.String]? = nil, + last_check_dates_tags: [Swift.String]? = nil, + last_checked_t: Swift.Int? = nil, + last_checker: Swift.String? = nil, + states: Swift.String? = nil, + states_hierarchy: [Swift.String]? = nil, + states_tags: [Swift.String]? = nil, + misc_tags: [Swift.String]? = nil + ) { + self.data_quality_bugs_tags = data_quality_bugs_tags + self.data_quality_errors_tags = data_quality_errors_tags + self.data_quality_info_tags = data_quality_info_tags + self.data_quality_tags = data_quality_tags + self.data_quality_warnings_tags = data_quality_warnings_tags + self.data_sources = data_sources + self.data_sources_tags = data_sources_tags + self.last_check_dates_tags = last_check_dates_tags + self.last_checked_t = last_checked_t + self.last_checker = last_checker + self.states = states + self.states_hierarchy = states_hierarchy + self.states_tags = states_tags + self.misc_tags = misc_tags + } + public enum CodingKeys: String, CodingKey { + case data_quality_bugs_tags + case data_quality_errors_tags + case data_quality_info_tags + case data_quality_tags + case data_quality_warnings_tags + case data_sources + case data_sources_tags + case last_check_dates_tags + case last_checked_t + case last_checker + case states + case states_hierarchy + case states_tags + case misc_tags + } + } + /// - Remark: Generated from `#/components/schemas/product_extended`. + public struct product_extended: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/product_extended/additives_original_tags`. + public var additives_original_tags: [Swift.String]? + /// - Remark: Generated from `#/components/schemas/product_extended/additives_prev_original_tags`. + public var additives_prev_original_tags: [Swift.String]? + /// - Remark: Generated from `#/components/schemas/product_extended/added_countries_tags`. + public var added_countries_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? + /// - Remark: Generated from `#/components/schemas/product_extended/allergens_from_ingredients`. + public var allergens_from_ingredients: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_extended/allergens_from_user`. + public var allergens_from_user: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_extended/amino_acids_prev_tags`. + public var amino_acids_prev_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? + /// - Remark: Generated from `#/components/schemas/product_extended/amino_acids_tags`. + public var amino_acids_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? + /// - Remark: Generated from `#/components/schemas/product_extended/carbon_footprint_percent_of_known_ingredients`. + public var carbon_footprint_percent_of_known_ingredients: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_extended/categories_properties`. + public struct categories_propertiesPayload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/product_extended/categories_properties/agribalyse_food_code:en`. + public var agribalyse_food_code_colon_en: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_extended/categories_properties/agribalyse_proxy_food_code:en`. + public var agribalyse_proxy_food_code_colon_en: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_extended/categories_properties/ciqual_food_code:en`. + public var ciqual_food_code_colon_en: Swift.String? + /// Creates a new `categories_propertiesPayload`. + /// + /// - Parameters: + /// - agribalyse_food_code_colon_en: + /// - agribalyse_proxy_food_code_colon_en: + /// - ciqual_food_code_colon_en: + public init( + agribalyse_food_code_colon_en: Swift.String? = nil, + agribalyse_proxy_food_code_colon_en: Swift.String? = nil, + ciqual_food_code_colon_en: Swift.String? = nil + ) { + self.agribalyse_food_code_colon_en = agribalyse_food_code_colon_en + self.agribalyse_proxy_food_code_colon_en = agribalyse_proxy_food_code_colon_en + self.ciqual_food_code_colon_en = ciqual_food_code_colon_en + } + public enum CodingKeys: String, CodingKey { + case agribalyse_food_code_colon_en = "agribalyse_food_code:en" + case agribalyse_proxy_food_code_colon_en = "agribalyse_proxy_food_code:en" + case ciqual_food_code_colon_en = "ciqual_food_code:en" + } + } + /// - Remark: Generated from `#/components/schemas/product_extended/categories_properties`. + public var categories_properties: Components.Schemas.product_extended.categories_propertiesPayload? + /// - Remark: Generated from `#/components/schemas/product_extended/categories_properties_tags`. + public var categories_properties_tags: [Swift.String]? + /// - Remark: Generated from `#/components/schemas/product_extended/category_properties`. + public struct category_propertiesPayload: Codable, Hashable, Sendable { + /// A container of undocumented properties. + public var additionalProperties: [String: Swift.String] + /// Creates a new `category_propertiesPayload`. + /// + /// - Parameters: + /// - additionalProperties: A container of undocumented properties. + public init(additionalProperties: [String: Swift.String] = .init()) { + self.additionalProperties = additionalProperties + } + public init(from decoder: any Decoder) throws { + additionalProperties = try decoder.decodeAdditionalProperties(knownKeys: []) + } + public func encode(to encoder: any Encoder) throws { + try encoder.encodeAdditionalProperties(additionalProperties) + } + } + /// - Remark: Generated from `#/components/schemas/product_extended/category_properties`. + public var category_properties: Components.Schemas.product_extended.category_propertiesPayload? + /// - Remark: Generated from `#/components/schemas/product_extended/ciqual_food_name_tags`. + public var ciqual_food_name_tags: [Swift.String]? + /// the category to use for comparison. + /// + /// **TODO** explain how it is chosen. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_extended/compared_to_category`. + public var compared_to_category: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_extended/conservation_conditions`. + public var conservation_conditions: Swift.String? + /// Contact info of customer service. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_extended/customer_service`. + public var customer_service: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_extended/expiration_date`. + public var expiration_date: Swift.String? + /// link to the product on the website of the producer + /// + /// + /// - Remark: Generated from `#/components/schemas/product_extended/link`. + public var link: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_extended/main_countries_tags`. + public var main_countries_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? + /// - Remark: Generated from `#/components/schemas/product_extended/minerals_prev_tags`. + public var minerals_prev_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? + /// - Remark: Generated from `#/components/schemas/product_extended/minerals_tags`. + public var minerals_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? + /// Those are fields provided by the producer (through producers platform), + /// and the value he provided. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_extended/owner_fields`. + public struct owner_fieldsPayload: Codable, Hashable, Sendable { + /// you can retrieve all kind of properties, the same as on the parent object (the product). + /// It's not processed entries (like tags for example) but raw ones. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_extended/owner_fields/additionalProperties`. + @frozen public enum additionalPropertiesPayload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/product_extended/owner_fields/additionalProperties/case1`. + case case1(Swift.Int) + /// - Remark: Generated from `#/components/schemas/product_extended/owner_fields/additionalProperties/case2`. + case case2(Swift.String) + /// - Remark: Generated from `#/components/schemas/product_extended/owner_fields/additionalProperties/case3`. + case case3(OpenAPIRuntime.OpenAPIObjectContainer) + public init(from decoder: any Decoder) throws { + var errors: [any Error] = [] + do { + self = .case1(try decoder.decodeFromSingleValueContainer()) + return + } catch { + errors.append(error) + } + do { + self = .case2(try decoder.decodeFromSingleValueContainer()) + return + } catch { + errors.append(error) + } + do { + self = .case3(try .init(from: decoder)) + return + } catch { + errors.append(error) + } + throw Swift.DecodingError.failedToDecodeOneOfSchema( + type: Self.self, + codingPath: decoder.codingPath, + errors: errors + ) + } + public func encode(to encoder: any Encoder) throws { + switch self { + case let .case1(value): + try encoder.encodeToSingleValueContainer(value) + case let .case2(value): + try encoder.encodeToSingleValueContainer(value) + case let .case3(value): + try value.encode(to: encoder) + } + } + } + /// you can retrieve all kind of properties, the same as on the parent object (the product). + /// It's not processed entries (like tags for example) but raw ones. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_extended/owner_fields/additionalProperties`. + public var additionalProperties: Components.Schemas.product_extended.owner_fieldsPayload.additionalPropertiesPayload? + /// Creates a new `owner_fieldsPayload`. + /// + /// - Parameters: + /// - additionalProperties: you can retrieve all kind of properties, the same as on the parent object (the product). + public init(additionalProperties: Components.Schemas.product_extended.owner_fieldsPayload.additionalPropertiesPayload? = nil) { + self.additionalProperties = additionalProperties + } + public enum CodingKeys: String, CodingKey { + case additionalProperties + } + } + /// Those are fields provided by the producer (through producers platform), + /// and the value he provided. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_extended/owner_fields`. + public var owner_fields: Components.Schemas.product_extended.owner_fieldsPayload? + /// Detail of ingredients or processing that makes the products having Nova 3 or 4 + /// + /// + /// - Remark: Generated from `#/components/schemas/product_extended/nova_groups_markers`. + public struct nova_groups_markersPayload: Codable, Hashable, Sendable { + /// Markers of level 3 + /// + /// + /// - Remark: Generated from `#/components/schemas/product_extended/nova_groups_markers/3`. + public var _3: [[Swift.String]]? + /// Markers of level 4 + /// + /// + /// - Remark: Generated from `#/components/schemas/product_extended/nova_groups_markers/4`. + public var _4: OpenAPIRuntime.OpenAPIArrayContainer? + /// Creates a new `nova_groups_markersPayload`. + /// + /// - Parameters: + /// - _3: Markers of level 3 + /// - _4: Markers of level 4 + public init( + _3: [[Swift.String]]? = nil, + _4: OpenAPIRuntime.OpenAPIArrayContainer? = nil + ) { + self._3 = _3 + self._4 = _4 + } + public enum CodingKeys: String, CodingKey { + case _3 = "3" + case _4 = "4" + } + } + /// Detail of ingredients or processing that makes the products having Nova 3 or 4 + /// + /// + /// - Remark: Generated from `#/components/schemas/product_extended/nova_groups_markers`. + public var nova_groups_markers: Components.Schemas.product_extended.nova_groups_markersPayload? + /// - Remark: Generated from `#/components/schemas/product_extended/nucleotides_tags`. + public var nucleotides_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? + /// - Remark: Generated from `#/components/schemas/product_extended/origin`. + public var origin: Swift.String? + /// Country, state, or city where the product can be purchased. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_extended/purchase_places`. + public var purchase_places: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_extended/purchase_places_tags`. + public var purchase_places_tags: [Swift.String]? + /// Distributor name. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_extended/stores`. + public var stores: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_extended/stores_tags`. + public var stores_tags: [Swift.String]? + /// - Remark: Generated from `#/components/schemas/product_extended/traces_from_ingredients`. + public var traces_from_ingredients: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_extended/traces_from_user`. + public var traces_from_user: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_extended/conservation_conditions_(?\w\w)`. + public var conservation_conditions__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_extended/customer_service_(?\w\w)`. + public var customer_service__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: Swift.String? + /// `origin` in language indicated by `language_code` + /// + /// + /// - Remark: Generated from `#/components/schemas/product_extended/origin_(?\w\w)`. + public var origin__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: Swift.String? + /// Creates a new `product_extended`. + /// + /// - Parameters: + /// - additives_original_tags: + /// - additives_prev_original_tags: + /// - added_countries_tags: + /// - allergens_from_ingredients: + /// - allergens_from_user: + /// - amino_acids_prev_tags: + /// - amino_acids_tags: + /// - carbon_footprint_percent_of_known_ingredients: + /// - categories_properties: + /// - categories_properties_tags: + /// - category_properties: + /// - ciqual_food_name_tags: + /// - compared_to_category: the category to use for comparison. + /// - conservation_conditions: + /// - customer_service: Contact info of customer service. + /// - expiration_date: + /// - link: link to the product on the website of the producer + /// - main_countries_tags: + /// - minerals_prev_tags: + /// - minerals_tags: + /// - owner_fields: Those are fields provided by the producer (through producers platform), + /// - nova_groups_markers: Detail of ingredients or processing that makes the products having Nova 3 or 4 + /// - nucleotides_tags: + /// - origin: + /// - purchase_places: Country, state, or city where the product can be purchased. + /// - purchase_places_tags: + /// - stores: Distributor name. + /// - stores_tags: + /// - traces_from_ingredients: + /// - traces_from_user: + /// - conservation_conditions__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: + /// - customer_service__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: + /// - origin__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: `origin` in language indicated by `language_code` + public init( + additives_original_tags: [Swift.String]? = nil, + additives_prev_original_tags: [Swift.String]? = nil, + added_countries_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? = nil, + allergens_from_ingredients: Swift.String? = nil, + allergens_from_user: Swift.String? = nil, + amino_acids_prev_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? = nil, + amino_acids_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? = nil, + carbon_footprint_percent_of_known_ingredients: Swift.Int? = nil, + categories_properties: Components.Schemas.product_extended.categories_propertiesPayload? = nil, + categories_properties_tags: [Swift.String]? = nil, + category_properties: Components.Schemas.product_extended.category_propertiesPayload? = nil, + ciqual_food_name_tags: [Swift.String]? = nil, + compared_to_category: Swift.String? = nil, + conservation_conditions: Swift.String? = nil, + customer_service: Swift.String? = nil, + expiration_date: Swift.String? = nil, + link: Swift.String? = nil, + main_countries_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? = nil, + minerals_prev_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? = nil, + minerals_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? = nil, + owner_fields: Components.Schemas.product_extended.owner_fieldsPayload? = nil, + nova_groups_markers: Components.Schemas.product_extended.nova_groups_markersPayload? = nil, + nucleotides_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? = nil, + origin: Swift.String? = nil, + purchase_places: Swift.String? = nil, + purchase_places_tags: [Swift.String]? = nil, + stores: Swift.String? = nil, + stores_tags: [Swift.String]? = nil, + traces_from_ingredients: Swift.String? = nil, + traces_from_user: Swift.String? = nil, + conservation_conditions__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: Swift.String? = nil, + customer_service__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: Swift.String? = nil, + origin__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: Swift.String? = nil + ) { + self.additives_original_tags = additives_original_tags + self.additives_prev_original_tags = additives_prev_original_tags + self.added_countries_tags = added_countries_tags + self.allergens_from_ingredients = allergens_from_ingredients + self.allergens_from_user = allergens_from_user + self.amino_acids_prev_tags = amino_acids_prev_tags + self.amino_acids_tags = amino_acids_tags + self.carbon_footprint_percent_of_known_ingredients = carbon_footprint_percent_of_known_ingredients + self.categories_properties = categories_properties + self.categories_properties_tags = categories_properties_tags + self.category_properties = category_properties + self.ciqual_food_name_tags = ciqual_food_name_tags + self.compared_to_category = compared_to_category + self.conservation_conditions = conservation_conditions + self.customer_service = customer_service + self.expiration_date = expiration_date + self.link = link + self.main_countries_tags = main_countries_tags + self.minerals_prev_tags = minerals_prev_tags + self.minerals_tags = minerals_tags + self.owner_fields = owner_fields + self.nova_groups_markers = nova_groups_markers + self.nucleotides_tags = nucleotides_tags + self.origin = origin + self.purchase_places = purchase_places + self.purchase_places_tags = purchase_places_tags + self.stores = stores + self.stores_tags = stores_tags + self.traces_from_ingredients = traces_from_ingredients + self.traces_from_user = traces_from_user + self.conservation_conditions__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ = conservation_conditions__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ + self.customer_service__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ = customer_service__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ + self.origin__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ = origin__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ + } + public enum CodingKeys: String, CodingKey { + case additives_original_tags + case additives_prev_original_tags + case added_countries_tags + case allergens_from_ingredients + case allergens_from_user + case amino_acids_prev_tags + case amino_acids_tags + case carbon_footprint_percent_of_known_ingredients + case categories_properties + case categories_properties_tags + case category_properties + case ciqual_food_name_tags + case compared_to_category + case conservation_conditions + case customer_service + case expiration_date + case link + case main_countries_tags + case minerals_prev_tags + case minerals_tags + case owner_fields + case nova_groups_markers + case nucleotides_tags + case origin + case purchase_places + case purchase_places_tags + case stores + case stores_tags + case traces_from_ingredients + case traces_from_user + case conservation_conditions__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ = #"conservation_conditions_(?\w\w)"# + case customer_service__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ = #"customer_service_(?\w\w)"# + case origin__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ = #"origin_(?\w\w)"# + } + } + /// Metadata of a product (author, editors, creation date, etc.) + /// + /// + /// - Remark: Generated from `#/components/schemas/product_meta`. + public struct product_meta: Codable, Hashable, Sendable { + /// Date when the product was added (UNIX timestamp format). + /// See also `entry_dates_tags` + /// + /// + /// - Remark: Generated from `#/components/schemas/product_meta/created_t`. + public var created_t: Swift.Int? + /// The contributor who added the product first. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_meta/creator`. + public var creator: Swift.String? + /// List of editors who edited the product. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_meta/editors_tags`. + public var editors_tags: [Swift.String]? + /// - Remark: Generated from `#/components/schemas/product_meta/informers_tags`. + public var informers_tags: [Swift.String]? + /// - Remark: Generated from `#/components/schemas/product_meta/interface_version_created`. + public var interface_version_created: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_meta/interface_version_modified`. + public var interface_version_modified: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_meta/languages`. + public struct languagesPayload: Codable, Hashable, Sendable { + /// **TODO** explain ! + /// + /// + /// - Remark: Generated from `#/components/schemas/product_meta/languages/en:(?\w\w)`. + public var en_colon__lpar__quest__lt_language_name_gt__bsol_w_bsol_w_rpar_: Swift.Int? + /// Creates a new `languagesPayload`. + /// + /// - Parameters: + /// - en_colon__lpar__quest__lt_language_name_gt__bsol_w_bsol_w_rpar_: **TODO** explain ! + public init(en_colon__lpar__quest__lt_language_name_gt__bsol_w_bsol_w_rpar_: Swift.Int? = nil) { + self.en_colon__lpar__quest__lt_language_name_gt__bsol_w_bsol_w_rpar_ = en_colon__lpar__quest__lt_language_name_gt__bsol_w_bsol_w_rpar_ + } + public enum CodingKeys: String, CodingKey { + case en_colon__lpar__quest__lt_language_name_gt__bsol_w_bsol_w_rpar_ = #"en:(?\w\w)"# + } + } + /// - Remark: Generated from `#/components/schemas/product_meta/languages`. + public var languages: Components.Schemas.product_meta.languagesPayload? + /// Same as `languages` but by language code, instead of language tags + /// + /// + /// - Remark: Generated from `#/components/schemas/product_meta/languages_codes`. + public struct languages_codesPayload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/product_meta/languages_codes/language_code_example`. + public var language_code_example: Swift.Int? + /// Creates a new `languages_codesPayload`. + /// + /// - Parameters: + /// - language_code_example: + public init(language_code_example: Swift.Int? = nil) { + self.language_code_example = language_code_example + } + public enum CodingKeys: String, CodingKey { + case language_code_example + } + } + /// Same as `languages` but by language code, instead of language tags + /// + /// + /// - Remark: Generated from `#/components/schemas/product_meta/languages_codes`. + public var languages_codes: Components.Schemas.product_meta.languages_codesPayload? + /// - Remark: Generated from `#/components/schemas/product_meta/languages_hierarchy`. + public var languages_hierarchy: [Swift.String]? + /// - Remark: Generated from `#/components/schemas/product_meta/languages_tags`. + public var languages_tags: [Swift.String]? + /// - Remark: Generated from `#/components/schemas/product_meta/last_edit_dates_tags`. + public var last_edit_dates_tags: [Swift.String]? + /// - Remark: Generated from `#/components/schemas/product_meta/last_editor`. + public var last_editor: Swift.String? + /// The username of the user who last modified the product. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_meta/last_modified_by`. + public var last_modified_by: Swift.String? + /// Date when the product page was last modified. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_meta/last_modified_t`. + public var last_modified_t: Swift.Int? + /// Id of the producer in case he provides his own data about a product (producer platform). + /// + /// + /// - Remark: Generated from `#/components/schemas/product_meta/owner`. + public var owner: Swift.String? + /// Tagyfied version of owner + /// + /// + /// - Remark: Generated from `#/components/schemas/product_meta/owners_tags`. + public var owners_tags: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_meta/photographers_tags`. + public var photographers_tags: [Swift.String]? + /// revision number of this product version (each edit adds a revision) + /// + /// - Remark: Generated from `#/components/schemas/product_meta/rev`. + public var rev: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_meta/sourcesPayload`. + public struct sourcesPayloadPayload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/product_meta/sourcesPayload/fields`. + public var fields: [Swift.String]? + /// - Remark: Generated from `#/components/schemas/product_meta/sourcesPayload/id`. + public var id: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_meta/sourcesPayload/images`. + public var images: [OpenAPIRuntime.OpenAPIObjectContainer]? + /// - Remark: Generated from `#/components/schemas/product_meta/sourcesPayload/import_t`. + public var import_t: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_meta/sourcesPayload/manufacturer`. + public var manufacturer: Swift.Int? + /// - Remark: Generated from `#/components/schemas/product_meta/sourcesPayload/name`. + public var name: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_meta/sourcesPayload/source_licence`. + public var source_licence: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_meta/sourcesPayload/source_licence_url`. + public var source_licence_url: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_meta/sourcesPayload/url`. + public var url: Swift.String? + /// Creates a new `sourcesPayloadPayload`. + /// + /// - Parameters: + /// - fields: + /// - id: + /// - images: + /// - import_t: + /// - manufacturer: + /// - name: + /// - source_licence: + /// - source_licence_url: + /// - url: + public init( + fields: [Swift.String]? = nil, + id: Swift.String? = nil, + images: [OpenAPIRuntime.OpenAPIObjectContainer]? = nil, + import_t: Swift.Int? = nil, + manufacturer: Swift.Int? = nil, + name: Swift.String? = nil, + source_licence: Swift.String? = nil, + source_licence_url: Swift.String? = nil, + url: Swift.String? = nil + ) { + self.fields = fields + self.id = id + self.images = images + self.import_t = import_t + self.manufacturer = manufacturer + self.name = name + self.source_licence = source_licence + self.source_licence_url = source_licence_url + self.url = url + } + public enum CodingKeys: String, CodingKey { + case fields + case id + case images + case import_t + case manufacturer + case name + case source_licence + case source_licence_url + case url + } + } + /// - Remark: Generated from `#/components/schemas/product_meta/sources`. + public typealias sourcesPayload = [Components.Schemas.product_meta.sourcesPayloadPayload] + /// - Remark: Generated from `#/components/schemas/product_meta/sources`. + public var sources: Components.Schemas.product_meta.sourcesPayload? + /// - Remark: Generated from `#/components/schemas/product_meta/sources_fields`. + public struct sources_fieldsPayload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/product_meta/sources_fields/org-gs1`. + public struct org_hyphen_gs1Payload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/product_meta/sources_fields/org-gs1/gln`. + public var gln: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_meta/sources_fields/org-gs1/gpcCategoryCode`. + public var gpcCategoryCode: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_meta/sources_fields/org-gs1/gpcCategoryName`. + public var gpcCategoryName: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_meta/sources_fields/org-gs1/isAllergenRelevantDataProvided`. + public var isAllergenRelevantDataProvided: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_meta/sources_fields/org-gs1/lastChangeDateTime`. + public var lastChangeDateTime: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_meta/sources_fields/org-gs1/partyName`. + public var partyName: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_meta/sources_fields/org-gs1/productionVariantDescription`. + public var productionVariantDescription: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_meta/sources_fields/org-gs1/publicationDateTime`. + public var publicationDateTime: Swift.String? + /// Creates a new `org_hyphen_gs1Payload`. + /// + /// - Parameters: + /// - gln: + /// - gpcCategoryCode: + /// - gpcCategoryName: + /// - isAllergenRelevantDataProvided: + /// - lastChangeDateTime: + /// - partyName: + /// - productionVariantDescription: + /// - publicationDateTime: + public init( + gln: Swift.String? = nil, + gpcCategoryCode: Swift.String? = nil, + gpcCategoryName: Swift.String? = nil, + isAllergenRelevantDataProvided: Swift.String? = nil, + lastChangeDateTime: Swift.String? = nil, + partyName: Swift.String? = nil, + productionVariantDescription: Swift.String? = nil, + publicationDateTime: Swift.String? = nil + ) { + self.gln = gln + self.gpcCategoryCode = gpcCategoryCode + self.gpcCategoryName = gpcCategoryName + self.isAllergenRelevantDataProvided = isAllergenRelevantDataProvided + self.lastChangeDateTime = lastChangeDateTime + self.partyName = partyName + self.productionVariantDescription = productionVariantDescription + self.publicationDateTime = publicationDateTime + } + public enum CodingKeys: String, CodingKey { + case gln + case gpcCategoryCode + case gpcCategoryName + case isAllergenRelevantDataProvided + case lastChangeDateTime + case partyName + case productionVariantDescription + case publicationDateTime + } + } + /// - Remark: Generated from `#/components/schemas/product_meta/sources_fields/org-gs1`. + public var org_hyphen_gs1: Components.Schemas.product_meta.sources_fieldsPayload.org_hyphen_gs1Payload? + /// Creates a new `sources_fieldsPayload`. + /// + /// - Parameters: + /// - org_hyphen_gs1: + public init(org_hyphen_gs1: Components.Schemas.product_meta.sources_fieldsPayload.org_hyphen_gs1Payload? = nil) { + self.org_hyphen_gs1 = org_hyphen_gs1 + } + public enum CodingKeys: String, CodingKey { + case org_hyphen_gs1 = "org-gs1" + } + } + /// - Remark: Generated from `#/components/schemas/product_meta/sources_fields`. + public var sources_fields: Components.Schemas.product_meta.sources_fieldsPayload? + /// - Remark: Generated from `#/components/schemas/product_meta/teams`. + public var teams: Swift.String? + /// - Remark: Generated from `#/components/schemas/product_meta/teams_tags`. + public var teams_tags: [Swift.String]? + /// - Remark: Generated from `#/components/schemas/product_meta/update_key`. + public var update_key: Swift.String? + /// Creates a new `product_meta`. + /// + /// - Parameters: + /// - created_t: Date when the product was added (UNIX timestamp format). + /// - creator: The contributor who added the product first. + /// - editors_tags: List of editors who edited the product. + /// - informers_tags: + /// - interface_version_created: + /// - interface_version_modified: + /// - languages: + /// - languages_codes: Same as `languages` but by language code, instead of language tags + /// - languages_hierarchy: + /// - languages_tags: + /// - last_edit_dates_tags: + /// - last_editor: + /// - last_modified_by: The username of the user who last modified the product. + /// - last_modified_t: Date when the product page was last modified. + /// - owner: Id of the producer in case he provides his own data about a product (producer platform). + /// - owners_tags: Tagyfied version of owner + /// - photographers_tags: + /// - rev: revision number of this product version (each edit adds a revision) + /// - sources: + /// - sources_fields: + /// - teams: + /// - teams_tags: + /// - update_key: + public init( + created_t: Swift.Int? = nil, + creator: Swift.String? = nil, + editors_tags: [Swift.String]? = nil, + informers_tags: [Swift.String]? = nil, + interface_version_created: Swift.String? = nil, + interface_version_modified: Swift.String? = nil, + languages: Components.Schemas.product_meta.languagesPayload? = nil, + languages_codes: Components.Schemas.product_meta.languages_codesPayload? = nil, + languages_hierarchy: [Swift.String]? = nil, + languages_tags: [Swift.String]? = nil, + last_edit_dates_tags: [Swift.String]? = nil, + last_editor: Swift.String? = nil, + last_modified_by: Swift.String? = nil, + last_modified_t: Swift.Int? = nil, + owner: Swift.String? = nil, + owners_tags: Swift.String? = nil, + photographers_tags: [Swift.String]? = nil, + rev: Swift.Int? = nil, + sources: Components.Schemas.product_meta.sourcesPayload? = nil, + sources_fields: Components.Schemas.product_meta.sources_fieldsPayload? = nil, + teams: Swift.String? = nil, + teams_tags: [Swift.String]? = nil, + update_key: Swift.String? = nil + ) { + self.created_t = created_t + self.creator = creator + self.editors_tags = editors_tags + self.informers_tags = informers_tags + self.interface_version_created = interface_version_created + self.interface_version_modified = interface_version_modified + self.languages = languages + self.languages_codes = languages_codes + self.languages_hierarchy = languages_hierarchy + self.languages_tags = languages_tags + self.last_edit_dates_tags = last_edit_dates_tags + self.last_editor = last_editor + self.last_modified_by = last_modified_by + self.last_modified_t = last_modified_t + self.owner = owner + self.owners_tags = owners_tags + self.photographers_tags = photographers_tags + self.rev = rev + self.sources = sources + self.sources_fields = sources_fields + self.teams = teams + self.teams_tags = teams_tags + self.update_key = update_key + } + public enum CodingKeys: String, CodingKey { + case created_t + case creator + case editors_tags + case informers_tags + case interface_version_created + case interface_version_modified + case languages + case languages_codes + case languages_hierarchy + case languages_tags + case last_edit_dates_tags + case last_editor + case last_modified_by + case last_modified_t + case owner + case owners_tags + case photographers_tags + case rev + case sources + case sources_fields + case teams + case teams_tags + case update_key + } + } + /// The title of a panel. + /// + /// - Remark: Generated from `#/components/schemas/title_element`. + public struct title_element: Codable, Hashable, Sendable { + /// A short name of this panel, not including any actual values + /// + /// - Remark: Generated from `#/components/schemas/title_element/name`. + public var name: Swift.String? + /// - Remark: Generated from `#/components/schemas/title_element/title`. + public var title: Swift.String? + /// Used to indicate how the value of this item is measured, such as "grade" for Nutri-Score and Eco-Score or "percentage" for Salt + /// + /// - Remark: Generated from `#/components/schemas/title_element/type`. + @frozen public enum _typePayload: String, Codable, Hashable, Sendable, CaseIterable { + case grade = "grade" + case percentage = "percentage" + } + /// Used to indicate how the value of this item is measured, such as "grade" for Nutri-Score and Eco-Score or "percentage" for Salt + /// + /// - Remark: Generated from `#/components/schemas/title_element/type`. + public var _type: Components.Schemas.title_element._typePayload? + /// The value for this panel where it corresponds to a A to E grade such as the Nutri-Score of the Eco-Score. + /// + /// - Remark: Generated from `#/components/schemas/title_element/grade`. + @frozen public enum gradePayload: String, Codable, Hashable, Sendable, CaseIterable { + case a = "a" + case b = "b" + case c = "c" + case d = "d" + case e = "e" + case unknown = "unknown" + } + /// The value for this panel where it corresponds to a A to E grade such as the Nutri-Score of the Eco-Score. + /// + /// - Remark: Generated from `#/components/schemas/title_element/grade`. + public var grade: Components.Schemas.title_element.gradePayload? + /// The numeric value of the panel, where the type is "percentage" + /// + /// - Remark: Generated from `#/components/schemas/title_element/value`. + public var value: Swift.Double? + /// - Remark: Generated from `#/components/schemas/title_element/icon_url`. + public var icon_url: Swift.String? + /// - Remark: Generated from `#/components/schemas/title_element/icon_color_from_evaluation`. + public var icon_color_from_evaluation: Swift.String? + /// If set to "small", the icon should be displayed at a small size. + /// + /// + /// - Remark: Generated from `#/components/schemas/title_element/icon_size`. + public var icon_size: Swift.String? + /// Creates a new `title_element`. + /// + /// - Parameters: + /// - name: A short name of this panel, not including any actual values + /// - title: + /// - _type: Used to indicate how the value of this item is measured, such as "grade" for Nutri-Score and Eco-Score or "percentage" for Salt + /// - grade: The value for this panel where it corresponds to a A to E grade such as the Nutri-Score of the Eco-Score. + /// - value: The numeric value of the panel, where the type is "percentage" + /// - icon_url: + /// - icon_color_from_evaluation: + /// - icon_size: If set to "small", the icon should be displayed at a small size. + public init( + name: Swift.String? = nil, + title: Swift.String? = nil, + _type: Components.Schemas.title_element._typePayload? = nil, + grade: Components.Schemas.title_element.gradePayload? = nil, + value: Swift.Double? = nil, + icon_url: Swift.String? = nil, + icon_color_from_evaluation: Swift.String? = nil, + icon_size: Swift.String? = nil + ) { + self.name = name + self.title = title + self._type = _type + self.grade = grade + self.value = value + self.icon_url = icon_url + self.icon_color_from_evaluation = icon_color_from_evaluation + self.icon_size = icon_size + } + public enum CodingKeys: String, CodingKey { + case name + case title + case _type = "type" + case grade + case value + case icon_url + case icon_color_from_evaluation + case icon_size + } + } + /// A text in simple HTML format to display. + /// + /// For some specific texts that correspond to a product field (e.g. a product name, the ingredients list of a product),the edit_field_* fields are used to indicate how to edit the field value. + /// + /// - Remark: Generated from `#/components/schemas/text_element`. + public struct text_element: Codable, Hashable, Sendable { + /// the type of text, might influence the way you display it. + /// + /// + /// - Remark: Generated from `#/components/schemas/text_element/type`. + @frozen public enum _typePayload: String, Codable, Hashable, Sendable, CaseIterable { + case summary = "summary" + case warning = "warning" + case notes = "notes" + } + /// the type of text, might influence the way you display it. + /// + /// + /// - Remark: Generated from `#/components/schemas/text_element/type`. + public var _type: Components.Schemas.text_element._typePayload? + /// Text to display in HTML format. + /// + /// - Remark: Generated from `#/components/schemas/text_element/html`. + public var html: Swift.String? + /// Language of the text. The name of the language is returned in the language requested when making the API call. e.g. if the text is in Polish, and the requested language is French, the language field will contain "Polonais" (French for "Polish"). Only set for specific fields such as the list of ingredients of a product. + /// + /// - Remark: Generated from `#/components/schemas/text_element/language`. + public var language: Swift.String? + /// 2 letter language code for the text. Only set for specific fields such as the list of ingredients of a product. + /// + /// - Remark: Generated from `#/components/schemas/text_element/lc`. + public var lc: Swift.String? + /// id of the field used to edit this text in the product edit API. + /// + /// - Remark: Generated from `#/components/schemas/text_element/edit_field_id`. + public var edit_field_id: Swift.String? + /// Type of the product field. + /// + /// - Remark: Generated from `#/components/schemas/text_element/edit_field_type`. + public var edit_field_type: Swift.String? + /// Current value of the product field. This may differ from the html field which can contain extra formating. + /// + /// - Remark: Generated from `#/components/schemas/text_element/edit_field_value`. + public var edit_field_value: Swift.String? + /// Link to the source + /// + /// - Remark: Generated from `#/components/schemas/text_element/source_url`. + public var source_url: Swift.String? + /// name of the source + /// + /// - Remark: Generated from `#/components/schemas/text_element/source_text`. + public var source_text: Swift.String? + /// Source locale name + /// + /// - Remark: Generated from `#/components/schemas/text_element/source_lc`. + public var source_lc: Swift.String? + /// Human readable source locale name + /// + /// - Remark: Generated from `#/components/schemas/text_element/source_language`. + public var source_language: Swift.String? + /// Creates a new `text_element`. + /// + /// - Parameters: + /// - _type: the type of text, might influence the way you display it. + /// - html: Text to display in HTML format. + /// - language: Language of the text. The name of the language is returned in the language requested when making the API call. e.g. if the text is in Polish, and the requested language is French, the language field will contain "Polonais" (French for "Polish"). Only set for specific fields such as the list of ingredients of a product. + /// - lc: 2 letter language code for the text. Only set for specific fields such as the list of ingredients of a product. + /// - edit_field_id: id of the field used to edit this text in the product edit API. + /// - edit_field_type: Type of the product field. + /// - edit_field_value: Current value of the product field. This may differ from the html field which can contain extra formating. + /// - source_url: Link to the source + /// - source_text: name of the source + /// - source_lc: Source locale name + /// - source_language: Human readable source locale name + public init( + _type: Components.Schemas.text_element._typePayload? = nil, + html: Swift.String? = nil, + language: Swift.String? = nil, + lc: Swift.String? = nil, + edit_field_id: Swift.String? = nil, + edit_field_type: Swift.String? = nil, + edit_field_value: Swift.String? = nil, + source_url: Swift.String? = nil, + source_text: Swift.String? = nil, + source_lc: Swift.String? = nil, + source_language: Swift.String? = nil + ) { + self._type = _type + self.html = html + self.language = language + self.lc = lc + self.edit_field_id = edit_field_id + self.edit_field_type = edit_field_type + self.edit_field_value = edit_field_value + self.source_url = source_url + self.source_text = source_text + self.source_lc = source_lc + self.source_language = source_language + } + public enum CodingKeys: String, CodingKey { + case _type = "type" + case html + case language + case lc + case edit_field_id + case edit_field_type + case edit_field_value + case source_url + case source_text + case source_lc + case source_language + } + } + /// - Remark: Generated from `#/components/schemas/image_element`. + public struct image_element: Codable, Hashable, Sendable { + /// full URL of the image + /// + /// - Remark: Generated from `#/components/schemas/image_element/url`. + public var url: Swift.String? + /// Width of the image. + /// + /// This is just a suggestion coming from the server, + /// the client may choose to use its own dimensions for the image. + /// + /// + /// - Remark: Generated from `#/components/schemas/image_element/width`. + public var width: Swift.Int? + /// Height of the image. + /// + /// This is just a suggestion coming from the server, + /// the client may choose to use its own dimensions for the image. + /// + /// + /// - Remark: Generated from `#/components/schemas/image_element/height`. + public var height: Swift.Int? + /// Alt Text of the image. + /// + /// - Remark: Generated from `#/components/schemas/image_element/alt_text`. + public var alt_text: Swift.String? + /// Creates a new `image_element`. + /// + /// - Parameters: + /// - url: full URL of the image + /// - width: Width of the image. + /// - height: Height of the image. + /// - alt_text: Alt Text of the image. + public init( + url: Swift.String? = nil, + width: Swift.Int? = nil, + height: Swift.Int? = nil, + alt_text: Swift.String? = nil + ) { + self.url = url + self.width = width + self.height = height + self.alt_text = alt_text + } + public enum CodingKeys: String, CodingKey { + case url + case width + case height + case alt_text + } + } + /// Panels can include other panels as sub-panels using the panel_element. + /// + /// - Remark: Generated from `#/components/schemas/panel_element`. + public struct panel_element: Codable, Hashable, Sendable { + /// The id of the panel to include. The id is the key of the panel in the panels object returned in the knowledge_panels field. + /// + /// - Remark: Generated from `#/components/schemas/panel_element/panel_id`. + public var panel_id: Swift.String? + /// Creates a new `panel_element`. + /// + /// - Parameters: + /// - panel_id: The id of the panel to include. The id is the key of the panel in the panels object returned in the knowledge_panels field. + public init(panel_id: Swift.String? = nil) { + self.panel_id = panel_id + } + public enum CodingKeys: String, CodingKey { + case panel_id + } + } + /// The panel group element is used to display an optional title followed by a number of sub-panels. + /// + /// - Remark: Generated from `#/components/schemas/panel_group_element`. + public struct panel_group_element: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/panel_group_element/title`. + public var title: Swift.String? + /// The ids of the panels to include. The ids are the keys of the panels in the panels object returned in the knowledge_panels field. + /// + /// - Remark: Generated from `#/components/schemas/panel_group_element/panel_ids`. + public var panel_ids: [Swift.String]? + /// Creates a new `panel_group_element`. + /// + /// - Parameters: + /// - title: + /// - panel_ids: The ids of the panels to include. The ids are the keys of the panels in the panels object returned in the knowledge_panels field. + public init( + title: Swift.String? = nil, + panel_ids: [Swift.String]? = nil + ) { + self.title = title + self.panel_ids = panel_ids + } + public enum CodingKeys: String, CodingKey { + case title + case panel_ids + } + } + /// Element to display a table. + /// + /// - Remark: Generated from `#/components/schemas/table_element`. + public struct table_element: Codable, Hashable, Sendable { + /// An id for the table. + /// + /// - Remark: Generated from `#/components/schemas/table_element/id`. + public var id: Swift.String? + /// Title of the column. + /// + /// + /// - Remark: Generated from `#/components/schemas/table_element/title`. + public var title: Swift.String? + /// - Remark: Generated from `#/components/schemas/table_element/rows`. + public var rows: Swift.String? + /// - Remark: Generated from `#/components/schemas/table_element/columnsPayload`. + public struct columnsPayloadPayload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/table_element/columnsPayload/type`. + public var _type: Swift.String? + /// - Remark: Generated from `#/components/schemas/table_element/columnsPayload/text`. + public var text: Swift.String? + /// - Remark: Generated from `#/components/schemas/table_element/columnsPayload/text_for_small_screens`. + public var text_for_small_screens: Swift.String? + /// - Remark: Generated from `#/components/schemas/table_element/columnsPayload/style`. + public var style: Swift.String? + /// - Remark: Generated from `#/components/schemas/table_element/columnsPayload/column_group_id`. + public var column_group_id: Swift.String? + /// - Remark: Generated from `#/components/schemas/table_element/columnsPayload/shown_by_default`. + public var shown_by_default: Swift.Bool? + /// Creates a new `columnsPayloadPayload`. + /// + /// - Parameters: + /// - _type: + /// - text: + /// - text_for_small_screens: + /// - style: + /// - column_group_id: + /// - shown_by_default: + public init( + _type: Swift.String? = nil, + text: Swift.String? = nil, + text_for_small_screens: Swift.String? = nil, + style: Swift.String? = nil, + column_group_id: Swift.String? = nil, + shown_by_default: Swift.Bool? = nil + ) { + self._type = _type + self.text = text + self.text_for_small_screens = text_for_small_screens + self.style = style + self.column_group_id = column_group_id + self.shown_by_default = shown_by_default + } + public enum CodingKeys: String, CodingKey { + case _type = "type" + case text + case text_for_small_screens + case style + case column_group_id + case shown_by_default + } + } + /// - Remark: Generated from `#/components/schemas/table_element/columns`. + public typealias columnsPayload = [Components.Schemas.table_element.columnsPayloadPayload] + /// - Remark: Generated from `#/components/schemas/table_element/columns`. + public var columns: Components.Schemas.table_element.columnsPayload? + /// Creates a new `table_element`. + /// + /// - Parameters: + /// - id: An id for the table. + /// - title: Title of the column. + /// - rows: + /// - columns: + public init( + id: Swift.String? = nil, + title: Swift.String? = nil, + rows: Swift.String? = nil, + columns: Components.Schemas.table_element.columnsPayload? = nil + ) { + self.id = id + self.title = title + self.rows = rows + self.columns = columns + } + public enum CodingKeys: String, CodingKey { + case id + case title + case rows + case columns + } + } + /// Each element object contains one specific element object such as a text element or an image element. + /// + /// + /// - Remark: Generated from `#/components/schemas/element`. + public struct element: Codable, Hashable, Sendable { + /// The type of the included element object. + /// The type also indicates which field contains the included element object. + /// e.g. if the type is "text", the included element object will be in the "text_element" field. + /// + /// Note that in the future, new type of element may be added, + /// so your code should ignore unrecognized types, and unknown properties. + /// + /// TODO: add Map type + /// + /// + /// - Remark: Generated from `#/components/schemas/element/type`. + public var _type: OpenAPIRuntime.OpenAPIValueContainer + /// - Remark: Generated from `#/components/schemas/element/text_element`. + public var text_element: Components.Schemas.text_element? + /// - Remark: Generated from `#/components/schemas/element/image_element`. + public var image_element: Components.Schemas.image_element? + /// - Remark: Generated from `#/components/schemas/element/action_element`. + public var action_element: Swift.String? + /// - Remark: Generated from `#/components/schemas/element/panel_element`. + public var panel_element: Components.Schemas.panel_element? + /// - Remark: Generated from `#/components/schemas/element/panel_group_element`. + public var panel_group_element: Components.Schemas.panel_group_element? + /// - Remark: Generated from `#/components/schemas/element/table_element`. + public var table_element: Components.Schemas.table_element? + /// Creates a new `element`. + /// + /// - Parameters: + /// - _type: The type of the included element object. + /// - text_element: + /// - image_element: + /// - action_element: + /// - panel_element: + /// - panel_group_element: + /// - table_element: + public init( + _type: OpenAPIRuntime.OpenAPIValueContainer, + text_element: Components.Schemas.text_element? = nil, + image_element: Components.Schemas.image_element? = nil, + action_element: Swift.String? = nil, + panel_element: Components.Schemas.panel_element? = nil, + panel_group_element: Components.Schemas.panel_group_element? = nil, + table_element: Components.Schemas.table_element? = nil + ) { + self._type = _type + self.text_element = text_element + self.image_element = image_element + self.action_element = action_element + self.panel_element = panel_element + self.panel_group_element = panel_group_element + self.table_element = table_element + } + public enum CodingKeys: String, CodingKey { + case _type = "type" + case text_element + case image_element + case action_element + case panel_element + case panel_group_element + case table_element + } + } + /// Each panel contains an optional title and an optional array of elements. + /// + /// - Remark: Generated from `#/components/schemas/panel`. + public struct panel: Codable, Hashable, Sendable { + /// Type of the panel. If set to "card", the panel and its sub-panels should be displayed in a card. If set to "inline", the panel should have its content always displayed. + /// + /// - Remark: Generated from `#/components/schemas/panel/type`. + public var _type: Swift.String? + /// If true, the panel is to be displayed already expanded. If false, only the title should be displayed, and the user should be able to click or tap it to open the panel and display the elements. + /// + /// - Remark: Generated from `#/components/schemas/panel/expanded`. + public var expanded: Swift.Bool? + /// If set to "large", the content of the panel should be expanded on large screens, but it should still be possible to unexpand it. + /// + /// - Remark: Generated from `#/components/schemas/panel/expand_for`. + public var expand_for: Swift.String? + /// A simple assessment of the panel value, typically used to format fonts, et.c e.g. bad = red + /// + /// - Remark: Generated from `#/components/schemas/panel/evaluation`. + @frozen public enum evaluationPayload: String, Codable, Hashable, Sendable, CaseIterable { + case good = "good" + case average = "average" + case neutral = "neutral" + case bad = "bad" + case unknown = "unknown" + } + /// A simple assessment of the panel value, typically used to format fonts, et.c e.g. bad = red + /// + /// - Remark: Generated from `#/components/schemas/panel/evaluation`. + public var evaluation: Components.Schemas.panel.evaluationPayload? + /// - Remark: Generated from `#/components/schemas/panel/title_element`. + public var title_element: Components.Schemas.title_element? + /// An ordered list of elements to display in the content of the panel. + /// + /// - Remark: Generated from `#/components/schemas/panel/elements`. + public var elements: [Components.Schemas.element]? + /// a message level, as levels we use in log. + /// It might help theming the panel visualy + /// + /// + /// - Remark: Generated from `#/components/schemas/panel/level`. + public var level: Swift.String? + /// size is either empty (normal display) + /// or small to indicate a panel that should have a smaller font size + /// + /// + /// - Remark: Generated from `#/components/schemas/panel/size`. + @frozen public enum sizePayload: String, Codable, Hashable, Sendable, CaseIterable { + case small = "small" + } + /// size is either empty (normal display) + /// or small to indicate a panel that should have a smaller font size + /// + /// + /// - Remark: Generated from `#/components/schemas/panel/size`. + public var size: Components.Schemas.panel.sizePayload? + /// - Remark: Generated from `#/components/schemas/panel/topics`. + public var topics: [Swift.String]? + /// Creates a new `panel`. + /// + /// - Parameters: + /// - _type: Type of the panel. If set to "card", the panel and its sub-panels should be displayed in a card. If set to "inline", the panel should have its content always displayed. + /// - expanded: If true, the panel is to be displayed already expanded. If false, only the title should be displayed, and the user should be able to click or tap it to open the panel and display the elements. + /// - expand_for: If set to "large", the content of the panel should be expanded on large screens, but it should still be possible to unexpand it. + /// - evaluation: A simple assessment of the panel value, typically used to format fonts, et.c e.g. bad = red + /// - title_element: + /// - elements: An ordered list of elements to display in the content of the panel. + /// - level: a message level, as levels we use in log. + /// - size: size is either empty (normal display) + /// - topics: + public init( + _type: Swift.String? = nil, + expanded: Swift.Bool? = nil, + expand_for: Swift.String? = nil, + evaluation: Components.Schemas.panel.evaluationPayload? = nil, + title_element: Components.Schemas.title_element? = nil, + elements: [Components.Schemas.element]? = nil, + level: Swift.String? = nil, + size: Components.Schemas.panel.sizePayload? = nil, + topics: [Swift.String]? = nil + ) { + self._type = _type + self.expanded = expanded + self.expand_for = expand_for + self.evaluation = evaluation + self.title_element = title_element + self.elements = elements + self.level = level + self.size = size + self.topics = topics + } + public enum CodingKeys: String, CodingKey { + case _type = "type" + case expanded + case expand_for + case evaluation + case title_element + case elements + case level + case size + case topics + } + } + /// The panels object is a dictionary of individual panel objects. + /// Each key of the dictionary is the id of the panel, and the value is the panel object. + /// + /// Apps typically display a number of root panels with known panel ids (e.g. health_card and environment_card). Panels can reference other panels and display them as sub-panels. + /// + /// - Remark: Generated from `#/components/schemas/panels`. + public struct panels: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/panels/additionalProperties`. + public var additionalProperties: Components.Schemas.panel? + /// Creates a new `panels`. + /// + /// - Parameters: + /// - additionalProperties: + public init(additionalProperties: Components.Schemas.panel? = nil) { + self.additionalProperties = additionalProperties + } + public enum CodingKeys: String, CodingKey { + case additionalProperties + } + } + /// Knowledge panels for a product + /// + /// + /// - Remark: Generated from `#/components/schemas/product_knowledge_panels`. + public struct product_knowledge_panels: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/product_knowledge_panels/knowledge_panels`. + public var knowledge_panels: Components.Schemas.panels? + /// Creates a new `product_knowledge_panels`. + /// + /// - Parameters: + /// - knowledge_panels: + public init(knowledge_panels: Components.Schemas.panels? = nil) { + self.knowledge_panels = knowledge_panels + } + public enum CodingKeys: String, CodingKey { + case knowledge_panels + } + } + /// Specific data about a product to enable personal ranking + /// + /// + /// - Remark: Generated from `#/components/schemas/product_attribute_groups`. + public struct product_attribute_groups: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/product_attribute_groups/attribute_groupsPayload`. + public struct attribute_groupsPayloadPayload: Codable, Hashable, Sendable { + /// Unique id of the attribute. + /// + /// It will be use to match against preferences parameters. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_attribute_groups/attribute_groupsPayload/id`. + public var id: Swift.String? + /// wether we have the information to really compute this criteria or not. + /// + /// - Remark: Generated from `#/components/schemas/product_attribute_groups/attribute_groupsPayload/status`. + @frozen public enum statusPayload: String, Codable, Hashable, Sendable, CaseIterable { + case known = "known" + case unknown = "unknown" + } + /// wether we have the information to really compute this criteria or not. + /// + /// - Remark: Generated from `#/components/schemas/product_attribute_groups/attribute_groupsPayload/status`. + public var status: Components.Schemas.product_attribute_groups.attribute_groupsPayloadPayload.statusPayload? + /// A descriptive sentence about the situation of the product concerning attribute + /// + /// + /// - Remark: Generated from `#/components/schemas/product_attribute_groups/attribute_groupsPayload/title`. + public var title: Swift.String? + /// a numeric value for the match, + /// telling how much the products ranks well for this particular attribute. + /// The higher the value, the better the match. + /// + /// + /// - Remark: Generated from `#/components/schemas/product_attribute_groups/attribute_groupsPayload/match`. + public var match: Swift.Float? + /// every attribute as a grade for a to e + /// + /// - Remark: Generated from `#/components/schemas/product_attribute_groups/attribute_groupsPayload/grade`. + @frozen public enum gradePayload: String, Codable, Hashable, Sendable, CaseIterable { + case unknown = "unknown" + case a = "a" + case b = "b" + case c = "c" + case d = "d" + case e = "e" + } + /// every attribute as a grade for a to e + /// + /// - Remark: Generated from `#/components/schemas/product_attribute_groups/attribute_groupsPayload/grade`. + public var grade: Components.Schemas.product_attribute_groups.attribute_groupsPayloadPayload.gradePayload? + /// The name of attribute, for eventual display + /// + /// - Remark: Generated from `#/components/schemas/product_attribute_groups/attribute_groupsPayload/name`. + public var name: Swift.String? + /// an icon representing the attribute match (often using a color) + /// + /// - Remark: Generated from `#/components/schemas/product_attribute_groups/attribute_groupsPayload/icon_url`. + public var icon_url: Swift.String? + /// An eventual description of the value of the property upon which this attribute is based + /// + /// - Remark: Generated from `#/components/schemas/product_attribute_groups/attribute_groupsPayload/description`. + public var description: Swift.String? + /// An eventual short description of the value of the property upon which this attribute is based + /// + /// - Remark: Generated from `#/components/schemas/product_attribute_groups/attribute_groupsPayload/description_short`. + public var description_short: Swift.String? + /// Creates a new `attribute_groupsPayloadPayload`. + /// + /// - Parameters: + /// - id: Unique id of the attribute. + /// - status: wether we have the information to really compute this criteria or not. + /// - title: A descriptive sentence about the situation of the product concerning attribute + /// - match: a numeric value for the match, + /// - grade: every attribute as a grade for a to e + /// - name: The name of attribute, for eventual display + /// - icon_url: an icon representing the attribute match (often using a color) + /// - description: An eventual description of the value of the property upon which this attribute is based + /// - description_short: An eventual short description of the value of the property upon which this attribute is based + public init( + id: Swift.String? = nil, + status: Components.Schemas.product_attribute_groups.attribute_groupsPayloadPayload.statusPayload? = nil, + title: Swift.String? = nil, + match: Swift.Float? = nil, + grade: Components.Schemas.product_attribute_groups.attribute_groupsPayloadPayload.gradePayload? = nil, + name: Swift.String? = nil, + icon_url: Swift.String? = nil, + description: Swift.String? = nil, + description_short: Swift.String? = nil + ) { + self.id = id + self.status = status + self.title = title + self.match = match + self.grade = grade + self.name = name + self.icon_url = icon_url + self.description = description + self.description_short = description_short + } + public enum CodingKeys: String, CodingKey { + case id + case status + case title + case match + case grade + case name + case icon_url + case description + case description_short + } + } + /// Each element is an attribute that can help compute a personal ranking for the product + /// + /// - Remark: Generated from `#/components/schemas/product_attribute_groups/attribute_groups`. + public typealias attribute_groupsPayload = [Components.Schemas.product_attribute_groups.attribute_groupsPayloadPayload] + /// Each element is an attribute that can help compute a personal ranking for the product + /// + /// - Remark: Generated from `#/components/schemas/product_attribute_groups/attribute_groups`. + public var attribute_groups: Components.Schemas.product_attribute_groups.attribute_groupsPayload? + /// Creates a new `product_attribute_groups`. + /// + /// - Parameters: + /// - attribute_groups: Each element is an attribute that can help compute a personal ranking for the product + public init(attribute_groups: Components.Schemas.product_attribute_groups.attribute_groupsPayload? = nil) { + self.attribute_groups = attribute_groups + } + public enum CodingKeys: String, CodingKey { + case attribute_groups + } + } + /// This is all the fields describing a product and how to display it on a page. + /// + /// Refer to the different sub schema for more readable entries: + /// + /// * [Product Base](#cmp--schemas-product-base): Base fields of a product + /// * [Product Misc](#cmp--schemas-product-misc): Miscellaneous but important fields of a product + /// * [Product Tags](#cmp--schemas-product-tags): Tags fields on a product + /// * [Product Nutrition](#cmp--schemas-product-nutrition): Nutrition fields of a product + /// * [Product Ingredients](#cmp--schemas-product-ingredients): Fields about ingredients of a product + /// * [Product Images](#cmp--schemas-product-images): Information about Images of a product + /// * [Product Eco-Score](#cmp--schemas-product-images): Fields related to Eco-Score for a product + /// * [Product Metadata](#cmp--schemas-product-ecoscore): Metadata of a product (author, editors, etc.) + /// * [Product Data Quality](#cmp--schemas-product-quality): fields related to data quality for a product + /// * [Product Knowledge Panels](#cmp--schemas-product-knowledge-panels): Knowledge panels for a product + /// * [Product Attribute Groups](#cmp--schemas-product-attribute-groups): Attribute groups for personal product matching + /// + /// + /// - Remark: Generated from `#/components/schemas/product`. + public struct product: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/product/value1`. + public var value1: Components.Schemas.product_base + /// - Remark: Generated from `#/components/schemas/product/value2`. + public var value2: Components.Schemas.product_misc + /// - Remark: Generated from `#/components/schemas/product/value3`. + public var value3: Components.Schemas.product_tags + /// - Remark: Generated from `#/components/schemas/product/value4`. + public var value4: Components.Schemas.product_images + /// - Remark: Generated from `#/components/schemas/product/value5`. + public var value5: Components.Schemas.product_ecoscore + /// - Remark: Generated from `#/components/schemas/product/value6`. + public var value6: Components.Schemas.product_ingredients + /// - Remark: Generated from `#/components/schemas/product/value7`. + public var value7: Components.Schemas.product_nutrition + /// - Remark: Generated from `#/components/schemas/product/value8`. + public var value8: Components.Schemas.product_quality + /// - Remark: Generated from `#/components/schemas/product/value9`. + public var value9: Components.Schemas.product_extended + /// - Remark: Generated from `#/components/schemas/product/value10`. + public var value10: Components.Schemas.product_meta + /// - Remark: Generated from `#/components/schemas/product/value11`. + public var value11: Components.Schemas.product_knowledge_panels + /// - Remark: Generated from `#/components/schemas/product/value12`. + public var value12: Components.Schemas.product_attribute_groups + /// Creates a new `product`. + /// + /// - Parameters: + /// - value1: + /// - value2: + /// - value3: + /// - value4: + /// - value5: + /// - value6: + /// - value7: + /// - value8: + /// - value9: + /// - value10: + /// - value11: + /// - value12: + public init( + value1: Components.Schemas.product_base, + value2: Components.Schemas.product_misc, + value3: Components.Schemas.product_tags, + value4: Components.Schemas.product_images, + value5: Components.Schemas.product_ecoscore, + value6: Components.Schemas.product_ingredients, + value7: Components.Schemas.product_nutrition, + value8: Components.Schemas.product_quality, + value9: Components.Schemas.product_extended, + value10: Components.Schemas.product_meta, + value11: Components.Schemas.product_knowledge_panels, + value12: Components.Schemas.product_attribute_groups + ) { + self.value1 = value1 + self.value2 = value2 + self.value3 = value3 + self.value4 = value4 + self.value5 = value5 + self.value6 = value6 + self.value7 = value7 + self.value8 = value8 + self.value9 = value9 + self.value10 = value10 + self.value11 = value11 + self.value12 = value12 + } + public init(from decoder: any Decoder) throws { + value1 = try .init(from: decoder) + value2 = try .init(from: decoder) + value3 = try .init(from: decoder) + value4 = try .init(from: decoder) + value5 = try .init(from: decoder) + value6 = try .init(from: decoder) + value7 = try .init(from: decoder) + value8 = try .init(from: decoder) + value9 = try .init(from: decoder) + value10 = try .init(from: decoder) + value11 = try .init(from: decoder) + value12 = try .init(from: decoder) + } + public func encode(to encoder: any Encoder) throws { + try value1.encode(to: encoder) + try value2.encode(to: encoder) + try value3.encode(to: encoder) + try value4.encode(to: encoder) + try value5.encode(to: encoder) + try value6.encode(to: encoder) + try value7.encode(to: encoder) + try value8.encode(to: encoder) + try value9.encode(to: encoder) + try value10.encode(to: encoder) + try value11.encode(to: encoder) + try value12.encode(to: encoder) + } + } + /// - Remark: Generated from `#/components/schemas/get_product_by_barcode`. + public struct get_product_by_barcode: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/get_product_by_barcode/value1`. + public var value1: Components.Schemas.get_product_by_barcode_base + /// - Remark: Generated from `#/components/schemas/get_product_by_barcode/value2`. + public struct Value2Payload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/get_product_by_barcode/value2/product`. + public struct productPayload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/get_product_by_barcode/value2/product/value1`. + public var value1: Components.Schemas.product + /// Creates a new `productPayload`. + /// + /// - Parameters: + /// - value1: + public init(value1: Components.Schemas.product) { + self.value1 = value1 + } + public init(from decoder: any Decoder) throws { + value1 = try .init(from: decoder) + } + public func encode(to encoder: any Encoder) throws { + try value1.encode(to: encoder) + } + } + /// - Remark: Generated from `#/components/schemas/get_product_by_barcode/value2/product`. + public var product: Components.Schemas.get_product_by_barcode.Value2Payload.productPayload? + /// Creates a new `Value2Payload`. + /// + /// - Parameters: + /// - product: + public init(product: Components.Schemas.get_product_by_barcode.Value2Payload.productPayload? = nil) { + self.product = product + } + public enum CodingKeys: String, CodingKey { + case product + } + } + /// - Remark: Generated from `#/components/schemas/get_product_by_barcode/value2`. + public var value2: Components.Schemas.get_product_by_barcode.Value2Payload + /// Creates a new `get_product_by_barcode`. + /// + /// - Parameters: + /// - value1: + /// - value2: + public init( + value1: Components.Schemas.get_product_by_barcode_base, + value2: Components.Schemas.get_product_by_barcode.Value2Payload + ) { + self.value1 = value1 + self.value2 = value2 + } + public init(from decoder: any Decoder) throws { + value1 = try .init(from: decoder) + value2 = try .init(from: decoder) + } + public func encode(to encoder: any Encoder) throws { + try value1.encode(to: encoder) + try value2.encode(to: encoder) + } + } + /// - Remark: Generated from `#/components/schemas/ocr_on_product`. + public struct ocr_on_product: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/ocr_on_product/status`. + public var status: Swift.Int? + /// Creates a new `ocr_on_product`. + /// + /// - Parameters: + /// - status: + public init(status: Swift.Int? = nil) { + self.status = status + } + public enum CodingKeys: String, CodingKey { + case status + } + } + /// - Remark: Generated from `#/components/schemas/crop_a_photo`. + @frozen public enum crop_a_photo: Sendable, Hashable { + /// - Remark: Generated from `#/components/schemas/crop_a_photo/code`. + public struct codePayload: Sendable, Hashable { + public var body: OpenAPIRuntime.HTTPBody + /// Creates a new `codePayload`. + /// + /// - Parameters: + /// - body: + public init(body: OpenAPIRuntime.HTTPBody) { + self.body = body + } + } + case code(OpenAPIRuntime.MultipartPart) + /// - Remark: Generated from `#/components/schemas/crop_a_photo/imgid`. + public struct imgidPayload: Sendable, Hashable { + public var body: OpenAPIRuntime.HTTPBody + /// Creates a new `imgidPayload`. + /// + /// - Parameters: + /// - body: + public init(body: OpenAPIRuntime.HTTPBody) { + self.body = body + } + } + case imgid(OpenAPIRuntime.MultipartPart) + /// - Remark: Generated from `#/components/schemas/crop_a_photo/id`. + public struct idPayload: Sendable, Hashable { + public var body: OpenAPIRuntime.HTTPBody + /// Creates a new `idPayload`. + /// + /// - Parameters: + /// - body: + public init(body: OpenAPIRuntime.HTTPBody) { + self.body = body + } + } + case id(OpenAPIRuntime.MultipartPart) + /// - Remark: Generated from `#/components/schemas/crop_a_photo/x1`. + public struct x1Payload: Sendable, Hashable { + public var body: OpenAPIRuntime.HTTPBody + /// Creates a new `x1Payload`. + /// + /// - Parameters: + /// - body: + public init(body: OpenAPIRuntime.HTTPBody) { + self.body = body + } + } + case x1(OpenAPIRuntime.MultipartPart) + /// - Remark: Generated from `#/components/schemas/crop_a_photo/y1`. + public struct y1Payload: Sendable, Hashable { + public var body: OpenAPIRuntime.HTTPBody + /// Creates a new `y1Payload`. + /// + /// - Parameters: + /// - body: + public init(body: OpenAPIRuntime.HTTPBody) { + self.body = body + } + } + case y1(OpenAPIRuntime.MultipartPart) + /// - Remark: Generated from `#/components/schemas/crop_a_photo/x2`. + public struct x2Payload: Sendable, Hashable { + public var body: OpenAPIRuntime.HTTPBody + /// Creates a new `x2Payload`. + /// + /// - Parameters: + /// - body: + public init(body: OpenAPIRuntime.HTTPBody) { + self.body = body + } + } + case x2(OpenAPIRuntime.MultipartPart) + /// - Remark: Generated from `#/components/schemas/crop_a_photo/y2`. + public struct y2Payload: Sendable, Hashable { + public var body: OpenAPIRuntime.HTTPBody + /// Creates a new `y2Payload`. + /// + /// - Parameters: + /// - body: + public init(body: OpenAPIRuntime.HTTPBody) { + self.body = body + } + } + case y2(OpenAPIRuntime.MultipartPart) + /// - Remark: Generated from `#/components/schemas/crop_a_photo/angle`. + public struct anglePayload: Sendable, Hashable { + public var body: OpenAPIRuntime.HTTPBody + /// Creates a new `anglePayload`. + /// + /// - Parameters: + /// - body: + public init(body: OpenAPIRuntime.HTTPBody) { + self.body = body + } + } + case angle(OpenAPIRuntime.MultipartPart) + /// - Remark: Generated from `#/components/schemas/crop_a_photo/normalize`. + public struct normalizePayload: Sendable, Hashable { + public var body: OpenAPIRuntime.HTTPBody + /// Creates a new `normalizePayload`. + /// + /// - Parameters: + /// - body: + public init(body: OpenAPIRuntime.HTTPBody) { + self.body = body + } + } + case normalize(OpenAPIRuntime.MultipartPart) + /// - Remark: Generated from `#/components/schemas/crop_a_photo/white_magic`. + public struct white_magicPayload: Sendable, Hashable { + public var body: OpenAPIRuntime.HTTPBody + /// Creates a new `white_magicPayload`. + /// + /// - Parameters: + /// - body: + public init(body: OpenAPIRuntime.HTTPBody) { + self.body = body + } + } + case white_magic(OpenAPIRuntime.MultipartPart) + case undocumented(OpenAPIRuntime.MultipartRawPart) + } + /// - Remark: Generated from `#/components/schemas/rotate_a_photo`. + public struct rotate_a_photo: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/rotate_a_photo/status`. + public var status: Swift.String? + /// - Remark: Generated from `#/components/schemas/rotate_a_photo/imagefield`. + public var imagefield: Swift.String? + /// - Remark: Generated from `#/components/schemas/rotate_a_photo/image`. + public struct imagePayload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/rotate_a_photo/image/display_url`. + public var display_url: Swift.String? + /// Creates a new `imagePayload`. + /// + /// - Parameters: + /// - display_url: + public init(display_url: Swift.String? = nil) { + self.display_url = display_url + } + public enum CodingKeys: String, CodingKey { + case display_url + } + } + /// - Remark: Generated from `#/components/schemas/rotate_a_photo/image`. + public var image: Components.Schemas.rotate_a_photo.imagePayload? + /// Creates a new `rotate_a_photo`. + /// + /// - Parameters: + /// - status: + /// - imagefield: + /// - image: + public init( + status: Swift.String? = nil, + imagefield: Swift.String? = nil, + image: Components.Schemas.rotate_a_photo.imagePayload? = nil + ) { + self.status = status + self.imagefield = imagefield + self.image = image + } + public enum CodingKeys: String, CodingKey { + case status + case imagefield + case image + } + } + /// - Remark: Generated from `#/components/schemas/unselect_a_photo`. + @frozen public enum unselect_a_photo: Sendable, Hashable { + /// - Remark: Generated from `#/components/schemas/unselect_a_photo/code`. + public struct codePayload: Sendable, Hashable { + public var body: OpenAPIRuntime.HTTPBody + /// Creates a new `codePayload`. + /// + /// - Parameters: + /// - body: + public init(body: OpenAPIRuntime.HTTPBody) { + self.body = body + } + } + case code(OpenAPIRuntime.MultipartPart) + /// - Remark: Generated from `#/components/schemas/unselect_a_photo/id`. + public struct idPayload: Sendable, Hashable { + public var body: OpenAPIRuntime.HTTPBody + /// Creates a new `idPayload`. + /// + /// - Parameters: + /// - body: + public init(body: OpenAPIRuntime.HTTPBody) { + self.body = body + } + } + case id(OpenAPIRuntime.MultipartPart) + case undocumented(OpenAPIRuntime.MultipartRawPart) + } + /// - Remark: Generated from `#/components/schemas/combined_add_or_edit_a_product_and_change_ref_properties`. + @frozen public enum combined_add_or_edit_a_product_and_change_ref_properties: Sendable, Hashable { + /// - Remark: Generated from `#/components/schemas/combined_add_or_edit_a_product_and_change_ref_properties/code`. + public struct codePayload: Sendable, Hashable { + public var body: OpenAPIRuntime.HTTPBody + /// Creates a new `codePayload`. + /// + /// - Parameters: + /// - body: + public init(body: OpenAPIRuntime.HTTPBody) { + self.body = body + } + } + case code(OpenAPIRuntime.MultipartPart) + /// - Remark: Generated from `#/components/schemas/combined_add_or_edit_a_product_and_change_ref_properties/user_id`. + public struct user_idPayload: Sendable, Hashable { + public var body: OpenAPIRuntime.HTTPBody + /// Creates a new `user_idPayload`. + /// + /// - Parameters: + /// - body: + public init(body: OpenAPIRuntime.HTTPBody) { + self.body = body + } + } + case user_id(OpenAPIRuntime.MultipartPart) + /// - Remark: Generated from `#/components/schemas/combined_add_or_edit_a_product_and_change_ref_properties/password`. + public struct passwordPayload: Sendable, Hashable { + public var body: OpenAPIRuntime.HTTPBody + /// Creates a new `passwordPayload`. + /// + /// - Parameters: + /// - body: + public init(body: OpenAPIRuntime.HTTPBody) { + self.body = body + } + } + case password(OpenAPIRuntime.MultipartPart) + /// - Remark: Generated from `#/components/schemas/combined_add_or_edit_a_product_and_change_ref_properties/comment`. + public struct commentPayload: Sendable, Hashable { + public var body: OpenAPIRuntime.HTTPBody + /// Creates a new `commentPayload`. + /// + /// - Parameters: + /// - body: + public init(body: OpenAPIRuntime.HTTPBody) { + self.body = body + } + } + case comment(OpenAPIRuntime.MultipartPart) + /// - Remark: Generated from `#/components/schemas/combined_add_or_edit_a_product_and_change_ref_properties/brands`. + public struct brandsPayload: Sendable, Hashable { + public var body: OpenAPIRuntime.HTTPBody + /// Creates a new `brandsPayload`. + /// + /// - Parameters: + /// - body: + public init(body: OpenAPIRuntime.HTTPBody) { + self.body = body + } + } + case brands(OpenAPIRuntime.MultipartPart) + /// - Remark: Generated from `#/components/schemas/combined_add_or_edit_a_product_and_change_ref_properties/labels`. + public struct labelsPayload: Sendable, Hashable { + public var body: OpenAPIRuntime.HTTPBody + /// Creates a new `labelsPayload`. + /// + /// - Parameters: + /// - body: + public init(body: OpenAPIRuntime.HTTPBody) { + self.body = body + } + } + case labels(OpenAPIRuntime.MultipartPart) + /// - Remark: Generated from `#/components/schemas/combined_add_or_edit_a_product_and_change_ref_properties/categories`. + public struct categoriesPayload: Sendable, Hashable { + public var body: OpenAPIRuntime.HTTPBody + /// Creates a new `categoriesPayload`. + /// + /// - Parameters: + /// - body: + public init(body: OpenAPIRuntime.HTTPBody) { + self.body = body + } + } + case categories(OpenAPIRuntime.MultipartPart) + /// - Remark: Generated from `#/components/schemas/combined_add_or_edit_a_product_and_change_ref_properties/packaging`. + public struct packagingPayload: Sendable, Hashable { + public var body: OpenAPIRuntime.HTTPBody + /// Creates a new `packagingPayload`. + /// + /// - Parameters: + /// - body: + public init(body: OpenAPIRuntime.HTTPBody) { + self.body = body + } + } + case packaging(OpenAPIRuntime.MultipartPart) + /// - Remark: Generated from `#/components/schemas/combined_add_or_edit_a_product_and_change_ref_properties/app_name`. + public struct app_namePayload: Sendable, Hashable { + public var body: OpenAPIRuntime.HTTPBody + /// Creates a new `app_namePayload`. + /// + /// - Parameters: + /// - body: + public init(body: OpenAPIRuntime.HTTPBody) { + self.body = body + } + } + case app_name(OpenAPIRuntime.MultipartPart) + /// - Remark: Generated from `#/components/schemas/combined_add_or_edit_a_product_and_change_ref_properties/app_version`. + public struct app_versionPayload: Sendable, Hashable { + public var body: OpenAPIRuntime.HTTPBody + /// Creates a new `app_versionPayload`. + /// + /// - Parameters: + /// - body: + public init(body: OpenAPIRuntime.HTTPBody) { + self.body = body + } + } + case app_version(OpenAPIRuntime.MultipartPart) + /// - Remark: Generated from `#/components/schemas/combined_add_or_edit_a_product_and_change_ref_properties/app_uuid`. + public struct app_uuidPayload: Sendable, Hashable { + public var body: OpenAPIRuntime.HTTPBody + /// Creates a new `app_uuidPayload`. + /// + /// - Parameters: + /// - body: + public init(body: OpenAPIRuntime.HTTPBody) { + self.body = body + } + } + case app_uuid(OpenAPIRuntime.MultipartPart) + /// - Remark: Generated from `#/components/schemas/combined_add_or_edit_a_product_and_change_ref_properties/user_agent`. + public struct user_agentPayload: Sendable, Hashable { + public var body: OpenAPIRuntime.HTTPBody + /// Creates a new `user_agentPayload`. + /// + /// - Parameters: + /// - body: + public init(body: OpenAPIRuntime.HTTPBody) { + self.body = body + } + } + case user_agent(OpenAPIRuntime.MultipartPart) + /// - Remark: Generated from `#/components/schemas/combined_add_or_edit_a_product_and_change_ref_properties/imagefield`. + public struct imagefieldPayload: Sendable, Hashable { + public var body: OpenAPIRuntime.OpenAPIValueContainer + /// Creates a new `imagefieldPayload`. + /// + /// - Parameters: + /// - body: + public init(body: OpenAPIRuntime.OpenAPIValueContainer) { + self.body = body + } + } + case imagefield(OpenAPIRuntime.MultipartPart) + case undocumented(OpenAPIRuntime.MultipartRawPart) + } + /// You can provide most of the properties defined in the product schema. + /// + /// + /// - Remark: Generated from `#/components/schemas/add_or_edit_a_product`. + public struct add_or_edit_a_product: Codable, Hashable, Sendable { + /// The barcode of the product to be added or edited + /// + /// - Remark: Generated from `#/components/schemas/add_or_edit_a_product/code`. + public var code: Swift.String + /// A valid username. + /// + /// - Remark: Generated from `#/components/schemas/add_or_edit_a_product/user_id`. + public var user_id: Swift.String + /// A valid corresponding password. + /// + /// - Remark: Generated from `#/components/schemas/add_or_edit_a_product/password`. + public var password: Swift.String + /// A comment for the change. It will be shown in product changes history. + /// + /// - Remark: Generated from `#/components/schemas/add_or_edit_a_product/comment`. + public var comment: Swift.String? + /// The brands of the product (comma separated list of values). + /// + /// - Remark: Generated from `#/components/schemas/add_or_edit_a_product/brands`. + public var brands: OpenAPIRuntime.OpenAPIValueContainer? + /// The labels of the product (comma separated list of values). + /// + /// - Remark: Generated from `#/components/schemas/add_or_edit_a_product/labels`. + public var labels: OpenAPIRuntime.OpenAPIValueContainer? + /// The categories of the product (comma separated list of values). + /// + /// - Remark: Generated from `#/components/schemas/add_or_edit_a_product/categories`. + public var categories: OpenAPIRuntime.OpenAPIValueContainer? + /// Packaging type, format, material. + /// The [v3 API documentation](https://openfoodfacts.github.io/openfoodfacts-server/api/ref-v3/#operation/post-api-v3-product-barcode) + /// has a more structured data for `packaging`. + /// + /// + /// - Remark: Generated from `#/components/schemas/add_or_edit_a_product/packaging`. + public var packaging: Swift.String? + /// Creates a new `add_or_edit_a_product`. + /// + /// - Parameters: + /// - code: The barcode of the product to be added or edited + /// - user_id: A valid username. + /// - password: A valid corresponding password. + /// - comment: A comment for the change. It will be shown in product changes history. + /// - brands: The brands of the product (comma separated list of values). + /// - labels: The labels of the product (comma separated list of values). + /// - categories: The categories of the product (comma separated list of values). + /// - packaging: Packaging type, format, material. + public init( + code: Swift.String, + user_id: Swift.String, + password: Swift.String, + comment: Swift.String? = nil, + brands: OpenAPIRuntime.OpenAPIValueContainer? = nil, + labels: OpenAPIRuntime.OpenAPIValueContainer? = nil, + categories: OpenAPIRuntime.OpenAPIValueContainer? = nil, + packaging: Swift.String? = nil + ) { + self.code = code + self.user_id = user_id + self.password = password + self.comment = comment + self.brands = brands + self.labels = labels + self.categories = categories + self.packaging = packaging + } + public enum CodingKeys: String, CodingKey { + case code + case user_id + case password + case comment + case brands + case labels + case categories + case packaging + } + } + /// Properties that goes in change ref + /// + /// + /// - Remark: Generated from `#/components/schemas/change_ref_properties`. + public struct change_ref_properties: Codable, Hashable, Sendable { + /// A comment on the contribution. + /// Adding meaningful comments help moderators and users understand a single product history. + /// + /// + /// - Remark: Generated from `#/components/schemas/change_ref_properties/comment`. + public var comment: Swift.String? + /// Name of the app providing the information + /// + /// + /// - Remark: Generated from `#/components/schemas/change_ref_properties/app_name`. + public var app_name: Swift.String? + /// Version of the app providing the information + /// + /// + /// - Remark: Generated from `#/components/schemas/change_ref_properties/app_version`. + public var app_version: Swift.String? + /// When an app uses a single user to log its contributions, + /// it might be interesting to know which user of the app is providing the information. + /// You can use this field to provide an identifier (eg: an sha1 of the username) that's privacy preserving. Make sure that your salt is strong, perfectly random and secret + /// + /// In case we have trouble with one of your user, it helps our moderators revert edits. + /// + /// + /// - Remark: Generated from `#/components/schemas/change_ref_properties/app_uuid`. + public var app_uuid: Swift.String? + /// It is required that you pass a specific User-Agent header when you do an API request. + /// But some times it's not possible to modify such a header + /// (eg. request using JavaScript in a browser). + /// In such cases, you can override it with this parameter. + /// + /// + /// - Remark: Generated from `#/components/schemas/change_ref_properties/User-Agent`. + public var User_hyphen_Agent: Swift.String? + /// Creates a new `change_ref_properties`. + /// + /// - Parameters: + /// - comment: A comment on the contribution. + /// - app_name: Name of the app providing the information + /// - app_version: Version of the app providing the information + /// - app_uuid: When an app uses a single user to log its contributions, + /// - User_hyphen_Agent: It is required that you pass a specific User-Agent header when you do an API request. + public init( + comment: Swift.String? = nil, + app_name: Swift.String? = nil, + app_version: Swift.String? = nil, + app_uuid: Swift.String? = nil, + User_hyphen_Agent: Swift.String? = nil + ) { + self.comment = comment + self.app_name = app_name + self.app_version = app_version + self.app_uuid = app_uuid + self.User_hyphen_Agent = User_hyphen_Agent + } + public enum CodingKeys: String, CodingKey { + case comment + case app_name + case app_version + case app_uuid + case User_hyphen_Agent = "User-Agent" + } + } + /// - Remark: Generated from `#/components/schemas/search_for_products`. + public struct search_for_products: Codable, Hashable, Sendable { + /// Total number of products found + /// + /// + /// - Remark: Generated from `#/components/schemas/search_for_products/count`. + public var count: Swift.Int? + /// Page number of returned results. + /// + /// You can get a different page, by using the `page` query parameter. + /// + /// + /// - Remark: Generated from `#/components/schemas/search_for_products/page`. + public var page: Swift.Int? + /// Number of products in this page. + /// + /// This will differ from page_size only on the last page. + /// + /// + /// - Remark: Generated from `#/components/schemas/search_for_products/page_count`. + public var page_count: Swift.Int? + /// Requested number of products per pages + /// + /// To get the number of pages, divide count by page_size + /// (eg. `Math.floor( count / page_size) + 1 `) + /// + /// + /// - Remark: Generated from `#/components/schemas/search_for_products/page_size`. + public var page_size: Swift.Int? + /// The products matching the query corresponding to current page + /// + /// + /// - Remark: Generated from `#/components/schemas/search_for_products/products`. + public var products: [Components.Schemas.product]? + /// - Remark: Generated from `#/components/schemas/search_for_products/skip`. + public var skip: Swift.Int? + /// Creates a new `search_for_products`. + /// + /// - Parameters: + /// - count: Total number of products found + /// - page: Page number of returned results. + /// - page_count: Number of products in this page. + /// - page_size: Requested number of products per pages + /// - products: The products matching the query corresponding to current page + /// - skip: + public init( + count: Swift.Int? = nil, + page: Swift.Int? = nil, + page_count: Swift.Int? = nil, + page_size: Swift.Int? = nil, + products: [Components.Schemas.product]? = nil, + skip: Swift.Int? = nil + ) { + self.count = count + self.page = page + self.page_count = page_count + self.page_size = page_size + self.products = products + self.skip = skip + } + public enum CodingKeys: String, CodingKey { + case count + case page + case page_count + case page_size + case products + case skip + } + } + /// The unit in which the nutrient for 100g or per serving is measured. + /// + /// The possible values depends on the nutrient. + /// + /// * `g` for grams + /// * `mg` for milligrams + /// * `μg` for micrograms + /// * `cl` for centiliters + /// * `ml` for mililiters + /// * `dv` for recommended daily intakes (aka [Dietary Reference Intake](https://en.wikipedia.org/wiki/Dietary_Reference_Intake)) + /// * `% vol` for percentage per volume (e.g. alcohol vol per 100 ml) + /// * `%` for percentage + /// + /// 🤓 code: see the [Units module][units-module], + /// and [Food:default_unit_for_nid function][default-unit] + /// + /// [units-module]: https://openfoodfacts.github.io/openfoodfacts-server/dev/ref-perl-pod/ProductOpener/Units.html + /// [default-unit]: https://openfoodfacts.github.io/openfoodfacts-server/dev/ref-perl-pod/ProductOpener/Food.html#default_unit_for_nid_(_%24nid) + /// + /// + /// - Remark: Generated from `#/components/schemas/nutrient_unit`. + @frozen public enum nutrient_unit: String, Codable, Hashable, Sendable, CaseIterable { + case g = "g" + case mg = "mg" + case μg = "μg" + case cl = "cl" + case ml = "ml" + case dv = "dv" + case _percnt__space_vol = "% vol" + case _percnt_ = "%" + } + /// - Remark: Generated from `#/components/schemas/nutrients`. + public struct nutrientsPayload: Codable, Hashable, Sendable { + /// id of the nutrient + /// + /// - Remark: Generated from `#/components/schemas/nutrients/id`. + public var id: Swift.String? + /// Name of the nutrient in the requested language + /// + /// - Remark: Generated from `#/components/schemas/nutrients/name`. + public var name: Swift.String? + /// Indicates if the nutrient is always shown on the nutrition facts table + /// + /// - Remark: Generated from `#/components/schemas/nutrients/important`. + public var important: Swift.Bool? + /// Indicates if the nutrient should be shown in the nutrition facts edit form + /// + /// - Remark: Generated from `#/components/schemas/nutrients/display_in_edit_form`. + public var display_in_edit_form: Swift.Bool? + /// Default unit of the nutrient + /// + /// - Remark: Generated from `#/components/schemas/nutrients/unit`. + public var unit: Components.Schemas.nutrient_unit? + /// Sub-nutrients (e.g. saturated-fat is a sub-nutrient of fat). + /// + /// + /// - Remark: Generated from `#/components/schemas/nutrients/nutrients`. + public var nutrients: OpenAPIRuntime.OpenAPIValueContainer? + /// Creates a new `nutrientsPayload`. + /// + /// - Parameters: + /// - id: id of the nutrient + /// - name: Name of the nutrient in the requested language + /// - important: Indicates if the nutrient is always shown on the nutrition facts table + /// - display_in_edit_form: Indicates if the nutrient should be shown in the nutrition facts edit form + /// - unit: Default unit of the nutrient + /// - nutrients: Sub-nutrients (e.g. saturated-fat is a sub-nutrient of fat). + public init( + id: Swift.String? = nil, + name: Swift.String? = nil, + important: Swift.Bool? = nil, + display_in_edit_form: Swift.Bool? = nil, + unit: Components.Schemas.nutrient_unit? = nil, + nutrients: OpenAPIRuntime.OpenAPIValueContainer? = nil + ) { + self.id = id + self.name = name + self.important = important + self.display_in_edit_form = display_in_edit_form + self.unit = unit + self.nutrients = nutrients + } + public enum CodingKeys: String, CodingKey { + case id + case name + case important + case display_in_edit_form + case unit + case nutrients + } + } + /// Nutrients and sub-nutrients of a product, with their name and default unit. + /// + /// + /// - Remark: Generated from `#/components/schemas/nutrients`. + public typealias nutrients = [Components.Schemas.nutrientsPayload] + /// - Remark: Generated from `#/components/schemas/get_nutrients`. + public typealias get_nutrients = Components.Schemas.nutrients + /// - Remark: Generated from `#/components/schemas/get_attribute_groups`. + public struct get_attribute_groupsPayload: Codable, Hashable, Sendable { + /// unique id of the group + /// + /// - Remark: Generated from `#/components/schemas/get_attribute_groups/id`. + public var id: Swift.String? + /// Name of the group + /// + /// - Remark: Generated from `#/components/schemas/get_attribute_groups/name`. + public var name: Swift.String? + /// - Remark: Generated from `#/components/schemas/get_attribute_groups/attributesPayload`. + public struct attributesPayloadPayload: Codable, Hashable, Sendable { + /// unique id of the attribute + /// + /// - Remark: Generated from `#/components/schemas/get_attribute_groups/attributesPayload/id`. + public var id: Swift.String? + /// Name of the attribute + /// + /// - Remark: Generated from `#/components/schemas/get_attribute_groups/attributesPayload/name`. + public var name: Swift.String? + /// url of icon to display next to the settings for this attribute + /// + /// - Remark: Generated from `#/components/schemas/get_attribute_groups/attributesPayload/icon_url`. + public var icon_url: Swift.String? + /// a description of the attribute to display to users + /// + /// - Remark: Generated from `#/components/schemas/get_attribute_groups/attributesPayload/setting_name`. + public var setting_name: Swift.String? + /// a complementary note on the attribute + /// + /// - Remark: Generated from `#/components/schemas/get_attribute_groups/attributesPayload/setting_note`. + public var setting_note: Swift.String? + /// Indicates the default setting for this attribute + /// + /// - Remark: Generated from `#/components/schemas/get_attribute_groups/attributesPayload/default`. + @frozen public enum _defaultPayload: String, Codable, Hashable, Sendable, CaseIterable { + case mandatory = "mandatory" + case very_important = "very_important" + case important = "important" + case not_important = "not_important" + } + /// Indicates the default setting for this attribute + /// + /// - Remark: Generated from `#/components/schemas/get_attribute_groups/attributesPayload/default`. + public var _default: Components.Schemas.get_attribute_groupsPayload.attributesPayloadPayload._defaultPayload? + /// Linked knowledge panel (optional) + /// + /// - Remark: Generated from `#/components/schemas/get_attribute_groups/attributesPayload/panel_id`. + public var panel_id: Swift.String? + /// Creates a new `attributesPayloadPayload`. + /// + /// - Parameters: + /// - id: unique id of the attribute + /// - name: Name of the attribute + /// - icon_url: url of icon to display next to the settings for this attribute + /// - setting_name: a description of the attribute to display to users + /// - setting_note: a complementary note on the attribute + /// - _default: Indicates the default setting for this attribute + /// - panel_id: Linked knowledge panel (optional) + public init( + id: Swift.String? = nil, + name: Swift.String? = nil, + icon_url: Swift.String? = nil, + setting_name: Swift.String? = nil, + setting_note: Swift.String? = nil, + _default: Components.Schemas.get_attribute_groupsPayload.attributesPayloadPayload._defaultPayload? = nil, + panel_id: Swift.String? = nil + ) { + self.id = id + self.name = name + self.icon_url = icon_url + self.setting_name = setting_name + self.setting_note = setting_note + self._default = _default + self.panel_id = panel_id + } + public enum CodingKeys: String, CodingKey { + case id + case name + case icon_url + case setting_name + case setting_note + case _default = "default" + case panel_id + } + } + /// Attributes that are part of this group + /// + /// + /// - Remark: Generated from `#/components/schemas/get_attribute_groups/attributes`. + public typealias attributesPayload = [Components.Schemas.get_attribute_groupsPayload.attributesPayloadPayload] + /// Attributes that are part of this group + /// + /// + /// - Remark: Generated from `#/components/schemas/get_attribute_groups/attributes`. + public var attributes: Components.Schemas.get_attribute_groupsPayload.attributesPayload? + /// Creates a new `get_attribute_groupsPayload`. + /// + /// - Parameters: + /// - id: unique id of the group + /// - name: Name of the group + /// - attributes: Attributes that are part of this group + public init( + id: Swift.String? = nil, + name: Swift.String? = nil, + attributes: Components.Schemas.get_attribute_groupsPayload.attributesPayload? = nil + ) { + self.id = id + self.name = name + self.attributes = attributes + } + public enum CodingKeys: String, CodingKey { + case id + case name + case attributes + } + } + /// List of groups of attributes for personal search in a specific language. + /// + /// + /// - Remark: Generated from `#/components/schemas/get_attribute_groups`. + public typealias get_attribute_groups = [Components.Schemas.get_attribute_groupsPayload] + /// - Remark: Generated from `#/components/schemas/get_preferences`. + public struct get_preferencesPayload: Codable, Hashable, Sendable { + /// id for the setting value + /// + /// - Remark: Generated from `#/components/schemas/get_preferences/id`. + @frozen public enum idPayload: String, Codable, Hashable, Sendable, CaseIterable { + case not_important = "not_important" + case important = "important" + case very_important = "very_important" + case mandatory = "mandatory" + } + /// id for the setting value + /// + /// - Remark: Generated from `#/components/schemas/get_preferences/id`. + public var id: Components.Schemas.get_preferencesPayload.idPayload? + /// name for the setting value, translated according to `lc` parameter + /// + /// - Remark: Generated from `#/components/schemas/get_preferences/name`. + public var name: Swift.String? + /// factor to apply to the property of the product corresponding to attributes + /// having this setting value + /// + /// + /// - Remark: Generated from `#/components/schemas/get_preferences/factor`. + public var factor: Swift.Int? + /// FIXME + /// + /// + /// - Remark: Generated from `#/components/schemas/get_preferences/minimum_match`. + public var minimum_match: Swift.Int? + /// Creates a new `get_preferencesPayload`. + /// + /// - Parameters: + /// - id: id for the setting value + /// - name: name for the setting value, translated according to `lc` parameter + /// - factor: factor to apply to the property of the product corresponding to attributes + /// - minimum_match: FIXME + public init( + id: Components.Schemas.get_preferencesPayload.idPayload? = nil, + name: Swift.String? = nil, + factor: Swift.Int? = nil, + minimum_match: Swift.Int? = nil + ) { + self.id = id + self.name = name + self.factor = factor + self.minimum_match = minimum_match + } + public enum CodingKeys: String, CodingKey { + case id + case name + case factor + case minimum_match + } + } + /// Rules to apply to compute personal ranking of a product, + /// based upon the setting value of each attribute. + /// + /// + /// - Remark: Generated from `#/components/schemas/get_preferences`. + public typealias get_preferences = [Components.Schemas.get_preferencesPayload] + } + /// Types generated from the `#/components/parameters` section of the OpenAPI document. + public enum Parameters { + /// - Remark: Generated from `#/components/parameters/id`. + public typealias id = Swift.String + /// 2 letter code of the country of the user. Used for localizing some fields in returned values (e.g. knowledge panels). If not passed, the country may be inferred by the IP address of the request. + /// + /// - Remark: Generated from `#/components/parameters/cc`. + public typealias cc = Swift.String + /// 2 letter code of the language of the user. + /// Used for localizing some fields in returned values (e.g. knowledge panels). + /// If not passed, the language may be inferred by the Accept-Language header of the request, + /// or from the domain name prefix. + /// + /// + /// - Remark: Generated from `#/components/parameters/lc`. + public typealias lc = Swift.String + /// Barcode of the product + /// + /// - Remark: Generated from `#/components/parameters/code`. + public typealias code = Swift.String + /// - Remark: Generated from `#/components/parameters/process_image`. + public typealias process_image = Swift.String + /// - Remark: Generated from `#/components/parameters/ocr_engine`. + public typealias ocr_engine = Swift.String + /// - Remark: Generated from `#/components/parameters/imgid`. + public typealias imgid = Swift.String + /// - Remark: Generated from `#/components/parameters/angle`. + public typealias angle = Swift.String + /// The page number you request to view (eg. in search results spanning multiple pages) + /// + /// + /// - Remark: Generated from `#/components/parameters/page`. + public typealias page = Swift.Int + /// The number of elements should be sent per page + /// + /// + /// - Remark: Generated from `#/components/parameters/page_size`. + public typealias page_size = Swift.Int + /// The allowed values used to sort/order the search results. + /// + /// * `product_name` sorts on name + /// * `ecoscore_score`, `nova_score`, `nutriscore_score` rank on the [Eco-Score](https://world.openfoodfacts.org/eco-score-the-environmental-impact-of-food-products), [Nova](https://world.openfoodfacts.org/nova), or [Nutri-Score](https://world.openfoodfacts.org/nutriscore) + /// * `scans_n`, `unique_scans_n` and `popularity_key` are about product popularity: number of scans on unique scans, rank of product + /// * `created_t`, `last_modified_t`, are about creation and modification dates + /// * `nothing`, tells not to sort at all (because if you do not provide the sort_by argument we default to sorting on popularity (for food) or last modification date) + /// + /// + /// - Remark: Generated from `#/components/parameters/sort_by`. + @frozen public enum sort_by: String, Codable, Hashable, Sendable, CaseIterable { + case product_name = "product_name" + case last_modified_t = "last_modified_t" + case scans_n = "scans_n" + case unique_scans_n = "unique_scans_n" + case created_t = "created_t" + case completeness = "completeness" + case popularity_key = "popularity_key" + case nutriscore_score = "nutriscore_score" + case nova_score = "nova_score" + case nothing = "nothing" + case ecoscore_score = "ecoscore_score" + } + /// The fields to be returned from the product object can also be limited. + /// If not specified, it returns the entire product object response. + /// + /// + /// - Remark: Generated from `#/components/parameters/fields`. + public typealias fields = Swift.String + /// When knowledge_panels are requested, you can specify which panels should be in the response. All the others will be excluded. + /// + /// + /// - Remark: Generated from `#/components/parameters/knowledge_panels_included`. + public typealias knowledge_panels_included = Swift.String + /// When knowledge_panels are requested, you can specify which panels to exclude from the response. All the others will be included. + /// If a panel is both excluded and included (with the knowledge_panels_excluded parameter), it will be excluded. + /// + /// + /// - Remark: Generated from `#/components/parameters/knowledge_panels_excluded`. + public typealias knowledge_panels_excluded = Swift.String + /// - Remark: Generated from `#/components/parameters/tagtype`. + public typealias tagtype = Swift.String + /// - Remark: Generated from `#/components/parameters/term`. + public typealias term = Swift.String + /// The additives_tags in english of product(s) you are searching for. + /// The [OFF App](https://world.openfoodfacts.org/additives) has a list of possible values for `additives`. + /// + /// You can use multiple values by using a comma separated list. + /// You can add a "-" before values to avoid matching a tag. + /// + /// + /// - Remark: Generated from `#/components/parameters/tags_parameters_properties_additives_tags`. + public typealias tags_parameters_properties_additives_tags = Swift.String + /// The allergens_tags in english of product(s) you are searching for. + /// The [OFF App](https://world.openfoodfacts.org/allergens) has a list of possible values for `allergens`. + /// + /// You can use multiple values by using a comma separated list. + /// You can add a "-" before values to avoid matching a tag. + /// + /// + /// - Remark: Generated from `#/components/parameters/tags_parameters_properties_allergens_tags`. + public typealias tags_parameters_properties_allergens_tags = Swift.String + /// The brands_tags of product(s) you are searching for. + /// The [OFF App](https://world.openfoodfacts.org/brands) has a list of possible values for `brands`. + /// + /// You can use multiple values by using a comma separated list. + /// You can add a "-" before values to avoid matching a tag. + /// + /// + /// - Remark: Generated from `#/components/parameters/tags_parameters_properties_brands_tags`. + public typealias tags_parameters_properties_brands_tags = Swift.String + /// The category of product(s) you are searching for. + /// The [OFF App](https://world.openfoodfacts.org/categories) has a list of possible values for `categories`. + /// + /// You can use multiple values by using a comma separated list. + /// You can add a "-" before values to avoid matching a tag. + /// + /// + /// - Remark: Generated from `#/components/parameters/tags_parameters_properties_categories_tags`. + public typealias tags_parameters_properties_categories_tags = Swift.String + /// The countries_tags_en of product(s) you are searching for. + /// The [OFF App](https://world.openfoodfacts.org/countries) shows a list of possible values for `countries`. + /// + /// You can use multiple values by using a comma separated list. + /// You can add a "-" before values to avoid matching a tag. + /// + /// + /// - Remark: Generated from `#/components/parameters/tags_parameters_properties_countries_tags`. + public typealias tags_parameters_properties_countries_tags = Swift.String + /// The emb_codes_tags of product(s) you are searching for. + /// + /// You can use multiple values by using a comma separated list. + /// You can add a "-" before values to avoid matching a tag. + /// + /// + /// - Remark: Generated from `#/components/parameters/tags_parameters_properties_emb_codes_tags`. + public typealias tags_parameters_properties_emb_codes_tags = Swift.String + /// The labels_tags in english of product(s) you are searching for. + /// The [OFF App](https://world.openfoodfacts.org/labels) has a list of possible values for `labels`. + /// + /// You can use multiple values by using a comma separated list. + /// You can add a "-" before values to avoid matching a tag. + /// + /// + /// - Remark: Generated from `#/components/parameters/tags_parameters_properties_labels_tags`. + public typealias tags_parameters_properties_labels_tags = Swift.String + /// The manufacturing_places_tags of product(s) you are searching for. + /// The [OFF App](https://world.openfoodfacts.org/manufacturing-places) has a list of possible values for `manufacturing-places`. + /// + /// You can use multiple values by using a comma separated list. + /// You can add a "-" before values to avoid matching a tag. + /// + /// + /// - Remark: Generated from `#/components/parameters/tags_parameters_properties_manufacturing_places_tags`. + public typealias tags_parameters_properties_manufacturing_places_tags = Swift.String + /// The nutrition_grades_tags of product(s) you are searching for. + /// The [OFF App](https://world.openfoodfacts.org/nutrition-grades) has a list of possible values for `nutrition-grades`. + /// + /// You can use multiple values by using a comma separated list. + /// You can add a "-" before values to avoid matching a tag. + /// + /// + /// - Remark: Generated from `#/components/parameters/tags_parameters_properties_nutrition_grades_tags`. + public typealias tags_parameters_properties_nutrition_grades_tags = Swift.String + /// The origins_tags of product(s) you are searching for. + /// + /// You can use multiple values by using a comma separated list. + /// You can add a "-" before values to avoid matching a tag. + /// + /// + /// - Remark: Generated from `#/components/parameters/tags_parameters_properties_origins_tags`. + public typealias tags_parameters_properties_origins_tags = Swift.String + /// The packaging_tag in german of product(s) you are searching for. + /// The [OFF App](https://world.openfoodfacts.org/packaging) has a list of possible values for `packaging`. + /// + /// You can use multiple values by using a comma separated list. + /// You can add a "-" before values to avoid matching a tag. + /// + /// + /// - Remark: Generated from `#/components/parameters/tags_parameters_properties_packaging_tags`. + public typealias tags_parameters_properties_packaging_tags = Swift.String + /// The purchase_places_tags of product(s) you are searching for. + /// + /// You can use multiple values by using a comma separated list. + /// You can add a "-" before values to avoid matching a tag. + /// + /// + /// - Remark: Generated from `#/components/parameters/tags_parameters_properties_purchase_places_tags`. + public typealias tags_parameters_properties_purchase_places_tags = Swift.String + /// The states_tags in english of product(s) you are searching for. + /// The [OFF App](https://world.openfoodfacts.org/states) has a list of possible values for `states`. + /// + /// You can use multiple values by using a comma separated list. + /// You can add a "-" before values to avoid matching a tag. + /// + /// + /// - Remark: Generated from `#/components/parameters/tags_parameters_properties_states_tags`. + public typealias tags_parameters_properties_states_tags = Swift.String + /// The stores_tags of product(s) you are searching for. + /// + /// You can use multiple values by using a comma separated list. + /// You can add a "-" before values to avoid matching a tag. + /// + /// + /// - Remark: Generated from `#/components/parameters/tags_parameters_properties_stores_tags`. + public typealias tags_parameters_properties_stores_tags = Swift.String + /// The traces_tags of product(s) you are searching for. + /// The [OFF App](https://world.openfoodfacts.org/traces) shows a list of possible values for `traces`. + /// + /// You can use multiple values by using a comma separated list. + /// You can add a "-" before values to avoid matching a tag. + /// + /// + /// - Remark: Generated from `#/components/parameters/tags_parameters_properties_traces_tags`. + public typealias tags_parameters_properties_traces_tags = Swift.String + /// You can add a language code to a specific tag to query it in a specific language + /// + /// + /// - Remark: Generated from `#/components/parameters/tags_parameters_properties_tag_name_with_language_code`. + public struct tags_parameters_properties_tag_name_with_language_code: Codable, Hashable, Sendable { + /// Will search in the tags corresponding to `tag_name`, + /// in the language corresponding to `language_code. + /// + /// `tag_name` is one of the field above which have the `_tags`` suffix: + /// categories, nutrition_grades, etc. + /// + /// `language_code` is a two letter iso language `language_code. + /// + /// You can use multiple values by using a comma separated list. + /// You can add a "-" before values to avoid matching a tag. + /// + /// + /// - Remark: Generated from `#/components/parameters/tags_parameters_properties_tag_name_with_language_code/tag_name_example`. + public var tag_name_example: Swift.String? + /// Creates a new `tags_parameters_properties_tag_name_with_language_code`. + /// + /// - Parameters: + /// - tag_name_example: Will search in the tags corresponding to `tag_name`, + public init(tag_name_example: Swift.String? = nil) { + self.tag_name_example = tag_name_example + } + public enum CodingKeys: String, CodingKey { + case tag_name_example + } + } + /// Search on nutrient lower than a value + /// + /// + /// - Remark: Generated from `#/components/parameters/nutrition_search_properties_nutrient_lower_than`. + public struct nutrition_search_properties_nutrient_lower_than: Codable, Hashable, Sendable { + /// Will search for products with nutrients lower than `value` + /// per `portion` (100g or serving). + /// + /// If `prepared` is "prepared" search in prepared product instead of "as sold". + /// + /// Important: the parameter value is discarded and should be empty + /// + /// + /// - Remark: Generated from `#/components/parameters/nutrition_search_properties_nutrient_lower_than/nutrient_example`. + public var nutrient_example: Swift.String? + /// Creates a new `nutrition_search_properties_nutrient_lower_than`. + /// + /// - Parameters: + /// - nutrient_example: Will search for products with nutrients lower than `value` + public init(nutrient_example: Swift.String? = nil) { + self.nutrient_example = nutrient_example + } + public enum CodingKeys: String, CodingKey { + case nutrient_example + } + } + /// Search on nutrient greater than a value + /// + /// + /// - Remark: Generated from `#/components/parameters/nutrition_search_properties_nutrient_greater_than`. + public struct nutrition_search_properties_nutrient_greater_than: Codable, Hashable, Sendable { + /// Will search for products with nutrients more than `value` + /// per `portion` (100g or serving). + /// + /// If `prepared` is "prepared" search in prepared product instead of "as sold". + /// + /// Important: the parameter value is discarded and should be empty + /// + /// + /// - Remark: Generated from `#/components/parameters/nutrition_search_properties_nutrient_greater_than/nutrient_example`. + public var nutrient_example: Swift.String? + /// Creates a new `nutrition_search_properties_nutrient_greater_than`. + /// + /// - Parameters: + /// - nutrient_example: Will search for products with nutrients more than `value` + public init(nutrient_example: Swift.String? = nil) { + self.nutrient_example = nutrient_example + } + public enum CodingKeys: String, CodingKey { + case nutrient_example + } + } + /// Search on nutrient for an exact quantity + /// + /// + /// - Remark: Generated from `#/components/parameters/nutrition_search_properties_nutrient_equal`. + public struct nutrition_search_properties_nutrient_equal: Codable, Hashable, Sendable { + /// Will search for products with nutrients exactl the parameter value + /// per `portion` (100g or serving). + /// + /// If `prepared` is "prepared" search in prepared product instead of "as sold". + /// + /// + /// - Remark: Generated from `#/components/parameters/nutrition_search_properties_nutrient_equal/nutrient_example`. + public var nutrient_example: Swift.String? + /// Creates a new `nutrition_search_properties_nutrient_equal`. + /// + /// - Parameters: + /// - nutrient_example: Will search for products with nutrients exactl the parameter value + public init(nutrient_example: Swift.String? = nil) { + self.nutrient_example = nutrient_example + } + public enum CodingKeys: String, CodingKey { + case nutrient_example + } + } + } + /// Types generated from the `#/components/requestBodies` section of the OpenAPI document. + public enum RequestBodies {} + /// Types generated from the `#/components/responses` section of the OpenAPI document. + public enum Responses {} + /// Types generated from the `#/components/headers` section of the OpenAPI document. + public enum Headers {} +} + +/// API operations, with input and output types, generated from `#/paths` in the OpenAPI document. +public enum Operations { + /// Get information for a specific product by barcode + /// + /// A product can be fetched via its unique barcode. + /// It returns all the details of that product response. + /// + /// + /// - Remark: HTTP `GET /api/v2/product/{barcode}`. + /// - Remark: Generated from `#/paths//api/v2/product/{barcode}/get(get-product-by-barcode)`. + public enum get_hyphen_product_hyphen_by_hyphen_barcode { + public static let id: Swift.String = "get-product-by-barcode" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/api/v2/product/{barcode}/GET/path`. + public struct Path: Sendable, Hashable { + /// The barcode of the product to be fetched + /// + /// + /// - Remark: Generated from `#/paths/api/v2/product/{barcode}/GET/path/barcode`. + public var barcode: Swift.String + /// Creates a new `Path`. + /// + /// - Parameters: + /// - barcode: The barcode of the product to be fetched + public init(barcode: Swift.String) { + self.barcode = barcode + } + } + public var path: Operations.get_hyphen_product_hyphen_by_hyphen_barcode.Input.Path + /// - Remark: Generated from `#/paths/api/v2/product/{barcode}/GET/header`. + public struct Headers: Sendable, Hashable { + public var accept: [OpenAPIRuntime.AcceptHeaderContentType] + /// Creates a new `Headers`. + /// + /// - Parameters: + /// - accept: + public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + self.accept = accept + } + } + public var headers: Operations.get_hyphen_product_hyphen_by_hyphen_barcode.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - headers: + public init( + path: Operations.get_hyphen_product_hyphen_by_hyphen_barcode.Input.Path, + headers: Operations.get_hyphen_product_hyphen_by_hyphen_barcode.Input.Headers = .init() + ) { + self.path = path + self.headers = headers + } + } + @frozen public enum Output: Sendable, Hashable { + public struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/api/v2/product/{barcode}/GET/responses/200/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/api/v2/product/{barcode}/GET/responses/200/content/application\/json`. + case json(Components.Schemas.get_product_by_barcode) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + public var json: Components.Schemas.get_product_by_barcode { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.get_hyphen_product_hyphen_by_hyphen_barcode.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.get_hyphen_product_hyphen_by_hyphen_barcode.Output.Ok.Body) { + self.body = body + } + } + /// OK + /// + /// - Remark: Generated from `#/paths//api/v2/product/{barcode}/get(get-product-by-barcode)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.get_hyphen_product_hyphen_by_hyphen_barcode.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + public var ok: Operations.get_hyphen_product_hyphen_by_hyphen_barcode.Output.Ok { + get throws { + switch self { + case let .ok(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + @frozen public enum AcceptableContentType: AcceptableProtocol { + case json + case other(Swift.String) + public init?(rawValue: Swift.String) { + switch rawValue.lowercased() { + case "application/json": + self = .json + default: + self = .other(rawValue) + } + } + public var rawValue: Swift.String { + switch self { + case let .other(string): + return string + case .json: + return "application/json" + } + } + public static var allCases: [Self] { + [ + .json + ] + } + } + } + /// Get Knowledge panels for a specific product by barcode + /// (special case of get product) + /// + /// + /// Knowledge panels gives high leve informations about a product, + /// ready to display. + /// This is used by open food facts website, + /// and by the official mobile application + /// + /// + /// - Remark: HTTP `GET /api/v2/product/{barcode}?fields=knowledge_panels`. + /// - Remark: Generated from `#/paths//api/v2/product/{barcode}?fields=knowledge_panels/get(get-product-by-barcode-knowledge-panels)`. + public enum get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels { + public static let id: Swift.String = "get-product-by-barcode-knowledge-panels" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/api/v2/product/{barcode}?fields=knowledge_panels/GET/path`. + public struct Path: Sendable, Hashable { + /// The barcode of the product to be fetched + /// + /// + /// - Remark: Generated from `#/paths/api/v2/product/{barcode}?fields=knowledge_panels/GET/path/barcode`. + public var barcode: Swift.String + /// Creates a new `Path`. + /// + /// - Parameters: + /// - barcode: The barcode of the product to be fetched + public init(barcode: Swift.String) { + self.barcode = barcode + } + } + public var path: Operations.get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels.Input.Path + /// - Remark: Generated from `#/paths/api/v2/product/{barcode}?fields=knowledge_panels/GET/header`. + public struct Headers: Sendable, Hashable { + public var accept: [OpenAPIRuntime.AcceptHeaderContentType] + /// Creates a new `Headers`. + /// + /// - Parameters: + /// - accept: + public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + self.accept = accept + } + } + public var headers: Operations.get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - headers: + public init( + path: Operations.get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels.Input.Path, + headers: Operations.get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels.Input.Headers = .init() + ) { + self.path = path + self.headers = headers + } + } + @frozen public enum Output: Sendable, Hashable { + public struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/api/v2/product/{barcode}?fields=knowledge_panels/GET/responses/200/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/api/v2/product/{barcode}?fields=knowledge_panels/GET/responses/200/content/json`. + public struct jsonPayload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/paths/api/v2/product/{barcode}?fields=knowledge_panels/GET/responses/200/content/json/value1`. + public var value1: Components.Schemas.get_product_by_barcode_base + /// - Remark: Generated from `#/paths/api/v2/product/{barcode}?fields=knowledge_panels/GET/responses/200/content/json/value2`. + public struct Value2Payload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/paths/api/v2/product/{barcode}?fields=knowledge_panels/GET/responses/200/content/json/value2/product`. + public var product: Components.Schemas.product_knowledge_panels? + /// Creates a new `Value2Payload`. + /// + /// - Parameters: + /// - product: + public init(product: Components.Schemas.product_knowledge_panels? = nil) { + self.product = product + } + public enum CodingKeys: String, CodingKey { + case product + } + } + /// - Remark: Generated from `#/paths/api/v2/product/{barcode}?fields=knowledge_panels/GET/responses/200/content/json/value2`. + public var value2: Operations.get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels.Output.Ok.Body.jsonPayload.Value2Payload + /// Creates a new `jsonPayload`. + /// + /// - Parameters: + /// - value1: + /// - value2: + public init( + value1: Components.Schemas.get_product_by_barcode_base, + value2: Operations.get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels.Output.Ok.Body.jsonPayload.Value2Payload + ) { + self.value1 = value1 + self.value2 = value2 + } + public init(from decoder: any Decoder) throws { + value1 = try .init(from: decoder) + value2 = try .init(from: decoder) + } + public func encode(to encoder: any Encoder) throws { + try value1.encode(to: encoder) + try value2.encode(to: encoder) + } + } + /// - Remark: Generated from `#/paths/api/v2/product/{barcode}?fields=knowledge_panels/GET/responses/200/content/application\/json`. + case json(Operations.get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels.Output.Ok.Body.jsonPayload) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + public var json: Operations.get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels.Output.Ok.Body.jsonPayload { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels.Output.Ok.Body) { + self.body = body + } + } + /// OK + /// + /// - Remark: Generated from `#/paths//api/v2/product/{barcode}?fields=knowledge_panels/get(get-product-by-barcode-knowledge-panels)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + public var ok: Operations.get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels.Output.Ok { + get throws { + switch self { + case let .ok(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + @frozen public enum AcceptableContentType: AcceptableProtocol { + case json + case other(Swift.String) + public init?(rawValue: Swift.String) { + switch rawValue.lowercased() { + case "application/json": + self = .json + default: + self = .other(rawValue) + } + } + public var rawValue: Swift.String { + switch self { + case let .other(string): + return string + case .json: + return "application/json" + } + } + public static var allCases: [Self] { + [ + .json + ] + } + } + } + /// Performing OCR on a Product + /// + /// Open Food Facts uses optical character recognition (OCR) to retrieve nutritional data and other information from the product labels. + /// + /// + /// - Remark: HTTP `GET /cgi/ingredients.pl`. + /// - Remark: Generated from `#/paths//cgi/ingredients.pl/get(get-cgi-ingredients.pl)`. + public enum get_hyphen_cgi_hyphen_ingredients_period_pl { + public static let id: Swift.String = "get-cgi-ingredients.pl" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/cgi/ingredients.pl/GET/query`. + public struct Query: Sendable, Hashable { + /// - Remark: Generated from `#/paths/cgi/ingredients.pl/GET/query/id`. + public var id: Components.Parameters.id + /// Barcode of the product + /// + /// - Remark: Generated from `#/paths/cgi/ingredients.pl/GET/query/code`. + public var code: Components.Parameters.code + /// - Remark: Generated from `#/paths/cgi/ingredients.pl/GET/query/process_image`. + public var process_image: Components.Parameters.process_image + /// - Remark: Generated from `#/paths/cgi/ingredients.pl/GET/query/ocr_engine`. + public var ocr_engine: Components.Parameters.ocr_engine + /// Creates a new `Query`. + /// + /// - Parameters: + /// - id: + /// - code: Barcode of the product + /// - process_image: + /// - ocr_engine: + public init( + id: Components.Parameters.id, + code: Components.Parameters.code, + process_image: Components.Parameters.process_image, + ocr_engine: Components.Parameters.ocr_engine + ) { + self.id = id + self.code = code + self.process_image = process_image + self.ocr_engine = ocr_engine + } + } + public var query: Operations.get_hyphen_cgi_hyphen_ingredients_period_pl.Input.Query + /// - Remark: Generated from `#/paths/cgi/ingredients.pl/GET/header`. + public struct Headers: Sendable, Hashable { + public var accept: [OpenAPIRuntime.AcceptHeaderContentType] + /// Creates a new `Headers`. + /// + /// - Parameters: + /// - accept: + public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + self.accept = accept + } + } + public var headers: Operations.get_hyphen_cgi_hyphen_ingredients_period_pl.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - query: + /// - headers: + public init( + query: Operations.get_hyphen_cgi_hyphen_ingredients_period_pl.Input.Query, + headers: Operations.get_hyphen_cgi_hyphen_ingredients_period_pl.Input.Headers = .init() + ) { + self.query = query + self.headers = headers + } + } + @frozen public enum Output: Sendable, Hashable { + public struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/cgi/ingredients.pl/GET/responses/200/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/cgi/ingredients.pl/GET/responses/200/content/application\/json`. + case json(Components.Schemas.ocr_on_product) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + public var json: Components.Schemas.ocr_on_product { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.get_hyphen_cgi_hyphen_ingredients_period_pl.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.get_hyphen_cgi_hyphen_ingredients_period_pl.Output.Ok.Body) { + self.body = body + } + } + /// OK + /// + /// - Remark: Generated from `#/paths//cgi/ingredients.pl/get(get-cgi-ingredients.pl)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.get_hyphen_cgi_hyphen_ingredients_period_pl.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + public var ok: Operations.get_hyphen_cgi_hyphen_ingredients_period_pl.Output.Ok { + get throws { + switch self { + case let .ok(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + @frozen public enum AcceptableContentType: AcceptableProtocol { + case json + case other(Swift.String) + public init?(rawValue: Swift.String) { + switch rawValue.lowercased() { + case "application/json": + self = .json + default: + self = .other(rawValue) + } + } + public var rawValue: Swift.String { + switch self { + case let .other(string): + return string + case .json: + return "application/json" + } + } + public static var allCases: [Self] { + [ + .json + ] + } + } + } + /// Rotate A Photo + /// + /// Although we recommend rotating photos manually and uploading a new version of the image, + /// the OFF API allows you to make api calls to automate this process. + /// You can rotate existing photos by setting the angle to 90º, 180º, or 270º clockwise. + /// + /// + /// - Remark: HTTP `GET /cgi/product_image_crop.pl`. + /// - Remark: Generated from `#/paths//cgi/product_image_crop.pl/get(get-cgi-product_image_crop.pl)`. + public enum get_hyphen_cgi_hyphen_product_image_crop_period_pl { + public static let id: Swift.String = "get-cgi-product_image_crop.pl" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/cgi/product_image_crop.pl/GET/query`. + public struct Query: Sendable, Hashable { + /// Barcode of the product + /// + /// - Remark: Generated from `#/paths/cgi/product_image_crop.pl/GET/query/code`. + public var code: Components.Parameters.code + /// - Remark: Generated from `#/paths/cgi/product_image_crop.pl/GET/query/id`. + public var id: Components.Parameters.id + /// - Remark: Generated from `#/paths/cgi/product_image_crop.pl/GET/query/imgid`. + public var imgid: Components.Parameters.imgid + /// - Remark: Generated from `#/paths/cgi/product_image_crop.pl/GET/query/angle`. + public var angle: Components.Parameters.angle + /// Creates a new `Query`. + /// + /// - Parameters: + /// - code: Barcode of the product + /// - id: + /// - imgid: + /// - angle: + public init( + code: Components.Parameters.code, + id: Components.Parameters.id, + imgid: Components.Parameters.imgid, + angle: Components.Parameters.angle + ) { + self.code = code + self.id = id + self.imgid = imgid + self.angle = angle + } + } + public var query: Operations.get_hyphen_cgi_hyphen_product_image_crop_period_pl.Input.Query + /// - Remark: Generated from `#/paths/cgi/product_image_crop.pl/GET/header`. + public struct Headers: Sendable, Hashable { + public var accept: [OpenAPIRuntime.AcceptHeaderContentType] + /// Creates a new `Headers`. + /// + /// - Parameters: + /// - accept: + public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + self.accept = accept + } + } + public var headers: Operations.get_hyphen_cgi_hyphen_product_image_crop_period_pl.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - query: + /// - headers: + public init( + query: Operations.get_hyphen_cgi_hyphen_product_image_crop_period_pl.Input.Query, + headers: Operations.get_hyphen_cgi_hyphen_product_image_crop_period_pl.Input.Headers = .init() + ) { + self.query = query + self.headers = headers + } + } + @frozen public enum Output: Sendable, Hashable { + public struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/cgi/product_image_crop.pl/GET/responses/200/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/cgi/product_image_crop.pl/GET/responses/200/content/application\/json`. + case json(Components.Schemas.rotate_a_photo) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + public var json: Components.Schemas.rotate_a_photo { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.get_hyphen_cgi_hyphen_product_image_crop_period_pl.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.get_hyphen_cgi_hyphen_product_image_crop_period_pl.Output.Ok.Body) { + self.body = body + } + } + /// OK + /// + /// - Remark: Generated from `#/paths//cgi/product_image_crop.pl/get(get-cgi-product_image_crop.pl)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.get_hyphen_cgi_hyphen_product_image_crop_period_pl.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + public var ok: Operations.get_hyphen_cgi_hyphen_product_image_crop_period_pl.Output.Ok { + get throws { + switch self { + case let .ok(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + @frozen public enum AcceptableContentType: AcceptableProtocol { + case json + case other(Swift.String) + public init?(rawValue: Swift.String) { + switch rawValue.lowercased() { + case "application/json": + self = .json + default: + self = .other(rawValue) + } + } + public var rawValue: Swift.String { + switch self { + case let .other(string): + return string + case .json: + return "application/json" + } + } + public static var allCases: [Self] { + [ + .json + ] + } + } + } + /// Crop A Photo + /// + /// Cropping is only relevant for editing existing products. + /// You cannot crop an image the first time you upload it to the system. + /// + /// + /// - Remark: HTTP `POST /cgi/product_image_crop.pl`. + /// - Remark: Generated from `#/paths//cgi/product_image_crop.pl/post(post-cgi-product_image_crop.pl)`. + public enum post_hyphen_cgi_hyphen_product_image_crop_period_pl { + public static let id: Swift.String = "post-cgi-product_image_crop.pl" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/cgi/product_image_crop.pl/POST/header`. + public struct Headers: Sendable, Hashable { + public var accept: [OpenAPIRuntime.AcceptHeaderContentType] + /// Creates a new `Headers`. + /// + /// - Parameters: + /// - accept: + public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + self.accept = accept + } + } + public var headers: Operations.post_hyphen_cgi_hyphen_product_image_crop_period_pl.Input.Headers + /// - Remark: Generated from `#/paths/cgi/product_image_crop.pl/POST/requestBody`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/cgi/product_image_crop.pl/POST/requestBody/content/multipart\/form-data`. + case multipartForm(OpenAPIRuntime.MultipartBody) + } + public var body: Operations.post_hyphen_cgi_hyphen_product_image_crop_period_pl.Input.Body + /// Creates a new `Input`. + /// + /// - Parameters: + /// - headers: + /// - body: + public init( + headers: Operations.post_hyphen_cgi_hyphen_product_image_crop_period_pl.Input.Headers = .init(), + body: Operations.post_hyphen_cgi_hyphen_product_image_crop_period_pl.Input.Body + ) { + self.headers = headers + self.body = body + } + } + @frozen public enum Output: Sendable, Hashable { + public struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/cgi/product_image_crop.pl/POST/responses/200/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/cgi/product_image_crop.pl/POST/responses/200/content/application\/json`. + case json(OpenAPIRuntime.OpenAPIObjectContainer) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + public var json: OpenAPIRuntime.OpenAPIObjectContainer { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.post_hyphen_cgi_hyphen_product_image_crop_period_pl.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.post_hyphen_cgi_hyphen_product_image_crop_period_pl.Output.Ok.Body) { + self.body = body + } + } + /// OK + /// + /// - Remark: Generated from `#/paths//cgi/product_image_crop.pl/post(post-cgi-product_image_crop.pl)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.post_hyphen_cgi_hyphen_product_image_crop_period_pl.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + public var ok: Operations.post_hyphen_cgi_hyphen_product_image_crop_period_pl.Output.Ok { + get throws { + switch self { + case let .ok(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + @frozen public enum AcceptableContentType: AcceptableProtocol { + case json + case other(Swift.String) + public init?(rawValue: Swift.String) { + switch rawValue.lowercased() { + case "application/json": + self = .json + default: + self = .other(rawValue) + } + } + public var rawValue: Swift.String { + switch self { + case let .other(string): + return string + case .json: + return "application/json" + } + } + public static var allCases: [Self] { + [ + .json + ] + } + } + } + /// Unselect A Photo + /// + /// - Remark: HTTP `POST /cgi/product_image_unselect.pl`. + /// - Remark: Generated from `#/paths//cgi/product_image_unselect.pl/post`. + public enum post_sol_cgi_sol_product_image_unselect_period_pl { + public static let id: Swift.String = "post/cgi/product_image_unselect.pl" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/cgi/product_image_unselect.pl/POST/header`. + public struct Headers: Sendable, Hashable { + public var accept: [OpenAPIRuntime.AcceptHeaderContentType] + /// Creates a new `Headers`. + /// + /// - Parameters: + /// - accept: + public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + self.accept = accept + } + } + public var headers: Operations.post_sol_cgi_sol_product_image_unselect_period_pl.Input.Headers + /// - Remark: Generated from `#/paths/cgi/product_image_unselect.pl/POST/requestBody`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/cgi/product_image_unselect.pl/POST/requestBody/content/multipart\/form-data`. + case multipartForm(OpenAPIRuntime.MultipartBody) + } + public var body: Operations.post_sol_cgi_sol_product_image_unselect_period_pl.Input.Body + /// Creates a new `Input`. + /// + /// - Parameters: + /// - headers: + /// - body: + public init( + headers: Operations.post_sol_cgi_sol_product_image_unselect_period_pl.Input.Headers = .init(), + body: Operations.post_sol_cgi_sol_product_image_unselect_period_pl.Input.Body + ) { + self.headers = headers + self.body = body + } + } + @frozen public enum Output: Sendable, Hashable { + public struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/cgi/product_image_unselect.pl/POST/responses/200/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/cgi/product_image_unselect.pl/POST/responses/200/content/json`. + public struct jsonPayload: Codable, Hashable, Sendable { + /// status of the unselect operation + /// + /// - Remark: Generated from `#/paths/cgi/product_image_unselect.pl/POST/responses/200/content/json/status`. + public var status: Swift.String? + /// status code of the operation + /// + /// - Remark: Generated from `#/paths/cgi/product_image_unselect.pl/POST/responses/200/content/json/status_code`. + public var status_code: Swift.Double? + /// image field that was unselected + /// + /// - Remark: Generated from `#/paths/cgi/product_image_unselect.pl/POST/responses/200/content/json/imagefield`. + public var imagefield: Swift.String? + /// Creates a new `jsonPayload`. + /// + /// - Parameters: + /// - status: status of the unselect operation + /// - status_code: status code of the operation + /// - imagefield: image field that was unselected + public init( + status: Swift.String? = nil, + status_code: Swift.Double? = nil, + imagefield: Swift.String? = nil + ) { + self.status = status + self.status_code = status_code + self.imagefield = imagefield + } + public enum CodingKeys: String, CodingKey { + case status + case status_code + case imagefield + } + } + /// - Remark: Generated from `#/paths/cgi/product_image_unselect.pl/POST/responses/200/content/application\/json`. + case json(Operations.post_sol_cgi_sol_product_image_unselect_period_pl.Output.Ok.Body.jsonPayload) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + public var json: Operations.post_sol_cgi_sol_product_image_unselect_period_pl.Output.Ok.Body.jsonPayload { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.post_sol_cgi_sol_product_image_unselect_period_pl.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.post_sol_cgi_sol_product_image_unselect_period_pl.Output.Ok.Body) { + self.body = body + } + } + /// OK + /// + /// - Remark: Generated from `#/paths//cgi/product_image_unselect.pl/post/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.post_sol_cgi_sol_product_image_unselect_period_pl.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + public var ok: Operations.post_sol_cgi_sol_product_image_unselect_period_pl.Output.Ok { + get throws { + switch self { + case let .ok(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + @frozen public enum AcceptableContentType: AcceptableProtocol { + case json + case other(Swift.String) + public init?(rawValue: Swift.String) { + switch rawValue.lowercased() { + case "application/json": + self = .json + default: + self = .other(rawValue) + } + } + public var rawValue: Swift.String { + switch self { + case let .other(string): + return string + case .json: + return "application/json" + } + } + public static var allCases: [Self] { + [ + .json + ] + } + } + } + /// Add or Edit A Product + /// + /// This updates a product. + /// + /// Note: If the barcode exists then you will be editing the existing product, + /// However if it doesn''t you will be creating a new product with that unique barcode, + /// and adding properties to the product. + /// + /// + /// - Remark: HTTP `POST /cgi/product_jqm2.pl`. + /// - Remark: Generated from `#/paths//cgi/product_jqm2.pl/post(post-cgi-product_jqm2.pl)`. + public enum post_hyphen_cgi_hyphen_product_jqm2_period_pl { + public static let id: Swift.String = "post-cgi-product_jqm2.pl" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/cgi/product_jqm2.pl/POST/header`. + public struct Headers: Sendable, Hashable { + public var accept: [OpenAPIRuntime.AcceptHeaderContentType] + /// Creates a new `Headers`. + /// + /// - Parameters: + /// - accept: + public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + self.accept = accept + } + } + public var headers: Operations.post_hyphen_cgi_hyphen_product_jqm2_period_pl.Input.Headers + /// - Remark: Generated from `#/paths/cgi/product_jqm2.pl/POST/requestBody`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/cgi/product_jqm2.pl/POST/requestBody/content/multipart\/form-data`. + case multipartForm(OpenAPIRuntime.MultipartBody) + } + public var body: Operations.post_hyphen_cgi_hyphen_product_jqm2_period_pl.Input.Body + /// Creates a new `Input`. + /// + /// - Parameters: + /// - headers: + /// - body: + public init( + headers: Operations.post_hyphen_cgi_hyphen_product_jqm2_period_pl.Input.Headers = .init(), + body: Operations.post_hyphen_cgi_hyphen_product_jqm2_period_pl.Input.Body + ) { + self.headers = headers + self.body = body + } + } + @frozen public enum Output: Sendable, Hashable { + public struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/cgi/product_jqm2.pl/POST/responses/200/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/cgi/product_jqm2.pl/POST/responses/200/content/application\/json`. + case json(Components.Schemas.add_or_edit_a_product) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + public var json: Components.Schemas.add_or_edit_a_product { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.post_hyphen_cgi_hyphen_product_jqm2_period_pl.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.post_hyphen_cgi_hyphen_product_jqm2_period_pl.Output.Ok.Body) { + self.body = body + } + } + /// OK + /// + /// - Remark: Generated from `#/paths//cgi/product_jqm2.pl/post(post-cgi-product_jqm2.pl)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.post_hyphen_cgi_hyphen_product_jqm2_period_pl.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + public var ok: Operations.post_hyphen_cgi_hyphen_product_jqm2_period_pl.Output.Ok { + get throws { + switch self { + case let .ok(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + @frozen public enum AcceptableContentType: AcceptableProtocol { + case json + case other(Swift.String) + public init?(rawValue: Swift.String) { + switch rawValue.lowercased() { + case "application/json": + self = .json + default: + self = .other(rawValue) + } + } + public var rawValue: Swift.String { + switch self { + case let .other(string): + return string + case .json: + return "application/json" + } + } + public static var allCases: [Self] { + [ + .json + ] + } + } + } + /// Search for Products + /// + /// Search request allows you to get products that match your search criteria. + /// + /// It allows you create many custom APIs for your use case. + /// + /// If the search query parameter has 2 possible values, they are seperated by a comma(,). + /// When filtering via a parameter that has different language codes like `fr`, `de` or `en`, specify the language code in the parameter name e.g `categories_tags_en` + /// + /// **Important:** search API v2 does not support full text request (search_term), + /// you have to use [search API v1](https://wiki.openfoodfacts.org/API/Read/Search) for that. + /// Upcoming [search-a-licious project](https://github.com/openfoodfacts/search-a-licious) will fix that. + /// + /// ### Limiting results + /// + /// You can limit the size of returned objects thanks to the `fields` object (see below). + /// + /// eg: `fields=code,product_name,brands,attribute_groups`` + /// + /// Please use it as much as possible to avoid overloading the servers. + /// + /// The search use pagination, see `page` and `page_size` parameters. + /// + /// **Beware:** the `page_count` data in item is a bit counter intuitive…, read the description. + /// + /// ### Conditions on tags + /// + /// All `_tags`` parameters accepts either: + /// + /// * a single value + /// * or a comma-separated list of values (doing a AND) + /// * or a pipe separated list of values (doing a OR) + /// + /// You can exclude terms by using a "-" prefix. + /// + /// For taxonomized entries, you might either use the tag id (recommended), + /// or a known synonym (without language prefix) + /// + /// * `labels_tags=en:organic,en:fair-trade` find items that are fair-trade AND organic + /// * `labels_tags=en:organic|en:fair-trade` find items that are fair-trade OR organic + /// * `labels_tags=en:organic,en:-fair-trade` find items that are organic BUT NOT fair-trade + /// + /// + /// ### Conditions on nutriments + /// + /// To get a list of nutrients + /// + /// You can either query on nutrient per 100g (`_100g` suffix) + /// or per serving (`serving` suffix). + /// + /// You can also add `_prepared_` + /// to get the nutrients in the prepared product instead of as sold. + /// + /// You can add a comparison operator and value to the parameter name + /// to get products with nutrient above or bellow a value. + /// If you use a parameter value it exactly match it. + /// + /// * `energy-kj_100g<200` products where energy in kj for 100g is less than 200kj + /// * `sugars_serving>10` products where sugar per serving is greater than 10g + /// * `saturated-fat_100g=1` products where saturated fat per 100g is exactly 10g + /// * `salt_prepared_serving<0.1` products where salt per serving for prepared product is less than 0.1g + /// + /// ### More references + /// + /// See also [wiki page](https://wiki.openfoodfacts.org/Open_Food_Facts_Search_API_Version_2) + /// + /// + /// - Remark: HTTP `GET /api/v2/search`. + /// - Remark: Generated from `#/paths//api/v2/search/get(get-search)`. + public enum get_hyphen_search { + public static let id: Swift.String = "get-search" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/api/v2/search/GET/query`. + public struct Query: Sendable, Hashable { + /// The additives_tags in english of product(s) you are searching for. + /// The [OFF App](https://world.openfoodfacts.org/additives) has a list of possible values for `additives`. + /// + /// You can use multiple values by using a comma separated list. + /// You can add a "-" before values to avoid matching a tag. + /// + /// + /// - Remark: Generated from `#/paths/api/v2/search/GET/query/additives_tags`. + public var additives_tags: Components.Parameters.tags_parameters_properties_additives_tags? + /// The allergens_tags in english of product(s) you are searching for. + /// The [OFF App](https://world.openfoodfacts.org/allergens) has a list of possible values for `allergens`. + /// + /// You can use multiple values by using a comma separated list. + /// You can add a "-" before values to avoid matching a tag. + /// + /// + /// - Remark: Generated from `#/paths/api/v2/search/GET/query/allergens_tags`. + public var allergens_tags: Components.Parameters.tags_parameters_properties_allergens_tags? + /// The brands_tags of product(s) you are searching for. + /// The [OFF App](https://world.openfoodfacts.org/brands) has a list of possible values for `brands`. + /// + /// You can use multiple values by using a comma separated list. + /// You can add a "-" before values to avoid matching a tag. + /// + /// + /// - Remark: Generated from `#/paths/api/v2/search/GET/query/brands_tags`. + public var brands_tags: Components.Parameters.tags_parameters_properties_brands_tags? + /// The category of product(s) you are searching for. + /// The [OFF App](https://world.openfoodfacts.org/categories) has a list of possible values for `categories`. + /// + /// You can use multiple values by using a comma separated list. + /// You can add a "-" before values to avoid matching a tag. + /// + /// + /// - Remark: Generated from `#/paths/api/v2/search/GET/query/categories_tags`. + public var categories_tags: Components.Parameters.tags_parameters_properties_categories_tags? + /// The countries_tags_en of product(s) you are searching for. + /// The [OFF App](https://world.openfoodfacts.org/countries) shows a list of possible values for `countries`. + /// + /// You can use multiple values by using a comma separated list. + /// You can add a "-" before values to avoid matching a tag. + /// + /// + /// - Remark: Generated from `#/paths/api/v2/search/GET/query/countries_tags_en`. + public var countries_tags_en: Components.Parameters.tags_parameters_properties_countries_tags? + /// The emb_codes_tags of product(s) you are searching for. + /// + /// You can use multiple values by using a comma separated list. + /// You can add a "-" before values to avoid matching a tag. + /// + /// + /// - Remark: Generated from `#/paths/api/v2/search/GET/query/emb_codes_tags`. + public var emb_codes_tags: Components.Parameters.tags_parameters_properties_emb_codes_tags? + /// The labels_tags in english of product(s) you are searching for. + /// The [OFF App](https://world.openfoodfacts.org/labels) has a list of possible values for `labels`. + /// + /// You can use multiple values by using a comma separated list. + /// You can add a "-" before values to avoid matching a tag. + /// + /// + /// - Remark: Generated from `#/paths/api/v2/search/GET/query/labels_tags`. + public var labels_tags: Components.Parameters.tags_parameters_properties_labels_tags? + /// The manufacturing_places_tags of product(s) you are searching for. + /// The [OFF App](https://world.openfoodfacts.org/manufacturing-places) has a list of possible values for `manufacturing-places`. + /// + /// You can use multiple values by using a comma separated list. + /// You can add a "-" before values to avoid matching a tag. + /// + /// + /// - Remark: Generated from `#/paths/api/v2/search/GET/query/manufacturing_places_tags`. + public var manufacturing_places_tags: Components.Parameters.tags_parameters_properties_manufacturing_places_tags? + /// The nutrition_grades_tags of product(s) you are searching for. + /// The [OFF App](https://world.openfoodfacts.org/nutrition-grades) has a list of possible values for `nutrition-grades`. + /// + /// You can use multiple values by using a comma separated list. + /// You can add a "-" before values to avoid matching a tag. + /// + /// + /// - Remark: Generated from `#/paths/api/v2/search/GET/query/nutrition_grades_tags`. + public var nutrition_grades_tags: Components.Parameters.tags_parameters_properties_nutrition_grades_tags? + /// The origins_tags of product(s) you are searching for. + /// + /// You can use multiple values by using a comma separated list. + /// You can add a "-" before values to avoid matching a tag. + /// + /// + /// - Remark: Generated from `#/paths/api/v2/search/GET/query/origins_tags`. + public var origins_tags: Components.Parameters.tags_parameters_properties_origins_tags? + /// The packaging_tag in german of product(s) you are searching for. + /// The [OFF App](https://world.openfoodfacts.org/packaging) has a list of possible values for `packaging`. + /// + /// You can use multiple values by using a comma separated list. + /// You can add a "-" before values to avoid matching a tag. + /// + /// + /// - Remark: Generated from `#/paths/api/v2/search/GET/query/packaging_tags_de`. + public var packaging_tags_de: Components.Parameters.tags_parameters_properties_packaging_tags? + /// The purchase_places_tags of product(s) you are searching for. + /// + /// You can use multiple values by using a comma separated list. + /// You can add a "-" before values to avoid matching a tag. + /// + /// + /// - Remark: Generated from `#/paths/api/v2/search/GET/query/purchase_places_tags`. + public var purchase_places_tags: Components.Parameters.tags_parameters_properties_purchase_places_tags? + /// The states_tags in english of product(s) you are searching for. + /// The [OFF App](https://world.openfoodfacts.org/states) has a list of possible values for `states`. + /// + /// You can use multiple values by using a comma separated list. + /// You can add a "-" before values to avoid matching a tag. + /// + /// + /// - Remark: Generated from `#/paths/api/v2/search/GET/query/states_tags`. + public var states_tags: Components.Parameters.tags_parameters_properties_states_tags? + /// The stores_tags of product(s) you are searching for. + /// + /// You can use multiple values by using a comma separated list. + /// You can add a "-" before values to avoid matching a tag. + /// + /// + /// - Remark: Generated from `#/paths/api/v2/search/GET/query/stores_tags`. + public var stores_tags: Components.Parameters.tags_parameters_properties_stores_tags? + /// The traces_tags of product(s) you are searching for. + /// The [OFF App](https://world.openfoodfacts.org/traces) shows a list of possible values for `traces`. + /// + /// You can use multiple values by using a comma separated list. + /// You can add a "-" before values to avoid matching a tag. + /// + /// + /// - Remark: Generated from `#/paths/api/v2/search/GET/query/traces_tags`. + public var traces_tags: Components.Parameters.tags_parameters_properties_traces_tags? + /// - Remark: Generated from `#/components/parameters/tags_parameters_properties_tag_name_with_language_code`. + public struct tags_parameters_properties_tag_name_with_language_code: Codable, Hashable, Sendable { + /// Will search in the tags corresponding to `tag_name`, + /// in the language corresponding to `language_code. + /// + /// `tag_name` is one of the field above which have the `_tags`` suffix: + /// categories, nutrition_grades, etc. + /// + /// `language_code` is a two letter iso language `language_code. + /// + /// You can use multiple values by using a comma separated list. + /// You can add a "-" before values to avoid matching a tag. + /// + /// + /// - Remark: Generated from `#/components/parameters/tags_parameters_properties_tag_name_with_language_code/tag_name_example`. + public var tag_name_example: Swift.String? + /// Creates a new `tags_parameters_properties_tag_name_with_language_code`. + /// + /// - Parameters: + /// - tag_name_example: Will search in the tags corresponding to `tag_name`, + public init(tag_name_example: Swift.String? = nil) { + self.tag_name_example = tag_name_example + } + public enum CodingKeys: String, CodingKey { + case tag_name_example + } + } + /// You can add a language code to a specific tag to query it in a specific language + /// + /// + /// - Remark: Generated from `#/paths/api/v2/search/GET/query/_tags_`. + public var _lt_tag_name_gt__tags__lt_language_code_gt_: Components.Parameters.tags_parameters_properties_tag_name_with_language_code? + /// - Remark: Generated from `#/components/parameters/nutrition_search_properties_nutrient_lower_than`. + public struct nutrition_search_properties_nutrient_lower_than: Codable, Hashable, Sendable { + /// Will search for products with nutrients lower than `value` + /// per `portion` (100g or serving). + /// + /// If `prepared` is "prepared" search in prepared product instead of "as sold". + /// + /// Important: the parameter value is discarded and should be empty + /// + /// + /// - Remark: Generated from `#/components/parameters/nutrition_search_properties_nutrient_lower_than/nutrient_example`. + public var nutrient_example: Swift.String? + /// Creates a new `nutrition_search_properties_nutrient_lower_than`. + /// + /// - Parameters: + /// - nutrient_example: Will search for products with nutrients lower than `value` + public init(nutrient_example: Swift.String? = nil) { + self.nutrient_example = nutrient_example + } + public enum CodingKeys: String, CodingKey { + case nutrient_example + } + } + /// Search on nutrient lower than a value + /// + /// + /// - Remark: Generated from `#/paths/api/v2/search/GET/query/_lt_`. + public var _lt_nutrient_gt__lt__lt_value_gt_: Components.Parameters.nutrition_search_properties_nutrient_lower_than? + /// - Remark: Generated from `#/components/parameters/nutrition_search_properties_nutrient_greater_than`. + public struct nutrition_search_properties_nutrient_greater_than: Codable, Hashable, Sendable { + /// Will search for products with nutrients more than `value` + /// per `portion` (100g or serving). + /// + /// If `prepared` is "prepared" search in prepared product instead of "as sold". + /// + /// Important: the parameter value is discarded and should be empty + /// + /// + /// - Remark: Generated from `#/components/parameters/nutrition_search_properties_nutrient_greater_than/nutrient_example`. + public var nutrient_example: Swift.String? + /// Creates a new `nutrition_search_properties_nutrient_greater_than`. + /// + /// - Parameters: + /// - nutrient_example: Will search for products with nutrients more than `value` + public init(nutrient_example: Swift.String? = nil) { + self.nutrient_example = nutrient_example + } + public enum CodingKeys: String, CodingKey { + case nutrient_example + } + } + /// Search on nutrient greater than a value + /// + /// + /// - Remark: Generated from `#/paths/api/v2/search/GET/query/_gt_`. + public var _lt_nutrient_gt__gt__lt_value_gt_: Components.Parameters.nutrition_search_properties_nutrient_greater_than? + /// - Remark: Generated from `#/components/parameters/nutrition_search_properties_nutrient_equal`. + public struct nutrition_search_properties_nutrient_equal: Codable, Hashable, Sendable { + /// Will search for products with nutrients exactl the parameter value + /// per `portion` (100g or serving). + /// + /// If `prepared` is "prepared" search in prepared product instead of "as sold". + /// + /// + /// - Remark: Generated from `#/components/parameters/nutrition_search_properties_nutrient_equal/nutrient_example`. + public var nutrient_example: Swift.String? + /// Creates a new `nutrition_search_properties_nutrient_equal`. + /// + /// - Parameters: + /// - nutrient_example: Will search for products with nutrients exactl the parameter value + public init(nutrient_example: Swift.String? = nil) { + self.nutrient_example = nutrient_example + } + public enum CodingKeys: String, CodingKey { + case nutrient_example + } + } + /// Search on nutrient for an exact quantity + /// + /// + /// - Remark: Generated from `#/paths/api/v2/search/GET/query/_eq_`. + public var _lt_nutrient_gt__eq__lt_value_gt_: Components.Parameters.nutrition_search_properties_nutrient_equal? + /// The fields to be returned from the product object can also be limited. + /// If not specified, it returns the entire product object response. + /// + /// + /// - Remark: Generated from `#/paths/api/v2/search/GET/query/fields`. + public var fields: Components.Parameters.fields? + /// - Remark: Generated from `#/components/parameters/sort_by`. + @frozen public enum sort_by: String, Codable, Hashable, Sendable, CaseIterable { + case product_name = "product_name" + case last_modified_t = "last_modified_t" + case scans_n = "scans_n" + case unique_scans_n = "unique_scans_n" + case created_t = "created_t" + case completeness = "completeness" + case popularity_key = "popularity_key" + case nutriscore_score = "nutriscore_score" + case nova_score = "nova_score" + case nothing = "nothing" + case ecoscore_score = "ecoscore_score" + } + /// The allowed values used to sort/order the search results. + /// + /// * `product_name` sorts on name + /// * `ecoscore_score`, `nova_score`, `nutriscore_score` rank on the [Eco-Score](https://world.openfoodfacts.org/eco-score-the-environmental-impact-of-food-products), [Nova](https://world.openfoodfacts.org/nova), or [Nutri-Score](https://world.openfoodfacts.org/nutriscore) + /// * `scans_n`, `unique_scans_n` and `popularity_key` are about product popularity: number of scans on unique scans, rank of product + /// * `created_t`, `last_modified_t`, are about creation and modification dates + /// * `nothing`, tells not to sort at all (because if you do not provide the sort_by argument we default to sorting on popularity (for food) or last modification date) + /// + /// + /// - Remark: Generated from `#/paths/api/v2/search/GET/query/sort_by`. + public var sort_by: Components.Parameters.sort_by? + /// The page number you request to view (eg. in search results spanning multiple pages) + /// + /// + /// - Remark: Generated from `#/paths/api/v2/search/GET/query/page`. + public var page: Components.Parameters.page? + /// The number of elements should be sent per page + /// + /// + /// - Remark: Generated from `#/paths/api/v2/search/GET/query/page_size`. + public var page_size: Components.Parameters.page_size? + /// Creates a new `Query`. + /// + /// - Parameters: + /// - additives_tags: The additives_tags in english of product(s) you are searching for. + /// - allergens_tags: The allergens_tags in english of product(s) you are searching for. + /// - brands_tags: The brands_tags of product(s) you are searching for. + /// - categories_tags: The category of product(s) you are searching for. + /// - countries_tags_en: The countries_tags_en of product(s) you are searching for. + /// - emb_codes_tags: The emb_codes_tags of product(s) you are searching for. + /// - labels_tags: The labels_tags in english of product(s) you are searching for. + /// - manufacturing_places_tags: The manufacturing_places_tags of product(s) you are searching for. + /// - nutrition_grades_tags: The nutrition_grades_tags of product(s) you are searching for. + /// - origins_tags: The origins_tags of product(s) you are searching for. + /// - packaging_tags_de: The packaging_tag in german of product(s) you are searching for. + /// - purchase_places_tags: The purchase_places_tags of product(s) you are searching for. + /// - states_tags: The states_tags in english of product(s) you are searching for. + /// - stores_tags: The stores_tags of product(s) you are searching for. + /// - traces_tags: The traces_tags of product(s) you are searching for. + /// - _lt_tag_name_gt__tags__lt_language_code_gt_: You can add a language code to a specific tag to query it in a specific language + /// - _lt_nutrient_gt__lt__lt_value_gt_: Search on nutrient lower than a value + /// - _lt_nutrient_gt__gt__lt_value_gt_: Search on nutrient greater than a value + /// - _lt_nutrient_gt__eq__lt_value_gt_: Search on nutrient for an exact quantity + /// - fields: The fields to be returned from the product object can also be limited. + /// - sort_by: The allowed values used to sort/order the search results. + /// - page: The page number you request to view (eg. in search results spanning multiple pages) + /// - page_size: The number of elements should be sent per page + public init( + additives_tags: Components.Parameters.tags_parameters_properties_additives_tags? = nil, + allergens_tags: Components.Parameters.tags_parameters_properties_allergens_tags? = nil, + brands_tags: Components.Parameters.tags_parameters_properties_brands_tags? = nil, + categories_tags: Components.Parameters.tags_parameters_properties_categories_tags? = nil, + countries_tags_en: Components.Parameters.tags_parameters_properties_countries_tags? = nil, + emb_codes_tags: Components.Parameters.tags_parameters_properties_emb_codes_tags? = nil, + labels_tags: Components.Parameters.tags_parameters_properties_labels_tags? = nil, + manufacturing_places_tags: Components.Parameters.tags_parameters_properties_manufacturing_places_tags? = nil, + nutrition_grades_tags: Components.Parameters.tags_parameters_properties_nutrition_grades_tags? = nil, + origins_tags: Components.Parameters.tags_parameters_properties_origins_tags? = nil, + packaging_tags_de: Components.Parameters.tags_parameters_properties_packaging_tags? = nil, + purchase_places_tags: Components.Parameters.tags_parameters_properties_purchase_places_tags? = nil, + states_tags: Components.Parameters.tags_parameters_properties_states_tags? = nil, + stores_tags: Components.Parameters.tags_parameters_properties_stores_tags? = nil, + traces_tags: Components.Parameters.tags_parameters_properties_traces_tags? = nil, + _lt_tag_name_gt__tags__lt_language_code_gt_: Components.Parameters.tags_parameters_properties_tag_name_with_language_code? = nil, + _lt_nutrient_gt__lt__lt_value_gt_: Components.Parameters.nutrition_search_properties_nutrient_lower_than? = nil, + _lt_nutrient_gt__gt__lt_value_gt_: Components.Parameters.nutrition_search_properties_nutrient_greater_than? = nil, + _lt_nutrient_gt__eq__lt_value_gt_: Components.Parameters.nutrition_search_properties_nutrient_equal? = nil, + fields: Components.Parameters.fields? = nil, + sort_by: Components.Parameters.sort_by? = nil, + page: Components.Parameters.page? = nil, + page_size: Components.Parameters.page_size? = nil + ) { + self.additives_tags = additives_tags + self.allergens_tags = allergens_tags + self.brands_tags = brands_tags + self.categories_tags = categories_tags + self.countries_tags_en = countries_tags_en + self.emb_codes_tags = emb_codes_tags + self.labels_tags = labels_tags + self.manufacturing_places_tags = manufacturing_places_tags + self.nutrition_grades_tags = nutrition_grades_tags + self.origins_tags = origins_tags + self.packaging_tags_de = packaging_tags_de + self.purchase_places_tags = purchase_places_tags + self.states_tags = states_tags + self.stores_tags = stores_tags + self.traces_tags = traces_tags + self._lt_tag_name_gt__tags__lt_language_code_gt_ = _lt_tag_name_gt__tags__lt_language_code_gt_ + self._lt_nutrient_gt__lt__lt_value_gt_ = _lt_nutrient_gt__lt__lt_value_gt_ + self._lt_nutrient_gt__gt__lt_value_gt_ = _lt_nutrient_gt__gt__lt_value_gt_ + self._lt_nutrient_gt__eq__lt_value_gt_ = _lt_nutrient_gt__eq__lt_value_gt_ + self.fields = fields + self.sort_by = sort_by + self.page = page + self.page_size = page_size + } + } + public var query: Operations.get_hyphen_search.Input.Query + /// - Remark: Generated from `#/paths/api/v2/search/GET/header`. + public struct Headers: Sendable, Hashable { + public var accept: [OpenAPIRuntime.AcceptHeaderContentType] + /// Creates a new `Headers`. + /// + /// - Parameters: + /// - accept: + public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + self.accept = accept + } + } + public var headers: Operations.get_hyphen_search.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - query: + /// - headers: + public init( + query: Operations.get_hyphen_search.Input.Query = .init(), + headers: Operations.get_hyphen_search.Input.Headers = .init() + ) { + self.query = query + self.headers = headers + } + } + @frozen public enum Output: Sendable, Hashable { + public struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/api/v2/search/GET/responses/200/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/api/v2/search/GET/responses/200/content/application\/json`. + case json(Components.Schemas.search_for_products) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + public var json: Components.Schemas.search_for_products { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.get_hyphen_search.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.get_hyphen_search.Output.Ok.Body) { + self.body = body + } + } + /// OK + /// + /// - Remark: Generated from `#/paths//api/v2/search/get(get-search)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.get_hyphen_search.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + public var ok: Operations.get_hyphen_search.Output.Ok { + get throws { + switch self { + case let .ok(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + @frozen public enum AcceptableContentType: AcceptableProtocol { + case json + case other(Swift.String) + public init?(rawValue: Swift.String) { + switch rawValue.lowercased() { + case "application/json": + self = .json + default: + self = .other(rawValue) + } + } + public var rawValue: Swift.String { + switch self { + case let .other(string): + return string + case .json: + return "application/json" + } + } + public static var allCases: [Self] { + [ + .json + ] + } + } + } + /// Get Suggestions to Aid Adding/Editing Products + /// + /// For example , Dave is looking for packaging_shapes that contain the term "fe", + /// all packaging_shapes containing "fe" will be returned. + /// This is useful if you have a search in your application, + /// for a specific product field. + /// + /// + /// - Remark: HTTP `GET /cgi/suggest.pl`. + /// - Remark: Generated from `#/paths//cgi/suggest.pl/get(get-cgi-suggest.pl)`. + public enum get_hyphen_cgi_hyphen_suggest_period_pl { + public static let id: Swift.String = "get-cgi-suggest.pl" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/cgi/suggest.pl/GET/query`. + public struct Query: Sendable, Hashable { + /// - Remark: Generated from `#/paths/cgi/suggest.pl/GET/query/tagtype`. + public var tagtype: Components.Parameters.tagtype? + /// - Remark: Generated from `#/paths/cgi/suggest.pl/GET/query/term`. + public var term: Components.Parameters.term? + /// Creates a new `Query`. + /// + /// - Parameters: + /// - tagtype: + /// - term: + public init( + tagtype: Components.Parameters.tagtype? = nil, + term: Components.Parameters.term? = nil + ) { + self.tagtype = tagtype + self.term = term + } + } + public var query: Operations.get_hyphen_cgi_hyphen_suggest_period_pl.Input.Query + /// - Remark: Generated from `#/paths/cgi/suggest.pl/GET/header`. + public struct Headers: Sendable, Hashable { + public var accept: [OpenAPIRuntime.AcceptHeaderContentType] + /// Creates a new `Headers`. + /// + /// - Parameters: + /// - accept: + public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + self.accept = accept + } + } + public var headers: Operations.get_hyphen_cgi_hyphen_suggest_period_pl.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - query: + /// - headers: + public init( + query: Operations.get_hyphen_cgi_hyphen_suggest_period_pl.Input.Query = .init(), + headers: Operations.get_hyphen_cgi_hyphen_suggest_period_pl.Input.Headers = .init() + ) { + self.query = query + self.headers = headers + } + } + @frozen public enum Output: Sendable, Hashable { + public struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/cgi/suggest.pl/GET/responses/200/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/cgi/suggest.pl/GET/responses/200/content/application\/json`. + case json(OpenAPIRuntime.OpenAPIArrayContainer) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + public var json: OpenAPIRuntime.OpenAPIArrayContainer { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.get_hyphen_cgi_hyphen_suggest_period_pl.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.get_hyphen_cgi_hyphen_suggest_period_pl.Output.Ok.Body) { + self.body = body + } + } + /// OK + /// + /// - Remark: Generated from `#/paths//cgi/suggest.pl/get(get-cgi-suggest.pl)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.get_hyphen_cgi_hyphen_suggest_period_pl.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + public var ok: Operations.get_hyphen_cgi_hyphen_suggest_period_pl.Output.Ok { + get throws { + switch self { + case let .ok(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + @frozen public enum AcceptableContentType: AcceptableProtocol { + case json + case other(Swift.String) + public init?(rawValue: Swift.String) { + switch rawValue.lowercased() { + case "application/json": + self = .json + default: + self = .other(rawValue) + } + } + public var rawValue: Swift.String { + switch self { + case let .other(string): + return string + case .json: + return "application/json" + } + } + public static var allCases: [Self] { + [ + .json + ] + } + } + } + /// Get a nested list of nutrients that can be displayed in the nutrition facts table for a specific country and language + /// + /// Used to display the nutrition facts table of a product, or to display a form to input those nutrition facts. + /// + /// + /// - Remark: HTTP `GET /cgi/nutrients.pl`. + /// - Remark: Generated from `#/paths//cgi/nutrients.pl/get(get-cgi-nutrients.pl)`. + public enum get_hyphen_cgi_hyphen_nutrients_period_pl { + public static let id: Swift.String = "get-cgi-nutrients.pl" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/cgi/nutrients.pl/GET/query`. + public struct Query: Sendable, Hashable { + /// 2 letter code of the country of the user. Used for localizing some fields in returned values (e.g. knowledge panels). If not passed, the country may be inferred by the IP address of the request. + /// + /// - Remark: Generated from `#/paths/cgi/nutrients.pl/GET/query/cc`. + public var cc: Components.Parameters.cc? + /// 2 letter code of the language of the user. + /// Used for localizing some fields in returned values (e.g. knowledge panels). + /// If not passed, the language may be inferred by the Accept-Language header of the request, + /// or from the domain name prefix. + /// + /// + /// - Remark: Generated from `#/paths/cgi/nutrients.pl/GET/query/lc`. + public var lc: Components.Parameters.lc? + /// Creates a new `Query`. + /// + /// - Parameters: + /// - cc: 2 letter code of the country of the user. Used for localizing some fields in returned values (e.g. knowledge panels). If not passed, the country may be inferred by the IP address of the request. + /// - lc: 2 letter code of the language of the user. + public init( + cc: Components.Parameters.cc? = nil, + lc: Components.Parameters.lc? = nil + ) { + self.cc = cc + self.lc = lc + } + } + public var query: Operations.get_hyphen_cgi_hyphen_nutrients_period_pl.Input.Query + /// - Remark: Generated from `#/paths/cgi/nutrients.pl/GET/header`. + public struct Headers: Sendable, Hashable { + public var accept: [OpenAPIRuntime.AcceptHeaderContentType] + /// Creates a new `Headers`. + /// + /// - Parameters: + /// - accept: + public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + self.accept = accept + } + } + public var headers: Operations.get_hyphen_cgi_hyphen_nutrients_period_pl.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - query: + /// - headers: + public init( + query: Operations.get_hyphen_cgi_hyphen_nutrients_period_pl.Input.Query = .init(), + headers: Operations.get_hyphen_cgi_hyphen_nutrients_period_pl.Input.Headers = .init() + ) { + self.query = query + self.headers = headers + } + } + @frozen public enum Output: Sendable, Hashable { + public struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/cgi/nutrients.pl/GET/responses/200/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/cgi/nutrients.pl/GET/responses/200/content/application\/json`. + case json(Components.Schemas.get_nutrients) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + public var json: Components.Schemas.get_nutrients { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.get_hyphen_cgi_hyphen_nutrients_period_pl.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.get_hyphen_cgi_hyphen_nutrients_period_pl.Output.Ok.Body) { + self.body = body + } + } + /// OK + /// + /// - Remark: Generated from `#/paths//cgi/nutrients.pl/get(get-cgi-nutrients.pl)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.get_hyphen_cgi_hyphen_nutrients_period_pl.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + public var ok: Operations.get_hyphen_cgi_hyphen_nutrients_period_pl.Output.Ok { + get throws { + switch self { + case let .ok(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + @frozen public enum AcceptableContentType: AcceptableProtocol { + case json + case other(Swift.String) + public init?(rawValue: Swift.String) { + switch rawValue.lowercased() { + case "application/json": + self = .json + default: + self = .other(rawValue) + } + } + public var rawValue: Swift.String { + switch self { + case let .other(string): + return string + case .json: + return "application/json" + } + } + public static var allCases: [Self] { + [ + .json + ] + } + } + } + /// Get the list of attributes available for personal search. + /// + /// Attributes are at the heart of personal search. + /// They score the products according to different criterias, + /// which could then be matched to a user's preferences. + /// + /// This API helps you list attributes and display them in your application, + /// for the user to choose the importance of each criteria. + /// + /// note: /api/v2/attribute_groups_{lc} is also a valid route, but consider it deprecated + /// + /// + /// - Remark: HTTP `GET /api/v2/attribute_groups`. + /// - Remark: Generated from `#/paths//api/v2/attribute_groups/get(get-attribute-groups)`. + public enum get_hyphen_attribute_hyphen_groups { + public static let id: Swift.String = "get-attribute-groups" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/api/v2/attribute_groups/GET/query`. + public struct Query: Sendable, Hashable { + /// 2 letter code of the language of the user. + /// Used for localizing some fields in returned values (e.g. knowledge panels). + /// If not passed, the language may be inferred by the Accept-Language header of the request, + /// or from the domain name prefix. + /// + /// + /// - Remark: Generated from `#/paths/api/v2/attribute_groups/GET/query/lc`. + public var lc: Components.Parameters.lc? + /// Creates a new `Query`. + /// + /// - Parameters: + /// - lc: 2 letter code of the language of the user. + public init(lc: Components.Parameters.lc? = nil) { + self.lc = lc + } + } + public var query: Operations.get_hyphen_attribute_hyphen_groups.Input.Query + /// - Remark: Generated from `#/paths/api/v2/attribute_groups/GET/header`. + public struct Headers: Sendable, Hashable { + public var accept: [OpenAPIRuntime.AcceptHeaderContentType] + /// Creates a new `Headers`. + /// + /// - Parameters: + /// - accept: + public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + self.accept = accept + } + } + public var headers: Operations.get_hyphen_attribute_hyphen_groups.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - query: + /// - headers: + public init( + query: Operations.get_hyphen_attribute_hyphen_groups.Input.Query = .init(), + headers: Operations.get_hyphen_attribute_hyphen_groups.Input.Headers = .init() + ) { + self.query = query + self.headers = headers + } + } + @frozen public enum Output: Sendable, Hashable { + public struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/api/v2/attribute_groups/GET/responses/200/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/api/v2/attribute_groups/GET/responses/200/content/application\/json`. + case json(Components.Schemas.get_attribute_groups) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + public var json: Components.Schemas.get_attribute_groups { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.get_hyphen_attribute_hyphen_groups.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.get_hyphen_attribute_hyphen_groups.Output.Ok.Body) { + self.body = body + } + } + /// OK + /// + /// - Remark: Generated from `#/paths//api/v2/attribute_groups/get(get-attribute-groups)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.get_hyphen_attribute_hyphen_groups.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + public var ok: Operations.get_hyphen_attribute_hyphen_groups.Output.Ok { + get throws { + switch self { + case let .ok(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + @frozen public enum AcceptableContentType: AcceptableProtocol { + case json + case other(Swift.String) + public init?(rawValue: Swift.String) { + switch rawValue.lowercased() { + case "application/json": + self = .json + default: + self = .other(rawValue) + } + } + public var rawValue: Swift.String { + switch self { + case let .other(string): + return string + case .json: + return "application/json" + } + } + public static var allCases: [Self] { + [ + .json + ] + } + } + } + /// Get the weights corresponding to attributes preferences + /// to compute personal product + /// + /// + /// - Remark: HTTP `GET /api/v2/preferences`. + /// - Remark: Generated from `#/paths//api/v2/preferences/get(get-preferences)`. + public enum get_hyphen_preferences { + public static let id: Swift.String = "get-preferences" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/api/v2/preferences/GET/query`. + public struct Query: Sendable, Hashable { + /// 2 letter code of the language of the user. + /// Used for localizing some fields in returned values (e.g. knowledge panels). + /// If not passed, the language may be inferred by the Accept-Language header of the request, + /// or from the domain name prefix. + /// + /// + /// - Remark: Generated from `#/paths/api/v2/preferences/GET/query/lc`. + public var lc: Components.Parameters.lc? + /// Creates a new `Query`. + /// + /// - Parameters: + /// - lc: 2 letter code of the language of the user. + public init(lc: Components.Parameters.lc? = nil) { + self.lc = lc + } + } + public var query: Operations.get_hyphen_preferences.Input.Query + /// - Remark: Generated from `#/paths/api/v2/preferences/GET/header`. + public struct Headers: Sendable, Hashable { + public var accept: [OpenAPIRuntime.AcceptHeaderContentType] + /// Creates a new `Headers`. + /// + /// - Parameters: + /// - accept: + public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + self.accept = accept + } + } + public var headers: Operations.get_hyphen_preferences.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - query: + /// - headers: + public init( + query: Operations.get_hyphen_preferences.Input.Query = .init(), + headers: Operations.get_hyphen_preferences.Input.Headers = .init() + ) { + self.query = query + self.headers = headers + } + } + @frozen public enum Output: Sendable, Hashable { + public struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/api/v2/preferences/GET/responses/200/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/api/v2/preferences/GET/responses/200/content/application\/json`. + case json(Components.Schemas.get_preferences) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + public var json: Components.Schemas.get_preferences { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.get_hyphen_preferences.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.get_hyphen_preferences.Output.Ok.Body) { + self.body = body + } + } + /// OK + /// + /// - Remark: Generated from `#/paths//api/v2/preferences/get(get-preferences)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.get_hyphen_preferences.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + public var ok: Operations.get_hyphen_preferences.Output.Ok { + get throws { + switch self { + case let .ok(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + @frozen public enum AcceptableContentType: AcceptableProtocol { + case json + case other(Swift.String) + public init?(rawValue: Swift.String) { + switch rawValue.lowercased() { + case "application/json": + self = .json + default: + self = .other(rawValue) + } + } + public var rawValue: Swift.String { + switch self { + case let .other(string): + return string + case .json: + return "application/json" + } + } + public static var allCases: [Self] { + [ + .json + ] + } + } + } +} diff --git a/OpenFoodFactsService/Sources/main.swift b/OpenFoodFactsService/Sources/main.swift index 18f528a..25a67f5 100644 --- a/OpenFoodFactsService/Sources/main.swift +++ b/OpenFoodFactsService/Sources/main.swift @@ -1,12 +1,2 @@ import OpenAPIRuntime import OpenAPIURLSession - - -let client = Client( - serverURL: try Servers.server2(), - transport: URLSessionTransport() -) - - -let response = try await client.getGreeting(query: .init(name: "CLI")) -print(response) diff --git a/OpenFoodFactsService/Sources/openapi-generator-config.yaml b/OpenFoodFactsService/Sources/openapi-generator-config.yaml index ecefb47..3e0f172 100644 --- a/OpenFoodFactsService/Sources/openapi-generator-config.yaml +++ b/OpenFoodFactsService/Sources/openapi-generator-config.yaml @@ -1,3 +1,4 @@ generate: - types - client +accessModifier: public \ No newline at end of file diff --git a/OpenFoodFactsService/Sources/openapi.yaml b/OpenFoodFactsService/Sources/openapi.yaml index 994efe9..e7f83d0 100644 --- a/OpenFoodFactsService/Sources/openapi.yaml +++ b/OpenFoodFactsService/Sources/openapi.yaml @@ -1,2967 +1,58 @@ openapi: 3.1.0 info: - title: Open Food Facts Open API - description: > - As a developer, the Open Food Facts API allows you to get information + title: OpenFoodFactsOpenAPI + description: 'As a developer, the Open Food Facts API allows you to get information and contribute to the products database. You can create great apps to - help people make better food choices and also provide data to enhance the - database. - termsOfService: 'https://world.openfoodfacts.org/terms-of-use' + help people make better food choices and also provide data to enhance the database. + + ' + termsOfService: https://world.openfoodfacts.org/terms-of-use contact: name: Open Food Facts - url: 'https://slack.openfoodfacts.org/' + url: https://slack.openfoodfacts.org/ email: reuse@openfoodfacts.org license: name: 'data: ODbL' - url: 'https://opendatacommons.org/licenses/odbl/summary/index.html' + url: https://opendatacommons.org/licenses/odbl/summary/index.html x-identifier: ODbL-1.0 version: '2' externalDocs: - description: | - Please read the API introduction before using this API. - url: 'https://openfoodfacts.github.io/openfoodfacts-server/api/' + description: 'Please read the API introduction before using this API. + + ' + url: https://openfoodfacts.github.io/openfoodfacts-server/api/ servers: - - description: dev - url: 'https://world.openfoodfacts.net' - - url: 'https://world.openfoodfacts.org' - description: prod +- description: dev + url: https://world.openfoodfacts.net +- url: https://world.openfoodfacts.org + description: prod paths: - '/api/v2/product/{barcode}': + /api/v2/product/{barcode}: get: tags: - - Read Requests + - Read Requests summary: Get information for a specific product by barcode parameters: - - name: barcode - in: path - description: | - The barcode of the product to be fetched - required: true - style: simple - explode: false - schema: - type: string - example: '3017620422003' + - name: barcode + in: path + description: 'The barcode of the product to be fetched + + ' + required: true + style: simple + explode: false + schema: + type: string + example: '3017620422003' responses: '200': description: OK content: application/json: schema: - x-stoplight: - id: cfk5obotr63sa - type: object - allOf: - - type: object - x-stoplight: - id: s4gz59htj4gc3 - properties: - code: - type: string - description: > - Barcode of the product - - (can be EAN-13 or internal codes for some food - stores). - - For products without a barcode, Open Food Facts - assigns a - - number starting with the 200 reserved prefix. - status: - type: integer - status_verbose: - type: string - - type: object - properties: - product: - type: object - allOf: - - type: object - description: > - This is all the fields describing a product and - how to display it on a page. - - - Refer to the different sub schema for more - readable entries: - - - * [Product Base](#cmp--schemas-product-base): Base - fields of a product - - * [Product Misc](#cmp--schemas-product-misc): - Miscellaneous but important fields of a product - - * [Product Tags](#cmp--schemas-product-tags): Tags - fields on a product - - * [Product - Nutrition](#cmp--schemas-product-nutrition): - Nutrition fields of a product - - * [Product - Ingredients](#cmp--schemas-product-ingredients): - Fields about ingredients of a product - - * [Product Images](#cmp--schemas-product-images): - Information about Images of a product - - * [Product - Eco-Score](#cmp--schemas-product-images): Fields - related to Eco-Score for a product - - * [Product - Metadata](#cmp--schemas-product-ecoscore): - Metadata of a product (author, editors, etc.) - - * [Product Data - Quality](#cmp--schemas-product-quality): fields - related to data quality for a product - - * [Product Knowledge - Panels](#cmp--schemas-product-knowledge-panels): - Knowledge panels for a product - - * [Product Attribute - Groups](#cmp--schemas-product-attribute-groups): - Attribute groups for personal product matching - allOf: - - type: object - description: | - Base product data - properties: - abbreviated_product_name: - type: string - description: Abbreviated name in requested language - code: - type: string - description: > - barcode of the product (can be EAN-13 or - internal codes for some food stores), - - for products without a barcode, - - Open Food Facts assigns a number starting - with the 200 reserved prefix - codes_tags: - type: array - items: - type: string - description: > - A value which is the type of barcode - "code-13" or "code-8" - - and - - A series of mask for the barcode - - It helps retrieve barcodes starting by - example: > - ["code-13","3017620422xxx","301762042xxxx","30176204xxxxx","3017620xxxxxx","301762xxxxxxx","30176xxxxxxxx","3017xxxxxxxxx","301xxxxxxxxxx","30xxxxxxxxxxx","3xxxxxxxxxxxx"] - generic_name: - type: string - description: | - Legal name of the product as regulated - by the European authorities. - id: - description: > - internal identifier for the product, - usually set to the value of `code`, - - except on the producers platform where it - is prefixed by the owner - type: string - lc: - type: string - description: > - Main language of the product. - - This is a duplicate of `lang` property - (for historical reasons). - lang: - type: string - description: > - Main language of the product. - - - This should be the main language of - product packaging (if one is predominant). - - - Main language is also used to decide which - ingredients list to parse. - nova_group: - type: integer - description: > - Nova group as an integer from 1 to 4. See - https://world.openfoodfacts.org/nova - nova_groups: - type: string - obsolete: - type: string - obsolete_since_date: - description: > - A date at which the product was declared - obsolete. - - This means it's not produced any more. - type: string - product_name: - type: string - description: | - The name of the product - product_name_en: - type: string - description: | - The name of the product can also - be in many other languages like - product_name_fr (for French). - product_quantity: - type: string - description: > - The size in g or ml for the whole product. - - It's a normalized version of the quantity - field. - example: '500' - product_quantity_unit: - type: string - description: > - The unit (either g or ml) for the - correponding product_quantity. - example: g - quantity: - type: string - description: | - Quantity and Unit. - patternProperties: - abbreviated_product_name_(?\w\w): - type: string - description: >- - Abbreviated name in language - `language_code`. - generic_name_(?\w\w): - type: string - description: > - This can be returned in many other - languages - - like generic_name_fr (for French). - - type: object - description: > - Miscellaneous but important fields of a - product - properties: - additives_n: - type: integer - description: | - Number of food additives. - checked: - type: string - complete: - type: integer - completeness: - type: number - ecoscore_grade: - type: string - description: | - See also: `ecoscore_tags` - ecoscore_score: - type: integer - description: | - See also: `ecoscore_tags` - food_groups: - type: string - food_groups_tags: - type: array - items: - type: string - nutrient_levels: - description: > - Traffic light indicators on main nutrients - levels - type: object - properties: - fat: - type: string - enum: - - low - - moderate - - high - salt: - type: string - enum: - - low - - moderate - - high - saturated-fat: - type: string - enum: - - low - - moderate - - high - sugars: - type: string - enum: - - low - - moderate - - high - packaging_text: - type: string - description: > - Recycling instructions as raw text, e.g. - Plastic - - bottle to recycle, Plastic cap to recycle. - - This will get automatically parsed and - - will be used to compute the Eco-Score. - - You can either request it (if it exists) - or - - send it in a specific language. - example: packaging_text_en - packagings: - type: array - x-stoplight: - id: 1cyz4qo9njog7 - title: Packagings (READ) - description: >- - The packagings object is an array of - individual packaging component objects. - - - The Packaging data document explains how - packaging data is structured in Open Food - Facts: - https://openfoodfacts.github.io/openfoodfacts-server/dev/explain-packaging-data/ - - - The shape, material and recycling - properties of each packaging component are - linked to entries in the packaging_shapes, - packaging_materials and - packaging_recycling taxonomies: - - - https://world.openfoodfacts.org/data/taxonomies/packaging_shapes.json - - https://world.openfoodfacts.org/data/taxonomies/packaging_materials.json - - https://world.openfoodfacts.org/data/taxonomies/packaging_recycling.json - - - If the tags_lc field is set, the - properties will include a lc_name field - with the translation in the requested - language. - examples: - - - number_of_units: 6 - shape: - id: 'en:bottle' - lc_name: bouteille - material: - id: 'en:bottle' - lc_name: bouteille - recycling: - id: 'en:bottle' - lc_name: bouteille - quantity_per_unit: 25 cl - quantity_per_unit_value: 25 - quantity_per_unit_unit: cl - weight_specified: 30 - weight_measured: 32 - weight_estimated: 26 - weight: 30 - weight_source_id: specified - items: - description: >- - Each packaging component has different - properties to specify how many there - are, its shape, material etc. - - - The shape, material and recycling - properties are mapped to one entry in - the packaging_shapes, - packaging_materials and - packaging_recycling taxonomies, and the - value of the property is the canonical - name of the taxonomy entry (e.g. - en:bottle). - - - They may contain values that could not - yet get matched to their respective - taxonomy, in which case they will - contain a free text value prefixed with - the language code of this text value - (e.g. "fr:Bouteille sphérique" might - have been entered by a French user to - indicate it is a spherical bottle). - title: Packaging component (READ) - type: object - examples: - - number_of_units: 6 - shape: - id: 'en:bottle' - lc_name: bouteille - material: - id: 'en:bottle' - lc_name: bouteille - recycling: - id: 'en:bottle' - lc_name: bouteille - quantity_per_unit: 25 cl - quantity_per_unit_value: 25 - quantity_per_unit_unit: cl - weight_specified: 30 - weight_measured: 32 - weight_estimated: 26 - weight: 30 - weight_source_id: specified - properties: - number_of_units: - type: integer - description: >- - umber of units of this packaging - component contained in the product (e.g. - 6 for a pack of 6 bottles) - shape: - title: Packaging component shape - x-stoplight: - id: xrj8agza3dwgf - type: object - description: >- - The shape property is canonicalized - using the packaging_shapes taxonomy. - examples: - - id: 'en:bottle' - lc_name: bouteille - properties: - id: - type: string - description: >- - Canonical id of the entry in the - taxonomy. If the value cannot be mapped - to a taxonomy entry, the value will be - the name of the entry in its original - language prefixed by the language 2 - letter code and a colon. - lc_name: - type: string - description: >- - Name of the entry in the language - requested in the tags_lc field of the - request. This field is returned only of - tags_lc is specified. If the translation - is not available, or if the entry does - not exist in the taxonomy, the value - will be the name of the entry in its - original language prefixed by the - language 2 letter code and a colon. - material: - title: Packaging component material - x-stoplight: - id: n6umazgqmwrd5 - type: object - description: >- - The material property is canonicalized - using the packaging_materials taxonomy. - examples: - - id: 'en:bottle' - lc_name: bouteille - properties: - id: - type: string - description: >- - Canonical id of the entry in the - taxonomy. If the value cannot be mapped - to a taxonomy entry, the value will be - the name of the entry in its original - language prefixed by the language 2 - letter code and a colon. - lc_name: - type: string - description: >- - Name of the entry in the language - requested in the tags_lc field of the - request. This field is returned only of - tags_lc is specified. If the translation - is not available, or if the entry does - not exist in the taxonomy, the value - will be the name of the entry in its - original language prefixed by the - language 2 letter code and a colon. - recycling: - title: >- - Packaging component recycling - instruction - x-stoplight: - id: 376tk8e2cmyh2 - type: object - description: >- - The recycling property is canonicalized - using the packaging_recycling taxonomy. - examples: - - id: 'en:bottle' - lc_name: bouteille - properties: - id: - type: string - description: >- - Canonical id of the entry in the - taxonomy. If the value cannot be mapped - to a taxonomy entry, the value will be - the name of the entry in its original - language prefixed by the language 2 - letter code and a colon. - lc_name: - type: string - description: >- - Name of the entry in the language - requested in the tags_lc field of the - request. This field is returned only of - tags_lc is specified. If the translation - is not available, or if the entry does - not exist in the taxonomy, the value - will be the name of the entry in its - original language prefixed by the - language 2 letter code and a colon. - quantity_per_unit: - type: string - description: >- - Quantity (weight or volume) of food - product contained in the packaging - component. (e.g. 75cl for a wine bottle) - quantity_per_unit_value: - type: number - description: Value parsed from the quantity field. - quantity_per_unit_unit: - type: string - description: >- - Unit parsed and normalized from the - quantity field. - weight_specified: - type: number - description: >- - Weight (as specified by the - manufacturer) of one unit of the empty - packaging component (in grams). (e.g. - for a 6 pack of 1.5l water bottles, it - might be 30, the weight in grams of 1 - empty water bottle without its cap which - is a different packaging component). - weight_measured: - type: number - description: >- - Weight (as measured by one or more - users) of one unit of the empty - packaging component (in grams). (e.g. - for a 6 pack of 1.5l water bottles, it - might be 30, the weight in grams of 1 - empty water bottle without its cap which - is a different packaging component). - weight_estimated: - type: number - description: >- - Weight (as estimated from similar - products) of one unit of the empty - packaging component (in grams). (e.g. - for a 6 pack of 1.5l water bottles, it - might be 30, the weight in grams of 1 - empty water bottle without its cap which - is a different packaging component). - weight: - type: number - description: >- - Weight of one unit of the empty - packaging component. - weight_source_id: - type: string - description: >- - Indicates which field was used to - populate the "weight" field. Either - "specified", "measured", or "estimated" - readOnly: true - packagings_complete: - title: packagings_complete - x-stoplight: - id: hxnnsy954q1ey - type: integer - minimum: 0 - maximum: 1 - description: >- - Indicate if the packagings array contains - all the packaging parts of the product. - This field can be set by users when they - enter or verify packaging data. Possible - values are 0 or 1. - pnns_groups_1: - description: > - Category of food according to [French - Nutrition and Health - Program](https://fr.wikipedia.org/wiki/Programme_national_nutrition_sant%C3%A9) - type: string - pnns_groups_1_tags: - type: array - items: - type: string - pnns_groups_2: - description: > - Sub Category of food according to [French - Nutrition and Health - Program](https://fr.wikipedia.org/wiki/Programme_national_nutrition_sant%C3%A9) - type: string - pnns_groups_2_tags: - type: array - items: - type: string - popularity_key: - description: > - An imprecise measurement of popularity - based on Scan statistics. A higher value - means higher popularity. - type: integer - popularity_tags: - description: > - Indicators for the popularity of a - product, like the amount of scans in a - specific year. - type: array - items: - type: string - scans_n: - type: integer - unique_scans_n: - type: integer - serving_quantity: - type: string - description: > - Normalized version of serving_size. - - Note that this is NOT the number of - servings by product. - - (in perl, see - `normalize_serving_size`) - serving_quantity_unit: - type: string - description: > - The unit (either g or ml) for the - correponding serving_quantity. - example: g - serving_size: - type: string - description: > - Serving size text (generally in g or ml). - - We expect a quantity + unit but the user - is free to input any string. - patternProperties: - food_groups_(?\w\w): - type: string - description: see `food_groups` - packaging_text_(?\w\w): - type: string - description: > - Packaging text in language designated by - `language_code` - - type: object - description: > - Data about a product which is represented as - tags - properties: - brands: - type: string - description: List of brands (not taxonomized) - brands_tags: - type: array - items: - type: string - description: 'List of brands (tags, not taxonomized)' - categories: - type: string - categories_hierarchy: - type: array - items: - type: string - categories_lc: - type: string - description: Categories language code - categories_tags: - type: array - items: - type: string - checkers_tags: - type: array - items: - type: string - description: >- - List of checkers (users who checked the - product) tags - cities: - type: string - cities_tags: - type: array - items: - type: object - correctors_tags: - type: array - items: - type: string - countries: - type: string - description: > - List of countries where the product is - sold. - countries_hierarchy: - type: array - items: - type: string - countries_lc: - type: string - description: Countries language code - countries_tags: - type: array - items: - type: string - ecoscore_tags: - description: > - All ecoscore of a product. - - Most of the time it's only one value, - - but it might eventually be more for - products composed of sub-products. - - See also: `ecoscore_score`, - `ecoscore_grade`. - type: array - items: - type: string - emb_codes: - type: string - description: > - Packager code. EMB is the French system of - traceability codes for packager. - example: EMB 2013330 - emb_codes_orig: - type: string - emb_codes_tags: - type: array - items: - type: object - labels: - type: string - labels_hierarchy: - type: array - items: - type: string - labels_lc: - type: string - labels_tags: - type: array - items: - type: string - entry_dates_tags: - description: > - The data as a series of tag: `yyyy-mm-dd`, - `yyyy-mm`, `yyyy` - type: array - items: - type: string - example: - - '2016-03-11' - - 2016-03 - - '2016' - manufacturing_places: - type: string - description: > - Places where the product was manufactured - or transformed. - manufacturing_places_tags: - type: array - items: - type: object - nova_groups_tags: - type: array - items: - type: string - nutrient_levels_tags: - type: array - items: - type: string - - type: object - description: > - Information about Images of a product. - - - Images ensure the reliability of Open Food - Facts data. - - It provides a primary source and proof of all - the structured data. - - You may therefore want to display it along the - structured information. - - - See also tutorials about images: - - * [Getting - images](https://openfoodfacts.github.io/openfoodfacts-server/api/how-to-download-images/) - - * [Uploading - images](https://openfoodfacts.github.io/openfoodfacts-server/api/tutorial-uploading-photo-to-a-product/) - properties: - images: - description: > - This contains properties for all images - contained on the product. - type: object - properties: - '1': - type: object - description: > - This object represent an image that was - uploaded to a product. - - "imgid" is an integer which is a - sequential number unique to each - picture. - properties: - sizes: - type: object - description: > - The available image sizes for the - product (both reduced and full). - - The reduced images are the ones with - numbers as the key( 100, 200 etc) - - while the full images have `full` as the - key. - properties: - full: - description: | - properties of fullsize image - **TODO** explain how to compute name - type: object - properties: - h: - type: integer - example: 400 - description: > - The height of the reduced/full image in - pixels. - w: - type: integer - example: 255 - description: >- - The width of the reduced/full image in - pixels. - patternProperties: - (?100|400): - description: > - properties of thumbnail of size - `image_size`. - - **TODO** explain how to compute name - - - For real type: see description of - property `full`. - - (Put this way because of a [bug in - rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) - type: string - uploaded_t: - type: string - example: '1457680652' - description: > - The time the image was uploaded (as unix - timestamp). - uploader: - type: string - example: openfoodfacts-contributors - description: | - The contributor that uploaded the image. - front: - description: > - property of an image (or part thereof) - selected for a particular role and a - particular language. - type: object - properties: - angle: - type: integer - example: 0 - description: >- - The angle of the image rotation (if it - was rotated). - coordinates_image_size: - type: string - example: full - geometry: - type: string - example: 0x0--1--1 - imgid: - type: string - example: '121' - description: >- - The id of the original/source image that - was selected to edit(rotate, normalize - etc) to produce this new image. - normalize: - type: 'null' - example: null - description: Normalize colors. - rev: - type: string - example: '420' - sizes: - type: object - description: > - The available image sizes for the - product (both reduced and full). - - The reduced images are the ones with - numbers as the key( 100, 200 etc) - - while the full images have `full` as the - key. - properties: - '100': - type: object - properties: - h: - type: integer - example: 400 - description: > - The height of the reduced/full image in - pixels. - w: - type: integer - example: 255 - description: >- - The width of the reduced/full image in - pixels. - '200': - type: object - properties: - h: - type: integer - example: 400 - description: > - The height of the reduced/full image in - pixels. - w: - type: integer - example: 255 - description: >- - The width of the reduced/full image in - pixels. - '400': - type: object - properties: - h: - type: integer - example: 400 - description: > - The height of the reduced/full image in - pixels. - w: - type: integer - example: 255 - description: >- - The width of the reduced/full image in - pixels. - full: - type: object - properties: - h: - type: integer - example: 400 - description: > - The height of the reduced/full image in - pixels. - w: - type: integer - example: 255 - description: >- - The width of the reduced/full image in - pixels. - white_magic: - type: 'null' - example: null - description: > - Photo on white background : Try to - remove the background. - x1: - type: string - example: '-1' - x2: - type: string - example: '-1' - y1: - type: string - example: '-1' - y2: - type: string - example: '-1' - patternProperties: - (?\d+): - description: > - See property `1` to get the real type of - those objects - - (Put this way because of a [bug in - rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) - type: string - (?front|nutrition|ingredients|packaging|other)_(?\w\w): - description: > - See property `front` to get the real - type of those objects - - (Put this way because of a [bug in - rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) - type: string - last_image_dates_tags: - type: array - items: - type: string - last_image_t: - description: >- - timestamp of last image upload (or - update?) - type: integer - selected_images: - type: object - description: > - URL for selected (important) images of the - product. - - - This is very handy if you display the - product to users. - properties: - front: - type: object - description: >- - URLs of thumbnails image of image of - type `image_type` - properties: - display: - description: > - Thumbnail urls of product image (front) - adapted to display on product page - type: object - patternProperties: - (?\w\w): - type: string - description: >- - url of the image for language - `language_code` - small: - description: > - Thumbnail urls of product image (front) - adapted to display on product list page - type: object - patternProperties: - (?\w\w): - type: string - description: >- - url of the image for language - `language_code` - thumb: - description: > - Thumbnail urls of product image (front) - in smallest format - type: object - patternProperties: - (?\w\w): - type: string - description: >- - url of the image for language - `language_code` - patternProperties: - (?front|packaging|ingredients|nutrition|other): - description: > - See property `front` to get the real - type of those objects - - (Put this way because of a [bug in - rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) - type: string - image_small_url: - type: string - image_thumb_url: - type: string - image_url: - type: string - patternProperties: - image(_(?front|packaging|ingredients|nutrition|other))?(_(?small|thumb))?_url: - description: > - the URL of image of type `image_type` in - size `image_size` (or full size if not - given). - - - The `image_type` tells which image the - url correspond to. `image_type` is - `front` if not provided. - - - The image is the one for current - language (affected by `lc` parameter) if - an image exists for this language, the - image in main product language - otherwise. - - - **IMPORTANT:** you should use - `selected_images` field instead of this - one. - type: string - - type: object - description: > - Fields related to Eco-Score for a product. - - - See also: `ecoscore_score`, `ecoscore_grade` - and `ecoscore_tags`. - properties: - ecoscore_data: - type: object - description: > - An object about a lot of details about - data needed for Eco-Score computation - - and complementary data of interest. - properties: - adjustments: - type: object - properties: - origins_of_ingredients: - type: object - properties: - aggregated_origins: - type: array - items: - type: object - properties: - origin: - type: string - percent: - type: integer - epi_score: - type: integer - epi_value: - type: integer - origins_from_origins_field: - type: array - items: - type: string - transportation_scores: - type: object - patternProperties: - (?\w\w): - type: integer - transportation_values: - type: object - patternProperties: - (?\w\w): - type: integer - values: - type: object - patternProperties: - (?\w\w): - type: integer - warning: - type: string - packaging: - type: object - properties: - non_recyclable_and_non_biodegradable_materials: - type: integer - packagings: - type: array - items: - type: object - properties: - ecoscore_material_score: - type: integer - ecoscore_shape_ratio: - type: integer - material: - type: string - shape: - type: string - score: - type: integer - value: - type: integer - warning: - type: string - production_system: - type: object - properties: - labels: - type: array - example: 'vegan, fat free, Kosher' - items: - type: string - value: - type: integer - warning: - type: string - threatened_species: - type: object - properties: - ingredient: - type: string - value: - type: integer - agribalyse: - type: object - properties: - agribalyse_food_code: - type: string - co2_agriculture: - type: number - co2_consumption: - type: integer - co2_distribution: - type: number - co2_packaging: - type: number - co2_processing: - type: number - co2_total: - type: number - co2_transportation: - type: number - code: - type: string - dqr: - type: string - ef_agriculture: - type: number - ef_consumption: - type: integer - ef_distribution: - type: number - ef_packaging: - type: number - ef_processing: - type: number - ef_total: - type: number - ef_transportation: - type: number - is_beverage: - type: integer - name_en: - type: string - description: > - This can be returned in many other - languages - - like name_fr (for french). - score: - type: integer - version: - type: string - grade: - type: string - grades: - type: object - patternProperties: - (?\w\w): - type: string - missing: - type: object - properties: - labels: - type: integer - origins: - type: integer - packagings: - type: integer - missing_data_warning: - type: integer - previous_data: - type: object - properties: - grade: - type: string - score: - type: integer - agribalyse: - type: object - properties: - agribalyse_food_code: - type: string - co2_agriculture: - type: number - co2_consumption: - type: integer - co2_distribution: - type: number - co2_packaging: - type: number - co2_processing: - type: number - co2_total: - type: number - co2_transportation: - type: number - code: - type: string - dqr: - type: string - ef_agriculture: - type: number - ef_consumption: - type: integer - ef_distribution: - type: number - ef_packaging: - type: number - ef_processing: - type: number - ef_total: - type: number - ef_transportation: - type: number - is_beverage: - type: integer - name_en: - type: string - description: > - This can be returned in many other - languages - - like name_fr (for french). - score: - type: integer - version: - type: string - score: - type: integer - scores: - type: object - patternProperties: - (?\w\w): - type: integer - status: - type: string - ecoscore_extended_data_version: - type: string - environment_impact_level: - type: string - environment_impact_level_tags: - type: array - items: - type: object - - type: object - description: Fields about ingredients of a product - properties: - additives_tags: - type: array - items: - type: string - allergens: - type: string - description: comma separated list of allergens - allergens_lc: - type: string - description: language in which `allergens` where input - allergens_hierarchy: - type: array - items: - type: string - allergens_tags: - type: array - items: - type: string - ingredients: - type: array - description: > - This structure gives the different - ingredients and some information about - them, - - like estimate on their quantity. - items: - type: object - properties: - id: - type: string - ingredients: - description: > - Sub ingredients composing this - ingredients. - $ref: '#' - percent: - type: integer - percent_estimate: - type: - - number - percent_max: - type: - - number - percent_min: - type: integer - text: - type: string - vegan: - type: string - vegetarian: - type: string - ingredients_analysis: - type: object - properties: - 'en:palm-oil': - type: array - items: - type: string - 'en:vegan-status-unknown': - type: array - items: - type: string - 'en:vegetarian-status-unknown': - type: array - items: - type: string - ingredients_analysis_tags: - type: array - items: - type: string - ingredients_from_or_that_may_be_from_palm_oil_n: - type: integer - ingredients_from_palm_oil_n: - type: integer - ingredients_from_palm_oil_tags: - type: array - items: - type: object - ingredients_hierarchy: - type: array - items: - type: string - ingredients_n: - type: integer - ingredients_n_tags: - type: array - items: - type: string - ingredients_original_tags: - type: array - items: - type: string - ingredients_percent_analysis: - type: integer - ingredients_sweeteners_n: - type: integer - description: > - Number of sweeteners additives in the - ingredients. Undefined if ingredients are - not specified. - ingredients_non_nutritive_sweeteners_n: - type: integer - description: > - Number of non-nutritive sweeteners - additives (as specified in the Nutri-Score - formula) in the ingredients. Undefined if - ingredients are not specified. - ingredients_tags: - type: array - items: - type: string - ingredients_lc: - type: string - description: > - Language that was used to parse the - ingredient list. If `ingredients_text` is - available - - for the product main language (`lang`), - `ingredients_lc=lang`, otherwise we look - at - - `ingredients_text` fields for other - languages and set `ingredients_lc` to the - first - - non-empty `ingredient_text`. - ingredients_text: - type: string - description: > - Raw list of ingredients. This will get - automatically - - parsed and get used to compute the - Eco-Score or find allergens, etc.. - - - It's a copy of ingredients_text in the - main language of the product (see `lang` - proprety). - example: > - Farine de blé* 67,4%, sucre de canne*, - huile de tournesol oléique*, graines de - chia* 5,2%, son de blé*, oranges - déshydratées * 0,9%, farine de riz*, - poudres à lever (acide citrique, - carbonates de sodium), arôme naturel - d'orange. - ingredients_text_with_allergens: - type: string - description: > - Same text as `ingredients_text` but where - allergens have HTML elements around them - to identify them - example: > - Farine de blé* 67,4%, sucre - de canne*, huile de tournesol oléique*, - graines de chia* 5,2%, son de blé*, - oranges déshydratées * 0,9%, farine de - riz*, poudres à lever (acide citrique, - carbonates de sodium), arôme naturel - d'orange. - ingredients_that_may_be_from_palm_oil_n: - type: integer - ingredients_that_may_be_from_palm_oil_tags: - type: array - items: - type: object - ingredients_with_specified_percent_n: - type: integer - ingredients_with_specified_percent_sum: - type: integer - ingredients_with_unspecified_percent_n: - type: integer - ingredients_with_unspecified_percent_sum: - type: integer - known_ingredients_n: - type: integer - origins: - type: string - description: | - Origins of ingredients - origins_hierarchy: - type: array - items: - type: object - origins_lc: - type: string - origins_tags: - type: array - items: - type: object - traces: - type: string - description: > - List of substances that might cause - allergies - - that are present in trace amounts in the - product - - (this does not include the ingredients, as - they - - are not only present in trace amounts). - - It is taxonomized with the allergens - taxonomy. - traces_hierarchy: - type: array - items: - type: object - traces_lc: - type: string - traces_tags: - type: array - items: - type: object - unknown_ingredients_n: - type: integer - patternProperties: - ingredients_text_(?\w\w): - type: string - description: > - Raw list of ingredients in language given - by 'language_code'. - - - See `ingredients_text` - ingredients_text_with_allergens_(?\w\w): - description: > - Like `ingredients_text_with_allergens` for - a particular language - type: string - - type: object - description: > - Nutrition fields of a product - - - Most of these properties are read-only. - - - See [how to add nutrition - data](https://openfoodfacts.github.io/openfoodfacts-server/api/ref-cheatsheet/#add-nutrition-facts-values-units-and-base) - properties: - no_nutrition_data: - type: string - description: > - When a product does not have nutrition - data displayed on the - - packaging, the user can check the field - "Nutrition facts are - - not specified on the product". - - By doing so, the no_nutrition_data field - takes the value "on". - - This case is frequent (thousands of - products). - example: 'on' - nutrition_data_per: - type: string - enum: - - serving - - 100g - description: > - The nutrition data on the package can be - per serving or per 100g. - - - This is essential to understand if - `_value` and `` - - values in `nutriments` applies for a - serving or for 100g. - - - **IMPORTANT:** - - When writing products, - - this setting applies to all existing - nutrients values for the product, - - not only the nutrient values sent in the - write request. - - So it should not be changed unless all - nutrients values are provided - - with values that match the - nutrition_data_per field. - nutrition_data_prepared_per: - type: string - enum: - - serving - - 100g - description: > - The nutrition data for prepared product on - the package (if any) can be per serving or - per 100g. - - - This is essential to understand if - `_prepared_value` and - `_prepared` - - values in `nutriments` applies for a - serving or for 100g. - - - See also important note on - `nutrition_data_per`. - nutriments: - type: object - description: > - All known nutrients for the product. - - - Note that each nutrients are declined with - a variety of suffixes like `_100g`, - `_serving`, - - see patternProperties below. - - - A specific `_unit` is the unit used to - measure the nutrient. - - - Beware that some properties are to be - interpreted based upon - `nutrition_data_per` value. - - - Also for products that have a nutrition - table for prepared product - - (eg. the nutrition facts for a bowl of - milk with cocoa powder), - - a `_prepared` suffix is added (before - other suffixes). - - - You can get all possible nutrients from - the - - [nutrients - taxonomy](https://static.openfoodfacts.org/data/taxonomies/nutrients.json) - - - **FIXME** add more nutrients with - description. - properties: - alcohol: - description: > - Quantity of alcohol - - - (per 100g or per serving) in a standard - unit (g or ml) - type: number - carbohydrates: - type: number - energy: - type: number - description: > - It is the same as `energy-kj` if we have - it, or computed from `energy-kcal` - otherwise - - - (per 100g or per serving) in kj - energy_value: - type: number - description: > - energy_value will be equal to - energy-kj_value if we have it or to - energy-kcal_value otherwise - energy_unit: - type: string - enum: - - kcal - - kj - description: > - Equal to energy-kj_unit if we have it or - to energy-kcal_unit otherwise - energy-kcal: - type: number - description: > - energy in kcal, if it is specified - - - (per 100g or per serving) in a standard - unit (g or ml) - energy-kj: - type: number - description: > - energy in kj, if it is specified - - - (per 100g or per serving) in a standard - unit (g or ml) - fat: - type: number - fruits-vegetables-legumes-estimate-from-ingredients: - type: number - description: > - An estimate, from the ingredients list - of the percentage of fruits, vegetable - and legumes. - - This is an important information for - Nutri-Score (2023 version) computation. - fruits-vegetables-nuts-estimate-from-ingredients: - type: number - description: > - An estimate, from the ingredients list - of the percentage of fruits, vegetable - and nuts. - - This is an important information for - Nutri-Score (2021 version) computation. - nova-group: - type: integer - nutrition-score-fr: - description: > - Experimental nutrition score derived - from - - the UK FSA score and adapted for the - French market - - (formula defined by the team of - Professor Hercberg). - proteins: - type: number - salt: - type: number - saturated-fat: - type: number - sodium: - type: number - sugars: - type: number - carbon-footprint-from-known-ingredients_product: - type: integer - carbon-footprint-from-known-ingredients_serving: - type: number - erythritol: - type: number - description: > - erythritol is a polyol which is not - providing any energy. - - As such, it needs not be taken into - account when computing - - the energy of a product. Eryhtritol is - now displayed on - - nutrition facts sheet of some products, - mainly in the USA. - - This value is entered either by - contributors, either by - - imports. - example: 12.5 - patternProperties: - '(?[\w-]+)_unit': - description: "The unit in which the nutrient for 100g or per serving is measured.\n\nThe possible values depends on the nutrient.\n\n* `g` for grams\n* `mg` for milligrams\n* `μg` for micrograms\n* `cl` for centiliters\n* `ml` for mililiters\n* `dv` for recommended daily intakes (aka [Dietary Reference Intake](https://en.wikipedia.org/wiki/Dietary_Reference_Intake))\n* `% vol` for alcohol vol per 100 ml\n\n\U0001F913 code: see the [Units module][units-module],\nand [Food:default_unit_for_nid function][default-unit]\n\n[units-module]: https://openfoodfacts.github.io/openfoodfacts-server/dev/ref-perl-pod/ProductOpener/Units.html\n[default-unit]: https://openfoodfacts.github.io/openfoodfacts-server/dev/ref-perl-pod/ProductOpener/Food.html#default_unit_for_nid_(_%24nid)\n" - type: string - enum: - - 公斤 - - 公升 - - kg - - кг - - l - - л - - 毫克 - - mg - - мг - - mcg - - µg - - oz - - fl oz - - dl - - дл - - cl - - кл - - 斤 - - g - - '' - - ' ' - - kj - - 克 - - 公克 - - г - - мл - - ml - - mmol/l - - 毫升 - - '% vol' - - ph - - '%' - - '% dv' - - '% vol (alcohol)' - - iu - - mol/l - - mval/l - - ppm - - �rh - - �fh - - �e - - �dh - - gpg - '(?[\w-]+)_100g': - description: > - The standardized value of a serving of - 100g (or 100ml for liquids) - - for the nutrient. - - - This is computed from the `nutrient` - property, - - the serving size (if needed), and the - `nutrient`_unit field. - - - **Note**: - - If you want to characterize products in - a uniform way, this is the value you - should use. - type: number - readOnly: true - '(?[\w-]+)_serving': - description: > - The standardized value of a serving for - this product. - type: number - readOnly: true - '(?[\w-]+)_value': - description: > - The value input by the user / displayed - on the product for the nutrient. - - - * per 100g or serving, depending on - `nutrition_data_per` - - * in the unit of corresponding - _unit field. - type: number - readOnly: true - '(?[\w-]+)_prepared': - description: > - The value for nutrient for **prepared** - product. - type: number - '(?[\w-]+)_prepared_unit': - description: > - The unit in which the nutrient of - **prepared** product is measured. - type: string - '(?[\w-]+)_prepared_100g': - description: > - The standardized value of a serving of - 100g (or 100ml for liquids) - - for the nutrient, for **prepared** - product. - type: number - readOnly: true - '(?[\w-]+)_prepared_serving': - description: > - The standardized value of a serving for - the **prepared** product. - type: number - readOnly: true - '(?[\w-]+)_prepared_value': - description: > - The standardized value for a serving or - 100g (or 100ml for liquids), - - depending on - `nutrition_data_prepared_per` - - for the nutrient for **prepared** - product. - type: number - readOnly: true - nutriscore_data: - description: > - Detail of data the Nutri-Score was - computed upon. - - - **Note**: this might not be stable, don't - rely too much on this, or, at least, tell - us ! - - - **TODO** document each property - type: object - properties: - energy: - type: integer - energy_points: - type: integer - energy_value: - type: integer - fiber: - type: integer - fiber_points: - type: integer - fiber_value: - type: integer - fruits_vegetables_nuts_colza_walnut_olive_oils: - type: integer - fruits_vegetables_nuts_colza_walnut_olive_oils_points: - type: integer - fruits_vegetables_nuts_colza_walnut_olive_oils_value: - type: integer - grade: - type: string - is_beverage: - type: integer - is_cheese: - type: integer - is_fat: - type: integer - is_water: - type: integer - negative_points: - type: integer - positive_points: - type: integer - proteins: - type: number - proteins_points: - type: integer - proteins_value: - type: number - saturated_fat: - type: number - saturated_fat_points: - type: integer - saturated_fat_ratio: - type: number - saturated_fat_ratio_points: - type: integer - saturated_fat_ratio_value: - type: number - saturated_fat_value: - type: number - score: - type: integer - sodium: - type: number - sodium_points: - type: integer - sodium_value: - type: number - sugars: - type: number - sugars_points: - type: integer - sugars_value: - type: number - nutriscore_grade: - description: > - Nutri-Score for the product as a letter. - - - See - https://world.openfoodfacts.org/nutriscore. - type: string - enum: - - a - - b - - c - - d - - e - nutriscore_score: - description: > - Nutri-Score for the product as an integer - (see also `nutriscore_grade`). - type: integer - nutriscore_score_opposite: - type: integer - nutrition_grade_fr: - type: string - description: > - Nutrition grade (‘a’ to ‘e’), - - https://world.openfoodfacts.org/nutriscore. - nutrition_grades: - description: > - Nutrition grades as a comma separated - list. - - - Some products with multiple components - might have multiple Nutri-Score - type: string - nutrition_grades_tags: - type: array - items: - type: string - nutrition_score_beverage: - type: integer - nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients: - type: integer - nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients_value: - type: integer - nutrition_score_warning_no_fiber: - type: integer - other_nutritional_substances_tags: - type: array - items: - type: object - unknown_nutrients_tags: - type: array - items: - type: object - vitamins_tags: - type: array - items: - type: object - - type: object - description: > - This is data that is linked to products data - quality - properties: - data_quality_bugs_tags: - type: array - items: - type: object - data_quality_errors_tags: - type: array - items: - type: object - data_quality_info_tags: - type: array - items: - type: string - data_quality_tags: - type: array - items: - type: string - data_quality_warnings_tags: - type: array - items: - type: string - data_sources: - type: string - description: | - Source of data imported from producers. - data_sources_tags: - type: array - items: - type: string - last_check_dates_tags: - type: array - items: - type: string - last_checked_t: - type: integer - last_checker: - type: string - states: - description: > - comma separated list of values indicating - some states of the product, - - like things to be done, or to be - completed. - - See [states - taxonomy](https://static.openfoodfacts.net/data/taxonomies/states.json) - type: string - states_hierarchy: - type: array - items: - type: string - states_tags: - type: array - items: - description: > - Each state describe something that is - completed or is to be done or improved - on the product. - - - Refer to [states - taxonomy](https://static.openfoodfacts.net/data/taxonomies/states.json) - type: string - misc_tags: - description: > - Information about different aspect of the - product - type: array - items: - type: string - - type: object - properties: - additives_original_tags: - type: array - items: - type: string - additives_prev_original_tags: - type: array - items: - type: string - added_countries_tags: - type: array - items: - type: object - allergens_from_ingredients: - type: string - allergens_from_user: - type: string - amino_acids_prev_tags: - type: array - items: - type: object - amino_acids_tags: - type: array - items: - type: object - carbon_footprint_percent_of_known_ingredients: - type: integer - categories_properties: - type: object - properties: - 'agribalyse_food_code:en': - type: string - 'agribalyse_proxy_food_code:en': - type: string - 'ciqual_food_code:en': - type: string - categories_properties_tags: - type: array - items: - type: string - category_properties: - type: object - additionalProperties: - description: >- - those are properties taken from the - category taxonomy - type: string - ciqual_food_name_tags: - type: array - items: - type: string - compared_to_category: - type: string - description: | - the category to use for comparison. - - **TODO** explain how it is chosen. - conservation_conditions: - type: string - customer_service: - type: string - description: | - Contact info of customer service. - expiration_date: - type: string - link: - type: string - description: > - link to the product on the website of the - producer - main_countries_tags: - type: array - items: - type: object - minerals_prev_tags: - type: array - items: - type: object - minerals_tags: - type: array - items: - type: object - owner_fields: - type: object - description: > - Those are fields provided by the producer - (through producers platform), - - and the value he provided. - properties: - additionalProperties: - description: > - you can retrieve all kind of properties, - the same as on the parent object (the - product). - - It's not processed entries (like tags - for example) but raw ones. - oneOf: - - type: integer - - type: string - - type: object - nova_groups_markers: - type: object - description: > - Detail of ingredients or processing that - makes the products having Nova 3 or 4 - properties: - '3': - description: | - Markers of level 3 - type: array - items: - type: array - description: > - This array has two element for each - marker. - - One - items: - type: string - '4': - description: | - Markers of level 4 - type: array - items: - $ref: >- - #/properties/nova_groups_markers/properties/3/items - nucleotides_tags: - type: array - items: - type: object - origin: - type: string - purchase_places: - type: string - description: > - Country, state, or city where the product - can be purchased. - example: Paris - purchase_places_tags: - type: array - items: - type: string - stores: - type: string - description: | - Distributor name. - example: Walmart - stores_tags: - type: array - items: - type: string - traces_from_ingredients: - type: string - traces_from_user: - type: string - patternProperties: - conservation_conditions_(?\w\w): - type: string - customer_service_(?\w\w): - type: string - origin_(?\w\w): - type: string - description: > - `origin` in language indicated by - `language_code` - - type: object - description: > - Metadata of a product (author, editors, - creation date, etc.) - properties: - created_t: - type: integer - description: > - Date when the product was added (UNIX - timestamp format). - - See also `entry_dates_tags` - example: | - 1457680652 - creator: - type: string - description: > - The contributor who added the product - first. - editors_tags: - description: | - List of editors who edited the product. - type: array - items: - type: string - informers_tags: - type: array - items: - type: string - interface_version_created: - type: string - interface_version_modified: - type: string - languages: - type: object - patternProperties: - 'en:(?\w\w)': - type: integer - description: | - **TODO** explain ! - languages_codes: - type: object - patternProperties: - (?\w\w): - type: integer - description: > - Same as `languages` but by language code, - instead of language tags - languages_hierarchy: - type: array - items: - type: string - languages_tags: - type: array - items: - type: string - last_edit_dates_tags: - type: array - items: - type: string - last_editor: - type: string - last_modified_by: - type: string - description: > - The username of the user who last modified - the product. - example: sebleouf - last_modified_t: - type: integer - description: > - Date when the product page was last - modified. - owner: - description: > - Id of the producer in case he provides his - own data about a product (producer - platform). - type: string - owners_tags: - description: | - Tagyfied version of owner - type: string - photographers_tags: - type: array - items: - type: string - rev: - description: >- - revision number of this product version - (each edit adds a revision) - type: integer - sources: - type: array - items: - type: object - properties: - fields: - type: array - items: - type: string - id: - type: string - images: - type: array - items: - type: object - import_t: - type: integer - manufacturer: - type: - - integer - - string - name: - type: string - source_licence: - type: string - source_licence_url: - type: string - url: - type: - - 'null' - - string - sources_fields: - type: object - properties: - org-gs1: - type: object - properties: - gln: - type: string - gpcCategoryCode: - type: string - gpcCategoryName: - type: string - isAllergenRelevantDataProvided: - type: string - lastChangeDateTime: - type: string - partyName: - type: string - productionVariantDescription: - type: string - publicationDateTime: - type: string - teams: - type: string - teams_tags: - type: array - items: - type: string - update_key: - type: string - - type: object - description: | - Knowledge panels for a product - properties: - knowledge_panels: - type: object - x-stoplight: - id: bcq3fkbtnwr5t - title: panels - description: >- - The panels object is a dictionary of - individual panel objects. - - Each key of the dictionary is the id of - the panel, and the value is the panel - object. - - - Apps typically display a number of root - panels with known panel ids (e.g. - health_card and environment_card). Panels - can reference other panels and display - them as sub-panels. - examples: - - additionalProperties: string - properties: - additionalProperties: - title: panel - x-stoplight: - id: mj9nhz3mqn05c - type: object - description: >- - Each panel contains an optional title - and an optional array of elements. - properties: - type: - type: string - description: >- - Type of the panel. If set to "card", the - panel and its sub-panels should be - displayed in a card. If set to "inline", - the panel should have its content always - displayed. - expanded: - type: boolean - description: >- - If true, the panel is to be displayed - already expanded. If false, only the - title should be displayed, and the user - should be able to click or tap it to - open the panel and display the elements. - expand_for: - type: string - description: >- - If set to "large", the content of the - panel should be expanded on large - screens, but it should still be possible - to unexpand it. - evaluation: - type: string - description: >- - A simple assessment of the panel value, - typically used to format fonts, et.c - e.g. bad = red - enum: - - good - - average - - neutral - - bad - - unknown - title_element: - title: title_element - x-stoplight: - id: lox0wvl9bdgy2 - type: object - description: The title of a panel. - properties: - name: - type: string - description: >- - A short name of this panel, not - including any actual values - title: - type: string - type: - type: string - enum: - - grade - - percentage - description: >- - Used to indicate how the value of this - item is measured, such as "grade" for - Nutri-Score and Eco-Score or - "percentage" for Salt - grade: - type: string - description: >- - The value for this panel where it - corresponds to a A to E grade such as - the Nutri-Score of the Eco-Score. - enum: - - a - - b - - c - - d - - e - - unknown - value: - type: number - description: >- - The numeric value of the panel, where - the type is "percentage" - icon_url: - type: string - icon_color_from_evaluation: - type: string - icon_size: - type: string - description: > - If set to "small", the icon should be - displayed at a small size. - elements: - type: array - description: >- - An ordered list of elements to display - in the content of the panel. - items: - title: element - x-stoplight: - id: e2ybdrtmx0tme - type: object - description: > - Each element object contains one - specific element object such as a text - element or an image element. - properties: - type: - element_type: string - enum: - - text - - image - - action - - panel - - panel_group - - table - description: > - The type of the included element object. - - The type also indicates which field - contains the included element object. - - e.g. if the type is "text", the included - element object will be in the - "text_element" field. - - - Note that in the future, new type of - element may be added, - - so your code should ignore unrecognized - types, and unknown properties. - - - TODO: add Map type - text_element: - title: text_element - x-stoplight: - id: vdwxlt73qnqfa - type: object - description: >- - A text in simple HTML format to display. - - - For some specific texts that correspond - to a product field (e.g. a product name, - the ingredients list of a product),the - edit_field_* fields are used to indicate - how to edit the field value. - properties: - type: - type: string - description: > - the type of text, might influence the - way you display it. - enum: - - summary - - warning - - notes - html: - type: string - description: Text to display in HTML format. - language: - type: string - description: >- - Language of the text. The name of the - language is returned in the language - requested when making the API call. e.g. - if the text is in Polish, and the - requested language is French, the - language field will contain "Polonais" - (French for "Polish"). Only set for - specific fields such as the list of - ingredients of a product. - lc: - type: string - description: >- - 2 letter language code for the text. - Only set for specific fields such as the - list of ingredients of a product. - edit_field_id: - type: string - description: >- - id of the field used to edit this text - in the product edit API. - edit_field_type: - type: string - description: Type of the product field. - edit_field_value: - type: string - description: >- - Current value of the product field. This - may differ from the html field which can - contain extra formating. - source_url: - type: string - description: Link to the source - example: >- - https://en.wikipedia.org/wiki/Sodium - acetate - source_text: - type: string - description: name of the source - example: Wikipedia - source_lc: - type: string - description: Source locale name - example: en - source_language: - type: string - description: Human readable source locale name - example: English - image_element: - title: image_element - x-stoplight: - id: k4v4kwt489q3j - type: object - properties: - url: - type: string - description: full URL of the image - width: - type: integer - description: > - Width of the image. - - - This is just a suggestion coming from - the server, - - the client may choose to use its own - dimensions for the image. - height: - type: integer - description: > - Height of the image. - - - This is just a suggestion coming from - the server, - - the client may choose to use its own - dimensions for the image. - alt_text: - type: string - description: Alt Text of the image. - action_element: - type: string - panel_element: - title: panel_element - x-stoplight: - id: ymx41elz4yrnj - type: object - description: >- - Panels can include other panels as - sub-panels using the panel_element. - properties: - panel_id: - type: string - description: >- - The id of the panel to include. The id - is the key of the panel in the panels - object returned in the knowledge_panels - field. - panel_group_element: - title: panel_group_element - x-stoplight: - id: b7emlfrgiuue2 - type: object - properties: - title: - type: string - panel_ids: - type: array - description: >- - The ids of the panels to include. The - ids are the keys of the panels in the - panels object returned in the - knowledge_panels field. - items: - type: string - description: >- - The panel group element is used to - display an optional title followed by a - number of sub-panels. - table_element: - title: table_element - x-stoplight: - id: 38zu3z4sruqo7 - type: object - description: Element to display a table. - properties: - id: - type: string - description: An id for the table. - title: - type: string - description: | - Title of the column. - rows: - type: string - columns: - type: array - items: - type: object - properties: - type: - type: string - text: - type: string - text_for_small_screens: - type: string - style: - type: string - column_group_id: - type: string - shown_by_default: - type: boolean - required: - - type - level: - type: string - description: > - a message level, as levels we use in - log. - - It might help theming the panel visualy - example: info - size: - type: string - enum: - - small - description: > - size is either empty (normal display) - - or small to indicate a panel that should - have a smaller font size - example: small - topics: - type: array - items: - type: string - example: health - readOnly: true - - type: object - description: > - Specific data about a product to enable - personal ranking - properties: - attribute_groups: - type: array - description: >- - Each element is an attribute that can help - compute a personal ranking for the product - items: - type: object - properties: - id: - type: string - description: > - Unique id of the attribute. - - - It will be use to match against - preferences parameters. - status: - type: string - enum: - - known - - unknown - description: >- - wether we have the information to really - compute this criteria or not. - title: - type: string - description: > - A descriptive sentence about the - situation of the product concerning - attribute - example: 'Does not contain: Molluscs' - match: - type: number - format: float - minimum: 0 - maximum: 100 - description: > - a numeric value for the match, - - telling how much the products ranks well - for this particular attribute. - - The higher the value, the better the - match. - grade: - description: every attribute as a grade for a to e - type: string - enum: - - unknown - - a - - b - - c - - d - - e - name: - type: string - description: >- - The name of attribute, for eventual - display - icon_url: - type: string - description: >- - an icon representing the attribute match - (often using a color) - description: - type: string - description: >- - An eventual description of the value of - the property upon which this attribute - is based - description_short: - type: string - description: >- - An eventual short description of the - value of the property upon which this - attribute is based + $ref: '#/components/schemas/get_product_by_barcode' examples: spread-example: summary: retrieved values for a well known chocolate and nut spread @@ -2970,197 +61,183 @@ paths: product: _id: '3017620422003' _keywords: - - et - - pate - - cacao - - produit - - ferrero - - gluten - - petit-dejeuner - - san - - au - - aux - - sucre - - nutella + - et + - pate + - cacao + - produit + - ferrero + - gluten + - petit-dejeuner + - san + - au + - aux + - sucre + - nutella abbreviated_product_name: Nutella t.400 abbreviated_product_name_fr: Nutella t.400 added_countries_tags: [] additives_n: 1 additives_original_tags: - - 'en:e322' + - en:e322 additives_prev_original_tags: - - 'en:e322' + - en:e322 additives_tags: - - 'en:e322' - allergens: 'en:milk,en:nuts,en:soybeans' - allergens_from_ingredients: 'en:nuts, hazelnuts' - allergens_from_user: '(fr) en:milk,en:nuts,en:soybeans' + - en:e322 + allergens: en:milk,en:nuts,en:soybeans + allergens_from_ingredients: en:nuts, hazelnuts + allergens_from_user: (fr) en:milk,en:nuts,en:soybeans allergens_hierarchy: - - 'en:milk' - - 'en:nuts' - - 'en:soybeans' + - en:milk + - en:nuts + - en:soybeans allergens_lc: fr allergens_tags: - - 'en:milk' - - 'en:nuts' - - 'en:soybeans' + - en:milk + - en:nuts + - en:soybeans amino_acids_prev_tags: [] amino_acids_tags: [] brands: Ferrero brands_tags: - - ferrero + - ferrero carbon_footprint_percent_of_known_ingredients: 13 - categories: >- - Produits à tartiner,Petit-déjeuners,Produits à tartiner - sucrés,Pâtes à tartiner,Pâtes à tartiner aux - noisettes,Pâtes à tartiner aux noisettes et au cacao + categories: "Produits \xE0 tartiner,Petit-d\xE9jeuners,Produits\ + \ \xE0 tartiner sucr\xE9s,P\xE2tes \xE0 tartiner,P\xE2tes\ + \ \xE0 tartiner aux noisettes,P\xE2tes \xE0 tartiner aux noisettes\ + \ et au cacao" categories_hierarchy: - - 'en:breakfasts' - - 'en:spreads' - - 'en:sweet-spreads' - - 'en:hazelnut-spreads' - - 'en:chocolate-spreads' - - 'en:cocoa-and-hazelnuts-spreads' + - en:breakfasts + - en:spreads + - en:sweet-spreads + - en:hazelnut-spreads + - en:chocolate-spreads + - en:cocoa-and-hazelnuts-spreads categories_lc: fr categories_properties: - 'agribalyse_food_code:en': '31032' - 'agribalyse_proxy_food_code:en': '31032' - 'ciqual_food_code:en': '31032' + agribalyse_food_code:en: '31032' + agribalyse_proxy_food_code:en: '31032' + ciqual_food_code:en: '31032' categories_properties_tags: - - all-products - - categories-known - - agribalyse-food-code-31032 - - agribalyse-food-code-known - - agribalyse-proxy-food-code-31032 - - agribalyse-proxy-food-code-known - - ciqual-food-code-31032 - - ciqual-food-code-known - - agribalyse-known - - agribalyse-31032 + - all-products + - categories-known + - agribalyse-food-code-31032 + - agribalyse-food-code-known + - agribalyse-proxy-food-code-31032 + - agribalyse-proxy-food-code-known + - ciqual-food-code-31032 + - ciqual-food-code-known + - agribalyse-known + - agribalyse-31032 categories_tags: - - 'en:breakfasts' - - 'en:spreads' - - 'en:sweet-spreads' - - 'fr:pates-a-tartiner' - - 'en:hazelnut-spreads' - - 'en:chocolate-spreads' - - 'en:cocoa-and-hazelnuts-spreads' + - en:breakfasts + - en:spreads + - en:sweet-spreads + - fr:pates-a-tartiner + - en:hazelnut-spreads + - en:chocolate-spreads + - en:cocoa-and-hazelnuts-spreads category_properties: - 'ciqual_food_name:en': Chocolate spread with hazelnuts + ciqual_food_name:en: Chocolate spread with hazelnuts checked: 'on' checkers_tags: - - moon-rabbit + - moon-rabbit ciqual_food_name_tags: - - chocolate-spread-with-hazelnuts + - chocolate-spread-with-hazelnuts cities_tags: [] code: '3017620422003' codes_tags: - - code-13 - - 3017620422xxx - - 301762042xxxx - - 30176204xxxxx - - 3017620xxxxxx - - 301762xxxxxxx - - 30176xxxxxxxx - - 3017xxxxxxxxx - - 301xxxxxxxxxx - - 30xxxxxxxxxxx - - 3xxxxxxxxxxxx - compared_to_category: 'en:cocoa-and-hazelnuts-spreads' + - code-13 + - 3017620422xxx + - 301762042xxxx + - 30176204xxxxx + - 3017620xxxxxx + - 301762xxxxxxx + - 30176xxxxxxxx + - 3017xxxxxxxxx + - 301xxxxxxxxxx + - 30xxxxxxxxxxx + - 3xxxxxxxxxxxx + compared_to_category: en:cocoa-and-hazelnuts-spreads complete: 0 completeness: 0.875 - conservation_conditions: >- - A conserver au sec et à l'abri de la chaleur. Ne pas - mettre au réfrigérateur. - conservation_conditions_fr: >- - A conserver au sec et à l'abri de la chaleur. Ne pas - mettre au réfrigérateur. + conservation_conditions: "A conserver au sec et \xE0 l'abri\ + \ de la chaleur. Ne pas mettre au r\xE9frig\xE9rateur." + conservation_conditions_fr: "A conserver au sec et \xE0 l'abri\ + \ de la chaleur. Ne pas mettre au r\xE9frig\xE9rateur." correctors_tags: - - user1 - - user2 - - user3 - - user4 - countries: >- - en:Algeria Austria Belgium Canada France Germany - Italy Luxembourg Mexico Morocco Netherlands - Portugal Senegal Spain Switzerland Tunisia United + - user1 + - user2 + - user3 + - user4 + countries: en:Algeria Austria Belgium Canada France Germany Italy Luxembourg Mexico Morocco Netherlands Portugal Senegal Spain Switzerland Tunisia United Kingdom United States - countries_beforescanbot: 'Belgium,France' + countries_beforescanbot: Belgium,France countries_hierarchy: - - >- - en:Algeria Austria Belgium Canada France Germany - Italy Luxembourg Mexico Morocco Netherlands - Portugal Senegal Spain Switzerland Tunisia United - Kingdom United States + - en:Algeria Austria Belgium Canada France Germany Italy Luxembourg Mexico Morocco Netherlands Portugal Senegal Spain Switzerland Tunisia United + Kingdom United States countries_lc: fr countries_tags: - - >- - en:algeria-austria-belgium-canada-france-germany-italy-luxembourg-mexico-morocco-netherlands-portugal-senegal-spain-switzerland-tunisia-united-kingdom-united-states + - en:algeria-austria-belgium-canada-france-germany-italy-luxembourg-mexico-morocco-netherlands-portugal-senegal-spain-switzerland-tunisia-united-kingdom-united-states created_t: 1457680652 creator: openfoodfacts-contributors - customer_service: >- - FERRERO FRANCE COMMERCIALE - Service Consommateurs, CS - 90058 - 76136 MONT SAINT AIGNAN Cedex - customer_service_fr: >- - FERRERO FRANCE COMMERCIALE - Service Consommateurs, CS - 90058 - 76136 MONT SAINT AIGNAN Cedex + customer_service: FERRERO FRANCE COMMERCIALE - Service Consommateurs, + CS 90058 - 76136 MONT SAINT AIGNAN Cedex + customer_service_fr: FERRERO FRANCE COMMERCIALE - Service Consommateurs, + CS 90058 - 76136 MONT SAINT AIGNAN Cedex data_quality_bugs_tags: [] data_quality_errors_tags: [] data_quality_info_tags: - - 'en:packaging-data-incomplete' - - 'en:ingredients-percent-analysis-ok' - - 'en:ecoscore-extended-data-computed' - - 'en:ecoscore-extended-data-less-precise-than-agribalyse' - - 'en:food-groups-1-known' - - 'en:food-groups-2-known' - - 'en:food-groups-3-unknown' + - en:packaging-data-incomplete + - en:ingredients-percent-analysis-ok + - en:ecoscore-extended-data-computed + - en:ecoscore-extended-data-less-precise-than-agribalyse + - en:food-groups-1-known + - en:food-groups-2-known + - en:food-groups-3-unknown data_quality_tags: - - 'en:packaging-data-incomplete' - - 'en:ingredients-percent-analysis-ok' - - 'en:ecoscore-extended-data-computed' - - 'en:ecoscore-extended-data-less-precise-than-agribalyse' - - 'en:food-groups-1-known' - - 'en:food-groups-2-known' - - 'en:food-groups-3-unknown' - - >- - en:ecoscore-origins-of-ingredients-origins-are-100-percent-unknown - - 'en:ecoscore-packaging-unspecified-shape' - - 'en:ecoscore-production-system-no-label' + - en:packaging-data-incomplete + - en:ingredients-percent-analysis-ok + - en:ecoscore-extended-data-computed + - en:ecoscore-extended-data-less-precise-than-agribalyse + - en:food-groups-1-known + - en:food-groups-2-known + - en:food-groups-3-unknown + - en:ecoscore-origins-of-ingredients-origins-are-100-percent-unknown + - en:ecoscore-packaging-unspecified-shape + - en:ecoscore-production-system-no-label data_quality_warnings_tags: - - >- - en:ecoscore-origins-of-ingredients-origins-are-100-percent-unknown - - 'en:ecoscore-packaging-unspecified-shape' - - 'en:ecoscore-production-system-no-label' - data_sources: >- - Database - FoodRepo / openfood.ch, Databases, Producer - - Ferrero, Producers, App - yuka, Apps, Producer - - ferrero-france-commerciale, Database - Equadis, Database - - GDSN, App - InFood, App - Open Food Facts, App - - halal-healthy, App - smoothie-openfoodfacts + - en:ecoscore-origins-of-ingredients-origins-are-100-percent-unknown + - en:ecoscore-packaging-unspecified-shape + - en:ecoscore-production-system-no-label + data_sources: Database - FoodRepo / openfood.ch, Databases, + Producer - Ferrero, Producers, App - yuka, Apps, Producer + - ferrero-france-commerciale, Database - Equadis, Database + - GDSN, App - InFood, App - Open Food Facts, App - halal-healthy, + App - smoothie-openfoodfacts data_sources_tags: - - database-foodrepo-openfood-ch - - databases - - producer-ferrero - - producers - - app-yuka - - apps - - producer-ferrero-france-commerciale - - database-equadis - - database-gdsn - - app-infood - - app-open-food-facts - - app-halal-healthy - - app-smoothie-openfoodfacts + - database-foodrepo-openfood-ch + - databases + - producer-ferrero + - producers + - app-yuka + - apps + - producer-ferrero-france-commerciale + - database-equadis + - database-gdsn + - app-infood + - app-open-food-facts + - app-halal-healthy + - app-smoothie-openfoodfacts ecoscore_data: adjustments: origins_of_ingredients: aggregated_origins: - - origin: 'en:unknown' - percent: 100 + - origin: en:unknown + percent: 100 epi_score: 0 epi_value: -5 origins_from_origins_field: - - 'en:unknown' + - en:unknown transportation_scores: fr: 0 'no': 0 @@ -3183,10 +260,10 @@ paths: packaging: non_recyclable_and_non_biodegradable_materials: 0 packagings: - - ecoscore_material_score: 81 - ecoscore_shape_ratio: 1 - material: 'en:clear-glass' - shape: 'en:unknown' + - ecoscore_material_score: 81 + ecoscore_shape_ratio: 1 + material: en:clear-glass + shape: en:unknown score: 81 value: -2 warning: unspecified_shape @@ -3195,7 +272,7 @@ paths: value: 0 warning: no_label threatened_species: - ingredient: 'en:palm-oil' + ingredient: en:palm-oil value: -10 agribalyse: agribalyse_food_code: '31032' @@ -3217,7 +294,7 @@ paths: ef_transportation: 0.017824104 is_beverage: 0 name_en: Chocolate spread with hazelnuts - name_fr: Pâte à tartiner chocolat et noisette + name_fr: "P\xE2te \xE0 tartiner chocolat et noisette" score: 40 grade: d grades: @@ -3246,21 +323,21 @@ paths: Climate_change: 0.172717449218484 EF_single_score: 0.023255035815491 likeliest_recipe: - 'en:emulsifier': 0.388589430098073 - 'en:hazelnut_oil': 12.806852015349 - 'en:palm_oil': 16.6103749736231 - 'en:sugar': 52.9709312507153 - 'en:water': 4.90093151221936 - 'fr:Cacao_Maigre_7': 3.94056985087663 - 'fr:Lait__cr_m__En_Poudre_8': 6.8959972390341 + en:emulsifier: 0.388589430098073 + en:hazelnut_oil: 12.806852015349 + en:palm_oil: 16.6103749736231 + en:sugar: 52.9709312507153 + en:water: 4.90093151221936 + fr:Cacao_Maigre_7: 3.94056985087663 + fr:Lait__cr_m__En_Poudre_8: 6.8959972390341 mass_ratio_uncharacterized: 0.11 uncharacterized_ingredients: impact: - - 'fr:Lait Écrémé En Poudre 8' - - 'fr:Cacao Maigre 7' + - "fr:Lait \xC9cr\xE9m\xE9 En Poudre 8" + - fr:Cacao Maigre 7 nutrition: - - 'fr:Lait Écrémé En Poudre 8' - - 'fr:Cacao Maigre 7' + - "fr:Lait \xC9cr\xE9m\xE9 En Poudre 8" + - fr:Cacao Maigre 7 uncharacterized_ingredients_mass_proportion: impact: 0.11 nutrition: 0.11 @@ -3268,73 +345,60 @@ paths: impact: 0.333333333333333 nutrition: 0.333333333333333 warnings: - - >- - The product has a high number of nutrition - uncharacterized ingredients: 33% - - >- - The product has a high number of impact - uncharacterized ingredients: 33% - - >- - The estimated mass of nutrition uncharacterized - ingredients in the product is high: 11% - - >- - The estimated mass of impact uncharacterized - ingredients in the product is high: 11% + - 'The product has a high number of nutrition uncharacterized + ingredients: 33%' + - 'The product has a high number of impact uncharacterized + ingredients: 33%' + - 'The estimated mass of nutrition uncharacterized ingredients + in the product is high: 11%' + - 'The estimated mass of impact uncharacterized ingredients + in the product is high: 11%' ecoscore_extended_data_version: '4' ecoscore_grade: d ecoscore_score: 23 ecoscore_tags: - - d + - d editors_tags: - - user1 - - user2 - - user3 - - user4 + - user1 + - user2 + - user3 + - user4 emb_codes: '' emb_codes_20141016: '' emb_codes_orig: '' emb_codes_tags: [] entry_dates_tags: - - '2016-03-11' - - 2016-03 - - '2016' + - '2016-03-11' + - 2016-03 + - '2016' environment_impact_level: '' environment_impact_level_tags: [] expiration_date: 09/2021 - food_groups: 'en:sweets' + food_groups: en:sweets food_groups_tags: - - 'en:sugary-snacks' - - 'en:sweets' + - en:sugary-snacks + - en:sweets fruits-vegetables-nuts_100g_estimate: 0 generic_name: '' - generic_name_ar: نوتلا + generic_name_ar: "\u0646\u0648\u062A\u0644\u0627" generic_name_de: Nuss-Nougat-Creme generic_name_en: '' generic_name_es: Crema de Avellanas con cacao - generic_name_fr: Pâte à tartiner aux noisettes + generic_name_fr: "P\xE2te \xE0 tartiner aux noisettes" generic_name_id: '' generic_name_it: Nutella generic_name_nl: '' grades: {} id: '3017620422003' - image_front_small_url: >- - https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.200.jpg - image_front_thumb_url: >- - https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.100.jpg - image_front_url: >- - https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.400.jpg - image_nutrition_small_url: >- - https://images.openfoodfacts.org/images/products/301/762/042/2003/nutrition_en.400.200.jpg - image_nutrition_thumb_url: >- - https://images.openfoodfacts.org/images/products/301/762/042/2003/nutrition_en.400.100.jpg - image_nutrition_url: >- - https://images.openfoodfacts.org/images/products/301/762/042/2003/nutrition_en.400.400.jpg - image_small_url: >- - https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.200.jpg - image_thumb_url: >- - https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.100.jpg - image_url: >- - https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.400.jpg + image_front_small_url: https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.200.jpg + image_front_thumb_url: https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.100.jpg + image_front_url: https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.400.jpg + image_nutrition_small_url: https://images.openfoodfacts.org/images/products/301/762/042/2003/nutrition_en.400.200.jpg + image_nutrition_thumb_url: https://images.openfoodfacts.org/images/products/301/762/042/2003/nutrition_en.400.100.jpg + image_nutrition_url: https://images.openfoodfacts.org/images/products/301/762/042/2003/nutrition_en.400.400.jpg + image_small_url: https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.200.jpg + image_thumb_url: https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.100.jpg + image_url: https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.400.jpg images: '1': sizes: @@ -3501,158 +565,152 @@ paths: y1: '-1' y2: '-1' informers_tags: - - user1 - - user2 - - user3 - - user4 + - user1 + - user2 + - user3 + - user4 ingredients: - - id: 'en:sugar' - percent_estimate: 46.5 - percent_max: 63 - percent_min: 30 - text: sugar - vegan: 'yes' - vegetarian: 'yes' - - from_palm_oil: 'yes' - id: 'en:palm-oil' - percent_estimate: 25.5 - percent_max: 38 - percent_min: 13 - text: palm oil - vegan: 'yes' - vegetarian: 'yes' - - id: 'en:hazelnut' - percent: 13 - percent_estimate: 13 - percent_max: 13 - percent_min: 13 - text: hazelnuts - vegan: 'yes' - vegetarian: 'yes' - - id: 'en:skim-milk-powder-8' - percent: 7 - percent_estimate: 7 - percent_max: 7 - percent_min: 7 - text: skim milk powder 8 - - id: 'en:lean-cocoa-7' - percent: 4 - percent_estimate: 4 - percent_max: 4 - percent_min: 4 - text: lean cocoa 7 - - id: 'en:emulsifier' - ingredients: - - id: 'en:soya-lecithin' - percent_estimate: 2 - percent_max: 4 - percent_min: 0 - text: soy lecithins - vegan: 'yes' - vegetarian: 'yes' - percent_estimate: 2 - percent_max: 4 - percent_min: 0 - text: emulsifiers - - id: 'en:vanillin' + - id: en:sugar + percent_estimate: 46.5 + percent_max: 63 + percent_min: 30 + text: sugar + vegan: 'yes' + vegetarian: 'yes' + - from_palm_oil: 'yes' + id: en:palm-oil + percent_estimate: 25.5 + percent_max: 38 + percent_min: 13 + text: palm oil + vegan: 'yes' + vegetarian: 'yes' + - id: en:hazelnut + percent: 13 + percent_estimate: 13 + percent_max: 13 + percent_min: 13 + text: hazelnuts + vegan: 'yes' + vegetarian: 'yes' + - id: en:skim-milk-powder-8 + percent: 7 + percent_estimate: 7 + percent_max: 7 + percent_min: 7 + text: skim milk powder 8 + - id: en:lean-cocoa-7 + percent: 4 + percent_estimate: 4 + percent_max: 4 + percent_min: 4 + text: lean cocoa 7 + - id: en:emulsifier + ingredients: + - id: en:soya-lecithin percent_estimate: 2 percent_max: 4 percent_min: 0 - text: vanillin + text: soy lecithins + vegan: 'yes' + vegetarian: 'yes' + percent_estimate: 2 + percent_max: 4 + percent_min: 0 + text: emulsifiers + - id: en:vanillin + percent_estimate: 2 + percent_max: 4 + percent_min: 0 + text: vanillin ingredients_analysis: - 'en:palm-oil': - - 'en:palm-oil' - 'en:vegan-status-unknown': - - 'en:skim-milk-powder-8' - - 'en:lean-cocoa-7' - - 'en:vanillin' - 'en:vegetarian-status-unknown': - - 'en:skim-milk-powder-8' - - 'en:lean-cocoa-7' - - 'en:vanillin' + en:palm-oil: + - en:palm-oil + en:vegan-status-unknown: + - en:skim-milk-powder-8 + - en:lean-cocoa-7 + - en:vanillin + en:vegetarian-status-unknown: + - en:skim-milk-powder-8 + - en:lean-cocoa-7 + - en:vanillin ingredients_analysis_tags: - - 'en:palm-oil' - - 'en:vegan-status-unknown' - - 'en:vegetarian-status-unknown' + - en:palm-oil + - en:vegan-status-unknown + - en:vegetarian-status-unknown ingredients_from_or_that_may_be_from_palm_oil_n: 0 ingredients_from_palm_oil_n: 0 ingredients_from_palm_oil_tags: [] ingredients_hierarchy: - - 'en:sugar' - - 'en:added-sugar' - - 'en:disaccharide' - - 'en:palm-oil' - - 'en:oil-and-fat' - - 'en:vegetable-oil-and-fat' - - 'en:palm-oil-and-fat' - - 'en:hazelnut' - - 'en:nut' - - 'en:tree-nut' - - 'en:skim-milk-powder-8' - - 'en:lean-cocoa-7' - - 'en:emulsifier' - - 'en:vanillin' - - 'en:soya-lecithin' - - 'en:e322' - - 'en:e322i' + - en:sugar + - en:added-sugar + - en:disaccharide + - en:palm-oil + - en:oil-and-fat + - en:vegetable-oil-and-fat + - en:palm-oil-and-fat + - en:hazelnut + - en:nut + - en:tree-nut + - en:skim-milk-powder-8 + - en:lean-cocoa-7 + - en:emulsifier + - en:vanillin + - en:soya-lecithin + - en:e322 + - en:e322i ingredients_n: 8 ingredients_n_tags: - - '8' - - 1-10 + - '8' + - 1-10 ingredients_original_tags: - - 'en:sugar' - - 'en:palm-oil' - - 'en:hazelnut' - - 'en:skim-milk-powder-8' - - 'en:lean-cocoa-7' - - 'en:emulsifier' - - 'en:vanillin' - - 'en:soya-lecithin' + - en:sugar + - en:palm-oil + - en:hazelnut + - en:skim-milk-powder-8 + - en:lean-cocoa-7 + - en:emulsifier + - en:vanillin + - en:soya-lecithin ingredients_percent_analysis: 1 ingredients_tags: - - 'en:sugar' - - 'en:added-sugar' - - 'en:disaccharide' - - 'en:palm-oil' - - 'en:oil-and-fat' - - 'en:vegetable-oil-and-fat' - - 'en:palm-oil-and-fat' - - 'en:hazelnut' - - 'en:nut' - - 'en:tree-nut' - - 'en:skim-milk-powder-8' - - 'en:lean-cocoa-7' - - 'en:emulsifier' - - 'en:vanillin' - - 'en:soya-lecithin' - - 'en:e322' - - 'en:e322i' - ingredients_text: >- - sugar, palm oil, hazelnuts 13%, skim milk powder 8, 7%, - lean cocoa 7, 4%, emulsifiers: soy lecithins, vanillin - ingredients_text_en: >- - sugar, palm oil, hazelnuts 13%, skim milk powder 8, 7%, - lean cocoa 7, 4%, emulsifiers: soy lecithins, vanillin - ingredients_text_fr: >- - Sucre, huile de palme, _NOISETTES_ 13%, _LAIT_ écrémé en - poudre 8,7%, cacao maigre 7,4%, émulsifiants: lécithine - [SOJA]; vanilline. Sans gluten - ingredients_text_with_allergens: >- - sugar, palm oil, hazelnuts 13%, skim milk powder - 8, 7%, lean cocoa 7, 4%, emulsifiers: soy lecithins, - vanillin - ingredients_text_with_allergens_en: >- - sugar, palm oil, hazelnuts 13%, skim milk powder - 8, 7%, lean cocoa 7, 4%, emulsifiers: soy lecithins, - vanillin - ingredients_text_with_allergens_fr: >- - Sucre, huile de palme, NOISETTES 13%, LAIT écrémé en poudre 8,7%, - cacao maigre 7,4%, émulsifiants: lécithine [SOJA]; vanilline. Sans gluten + - en:sugar + - en:added-sugar + - en:disaccharide + - en:palm-oil + - en:oil-and-fat + - en:vegetable-oil-and-fat + - en:palm-oil-and-fat + - en:hazelnut + - en:nut + - en:tree-nut + - en:skim-milk-powder-8 + - en:lean-cocoa-7 + - en:emulsifier + - en:vanillin + - en:soya-lecithin + - en:e322 + - en:e322i + ingredients_text: 'sugar, palm oil, hazelnuts 13%, skim milk + powder 8, 7%, lean cocoa 7, 4%, emulsifiers: soy lecithins, + vanillin' + ingredients_text_en: 'sugar, palm oil, hazelnuts 13%, skim + milk powder 8, 7%, lean cocoa 7, 4%, emulsifiers: soy lecithins, + vanillin' + ingredients_text_fr: "Sucre, huile de palme, _NOISETTES_ 13%,\ + \ _LAIT_ \xE9cr\xE9m\xE9 en poudre 8,7%, cacao maigre 7,4%,\ + \ \xE9mulsifiants: l\xE9cithine [SOJA]; vanilline. Sans gluten" + ingredients_text_with_allergens: 'sugar, palm oil, hazelnuts + 13%, skim milk powder 8, 7%, lean cocoa 7, 4%, emulsifiers: + soy lecithins, vanillin' + ingredients_text_with_allergens_en: 'sugar, palm oil, hazelnuts 13%, skim milk powder 8, + 7%, lean cocoa 7, 4%, emulsifiers: soy lecithins, vanillin' + ingredients_text_with_allergens_fr: "Sucre, huile de palme,\ + \ NOISETTES 13%, LAIT \xE9cr\xE9m\xE9 en poudre 8,7%, cacao\ + \ maigre 7,4%, \xE9mulsifiants: l\xE9cithine [SOJA]; vanilline. Sans gluten" ingredients_that_may_be_from_palm_oil_n: 0 ingredients_that_may_be_from_palm_oil_tags: [] ingredients_with_specified_percent_n: 3 @@ -3662,47 +720,47 @@ paths: interface_version_created: '20120622' interface_version_modified: 20150316.jqm2 known_ingredients_n: 15 - labels: 'Sans gluten,en:nonorganic' + labels: Sans gluten,en:nonorganic labels_hierarchy: - - 'en:no-gluten' - - 'en:nonorganic' + - en:no-gluten + - en:nonorganic labels_lc: fr labels_tags: - - 'en:no-gluten' - - 'en:nonorganic' + - en:no-gluten + - en:nonorganic lang: en languages: - 'en:arabic': 2 - 'en:english': 4 - 'en:french': 10 - 'en:german': 3 - 'en:italian': 3 - 'en:spanish': 7 + en:arabic: 2 + en:english: 4 + en:french: 10 + en:german: 3 + en:italian: 3 + en:spanish: 7 languages_codes: en: 4 fr: 10 languages_hierarchy: - - 'en:english' - - 'en:french' + - en:english + - en:french languages_tags: - - 'en:english' - - 'en:french' - - 'en:multilingual' + - en:english + - en:french + - en:multilingual last_check_dates_tags: - - '2021-07-21' - - 2021-07 - - '2021' + - '2021-07-21' + - 2021-07 + - '2021' last_checked_t: 1626872806 last_checker: user3 last_edit_dates_tags: - - '2022-07-29' - - 2022-07 - - '2022' + - '2022-07-29' + - 2022-07 + - '2022' last_editor: user4 last_image_dates_tags: - - '2022-07-29' - - 2022-07 - - '2022' + - '2022-07-29' + - 2022-07 + - '2022' last_image_t: 1659084293 last_modified_by: user4 last_modified_t: 1659084329 @@ -3715,32 +773,31 @@ paths: minerals_prev_tags: [] minerals_tags: [] misc_tags: - - 'en:nutrition-no-fiber' - - >- - en:nutrition-fruits-vegetables-nuts-estimate-from-ingredients - - 'en:nutrition-no-fiber-or-fruits-vegetables-nuts' - - 'en:nutriscore-computed' - - 'en:ecoscore-extended-data-computed' - - 'en:ecoscore-extended-data-version-4' - - 'en:ecoscore-missing-data-warning' - - 'en:ecoscore-missing-data-labels' - - 'en:ecoscore-missing-data-origins' - - 'en:ecoscore-missing-data-packagings' - - 'en:ecoscore-computed' + - en:nutrition-no-fiber + - en:nutrition-fruits-vegetables-nuts-estimate-from-ingredients + - en:nutrition-no-fiber-or-fruits-vegetables-nuts + - en:nutriscore-computed + - en:ecoscore-extended-data-computed + - en:ecoscore-extended-data-version-4 + - en:ecoscore-missing-data-warning + - en:ecoscore-missing-data-labels + - en:ecoscore-missing-data-origins + - en:ecoscore-missing-data-packagings + - en:ecoscore-computed no_nutrition_data: 'null' nova_group: 4 nova_groups: '4' nova_groups_markers: '3': - - - ingredients - - 'en:sugar' + - - ingredients + - en:sugar '4': - - - additives - - 'en:e322' - - - ingredients - - 'en:emulsifier' + - - additives + - en:e322 + - - ingredients + - en:emulsifier nova_groups_tags: - - 'en:4-ultra-processed-food-and-drink-products' + - en:4-ultra-processed-food-and-drink-products nucleotides_prev_tags: [] nucleotides_tags: [] nutrient_levels: @@ -3749,10 +806,10 @@ paths: saturated-fat: high sugars: high nutrient_levels_tags: - - 'en:fat-in-high-quantity' - - 'en:saturated-fat-in-high-quantity' - - 'en:sugars-in-high-quantity' - - 'en:salt-in-low-quantity' + - en:fat-in-high-quantity + - en:saturated-fat-in-high-quantity + - en:sugars-in-high-quantity + - en:salt-in-low-quantity nutriments: alcohol: 0 alcohol_100g: 0 @@ -3861,7 +918,7 @@ paths: nutrition_grade_fr: e nutrition_grades: e nutrition_grades_tags: - - e + - e nutrition_score_beverage: 0 nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients: 1 nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients_value: 13 @@ -3876,79 +933,80 @@ paths: other_nutritional_substances_tags: [] owner: org-ferrero-france-commerciale owners_tags: org-ferrero-france-commerciale - packaging: >- - PP 5 Ummi PLASTIQUE / PLASTIEK PAP 27 WWW PAPIER / - PAPIER CIPAP 82 PANNEAU DE FIBRE COMPOSITES/ COMPOSIET - VEZELPLAAT GL 70 VERRE / GLAS + packaging: PP 5 Ummi PLASTIQUE / PLASTIEK PAP 27 WWW PAPIER + / PAPIER CIPAP 82 PANNEAU DE FIBRE COMPOSITES/ COMPOSIET VEZELPLAAT + GL 70 VERRE / GLAS packaging_hierarchy: - - >- - fr:PP 5 Ummi PLASTIQUE / PLASTIEK PAP 27 WWW PAPIER / - PAPIER CIPAP 82 PANNEAU DE FIBRE COMPOSITES/ COMPOSIET - VEZELPLAAT GL 70 VERRE / GLAS + - fr:PP 5 Ummi PLASTIQUE / PLASTIEK PAP 27 WWW PAPIER / PAPIER + CIPAP 82 PANNEAU DE FIBRE COMPOSITES/ COMPOSIET VEZELPLAAT + GL 70 VERRE / GLAS packaging_lc: fr packaging_tags: - - >- - fr:pp-5-ummi-plastique-plastiek-pap-27-www-papier-papier-cipap-82-panneau-de-fibre-composites-composiet-vezelplaat-gl-70-verre-glas + - fr:pp-5-ummi-plastique-plastiek-pap-27-www-papier-papier-cipap-82-panneau-de-fibre-composites-composiet-vezelplaat-gl-70-verre-glas packaging_text: '' packaging_text_ar: '' packaging_text_de: '' packaging_text_en: '' - packaging_text_es: 'Pot en verre, couvercle en plastique.' - packaging_text_fr: "1 couvercle plastique blanc opaque PP à jeter,\r\n1 plaque en carton PAP 21 à recycler,\r\n1 opercule en carton C/PAP 82 à recycler,\r\n1 pot en verre à recycler" + packaging_text_es: Pot en verre, couvercle en plastique. + packaging_text_fr: "1 couvercle plastique blanc opaque PP \xE0\ + \ jeter,\r\n1 plaque en carton PAP 21 \xE0 recycler,\r\n1\ + \ opercule en carton C/PAP 82 \xE0 recycler,\r\n1 pot en verre\ + \ \xE0 recycler" packaging_text_id: '' packaging_text_it: '' packaging_text_nl: '' packagings: - - material: 'en:clear-glass' + - material: en:clear-glass photographers_tags: - - user1 - - user2 - - user3 - - user4 + - user1 + - user2 + - user3 + - user4 pnns_groups_1: Sugary snacks pnns_groups_1_tags: - - sugary-snacks - - known + - sugary-snacks + - known pnns_groups_2: Sweets pnns_groups_2_tags: - - sweets - - known + - sweets + - known popularity_key: 20999992556 popularity_tags: - - top-10-scans-2021 - - top-50-scans-2021 - - top-100-scans-2021 - - top-500-scans-2021 - - top-1000-scans-2021 - - top-5000-scans-2021 - - top-10000-scans-2021 - - top-50000-scans-2021 - - top-100000-scans-2021 - - top-10-fr-scans-2021 - - top-50-fr-scans-2021 - - top-100-fr-scans-2021 - - top-500-fr-scans-2021 - - top-1000-fr-scans-2021 - - top-5000-fr-scans-2021 - - top-10000-fr-scans-2021 - - top-50000-fr-scans-2021 - - top-100000-fr-scans-2021 - - top-country-fr-scans-2021 - - at-least-5-fr-scans-2021 - - at-least-10-fr-scans-2021 + - top-10-scans-2021 + - top-50-scans-2021 + - top-100-scans-2021 + - top-500-scans-2021 + - top-1000-scans-2021 + - top-5000-scans-2021 + - top-10000-scans-2021 + - top-50000-scans-2021 + - top-100000-scans-2021 + - top-10-fr-scans-2021 + - top-50-fr-scans-2021 + - top-100-fr-scans-2021 + - top-500-fr-scans-2021 + - top-1000-fr-scans-2021 + - top-5000-fr-scans-2021 + - top-10000-fr-scans-2021 + - top-50000-fr-scans-2021 + - top-100000-fr-scans-2021 + - top-country-fr-scans-2021 + - at-least-5-fr-scans-2021 + - at-least-10-fr-scans-2021 product_name: Nutella - product_name_ar: نوتيلا + product_name_ar: "\u0646\u0648\u062A\u064A\u0644\u0627" product_name_de: Nutella product_name_en: Nutella product_name_es: Nutella - product_name_fr: Pâte à tartiner Nutella noisettes et cacao - 400g + product_name_fr: "P\xE2te \xE0 tartiner Nutella noisettes et\ + \ cacao - 400g" product_name_id: '' product_name_it: Nutella product_name_nl: '' product_quantity: '400' purchase_places: F - 77480 Mousseaux les Bray France purchase_places_tags: - - f-77480-mousseaux-les-bray-france + - f-77480-mousseaux-les-bray-france quantity: 400g removed_countries_tags: [] rev: 421 @@ -3957,159 +1015,136 @@ paths: selected_images: front: display: - en: >- - https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.400.jpg - fr: >- - https://images.openfoodfacts.org/images/products/301/762/042/2003/front_fr.415.400.jpg + en: https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.400.jpg + fr: https://images.openfoodfacts.org/images/products/301/762/042/2003/front_fr.415.400.jpg small: - en: >- - https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.200.jpg - fr: >- - https://images.openfoodfacts.org/images/products/301/762/042/2003/front_fr.415.200.jpg + en: https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.200.jpg + fr: https://images.openfoodfacts.org/images/products/301/762/042/2003/front_fr.415.200.jpg thumb: - en: >- - https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.100.jpg - fr: >- - https://images.openfoodfacts.org/images/products/301/762/042/2003/front_fr.415.100.jpg + en: https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.100.jpg + fr: https://images.openfoodfacts.org/images/products/301/762/042/2003/front_fr.415.100.jpg ingredients: display: - fr: >- - https://images.openfoodfacts.org/images/products/301/762/042/2003/ingredients_fr.299.400.jpg + fr: https://images.openfoodfacts.org/images/products/301/762/042/2003/ingredients_fr.299.400.jpg small: - fr: >- - https://images.openfoodfacts.org/images/products/301/762/042/2003/ingredients_fr.299.200.jpg + fr: https://images.openfoodfacts.org/images/products/301/762/042/2003/ingredients_fr.299.200.jpg thumb: - fr: >- - https://images.openfoodfacts.org/images/products/301/762/042/2003/ingredients_fr.299.100.jpg + fr: https://images.openfoodfacts.org/images/products/301/762/042/2003/ingredients_fr.299.100.jpg nutrition: display: - en: >- - https://images.openfoodfacts.org/images/products/301/762/042/2003/nutrition_en.400.400.jpg + en: https://images.openfoodfacts.org/images/products/301/762/042/2003/nutrition_en.400.400.jpg small: - en: >- - https://images.openfoodfacts.org/images/products/301/762/042/2003/nutrition_en.400.200.jpg + en: https://images.openfoodfacts.org/images/products/301/762/042/2003/nutrition_en.400.200.jpg thumb: - en: >- - https://images.openfoodfacts.org/images/products/301/762/042/2003/nutrition_en.400.100.jpg + en: https://images.openfoodfacts.org/images/products/301/762/042/2003/nutrition_en.400.100.jpg packaging: display: - fr: >- - https://images.openfoodfacts.org/images/products/301/762/042/2003/packaging_fr.420.400.jpg + fr: https://images.openfoodfacts.org/images/products/301/762/042/2003/packaging_fr.420.400.jpg small: - fr: >- - https://images.openfoodfacts.org/images/products/301/762/042/2003/packaging_fr.420.200.jpg + fr: https://images.openfoodfacts.org/images/products/301/762/042/2003/packaging_fr.420.200.jpg thumb: - fr: >- - https://images.openfoodfacts.org/images/products/301/762/042/2003/packaging_fr.420.100.jpg + fr: https://images.openfoodfacts.org/images/products/301/762/042/2003/packaging_fr.420.100.jpg serving_quantity: '15' serving_size: 15g sortkey: 1610877517 sources: - - fields: - - product_name_de - - product_name_it - - brands - - countries - id: openfood-ch - images: [] - import_t: 1548767279 - manufacturer: '0' - name: FoodRepo - source_licence: >- - Creative Commons Attribution 4.0 International - License - source_licence_url: 'https://creativecommons.org/licenses/by/4.0/' - url: 'https://www.foodrepo.org/ch/products/19413' - - fields: - - packaging - - ingredients_text_fr - id: ferrero - images: [] - import_t: 1552318840 - manufacturer: '1' - name: Ferrero - url: 'https://www.ferrero.fr' + - fields: + - product_name_de + - product_name_it + - brands + - countries + id: openfood-ch + images: [] + import_t: 1548767279 + manufacturer: '0' + name: FoodRepo + source_licence: Creative Commons Attribution 4.0 International + License + source_licence_url: https://creativecommons.org/licenses/by/4.0/ + url: https://www.foodrepo.org/ch/products/19413 + - fields: + - packaging + - ingredients_text_fr + id: ferrero + images: [] + import_t: 1552318840 + manufacturer: '1' + name: Ferrero + url: https://www.ferrero.fr sources_fields: org-gs1: gln: '3010176200101' gpcCategoryCode: '10000187' - gpcCategoryName: Pâtes à Tartiner Sucrées (Longue Conservation) + gpcCategoryName: "P\xE2tes \xE0 Tartiner Sucr\xE9es (Longue\ + \ Conservation)" isAllergenRelevantDataProvided: 'true' lastChangeDateTime: '2022-07-13T16:01:41+02:00' partyName: FERRERO FRANCE COMMERCIALE productionVariantDescription: '2014' publicationDateTime: '2022-07-13T16:01:41+02:00' - states: >- - en:to-be-completed, en:nutrition-facts-completed, - en:ingredients-completed, en:expiration-date-completed, - en:packaging-code-to-be-completed, - en:characteristics-to-be-completed, - en:origins-to-be-completed, en:categories-completed, - en:brands-completed, en:packaging-completed, - en:quantity-completed, en:product-name-completed, - en:photos-to-be-validated, - en:packaging-photo-to-be-selected, - en:nutrition-photo-selected, - en:ingredients-photo-to-be-selected, - en:front-photo-selected, en:photos-uploaded + states: en:to-be-completed, en:nutrition-facts-completed, en:ingredients-completed, + en:expiration-date-completed, en:packaging-code-to-be-completed, + en:characteristics-to-be-completed, en:origins-to-be-completed, + en:categories-completed, en:brands-completed, en:packaging-completed, + en:quantity-completed, en:product-name-completed, en:photos-to-be-validated, + en:packaging-photo-to-be-selected, en:nutrition-photo-selected, + en:ingredients-photo-to-be-selected, en:front-photo-selected, + en:photos-uploaded states_hierarchy: - - 'en:to-be-completed' - - 'en:nutrition-facts-completed' - - 'en:ingredients-completed' - - 'en:expiration-date-completed' - - 'en:packaging-code-to-be-completed' - - 'en:characteristics-to-be-completed' - - 'en:origins-to-be-completed' - - 'en:categories-completed' - - 'en:brands-completed' - - 'en:packaging-completed' - - 'en:quantity-completed' - - 'en:product-name-completed' - - 'en:photos-to-be-validated' - - 'en:packaging-photo-to-be-selected' - - 'en:nutrition-photo-selected' - - 'en:ingredients-photo-to-be-selected' - - 'en:front-photo-selected' - - 'en:photos-uploaded' + - en:to-be-completed + - en:nutrition-facts-completed + - en:ingredients-completed + - en:expiration-date-completed + - en:packaging-code-to-be-completed + - en:characteristics-to-be-completed + - en:origins-to-be-completed + - en:categories-completed + - en:brands-completed + - en:packaging-completed + - en:quantity-completed + - en:product-name-completed + - en:photos-to-be-validated + - en:packaging-photo-to-be-selected + - en:nutrition-photo-selected + - en:ingredients-photo-to-be-selected + - en:front-photo-selected + - en:photos-uploaded states_tags: - - 'en:to-be-completed' - - 'en:nutrition-facts-completed' - - 'en:ingredients-completed' - - 'en:expiration-date-completed' - - 'en:packaging-code-to-be-completed' - - 'en:characteristics-to-be-completed' - - 'en:origins-to-be-completed' - - 'en:categories-completed' - - 'en:brands-completed' - - 'en:packaging-completed' - - 'en:quantity-completed' - - 'en:product-name-completed' - - 'en:photos-to-be-validated' - - 'en:packaging-photo-to-be-selected' - - 'en:nutrition-photo-selected' - - 'en:ingredients-photo-to-be-selected' - - 'en:front-photo-selected' - - 'en:photos-uploaded' - stores: >- - Bi1 Magasins U Carrefour Franprix Auchan Casino - Intermarché,carrefour.fr + - en:to-be-completed + - en:nutrition-facts-completed + - en:ingredients-completed + - en:expiration-date-completed + - en:packaging-code-to-be-completed + - en:characteristics-to-be-completed + - en:origins-to-be-completed + - en:categories-completed + - en:brands-completed + - en:packaging-completed + - en:quantity-completed + - en:product-name-completed + - en:photos-to-be-validated + - en:packaging-photo-to-be-selected + - en:nutrition-photo-selected + - en:ingredients-photo-to-be-selected + - en:front-photo-selected + - en:photos-uploaded + stores: "Bi1 Magasins U Carrefour Franprix Auchan Casino\ + \ Intermarch\xE9,carrefour.fr" stores_tags: - - >- - bi1-magasins-u-carrefour-franprix-auchan-casino-intermarche - - carrefour-fr - teams: >- - pain-au-chocolat,shark-attack,stakano,chocolatine,la-robe-est-bleue,vegan,m,b,c,vegancheck + - bi1-magasins-u-carrefour-franprix-auchan-casino-intermarche + - carrefour-fr + teams: pain-au-chocolat,shark-attack,stakano,chocolatine,la-robe-est-bleue,vegan,m,b,c,vegancheck teams_tags: - - pain-au-chocolat - - shark-attack - - stakano - - chocolatine - - la-robe-est-bleue - - vegan - - m - - b - - c - - vegancheck + - pain-au-chocolat + - shark-attack + - stakano + - chocolatine + - la-robe-est-bleue + - vegan + - m + - b + - c + - vegancheck traces: '' traces_from_ingredients: '' traces_from_user: '(fr) ' @@ -4124,28 +1159,33 @@ paths: vitamins_tags: [] status: 1 status_verbose: product found - description: | - A product can be fetched via its unique barcode. + description: 'A product can be fetched via its unique barcode. + It returns all the details of that product response. + + ' operationId: get-product-by-barcode - '/api/v2/product/{barcode}?fields=knowledge_panels': + /api/v2/product/{barcode}?fields=knowledge_panels: get: tags: - - Read Requests - summary: | - Get Knowledge panels for a specific product by barcode + - Read Requests + summary: 'Get Knowledge panels for a specific product by barcode + (special case of get product) + + ' parameters: - - name: barcode - in: path - description: | - The barcode of the product to be fetched - required: true - style: simple - explode: false - schema: - type: string - example: '3017620422003' + - name: barcode + in: path + description: 'The barcode of the product to be fetched + + ' + required: true + style: simple + explode: false + schema: + type: string + example: '3017620422003' responses: '200': description: OK @@ -4153,521 +1193,21 @@ paths: application/json: schema: allOf: - - type: object - x-stoplight: - id: s4gz59htj4gc3 - properties: - code: - type: string - description: > - Barcode of the product - - (can be EAN-13 or internal codes for some food - stores). - - For products without a barcode, Open Food Facts - assigns a + - $ref: '#/components/schemas/get_product_by_barcode_base' + - type: object + properties: + product: + $ref: '#/components/schemas/product_knowledge_panels' + description: 'Knowledge panels gives high leve informations about a product, - number starting with the 200 reserved prefix. - status: - type: integer - status_verbose: - type: string - - type: object - properties: - product: - type: object - description: | - Knowledge panels for a product - properties: - knowledge_panels: - type: object - x-stoplight: - id: bcq3fkbtnwr5t - title: panels - description: >- - The panels object is a dictionary of individual - panel objects. - - Each key of the dictionary is the id of the panel, - and the value is the panel object. - - - Apps typically display a number of root panels - with known panel ids (e.g. health_card and - environment_card). Panels can reference other - panels and display them as sub-panels. - examples: - - additionalProperties: string - properties: - additionalProperties: - title: panel - x-stoplight: - id: mj9nhz3mqn05c - type: object - description: >- - Each panel contains an optional title and an - optional array of elements. - properties: - type: - type: string - description: >- - Type of the panel. If set to "card", the - panel and its sub-panels should be - displayed in a card. If set to "inline", - the panel should have its content always - displayed. - expanded: - type: boolean - description: >- - If true, the panel is to be displayed - already expanded. If false, only the title - should be displayed, and the user should - be able to click or tap it to open the - panel and display the elements. - expand_for: - type: string - description: >- - If set to "large", the content of the - panel should be expanded on large screens, - but it should still be possible to - unexpand it. - evaluation: - type: string - description: >- - A simple assessment of the panel value, - typically used to format fonts, et.c e.g. - bad = red - enum: - - good - - average - - neutral - - bad - - unknown - title_element: - title: title_element - x-stoplight: - id: lox0wvl9bdgy2 - type: object - description: The title of a panel. - properties: - name: - type: string - description: >- - A short name of this panel, not - including any actual values - title: - type: string - type: - type: string - enum: - - grade - - percentage - description: >- - Used to indicate how the value of this - item is measured, such as "grade" for - Nutri-Score and Eco-Score or - "percentage" for Salt - grade: - type: string - description: >- - The value for this panel where it - corresponds to a A to E grade such as - the Nutri-Score of the Eco-Score. - enum: - - a - - b - - c - - d - - e - - unknown - value: - type: number - description: >- - The numeric value of the panel, where - the type is "percentage" - icon_url: - type: string - icon_color_from_evaluation: - type: string - icon_size: - type: string - description: > - If set to "small", the icon should be - displayed at a small size. - elements: - type: array - description: >- - An ordered list of elements to display in - the content of the panel. - items: - title: element - x-stoplight: - id: e2ybdrtmx0tme - type: object - description: > - Each element object contains one - specific element object such as a text - element or an image element. - properties: - type: - element_type: string - enum: - - text - - image - - action - - panel - - panel_group - - table - description: > - The type of the included element object. - - The type also indicates which field - contains the included element object. - - e.g. if the type is "text", the included - element object will be in the - "text_element" field. - - - Note that in the future, new type of - element may be added, - - so your code should ignore unrecognized - types, and unknown properties. - - - TODO: add Map type - text_element: - title: text_element - x-stoplight: - id: vdwxlt73qnqfa - type: object - description: >- - A text in simple HTML format to display. - - - For some specific texts that correspond - to a product field (e.g. a product name, - the ingredients list of a product),the - edit_field_* fields are used to indicate - how to edit the field value. - properties: - type: - type: string - description: > - the type of text, might influence the - way you display it. - enum: - - summary - - warning - - notes - html: - type: string - description: Text to display in HTML format. - language: - type: string - description: >- - Language of the text. The name of the - language is returned in the language - requested when making the API call. e.g. - if the text is in Polish, and the - requested language is French, the - language field will contain "Polonais" - (French for "Polish"). Only set for - specific fields such as the list of - ingredients of a product. - lc: - type: string - description: >- - 2 letter language code for the text. - Only set for specific fields such as the - list of ingredients of a product. - edit_field_id: - type: string - description: >- - id of the field used to edit this text - in the product edit API. - edit_field_type: - type: string - description: Type of the product field. - edit_field_value: - type: string - description: >- - Current value of the product field. This - may differ from the html field which can - contain extra formating. - source_url: - type: string - description: Link to the source - example: >- - https://en.wikipedia.org/wiki/Sodium - acetate - source_text: - type: string - description: name of the source - example: Wikipedia - source_lc: - type: string - description: Source locale name - example: en - source_language: - type: string - description: Human readable source locale name - example: English - image_element: - title: image_element - x-stoplight: - id: k4v4kwt489q3j - type: object - properties: - url: - type: string - description: full URL of the image - width: - type: integer - description: > - Width of the image. - - - This is just a suggestion coming from - the server, - - the client may choose to use its own - dimensions for the image. - height: - type: integer - description: > - Height of the image. - - - This is just a suggestion coming from - the server, - - the client may choose to use its own - dimensions for the image. - alt_text: - type: string - description: Alt Text of the image. - action_element: - type: string - panel_element: - title: panel_element - x-stoplight: - id: ymx41elz4yrnj - type: object - description: >- - Panels can include other panels as - sub-panels using the panel_element. - properties: - panel_id: - type: string - description: >- - The id of the panel to include. The id - is the key of the panel in the panels - object returned in the knowledge_panels - field. - panel_group_element: - title: panel_group_element - x-stoplight: - id: b7emlfrgiuue2 - type: object - properties: - title: - type: string - panel_ids: - type: array - description: >- - The ids of the panels to include. The - ids are the keys of the panels in the - panels object returned in the - knowledge_panels field. - items: - type: string - description: >- - The panel group element is used to - display an optional title followed by a - number of sub-panels. - table_element: - title: table_element - x-stoplight: - id: 38zu3z4sruqo7 - type: object - description: Element to display a table. - properties: - id: - type: string - description: An id for the table. - title: - type: string - description: | - Title of the column. - rows: - type: string - columns: - type: array - items: - type: object - properties: - type: - type: string - text: - type: string - text_for_small_screens: - type: string - style: - type: string - column_group_id: - type: string - shown_by_default: - type: boolean - required: - - type - level: - type: string - description: | - a message level, as levels we use in log. - It might help theming the panel visualy - example: info - size: - type: string - enum: - - small - description: > - size is either empty (normal display) - - or small to indicate a panel that should - have a smaller font size - example: small - topics: - type: array - items: - type: string - example: health - readOnly: true - description: | - Knowledge panels gives high leve informations about a product, ready to display. - This is used by open food facts website, - and by the official mobile application - operationId: get-product-by-barcode-knowledge-panels - /cgi/product_image_upload.pl: - post: - tags: - - Write Requests - summary: Add a Photo to an Existing Product - operationId: get-cgi-product_image_upload.pl - description: | - Photos are source and proof of data. - The first photo uploaded for a product is - auto-selected as the product’s “front” photo.' - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - files: - type: array - items: - type: object - properties: - url: - type: string - example: /product/3017620422003/nutella-ferrero - filename: - type: string - example: '' - name: - type: string - example: Nutella - Ferrero - 400g - thumbnailUrl: - type: string - example: /images/products/301/762/042/2003/123.100.jpg - code: - type: string - example: '3017620422003' - image: - type: object - properties: - thumb_url: - type: string - example: 123.100.jpg - imgid: - type: integer - example: 123 - crop_url: - type: string - example: 123.400.jpg - imgid: - type: integer - example: 123 - status: - type: string - example: status ok - imagefield: - type: string - example: front_en - code: - type: string - example: '3017620422003' - requestBody: - content: - multipart/form-data: - schema: - type: object - properties: - code: - type: string - description: | - Barcode of the product - example: '3017620422003' - imagefield: - type: string - description: > - Indicates the type of the image and the corresponding - language. It should - - be in the format `{IMAGE_TYPE}_{LANG}` format, where - `IMAGE_TYPE` is one - of `front|ingredients|nutrition|packaging|other` and `LANG` - is the 2 - - letter language code. Use `other` if you don't want the - image to be - - selected. Note that the first image of a product is always - selected as front - - picture. - example: front_en - imgupload_front_en: - type: string - format: binary - description: > - This field must contain image binary content. - - The format and extension must be one of - gif|jpeg|jpg|png|heic. - - This field is dynamic and dependent on the value of - imagefield in the - - request body. It wil be imgupload_the value of the - imagefield stated + This is used by open food facts website, - earlier. For example, if `imagefield=front_en`, the name of - this field + and by the official mobile application - should be `imageupload_front_en`. - required: - - code - - imagefield - - imgupload_front_en - description: '' + ' + operationId: get-product-by-barcode-knowledge-panels /cgi/ingredients.pl: parameters: [] get: @@ -4679,21 +1219,18 @@ paths: content: application/json: schema: - type: object - properties: - status: - type: integer - example: 1 - description: > - Open Food Facts uses optical character recognition (OCR) to retrieve + $ref: '#/components/schemas/ocr_on_product' + description: 'Open Food Facts uses optical character recognition (OCR) to retrieve nutritional data and other information from the product labels. + + ' parameters: - - $ref: '#/components/parameters/id' - - $ref: '#/components/parameters/code' - - $ref: '#/components/parameters/process_image' - - $ref: '#/components/parameters/ocr_engine' + - $ref: '#/components/parameters/id' + - $ref: '#/components/parameters/code' + - $ref: '#/components/parameters/process_image' + - $ref: '#/components/parameters/ocr_engine' tags: - - Read Requests + - Read Requests /cgi/product_image_crop.pl: post: summary: Crop A Photo @@ -4706,108 +1243,20 @@ paths: schema: type: object properties: {} - description: | - Cropping is only relevant for editing existing products. + description: 'Cropping is only relevant for editing existing products. + You cannot crop an image the first time you upload it to the system. + + ' parameters: [] requestBody: + required: true content: multipart/form-data: schema: - type: object - description: > - Select a photo and optionally crop/rotate it. - - The origin of the cropping coordinates is the top-left corner. - - Note that rotation is applied *before* cropping, so the cropping - bounding box - - is relative to the rotated image. - required: - - id - - code - - imgid - properties: - code: - type: string - description: Barcode of the product. - example: 04963406 - imgid: - type: integer - description: 'identifier of the image to select, it should be a number' - example: 2 - id: - type: string - description: > - identifier of the selected image field, should be in the - format - - `{IMAGE_TYPE}_{LANG}` format, where `IMAGE_TYPE` is one of - - `front|ingredients|nutrition|packaging|other` and `LANG` is - the 2 letter - - language code. - - Note that if you select an image for the main language of - the product (ex: - - `ingredients_it` if `it` is the main language), this image - will be - - displayed on Product Opener for all languages (ex: on - - `https://fr.openfoodfacts.org`, unless `ingredients_fr` - exists). - example: front_en - x1: - type: integer - example: 0 - description: 'X origin coordinate of the crop, it must be lower than x2' - y1: - type: integer - example: 0 - description: 'Y origin coordinate of the crop, it must be lower than y2' - x2: - type: integer - example: 145 - description: 'X end coordinate of the crop, it must be higher than x1' - y2: - type: integer - example: 145 - description: 'Y end coordinate of the crop, it must be higher than y1' - angle: - type: integer - example: 0 - description: > - angle of the rotation to apply on the selected image. - - passing `90` as value rotate the image 90 degrees - counter-clockwise. - normalize: - type: string - example: 'false' - description: >- - whether the selected image should be normalized using - ImageMagick - enum: - - 'true' - - 'false' - white_magic: - type: string - default: 'false' - description: > - whether the source image should be white magiced (background - removal) using - - ImageMagick. - enum: - - 'true' - - 'false' - required: true + $ref: '#/components/schemas/crop_a_photo' tags: - - Write Requests + - Write Requests get: summary: Rotate A Photo operationId: get-cgi-product_image_crop.pl @@ -4817,52 +1266,27 @@ paths: content: application/json: schema: - type: object - properties: - status: - type: string - example: status ok - imagefield: - type: string - example: nutrition_fr - image: - type: object - properties: - display_url: - type: string - example: nutrition_fr.67.400.jpg - description: > - Although we recommend rotating photos manually and uploading a new - version of the image, - - the OFF API allows you to make api calls to automate this process. - - You can rotate existing photos by setting the angle to 90º, 180º, or - 270º clockwise. + $ref: '#/components/schemas/rotate_a_photo' + description: "Although we recommend rotating photos manually and uploading a\ + \ new version of the image,\nthe OFF API allows you to make api calls to automate\ + \ this process.\nYou can rotate existing photos by setting the angle to 90\xBA\ + , 180\xBA, or 270\xBA clockwise.\n" parameters: - - $ref: '#/components/parameters/code' - - $ref: '#/components/parameters/id' - - $ref: '#/components/parameters/imgid' - - $ref: '#/components/parameters/angle' + - $ref: '#/components/parameters/code' + - $ref: '#/components/parameters/id' + - $ref: '#/components/parameters/imgid' + - $ref: '#/components/parameters/angle' tags: - - Write Requests + - Write Requests /cgi/product_image_unselect.pl: post: summary: Unselect A Photo requestBody: + required: true content: multipart/form-data: schema: - type: object - properties: - code: - type: string - description: code of the product - example: '4251105501381' - id: - type: string - description: image field (image id) of the photo to unselect - example: front_fr + $ref: '#/components/schemas/unselect_a_photo' responses: '200': description: OK @@ -4893,4311 +1317,1513 @@ paths: content: application/json: schema: - type: object - properties: - status_verbose: - type: string - example: fields saved - status: - type: integer - example: 1 + $ref: '#/components/schemas/add_or_edit_a_product' parameters: [] requestBody: + required: true content: multipart/form-data: schema: - allOf: - - type: object - description: > - You can provide most of the properties defined in the - product schema. - properties: - code: - type: string - description: The barcode of the product to be added or edited - example: '0074570036004' - user_id: - type: string - description: A valid username. - example: myusername - password: - type: string - description: A valid corresponding password. - example: mypassword - comment: - type: string - description: >- - A comment for the change. It will be shown in product - changes history. - example: new packaging from super-app - brands: - schema: - type: array - items: - type: string - style: form - explode: false - description: >- - The brands of the product (comma separated list of - values). - example: 'Häagen-Dazs,General-mills' - labels: - schema: - type: array - items: - type: string - style: form - explode: false - description: >- - The labels of the product (comma separated list of - values). - example: 'Kosher,Ferroro' - categories: - schema: - type: array - items: - type: string - style: form - explode: false - description: >- - The categories of the product (comma separated list of - values). - example: 'Desserts,Frozen foods' - packaging: - type: string - description: > - Packaging type, format, material. - - The [v3 API - documentation](https://openfoodfacts.github.io/openfoodfacts-server/api/ref-v3/#operation/post-api-v3-product-barcode) - - has a more structured data for `packaging`. - example: Frozen - required: - - code - - user_id - - password - - type: object - description: | - Properties that goes in change ref - properties: - comment: - type: string - description: > - A comment on the contribution. - - Adding meaningful comments help moderators and users - understand a single product history. - app_name: - type: string - description: | - Name of the app providing the information - app_version: - type: string - description: | - Version of the app providing the information - app_uuid: - type: string - description: > - When an app uses a single user to log its contributions, - - it might be interesting to know which user of the app is - providing the information. - - You can use this field to provide an identifier (eg: an - sha1 of the username) that's privacy preserving. Make - sure that your salt is strong, perfectly random and - secret - - - In case we have trouble with one of your user, it helps - our moderators revert edits. - User-Agent: - type: string - description: > - It is required that you pass a specific User-Agent - header when you do an API request. - - But some times it's not possible to modify such a header - - (eg. request using JavaScript in a browser). - - In such cases, you can override it with this parameter. - required: true + $ref: '#/components/schemas/combined_add_or_edit_a_product_and_change_ref_properties' tags: - - Write Requests - description: > - This updates a product. + - Write Requests + description: 'This updates a product. - Note: If the barcode exists then you will be editing the existing - product, + Note: If the barcode exists then you will be editing the existing product, - However if it doesn''t you will be creating a new product with that - unique barcode, + However if it doesn''''t you will be creating a new product with that unique + barcode, and adding properties to the product. + + ' /api/v2/search: get: summary: Search for Products tags: - - Read Requests + - Read Requests responses: '200': description: OK content: application/json: schema: - type: object - properties: - count: - type: integer - description: | - Total number of products found - example: 2701 - page: - type: integer - description: > - Page number of returned results. - - - You can get a different page, by using the `page` query - parameter. - example: 1 - page_count: - type: integer - description: | - Number of products in this page. - - This will differ from page_size only on the last page. - example: 24 - page_size: - type: integer - description: | - Requested number of products per pages - - To get the number of pages, divide count by page_size - (eg. `Math.floor( count / page_size) + 1 `) - example: 24 - products: - type: array - description: > - The products matching the query corresponding to current - page - items: - type: object - description: > - This is all the fields describing a product and how to - display it on a page. - - - Refer to the different sub schema for more readable - entries: - - - * [Product Base](#cmp--schemas-product-base): Base - fields of a product - - * [Product Misc](#cmp--schemas-product-misc): - Miscellaneous but important fields of a product - - * [Product Tags](#cmp--schemas-product-tags): Tags - fields on a product - - * [Product Nutrition](#cmp--schemas-product-nutrition): - Nutrition fields of a product - - * [Product - Ingredients](#cmp--schemas-product-ingredients): Fields - about ingredients of a product - - * [Product Images](#cmp--schemas-product-images): - Information about Images of a product - - * [Product Eco-Score](#cmp--schemas-product-images): - Fields related to Eco-Score for a product - - * [Product Metadata](#cmp--schemas-product-ecoscore): - Metadata of a product (author, editors, etc.) - - * [Product Data Quality](#cmp--schemas-product-quality): - fields related to data quality for a product - - * [Product Knowledge - Panels](#cmp--schemas-product-knowledge-panels): - Knowledge panels for a product - - * [Product Attribute - Groups](#cmp--schemas-product-attribute-groups): - Attribute groups for personal product matching - allOf: - - type: object - description: | - Base product data - properties: - abbreviated_product_name: - type: string - description: Abbreviated name in requested language - code: - type: string - description: > - barcode of the product (can be EAN-13 or - internal codes for some food stores), - - for products without a barcode, - - Open Food Facts assigns a number starting with - the 200 reserved prefix - codes_tags: - type: array - items: - type: string - description: > - A value which is the type of barcode "code-13" - or "code-8" - - and - - A series of mask for the barcode - - It helps retrieve barcodes starting by - example: > - ["code-13","3017620422xxx","301762042xxxx","30176204xxxxx","3017620xxxxxx","301762xxxxxxx","30176xxxxxxxx","3017xxxxxxxxx","301xxxxxxxxxx","30xxxxxxxxxxx","3xxxxxxxxxxxx"] - generic_name: - type: string - description: | - Legal name of the product as regulated - by the European authorities. - id: - description: > - internal identifier for the product, usually set - to the value of `code`, - - except on the producers platform where it is - prefixed by the owner - type: string - lc: - type: string - description: > - Main language of the product. - - This is a duplicate of `lang` property (for - historical reasons). - lang: - type: string - description: > - Main language of the product. - - - This should be the main language of product - packaging (if one is predominant). - - - Main language is also used to decide which - ingredients list to parse. - nova_group: - type: integer - description: > - Nova group as an integer from 1 to 4. See - https://world.openfoodfacts.org/nova - nova_groups: - type: string - obsolete: - type: string - obsolete_since_date: - description: > - A date at which the product was declared - obsolete. - - This means it's not produced any more. - type: string - product_name: - type: string - description: | - The name of the product - product_name_en: - type: string - description: | - The name of the product can also - be in many other languages like - product_name_fr (for French). - product_quantity: - type: string - description: | - The size in g or ml for the whole product. - It's a normalized version of the quantity field. - example: '500' - product_quantity_unit: - type: string - description: > - The unit (either g or ml) for the correponding - product_quantity. - example: g - quantity: - type: string - description: | - Quantity and Unit. - patternProperties: - abbreviated_product_name_(?\w\w): - type: string - description: Abbreviated name in language `language_code`. - generic_name_(?\w\w): - type: string - description: | - This can be returned in many other languages - like generic_name_fr (for French). - - type: object - description: | - Miscellaneous but important fields of a product - properties: - additives_n: - type: integer - description: | - Number of food additives. - checked: - type: string - complete: - type: integer - completeness: - type: number - ecoscore_grade: - type: string - description: | - See also: `ecoscore_tags` - ecoscore_score: - type: integer - description: | - See also: `ecoscore_tags` - food_groups: - type: string - food_groups_tags: - type: array - items: - type: string - nutrient_levels: - description: > - Traffic light indicators on main nutrients - levels - type: object - properties: - fat: - type: string - enum: - - low - - moderate - - high - salt: - type: string - enum: - - low - - moderate - - high - saturated-fat: - type: string - enum: - - low - - moderate - - high - sugars: - type: string - enum: - - low - - moderate - - high - packaging_text: - type: string - description: | - Recycling instructions as raw text, e.g. Plastic - bottle to recycle, Plastic cap to recycle. - This will get automatically parsed and - will be used to compute the Eco-Score. - You can either request it (if it exists) or - send it in a specific language. - example: packaging_text_en - packagings: - type: array - x-stoplight: - id: 1cyz4qo9njog7 - title: Packagings (READ) - description: >- - The packagings object is an array of individual - packaging component objects. - - - The Packaging data document explains how - packaging data is structured in Open Food Facts: - https://openfoodfacts.github.io/openfoodfacts-server/dev/explain-packaging-data/ - - - The shape, material and recycling properties of - each packaging component are linked to entries - in the packaging_shapes, packaging_materials and - packaging_recycling taxonomies: - - - https://world.openfoodfacts.org/data/taxonomies/packaging_shapes.json - - https://world.openfoodfacts.org/data/taxonomies/packaging_materials.json - - https://world.openfoodfacts.org/data/taxonomies/packaging_recycling.json - - - If the tags_lc field is set, the properties will - include a lc_name field with the translation in - the requested language. - examples: - - - number_of_units: 6 - shape: - id: 'en:bottle' - lc_name: bouteille - material: - id: 'en:bottle' - lc_name: bouteille - recycling: - id: 'en:bottle' - lc_name: bouteille - quantity_per_unit: 25 cl - quantity_per_unit_value: 25 - quantity_per_unit_unit: cl - weight_specified: 30 - weight_measured: 32 - weight_estimated: 26 - weight: 30 - weight_source_id: specified - items: - description: >- - Each packaging component has different - properties to specify how many there are, its - shape, material etc. - - - The shape, material and recycling properties - are mapped to one entry in the - packaging_shapes, packaging_materials and - packaging_recycling taxonomies, and the value - of the property is the canonical name of the - taxonomy entry (e.g. en:bottle). - - - They may contain values that could not yet get - matched to their respective taxonomy, in which - case they will contain a free text value - prefixed with the language code of this text - value (e.g. "fr:Bouteille sphérique" might - have been entered by a French user to indicate - it is a spherical bottle). - title: Packaging component (READ) - type: object - examples: - - number_of_units: 6 - shape: - id: 'en:bottle' - lc_name: bouteille - material: - id: 'en:bottle' - lc_name: bouteille - recycling: - id: 'en:bottle' - lc_name: bouteille - quantity_per_unit: 25 cl - quantity_per_unit_value: 25 - quantity_per_unit_unit: cl - weight_specified: 30 - weight_measured: 32 - weight_estimated: 26 - weight: 30 - weight_source_id: specified - properties: - number_of_units: - type: integer - description: >- - umber of units of this packaging component - contained in the product (e.g. 6 for a - pack of 6 bottles) - shape: - title: Packaging component shape - x-stoplight: - id: xrj8agza3dwgf - type: object - description: >- - The shape property is canonicalized using - the packaging_shapes taxonomy. - examples: - - id: 'en:bottle' - lc_name: bouteille - properties: - id: - type: string - description: >- - Canonical id of the entry in the - taxonomy. If the value cannot be mapped - to a taxonomy entry, the value will be - the name of the entry in its original - language prefixed by the language 2 - letter code and a colon. - lc_name: - type: string - description: >- - Name of the entry in the language - requested in the tags_lc field of the - request. This field is returned only of - tags_lc is specified. If the translation - is not available, or if the entry does - not exist in the taxonomy, the value - will be the name of the entry in its - original language prefixed by the - language 2 letter code and a colon. - material: - title: Packaging component material - x-stoplight: - id: n6umazgqmwrd5 - type: object - description: >- - The material property is canonicalized - using the packaging_materials taxonomy. - examples: - - id: 'en:bottle' - lc_name: bouteille - properties: - id: - type: string - description: >- - Canonical id of the entry in the - taxonomy. If the value cannot be mapped - to a taxonomy entry, the value will be - the name of the entry in its original - language prefixed by the language 2 - letter code and a colon. - lc_name: - type: string - description: >- - Name of the entry in the language - requested in the tags_lc field of the - request. This field is returned only of - tags_lc is specified. If the translation - is not available, or if the entry does - not exist in the taxonomy, the value - will be the name of the entry in its - original language prefixed by the - language 2 letter code and a colon. - recycling: - title: Packaging component recycling instruction - x-stoplight: - id: 376tk8e2cmyh2 - type: object - description: >- - The recycling property is canonicalized - using the packaging_recycling taxonomy. - examples: - - id: 'en:bottle' - lc_name: bouteille - properties: - id: - type: string - description: >- - Canonical id of the entry in the - taxonomy. If the value cannot be mapped - to a taxonomy entry, the value will be - the name of the entry in its original - language prefixed by the language 2 - letter code and a colon. - lc_name: - type: string - description: >- - Name of the entry in the language - requested in the tags_lc field of the - request. This field is returned only of - tags_lc is specified. If the translation - is not available, or if the entry does - not exist in the taxonomy, the value - will be the name of the entry in its - original language prefixed by the - language 2 letter code and a colon. - quantity_per_unit: - type: string - description: >- - Quantity (weight or volume) of food - product contained in the packaging - component. (e.g. 75cl for a wine bottle) - quantity_per_unit_value: - type: number - description: Value parsed from the quantity field. - quantity_per_unit_unit: - type: string - description: >- - Unit parsed and normalized from the - quantity field. - weight_specified: - type: number - description: >- - Weight (as specified by the manufacturer) - of one unit of the empty packaging - component (in grams). (e.g. for a 6 pack - of 1.5l water bottles, it might be 30, the - weight in grams of 1 empty water bottle - without its cap which is a different - packaging component). - weight_measured: - type: number - description: >- - Weight (as measured by one or more users) - of one unit of the empty packaging - component (in grams). (e.g. for a 6 pack - of 1.5l water bottles, it might be 30, the - weight in grams of 1 empty water bottle - without its cap which is a different - packaging component). - weight_estimated: - type: number - description: >- - Weight (as estimated from similar - products) of one unit of the empty - packaging component (in grams). (e.g. for - a 6 pack of 1.5l water bottles, it might - be 30, the weight in grams of 1 empty - water bottle without its cap which is a - different packaging component). - weight: - type: number - description: >- - Weight of one unit of the empty packaging - component. - weight_source_id: - type: string - description: >- - Indicates which field was used to populate - the "weight" field. Either "specified", - "measured", or "estimated" - readOnly: true - packagings_complete: - title: packagings_complete - x-stoplight: - id: hxnnsy954q1ey - type: integer - minimum: 0 - maximum: 1 - description: >- - Indicate if the packagings array contains all - the packaging parts of the product. This field - can be set by users when they enter or verify - packaging data. Possible values are 0 or 1. - pnns_groups_1: - description: > - Category of food according to [French Nutrition - and Health - Program](https://fr.wikipedia.org/wiki/Programme_national_nutrition_sant%C3%A9) - type: string - pnns_groups_1_tags: - type: array - items: - type: string - pnns_groups_2: - description: > - Sub Category of food according to [French - Nutrition and Health - Program](https://fr.wikipedia.org/wiki/Programme_national_nutrition_sant%C3%A9) - type: string - pnns_groups_2_tags: - type: array - items: - type: string - popularity_key: - description: > - An imprecise measurement of popularity based on - Scan statistics. A higher value means higher - popularity. - type: integer - popularity_tags: - description: > - Indicators for the popularity of a product, like - the amount of scans in a specific year. - type: array - items: - type: string - scans_n: - type: integer - unique_scans_n: - type: integer - serving_quantity: - type: string - description: > - Normalized version of serving_size. - - Note that this is NOT the number of servings by - product. - - (in perl, see - `normalize_serving_size`) - serving_quantity_unit: - type: string - description: > - The unit (either g or ml) for the correponding - serving_quantity. - example: g - serving_size: - type: string - description: > - Serving size text (generally in g or ml). - - We expect a quantity + unit but the user is free - to input any string. - patternProperties: - food_groups_(?\w\w): - type: string - description: see `food_groups` - packaging_text_(?\w\w): - type: string - description: > - Packaging text in language designated by - `language_code` - - type: object - description: | - Data about a product which is represented as tags - properties: - brands: - type: string - description: List of brands (not taxonomized) - brands_tags: - type: array - items: - type: string - description: 'List of brands (tags, not taxonomized)' - categories: - type: string - categories_hierarchy: - type: array - items: - type: string - categories_lc: - type: string - description: Categories language code - categories_tags: - type: array - items: - type: string - checkers_tags: - type: array - items: - type: string - description: >- - List of checkers (users who checked the - product) tags - cities: - type: string - cities_tags: - type: array - items: - type: object - correctors_tags: - type: array - items: - type: string - countries: - type: string - description: | - List of countries where the product is sold. - countries_hierarchy: - type: array - items: - type: string - countries_lc: - type: string - description: Countries language code - countries_tags: - type: array - items: - type: string - ecoscore_tags: - description: > - All ecoscore of a product. - - Most of the time it's only one value, - - but it might eventually be more for products - composed of sub-products. - - See also: `ecoscore_score`, `ecoscore_grade`. - type: array - items: - type: string - emb_codes: - type: string - description: > - Packager code. EMB is the French system of - traceability codes for packager. - example: EMB 2013330 - emb_codes_orig: - type: string - emb_codes_tags: - type: array - items: - type: object - labels: - type: string - labels_hierarchy: - type: array - items: - type: string - labels_lc: - type: string - labels_tags: - type: array - items: - type: string - entry_dates_tags: - description: > - The data as a series of tag: `yyyy-mm-dd`, - `yyyy-mm`, `yyyy` - type: array - items: - type: string - example: - - '2016-03-11' - - 2016-03 - - '2016' - manufacturing_places: - type: string - description: > - Places where the product was manufactured or - transformed. - manufacturing_places_tags: - type: array - items: - type: object - nova_groups_tags: - type: array - items: - type: string - nutrient_levels_tags: - type: array - items: - type: string - - type: object - description: > - Information about Images of a product. - - - Images ensure the reliability of Open Food Facts - data. - - It provides a primary source and proof of all the - structured data. - - You may therefore want to display it along the - structured information. - - - See also tutorials about images: - - * [Getting - images](https://openfoodfacts.github.io/openfoodfacts-server/api/how-to-download-images/) - - * [Uploading - images](https://openfoodfacts.github.io/openfoodfacts-server/api/tutorial-uploading-photo-to-a-product/) - properties: - images: - description: > - This contains properties for all images - contained on the product. - type: object - properties: - '1': - type: object - description: > - This object represent an image that was - uploaded to a product. - - "imgid" is an integer which is a sequential - number unique to each picture. - properties: - sizes: - type: object - description: > - The available image sizes for the - product (both reduced and full). - - The reduced images are the ones with - numbers as the key( 100, 200 etc) - - while the full images have `full` as the - key. - properties: - full: - description: | - properties of fullsize image - **TODO** explain how to compute name - type: object - properties: - h: - type: integer - example: 400 - description: > - The height of the reduced/full image in - pixels. - w: - type: integer - example: 255 - description: >- - The width of the reduced/full image in - pixels. - patternProperties: - (?100|400): - description: > - properties of thumbnail of size - `image_size`. - - **TODO** explain how to compute name - - - For real type: see description of - property `full`. - - (Put this way because of a [bug in - rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) - type: string - uploaded_t: - type: string - example: '1457680652' - description: > - The time the image was uploaded (as unix - timestamp). - uploader: - type: string - example: openfoodfacts-contributors - description: | - The contributor that uploaded the image. - front: - description: > - property of an image (or part thereof) - selected for a particular role and a - particular language. - type: object - properties: - angle: - type: integer - example: 0 - description: >- - The angle of the image rotation (if it - was rotated). - coordinates_image_size: - type: string - example: full - geometry: - type: string - example: 0x0--1--1 - imgid: - type: string - example: '121' - description: >- - The id of the original/source image that - was selected to edit(rotate, normalize - etc) to produce this new image. - normalize: - type: 'null' - example: null - description: Normalize colors. - rev: - type: string - example: '420' - sizes: - type: object - description: > - The available image sizes for the - product (both reduced and full). - - The reduced images are the ones with - numbers as the key( 100, 200 etc) - - while the full images have `full` as the - key. - properties: - '100': - type: object - properties: - h: - type: integer - example: 400 - description: > - The height of the reduced/full image in - pixels. - w: - type: integer - example: 255 - description: >- - The width of the reduced/full image in - pixels. - '200': - type: object - properties: - h: - type: integer - example: 400 - description: > - The height of the reduced/full image in - pixels. - w: - type: integer - example: 255 - description: >- - The width of the reduced/full image in - pixels. - '400': - type: object - properties: - h: - type: integer - example: 400 - description: > - The height of the reduced/full image in - pixels. - w: - type: integer - example: 255 - description: >- - The width of the reduced/full image in - pixels. - full: - type: object - properties: - h: - type: integer - example: 400 - description: > - The height of the reduced/full image in - pixels. - w: - type: integer - example: 255 - description: >- - The width of the reduced/full image in - pixels. - white_magic: - type: 'null' - example: null - description: > - Photo on white background : Try to - remove the background. - x1: - type: string - example: '-1' - x2: - type: string - example: '-1' - y1: - type: string - example: '-1' - y2: - type: string - example: '-1' - patternProperties: - (?\d+): - description: > - See property `1` to get the real type of - those objects - - (Put this way because of a [bug in - rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) - type: string - (?front|nutrition|ingredients|packaging|other)_(?\w\w): - description: > - See property `front` to get the real type of - those objects - - (Put this way because of a [bug in - rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) - type: string - last_image_dates_tags: - type: array - items: - type: string - last_image_t: - description: timestamp of last image upload (or update?) - type: integer - selected_images: - type: object - description: > - URL for selected (important) images of the - product. - - - This is very handy if you display the product to - users. - properties: - front: - type: object - description: >- - URLs of thumbnails image of image of type - `image_type` - properties: - display: - description: > - Thumbnail urls of product image (front) - adapted to display on product page - type: object - patternProperties: - (?\w\w): - type: string - description: >- - url of the image for language - `language_code` - small: - description: > - Thumbnail urls of product image (front) - adapted to display on product list page - type: object - patternProperties: - (?\w\w): - type: string - description: >- - url of the image for language - `language_code` - thumb: - description: > - Thumbnail urls of product image (front) - in smallest format - type: object - patternProperties: - (?\w\w): - type: string - description: >- - url of the image for language - `language_code` - patternProperties: - (?front|packaging|ingredients|nutrition|other): - description: > - See property `front` to get the real type of - those objects - - (Put this way because of a [bug in - rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) - type: string - image_small_url: - type: string - image_thumb_url: - type: string - image_url: - type: string - patternProperties: - image(_(?front|packaging|ingredients|nutrition|other))?(_(?small|thumb))?_url: - description: > - the URL of image of type `image_type` in size - `image_size` (or full size if not given). - - - The `image_type` tells which image the url - correspond to. `image_type` is `front` if not - provided. - - - The image is the one for current language - (affected by `lc` parameter) if an image - exists for this language, the image in main - product language otherwise. - - - **IMPORTANT:** you should use - `selected_images` field instead of this one. - type: string - - type: object - description: > - Fields related to Eco-Score for a product. - - - See also: `ecoscore_score`, `ecoscore_grade` and - `ecoscore_tags`. - properties: - ecoscore_data: - type: object - description: > - An object about a lot of details about data - needed for Eco-Score computation - - and complementary data of interest. - properties: - adjustments: - type: object - properties: - origins_of_ingredients: - type: object - properties: - aggregated_origins: - type: array - items: - type: object - properties: - origin: - type: string - percent: - type: integer - epi_score: - type: integer - epi_value: - type: integer - origins_from_origins_field: - type: array - items: - type: string - transportation_scores: - type: object - patternProperties: - (?\w\w): - type: integer - transportation_values: - type: object - patternProperties: - (?\w\w): - type: integer - values: - type: object - patternProperties: - (?\w\w): - type: integer - warning: - type: string - packaging: - type: object - properties: - non_recyclable_and_non_biodegradable_materials: - type: integer - packagings: - type: array - items: - type: object - properties: - ecoscore_material_score: - type: integer - ecoscore_shape_ratio: - type: integer - material: - type: string - shape: - type: string - score: - type: integer - value: - type: integer - warning: - type: string - production_system: - type: object - properties: - labels: - type: array - example: 'vegan, fat free, Kosher' - items: - type: string - value: - type: integer - warning: - type: string - threatened_species: - type: object - properties: - ingredient: - type: string - value: - type: integer - agribalyse: - type: object - properties: - agribalyse_food_code: - type: string - co2_agriculture: - type: number - co2_consumption: - type: integer - co2_distribution: - type: number - co2_packaging: - type: number - co2_processing: - type: number - co2_total: - type: number - co2_transportation: - type: number - code: - type: string - dqr: - type: string - ef_agriculture: - type: number - ef_consumption: - type: integer - ef_distribution: - type: number - ef_packaging: - type: number - ef_processing: - type: number - ef_total: - type: number - ef_transportation: - type: number - is_beverage: - type: integer - name_en: - type: string - description: > - This can be returned in many other - languages - - like name_fr (for french). - score: - type: integer - version: - type: string - grade: - type: string - grades: - type: object - patternProperties: - (?\w\w): - type: string - missing: - type: object - properties: - labels: - type: integer - origins: - type: integer - packagings: - type: integer - missing_data_warning: - type: integer - previous_data: - type: object - properties: - grade: - type: string - score: - type: integer - agribalyse: - type: object - properties: - agribalyse_food_code: - type: string - co2_agriculture: - type: number - co2_consumption: - type: integer - co2_distribution: - type: number - co2_packaging: - type: number - co2_processing: - type: number - co2_total: - type: number - co2_transportation: - type: number - code: - type: string - dqr: - type: string - ef_agriculture: - type: number - ef_consumption: - type: integer - ef_distribution: - type: number - ef_packaging: - type: number - ef_processing: - type: number - ef_total: - type: number - ef_transportation: - type: number - is_beverage: - type: integer - name_en: - type: string - description: > - This can be returned in many other - languages - - like name_fr (for french). - score: - type: integer - version: - type: string - score: - type: integer - scores: - type: object - patternProperties: - (?\w\w): - type: integer - status: - type: string - ecoscore_extended_data_version: - type: string - environment_impact_level: - type: string - environment_impact_level_tags: - type: array - items: - type: object - - type: object - description: Fields about ingredients of a product - properties: - additives_tags: - type: array - items: - type: string - allergens: - type: string - description: comma separated list of allergens - allergens_lc: - type: string - description: language in which `allergens` where input - allergens_hierarchy: - type: array - items: - type: string - allergens_tags: - type: array - items: - type: string - ingredients: - type: array - description: > - This structure gives the different ingredients - and some information about them, - - like estimate on their quantity. - items: - type: object - properties: - id: - type: string - ingredients: - description: > - Sub ingredients composing this - ingredients. - $ref: '#' - percent: - type: integer - percent_estimate: - type: - - number - percent_max: - type: - - number - percent_min: - type: integer - text: - type: string - vegan: - type: string - vegetarian: - type: string - ingredients_analysis: - type: object - properties: - 'en:palm-oil': - type: array - items: - type: string - 'en:vegan-status-unknown': - type: array - items: - type: string - 'en:vegetarian-status-unknown': - type: array - items: - type: string - ingredients_analysis_tags: - type: array - items: - type: string - ingredients_from_or_that_may_be_from_palm_oil_n: - type: integer - ingredients_from_palm_oil_n: - type: integer - ingredients_from_palm_oil_tags: - type: array - items: - type: object - ingredients_hierarchy: - type: array - items: - type: string - ingredients_n: - type: integer - ingredients_n_tags: - type: array - items: - type: string - ingredients_original_tags: - type: array - items: - type: string - ingredients_percent_analysis: - type: integer - ingredients_sweeteners_n: - type: integer - description: > - Number of sweeteners additives in the - ingredients. Undefined if ingredients are not - specified. - ingredients_non_nutritive_sweeteners_n: - type: integer - description: > - Number of non-nutritive sweeteners additives (as - specified in the Nutri-Score formula) in the - ingredients. Undefined if ingredients are not - specified. - ingredients_tags: - type: array - items: - type: string - ingredients_lc: - type: string - description: > - Language that was used to parse the ingredient - list. If `ingredients_text` is available - - for the product main language (`lang`), - `ingredients_lc=lang`, otherwise we look at - - `ingredients_text` fields for other languages - and set `ingredients_lc` to the first - - non-empty `ingredient_text`. - ingredients_text: - type: string - description: > - Raw list of ingredients. This will get - automatically - - parsed and get used to compute the Eco-Score or - find allergens, etc.. - - - It's a copy of ingredients_text in the main - language of the product (see `lang` proprety). - example: > - Farine de blé* 67,4%, sucre de canne*, huile de - tournesol oléique*, graines de chia* 5,2%, son - de blé*, oranges déshydratées * 0,9%, farine de - riz*, poudres à lever (acide citrique, - carbonates de sodium), arôme naturel d'orange. - ingredients_text_with_allergens: - type: string - description: > - Same text as `ingredients_text` but where - allergens have HTML elements around them to - identify them - example: > - Farine de blé* - 67,4%, sucre de canne*, huile de tournesol - oléique*, graines de chia* 5,2%, son de blé*, oranges - déshydratées * 0,9%, farine de riz*, poudres à - lever (acide citrique, carbonates de sodium), - arôme naturel d'orange. - ingredients_that_may_be_from_palm_oil_n: - type: integer - ingredients_that_may_be_from_palm_oil_tags: - type: array - items: - type: object - ingredients_with_specified_percent_n: - type: integer - ingredients_with_specified_percent_sum: - type: integer - ingredients_with_unspecified_percent_n: - type: integer - ingredients_with_unspecified_percent_sum: - type: integer - known_ingredients_n: - type: integer - origins: - type: string - description: | - Origins of ingredients - origins_hierarchy: - type: array - items: - type: object - origins_lc: - type: string - origins_tags: - type: array - items: - type: object - traces: - type: string - description: | - List of substances that might cause allergies - that are present in trace amounts in the product - (this does not include the ingredients, as they - are not only present in trace amounts). - It is taxonomized with the allergens taxonomy. - traces_hierarchy: - type: array - items: - type: object - traces_lc: - type: string - traces_tags: - type: array - items: - type: object - unknown_ingredients_n: - type: integer - patternProperties: - ingredients_text_(?\w\w): - type: string - description: > - Raw list of ingredients in language given by - 'language_code'. - - - See `ingredients_text` - ingredients_text_with_allergens_(?\w\w): - description: > - Like `ingredients_text_with_allergens` for a - particular language - type: string - - type: object - description: > - Nutrition fields of a product - - - Most of these properties are read-only. - - - See [how to add nutrition - data](https://openfoodfacts.github.io/openfoodfacts-server/api/ref-cheatsheet/#add-nutrition-facts-values-units-and-base) - properties: - no_nutrition_data: - type: string - description: > - When a product does not have nutrition data - displayed on the - - packaging, the user can check the field - "Nutrition facts are - - not specified on the product". - - By doing so, the no_nutrition_data field takes - the value "on". - - This case is frequent (thousands of products). - example: 'on' - nutrition_data_per: - type: string - enum: - - serving - - 100g - description: > - The nutrition data on the package can be per - serving or per 100g. - - - This is essential to understand if - `_value` and `` - - values in `nutriments` applies for a serving or - for 100g. - - - **IMPORTANT:** - - When writing products, - - this setting applies to all existing nutrients - values for the product, - - not only the nutrient values sent in the write - request. - - So it should not be changed unless all nutrients - values are provided - - with values that match the nutrition_data_per - field. - nutrition_data_prepared_per: - type: string - enum: - - serving - - 100g - description: > - The nutrition data for prepared product on the - package (if any) can be per serving or per 100g. - - - This is essential to understand if - `_prepared_value` and - `_prepared` - - values in `nutriments` applies for a serving or - for 100g. - - - See also important note on `nutrition_data_per`. - nutriments: - type: object - description: > - All known nutrients for the product. - - - Note that each nutrients are declined with a - variety of suffixes like `_100g`, `_serving`, - - see patternProperties below. - - - A specific `_unit` is the unit used to measure - the nutrient. - - - Beware that some properties are to be - interpreted based upon `nutrition_data_per` - value. - - - Also for products that have a nutrition table - for prepared product - - (eg. the nutrition facts for a bowl of milk with - cocoa powder), - - a `_prepared` suffix is added (before other - suffixes). - - - You can get all possible nutrients from the - - [nutrients - taxonomy](https://static.openfoodfacts.org/data/taxonomies/nutrients.json) - - - **FIXME** add more nutrients with description. - properties: - alcohol: - description: > - Quantity of alcohol - - - (per 100g or per serving) in a standard unit - (g or ml) - type: number - carbohydrates: - type: number - energy: - type: number - description: > - It is the same as `energy-kj` if we have it, - or computed from `energy-kcal` otherwise - - - (per 100g or per serving) in kj - energy_value: - type: number - description: > - energy_value will be equal to - energy-kj_value if we have it or to - energy-kcal_value otherwise - energy_unit: - type: string - enum: - - kcal - - kj - description: > - Equal to energy-kj_unit if we have it or to - energy-kcal_unit otherwise - energy-kcal: - type: number - description: > - energy in kcal, if it is specified - - - (per 100g or per serving) in a standard unit - (g or ml) - energy-kj: - type: number - description: > - energy in kj, if it is specified - - - (per 100g or per serving) in a standard unit - (g or ml) - fat: - type: number - fruits-vegetables-legumes-estimate-from-ingredients: - type: number - description: > - An estimate, from the ingredients list of - the percentage of fruits, vegetable and - legumes. - - This is an important information for - Nutri-Score (2023 version) computation. - fruits-vegetables-nuts-estimate-from-ingredients: - type: number - description: > - An estimate, from the ingredients list of - the percentage of fruits, vegetable and - nuts. - - This is an important information for - Nutri-Score (2021 version) computation. - nova-group: - type: integer - nutrition-score-fr: - description: > - Experimental nutrition score derived from - - the UK FSA score and adapted for the French - market - - (formula defined by the team of Professor - Hercberg). - proteins: - type: number - salt: - type: number - saturated-fat: - type: number - sodium: - type: number - sugars: - type: number - carbon-footprint-from-known-ingredients_product: - type: integer - carbon-footprint-from-known-ingredients_serving: - type: number - erythritol: - type: number - description: > - erythritol is a polyol which is not - providing any energy. - - As such, it needs not be taken into account - when computing - - the energy of a product. Eryhtritol is now - displayed on - - nutrition facts sheet of some products, - mainly in the USA. - - This value is entered either by - contributors, either by - - imports. - example: 12.5 - patternProperties: - '(?[\w-]+)_unit': - description: "The unit in which the nutrient for 100g or per serving is measured.\n\nThe possible values depends on the nutrient.\n\n* `g` for grams\n* `mg` for milligrams\n* `μg` for micrograms\n* `cl` for centiliters\n* `ml` for mililiters\n* `dv` for recommended daily intakes (aka [Dietary Reference Intake](https://en.wikipedia.org/wiki/Dietary_Reference_Intake))\n* `% vol` for alcohol vol per 100 ml\n\n\U0001F913 code: see the [Units module][units-module],\nand [Food:default_unit_for_nid function][default-unit]\n\n[units-module]: https://openfoodfacts.github.io/openfoodfacts-server/dev/ref-perl-pod/ProductOpener/Units.html\n[default-unit]: https://openfoodfacts.github.io/openfoodfacts-server/dev/ref-perl-pod/ProductOpener/Food.html#default_unit_for_nid_(_%24nid)\n" - type: string - enum: - - 公斤 - - 公升 - - kg - - кг - - l - - л - - 毫克 - - mg - - мг - - mcg - - µg - - oz - - fl oz - - dl - - дл - - cl - - кл - - 斤 - - g - - '' - - ' ' - - kj - - 克 - - 公克 - - г - - мл - - ml - - mmol/l - - 毫升 - - '% vol' - - ph - - '%' - - '% dv' - - '% vol (alcohol)' - - iu - - mol/l - - mval/l - - ppm - - �rh - - �fh - - �e - - �dh - - gpg - '(?[\w-]+)_100g': - description: > - The standardized value of a serving of 100g - (or 100ml for liquids) - - for the nutrient. - - - This is computed from the `nutrient` - property, - - the serving size (if needed), and the - `nutrient`_unit field. - - - **Note**: - - If you want to characterize products in a - uniform way, this is the value you should - use. - type: number - readOnly: true - '(?[\w-]+)_serving': - description: > - The standardized value of a serving for this - product. - type: number - readOnly: true - '(?[\w-]+)_value': - description: > - The value input by the user / displayed on - the product for the nutrient. - - - * per 100g or serving, depending on - `nutrition_data_per` - - * in the unit of corresponding - _unit field. - type: number - readOnly: true - '(?[\w-]+)_prepared': - description: > - The value for nutrient for **prepared** - product. - type: number - '(?[\w-]+)_prepared_unit': - description: > - The unit in which the nutrient of - **prepared** product is measured. - type: string - '(?[\w-]+)_prepared_100g': - description: > - The standardized value of a serving of 100g - (or 100ml for liquids) - - for the nutrient, for **prepared** product. - type: number - readOnly: true - '(?[\w-]+)_prepared_serving': - description: > - The standardized value of a serving for the - **prepared** product. - type: number - readOnly: true - '(?[\w-]+)_prepared_value': - description: > - The standardized value for a serving or 100g - (or 100ml for liquids), - - depending on `nutrition_data_prepared_per` - - for the nutrient for **prepared** product. - type: number - readOnly: true - nutriscore_data: - description: > - Detail of data the Nutri-Score was computed - upon. - - - **Note**: this might not be stable, don't rely - too much on this, or, at least, tell us ! - - - **TODO** document each property - type: object - properties: - energy: - type: integer - energy_points: - type: integer - energy_value: - type: integer - fiber: - type: integer - fiber_points: - type: integer - fiber_value: - type: integer - fruits_vegetables_nuts_colza_walnut_olive_oils: - type: integer - fruits_vegetables_nuts_colza_walnut_olive_oils_points: - type: integer - fruits_vegetables_nuts_colza_walnut_olive_oils_value: - type: integer - grade: - type: string - is_beverage: - type: integer - is_cheese: - type: integer - is_fat: - type: integer - is_water: - type: integer - negative_points: - type: integer - positive_points: - type: integer - proteins: - type: number - proteins_points: - type: integer - proteins_value: - type: number - saturated_fat: - type: number - saturated_fat_points: - type: integer - saturated_fat_ratio: - type: number - saturated_fat_ratio_points: - type: integer - saturated_fat_ratio_value: - type: number - saturated_fat_value: - type: number - score: - type: integer - sodium: - type: number - sodium_points: - type: integer - sodium_value: - type: number - sugars: - type: number - sugars_points: - type: integer - sugars_value: - type: number - nutriscore_grade: - description: | - Nutri-Score for the product as a letter. - - See https://world.openfoodfacts.org/nutriscore. - type: string - enum: - - a - - b - - c - - d - - e - nutriscore_score: - description: > - Nutri-Score for the product as an integer (see - also `nutriscore_grade`). - type: integer - nutriscore_score_opposite: - type: integer - nutrition_grade_fr: - type: string - description: | - Nutrition grade (‘a’ to ‘e’), - https://world.openfoodfacts.org/nutriscore. - nutrition_grades: - description: > - Nutrition grades as a comma separated list. - - - Some products with multiple components might - have multiple Nutri-Score - type: string - nutrition_grades_tags: - type: array - items: - type: string - nutrition_score_beverage: - type: integer - nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients: - type: integer - nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients_value: - type: integer - nutrition_score_warning_no_fiber: - type: integer - other_nutritional_substances_tags: - type: array - items: - type: object - unknown_nutrients_tags: - type: array - items: - type: object - vitamins_tags: - type: array - items: - type: object - - type: object - description: | - This is data that is linked to products data quality - properties: - data_quality_bugs_tags: - type: array - items: - type: object - data_quality_errors_tags: - type: array - items: - type: object - data_quality_info_tags: - type: array - items: - type: string - data_quality_tags: - type: array - items: - type: string - data_quality_warnings_tags: - type: array - items: - type: string - data_sources: - type: string - description: | - Source of data imported from producers. - data_sources_tags: - type: array - items: - type: string - last_check_dates_tags: - type: array - items: - type: string - last_checked_t: - type: integer - last_checker: - type: string - states: - description: > - comma separated list of values indicating some - states of the product, - - like things to be done, or to be completed. - - See [states - taxonomy](https://static.openfoodfacts.net/data/taxonomies/states.json) - type: string - states_hierarchy: - type: array - items: - type: string - states_tags: - type: array - items: - description: > - Each state describe something that is - completed or is to be done or improved on the - product. - - - Refer to [states - taxonomy](https://static.openfoodfacts.net/data/taxonomies/states.json) - type: string - misc_tags: - description: > - Information about different aspect of the - product - type: array - items: - type: string - - type: object - properties: - additives_original_tags: - type: array - items: - type: string - additives_prev_original_tags: - type: array - items: - type: string - added_countries_tags: - type: array - items: - type: object - allergens_from_ingredients: - type: string - allergens_from_user: - type: string - amino_acids_prev_tags: - type: array - items: - type: object - amino_acids_tags: - type: array - items: - type: object - carbon_footprint_percent_of_known_ingredients: - type: integer - categories_properties: - type: object - properties: - 'agribalyse_food_code:en': - type: string - 'agribalyse_proxy_food_code:en': - type: string - 'ciqual_food_code:en': - type: string - categories_properties_tags: - type: array - items: - type: string - category_properties: - type: object - additionalProperties: - description: >- - those are properties taken from the category - taxonomy - type: string - ciqual_food_name_tags: - type: array - items: - type: string - compared_to_category: - type: string - description: | - the category to use for comparison. - - **TODO** explain how it is chosen. - conservation_conditions: - type: string - customer_service: - type: string - description: | - Contact info of customer service. - expiration_date: - type: string - link: - type: string - description: > - link to the product on the website of the - producer - main_countries_tags: - type: array - items: - type: object - minerals_prev_tags: - type: array - items: - type: object - minerals_tags: - type: array - items: - type: object - owner_fields: - type: object - description: > - Those are fields provided by the producer - (through producers platform), - - and the value he provided. - properties: - additionalProperties: - description: > - you can retrieve all kind of properties, the - same as on the parent object (the product). - - It's not processed entries (like tags for - example) but raw ones. - oneOf: - - type: integer - - type: string - - type: object - nova_groups_markers: - type: object - description: > - Detail of ingredients or processing that makes - the products having Nova 3 or 4 - properties: - '3': - description: | - Markers of level 3 - type: array - items: - type: array - description: > - This array has two element for each - marker. - - One - items: - type: string - '4': - description: | - Markers of level 4 - type: array - items: - $ref: >- - #/properties/nova_groups_markers/properties/3/items - nucleotides_tags: - type: array - items: - type: object - origin: - type: string - purchase_places: - type: string - description: > - Country, state, or city where the product can be - purchased. - example: Paris - purchase_places_tags: - type: array - items: - type: string - stores: - type: string - description: | - Distributor name. - example: Walmart - stores_tags: - type: array - items: - type: string - traces_from_ingredients: - type: string - traces_from_user: - type: string - patternProperties: - conservation_conditions_(?\w\w): - type: string - customer_service_(?\w\w): - type: string - origin_(?\w\w): - type: string - description: > - `origin` in language indicated by - `language_code` - - type: object - description: > - Metadata of a product (author, editors, creation - date, etc.) - properties: - created_t: - type: integer - description: > - Date when the product was added (UNIX timestamp - format). - - See also `entry_dates_tags` - example: | - 1457680652 - creator: - type: string - description: | - The contributor who added the product first. - editors_tags: - description: | - List of editors who edited the product. - type: array - items: - type: string - informers_tags: - type: array - items: - type: string - interface_version_created: - type: string - interface_version_modified: - type: string - languages: - type: object - patternProperties: - 'en:(?\w\w)': - type: integer - description: | - **TODO** explain ! - languages_codes: - type: object - patternProperties: - (?\w\w): - type: integer - description: > - Same as `languages` but by language code, - instead of language tags - languages_hierarchy: - type: array - items: - type: string - languages_tags: - type: array - items: - type: string - last_edit_dates_tags: - type: array - items: - type: string - last_editor: - type: string - last_modified_by: - type: string - description: > - The username of the user who last modified the - product. - example: sebleouf - last_modified_t: - type: integer - description: | - Date when the product page was last modified. - owner: - description: > - Id of the producer in case he provides his own - data about a product (producer platform). - type: string - owners_tags: - description: | - Tagyfied version of owner - type: string - photographers_tags: - type: array - items: - type: string - rev: - description: >- - revision number of this product version (each - edit adds a revision) - type: integer - sources: - type: array - items: - type: object - properties: - fields: - type: array - items: - type: string - id: - type: string - images: - type: array - items: - type: object - import_t: - type: integer - manufacturer: - type: - - integer - - string - name: - type: string - source_licence: - type: string - source_licence_url: - type: string - url: - type: - - 'null' - - string - sources_fields: - type: object - properties: - org-gs1: - type: object - properties: - gln: - type: string - gpcCategoryCode: - type: string - gpcCategoryName: - type: string - isAllergenRelevantDataProvided: - type: string - lastChangeDateTime: - type: string - partyName: - type: string - productionVariantDescription: - type: string - publicationDateTime: - type: string - teams: - type: string - teams_tags: - type: array - items: - type: string - update_key: - type: string - - type: object - description: | - Knowledge panels for a product - properties: - knowledge_panels: - type: object - x-stoplight: - id: bcq3fkbtnwr5t - title: panels - description: >- - The panels object is a dictionary of individual - panel objects. - - Each key of the dictionary is the id of the - panel, and the value is the panel object. - - - Apps typically display a number of root panels - with known panel ids (e.g. health_card and - environment_card). Panels can reference other - panels and display them as sub-panels. - examples: - - additionalProperties: string - properties: - additionalProperties: - title: panel - x-stoplight: - id: mj9nhz3mqn05c - type: object - description: >- - Each panel contains an optional title and an - optional array of elements. - properties: - type: - type: string - description: >- - Type of the panel. If set to "card", the - panel and its sub-panels should be - displayed in a card. If set to "inline", - the panel should have its content always - displayed. - expanded: - type: boolean - description: >- - If true, the panel is to be displayed - already expanded. If false, only the - title should be displayed, and the user - should be able to click or tap it to - open the panel and display the elements. - expand_for: - type: string - description: >- - If set to "large", the content of the - panel should be expanded on large - screens, but it should still be possible - to unexpand it. - evaluation: - type: string - description: >- - A simple assessment of the panel value, - typically used to format fonts, et.c - e.g. bad = red - enum: - - good - - average - - neutral - - bad - - unknown - title_element: - title: title_element - x-stoplight: - id: lox0wvl9bdgy2 - type: object - description: The title of a panel. - properties: - name: - type: string - description: >- - A short name of this panel, not - including any actual values - title: - type: string - type: - type: string - enum: - - grade - - percentage - description: >- - Used to indicate how the value of this - item is measured, such as "grade" for - Nutri-Score and Eco-Score or - "percentage" for Salt - grade: - type: string - description: >- - The value for this panel where it - corresponds to a A to E grade such as - the Nutri-Score of the Eco-Score. - enum: - - a - - b - - c - - d - - e - - unknown - value: - type: number - description: >- - The numeric value of the panel, where - the type is "percentage" - icon_url: - type: string - icon_color_from_evaluation: - type: string - icon_size: - type: string - description: > - If set to "small", the icon should be - displayed at a small size. - elements: - type: array - description: >- - An ordered list of elements to display - in the content of the panel. - items: - title: element - x-stoplight: - id: e2ybdrtmx0tme - type: object - description: > - Each element object contains one - specific element object such as a text - element or an image element. - properties: - type: - element_type: string - enum: - - text - - image - - action - - panel - - panel_group - - table - description: > - The type of the included element object. - - The type also indicates which field - contains the included element object. - - e.g. if the type is "text", the included - element object will be in the - "text_element" field. - - - Note that in the future, new type of - element may be added, - - so your code should ignore unrecognized - types, and unknown properties. - - - TODO: add Map type - text_element: - title: text_element - x-stoplight: - id: vdwxlt73qnqfa - type: object - description: >- - A text in simple HTML format to display. - - - For some specific texts that correspond - to a product field (e.g. a product name, - the ingredients list of a product),the - edit_field_* fields are used to indicate - how to edit the field value. - properties: - type: - type: string - description: > - the type of text, might influence the - way you display it. - enum: - - summary - - warning - - notes - html: - type: string - description: Text to display in HTML format. - language: - type: string - description: >- - Language of the text. The name of the - language is returned in the language - requested when making the API call. e.g. - if the text is in Polish, and the - requested language is French, the - language field will contain "Polonais" - (French for "Polish"). Only set for - specific fields such as the list of - ingredients of a product. - lc: - type: string - description: >- - 2 letter language code for the text. - Only set for specific fields such as the - list of ingredients of a product. - edit_field_id: - type: string - description: >- - id of the field used to edit this text - in the product edit API. - edit_field_type: - type: string - description: Type of the product field. - edit_field_value: - type: string - description: >- - Current value of the product field. This - may differ from the html field which can - contain extra formating. - source_url: - type: string - description: Link to the source - example: >- - https://en.wikipedia.org/wiki/Sodium - acetate - source_text: - type: string - description: name of the source - example: Wikipedia - source_lc: - type: string - description: Source locale name - example: en - source_language: - type: string - description: Human readable source locale name - example: English - image_element: - title: image_element - x-stoplight: - id: k4v4kwt489q3j - type: object - properties: - url: - type: string - description: full URL of the image - width: - type: integer - description: > - Width of the image. - - - This is just a suggestion coming from - the server, - - the client may choose to use its own - dimensions for the image. - height: - type: integer - description: > - Height of the image. - - - This is just a suggestion coming from - the server, - - the client may choose to use its own - dimensions for the image. - alt_text: - type: string - description: Alt Text of the image. - action_element: - type: string - panel_element: - title: panel_element - x-stoplight: - id: ymx41elz4yrnj - type: object - description: >- - Panels can include other panels as - sub-panels using the panel_element. - properties: - panel_id: - type: string - description: >- - The id of the panel to include. The id - is the key of the panel in the panels - object returned in the knowledge_panels - field. - panel_group_element: - title: panel_group_element - x-stoplight: - id: b7emlfrgiuue2 - type: object - properties: - title: - type: string - panel_ids: - type: array - description: >- - The ids of the panels to include. The - ids are the keys of the panels in the - panels object returned in the - knowledge_panels field. - items: - type: string - description: >- - The panel group element is used to - display an optional title followed by a - number of sub-panels. - table_element: - title: table_element - x-stoplight: - id: 38zu3z4sruqo7 - type: object - description: Element to display a table. - properties: - id: - type: string - description: An id for the table. - title: - type: string - description: | - Title of the column. - rows: - type: string - columns: - type: array - items: - type: object - properties: - type: - type: string - text: - type: string - text_for_small_screens: - type: string - style: - type: string - column_group_id: - type: string - shown_by_default: - type: boolean - required: - - type - level: - type: string - description: > - a message level, as levels we use in - log. - - It might help theming the panel visualy - example: info - size: - type: string - enum: - - small - description: > - size is either empty (normal display) - - or small to indicate a panel that should - have a smaller font size - example: small - topics: - type: array - items: - type: string - example: health - readOnly: true - - type: object - description: > - Specific data about a product to enable personal - ranking - properties: - attribute_groups: - type: array - description: >- - Each element is an attribute that can help - compute a personal ranking for the product - items: - type: object - properties: - id: - type: string - description: > - Unique id of the attribute. - - - It will be use to match against - preferences parameters. - status: - type: string - enum: - - known - - unknown - description: >- - wether we have the information to really - compute this criteria or not. - title: - type: string - description: > - A descriptive sentence about the situation - of the product concerning attribute - example: 'Does not contain: Molluscs' - match: - type: number - format: float - minimum: 0 - maximum: 100 - description: > - a numeric value for the match, - - telling how much the products ranks well - for this particular attribute. - - The higher the value, the better the - match. - grade: - description: every attribute as a grade for a to e - type: string - enum: - - unknown - - a - - b - - c - - d - - e - name: - type: string - description: >- - The name of attribute, for eventual - display - icon_url: - type: string - description: >- - an icon representing the attribute match - (often using a color) - description: - type: string - description: >- - An eventual description of the value of - the property upon which this attribute is - based - description_short: - type: string - description: >- - An eventual short description of the value - of the property upon which this attribute - is based - skip: - type: integer - example: 0 + $ref: '#/components/schemas/search_for_products' operationId: get-search - description: > - Search request allows you to get products that match your search - criteria. - - - It allows you create many custom APIs for your use case. + description: "Search request allows you to get products that match your search\ + \ criteria.\n\nIt allows you create many custom APIs for your use case.\n\n\ + If the search query parameter has 2 possible values, they are seperated by\ + \ a comma(,).\nWhen filtering via a parameter that has different language\ + \ codes like `fr`, `de` or `en`, specify the language code in the parameter\ + \ name e.g `categories_tags_en`\n\n**Important:** search API v2 does not support\ + \ full text request (search_term),\nyou have to use [search API v1](https://wiki.openfoodfacts.org/API/Read/Search)\ + \ for that.\nUpcoming [search-a-licious project](https://github.com/openfoodfacts/search-a-licious)\ + \ will fix that.\n\n### Limiting results\n\nYou can limit the size of returned\ + \ objects thanks to the `fields` object (see below).\n\neg: `fields=code,product_name,brands,attribute_groups``\n\ + \nPlease use it as much as possible to avoid overloading the servers.\n\n\ + The search use pagination, see `page` and `page_size` parameters.\n\n**Beware:**\ + \ the `page_count` data in item is a bit counter intuitive\u2026, read the\ + \ description.\n\n### Conditions on tags\n\nAll `_tags`` parameters accepts\ + \ either:\n\n* a single value\n* or a comma-separated list of values (doing\ + \ a AND)\n* or a pipe separated list of values (doing a OR)\n\nYou can exclude\ + \ terms by using a \"-\" prefix.\n\nFor taxonomized entries, you might either\ + \ use the tag id (recommended),\nor a known synonym (without language prefix)\n\ + \n* `labels_tags=en:organic,en:fair-trade` find items that are fair-trade\ + \ AND organic\n* `labels_tags=en:organic|en:fair-trade` find items that are\ + \ fair-trade OR organic\n* `labels_tags=en:organic,en:-fair-trade` find items\ + \ that are organic BUT NOT fair-trade\n\n\n### Conditions on nutriments\n\n\ + To get a list of nutrients\n\nYou can either query on nutrient per 100g (`_100g`\ + \ suffix)\nor per serving (`serving` suffix).\n\nYou can also add `_prepared_`\n\ + to get the nutrients in the prepared product instead of as sold.\n\nYou can\ + \ add a comparison operator and value to the parameter name\nto get products\ + \ with nutrient above or bellow a value.\nIf you use a parameter value it\ + \ exactly match it.\n\n* `energy-kj_100g<200` products where energy in kj\ + \ for 100g is less than 200kj\n* `sugars_serving>10` products where sugar\ + \ per serving is greater than 10g\n* `saturated-fat_100g=1` products where\ + \ saturated fat per 100g is exactly 10g\n* `salt_prepared_serving<0.1` products\ + \ where salt per serving for prepared product is less than 0.1g\n\n### More\ + \ references\n\nSee also [wiki page](https://wiki.openfoodfacts.org/Open_Food_Facts_Search_API_Version_2)\n" + parameters: + - $ref: '#/components/parameters/tags_parameters_properties_additives_tags' + - $ref: '#/components/parameters/tags_parameters_properties_allergens_tags' + - $ref: '#/components/parameters/tags_parameters_properties_brands_tags' + - $ref: '#/components/parameters/tags_parameters_properties_categories_tags' + - $ref: '#/components/parameters/tags_parameters_properties_countries_tags' + - $ref: '#/components/parameters/tags_parameters_properties_emb_codes_tags' + - $ref: '#/components/parameters/tags_parameters_properties_labels_tags' + - $ref: '#/components/parameters/tags_parameters_properties_manufacturing_places_tags' + - $ref: '#/components/parameters/tags_parameters_properties_nutrition_grades_tags' + - $ref: '#/components/parameters/tags_parameters_properties_origins_tags' + - $ref: '#/components/parameters/tags_parameters_properties_packaging_tags' + - $ref: '#/components/parameters/tags_parameters_properties_purchase_places_tags' + - $ref: '#/components/parameters/tags_parameters_properties_states_tags' + - $ref: '#/components/parameters/tags_parameters_properties_stores_tags' + - $ref: '#/components/parameters/tags_parameters_properties_traces_tags' + - $ref: '#/components/parameters/tags_parameters_properties_tag_name_with_language_code' + - $ref: '#/components/parameters/nutrition_search_properties_nutrient_lower_than' + - $ref: '#/components/parameters/nutrition_search_properties_nutrient_greater_than' + - $ref: '#/components/parameters/nutrition_search_properties_nutrient_equal' + - $ref: '#/components/parameters/fields' + - $ref: '#/components/parameters/sort_by' + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/page_size' + parameters: [] + /cgi/suggest.pl: + get: + summary: Get Suggestions to Aid Adding/Editing Products + tags: + - Read Requests + responses: + '200': + description: OK + content: + application/json: + schema: + type: array + operationId: get-cgi-suggest.pl + parameters: + - $ref: '#/components/parameters/tagtype' + - $ref: '#/components/parameters/term' + description: 'For example , Dave is looking for packaging_shapes that contain + the term "fe", + all packaging_shapes containing "fe" will be returned. - If the search query parameter has 2 possible values, they are seperated - by a comma(,). + This is useful if you have a search in your application, - When filtering via a parameter that has different language codes like - `fr`, `de` or `en`, specify the language code in the parameter name e.g - `categories_tags_en` + for a specific product field. + ' + /cgi/nutrients.pl: + get: + summary: Get a nested list of nutrients that can be displayed in the nutrition + facts table for a specific country and language + tags: + - Read Requests + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/get_nutrients' + operationId: get-cgi-nutrients.pl + parameters: + - $ref: '#/components/parameters/cc' + - $ref: '#/components/parameters/lc' + description: 'Used to display the nutrition facts table of a product, or to + display a form to input those nutrition facts. - **Important:** search API v2 does not support full text request - (search_term), + ' + /api/v2/attribute_groups: + get: + summary: Get the list of attributes available for personal search. + description: 'Attributes are at the heart of personal search. - you have to use [search API - v1](https://wiki.openfoodfacts.org/API/Read/Search) for that. + They score the products according to different criterias, - Upcoming [search-a-licious - project](https://github.com/openfoodfacts/search-a-licious) will fix - that. + which could then be matched to a user''s preferences. - ### Limiting results + This API helps you list attributes and display them in your application, + for the user to choose the importance of each criteria. - You can limit the size of returned objects thanks to the `fields` object - (see below). + note: /api/v2/attribute_groups_{lc} is also a valid route, but consider it + deprecated - eg: `fields=code,product_name,brands,attribute_groups`` + ' + tags: + - Read Requests + - Personal search + operationId: get-attribute-groups + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/get_attribute_groups' + parameters: + - $ref: '#/components/parameters/lc' + /api/v2/preferences: + get: + summary: 'Get the weights corresponding to attributes preferences + to compute personal product - Please use it as much as possible to avoid overloading the servers. + ' + tags: + - Read Requests + - Personal search + operationId: get-preferences + parameters: + - $ref: '#/components/parameters/lc' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/get_preferences' +components: + schemas: + Product-Base: + $ref: '#/components/schemas/product_base' + Product-Misc: + $ref: '#/components/schemas/product_misc' + Product-Tags: + $ref: '#/components/schemas/product_tags' + Product-Nutrition: + $ref: '#/components/schemas/product_nutrition' + Product-Ingredients: + $ref: '#/components/schemas/product_ingredients' + Product-Images: + $ref: '#/components/schemas/product_images' + Product-Eco-Score: + $ref: '#/components/schemas/product_ecoscore' + Product-Metadata: + $ref: '#/components/schemas/product_meta' + Product-Data-Quality: + $ref: '#/components/schemas/product_quality' + Product-Knowledge-Panels: + $ref: '#/components/schemas/product_knowledge_panels' + Product-Attribute-Groups: + $ref: '#/components/schemas/product_attribute_groups' + Product: + $ref: '#/components/schemas/product' + get_product_by_barcode_base: + type: object + x-stoplight: + id: s4gz59htj4gc3 + properties: + code: + type: string + description: "Barcode of the product\n(can be EAN-13 or internal codes for\ + \ some food stores).\nFor products without a barcode, Open Food Facts\ + \ assigns a \nnumber starting with the 200 reserved prefix.\n" + status: + type: integer + status_verbose: + type: string + product_base: + type: object + description: 'Base product data + ' + properties: + abbreviated_product_name: + type: string + description: Abbreviated name in requested language + code: + type: string + description: 'barcode of the product (can be EAN-13 or internal codes for + some food stores), - The search use pagination, see `page` and `page_size` parameters. + for products without a barcode, + Open Food Facts assigns a number starting with the 200 reserved prefix - **Beware:** the `page_count` data in item is a bit counter intuitive…, - read the description. + ' + codes_tags: + type: array + items: + type: string + description: 'A value which is the type of barcode "code-13" or "code-8" + and - ### Conditions on tags + A series of mask for the barcode + It helps retrieve barcodes starting by - All `_tags`` parameters accepts either: + ' + example: '["code-13","3017620422xxx","301762042xxxx","30176204xxxxx","3017620xxxxxx","301762xxxxxxx","30176xxxxxxxx","3017xxxxxxxxx","301xxxxxxxxxx","30xxxxxxxxxxx","3xxxxxxxxxxxx"] + ' + generic_name: + type: string + description: 'Legal name of the product as regulated - * a single value + by the European authorities. - * or a comma-separated list of values (doing a AND) + ' + id: + description: 'internal identifier for the product, usually set to the value + of `code`, - * or a pipe separated list of values (doing a OR) + except on the producers platform where it is prefixed by the owner + ' + type: string + lc: + type: string + description: 'Main language of the product. - You can exclude terms by using a "-" prefix. + This is a duplicate of `lang` property (for historical reasons). + ' + lang: + type: string + description: 'Main language of the product. - For taxonomized entries, you might either use the tag id (recommended), - or a known synonym (without language prefix) + This should be the main language of product packaging (if one is predominant). - * `labels_tags=en:organic,en:fair-trade` find items that are fair-trade - AND organic + Main language is also used to decide which ingredients list to parse. - * `labels_tags=en:organic|en:fair-trade` find items that are fair-trade - OR organic + ' + nova_group: + type: integer + description: 'Nova group as an integer from 1 to 4. See https://world.openfoodfacts.org/nova - * `labels_tags=en:organic,en:-fair-trade` find items that are organic - BUT NOT fair-trade + ' + nova_groups: + type: string + obsolete: + type: string + obsolete_since_date: + description: 'A date at which the product was declared obsolete. + This means it''s not produced any more. + ' + type: string + product_name: + type: string + description: 'The name of the product - ### Conditions on nutriments + ' + product_name_en: + type: string + description: 'The name of the product can also + be in many other languages like - To get a list of nutrients + product_name_fr (for French). + ' + product_quantity: + type: string + description: 'The size in g or ml for the whole product. - You can either query on nutrient per 100g (`_100g` suffix) + It''s a normalized version of the quantity field. - or per serving (`serving` suffix). + ' + example: '500' + product_quantity_unit: + type: string + description: 'The unit (either g or ml) for the correponding product_quantity. + ' + example: g + quantity: + type: string + description: 'Quantity and Unit. - You can also add `_prepared_` + ' + abbreviated_product_name_(?\w\w): + type: string + description: Abbreviated name in language `language_code`. + generic_name_(?\w\w): + type: string + description: 'This can be returned in many other languages - to get the nutrients in the prepared product instead of as sold. + like generic_name_fr (for French). + ' + shape: + title: Packaging component shape + x-stoplight: + id: xrj8agza3dwgf + type: object + description: The shape property is canonicalized using the packaging_shapes + taxonomy. + examples: + - id: en:bottle + lc_name: bouteille + properties: + id: + type: string + description: Canonical id of the entry in the taxonomy. If the value cannot + be mapped to a taxonomy entry, the value will be the name of the entry + in its original language prefixed by the language 2 letter code and a + colon. + lc_name: + type: string + description: Name of the entry in the language requested in the tags_lc + field of the request. This field is returned only of tags_lc is specified. + If the translation is not available, or if the entry does not exist in + the taxonomy, the value will be the name of the entry in its original + language prefixed by the language 2 letter code and a colon. + material: + title: Packaging component material + x-stoplight: + id: n6umazgqmwrd5 + type: object + description: The material property is canonicalized using the packaging_materials + taxonomy. + examples: + - id: en:bottle + lc_name: bouteille + properties: + id: + type: string + description: Canonical id of the entry in the taxonomy. If the value cannot + be mapped to a taxonomy entry, the value will be the name of the entry + in its original language prefixed by the language 2 letter code and a + colon. + lc_name: + type: string + description: Name of the entry in the language requested in the tags_lc + field of the request. This field is returned only of tags_lc is specified. + If the translation is not available, or if the entry does not exist in + the taxonomy, the value will be the name of the entry in its original + language prefixed by the language 2 letter code and a colon. + recycling: + title: Packaging component recycling instruction + x-stoplight: + id: 376tk8e2cmyh2 + type: object + description: The recycling property is canonicalized using the packaging_recycling + taxonomy. + examples: + - id: en:bottle + lc_name: bouteille + properties: + id: + type: string + description: Canonical id of the entry in the taxonomy. If the value cannot + be mapped to a taxonomy entry, the value will be the name of the entry + in its original language prefixed by the language 2 letter code and a + colon. + lc_name: + type: string + description: Name of the entry in the language requested in the tags_lc + field of the request. This field is returned only of tags_lc is specified. + If the translation is not available, or if the entry does not exist in + the taxonomy, the value will be the name of the entry in its original + language prefixed by the language 2 letter code and a colon. + packaging_component: + description: "Each packaging component has different properties to specify how\ + \ many there are, its shape, material etc.\n\nThe shape, material and recycling\ + \ properties are mapped to one entry in the packaging_shapes, packaging_materials\ + \ and packaging_recycling taxonomies, and the value of the property is the\ + \ canonical name of the taxonomy entry (e.g. en:bottle).\n\nThey may contain\ + \ values that could not yet get matched to their respective taxonomy, in which\ + \ case they will contain a free text value prefixed with the language code\ + \ of this text value (e.g. \"fr:Bouteille sph\xE9rique\" might have been entered\ + \ by a French user to indicate it is a spherical bottle)." + title: Packaging component (READ) + type: object + examples: + - number_of_units: 6 + shape: + id: en:bottle + lc_name: bouteille + material: + id: en:bottle + lc_name: bouteille + recycling: + id: en:bottle + lc_name: bouteille + quantity_per_unit: 25 cl + quantity_per_unit_value: 25 + quantity_per_unit_unit: cl + weight_specified: 30 + weight_measured: 32 + weight_estimated: 26 + weight: 30 + weight_source_id: specified + properties: + number_of_units: + type: integer + description: umber of units of this packaging component contained in the + product (e.g. 6 for a pack of 6 bottles) + shape: + $ref: '#/components/schemas/shape' + material: + $ref: '#/components/schemas/material' + recycling: + $ref: '#/components/schemas/recycling' + quantity_per_unit: + type: string + description: Quantity (weight or volume) of food product contained in the + packaging component. (e.g. 75cl for a wine bottle) + quantity_per_unit_value: + type: number + description: Value parsed from the quantity field. + quantity_per_unit_unit: + type: string + description: Unit parsed and normalized from the quantity field. + weight_specified: + type: number + description: Weight (as specified by the manufacturer) of one unit of the + empty packaging component (in grams). (e.g. for a 6 pack of 1.5l water + bottles, it might be 30, the weight in grams of 1 empty water bottle without + its cap which is a different packaging component). + weight_measured: + type: number + description: Weight (as measured by one or more users) of one unit of the + empty packaging component (in grams). (e.g. for a 6 pack of 1.5l water + bottles, it might be 30, the weight in grams of 1 empty water bottle without + its cap which is a different packaging component). + weight_estimated: + type: number + description: Weight (as estimated from similar products) of one unit of + the empty packaging component (in grams). (e.g. for a 6 pack of 1.5l water + bottles, it might be 30, the weight in grams of 1 empty water bottle without + its cap which is a different packaging component). + weight: + type: number + description: Weight of one unit of the empty packaging component. + weight_source_id: + type: string + description: Indicates which field was used to populate the "weight" field. + Either "specified", "measured", or "estimated" + packagings: + type: array + x-stoplight: + id: 1cyz4qo9njog7 + title: Packagings (READ) + description: 'The packagings object is an array of individual packaging component + objects. + + + The Packaging data document explains how packaging data is structured in Open + Food Facts: https://openfoodfacts.github.io/openfoodfacts-server/dev/explain-packaging-data/ + + + The shape, material and recycling properties of each packaging component are + linked to entries in the packaging_shapes, packaging_materials and packaging_recycling + taxonomies: + + + https://world.openfoodfacts.org/data/taxonomies/packaging_shapes.json + + https://world.openfoodfacts.org/data/taxonomies/packaging_materials.json + + https://world.openfoodfacts.org/data/taxonomies/packaging_recycling.json + + + If the tags_lc field is set, the properties will include a lc_name field with + the translation in the requested language.' + examples: + - - number_of_units: 6 + shape: + id: en:bottle + lc_name: bouteille + material: + id: en:bottle + lc_name: bouteille + recycling: + id: en:bottle + lc_name: bouteille + quantity_per_unit: 25 cl + quantity_per_unit_value: 25 + quantity_per_unit_unit: cl + weight_specified: 30 + weight_measured: 32 + weight_estimated: 26 + weight: 30 + weight_source_id: specified + items: + $ref: '#/components/schemas/packaging_component' + readOnly: true + packagings_complete: + title: packagings_complete + x-stoplight: + id: hxnnsy954q1ey + type: integer + minimum: 0 + maximum: 1 + description: Indicate if the packagings array contains all the packaging parts + of the product. This field can be set by users when they enter or verify packaging + data. Possible values are 0 or 1. + product_misc: + type: object + description: 'Miscellaneous but important fields of a product - You can add a comparison operator and value to the parameter name + ' + properties: + additives_n: + type: integer + description: 'Number of food additives. - to get products with nutrient above or bellow a value. + ' + checked: + type: string + complete: + type: integer + completeness: + type: number + ecoscore_grade: + type: string + description: 'See also: `ecoscore_tags` - If you use a parameter value it exactly match it. + ' + ecoscore_score: + type: integer + description: 'See also: `ecoscore_tags` + ' + food_groups: + type: string + food_groups_tags: + type: array + items: + type: string + nutrient_levels: + description: 'Traffic light indicators on main nutrients levels - * `energy-kj_100g<200` products where energy in kj for 100g is less than - 200kj + ' + type: object + properties: + fat: + type: string + enum: + - low + - moderate + - high + salt: + type: string + enum: + - low + - moderate + - high + saturated-fat: + type: string + enum: + - low + - moderate + - high + sugars: + type: string + enum: + - low + - moderate + - high + packaging_text: + type: string + description: 'Recycling instructions as raw text, e.g. Plastic - * `sugars_serving>10` products where sugar per serving is greater than - 10g + bottle to recycle, Plastic cap to recycle. - * `saturated-fat_100g=1` products where saturated fat per 100g is - exactly 10g + This will get automatically parsed and - * `salt_prepared_serving<0.1` products where salt per serving for - prepared product is less than 0.1g + will be used to compute the Eco-Score. + You can either request it (if it exists) or - ### More references + send it in a specific language. + ' + example: packaging_text_en + packagings: + $ref: '#/components/schemas/packagings' + packagings_complete: + $ref: '#/components/schemas/packagings_complete' + pnns_groups_1: + description: 'Category of food according to [French Nutrition and Health + Program](https://fr.wikipedia.org/wiki/Programme_national_nutrition_sant%C3%A9) - See also [wiki - page](https://wiki.openfoodfacts.org/Open_Food_Facts_Search_API_Version_2) - parameters: - - style: form - explode: false - schema: + ' + type: string + pnns_groups_1_tags: + type: array + items: type: string - example: e322 - in: query - name: additives_tags - description: > - The additives_tags in english of product(s) you are searching for. - - The [OFF App](https://world.openfoodfacts.org/additives) has a list - of possible values for `additives`. + pnns_groups_2: + description: 'Sub Category of food according to [French Nutrition and Health + Program](https://fr.wikipedia.org/wiki/Programme_national_nutrition_sant%C3%A9) + ' + type: string + pnns_groups_2_tags: + type: array + items: + type: string + popularity_key: + description: 'An imprecise measurement of popularity based on Scan statistics. + A higher value means higher popularity. - You can use multiple values by using a comma separated list. + ' + type: integer + popularity_tags: + description: 'Indicators for the popularity of a product, like the amount + of scans in a specific year. - You can add a "-" before values to avoid matching a tag. - - style: form - explode: false - schema: + ' + type: array + items: type: string - example: m - in: query - name: allergens_tags - description: > - The allergens_tags in english of product(s) you are searching for. + scans_n: + type: integer + unique_scans_n: + type: integer + serving_quantity: + type: string + description: 'Normalized version of serving_size. - The [OFF App](https://world.openfoodfacts.org/allergens) has a list - of possible values for `allergens`. + Note that this is NOT the number of servings by product. + (in perl, see `normalize_serving_size`) - You can use multiple values by using a comma separated list. + ' + serving_quantity_unit: + type: string + description: 'The unit (either g or ml) for the correponding serving_quantity. - You can add a "-" before values to avoid matching a tag. - - style: form - explode: false - schema: - type: string - example: ferrero - in: query - name: brands_tags - description: > - The brands_tags of product(s) you are searching for. + ' + example: g + serving_size: + type: string + description: 'Serving size text (generally in g or ml). - The [OFF App](https://world.openfoodfacts.org/brands) has a list of - possible values for `brands`. + We expect a quantity + unit but the user is free to input any string. + ' + food_groups_(?\w\w): + type: string + description: see `food_groups` + packaging_text_(?\w\w): + type: string + description: 'Packaging text in language designated by `language_code` - You can use multiple values by using a comma separated list. + ' + product_tags: + type: object + description: 'Data about a product which is represented as tags - You can add a "-" before values to avoid matching a tag. - - style: form - explode: false - schema: + ' + properties: + brands: + type: string + description: List of brands (not taxonomized) + brands_tags: + type: array + items: type: string - example: chocolates - in: query - name: categories_tags - description: > - The category of product(s) you are searching for. - - The [OFF App](https://world.openfoodfacts.org/categories) has a list - of possible values for `categories`. - - - You can use multiple values by using a comma separated list. + description: List of brands (tags, not taxonomized) + categories: + type: string + categories_hierarchy: + type: array + items: + type: string + categories_lc: + type: string + description: Categories language code + categories_tags: + type: array + items: + type: string + checkers_tags: + type: array + items: + type: string + description: List of checkers (users who checked the product) tags + cities: + type: string + cities_tags: + type: array + items: + type: object + correctors_tags: + type: array + items: + type: string + countries: + type: string + description: 'List of countries where the product is sold. - You can add a "-" before values to avoid matching a tag. - - style: form - explode: false - schema: + ' + countries_hierarchy: + type: array + items: + type: string + countries_lc: + type: string + description: Countries language code + countries_tags: + type: array + items: type: string - example: united-kingdom - in: query - name: countries_tags_en - description: > - The countries_tags_en of product(s) you are searching for. + ecoscore_tags: + description: 'All ecoscore of a product. - The [OFF App](https://world.openfoodfacts.org/countries) shows a - list of possible values for `countries`. + Most of the time it''s only one value, + but it might eventually be more for products composed of sub-products. - You can use multiple values by using a comma separated list. + See also: `ecoscore_score`, `ecoscore_grade`. - You can add a "-" before values to avoid matching a tag. - - style: form - explode: false - schema: - type: string - in: query - name: emb_codes_tags - description: | - The emb_codes_tags of product(s) you are searching for. - - You can use multiple values by using a comma separated list. - You can add a "-" before values to avoid matching a tag. - - style: form - explode: false - schema: + ' + type: array + items: type: string - example: organic - in: query - name: labels_tags - description: > - The labels_tags in english of product(s) you are searching for. - - The [OFF App](https://world.openfoodfacts.org/labels) has a list of - possible values for `labels`. - - - You can use multiple values by using a comma separated list. + emb_codes: + type: string + description: 'Packager code. EMB is the French system of traceability codes + for packager. - You can add a "-" before values to avoid matching a tag. - - style: form - explode: false - schema: + ' + example: EMB 2013330 + emb_codes_orig: + type: string + emb_codes_tags: + type: array + items: + type: object + labels: + type: string + labels_hierarchy: + type: array + items: type: string - in: query - name: manufacturing_places_tags - description: > - The manufacturing_places_tags of product(s) you are searching for. - - The [OFF App](https://world.openfoodfacts.org/manufacturing-places) - has a list of possible values for `manufacturing-places`. - - - You can use multiple values by using a comma separated list. - - You can add a "-" before values to avoid matching a tag. - - style: form - explode: false - schema: + labels_lc: + type: string + labels_tags: + type: array + items: type: string - example: e - in: query - name: nutrition_grades_tags - description: > - The nutrition_grades_tags of product(s) you are searching for. - - The [OFF App](https://world.openfoodfacts.org/nutrition-grades) has - a list of possible values for `nutrition-grades`. - + entry_dates_tags: + description: 'The data as a series of tag: `yyyy-mm-dd`, `yyyy-mm`, `yyyy` - You can use multiple values by using a comma separated list. + ' + type: array + items: + type: string + example: + - '2016-03-11' + - 2016-03 + - '2016' + manufacturing_places: + type: string + description: 'Places where the product was manufactured or transformed. - You can add a "-" before values to avoid matching a tag. - - style: form - explode: false - schema: + ' + manufacturing_places_tags: + type: array + items: + type: object + nova_groups_tags: + type: array + items: type: string - in: query - name: origins_tags - description: | - The origins_tags of product(s) you are searching for. - - You can use multiple values by using a comma separated list. - You can add a "-" before values to avoid matching a tag. - - style: form - explode: false - schema: + nutrient_levels_tags: + type: array + items: type: string - example: 1-jar-aus-klarglas - in: query - name: packaging_tags_de - description: > - The packaging_tag in german of product(s) you are searching for. + image_size: + type: object + properties: + h: + type: integer + example: 400 + description: 'The height of the reduced/full image in pixels. + + ' + w: + type: integer + example: 255 + description: The width of the reduced/full image in pixels. + image: + type: object + description: 'This object represent an image that was uploaded to a product. - The [OFF App](https://world.openfoodfacts.org/packaging) has a list - of possible values for `packaging`. + "imgid" is an integer which is a sequential number unique to each picture. + ' + properties: + sizes: + type: object + description: "The available image sizes for the product (both reduced and\ + \ full). \nThe reduced images are the ones with numbers as the key( 100,\ + \ 200 etc) \nwhile the full images have `full` as the key.\n" + properties: + full: + description: 'properties of fullsize image - You can use multiple values by using a comma separated list. + **TODO** explain how to compute name - You can add a "-" before values to avoid matching a tag. - - style: form - explode: false - schema: - type: string - in: query - name: purchase_places_tags - description: | - The purchase_places_tags of product(s) you are searching for. - - You can use multiple values by using a comma separated list. - You can add a "-" before values to avoid matching a tag. - - style: form - explode: false - schema: - type: string - example: nutrition-facts-completed - in: query - name: states_tags - description: > - The states_tags in english of product(s) you are searching for. + ' + $ref: '#/components/schemas/image_size' + image_size_example: + description: 'properties of thumbnail of size `image_size`. - The [OFF App](https://world.openfoodfacts.org/states) has a list of - possible values for `states`. + **TODO** explain how to compute name - You can use multiple values by using a comma separated list. + For real type: see description of property `full`. - You can add a "-" before values to avoid matching a tag. - - style: form - explode: false - schema: - type: string - example: aldi - in: query - name: stores_tags - description: | - The stores_tags of product(s) you are searching for. - - You can use multiple values by using a comma separated list. - You can add a "-" before values to avoid matching a tag. - - style: form - explode: false - schema: - type: string - in: query - name: traces_tags - description: > - The traces_tags of product(s) you are searching for. + (Put this way because of a [bug in rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) - The [OFF App](https://world.openfoodfacts.org/traces) shows a list - of possible values for `traces`. + ' + type: string + uploaded_t: + type: string + example: '1457680652' + description: 'The time the image was uploaded (as unix timestamp). + ' + uploader: + type: string + example: openfoodfacts-contributors + description: 'The contributor that uploaded the image. - You can use multiple values by using a comma separated list. + ' + image_role: + type: object + description: 'property of an image (or part thereof) selected for a particular + role and a particular language. - You can add a "-" before values to avoid matching a tag. - - in: query - name: _tags_ - description: > - You can add a language code to a specific tag to query it in a - specific language - style: form - explode: false - schema: - type: object - patternProperties: - (?\w+)_tags_(?\w\w): - type: string - description: > - Will search in the tags corresponding to `tag_name`, + ' + properties: + angle: + type: integer + example: 0 + description: The angle of the image rotation (if it was rotated). + coordinates_image_size: + type: string + example: full + geometry: + type: string + example: 0x0--1--1 + imgid: + type: string + example: '121' + description: The id of the original/source image that was selected to edit(rotate, + normalize etc) to produce this new image. + rev: + type: string + example: '420' + sizes: + type: object + description: "The available image sizes for the product (both reduced and\ + \ full). \nThe reduced images are the ones with numbers as the key( 100,\ + \ 200 etc)\nwhile the full images have `full` as the key.\n" + properties: + '100': + $ref: '#/components/schemas/image_size' + '200': + $ref: '#/components/schemas/image_size' + '400': + $ref: '#/components/schemas/image_size' + full: + $ref: '#/components/schemas/image_size' + x1: + type: string + example: '-1' + x2: + type: string + example: '-1' + y1: + type: string + example: '-1' + y2: + type: string + example: '-1' + image_urls: + type: object + properties: + language_code_example: + type: string + description: url of the image for language `language_code` + product_images: + type: object + description: 'Information about Images of a product. - in the language corresponding to `language_code. + Images ensure the reliability of Open Food Facts data. - `tag_name` is one of the field above which have the `_tags`` - suffix: + It provides a primary source and proof of all the structured data. - categories, nutrition_grades, etc. + You may therefore want to display it along the structured information. - `language_code` is a two letter iso language `language_code. + See also tutorials about images: + * [Getting images](https://openfoodfacts.github.io/openfoodfacts-server/api/how-to-download-images/) - You can use multiple values by using a comma separated list. + * [Uploading images](https://openfoodfacts.github.io/openfoodfacts-server/api/tutorial-uploading-photo-to-a-product/) - You can add a "-" before values to avoid matching a tag. - examples: - - packaging_tags_de: null - summary: packaging in german - value: - packaging_tags_de: 'de:Flasche' - - origins_tags_fr: null - summary: origins in french - value: - origins_tags_fr: 'fr:France' - - categories_tags_en: null - summary: categories in english - value: - categories_tags_en: 'en:Beer' - - in: query - name: _lt_ - description: | - Search on nutrient lower than a value - schema: - type: object - patternProperties: - (?\w+)(?_prepared)?(?100g|serving)<(?\d+): - type: string - description: > - Will search for products with nutrients lower than `value` + ' + properties: + images: + description: 'This contains properties for all images contained on the product. - per `portion` (100g or serving). + ' + type: object + properties: + 1: + type: object + description: 'This represents an image uploaded for this product. + ' + $ref: '#/components/schemas/image' + front: + description: 'This represents an image (or part of it) selected for + a specific role on this product. - If `prepared` is "prepared" search in prepared product instead - of "as sold". + ' + type: object + $ref: '#/components/schemas/image_role' + imgid_example: + description: 'See property `1` to get the real type of those objects + (Put this way because of a [bug in rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) - Important: the parameter value is discarded and should be - empty - examples: - - salt_100g_lt_2: null - summary: salt per 100g is lower than 2g (in product as sold) - value: - salt_100g<2: 1 - - in: query - name: _gt_ - description: | - Search on nutrient greater than a value - schema: - type: object - patternProperties: - (?\w+)(?_prepared)?(?100g|serving)>(?\d+): - type: string - description: > - Will search for products with nutrients more than `value` + ' + type: string + image_type_example: + description: 'See property `front` to get the real type of those objects - per `portion` (100g or serving). + (Put this way because of a [bug in rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) + ' + type: string + last_image_dates_tags: + type: array + items: + type: string + last_image_t: + description: timestamp of last image upload (or update?) + type: integer + selected_images: + type: object + description: 'URL for selected (important) images of the product. - If `prepared` is "prepared" search in prepared product instead - of "as sold". + This is very handy if you display the product to users. - Important: the parameter value is discarded and should be - empty - examples: - - carbohydrates_prepared_serving_gt_10: null - summary: >- - carbohydrates per serving is greater than 10g in prepared - product - value: - salt_100g>10: 1 - - in: query - name: _eq_ - description: | - Search on nutrient for an exact quantity - schema: - type: object - patternProperties: - (?\w+)(?_prepared)?(?100g|serving): - type: string - description: > - Will search for products with nutrients exactl the parameter - value - - per `portion` (100g or serving). - - - If `prepared` is "prepared" search in prepared product instead - of "as sold". - examples: - - fat_100g_eq_5: null - summary: fat per 100g is exactly equal to 5g (in product as sold) - value: - fat_100g: 5 - - $ref: '#/components/parameters/fields' - - $ref: '#/components/parameters/sort_by' - - $ref: '#/components/parameters/page' - - $ref: '#/components/parameters/page_size' - parameters: [] - /cgi/suggest.pl: - get: - summary: Get Suggestions to Aid Adding/Editing Products - tags: - - Read Requests - responses: - '200': - description: OK - content: - application/json: - schema: - type: array - operationId: get-cgi-suggest.pl - parameters: - - $ref: '#/components/parameters/tagtype' - - $ref: '#/components/parameters/term' - description: > - For example , Dave is looking for packaging_shapes that contain the term - "fe", + ' + properties: + front: + type: object + description: URLs of thumbnails image of image of type `image_type` + properties: + display: + description: 'Thumbnail urls of product image (front) adapted to + display on product page - all packaging_shapes containing "fe" will be returned. + ' + type: object + $ref: '#/components/schemas/image_urls' + small: + description: 'Thumbnail urls of product image (front) adapted to + display on product list page - This is useful if you have a search in your application, + ' + type: object + $ref: '#/components/schemas/image_urls' + thumb: + description: 'Thumbnail urls of product image (front) in smallest + format - for a specific product field. - /cgi/nutrients.pl: - get: - summary: >- - Get a nested list of nutrients that can be displayed in the nutrition - facts table for a specific country and language - tags: - - Read Requests - responses: - '200': - description: OK - content: - application/json: - schema: - type: array - description: > - Nutrients and sub-nutrients of a product, with their name and - default unit. - items: + ' type: object - properties: - id: - type: string - description: id of the nutrient - name: - type: string - description: Name of the nutrient in the requested language - important: - type: boolean - description: >- - Indicates if the nutrient is always shown on the - nutrition facts table - display_in_edit_form: - type: boolean - description: >- - Indicates if the nutrient should be shown in the - nutrition facts edit form - unit: - description: "The unit in which the nutrient for 100g or per serving is measured.\n\nThe possible values depends on the nutrient.\n\n* `g` for grams\n* `mg` for milligrams\n* `μg` for micrograms\n* `cl` for centiliters\n* `ml` for mililiters\n* `dv` for recommended daily intakes (aka [Dietary Reference Intake](https://en.wikipedia.org/wiki/Dietary_Reference_Intake))\n* `% vol` for percentage per volume (e.g. alcohol vol per 100 ml)\n* `%` for percentage\n\n\U0001F913 code: see the [Units module][units-module],\nand [Food:default_unit_for_nid function][default-unit]\n\n[units-module]: https://openfoodfacts.github.io/openfoodfacts-server/dev/ref-perl-pod/ProductOpener/Units.html\n[default-unit]: https://openfoodfacts.github.io/openfoodfacts-server/dev/ref-perl-pod/ProductOpener/Food.html#default_unit_for_nid_(_%24nid)\n" - type: string - enum: - - g - - mg - - μg - - cl - - ml - - dv - - '% vol' - - '%' - nutrients: - description: > - Sub-nutrients (e.g. saturated-fat is a sub-nutrient of - fat). - $ref: '#/' - operationId: get-cgi-nutrients.pl - parameters: - - $ref: '#/components/parameters/cc' - - $ref: '#/components/parameters/lc' - description: > - Used to display the nutrition facts table of a product, or to display a - form to input those nutrition facts. - /api/v2/attribute_groups: - get: - summary: Get the list of attributes available for personal search. - description: > - Attributes are at the heart of personal search. + $ref: '#/components/schemas/image_urls' + image_type_example: + description: 'See property `front` to get the real type of those objects - They score the products according to different criterias, + (Put this way because of a [bug in rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) - which could then be matched to a user's preferences. + ' + type: string + image_small_url: + type: string + image_thumb_url: + type: string + image_url: + type: string + agribalyse: + type: object + properties: + agribalyse_food_code: + type: string + co2_agriculture: + type: number + co2_consumption: + type: integer + co2_distribution: + type: number + co2_packaging: + type: number + co2_processing: + type: number + co2_total: + type: number + co2_transportation: + type: number + code: + type: string + dqr: + type: string + ef_agriculture: + type: number + ef_consumption: + type: integer + ef_distribution: + type: number + ef_packaging: + type: number + ef_processing: + type: number + ef_total: + type: number + ef_transportation: + type: number + is_beverage: + type: integer + name_en: + type: string + description: 'This can be returned in many other languages + like name_fr (for french). - This API helps you list attributes and display them in your application, + ' + score: + type: integer + version: + type: string + product_ecoscore: + type: object + description: 'Fields related to Eco-Score for a product. - for the user to choose the importance of each criteria. + See also: `ecoscore_score`, `ecoscore_grade` and `ecoscore_tags`. - note: /api/v2/attribute_groups_{lc} is also a valid route, but consider - it deprecated - tags: - - Read Requests - - Personal search - operationId: get-attribute-groups - responses: - '200': - description: OK - content: - application/json: - schema: - type: array - description: > - List of groups of attributes for personal search in a specific - language. - items: + ' + properties: + ecoscore_data: + type: object + description: "An object about a lot of details about data needed for Eco-Score\ + \ computation \nand complementary data of interest.\n" + properties: + adjustments: + type: object + properties: + origins_of_ingredients: type: object properties: - id: - type: string - description: unique id of the group - name: - type: string - description: Name of the group - attributes: + aggregated_origins: type: array - description: | - Attributes that are part of this group items: type: object properties: - id: - type: string - description: unique id of the attribute - name: - type: string - description: Name of the attribute - icon_url: - type: string - description: >- - url of icon to display next to the settings for - this attribute - setting_name: - type: string - description: a description of the attribute to display to users - setting_note: - type: string - description: a complementary note on the attribute - default: - type: string - enum: - - mandatory - - very_important - - important - - not_important - description: Indicates the default setting for this attribute - panel_id: + origin: type: string - description: Linked knowledge panel (optional) - parameters: - - $ref: '#/components/parameters/lc' - /api/v2/preferences: - get: - summary: | - Get the weights corresponding to attributes preferences - to compute personal product - tags: - - Read Requests - - Personal search - operationId: get-preferences - parameters: - - $ref: '#/components/parameters/lc' - responses: - '200': - description: OK - content: - application/json: - schema: - type: array - description: | - Rules to apply to compute personal ranking of a product, - based upon the setting value of each attribute. - items: + percent: + type: integer + epi_score: + type: integer + epi_value: + type: integer + origins_from_origins_field: + type: array + items: + type: string + transportation_scores: + type: object + properties: + language_code_example: + type: integer + transportation_values: + type: object + properties: + language_code_example: + type: integer + values: + type: object + properties: + language_code_example: + type: integer + warning: + type: string + packaging: type: object properties: - id: - type: string - description: id for the setting value - enum: - - not_important - - important - - very_important - - mandatory - name: + non_recyclable_and_non_biodegradable_materials: + type: integer + packagings: + type: array + items: + type: object + properties: + ecoscore_material_score: + type: integer + ecoscore_shape_ratio: + type: integer + material: + type: string + shape: + type: string + score: + type: integer + value: + type: integer + warning: type: string - description: >- - name for the setting value, translated according to `lc` - parameter - factor: + production_system: + type: object + properties: + labels: + type: array + example: vegan, fat free, Kosher + items: + type: string + value: type: integer - description: > - factor to apply to the property of the product - corresponding to attributes - - having this setting value - minimum_match: + warning: + type: string + threatened_species: + type: object + properties: + ingredient: + type: string + value: type: integer - description: | - FIXME -components: - schemas: - Product-Base: + agribalyse: + $ref: '#/components/schemas/agribalyse' + grade: + type: string + grades: + type: object + properties: + language_code_example: + type: string + missing: + type: object + properties: + labels: + type: integer + origins: + type: integer + packagings: + type: integer + missing_data_warning: + type: integer + previous_data: + type: object + properties: + grade: + type: string + score: + type: integer + agribalyse: + $ref: '#/components/schemas/agribalyse' + score: + type: integer + scores: + type: object + properties: + language_code_example: + type: integer + status: + type: string + ecoscore_extended_data_version: + type: string + environment_impact_level: + type: string + environment_impact_level_tags: + type: array + items: + type: object + ingredient: + type: array + description: 'This structure gives the different ingredients and some information + about them, + + like estimate on their quantity. + + ' + items: + type: object + properties: + id: + type: string + percent: + type: integer + percent_estimate: + type: + - number + percent_max: + type: + - number + percent_min: + type: integer + text: + type: string + vegan: + type: string + vegetarian: + type: string + product_ingredients: type: object - description: | - Base product data + description: Fields about ingredients of a product properties: - abbreviated_product_name: + additives_tags: + type: array + items: + type: string + allergens: type: string - description: Abbreviated name in requested language - code: + description: comma separated list of allergens + allergens_lc: type: string - description: > - barcode of the product (can be EAN-13 or internal codes for some - food stores), + description: language in which `allergens` where input + allergens_hierarchy: + type: array + items: + type: string + allergens_tags: + type: array + items: + type: string + ingredients: + $ref: '#/components/schemas/ingredient' + ingredients_analysis: + type: object + properties: + en:palm-oil: + type: array + items: + type: string + en:vegan-status-unknown: + type: array + items: + type: string + en:vegetarian-status-unknown: + type: array + items: + type: string + ingredients_analysis_tags: + type: array + items: + type: string + ingredients_from_or_that_may_be_from_palm_oil_n: + type: integer + ingredients_from_palm_oil_n: + type: integer + ingredients_from_palm_oil_tags: + type: array + items: + type: object + ingredients_hierarchy: + type: array + items: + type: string + ingredients_n: + type: integer + ingredients_n_tags: + type: array + items: + type: string + ingredients_original_tags: + type: array + items: + type: string + ingredients_percent_analysis: + type: integer + ingredients_sweeteners_n: + type: integer + description: 'Number of sweeteners additives in the ingredients. Undefined + if ingredients are not specified. - for products without a barcode, + ' + ingredients_non_nutritive_sweeteners_n: + type: integer + description: 'Number of non-nutritive sweeteners additives (as specified + in the Nutri-Score formula) in the ingredients. Undefined if ingredients + are not specified. - Open Food Facts assigns a number starting with the 200 reserved - prefix - codes_tags: + ' + ingredients_tags: type: array items: type: string - description: | - A value which is the type of barcode "code-13" or "code-8" - and - A series of mask for the barcode - It helps retrieve barcodes starting by - example: > - ["code-13","3017620422xxx","301762042xxxx","30176204xxxxx","3017620xxxxxx","301762xxxxxxx","30176xxxxxxxx","3017xxxxxxxxx","301xxxxxxxxxx","30xxxxxxxxxxx","3xxxxxxxxxxxx"] - generic_name: - type: string - description: | - Legal name of the product as regulated - by the European authorities. - id: - description: > - internal identifier for the product, usually set to the value of - `code`, - - except on the producers platform where it is prefixed by the owner - type: string - lc: + ingredients_lc: type: string - description: | - Main language of the product. - This is a duplicate of `lang` property (for historical reasons). - lang: + description: "Language that was used to parse the ingredient list. If `ingredients_text`\ + \ is available\nfor the product main language (`lang`), `ingredients_lc=lang`,\ + \ otherwise we look at\n`ingredients_text` fields for other languages\ + \ and set `ingredients_lc` to the first\nnon-empty `ingredient_text`.\ + \ \n" + ingredients_text: type: string - description: > - Main language of the product. + description: 'Raw list of ingredients. This will get automatically + parsed and get used to compute the Eco-Score or find allergens, etc.. - This should be the main language of product packaging (if one is - predominant). + It''s a copy of ingredients_text in the main language of the product (see + `lang` proprety). - Main language is also used to decide which ingredients list to - parse. - nova_group: - type: integer - description: > - Nova group as an integer from 1 to 4. See - https://world.openfoodfacts.org/nova - nova_groups: - type: string - obsolete: - type: string - obsolete_since_date: - description: | - A date at which the product was declared obsolete. - This means it's not produced any more. - type: string - product_name: - type: string - description: | - The name of the product - product_name_en: - type: string - description: | - The name of the product can also - be in many other languages like - product_name_fr (for French). - product_quantity: - type: string - description: | - The size in g or ml for the whole product. - It's a normalized version of the quantity field. - example: '500' - product_quantity_unit: - type: string - description: | - The unit (either g or ml) for the correponding product_quantity. - example: g - quantity: - type: string - description: | - Quantity and Unit. - patternProperties: - abbreviated_product_name_(?\w\w): - type: string - description: Abbreviated name in language `language_code`. - generic_name_(?\w\w): - type: string - description: | - This can be returned in many other languages - like generic_name_fr (for French). - Product-Misc: - type: object - description: | - Miscellaneous but important fields of a product - properties: - additives_n: - type: integer - description: | - Number of food additives. - checked: - type: string - complete: - type: integer - completeness: - type: number - ecoscore_grade: + ' + example: "Farine de bl\xE9* 67,4%, sucre de canne*, huile de tournesol ol\xE9\ + ique*, graines de chia* 5,2%, son de bl\xE9*, oranges d\xE9shydrat\xE9\ + es * 0,9%, farine de riz*, poudres \xE0 lever (acide citrique, carbonates\ + \ de sodium), ar\xF4me naturel d'orange.\n" + ingredients_text_with_allergens: type: string - description: | - See also: `ecoscore_tags` - ecoscore_score: + description: 'Same text as `ingredients_text` but where allergens have HTML + elements around them to identify them + + ' + example: "Farine de bl\xE9* 67,4%, sucre\ + \ de canne*, huile de tournesol ol\xE9ique*, graines de chia* 5,2%, son de bl\xE9*, oranges d\xE9shydrat\xE9es\ + \ * 0,9%, farine de riz*, poudres \xE0 lever (acide citrique, carbonates\ + \ de sodium), ar\xF4me naturel d'orange.\n" + ingredients_that_may_be_from_palm_oil_n: type: integer - description: | - See also: `ecoscore_tags` - food_groups: - type: string - food_groups_tags: + ingredients_that_may_be_from_palm_oil_tags: type: array items: - type: string - nutrient_levels: - description: | - Traffic light indicators on main nutrients levels - type: object - properties: - fat: - type: string - enum: - - low - - moderate - - high - salt: - type: string - enum: - - low - - moderate - - high - saturated-fat: - type: string - enum: - - low - - moderate - - high - sugars: - type: string - enum: - - low - - moderate - - high - packaging_text: - type: string - description: | - Recycling instructions as raw text, e.g. Plastic - bottle to recycle, Plastic cap to recycle. - This will get automatically parsed and - will be used to compute the Eco-Score. - You can either request it (if it exists) or - send it in a specific language. - example: packaging_text_en - packagings: - type: array - x-stoplight: - id: 1cyz4qo9njog7 - title: Packagings (READ) - description: >- - The packagings object is an array of individual packaging component - objects. - - - The Packaging data document explains how packaging data is - structured in Open Food Facts: - https://openfoodfacts.github.io/openfoodfacts-server/dev/explain-packaging-data/ - - - The shape, material and recycling properties of each packaging - component are linked to entries in the packaging_shapes, - packaging_materials and packaging_recycling taxonomies: - - - https://world.openfoodfacts.org/data/taxonomies/packaging_shapes.json - - https://world.openfoodfacts.org/data/taxonomies/packaging_materials.json - - https://world.openfoodfacts.org/data/taxonomies/packaging_recycling.json - - - If the tags_lc field is set, the properties will include a lc_name - field with the translation in the requested language. - examples: - - - number_of_units: 6 - shape: - id: 'en:bottle' - lc_name: bouteille - material: - id: 'en:bottle' - lc_name: bouteille - recycling: - id: 'en:bottle' - lc_name: bouteille - quantity_per_unit: 25 cl - quantity_per_unit_value: 25 - quantity_per_unit_unit: cl - weight_specified: 30 - weight_measured: 32 - weight_estimated: 26 - weight: 30 - weight_source_id: specified - items: - description: >- - Each packaging component has different properties to specify how - many there are, its shape, material etc. - - - The shape, material and recycling properties are mapped to one - entry in the packaging_shapes, packaging_materials and - packaging_recycling taxonomies, and the value of the property is - the canonical name of the taxonomy entry (e.g. en:bottle). - - - They may contain values that could not yet get matched to their - respective taxonomy, in which case they will contain a free text - value prefixed with the language code of this text value (e.g. - "fr:Bouteille sphérique" might have been entered by a French user - to indicate it is a spherical bottle). - title: Packaging component (READ) type: object - examples: - - number_of_units: 6 - shape: - id: 'en:bottle' - lc_name: bouteille - material: - id: 'en:bottle' - lc_name: bouteille - recycling: - id: 'en:bottle' - lc_name: bouteille - quantity_per_unit: 25 cl - quantity_per_unit_value: 25 - quantity_per_unit_unit: cl - weight_specified: 30 - weight_measured: 32 - weight_estimated: 26 - weight: 30 - weight_source_id: specified - properties: - number_of_units: - type: integer - description: >- - umber of units of this packaging component contained in the - product (e.g. 6 for a pack of 6 bottles) - shape: - title: Packaging component shape - x-stoplight: - id: xrj8agza3dwgf - type: object - description: >- - The shape property is canonicalized using the packaging_shapes - taxonomy. - examples: - - id: 'en:bottle' - lc_name: bouteille - properties: - id: - type: string - description: >- - Canonical id of the entry in the taxonomy. If the value - cannot be mapped to a taxonomy entry, the value will be - the name of the entry in its original language prefixed by - the language 2 letter code and a colon. - lc_name: - type: string - description: >- - Name of the entry in the language requested in the tags_lc - field of the request. This field is returned only of - tags_lc is specified. If the translation is not available, - or if the entry does not exist in the taxonomy, the value - will be the name of the entry in its original language - prefixed by the language 2 letter code and a colon. - material: - title: Packaging component material - x-stoplight: - id: n6umazgqmwrd5 - type: object - description: >- - The material property is canonicalized using the - packaging_materials taxonomy. - examples: - - id: 'en:bottle' - lc_name: bouteille - properties: - id: - type: string - description: >- - Canonical id of the entry in the taxonomy. If the value - cannot be mapped to a taxonomy entry, the value will be - the name of the entry in its original language prefixed by - the language 2 letter code and a colon. - lc_name: - type: string - description: >- - Name of the entry in the language requested in the tags_lc - field of the request. This field is returned only of - tags_lc is specified. If the translation is not available, - or if the entry does not exist in the taxonomy, the value - will be the name of the entry in its original language - prefixed by the language 2 letter code and a colon. - recycling: - title: Packaging component recycling instruction - x-stoplight: - id: 376tk8e2cmyh2 - type: object - description: >- - The recycling property is canonicalized using the - packaging_recycling taxonomy. - examples: - - id: 'en:bottle' - lc_name: bouteille - properties: - id: - type: string - description: >- - Canonical id of the entry in the taxonomy. If the value - cannot be mapped to a taxonomy entry, the value will be - the name of the entry in its original language prefixed by - the language 2 letter code and a colon. - lc_name: - type: string - description: >- - Name of the entry in the language requested in the tags_lc - field of the request. This field is returned only of - tags_lc is specified. If the translation is not available, - or if the entry does not exist in the taxonomy, the value - will be the name of the entry in its original language - prefixed by the language 2 letter code and a colon. - quantity_per_unit: - type: string - description: >- - Quantity (weight or volume) of food product contained in the - packaging component. (e.g. 75cl for a wine bottle) - quantity_per_unit_value: - type: number - description: Value parsed from the quantity field. - quantity_per_unit_unit: - type: string - description: Unit parsed and normalized from the quantity field. - weight_specified: - type: number - description: >- - Weight (as specified by the manufacturer) of one unit of the - empty packaging component (in grams). (e.g. for a 6 pack of - 1.5l water bottles, it might be 30, the weight in grams of 1 - empty water bottle without its cap which is a different - packaging component). - weight_measured: - type: number - description: >- - Weight (as measured by one or more users) of one unit of the - empty packaging component (in grams). (e.g. for a 6 pack of - 1.5l water bottles, it might be 30, the weight in grams of 1 - empty water bottle without its cap which is a different - packaging component). - weight_estimated: - type: number - description: >- - Weight (as estimated from similar products) of one unit of the - empty packaging component (in grams). (e.g. for a 6 pack of - 1.5l water bottles, it might be 30, the weight in grams of 1 - empty water bottle without its cap which is a different - packaging component). - weight: - type: number - description: Weight of one unit of the empty packaging component. - weight_source_id: - type: string - description: >- - Indicates which field was used to populate the "weight" field. - Either "specified", "measured", or "estimated" - readOnly: true - packagings_complete: - title: packagings_complete - x-stoplight: - id: hxnnsy954q1ey + ingredients_with_specified_percent_n: type: integer - minimum: 0 - maximum: 1 - description: >- - Indicate if the packagings array contains all the packaging parts of - the product. This field can be set by users when they enter or - verify packaging data. Possible values are 0 or 1. - pnns_groups_1: - description: > - Category of food according to [French Nutrition and Health - Program](https://fr.wikipedia.org/wiki/Programme_national_nutrition_sant%C3%A9) - type: string - pnns_groups_1_tags: - type: array - items: - type: string - pnns_groups_2: - description: > - Sub Category of food according to [French Nutrition and Health - Program](https://fr.wikipedia.org/wiki/Programme_national_nutrition_sant%C3%A9) - type: string - pnns_groups_2_tags: - type: array - items: - type: string - popularity_key: - description: > - An imprecise measurement of popularity based on Scan statistics. A - higher value means higher popularity. + ingredients_with_specified_percent_sum: type: integer - popularity_tags: - description: > - Indicators for the popularity of a product, like the amount of scans - in a specific year. - type: array - items: - type: string - scans_n: + ingredients_with_unspecified_percent_n: type: integer - unique_scans_n: + ingredients_with_unspecified_percent_sum: type: integer - serving_quantity: - type: string - description: | - Normalized version of serving_size. - Note that this is NOT the number of servings by product. - (in perl, see `normalize_serving_size`) - serving_quantity_unit: - type: string - description: | - The unit (either g or ml) for the correponding serving_quantity. - example: g - serving_size: + known_ingredients_n: + type: integer + origins: type: string - description: > - Serving size text (generally in g or ml). + description: 'Origins of ingredients - We expect a quantity + unit but the user is free to input any - string. - patternProperties: - food_groups_(?\w\w): - type: string - description: see `food_groups` - packaging_text_(?\w\w): - type: string - description: | - Packaging text in language designated by `language_code` - Product-Tags: - type: object - description: | - Data about a product which is represented as tags - properties: - brands: - type: string - description: List of brands (not taxonomized) - brands_tags: - type: array - items: - type: string - description: 'List of brands (tags, not taxonomized)' - categories: - type: string - categories_hierarchy: - type: array - items: - type: string - categories_lc: - type: string - description: Categories language code - categories_tags: - type: array - items: - type: string - checkers_tags: - type: array - items: - type: string - description: List of checkers (users who checked the product) tags - cities: - type: string - cities_tags: + ' + origins_hierarchy: type: array items: type: object - correctors_tags: - type: array - items: - type: string - countries: + origins_lc: type: string - description: | - List of countries where the product is sold. - countries_hierarchy: + origins_tags: type: array items: - type: string - countries_lc: + type: object + traces: type: string - description: Countries language code - countries_tags: - type: array - items: - type: string - ecoscore_tags: - description: > - All ecoscore of a product. + description: 'List of substances that might cause allergies - Most of the time it's only one value, + that are present in trace amounts in the product - but it might eventually be more for products composed of - sub-products. + (this does not include the ingredients, as they - See also: `ecoscore_score`, `ecoscore_grade`. - type: array - items: - type: string - emb_codes: - type: string - description: > - Packager code. EMB is the French system of traceability codes for - packager. - example: EMB 2013330 - emb_codes_orig: - type: string - emb_codes_tags: + are not only present in trace amounts). + + It is taxonomized with the allergens taxonomy. + + ' + traces_hierarchy: type: array items: type: object - labels: + traces_lc: type: string - labels_hierarchy: + traces_tags: type: array items: - type: string - labels_lc: + type: object + unknown_ingredients_n: + type: integer + ingredients_text_(?\w\w): type: string - labels_tags: - type: array - items: - type: string - entry_dates_tags: - description: | - The data as a series of tag: `yyyy-mm-dd`, `yyyy-mm`, `yyyy` - type: array - items: - type: string - example: - - '2016-03-11' - - 2016-03 - - '2016' - manufacturing_places: + description: 'Raw list of ingredients in language given by ''language_code''. + + + See `ingredients_text` + + ' + ingredients_text_with_allergens_(?\w\w): + description: 'Like `ingredients_text_with_allergens` for a particular language + + ' type: string - description: | - Places where the product was manufactured or transformed. - manufacturing_places_tags: - type: array - items: - type: object - nova_groups_tags: - type: array - items: - type: string - nutrient_levels_tags: - type: array - items: - type: string - Product-Nutrition: + product_nutrition: type: object - description: > - Nutrition fields of a product + description: 'Nutrition fields of a product Most of these properties are read-only. - See [how to add nutrition - data](https://openfoodfacts.github.io/openfoodfacts-server/api/ref-cheatsheet/#add-nutrition-facts-values-units-and-base) + See [how to add nutrition data](https://openfoodfacts.github.io/openfoodfacts-server/api/ref-cheatsheet/#add-nutrition-facts-values-units-and-base) + + ' properties: no_nutrition_data: type: string - description: | - When a product does not have nutrition data displayed on the + description: 'When a product does not have nutrition data displayed on the + packaging, the user can check the field "Nutrition facts are + not specified on the product". + By doing so, the no_nutrition_data field takes the value "on". + This case is frequent (thousands of products). + + ' example: 'on' nutrition_data_per: type: string enum: - - serving - - 100g - description: > - The nutrition data on the package can be per serving or per 100g. + - serving + - 100g + description: 'The nutrition data on the package can be per serving or per + 100g. - This is essential to understand if `_value` and - `` + This is essential to understand if `_value` and `` values in `nutriments` applies for a serving or for 100g. @@ -9206,39 +2832,39 @@ components: When writing products, - this setting applies to all existing nutrients values for the - product, + this setting applies to all existing nutrients values for the product, not only the nutrient values sent in the write request. So it should not be changed unless all nutrients values are provided with values that match the nutrition_data_per field. + + ' nutrition_data_prepared_per: type: string enum: - - serving - - 100g - description: > - The nutrition data for prepared product on the package (if any) can - be per serving or per 100g. + - serving + - 100g + description: 'The nutrition data for prepared product on the package (if + any) can be per serving or per 100g. - This is essential to understand if `_prepared_value` and - `_prepared` + This is essential to understand if `_prepared_value` and `_prepared` values in `nutriments` applies for a serving or for 100g. See also important note on `nutrition_data_per`. + + ' nutriments: type: object - description: > - All known nutrients for the product. + description: 'All known nutrients for the product. - Note that each nutrients are declined with a variety of suffixes - like `_100g`, `_serving`, + Note that each nutrients are declined with a variety of suffixes like + `_100g`, `_serving`, see patternProperties below. @@ -9246,8 +2872,8 @@ components: A specific `_unit` is the unit used to measure the nutrient. - Beware that some properties are to be interpreted based upon - `nutrition_data_per` value. + Beware that some properties are to be interpreted based upon `nutrition_data_per` + value. Also for products that have a nutrition table for prepared product @@ -9259,78 +2885,91 @@ components: You can get all possible nutrients from the - [nutrients - taxonomy](https://static.openfoodfacts.org/data/taxonomies/nutrients.json) + [nutrients taxonomy](https://static.openfoodfacts.org/data/taxonomies/nutrients.json) **FIXME** add more nutrients with description. + + ' properties: alcohol: - description: | - Quantity of alcohol + description: 'Quantity of alcohol + (per 100g or per serving) in a standard unit (g or ml) + + ' type: number carbohydrates: type: number energy: type: number - description: > - It is the same as `energy-kj` if we have it, or computed from - `energy-kcal` otherwise + description: 'It is the same as `energy-kj` if we have it, or computed + from `energy-kcal` otherwise (per 100g or per serving) in kj + + ' energy_value: type: number - description: > - energy_value will be equal to energy-kj_value if we have it or - to energy-kcal_value otherwise + description: 'energy_value will be equal to energy-kj_value if we have + it or to energy-kcal_value otherwise + + ' energy_unit: type: string enum: - - kcal - - kj - description: > - Equal to energy-kj_unit if we have it or to energy-kcal_unit + - kcal + - kj + description: 'Equal to energy-kj_unit if we have it or to energy-kcal_unit otherwise + + ' energy-kcal: type: number - description: | - energy in kcal, if it is specified + description: 'energy in kcal, if it is specified + (per 100g or per serving) in a standard unit (g or ml) + + ' energy-kj: type: number - description: | - energy in kj, if it is specified + description: 'energy in kj, if it is specified + (per 100g or per serving) in a standard unit (g or ml) + + ' fat: type: number fruits-vegetables-legumes-estimate-from-ingredients: type: number - description: > - An estimate, from the ingredients list of the percentage of - fruits, vegetable and legumes. + description: 'An estimate, from the ingredients list of the percentage + of fruits, vegetable and legumes. - This is an important information for Nutri-Score (2023 version) - computation. + This is an important information for Nutri-Score (2023 version) computation. + + ' fruits-vegetables-nuts-estimate-from-ingredients: type: number - description: > - An estimate, from the ingredients list of the percentage of - fruits, vegetable and nuts. + description: 'An estimate, from the ingredients list of the percentage + of fruits, vegetable and nuts. + + This is an important information for Nutri-Score (2021 version) computation. - This is an important information for Nutri-Score (2021 version) - computation. + ' nova-group: type: integer nutrition-score-fr: - description: | - Experimental nutrition score derived from + description: 'Experimental nutrition score derived from + the UK FSA score and adapted for the French market + (formula defined by the team of Professor Hercberg). + + ' proteins: type: number salt: @@ -9347,140 +2986,35 @@ components: type: number erythritol: type: number - description: | - erythritol is a polyol which is not providing any energy. + description: 'erythritol is a polyol which is not providing any energy. + As such, it needs not be taken into account when computing + the energy of a product. Eryhtritol is now displayed on - nutrition facts sheet of some products, mainly in the USA. - This value is entered either by contributors, either by - imports. - example: 12.5 - patternProperties: - '(?[\w-]+)_unit': - description: "The unit in which the nutrient for 100g or per serving is measured.\n\nThe possible values depends on the nutrient.\n\n* `g` for grams\n* `mg` for milligrams\n* `μg` for micrograms\n* `cl` for centiliters\n* `ml` for mililiters\n* `dv` for recommended daily intakes (aka [Dietary Reference Intake](https://en.wikipedia.org/wiki/Dietary_Reference_Intake))\n* `% vol` for alcohol vol per 100 ml\n\n\U0001F913 code: see the [Units module][units-module],\nand [Food:default_unit_for_nid function][default-unit]\n\n[units-module]: https://openfoodfacts.github.io/openfoodfacts-server/dev/ref-perl-pod/ProductOpener/Units.html\n[default-unit]: https://openfoodfacts.github.io/openfoodfacts-server/dev/ref-perl-pod/ProductOpener/Food.html#default_unit_for_nid_(_%24nid)\n" - type: string - enum: - - 公斤 - - 公升 - - kg - - кг - - l - - л - - 毫克 - - mg - - мг - - mcg - - µg - - oz - - fl oz - - dl - - дл - - cl - - кл - - 斤 - - g - - '' - - ' ' - - kj - - 克 - - 公克 - - г - - мл - - ml - - mmol/l - - 毫升 - - '% vol' - - ph - - '%' - - '% dv' - - '% vol (alcohol)' - - iu - - mol/l - - mval/l - - ppm - - �rh - - �fh - - �e - - �dh - - gpg - '(?[\w-]+)_100g': - description: > - The standardized value of a serving of 100g (or 100ml for - liquids) - - for the nutrient. - - - This is computed from the `nutrient` property, - - the serving size (if needed), and the `nutrient`_unit field. - - - **Note**: - - If you want to characterize products in a uniform way, this is - the value you should use. - type: number - readOnly: true - '(?[\w-]+)_serving': - description: | - The standardized value of a serving for this product. - type: number - readOnly: true - '(?[\w-]+)_value': - description: > - The value input by the user / displayed on the product for the - nutrient. + nutrition facts sheet of some products, mainly in the USA. - * per 100g or serving, depending on `nutrition_data_per` + This value is entered either by contributors, either by - * in the unit of corresponding _unit field. - type: number - readOnly: true - '(?[\w-]+)_prepared': - description: | - The value for nutrient for **prepared** product. - type: number - '(?[\w-]+)_prepared_unit': - description: > - The unit in which the nutrient of **prepared** product is - measured. - type: string - '(?[\w-]+)_prepared_100g': - description: > - The standardized value of a serving of 100g (or 100ml for - liquids) + imports. - for the nutrient, for **prepared** product. - type: number - readOnly: true - '(?[\w-]+)_prepared_serving': - description: > - The standardized value of a serving for the **prepared** - product. - type: number - readOnly: true - '(?[\w-]+)_prepared_value': - description: > - The standardized value for a serving or 100g (or 100ml for - liquids), + ' + example: 12.5 + nutrient_example: + description: 'The standardized value for a serving or 100g (or 100ml + for liquids), depending on `nutrition_data_prepared_per` for the nutrient for **prepared** product. + + ' type: number readOnly: true nutriscore_data: - description: > - Detail of data the Nutri-Score was computed upon. - - - **Note**: this might not be stable, don't rely too much on this, or, - at least, tell us ! - - - **TODO** document each property + description: "Detail of data the Nutri-Score was computed upon.\n\n**Note**:\_\ + this might not be stable, don't rely too much on this, or, at least, tell\ + \ us !\n\n**TODO** document each property\n" type: object properties: energy: @@ -9548,36 +3082,36 @@ components: sugars_value: type: number nutriscore_grade: - description: | - Nutri-Score for the product as a letter. + description: 'Nutri-Score for the product as a letter. + See https://world.openfoodfacts.org/nutriscore. + + ' type: string enum: - - a - - b - - c - - d - - e + - a + - b + - c + - d + - e nutriscore_score: - description: > - Nutri-Score for the product as an integer (see also - `nutriscore_grade`). + description: 'Nutri-Score for the product as an integer (see also `nutriscore_grade`). + + ' type: integer nutriscore_score_opposite: type: integer nutrition_grade_fr: type: string - description: | - Nutrition grade (‘a’ to ‘e’), - https://world.openfoodfacts.org/nutriscore. + description: "Nutrition grade (\u2018a\u2019 to \u2018e\u2019),\nhttps://world.openfoodfacts.org/nutriscore.\n" nutrition_grades: - description: > - Nutrition grades as a comma separated list. + description: 'Nutrition grades as a comma separated list. + + Some products with multiple components might have multiple Nutri-Score - Some products with multiple components might have multiple - Nutri-Score + ' type: string nutrition_grades_tags: type: array @@ -9603,3969 +3137,1364 @@ components: type: array items: type: object - Product-Ingredients: + product_quality: type: object - description: Fields about ingredients of a product + description: 'This is data that is linked to products data quality + + ' properties: - additives_tags: + data_quality_bugs_tags: type: array items: - type: string - allergens: - type: string - description: comma separated list of allergens - allergens_lc: - type: string - description: language in which `allergens` where input - allergens_hierarchy: + type: object + data_quality_errors_tags: + type: array + items: + type: object + data_quality_info_tags: type: array items: type: string - allergens_tags: + data_quality_tags: type: array items: type: string - ingredients: + data_quality_warnings_tags: type: array - description: > - This structure gives the different ingredients and some information - about them, + items: + type: string + data_sources: + type: string + description: 'Source of data imported from producers. - like estimate on their quantity. + ' + data_sources_tags: + type: array items: - type: object - properties: - id: - type: string - ingredients: - description: | - Sub ingredients composing this ingredients. - $ref: '#' - percent: - type: integer - percent_estimate: - type: - - number - percent_max: - type: - - number - percent_min: - type: integer - text: - type: string - vegan: - type: string - vegetarian: - type: string - ingredients_analysis: - type: object - properties: - 'en:palm-oil': - type: array - items: - type: string - 'en:vegan-status-unknown': - type: array - items: - type: string - 'en:vegetarian-status-unknown': - type: array - items: - type: string - ingredients_analysis_tags: + type: string + last_check_dates_tags: type: array items: type: string - ingredients_from_or_that_may_be_from_palm_oil_n: - type: integer - ingredients_from_palm_oil_n: + last_checked_t: type: integer - ingredients_from_palm_oil_tags: + last_checker: + type: string + states: + description: 'comma separated list of values indicating some states of the + product, + + like things to be done, or to be completed. + + See [states taxonomy](https://static.openfoodfacts.net/data/taxonomies/states.json) + + ' + type: string + states_hierarchy: type: array items: - type: object - ingredients_hierarchy: + type: string + states_tags: + type: array + items: + description: 'Each state describe something that is completed or is to + be done or improved on the product. + + + Refer to [states taxonomy](https://static.openfoodfacts.net/data/taxonomies/states.json) + + ' + type: string + misc_tags: + description: 'Information about different aspect of the product + + ' type: array items: type: string - ingredients_n: - type: integer - ingredients_n_tags: + product_extended: + type: object + properties: + additives_original_tags: type: array items: type: string - ingredients_original_tags: + additives_prev_original_tags: type: array items: type: string - ingredients_percent_analysis: - type: integer - ingredients_sweeteners_n: - type: integer - description: > - Number of sweeteners additives in the ingredients. Undefined if - ingredients are not specified. - ingredients_non_nutritive_sweeteners_n: + added_countries_tags: + type: array + items: + type: object + allergens_from_ingredients: + type: string + allergens_from_user: + type: string + amino_acids_prev_tags: + type: array + items: + type: object + amino_acids_tags: + type: array + items: + type: object + carbon_footprint_percent_of_known_ingredients: type: integer - description: > - Number of non-nutritive sweeteners additives (as specified in the - Nutri-Score formula) in the ingredients. Undefined if ingredients - are not specified. - ingredients_tags: + categories_properties: + type: object + properties: + agribalyse_food_code:en: + type: string + agribalyse_proxy_food_code:en: + type: string + ciqual_food_code:en: + type: string + categories_properties_tags: type: array items: type: string - ingredients_lc: + category_properties: + type: object + additionalProperties: + description: those are properties taken from the category taxonomy + type: string + ciqual_food_name_tags: + type: array + items: + type: string + compared_to_category: type: string - description: > - Language that was used to parse the ingredient list. If - `ingredients_text` is available + description: 'the category to use for comparison. - for the product main language (`lang`), `ingredients_lc=lang`, - otherwise we look at - `ingredients_text` fields for other languages and set - `ingredients_lc` to the first + **TODO** explain how it is chosen. - non-empty `ingredient_text`. - ingredients_text: + ' + conservation_conditions: type: string - description: > - Raw list of ingredients. This will get automatically - - parsed and get used to compute the Eco-Score or find allergens, - etc.. - + customer_service: + type: string + description: 'Contact info of customer service. - It's a copy of ingredients_text in the main language of the product - (see `lang` proprety). - example: > - Farine de blé* 67,4%, sucre de canne*, huile de tournesol oléique*, - graines de chia* 5,2%, son de blé*, oranges déshydratées * 0,9%, - farine de riz*, poudres à lever (acide citrique, carbonates de - sodium), arôme naturel d'orange. - ingredients_text_with_allergens: + ' + expiration_date: type: string - description: > - Same text as `ingredients_text` but where allergens have HTML - elements around them to identify them - example: > - Farine de blé* 67,4%, sucre de canne*, - huile de tournesol oléique*, graines de chia* 5,2%, son de blé*, oranges déshydratées * 0,9%, - farine de riz*, poudres à lever (acide citrique, carbonates de - sodium), arôme naturel d'orange. - ingredients_that_may_be_from_palm_oil_n: - type: integer - ingredients_that_may_be_from_palm_oil_tags: + link: + type: string + description: 'link to the product on the website of the producer + + ' + main_countries_tags: type: array items: type: object - ingredients_with_specified_percent_n: - type: integer - ingredients_with_specified_percent_sum: - type: integer - ingredients_with_unspecified_percent_n: - type: integer - ingredients_with_unspecified_percent_sum: - type: integer - known_ingredients_n: - type: integer - origins: - type: string - description: | - Origins of ingredients - origins_hierarchy: + minerals_prev_tags: type: array items: type: object - origins_lc: - type: string - origins_tags: + minerals_tags: type: array items: type: object - traces: - type: string - description: | - List of substances that might cause allergies - that are present in trace amounts in the product - (this does not include the ingredients, as they - are not only present in trace amounts). - It is taxonomized with the allergens taxonomy. - traces_hierarchy: + owner_fields: + type: object + description: 'Those are fields provided by the producer (through producers + platform), + + and the value he provided. + + ' + properties: + additionalProperties: + description: 'you can retrieve all kind of properties, the same as on + the parent object (the product). + + It''s not processed entries (like tags for example) but raw ones. + + ' + oneOf: + - type: integer + - type: string + - type: object + nova_groups_markers: + type: object + description: 'Detail of ingredients or processing that makes the products + having Nova 3 or 4 + + ' + properties: + '3': + description: 'Markers of level 3 + + ' + type: array + items: + type: array + description: 'This array has two element for each marker. + + One + + ' + items: + type: string + '4': + description: 'Markers of level 4 + + ' + type: array + nucleotides_tags: type: array items: type: object - traces_lc: + origin: type: string - traces_tags: + purchase_places: + type: string + description: 'Country, state, or city where the product can be purchased. + + ' + example: Paris + purchase_places_tags: type: array items: - type: object - unknown_ingredients_n: - type: integer - patternProperties: - ingredients_text_(?\w\w): + type: string + stores: type: string - description: | - Raw list of ingredients in language given by 'language_code'. + description: 'Distributor name. - See `ingredients_text` - ingredients_text_with_allergens_(?\w\w): - description: | - Like `ingredients_text_with_allergens` for a particular language + ' + example: Walmart + stores_tags: + type: array + items: + type: string + traces_from_ingredients: type: string - Product-Images: - type: object - description: > - Information about Images of a product. - + traces_from_user: + type: string + conservation_conditions_(?\w\w): + type: string + customer_service_(?\w\w): + type: string + origin_(?\w\w): + type: string + description: '`origin` in language indicated by `language_code` - Images ensure the reliability of Open Food Facts data. + ' + product_meta: + type: object + description: 'Metadata of a product (author, editors, creation date, etc.) - It provides a primary source and proof of all the structured data. + ' + properties: + created_t: + type: integer + description: 'Date when the product was added (UNIX timestamp format). - You may therefore want to display it along the structured information. + See also `entry_dates_tags` + ' + example: '1457680652 - See also tutorials about images: + ' + creator: + type: string + description: 'The contributor who added the product first. - * [Getting - images](https://openfoodfacts.github.io/openfoodfacts-server/api/how-to-download-images/) + ' + editors_tags: + description: 'List of editors who edited the product. - * [Uploading - images](https://openfoodfacts.github.io/openfoodfacts-server/api/tutorial-uploading-photo-to-a-product/) - properties: - images: - description: | - This contains properties for all images contained on the product. + ' + type: array + items: + type: string + informers_tags: + type: array + items: + type: string + interface_version_created: + type: string + interface_version_modified: + type: string + languages: type: object properties: - '1': - type: object - description: > - This object represent an image that was uploaded to a product. + en:(?\w\w): + type: integer + description: '**TODO** explain ! - "imgid" is an integer which is a sequential number unique to - each picture. - properties: - sizes: - type: object - description: > - The available image sizes for the product (both reduced and - full). + ' + languages_codes: + type: object + description: 'Same as `languages` but by language code, instead of language + tags - The reduced images are the ones with numbers as the key( - 100, 200 etc) + ' + properties: + language_code_example: + type: integer + languages_hierarchy: + type: array + items: + type: string + languages_tags: + type: array + items: + type: string + last_edit_dates_tags: + type: array + items: + type: string + last_editor: + type: string + last_modified_by: + type: string + description: 'The username of the user who last modified the product. - while the full images have `full` as the key. - properties: - full: - description: | - properties of fullsize image - **TODO** explain how to compute name - type: object - properties: - h: - type: integer - example: 400 - description: | - The height of the reduced/full image in pixels. - w: - type: integer - example: 255 - description: The width of the reduced/full image in pixels. - patternProperties: - (?100|400): - description: > - properties of thumbnail of size `image_size`. + ' + example: sebleouf + last_modified_t: + type: integer + description: 'Date when the product page was last modified. - **TODO** explain how to compute name + ' + owner: + description: 'Id of the producer in case he provides his own data about + a product (producer platform). + ' + type: string + owners_tags: + description: 'Tagyfied version of owner - For real type: see description of property `full`. - - (Put this way because of a [bug in - rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) - type: string - uploaded_t: - type: string - example: '1457680652' - description: | - The time the image was uploaded (as unix timestamp). - uploader: + ' + type: string + photographers_tags: + type: array + items: + type: string + rev: + description: revision number of this product version (each edit adds a revision) + type: integer + sources: + type: array + items: + type: object + properties: + fields: + type: array + items: type: string - example: openfoodfacts-contributors - description: | - The contributor that uploaded the image. - front: - description: > - property of an image (or part thereof) selected for a particular - role and a particular language. + id: + type: string + images: + type: array + items: + type: object + import_t: + type: integer + manufacturer: + type: + - integer + - string + name: + type: string + source_licence: + type: string + source_licence_url: + type: string + url: + type: + - 'null' + - string + sources_fields: + type: object + properties: + org-gs1: type: object properties: - angle: - type: integer - example: 0 - description: The angle of the image rotation (if it was rotated). - coordinates_image_size: + gln: type: string - example: full - geometry: + gpcCategoryCode: type: string - example: 0x0--1--1 - imgid: + gpcCategoryName: type: string - example: '121' - description: >- - The id of the original/source image that was selected to - edit(rotate, normalize etc) to produce this new image. - normalize: - type: 'null' - example: null - description: Normalize colors. - rev: + isAllergenRelevantDataProvided: type: string - example: '420' - sizes: - type: object - description: > - The available image sizes for the product (both reduced and - full). - - The reduced images are the ones with numbers as the key( - 100, 200 etc) - - while the full images have `full` as the key. - properties: - '100': - type: object - properties: - h: - type: integer - example: 400 - description: | - The height of the reduced/full image in pixels. - w: - type: integer - example: 255 - description: The width of the reduced/full image in pixels. - '200': - type: object - properties: - h: - type: integer - example: 400 - description: | - The height of the reduced/full image in pixels. - w: - type: integer - example: 255 - description: The width of the reduced/full image in pixels. - '400': - type: object - properties: - h: - type: integer - example: 400 - description: | - The height of the reduced/full image in pixels. - w: - type: integer - example: 255 - description: The width of the reduced/full image in pixels. - full: - type: object - properties: - h: - type: integer - example: 400 - description: | - The height of the reduced/full image in pixels. - w: - type: integer - example: 255 - description: The width of the reduced/full image in pixels. - white_magic: - type: 'null' - example: null - description: | - Photo on white background : Try to remove the background. - x1: + lastChangeDateTime: type: string - example: '-1' - x2: + partyName: type: string - example: '-1' - y1: + productionVariantDescription: type: string - example: '-1' - y2: + publicationDateTime: type: string - example: '-1' - patternProperties: - (?\d+): - description: > - See property `1` to get the real type of those objects - - (Put this way because of a [bug in - rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) - type: string - (?front|nutrition|ingredients|packaging|other)_(?\w\w): - description: > - See property `front` to get the real type of those objects - - (Put this way because of a [bug in - rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) - type: string - last_image_dates_tags: + teams: + type: string + teams_tags: type: array items: type: string - last_image_t: - description: timestamp of last image upload (or update?) + update_key: + type: string + title_element: + title: title_element + x-stoplight: + id: lox0wvl9bdgy2 + type: object + description: The title of a panel. + properties: + name: + type: string + description: A short name of this panel, not including any actual values + title: + type: string + type: + type: string + enum: + - grade + - percentage + description: Used to indicate how the value of this item is measured, such + as "grade" for Nutri-Score and Eco-Score or "percentage" for Salt + grade: + type: string + description: The value for this panel where it corresponds to a A to E grade + such as the Nutri-Score of the Eco-Score. + enum: + - a + - b + - c + - d + - e + - unknown + value: + type: number + description: The numeric value of the panel, where the type is "percentage" + icon_url: + type: string + icon_color_from_evaluation: + type: string + icon_size: + type: string + description: 'If set to "small", the icon should be displayed at a small + size. + + ' + text_element: + title: text_element + x-stoplight: + id: vdwxlt73qnqfa + type: object + description: 'A text in simple HTML format to display. + + + For some specific texts that correspond to a product field (e.g. a product + name, the ingredients list of a product),the edit_field_* fields are used + to indicate how to edit the field value.' + properties: + type: + type: string + description: 'the type of text, might influence the way you display it. + + ' + enum: + - summary + - warning + - notes + html: + type: string + description: Text to display in HTML format. + language: + type: string + description: Language of the text. The name of the language is returned + in the language requested when making the API call. e.g. if the text is + in Polish, and the requested language is French, the language field will + contain "Polonais" (French for "Polish"). Only set for specific fields + such as the list of ingredients of a product. + lc: + type: string + description: 2 letter language code for the text. Only set for specific + fields such as the list of ingredients of a product. + edit_field_id: + type: string + description: id of the field used to edit this text in the product edit + API. + edit_field_type: + type: string + description: Type of the product field. + edit_field_value: + type: string + description: Current value of the product field. This may differ from the + html field which can contain extra formating. + source_url: + type: string + description: Link to the source + example: https://en.wikipedia.org/wiki/Sodium acetate + source_text: + type: string + description: name of the source + example: Wikipedia + source_lc: + type: string + description: Source locale name + example: en + source_language: + type: string + description: Human readable source locale name + example: English + image_element: + title: image_element + x-stoplight: + id: k4v4kwt489q3j + type: object + properties: + url: + type: string + description: full URL of the image + width: type: integer - selected_images: - type: object - description: | - URL for selected (important) images of the product. + description: "Width of the image.\n\nThis is just a suggestion coming from\ + \ the server, \nthe client may choose to use its own dimensions for the\ + \ image.\n" + height: + type: integer + description: 'Height of the image. - This is very handy if you display the product to users. - properties: - front: - type: object - description: URLs of thumbnails image of image of type `image_type` - properties: - display: - description: > - Thumbnail urls of product image (front) adapted to display - on product page - type: object - patternProperties: - (?\w\w): - type: string - description: url of the image for language `language_code` - small: - description: > - Thumbnail urls of product image (front) adapted to display - on product list page - type: object - patternProperties: - (?\w\w): - type: string - description: url of the image for language `language_code` - thumb: - description: | - Thumbnail urls of product image (front) in smallest format - type: object - patternProperties: - (?\w\w): - type: string - description: url of the image for language `language_code` - patternProperties: - (?front|packaging|ingredients|nutrition|other): - description: > - See property `front` to get the real type of those objects - - (Put this way because of a [bug in - rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) - type: string - image_small_url: + + This is just a suggestion coming from the server, + + the client may choose to use its own dimensions for the image. + + ' + alt_text: type: string - image_thumb_url: + description: Alt Text of the image. + panel_element: + title: panel_element + x-stoplight: + id: ymx41elz4yrnj + type: object + description: Panels can include other panels as sub-panels using the panel_element. + properties: + panel_id: type: string - image_url: + description: The id of the panel to include. The id is the key of the panel + in the panels object returned in the knowledge_panels field. + panel_group_element: + title: panel_group_element + x-stoplight: + id: b7emlfrgiuue2 + type: object + properties: + title: type: string - patternProperties: - image(_(?front|packaging|ingredients|nutrition|other))?(_(?small|thumb))?_url: - description: > - the URL of image of type `image_type` in size `image_size` (or - full size if not given). + panel_ids: + type: array + description: The ids of the panels to include. The ids are the keys of the + panels in the panels object returned in the knowledge_panels field. + items: + type: string + description: The panel group element is used to display an optional title followed + by a number of sub-panels. + table_element: + title: table_element + x-stoplight: + id: 38zu3z4sruqo7 + type: object + description: Element to display a table. + properties: + id: + type: string + description: An id for the table. + title: + type: string + description: 'Title of the column. + + ' + rows: + type: string + columns: + type: array + items: + type: object + properties: + type: + type: string + text: + type: string + text_for_small_screens: + type: string + style: + type: string + column_group_id: + type: string + shown_by_default: + type: boolean + element: + title: element + x-stoplight: + id: e2ybdrtmx0tme + type: object + description: 'Each element object contains one specific element object such + as a text element or an image element. + + ' + properties: + type: + element_type: string + enum: + - text + - image + - action + - panel + - panel_group + - table + description: 'The type of the included element object. + The type also indicates which field contains the included element object. - The `image_type` tells which image the url correspond to. - `image_type` is `front` if not provided. + e.g. if the type is "text", the included element object will be in the + "text_element" field. - The image is the one for current language (affected by `lc` - parameter) if an image exists for this language, the image in main - product language otherwise. + Note that in the future, new type of element may be added, + + so your code should ignore unrecognized types, and unknown properties. + + + TODO: add Map type + + ' + text_element: + $ref: '#/components/schemas/text_element' + image_element: + $ref: '#/components/schemas/image_element' + action_element: + type: string + panel_element: + $ref: '#/components/schemas/panel_element' + panel_group_element: + $ref: '#/components/schemas/panel_group_element' + table_element: + $ref: '#/components/schemas/table_element' + required: + - type + panel: + title: panel + x-stoplight: + id: mj9nhz3mqn05c + type: object + description: Each panel contains an optional title and an optional array of + elements. + properties: + type: + type: string + description: Type of the panel. If set to "card", the panel and its sub-panels + should be displayed in a card. If set to "inline", the panel should have + its content always displayed. + expanded: + type: boolean + description: If true, the panel is to be displayed already expanded. If + false, only the title should be displayed, and the user should be able + to click or tap it to open the panel and display the elements. + expand_for: + type: string + description: If set to "large", the content of the panel should be expanded + on large screens, but it should still be possible to unexpand it. + evaluation: + type: string + description: A simple assessment of the panel value, typically used to format + fonts, et.c e.g. bad = red + enum: + - good + - average + - neutral + - bad + - unknown + title_element: + $ref: '#/components/schemas/title_element' + elements: + type: array + description: An ordered list of elements to display in the content of the + panel. + items: + $ref: '#/components/schemas/element' + level: + type: string + description: 'a message level, as levels we use in log. + It might help theming the panel visualy - **IMPORTANT:** you should use `selected_images` field instead of - this one. + ' + example: info + size: + type: string + enum: + - small + description: "size is either empty (normal display) \nor small to indicate\ + \ a panel that should have a smaller font size\n" + example: small + topics: + type: array + items: type: string - Product-Eco-Score: + example: health + panels: type: object - description: | - Fields related to Eco-Score for a product. + x-stoplight: + id: bcq3fkbtnwr5t + title: panels + description: 'The panels object is a dictionary of individual panel objects. - See also: `ecoscore_score`, `ecoscore_grade` and `ecoscore_tags`. + Each key of the dictionary is the id of the panel, and the value is the panel + object. + + + Apps typically display a number of root panels with known panel ids (e.g. + health_card and environment_card). Panels can reference other panels and display + them as sub-panels.' + examples: + - additionalProperties: string properties: - ecoscore_data: - type: object - description: > - An object about a lot of details about data needed for Eco-Score - computation + additionalProperties: + $ref: '#/components/schemas/panel' + readOnly: true + product_knowledge_panels: + type: object + description: 'Knowledge panels for a product - and complementary data of interest. - properties: - adjustments: - type: object - properties: - origins_of_ingredients: - type: object - properties: - aggregated_origins: - type: array - items: - type: object - properties: - origin: - type: string - percent: - type: integer - epi_score: - type: integer - epi_value: - type: integer - origins_from_origins_field: - type: array - items: - type: string - transportation_scores: - type: object - patternProperties: - (?\w\w): - type: integer - transportation_values: - type: object - patternProperties: - (?\w\w): - type: integer - values: - type: object - patternProperties: - (?\w\w): - type: integer - warning: - type: string - packaging: - type: object - properties: - non_recyclable_and_non_biodegradable_materials: - type: integer - packagings: - type: array - items: - type: object - properties: - ecoscore_material_score: - type: integer - ecoscore_shape_ratio: - type: integer - material: - type: string - shape: - type: string - score: - type: integer - value: - type: integer - warning: - type: string - production_system: - type: object - properties: - labels: - type: array - example: 'vegan, fat free, Kosher' - items: - type: string - value: - type: integer - warning: - type: string - threatened_species: - type: object - properties: - ingredient: - type: string - value: - type: integer - agribalyse: - type: object - properties: - agribalyse_food_code: - type: string - co2_agriculture: - type: number - co2_consumption: - type: integer - co2_distribution: - type: number - co2_packaging: - type: number - co2_processing: - type: number - co2_total: - type: number - co2_transportation: - type: number - code: - type: string - dqr: - type: string - ef_agriculture: - type: number - ef_consumption: - type: integer - ef_distribution: - type: number - ef_packaging: - type: number - ef_processing: - type: number - ef_total: - type: number - ef_transportation: - type: number - is_beverage: - type: integer - name_en: - type: string - description: | - This can be returned in many other languages - like name_fr (for french). - score: - type: integer - version: - type: string - grade: - type: string - grades: - type: object - patternProperties: - (?\w\w): - type: string - missing: - type: object - properties: - labels: - type: integer - origins: - type: integer - packagings: - type: integer - missing_data_warning: - type: integer - previous_data: - type: object - properties: - grade: - type: string - score: - type: integer - agribalyse: - type: object - properties: - agribalyse_food_code: - type: string - co2_agriculture: - type: number - co2_consumption: - type: integer - co2_distribution: - type: number - co2_packaging: - type: number - co2_processing: - type: number - co2_total: - type: number - co2_transportation: - type: number - code: - type: string - dqr: - type: string - ef_agriculture: - type: number - ef_consumption: - type: integer - ef_distribution: - type: number - ef_packaging: - type: number - ef_processing: - type: number - ef_total: - type: number - ef_transportation: - type: number - is_beverage: - type: integer - name_en: - type: string - description: | - This can be returned in many other languages - like name_fr (for french). - score: - type: integer - version: - type: string - score: - type: integer - scores: - type: object - patternProperties: - (?\w\w): - type: integer - status: - type: string - ecoscore_extended_data_version: - type: string - environment_impact_level: - type: string - environment_impact_level_tags: + ' + properties: + knowledge_panels: + $ref: '#/components/schemas/panels' + product_attribute_groups: + type: object + description: 'Specific data about a product to enable personal ranking + + ' + properties: + attribute_groups: type: array + description: Each element is an attribute that can help compute a personal + ranking for the product items: type: object - Product-Metadata: + properties: + id: + type: string + description: 'Unique id of the attribute. + + + It will be use to match against preferences parameters. + + ' + status: + type: string + enum: + - known + - unknown + description: wether we have the information to really compute this + criteria or not. + title: + type: string + description: 'A descriptive sentence about the situation of the product + concerning attribute + + ' + example: 'Does not contain: Molluscs' + match: + type: number + format: float + minimum: 0 + maximum: 100 + description: 'a numeric value for the match, + + telling how much the products ranks well for this particular attribute. + + The higher the value, the better the match. + + ' + grade: + description: every attribute as a grade for a to e + type: string + enum: + - unknown + - a + - b + - c + - d + - e + name: + type: string + description: The name of attribute, for eventual display + icon_url: + type: string + description: an icon representing the attribute match (often using + a color) + description: + type: string + description: An eventual description of the value of the property + upon which this attribute is based + description_short: + type: string + description: An eventual short description of the value of the property + upon which this attribute is based + product: + type: object + description: 'This is all the fields describing a product and how to display + it on a page. + + + Refer to the different sub schema for more readable entries: + + + * [Product Base](#cmp--schemas-product-base): Base fields of a product + + * [Product Misc](#cmp--schemas-product-misc): Miscellaneous but important + fields of a product + + * [Product Tags](#cmp--schemas-product-tags): Tags fields on a product + + * [Product Nutrition](#cmp--schemas-product-nutrition): Nutrition fields of + a product + + * [Product Ingredients](#cmp--schemas-product-ingredients): Fields about ingredients + of a product + + * [Product Images](#cmp--schemas-product-images): Information about Images + of a product + + * [Product Eco-Score](#cmp--schemas-product-images): Fields related to Eco-Score + for a product + + * [Product Metadata](#cmp--schemas-product-ecoscore): Metadata of a product + (author, editors, etc.) + + * [Product Data Quality](#cmp--schemas-product-quality): fields related to + data quality for a product + + * [Product Knowledge Panels](#cmp--schemas-product-knowledge-panels): Knowledge + panels for a product + + * [Product Attribute Groups](#cmp--schemas-product-attribute-groups): Attribute + groups for personal product matching + + ' + allOf: + - $ref: '#/components/schemas/product_base' + - $ref: '#/components/schemas/product_misc' + - $ref: '#/components/schemas/product_tags' + - $ref: '#/components/schemas/product_images' + - $ref: '#/components/schemas/product_ecoscore' + - $ref: '#/components/schemas/product_ingredients' + - $ref: '#/components/schemas/product_nutrition' + - $ref: '#/components/schemas/product_quality' + - $ref: '#/components/schemas/product_extended' + - $ref: '#/components/schemas/product_meta' + - $ref: '#/components/schemas/product_knowledge_panels' + - $ref: '#/components/schemas/product_attribute_groups' + get_product_by_barcode: + x-stoplight: + id: cfk5obotr63sa + type: object + allOf: + - $ref: '#/components/schemas/get_product_by_barcode_base' + - type: object + properties: + product: + type: object + allOf: + - $ref: '#/components/schemas/product' + ocr_on_product: type: object - description: | - Metadata of a product (author, editors, creation date, etc.) properties: - created_t: + status: type: integer - description: | - Date when the product was added (UNIX timestamp format). - See also `entry_dates_tags` - example: | - 1457680652 - creator: + example: 1 + crop_a_photo: + type: object + description: 'Select a photo and optionally crop/rotate it. + + The origin of the cropping coordinates is the top-left corner. + + Note that rotation is applied *before* cropping, so the cropping bounding + box + + is relative to the rotated image. + + ' + required: + - id + - code + - imgid + properties: + code: type: string - description: | - The contributor who added the product first. - editors_tags: - description: | - List of editors who edited the product. - type: array - items: - type: string - informers_tags: - type: array - items: - type: string - interface_version_created: + description: Barcode of the product. + example: 04963406 + imgid: + type: integer + description: identifier of the image to select, it should be a number + example: 2 + id: type: string - interface_version_modified: + description: 'identifier of the selected image field, should be in the format + + `{IMAGE_TYPE}_{LANG}` format, where `IMAGE_TYPE` is one of + + `front|ingredients|nutrition|packaging|other` and `LANG` is the 2 letter + + language code. + + Note that if you select an image for the main language of the product + (ex: + + `ingredients_it` if `it` is the main language), this image will be + + displayed on Product Opener for all languages (ex: on + + `https://fr.openfoodfacts.org`, unless `ingredients_fr` exists). + + ' + example: front_en + x1: + type: integer + example: 0 + description: X origin coordinate of the crop, it must be lower than x2 + y1: + type: integer + example: 0 + description: Y origin coordinate of the crop, it must be lower than y2 + x2: + type: integer + example: 145 + description: X end coordinate of the crop, it must be higher than x1 + y2: + type: integer + example: 145 + description: Y end coordinate of the crop, it must be higher than y1 + angle: + type: integer + example: 0 + description: 'angle of the rotation to apply on the selected image. + + passing `90` as value rotate the image 90 degrees counter-clockwise. + + ' + normalize: type: string - languages: - type: object - patternProperties: - 'en:(?\w\w)': - type: integer - description: | - **TODO** explain ! - languages_codes: + example: 'false' + description: whether the selected image should be normalized using ImageMagick + enum: + - 'true' + - 'false' + white_magic: + type: string + default: 'false' + description: 'whether the source image should be white magiced (background + removal) using + + ImageMagick. + + ' + enum: + - 'true' + - 'false' + rotate_a_photo: + type: object + properties: + status: + type: string + example: status ok + imagefield: + type: string + example: nutrition_fr + image: type: object - patternProperties: - (?\w\w): - type: integer - description: | - Same as `languages` but by language code, instead of language tags - languages_hierarchy: + properties: + display_url: + type: string + example: nutrition_fr.67.400.jpg + unselect_a_photo: + type: object + properties: + code: + type: string + description: code of the product + example: '4251105501381' + id: + type: string + description: image field (image id) of the photo to unselect + example: front_fr + combined_add_or_edit_a_product_and_change_ref_properties: + type: object + description: 'Combines properties of add_or_edit_a_product and change_ref_properties' + properties: + code: + type: string + description: The barcode of the product to be added or edited + example: '0074570036004' + user_id: + type: string + description: A valid username. + example: myusername + password: + type: string + description: A valid corresponding password. + example: mypassword + comment: + type: string + description: "A comment for the change. It will be shown in product changes history." + example: new packaging from super-app + brands: type: array items: type: string - languages_tags: + style: form + explode: false + description: The brands of the product (comma separated list of values). + example: "Häagen-Dazs,General-mills" + labels: type: array items: type: string - last_edit_dates_tags: + style: form + explode: false + description: The labels of the product (comma separated list of values). + example: Kosher, Ferrero + categories: type: array items: type: string - last_editor: + style: form + explode: false + description: The categories of the product (comma separated list of values). + example: Desserts, Frozen foods + packaging: type: string - last_modified_by: + description: 'Packaging type, format, material. The [v3 API documentation](https://openfoodfacts.github.io/openfoodfacts-server/api/ref-v3/#operation/post-api-v3-product-barcode) has a more structured data for `packaging`.' + example: Frozen + app_name: type: string - description: | - The username of the user who last modified the product. - example: sebleouf - last_modified_t: - type: integer - description: | - Date when the product page was last modified. - owner: - description: > - Id of the producer in case he provides his own data about a product - (producer platform). + description: 'Name of the app providing the information' + app_version: type: string - owners_tags: - description: | - Tagyfied version of owner + description: 'Version of the app providing the information' + app_uuid: type: string - photographers_tags: - type: array - items: - type: string - rev: - description: revision number of this product version (each edit adds a revision) - type: integer - sources: - type: array - items: - type: object - properties: - fields: - type: array - items: - type: string - id: - type: string - images: - type: array - items: - type: object - import_t: - type: integer - manufacturer: - type: - - integer - - string - name: - type: string - source_licence: - type: string - source_licence_url: - type: string - url: - type: - - 'null' - - string - sources_fields: - type: object - properties: - org-gs1: - type: object - properties: - gln: - type: string - gpcCategoryCode: - type: string - gpcCategoryName: - type: string - isAllergenRelevantDataProvided: - type: string - lastChangeDateTime: - type: string - partyName: - type: string - productionVariantDescription: - type: string - publicationDateTime: - type: string - teams: - type: string - teams_tags: - type: array - items: - type: string - update_key: + description: 'When an app uses a single user to log its contributions, it might be interesting to know which user of the app is providing the information. You can use this field to provide an identifier (e.g., a SHA1 of the username) that is privacy preserving. Make sure that your salt is strong, perfectly random, and secret. In case we have trouble with one of your users, it helps our moderators revert edits.' + user_agent: type: string - Product-Data-Quality: + description: 'It is required that you pass a specific User-Agent header when you do an API request. In some cases, where modification is not possible (e.g., JavaScript in a browser), you can use this parameter.' + required: + - code + - user_id + - password + - imagefield + add_or_edit_a_product: type: object - description: | - This is data that is linked to products data quality + description: 'You can provide most of the properties defined in the product + schema. + + ' properties: - data_quality_bugs_tags: - type: array - items: - type: object - data_quality_errors_tags: - type: array - items: - type: object - data_quality_info_tags: - type: array - items: - type: string - data_quality_tags: - type: array - items: - type: string - data_quality_warnings_tags: - type: array - items: - type: string - data_sources: + code: type: string - description: | - Source of data imported from producers. - data_sources_tags: - type: array - items: - type: string - last_check_dates_tags: - type: array - items: - type: string - last_checked_t: - type: integer - last_checker: + description: The barcode of the product to be added or edited + example: '0074570036004' + user_id: type: string - states: - description: > - comma separated list of values indicating some states of the - product, - - like things to be done, or to be completed. - - See [states - taxonomy](https://static.openfoodfacts.net/data/taxonomies/states.json) + description: A valid username. + example: myusername + password: type: string - states_hierarchy: - type: array - items: - type: string - states_tags: - type: array - items: - description: > - Each state describe something that is completed or is to be done - or improved on the product. - - - Refer to [states - taxonomy](https://static.openfoodfacts.net/data/taxonomies/states.json) - type: string - misc_tags: - description: | - Information about different aspect of the product - type: array - items: - type: string - Product-Knowledge-Panels: - type: object - description: | - Knowledge panels for a product - properties: - knowledge_panels: - type: object - x-stoplight: - id: bcq3fkbtnwr5t - title: panels - description: >- - The panels object is a dictionary of individual panel objects. - - Each key of the dictionary is the id of the panel, and the value is - the panel object. - - - Apps typically display a number of root panels with known panel ids - (e.g. health_card and environment_card). Panels can reference other - panels and display them as sub-panels. - examples: - - additionalProperties: string - properties: - additionalProperties: - title: panel - x-stoplight: - id: mj9nhz3mqn05c - type: object - description: >- - Each panel contains an optional title and an optional array of - elements. - properties: - type: - type: string - description: >- - Type of the panel. If set to "card", the panel and its - sub-panels should be displayed in a card. If set to - "inline", the panel should have its content always - displayed. - expanded: - type: boolean - description: >- - If true, the panel is to be displayed already expanded. If - false, only the title should be displayed, and the user - should be able to click or tap it to open the panel and - display the elements. - expand_for: - type: string - description: >- - If set to "large", the content of the panel should be - expanded on large screens, but it should still be possible - to unexpand it. - evaluation: - type: string - description: >- - A simple assessment of the panel value, typically used to - format fonts, et.c e.g. bad = red - enum: - - good - - average - - neutral - - bad - - unknown - title_element: - title: title_element - x-stoplight: - id: lox0wvl9bdgy2 - type: object - description: The title of a panel. - properties: - name: - type: string - description: >- - A short name of this panel, not including any actual - values - title: - type: string - type: - type: string - enum: - - grade - - percentage - description: >- - Used to indicate how the value of this item is measured, - such as "grade" for Nutri-Score and Eco-Score or - "percentage" for Salt - grade: - type: string - description: >- - The value for this panel where it corresponds to a A to - E grade such as the Nutri-Score of the Eco-Score. - enum: - - a - - b - - c - - d - - e - - unknown - value: - type: number - description: >- - The numeric value of the panel, where the type is - "percentage" - icon_url: - type: string - icon_color_from_evaluation: - type: string - icon_size: - type: string - description: > - If set to "small", the icon should be displayed at a - small size. - elements: - type: array - description: >- - An ordered list of elements to display in the content of the - panel. - items: - title: element - x-stoplight: - id: e2ybdrtmx0tme - type: object - description: > - Each element object contains one specific element object - such as a text element or an image element. - properties: - type: - element_type: string - enum: - - text - - image - - action - - panel - - panel_group - - table - description: > - The type of the included element object. - - The type also indicates which field contains the - included element object. - - e.g. if the type is "text", the included element - object will be in the "text_element" field. - - - Note that in the future, new type of element may be - added, - - so your code should ignore unrecognized types, and - unknown properties. - - - TODO: add Map type - text_element: - title: text_element - x-stoplight: - id: vdwxlt73qnqfa - type: object - description: >- - A text in simple HTML format to display. - - - For some specific texts that correspond to a product - field (e.g. a product name, the ingredients list of a - product),the edit_field_* fields are used to indicate - how to edit the field value. - properties: - type: - type: string - description: > - the type of text, might influence the way you - display it. - enum: - - summary - - warning - - notes - html: - type: string - description: Text to display in HTML format. - language: - type: string - description: >- - Language of the text. The name of the language is - returned in the language requested when making the - API call. e.g. if the text is in Polish, and the - requested language is French, the language field - will contain "Polonais" (French for "Polish"). - Only set for specific fields such as the list of - ingredients of a product. - lc: - type: string - description: >- - 2 letter language code for the text. Only set for - specific fields such as the list of ingredients of - a product. - edit_field_id: - type: string - description: >- - id of the field used to edit this text in the - product edit API. - edit_field_type: - type: string - description: Type of the product field. - edit_field_value: - type: string - description: >- - Current value of the product field. This may - differ from the html field which can contain extra - formating. - source_url: - type: string - description: Link to the source - example: 'https://en.wikipedia.org/wiki/Sodium acetate' - source_text: - type: string - description: name of the source - example: Wikipedia - source_lc: - type: string - description: Source locale name - example: en - source_language: - type: string - description: Human readable source locale name - example: English - image_element: - title: image_element - x-stoplight: - id: k4v4kwt489q3j - type: object - properties: - url: - type: string - description: full URL of the image - width: - type: integer - description: > - Width of the image. - - - This is just a suggestion coming from the server, - - the client may choose to use its own dimensions - for the image. - height: - type: integer - description: > - Height of the image. - - - This is just a suggestion coming from the server, - - the client may choose to use its own dimensions - for the image. - alt_text: - type: string - description: Alt Text of the image. - action_element: - type: string - panel_element: - title: panel_element - x-stoplight: - id: ymx41elz4yrnj - type: object - description: >- - Panels can include other panels as sub-panels using - the panel_element. - properties: - panel_id: - type: string - description: >- - The id of the panel to include. The id is the key - of the panel in the panels object returned in the - knowledge_panels field. - panel_group_element: - title: panel_group_element - x-stoplight: - id: b7emlfrgiuue2 - type: object - properties: - title: - type: string - panel_ids: - type: array - description: >- - The ids of the panels to include. The ids are the - keys of the panels in the panels object returned - in the knowledge_panels field. - items: - type: string - description: >- - The panel group element is used to display an optional - title followed by a number of sub-panels. - table_element: - title: table_element - x-stoplight: - id: 38zu3z4sruqo7 - type: object - description: Element to display a table. - properties: - id: - type: string - description: An id for the table. - title: - type: string - description: | - Title of the column. - rows: - type: string - columns: - type: array - items: - type: object - properties: - type: - type: string - text: - type: string - text_for_small_screens: - type: string - style: - type: string - column_group_id: - type: string - shown_by_default: - type: boolean - required: - - type - level: - type: string - description: | - a message level, as levels we use in log. - It might help theming the panel visualy - example: info - size: - type: string - enum: - - small - description: > - size is either empty (normal display) - - or small to indicate a panel that should have a smaller font - size - example: small - topics: - type: array - items: - type: string - example: health - readOnly: true - Product-Attribute-Groups: - type: object - description: | - Specific data about a product to enable personal ranking - properties: - attribute_groups: - type: array - description: >- - Each element is an attribute that can help compute a personal - ranking for the product - items: - type: object - properties: - id: - type: string - description: | - Unique id of the attribute. + description: A valid corresponding password. + example: mypassword + comment: + type: string + description: "A\_comment for the change. It will be shown in product changes\ + \ history." + example: new packaging from super-app + brands: + schema: + type: array + items: + type: string + style: form + explode: false + description: The brands of the product (comma separated list of values). + example: "H\xE4agen-Dazs,General-mills" + labels: + schema: + type: array + items: + type: string + style: form + explode: false + description: The labels of the product (comma separated list of values). + example: Kosher,Ferroro + categories: + schema: + type: array + items: + type: string + style: form + explode: false + description: The categories of the product (comma separated list of values). + example: Desserts,Frozen foods + packaging: + type: string + description: 'Packaging type, format, material. - It will be use to match against preferences parameters. - status: - type: string - enum: - - known - - unknown - description: >- - wether we have the information to really compute this criteria - or not. - title: - type: string - description: > - A descriptive sentence about the situation of the product - concerning attribute - example: 'Does not contain: Molluscs' - match: - type: number - format: float - minimum: 0 - maximum: 100 - description: > - a numeric value for the match, + The [v3 API documentation](https://openfoodfacts.github.io/openfoodfacts-server/api/ref-v3/#operation/post-api-v3-product-barcode) - telling how much the products ranks well for this particular - attribute. + has a more structured data for `packaging`. - The higher the value, the better the match. - grade: - description: every attribute as a grade for a to e - type: string - enum: - - unknown - - a - - b - - c - - d - - e - name: - type: string - description: 'The name of attribute, for eventual display' - icon_url: - type: string - description: an icon representing the attribute match (often using a color) - description: - type: string - description: >- - An eventual description of the value of the property upon - which this attribute is based - description_short: - type: string - description: >- - An eventual short description of the value of the property - upon which this attribute is based - Product: + ' + example: Frozen + required: + - code + - user_id + - password + change_ref_properties: type: object - description: > - This is all the fields describing a product and how to display it on a - page. - + description: 'Properties that goes in change ref - Refer to the different sub schema for more readable entries: - - - * [Product Base](#cmp--schemas-product-base): Base fields of a product - - * [Product Misc](#cmp--schemas-product-misc): Miscellaneous but - important fields of a product - - * [Product Tags](#cmp--schemas-product-tags): Tags fields on a product - - * [Product Nutrition](#cmp--schemas-product-nutrition): Nutrition fields - of a product - - * [Product Ingredients](#cmp--schemas-product-ingredients): Fields about - ingredients of a product - - * [Product Images](#cmp--schemas-product-images): Information about - Images of a product - - * [Product Eco-Score](#cmp--schemas-product-images): Fields related to - Eco-Score for a product - - * [Product Metadata](#cmp--schemas-product-ecoscore): Metadata of a - product (author, editors, etc.) - - * [Product Data Quality](#cmp--schemas-product-quality): fields related - to data quality for a product - - * [Product Knowledge Panels](#cmp--schemas-product-knowledge-panels): - Knowledge panels for a product - - * [Product Attribute Groups](#cmp--schemas-product-attribute-groups): - Attribute groups for personal product matching - allOf: - - type: object - description: | - Base product data - properties: - abbreviated_product_name: - type: string - description: Abbreviated name in requested language - code: - type: string - description: > - barcode of the product (can be EAN-13 or internal codes for some - food stores), + ' + properties: + comment: + type: string + description: 'A comment on the contribution. - for products without a barcode, + Adding meaningful comments help moderators and users understand a single + product history. - Open Food Facts assigns a number starting with the 200 reserved - prefix - codes_tags: - type: array - items: - type: string - description: | - A value which is the type of barcode "code-13" or "code-8" - and - A series of mask for the barcode - It helps retrieve barcodes starting by - example: > - ["code-13","3017620422xxx","301762042xxxx","30176204xxxxx","3017620xxxxxx","301762xxxxxxx","30176xxxxxxxx","3017xxxxxxxxx","301xxxxxxxxxx","30xxxxxxxxxxx","3xxxxxxxxxxxx"] - generic_name: - type: string - description: | - Legal name of the product as regulated - by the European authorities. - id: - description: > - internal identifier for the product, usually set to the value of - `code`, - - except on the producers platform where it is prefixed by the - owner - type: string - lc: - type: string - description: | - Main language of the product. - This is a duplicate of `lang` property (for historical reasons). - lang: - type: string - description: > - Main language of the product. + ' + app_name: + type: string + description: 'Name of the app providing the information + ' + app_version: + type: string + description: 'Version of the app providing the information - This should be the main language of product packaging (if one is - predominant). + ' + app_uuid: + type: string + description: 'When an app uses a single user to log its contributions, - - Main language is also used to decide which ingredients list to - parse. - nova_group: - type: integer - description: > - Nova group as an integer from 1 to 4. See - https://world.openfoodfacts.org/nova - nova_groups: - type: string - obsolete: - type: string - obsolete_since_date: - description: | - A date at which the product was declared obsolete. - This means it's not produced any more. - type: string - product_name: - type: string - description: | - The name of the product - product_name_en: - type: string - description: | - The name of the product can also - be in many other languages like - product_name_fr (for French). - product_quantity: - type: string - description: | - The size in g or ml for the whole product. - It's a normalized version of the quantity field. - example: '500' - product_quantity_unit: - type: string - description: | - The unit (either g or ml) for the correponding product_quantity. - example: g - quantity: - type: string - description: | - Quantity and Unit. - patternProperties: - abbreviated_product_name_(?\w\w): - type: string - description: Abbreviated name in language `language_code`. - generic_name_(?\w\w): - type: string - description: | - This can be returned in many other languages - like generic_name_fr (for French). - - type: object - description: | - Miscellaneous but important fields of a product - properties: - additives_n: - type: integer - description: | - Number of food additives. - checked: - type: string - complete: - type: integer - completeness: - type: number - ecoscore_grade: - type: string - description: | - See also: `ecoscore_tags` - ecoscore_score: - type: integer - description: | - See also: `ecoscore_tags` - food_groups: - type: string - food_groups_tags: - type: array - items: - type: string - nutrient_levels: - description: | - Traffic light indicators on main nutrients levels - type: object - properties: - fat: - type: string - enum: - - low - - moderate - - high - salt: - type: string - enum: - - low - - moderate - - high - saturated-fat: - type: string - enum: - - low - - moderate - - high - sugars: - type: string - enum: - - low - - moderate - - high - packaging_text: - type: string - description: | - Recycling instructions as raw text, e.g. Plastic - bottle to recycle, Plastic cap to recycle. - This will get automatically parsed and - will be used to compute the Eco-Score. - You can either request it (if it exists) or - send it in a specific language. - example: packaging_text_en - packagings: - type: array - x-stoplight: - id: 1cyz4qo9njog7 - title: Packagings (READ) - description: >- - The packagings object is an array of individual packaging - component objects. - - - The Packaging data document explains how packaging data is - structured in Open Food Facts: - https://openfoodfacts.github.io/openfoodfacts-server/dev/explain-packaging-data/ - - - The shape, material and recycling properties of each packaging - component are linked to entries in the packaging_shapes, - packaging_materials and packaging_recycling taxonomies: - - - https://world.openfoodfacts.org/data/taxonomies/packaging_shapes.json - - https://world.openfoodfacts.org/data/taxonomies/packaging_materials.json - - https://world.openfoodfacts.org/data/taxonomies/packaging_recycling.json - - - If the tags_lc field is set, the properties will include a - lc_name field with the translation in the requested language. - examples: - - - number_of_units: 6 - shape: - id: 'en:bottle' - lc_name: bouteille - material: - id: 'en:bottle' - lc_name: bouteille - recycling: - id: 'en:bottle' - lc_name: bouteille - quantity_per_unit: 25 cl - quantity_per_unit_value: 25 - quantity_per_unit_unit: cl - weight_specified: 30 - weight_measured: 32 - weight_estimated: 26 - weight: 30 - weight_source_id: specified - items: - description: >- - Each packaging component has different properties to specify - how many there are, its shape, material etc. - - - The shape, material and recycling properties are mapped to one - entry in the packaging_shapes, packaging_materials and - packaging_recycling taxonomies, and the value of the property - is the canonical name of the taxonomy entry (e.g. en:bottle). - - - They may contain values that could not yet get matched to - their respective taxonomy, in which case they will contain a - free text value prefixed with the language code of this text - value (e.g. "fr:Bouteille sphérique" might have been entered - by a French user to indicate it is a spherical bottle). - title: Packaging component (READ) - type: object - examples: - - number_of_units: 6 - shape: - id: 'en:bottle' - lc_name: bouteille - material: - id: 'en:bottle' - lc_name: bouteille - recycling: - id: 'en:bottle' - lc_name: bouteille - quantity_per_unit: 25 cl - quantity_per_unit_value: 25 - quantity_per_unit_unit: cl - weight_specified: 30 - weight_measured: 32 - weight_estimated: 26 - weight: 30 - weight_source_id: specified - properties: - number_of_units: - type: integer - description: >- - umber of units of this packaging component contained in - the product (e.g. 6 for a pack of 6 bottles) - shape: - title: Packaging component shape - x-stoplight: - id: xrj8agza3dwgf - type: object - description: >- - The shape property is canonicalized using the - packaging_shapes taxonomy. - examples: - - id: 'en:bottle' - lc_name: bouteille - properties: - id: - type: string - description: >- - Canonical id of the entry in the taxonomy. If the - value cannot be mapped to a taxonomy entry, the value - will be the name of the entry in its original language - prefixed by the language 2 letter code and a colon. - lc_name: - type: string - description: >- - Name of the entry in the language requested in the - tags_lc field of the request. This field is returned - only of tags_lc is specified. If the translation is - not available, or if the entry does not exist in the - taxonomy, the value will be the name of the entry in - its original language prefixed by the language 2 - letter code and a colon. - material: - title: Packaging component material - x-stoplight: - id: n6umazgqmwrd5 - type: object - description: >- - The material property is canonicalized using the - packaging_materials taxonomy. - examples: - - id: 'en:bottle' - lc_name: bouteille - properties: - id: - type: string - description: >- - Canonical id of the entry in the taxonomy. If the - value cannot be mapped to a taxonomy entry, the value - will be the name of the entry in its original language - prefixed by the language 2 letter code and a colon. - lc_name: - type: string - description: >- - Name of the entry in the language requested in the - tags_lc field of the request. This field is returned - only of tags_lc is specified. If the translation is - not available, or if the entry does not exist in the - taxonomy, the value will be the name of the entry in - its original language prefixed by the language 2 - letter code and a colon. - recycling: - title: Packaging component recycling instruction - x-stoplight: - id: 376tk8e2cmyh2 - type: object - description: >- - The recycling property is canonicalized using the - packaging_recycling taxonomy. - examples: - - id: 'en:bottle' - lc_name: bouteille - properties: - id: - type: string - description: >- - Canonical id of the entry in the taxonomy. If the - value cannot be mapped to a taxonomy entry, the value - will be the name of the entry in its original language - prefixed by the language 2 letter code and a colon. - lc_name: - type: string - description: >- - Name of the entry in the language requested in the - tags_lc field of the request. This field is returned - only of tags_lc is specified. If the translation is - not available, or if the entry does not exist in the - taxonomy, the value will be the name of the entry in - its original language prefixed by the language 2 - letter code and a colon. - quantity_per_unit: - type: string - description: >- - Quantity (weight or volume) of food product contained in - the packaging component. (e.g. 75cl for a wine bottle) - quantity_per_unit_value: - type: number - description: Value parsed from the quantity field. - quantity_per_unit_unit: - type: string - description: Unit parsed and normalized from the quantity field. - weight_specified: - type: number - description: >- - Weight (as specified by the manufacturer) of one unit of - the empty packaging component (in grams). (e.g. for a 6 - pack of 1.5l water bottles, it might be 30, the weight in - grams of 1 empty water bottle without its cap which is a - different packaging component). - weight_measured: - type: number - description: >- - Weight (as measured by one or more users) of one unit of - the empty packaging component (in grams). (e.g. for a 6 - pack of 1.5l water bottles, it might be 30, the weight in - grams of 1 empty water bottle without its cap which is a - different packaging component). - weight_estimated: - type: number - description: >- - Weight (as estimated from similar products) of one unit of - the empty packaging component (in grams). (e.g. for a 6 - pack of 1.5l water bottles, it might be 30, the weight in - grams of 1 empty water bottle without its cap which is a - different packaging component). - weight: - type: number - description: Weight of one unit of the empty packaging component. - weight_source_id: - type: string - description: >- - Indicates which field was used to populate the "weight" - field. Either "specified", "measured", or "estimated" - readOnly: true - packagings_complete: - title: packagings_complete - x-stoplight: - id: hxnnsy954q1ey - type: integer - minimum: 0 - maximum: 1 - description: >- - Indicate if the packagings array contains all the packaging - parts of the product. This field can be set by users when they - enter or verify packaging data. Possible values are 0 or 1. - pnns_groups_1: - description: > - Category of food according to [French Nutrition and Health - Program](https://fr.wikipedia.org/wiki/Programme_national_nutrition_sant%C3%A9) - type: string - pnns_groups_1_tags: - type: array - items: - type: string - pnns_groups_2: - description: > - Sub Category of food according to [French Nutrition and Health - Program](https://fr.wikipedia.org/wiki/Programme_national_nutrition_sant%C3%A9) - type: string - pnns_groups_2_tags: - type: array - items: - type: string - popularity_key: - description: > - An imprecise measurement of popularity based on Scan statistics. - A higher value means higher popularity. - type: integer - popularity_tags: - description: > - Indicators for the popularity of a product, like the amount of - scans in a specific year. - type: array - items: - type: string - scans_n: - type: integer - unique_scans_n: - type: integer - serving_quantity: - type: string - description: | - Normalized version of serving_size. - Note that this is NOT the number of servings by product. - (in perl, see `normalize_serving_size`) - serving_quantity_unit: - type: string - description: | - The unit (either g or ml) for the correponding serving_quantity. - example: g - serving_size: - type: string - description: > - Serving size text (generally in g or ml). - - We expect a quantity + unit but the user is free to input any - string. - patternProperties: - food_groups_(?\w\w): - type: string - description: see `food_groups` - packaging_text_(?\w\w): - type: string - description: | - Packaging text in language designated by `language_code` - - type: object - description: | - Data about a product which is represented as tags - properties: - brands: - type: string - description: List of brands (not taxonomized) - brands_tags: - type: array - items: - type: string - description: 'List of brands (tags, not taxonomized)' - categories: - type: string - categories_hierarchy: - type: array - items: - type: string - categories_lc: - type: string - description: Categories language code - categories_tags: - type: array - items: - type: string - checkers_tags: - type: array - items: - type: string - description: List of checkers (users who checked the product) tags - cities: - type: string - cities_tags: - type: array - items: - type: object - correctors_tags: - type: array - items: - type: string - countries: - type: string - description: | - List of countries where the product is sold. - countries_hierarchy: - type: array - items: - type: string - countries_lc: - type: string - description: Countries language code - countries_tags: - type: array - items: - type: string - ecoscore_tags: - description: > - All ecoscore of a product. - - Most of the time it's only one value, - - but it might eventually be more for products composed of - sub-products. - - See also: `ecoscore_score`, `ecoscore_grade`. - type: array - items: - type: string - emb_codes: - type: string - description: > - Packager code. EMB is the French system of traceability codes - for packager. - example: EMB 2013330 - emb_codes_orig: - type: string - emb_codes_tags: - type: array - items: - type: object - labels: - type: string - labels_hierarchy: - type: array - items: - type: string - labels_lc: - type: string - labels_tags: - type: array - items: - type: string - entry_dates_tags: - description: | - The data as a series of tag: `yyyy-mm-dd`, `yyyy-mm`, `yyyy` - type: array - items: - type: string - example: - - '2016-03-11' - - 2016-03 - - '2016' - manufacturing_places: - type: string - description: | - Places where the product was manufactured or transformed. - manufacturing_places_tags: - type: array - items: - type: object - nova_groups_tags: - type: array - items: - type: string - nutrient_levels_tags: - type: array - items: - type: string - - type: object - description: > - Information about Images of a product. - - - Images ensure the reliability of Open Food Facts data. - - It provides a primary source and proof of all the structured data. - - You may therefore want to display it along the structured + it might be interesting to know which user of the app is providing the information. - - See also tutorials about images: - - * [Getting - images](https://openfoodfacts.github.io/openfoodfacts-server/api/how-to-download-images/) - - * [Uploading - images](https://openfoodfacts.github.io/openfoodfacts-server/api/tutorial-uploading-photo-to-a-product/) - properties: - images: - description: > - This contains properties for all images contained on the - product. - type: object - properties: - '1': - type: object - description: > - This object represent an image that was uploaded to a - product. - - "imgid" is an integer which is a sequential number unique to - each picture. - properties: - sizes: - type: object - description: > - The available image sizes for the product (both reduced - and full). - - The reduced images are the ones with numbers as the key( - 100, 200 etc) - - while the full images have `full` as the key. - properties: - full: - description: | - properties of fullsize image - **TODO** explain how to compute name - type: object - properties: - h: - type: integer - example: 400 - description: | - The height of the reduced/full image in pixels. - w: - type: integer - example: 255 - description: The width of the reduced/full image in pixels. - patternProperties: - (?100|400): - description: > - properties of thumbnail of size `image_size`. - - **TODO** explain how to compute name - - - For real type: see description of property `full`. - - (Put this way because of a [bug in - rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) - type: string - uploaded_t: - type: string - example: '1457680652' - description: | - The time the image was uploaded (as unix timestamp). - uploader: - type: string - example: openfoodfacts-contributors - description: | - The contributor that uploaded the image. - front: - description: > - property of an image (or part thereof) selected for a - particular role and a particular language. - type: object - properties: - angle: - type: integer - example: 0 - description: The angle of the image rotation (if it was rotated). - coordinates_image_size: - type: string - example: full - geometry: - type: string - example: 0x0--1--1 - imgid: - type: string - example: '121' - description: >- - The id of the original/source image that was selected to - edit(rotate, normalize etc) to produce this new image. - normalize: - type: 'null' - example: null - description: Normalize colors. - rev: - type: string - example: '420' - sizes: - type: object - description: > - The available image sizes for the product (both reduced - and full). - - The reduced images are the ones with numbers as the key( - 100, 200 etc) - - while the full images have `full` as the key. - properties: - '100': - type: object - properties: - h: - type: integer - example: 400 - description: | - The height of the reduced/full image in pixels. - w: - type: integer - example: 255 - description: The width of the reduced/full image in pixels. - '200': - type: object - properties: - h: - type: integer - example: 400 - description: | - The height of the reduced/full image in pixels. - w: - type: integer - example: 255 - description: The width of the reduced/full image in pixels. - '400': - type: object - properties: - h: - type: integer - example: 400 - description: | - The height of the reduced/full image in pixels. - w: - type: integer - example: 255 - description: The width of the reduced/full image in pixels. - full: - type: object - properties: - h: - type: integer - example: 400 - description: | - The height of the reduced/full image in pixels. - w: - type: integer - example: 255 - description: The width of the reduced/full image in pixels. - white_magic: - type: 'null' - example: null - description: > - Photo on white background : Try to remove the - background. - x1: - type: string - example: '-1' - x2: - type: string - example: '-1' - y1: - type: string - example: '-1' - y2: - type: string - example: '-1' - patternProperties: - (?\d+): - description: > - See property `1` to get the real type of those objects - - (Put this way because of a [bug in - rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) - type: string - (?front|nutrition|ingredients|packaging|other)_(?\w\w): - description: > - See property `front` to get the real type of those objects - - (Put this way because of a [bug in - rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) - type: string - last_image_dates_tags: - type: array - items: - type: string - last_image_t: - description: timestamp of last image upload (or update?) - type: integer - selected_images: - type: object - description: | - URL for selected (important) images of the product. - - This is very handy if you display the product to users. - properties: - front: - type: object - description: URLs of thumbnails image of image of type `image_type` - properties: - display: - description: > - Thumbnail urls of product image (front) adapted to - display on product page - type: object - patternProperties: - (?\w\w): - type: string - description: url of the image for language `language_code` - small: - description: > - Thumbnail urls of product image (front) adapted to - display on product list page - type: object - patternProperties: - (?\w\w): - type: string - description: url of the image for language `language_code` - thumb: - description: > - Thumbnail urls of product image (front) in smallest - format - type: object - patternProperties: - (?\w\w): - type: string - description: url of the image for language `language_code` - patternProperties: - (?front|packaging|ingredients|nutrition|other): - description: > - See property `front` to get the real type of those objects - - (Put this way because of a [bug in - rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) - type: string - image_small_url: - type: string - image_thumb_url: - type: string - image_url: - type: string - patternProperties: - image(_(?front|packaging|ingredients|nutrition|other))?(_(?small|thumb))?_url: - description: > - the URL of image of type `image_type` in size `image_size` (or - full size if not given). - - - The `image_type` tells which image the url correspond to. - `image_type` is `front` if not provided. - - - The image is the one for current language (affected by `lc` - parameter) if an image exists for this language, the image in - main product language otherwise. - - - **IMPORTANT:** you should use `selected_images` field instead - of this one. - type: string - - type: object - description: | - Fields related to Eco-Score for a product. - - See also: `ecoscore_score`, `ecoscore_grade` and `ecoscore_tags`. - properties: - ecoscore_data: - type: object - description: > - An object about a lot of details about data needed for Eco-Score - computation - - and complementary data of interest. - properties: - adjustments: - type: object - properties: - origins_of_ingredients: - type: object - properties: - aggregated_origins: - type: array - items: - type: object - properties: - origin: - type: string - percent: - type: integer - epi_score: - type: integer - epi_value: - type: integer - origins_from_origins_field: - type: array - items: - type: string - transportation_scores: - type: object - patternProperties: - (?\w\w): - type: integer - transportation_values: - type: object - patternProperties: - (?\w\w): - type: integer - values: - type: object - patternProperties: - (?\w\w): - type: integer - warning: - type: string - packaging: - type: object - properties: - non_recyclable_and_non_biodegradable_materials: - type: integer - packagings: - type: array - items: - type: object - properties: - ecoscore_material_score: - type: integer - ecoscore_shape_ratio: - type: integer - material: - type: string - shape: - type: string - score: - type: integer - value: - type: integer - warning: - type: string - production_system: - type: object - properties: - labels: - type: array - example: 'vegan, fat free, Kosher' - items: - type: string - value: - type: integer - warning: - type: string - threatened_species: - type: object - properties: - ingredient: - type: string - value: - type: integer - agribalyse: - type: object - properties: - agribalyse_food_code: - type: string - co2_agriculture: - type: number - co2_consumption: - type: integer - co2_distribution: - type: number - co2_packaging: - type: number - co2_processing: - type: number - co2_total: - type: number - co2_transportation: - type: number - code: - type: string - dqr: - type: string - ef_agriculture: - type: number - ef_consumption: - type: integer - ef_distribution: - type: number - ef_packaging: - type: number - ef_processing: - type: number - ef_total: - type: number - ef_transportation: - type: number - is_beverage: - type: integer - name_en: - type: string - description: | - This can be returned in many other languages - like name_fr (for french). - score: - type: integer - version: - type: string - grade: - type: string - grades: - type: object - patternProperties: - (?\w\w): - type: string - missing: - type: object - properties: - labels: - type: integer - origins: - type: integer - packagings: - type: integer - missing_data_warning: - type: integer - previous_data: - type: object - properties: - grade: - type: string - score: - type: integer - agribalyse: - type: object - properties: - agribalyse_food_code: - type: string - co2_agriculture: - type: number - co2_consumption: - type: integer - co2_distribution: - type: number - co2_packaging: - type: number - co2_processing: - type: number - co2_total: - type: number - co2_transportation: - type: number - code: - type: string - dqr: - type: string - ef_agriculture: - type: number - ef_consumption: - type: integer - ef_distribution: - type: number - ef_packaging: - type: number - ef_processing: - type: number - ef_total: - type: number - ef_transportation: - type: number - is_beverage: - type: integer - name_en: - type: string - description: | - This can be returned in many other languages - like name_fr (for french). - score: - type: integer - version: - type: string - score: - type: integer - scores: - type: object - patternProperties: - (?\w\w): - type: integer - status: - type: string - ecoscore_extended_data_version: - type: string - environment_impact_level: - type: string - environment_impact_level_tags: - type: array - items: - type: object - - type: object - description: Fields about ingredients of a product - properties: - additives_tags: - type: array - items: - type: string - allergens: - type: string - description: comma separated list of allergens - allergens_lc: - type: string - description: language in which `allergens` where input - allergens_hierarchy: - type: array - items: - type: string - allergens_tags: - type: array - items: - type: string - ingredients: - type: array - description: > - This structure gives the different ingredients and some - information about them, - - like estimate on their quantity. - items: - type: object - properties: - id: - type: string - ingredients: - description: | - Sub ingredients composing this ingredients. - $ref: '#' - percent: - type: integer - percent_estimate: - type: - - number - percent_max: - type: - - number - percent_min: - type: integer - text: - type: string - vegan: - type: string - vegetarian: - type: string - ingredients_analysis: - type: object - properties: - 'en:palm-oil': - type: array - items: - type: string - 'en:vegan-status-unknown': - type: array - items: - type: string - 'en:vegetarian-status-unknown': - type: array - items: - type: string - ingredients_analysis_tags: - type: array - items: - type: string - ingredients_from_or_that_may_be_from_palm_oil_n: - type: integer - ingredients_from_palm_oil_n: - type: integer - ingredients_from_palm_oil_tags: - type: array - items: - type: object - ingredients_hierarchy: - type: array - items: - type: string - ingredients_n: - type: integer - ingredients_n_tags: - type: array - items: - type: string - ingredients_original_tags: - type: array - items: - type: string - ingredients_percent_analysis: - type: integer - ingredients_sweeteners_n: - type: integer - description: > - Number of sweeteners additives in the ingredients. Undefined if - ingredients are not specified. - ingredients_non_nutritive_sweeteners_n: - type: integer - description: > - Number of non-nutritive sweeteners additives (as specified in - the Nutri-Score formula) in the ingredients. Undefined if - ingredients are not specified. - ingredients_tags: - type: array - items: - type: string - ingredients_lc: - type: string - description: > - Language that was used to parse the ingredient list. If - `ingredients_text` is available - - for the product main language (`lang`), `ingredients_lc=lang`, - otherwise we look at - - `ingredients_text` fields for other languages and set - `ingredients_lc` to the first - - non-empty `ingredient_text`. - ingredients_text: - type: string - description: > - Raw list of ingredients. This will get automatically - - parsed and get used to compute the Eco-Score or find allergens, - etc.. - - - It's a copy of ingredients_text in the main language of the - product (see `lang` proprety). - example: > - Farine de blé* 67,4%, sucre de canne*, huile de tournesol - oléique*, graines de chia* 5,2%, son de blé*, oranges - déshydratées * 0,9%, farine de riz*, poudres à lever (acide - citrique, carbonates de sodium), arôme naturel d'orange. - ingredients_text_with_allergens: - type: string - description: > - Same text as `ingredients_text` but where allergens have HTML - elements around them to identify them - example: > - Farine de blé* 67,4%, sucre de - canne*, huile de tournesol oléique*, graines de chia* 5,2%, - son de blé*, oranges déshydratées - * 0,9%, farine de riz*, poudres à lever (acide citrique, - carbonates de sodium), arôme naturel d'orange. - ingredients_that_may_be_from_palm_oil_n: - type: integer - ingredients_that_may_be_from_palm_oil_tags: - type: array - items: - type: object - ingredients_with_specified_percent_n: - type: integer - ingredients_with_specified_percent_sum: - type: integer - ingredients_with_unspecified_percent_n: - type: integer - ingredients_with_unspecified_percent_sum: - type: integer - known_ingredients_n: - type: integer - origins: - type: string - description: | - Origins of ingredients - origins_hierarchy: - type: array - items: - type: object - origins_lc: - type: string - origins_tags: - type: array - items: - type: object - traces: - type: string - description: | - List of substances that might cause allergies - that are present in trace amounts in the product - (this does not include the ingredients, as they - are not only present in trace amounts). - It is taxonomized with the allergens taxonomy. - traces_hierarchy: - type: array - items: - type: object - traces_lc: - type: string - traces_tags: - type: array - items: - type: object - unknown_ingredients_n: - type: integer - patternProperties: - ingredients_text_(?\w\w): - type: string - description: | - Raw list of ingredients in language given by 'language_code'. - - See `ingredients_text` - ingredients_text_with_allergens_(?\w\w): - description: | - Like `ingredients_text_with_allergens` for a particular language - type: string - - type: object - description: > - Nutrition fields of a product - - - Most of these properties are read-only. - - - See [how to add nutrition - data](https://openfoodfacts.github.io/openfoodfacts-server/api/ref-cheatsheet/#add-nutrition-facts-values-units-and-base) - properties: - no_nutrition_data: - type: string - description: | - When a product does not have nutrition data displayed on the - packaging, the user can check the field "Nutrition facts are - not specified on the product". - By doing so, the no_nutrition_data field takes the value "on". - This case is frequent (thousands of products). - example: 'on' - nutrition_data_per: - type: string - enum: - - serving - - 100g - description: > - The nutrition data on the package can be per serving or per - 100g. - - - This is essential to understand if `_value` and - `` - - values in `nutriments` applies for a serving or for 100g. - - - **IMPORTANT:** - - When writing products, - - this setting applies to all existing nutrients values for the - product, - - not only the nutrient values sent in the write request. - - So it should not be changed unless all nutrients values are - provided - - with values that match the nutrition_data_per field. - nutrition_data_prepared_per: - type: string - enum: - - serving - - 100g - description: > - The nutrition data for prepared product on the package (if any) - can be per serving or per 100g. - - - This is essential to understand if `_prepared_value` - and `_prepared` - - values in `nutriments` applies for a serving or for 100g. - - - See also important note on `nutrition_data_per`. - nutriments: - type: object - description: > - All known nutrients for the product. - - - Note that each nutrients are declined with a variety of suffixes - like `_100g`, `_serving`, - - see patternProperties below. - - - A specific `_unit` is the unit used to measure the nutrient. - - - Beware that some properties are to be interpreted based upon - `nutrition_data_per` value. - - - Also for products that have a nutrition table for prepared - product - - (eg. the nutrition facts for a bowl of milk with cocoa powder), - - a `_prepared` suffix is added (before other suffixes). - - - You can get all possible nutrients from the - - [nutrients - taxonomy](https://static.openfoodfacts.org/data/taxonomies/nutrients.json) - - - **FIXME** add more nutrients with description. - properties: - alcohol: - description: | - Quantity of alcohol - - (per 100g or per serving) in a standard unit (g or ml) - type: number - carbohydrates: - type: number - energy: - type: number - description: > - It is the same as `energy-kj` if we have it, or computed - from `energy-kcal` otherwise - - - (per 100g or per serving) in kj - energy_value: - type: number - description: > - energy_value will be equal to energy-kj_value if we have it - or to energy-kcal_value otherwise - energy_unit: - type: string - enum: - - kcal - - kj - description: > - Equal to energy-kj_unit if we have it or to energy-kcal_unit - otherwise - energy-kcal: - type: number - description: | - energy in kcal, if it is specified - - (per 100g or per serving) in a standard unit (g or ml) - energy-kj: - type: number - description: | - energy in kj, if it is specified - - (per 100g or per serving) in a standard unit (g or ml) - fat: - type: number - fruits-vegetables-legumes-estimate-from-ingredients: - type: number - description: > - An estimate, from the ingredients list of the percentage of - fruits, vegetable and legumes. - - This is an important information for Nutri-Score (2023 - version) computation. - fruits-vegetables-nuts-estimate-from-ingredients: - type: number - description: > - An estimate, from the ingredients list of the percentage of - fruits, vegetable and nuts. - - This is an important information for Nutri-Score (2021 - version) computation. - nova-group: - type: integer - nutrition-score-fr: - description: | - Experimental nutrition score derived from - the UK FSA score and adapted for the French market - (formula defined by the team of Professor Hercberg). - proteins: - type: number - salt: - type: number - saturated-fat: - type: number - sodium: - type: number - sugars: - type: number - carbon-footprint-from-known-ingredients_product: - type: integer - carbon-footprint-from-known-ingredients_serving: - type: number - erythritol: - type: number - description: | - erythritol is a polyol which is not providing any energy. - As such, it needs not be taken into account when computing - the energy of a product. Eryhtritol is now displayed on - nutrition facts sheet of some products, mainly in the USA. - This value is entered either by contributors, either by - imports. - example: 12.5 - patternProperties: - '(?[\w-]+)_unit': - description: "The unit in which the nutrient for 100g or per serving is measured.\n\nThe possible values depends on the nutrient.\n\n* `g` for grams\n* `mg` for milligrams\n* `μg` for micrograms\n* `cl` for centiliters\n* `ml` for mililiters\n* `dv` for recommended daily intakes (aka [Dietary Reference Intake](https://en.wikipedia.org/wiki/Dietary_Reference_Intake))\n* `% vol` for alcohol vol per 100 ml\n\n\U0001F913 code: see the [Units module][units-module],\nand [Food:default_unit_for_nid function][default-unit]\n\n[units-module]: https://openfoodfacts.github.io/openfoodfacts-server/dev/ref-perl-pod/ProductOpener/Units.html\n[default-unit]: https://openfoodfacts.github.io/openfoodfacts-server/dev/ref-perl-pod/ProductOpener/Food.html#default_unit_for_nid_(_%24nid)\n" - type: string - enum: - - 公斤 - - 公升 - - kg - - кг - - l - - л - - 毫克 - - mg - - мг - - mcg - - µg - - oz - - fl oz - - dl - - дл - - cl - - кл - - 斤 - - g - - '' - - ' ' - - kj - - 克 - - 公克 - - г - - мл - - ml - - mmol/l - - 毫升 - - '% vol' - - ph - - '%' - - '% dv' - - '% vol (alcohol)' - - iu - - mol/l - - mval/l - - ppm - - �rh - - �fh - - �e - - �dh - - gpg - '(?[\w-]+)_100g': - description: > - The standardized value of a serving of 100g (or 100ml for - liquids) - - for the nutrient. - - - This is computed from the `nutrient` property, - - the serving size (if needed), and the `nutrient`_unit field. - - - **Note**: - - If you want to characterize products in a uniform way, this - is the value you should use. - type: number - readOnly: true - '(?[\w-]+)_serving': - description: | - The standardized value of a serving for this product. - type: number - readOnly: true - '(?[\w-]+)_value': - description: > - The value input by the user / displayed on the product for - the nutrient. - - - * per 100g or serving, depending on `nutrition_data_per` - - * in the unit of corresponding _unit field. - type: number - readOnly: true - '(?[\w-]+)_prepared': - description: | - The value for nutrient for **prepared** product. - type: number - '(?[\w-]+)_prepared_unit': - description: > - The unit in which the nutrient of **prepared** product is - measured. - type: string - '(?[\w-]+)_prepared_100g': - description: > - The standardized value of a serving of 100g (or 100ml for - liquids) - - for the nutrient, for **prepared** product. - type: number - readOnly: true - '(?[\w-]+)_prepared_serving': - description: > - The standardized value of a serving for the **prepared** - product. - type: number - readOnly: true - '(?[\w-]+)_prepared_value': - description: > - The standardized value for a serving or 100g (or 100ml for - liquids), - - depending on `nutrition_data_prepared_per` - - for the nutrient for **prepared** product. - type: number - readOnly: true - nutriscore_data: - description: > - Detail of data the Nutri-Score was computed upon. - - - **Note**: this might not be stable, don't rely too much on this, - or, at least, tell us ! - - - **TODO** document each property - type: object - properties: - energy: - type: integer - energy_points: - type: integer - energy_value: - type: integer - fiber: - type: integer - fiber_points: - type: integer - fiber_value: - type: integer - fruits_vegetables_nuts_colza_walnut_olive_oils: - type: integer - fruits_vegetables_nuts_colza_walnut_olive_oils_points: - type: integer - fruits_vegetables_nuts_colza_walnut_olive_oils_value: - type: integer - grade: - type: string - is_beverage: - type: integer - is_cheese: - type: integer - is_fat: - type: integer - is_water: - type: integer - negative_points: - type: integer - positive_points: - type: integer - proteins: - type: number - proteins_points: - type: integer - proteins_value: - type: number - saturated_fat: - type: number - saturated_fat_points: - type: integer - saturated_fat_ratio: - type: number - saturated_fat_ratio_points: - type: integer - saturated_fat_ratio_value: - type: number - saturated_fat_value: - type: number - score: - type: integer - sodium: - type: number - sodium_points: - type: integer - sodium_value: - type: number - sugars: - type: number - sugars_points: - type: integer - sugars_value: - type: number - nutriscore_grade: - description: | - Nutri-Score for the product as a letter. - - See https://world.openfoodfacts.org/nutriscore. - type: string - enum: - - a - - b - - c - - d - - e - nutriscore_score: - description: > - Nutri-Score for the product as an integer (see also - `nutriscore_grade`). - type: integer - nutriscore_score_opposite: - type: integer - nutrition_grade_fr: - type: string - description: | - Nutrition grade (‘a’ to ‘e’), - https://world.openfoodfacts.org/nutriscore. - nutrition_grades: - description: > - Nutrition grades as a comma separated list. - - - Some products with multiple components might have multiple - Nutri-Score - type: string - nutrition_grades_tags: - type: array - items: - type: string - nutrition_score_beverage: - type: integer - nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients: - type: integer - nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients_value: - type: integer - nutrition_score_warning_no_fiber: - type: integer - other_nutritional_substances_tags: - type: array - items: - type: object - unknown_nutrients_tags: - type: array - items: - type: object - vitamins_tags: - type: array - items: - type: object - - type: object - description: | - This is data that is linked to products data quality - properties: - data_quality_bugs_tags: - type: array - items: - type: object - data_quality_errors_tags: - type: array - items: - type: object - data_quality_info_tags: - type: array - items: - type: string - data_quality_tags: - type: array - items: - type: string - data_quality_warnings_tags: - type: array - items: - type: string - data_sources: - type: string - description: | - Source of data imported from producers. - data_sources_tags: - type: array - items: - type: string - last_check_dates_tags: - type: array - items: - type: string - last_checked_t: - type: integer - last_checker: - type: string - states: - description: > - comma separated list of values indicating some states of the - product, - - like things to be done, or to be completed. - - See [states - taxonomy](https://static.openfoodfacts.net/data/taxonomies/states.json) - type: string - states_hierarchy: - type: array - items: - type: string - states_tags: - type: array - items: - description: > - Each state describe something that is completed or is to be - done or improved on the product. - - - Refer to [states - taxonomy](https://static.openfoodfacts.net/data/taxonomies/states.json) - type: string - misc_tags: - description: | - Information about different aspect of the product - type: array - items: - type: string - - type: object - properties: - additives_original_tags: - type: array - items: - type: string - additives_prev_original_tags: - type: array - items: - type: string - added_countries_tags: - type: array - items: - type: object - allergens_from_ingredients: - type: string - allergens_from_user: - type: string - amino_acids_prev_tags: - type: array - items: - type: object - amino_acids_tags: - type: array - items: - type: object - carbon_footprint_percent_of_known_ingredients: - type: integer - categories_properties: - type: object - properties: - 'agribalyse_food_code:en': - type: string - 'agribalyse_proxy_food_code:en': - type: string - 'ciqual_food_code:en': - type: string - categories_properties_tags: - type: array - items: - type: string - category_properties: - type: object - additionalProperties: - description: those are properties taken from the category taxonomy - type: string - ciqual_food_name_tags: - type: array - items: - type: string - compared_to_category: - type: string - description: | - the category to use for comparison. - - **TODO** explain how it is chosen. - conservation_conditions: - type: string - customer_service: - type: string - description: | - Contact info of customer service. - expiration_date: - type: string - link: - type: string - description: | - link to the product on the website of the producer - main_countries_tags: - type: array - items: - type: object - minerals_prev_tags: - type: array - items: - type: object - minerals_tags: - type: array - items: - type: object - owner_fields: - type: object - description: > - Those are fields provided by the producer (through producers - platform), - - and the value he provided. - properties: - additionalProperties: - description: > - you can retrieve all kind of properties, the same as on the - parent object (the product). - - It's not processed entries (like tags for example) but raw - ones. - oneOf: - - type: integer - - type: string - - type: object - nova_groups_markers: - type: object - description: > - Detail of ingredients or processing that makes the products - having Nova 3 or 4 - properties: - '3': - description: | - Markers of level 3 - type: array - items: - type: array - description: | - This array has two element for each marker. - One - items: - type: string - '4': - description: | - Markers of level 4 - type: array - items: - $ref: '#/properties/nova_groups_markers/properties/3/items' - nucleotides_tags: - type: array - items: - type: object - origin: - type: string - purchase_places: - type: string - description: | - Country, state, or city where the product can be purchased. - example: Paris - purchase_places_tags: - type: array - items: - type: string - stores: - type: string - description: | - Distributor name. - example: Walmart - stores_tags: - type: array - items: - type: string - traces_from_ingredients: - type: string - traces_from_user: - type: string - patternProperties: - conservation_conditions_(?\w\w): - type: string - customer_service_(?\w\w): - type: string - origin_(?\w\w): - type: string - description: | - `origin` in language indicated by `language_code` - - type: object - description: | - Metadata of a product (author, editors, creation date, etc.) - properties: - created_t: - type: integer - description: | - Date when the product was added (UNIX timestamp format). - See also `entry_dates_tags` - example: | - 1457680652 - creator: - type: string - description: | - The contributor who added the product first. - editors_tags: - description: | - List of editors who edited the product. - type: array - items: - type: string - informers_tags: - type: array - items: - type: string - interface_version_created: - type: string - interface_version_modified: - type: string - languages: - type: object - patternProperties: - 'en:(?\w\w)': - type: integer - description: | - **TODO** explain ! - languages_codes: - type: object - patternProperties: - (?\w\w): - type: integer - description: > - Same as `languages` but by language code, instead of language - tags - languages_hierarchy: - type: array - items: - type: string - languages_tags: - type: array - items: - type: string - last_edit_dates_tags: - type: array - items: - type: string - last_editor: - type: string - last_modified_by: - type: string - description: | - The username of the user who last modified the product. - example: sebleouf - last_modified_t: - type: integer - description: | - Date when the product page was last modified. - owner: - description: > - Id of the producer in case he provides his own data about a - product (producer platform). - type: string - owners_tags: - description: | - Tagyfied version of owner - type: string - photographers_tags: - type: array - items: - type: string - rev: - description: >- - revision number of this product version (each edit adds a - revision) - type: integer - sources: - type: array - items: - type: object - properties: - fields: - type: array - items: - type: string - id: - type: string - images: - type: array - items: - type: object - import_t: - type: integer - manufacturer: - type: - - integer - - string - name: - type: string - source_licence: - type: string - source_licence_url: - type: string - url: - type: - - 'null' - - string - sources_fields: - type: object - properties: - org-gs1: - type: object - properties: - gln: - type: string - gpcCategoryCode: - type: string - gpcCategoryName: - type: string - isAllergenRelevantDataProvided: - type: string - lastChangeDateTime: - type: string - partyName: - type: string - productionVariantDescription: - type: string - publicationDateTime: - type: string - teams: - type: string - teams_tags: - type: array - items: - type: string - update_key: - type: string - - type: object - description: | - Knowledge panels for a product - properties: - knowledge_panels: - type: object - x-stoplight: - id: bcq3fkbtnwr5t - title: panels - description: >- - The panels object is a dictionary of individual panel objects. - - Each key of the dictionary is the id of the panel, and the value - is the panel object. + You can use this field to provide an identifier (eg: an sha1 of the username) + that''s privacy preserving. Make sure that your salt is strong, perfectly + random and secret - Apps typically display a number of root panels with known panel - ids (e.g. health_card and environment_card). Panels can - reference other panels and display them as sub-panels. - examples: - - additionalProperties: string + In case we have trouble with one of your user, it helps our moderators + revert edits. + + ' + User-Agent: + type: string + description: 'It is required that you pass a specific User-Agent header + when you do an API request. + + But some times it''s not possible to modify such a header + + (eg. request using JavaScript in a browser). + + In such cases, you can override it with this parameter. + + ' + search_for_products: + type: object + properties: + count: + type: integer + description: 'Total number of products found + + ' + example: 2701 + page: + type: integer + description: 'Page number of returned results. + + + You can get a different page, by using the `page` query parameter. + + ' + example: 1 + page_count: + type: integer + description: 'Number of products in this page. + + + This will differ from page_size only on the last page. + + ' + example: 24 + page_size: + type: integer + description: 'Requested number of products per pages + + + To get the number of pages, divide count by page_size + + (eg. `Math.floor( count / page_size) + 1 `) + + ' + example: 24 + products: + type: array + description: 'The products matching the query corresponding to current page + + ' + items: + $ref: '#/components/schemas/product' + skip: + type: integer + example: 0 + nutrient_unit: + description: "The unit in which the nutrient for 100g or per serving is measured.\n\ + \nThe possible values depends on the nutrient.\n\n* `g` for grams\n* `mg`\ + \ for milligrams\n* `\u03BCg` for micrograms\n* `cl` for centiliters\n* `ml`\ + \ for mililiters\n* `dv` for recommended daily intakes (aka [Dietary Reference\ + \ Intake](https://en.wikipedia.org/wiki/Dietary_Reference_Intake))\n* `% vol`\ + \ for percentage per volume (e.g. alcohol vol per 100 ml)\n* `%` for percentage\n\ + \n\U0001F913 code: see the [Units module][units-module],\nand [Food:default_unit_for_nid\ + \ function][default-unit]\n\n[units-module]: https://openfoodfacts.github.io/openfoodfacts-server/dev/ref-perl-pod/ProductOpener/Units.html\n\ + [default-unit]: https://openfoodfacts.github.io/openfoodfacts-server/dev/ref-perl-pod/ProductOpener/Food.html#default_unit_for_nid_(_%24nid)\n" + type: string + enum: + - g + - mg + - "\u03BCg" + - cl + - ml + - dv + - '% vol' + - '%' + nutrients: + type: array + description: 'Nutrients and sub-nutrients of a product, with their name and + default unit. + + ' + items: + type: object + properties: + id: + type: string + description: id of the nutrient + name: + type: string + description: Name of the nutrient in the requested language + important: + type: boolean + description: Indicates if the nutrient is always shown on the nutrition + facts table + display_in_edit_form: + type: boolean + description: Indicates if the nutrient should be shown in the nutrition + facts edit form + unit: + description: Default unit of the nutrient + $ref: '#/components/schemas/nutrient_unit' + nutrients: + description: 'Sub-nutrients (e.g. saturated-fat is a sub-nutrient of fat). + + ' + get_nutrients: + $ref: '#/components/schemas/nutrients' + get_attribute_groups: + type: array + description: 'List of groups of attributes for personal search in a specific + language. + + ' + items: + type: object + properties: + id: + type: string + description: unique id of the group + name: + type: string + description: Name of the group + attributes: + type: array + description: 'Attributes that are part of this group + + ' + items: + type: object properties: - additionalProperties: - title: panel - x-stoplight: - id: mj9nhz3mqn05c - type: object - description: >- - Each panel contains an optional title and an optional array - of elements. - properties: - type: - type: string - description: >- - Type of the panel. If set to "card", the panel and its - sub-panels should be displayed in a card. If set to - "inline", the panel should have its content always - displayed. - expanded: - type: boolean - description: >- - If true, the panel is to be displayed already expanded. - If false, only the title should be displayed, and the - user should be able to click or tap it to open the panel - and display the elements. - expand_for: - type: string - description: >- - If set to "large", the content of the panel should be - expanded on large screens, but it should still be - possible to unexpand it. - evaluation: - type: string - description: >- - A simple assessment of the panel value, typically used - to format fonts, et.c e.g. bad = red - enum: - - good - - average - - neutral - - bad - - unknown - title_element: - title: title_element - x-stoplight: - id: lox0wvl9bdgy2 - type: object - description: The title of a panel. - properties: - name: - type: string - description: >- - A short name of this panel, not including any actual - values - title: - type: string - type: - type: string - enum: - - grade - - percentage - description: >- - Used to indicate how the value of this item is - measured, such as "grade" for Nutri-Score and - Eco-Score or "percentage" for Salt - grade: - type: string - description: >- - The value for this panel where it corresponds to a A - to E grade such as the Nutri-Score of the Eco-Score. - enum: - - a - - b - - c - - d - - e - - unknown - value: - type: number - description: >- - The numeric value of the panel, where the type is - "percentage" - icon_url: - type: string - icon_color_from_evaluation: - type: string - icon_size: - type: string - description: > - If set to "small", the icon should be displayed at a - small size. - elements: - type: array - description: >- - An ordered list of elements to display in the content of - the panel. - items: - title: element - x-stoplight: - id: e2ybdrtmx0tme - type: object - description: > - Each element object contains one specific element - object such as a text element or an image element. - properties: - type: - element_type: string - enum: - - text - - image - - action - - panel - - panel_group - - table - description: > - The type of the included element object. - - The type also indicates which field contains the - included element object. - - e.g. if the type is "text", the included element - object will be in the "text_element" field. - - - Note that in the future, new type of element may - be added, - - so your code should ignore unrecognized types, and - unknown properties. - - - TODO: add Map type - text_element: - title: text_element - x-stoplight: - id: vdwxlt73qnqfa - type: object - description: >- - A text in simple HTML format to display. - - - For some specific texts that correspond to a - product field (e.g. a product name, the - ingredients list of a product),the edit_field_* - fields are used to indicate how to edit the field - value. - properties: - type: - type: string - description: > - the type of text, might influence the way you - display it. - enum: - - summary - - warning - - notes - html: - type: string - description: Text to display in HTML format. - language: - type: string - description: >- - Language of the text. The name of the language - is returned in the language requested when - making the API call. e.g. if the text is in - Polish, and the requested language is French, - the language field will contain "Polonais" - (French for "Polish"). Only set for specific - fields such as the list of ingredients of a - product. - lc: - type: string - description: >- - 2 letter language code for the text. Only set - for specific fields such as the list of - ingredients of a product. - edit_field_id: - type: string - description: >- - id of the field used to edit this text in the - product edit API. - edit_field_type: - type: string - description: Type of the product field. - edit_field_value: - type: string - description: >- - Current value of the product field. This may - differ from the html field which can contain - extra formating. - source_url: - type: string - description: Link to the source - example: 'https://en.wikipedia.org/wiki/Sodium acetate' - source_text: - type: string - description: name of the source - example: Wikipedia - source_lc: - type: string - description: Source locale name - example: en - source_language: - type: string - description: Human readable source locale name - example: English - image_element: - title: image_element - x-stoplight: - id: k4v4kwt489q3j - type: object - properties: - url: - type: string - description: full URL of the image - width: - type: integer - description: > - Width of the image. - - - This is just a suggestion coming from the - server, - - the client may choose to use its own - dimensions for the image. - height: - type: integer - description: > - Height of the image. - - - This is just a suggestion coming from the - server, - - the client may choose to use its own - dimensions for the image. - alt_text: - type: string - description: Alt Text of the image. - action_element: - type: string - panel_element: - title: panel_element - x-stoplight: - id: ymx41elz4yrnj - type: object - description: >- - Panels can include other panels as sub-panels - using the panel_element. - properties: - panel_id: - type: string - description: >- - The id of the panel to include. The id is the - key of the panel in the panels object returned - in the knowledge_panels field. - panel_group_element: - title: panel_group_element - x-stoplight: - id: b7emlfrgiuue2 - type: object - properties: - title: - type: string - panel_ids: - type: array - description: >- - The ids of the panels to include. The ids are - the keys of the panels in the panels object - returned in the knowledge_panels field. - items: - type: string - description: >- - The panel group element is used to display an - optional title followed by a number of sub-panels. - table_element: - title: table_element - x-stoplight: - id: 38zu3z4sruqo7 - type: object - description: Element to display a table. - properties: - id: - type: string - description: An id for the table. - title: - type: string - description: | - Title of the column. - rows: - type: string - columns: - type: array - items: - type: object - properties: - type: - type: string - text: - type: string - text_for_small_screens: - type: string - style: - type: string - column_group_id: - type: string - shown_by_default: - type: boolean - required: - - type - level: - type: string - description: | - a message level, as levels we use in log. - It might help theming the panel visualy - example: info - size: - type: string - enum: - - small - description: > - size is either empty (normal display) - - or small to indicate a panel that should have a smaller - font size - example: small - topics: - type: array - items: - type: string - example: health - readOnly: true - - type: object - description: | - Specific data about a product to enable personal ranking - properties: - attribute_groups: - type: array - description: >- - Each element is an attribute that can help compute a personal - ranking for the product - items: - type: object - properties: - id: - type: string - description: | - Unique id of the attribute. + id: + type: string + description: unique id of the attribute + name: + type: string + description: Name of the attribute + icon_url: + type: string + description: url of icon to display next to the settings for this + attribute + setting_name: + type: string + description: a description of the attribute to display to users + setting_note: + type: string + description: a complementary note on the attribute + default: + type: string + enum: + - mandatory + - very_important + - important + - not_important + description: Indicates the default setting for this attribute + panel_id: + type: string + description: Linked knowledge panel (optional) + get_preferences: + type: array + description: 'Rules to apply to compute personal ranking of a product, + + based upon the setting value of each attribute. + + ' + items: + type: object + properties: + id: + type: string + description: id for the setting value + enum: + - not_important + - important + - very_important + - mandatory + name: + type: string + description: name for the setting value, translated according to `lc` + parameter + factor: + type: integer + description: 'factor to apply to the property of the product corresponding + to attributes - It will be use to match against preferences parameters. - status: - type: string - enum: - - known - - unknown - description: >- - wether we have the information to really compute this - criteria or not. - title: - type: string - description: > - A descriptive sentence about the situation of the product - concerning attribute - example: 'Does not contain: Molluscs' - match: - type: number - format: float - minimum: 0 - maximum: 100 - description: > - a numeric value for the match, - - telling how much the products ranks well for this - particular attribute. - - The higher the value, the better the match. - grade: - description: every attribute as a grade for a to e - type: string - enum: - - unknown - - a - - b - - c - - d - - e - name: - type: string - description: 'The name of attribute, for eventual display' - icon_url: - type: string - description: >- - an icon representing the attribute match (often using a - color) - description: - type: string - description: >- - An eventual description of the value of the property upon - which this attribute is based - description_short: - type: string - description: >- - An eventual short description of the value of the property - upon which this attribute is based + having this setting value + + ' + minimum_match: + type: integer + description: 'FIXME + + ' parameters: id: schema: @@ -13581,10 +4510,9 @@ components: in: query name: cc required: false - description: >- - 2 letter code of the country of the user. Used for localizing some - fields in returned values (e.g. knowledge panels). If not passed, the - country may be inferred by the IP address of the request. + description: 2 letter code of the country of the user. Used for localizing some + fields in returned values (e.g. knowledge panels). If not passed, the country + may be inferred by the IP address of the request. lc: schema: type: string @@ -13592,16 +4520,16 @@ components: in: query name: lc required: false - description: > - 2 letter code of the language of the user. + description: '2 letter code of the language of the user. - Used for localizing some fields in returned values (e.g. knowledge - panels). + Used for localizing some fields in returned values (e.g. knowledge panels). - If not passed, the language may be inferred by the Accept-Language - header of the request, + If not passed, the language may be inferred by the Accept-Language header + of the request, or from the domain name prefix. + + ' code: schema: type: string @@ -13644,85 +4572,81 @@ components: example: 24 in: query name: page - description: > - The page number you request to view (eg. in search results spanning + description: 'The page number you request to view (eg. in search results spanning multiple pages) + + ' page_size: schema: type: integer example: 24 in: query name: page_size - description: | - The number of elements should be sent per page + description: 'The number of elements should be sent per page + + ' sort_by: schema: type: string example: product_name enum: - - product_name - - last_modified_t - - scans_n - - unique_scans_n - - created_t - - completeness - - popularity_key - - nutriscore_score - - nova_score - - nothing - - ecoscore_score + - product_name + - last_modified_t + - scans_n + - unique_scans_n + - created_t + - completeness + - popularity_key + - nutriscore_score + - nova_score + - nothing + - ecoscore_score in: query name: sort_by - description: > - The allowed values used to sort/order the search results. - - - * `product_name` sorts on name - - * `ecoscore_score`, `nova_score`, `nutriscore_score` rank on the - [Eco-Score](https://world.openfoodfacts.org/eco-score-the-environmental-impact-of-food-products), - [Nova](https://world.openfoodfacts.org/nova), or - [Nutri-Score](https://world.openfoodfacts.org/nutriscore) - - * `scans_n`, `unique_scans_n` and `popularity_key` are about product - popularity: number of scans on unique scans, rank of product - - * `created_t`, `last_modified_t`, are about creation and modification - dates - - * `nothing`, tells not to sort at all (because if you do not provide the - sort_by argument we default to sorting on popularity (for food) or last - modification date) + description: "The allowed values used to sort/order the search results.\n\n\ + * `product_name` sorts on name\n* `ecoscore_score`, `nova_score`, `nutriscore_score`\ + \ rank on the [Eco-Score](https://world.openfoodfacts.org/eco-score-the-environmental-impact-of-food-products),\ + \ [Nova](https://world.openfoodfacts.org/nova), or [Nutri-Score](https://world.openfoodfacts.org/nutriscore)\n\ + * `scans_n`, `unique_scans_n` and `popularity_key` are about product popularity:\_\ + number of scans on unique scans, rank of product\n* `created_t`, `last_modified_t`,\ + \ are about creation and modification dates\n* `nothing`, tells not to sort\ + \ at all (because if you do not provide the sort_by argument we default to\ + \ sorting on popularity (for food) or last modification date)\n" fields: schema: type: string - example: 'code,product_name' + example: code,product_name in: query name: fields - description: | - The fields to be returned from the product object can also be limited. + description: 'The fields to be returned from the product object can also be + limited. + If not specified, it returns the entire product object response. + + ' knowledge_panels_included: schema: type: string - example: 'heatlh_card, environment_card' + example: heatlh_card, environment_card in: query name: knowledge_panels_included - description: > - When knowledge_panels are requested, you can specify which panels should - be in the response. All the others will be excluded. + description: 'When knowledge_panels are requested, you can specify which panels + should be in the response. All the others will be excluded. + + ' knowledge_panels_excluded: schema: type: string - example: 'heatlh_card, environment_card' + example: heatlh_card, environment_card in: query name: knowledge_panels_excluded - description: > - When knowledge_panels are requested, you can specify which panels to - exclude from the response. All the others will be included. + description: 'When knowledge_panels are requested, you can specify which panels + to exclude from the response. All the others will be included. + + If a panel is both excluded and included (with the knowledge_panels_excluded + parameter), it will be excluded. - If a panel is both excluded and included (with the - knowledge_panels_excluded parameter), it will be excluded. + ' tagtype: schema: type: string @@ -13735,6 +4659,404 @@ components: example: f in: query name: term + tags_parameters_properties_additives_tags: + style: form + explode: false + schema: + type: string + example: e322 + in: query + name: additives_tags + description: 'The additives_tags in english of product(s) you are searching + for. + + The [OFF App](https://world.openfoodfacts.org/additives) has a list of possible + values for `additives`. + + + You can use multiple values by using a comma separated list. + + You can add a "-" before values to avoid matching a tag. + + ' + tags_parameters_properties_allergens_tags: + style: form + explode: false + schema: + type: string + example: m + in: query + name: allergens_tags + description: 'The allergens_tags in english of product(s) you are searching + for. + + The [OFF App](https://world.openfoodfacts.org/allergens) has a list of possible + values for `allergens`. + + + You can use multiple values by using a comma separated list. + + You can add a "-" before values to avoid matching a tag. + + ' + tags_parameters_properties_brands_tags: + style: form + explode: false + schema: + type: string + example: ferrero + in: query + name: brands_tags + description: 'The brands_tags of product(s) you are searching for. + + The [OFF App](https://world.openfoodfacts.org/brands) has a list of possible + values for `brands`. + + + You can use multiple values by using a comma separated list. + + You can add a "-" before values to avoid matching a tag. + + ' + tags_parameters_properties_categories_tags: + style: form + explode: false + schema: + type: string + example: chocolates + in: query + name: categories_tags + description: 'The category of product(s) you are searching for. + + The [OFF App](https://world.openfoodfacts.org/categories) has a list of possible + values for `categories`. + + + You can use multiple values by using a comma separated list. + + You can add a "-" before values to avoid matching a tag. + + ' + tags_parameters_properties_countries_tags: + style: form + explode: false + schema: + type: string + example: united-kingdom + in: query + name: countries_tags_en + description: 'The countries_tags_en of product(s) you are searching for. + + The [OFF App](https://world.openfoodfacts.org/countries) shows a list of possible + values for `countries`. + + + You can use multiple values by using a comma separated list. + + You can add a "-" before values to avoid matching a tag. + + ' + tags_parameters_properties_emb_codes_tags: + style: form + explode: false + schema: + type: string + in: query + name: emb_codes_tags + description: 'The emb_codes_tags of product(s) you are searching for. + + + You can use multiple values by using a comma separated list. + + You can add a "-" before values to avoid matching a tag. + + ' + tags_parameters_properties_labels_tags: + style: form + explode: false + schema: + type: string + example: organic + in: query + name: labels_tags + description: 'The labels_tags in english of product(s) you are searching for. + + The [OFF App](https://world.openfoodfacts.org/labels) has a list of possible + values for `labels`. + + + You can use multiple values by using a comma separated list. + + You can add a "-" before values to avoid matching a tag. + + ' + tags_parameters_properties_manufacturing_places_tags: + style: form + explode: false + schema: + type: string + in: query + name: manufacturing_places_tags + description: 'The manufacturing_places_tags of product(s) you are searching + for. + + The [OFF App](https://world.openfoodfacts.org/manufacturing-places) has a + list of possible values for `manufacturing-places`. + + + You can use multiple values by using a comma separated list. + + You can add a "-" before values to avoid matching a tag. + + ' + tags_parameters_properties_nutrition_grades_tags: + style: form + explode: false + schema: + type: string + example: e + in: query + name: nutrition_grades_tags + description: 'The nutrition_grades_tags of product(s) you are searching for. + + The [OFF App](https://world.openfoodfacts.org/nutrition-grades) has a list + of possible values for `nutrition-grades`. + + + You can use multiple values by using a comma separated list. + + You can add a "-" before values to avoid matching a tag. + + ' + tags_parameters_properties_origins_tags: + style: form + explode: false + schema: + type: string + in: query + name: origins_tags + description: 'The origins_tags of product(s) you are searching for. + + + You can use multiple values by using a comma separated list. + + You can add a "-" before values to avoid matching a tag. + + ' + tags_parameters_properties_packaging_tags: + style: form + explode: false + schema: + type: string + example: 1-jar-aus-klarglas + in: query + name: packaging_tags_de + description: 'The packaging_tag in german of product(s) you are searching for. + + The [OFF App](https://world.openfoodfacts.org/packaging) has a list of possible + values for `packaging`. + + + You can use multiple values by using a comma separated list. + + You can add a "-" before values to avoid matching a tag. + + ' + tags_parameters_properties_purchase_places_tags: + style: form + explode: false + schema: + type: string + in: query + name: purchase_places_tags + description: 'The purchase_places_tags of product(s) you are searching for. + + + You can use multiple values by using a comma separated list. + + You can add a "-" before values to avoid matching a tag. + + ' + tags_parameters_properties_states_tags: + style: form + explode: false + schema: + type: string + example: nutrition-facts-completed + in: query + name: states_tags + description: 'The states_tags in english of product(s) you are searching for. + + The [OFF App](https://world.openfoodfacts.org/states) has a list of possible + values for `states`. + + + You can use multiple values by using a comma separated list. + + You can add a "-" before values to avoid matching a tag. + + ' + tags_parameters_properties_stores_tags: + style: form + explode: false + schema: + type: string + example: aldi + in: query + name: stores_tags + description: 'The stores_tags of product(s) you are searching for. + + + You can use multiple values by using a comma separated list. + + You can add a "-" before values to avoid matching a tag. + + ' + tags_parameters_properties_traces_tags: + style: form + explode: false + schema: + type: string + in: query + name: traces_tags + description: 'The traces_tags of product(s) you are searching for. + + The [OFF App](https://world.openfoodfacts.org/traces) shows a list of possible + values for `traces`. + + + You can use multiple values by using a comma separated list. + + You can add a "-" before values to avoid matching a tag. + + ' + tags_parameters_properties_tag_name_with_language_code: + in: query + name: _tags_ + description: 'You can add a language code to a specific tag to query it in a + specific language + + ' + style: form + explode: false + schema: + type: object + examples: + - packaging_tags_de: null + summary: packaging in german + value: + packaging_tags_de: de:Flasche + - origins_tags_fr: null + summary: origins in french + value: + origins_tags_fr: fr:France + - categories_tags_en: null + summary: categories in english + value: + categories_tags_en: en:Beer + properties: + tag_name_example: + type: string + description: 'Will search in the tags corresponding to `tag_name`, + + in the language corresponding to `language_code. + + + `tag_name` is one of the field above which have the `_tags`` suffix: + + categories, nutrition_grades, etc. + + + `language_code` is a two letter iso language `language_code. + + + You can use multiple values by using a comma separated list. + + You can add a "-" before values to avoid matching a tag. + + ' + nutrition_search_properties_nutrient_lower_than: + in: query + name: _lt_ + description: 'Search on nutrient lower than a value + + ' + schema: + type: object + examples: + - salt_100g_lt_2: null + summary: salt per 100g is lower than 2g (in product as sold) + value: + salt_100g<2: 1 + properties: + nutrient_example: + type: string + description: 'Will search for products with nutrients lower than `value` + + per `portion` (100g or serving). + + + If `prepared` is "prepared" search in prepared product instead of "as + sold". + + + Important: the parameter value is discarded and should be empty + + ' + nutrition_search_properties_nutrient_greater_than: + in: query + name: _gt_ + description: 'Search on nutrient greater than a value + + ' + schema: + type: object + examples: + - carbohydrates_prepared_serving_gt_10: null + summary: carbohydrates per serving is greater than 10g in prepared product + value: + salt_100g>10: 1 + properties: + nutrient_example: + type: string + description: 'Will search for products with nutrients more than `value` + + per `portion` (100g or serving). + + + If `prepared` is "prepared" search in prepared product instead of "as + sold". + + + Important: the parameter value is discarded and should be empty + + ' + nutrition_search_properties_nutrient_equal: + in: query + name: _eq_ + description: 'Search on nutrient for an exact quantity + + ' + schema: + type: object + examples: + - fat_100g_eq_5: null + summary: fat per 100g is exactly equal to 5g (in product as sold) + value: + fat_100g: 5 + properties: + nutrient_example: + type: string + description: 'Will search for products with nutrients exactl the parameter + value + + per `portion` (100g or serving). + + + If `prepared` is "prepared" search in prepared product instead of "as + sold". + + ' tags: - - name: Read Requests - - name: Write Requests \ No newline at end of file +- name: Read Requests +- name: Write Requests diff --git a/OpenFoodFactsService/merge_yamls.py b/OpenFoodFactsService/merge_yamls.py deleted file mode 100644 index 9a54385..0000000 --- a/OpenFoodFactsService/merge_yamls.py +++ /dev/null @@ -1,99 +0,0 @@ -import os -import yaml -import re - -def load_yaml(file_path): - if os.path.isdir(file_path): - print(f"Error: {file_path} is a directory, not a file.") - return None - print(f"Loading YAML file: {file_path}") - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def replace_references_bottom_up(openapi_data, current_file_path): - base_path = os.path.dirname(current_file_path) - # Find all references and replace them in a bottom-up manner - references_to_replace = [] - if isinstance(openapi_data, dict): - for key, value in openapi_data.items(): - if key == '$ref' and isinstance(value, str): - references_to_replace.append((key, value)) - else: - replace_references_bottom_up(value, current_file_path) - elif isinstance(openapi_data, list): - for item in openapi_data: - replace_references_bottom_up(item, current_file_path) - - # Replace references after traversing deeply - for key, value in references_to_replace: - ref_file_path, ref_anchor = parse_reference(value, base_path) - print(f"Resolving reference for key: {key}, from file: {ref_file_path}, anchor: {ref_anchor}") - if os.path.exists(ref_file_path) and not os.path.isdir(ref_file_path): - referenced_data = load_yaml(ref_file_path) - if referenced_data is None: - continue - # Traverse to the desired anchor (property) if present - if ref_anchor: - referenced_data = traverse_to_anchor(referenced_data, ref_anchor) - replace_references_bottom_up(referenced_data, ref_file_path) - if isinstance(referenced_data, dict): - openapi_data.update(referenced_data) - else: - openapi_data[key] = referenced_data - del openapi_data[key] - else: - print(f"Reference file not found or is a directory: {ref_file_path}") - -def parse_reference(ref_value, base_path): - # Split the reference into the file path and anchor (if any) - ref_parts = ref_value.split('#') - ref_file_path = os.path.join(base_path, ref_parts[0]) - ref_file_path = os.path.normpath(ref_file_path) - ref_anchor = ref_parts[1] if len(ref_parts) > 1 else None - return ref_file_path, ref_anchor - -def traverse_to_anchor(data, anchor): - # Traverse the data structure to find the anchor location - parts = anchor.strip('/').split('/') - for part in parts: - if isinstance(data, dict) and part in data: - data = data[part] - else: - print(f"Anchor part '{part}' not found in data.") - return None - return data - -def dereference_yaml(input_file): - yaml_data = load_yaml(input_file) - if yaml_data is None: - print(f"Error: Failed to load YAML file: {input_file}") - return - while True: - references_before = count_references(yaml_data) - replace_references_bottom_up(yaml_data, input_file) - references_after = count_references(yaml_data) - if references_before == references_after: - break - - # Save the fully dereferenced YAML data - with open(input_file, 'w') as file: - print(f"Saving dereferenced file: {input_file}") - yaml.dump(yaml_data, file, sort_keys=False) - -def count_references(openapi_data): - if isinstance(openapi_data, dict): - return sum(1 for key, value in openapi_data.items() if key == '$ref') + sum(count_references(value) for value in openapi_data.values()) - elif isinstance(openapi_data, list): - return sum(count_references(item) for item in openapi_data) - return 0 - -if __name__ == "__main__": - import sys - if len(sys.argv) != 2: - print("Usage: python script.py ") - sys.exit(1) - - input_file = sys.argv[1] - print(f"Starting to dereference YAML file: {input_file}") - dereference_yaml(input_file) - print(f"All references have been dereferenced in the YAML file: {input_file}") \ No newline at end of file diff --git a/Tools/clear_and_process.sh b/Tools/clear_and_process.sh new file mode 100644 index 0000000..1463fda --- /dev/null +++ b/Tools/clear_and_process.sh @@ -0,0 +1,4 @@ +#rm -rf ref +#cp -r ~/Projects/FoodIntake/FoodDatabases/OFF/openfoodfacts-server/docs/api/ref . +cp ./ref/api.yml Sources/openapi.yaml +python process_yamls.py Sources/openapi.yaml diff --git a/Tools/generate.sh b/Tools/generate.sh new file mode 100644 index 0000000..e1698c9 --- /dev/null +++ b/Tools/generate.sh @@ -0,0 +1,5 @@ +swift run swift-openapi-generator generate \ + --mode types --mode client \ + --output-directory ../OpenFoodFactsService/Sources/ \ + --config ../OpenFoodFactsService/Sources/openapi-generator-config.yaml \ + ../OpenFoodFactsService/Sources/openapi.yaml diff --git a/Tools/process_yamls.py b/Tools/process_yamls.py new file mode 100644 index 0000000..a279b51 --- /dev/null +++ b/Tools/process_yamls.py @@ -0,0 +1,216 @@ +import os +import yaml +import re + +def load_yaml(file_path): + if os.path.isdir(file_path): + print(f"Error: {file_path} is a directory, not a file.") + return None + print(f"Loading YAML file: {file_path}") + with open(file_path, 'r') as file: + return yaml.safe_load(file) + +def replace_references_bottom_up(openapi_data, current_file_path, components): + base_path = os.path.dirname(current_file_path) + # Find all references and replace them in a bottom-up manner + references_to_replace = [] + if isinstance(openapi_data, dict): + for key, value in openapi_data.items(): + if key == '$ref' and isinstance(value, str): + if not value.endswith('example'): + references_to_replace.append((key, value)) + elif key == 'examples' and isinstance(value, dict): + # Handle example references separately to directly insert them as YAML code + for example_key, example_value in value.items(): + if isinstance(example_value, dict) and '$ref' in example_value: + ref_file_path, ref_anchor = parse_reference(example_value['$ref'], base_path) + if os.path.exists(ref_file_path) and not os.path.isdir(ref_file_path): + referenced_data = load_yaml(ref_file_path) + if referenced_data is not None: + if ref_anchor: + referenced_data = traverse_to_anchor(referenced_data, ref_anchor) + value[example_key] = referenced_data + elif key == 'type' and value == 'int': + # Replace 'type: int' with 'type: integer' + openapi_data[key] = 'integer' + else: + replace_references_bottom_up(value, current_file_path, components) + elif isinstance(openapi_data, list): + for item in openapi_data: + replace_references_bottom_up(item, current_file_path, components) + + # Replace references after traversing deeply + for key, value in references_to_replace: + ref_file_path, ref_anchor = parse_reference(value, base_path) + print(f"Resolving reference for key: {key}, from file: {ref_file_path}, anchor: {ref_anchor}") + if os.path.exists(ref_file_path) and not os.path.isdir(ref_file_path): + referenced_data = load_yaml(ref_file_path) + if referenced_data is None: + continue + # Traverse to the desired anchor (property) if present + if ref_anchor: + referenced_data = traverse_to_anchor(referenced_data, ref_anchor) + replace_references_bottom_up(referenced_data, ref_file_path, components) + + # Add the referenced data into appropriate components section + component_name = generate_component_name(ref_file_path, ref_anchor) + if is_parameter_reference(ref_anchor, ref_file_path): + components.setdefault('parameters', {})[component_name] = referenced_data + openapi_data[key] = f"#/components/parameters/{component_name}" + else: + components.setdefault('schemas', {})[component_name] = referenced_data + openapi_data[key] = f"#/components/schemas/{component_name}" + else: + print(f"Reference file not found or is a directory: {ref_file_path}") + +def parse_reference(ref_value, base_path): + # Split the reference into the file path and anchor (if any) + ref_parts = ref_value.split('#') + ref_file_path = os.path.join(base_path, ref_parts[0]) + ref_file_path = os.path.normpath(ref_file_path) + ref_anchor = ref_parts[1] if len(ref_parts) > 1 else None + return ref_file_path, ref_anchor + +def traverse_to_anchor(data, anchor): + # Traverse the data structure to find the anchor location + parts = anchor.strip('/').split('/') + for part in parts: + if isinstance(data, dict) and part in data: + data = data[part] + else: + print(f"Anchor part '{part}' not found in data.") + return None + return data + +def generate_component_name(ref_file_path, ref_anchor): + # Generate a unique component name based on the file path and anchor + component_name = os.path.basename(ref_file_path).replace('.yaml', '') + if ref_anchor: + anchor_parts = ref_anchor.strip('/').split('/') + component_name += '_' + '_'.join(anchor_parts) + return component_name + +def is_parameter_reference(ref_anchor, ref_file_path): + # Determine if the reference should be placed under parameters or schemas + if ref_anchor and ('parameters' in ref_anchor or 'properties' in ref_anchor): + return True + if 'parameters' in ref_file_path: + return True + return False + +def dereference_yaml(input_file): + yaml_data = load_yaml(input_file) + if yaml_data is None: + print(f"Error: Failed to load YAML file: {input_file}") + return + components = yaml_data.setdefault('components', {}) + while True: + references_before = count_references(yaml_data) + replace_references_bottom_up(yaml_data, input_file, components) + references_after = count_references(yaml_data) + if references_before == references_after: + break + + # Save the fully dereferenced YAML data + with open(input_file, 'w') as file: + print(f"Saving dereferenced file: {input_file}") + yaml.dump(yaml_data, file, sort_keys=False) + +def unwind_pattern_properties(input_file): + yaml_data = load_yaml(input_file) + if yaml_data is None: + print(f"Error: Failed to load YAML file: {input_file}") + return + + def unwind_properties(data): + if isinstance(data, dict): + for key, value in list(data.items()): + if key == 'patternProperties' and isinstance(value, dict): + # Unwind patternProperties into simple properties + for pattern_key, pattern_value in value.items(): + # Handle regex keys like (?[\w-]+)_unit and replace with example key + regex_match = re.match(r'\(\?<(?P\w+)>.*\)', pattern_key) + if regex_match: + pattern_key = regex_match.group('key') + '_example' + print(f"Unwinding patternProperties: {pattern_key}") + data.setdefault('properties', {})[pattern_key] = pattern_value + del data['patternProperties'] + else: + unwind_properties(value) + elif isinstance(data, list): + for item in data: + unwind_properties(item) + + unwind_properties(yaml_data) + + # Save the updated YAML data + with open(input_file, 'w') as file: + print(f"Saving file after unwinding patternProperties: {input_file}") + yaml.dump(yaml_data, file, sort_keys=False) + +def replace_all_of(input_file): + yaml_data = load_yaml(input_file) + if yaml_data is None: + print(f"Error: Failed to load YAML file: {input_file}") + return + + def replace_all_of_recursive(data): + if isinstance(data, dict): + for key, value in list(data.items()): + if key == 'allOf' and isinstance(value, list): + combined_schema = {'type': 'object', 'properties': {}} + for item in value: + if isinstance(item, dict): + for k, v in item.get('properties', {}).items(): + combined_schema['properties'][k] = v + data.pop('allOf') + data.update(combined_schema) + else: + replace_all_of_recursive(value) + elif isinstance(data, list): + for item in data: + replace_all_of_recursive(item) + + replace_all_of_recursive(yaml_data) + + # Save the updated YAML data + with open(input_file, 'w') as file: + print(f"Saving file after replacing allOf: {input_file}") + yaml.dump(yaml_data, file, sort_keys=False) + +def count_references(openapi_data): + if isinstance(openapi_data, dict): + return sum(1 for key, value in openapi_data.items() if key == '$ref') + sum(count_references(value) for value in openapi_data.values()) + elif isinstance(openapi_data, list): + return sum(count_references(item) for item in openapi_data) + return 0 + +if __name__ == "__main__": + import sys + if len(sys.argv) < 2 or len(sys.argv) > 3: + print("Usage: python script.py []\nCommands:\n --dereference: Replace references with components.\n --unwind-pattern-properties: Unwind patternProperties into simple properties.\n --replace-all-of: Replace allOf with combined component.") + sys.exit(1) + + input_file = sys.argv[1] + command = sys.argv[2] if len(sys.argv) == 3 else None + + if command is None: + print(f"Starting to dereference and then unwind patternProperties in YAML file: {input_file}") + dereference_yaml(input_file) + unwind_pattern_properties(input_file) + print(f"All references have been dereferenced and all patternProperties have been unwound in the YAML file: {input_file}") + elif command == '--dereference': + print(f"Starting to dereference YAML file: {input_file}") + dereference_yaml(input_file) + print(f"All references have been dereferenced in the YAML file: {input_file}") + elif command == '--unwind-pattern-properties': + print(f"Starting to unwind patternProperties in YAML file: {input_file}") + unwind_pattern_properties(input_file) + print(f"All patternProperties have been unwound in the YAML file: {input_file}") + elif command == '--replace-all-of': + print(f"Starting to replace allOf in YAML file: {input_file}") + replace_all_of(input_file) + print(f"All allOf have been replaced in the YAML file: {input_file}") + else: + print("Unknown command. Use --dereference, --unwind-pattern-properties, or --replace-all-of.") + sys.exit(1) \ No newline at end of file diff --git a/Tools/ref/api-v3.yml b/Tools/ref/api-v3.yml new file mode 100644 index 0000000..7ffefdb --- /dev/null +++ b/Tools/ref/api-v3.yml @@ -0,0 +1,443 @@ +openapi: 3.1.0 +x-stoplight: + id: 0x3135wk4xq0t +info: + title: Open Food Facts Open API V3 - under development + description: | + As a developer, the Open Food Facts API allows you to get information + and contribute to the products database. You can create great apps to + help people make better food choices and also provide data to enhance the database. + termsOfService: "https://world.openfoodfacts.org/terms-of-use" + contact: + name: Open Food Facts + url: "https://slack.openfoodfacts.org/" + email: reuse@openfoodfacts.org + license: + name: "License (MIT, Apache 2.0, etc)" + url: "https://opendatacommons.org/licenses/odbl/summary/index.html" + version: "3" +servers: + - url: "https://world.openfoodfacts.org" + description: prod + - description: dev + url: "https://world.openfoodfacts.net" +paths: + "/api/v3/product/{barcode}": + get: + tags: + - Read Requests + summary: READ Product - Get information for a specific product by barcode (API V3) + parameters: + - name: barcode + in: path + description: | + The barcode of the product to be fetched + required: true + style: simple + explode: false + schema: + type: string + example: "3017620422003" + - $ref: "#/components/parameters/cc" + - $ref: "#/components/parameters/lc" + - schema: + type: string + in: query + name: tags_lc + description: "2 letter language code to request names of tags in a specific language. For READ requests: if passed, all taxonomized tags of the response will include a `lc_name` property with the translation in the requested language, if available. Otherwise, the property value will contain the name in the original language, prefixed by the 2 language code and a colon." + - schema: + type: string + in: query + name: fields + description: |- + Comma separated list of fields requested in the response. + + Special values: + * "none": returns no fields + * "raw": returns all fields as stored internally in the database + * "all": returns all fields except generated fields that need to be explicitly requested such as "knowledge_panels". + + Defaults to "all" for READ requests. The "all" value can also be combined with fields like "attribute_groups" and "knowledge_panels".' + - schema: + type: string + example: "health_card, environment_card" + required: false + in: query + name: knowledge_panels_included + description: |- + When knowledge_panels are requested, you can specify which panels should be in the response. All the others will be excluded. + - schema: + type: string + example: "health_card, environment_card" + required: false + in: query + name: knowledge_panels_excluded + description: |- + When knowledge_panels are requested, you can specify which panels to exclude from the response. All the others will be included. + If a panel is both excluded and included (with the knowledge_panels_excluded parameter), it will be excluded. + responses: + "200": + description: OK + content: + application/json: + schema: + allOf: + - $ref: ./responses/response-status/response_status.yaml + - $ref: ./schemas/product.yaml + description: |- + Retrieve information for a product with a specific barcode. + + The fields parameter allows to specify what fields to retrieve. + operationId: get-product-by-barcode + parameters: + - schema: + type: string + name: barcode + in: path + required: true + description: 'Barcode of the product to create or update, or "test" to analyze the product data sent without creating or updating a product' + patch: + summary: "WRITE Product - Create or update product, or analyze test product (API V3 - Implementation in progress)" + operationId: patch-api-v3-product-barcode + responses: + "200": + description: |- + The response will include a "product" structure. The fields returned in this structure will depend on the value of the "fields" input field: + + - "updated" (default): all fields updated by the query will be returned, including fields that are directly generated from the updated fields. For instance, sending "packagings" or "packagings_add" will return the "packagings" field. + + - "none": no fields are returned. + + - "all": returns all fields except generated fields that need to be explicitly requested such as "knowledge_panels". + + The "fields" values can also be concatenated: "all,knowledge_panels" + content: + application/json: + schema: + allOf: + - $ref: ./responses/response-status/response_status.yaml + - type: object + properties: + product: + $ref: ./schemas/product.yaml + examples: + Update of packagings: + value: + status: success_with_errors + result: + id: "en:product-updated" + en_name: Product updated + lc_name: Produit mis à jour + errors: + - message: + id: "en:sugars-higher-than-carbohydrates" + name: Sugars higher than carbohydrates + lc_name: Sucres plus élevés que les glucides + description: Sugars (40g) are higher than carbohydrates (35g). + lc_description: Les sucres (40g) sont plus élévés que les glucdes. + field: + id: nutriment.sugars + value: "40" + impact: + id: "en:nutrients-not-updated" + name: Nutrients not updated + lc_name: Nutriments non mis à jour + description: The nutrients were not updated. + lc_description: Les nutriments n'ont pas été mis à jour. + product: + packagings: + - material: "en:pp-polypropylene" + number: "2" + recycling: "en:discard" + shape: "en:lid" + - material: "en:non-corrugated-cardboard" + number: "1" + recycling: "en:recycle" + shape: "en:box" + weight: 120 + - material: "en:paper-and-fibreboard-aluminium" + number: "2" + recycling: "en:recycle" + shape: "en:seal" + - material: "en:clear-glass" + number: "2" + recycling: "en:recycle" + shape: "en:jar" + quantity: 200 ML + quantity_value: 200 + quantity_unit: ml + weight: 80 + headers: {} + description: |- + This API allows to create or update a product (if the product already exists, its data is updated, otherwise it is created), or to analyze a test product (in which case no product is created or updated). To analyze a product, the "barcode" path component needs to contain the value "test" instead of a barcode. + + New API to send structured product data in a JSON format instead of in a flattened list of key / value pairs field as-in the current product add / edit API that relies on a multipart/form-data format. + + Important: this new Product WRITE API is under development. The initial deployment will support only packaging fields. + + This new API will be used in particular to send structured packaging data: https://openfoodfacts.github.io/openfoodfacts-server/dev/explain-packaging-data/ + + The new API can then be gradually extended to support other product fields. + requestBody: + content: + application/json: + schema: + allOf: + - $ref: ./requestBodies/lc_cc.yaml + - $ref: ./requestBodies/fields_tags_lc.yaml + - type: object + properties: + user_id: + type: string + password: + type: string + product: + $ref: ./schemas/product_update_api_v3.yaml + examples: + example-1: + value: + lc: fr + cc: fr + fields: "product_name,packagings" + tags_lc: fr + userid: string + password: string + code: string + product: + packagings: + - number_of_units: 6 + shape: + id: "en:bottle" + material: + id: "en:plastic" + recycling: + id: "en:recycle" + quantity_per_unit: 25 cl + weight_measured: 10 + packagings_add: + - number_of_units: 6 + shape: + id: "en:bottle" + material: + id: "en:plastic" + recycling: + id: "en:recycle" + quantity_per_unit: 25 cl + weight_measured: 10 + application/xml: + schema: + type: object + properties: {} + description: | + Structured data for the product is passed in the product field. + + For complex structures such as the packagings object, it is possible to replace pre-existing data, or completing it: + + - an object sent in the packagings field will replace any pre-existing data. + - an object sent in the field suffixed with _add (e.g. packagings_add) will be merged with any pre-existing data. + parameters: [] + /api/v3/taxonomy_suggestions: + parameters: [] + get: + summary: Get taxonomy entries suggestions + tags: [] + responses: + "200": + description: OK + content: + application/json: + schema: + allOf: + - $ref: ./responses/response-status/response_status.yaml + - type: object + properties: + suggestions: + type: array + description: Array of sorted strings suggestions in the language requested in the "lc" field. + items: + type: string + matched_synonyms: + type: object + description: | + Dictionary of strings associating canonical names (as seen in suggestions field) with the synonym that best matches the query. An entry is present for all suggestions, even when the synonym is the same with the canonical name. + + This value is present only if get_synonyms parameter is present. + additional_properties: + type: string + operationId: get-api-v3-taxonomy_suggestions-taxonomy + description: |- + Open Food Facts uses multilingual [taxonomies](https://wiki.openfoodfacts.org/Global_taxonomies) to normalize entries for categories, labels, ingredients, packaging shapes / materials / recycling instructions and many more fields. + + This API returns taxonomy entries suggestions that can be used in product edit forms, search forms etc. (for instance in autocomplete dropdowns using libraries like Tagify or select2 on the Web). + + Suggestions filtering: + + The string parameter allows to get only suggestions that contain a specific string (useful for autocomplete suggestions). + + Suggestions ordering: + + - For packaging shapes and materials, suggestions are ordered first by the number of packaging components they appear in (restricted by country, categories and shape (for materials) if they are passed as parameters). + - for all other taxonomies, results are ordered alphabetically + + If a string is passed, an additional sort is done to put first suggestions that start with the string, followed by suggestions with a word that start with the string, and then suggestions that contain the string anywhere. + parameters: + - $ref: ./api.yml#/components/parameters/tagtype + - $ref: "#/components/parameters/cc" + - $ref: "#/components/parameters/lc" + - schema: + type: string + example: pe + in: query + name: string + description: "Optional string used to filter suggestions (useful for autocomplete). If passed, suggestions starting with the string will be returned first, followed by suggestions matching the string at the beginning of a word, and suggestions matching the string inside a word." + - schema: + type: string + example: yougurts + in: query + name: categories + description: 'Comma separated list of categories tags (e.g. "en:fats,en:unsalted-butters" or categories names in the language indicated by the "lc" field (e.g. "graisses, beurres salés" in French)' + - schema: + type: string + example: bottle + in: query + name: shape + description: 'Shape of packaging component (tag identified in the packaging_shapes taxonomy, or plain text tag name in the language indicated by the "lc" field)' + - schema: + type: string + in: query + name: limit + description: "Maximum number of suggestions. Default is 25, max is 400." + - schema: + type: string + in: query + name: get_synonyms + description: 'Whether or not to include "matched_synonyms" in the response. Set to 1 to include.' + - schema: + type: string + in: query + name: term + description: Alias for the "string" parameter provided for backward compatibility. "string" takes precedence. + "/api/v3/tag/{tagtype}/{tag_or_tagid}": + parameters: + - $ref: "#/components/parameters/cc" + - $ref: "#/components/parameters/lc" + - schema: + type: string + example: categories + name: tagtype + in: path + required: true + description: Type of the tag + - schema: + type: string + name: tag_or_tagid + in: path + required: true + description: "Tag name (e.g. yogurts) or tag id (e.g. en:yogurts)" + get: + summary: Get knowledge panels for a tag + tags: [] + responses: + "200": + description: OK + content: + application/json: + schema: + allOf: + - $ref: ./responses/response-status/response_status.yaml + - type: object + properties: + tagtype: + type: string + description: | + Input tagtype + tagid: + type: string + description: | + Input tagid + tag: + type: object + properties: + tagid: + type: string + description: Canonicalized tagid corresponding to the input tag_or_tagid + tagtype: + type: string + description: Canonicalized tagtype + knowledge_panels: + $ref: ./schemas/knowledge_panels/panels.yaml + description: Knowledge panels for the tag + application/xml: + schema: + type: object + properties: {} + operationId: get-api-v3-tag-tagtype-tag_or_tagid + description: |- + Return knowledge panels for a tag. + + Currently the knowledge panels returned are: + + Categories: + - Packaging stats for a category + /api/v3/product_revert: + parameters: [] + post: + summary: Revert a product to a previous revision + tags: [] + responses: + "200": + description: OK + content: + application/json: + schema: + allOf: + - $ref: ./responses/response-status/response_status.yaml + operationId: post-api-v3-product_revert + description: |- + For moderators only, revert a product to a previous revision. + requestBody: + content: + application/json: + schema: + allOf: + - $ref: ./requestBodies/fields_tags_lc.yaml + - type: object + properties: + code: + type: string + description: Barcode of the product + rev: + type: integer + description: Revision number to revert to + description: | + The code and rev fields are mandatory. + parameters: [] +components: + parameters: + cc: + schema: + type: string + example: "us" + in: query + name: cc + required: false + description: "2 letter code of the country of the user. Used for localizing some fields in returned values (e.g. knowledge panels). If not passed, the country may be inferred by the IP address of the request." + lc: + schema: + type: string + example: "fr" + in: query + name: lc + required: false + description: "2 letter code of the language of the user. Used for localizing some fields in returned values (e.g. knowledge panels). If not passed, the language may be inferred by the Accept-Language header of the request." + code: + schema: + type: string + example: "4251105501381" + in: query + name: code + description: Barcode of the product + required: true +tags: + - name: Read Requests + - name: Write Requests diff --git a/Tools/ref/api.yml b/Tools/ref/api.yml new file mode 100644 index 0000000..8320beb --- /dev/null +++ b/Tools/ref/api.yml @@ -0,0 +1,599 @@ +openapi: 3.1.0 +info: + title: Open Food Facts Open API + description: | + As a developer, the Open Food Facts API allows you to get information + and contribute to the products database. You can create great apps to + help people make better food choices and also provide data to enhance the database. + termsOfService: "https://world.openfoodfacts.org/terms-of-use" + contact: + name: Open Food Facts + url: "https://slack.openfoodfacts.org/" + email: reuse@openfoodfacts.org + license: + name: "data: ODbL" + url: "https://opendatacommons.org/licenses/odbl/summary/index.html" + # can't use url and identifier - use x-identifier + x-identifier: "ODbL-1.0" + version: "2" +externalDocs: + description: | + Please read the API introduction before using this API. + url: https://openfoodfacts.github.io/openfoodfacts-server/api/ +servers: + - description: dev + url: "https://world.openfoodfacts.net" + - url: "https://world.openfoodfacts.org" + description: prod +paths: + "/api/v2/product/{barcode}": + get: + tags: + - Read Requests + summary: Get information for a specific product by barcode + parameters: + - name: barcode + in: path + description: | + The barcode of the product to be fetched + required: true + style: simple + explode: false + schema: + type: string + example: "3017620422003" + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: ./responses/get_product_by_barcode.yaml + examples: + spread-example: + $ref: ./examples/get_product_by_barcode_spread.yaml + + description: | + A product can be fetched via its unique barcode. + It returns all the details of that product response. + operationId: get-product-by-barcode + "/api/v2/product/{barcode}?fields=knowledge_panels": + get: + tags: + - Read Requests + summary: | + Get Knowledge panels for a specific product by barcode + (special case of get product) + parameters: + - name: barcode + in: path + description: | + The barcode of the product to be fetched + required: true + style: simple + explode: false + schema: + type: string + example: "3017620422003" + responses: + "200": + description: OK + content: + application/json: + schema: + allOf: + - $ref: ./responses/get_product_by_barcode_base.yaml + - type: object + properties: + product: + $ref: ./schemas/product_knowledge_panels.yaml + description: | + Knowledge panels gives high leve informations about a product, + ready to display. + This is used by open food facts website, + and by the official mobile application + operationId: get-product-by-barcode-knowledge-panels + /cgi/product_image_upload.pl: + post: + tags: + - Write Requests + summary: Add a Photo to an Existing Product + operationId: get-cgi-product_image_upload.pl + description: | + Photos are source and proof of data. + The first photo uploaded for a product is + auto-selected as the product’s “front” photo.' + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: ./responses/add_photo_to_existing_product.yaml + requestBody: + content: + multipart/form-data: + schema: + $ref: ./requestBodies/add_photo_to_existing_product.yaml + description: "" + /cgi/ingredients.pl: + parameters: [] + get: + summary: Performing OCR on a Product + operationId: get-cgi-ingredients.pl + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: ./responses/ocr_on_product.yaml + description: | + Open Food Facts uses optical character recognition (OCR) to retrieve nutritional data and other information from the product labels. + parameters: + - $ref: "#/components/parameters/id" + - $ref: "#/components/parameters/code" + - $ref: "#/components/parameters/process_image" + - $ref: "#/components/parameters/ocr_engine" + tags: + - Read Requests + /cgi/product_image_crop.pl: + post: + summary: Crop A Photo + operationId: post-cgi-product_image_crop.pl + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: {} + description: | + Cropping is only relevant for editing existing products. + You cannot crop an image the first time you upload it to the system. + parameters: [] + requestBody: + content: + multipart/form-data: + schema: + $ref: ./requestBodies/crop_a_photo.yaml + required: true + tags: + - Write Requests + get: + summary: Rotate A Photo + operationId: get-cgi-product_image_crop.pl + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: ./responses/rotate_a_photo.yaml + description: | + Although we recommend rotating photos manually and uploading a new version of the image, + the OFF API allows you to make api calls to automate this process. + You can rotate existing photos by setting the angle to 90º, 180º, or 270º clockwise. + parameters: + - $ref: "#/components/parameters/code" + - $ref: "#/components/parameters/id" + - $ref: "#/components/parameters/imgid" + - $ref: "#/components/parameters/angle" + tags: + - Write Requests + /cgi/product_image_unselect.pl: + post: + summary: Unselect A Photo + requestBody: + content: + multipart/form-data: + schema: + $ref: ./requestBodies/unselect_a_photo.yaml + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + status: + type: string + description: status of the unselect operation + example: status ok + status_code: + type: number + description: status code of the operation + example: 0 + imagefield: + type: string + example: front_fr + description: image field that was unselected + + /cgi/product_jqm2.pl: + post: + summary: Add or Edit A Product + operationId: post-cgi-product_jqm2.pl + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: ./responses/add_or_edit_a_product.yaml + parameters: [] + requestBody: + content: + multipart/form-data: + schema: + allOf: + - $ref: ./requestBodies/add_or_edit_a_product.yaml + - $ref: ./requestBodies/change_ref_properties.yaml + tags: + - Write Requests + description: | + This updates a product. + + Note: If the barcode exists then you will be editing the existing product, + However if it doesn''t you will be creating a new product with that unique barcode, + and adding properties to the product. + /api/v2/search: + get: + summary: Search for Products + tags: + - Read Requests + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: ./responses/search_for_products.yaml + operationId: get-search + description: | + Search request allows you to get products that match your search criteria. + + It allows you create many custom APIs for your use case. + + If the search query parameter has 2 possible values, they are seperated by a comma(,). + When filtering via a parameter that has different language codes like `fr`, `de` or `en`, specify the language code in the parameter name e.g `categories_tags_en` + + **Important:** search API v2 does not support full text request (search_term), + you have to use [search API v1](https://wiki.openfoodfacts.org/API/Read/Search) for that. + Upcoming [search-a-licious project](https://github.com/openfoodfacts/search-a-licious) will fix that. + + ### Limiting results + + You can limit the size of returned objects thanks to the `fields` object (see below). + + eg: `fields=code,product_name,brands,attribute_groups`` + + Please use it as much as possible to avoid overloading the servers. + + The search use pagination, see `page` and `page_size` parameters. + + **Beware:** the `page_count` data in item is a bit counter intuitive…, read the description. + + ### Conditions on tags + + All `_tags`` parameters accepts either: + + * a single value + * or a comma-separated list of values (doing a AND) + * or a pipe separated list of values (doing a OR) + + You can exclude terms by using a "-" prefix. + + For taxonomized entries, you might either use the tag id (recommended), + or a known synonym (without language prefix) + + * `labels_tags=en:organic,en:fair-trade` find items that are fair-trade AND organic + * `labels_tags=en:organic|en:fair-trade` find items that are fair-trade OR organic + * `labels_tags=en:organic,en:-fair-trade` find items that are organic BUT NOT fair-trade + + + ### Conditions on nutriments + + To get a list of nutrients + + You can either query on nutrient per 100g (`_100g` suffix) + or per serving (`serving` suffix). + + You can also add `_prepared_` + to get the nutrients in the prepared product instead of as sold. + + You can add a comparison operator and value to the parameter name + to get products with nutrient above or bellow a value. + If you use a parameter value it exactly match it. + + * `energy-kj_100g<200` products where energy in kj for 100g is less than 200kj + * `sugars_serving>10` products where sugar per serving is greater than 10g + * `saturated-fat_100g=1` products where saturated fat per 100g is exactly 10g + * `salt_prepared_serving<0.1` products where salt per serving for prepared product is less than 0.1g + + ### More references + + See also [wiki page](https://wiki.openfoodfacts.org/Open_Food_Facts_Search_API_Version_2) + + parameters: + # all tags parameters + - $ref: "./schemas/tags_parameters.yaml#/properties/additives_tags" + - $ref: "./schemas/tags_parameters.yaml#/properties/allergens_tags" + - $ref: "./schemas/tags_parameters.yaml#/properties/brands_tags" + - $ref: "./schemas/tags_parameters.yaml#/properties/categories_tags" + - $ref: "./schemas/tags_parameters.yaml#/properties/countries_tags" + - $ref: "./schemas/tags_parameters.yaml#/properties/emb_codes_tags" + - $ref: "./schemas/tags_parameters.yaml#/properties/labels_tags" + - $ref: "./schemas/tags_parameters.yaml#/properties/manufacturing_places_tags" + - $ref: "./schemas/tags_parameters.yaml#/properties/nutrition_grades_tags" + - $ref: "./schemas/tags_parameters.yaml#/properties/origins_tags" + - $ref: "./schemas/tags_parameters.yaml#/properties/packaging_tags" + - $ref: "./schemas/tags_parameters.yaml#/properties/purchase_places_tags" + - $ref: "./schemas/tags_parameters.yaml#/properties/states_tags" + - $ref: "./schemas/tags_parameters.yaml#/properties/stores_tags" + - $ref: "./schemas/tags_parameters.yaml#/properties/traces_tags" + - $ref: "./schemas/tags_parameters.yaml#/properties/tag_name_with_language_code" + - $ref: "./schemas/nutrition_search.yaml#/properties/nutrient_lower_than" + - $ref: "./schemas/nutrition_search.yaml#/properties/nutrient_greater_than" + - $ref: "./schemas/nutrition_search.yaml#/properties/nutrient_equal" + - $ref: "#/components/parameters/fields" + - $ref: "#/components/parameters/sort_by" + - $ref: "#/components/parameters/page" + - $ref: "#/components/parameters/page_size" + parameters: [] + /cgi/suggest.pl: + get: + summary: Get Suggestions to Aid Adding/Editing Products + tags: + - Read Requests + responses: + "200": + description: OK + content: + application/json: + schema: + type: array + operationId: get-cgi-suggest.pl + parameters: + - $ref: "#/components/parameters/tagtype" + - $ref: "#/components/parameters/term" + description: | + For example , Dave is looking for packaging_shapes that contain the term "fe", + all packaging_shapes containing "fe" will be returned. + This is useful if you have a search in your application, + for a specific product field. + /cgi/nutrients.pl: + get: + summary: Get a nested list of nutrients that can be displayed in the nutrition facts table for a specific country and language + tags: + - Read Requests + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: ./responses/get_nutrients.yaml + operationId: get-cgi-nutrients.pl + parameters: + - $ref: "#/components/parameters/cc" + - $ref: "#/components/parameters/lc" + description: | + Used to display the nutrition facts table of a product, or to display a form to input those nutrition facts. + /api/v2/attribute_groups: + get: + summary: Get the list of attributes available for personal search. + description: | + Attributes are at the heart of personal search. + They score the products according to different criterias, + which could then be matched to a user's preferences. + + This API helps you list attributes and display them in your application, + for the user to choose the importance of each criteria. + + note: /api/v2/attribute_groups_{lc} is also a valid route, but consider it deprecated + tags: + - Read Requests + - Personal search + operationId: get-attribute-groups + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: ./responses/get_attribute_groups.yaml + parameters: + - $ref: "#/components/parameters/lc" + /api/v2/preferences: + get: + summary: | + Get the weights corresponding to attributes preferences + to compute personal product + tags: + - Read Requests + - Personal search + operationId: get-preferences + parameters: + - $ref: "#/components/parameters/lc" + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: ./responses/get_preferences.yaml +components: + schemas: + "Product-Base": + $ref: ./schemas/product_base.yaml + "Product-Misc": + $ref: ./schemas/product_misc.yaml + "Product-Tags": + $ref: ./schemas/product_tags.yaml + "Product-Nutrition": + $ref: ./schemas/product_nutrition.yaml + "Product-Ingredients": + $ref: ./schemas/product_ingredients.yaml + "Product-Images": + $ref: ./schemas/product_images.yaml + "Product-Eco-Score": + $ref: ./schemas/product_ecoscore.yaml + "Product-Metadata": + $ref: ./schemas/product_meta.yaml + "Product-Data-Quality": + $ref: ./schemas/product_quality.yaml + "Product-Knowledge-Panels": + $ref: ./schemas/product_knowledge_panels.yaml + "Product-Attribute-Groups": + $ref: "./schemas/product_attribute_groups.yaml" + Product: + $ref: ./schemas/product.yaml + parameters: + id: + schema: + type: string + example: ingredients_en + in: query + name: id + required: true + cc: + schema: + type: string + example: "us" + in: query + name: cc + required: false + description: "2 letter code of the country of the user. Used for localizing some fields in returned values (e.g. knowledge panels). If not passed, the country may be inferred by the IP address of the request." + lc: + schema: + type: string + example: "fr" + in: query + name: lc + required: false + description: | + 2 letter code of the language of the user. + Used for localizing some fields in returned values (e.g. knowledge panels). + If not passed, the language may be inferred by the Accept-Language header of the request, + or from the domain name prefix. + code: + schema: + type: string + example: "4251105501381" + in: query + name: code + description: Barcode of the product + required: true + process_image: + schema: + type: string + example: "1" + in: query + name: process_image + required: true + ocr_engine: + schema: + type: string + example: google_cloud_vision + in: query + name: ocr_engine + required: true + imgid: + schema: + type: string + example: "1" + in: query + name: imgid + required: true + angle: + schema: + type: string + example: "90" + in: query + name: angle + required: true + page: + schema: + type: int + example: 24 + in: query + name: page + description: | + The page number you request to view (eg. in search results spanning multiple pages) + page_size: + schema: + type: int + example: 24 + in: query + name: page_size + description: | + The number of elements should be sent per page + sort_by: + schema: + type: string + example: product_name + enum: + - product_name + - last_modified_t + - scans_n + - unique_scans_n + - created_t + - completeness + - popularity_key + - nutriscore_score + - nova_score + - nothing + - ecoscore_score + in: query + name: sort_by + description: | + The allowed values used to sort/order the search results. + + * `product_name` sorts on name + * `ecoscore_score`, `nova_score`, `nutriscore_score` rank on the [Eco-Score](https://world.openfoodfacts.org/eco-score-the-environmental-impact-of-food-products), [Nova](https://world.openfoodfacts.org/nova), or [Nutri-Score](https://world.openfoodfacts.org/nutriscore) + * `scans_n`, `unique_scans_n` and `popularity_key` are about product popularity: number of scans on unique scans, rank of product + * `created_t`, `last_modified_t`, are about creation and modification dates + * `nothing`, tells not to sort at all (because if you do not provide the sort_by argument we default to sorting on popularity (for food) or last modification date) + fields: + schema: + type: string + example: "code,product_name" + in: query + name: fields + description: | + The fields to be returned from the product object can also be limited. + If not specified, it returns the entire product object response. + knowledge_panels_included: + schema: + type: string + example: "heatlh_card, environment_card" + in: query + name: knowledge_panels_included + description: | + When knowledge_panels are requested, you can specify which panels should be in the response. All the others will be excluded. + knowledge_panels_excluded: + schema: + type: string + example: "heatlh_card, environment_card" + in: query + name: knowledge_panels_excluded + description: | + When knowledge_panels are requested, you can specify which panels to exclude from the response. All the others will be included. + If a panel is both excluded and included (with the knowledge_panels_excluded parameter), it will be excluded. + tagtype: + schema: + type: string + example: additives + in: query + name: tagtype + term: + schema: + type: string + example: f + in: query + name: term +tags: + - name: Read Requests + - name: Write Requests diff --git a/Tools/ref/examples/get_product_by_barcode_spread.yaml b/Tools/ref/examples/get_product_by_barcode_spread.yaml new file mode 100644 index 0000000..8dd5c53 --- /dev/null +++ b/Tools/ref/examples/get_product_by_barcode_spread.yaml @@ -0,0 +1,1055 @@ +summary: retrieved values for a well known chocolate and nut spread +value: + code: '3017620422003' + product: + _id: '3017620422003' + _keywords: + - et + - pate + - cacao + - produit + - ferrero + - gluten + - petit-dejeuner + - san + - au + - aux + - sucre + - nutella + abbreviated_product_name: Nutella t.400 + abbreviated_product_name_fr: Nutella t.400 + added_countries_tags: [] + additives_n: 1 + additives_original_tags: + - 'en:e322' + additives_prev_original_tags: + - 'en:e322' + additives_tags: + - 'en:e322' + allergens: 'en:milk,en:nuts,en:soybeans' + allergens_from_ingredients: 'en:nuts, hazelnuts' + allergens_from_user: '(fr) en:milk,en:nuts,en:soybeans' + allergens_hierarchy: + - 'en:milk' + - 'en:nuts' + - 'en:soybeans' + allergens_lc: fr + allergens_tags: + - 'en:milk' + - 'en:nuts' + - 'en:soybeans' + amino_acids_prev_tags: [] + amino_acids_tags: [] + brands: Ferrero + brands_tags: + - ferrero + carbon_footprint_percent_of_known_ingredients: 13 + categories: 'Produits à tartiner,Petit-déjeuners,Produits à tartiner sucrés,Pâtes à tartiner,Pâtes à tartiner aux noisettes,Pâtes à tartiner aux noisettes et au cacao' + categories_hierarchy: + - 'en:breakfasts' + - 'en:spreads' + - 'en:sweet-spreads' + - 'en:hazelnut-spreads' + - 'en:chocolate-spreads' + - 'en:cocoa-and-hazelnuts-spreads' + categories_lc: fr + categories_properties: + 'agribalyse_food_code:en': '31032' + 'agribalyse_proxy_food_code:en': '31032' + 'ciqual_food_code:en': '31032' + categories_properties_tags: + - all-products + - categories-known + - agribalyse-food-code-31032 + - agribalyse-food-code-known + - agribalyse-proxy-food-code-31032 + - agribalyse-proxy-food-code-known + - ciqual-food-code-31032 + - ciqual-food-code-known + - agribalyse-known + - agribalyse-31032 + categories_tags: + - 'en:breakfasts' + - 'en:spreads' + - 'en:sweet-spreads' + - 'fr:pates-a-tartiner' + - 'en:hazelnut-spreads' + - 'en:chocolate-spreads' + - 'en:cocoa-and-hazelnuts-spreads' + category_properties: + 'ciqual_food_name:en': Chocolate spread with hazelnuts + checked: 'on' + checkers_tags: + - moon-rabbit + ciqual_food_name_tags: + - chocolate-spread-with-hazelnuts + cities_tags: [] + code: '3017620422003' + codes_tags: + - code-13 + - 3017620422xxx + - 301762042xxxx + - 30176204xxxxx + - 3017620xxxxxx + - 301762xxxxxxx + - 30176xxxxxxxx + - 3017xxxxxxxxx + - 301xxxxxxxxxx + - 30xxxxxxxxxxx + - 3xxxxxxxxxxxx + compared_to_category: 'en:cocoa-and-hazelnuts-spreads' + complete: 0 + completeness: 0.875 + conservation_conditions: A conserver au sec et à l'abri de la chaleur. Ne pas mettre au réfrigérateur. + conservation_conditions_fr: A conserver au sec et à l'abri de la chaleur. Ne pas mettre au réfrigérateur. + correctors_tags: + - user1 + - user2 + - user3 + - user4 + countries: 'en:Algeria Austria Belgium Canada France Germany Italy Luxembourg Mexico Morocco Netherlands Portugal Senegal Spain Switzerland Tunisia United Kingdom United States' + countries_beforescanbot: 'Belgium,France' + countries_hierarchy: + - 'en:Algeria Austria Belgium Canada France Germany Italy Luxembourg Mexico Morocco Netherlands Portugal Senegal Spain Switzerland Tunisia United Kingdom United States' + countries_lc: fr + countries_tags: + - 'en:algeria-austria-belgium-canada-france-germany-italy-luxembourg-mexico-morocco-netherlands-portugal-senegal-spain-switzerland-tunisia-united-kingdom-united-states' + created_t: 1457680652 + creator: openfoodfacts-contributors + customer_service: 'FERRERO FRANCE COMMERCIALE - Service Consommateurs, CS 90058 - 76136 MONT SAINT AIGNAN Cedex' + customer_service_fr: 'FERRERO FRANCE COMMERCIALE - Service Consommateurs, CS 90058 - 76136 MONT SAINT AIGNAN Cedex' + data_quality_bugs_tags: [] + data_quality_errors_tags: [] + data_quality_info_tags: + - 'en:packaging-data-incomplete' + - 'en:ingredients-percent-analysis-ok' + - 'en:ecoscore-extended-data-computed' + - 'en:ecoscore-extended-data-less-precise-than-agribalyse' + - 'en:food-groups-1-known' + - 'en:food-groups-2-known' + - 'en:food-groups-3-unknown' + data_quality_tags: + - 'en:packaging-data-incomplete' + - 'en:ingredients-percent-analysis-ok' + - 'en:ecoscore-extended-data-computed' + - 'en:ecoscore-extended-data-less-precise-than-agribalyse' + - 'en:food-groups-1-known' + - 'en:food-groups-2-known' + - 'en:food-groups-3-unknown' + - 'en:ecoscore-origins-of-ingredients-origins-are-100-percent-unknown' + - 'en:ecoscore-packaging-unspecified-shape' + - 'en:ecoscore-production-system-no-label' + data_quality_warnings_tags: + - 'en:ecoscore-origins-of-ingredients-origins-are-100-percent-unknown' + - 'en:ecoscore-packaging-unspecified-shape' + - 'en:ecoscore-production-system-no-label' + data_sources: 'Database - FoodRepo / openfood.ch, Databases, Producer - Ferrero, Producers, App - yuka, Apps, Producer - ferrero-france-commerciale, Database - Equadis, Database - GDSN, App - InFood, App - Open Food Facts, App - halal-healthy, App - smoothie-openfoodfacts' + data_sources_tags: + - database-foodrepo-openfood-ch + - databases + - producer-ferrero + - producers + - app-yuka + - apps + - producer-ferrero-france-commerciale + - database-equadis + - database-gdsn + - app-infood + - app-open-food-facts + - app-halal-healthy + - app-smoothie-openfoodfacts + ecoscore_data: + adjustments: + origins_of_ingredients: + aggregated_origins: + - origin: 'en:unknown' + percent: 100 + epi_score: 0 + epi_value: -5 + origins_from_origins_field: + - 'en:unknown' + transportation_scores: + fr: 0 + 'no': 0 + uk: 0 + us: 0 + world: 0 + transportation_values: + fr: 0 + 'no': 0 + uk: 0 + us: 0 + world: 0 + values: + fr: -5 + 'no': -5 + uk: -5 + us: -5 + world: -5 + warning: origins_are_100_percent_unknown + packaging: + non_recyclable_and_non_biodegradable_materials: 0 + packagings: + - ecoscore_material_score: 81 + ecoscore_shape_ratio: 1 + material: 'en:clear-glass' + shape: 'en:unknown' + score: 81 + value: -2 + warning: unspecified_shape + production_system: + labels: [] + value: 0 + warning: no_label + threatened_species: + ingredient: 'en:palm-oil' + value: -10 + agribalyse: + agribalyse_food_code: '31032' + co2_agriculture: 8.7770996 + co2_consumption: 0 + co2_distribution: 0.014104999 + co2_packaging: 0.18864842 + co2_processing: 0.69167973 + co2_total: 9.8742343 + co2_transportation: 0.19708507 + code: '31032' + dqr: '2.54' + ef_agriculture: 0.61477708 + ef_consumption: 0 + ef_distribution: 0.0045906531 + ef_packaging: 0.020453714 + ef_processing: 0.085674643 + ef_total: 0.74366703 + ef_transportation: 0.017824104 + is_beverage: 0 + name_en: Chocolate spread with hazelnuts + name_fr: Pâte à tartiner chocolat et noisette + score: 40 + grade: d + grades: + fr: d + 'no': d + uk: d + us: d + world: d + missing: + labels: 1 + origins: 1 + packagings: 1 + missing_data_warning: 1 + score: 23 + scores: + fr: 23 + 'no': 23 + uk: 23 + us: 23 + world: 23 + status: known + ecoscore_extended_data: + impact: + ef_single_score_log_stddev: 0.0539895633164057 + likeliest_impacts: + Climate_change: 0.172717449218484 + EF_single_score: 0.023255035815491 + likeliest_recipe: + 'en:emulsifier': 0.388589430098073 + 'en:hazelnut_oil': 12.806852015349 + 'en:palm_oil': 16.6103749736231 + 'en:sugar': 52.9709312507153 + 'en:water': 4.90093151221936 + 'fr:Cacao_Maigre_7': 3.94056985087663 + 'fr:Lait__cr_m__En_Poudre_8': 6.8959972390341 + mass_ratio_uncharacterized: 0.11 + uncharacterized_ingredients: + impact: + - 'fr:Lait Écrémé En Poudre 8' + - 'fr:Cacao Maigre 7' + nutrition: + - 'fr:Lait Écrémé En Poudre 8' + - 'fr:Cacao Maigre 7' + uncharacterized_ingredients_mass_proportion: + impact: 0.11 + nutrition: 0.11 + uncharacterized_ingredients_ratio: + impact: 0.333333333333333 + nutrition: 0.333333333333333 + warnings: + - 'The product has a high number of nutrition uncharacterized ingredients: 33%' + - 'The product has a high number of impact uncharacterized ingredients: 33%' + - 'The estimated mass of nutrition uncharacterized ingredients in the product is high: 11%' + - 'The estimated mass of impact uncharacterized ingredients in the product is high: 11%' + ecoscore_extended_data_version: '4' + ecoscore_grade: d + ecoscore_score: 23 + ecoscore_tags: + - d + editors_tags: + - user1 + - user2 + - user3 + - user4 + emb_codes: '' + emb_codes_20141016: '' + emb_codes_orig: '' + emb_codes_tags: [] + entry_dates_tags: + - '2016-03-11' + - 2016-03 + - '2016' + environment_impact_level: '' + environment_impact_level_tags: [] + expiration_date: 09/2021 + food_groups: 'en:sweets' + food_groups_tags: + - 'en:sugary-snacks' + - 'en:sweets' + fruits-vegetables-nuts_100g_estimate: 0 + generic_name: '' + generic_name_ar: نوتلا + generic_name_de: Nuss-Nougat-Creme + generic_name_en: '' + generic_name_es: Crema de Avellanas con cacao + generic_name_fr: Pâte à tartiner aux noisettes + generic_name_id: '' + generic_name_it: Nutella + generic_name_nl: '' + grades: {} + id: '3017620422003' + image_front_small_url: 'https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.200.jpg' + image_front_thumb_url: 'https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.100.jpg' + image_front_url: 'https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.400.jpg' + image_nutrition_small_url: 'https://images.openfoodfacts.org/images/products/301/762/042/2003/nutrition_en.400.200.jpg' + image_nutrition_thumb_url: 'https://images.openfoodfacts.org/images/products/301/762/042/2003/nutrition_en.400.100.jpg' + image_nutrition_url: 'https://images.openfoodfacts.org/images/products/301/762/042/2003/nutrition_en.400.400.jpg' + image_small_url: 'https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.200.jpg' + image_thumb_url: 'https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.100.jpg' + image_url: 'https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.400.jpg' + images: + '1': + sizes: + '100': + h: 100 + w: 56 + '400': + h: 400 + w: 225 + full: + h: 2000 + w: 1125 + uploaded_t: '1457680652' + uploader: openfoodfacts-contributors + '2': + sizes: + '100': + h: 100 + w: 75 + '400': + h: 400 + w: 300 + full: + h: 3264 + w: 2448 + uploaded_t: '1462829284' + uploader: openfoodfacts-contributors + '3': + sizes: + '100': + h: 100 + w: 56 + '400': + h: 400 + w: 225 + full: + h: 2000 + w: 1125 + uploaded_t: '1468510986' + uploader: user3 + front_en: + angle: '0' + coordinates_image_size: full + geometry: 0x0-0-0 + imgid: '1' + normalize: 'false' + rev: '399' + sizes: + '100': + h: 100 + w: 77 + '200': + h: 200 + w: 155 + '400': + h: 400 + w: 310 + full: + h: 1808 + w: 1400 + white_magic: 'false' + x1: '0' + x2: '0' + y1: '0' + y2: '0' + front_fr: + angle: 0 + coordinates_image_size: '400' + geometry: 0x0--5--5 + imgid: '2' + normalize: 'false' + rev: '415' + sizes: + '100': + h: 100 + w: 77 + '200': + h: 200 + w: 155 + '400': + h: 400 + w: 310 + full: + h: 1808 + w: 1400 + white_magic: 'false' + x1: '-1' + x2: '-1' + y1: '-1' + y2: '-1' + ingredients_fr: + angle: null + coordinates_image_size: '400' + geometry: 0x0-0-0 + imgid: '3' + normalize: null + rev: '299' + sizes: + '100': + h: 16 + w: 100 + '200': + h: 33 + w: 200 + '400': + h: 65 + w: 400 + full: + h: 334 + w: 2046 + white_magic: null + x1: null + x2: null + y1: null + y2: null + nutrition_en: + angle: '0' + coordinates_image_size: full + geometry: 0x0-0-0 + imgid: '3' + normalize: 'false' + rev: '400' + sizes: + '100': + h: 100 + w: 96 + '200': + h: 200 + w: 192 + '400': + h: 400 + w: 383 + full: + h: 572 + w: 548 + white_magic: 'false' + x1: '0' + x2: '0' + y1: '0' + y2: '0' + packaging_fr: + angle: 0 + coordinates_image_size: full + geometry: 0x0--1--1 + imgid: '3' + normalize: null + rev: '420' + sizes: + '100': + h: 31 + w: 100 + '200': + h: 61 + w: 200 + '400': + h: 122 + w: 400 + full: + h: 638 + w: 2084 + white_magic: null + x1: '-1' + x2: '-1' + y1: '-1' + y2: '-1' + informers_tags: + - user1 + - user2 + - user3 + - user4 + ingredients: + - id: 'en:sugar' + percent_estimate: 46.5 + percent_max: 63 + percent_min: 30 + text: sugar + vegan: 'yes' + vegetarian: 'yes' + - from_palm_oil: 'yes' + id: 'en:palm-oil' + percent_estimate: 25.5 + percent_max: 38 + percent_min: 13 + text: palm oil + vegan: 'yes' + vegetarian: 'yes' + - id: 'en:hazelnut' + percent: 13 + percent_estimate: 13 + percent_max: 13 + percent_min: 13 + text: hazelnuts + vegan: 'yes' + vegetarian: 'yes' + - id: 'en:skim-milk-powder-8' + percent: 7 + percent_estimate: 7 + percent_max: 7 + percent_min: 7 + text: skim milk powder 8 + - id: 'en:lean-cocoa-7' + percent: 4 + percent_estimate: 4 + percent_max: 4 + percent_min: 4 + text: lean cocoa 7 + - id: 'en:emulsifier' + ingredients: + - id: 'en:soya-lecithin' + percent_estimate: 2 + percent_max: 4 + percent_min: 0 + text: soy lecithins + vegan: 'yes' + vegetarian: 'yes' + percent_estimate: 2 + percent_max: 4 + percent_min: 0 + text: emulsifiers + - id: 'en:vanillin' + percent_estimate: 2 + percent_max: 4 + percent_min: 0 + text: vanillin + ingredients_analysis: + 'en:palm-oil': + - 'en:palm-oil' + 'en:vegan-status-unknown': + - 'en:skim-milk-powder-8' + - 'en:lean-cocoa-7' + - 'en:vanillin' + 'en:vegetarian-status-unknown': + - 'en:skim-milk-powder-8' + - 'en:lean-cocoa-7' + - 'en:vanillin' + ingredients_analysis_tags: + - 'en:palm-oil' + - 'en:vegan-status-unknown' + - 'en:vegetarian-status-unknown' + ingredients_from_or_that_may_be_from_palm_oil_n: 0 + ingredients_from_palm_oil_n: 0 + ingredients_from_palm_oil_tags: [] + ingredients_hierarchy: + - 'en:sugar' + - 'en:added-sugar' + - 'en:disaccharide' + - 'en:palm-oil' + - 'en:oil-and-fat' + - 'en:vegetable-oil-and-fat' + - 'en:palm-oil-and-fat' + - 'en:hazelnut' + - 'en:nut' + - 'en:tree-nut' + - 'en:skim-milk-powder-8' + - 'en:lean-cocoa-7' + - 'en:emulsifier' + - 'en:vanillin' + - 'en:soya-lecithin' + - 'en:e322' + - 'en:e322i' + ingredients_n: 8 + ingredients_n_tags: + - '8' + - 1-10 + ingredients_original_tags: + - 'en:sugar' + - 'en:palm-oil' + - 'en:hazelnut' + - 'en:skim-milk-powder-8' + - 'en:lean-cocoa-7' + - 'en:emulsifier' + - 'en:vanillin' + - 'en:soya-lecithin' + ingredients_percent_analysis: 1 + ingredients_tags: + - 'en:sugar' + - 'en:added-sugar' + - 'en:disaccharide' + - 'en:palm-oil' + - 'en:oil-and-fat' + - 'en:vegetable-oil-and-fat' + - 'en:palm-oil-and-fat' + - 'en:hazelnut' + - 'en:nut' + - 'en:tree-nut' + - 'en:skim-milk-powder-8' + - 'en:lean-cocoa-7' + - 'en:emulsifier' + - 'en:vanillin' + - 'en:soya-lecithin' + - 'en:e322' + - 'en:e322i' + ingredients_text: 'sugar, palm oil, hazelnuts 13%, skim milk powder 8, 7%, lean cocoa 7, 4%, emulsifiers: soy lecithins, vanillin' + ingredients_text_en: 'sugar, palm oil, hazelnuts 13%, skim milk powder 8, 7%, lean cocoa 7, 4%, emulsifiers: soy lecithins, vanillin' + ingredients_text_fr: 'Sucre, huile de palme, _NOISETTES_ 13%, _LAIT_ écrémé en poudre 8,7%, cacao maigre 7,4%, émulsifiants: lécithine [SOJA]; vanilline. Sans gluten' + ingredients_text_with_allergens: 'sugar, palm oil, hazelnuts 13%, skim milk powder 8, 7%, lean cocoa 7, 4%, emulsifiers: soy lecithins, vanillin' + ingredients_text_with_allergens_en: 'sugar, palm oil, hazelnuts 13%, skim milk powder 8, 7%, lean cocoa 7, 4%, emulsifiers: soy lecithins, vanillin' + ingredients_text_with_allergens_fr: 'Sucre, huile de palme, NOISETTES 13%, LAIT écrémé en poudre 8,7%, cacao maigre 7,4%, émulsifiants: lécithine [SOJA]; vanilline. Sans gluten' + ingredients_that_may_be_from_palm_oil_n: 0 + ingredients_that_may_be_from_palm_oil_tags: [] + ingredients_with_specified_percent_n: 3 + ingredients_with_specified_percent_sum: 24 + ingredients_with_unspecified_percent_n: 4 + ingredients_with_unspecified_percent_sum: 76 + interface_version_created: '20120622' + interface_version_modified: 20150316.jqm2 + known_ingredients_n: 15 + labels: 'Sans gluten,en:nonorganic' + labels_hierarchy: + - 'en:no-gluten' + - 'en:nonorganic' + labels_lc: fr + labels_tags: + - 'en:no-gluten' + - 'en:nonorganic' + lang: en + languages: + 'en:arabic': 2 + 'en:english': 4 + 'en:french': 10 + 'en:german': 3 + 'en:italian': 3 + 'en:spanish': 7 + languages_codes: + en: 4 + fr: 10 + languages_hierarchy: + - 'en:english' + - 'en:french' + languages_tags: + - 'en:english' + - 'en:french' + - 'en:multilingual' + last_check_dates_tags: + - '2021-07-21' + - 2021-07 + - '2021' + last_checked_t: 1626872806 + last_checker: user3 + last_edit_dates_tags: + - '2022-07-29' + - 2022-07 + - '2022' + last_editor: user4 + last_image_dates_tags: + - '2022-07-29' + - 2022-07 + - '2022' + last_image_t: 1659084293 + last_modified_by: user4 + last_modified_t: 1659084329 + lc: en + link: '' + main_countries_tags: [] + manufacturing_places: '' + manufacturing_places_tags: [] + max_imgid: '121' + minerals_prev_tags: [] + minerals_tags: [] + misc_tags: + - 'en:nutrition-no-fiber' + - 'en:nutrition-fruits-vegetables-nuts-estimate-from-ingredients' + - 'en:nutrition-no-fiber-or-fruits-vegetables-nuts' + - 'en:nutriscore-computed' + - 'en:ecoscore-extended-data-computed' + - 'en:ecoscore-extended-data-version-4' + - 'en:ecoscore-missing-data-warning' + - 'en:ecoscore-missing-data-labels' + - 'en:ecoscore-missing-data-origins' + - 'en:ecoscore-missing-data-packagings' + - 'en:ecoscore-computed' + no_nutrition_data: 'null' + nova_group: 4 + nova_groups: '4' + nova_groups_markers: + '3': + - - ingredients + - 'en:sugar' + '4': + - - additives + - 'en:e322' + - - ingredients + - 'en:emulsifier' + nova_groups_tags: + - 'en:4-ultra-processed-food-and-drink-products' + nucleotides_prev_tags: [] + nucleotides_tags: [] + nutrient_levels: + fat: high + salt: low + saturated-fat: high + sugars: high + nutrient_levels_tags: + - 'en:fat-in-high-quantity' + - 'en:saturated-fat-in-high-quantity' + - 'en:sugars-in-high-quantity' + - 'en:salt-in-low-quantity' + nutriments: + alcohol: 0 + alcohol_100g: 0 + alcohol_serving: 0 + alcohol_unit: '% vol' + alcohol_value: 0 + carbohydrates: 57.5 + carbohydrates_100g: 57.5 + carbohydrates_serving: 8.62 + carbohydrates_unit: g + carbohydrates_value: 57.5 + carbon-footprint-from-known-ingredients_product: 135 + carbon-footprint-from-known-ingredients_serving: 5.07 + energy: 2252 + energy-kcal: 539 + energy-kcal_100g: 539 + energy-kcal_serving: 80.8 + energy-kcal_unit: kcal + energy-kcal_value: 539 + energy-kj: 2252 + energy-kj_100g: 2252 + energy-kj_serving: 338 + energy-kj_unit: kJ + energy-kj_value: 2252 + energy_100g: 2252 + energy_serving: 338 + energy_unit: kJ + energy_value: 2252 + fat: 30.9 + fat_100g: 30.9 + fat_serving: 4.63 + fat_unit: g + fat_value: 30.9 + fruits-vegetables-nuts-estimate-from-ingredients_100g: 13 + fruits-vegetables-nuts-estimate-from-ingredients_serving: 13 + nova-group: 4 + nova-group_100g: 4 + nova-group_serving: 4 + nutrition-score-fr: 26 + nutrition-score-fr_100g: 26 + proteins: 6.3 + proteins_100g: 6.3 + proteins_serving: 0.945 + proteins_unit: g + proteins_value: 6.3 + salt: 0.107 + salt_100g: 0.107 + salt_serving: 0.016 + salt_unit: g + salt_value: 0.107 + saturated-fat: 10.6 + saturated-fat_100g: 10.6 + saturated-fat_serving: 1.59 + saturated-fat_unit: g + saturated-fat_value: 10.6 + sodium: 0.0428 + sodium_100g: 0.0428 + sodium_serving: 0.00642 + sodium_unit: g + sodium_value: 0.0428 + sugars: 56.3 + sugars_100g: 56.3 + sugars_serving: 8.44 + sugars_unit: g + sugars_value: 56.3 + nutriscore_data: + energy: 2252 + energy_points: 6 + energy_value: 2252 + fiber: 0 + fiber_points: 0 + fiber_value: 0 + fruits_vegetables_nuts_colza_walnut_olive_oils: 13 + fruits_vegetables_nuts_colza_walnut_olive_oils_points: 0 + fruits_vegetables_nuts_colza_walnut_olive_oils_value: 13 + grade: e + is_beverage: 0 + is_cheese: 0 + is_fat: 0 + is_water: 0 + negative_points: 26 + positive_points: 0 + proteins: 6.3 + proteins_points: 3 + proteins_value: 6.3 + saturated_fat: 10.6 + saturated_fat_points: 10 + saturated_fat_ratio: 34.3042071197411 + saturated_fat_ratio_points: 5 + saturated_fat_ratio_value: 34.3 + saturated_fat_value: 10.6 + score: 26 + sodium: 42.8 + sodium_points: 0 + sodium_value: 42.8 + sugars: 56.3 + sugars_points: 10 + sugars_value: 56.3 + nutriscore_grade: e + nutriscore_score: 26 + nutriscore_score_opposite: -26 + nutrition_data: 'on' + nutrition_data_per: 100g + nutrition_data_prepared: '' + nutrition_data_prepared_per: 100g + nutrition_grade_fr: e + nutrition_grades: e + nutrition_grades_tags: + - e + nutrition_score_beverage: 0 + nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients: 1 + nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients_value: 13 + nutrition_score_warning_no_fiber: 1 + obsolete: '' + obsolete_since_date: '' + origin: '' + origins: '' + origins_hierarchy: [] + origins_lc: fr + origins_tags: [] + other_nutritional_substances_tags: [] + owner: org-ferrero-france-commerciale + owners_tags: org-ferrero-france-commerciale + packaging: PP 5 Ummi PLASTIQUE / PLASTIEK PAP 27 WWW PAPIER / PAPIER CIPAP 82 PANNEAU DE FIBRE COMPOSITES/ COMPOSIET VEZELPLAAT GL 70 VERRE / GLAS + packaging_hierarchy: + - 'fr:PP 5 Ummi PLASTIQUE / PLASTIEK PAP 27 WWW PAPIER / PAPIER CIPAP 82 PANNEAU DE FIBRE COMPOSITES/ COMPOSIET VEZELPLAAT GL 70 VERRE / GLAS' + packaging_lc: fr + packaging_tags: + - 'fr:pp-5-ummi-plastique-plastiek-pap-27-www-papier-papier-cipap-82-panneau-de-fibre-composites-composiet-vezelplaat-gl-70-verre-glas' + packaging_text: '' + packaging_text_ar: '' + packaging_text_de: '' + packaging_text_en: '' + packaging_text_es: 'Pot en verre, couvercle en plastique.' + packaging_text_fr: "1 couvercle plastique blanc opaque PP à jeter,\r\n1 plaque en carton PAP 21 à recycler,\r\n1 opercule en carton C/PAP 82 à recycler,\r\n1 pot en verre à recycler" + packaging_text_id: '' + packaging_text_it: '' + packaging_text_nl: '' + packagings: + - material: 'en:clear-glass' + photographers_tags: + - user1 + - user2 + - user3 + - user4 + pnns_groups_1: Sugary snacks + pnns_groups_1_tags: + - sugary-snacks + - known + pnns_groups_2: Sweets + pnns_groups_2_tags: + - sweets + - known + popularity_key: 20999992556 + popularity_tags: + - top-10-scans-2021 + - top-50-scans-2021 + - top-100-scans-2021 + - top-500-scans-2021 + - top-1000-scans-2021 + - top-5000-scans-2021 + - top-10000-scans-2021 + - top-50000-scans-2021 + - top-100000-scans-2021 + - top-10-fr-scans-2021 + - top-50-fr-scans-2021 + - top-100-fr-scans-2021 + - top-500-fr-scans-2021 + - top-1000-fr-scans-2021 + - top-5000-fr-scans-2021 + - top-10000-fr-scans-2021 + - top-50000-fr-scans-2021 + - top-100000-fr-scans-2021 + - top-country-fr-scans-2021 + - at-least-5-fr-scans-2021 + - at-least-10-fr-scans-2021 + product_name: Nutella + product_name_ar: نوتيلا + product_name_de: Nutella + product_name_en: Nutella + product_name_es: Nutella + product_name_fr: Pâte à tartiner Nutella noisettes et cacao - 400g + product_name_id: '' + product_name_it: Nutella + product_name_nl: '' + product_quantity: '400' + purchase_places: F - 77480 Mousseaux les Bray France + purchase_places_tags: + - f-77480-mousseaux-les-bray-france + quantity: 400g + removed_countries_tags: [] + rev: 421 + scans_n: 3713 + scores: {} + selected_images: + front: + display: + en: 'https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.400.jpg' + fr: 'https://images.openfoodfacts.org/images/products/301/762/042/2003/front_fr.415.400.jpg' + small: + en: 'https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.200.jpg' + fr: 'https://images.openfoodfacts.org/images/products/301/762/042/2003/front_fr.415.200.jpg' + thumb: + en: 'https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.100.jpg' + fr: 'https://images.openfoodfacts.org/images/products/301/762/042/2003/front_fr.415.100.jpg' + ingredients: + display: + fr: 'https://images.openfoodfacts.org/images/products/301/762/042/2003/ingredients_fr.299.400.jpg' + small: + fr: 'https://images.openfoodfacts.org/images/products/301/762/042/2003/ingredients_fr.299.200.jpg' + thumb: + fr: 'https://images.openfoodfacts.org/images/products/301/762/042/2003/ingredients_fr.299.100.jpg' + nutrition: + display: + en: 'https://images.openfoodfacts.org/images/products/301/762/042/2003/nutrition_en.400.400.jpg' + small: + en: 'https://images.openfoodfacts.org/images/products/301/762/042/2003/nutrition_en.400.200.jpg' + thumb: + en: 'https://images.openfoodfacts.org/images/products/301/762/042/2003/nutrition_en.400.100.jpg' + packaging: + display: + fr: 'https://images.openfoodfacts.org/images/products/301/762/042/2003/packaging_fr.420.400.jpg' + small: + fr: 'https://images.openfoodfacts.org/images/products/301/762/042/2003/packaging_fr.420.200.jpg' + thumb: + fr: 'https://images.openfoodfacts.org/images/products/301/762/042/2003/packaging_fr.420.100.jpg' + serving_quantity: '15' + serving_size: 15g + sortkey: 1610877517 + sources: + - fields: + - product_name_de + - product_name_it + - brands + - countries + id: openfood-ch + images: [] + import_t: 1548767279 + manufacturer: '0' + name: FoodRepo + source_licence: Creative Commons Attribution 4.0 International License + source_licence_url: 'https://creativecommons.org/licenses/by/4.0/' + url: 'https://www.foodrepo.org/ch/products/19413' + - fields: + - packaging + - ingredients_text_fr + id: ferrero + images: [] + import_t: 1552318840 + manufacturer: '1' + name: Ferrero + url: 'https://www.ferrero.fr' + sources_fields: + org-gs1: + gln: '3010176200101' + gpcCategoryCode: '10000187' + gpcCategoryName: Pâtes à Tartiner Sucrées (Longue Conservation) + isAllergenRelevantDataProvided: 'true' + lastChangeDateTime: '2022-07-13T16:01:41+02:00' + partyName: FERRERO FRANCE COMMERCIALE + productionVariantDescription: '2014' + publicationDateTime: '2022-07-13T16:01:41+02:00' + states: 'en:to-be-completed, en:nutrition-facts-completed, en:ingredients-completed, en:expiration-date-completed, en:packaging-code-to-be-completed, en:characteristics-to-be-completed, en:origins-to-be-completed, en:categories-completed, en:brands-completed, en:packaging-completed, en:quantity-completed, en:product-name-completed, en:photos-to-be-validated, en:packaging-photo-to-be-selected, en:nutrition-photo-selected, en:ingredients-photo-to-be-selected, en:front-photo-selected, en:photos-uploaded' + states_hierarchy: + - 'en:to-be-completed' + - 'en:nutrition-facts-completed' + - 'en:ingredients-completed' + - 'en:expiration-date-completed' + - 'en:packaging-code-to-be-completed' + - 'en:characteristics-to-be-completed' + - 'en:origins-to-be-completed' + - 'en:categories-completed' + - 'en:brands-completed' + - 'en:packaging-completed' + - 'en:quantity-completed' + - 'en:product-name-completed' + - 'en:photos-to-be-validated' + - 'en:packaging-photo-to-be-selected' + - 'en:nutrition-photo-selected' + - 'en:ingredients-photo-to-be-selected' + - 'en:front-photo-selected' + - 'en:photos-uploaded' + states_tags: + - 'en:to-be-completed' + - 'en:nutrition-facts-completed' + - 'en:ingredients-completed' + - 'en:expiration-date-completed' + - 'en:packaging-code-to-be-completed' + - 'en:characteristics-to-be-completed' + - 'en:origins-to-be-completed' + - 'en:categories-completed' + - 'en:brands-completed' + - 'en:packaging-completed' + - 'en:quantity-completed' + - 'en:product-name-completed' + - 'en:photos-to-be-validated' + - 'en:packaging-photo-to-be-selected' + - 'en:nutrition-photo-selected' + - 'en:ingredients-photo-to-be-selected' + - 'en:front-photo-selected' + - 'en:photos-uploaded' + stores: 'Bi1 Magasins U Carrefour Franprix Auchan Casino Intermarché,carrefour.fr' + stores_tags: + - bi1-magasins-u-carrefour-franprix-auchan-casino-intermarche + - carrefour-fr + teams: 'pain-au-chocolat,shark-attack,stakano,chocolatine,la-robe-est-bleue,vegan,m,b,c,vegancheck' + teams_tags: + - pain-au-chocolat + - shark-attack + - stakano + - chocolatine + - la-robe-est-bleue + - vegan + - m + - b + - c + - vegancheck + traces: '' + traces_from_ingredients: '' + traces_from_user: '(fr) ' + traces_hierarchy: [] + traces_lc: fr + traces_tags: [] + unique_scans_n: 2544 + unknown_ingredients_n: 2 + unknown_nutrients_tags: [] + update_key: ing20220322 + vitamins_prev_tags: [] + vitamins_tags: [] + status: 1 + status_verbose: product found \ No newline at end of file diff --git a/Tools/ref/requestBodies/add_or_edit_a_product.yaml b/Tools/ref/requestBodies/add_or_edit_a_product.yaml new file mode 100644 index 0000000..5cf65f1 --- /dev/null +++ b/Tools/ref/requestBodies/add_or_edit_a_product.yaml @@ -0,0 +1,58 @@ +type: object +description: | + You can provide most of the properties defined in the product schema. +properties: + code: + type: string + description: The barcode of the product to be added or edited + example: '0074570036004' + user_id: + type: string + description: A valid username. + example: myusername + password: + type: string + description: A valid corresponding password. + example: mypassword + comment: + type: string + description: A comment for the change. It will be shown in product changes history. + example: new packaging from super-app + brands: + schema: + type: array + items: + type: string + style: form + explode: false + description: The brands of the product (comma separated list of values). + example: Häagen-Dazs,General-mills + labels: + schema: + type: array + items: + type: string + style: form + explode: false + description: The labels of the product (comma separated list of values). + example: Kosher,Ferroro + categories: + schema: + type: array + items: + type: string + style: form + explode: false + description: The categories of the product (comma separated list of values). + example: Desserts,Frozen foods + packaging: + type: string + description: | + Packaging type, format, material. + The [v3 API documentation](https://openfoodfacts.github.io/openfoodfacts-server/api/ref-v3/#operation/post-api-v3-product-barcode) + has a more structured data for `packaging`. + example: Frozen +required: + - code + - user_id + - password diff --git a/Tools/ref/requestBodies/add_photo_to_existing_product.yaml b/Tools/ref/requestBodies/add_photo_to_existing_product.yaml new file mode 100644 index 0000000..97780c1 --- /dev/null +++ b/Tools/ref/requestBodies/add_photo_to_existing_product.yaml @@ -0,0 +1,31 @@ +type: object +properties: + code: + type: string + description: | + Barcode of the product + example: '3017620422003' + imagefield: + type: string + description: | + Indicates the type of the image and the corresponding language. It should + be in the format `{IMAGE_TYPE}_{LANG}` format, where `IMAGE_TYPE` is one + of `front|ingredients|nutrition|packaging|other` and `LANG` is the 2 + letter language code. Use `other` if you don't want the image to be + selected. Note that the first image of a product is always selected as front + picture. + example: front_en + imgupload_front_en: + type: string + format: binary + description: | + This field must contain image binary content. + The format and extension must be one of gif|jpeg|jpg|png|heic. + This field is dynamic and dependent on the value of imagefield in the + request body. It wil be imgupload_the value of the imagefield stated + earlier. For example, if `imagefield=front_en`, the name of this field + should be `imageupload_front_en`. +required: + - code + - imagefield + - imgupload_front_en diff --git a/Tools/ref/requestBodies/change_ref_properties.yaml b/Tools/ref/requestBodies/change_ref_properties.yaml new file mode 100644 index 0000000..c98dbd9 --- /dev/null +++ b/Tools/ref/requestBodies/change_ref_properties.yaml @@ -0,0 +1,32 @@ +type: object +description: | + Properties that goes in change ref +properties: + comment: + type: string + description: | + A comment on the contribution. + Adding meaningful comments help moderators and users understand a single product history. + app_name: + type: string + description: | + Name of the app providing the information + app_version: + type: string + description: | + Version of the app providing the information + app_uuid: + type: string + description: | + When an app uses a single user to log its contributions, + it might be interesting to know which user of the app is providing the information. + You can use this field to provide an identifier (eg: an sha1 of the username) that's privacy preserving. Make sure that your salt is strong, perfectly random and secret + + In case we have trouble with one of your user, it helps our moderators revert edits. + User-Agent: + type: string + description: | + It is required that you pass a specific User-Agent header when you do an API request. + But some times it's not possible to modify such a header + (eg. request using JavaScript in a browser). + In such cases, you can override it with this parameter. diff --git a/Tools/ref/requestBodies/crop_a_photo.yaml b/Tools/ref/requestBodies/crop_a_photo.yaml new file mode 100644 index 0000000..2ab18bb --- /dev/null +++ b/Tools/ref/requestBodies/crop_a_photo.yaml @@ -0,0 +1,69 @@ +type: object +description: | + Select a photo and optionally crop/rotate it. + The origin of the cropping coordinates is the top-left corner. + Note that rotation is applied *before* cropping, so the cropping bounding box + is relative to the rotated image. +required: + - id + - code + - imgid +properties: + code: + type: string + description: Barcode of the product. + example: "04963406" + imgid: + type: integer + description: identifier of the image to select, it should be a number + example: 2 + id: + type: string + description: | + identifier of the selected image field, should be in the format + `{IMAGE_TYPE}_{LANG}` format, where `IMAGE_TYPE` is one of + `front|ingredients|nutrition|packaging|other` and `LANG` is the 2 letter + language code. + Note that if you select an image for the main language of the product (ex: + `ingredients_it` if `it` is the main language), this image will be + displayed on Product Opener for all languages (ex: on + `https://fr.openfoodfacts.org`, unless `ingredients_fr` exists). + example: front_en + x1: + type: integer + example: 0 + description: X origin coordinate of the crop, it must be lower than x2 + y1: + type: integer + example: 0 + description: Y origin coordinate of the crop, it must be lower than y2 + x2: + type: integer + example: 145 + description: X end coordinate of the crop, it must be higher than x1 + y2: + type: integer + example: 145 + description: Y end coordinate of the crop, it must be higher than y1 + angle: + type: integer + example: 0 + description: | + angle of the rotation to apply on the selected image. + passing `90` as value rotate the image 90 degrees counter-clockwise. + normalize: + type: string + example: "false" + description: whether the selected image should be normalized using ImageMagick + enum: + - "true" + - "false" + white_magic: + type: string + default: "false" + description: | + whether the source image should be white magiced (background removal) using + ImageMagick. + enum: + - "true" + - "false" \ No newline at end of file diff --git a/Tools/ref/requestBodies/fields_tags_lc.yaml b/Tools/ref/requestBodies/fields_tags_lc.yaml new file mode 100644 index 0000000..7bb7443 --- /dev/null +++ b/Tools/ref/requestBodies/fields_tags_lc.yaml @@ -0,0 +1,22 @@ +title: Fields requested and language for taxonomized tags fields +x-stoplight: + id: dt27yo5v076qu +type: object +description: '' +properties: + fields: + type: string + description: 'Comma separated list of fields requested in the response. Special values: "updated": returns field that were updated by the query (e.g. sending "packagings" or "packagings_add" would return "packagings"), "none": returns no fields, "all": returns all fields except generated fields that need to be explicitly requested such as "knowledge_panels". Defaults to "updated" for WRITE requests, and "all" for READ requests.' + tags_lc: + type: string + description: |- + 2 letter language code to request names of tags in a specific language. + + For READ requets: if passed, all taxonomized tags of the response will include a lc_name property with the translation in the requested language, if available. Otherwise, the property value will contain the name in the original language, prefixed by the 2 language code and a colon. + + For WRITE requests: if passed, taxonomized tags fields with a lc_name property will be considered to be in this language. +examples: + - fields: 'product_name,packagings' + tags_lc: fr + - fields: updated + tags_lc: fr diff --git a/Tools/ref/requestBodies/lc_cc.yaml b/Tools/ref/requestBodies/lc_cc.yaml new file mode 100644 index 0000000..4012eee --- /dev/null +++ b/Tools/ref/requestBodies/lc_cc.yaml @@ -0,0 +1,15 @@ +title: Language and country of the user +x-stoplight: + id: iemwzgz7wc8b9 +type: object +properties: + lc: + type: string + description: '2 letter code of the language of the interface. Used for localizing some fields in returned values (e.g. knowledge panels). If not passed, the language may be inferred by the country of the user (passed through the cc field or inferred by the IP address).' + cc: + type: string + description: '2 letter code of the country of the user. Used for localizing some fields in returned values (e.g. knowledge panels). If not passed, the country may be inferred by the IP address of the request.' +description: '' +examples: + - lc: fr + cc: fr diff --git a/Tools/ref/requestBodies/unselect_a_photo.yaml b/Tools/ref/requestBodies/unselect_a_photo.yaml new file mode 100644 index 0000000..f0200c2 --- /dev/null +++ b/Tools/ref/requestBodies/unselect_a_photo.yaml @@ -0,0 +1,10 @@ +type: object +properties: + code: + type: string + description: code of the product + example: '4251105501381' + id: + type: string + description: image field (image id) of the photo to unselect + example: front_fr diff --git a/Tools/ref/responses/add_or_edit_a_product.yaml b/Tools/ref/responses/add_or_edit_a_product.yaml new file mode 100644 index 0000000..501d6e6 --- /dev/null +++ b/Tools/ref/responses/add_or_edit_a_product.yaml @@ -0,0 +1,8 @@ +type: object +properties: + status_verbose: + type: string + example: fields saved + status: + type: integer + example: 1 \ No newline at end of file diff --git a/Tools/ref/responses/add_photo_to_existing_product.yaml b/Tools/ref/responses/add_photo_to_existing_product.yaml new file mode 100644 index 0000000..fe64c95 --- /dev/null +++ b/Tools/ref/responses/add_photo_to_existing_product.yaml @@ -0,0 +1,47 @@ +#TODO: Describe these response fields +type: object +properties: + files: + type: array + items: + type: object + properties: + url: + type: string + example: /product/3017620422003/nutella-ferrero + filename: + type: string + example: '' + name: + type: string + example: Nutella - Ferrero - 400g + thumbnailUrl: + type: string + example: /images/products/301/762/042/2003/123.100.jpg + code: + type: string + example: '3017620422003' + image: + type: object + properties: + thumb_url: + type: string + example: 123.100.jpg + imgid: + type: integer + example: 123 + crop_url: + type: string + example: 123.400.jpg + imgid: + type: integer + example: 123 + status: + type: string + example: status ok + imagefield: + type: string + example: front_en + code: + type: string + example: '3017620422003' diff --git a/Tools/ref/responses/change_ref_properties.yaml b/Tools/ref/responses/change_ref_properties.yaml new file mode 100644 index 0000000..501d6e6 --- /dev/null +++ b/Tools/ref/responses/change_ref_properties.yaml @@ -0,0 +1,8 @@ +type: object +properties: + status_verbose: + type: string + example: fields saved + status: + type: integer + example: 1 \ No newline at end of file diff --git a/Tools/ref/responses/get_attribute_groups.yaml b/Tools/ref/responses/get_attribute_groups.yaml new file mode 100644 index 0000000..91f13f7 --- /dev/null +++ b/Tools/ref/responses/get_attribute_groups.yaml @@ -0,0 +1,45 @@ +type: array +description: | + List of groups of attributes for personal search in a specific language. +items: + type: object + properties: + id: + type: string + description: unique id of the group + name: + type: string + description: Name of the group + attributes: + type: array + description: | + Attributes that are part of this group + items: + type: object + properties: + id: + type: string + description: unique id of the attribute + name: + type: string + description: Name of the attribute + icon_url: + type: string + description: url of icon to display next to the settings for this attribute + setting_name: + type: string + description: a description of the attribute to display to users + setting_note: + type: string + description: a complementary note on the attribute + default: + type: string + enum: + - "mandatory" + - "very_important" + - "important" + - "not_important" + description: Indicates the default setting for this attribute + panel_id: + type: string + description: Linked knowledge panel (optional) \ No newline at end of file diff --git a/Tools/ref/responses/get_nutrients.yaml b/Tools/ref/responses/get_nutrients.yaml new file mode 100644 index 0000000..4b1df7e --- /dev/null +++ b/Tools/ref/responses/get_nutrients.yaml @@ -0,0 +1 @@ +$ref: ../schemas/nutrients.yaml \ No newline at end of file diff --git a/Tools/ref/responses/get_preferences.yaml b/Tools/ref/responses/get_preferences.yaml new file mode 100644 index 0000000..21a8527 --- /dev/null +++ b/Tools/ref/responses/get_preferences.yaml @@ -0,0 +1,27 @@ +type: array +description: | + Rules to apply to compute personal ranking of a product, + based upon the setting value of each attribute. +items: + type: object + properties: + id: + type: string + description: id for the setting value + enum: + - "not_important" + - "important" + - "very_important" + - "mandatory" + name: + type: string + description: name for the setting value, translated according to `lc` parameter + factor: + type: integer + description: | + factor to apply to the property of the product corresponding to attributes + having this setting value + minimum_match: + type: integer + description: | + FIXME diff --git a/Tools/ref/responses/get_product_by_barcode.yaml b/Tools/ref/responses/get_product_by_barcode.yaml new file mode 100644 index 0000000..38fb28b --- /dev/null +++ b/Tools/ref/responses/get_product_by_barcode.yaml @@ -0,0 +1,11 @@ +x-stoplight: + id: cfk5obotr63sa +type: object +allOf: + - $ref: ./get_product_by_barcode_base.yaml + - type: object + properties: + product: + type: object + allOf: + - $ref: ../schemas/product.yaml \ No newline at end of file diff --git a/Tools/ref/responses/get_product_by_barcode_base.yaml b/Tools/ref/responses/get_product_by_barcode_base.yaml new file mode 100644 index 0000000..088c16c --- /dev/null +++ b/Tools/ref/responses/get_product_by_barcode_base.yaml @@ -0,0 +1,15 @@ +type: object +x-stoplight: + id: s4gz59htj4gc3 +properties: + code: + type: string + description: | + Barcode of the product + (can be EAN-13 or internal codes for some food stores). + For products without a barcode, Open Food Facts assigns a + number starting with the 200 reserved prefix. + status: + type: integer + status_verbose: + type: string diff --git a/Tools/ref/responses/ocr_on_product.yaml b/Tools/ref/responses/ocr_on_product.yaml new file mode 100644 index 0000000..c7899e7 --- /dev/null +++ b/Tools/ref/responses/ocr_on_product.yaml @@ -0,0 +1,5 @@ +type: object +properties: + status: + type: integer + example: 1 diff --git a/Tools/ref/responses/response-status/response_status.yaml b/Tools/ref/responses/response-status/response_status.yaml new file mode 100644 index 0000000..136dab1 --- /dev/null +++ b/Tools/ref/responses/response-status/response_status.yaml @@ -0,0 +1,61 @@ +title: Response status +x-stoplight: + id: 54bh0c5mejahn +type: object +description: 'A response object to describe if a READ or WRITE request was successful or not, and if there were errors or warnings, and what the impact of those errors or warnings was.' +examples: + - status_id: success_with_errors + result: + id: product_updated + name: Product updated + lc_name: Produit mis à jour + errors: + - message: + id: sugars_higher_than_carbohydrates + name: Sugars higher than carbohydrates + lc_name: Sucres plus élevés que les glucides + description: Sugars (40g) are higher than carbohydrates (35g). + lc_description: Les sucres (40g) sont plus élévés que les glucdes. + field: + id: nutriment.sugars + value: '40' + impact: + id: nutrients_not_updated + name: Nutrients not updated + lc_name: Nutriments non mis à jour + description: The nutrients were not updated. + lc_description: Les nutriments n'ont pas été mis à jour. +properties: + status_id: + type: string + enum: + - success + - success_with_warnings + - success_with_errors + - failure + description: 'Overall status of the request: whether it failed or succeeded, with or without warnings or errors.' + result: + type: object + description: |- + Overall result + of the request (e.g. a product has been created) + properties: + id: + type: string + description: Identifier of a response result entry + name: + type: string + description: Name of the response result entry in English. + lc_name: + type: string + description: 'Name of the response result entry in the language specified in tags_lc, if supplied.' + warnings: + type: array + description: 'List of warnings. Warnings are used to alert about something that may be wrong, but is not necessarily wrong (e.g. a nutrient value that is unexpectedly high).' + items: + $ref: ./warning-or-error.yaml + errors: + type: array + description: List of errors. Errors are used to alert about something that is definitely wrong (e.g. a nutrient value thaty is impossibly high). + items: + $ref: ./warning-or-error.yaml diff --git a/Tools/ref/responses/response-status/warning-or-error.yaml b/Tools/ref/responses/response-status/warning-or-error.yaml new file mode 100644 index 0000000..8b9bf73 --- /dev/null +++ b/Tools/ref/responses/response-status/warning-or-error.yaml @@ -0,0 +1,64 @@ +title: Warning or error message +x-stoplight: + id: eakkz8p7qfoj0 +type: object +description: 'Describes a warning or error for a READ or WRITE request, which field triggered it, and what the impact was (e.g. the field was ignored).' +examples: + - message: + id: sugars_higher_than_carbohydrates + name: Sugars higher than carbohydrates + lc_name: Sucres plus élevés que les glucides + description: Sugars (40g) are higher than carbohydrates (35g). + lc_description: Les sucres (40g) sont plus élévés que les glucdes. + field: + id: nutriment.sugars + value: '40' + impact: + id: nutrients_not_updated + name: Nutrients not updated + lc_name: Nutriments non mis à jour + description: The nutrients were not updated. + lc_description: Les nutriments n'ont pas été mis à jour. +properties: + message: + type: object + properties: + id: + type: string + description: | + Identifier of a response message. + name: + type: string + description: Name of the response message entry in English. + lc_name: + type: string + description: 'Name of the response message entry in the language specified in tags_lc, if supplied.' + description: + type: string + description: 'Description of the problem specific to the request, in English.' + lc_description: + type: string + description: 'Description of the problem specific to the request, in the language specified in tags_lc, if supplied.' + field: + type: object + description: Field that triggered the warning or error. + properties: + id: + type: string + description: Name of the field that triggered the warning or error. + value: + type: string + description: Value of the field that triggered the warning or error. + impact: + type: object + properties: + id: + type: string + name: + type: string + lc_name: + type: string + description: + type: string + lc_description: + type: string diff --git a/Tools/ref/responses/rotate_a_photo.yaml b/Tools/ref/responses/rotate_a_photo.yaml new file mode 100644 index 0000000..c1a8284 --- /dev/null +++ b/Tools/ref/responses/rotate_a_photo.yaml @@ -0,0 +1,17 @@ +#TODO: Describe the response fields +#TODO: Api review to sort this response in a particular order. It is not fixed. +type: object +properties: + status: + type: string + example: status ok + imagefield: + type: string + example: nutrition_fr + image: + type: object + properties: + display_url: + type: string + example: nutrition_fr.67.400.jpg + diff --git a/Tools/ref/responses/search_for_products.yaml b/Tools/ref/responses/search_for_products.yaml new file mode 100644 index 0000000..40c9b3c --- /dev/null +++ b/Tools/ref/responses/search_for_products.yaml @@ -0,0 +1,38 @@ +type: object +properties: + count: + type: integer + description: | + Total number of products found + example: 2701 + page: + type: integer + description: | + Page number of returned results. + + You can get a different page, by using the `page` query parameter. + example: 1 + page_count: + type: integer + description: | + Number of products in this page. + + This will differ from page_size only on the last page. + example: 24 + page_size: + type: integer + description: | + Requested number of products per pages + + To get the number of pages, divide count by page_size + (eg. `Math.floor( count / page_size) + 1 `) + example: 24 + products: + type: array + description: | + The products matching the query corresponding to current page + items: + $ref: ../schemas/product.yaml + skip: + type: integer + example: 0 diff --git a/Tools/ref/schemas/agribalyse.yaml b/Tools/ref/schemas/agribalyse.yaml new file mode 100644 index 0000000..c8c990a --- /dev/null +++ b/Tools/ref/schemas/agribalyse.yaml @@ -0,0 +1,47 @@ +type: object +properties: + agribalyse_food_code: + type: string + co2_agriculture: + type: number + co2_consumption: + type: integer + co2_distribution: + type: number + co2_packaging: + type: number + co2_processing: + type: number + co2_total: + type: number + co2_transportation: + type: number + code: + type: string + dqr: + type: string + ef_agriculture: + type: number + ef_consumption: + type: integer + ef_distribution: + type: number + ef_packaging: + type: number + ef_processing: + type: number + ef_total: + type: number + ef_transportation: + type: number + is_beverage: + type: integer + name_en: + type: string + description: | + This can be returned in many other languages + like name_fr (for french). + score: + type: integer + version: + type: string diff --git a/Tools/ref/schemas/image.yaml b/Tools/ref/schemas/image.yaml new file mode 100644 index 0000000..ecf222b --- /dev/null +++ b/Tools/ref/schemas/image.yaml @@ -0,0 +1,36 @@ +type: object +description: | + This object represent an image that was uploaded to a product. + "imgid" is an integer which is a sequential number unique to each picture. +properties: + sizes: + type: object + description: | + The available image sizes for the product (both reduced and full). + The reduced images are the ones with numbers as the key( 100, 200 etc) + while the full images have `full` as the key. + properties: + full: + description: | + properties of fullsize image + **TODO** explain how to compute name + $ref: ./image_size.yaml + patternProperties: + '(?100|400)': + description: | + properties of thumbnail of size `image_size`. + **TODO** explain how to compute name + + For real type: see description of property `full`. + (Put this way because of a [bug in rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) + type: string + uploaded_t: + type: string + example: '1457680652' + description: | + The time the image was uploaded (as unix timestamp). + uploader: + type: string + example: openfoodfacts-contributors + description: | + The contributor that uploaded the image. diff --git a/Tools/ref/schemas/image_role.yaml b/Tools/ref/schemas/image_role.yaml new file mode 100644 index 0000000..b217778 --- /dev/null +++ b/Tools/ref/schemas/image_role.yaml @@ -0,0 +1,57 @@ +type: object +description: | + property of an image (or part thereof) selected for a particular role and a particular language. +properties: + angle: + type: integer + example: 0 + description: The angle of the image rotation (if it was rotated). + coordinates_image_size: + type: string + example: full + geometry: + type: string + example: "0x0--1--1" + imgid: + type: string + example: '121' + description: 'The id of the original/source image that was selected to edit(rotate, normalize etc) to produce this new image.' + normalize: + type: 'null' + example: null + description: Normalize colors. + rev: + type: string + example: '420' + sizes: + type: object + description: | + The available image sizes for the product (both reduced and full). + The reduced images are the ones with numbers as the key( 100, 200 etc) + while the full images have `full` as the key. + properties: + '100': + $ref: ./image_size.yaml + '200': + $ref: ./image_size.yaml + '400': + $ref: ./image_size.yaml + full: + $ref: ./image_size.yaml + white_magic: + type: 'null' + example: null + description: | + Photo on white background : Try to remove the background. + x1: + type: string + example: '-1' + x2: + type: string + example: '-1' + y1: + type: string + example: '-1' + y2: + type: string + example: '-1' diff --git a/Tools/ref/schemas/image_size.yaml b/Tools/ref/schemas/image_size.yaml new file mode 100644 index 0000000..58076d8 --- /dev/null +++ b/Tools/ref/schemas/image_size.yaml @@ -0,0 +1,12 @@ +type: object +properties: + h: + type: integer + example: 400 + description: | + The height of the reduced/full image in pixels. + w: + type: integer + example: 255 + description: | + The width of the reduced/full image in pixels. \ No newline at end of file diff --git a/Tools/ref/schemas/image_urls.yaml b/Tools/ref/schemas/image_urls.yaml new file mode 100644 index 0000000..10d56a6 --- /dev/null +++ b/Tools/ref/schemas/image_urls.yaml @@ -0,0 +1,5 @@ +type: object +patternProperties: + '(?\w\w)': + type: string + description: url of the image for language `language_code` \ No newline at end of file diff --git a/Tools/ref/schemas/ingredient.yaml b/Tools/ref/schemas/ingredient.yaml new file mode 100644 index 0000000..8e80443 --- /dev/null +++ b/Tools/ref/schemas/ingredient.yaml @@ -0,0 +1,30 @@ +type: array +description: | + This structure gives the different ingredients and some information about them, + like estimate on their quantity. +items: + type: object + properties: + id: + type: string + ingredients: + description: | + Sub ingredients composing this ingredients. + # self recursive + $ref: "#" + percent: + type: integer + percent_estimate: + type: + - number + percent_max: + type: + - number + percent_min: + type: integer + text: + type: string + vegan: + type: string + vegetarian: + type: string diff --git a/Tools/ref/schemas/knowledge_panels/elements/element.yaml b/Tools/ref/schemas/knowledge_panels/elements/element.yaml new file mode 100644 index 0000000..131312b --- /dev/null +++ b/Tools/ref/schemas/knowledge_panels/elements/element.yaml @@ -0,0 +1,39 @@ +title: element +x-stoplight: + id: e2ybdrtmx0tme +type: object +description: | + Each element object contains one specific element object such as a text element or an image element. +properties: + type: + element_type: string + enum: + - text + - image + - action + - panel + - panel_group + - table + description: | + The type of the included element object. + The type also indicates which field contains the included element object. + e.g. if the type is "text", the included element object will be in the "text_element" field. + + Note that in the future, new type of element may be added, + so your code should ignore unrecognized types, and unknown properties. + + TODO: add Map type + text_element: + $ref: ./text_element.yaml + image_element: + $ref: ./image_element.yaml + action_element: + type: string + panel_element: + $ref: ./panel_element.yaml + panel_group_element: + $ref: ./panel_group_element.yaml + table_element: + $ref: ./table_element.yaml +required: + - type diff --git a/Tools/ref/schemas/knowledge_panels/elements/image_element.yaml b/Tools/ref/schemas/knowledge_panels/elements/image_element.yaml new file mode 100644 index 0000000..39b6410 --- /dev/null +++ b/Tools/ref/schemas/knowledge_panels/elements/image_element.yaml @@ -0,0 +1,26 @@ +title: image_element +x-stoplight: + id: k4v4kwt489q3j +type: object +properties: + url: + type: string + description: full URL of the image + width: + type: integer + description: | + Width of the image. + + This is just a suggestion coming from the server, + the client may choose to use its own dimensions for the image. + height: + type: integer + description: | + Height of the image. + + This is just a suggestion coming from the server, + the client may choose to use its own dimensions for the image. + alt_text: + type: string + description: Alt Text of the image. + diff --git a/Tools/ref/schemas/knowledge_panels/elements/panel_element.yaml b/Tools/ref/schemas/knowledge_panels/elements/panel_element.yaml new file mode 100644 index 0000000..6490202 --- /dev/null +++ b/Tools/ref/schemas/knowledge_panels/elements/panel_element.yaml @@ -0,0 +1,9 @@ +title: panel_element +x-stoplight: + id: ymx41elz4yrnj +type: object +description: Panels can include other panels as sub-panels using the panel_element. +properties: + panel_id: + type: string + description: The id of the panel to include. The id is the key of the panel in the panels object returned in the knowledge_panels field. diff --git a/Tools/ref/schemas/knowledge_panels/elements/panel_group_element.yaml b/Tools/ref/schemas/knowledge_panels/elements/panel_group_element.yaml new file mode 100644 index 0000000..9792c95 --- /dev/null +++ b/Tools/ref/schemas/knowledge_panels/elements/panel_group_element.yaml @@ -0,0 +1,13 @@ +title: panel_group_element +x-stoplight: + id: b7emlfrgiuue2 +type: object +properties: + title: + type: string + panel_ids: + type: array + description: The ids of the panels to include. The ids are the keys of the panels in the panels object returned in the knowledge_panels field. + items: + type: string +description: The panel group element is used to display an optional title followed by a number of sub-panels. diff --git a/Tools/ref/schemas/knowledge_panels/elements/table_element.yaml b/Tools/ref/schemas/knowledge_panels/elements/table_element.yaml new file mode 100644 index 0000000..c408d4e --- /dev/null +++ b/Tools/ref/schemas/knowledge_panels/elements/table_element.yaml @@ -0,0 +1,32 @@ +title: table_element +x-stoplight: + id: 38zu3z4sruqo7 +type: object +description: Element to display a table. +properties: + id: + type: string + description: An id for the table. + title: + type: string + description: | + Title of the column. + rows: + type: string + columns: + type: array + items: + type: object + properties: + type: + type: string + text: + type: string + text_for_small_screens: + type: string + style: + type: string + column_group_id: + type: string + shown_by_default: + type: boolean diff --git a/Tools/ref/schemas/knowledge_panels/elements/text_element.yaml b/Tools/ref/schemas/knowledge_panels/elements/text_element.yaml new file mode 100644 index 0000000..2309268 --- /dev/null +++ b/Tools/ref/schemas/knowledge_panels/elements/text_element.yaml @@ -0,0 +1,51 @@ +title: text_element +x-stoplight: + id: vdwxlt73qnqfa +type: object +description: |- + A text in simple HTML format to display. + + For some specific texts that correspond to a product field (e.g. a product name, the ingredients list of a product),the edit_field_* fields are used to indicate how to edit the field value. +properties: + type: + type: string + description: | + the type of text, might influence the way you display it. + enum: + - summary + - warning + - notes + html: + type: string + description: Text to display in HTML format. + language: + type: string + description: 'Language of the text. The name of the language is returned in the language requested when making the API call. e.g. if the text is in Polish, and the requested language is French, the language field will contain "Polonais" (French for "Polish"). Only set for specific fields such as the list of ingredients of a product.' + lc: + type: string + description: 2 letter language code for the text. Only set for specific fields such as the list of ingredients of a product. + edit_field_id: + type: string + description: id of the field used to edit this text in the product edit API. + edit_field_type: + type: string + description: Type of the product field. + edit_field_value: + type: string + description: Current value of the product field. This may differ from the html field which can contain extra formating. + source_url: + type: string + description: Link to the source + example: https://en.wikipedia.org/wiki/Sodium acetate + source_text: + type: string + description: name of the source + example: Wikipedia + source_lc: + type: string + description: Source locale name + example: en + source_language: + type: string + description: Human readable source locale name + example: English diff --git a/Tools/ref/schemas/knowledge_panels/elements/title_element.yaml b/Tools/ref/schemas/knowledge_panels/elements/title_element.yaml new file mode 100644 index 0000000..86f4fa1 --- /dev/null +++ b/Tools/ref/schemas/knowledge_panels/elements/title_element.yaml @@ -0,0 +1,38 @@ +title: title_element +x-stoplight: + id: lox0wvl9bdgy2 +type: object +description: The title of a panel. +properties: + name: + type: string + description: A short name of this panel, not including any actual values + title: + type: string + type: + type: string + enum: + - grade + - percentage + description: 'Used to indicate how the value of this item is measured, such as "grade" for Nutri-Score and Eco-Score or "percentage" for Salt' + grade: + type: string + description: The value for this panel where it corresponds to a A to E grade such as the Nutri-Score of the Eco-Score. + enum: + - a + - b + - c + - d + - e + - unknown + value: + type: number + description: 'The numeric value of the panel, where the type is "percentage"' + icon_url: + type: string + icon_color_from_evaluation: + type: string + icon_size: + type: string + description: | + If set to "small", the icon should be displayed at a small size. diff --git a/Tools/ref/schemas/knowledge_panels/panel.yaml b/Tools/ref/schemas/knowledge_panels/panel.yaml new file mode 100644 index 0000000..5c3e470 --- /dev/null +++ b/Tools/ref/schemas/knowledge_panels/panel.yaml @@ -0,0 +1,50 @@ +title: panel +x-stoplight: + id: mj9nhz3mqn05c +type: object +description: Each panel contains an optional title and an optional array of elements. +properties: + type: + type: string + description: 'Type of the panel. If set to "card", the panel and its sub-panels should be displayed in a card. If set to "inline", the panel should have its content always displayed.' + expanded: + type: boolean + description: 'If true, the panel is to be displayed already expanded. If false, only the title should be displayed, and the user should be able to click or tap it to open the panel and display the elements.' + expand_for: + type: string + description: 'If set to "large", the content of the panel should be expanded on large screens, but it should still be possible to unexpand it.' + evaluation: + type: string + description: A simple assessment of the panel value, typically used to format fonts, et.c e.g. bad = red + enum: + - good + - average + - neutral + - bad + - unknown + title_element: + $ref: ./elements/title_element.yaml + elements: + type: array + description: An ordered list of elements to display in the content of the panel. + items: + $ref: ./elements/element.yaml + level: + type: string + description: | + a message level, as levels we use in log. + It might help theming the panel visualy + example: info + size: + type: string + enum: + - small + description: | + size is either empty (normal display) + or small to indicate a panel that should have a smaller font size + example: small + topics: + type: array + items: + type: string + example: health diff --git a/Tools/ref/schemas/knowledge_panels/panels.yaml b/Tools/ref/schemas/knowledge_panels/panels.yaml new file mode 100644 index 0000000..b6e982f --- /dev/null +++ b/Tools/ref/schemas/knowledge_panels/panels.yaml @@ -0,0 +1,15 @@ +type: object +x-stoplight: + id: bcq3fkbtnwr5t +title: panels +description: |- + The panels object is a dictionary of individual panel objects. + Each key of the dictionary is the id of the panel, and the value is the panel object. + + Apps typically display a number of root panels with known panel ids (e.g. health_card and environment_card). Panels can reference other panels and display them as sub-panels. +examples: + - additionalProperties: string +properties: + additionalProperties: + $ref: ./panel.yaml +readOnly: true diff --git a/Tools/ref/schemas/nutrient_unit.yaml b/Tools/ref/schemas/nutrient_unit.yaml new file mode 100644 index 0000000..76458a7 --- /dev/null +++ b/Tools/ref/schemas/nutrient_unit.yaml @@ -0,0 +1,21 @@ +description: | + The unit in which the nutrient for 100g or per serving is measured. + + The possible values depends on the nutrient. + + * `g` for grams + * `mg` for milligrams + * `μg` for micrograms + * `cl` for centiliters + * `ml` for mililiters + * `dv` for recommended daily intakes (aka [Dietary Reference Intake](https://en.wikipedia.org/wiki/Dietary_Reference_Intake)) + * `% vol` for percentage per volume (e.g. alcohol vol per 100 ml) + * `%` for percentage + + 🤓 code: see the [Units module][units-module], + and [Food:default_unit_for_nid function][default-unit] + + [units-module]: https://openfoodfacts.github.io/openfoodfacts-server/dev/ref-perl-pod/ProductOpener/Units.html + [default-unit]: https://openfoodfacts.github.io/openfoodfacts-server/dev/ref-perl-pod/ProductOpener/Food.html#default_unit_for_nid_(_%24nid) +type: string +enum: ['g','mg','μg','cl','ml','dv','% vol','%'] diff --git a/Tools/ref/schemas/nutrients.yaml b/Tools/ref/schemas/nutrients.yaml new file mode 100644 index 0000000..7f2a14a --- /dev/null +++ b/Tools/ref/schemas/nutrients.yaml @@ -0,0 +1,26 @@ +type: array +description: | + Nutrients and sub-nutrients of a product, with their name and default unit. +items: + type: object + properties: + id: + type: string + description: id of the nutrient + name: + type: string + description: Name of the nutrient in the requested language + important: + type: boolean + description: Indicates if the nutrient is always shown on the nutrition facts table + display_in_edit_form: + type: boolean + description: Indicates if the nutrient should be shown in the nutrition facts edit form + unit: + description: Default unit of the nutrient + $ref: "./nutrient_unit.yaml" + nutrients: + description: | + Sub-nutrients (e.g. saturated-fat is a sub-nutrient of fat). + # self recursive + $ref: "#/" \ No newline at end of file diff --git a/Tools/ref/schemas/nutrition_search.yaml b/Tools/ref/schemas/nutrition_search.yaml new file mode 100644 index 0000000..cf5db20 --- /dev/null +++ b/Tools/ref/schemas/nutrition_search.yaml @@ -0,0 +1,67 @@ +type: object +description: Parameters of type nutrients (for search) +properties: + nutrient_lower_than: + in: query + name: '_lt_' + description: | + Search on nutrient lower than a value + schema: + type: object + patternProperties: + '(?\w+)(?_prepared)?(?100g|serving)<(?\d+)': + type: string + description: | + Will search for products with nutrients lower than `value` + per `portion` (100g or serving). + + If `prepared` is "prepared" search in prepared product instead of "as sold". + + Important: the parameter value is discarded and should be empty + examples: + - salt_100g_lt_2: + summary: salt per 100g is lower than 2g (in product as sold) + value: + "salt_100g<2": 1 + nutrient_greater_than: + in: query + name: '_gt_' + description: | + Search on nutrient greater than a value + schema: + type: object + patternProperties: + '(?\w+)(?_prepared)?(?100g|serving)>(?\d+)': + type: string + description: | + Will search for products with nutrients more than `value` + per `portion` (100g or serving). + + If `prepared` is "prepared" search in prepared product instead of "as sold". + + Important: the parameter value is discarded and should be empty + examples: + - carbohydrates_prepared_serving_gt_10: + summary: carbohydrates per serving is greater than 10g in prepared product + value: + "salt_100g>10": 1 + nutrient_equal: + in: query + name: '_eq_' + description: | + Search on nutrient for an exact quantity + schema: + type: object + patternProperties: + '(?\w+)(?_prepared)?(?100g|serving)': + type: string + description: | + Will search for products with nutrients exactl the parameter value + per `portion` (100g or serving). + + If `prepared` is "prepared" search in prepared product instead of "as sold". + examples: + - fat_100g_eq_5: + summary: fat per 100g is exactly equal to 5g (in product as sold) + value: + "fat_100g": 5 diff --git a/Tools/ref/schemas/packagings/input_taxonomy_tag.yaml b/Tools/ref/schemas/packagings/input_taxonomy_tag.yaml new file mode 100644 index 0000000..9433222 --- /dev/null +++ b/Tools/ref/schemas/packagings/input_taxonomy_tag.yaml @@ -0,0 +1,14 @@ +title: Input taxonomy tag +x-stoplight: + id: 7gx5uzyifakgo +type: string +description: |- + A tag entry, that will be matched against a taxonomy (e.g. a category, a label) + + The entry is a string that can contain either: + + - a taxonomy entry id, in the form [2 letter language code]:[normalized canonical name] (e.g. "en:green-teas") + - a string in a specific language, prefixed by the 2 letter language code (e.g. "fr:Thés verts") + - a string in the default language of the field (e.g. French for categories_tags_fr) or in the language indicated by the tags_lc request field (e.g. Thés verts) + + All entries will be matched to the corresponding taxonomy. It is possible to specify values that do not exist yet in the taxonomy. They may later be added as new taxonomy entries, or as new translations or synonyms of an existing entry. diff --git a/Tools/ref/schemas/packagings/material-write.yaml b/Tools/ref/schemas/packagings/material-write.yaml new file mode 100644 index 0000000..8125eba --- /dev/null +++ b/Tools/ref/schemas/packagings/material-write.yaml @@ -0,0 +1,17 @@ +title: Packaging component material (WRITE) +x-stoplight: + id: vgm9p553p4vd9 +description: The material property is canonicalized using the packaging_materials taxonomy. +examples: + - id: string + - lc_name: bouteille +anyOf: + - properties: + id: + type: string + description: 'Canonical id of the entry in the taxonomy. If the value cannot be mapped to a taxonomy entry, the value must be the name of the entry in its original language prefixed by the language 2 letter code and a colon.' + - properties: + lc_name: + type: string + description: 'Name of the entry in the language specified in the tags_lc field of the request. If the translation is not available, the value must be the name of the entry in its original language prefixed by the language 2 letter code and a colon.' +type: object diff --git a/Tools/ref/schemas/packagings/material.yaml b/Tools/ref/schemas/packagings/material.yaml new file mode 100644 index 0000000..40adfa7 --- /dev/null +++ b/Tools/ref/schemas/packagings/material.yaml @@ -0,0 +1,15 @@ +title: Packaging component material +x-stoplight: + id: n6umazgqmwrd5 +type: object +description: The material property is canonicalized using the packaging_materials taxonomy. +examples: + - id: 'en:bottle' + lc_name: bouteille +properties: + id: + type: string + description: 'Canonical id of the entry in the taxonomy. If the value cannot be mapped to a taxonomy entry, the value will be the name of the entry in its original language prefixed by the language 2 letter code and a colon.' + lc_name: + type: string + description: 'Name of the entry in the language requested in the tags_lc field of the request. This field is returned only of tags_lc is specified. If the translation is not available, or if the entry does not exist in the taxonomy, the value will be the name of the entry in its original language prefixed by the language 2 letter code and a colon.' diff --git a/Tools/ref/schemas/packagings/packaging_component-write.yaml b/Tools/ref/schemas/packagings/packaging_component-write.yaml new file mode 100644 index 0000000..86196b5 --- /dev/null +++ b/Tools/ref/schemas/packagings/packaging_component-write.yaml @@ -0,0 +1,53 @@ +title: Packaging component (WRITE) +x-stoplight: + id: iacgfu9zaek8v +type: object +description: |- + Each packaging component has different properties to specify how many there are, its shape, material etc. + + The shape, material and recycling properties will be mapped to one entry in the packaging_shapes, packaging_materials and packaging_recycling taxonomies. + + For input, clients can either pass the id of a corresponding taxonomy entry (e.g. "en:pizza-box"), or a free text value prefixed with the language code of the text (e.g. "en:Pizza box", "fr:boite à pizza"). If the language code prefix is missing, the value of the "lc" field of the query will be used. + + The resulting structure will contain the id of the canonical entry in the taxonomy if it good be matched, or the free text value prefixed with the language code otherwise. + + For weights, the API is expecting a number with the number of grams. If a string is passed instead of a number, we will attempt to convert it to grams. The string may contain units (e.g. "6.9 g"), and use . or , as the decimal separator. Conversion may not work for all inputs. If a string was converted to a number, the API response will include a warning and specify the converted value. +examples: + - number_of_units: 6 + shape: + id: 'en:bottle' + material: + id: 'en:plastic' + recycling: + id: 'en:recycle' + quantity_per_unit: 25 cl + weight_measured: 10 +properties: + number_of_units: + type: integer + description: Number of units of this packaging component contained in the product (e.g. 6 for a pack of 6 bottles) + shape: + $ref: ./shape-write.yaml + material: + $ref: ./material-write.yaml + recycling: + $ref: ./recycling-write.yaml + quantity_per_unit: + type: string + description: Quantity (weight or volume) of food product contained in the packaging component. (e.g. 75cl for a wine bottle) + weight_specified: + type: + - number + - string + description: 'Weight (as specified by the manufacturer) of one unit of the empty packaging component (in grams). (e.g. for a 6 pack of 1.5l water bottles, it might be 30, the weight in grams of 1 empty water bottle without its cap which is a different packaging component). If passed a string - possibly with an unit - it will be converted to a number.' + weight_measured: + type: + - number + - string + description: 'Weight (as measured by one or more users) of one unit of the empty packaging component (in grams). (e.g. for a 6 pack of 1.5l water bottles, it might be 30, the weight in grams of 1 empty water bottle without its cap which is a different packaging component). If passed a string - possibly with an unit - it will be converted to a number.' + brands: + type: string + description: 'A comma separated list of brands / product names for the packaging component (e.g. "Tetra Pak", Tetra Brik"' + labels: + type: string + description: 'A comma separated list of labels, canonicalized with the packaging_labels taxonomy (e.g. "en:FSC, fr:Encre végétale")' diff --git a/Tools/ref/schemas/packagings/packaging_component.yaml b/Tools/ref/schemas/packagings/packaging_component.yaml new file mode 100644 index 0000000..b1ada7e --- /dev/null +++ b/Tools/ref/schemas/packagings/packaging_component.yaml @@ -0,0 +1,61 @@ +description: |- + Each packaging component has different properties to specify how many there are, its shape, material etc. + + The shape, material and recycling properties are mapped to one entry in the packaging_shapes, packaging_materials and packaging_recycling taxonomies, and the value of the property is the canonical name of the taxonomy entry (e.g. en:bottle). + + They may contain values that could not yet get matched to their respective taxonomy, in which case they will contain a free text value prefixed with the language code of this text value (e.g. "fr:Bouteille sphérique" might have been entered by a French user to indicate it is a spherical bottle). +title: Packaging component (READ) +type: object +examples: + - number_of_units: 6 + shape: + id: 'en:bottle' + lc_name: bouteille + material: + id: 'en:bottle' + lc_name: bouteille + recycling: + id: 'en:bottle' + lc_name: bouteille + quantity_per_unit: 25 cl + quantity_per_unit_value: 25 + quantity_per_unit_unit: cl + weight_specified: 30 + weight_measured: 32 + weight_estimated: 26 + weight: 30 + weight_source_id: specified +properties: + number_of_units: + type: integer + description: umber of units of this packaging component contained in the product (e.g. 6 for a pack of 6 bottles) + shape: + $ref: ./shape.yaml + material: + $ref: ./material.yaml + recycling: + $ref: ./recycling.yaml + quantity_per_unit: + type: string + description: Quantity (weight or volume) of food product contained in the packaging component. (e.g. 75cl for a wine bottle) + quantity_per_unit_value: + type: number + description: Value parsed from the quantity field. + quantity_per_unit_unit: + type: string + description: Unit parsed and normalized from the quantity field. + weight_specified: + type: number + description: 'Weight (as specified by the manufacturer) of one unit of the empty packaging component (in grams). (e.g. for a 6 pack of 1.5l water bottles, it might be 30, the weight in grams of 1 empty water bottle without its cap which is a different packaging component).' + weight_measured: + type: number + description: 'Weight (as measured by one or more users) of one unit of the empty packaging component (in grams). (e.g. for a 6 pack of 1.5l water bottles, it might be 30, the weight in grams of 1 empty water bottle without its cap which is a different packaging component).' + weight_estimated: + type: number + description: 'Weight (as estimated from similar products) of one unit of the empty packaging component (in grams). (e.g. for a 6 pack of 1.5l water bottles, it might be 30, the weight in grams of 1 empty water bottle without its cap which is a different packaging component).' + weight: + type: number + description: Weight of one unit of the empty packaging component. + weight_source_id: + type: string + description: 'Indicates which field was used to populate the "weight" field. Either "specified", "measured", or "estimated"' diff --git a/Tools/ref/schemas/packagings/packagings-write.yaml b/Tools/ref/schemas/packagings/packagings-write.yaml new file mode 100644 index 0000000..e05839b --- /dev/null +++ b/Tools/ref/schemas/packagings/packagings-write.yaml @@ -0,0 +1,11 @@ +type: array +x-stoplight: + id: 69xpogby1amz6 +title: Packagings (WRITE) +description: |- + The packagings object is an array of individual packaging component objects. + + The Packaging data document explains how packaging data is structured in Open Food Facts: https://openfoodfacts.github.io/openfoodfacts-server/dev/explain-packaging-data/ +examples: [] +items: + $ref: ./packaging_component-write.yaml diff --git a/Tools/ref/schemas/packagings/packagings.yaml b/Tools/ref/schemas/packagings/packagings.yaml new file mode 100644 index 0000000..174a519 --- /dev/null +++ b/Tools/ref/schemas/packagings/packagings.yaml @@ -0,0 +1,38 @@ +type: array +x-stoplight: + id: 1cyz4qo9njog7 +title: Packagings (READ) +description: |- + The packagings object is an array of individual packaging component objects. + + The Packaging data document explains how packaging data is structured in Open Food Facts: https://openfoodfacts.github.io/openfoodfacts-server/dev/explain-packaging-data/ + + The shape, material and recycling properties of each packaging component are linked to entries in the packaging_shapes, packaging_materials and packaging_recycling taxonomies: + + https://world.openfoodfacts.org/data/taxonomies/packaging_shapes.json + https://world.openfoodfacts.org/data/taxonomies/packaging_materials.json + https://world.openfoodfacts.org/data/taxonomies/packaging_recycling.json + + If the tags_lc field is set, the properties will include a lc_name field with the translation in the requested language. +examples: + - - number_of_units: 6 + shape: + id: 'en:bottle' + lc_name: bouteille + material: + id: 'en:bottle' + lc_name: bouteille + recycling: + id: 'en:bottle' + lc_name: bouteille + quantity_per_unit: 25 cl + quantity_per_unit_value: 25 + quantity_per_unit_unit: cl + weight_specified: 30 + weight_measured: 32 + weight_estimated: 26 + weight: 30 + weight_source_id: specified +items: + $ref: ./packaging_component.yaml +readOnly: true diff --git a/Tools/ref/schemas/packagings/packagings_complete.yaml b/Tools/ref/schemas/packagings/packagings_complete.yaml new file mode 100644 index 0000000..88b4b52 --- /dev/null +++ b/Tools/ref/schemas/packagings/packagings_complete.yaml @@ -0,0 +1,7 @@ +title: packagings_complete +x-stoplight: + id: hxnnsy954q1ey +type: integer +minimum: 0 +maximum: 1 +description: Indicate if the packagings array contains all the packaging parts of the product. This field can be set by users when they enter or verify packaging data. Possible values are 0 or 1. diff --git a/Tools/ref/schemas/packagings/recycling-write.yaml b/Tools/ref/schemas/packagings/recycling-write.yaml new file mode 100644 index 0000000..bddbd11 --- /dev/null +++ b/Tools/ref/schemas/packagings/recycling-write.yaml @@ -0,0 +1,17 @@ +title: Packaging component recycling instruction (WRITE) +x-stoplight: + id: 72oyv89xtgc2n +description: The recycling property is canonicalized using the packaging_recycling taxonomy. +examples: + - id: string + - lc_name: bouteille +anyOf: + - properties: + id: + type: string + description: 'Canonical id of the entry in the taxonomy. If the value cannot be mapped to a taxonomy entry, the value must be the name of the entry in its original language prefixed by the language 2 letter code and a colon.' + - properties: + lc_name: + type: string + description: 'Name of the entry in the language specified in the tags_lc field of the request. If the translation is not available, the value must be the name of the entry in its original language prefixed by the language 2 letter code and a colon.' +type: object diff --git a/Tools/ref/schemas/packagings/recycling.yaml b/Tools/ref/schemas/packagings/recycling.yaml new file mode 100644 index 0000000..5396245 --- /dev/null +++ b/Tools/ref/schemas/packagings/recycling.yaml @@ -0,0 +1,15 @@ +title: Packaging component recycling instruction +x-stoplight: + id: 376tk8e2cmyh2 +type: object +description: The recycling property is canonicalized using the packaging_recycling taxonomy. +examples: + - id: 'en:bottle' + lc_name: bouteille +properties: + id: + type: string + description: 'Canonical id of the entry in the taxonomy. If the value cannot be mapped to a taxonomy entry, the value will be the name of the entry in its original language prefixed by the language 2 letter code and a colon.' + lc_name: + type: string + description: 'Name of the entry in the language requested in the tags_lc field of the request. This field is returned only of tags_lc is specified. If the translation is not available, or if the entry does not exist in the taxonomy, the value will be the name of the entry in its original language prefixed by the language 2 letter code and a colon.' diff --git a/Tools/ref/schemas/packagings/shape-write.yaml b/Tools/ref/schemas/packagings/shape-write.yaml new file mode 100644 index 0000000..e16b14c --- /dev/null +++ b/Tools/ref/schemas/packagings/shape-write.yaml @@ -0,0 +1,17 @@ +title: Packaging component shape (WRITE) +x-stoplight: + id: yi44igltu79cl +description: The shape property is canonicalized using the packaging_shapes taxonomy. +examples: + - id: string + - lc_name: bouteille +anyOf: + - properties: + id: + type: string + description: 'Canonical id of the entry in the taxonomy. If the value cannot be mapped to a taxonomy entry, the value must be the name of the entry in its original language prefixed by the language 2 letter code and a colon.' + - properties: + lc_name: + type: string + description: 'Name of the entry in the language specified in the tags_lc field of the request. If the translation is not available, the value must be the name of the entry in its original language prefixed by the language 2 letter code and a colon.' +type: object diff --git a/Tools/ref/schemas/packagings/shape.yaml b/Tools/ref/schemas/packagings/shape.yaml new file mode 100644 index 0000000..f0e2896 --- /dev/null +++ b/Tools/ref/schemas/packagings/shape.yaml @@ -0,0 +1,15 @@ +title: Packaging component shape +x-stoplight: + id: xrj8agza3dwgf +type: object +description: The shape property is canonicalized using the packaging_shapes taxonomy. +examples: + - id: 'en:bottle' + lc_name: bouteille +properties: + id: + type: string + description: 'Canonical id of the entry in the taxonomy. If the value cannot be mapped to a taxonomy entry, the value will be the name of the entry in its original language prefixed by the language 2 letter code and a colon.' + lc_name: + type: string + description: 'Name of the entry in the language requested in the tags_lc field of the request. This field is returned only of tags_lc is specified. If the translation is not available, or if the entry does not exist in the taxonomy, the value will be the name of the entry in its original language prefixed by the language 2 letter code and a colon.' diff --git a/Tools/ref/schemas/product.yaml b/Tools/ref/schemas/product.yaml new file mode 100644 index 0000000..5cf3a8b --- /dev/null +++ b/Tools/ref/schemas/product.yaml @@ -0,0 +1,31 @@ +type: object +description: | + This is all the fields describing a product and how to display it on a page. + + Refer to the different sub schema for more readable entries: + + * [Product Base](#cmp--schemas-product-base): Base fields of a product + * [Product Misc](#cmp--schemas-product-misc): Miscellaneous but important fields of a product + * [Product Tags](#cmp--schemas-product-tags): Tags fields on a product + * [Product Nutrition](#cmp--schemas-product-nutrition): Nutrition fields of a product + * [Product Ingredients](#cmp--schemas-product-ingredients): Fields about ingredients of a product + * [Product Images](#cmp--schemas-product-images): Information about Images of a product + * [Product Eco-Score](#cmp--schemas-product-images): Fields related to Eco-Score for a product + * [Product Metadata](#cmp--schemas-product-ecoscore): Metadata of a product (author, editors, etc.) + * [Product Data Quality](#cmp--schemas-product-quality): fields related to data quality for a product + * [Product Knowledge Panels](#cmp--schemas-product-knowledge-panels): Knowledge panels for a product + * [Product Attribute Groups](#cmp--schemas-product-attribute-groups): Attribute groups for personal product matching + +allOf: + - $ref: './product_base.yaml' + - $ref: './product_misc.yaml' + - $ref: './product_tags.yaml' + - $ref: './product_images.yaml' + - $ref: './product_ecoscore.yaml' + - $ref: './product_ingredients.yaml' + - $ref: './product_nutrition.yaml' + - $ref: './product_quality.yaml' + - $ref: './product_extended.yaml' + - $ref: './product_meta.yaml' + - $ref: './product_knowledge_panels.yaml' + - $ref: './product_attribute_groups.yaml' diff --git a/Tools/ref/schemas/product_attribute_groups.yaml b/Tools/ref/schemas/product_attribute_groups.yaml new file mode 100644 index 0000000..c67814b --- /dev/null +++ b/Tools/ref/schemas/product_attribute_groups.yaml @@ -0,0 +1,51 @@ +type: object +description: | + Specific data about a product to enable personal ranking +properties: + attribute_groups: + type: array + description: Each element is an attribute that can help compute a personal ranking for the product + items: + type: object + properties: + id: + type: string + description: | + Unique id of the attribute. + + It will be use to match against preferences parameters. + status: + type: string + enum: ["known", "unknown"] + description: wether we have the information to really compute this criteria or not. + title: + type: string + description: | + A descriptive sentence about the situation of the product concerning attribute + example: "Does not contain: Molluscs" + match: + type: number + format: float + minimum: 0 + maximum: 100 + description: | + a numeric value for the match, + telling how much the products ranks well for this particular attribute. + The higher the value, the better the match. + grade: + description: every attribute as a grade for a to e + type: string + enum: ['unknown', 'a', 'b', 'c', 'd', 'e'] + name: + type: string + description: The name of attribute, for eventual display + icon_url: + type: string + description: an icon representing the attribute match (often using a color) + description: + type: string + description: An eventual description of the value of the property upon which this attribute is based + description_short: + type: string + description: An eventual short description of the value of the property upon which this attribute is based + diff --git a/Tools/ref/schemas/product_base.yaml b/Tools/ref/schemas/product_base.yaml new file mode 100644 index 0000000..81a505d --- /dev/null +++ b/Tools/ref/schemas/product_base.yaml @@ -0,0 +1,96 @@ +type: object +description: | + Base product data +properties: + abbreviated_product_name: + type: string + description: Abbreviated name in requested language + code: + type: string + description: | + barcode of the product (can be EAN-13 or internal codes for some food stores), + for products without a barcode, + Open Food Facts assigns a number starting with the 200 reserved prefix + codes_tags: + type: array + items: + type: string + description: | + A value which is the type of barcode "code-13" or "code-8" + and + A series of mask for the barcode + It helps retrieve barcodes starting by + example: | + ["code-13","3017620422xxx","301762042xxxx","30176204xxxxx","3017620xxxxxx","301762xxxxxxx","30176xxxxxxxx","3017xxxxxxxxx","301xxxxxxxxxx","30xxxxxxxxxxx","3xxxxxxxxxxxx"] + generic_name: + type: string + description: | + Legal name of the product as regulated + by the European authorities. + id: + description: | + internal identifier for the product, usually set to the value of `code`, + except on the producers platform where it is prefixed by the owner + type: string + lc: + type: string + description: | + Main language of the product. + This is a duplicate of `lang` property (for historical reasons). + lang: + type: string + description: | + Main language of the product. + + This should be the main language of product packaging (if one is predominant). + + Main language is also used to decide which ingredients list to parse. + nova_group: + type: integer + description: | + Nova group as an integer from 1 to 4. See https://world.openfoodfacts.org/nova + nova_groups: + type: string + obsolete: + type: string + obsolete_since_date: + description: | + A date at which the product was declared obsolete. + This means it's not produced any more. + type: string + product_name: + type: string + description: | + The name of the product + product_name_en: + type: string + description: | + The name of the product can also + be in many other languages like + product_name_fr (for French). + product_quantity: + type: string + description: | + The size in g or ml for the whole product. + It's a normalized version of the quantity field. + example: "500" + product_quantity_unit: + type: string + description: | + The unit (either g or ml) for the correponding product_quantity. + example: "g" + quantity: + type: string + description: | + Quantity and Unit. + + +patternProperties: + abbreviated_product_name_(?\w\w): + type: string + description: Abbreviated name in language `language_code`. + 'generic_name_(?\w\w)': + type: string + description: | + This can be returned in many other languages + like generic_name_fr (for French). diff --git a/Tools/ref/schemas/product_ecoscore.yaml b/Tools/ref/schemas/product_ecoscore.yaml new file mode 100644 index 0000000..31d0e6d --- /dev/null +++ b/Tools/ref/schemas/product_ecoscore.yaml @@ -0,0 +1,146 @@ +type: object +description: | + Fields related to Eco-Score for a product. + + See also: `ecoscore_score`, `ecoscore_grade` and `ecoscore_tags`. + +properties: + ecoscore_data: + type: object + description: | + An object about a lot of details about data needed for Eco-Score computation + and complementary data of interest. + properties: + adjustments: + type: object + properties: + origins_of_ingredients: + type: object + properties: + aggregated_origins: + type: array + items: + type: object + properties: + origin: + type: string + percent: + type: integer + epi_score: + type: integer + epi_value: + type: integer + origins_from_origins_field: + type: array + items: + type: string + transportation_scores: + type: object + patternProperties: + (?\w\w): + type: integer + transportation_values: + type: object + patternProperties: + (?\w\w): + type: integer + + values: + type: object + patternProperties: + (?\w\w): + type: integer + warning: + type: string + packaging: + type: object + properties: + non_recyclable_and_non_biodegradable_materials: + type: integer + packagings: + type: array + items: + type: object + properties: + ecoscore_material_score: + type: integer + ecoscore_shape_ratio: + type: integer + material: + type: string + shape: + type: string + score: + type: integer + value: + type: integer + warning: + type: string + production_system: + type: object + properties: + labels: + type: array + example: "vegan, fat free, Kosher" + items: + type: string + value: + type: integer + warning: + type: string + threatened_species: + type: object + properties: + ingredient: + type: string + value: + type: integer + agribalyse: + $ref: "./agribalyse.yaml" + grade: + type: string + grades: + type: object + patternProperties: + (?\w\w): + type: string + missing: + type: object + properties: + labels: + type: integer + origins: + type: integer + packagings: + type: integer + + missing_data_warning: + type: integer + + previous_data: + type: object + properties: + grade: + type: string + score: + type: integer + agribalyse: + $ref: "./agribalyse.yaml" + score: + type: integer + scores: + type: object + patternProperties: + (?\w\w): + type: integer + status: + type: string + ecoscore_extended_data_version: + type: string + + environment_impact_level: + type: string + environment_impact_level_tags: + type: array + items: + type: object diff --git a/Tools/ref/schemas/product_extended.yaml b/Tools/ref/schemas/product_extended.yaml new file mode 100644 index 0000000..b317ac6 --- /dev/null +++ b/Tools/ref/schemas/product_extended.yaml @@ -0,0 +1,161 @@ +type: object +properties: + additives_original_tags: + type: array + items: + type: string + additives_prev_original_tags: + type: array + items: + type: string + added_countries_tags: + type: array + items: + type: object + allergens_from_ingredients: + type: string + allergens_from_user: + type: string + + amino_acids_prev_tags: + type: array + items: + type: object + amino_acids_tags: + type: array + items: + type: object + carbon_footprint_percent_of_known_ingredients: + type: integer + categories_properties: + type: object + properties: + "agribalyse_food_code:en": + type: string + "agribalyse_proxy_food_code:en": + type: string + "ciqual_food_code:en": + type: string + categories_properties_tags: + type: array + items: + type: string + category_properties: + type: object + additionalProperties: + description: those are properties taken from the category taxonomy + type: string + ciqual_food_name_tags: + type: array + items: + type: string + compared_to_category: + type: string + description: | + the category to use for comparison. + + **TODO** explain how it is chosen. + conservation_conditions: + type: string + customer_service: + type: string + description: | + Contact info of customer service. + expiration_date: + type: string + + link: + type: string + description: | + link to the product on the website of the producer + + main_countries_tags: + type: array + items: + type: object + + minerals_prev_tags: + type: array + items: + type: object + minerals_tags: + type: array + items: + type: object + owner_fields: + type: object + description: | + Those are fields provided by the producer (through producers platform), + and the value he provided. + properties: + additionalProperties: + description: | + you can retrieve all kind of properties, the same as on the parent object (the product). + It's not processed entries (like tags for example) but raw ones. + oneOf: + - type: integer + - type: string + - type: object + nova_groups_markers: + type: object + description: | + Detail of ingredients or processing that makes the products having Nova 3 or 4 + properties: + "3": + description: | + Markers of level 3 + type: array + items: + type: array + description: | + This array has two element for each marker. + One + items: + type: string + "4": + description: | + Markers of level 4 + type: array + items: + # same as above + $ref: "#/properties/nova_groups_markers/properties/3/items" + + nucleotides_tags: + type: array + items: + type: object + origin: + type: string + purchase_places: + type: string + description: | + Country, state, or city where the product can be purchased. + example: Paris + purchase_places_tags: + type: array + items: + type: string + stores: + type: string + description: | + Distributor name. + example: Walmart + stores_tags: + type: array + items: + type: string + traces_from_ingredients: + type: string + traces_from_user: + type: string + + +patternProperties: + 'conservation_conditions_(?\w\w)': + type: string + 'customer_service_(?\w\w)': + type: string + 'origin_(?\w\w)': + type: string + description: | + `origin` in language indicated by `language_code` diff --git a/Tools/ref/schemas/product_hidden.yaml b/Tools/ref/schemas/product_hidden.yaml new file mode 100644 index 0000000..1ae3a7f --- /dev/null +++ b/Tools/ref/schemas/product_hidden.yaml @@ -0,0 +1,105 @@ +type: object +detail: | + Here are referenced fields that one may found in the database but + either have no real meaning or should not be considered part of the API + +properties: + allergens_imported: + type: string + brands_imported: + type: string + countries_imported: + type: string + data_sources_imported: + type: string + lang_imported: + type: string + lc_imported: + type: string + no_nutrition_data_imported: + type: string + nutrition_data_per_imported: + type: string + obsolete_imported: + type: string + owner_imported: + type: string + packaging_imported: + type: string + producer_version_id_imported: + type: string + quantity_imported: + type: string + serving_size_imported: + type: string + + + grades: + type: object + + countries_beforescanbot: + type: string + nucleotides_prev_tags: + type: array + items: + type: object + + nutrition_data: + type: string + nutrition_data_prepared: + type: string + + _id: + type: string + description: id in database of the product, this normally is the barcode + _keywords: + type: array + items: + type: string + + max_imgid: + type: string + packaging: + type: string + packaging_hierarchy: + type: array + items: + type: string + packaging_lc: + type: string + packaging_tags: + type: array + items: + type: string + producer_version_id: + description: | + A version id internal to the producer. + We may grab those from PIM or GS1 platforms. + type: string + removed_countries_tags: + type: array + items: + type: object + sortkey: + type: integer + + vitamins_prev_tags: + type: array + items: + type: object + + scores: + type: object + +patternProperties: + 'abbreviated_product_name_(?\w\w)_imported': + type: string + 'conservation_conditions_(?\w\w)_imported': + type: string + 'customer_service_(?\w\w)_imported': + type: string + + 'ingredients_text_(?\w\w)_imported': + type: string + description: | + list of ingredients as imported by the producer in language_code \ No newline at end of file diff --git a/Tools/ref/schemas/product_images.yaml b/Tools/ref/schemas/product_images.yaml new file mode 100644 index 0000000..22d8ef5 --- /dev/null +++ b/Tools/ref/schemas/product_images.yaml @@ -0,0 +1,98 @@ +type: object +description: | + Information about Images of a product. + + Images ensure the reliability of Open Food Facts data. + It provides a primary source and proof of all the structured data. + You may therefore want to display it along the structured information. + + See also tutorials about images: + * [Getting images](https://openfoodfacts.github.io/openfoodfacts-server/api/how-to-download-images/) + * [Uploading images](https://openfoodfacts.github.io/openfoodfacts-server/api/tutorial-uploading-photo-to-a-product/) +properties: + images: + description: | + This contains properties for all images contained on the product. + type: object + properties: + 1: + type: object + description: | + This represents an image uploaded for this product. + $ref: ./image.yaml + front: + description: | + This represents an image (or part of it) selected for a specific role on this product. + type: object + $ref: ./image_role.yaml + patternProperties: + '(?\d+)': + description: | + See property `1` to get the real type of those objects + (Put this way because of a [bug in rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) + type: string + '(?front|nutrition|ingredients|packaging|other)_(?\w\w)': + description: | + See property `front` to get the real type of those objects + (Put this way because of a [bug in rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) + type: string + + last_image_dates_tags: + type: array + items: + type: string + last_image_t: + description: timestamp of last image upload (or update?) + type: integer + + selected_images: + type: object + description: | + URL for selected (important) images of the product. + + This is very handy if you display the product to users. + properties: + front: + type: object + description: URLs of thumbnails image of image of type `image_type` + properties: + display: + description: | + Thumbnail urls of product image (front) adapted to display on product page + type: object + $ref: 'image_urls.yaml' + small: + description: | + Thumbnail urls of product image (front) adapted to display on product list page + type: object + $ref: 'image_urls.yaml' + thumb: + description: | + Thumbnail urls of product image (front) in smallest format + type: object + $ref: 'image_urls.yaml' + patternProperties: + '(?front|packaging|ingredients|nutrition|other)': + description: | + See property `front` to get the real type of those objects + (Put this way because of a [bug in rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) + type: string + + image_small_url: + type: string + image_thumb_url: + type: string + image_url: + type: string + + patternProperties: + 'image(_(?front|packaging|ingredients|nutrition|other))?(_(?small|thumb))?_url': + description: | + the URL of image of type `image_type` in size `image_size` (or full size if not given). + + The `image_type` tells which image the url correspond to. `image_type` is `front` if not provided. + + The image is the one for current language (affected by `lc` parameter) if an image exists for this language, the image in main product language otherwise. + + **IMPORTANT:** you should use `selected_images` field instead of this one. + type: string diff --git a/Tools/ref/schemas/product_ingredients.yaml b/Tools/ref/schemas/product_ingredients.yaml new file mode 100644 index 0000000..a3a797e --- /dev/null +++ b/Tools/ref/schemas/product_ingredients.yaml @@ -0,0 +1,167 @@ +type: object +description: Fields about ingredients of a product +properties: + + additives_tags: + type: array + items: + type: string + allergens: + type: string + description: comma separated list of allergens + allergens_lc: + type: string + description: language in which `allergens` where input + allergens_hierarchy: + type: array + items: + type: string + allergens_tags: + type: array + items: + type: string + + ingredients: + $ref: ./ingredient.yaml + ingredients_analysis: + type: object + properties: + "en:palm-oil": + type: array + items: + type: string + "en:vegan-status-unknown": + type: array + items: + type: string + "en:vegetarian-status-unknown": + type: array + items: + type: string + ingredients_analysis_tags: + type: array + items: + type: string + ingredients_from_or_that_may_be_from_palm_oil_n: + type: integer + ingredients_from_palm_oil_n: + type: integer + ingredients_from_palm_oil_tags: + type: array + items: + type: object + ingredients_hierarchy: + type: array + items: + type: string + ingredients_n: + type: integer + ingredients_n_tags: + type: array + items: + type: string + ingredients_original_tags: + type: array + items: + type: string + ingredients_percent_analysis: + type: integer + ingredients_sweeteners_n: + type: integer + description: | + Number of sweeteners additives in the ingredients. Undefined if ingredients are not specified. + ingredients_non_nutritive_sweeteners_n: + type: integer + description: | + Number of non-nutritive sweeteners additives (as specified in the Nutri-Score formula) in the ingredients. Undefined if ingredients are not specified. + ingredients_tags: + type: array + items: + type: string + ingredients_lc: + type: string + description: | + Language that was used to parse the ingredient list. If `ingredients_text` is available + for the product main language (`lang`), `ingredients_lc=lang`, otherwise we look at + `ingredients_text` fields for other languages and set `ingredients_lc` to the first + non-empty `ingredient_text`. + ingredients_text: + type: string + description: | + Raw list of ingredients. This will get automatically + parsed and get used to compute the Eco-Score or find allergens, etc.. + + It's a copy of ingredients_text in the main language of the product (see `lang` proprety). + + example: | + Farine de blé* 67,4%, sucre de canne*, huile de tournesol oléique*, graines de chia* 5,2%, son de blé*, oranges déshydratées * 0,9%, farine de riz*, poudres à lever (acide citrique, carbonates de sodium), arôme naturel d'orange. + ingredients_text_with_allergens: + type: string + description: | + Same text as `ingredients_text` but where allergens have HTML elements around them to identify them + example: | + Farine de blé* 67,4%, sucre de canne*, huile de tournesol oléique*, graines de chia* 5,2%, son de blé*, oranges déshydratées * 0,9%, farine de riz*, poudres à lever (acide citrique, carbonates de sodium), arôme naturel d'orange. + ingredients_that_may_be_from_palm_oil_n: + type: integer + ingredients_that_may_be_from_palm_oil_tags: + type: array + items: + type: object + ingredients_with_specified_percent_n: + type: integer + ingredients_with_specified_percent_sum: + type: integer + ingredients_with_unspecified_percent_n: + type: integer + ingredients_with_unspecified_percent_sum: + type: integer + known_ingredients_n: + type: integer + origins: + type: string + description: | + Origins of ingredients + origins_hierarchy: + type: array + items: + type: object + origins_lc: + type: string + origins_tags: + type: array + items: + type: object + traces: + type: string + description: | + List of substances that might cause allergies + that are present in trace amounts in the product + (this does not include the ingredients, as they + are not only present in trace amounts). + It is taxonomized with the allergens taxonomy. + traces_hierarchy: + type: array + items: + type: object + traces_lc: + type: string + traces_tags: + type: array + items: + type: object + unknown_ingredients_n: + type: integer + + +patternProperties: + 'ingredients_text_(?\w\w)': + type: string + description: | + Raw list of ingredients in language given by 'language_code'. + + See `ingredients_text` + 'ingredients_text_with_allergens_(?\w\w)': + description: | + Like `ingredients_text_with_allergens` for a particular language + type: string + diff --git a/Tools/ref/schemas/product_knowledge_panels.yaml b/Tools/ref/schemas/product_knowledge_panels.yaml new file mode 100644 index 0000000..92dafe8 --- /dev/null +++ b/Tools/ref/schemas/product_knowledge_panels.yaml @@ -0,0 +1,6 @@ +type: object +description: | + Knowledge panels for a product +properties: + knowledge_panels: + $ref: ./knowledge_panels/panels.yaml diff --git a/Tools/ref/schemas/product_meta.yaml b/Tools/ref/schemas/product_meta.yaml new file mode 100644 index 0000000..6ff9c0d --- /dev/null +++ b/Tools/ref/schemas/product_meta.yaml @@ -0,0 +1,145 @@ +type: object +description: | + Metadata of a product (author, editors, creation date, etc.) + +properties: + created_t: + type: integer + description: | + Date when the product was added (UNIX timestamp format). + See also `entry_dates_tags` + example: | + 1457680652 + creator: + type: string + description: | + The contributor who added the product first. + editors_tags: + description: | + List of editors who edited the product. + type: array + items: + type: string + + informers_tags: + type: array + items: + type: string + interface_version_created: + type: string + interface_version_modified: + type: string + languages: + type: object + patternProperties: + 'en:(?\w\w)': + type: integer + description: | + **TODO** explain ! + languages_codes: + type: object + patternProperties: + (?\w\w): + type: integer + description: | + Same as `languages` but by language code, instead of language tags + languages_hierarchy: + type: array + items: + type: string + languages_tags: + type: array + items: + type: string + last_edit_dates_tags: + type: array + items: + type: string + last_editor: + type: string + + last_modified_by: + type: string + description: | + The username of the user who last modified the product. + example: sebleouf + last_modified_t: + type: integer + description: | + Date when the product page was last modified. + owner: + description: | + Id of the producer in case he provides his own data about a product (producer platform). + type: string + owners_tags: + description: | + Tagyfied version of owner + type: string + photographers_tags: + type: array + items: + type: string + rev: + description: revision number of this product version (each edit adds a revision) + type: integer + sources: + type: array + items: + type: object + properties: + fields: + type: array + items: + type: string + id: + type: string + images: + type: array + items: + type: object + import_t: + type: integer + manufacturer: + type: + - integer + - string + name: + type: string + source_licence: + type: string + source_licence_url: + type: string + url: + type: + - "null" + - string + sources_fields: + type: object + properties: + org-gs1: + type: object + properties: + gln: + type: string + gpcCategoryCode: + type: string + gpcCategoryName: + type: string + isAllergenRelevantDataProvided: + type: string + lastChangeDateTime: + type: string + partyName: + type: string + productionVariantDescription: + type: string + publicationDateTime: + type: string + teams: + type: string + teams_tags: + type: array + items: + type: string + update_key: + type: string diff --git a/Tools/ref/schemas/product_misc.yaml b/Tools/ref/schemas/product_misc.yaml new file mode 100644 index 0000000..05ce5b5 --- /dev/null +++ b/Tools/ref/schemas/product_misc.yaml @@ -0,0 +1,115 @@ +type: object +description: | + Miscellaneous but important fields of a product +properties: + additives_n: + type: integer + description: | + Number of food additives. + checked: + type: string + complete: + type: integer + completeness: + type: number + ecoscore_grade: + type: string + description: | + See also: `ecoscore_tags` + ecoscore_score: + type: integer + description: | + See also: `ecoscore_tags` + food_groups: + type: string + food_groups_tags: + type: array + items: + type: string + nutrient_levels: + description: | + Traffic light indicators on main nutrients levels + type: object + properties: + fat: + type: string + enum: ["low", "moderate", "high"] + salt: + type: string + enum: ["low", "moderate", "high"] + saturated-fat: + type: string + enum: ["low", "moderate", "high"] + sugars: + type: string + enum: ["low", "moderate", "high"] + packaging_text: + type: string + description: | + Recycling instructions as raw text, e.g. Plastic + bottle to recycle, Plastic cap to recycle. + This will get automatically parsed and + will be used to compute the Eco-Score. + You can either request it (if it exists) or + send it in a specific language. + example: packaging_text_en + packagings: + $ref: ./packagings/packagings.yaml + packagings_complete: + $ref: ./packagings/packagings_complete.yaml + + pnns_groups_1: + description: | + Category of food according to [French Nutrition and Health Program](https://fr.wikipedia.org/wiki/Programme_national_nutrition_sant%C3%A9) + type: string + pnns_groups_1_tags: + type: array + items: + type: string + pnns_groups_2: + description: | + Sub Category of food according to [French Nutrition and Health Program](https://fr.wikipedia.org/wiki/Programme_national_nutrition_sant%C3%A9) + type: string + pnns_groups_2_tags: + type: array + items: + type: string + popularity_key: + description: | + An imprecise measurement of popularity based on Scan statistics. A higher value means higher popularity. + type: integer + popularity_tags: + description: | + Indicators for the popularity of a product, like the amount of scans in a specific year. + type: array + items: + type: string + scans_n: + type: integer + unique_scans_n: + type: integer + serving_quantity: + type: string + description: | + Normalized version of serving_size. + Note that this is NOT the number of servings by product. + (in perl, see `normalize_serving_size`) + serving_quantity_unit: + type: string + description: | + The unit (either g or ml) for the correponding serving_quantity. + example: "g" + serving_size: + type: string + description: | + Serving size text (generally in g or ml). + We expect a quantity + unit but the user is free to input any string. + +patternProperties: + 'food_groups_(?\w\w)': + type: string + description: see `food_groups` + 'packaging_text_(?\w\w)': + type: string + description: | + Packaging text in language designated by `language_code` diff --git a/Tools/ref/schemas/product_nutrition.yaml b/Tools/ref/schemas/product_nutrition.yaml new file mode 100644 index 0000000..3b22bfb --- /dev/null +++ b/Tools/ref/schemas/product_nutrition.yaml @@ -0,0 +1,339 @@ +type: object +description: | + Nutrition fields of a product + + Most of these properties are read-only. + + See [how to add nutrition data](https://openfoodfacts.github.io/openfoodfacts-server/api/ref-cheatsheet/#add-nutrition-facts-values-units-and-base) +properties: + no_nutrition_data: + type: string + description: | + When a product does not have nutrition data displayed on the + packaging, the user can check the field "Nutrition facts are + not specified on the product". + By doing so, the no_nutrition_data field takes the value "on". + This case is frequent (thousands of products). + example: "on" + nutrition_data_per: + type: string + enum: + - serving + - 100g + description: | + The nutrition data on the package can be per serving or per 100g. + + This is essential to understand if `_value` and `` + values in `nutriments` applies for a serving or for 100g. + + **IMPORTANT:** + When writing products, + this setting applies to all existing nutrients values for the product, + not only the nutrient values sent in the write request. + So it should not be changed unless all nutrients values are provided + with values that match the nutrition_data_per field. + nutrition_data_prepared_per: + type: string + enum: + - serving + - 100g + description: | + The nutrition data for prepared product on the package (if any) can be per serving or per 100g. + + This is essential to understand if `_prepared_value` and `_prepared` + values in `nutriments` applies for a serving or for 100g. + + See also important note on `nutrition_data_per`. + nutriments: + type: object + description: | + All known nutrients for the product. + + Note that each nutrients are declined with a variety of suffixes like `_100g`, `_serving`, + see patternProperties below. + + A specific `_unit` is the unit used to measure the nutrient. + + Beware that some properties are to be interpreted based upon `nutrition_data_per` value. + + Also for products that have a nutrition table for prepared product + (eg. the nutrition facts for a bowl of milk with cocoa powder), + a `_prepared` suffix is added (before other suffixes). + + You can get all possible nutrients from the + [nutrients taxonomy](https://static.openfoodfacts.org/data/taxonomies/nutrients.json) + + **FIXME** add more nutrients with description. + properties: + alcohol: + description: | + Quantity of alcohol + + (per 100g or per serving) in a standard unit (g or ml) + type: number + carbohydrates: + type: number + energy: + type: number + description: | + It is the same as `energy-kj` if we have it, or computed from `energy-kcal` otherwise + + (per 100g or per serving) in kj + energy_value: + type: number + description: | + energy_value will be equal to energy-kj_value if we have it or to energy-kcal_value otherwise + energy_unit: + type: string + enum: ["kcal", "kj"] + description: | + Equal to energy-kj_unit if we have it or to energy-kcal_unit otherwise + energy-kcal: + type: number + description: | + energy in kcal, if it is specified + + (per 100g or per serving) in a standard unit (g or ml) + energy-kj: + type: number + description: | + energy in kj, if it is specified + + (per 100g or per serving) in a standard unit (g or ml) + fat: + type: number + fruits-vegetables-legumes-estimate-from-ingredients: + type: number + description: | + An estimate, from the ingredients list of the percentage of fruits, vegetable and legumes. + This is an important information for Nutri-Score (2023 version) computation. + fruits-vegetables-nuts-estimate-from-ingredients: + type: number + description: | + An estimate, from the ingredients list of the percentage of fruits, vegetable and nuts. + This is an important information for Nutri-Score (2021 version) computation. + nova-group: + type: integer + nutrition-score-fr: + description: | + Experimental nutrition score derived from + the UK FSA score and adapted for the French market + (formula defined by the team of Professor Hercberg). + proteins: + type: number + salt: + type: number + saturated-fat: + type: number + sodium: + type: number + sugars: + type: number + carbon-footprint-from-known-ingredients_product: + type: integer + carbon-footprint-from-known-ingredients_serving: + type: number + erythritol: + type: number + description: | + erythritol is a polyol which is not providing any energy. + As such, it needs not be taken into account when computing + the energy of a product. Eryhtritol is now displayed on + nutrition facts sheet of some products, mainly in the USA. + This value is entered either by contributors, either by + imports. + example: 12.5 + patternProperties: + '(?[\w-]+)_unit': + description: | + The unit in which the nutrient for 100g or per serving is measured. + + The possible values depends on the nutrient. + + * `g` for grams + * `mg` for milligrams + * `μg` for micrograms + * `cl` for centiliters + * `ml` for mililiters + * `dv` for recommended daily intakes (aka [Dietary Reference Intake](https://en.wikipedia.org/wiki/Dietary_Reference_Intake)) + * `% vol` for alcohol vol per 100 ml + + 🤓 code: see the [Units module][units-module], + and [Food:default_unit_for_nid function][default-unit] + + [units-module]: https://openfoodfacts.github.io/openfoodfacts-server/dev/ref-perl-pod/ProductOpener/Units.html + [default-unit]: https://openfoodfacts.github.io/openfoodfacts-server/dev/ref-perl-pod/ProductOpener/Food.html#default_unit_for_nid_(_%24nid) + type: string + enum: ['公斤', '公升', 'kg', 'кг', 'l', 'л', '毫克', 'mg', 'мг', 'mcg', 'µg', 'oz', 'fl oz', 'dl', 'дл', 'cl', 'кл', '斤', 'g', '', ' ', 'kj', '克', '公克', 'г', 'мл', 'ml', 'mmol/l', '毫升', '% vol', 'ph', '%', '% dv', '% vol (alcohol)', 'iu', 'mol/l', 'mval/l', 'ppm', '�rh', '�fh', '�e', '�dh', 'gpg'] + '(?[\w-]+)_100g': + description: | + The standardized value of a serving of 100g (or 100ml for liquids) + for the nutrient. + + This is computed from the `nutrient` property, + the serving size (if needed), and the `nutrient`_unit field. + + **Note**: + If you want to characterize products in a uniform way, this is the value you should use. + type: number + readOnly: true + '(?[\w-]+)_serving': + description: | + The standardized value of a serving for this product. + type: number + readOnly: true + '(?[\w-]+)_value': + description: | + The value input by the user / displayed on the product for the nutrient. + + * per 100g or serving, depending on `nutrition_data_per` + * in the unit of corresponding _unit field. + type: number + readOnly: true + '(?[\w-]+)_prepared': + description: | + The value for nutrient for **prepared** product. + type: number + '(?[\w-]+)_prepared_unit': + description: | + The unit in which the nutrient of **prepared** product is measured. + type: string + '(?[\w-]+)_prepared_100g': + description: | + The standardized value of a serving of 100g (or 100ml for liquids) + for the nutrient, for **prepared** product. + type: number + readOnly: true + '(?[\w-]+)_prepared_serving': + description: | + The standardized value of a serving for the **prepared** product. + type: number + readOnly: true + '(?[\w-]+)_prepared_value': + description: | + The standardized value for a serving or 100g (or 100ml for liquids), + depending on `nutrition_data_prepared_per` + for the nutrient for **prepared** product. + type: number + readOnly: true + nutriscore_data: + description: | + Detail of data the Nutri-Score was computed upon. + + **Note**: this might not be stable, don't rely too much on this, or, at least, tell us ! + + **TODO** document each property + type: object + properties: + energy: + type: integer + energy_points: + type: integer + energy_value: + type: integer + fiber: + type: integer + fiber_points: + type: integer + fiber_value: + type: integer + fruits_vegetables_nuts_colza_walnut_olive_oils: + type: integer + fruits_vegetables_nuts_colza_walnut_olive_oils_points: + type: integer + fruits_vegetables_nuts_colza_walnut_olive_oils_value: + type: integer + grade: + type: string + is_beverage: + type: integer + is_cheese: + type: integer + is_fat: + type: integer + is_water: + type: integer + negative_points: + type: integer + positive_points: + type: integer + proteins: + type: number + proteins_points: + type: integer + proteins_value: + type: number + saturated_fat: + type: number + saturated_fat_points: + type: integer + saturated_fat_ratio: + type: number + saturated_fat_ratio_points: + type: integer + saturated_fat_ratio_value: + type: number + saturated_fat_value: + type: number + score: + type: integer + sodium: + type: number + sodium_points: + type: integer + sodium_value: + type: number + sugars: + type: number + sugars_points: + type: integer + sugars_value: + type: number + nutriscore_grade: + description: | + Nutri-Score for the product as a letter. + + See https://world.openfoodfacts.org/nutriscore. + type: string + enum: ["a", "b", "c", "d", "e"] + nutriscore_score: + description: | + Nutri-Score for the product as an integer (see also `nutriscore_grade`). + type: integer + nutriscore_score_opposite: + type: integer + nutrition_grade_fr: + type: string + description: | + Nutrition grade (‘a’ to ‘e’), + https://world.openfoodfacts.org/nutriscore. + nutrition_grades: + description: | + Nutrition grades as a comma separated list. + + Some products with multiple components might have multiple Nutri-Score + type: string + nutrition_grades_tags: + type: array + items: + type: string + nutrition_score_beverage: + type: integer + nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients: + type: integer + nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients_value: + type: integer + nutrition_score_warning_no_fiber: + type: integer + other_nutritional_substances_tags: + type: array + items: + type: object + unknown_nutrients_tags: + type: array + items: + type: object + vitamins_tags: + type: array + items: + type: object diff --git a/Tools/ref/schemas/product_quality.yaml b/Tools/ref/schemas/product_quality.yaml new file mode 100644 index 0000000..ae13f20 --- /dev/null +++ b/Tools/ref/schemas/product_quality.yaml @@ -0,0 +1,66 @@ +type: object +description: | + This is data that is linked to products data quality +properties: + data_quality_bugs_tags: + type: array + items: + type: object + data_quality_errors_tags: + type: array + items: + type: object + data_quality_info_tags: + type: array + items: + type: string + data_quality_tags: + type: array + items: + type: string + data_quality_warnings_tags: + type: array + items: + type: string + data_sources: + type: string + description: | + Source of data imported from producers. + data_sources_tags: + type: array + items: + type: string + last_check_dates_tags: + type: array + items: + type: string + last_checked_t: + type: integer + last_checker: + type: string + + states: + description: | + comma separated list of values indicating some states of the product, + like things to be done, or to be completed. + See [states taxonomy](https://static.openfoodfacts.net/data/taxonomies/states.json) + type: string + states_hierarchy: + type: array + items: + type: string + states_tags: + type: array + items: + description: | + Each state describe something that is completed or is to be done or improved on the product. + + Refer to [states taxonomy](https://static.openfoodfacts.net/data/taxonomies/states.json) + type: string + + misc_tags: + description: | + Information about different aspect of the product + type: array + items: + type: string diff --git a/Tools/ref/schemas/product_tags.yaml b/Tools/ref/schemas/product_tags.yaml new file mode 100644 index 0000000..314b51e --- /dev/null +++ b/Tools/ref/schemas/product_tags.yaml @@ -0,0 +1,119 @@ +type: object +description: | + Data about a product which is represented as tags +properties: + + brands: + type: string + description: List of brands (not taxonomized) + brands_tags: + type: array + items: + type: string + description: List of brands (tags, not taxonomized) + + categories: + type: string + categories_hierarchy: + type: array + items: + type: string + categories_lc: + type: string + description: Categories language code + categories_tags: + type: array + items: + type: string + + checkers_tags: + type: array + items: + type: string + description: List of checkers (users who checked the product) tags + cities: + type: string + cities_tags: + type: array + items: + type: object + correctors_tags: + type: array + items: + type: string + + countries: + type: string + description: | + List of countries where the product is sold. + countries_hierarchy: + type: array + items: + type: string + countries_lc: + type: string + description: Countries language code + countries_tags: + type: array + items: + type: string + ecoscore_tags: + description: | + All ecoscore of a product. + Most of the time it's only one value, + but it might eventually be more for products composed of sub-products. + See also: `ecoscore_score`, `ecoscore_grade`. + type: array + items: + type: string + + emb_codes: + type: string + description: | + Packager code. EMB is the French system of traceability codes for packager. + example: EMB 2013330 + emb_codes_orig: + type: string + emb_codes_tags: + type: array + items: + type: object + + + labels: + type: string + labels_hierarchy: + type: array + items: + type: string + labels_lc: + type: string + labels_tags: + type: array + items: + type: string + + entry_dates_tags: + description: | + The data as a series of tag: `yyyy-mm-dd`, `yyyy-mm`, `yyyy` + type: array + items: + type: string + example: ["2016-03-11","2016-03","2016"] + + manufacturing_places: + type: string + description: | + Places where the product was manufactured or transformed. + manufacturing_places_tags: + type: array + items: + type: object + nova_groups_tags: + type: array + items: + type: string + nutrient_levels_tags: + type: array + items: + type: string diff --git a/Tools/ref/schemas/product_update_api_v3.yaml b/Tools/ref/schemas/product_update_api_v3.yaml new file mode 100644 index 0000000..e700ac2 --- /dev/null +++ b/Tools/ref/schemas/product_update_api_v3.yaml @@ -0,0 +1,28 @@ +title: Product update API V3 (WRITE) +x-stoplight: + id: qnmmu2yuzc1xf +type: object +description: Model for creating or updating products using the v3 version of the product update API. +examples: [] +properties: + packagings: + $ref: ./packagings/packagings-write.yaml + packagings_add: + $ref: ./packagings/packagings-write.yaml + packagings_complete: + $ref: ./packagings/packagings_complete.yaml + lang: + type: string + minLength: 2 + maxLength: 2 + example: fr + description: 2 letter language code of the main language of the product (the most prominent on the packaging) + quantity: + type: string + serving_size: + type: string + categories_tags: + type: array + description: An array of categories + items: + $ref: ./packagings/input_taxonomy_tag.yaml diff --git a/Tools/ref/schemas/tags_parameters.yaml b/Tools/ref/schemas/tags_parameters.yaml new file mode 100644 index 0000000..53b99f1 --- /dev/null +++ b/Tools/ref/schemas/tags_parameters.yaml @@ -0,0 +1,240 @@ +type: object +description: Parameters of type tags (for search) +properties: + additives_tags: + style: form + explode: false + schema: + type: string + example: e322 + in: query + name: additives_tags + description: | + The additives_tags in english of product(s) you are searching for. + The [OFF App](https://world.openfoodfacts.org/additives) has a list of possible values for `additives`. + + You can use multiple values by using a comma separated list. + You can add a "-" before values to avoid matching a tag. + allergens_tags: + style: form + explode: false + schema: + type: string + example: m + in: query + name: allergens_tags + description: | + The allergens_tags in english of product(s) you are searching for. + The [OFF App](https://world.openfoodfacts.org/allergens) has a list of possible values for `allergens`. + + You can use multiple values by using a comma separated list. + You can add a "-" before values to avoid matching a tag. + brands_tags: + style: form + explode: false + schema: + type: string + example: ferrero + in: query + name: brands_tags + description: | + The brands_tags of product(s) you are searching for. + The [OFF App](https://world.openfoodfacts.org/brands) has a list of possible values for `brands`. + + You can use multiple values by using a comma separated list. + You can add a "-" before values to avoid matching a tag. + categories_tags: + style: form + explode: false + schema: + type: string + example: chocolates + in: query + name: categories_tags + description: | + The category of product(s) you are searching for. + The [OFF App](https://world.openfoodfacts.org/categories) has a list of possible values for `categories`. + + You can use multiple values by using a comma separated list. + You can add a "-" before values to avoid matching a tag. + countries_tags: + style: form + explode: false + schema: + type: string + example: united-kingdom + in: query + name: countries_tags_en + description: | + The countries_tags_en of product(s) you are searching for. + The [OFF App](https://world.openfoodfacts.org/countries) shows a list of possible values for `countries`. + + You can use multiple values by using a comma separated list. + You can add a "-" before values to avoid matching a tag. + emb_codes_tags: + style: form + explode: false + schema: + type: string + in: query + name: emb_codes_tags + description: | + The emb_codes_tags of product(s) you are searching for. + + You can use multiple values by using a comma separated list. + You can add a "-" before values to avoid matching a tag. + labels_tags: + style: form + explode: false + schema: + type: string + example: organic + in: query + name: labels_tags + description: | + The labels_tags in english of product(s) you are searching for. + The [OFF App](https://world.openfoodfacts.org/labels) has a list of possible values for `labels`. + + You can use multiple values by using a comma separated list. + You can add a "-" before values to avoid matching a tag. + manufacturing_places_tags: + style: form + explode: false + schema: + type: string + in: query + name: manufacturing_places_tags + description: | + The manufacturing_places_tags of product(s) you are searching for. + The [OFF App](https://world.openfoodfacts.org/manufacturing-places) has a list of possible values for `manufacturing-places`. + + You can use multiple values by using a comma separated list. + You can add a "-" before values to avoid matching a tag. + nutrition_grades_tags: + style: form + explode: false + schema: + type: string + example: e + in: query + name: nutrition_grades_tags + description: | + The nutrition_grades_tags of product(s) you are searching for. + The [OFF App](https://world.openfoodfacts.org/nutrition-grades) has a list of possible values for `nutrition-grades`. + + You can use multiple values by using a comma separated list. + You can add a "-" before values to avoid matching a tag. + origins_tags: + style: form + explode: false + schema: + type: string + in: query + name: origins_tags + description: | + The origins_tags of product(s) you are searching for. + + You can use multiple values by using a comma separated list. + You can add a "-" before values to avoid matching a tag. + packaging_tags: + style: form + explode: false + schema: + type: string + example: 1-jar-aus-klarglas + in: query + name: packaging_tags_de + description: | + The packaging_tag in german of product(s) you are searching for. + The [OFF App](https://world.openfoodfacts.org/packaging) has a list of possible values for `packaging`. + + You can use multiple values by using a comma separated list. + You can add a "-" before values to avoid matching a tag. + purchase_places_tags: + style: form + explode: false + schema: + type: string + in: query + name: purchase_places_tags + description: | + The purchase_places_tags of product(s) you are searching for. + + You can use multiple values by using a comma separated list. + You can add a "-" before values to avoid matching a tag. + states_tags: + style: form + explode: false + schema: + type: string + example: nutrition-facts-completed + in: query + name: states_tags + description: | + The states_tags in english of product(s) you are searching for. + The [OFF App](https://world.openfoodfacts.org/states) has a list of possible values for `states`. + + You can use multiple values by using a comma separated list. + You can add a "-" before values to avoid matching a tag. + stores_tags: + style: form + explode: false + schema: + type: string + example: aldi + in: query + name: stores_tags + description: | + The stores_tags of product(s) you are searching for. + + You can use multiple values by using a comma separated list. + You can add a "-" before values to avoid matching a tag. + traces_tags: + style: form + explode: false + schema: + type: string + in: query + name: traces_tags + description: | + The traces_tags of product(s) you are searching for. + The [OFF App](https://world.openfoodfacts.org/traces) shows a list of possible values for `traces`. + + You can use multiple values by using a comma separated list. + You can add a "-" before values to avoid matching a tag. + tag_name_with_language_code: + in: query + name: '_tags_' + description: | + You can add a language code to a specific tag to query it in a specific language + style: form + explode: false + schema: + type: object + patternProperties: + '(?\w+)_tags_(?\w\w)': + type: string + description: | + Will search in the tags corresponding to `tag_name`, + in the language corresponding to `language_code. + + `tag_name` is one of the field above which have the `_tags`` suffix: + categories, nutrition_grades, etc. + + `language_code` is a two letter iso language `language_code. + + You can use multiple values by using a comma separated list. + You can add a "-" before values to avoid matching a tag. + examples: + - packaging_tags_de: + summary: packaging in german + value: + packaging_tags_de: "de:Flasche" + - origins_tags_fr: + summary: origins in french + value: + origins_tags_fr: "fr:France" + - categories_tags_en: + summary: categories in english + value: + categories_tags_en: "en:Beer" diff --git a/Tools/ref/schemas/taxonomies/tagtype.yaml b/Tools/ref/schemas/taxonomies/tagtype.yaml new file mode 100644 index 0000000..412ff2f --- /dev/null +++ b/Tools/ref/schemas/taxonomies/tagtype.yaml @@ -0,0 +1,45 @@ +title: tagtype +x-stoplight: + id: cyaecslbj8x2i +type: string +enum: + - additives_classes + - additives + - allergens + - amino_acids + - categories + - countries + - data_quality + - data_quality + - data_quality + - data_quality + - data_quality + - data_quality + - data_quality + - food_groups + - improvements + - ingredients_analysis + - ingredients_processing + - ingredients + - labels + - languages + - minerals + - misc + - nova_groups + - nucleotides + - nutrient_levels + - nutrients + - origins + - other_nutritional_substances + - packaging_materials + - packaging_recycling + - packaging + - packaging_shapes + - periods_after_opening + - preservation + - states + - test + - traces + - vitamins +description: 'Identifier of a taxonomy. See https://wiki.openfoodfacts.org/Global_taxonomies and https://github.com/openfoodfacts/openfoodfacts-server/tree/main/taxonomies' +examples: [] From e1e802ddafd4203f8edbb948b1f44135ec26a126 Mon Sep 17 00:00:00 2001 From: Henadzi Rabkin Date: Tue, 8 Oct 2024 23:18:50 +0200 Subject: [PATCH 6/9] Renaming API client and methods --- .../{Client.swift => OpenFoodFactsAPI.swift} | 102 +- OpenFoodFactsService/Sources/Types.swift | 540 ++++----- OpenFoodFactsService/Sources/main.swift | 2 - OpenFoodFactsService/Sources/openapi.yaml | 23 +- Tools/ref/api-v3.yml | 443 ------- Tools/ref/api.yml | 599 ---------- .../get_product_by_barcode_spread.yaml | 1055 ----------------- .../requestBodies/add_or_edit_a_product.yaml | 58 - .../add_photo_to_existing_product.yaml | 31 - .../requestBodies/change_ref_properties.yaml | 32 - Tools/ref/requestBodies/crop_a_photo.yaml | 69 -- Tools/ref/requestBodies/fields_tags_lc.yaml | 22 - Tools/ref/requestBodies/lc_cc.yaml | 15 - Tools/ref/requestBodies/unselect_a_photo.yaml | 10 - .../ref/responses/add_or_edit_a_product.yaml | 8 - .../add_photo_to_existing_product.yaml | 47 - .../ref/responses/change_ref_properties.yaml | 8 - Tools/ref/responses/get_attribute_groups.yaml | 45 - Tools/ref/responses/get_nutrients.yaml | 1 - Tools/ref/responses/get_preferences.yaml | 27 - .../ref/responses/get_product_by_barcode.yaml | 11 - .../get_product_by_barcode_base.yaml | 15 - Tools/ref/responses/ocr_on_product.yaml | 5 - .../response-status/response_status.yaml | 61 - .../response-status/warning-or-error.yaml | 64 - Tools/ref/responses/rotate_a_photo.yaml | 17 - Tools/ref/responses/search_for_products.yaml | 38 - Tools/ref/schemas/agribalyse.yaml | 47 - Tools/ref/schemas/image.yaml | 36 - Tools/ref/schemas/image_role.yaml | 57 - Tools/ref/schemas/image_size.yaml | 12 - Tools/ref/schemas/image_urls.yaml | 5 - Tools/ref/schemas/ingredient.yaml | 30 - .../knowledge_panels/elements/element.yaml | 39 - .../elements/image_element.yaml | 26 - .../elements/panel_element.yaml | 9 - .../elements/panel_group_element.yaml | 13 - .../elements/table_element.yaml | 32 - .../elements/text_element.yaml | 51 - .../elements/title_element.yaml | 38 - Tools/ref/schemas/knowledge_panels/panel.yaml | 50 - .../ref/schemas/knowledge_panels/panels.yaml | 15 - Tools/ref/schemas/nutrient_unit.yaml | 21 - Tools/ref/schemas/nutrients.yaml | 26 - Tools/ref/schemas/nutrition_search.yaml | 67 -- .../packagings/input_taxonomy_tag.yaml | 14 - .../schemas/packagings/material-write.yaml | 17 - Tools/ref/schemas/packagings/material.yaml | 15 - .../packagings/packaging_component-write.yaml | 53 - .../packagings/packaging_component.yaml | 61 - .../schemas/packagings/packagings-write.yaml | 11 - Tools/ref/schemas/packagings/packagings.yaml | 38 - .../packagings/packagings_complete.yaml | 7 - .../schemas/packagings/recycling-write.yaml | 17 - Tools/ref/schemas/packagings/recycling.yaml | 15 - Tools/ref/schemas/packagings/shape-write.yaml | 17 - Tools/ref/schemas/packagings/shape.yaml | 15 - Tools/ref/schemas/product.yaml | 31 - .../ref/schemas/product_attribute_groups.yaml | 51 - Tools/ref/schemas/product_base.yaml | 96 -- Tools/ref/schemas/product_ecoscore.yaml | 146 --- Tools/ref/schemas/product_extended.yaml | 161 --- Tools/ref/schemas/product_hidden.yaml | 105 -- Tools/ref/schemas/product_images.yaml | 98 -- Tools/ref/schemas/product_ingredients.yaml | 167 --- .../ref/schemas/product_knowledge_panels.yaml | 6 - Tools/ref/schemas/product_meta.yaml | 145 --- Tools/ref/schemas/product_misc.yaml | 115 -- Tools/ref/schemas/product_nutrition.yaml | 339 ------ Tools/ref/schemas/product_quality.yaml | 66 -- Tools/ref/schemas/product_tags.yaml | 119 -- Tools/ref/schemas/product_update_api_v3.yaml | 28 - Tools/ref/schemas/tags_parameters.yaml | 240 ---- Tools/ref/schemas/taxonomies/tagtype.yaml | 45 - 74 files changed, 333 insertions(+), 5827 deletions(-) rename OpenFoodFactsService/Sources/{Client.swift => OpenFoodFactsAPI.swift} (92%) delete mode 100644 OpenFoodFactsService/Sources/main.swift delete mode 100644 Tools/ref/api-v3.yml delete mode 100644 Tools/ref/api.yml delete mode 100644 Tools/ref/examples/get_product_by_barcode_spread.yaml delete mode 100644 Tools/ref/requestBodies/add_or_edit_a_product.yaml delete mode 100644 Tools/ref/requestBodies/add_photo_to_existing_product.yaml delete mode 100644 Tools/ref/requestBodies/change_ref_properties.yaml delete mode 100644 Tools/ref/requestBodies/crop_a_photo.yaml delete mode 100644 Tools/ref/requestBodies/fields_tags_lc.yaml delete mode 100644 Tools/ref/requestBodies/lc_cc.yaml delete mode 100644 Tools/ref/requestBodies/unselect_a_photo.yaml delete mode 100644 Tools/ref/responses/add_or_edit_a_product.yaml delete mode 100644 Tools/ref/responses/add_photo_to_existing_product.yaml delete mode 100644 Tools/ref/responses/change_ref_properties.yaml delete mode 100644 Tools/ref/responses/get_attribute_groups.yaml delete mode 100644 Tools/ref/responses/get_nutrients.yaml delete mode 100644 Tools/ref/responses/get_preferences.yaml delete mode 100644 Tools/ref/responses/get_product_by_barcode.yaml delete mode 100644 Tools/ref/responses/get_product_by_barcode_base.yaml delete mode 100644 Tools/ref/responses/ocr_on_product.yaml delete mode 100644 Tools/ref/responses/response-status/response_status.yaml delete mode 100644 Tools/ref/responses/response-status/warning-or-error.yaml delete mode 100644 Tools/ref/responses/rotate_a_photo.yaml delete mode 100644 Tools/ref/responses/search_for_products.yaml delete mode 100644 Tools/ref/schemas/agribalyse.yaml delete mode 100644 Tools/ref/schemas/image.yaml delete mode 100644 Tools/ref/schemas/image_role.yaml delete mode 100644 Tools/ref/schemas/image_size.yaml delete mode 100644 Tools/ref/schemas/image_urls.yaml delete mode 100644 Tools/ref/schemas/ingredient.yaml delete mode 100644 Tools/ref/schemas/knowledge_panels/elements/element.yaml delete mode 100644 Tools/ref/schemas/knowledge_panels/elements/image_element.yaml delete mode 100644 Tools/ref/schemas/knowledge_panels/elements/panel_element.yaml delete mode 100644 Tools/ref/schemas/knowledge_panels/elements/panel_group_element.yaml delete mode 100644 Tools/ref/schemas/knowledge_panels/elements/table_element.yaml delete mode 100644 Tools/ref/schemas/knowledge_panels/elements/text_element.yaml delete mode 100644 Tools/ref/schemas/knowledge_panels/elements/title_element.yaml delete mode 100644 Tools/ref/schemas/knowledge_panels/panel.yaml delete mode 100644 Tools/ref/schemas/knowledge_panels/panels.yaml delete mode 100644 Tools/ref/schemas/nutrient_unit.yaml delete mode 100644 Tools/ref/schemas/nutrients.yaml delete mode 100644 Tools/ref/schemas/nutrition_search.yaml delete mode 100644 Tools/ref/schemas/packagings/input_taxonomy_tag.yaml delete mode 100644 Tools/ref/schemas/packagings/material-write.yaml delete mode 100644 Tools/ref/schemas/packagings/material.yaml delete mode 100644 Tools/ref/schemas/packagings/packaging_component-write.yaml delete mode 100644 Tools/ref/schemas/packagings/packaging_component.yaml delete mode 100644 Tools/ref/schemas/packagings/packagings-write.yaml delete mode 100644 Tools/ref/schemas/packagings/packagings.yaml delete mode 100644 Tools/ref/schemas/packagings/packagings_complete.yaml delete mode 100644 Tools/ref/schemas/packagings/recycling-write.yaml delete mode 100644 Tools/ref/schemas/packagings/recycling.yaml delete mode 100644 Tools/ref/schemas/packagings/shape-write.yaml delete mode 100644 Tools/ref/schemas/packagings/shape.yaml delete mode 100644 Tools/ref/schemas/product.yaml delete mode 100644 Tools/ref/schemas/product_attribute_groups.yaml delete mode 100644 Tools/ref/schemas/product_base.yaml delete mode 100644 Tools/ref/schemas/product_ecoscore.yaml delete mode 100644 Tools/ref/schemas/product_extended.yaml delete mode 100644 Tools/ref/schemas/product_hidden.yaml delete mode 100644 Tools/ref/schemas/product_images.yaml delete mode 100644 Tools/ref/schemas/product_ingredients.yaml delete mode 100644 Tools/ref/schemas/product_knowledge_panels.yaml delete mode 100644 Tools/ref/schemas/product_meta.yaml delete mode 100644 Tools/ref/schemas/product_misc.yaml delete mode 100644 Tools/ref/schemas/product_nutrition.yaml delete mode 100644 Tools/ref/schemas/product_quality.yaml delete mode 100644 Tools/ref/schemas/product_tags.yaml delete mode 100644 Tools/ref/schemas/product_update_api_v3.yaml delete mode 100644 Tools/ref/schemas/tags_parameters.yaml delete mode 100644 Tools/ref/schemas/taxonomies/tagtype.yaml diff --git a/OpenFoodFactsService/Sources/Client.swift b/OpenFoodFactsService/Sources/OpenFoodFactsAPI.swift similarity index 92% rename from OpenFoodFactsService/Sources/Client.swift rename to OpenFoodFactsService/Sources/OpenFoodFactsAPI.swift index 1baeedc..5062747 100644 --- a/OpenFoodFactsService/Sources/Client.swift +++ b/OpenFoodFactsService/Sources/OpenFoodFactsAPI.swift @@ -14,7 +14,7 @@ import HTTPTypes /// and contribute to the products database. You can create great apps to /// help people make better food choices and also provide data to enhance the database. /// -public struct Client: APIProtocol { +public struct OpenFoodFactsAPI: APIProtocol { /// The underlying HTTP client. private let client: UniversalClient /// Creates a new client. @@ -48,11 +48,11 @@ public struct Client: APIProtocol { /// /// /// - Remark: HTTP `GET /api/v2/product/{barcode}`. - /// - Remark: Generated from `#/paths//api/v2/product/{barcode}/get(get-product-by-barcode)`. - public func get_hyphen_product_hyphen_by_hyphen_barcode(_ input: Operations.get_hyphen_product_hyphen_by_hyphen_barcode.Input) async throws -> Operations.get_hyphen_product_hyphen_by_hyphen_barcode.Output { + /// - Remark: Generated from `#/paths//api/v2/product/{barcode}/get(getProductByBarcode)`. + public func getProductByBarcode(_ input: Operations.getProductByBarcode.Input) async throws -> Operations.getProductByBarcode.Output { try await client.send( input: input, - forOperation: Operations.get_hyphen_product_hyphen_by_hyphen_barcode.id, + forOperation: Operations.getProductByBarcode.id, serializer: { input in let path = try converter.renderedPath( template: "/api/v2/product/{}", @@ -75,7 +75,7 @@ public struct Client: APIProtocol { switch response.status.code { case 200: let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) - let body: Operations.get_hyphen_product_hyphen_by_hyphen_barcode.Output.Ok.Body + let body: Operations.getProductByBarcode.Output.Ok.Body let chosenContentType = try converter.bestContentType( received: contentType, options: [ @@ -118,11 +118,11 @@ public struct Client: APIProtocol { /// /// /// - Remark: HTTP `GET /api/v2/product/{barcode}?fields=knowledge_panels`. - /// - Remark: Generated from `#/paths//api/v2/product/{barcode}?fields=knowledge_panels/get(get-product-by-barcode-knowledge-panels)`. - public func get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels(_ input: Operations.get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels.Input) async throws -> Operations.get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels.Output { + /// - Remark: Generated from `#/paths//api/v2/product/{barcode}?fields=knowledge_panels/get(getProductByBarcodeKnowledgePanels)`. + public func getProductByBarcodeKnowledgePanels(_ input: Operations.getProductByBarcodeKnowledgePanels.Input) async throws -> Operations.getProductByBarcodeKnowledgePanels.Output { try await client.send( input: input, - forOperation: Operations.get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels.id, + forOperation: Operations.getProductByBarcodeKnowledgePanels.id, serializer: { input in let path = try converter.renderedPath( template: "/api/v2/product/{}?fields=knowledge_panels", @@ -145,7 +145,7 @@ public struct Client: APIProtocol { switch response.status.code { case 200: let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) - let body: Operations.get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels.Output.Ok.Body + let body: Operations.getProductByBarcodeKnowledgePanels.Output.Ok.Body let chosenContentType = try converter.bestContentType( received: contentType, options: [ @@ -155,7 +155,7 @@ public struct Client: APIProtocol { switch chosenContentType { case "application/json": body = try await converter.getResponseBodyAsJSON( - Operations.get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels.Output.Ok.Body.jsonPayload.self, + Operations.getProductByBarcodeKnowledgePanels.Output.Ok.Body.jsonPayload.self, from: responseBody, transforming: { value in .json(value) @@ -183,11 +183,11 @@ public struct Client: APIProtocol { /// /// /// - Remark: HTTP `GET /cgi/ingredients.pl`. - /// - Remark: Generated from `#/paths//cgi/ingredients.pl/get(get-cgi-ingredients.pl)`. - public func get_hyphen_cgi_hyphen_ingredients_period_pl(_ input: Operations.get_hyphen_cgi_hyphen_ingredients_period_pl.Input) async throws -> Operations.get_hyphen_cgi_hyphen_ingredients_period_pl.Output { + /// - Remark: Generated from `#/paths//cgi/ingredients.pl/get(getIngredients)`. + public func getIngredients(_ input: Operations.getIngredients.Input) async throws -> Operations.getIngredients.Output { try await client.send( input: input, - forOperation: Operations.get_hyphen_cgi_hyphen_ingredients_period_pl.id, + forOperation: Operations.getIngredients.id, serializer: { input in let path = try converter.renderedPath( template: "/cgi/ingredients.pl", @@ -236,7 +236,7 @@ public struct Client: APIProtocol { switch response.status.code { case 200: let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) - let body: Operations.get_hyphen_cgi_hyphen_ingredients_period_pl.Output.Ok.Body + let body: Operations.getIngredients.Output.Ok.Body let chosenContentType = try converter.bestContentType( received: contentType, options: [ @@ -276,11 +276,11 @@ public struct Client: APIProtocol { /// /// /// - Remark: HTTP `GET /cgi/product_image_crop.pl`. - /// - Remark: Generated from `#/paths//cgi/product_image_crop.pl/get(get-cgi-product_image_crop.pl)`. - public func get_hyphen_cgi_hyphen_product_image_crop_period_pl(_ input: Operations.get_hyphen_cgi_hyphen_product_image_crop_period_pl.Input) async throws -> Operations.get_hyphen_cgi_hyphen_product_image_crop_period_pl.Output { + /// - Remark: Generated from `#/paths//cgi/product_image_crop.pl/get(getProductImageCrop)`. + public func getProductImageCrop(_ input: Operations.getProductImageCrop.Input) async throws -> Operations.getProductImageCrop.Output { try await client.send( input: input, - forOperation: Operations.get_hyphen_cgi_hyphen_product_image_crop_period_pl.id, + forOperation: Operations.getProductImageCrop.id, serializer: { input in let path = try converter.renderedPath( template: "/cgi/product_image_crop.pl", @@ -329,7 +329,7 @@ public struct Client: APIProtocol { switch response.status.code { case 200: let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) - let body: Operations.get_hyphen_cgi_hyphen_product_image_crop_period_pl.Output.Ok.Body + let body: Operations.getProductImageCrop.Output.Ok.Body let chosenContentType = try converter.bestContentType( received: contentType, options: [ @@ -368,11 +368,11 @@ public struct Client: APIProtocol { /// /// /// - Remark: HTTP `POST /cgi/product_image_crop.pl`. - /// - Remark: Generated from `#/paths//cgi/product_image_crop.pl/post(post-cgi-product_image_crop.pl)`. - public func post_hyphen_cgi_hyphen_product_image_crop_period_pl(_ input: Operations.post_hyphen_cgi_hyphen_product_image_crop_period_pl.Input) async throws -> Operations.post_hyphen_cgi_hyphen_product_image_crop_period_pl.Output { + /// - Remark: Generated from `#/paths//cgi/product_image_crop.pl/post(productImageCrop)`. + public func productImageCrop(_ input: Operations.productImageCrop.Input) async throws -> Operations.productImageCrop.Output { try await client.send( input: input, - forOperation: Operations.post_hyphen_cgi_hyphen_product_image_crop_period_pl.id, + forOperation: Operations.productImageCrop.id, serializer: { input in let path = try converter.renderedPath( template: "/cgi/product_image_crop.pl", @@ -565,7 +565,7 @@ public struct Client: APIProtocol { switch response.status.code { case 200: let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) - let body: Operations.post_hyphen_cgi_hyphen_product_image_crop_period_pl.Output.Ok.Body + let body: Operations.productImageCrop.Output.Ok.Body let chosenContentType = try converter.bestContentType( received: contentType, options: [ @@ -600,11 +600,11 @@ public struct Client: APIProtocol { /// Unselect A Photo /// /// - Remark: HTTP `POST /cgi/product_image_unselect.pl`. - /// - Remark: Generated from `#/paths//cgi/product_image_unselect.pl/post`. - public func post_sol_cgi_sol_product_image_unselect_period_pl(_ input: Operations.post_sol_cgi_sol_product_image_unselect_period_pl.Input) async throws -> Operations.post_sol_cgi_sol_product_image_unselect_period_pl.Output { + /// - Remark: Generated from `#/paths//cgi/product_image_unselect.pl/post(postProductImageUnselect)`. + public func postProductImageUnselect(_ input: Operations.postProductImageUnselect.Input) async throws -> Operations.postProductImageUnselect.Output { try await client.send( input: input, - forOperation: Operations.post_sol_cgi_sol_product_image_unselect_period_pl.id, + forOperation: Operations.postProductImageUnselect.id, serializer: { input in let path = try converter.renderedPath( template: "/cgi/product_image_unselect.pl", @@ -676,7 +676,7 @@ public struct Client: APIProtocol { switch response.status.code { case 200: let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) - let body: Operations.post_sol_cgi_sol_product_image_unselect_period_pl.Output.Ok.Body + let body: Operations.postProductImageUnselect.Output.Ok.Body let chosenContentType = try converter.bestContentType( received: contentType, options: [ @@ -686,7 +686,7 @@ public struct Client: APIProtocol { switch chosenContentType { case "application/json": body = try await converter.getResponseBodyAsJSON( - Operations.post_sol_cgi_sol_product_image_unselect_period_pl.Output.Ok.Body.jsonPayload.self, + Operations.postProductImageUnselect.Output.Ok.Body.jsonPayload.self, from: responseBody, transforming: { value in .json(value) @@ -718,11 +718,11 @@ public struct Client: APIProtocol { /// /// /// - Remark: HTTP `POST /cgi/product_jqm2.pl`. - /// - Remark: Generated from `#/paths//cgi/product_jqm2.pl/post(post-cgi-product_jqm2.pl)`. - public func post_hyphen_cgi_hyphen_product_jqm2_period_pl(_ input: Operations.post_hyphen_cgi_hyphen_product_jqm2_period_pl.Input) async throws -> Operations.post_hyphen_cgi_hyphen_product_jqm2_period_pl.Output { + /// - Remark: Generated from `#/paths//cgi/product_jqm2.pl/post(postProduct)`. + public func postProduct(_ input: Operations.postProduct.Input) async throws -> Operations.postProduct.Output { try await client.send( input: input, - forOperation: Operations.post_hyphen_cgi_hyphen_product_jqm2_period_pl.id, + forOperation: Operations.postProduct.id, serializer: { input in let path = try converter.renderedPath( template: "/cgi/product_jqm2.pl", @@ -961,7 +961,7 @@ public struct Client: APIProtocol { switch response.status.code { case 200: let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) - let body: Operations.post_hyphen_cgi_hyphen_product_jqm2_period_pl.Output.Ok.Body + let body: Operations.postProduct.Output.Ok.Body let chosenContentType = try converter.bestContentType( received: contentType, options: [ @@ -1061,11 +1061,11 @@ public struct Client: APIProtocol { /// /// /// - Remark: HTTP `GET /api/v2/search`. - /// - Remark: Generated from `#/paths//api/v2/search/get(get-search)`. - public func get_hyphen_search(_ input: Operations.get_hyphen_search.Input) async throws -> Operations.get_hyphen_search.Output { + /// - Remark: Generated from `#/paths//api/v2/search/get(searchProducts)`. + public func searchProducts(_ input: Operations.searchProducts.Input) async throws -> Operations.searchProducts.Output { try await client.send( input: input, - forOperation: Operations.get_hyphen_search.id, + forOperation: Operations.searchProducts.id, serializer: { input in let path = try converter.renderedPath( template: "/api/v2/search", @@ -1247,7 +1247,7 @@ public struct Client: APIProtocol { switch response.status.code { case 200: let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) - let body: Operations.get_hyphen_search.Output.Ok.Body + let body: Operations.searchProducts.Output.Ok.Body let chosenContentType = try converter.bestContentType( received: contentType, options: [ @@ -1288,11 +1288,11 @@ public struct Client: APIProtocol { /// /// /// - Remark: HTTP `GET /cgi/suggest.pl`. - /// - Remark: Generated from `#/paths//cgi/suggest.pl/get(get-cgi-suggest.pl)`. - public func get_hyphen_cgi_hyphen_suggest_period_pl(_ input: Operations.get_hyphen_cgi_hyphen_suggest_period_pl.Input) async throws -> Operations.get_hyphen_cgi_hyphen_suggest_period_pl.Output { + /// - Remark: Generated from `#/paths//cgi/suggest.pl/get(getSuggestions)`. + public func getSuggestions(_ input: Operations.getSuggestions.Input) async throws -> Operations.getSuggestions.Output { try await client.send( input: input, - forOperation: Operations.get_hyphen_cgi_hyphen_suggest_period_pl.id, + forOperation: Operations.getSuggestions.id, serializer: { input in let path = try converter.renderedPath( template: "/cgi/suggest.pl", @@ -1327,7 +1327,7 @@ public struct Client: APIProtocol { switch response.status.code { case 200: let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) - let body: Operations.get_hyphen_cgi_hyphen_suggest_period_pl.Output.Ok.Body + let body: Operations.getSuggestions.Output.Ok.Body let chosenContentType = try converter.bestContentType( received: contentType, options: [ @@ -1365,11 +1365,11 @@ public struct Client: APIProtocol { /// /// /// - Remark: HTTP `GET /cgi/nutrients.pl`. - /// - Remark: Generated from `#/paths//cgi/nutrients.pl/get(get-cgi-nutrients.pl)`. - public func get_hyphen_cgi_hyphen_nutrients_period_pl(_ input: Operations.get_hyphen_cgi_hyphen_nutrients_period_pl.Input) async throws -> Operations.get_hyphen_cgi_hyphen_nutrients_period_pl.Output { + /// - Remark: Generated from `#/paths//cgi/nutrients.pl/get(getNutrients)`. + public func getNutrients(_ input: Operations.getNutrients.Input) async throws -> Operations.getNutrients.Output { try await client.send( input: input, - forOperation: Operations.get_hyphen_cgi_hyphen_nutrients_period_pl.id, + forOperation: Operations.getNutrients.id, serializer: { input in let path = try converter.renderedPath( template: "/cgi/nutrients.pl", @@ -1404,7 +1404,7 @@ public struct Client: APIProtocol { switch response.status.code { case 200: let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) - let body: Operations.get_hyphen_cgi_hyphen_nutrients_period_pl.Output.Ok.Body + let body: Operations.getNutrients.Output.Ok.Body let chosenContentType = try converter.bestContentType( received: contentType, options: [ @@ -1449,11 +1449,11 @@ public struct Client: APIProtocol { /// /// /// - Remark: HTTP `GET /api/v2/attribute_groups`. - /// - Remark: Generated from `#/paths//api/v2/attribute_groups/get(get-attribute-groups)`. - public func get_hyphen_attribute_hyphen_groups(_ input: Operations.get_hyphen_attribute_hyphen_groups.Input) async throws -> Operations.get_hyphen_attribute_hyphen_groups.Output { + /// - Remark: Generated from `#/paths//api/v2/attribute_groups/get(getAttributeGroups)`. + public func getAttributeGroups(_ input: Operations.getAttributeGroups.Input) async throws -> Operations.getAttributeGroups.Output { try await client.send( input: input, - forOperation: Operations.get_hyphen_attribute_hyphen_groups.id, + forOperation: Operations.getAttributeGroups.id, serializer: { input in let path = try converter.renderedPath( template: "/api/v2/attribute_groups", @@ -1481,7 +1481,7 @@ public struct Client: APIProtocol { switch response.status.code { case 200: let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) - let body: Operations.get_hyphen_attribute_hyphen_groups.Output.Ok.Body + let body: Operations.getAttributeGroups.Output.Ok.Body let chosenContentType = try converter.bestContentType( received: contentType, options: [ @@ -1518,11 +1518,11 @@ public struct Client: APIProtocol { /// /// /// - Remark: HTTP `GET /api/v2/preferences`. - /// - Remark: Generated from `#/paths//api/v2/preferences/get(get-preferences)`. - public func get_hyphen_preferences(_ input: Operations.get_hyphen_preferences.Input) async throws -> Operations.get_hyphen_preferences.Output { + /// - Remark: Generated from `#/paths//api/v2/preferences/get(getPreferences)`. + public func getPreferences(_ input: Operations.getPreferences.Input) async throws -> Operations.getPreferences.Output { try await client.send( input: input, - forOperation: Operations.get_hyphen_preferences.id, + forOperation: Operations.getPreferences.id, serializer: { input in let path = try converter.renderedPath( template: "/api/v2/preferences", @@ -1550,7 +1550,7 @@ public struct Client: APIProtocol { switch response.status.code { case 200: let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) - let body: Operations.get_hyphen_preferences.Output.Ok.Body + let body: Operations.getPreferences.Output.Ok.Body let chosenContentType = try converter.bestContentType( received: contentType, options: [ diff --git a/OpenFoodFactsService/Sources/Types.swift b/OpenFoodFactsService/Sources/Types.swift index 3d08c51..5e537c4 100644 --- a/OpenFoodFactsService/Sources/Types.swift +++ b/OpenFoodFactsService/Sources/Types.swift @@ -18,8 +18,8 @@ public protocol APIProtocol: Sendable { /// /// /// - Remark: HTTP `GET /api/v2/product/{barcode}`. - /// - Remark: Generated from `#/paths//api/v2/product/{barcode}/get(get-product-by-barcode)`. - func get_hyphen_product_hyphen_by_hyphen_barcode(_ input: Operations.get_hyphen_product_hyphen_by_hyphen_barcode.Input) async throws -> Operations.get_hyphen_product_hyphen_by_hyphen_barcode.Output + /// - Remark: Generated from `#/paths//api/v2/product/{barcode}/get(getProductByBarcode)`. + func getProductByBarcode(_ input: Operations.getProductByBarcode.Input) async throws -> Operations.getProductByBarcode.Output /// Get Knowledge panels for a specific product by barcode /// (special case of get product) /// @@ -31,16 +31,16 @@ public protocol APIProtocol: Sendable { /// /// /// - Remark: HTTP `GET /api/v2/product/{barcode}?fields=knowledge_panels`. - /// - Remark: Generated from `#/paths//api/v2/product/{barcode}?fields=knowledge_panels/get(get-product-by-barcode-knowledge-panels)`. - func get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels(_ input: Operations.get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels.Input) async throws -> Operations.get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels.Output + /// - Remark: Generated from `#/paths//api/v2/product/{barcode}?fields=knowledge_panels/get(getProductByBarcodeKnowledgePanels)`. + func getProductByBarcodeKnowledgePanels(_ input: Operations.getProductByBarcodeKnowledgePanels.Input) async throws -> Operations.getProductByBarcodeKnowledgePanels.Output /// Performing OCR on a Product /// /// Open Food Facts uses optical character recognition (OCR) to retrieve nutritional data and other information from the product labels. /// /// /// - Remark: HTTP `GET /cgi/ingredients.pl`. - /// - Remark: Generated from `#/paths//cgi/ingredients.pl/get(get-cgi-ingredients.pl)`. - func get_hyphen_cgi_hyphen_ingredients_period_pl(_ input: Operations.get_hyphen_cgi_hyphen_ingredients_period_pl.Input) async throws -> Operations.get_hyphen_cgi_hyphen_ingredients_period_pl.Output + /// - Remark: Generated from `#/paths//cgi/ingredients.pl/get(getIngredients)`. + func getIngredients(_ input: Operations.getIngredients.Input) async throws -> Operations.getIngredients.Output /// Rotate A Photo /// /// Although we recommend rotating photos manually and uploading a new version of the image, @@ -49,8 +49,8 @@ public protocol APIProtocol: Sendable { /// /// /// - Remark: HTTP `GET /cgi/product_image_crop.pl`. - /// - Remark: Generated from `#/paths//cgi/product_image_crop.pl/get(get-cgi-product_image_crop.pl)`. - func get_hyphen_cgi_hyphen_product_image_crop_period_pl(_ input: Operations.get_hyphen_cgi_hyphen_product_image_crop_period_pl.Input) async throws -> Operations.get_hyphen_cgi_hyphen_product_image_crop_period_pl.Output + /// - Remark: Generated from `#/paths//cgi/product_image_crop.pl/get(getProductImageCrop)`. + func getProductImageCrop(_ input: Operations.getProductImageCrop.Input) async throws -> Operations.getProductImageCrop.Output /// Crop A Photo /// /// Cropping is only relevant for editing existing products. @@ -58,13 +58,13 @@ public protocol APIProtocol: Sendable { /// /// /// - Remark: HTTP `POST /cgi/product_image_crop.pl`. - /// - Remark: Generated from `#/paths//cgi/product_image_crop.pl/post(post-cgi-product_image_crop.pl)`. - func post_hyphen_cgi_hyphen_product_image_crop_period_pl(_ input: Operations.post_hyphen_cgi_hyphen_product_image_crop_period_pl.Input) async throws -> Operations.post_hyphen_cgi_hyphen_product_image_crop_period_pl.Output + /// - Remark: Generated from `#/paths//cgi/product_image_crop.pl/post(productImageCrop)`. + func productImageCrop(_ input: Operations.productImageCrop.Input) async throws -> Operations.productImageCrop.Output /// Unselect A Photo /// /// - Remark: HTTP `POST /cgi/product_image_unselect.pl`. - /// - Remark: Generated from `#/paths//cgi/product_image_unselect.pl/post`. - func post_sol_cgi_sol_product_image_unselect_period_pl(_ input: Operations.post_sol_cgi_sol_product_image_unselect_period_pl.Input) async throws -> Operations.post_sol_cgi_sol_product_image_unselect_period_pl.Output + /// - Remark: Generated from `#/paths//cgi/product_image_unselect.pl/post(postProductImageUnselect)`. + func postProductImageUnselect(_ input: Operations.postProductImageUnselect.Input) async throws -> Operations.postProductImageUnselect.Output /// Add or Edit A Product /// /// This updates a product. @@ -75,8 +75,8 @@ public protocol APIProtocol: Sendable { /// /// /// - Remark: HTTP `POST /cgi/product_jqm2.pl`. - /// - Remark: Generated from `#/paths//cgi/product_jqm2.pl/post(post-cgi-product_jqm2.pl)`. - func post_hyphen_cgi_hyphen_product_jqm2_period_pl(_ input: Operations.post_hyphen_cgi_hyphen_product_jqm2_period_pl.Input) async throws -> Operations.post_hyphen_cgi_hyphen_product_jqm2_period_pl.Output + /// - Remark: Generated from `#/paths//cgi/product_jqm2.pl/post(postProduct)`. + func postProduct(_ input: Operations.postProduct.Input) async throws -> Operations.postProduct.Output /// Search for Products /// /// Search request allows you to get products that match your search criteria. @@ -145,8 +145,8 @@ public protocol APIProtocol: Sendable { /// /// /// - Remark: HTTP `GET /api/v2/search`. - /// - Remark: Generated from `#/paths//api/v2/search/get(get-search)`. - func get_hyphen_search(_ input: Operations.get_hyphen_search.Input) async throws -> Operations.get_hyphen_search.Output + /// - Remark: Generated from `#/paths//api/v2/search/get(searchProducts)`. + func searchProducts(_ input: Operations.searchProducts.Input) async throws -> Operations.searchProducts.Output /// Get Suggestions to Aid Adding/Editing Products /// /// For example , Dave is looking for packaging_shapes that contain the term "fe", @@ -156,16 +156,16 @@ public protocol APIProtocol: Sendable { /// /// /// - Remark: HTTP `GET /cgi/suggest.pl`. - /// - Remark: Generated from `#/paths//cgi/suggest.pl/get(get-cgi-suggest.pl)`. - func get_hyphen_cgi_hyphen_suggest_period_pl(_ input: Operations.get_hyphen_cgi_hyphen_suggest_period_pl.Input) async throws -> Operations.get_hyphen_cgi_hyphen_suggest_period_pl.Output + /// - Remark: Generated from `#/paths//cgi/suggest.pl/get(getSuggestions)`. + func getSuggestions(_ input: Operations.getSuggestions.Input) async throws -> Operations.getSuggestions.Output /// Get a nested list of nutrients that can be displayed in the nutrition facts table for a specific country and language /// /// Used to display the nutrition facts table of a product, or to display a form to input those nutrition facts. /// /// /// - Remark: HTTP `GET /cgi/nutrients.pl`. - /// - Remark: Generated from `#/paths//cgi/nutrients.pl/get(get-cgi-nutrients.pl)`. - func get_hyphen_cgi_hyphen_nutrients_period_pl(_ input: Operations.get_hyphen_cgi_hyphen_nutrients_period_pl.Input) async throws -> Operations.get_hyphen_cgi_hyphen_nutrients_period_pl.Output + /// - Remark: Generated from `#/paths//cgi/nutrients.pl/get(getNutrients)`. + func getNutrients(_ input: Operations.getNutrients.Input) async throws -> Operations.getNutrients.Output /// Get the list of attributes available for personal search. /// /// Attributes are at the heart of personal search. @@ -179,15 +179,15 @@ public protocol APIProtocol: Sendable { /// /// /// - Remark: HTTP `GET /api/v2/attribute_groups`. - /// - Remark: Generated from `#/paths//api/v2/attribute_groups/get(get-attribute-groups)`. - func get_hyphen_attribute_hyphen_groups(_ input: Operations.get_hyphen_attribute_hyphen_groups.Input) async throws -> Operations.get_hyphen_attribute_hyphen_groups.Output + /// - Remark: Generated from `#/paths//api/v2/attribute_groups/get(getAttributeGroups)`. + func getAttributeGroups(_ input: Operations.getAttributeGroups.Input) async throws -> Operations.getAttributeGroups.Output /// Get the weights corresponding to attributes preferences /// to compute personal product /// /// /// - Remark: HTTP `GET /api/v2/preferences`. - /// - Remark: Generated from `#/paths//api/v2/preferences/get(get-preferences)`. - func get_hyphen_preferences(_ input: Operations.get_hyphen_preferences.Input) async throws -> Operations.get_hyphen_preferences.Output + /// - Remark: Generated from `#/paths//api/v2/preferences/get(getPreferences)`. + func getPreferences(_ input: Operations.getPreferences.Input) async throws -> Operations.getPreferences.Output } /// Convenience overloads for operation inputs. @@ -199,12 +199,12 @@ extension APIProtocol { /// /// /// - Remark: HTTP `GET /api/v2/product/{barcode}`. - /// - Remark: Generated from `#/paths//api/v2/product/{barcode}/get(get-product-by-barcode)`. - public func get_hyphen_product_hyphen_by_hyphen_barcode( - path: Operations.get_hyphen_product_hyphen_by_hyphen_barcode.Input.Path, - headers: Operations.get_hyphen_product_hyphen_by_hyphen_barcode.Input.Headers = .init() - ) async throws -> Operations.get_hyphen_product_hyphen_by_hyphen_barcode.Output { - try await get_hyphen_product_hyphen_by_hyphen_barcode(Operations.get_hyphen_product_hyphen_by_hyphen_barcode.Input( + /// - Remark: Generated from `#/paths//api/v2/product/{barcode}/get(getProductByBarcode)`. + public func getProductByBarcode( + path: Operations.getProductByBarcode.Input.Path, + headers: Operations.getProductByBarcode.Input.Headers = .init() + ) async throws -> Operations.getProductByBarcode.Output { + try await getProductByBarcode(Operations.getProductByBarcode.Input( path: path, headers: headers )) @@ -220,12 +220,12 @@ extension APIProtocol { /// /// /// - Remark: HTTP `GET /api/v2/product/{barcode}?fields=knowledge_panels`. - /// - Remark: Generated from `#/paths//api/v2/product/{barcode}?fields=knowledge_panels/get(get-product-by-barcode-knowledge-panels)`. - public func get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels( - path: Operations.get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels.Input.Path, - headers: Operations.get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels.Input.Headers = .init() - ) async throws -> Operations.get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels.Output { - try await get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels(Operations.get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels.Input( + /// - Remark: Generated from `#/paths//api/v2/product/{barcode}?fields=knowledge_panels/get(getProductByBarcodeKnowledgePanels)`. + public func getProductByBarcodeKnowledgePanels( + path: Operations.getProductByBarcodeKnowledgePanels.Input.Path, + headers: Operations.getProductByBarcodeKnowledgePanels.Input.Headers = .init() + ) async throws -> Operations.getProductByBarcodeKnowledgePanels.Output { + try await getProductByBarcodeKnowledgePanels(Operations.getProductByBarcodeKnowledgePanels.Input( path: path, headers: headers )) @@ -236,12 +236,12 @@ extension APIProtocol { /// /// /// - Remark: HTTP `GET /cgi/ingredients.pl`. - /// - Remark: Generated from `#/paths//cgi/ingredients.pl/get(get-cgi-ingredients.pl)`. - public func get_hyphen_cgi_hyphen_ingredients_period_pl( - query: Operations.get_hyphen_cgi_hyphen_ingredients_period_pl.Input.Query, - headers: Operations.get_hyphen_cgi_hyphen_ingredients_period_pl.Input.Headers = .init() - ) async throws -> Operations.get_hyphen_cgi_hyphen_ingredients_period_pl.Output { - try await get_hyphen_cgi_hyphen_ingredients_period_pl(Operations.get_hyphen_cgi_hyphen_ingredients_period_pl.Input( + /// - Remark: Generated from `#/paths//cgi/ingredients.pl/get(getIngredients)`. + public func getIngredients( + query: Operations.getIngredients.Input.Query, + headers: Operations.getIngredients.Input.Headers = .init() + ) async throws -> Operations.getIngredients.Output { + try await getIngredients(Operations.getIngredients.Input( query: query, headers: headers )) @@ -254,12 +254,12 @@ extension APIProtocol { /// /// /// - Remark: HTTP `GET /cgi/product_image_crop.pl`. - /// - Remark: Generated from `#/paths//cgi/product_image_crop.pl/get(get-cgi-product_image_crop.pl)`. - public func get_hyphen_cgi_hyphen_product_image_crop_period_pl( - query: Operations.get_hyphen_cgi_hyphen_product_image_crop_period_pl.Input.Query, - headers: Operations.get_hyphen_cgi_hyphen_product_image_crop_period_pl.Input.Headers = .init() - ) async throws -> Operations.get_hyphen_cgi_hyphen_product_image_crop_period_pl.Output { - try await get_hyphen_cgi_hyphen_product_image_crop_period_pl(Operations.get_hyphen_cgi_hyphen_product_image_crop_period_pl.Input( + /// - Remark: Generated from `#/paths//cgi/product_image_crop.pl/get(getProductImageCrop)`. + public func getProductImageCrop( + query: Operations.getProductImageCrop.Input.Query, + headers: Operations.getProductImageCrop.Input.Headers = .init() + ) async throws -> Operations.getProductImageCrop.Output { + try await getProductImageCrop(Operations.getProductImageCrop.Input( query: query, headers: headers )) @@ -271,12 +271,12 @@ extension APIProtocol { /// /// /// - Remark: HTTP `POST /cgi/product_image_crop.pl`. - /// - Remark: Generated from `#/paths//cgi/product_image_crop.pl/post(post-cgi-product_image_crop.pl)`. - public func post_hyphen_cgi_hyphen_product_image_crop_period_pl( - headers: Operations.post_hyphen_cgi_hyphen_product_image_crop_period_pl.Input.Headers = .init(), - body: Operations.post_hyphen_cgi_hyphen_product_image_crop_period_pl.Input.Body - ) async throws -> Operations.post_hyphen_cgi_hyphen_product_image_crop_period_pl.Output { - try await post_hyphen_cgi_hyphen_product_image_crop_period_pl(Operations.post_hyphen_cgi_hyphen_product_image_crop_period_pl.Input( + /// - Remark: Generated from `#/paths//cgi/product_image_crop.pl/post(productImageCrop)`. + public func productImageCrop( + headers: Operations.productImageCrop.Input.Headers = .init(), + body: Operations.productImageCrop.Input.Body + ) async throws -> Operations.productImageCrop.Output { + try await productImageCrop(Operations.productImageCrop.Input( headers: headers, body: body )) @@ -284,12 +284,12 @@ extension APIProtocol { /// Unselect A Photo /// /// - Remark: HTTP `POST /cgi/product_image_unselect.pl`. - /// - Remark: Generated from `#/paths//cgi/product_image_unselect.pl/post`. - public func post_sol_cgi_sol_product_image_unselect_period_pl( - headers: Operations.post_sol_cgi_sol_product_image_unselect_period_pl.Input.Headers = .init(), - body: Operations.post_sol_cgi_sol_product_image_unselect_period_pl.Input.Body - ) async throws -> Operations.post_sol_cgi_sol_product_image_unselect_period_pl.Output { - try await post_sol_cgi_sol_product_image_unselect_period_pl(Operations.post_sol_cgi_sol_product_image_unselect_period_pl.Input( + /// - Remark: Generated from `#/paths//cgi/product_image_unselect.pl/post(postProductImageUnselect)`. + public func postProductImageUnselect( + headers: Operations.postProductImageUnselect.Input.Headers = .init(), + body: Operations.postProductImageUnselect.Input.Body + ) async throws -> Operations.postProductImageUnselect.Output { + try await postProductImageUnselect(Operations.postProductImageUnselect.Input( headers: headers, body: body )) @@ -304,12 +304,12 @@ extension APIProtocol { /// /// /// - Remark: HTTP `POST /cgi/product_jqm2.pl`. - /// - Remark: Generated from `#/paths//cgi/product_jqm2.pl/post(post-cgi-product_jqm2.pl)`. - public func post_hyphen_cgi_hyphen_product_jqm2_period_pl( - headers: Operations.post_hyphen_cgi_hyphen_product_jqm2_period_pl.Input.Headers = .init(), - body: Operations.post_hyphen_cgi_hyphen_product_jqm2_period_pl.Input.Body - ) async throws -> Operations.post_hyphen_cgi_hyphen_product_jqm2_period_pl.Output { - try await post_hyphen_cgi_hyphen_product_jqm2_period_pl(Operations.post_hyphen_cgi_hyphen_product_jqm2_period_pl.Input( + /// - Remark: Generated from `#/paths//cgi/product_jqm2.pl/post(postProduct)`. + public func postProduct( + headers: Operations.postProduct.Input.Headers = .init(), + body: Operations.postProduct.Input.Body + ) async throws -> Operations.postProduct.Output { + try await postProduct(Operations.postProduct.Input( headers: headers, body: body )) @@ -382,12 +382,12 @@ extension APIProtocol { /// /// /// - Remark: HTTP `GET /api/v2/search`. - /// - Remark: Generated from `#/paths//api/v2/search/get(get-search)`. - public func get_hyphen_search( - query: Operations.get_hyphen_search.Input.Query = .init(), - headers: Operations.get_hyphen_search.Input.Headers = .init() - ) async throws -> Operations.get_hyphen_search.Output { - try await get_hyphen_search(Operations.get_hyphen_search.Input( + /// - Remark: Generated from `#/paths//api/v2/search/get(searchProducts)`. + public func searchProducts( + query: Operations.searchProducts.Input.Query = .init(), + headers: Operations.searchProducts.Input.Headers = .init() + ) async throws -> Operations.searchProducts.Output { + try await searchProducts(Operations.searchProducts.Input( query: query, headers: headers )) @@ -401,12 +401,12 @@ extension APIProtocol { /// /// /// - Remark: HTTP `GET /cgi/suggest.pl`. - /// - Remark: Generated from `#/paths//cgi/suggest.pl/get(get-cgi-suggest.pl)`. - public func get_hyphen_cgi_hyphen_suggest_period_pl( - query: Operations.get_hyphen_cgi_hyphen_suggest_period_pl.Input.Query = .init(), - headers: Operations.get_hyphen_cgi_hyphen_suggest_period_pl.Input.Headers = .init() - ) async throws -> Operations.get_hyphen_cgi_hyphen_suggest_period_pl.Output { - try await get_hyphen_cgi_hyphen_suggest_period_pl(Operations.get_hyphen_cgi_hyphen_suggest_period_pl.Input( + /// - Remark: Generated from `#/paths//cgi/suggest.pl/get(getSuggestions)`. + public func getSuggestions( + query: Operations.getSuggestions.Input.Query = .init(), + headers: Operations.getSuggestions.Input.Headers = .init() + ) async throws -> Operations.getSuggestions.Output { + try await getSuggestions(Operations.getSuggestions.Input( query: query, headers: headers )) @@ -417,12 +417,12 @@ extension APIProtocol { /// /// /// - Remark: HTTP `GET /cgi/nutrients.pl`. - /// - Remark: Generated from `#/paths//cgi/nutrients.pl/get(get-cgi-nutrients.pl)`. - public func get_hyphen_cgi_hyphen_nutrients_period_pl( - query: Operations.get_hyphen_cgi_hyphen_nutrients_period_pl.Input.Query = .init(), - headers: Operations.get_hyphen_cgi_hyphen_nutrients_period_pl.Input.Headers = .init() - ) async throws -> Operations.get_hyphen_cgi_hyphen_nutrients_period_pl.Output { - try await get_hyphen_cgi_hyphen_nutrients_period_pl(Operations.get_hyphen_cgi_hyphen_nutrients_period_pl.Input( + /// - Remark: Generated from `#/paths//cgi/nutrients.pl/get(getNutrients)`. + public func getNutrients( + query: Operations.getNutrients.Input.Query = .init(), + headers: Operations.getNutrients.Input.Headers = .init() + ) async throws -> Operations.getNutrients.Output { + try await getNutrients(Operations.getNutrients.Input( query: query, headers: headers )) @@ -440,12 +440,12 @@ extension APIProtocol { /// /// /// - Remark: HTTP `GET /api/v2/attribute_groups`. - /// - Remark: Generated from `#/paths//api/v2/attribute_groups/get(get-attribute-groups)`. - public func get_hyphen_attribute_hyphen_groups( - query: Operations.get_hyphen_attribute_hyphen_groups.Input.Query = .init(), - headers: Operations.get_hyphen_attribute_hyphen_groups.Input.Headers = .init() - ) async throws -> Operations.get_hyphen_attribute_hyphen_groups.Output { - try await get_hyphen_attribute_hyphen_groups(Operations.get_hyphen_attribute_hyphen_groups.Input( + /// - Remark: Generated from `#/paths//api/v2/attribute_groups/get(getAttributeGroups)`. + public func getAttributeGroups( + query: Operations.getAttributeGroups.Input.Query = .init(), + headers: Operations.getAttributeGroups.Input.Headers = .init() + ) async throws -> Operations.getAttributeGroups.Output { + try await getAttributeGroups(Operations.getAttributeGroups.Input( query: query, headers: headers )) @@ -455,12 +455,12 @@ extension APIProtocol { /// /// /// - Remark: HTTP `GET /api/v2/preferences`. - /// - Remark: Generated from `#/paths//api/v2/preferences/get(get-preferences)`. - public func get_hyphen_preferences( - query: Operations.get_hyphen_preferences.Input.Query = .init(), - headers: Operations.get_hyphen_preferences.Input.Headers = .init() - ) async throws -> Operations.get_hyphen_preferences.Output { - try await get_hyphen_preferences(Operations.get_hyphen_preferences.Input( + /// - Remark: Generated from `#/paths//api/v2/preferences/get(getPreferences)`. + public func getPreferences( + query: Operations.getPreferences.Input.Query = .init(), + headers: Operations.getPreferences.Input.Headers = .init() + ) async throws -> Operations.getPreferences.Output { + try await getPreferences(Operations.getPreferences.Input( query: query, headers: headers )) @@ -6527,9 +6527,9 @@ public enum Operations { /// /// /// - Remark: HTTP `GET /api/v2/product/{barcode}`. - /// - Remark: Generated from `#/paths//api/v2/product/{barcode}/get(get-product-by-barcode)`. - public enum get_hyphen_product_hyphen_by_hyphen_barcode { - public static let id: Swift.String = "get-product-by-barcode" + /// - Remark: Generated from `#/paths//api/v2/product/{barcode}/get(getProductByBarcode)`. + public enum getProductByBarcode { + public static let id: Swift.String = "getProductByBarcode" public struct Input: Sendable, Hashable { /// - Remark: Generated from `#/paths/api/v2/product/{barcode}/GET/path`. public struct Path: Sendable, Hashable { @@ -6546,27 +6546,27 @@ public enum Operations { self.barcode = barcode } } - public var path: Operations.get_hyphen_product_hyphen_by_hyphen_barcode.Input.Path + public var path: Operations.getProductByBarcode.Input.Path /// - Remark: Generated from `#/paths/api/v2/product/{barcode}/GET/header`. public struct Headers: Sendable, Hashable { - public var accept: [OpenAPIRuntime.AcceptHeaderContentType] + public var accept: [OpenAPIRuntime.AcceptHeaderContentType] /// Creates a new `Headers`. /// /// - Parameters: /// - accept: - public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { self.accept = accept } } - public var headers: Operations.get_hyphen_product_hyphen_by_hyphen_barcode.Input.Headers + public var headers: Operations.getProductByBarcode.Input.Headers /// Creates a new `Input`. /// /// - Parameters: /// - path: /// - headers: public init( - path: Operations.get_hyphen_product_hyphen_by_hyphen_barcode.Input.Path, - headers: Operations.get_hyphen_product_hyphen_by_hyphen_barcode.Input.Headers = .init() + path: Operations.getProductByBarcode.Input.Path, + headers: Operations.getProductByBarcode.Input.Headers = .init() ) { self.path = path self.headers = headers @@ -6592,26 +6592,26 @@ public enum Operations { } } /// Received HTTP response body - public var body: Operations.get_hyphen_product_hyphen_by_hyphen_barcode.Output.Ok.Body + public var body: Operations.getProductByBarcode.Output.Ok.Body /// Creates a new `Ok`. /// /// - Parameters: /// - body: Received HTTP response body - public init(body: Operations.get_hyphen_product_hyphen_by_hyphen_barcode.Output.Ok.Body) { + public init(body: Operations.getProductByBarcode.Output.Ok.Body) { self.body = body } } /// OK /// - /// - Remark: Generated from `#/paths//api/v2/product/{barcode}/get(get-product-by-barcode)/responses/200`. + /// - Remark: Generated from `#/paths//api/v2/product/{barcode}/get(getProductByBarcode)/responses/200`. /// /// HTTP response code: `200 ok`. - case ok(Operations.get_hyphen_product_hyphen_by_hyphen_barcode.Output.Ok) + case ok(Operations.getProductByBarcode.Output.Ok) /// The associated value of the enum case if `self` is `.ok`. /// /// - Throws: An error if `self` is not `.ok`. /// - SeeAlso: `.ok`. - public var ok: Operations.get_hyphen_product_hyphen_by_hyphen_barcode.Output.Ok { + public var ok: Operations.getProductByBarcode.Output.Ok { get throws { switch self { case let .ok(response): @@ -6666,9 +6666,9 @@ public enum Operations { /// /// /// - Remark: HTTP `GET /api/v2/product/{barcode}?fields=knowledge_panels`. - /// - Remark: Generated from `#/paths//api/v2/product/{barcode}?fields=knowledge_panels/get(get-product-by-barcode-knowledge-panels)`. - public enum get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels { - public static let id: Swift.String = "get-product-by-barcode-knowledge-panels" + /// - Remark: Generated from `#/paths//api/v2/product/{barcode}?fields=knowledge_panels/get(getProductByBarcodeKnowledgePanels)`. + public enum getProductByBarcodeKnowledgePanels { + public static let id: Swift.String = "getProductByBarcodeKnowledgePanels" public struct Input: Sendable, Hashable { /// - Remark: Generated from `#/paths/api/v2/product/{barcode}?fields=knowledge_panels/GET/path`. public struct Path: Sendable, Hashable { @@ -6685,27 +6685,27 @@ public enum Operations { self.barcode = barcode } } - public var path: Operations.get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels.Input.Path + public var path: Operations.getProductByBarcodeKnowledgePanels.Input.Path /// - Remark: Generated from `#/paths/api/v2/product/{barcode}?fields=knowledge_panels/GET/header`. public struct Headers: Sendable, Hashable { - public var accept: [OpenAPIRuntime.AcceptHeaderContentType] + public var accept: [OpenAPIRuntime.AcceptHeaderContentType] /// Creates a new `Headers`. /// /// - Parameters: /// - accept: - public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { self.accept = accept } } - public var headers: Operations.get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels.Input.Headers + public var headers: Operations.getProductByBarcodeKnowledgePanels.Input.Headers /// Creates a new `Input`. /// /// - Parameters: /// - path: /// - headers: public init( - path: Operations.get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels.Input.Path, - headers: Operations.get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels.Input.Headers = .init() + path: Operations.getProductByBarcodeKnowledgePanels.Input.Path, + headers: Operations.getProductByBarcodeKnowledgePanels.Input.Headers = .init() ) { self.path = path self.headers = headers @@ -6735,7 +6735,7 @@ public enum Operations { } } /// - Remark: Generated from `#/paths/api/v2/product/{barcode}?fields=knowledge_panels/GET/responses/200/content/json/value2`. - public var value2: Operations.get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels.Output.Ok.Body.jsonPayload.Value2Payload + public var value2: Operations.getProductByBarcodeKnowledgePanels.Output.Ok.Body.jsonPayload.Value2Payload /// Creates a new `jsonPayload`. /// /// - Parameters: @@ -6743,7 +6743,7 @@ public enum Operations { /// - value2: public init( value1: Components.Schemas.get_product_by_barcode_base, - value2: Operations.get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels.Output.Ok.Body.jsonPayload.Value2Payload + value2: Operations.getProductByBarcodeKnowledgePanels.Output.Ok.Body.jsonPayload.Value2Payload ) { self.value1 = value1 self.value2 = value2 @@ -6758,12 +6758,12 @@ public enum Operations { } } /// - Remark: Generated from `#/paths/api/v2/product/{barcode}?fields=knowledge_panels/GET/responses/200/content/application\/json`. - case json(Operations.get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels.Output.Ok.Body.jsonPayload) + case json(Operations.getProductByBarcodeKnowledgePanels.Output.Ok.Body.jsonPayload) /// The associated value of the enum case if `self` is `.json`. /// /// - Throws: An error if `self` is not `.json`. /// - SeeAlso: `.json`. - public var json: Operations.get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels.Output.Ok.Body.jsonPayload { + public var json: Operations.getProductByBarcodeKnowledgePanels.Output.Ok.Body.jsonPayload { get throws { switch self { case let .json(body): @@ -6773,26 +6773,26 @@ public enum Operations { } } /// Received HTTP response body - public var body: Operations.get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels.Output.Ok.Body + public var body: Operations.getProductByBarcodeKnowledgePanels.Output.Ok.Body /// Creates a new `Ok`. /// /// - Parameters: /// - body: Received HTTP response body - public init(body: Operations.get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels.Output.Ok.Body) { + public init(body: Operations.getProductByBarcodeKnowledgePanels.Output.Ok.Body) { self.body = body } } /// OK /// - /// - Remark: Generated from `#/paths//api/v2/product/{barcode}?fields=knowledge_panels/get(get-product-by-barcode-knowledge-panels)/responses/200`. + /// - Remark: Generated from `#/paths//api/v2/product/{barcode}?fields=knowledge_panels/get(getProductByBarcodeKnowledgePanels)/responses/200`. /// /// HTTP response code: `200 ok`. - case ok(Operations.get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels.Output.Ok) + case ok(Operations.getProductByBarcodeKnowledgePanels.Output.Ok) /// The associated value of the enum case if `self` is `.ok`. /// /// - Throws: An error if `self` is not `.ok`. /// - SeeAlso: `.ok`. - public var ok: Operations.get_hyphen_product_hyphen_by_hyphen_barcode_hyphen_knowledge_hyphen_panels.Output.Ok { + public var ok: Operations.getProductByBarcodeKnowledgePanels.Output.Ok { get throws { switch self { case let .ok(response): @@ -6842,9 +6842,9 @@ public enum Operations { /// /// /// - Remark: HTTP `GET /cgi/ingredients.pl`. - /// - Remark: Generated from `#/paths//cgi/ingredients.pl/get(get-cgi-ingredients.pl)`. - public enum get_hyphen_cgi_hyphen_ingredients_period_pl { - public static let id: Swift.String = "get-cgi-ingredients.pl" + /// - Remark: Generated from `#/paths//cgi/ingredients.pl/get(getIngredients)`. + public enum getIngredients { + public static let id: Swift.String = "getIngredients" public struct Input: Sendable, Hashable { /// - Remark: Generated from `#/paths/cgi/ingredients.pl/GET/query`. public struct Query: Sendable, Hashable { @@ -6877,27 +6877,27 @@ public enum Operations { self.ocr_engine = ocr_engine } } - public var query: Operations.get_hyphen_cgi_hyphen_ingredients_period_pl.Input.Query + public var query: Operations.getIngredients.Input.Query /// - Remark: Generated from `#/paths/cgi/ingredients.pl/GET/header`. public struct Headers: Sendable, Hashable { - public var accept: [OpenAPIRuntime.AcceptHeaderContentType] + public var accept: [OpenAPIRuntime.AcceptHeaderContentType] /// Creates a new `Headers`. /// /// - Parameters: /// - accept: - public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { self.accept = accept } } - public var headers: Operations.get_hyphen_cgi_hyphen_ingredients_period_pl.Input.Headers + public var headers: Operations.getIngredients.Input.Headers /// Creates a new `Input`. /// /// - Parameters: /// - query: /// - headers: public init( - query: Operations.get_hyphen_cgi_hyphen_ingredients_period_pl.Input.Query, - headers: Operations.get_hyphen_cgi_hyphen_ingredients_period_pl.Input.Headers = .init() + query: Operations.getIngredients.Input.Query, + headers: Operations.getIngredients.Input.Headers = .init() ) { self.query = query self.headers = headers @@ -6923,26 +6923,26 @@ public enum Operations { } } /// Received HTTP response body - public var body: Operations.get_hyphen_cgi_hyphen_ingredients_period_pl.Output.Ok.Body + public var body: Operations.getIngredients.Output.Ok.Body /// Creates a new `Ok`. /// /// - Parameters: /// - body: Received HTTP response body - public init(body: Operations.get_hyphen_cgi_hyphen_ingredients_period_pl.Output.Ok.Body) { + public init(body: Operations.getIngredients.Output.Ok.Body) { self.body = body } } /// OK /// - /// - Remark: Generated from `#/paths//cgi/ingredients.pl/get(get-cgi-ingredients.pl)/responses/200`. + /// - Remark: Generated from `#/paths//cgi/ingredients.pl/get(getIngredients)/responses/200`. /// /// HTTP response code: `200 ok`. - case ok(Operations.get_hyphen_cgi_hyphen_ingredients_period_pl.Output.Ok) + case ok(Operations.getIngredients.Output.Ok) /// The associated value of the enum case if `self` is `.ok`. /// /// - Throws: An error if `self` is not `.ok`. /// - SeeAlso: `.ok`. - public var ok: Operations.get_hyphen_cgi_hyphen_ingredients_period_pl.Output.Ok { + public var ok: Operations.getIngredients.Output.Ok { get throws { switch self { case let .ok(response): @@ -6994,9 +6994,9 @@ public enum Operations { /// /// /// - Remark: HTTP `GET /cgi/product_image_crop.pl`. - /// - Remark: Generated from `#/paths//cgi/product_image_crop.pl/get(get-cgi-product_image_crop.pl)`. - public enum get_hyphen_cgi_hyphen_product_image_crop_period_pl { - public static let id: Swift.String = "get-cgi-product_image_crop.pl" + /// - Remark: Generated from `#/paths//cgi/product_image_crop.pl/get(getProductImageCrop)`. + public enum getProductImageCrop { + public static let id: Swift.String = "getProductImageCrop" public struct Input: Sendable, Hashable { /// - Remark: Generated from `#/paths/cgi/product_image_crop.pl/GET/query`. public struct Query: Sendable, Hashable { @@ -7029,27 +7029,27 @@ public enum Operations { self.angle = angle } } - public var query: Operations.get_hyphen_cgi_hyphen_product_image_crop_period_pl.Input.Query + public var query: Operations.getProductImageCrop.Input.Query /// - Remark: Generated from `#/paths/cgi/product_image_crop.pl/GET/header`. public struct Headers: Sendable, Hashable { - public var accept: [OpenAPIRuntime.AcceptHeaderContentType] + public var accept: [OpenAPIRuntime.AcceptHeaderContentType] /// Creates a new `Headers`. /// /// - Parameters: /// - accept: - public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { self.accept = accept } } - public var headers: Operations.get_hyphen_cgi_hyphen_product_image_crop_period_pl.Input.Headers + public var headers: Operations.getProductImageCrop.Input.Headers /// Creates a new `Input`. /// /// - Parameters: /// - query: /// - headers: public init( - query: Operations.get_hyphen_cgi_hyphen_product_image_crop_period_pl.Input.Query, - headers: Operations.get_hyphen_cgi_hyphen_product_image_crop_period_pl.Input.Headers = .init() + query: Operations.getProductImageCrop.Input.Query, + headers: Operations.getProductImageCrop.Input.Headers = .init() ) { self.query = query self.headers = headers @@ -7075,26 +7075,26 @@ public enum Operations { } } /// Received HTTP response body - public var body: Operations.get_hyphen_cgi_hyphen_product_image_crop_period_pl.Output.Ok.Body + public var body: Operations.getProductImageCrop.Output.Ok.Body /// Creates a new `Ok`. /// /// - Parameters: /// - body: Received HTTP response body - public init(body: Operations.get_hyphen_cgi_hyphen_product_image_crop_period_pl.Output.Ok.Body) { + public init(body: Operations.getProductImageCrop.Output.Ok.Body) { self.body = body } } /// OK /// - /// - Remark: Generated from `#/paths//cgi/product_image_crop.pl/get(get-cgi-product_image_crop.pl)/responses/200`. + /// - Remark: Generated from `#/paths//cgi/product_image_crop.pl/get(getProductImageCrop)/responses/200`. /// /// HTTP response code: `200 ok`. - case ok(Operations.get_hyphen_cgi_hyphen_product_image_crop_period_pl.Output.Ok) + case ok(Operations.getProductImageCrop.Output.Ok) /// The associated value of the enum case if `self` is `.ok`. /// /// - Throws: An error if `self` is not `.ok`. /// - SeeAlso: `.ok`. - public var ok: Operations.get_hyphen_cgi_hyphen_product_image_crop_period_pl.Output.Ok { + public var ok: Operations.getProductImageCrop.Output.Ok { get throws { switch self { case let .ok(response): @@ -7145,36 +7145,36 @@ public enum Operations { /// /// /// - Remark: HTTP `POST /cgi/product_image_crop.pl`. - /// - Remark: Generated from `#/paths//cgi/product_image_crop.pl/post(post-cgi-product_image_crop.pl)`. - public enum post_hyphen_cgi_hyphen_product_image_crop_period_pl { - public static let id: Swift.String = "post-cgi-product_image_crop.pl" + /// - Remark: Generated from `#/paths//cgi/product_image_crop.pl/post(productImageCrop)`. + public enum productImageCrop { + public static let id: Swift.String = "productImageCrop" public struct Input: Sendable, Hashable { /// - Remark: Generated from `#/paths/cgi/product_image_crop.pl/POST/header`. public struct Headers: Sendable, Hashable { - public var accept: [OpenAPIRuntime.AcceptHeaderContentType] + public var accept: [OpenAPIRuntime.AcceptHeaderContentType] /// Creates a new `Headers`. /// /// - Parameters: /// - accept: - public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { self.accept = accept } } - public var headers: Operations.post_hyphen_cgi_hyphen_product_image_crop_period_pl.Input.Headers + public var headers: Operations.productImageCrop.Input.Headers /// - Remark: Generated from `#/paths/cgi/product_image_crop.pl/POST/requestBody`. @frozen public enum Body: Sendable, Hashable { /// - Remark: Generated from `#/paths/cgi/product_image_crop.pl/POST/requestBody/content/multipart\/form-data`. case multipartForm(OpenAPIRuntime.MultipartBody) } - public var body: Operations.post_hyphen_cgi_hyphen_product_image_crop_period_pl.Input.Body + public var body: Operations.productImageCrop.Input.Body /// Creates a new `Input`. /// /// - Parameters: /// - headers: /// - body: public init( - headers: Operations.post_hyphen_cgi_hyphen_product_image_crop_period_pl.Input.Headers = .init(), - body: Operations.post_hyphen_cgi_hyphen_product_image_crop_period_pl.Input.Body + headers: Operations.productImageCrop.Input.Headers = .init(), + body: Operations.productImageCrop.Input.Body ) { self.headers = headers self.body = body @@ -7200,26 +7200,26 @@ public enum Operations { } } /// Received HTTP response body - public var body: Operations.post_hyphen_cgi_hyphen_product_image_crop_period_pl.Output.Ok.Body + public var body: Operations.productImageCrop.Output.Ok.Body /// Creates a new `Ok`. /// /// - Parameters: /// - body: Received HTTP response body - public init(body: Operations.post_hyphen_cgi_hyphen_product_image_crop_period_pl.Output.Ok.Body) { + public init(body: Operations.productImageCrop.Output.Ok.Body) { self.body = body } } /// OK /// - /// - Remark: Generated from `#/paths//cgi/product_image_crop.pl/post(post-cgi-product_image_crop.pl)/responses/200`. + /// - Remark: Generated from `#/paths//cgi/product_image_crop.pl/post(productImageCrop)/responses/200`. /// /// HTTP response code: `200 ok`. - case ok(Operations.post_hyphen_cgi_hyphen_product_image_crop_period_pl.Output.Ok) + case ok(Operations.productImageCrop.Output.Ok) /// The associated value of the enum case if `self` is `.ok`. /// /// - Throws: An error if `self` is not `.ok`. /// - SeeAlso: `.ok`. - public var ok: Operations.post_hyphen_cgi_hyphen_product_image_crop_period_pl.Output.Ok { + public var ok: Operations.productImageCrop.Output.Ok { get throws { switch self { case let .ok(response): @@ -7266,36 +7266,36 @@ public enum Operations { /// Unselect A Photo /// /// - Remark: HTTP `POST /cgi/product_image_unselect.pl`. - /// - Remark: Generated from `#/paths//cgi/product_image_unselect.pl/post`. - public enum post_sol_cgi_sol_product_image_unselect_period_pl { - public static let id: Swift.String = "post/cgi/product_image_unselect.pl" + /// - Remark: Generated from `#/paths//cgi/product_image_unselect.pl/post(postProductImageUnselect)`. + public enum postProductImageUnselect { + public static let id: Swift.String = "postProductImageUnselect" public struct Input: Sendable, Hashable { /// - Remark: Generated from `#/paths/cgi/product_image_unselect.pl/POST/header`. public struct Headers: Sendable, Hashable { - public var accept: [OpenAPIRuntime.AcceptHeaderContentType] + public var accept: [OpenAPIRuntime.AcceptHeaderContentType] /// Creates a new `Headers`. /// /// - Parameters: /// - accept: - public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { self.accept = accept } } - public var headers: Operations.post_sol_cgi_sol_product_image_unselect_period_pl.Input.Headers + public var headers: Operations.postProductImageUnselect.Input.Headers /// - Remark: Generated from `#/paths/cgi/product_image_unselect.pl/POST/requestBody`. @frozen public enum Body: Sendable, Hashable { /// - Remark: Generated from `#/paths/cgi/product_image_unselect.pl/POST/requestBody/content/multipart\/form-data`. case multipartForm(OpenAPIRuntime.MultipartBody) } - public var body: Operations.post_sol_cgi_sol_product_image_unselect_period_pl.Input.Body + public var body: Operations.postProductImageUnselect.Input.Body /// Creates a new `Input`. /// /// - Parameters: /// - headers: /// - body: public init( - headers: Operations.post_sol_cgi_sol_product_image_unselect_period_pl.Input.Headers = .init(), - body: Operations.post_sol_cgi_sol_product_image_unselect_period_pl.Input.Body + headers: Operations.postProductImageUnselect.Input.Headers = .init(), + body: Operations.postProductImageUnselect.Input.Body ) { self.headers = headers self.body = body @@ -7341,12 +7341,12 @@ public enum Operations { } } /// - Remark: Generated from `#/paths/cgi/product_image_unselect.pl/POST/responses/200/content/application\/json`. - case json(Operations.post_sol_cgi_sol_product_image_unselect_period_pl.Output.Ok.Body.jsonPayload) + case json(Operations.postProductImageUnselect.Output.Ok.Body.jsonPayload) /// The associated value of the enum case if `self` is `.json`. /// /// - Throws: An error if `self` is not `.json`. /// - SeeAlso: `.json`. - public var json: Operations.post_sol_cgi_sol_product_image_unselect_period_pl.Output.Ok.Body.jsonPayload { + public var json: Operations.postProductImageUnselect.Output.Ok.Body.jsonPayload { get throws { switch self { case let .json(body): @@ -7356,26 +7356,26 @@ public enum Operations { } } /// Received HTTP response body - public var body: Operations.post_sol_cgi_sol_product_image_unselect_period_pl.Output.Ok.Body + public var body: Operations.postProductImageUnselect.Output.Ok.Body /// Creates a new `Ok`. /// /// - Parameters: /// - body: Received HTTP response body - public init(body: Operations.post_sol_cgi_sol_product_image_unselect_period_pl.Output.Ok.Body) { + public init(body: Operations.postProductImageUnselect.Output.Ok.Body) { self.body = body } } /// OK /// - /// - Remark: Generated from `#/paths//cgi/product_image_unselect.pl/post/responses/200`. + /// - Remark: Generated from `#/paths//cgi/product_image_unselect.pl/post(postProductImageUnselect)/responses/200`. /// /// HTTP response code: `200 ok`. - case ok(Operations.post_sol_cgi_sol_product_image_unselect_period_pl.Output.Ok) + case ok(Operations.postProductImageUnselect.Output.Ok) /// The associated value of the enum case if `self` is `.ok`. /// /// - Throws: An error if `self` is not `.ok`. /// - SeeAlso: `.ok`. - public var ok: Operations.post_sol_cgi_sol_product_image_unselect_period_pl.Output.Ok { + public var ok: Operations.postProductImageUnselect.Output.Ok { get throws { switch self { case let .ok(response): @@ -7429,36 +7429,36 @@ public enum Operations { /// /// /// - Remark: HTTP `POST /cgi/product_jqm2.pl`. - /// - Remark: Generated from `#/paths//cgi/product_jqm2.pl/post(post-cgi-product_jqm2.pl)`. - public enum post_hyphen_cgi_hyphen_product_jqm2_period_pl { - public static let id: Swift.String = "post-cgi-product_jqm2.pl" + /// - Remark: Generated from `#/paths//cgi/product_jqm2.pl/post(postProduct)`. + public enum postProduct { + public static let id: Swift.String = "postProduct" public struct Input: Sendable, Hashable { /// - Remark: Generated from `#/paths/cgi/product_jqm2.pl/POST/header`. public struct Headers: Sendable, Hashable { - public var accept: [OpenAPIRuntime.AcceptHeaderContentType] + public var accept: [OpenAPIRuntime.AcceptHeaderContentType] /// Creates a new `Headers`. /// /// - Parameters: /// - accept: - public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { self.accept = accept } } - public var headers: Operations.post_hyphen_cgi_hyphen_product_jqm2_period_pl.Input.Headers + public var headers: Operations.postProduct.Input.Headers /// - Remark: Generated from `#/paths/cgi/product_jqm2.pl/POST/requestBody`. @frozen public enum Body: Sendable, Hashable { /// - Remark: Generated from `#/paths/cgi/product_jqm2.pl/POST/requestBody/content/multipart\/form-data`. case multipartForm(OpenAPIRuntime.MultipartBody) } - public var body: Operations.post_hyphen_cgi_hyphen_product_jqm2_period_pl.Input.Body + public var body: Operations.postProduct.Input.Body /// Creates a new `Input`. /// /// - Parameters: /// - headers: /// - body: public init( - headers: Operations.post_hyphen_cgi_hyphen_product_jqm2_period_pl.Input.Headers = .init(), - body: Operations.post_hyphen_cgi_hyphen_product_jqm2_period_pl.Input.Body + headers: Operations.postProduct.Input.Headers = .init(), + body: Operations.postProduct.Input.Body ) { self.headers = headers self.body = body @@ -7484,26 +7484,26 @@ public enum Operations { } } /// Received HTTP response body - public var body: Operations.post_hyphen_cgi_hyphen_product_jqm2_period_pl.Output.Ok.Body + public var body: Operations.postProduct.Output.Ok.Body /// Creates a new `Ok`. /// /// - Parameters: /// - body: Received HTTP response body - public init(body: Operations.post_hyphen_cgi_hyphen_product_jqm2_period_pl.Output.Ok.Body) { + public init(body: Operations.postProduct.Output.Ok.Body) { self.body = body } } /// OK /// - /// - Remark: Generated from `#/paths//cgi/product_jqm2.pl/post(post-cgi-product_jqm2.pl)/responses/200`. + /// - Remark: Generated from `#/paths//cgi/product_jqm2.pl/post(postProduct)/responses/200`. /// /// HTTP response code: `200 ok`. - case ok(Operations.post_hyphen_cgi_hyphen_product_jqm2_period_pl.Output.Ok) + case ok(Operations.postProduct.Output.Ok) /// The associated value of the enum case if `self` is `.ok`. /// /// - Throws: An error if `self` is not `.ok`. /// - SeeAlso: `.ok`. - public var ok: Operations.post_hyphen_cgi_hyphen_product_jqm2_period_pl.Output.Ok { + public var ok: Operations.postProduct.Output.Ok { get throws { switch self { case let .ok(response): @@ -7615,9 +7615,9 @@ public enum Operations { /// /// /// - Remark: HTTP `GET /api/v2/search`. - /// - Remark: Generated from `#/paths//api/v2/search/get(get-search)`. - public enum get_hyphen_search { - public static let id: Swift.String = "get-search" + /// - Remark: Generated from `#/paths//api/v2/search/get(searchProducts)`. + public enum searchProducts { + public static let id: Swift.String = "searchProducts" public struct Input: Sendable, Hashable { /// - Remark: Generated from `#/paths/api/v2/search/GET/query`. public struct Query: Sendable, Hashable { @@ -7983,27 +7983,27 @@ public enum Operations { self.page_size = page_size } } - public var query: Operations.get_hyphen_search.Input.Query + public var query: Operations.searchProducts.Input.Query /// - Remark: Generated from `#/paths/api/v2/search/GET/header`. public struct Headers: Sendable, Hashable { - public var accept: [OpenAPIRuntime.AcceptHeaderContentType] + public var accept: [OpenAPIRuntime.AcceptHeaderContentType] /// Creates a new `Headers`. /// /// - Parameters: /// - accept: - public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { self.accept = accept } } - public var headers: Operations.get_hyphen_search.Input.Headers + public var headers: Operations.searchProducts.Input.Headers /// Creates a new `Input`. /// /// - Parameters: /// - query: /// - headers: public init( - query: Operations.get_hyphen_search.Input.Query = .init(), - headers: Operations.get_hyphen_search.Input.Headers = .init() + query: Operations.searchProducts.Input.Query = .init(), + headers: Operations.searchProducts.Input.Headers = .init() ) { self.query = query self.headers = headers @@ -8029,26 +8029,26 @@ public enum Operations { } } /// Received HTTP response body - public var body: Operations.get_hyphen_search.Output.Ok.Body + public var body: Operations.searchProducts.Output.Ok.Body /// Creates a new `Ok`. /// /// - Parameters: /// - body: Received HTTP response body - public init(body: Operations.get_hyphen_search.Output.Ok.Body) { + public init(body: Operations.searchProducts.Output.Ok.Body) { self.body = body } } /// OK /// - /// - Remark: Generated from `#/paths//api/v2/search/get(get-search)/responses/200`. + /// - Remark: Generated from `#/paths//api/v2/search/get(searchProducts)/responses/200`. /// /// HTTP response code: `200 ok`. - case ok(Operations.get_hyphen_search.Output.Ok) + case ok(Operations.searchProducts.Output.Ok) /// The associated value of the enum case if `self` is `.ok`. /// /// - Throws: An error if `self` is not `.ok`. /// - SeeAlso: `.ok`. - public var ok: Operations.get_hyphen_search.Output.Ok { + public var ok: Operations.searchProducts.Output.Ok { get throws { switch self { case let .ok(response): @@ -8101,9 +8101,9 @@ public enum Operations { /// /// /// - Remark: HTTP `GET /cgi/suggest.pl`. - /// - Remark: Generated from `#/paths//cgi/suggest.pl/get(get-cgi-suggest.pl)`. - public enum get_hyphen_cgi_hyphen_suggest_period_pl { - public static let id: Swift.String = "get-cgi-suggest.pl" + /// - Remark: Generated from `#/paths//cgi/suggest.pl/get(getSuggestions)`. + public enum getSuggestions { + public static let id: Swift.String = "getSuggestions" public struct Input: Sendable, Hashable { /// - Remark: Generated from `#/paths/cgi/suggest.pl/GET/query`. public struct Query: Sendable, Hashable { @@ -8124,27 +8124,27 @@ public enum Operations { self.term = term } } - public var query: Operations.get_hyphen_cgi_hyphen_suggest_period_pl.Input.Query + public var query: Operations.getSuggestions.Input.Query /// - Remark: Generated from `#/paths/cgi/suggest.pl/GET/header`. public struct Headers: Sendable, Hashable { - public var accept: [OpenAPIRuntime.AcceptHeaderContentType] + public var accept: [OpenAPIRuntime.AcceptHeaderContentType] /// Creates a new `Headers`. /// /// - Parameters: /// - accept: - public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { self.accept = accept } } - public var headers: Operations.get_hyphen_cgi_hyphen_suggest_period_pl.Input.Headers + public var headers: Operations.getSuggestions.Input.Headers /// Creates a new `Input`. /// /// - Parameters: /// - query: /// - headers: public init( - query: Operations.get_hyphen_cgi_hyphen_suggest_period_pl.Input.Query = .init(), - headers: Operations.get_hyphen_cgi_hyphen_suggest_period_pl.Input.Headers = .init() + query: Operations.getSuggestions.Input.Query = .init(), + headers: Operations.getSuggestions.Input.Headers = .init() ) { self.query = query self.headers = headers @@ -8170,26 +8170,26 @@ public enum Operations { } } /// Received HTTP response body - public var body: Operations.get_hyphen_cgi_hyphen_suggest_period_pl.Output.Ok.Body + public var body: Operations.getSuggestions.Output.Ok.Body /// Creates a new `Ok`. /// /// - Parameters: /// - body: Received HTTP response body - public init(body: Operations.get_hyphen_cgi_hyphen_suggest_period_pl.Output.Ok.Body) { + public init(body: Operations.getSuggestions.Output.Ok.Body) { self.body = body } } /// OK /// - /// - Remark: Generated from `#/paths//cgi/suggest.pl/get(get-cgi-suggest.pl)/responses/200`. + /// - Remark: Generated from `#/paths//cgi/suggest.pl/get(getSuggestions)/responses/200`. /// /// HTTP response code: `200 ok`. - case ok(Operations.get_hyphen_cgi_hyphen_suggest_period_pl.Output.Ok) + case ok(Operations.getSuggestions.Output.Ok) /// The associated value of the enum case if `self` is `.ok`. /// /// - Throws: An error if `self` is not `.ok`. /// - SeeAlso: `.ok`. - public var ok: Operations.get_hyphen_cgi_hyphen_suggest_period_pl.Output.Ok { + public var ok: Operations.getSuggestions.Output.Ok { get throws { switch self { case let .ok(response): @@ -8239,9 +8239,9 @@ public enum Operations { /// /// /// - Remark: HTTP `GET /cgi/nutrients.pl`. - /// - Remark: Generated from `#/paths//cgi/nutrients.pl/get(get-cgi-nutrients.pl)`. - public enum get_hyphen_cgi_hyphen_nutrients_period_pl { - public static let id: Swift.String = "get-cgi-nutrients.pl" + /// - Remark: Generated from `#/paths//cgi/nutrients.pl/get(getNutrients)`. + public enum getNutrients { + public static let id: Swift.String = "getNutrients" public struct Input: Sendable, Hashable { /// - Remark: Generated from `#/paths/cgi/nutrients.pl/GET/query`. public struct Query: Sendable, Hashable { @@ -8270,27 +8270,27 @@ public enum Operations { self.lc = lc } } - public var query: Operations.get_hyphen_cgi_hyphen_nutrients_period_pl.Input.Query + public var query: Operations.getNutrients.Input.Query /// - Remark: Generated from `#/paths/cgi/nutrients.pl/GET/header`. public struct Headers: Sendable, Hashable { - public var accept: [OpenAPIRuntime.AcceptHeaderContentType] + public var accept: [OpenAPIRuntime.AcceptHeaderContentType] /// Creates a new `Headers`. /// /// - Parameters: /// - accept: - public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { self.accept = accept } } - public var headers: Operations.get_hyphen_cgi_hyphen_nutrients_period_pl.Input.Headers + public var headers: Operations.getNutrients.Input.Headers /// Creates a new `Input`. /// /// - Parameters: /// - query: /// - headers: public init( - query: Operations.get_hyphen_cgi_hyphen_nutrients_period_pl.Input.Query = .init(), - headers: Operations.get_hyphen_cgi_hyphen_nutrients_period_pl.Input.Headers = .init() + query: Operations.getNutrients.Input.Query = .init(), + headers: Operations.getNutrients.Input.Headers = .init() ) { self.query = query self.headers = headers @@ -8316,26 +8316,26 @@ public enum Operations { } } /// Received HTTP response body - public var body: Operations.get_hyphen_cgi_hyphen_nutrients_period_pl.Output.Ok.Body + public var body: Operations.getNutrients.Output.Ok.Body /// Creates a new `Ok`. /// /// - Parameters: /// - body: Received HTTP response body - public init(body: Operations.get_hyphen_cgi_hyphen_nutrients_period_pl.Output.Ok.Body) { + public init(body: Operations.getNutrients.Output.Ok.Body) { self.body = body } } /// OK /// - /// - Remark: Generated from `#/paths//cgi/nutrients.pl/get(get-cgi-nutrients.pl)/responses/200`. + /// - Remark: Generated from `#/paths//cgi/nutrients.pl/get(getNutrients)/responses/200`. /// /// HTTP response code: `200 ok`. - case ok(Operations.get_hyphen_cgi_hyphen_nutrients_period_pl.Output.Ok) + case ok(Operations.getNutrients.Output.Ok) /// The associated value of the enum case if `self` is `.ok`. /// /// - Throws: An error if `self` is not `.ok`. /// - SeeAlso: `.ok`. - public var ok: Operations.get_hyphen_cgi_hyphen_nutrients_period_pl.Output.Ok { + public var ok: Operations.getNutrients.Output.Ok { get throws { switch self { case let .ok(response): @@ -8392,9 +8392,9 @@ public enum Operations { /// /// /// - Remark: HTTP `GET /api/v2/attribute_groups`. - /// - Remark: Generated from `#/paths//api/v2/attribute_groups/get(get-attribute-groups)`. - public enum get_hyphen_attribute_hyphen_groups { - public static let id: Swift.String = "get-attribute-groups" + /// - Remark: Generated from `#/paths//api/v2/attribute_groups/get(getAttributeGroups)`. + public enum getAttributeGroups { + public static let id: Swift.String = "getAttributeGroups" public struct Input: Sendable, Hashable { /// - Remark: Generated from `#/paths/api/v2/attribute_groups/GET/query`. public struct Query: Sendable, Hashable { @@ -8414,27 +8414,27 @@ public enum Operations { self.lc = lc } } - public var query: Operations.get_hyphen_attribute_hyphen_groups.Input.Query + public var query: Operations.getAttributeGroups.Input.Query /// - Remark: Generated from `#/paths/api/v2/attribute_groups/GET/header`. public struct Headers: Sendable, Hashable { - public var accept: [OpenAPIRuntime.AcceptHeaderContentType] + public var accept: [OpenAPIRuntime.AcceptHeaderContentType] /// Creates a new `Headers`. /// /// - Parameters: /// - accept: - public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { self.accept = accept } } - public var headers: Operations.get_hyphen_attribute_hyphen_groups.Input.Headers + public var headers: Operations.getAttributeGroups.Input.Headers /// Creates a new `Input`. /// /// - Parameters: /// - query: /// - headers: public init( - query: Operations.get_hyphen_attribute_hyphen_groups.Input.Query = .init(), - headers: Operations.get_hyphen_attribute_hyphen_groups.Input.Headers = .init() + query: Operations.getAttributeGroups.Input.Query = .init(), + headers: Operations.getAttributeGroups.Input.Headers = .init() ) { self.query = query self.headers = headers @@ -8460,26 +8460,26 @@ public enum Operations { } } /// Received HTTP response body - public var body: Operations.get_hyphen_attribute_hyphen_groups.Output.Ok.Body + public var body: Operations.getAttributeGroups.Output.Ok.Body /// Creates a new `Ok`. /// /// - Parameters: /// - body: Received HTTP response body - public init(body: Operations.get_hyphen_attribute_hyphen_groups.Output.Ok.Body) { + public init(body: Operations.getAttributeGroups.Output.Ok.Body) { self.body = body } } /// OK /// - /// - Remark: Generated from `#/paths//api/v2/attribute_groups/get(get-attribute-groups)/responses/200`. + /// - Remark: Generated from `#/paths//api/v2/attribute_groups/get(getAttributeGroups)/responses/200`. /// /// HTTP response code: `200 ok`. - case ok(Operations.get_hyphen_attribute_hyphen_groups.Output.Ok) + case ok(Operations.getAttributeGroups.Output.Ok) /// The associated value of the enum case if `self` is `.ok`. /// /// - Throws: An error if `self` is not `.ok`. /// - SeeAlso: `.ok`. - public var ok: Operations.get_hyphen_attribute_hyphen_groups.Output.Ok { + public var ok: Operations.getAttributeGroups.Output.Ok { get throws { switch self { case let .ok(response): @@ -8528,9 +8528,9 @@ public enum Operations { /// /// /// - Remark: HTTP `GET /api/v2/preferences`. - /// - Remark: Generated from `#/paths//api/v2/preferences/get(get-preferences)`. - public enum get_hyphen_preferences { - public static let id: Swift.String = "get-preferences" + /// - Remark: Generated from `#/paths//api/v2/preferences/get(getPreferences)`. + public enum getPreferences { + public static let id: Swift.String = "getPreferences" public struct Input: Sendable, Hashable { /// - Remark: Generated from `#/paths/api/v2/preferences/GET/query`. public struct Query: Sendable, Hashable { @@ -8550,27 +8550,27 @@ public enum Operations { self.lc = lc } } - public var query: Operations.get_hyphen_preferences.Input.Query + public var query: Operations.getPreferences.Input.Query /// - Remark: Generated from `#/paths/api/v2/preferences/GET/header`. public struct Headers: Sendable, Hashable { - public var accept: [OpenAPIRuntime.AcceptHeaderContentType] + public var accept: [OpenAPIRuntime.AcceptHeaderContentType] /// Creates a new `Headers`. /// /// - Parameters: /// - accept: - public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { self.accept = accept } } - public var headers: Operations.get_hyphen_preferences.Input.Headers + public var headers: Operations.getPreferences.Input.Headers /// Creates a new `Input`. /// /// - Parameters: /// - query: /// - headers: public init( - query: Operations.get_hyphen_preferences.Input.Query = .init(), - headers: Operations.get_hyphen_preferences.Input.Headers = .init() + query: Operations.getPreferences.Input.Query = .init(), + headers: Operations.getPreferences.Input.Headers = .init() ) { self.query = query self.headers = headers @@ -8596,26 +8596,26 @@ public enum Operations { } } /// Received HTTP response body - public var body: Operations.get_hyphen_preferences.Output.Ok.Body + public var body: Operations.getPreferences.Output.Ok.Body /// Creates a new `Ok`. /// /// - Parameters: /// - body: Received HTTP response body - public init(body: Operations.get_hyphen_preferences.Output.Ok.Body) { + public init(body: Operations.getPreferences.Output.Ok.Body) { self.body = body } } /// OK /// - /// - Remark: Generated from `#/paths//api/v2/preferences/get(get-preferences)/responses/200`. + /// - Remark: Generated from `#/paths//api/v2/preferences/get(getPreferences)/responses/200`. /// /// HTTP response code: `200 ok`. - case ok(Operations.get_hyphen_preferences.Output.Ok) + case ok(Operations.getPreferences.Output.Ok) /// The associated value of the enum case if `self` is `.ok`. /// /// - Throws: An error if `self` is not `.ok`. /// - SeeAlso: `.ok`. - public var ok: Operations.get_hyphen_preferences.Output.Ok { + public var ok: Operations.getPreferences.Output.Ok { get throws { switch self { case let .ok(response): diff --git a/OpenFoodFactsService/Sources/main.swift b/OpenFoodFactsService/Sources/main.swift deleted file mode 100644 index 25a67f5..0000000 --- a/OpenFoodFactsService/Sources/main.swift +++ /dev/null @@ -1,2 +0,0 @@ -import OpenAPIRuntime -import OpenAPIURLSession diff --git a/OpenFoodFactsService/Sources/openapi.yaml b/OpenFoodFactsService/Sources/openapi.yaml index e7f83d0..74fd3c1 100644 --- a/OpenFoodFactsService/Sources/openapi.yaml +++ b/OpenFoodFactsService/Sources/openapi.yaml @@ -1164,7 +1164,7 @@ paths: It returns all the details of that product response. ' - operationId: get-product-by-barcode + operationId: getProductByBarcode /api/v2/product/{barcode}?fields=knowledge_panels: get: tags: @@ -1207,12 +1207,12 @@ paths: and by the official mobile application ' - operationId: get-product-by-barcode-knowledge-panels + operationId: getProductByBarcodeKnowledgePanels /cgi/ingredients.pl: parameters: [] get: summary: Performing OCR on a Product - operationId: get-cgi-ingredients.pl + operationId: getIngredients responses: '200': description: OK @@ -1234,7 +1234,7 @@ paths: /cgi/product_image_crop.pl: post: summary: Crop A Photo - operationId: post-cgi-product_image_crop.pl + operationId: productImageCrop responses: '200': description: OK @@ -1259,7 +1259,7 @@ paths: - Write Requests get: summary: Rotate A Photo - operationId: get-cgi-product_image_crop.pl + operationId: getProductImageCrop responses: '200': description: OK @@ -1280,6 +1280,7 @@ paths: - Write Requests /cgi/product_image_unselect.pl: post: + operationId: postProductImageUnselect summary: Unselect A Photo requestBody: required: true @@ -1310,7 +1311,7 @@ paths: /cgi/product_jqm2.pl: post: summary: Add or Edit A Product - operationId: post-cgi-product_jqm2.pl + operationId: postProduct responses: '200': description: OK @@ -1350,7 +1351,7 @@ paths: application/json: schema: $ref: '#/components/schemas/search_for_products' - operationId: get-search + operationId: searchProducts description: "Search request allows you to get products that match your search\ \ criteria.\n\nIt allows you create many custom APIs for your use case.\n\n\ If the search query parameter has 2 possible values, they are seperated by\ @@ -1421,7 +1422,7 @@ paths: application/json: schema: type: array - operationId: get-cgi-suggest.pl + operationId: getSuggestions parameters: - $ref: '#/components/parameters/tagtype' - $ref: '#/components/parameters/term' @@ -1448,7 +1449,7 @@ paths: application/json: schema: $ref: '#/components/schemas/get_nutrients' - operationId: get-cgi-nutrients.pl + operationId: getNutrients parameters: - $ref: '#/components/parameters/cc' - $ref: '#/components/parameters/lc' @@ -1478,7 +1479,7 @@ paths: tags: - Read Requests - Personal search - operationId: get-attribute-groups + operationId: getAttributeGroups responses: '200': description: OK @@ -1498,7 +1499,7 @@ paths: tags: - Read Requests - Personal search - operationId: get-preferences + operationId: getPreferences parameters: - $ref: '#/components/parameters/lc' responses: diff --git a/Tools/ref/api-v3.yml b/Tools/ref/api-v3.yml deleted file mode 100644 index 7ffefdb..0000000 --- a/Tools/ref/api-v3.yml +++ /dev/null @@ -1,443 +0,0 @@ -openapi: 3.1.0 -x-stoplight: - id: 0x3135wk4xq0t -info: - title: Open Food Facts Open API V3 - under development - description: | - As a developer, the Open Food Facts API allows you to get information - and contribute to the products database. You can create great apps to - help people make better food choices and also provide data to enhance the database. - termsOfService: "https://world.openfoodfacts.org/terms-of-use" - contact: - name: Open Food Facts - url: "https://slack.openfoodfacts.org/" - email: reuse@openfoodfacts.org - license: - name: "License (MIT, Apache 2.0, etc)" - url: "https://opendatacommons.org/licenses/odbl/summary/index.html" - version: "3" -servers: - - url: "https://world.openfoodfacts.org" - description: prod - - description: dev - url: "https://world.openfoodfacts.net" -paths: - "/api/v3/product/{barcode}": - get: - tags: - - Read Requests - summary: READ Product - Get information for a specific product by barcode (API V3) - parameters: - - name: barcode - in: path - description: | - The barcode of the product to be fetched - required: true - style: simple - explode: false - schema: - type: string - example: "3017620422003" - - $ref: "#/components/parameters/cc" - - $ref: "#/components/parameters/lc" - - schema: - type: string - in: query - name: tags_lc - description: "2 letter language code to request names of tags in a specific language. For READ requests: if passed, all taxonomized tags of the response will include a `lc_name` property with the translation in the requested language, if available. Otherwise, the property value will contain the name in the original language, prefixed by the 2 language code and a colon." - - schema: - type: string - in: query - name: fields - description: |- - Comma separated list of fields requested in the response. - - Special values: - * "none": returns no fields - * "raw": returns all fields as stored internally in the database - * "all": returns all fields except generated fields that need to be explicitly requested such as "knowledge_panels". - - Defaults to "all" for READ requests. The "all" value can also be combined with fields like "attribute_groups" and "knowledge_panels".' - - schema: - type: string - example: "health_card, environment_card" - required: false - in: query - name: knowledge_panels_included - description: |- - When knowledge_panels are requested, you can specify which panels should be in the response. All the others will be excluded. - - schema: - type: string - example: "health_card, environment_card" - required: false - in: query - name: knowledge_panels_excluded - description: |- - When knowledge_panels are requested, you can specify which panels to exclude from the response. All the others will be included. - If a panel is both excluded and included (with the knowledge_panels_excluded parameter), it will be excluded. - responses: - "200": - description: OK - content: - application/json: - schema: - allOf: - - $ref: ./responses/response-status/response_status.yaml - - $ref: ./schemas/product.yaml - description: |- - Retrieve information for a product with a specific barcode. - - The fields parameter allows to specify what fields to retrieve. - operationId: get-product-by-barcode - parameters: - - schema: - type: string - name: barcode - in: path - required: true - description: 'Barcode of the product to create or update, or "test" to analyze the product data sent without creating or updating a product' - patch: - summary: "WRITE Product - Create or update product, or analyze test product (API V3 - Implementation in progress)" - operationId: patch-api-v3-product-barcode - responses: - "200": - description: |- - The response will include a "product" structure. The fields returned in this structure will depend on the value of the "fields" input field: - - - "updated" (default): all fields updated by the query will be returned, including fields that are directly generated from the updated fields. For instance, sending "packagings" or "packagings_add" will return the "packagings" field. - - - "none": no fields are returned. - - - "all": returns all fields except generated fields that need to be explicitly requested such as "knowledge_panels". - - The "fields" values can also be concatenated: "all,knowledge_panels" - content: - application/json: - schema: - allOf: - - $ref: ./responses/response-status/response_status.yaml - - type: object - properties: - product: - $ref: ./schemas/product.yaml - examples: - Update of packagings: - value: - status: success_with_errors - result: - id: "en:product-updated" - en_name: Product updated - lc_name: Produit mis à jour - errors: - - message: - id: "en:sugars-higher-than-carbohydrates" - name: Sugars higher than carbohydrates - lc_name: Sucres plus élevés que les glucides - description: Sugars (40g) are higher than carbohydrates (35g). - lc_description: Les sucres (40g) sont plus élévés que les glucdes. - field: - id: nutriment.sugars - value: "40" - impact: - id: "en:nutrients-not-updated" - name: Nutrients not updated - lc_name: Nutriments non mis à jour - description: The nutrients were not updated. - lc_description: Les nutriments n'ont pas été mis à jour. - product: - packagings: - - material: "en:pp-polypropylene" - number: "2" - recycling: "en:discard" - shape: "en:lid" - - material: "en:non-corrugated-cardboard" - number: "1" - recycling: "en:recycle" - shape: "en:box" - weight: 120 - - material: "en:paper-and-fibreboard-aluminium" - number: "2" - recycling: "en:recycle" - shape: "en:seal" - - material: "en:clear-glass" - number: "2" - recycling: "en:recycle" - shape: "en:jar" - quantity: 200 ML - quantity_value: 200 - quantity_unit: ml - weight: 80 - headers: {} - description: |- - This API allows to create or update a product (if the product already exists, its data is updated, otherwise it is created), or to analyze a test product (in which case no product is created or updated). To analyze a product, the "barcode" path component needs to contain the value "test" instead of a barcode. - - New API to send structured product data in a JSON format instead of in a flattened list of key / value pairs field as-in the current product add / edit API that relies on a multipart/form-data format. - - Important: this new Product WRITE API is under development. The initial deployment will support only packaging fields. - - This new API will be used in particular to send structured packaging data: https://openfoodfacts.github.io/openfoodfacts-server/dev/explain-packaging-data/ - - The new API can then be gradually extended to support other product fields. - requestBody: - content: - application/json: - schema: - allOf: - - $ref: ./requestBodies/lc_cc.yaml - - $ref: ./requestBodies/fields_tags_lc.yaml - - type: object - properties: - user_id: - type: string - password: - type: string - product: - $ref: ./schemas/product_update_api_v3.yaml - examples: - example-1: - value: - lc: fr - cc: fr - fields: "product_name,packagings" - tags_lc: fr - userid: string - password: string - code: string - product: - packagings: - - number_of_units: 6 - shape: - id: "en:bottle" - material: - id: "en:plastic" - recycling: - id: "en:recycle" - quantity_per_unit: 25 cl - weight_measured: 10 - packagings_add: - - number_of_units: 6 - shape: - id: "en:bottle" - material: - id: "en:plastic" - recycling: - id: "en:recycle" - quantity_per_unit: 25 cl - weight_measured: 10 - application/xml: - schema: - type: object - properties: {} - description: | - Structured data for the product is passed in the product field. - - For complex structures such as the packagings object, it is possible to replace pre-existing data, or completing it: - - - an object sent in the packagings field will replace any pre-existing data. - - an object sent in the field suffixed with _add (e.g. packagings_add) will be merged with any pre-existing data. - parameters: [] - /api/v3/taxonomy_suggestions: - parameters: [] - get: - summary: Get taxonomy entries suggestions - tags: [] - responses: - "200": - description: OK - content: - application/json: - schema: - allOf: - - $ref: ./responses/response-status/response_status.yaml - - type: object - properties: - suggestions: - type: array - description: Array of sorted strings suggestions in the language requested in the "lc" field. - items: - type: string - matched_synonyms: - type: object - description: | - Dictionary of strings associating canonical names (as seen in suggestions field) with the synonym that best matches the query. An entry is present for all suggestions, even when the synonym is the same with the canonical name. - - This value is present only if get_synonyms parameter is present. - additional_properties: - type: string - operationId: get-api-v3-taxonomy_suggestions-taxonomy - description: |- - Open Food Facts uses multilingual [taxonomies](https://wiki.openfoodfacts.org/Global_taxonomies) to normalize entries for categories, labels, ingredients, packaging shapes / materials / recycling instructions and many more fields. - - This API returns taxonomy entries suggestions that can be used in product edit forms, search forms etc. (for instance in autocomplete dropdowns using libraries like Tagify or select2 on the Web). - - Suggestions filtering: - - The string parameter allows to get only suggestions that contain a specific string (useful for autocomplete suggestions). - - Suggestions ordering: - - - For packaging shapes and materials, suggestions are ordered first by the number of packaging components they appear in (restricted by country, categories and shape (for materials) if they are passed as parameters). - - for all other taxonomies, results are ordered alphabetically - - If a string is passed, an additional sort is done to put first suggestions that start with the string, followed by suggestions with a word that start with the string, and then suggestions that contain the string anywhere. - parameters: - - $ref: ./api.yml#/components/parameters/tagtype - - $ref: "#/components/parameters/cc" - - $ref: "#/components/parameters/lc" - - schema: - type: string - example: pe - in: query - name: string - description: "Optional string used to filter suggestions (useful for autocomplete). If passed, suggestions starting with the string will be returned first, followed by suggestions matching the string at the beginning of a word, and suggestions matching the string inside a word." - - schema: - type: string - example: yougurts - in: query - name: categories - description: 'Comma separated list of categories tags (e.g. "en:fats,en:unsalted-butters" or categories names in the language indicated by the "lc" field (e.g. "graisses, beurres salés" in French)' - - schema: - type: string - example: bottle - in: query - name: shape - description: 'Shape of packaging component (tag identified in the packaging_shapes taxonomy, or plain text tag name in the language indicated by the "lc" field)' - - schema: - type: string - in: query - name: limit - description: "Maximum number of suggestions. Default is 25, max is 400." - - schema: - type: string - in: query - name: get_synonyms - description: 'Whether or not to include "matched_synonyms" in the response. Set to 1 to include.' - - schema: - type: string - in: query - name: term - description: Alias for the "string" parameter provided for backward compatibility. "string" takes precedence. - "/api/v3/tag/{tagtype}/{tag_or_tagid}": - parameters: - - $ref: "#/components/parameters/cc" - - $ref: "#/components/parameters/lc" - - schema: - type: string - example: categories - name: tagtype - in: path - required: true - description: Type of the tag - - schema: - type: string - name: tag_or_tagid - in: path - required: true - description: "Tag name (e.g. yogurts) or tag id (e.g. en:yogurts)" - get: - summary: Get knowledge panels for a tag - tags: [] - responses: - "200": - description: OK - content: - application/json: - schema: - allOf: - - $ref: ./responses/response-status/response_status.yaml - - type: object - properties: - tagtype: - type: string - description: | - Input tagtype - tagid: - type: string - description: | - Input tagid - tag: - type: object - properties: - tagid: - type: string - description: Canonicalized tagid corresponding to the input tag_or_tagid - tagtype: - type: string - description: Canonicalized tagtype - knowledge_panels: - $ref: ./schemas/knowledge_panels/panels.yaml - description: Knowledge panels for the tag - application/xml: - schema: - type: object - properties: {} - operationId: get-api-v3-tag-tagtype-tag_or_tagid - description: |- - Return knowledge panels for a tag. - - Currently the knowledge panels returned are: - - Categories: - - Packaging stats for a category - /api/v3/product_revert: - parameters: [] - post: - summary: Revert a product to a previous revision - tags: [] - responses: - "200": - description: OK - content: - application/json: - schema: - allOf: - - $ref: ./responses/response-status/response_status.yaml - operationId: post-api-v3-product_revert - description: |- - For moderators only, revert a product to a previous revision. - requestBody: - content: - application/json: - schema: - allOf: - - $ref: ./requestBodies/fields_tags_lc.yaml - - type: object - properties: - code: - type: string - description: Barcode of the product - rev: - type: integer - description: Revision number to revert to - description: | - The code and rev fields are mandatory. - parameters: [] -components: - parameters: - cc: - schema: - type: string - example: "us" - in: query - name: cc - required: false - description: "2 letter code of the country of the user. Used for localizing some fields in returned values (e.g. knowledge panels). If not passed, the country may be inferred by the IP address of the request." - lc: - schema: - type: string - example: "fr" - in: query - name: lc - required: false - description: "2 letter code of the language of the user. Used for localizing some fields in returned values (e.g. knowledge panels). If not passed, the language may be inferred by the Accept-Language header of the request." - code: - schema: - type: string - example: "4251105501381" - in: query - name: code - description: Barcode of the product - required: true -tags: - - name: Read Requests - - name: Write Requests diff --git a/Tools/ref/api.yml b/Tools/ref/api.yml deleted file mode 100644 index 8320beb..0000000 --- a/Tools/ref/api.yml +++ /dev/null @@ -1,599 +0,0 @@ -openapi: 3.1.0 -info: - title: Open Food Facts Open API - description: | - As a developer, the Open Food Facts API allows you to get information - and contribute to the products database. You can create great apps to - help people make better food choices and also provide data to enhance the database. - termsOfService: "https://world.openfoodfacts.org/terms-of-use" - contact: - name: Open Food Facts - url: "https://slack.openfoodfacts.org/" - email: reuse@openfoodfacts.org - license: - name: "data: ODbL" - url: "https://opendatacommons.org/licenses/odbl/summary/index.html" - # can't use url and identifier - use x-identifier - x-identifier: "ODbL-1.0" - version: "2" -externalDocs: - description: | - Please read the API introduction before using this API. - url: https://openfoodfacts.github.io/openfoodfacts-server/api/ -servers: - - description: dev - url: "https://world.openfoodfacts.net" - - url: "https://world.openfoodfacts.org" - description: prod -paths: - "/api/v2/product/{barcode}": - get: - tags: - - Read Requests - summary: Get information for a specific product by barcode - parameters: - - name: barcode - in: path - description: | - The barcode of the product to be fetched - required: true - style: simple - explode: false - schema: - type: string - example: "3017620422003" - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: ./responses/get_product_by_barcode.yaml - examples: - spread-example: - $ref: ./examples/get_product_by_barcode_spread.yaml - - description: | - A product can be fetched via its unique barcode. - It returns all the details of that product response. - operationId: get-product-by-barcode - "/api/v2/product/{barcode}?fields=knowledge_panels": - get: - tags: - - Read Requests - summary: | - Get Knowledge panels for a specific product by barcode - (special case of get product) - parameters: - - name: barcode - in: path - description: | - The barcode of the product to be fetched - required: true - style: simple - explode: false - schema: - type: string - example: "3017620422003" - responses: - "200": - description: OK - content: - application/json: - schema: - allOf: - - $ref: ./responses/get_product_by_barcode_base.yaml - - type: object - properties: - product: - $ref: ./schemas/product_knowledge_panels.yaml - description: | - Knowledge panels gives high leve informations about a product, - ready to display. - This is used by open food facts website, - and by the official mobile application - operationId: get-product-by-barcode-knowledge-panels - /cgi/product_image_upload.pl: - post: - tags: - - Write Requests - summary: Add a Photo to an Existing Product - operationId: get-cgi-product_image_upload.pl - description: | - Photos are source and proof of data. - The first photo uploaded for a product is - auto-selected as the product’s “front” photo.' - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: ./responses/add_photo_to_existing_product.yaml - requestBody: - content: - multipart/form-data: - schema: - $ref: ./requestBodies/add_photo_to_existing_product.yaml - description: "" - /cgi/ingredients.pl: - parameters: [] - get: - summary: Performing OCR on a Product - operationId: get-cgi-ingredients.pl - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: ./responses/ocr_on_product.yaml - description: | - Open Food Facts uses optical character recognition (OCR) to retrieve nutritional data and other information from the product labels. - parameters: - - $ref: "#/components/parameters/id" - - $ref: "#/components/parameters/code" - - $ref: "#/components/parameters/process_image" - - $ref: "#/components/parameters/ocr_engine" - tags: - - Read Requests - /cgi/product_image_crop.pl: - post: - summary: Crop A Photo - operationId: post-cgi-product_image_crop.pl - responses: - "200": - description: OK - content: - application/json: - schema: - type: object - properties: {} - description: | - Cropping is only relevant for editing existing products. - You cannot crop an image the first time you upload it to the system. - parameters: [] - requestBody: - content: - multipart/form-data: - schema: - $ref: ./requestBodies/crop_a_photo.yaml - required: true - tags: - - Write Requests - get: - summary: Rotate A Photo - operationId: get-cgi-product_image_crop.pl - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: ./responses/rotate_a_photo.yaml - description: | - Although we recommend rotating photos manually and uploading a new version of the image, - the OFF API allows you to make api calls to automate this process. - You can rotate existing photos by setting the angle to 90º, 180º, or 270º clockwise. - parameters: - - $ref: "#/components/parameters/code" - - $ref: "#/components/parameters/id" - - $ref: "#/components/parameters/imgid" - - $ref: "#/components/parameters/angle" - tags: - - Write Requests - /cgi/product_image_unselect.pl: - post: - summary: Unselect A Photo - requestBody: - content: - multipart/form-data: - schema: - $ref: ./requestBodies/unselect_a_photo.yaml - responses: - "200": - description: OK - content: - application/json: - schema: - type: object - properties: - status: - type: string - description: status of the unselect operation - example: status ok - status_code: - type: number - description: status code of the operation - example: 0 - imagefield: - type: string - example: front_fr - description: image field that was unselected - - /cgi/product_jqm2.pl: - post: - summary: Add or Edit A Product - operationId: post-cgi-product_jqm2.pl - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: ./responses/add_or_edit_a_product.yaml - parameters: [] - requestBody: - content: - multipart/form-data: - schema: - allOf: - - $ref: ./requestBodies/add_or_edit_a_product.yaml - - $ref: ./requestBodies/change_ref_properties.yaml - tags: - - Write Requests - description: | - This updates a product. - - Note: If the barcode exists then you will be editing the existing product, - However if it doesn''t you will be creating a new product with that unique barcode, - and adding properties to the product. - /api/v2/search: - get: - summary: Search for Products - tags: - - Read Requests - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: ./responses/search_for_products.yaml - operationId: get-search - description: | - Search request allows you to get products that match your search criteria. - - It allows you create many custom APIs for your use case. - - If the search query parameter has 2 possible values, they are seperated by a comma(,). - When filtering via a parameter that has different language codes like `fr`, `de` or `en`, specify the language code in the parameter name e.g `categories_tags_en` - - **Important:** search API v2 does not support full text request (search_term), - you have to use [search API v1](https://wiki.openfoodfacts.org/API/Read/Search) for that. - Upcoming [search-a-licious project](https://github.com/openfoodfacts/search-a-licious) will fix that. - - ### Limiting results - - You can limit the size of returned objects thanks to the `fields` object (see below). - - eg: `fields=code,product_name,brands,attribute_groups`` - - Please use it as much as possible to avoid overloading the servers. - - The search use pagination, see `page` and `page_size` parameters. - - **Beware:** the `page_count` data in item is a bit counter intuitive…, read the description. - - ### Conditions on tags - - All `_tags`` parameters accepts either: - - * a single value - * or a comma-separated list of values (doing a AND) - * or a pipe separated list of values (doing a OR) - - You can exclude terms by using a "-" prefix. - - For taxonomized entries, you might either use the tag id (recommended), - or a known synonym (without language prefix) - - * `labels_tags=en:organic,en:fair-trade` find items that are fair-trade AND organic - * `labels_tags=en:organic|en:fair-trade` find items that are fair-trade OR organic - * `labels_tags=en:organic,en:-fair-trade` find items that are organic BUT NOT fair-trade - - - ### Conditions on nutriments - - To get a list of nutrients - - You can either query on nutrient per 100g (`_100g` suffix) - or per serving (`serving` suffix). - - You can also add `_prepared_` - to get the nutrients in the prepared product instead of as sold. - - You can add a comparison operator and value to the parameter name - to get products with nutrient above or bellow a value. - If you use a parameter value it exactly match it. - - * `energy-kj_100g<200` products where energy in kj for 100g is less than 200kj - * `sugars_serving>10` products where sugar per serving is greater than 10g - * `saturated-fat_100g=1` products where saturated fat per 100g is exactly 10g - * `salt_prepared_serving<0.1` products where salt per serving for prepared product is less than 0.1g - - ### More references - - See also [wiki page](https://wiki.openfoodfacts.org/Open_Food_Facts_Search_API_Version_2) - - parameters: - # all tags parameters - - $ref: "./schemas/tags_parameters.yaml#/properties/additives_tags" - - $ref: "./schemas/tags_parameters.yaml#/properties/allergens_tags" - - $ref: "./schemas/tags_parameters.yaml#/properties/brands_tags" - - $ref: "./schemas/tags_parameters.yaml#/properties/categories_tags" - - $ref: "./schemas/tags_parameters.yaml#/properties/countries_tags" - - $ref: "./schemas/tags_parameters.yaml#/properties/emb_codes_tags" - - $ref: "./schemas/tags_parameters.yaml#/properties/labels_tags" - - $ref: "./schemas/tags_parameters.yaml#/properties/manufacturing_places_tags" - - $ref: "./schemas/tags_parameters.yaml#/properties/nutrition_grades_tags" - - $ref: "./schemas/tags_parameters.yaml#/properties/origins_tags" - - $ref: "./schemas/tags_parameters.yaml#/properties/packaging_tags" - - $ref: "./schemas/tags_parameters.yaml#/properties/purchase_places_tags" - - $ref: "./schemas/tags_parameters.yaml#/properties/states_tags" - - $ref: "./schemas/tags_parameters.yaml#/properties/stores_tags" - - $ref: "./schemas/tags_parameters.yaml#/properties/traces_tags" - - $ref: "./schemas/tags_parameters.yaml#/properties/tag_name_with_language_code" - - $ref: "./schemas/nutrition_search.yaml#/properties/nutrient_lower_than" - - $ref: "./schemas/nutrition_search.yaml#/properties/nutrient_greater_than" - - $ref: "./schemas/nutrition_search.yaml#/properties/nutrient_equal" - - $ref: "#/components/parameters/fields" - - $ref: "#/components/parameters/sort_by" - - $ref: "#/components/parameters/page" - - $ref: "#/components/parameters/page_size" - parameters: [] - /cgi/suggest.pl: - get: - summary: Get Suggestions to Aid Adding/Editing Products - tags: - - Read Requests - responses: - "200": - description: OK - content: - application/json: - schema: - type: array - operationId: get-cgi-suggest.pl - parameters: - - $ref: "#/components/parameters/tagtype" - - $ref: "#/components/parameters/term" - description: | - For example , Dave is looking for packaging_shapes that contain the term "fe", - all packaging_shapes containing "fe" will be returned. - This is useful if you have a search in your application, - for a specific product field. - /cgi/nutrients.pl: - get: - summary: Get a nested list of nutrients that can be displayed in the nutrition facts table for a specific country and language - tags: - - Read Requests - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: ./responses/get_nutrients.yaml - operationId: get-cgi-nutrients.pl - parameters: - - $ref: "#/components/parameters/cc" - - $ref: "#/components/parameters/lc" - description: | - Used to display the nutrition facts table of a product, or to display a form to input those nutrition facts. - /api/v2/attribute_groups: - get: - summary: Get the list of attributes available for personal search. - description: | - Attributes are at the heart of personal search. - They score the products according to different criterias, - which could then be matched to a user's preferences. - - This API helps you list attributes and display them in your application, - for the user to choose the importance of each criteria. - - note: /api/v2/attribute_groups_{lc} is also a valid route, but consider it deprecated - tags: - - Read Requests - - Personal search - operationId: get-attribute-groups - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: ./responses/get_attribute_groups.yaml - parameters: - - $ref: "#/components/parameters/lc" - /api/v2/preferences: - get: - summary: | - Get the weights corresponding to attributes preferences - to compute personal product - tags: - - Read Requests - - Personal search - operationId: get-preferences - parameters: - - $ref: "#/components/parameters/lc" - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: ./responses/get_preferences.yaml -components: - schemas: - "Product-Base": - $ref: ./schemas/product_base.yaml - "Product-Misc": - $ref: ./schemas/product_misc.yaml - "Product-Tags": - $ref: ./schemas/product_tags.yaml - "Product-Nutrition": - $ref: ./schemas/product_nutrition.yaml - "Product-Ingredients": - $ref: ./schemas/product_ingredients.yaml - "Product-Images": - $ref: ./schemas/product_images.yaml - "Product-Eco-Score": - $ref: ./schemas/product_ecoscore.yaml - "Product-Metadata": - $ref: ./schemas/product_meta.yaml - "Product-Data-Quality": - $ref: ./schemas/product_quality.yaml - "Product-Knowledge-Panels": - $ref: ./schemas/product_knowledge_panels.yaml - "Product-Attribute-Groups": - $ref: "./schemas/product_attribute_groups.yaml" - Product: - $ref: ./schemas/product.yaml - parameters: - id: - schema: - type: string - example: ingredients_en - in: query - name: id - required: true - cc: - schema: - type: string - example: "us" - in: query - name: cc - required: false - description: "2 letter code of the country of the user. Used for localizing some fields in returned values (e.g. knowledge panels). If not passed, the country may be inferred by the IP address of the request." - lc: - schema: - type: string - example: "fr" - in: query - name: lc - required: false - description: | - 2 letter code of the language of the user. - Used for localizing some fields in returned values (e.g. knowledge panels). - If not passed, the language may be inferred by the Accept-Language header of the request, - or from the domain name prefix. - code: - schema: - type: string - example: "4251105501381" - in: query - name: code - description: Barcode of the product - required: true - process_image: - schema: - type: string - example: "1" - in: query - name: process_image - required: true - ocr_engine: - schema: - type: string - example: google_cloud_vision - in: query - name: ocr_engine - required: true - imgid: - schema: - type: string - example: "1" - in: query - name: imgid - required: true - angle: - schema: - type: string - example: "90" - in: query - name: angle - required: true - page: - schema: - type: int - example: 24 - in: query - name: page - description: | - The page number you request to view (eg. in search results spanning multiple pages) - page_size: - schema: - type: int - example: 24 - in: query - name: page_size - description: | - The number of elements should be sent per page - sort_by: - schema: - type: string - example: product_name - enum: - - product_name - - last_modified_t - - scans_n - - unique_scans_n - - created_t - - completeness - - popularity_key - - nutriscore_score - - nova_score - - nothing - - ecoscore_score - in: query - name: sort_by - description: | - The allowed values used to sort/order the search results. - - * `product_name` sorts on name - * `ecoscore_score`, `nova_score`, `nutriscore_score` rank on the [Eco-Score](https://world.openfoodfacts.org/eco-score-the-environmental-impact-of-food-products), [Nova](https://world.openfoodfacts.org/nova), or [Nutri-Score](https://world.openfoodfacts.org/nutriscore) - * `scans_n`, `unique_scans_n` and `popularity_key` are about product popularity: number of scans on unique scans, rank of product - * `created_t`, `last_modified_t`, are about creation and modification dates - * `nothing`, tells not to sort at all (because if you do not provide the sort_by argument we default to sorting on popularity (for food) or last modification date) - fields: - schema: - type: string - example: "code,product_name" - in: query - name: fields - description: | - The fields to be returned from the product object can also be limited. - If not specified, it returns the entire product object response. - knowledge_panels_included: - schema: - type: string - example: "heatlh_card, environment_card" - in: query - name: knowledge_panels_included - description: | - When knowledge_panels are requested, you can specify which panels should be in the response. All the others will be excluded. - knowledge_panels_excluded: - schema: - type: string - example: "heatlh_card, environment_card" - in: query - name: knowledge_panels_excluded - description: | - When knowledge_panels are requested, you can specify which panels to exclude from the response. All the others will be included. - If a panel is both excluded and included (with the knowledge_panels_excluded parameter), it will be excluded. - tagtype: - schema: - type: string - example: additives - in: query - name: tagtype - term: - schema: - type: string - example: f - in: query - name: term -tags: - - name: Read Requests - - name: Write Requests diff --git a/Tools/ref/examples/get_product_by_barcode_spread.yaml b/Tools/ref/examples/get_product_by_barcode_spread.yaml deleted file mode 100644 index 8dd5c53..0000000 --- a/Tools/ref/examples/get_product_by_barcode_spread.yaml +++ /dev/null @@ -1,1055 +0,0 @@ -summary: retrieved values for a well known chocolate and nut spread -value: - code: '3017620422003' - product: - _id: '3017620422003' - _keywords: - - et - - pate - - cacao - - produit - - ferrero - - gluten - - petit-dejeuner - - san - - au - - aux - - sucre - - nutella - abbreviated_product_name: Nutella t.400 - abbreviated_product_name_fr: Nutella t.400 - added_countries_tags: [] - additives_n: 1 - additives_original_tags: - - 'en:e322' - additives_prev_original_tags: - - 'en:e322' - additives_tags: - - 'en:e322' - allergens: 'en:milk,en:nuts,en:soybeans' - allergens_from_ingredients: 'en:nuts, hazelnuts' - allergens_from_user: '(fr) en:milk,en:nuts,en:soybeans' - allergens_hierarchy: - - 'en:milk' - - 'en:nuts' - - 'en:soybeans' - allergens_lc: fr - allergens_tags: - - 'en:milk' - - 'en:nuts' - - 'en:soybeans' - amino_acids_prev_tags: [] - amino_acids_tags: [] - brands: Ferrero - brands_tags: - - ferrero - carbon_footprint_percent_of_known_ingredients: 13 - categories: 'Produits à tartiner,Petit-déjeuners,Produits à tartiner sucrés,Pâtes à tartiner,Pâtes à tartiner aux noisettes,Pâtes à tartiner aux noisettes et au cacao' - categories_hierarchy: - - 'en:breakfasts' - - 'en:spreads' - - 'en:sweet-spreads' - - 'en:hazelnut-spreads' - - 'en:chocolate-spreads' - - 'en:cocoa-and-hazelnuts-spreads' - categories_lc: fr - categories_properties: - 'agribalyse_food_code:en': '31032' - 'agribalyse_proxy_food_code:en': '31032' - 'ciqual_food_code:en': '31032' - categories_properties_tags: - - all-products - - categories-known - - agribalyse-food-code-31032 - - agribalyse-food-code-known - - agribalyse-proxy-food-code-31032 - - agribalyse-proxy-food-code-known - - ciqual-food-code-31032 - - ciqual-food-code-known - - agribalyse-known - - agribalyse-31032 - categories_tags: - - 'en:breakfasts' - - 'en:spreads' - - 'en:sweet-spreads' - - 'fr:pates-a-tartiner' - - 'en:hazelnut-spreads' - - 'en:chocolate-spreads' - - 'en:cocoa-and-hazelnuts-spreads' - category_properties: - 'ciqual_food_name:en': Chocolate spread with hazelnuts - checked: 'on' - checkers_tags: - - moon-rabbit - ciqual_food_name_tags: - - chocolate-spread-with-hazelnuts - cities_tags: [] - code: '3017620422003' - codes_tags: - - code-13 - - 3017620422xxx - - 301762042xxxx - - 30176204xxxxx - - 3017620xxxxxx - - 301762xxxxxxx - - 30176xxxxxxxx - - 3017xxxxxxxxx - - 301xxxxxxxxxx - - 30xxxxxxxxxxx - - 3xxxxxxxxxxxx - compared_to_category: 'en:cocoa-and-hazelnuts-spreads' - complete: 0 - completeness: 0.875 - conservation_conditions: A conserver au sec et à l'abri de la chaleur. Ne pas mettre au réfrigérateur. - conservation_conditions_fr: A conserver au sec et à l'abri de la chaleur. Ne pas mettre au réfrigérateur. - correctors_tags: - - user1 - - user2 - - user3 - - user4 - countries: 'en:Algeria Austria Belgium Canada France Germany Italy Luxembourg Mexico Morocco Netherlands Portugal Senegal Spain Switzerland Tunisia United Kingdom United States' - countries_beforescanbot: 'Belgium,France' - countries_hierarchy: - - 'en:Algeria Austria Belgium Canada France Germany Italy Luxembourg Mexico Morocco Netherlands Portugal Senegal Spain Switzerland Tunisia United Kingdom United States' - countries_lc: fr - countries_tags: - - 'en:algeria-austria-belgium-canada-france-germany-italy-luxembourg-mexico-morocco-netherlands-portugal-senegal-spain-switzerland-tunisia-united-kingdom-united-states' - created_t: 1457680652 - creator: openfoodfacts-contributors - customer_service: 'FERRERO FRANCE COMMERCIALE - Service Consommateurs, CS 90058 - 76136 MONT SAINT AIGNAN Cedex' - customer_service_fr: 'FERRERO FRANCE COMMERCIALE - Service Consommateurs, CS 90058 - 76136 MONT SAINT AIGNAN Cedex' - data_quality_bugs_tags: [] - data_quality_errors_tags: [] - data_quality_info_tags: - - 'en:packaging-data-incomplete' - - 'en:ingredients-percent-analysis-ok' - - 'en:ecoscore-extended-data-computed' - - 'en:ecoscore-extended-data-less-precise-than-agribalyse' - - 'en:food-groups-1-known' - - 'en:food-groups-2-known' - - 'en:food-groups-3-unknown' - data_quality_tags: - - 'en:packaging-data-incomplete' - - 'en:ingredients-percent-analysis-ok' - - 'en:ecoscore-extended-data-computed' - - 'en:ecoscore-extended-data-less-precise-than-agribalyse' - - 'en:food-groups-1-known' - - 'en:food-groups-2-known' - - 'en:food-groups-3-unknown' - - 'en:ecoscore-origins-of-ingredients-origins-are-100-percent-unknown' - - 'en:ecoscore-packaging-unspecified-shape' - - 'en:ecoscore-production-system-no-label' - data_quality_warnings_tags: - - 'en:ecoscore-origins-of-ingredients-origins-are-100-percent-unknown' - - 'en:ecoscore-packaging-unspecified-shape' - - 'en:ecoscore-production-system-no-label' - data_sources: 'Database - FoodRepo / openfood.ch, Databases, Producer - Ferrero, Producers, App - yuka, Apps, Producer - ferrero-france-commerciale, Database - Equadis, Database - GDSN, App - InFood, App - Open Food Facts, App - halal-healthy, App - smoothie-openfoodfacts' - data_sources_tags: - - database-foodrepo-openfood-ch - - databases - - producer-ferrero - - producers - - app-yuka - - apps - - producer-ferrero-france-commerciale - - database-equadis - - database-gdsn - - app-infood - - app-open-food-facts - - app-halal-healthy - - app-smoothie-openfoodfacts - ecoscore_data: - adjustments: - origins_of_ingredients: - aggregated_origins: - - origin: 'en:unknown' - percent: 100 - epi_score: 0 - epi_value: -5 - origins_from_origins_field: - - 'en:unknown' - transportation_scores: - fr: 0 - 'no': 0 - uk: 0 - us: 0 - world: 0 - transportation_values: - fr: 0 - 'no': 0 - uk: 0 - us: 0 - world: 0 - values: - fr: -5 - 'no': -5 - uk: -5 - us: -5 - world: -5 - warning: origins_are_100_percent_unknown - packaging: - non_recyclable_and_non_biodegradable_materials: 0 - packagings: - - ecoscore_material_score: 81 - ecoscore_shape_ratio: 1 - material: 'en:clear-glass' - shape: 'en:unknown' - score: 81 - value: -2 - warning: unspecified_shape - production_system: - labels: [] - value: 0 - warning: no_label - threatened_species: - ingredient: 'en:palm-oil' - value: -10 - agribalyse: - agribalyse_food_code: '31032' - co2_agriculture: 8.7770996 - co2_consumption: 0 - co2_distribution: 0.014104999 - co2_packaging: 0.18864842 - co2_processing: 0.69167973 - co2_total: 9.8742343 - co2_transportation: 0.19708507 - code: '31032' - dqr: '2.54' - ef_agriculture: 0.61477708 - ef_consumption: 0 - ef_distribution: 0.0045906531 - ef_packaging: 0.020453714 - ef_processing: 0.085674643 - ef_total: 0.74366703 - ef_transportation: 0.017824104 - is_beverage: 0 - name_en: Chocolate spread with hazelnuts - name_fr: Pâte à tartiner chocolat et noisette - score: 40 - grade: d - grades: - fr: d - 'no': d - uk: d - us: d - world: d - missing: - labels: 1 - origins: 1 - packagings: 1 - missing_data_warning: 1 - score: 23 - scores: - fr: 23 - 'no': 23 - uk: 23 - us: 23 - world: 23 - status: known - ecoscore_extended_data: - impact: - ef_single_score_log_stddev: 0.0539895633164057 - likeliest_impacts: - Climate_change: 0.172717449218484 - EF_single_score: 0.023255035815491 - likeliest_recipe: - 'en:emulsifier': 0.388589430098073 - 'en:hazelnut_oil': 12.806852015349 - 'en:palm_oil': 16.6103749736231 - 'en:sugar': 52.9709312507153 - 'en:water': 4.90093151221936 - 'fr:Cacao_Maigre_7': 3.94056985087663 - 'fr:Lait__cr_m__En_Poudre_8': 6.8959972390341 - mass_ratio_uncharacterized: 0.11 - uncharacterized_ingredients: - impact: - - 'fr:Lait Écrémé En Poudre 8' - - 'fr:Cacao Maigre 7' - nutrition: - - 'fr:Lait Écrémé En Poudre 8' - - 'fr:Cacao Maigre 7' - uncharacterized_ingredients_mass_proportion: - impact: 0.11 - nutrition: 0.11 - uncharacterized_ingredients_ratio: - impact: 0.333333333333333 - nutrition: 0.333333333333333 - warnings: - - 'The product has a high number of nutrition uncharacterized ingredients: 33%' - - 'The product has a high number of impact uncharacterized ingredients: 33%' - - 'The estimated mass of nutrition uncharacterized ingredients in the product is high: 11%' - - 'The estimated mass of impact uncharacterized ingredients in the product is high: 11%' - ecoscore_extended_data_version: '4' - ecoscore_grade: d - ecoscore_score: 23 - ecoscore_tags: - - d - editors_tags: - - user1 - - user2 - - user3 - - user4 - emb_codes: '' - emb_codes_20141016: '' - emb_codes_orig: '' - emb_codes_tags: [] - entry_dates_tags: - - '2016-03-11' - - 2016-03 - - '2016' - environment_impact_level: '' - environment_impact_level_tags: [] - expiration_date: 09/2021 - food_groups: 'en:sweets' - food_groups_tags: - - 'en:sugary-snacks' - - 'en:sweets' - fruits-vegetables-nuts_100g_estimate: 0 - generic_name: '' - generic_name_ar: نوتلا - generic_name_de: Nuss-Nougat-Creme - generic_name_en: '' - generic_name_es: Crema de Avellanas con cacao - generic_name_fr: Pâte à tartiner aux noisettes - generic_name_id: '' - generic_name_it: Nutella - generic_name_nl: '' - grades: {} - id: '3017620422003' - image_front_small_url: 'https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.200.jpg' - image_front_thumb_url: 'https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.100.jpg' - image_front_url: 'https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.400.jpg' - image_nutrition_small_url: 'https://images.openfoodfacts.org/images/products/301/762/042/2003/nutrition_en.400.200.jpg' - image_nutrition_thumb_url: 'https://images.openfoodfacts.org/images/products/301/762/042/2003/nutrition_en.400.100.jpg' - image_nutrition_url: 'https://images.openfoodfacts.org/images/products/301/762/042/2003/nutrition_en.400.400.jpg' - image_small_url: 'https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.200.jpg' - image_thumb_url: 'https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.100.jpg' - image_url: 'https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.400.jpg' - images: - '1': - sizes: - '100': - h: 100 - w: 56 - '400': - h: 400 - w: 225 - full: - h: 2000 - w: 1125 - uploaded_t: '1457680652' - uploader: openfoodfacts-contributors - '2': - sizes: - '100': - h: 100 - w: 75 - '400': - h: 400 - w: 300 - full: - h: 3264 - w: 2448 - uploaded_t: '1462829284' - uploader: openfoodfacts-contributors - '3': - sizes: - '100': - h: 100 - w: 56 - '400': - h: 400 - w: 225 - full: - h: 2000 - w: 1125 - uploaded_t: '1468510986' - uploader: user3 - front_en: - angle: '0' - coordinates_image_size: full - geometry: 0x0-0-0 - imgid: '1' - normalize: 'false' - rev: '399' - sizes: - '100': - h: 100 - w: 77 - '200': - h: 200 - w: 155 - '400': - h: 400 - w: 310 - full: - h: 1808 - w: 1400 - white_magic: 'false' - x1: '0' - x2: '0' - y1: '0' - y2: '0' - front_fr: - angle: 0 - coordinates_image_size: '400' - geometry: 0x0--5--5 - imgid: '2' - normalize: 'false' - rev: '415' - sizes: - '100': - h: 100 - w: 77 - '200': - h: 200 - w: 155 - '400': - h: 400 - w: 310 - full: - h: 1808 - w: 1400 - white_magic: 'false' - x1: '-1' - x2: '-1' - y1: '-1' - y2: '-1' - ingredients_fr: - angle: null - coordinates_image_size: '400' - geometry: 0x0-0-0 - imgid: '3' - normalize: null - rev: '299' - sizes: - '100': - h: 16 - w: 100 - '200': - h: 33 - w: 200 - '400': - h: 65 - w: 400 - full: - h: 334 - w: 2046 - white_magic: null - x1: null - x2: null - y1: null - y2: null - nutrition_en: - angle: '0' - coordinates_image_size: full - geometry: 0x0-0-0 - imgid: '3' - normalize: 'false' - rev: '400' - sizes: - '100': - h: 100 - w: 96 - '200': - h: 200 - w: 192 - '400': - h: 400 - w: 383 - full: - h: 572 - w: 548 - white_magic: 'false' - x1: '0' - x2: '0' - y1: '0' - y2: '0' - packaging_fr: - angle: 0 - coordinates_image_size: full - geometry: 0x0--1--1 - imgid: '3' - normalize: null - rev: '420' - sizes: - '100': - h: 31 - w: 100 - '200': - h: 61 - w: 200 - '400': - h: 122 - w: 400 - full: - h: 638 - w: 2084 - white_magic: null - x1: '-1' - x2: '-1' - y1: '-1' - y2: '-1' - informers_tags: - - user1 - - user2 - - user3 - - user4 - ingredients: - - id: 'en:sugar' - percent_estimate: 46.5 - percent_max: 63 - percent_min: 30 - text: sugar - vegan: 'yes' - vegetarian: 'yes' - - from_palm_oil: 'yes' - id: 'en:palm-oil' - percent_estimate: 25.5 - percent_max: 38 - percent_min: 13 - text: palm oil - vegan: 'yes' - vegetarian: 'yes' - - id: 'en:hazelnut' - percent: 13 - percent_estimate: 13 - percent_max: 13 - percent_min: 13 - text: hazelnuts - vegan: 'yes' - vegetarian: 'yes' - - id: 'en:skim-milk-powder-8' - percent: 7 - percent_estimate: 7 - percent_max: 7 - percent_min: 7 - text: skim milk powder 8 - - id: 'en:lean-cocoa-7' - percent: 4 - percent_estimate: 4 - percent_max: 4 - percent_min: 4 - text: lean cocoa 7 - - id: 'en:emulsifier' - ingredients: - - id: 'en:soya-lecithin' - percent_estimate: 2 - percent_max: 4 - percent_min: 0 - text: soy lecithins - vegan: 'yes' - vegetarian: 'yes' - percent_estimate: 2 - percent_max: 4 - percent_min: 0 - text: emulsifiers - - id: 'en:vanillin' - percent_estimate: 2 - percent_max: 4 - percent_min: 0 - text: vanillin - ingredients_analysis: - 'en:palm-oil': - - 'en:palm-oil' - 'en:vegan-status-unknown': - - 'en:skim-milk-powder-8' - - 'en:lean-cocoa-7' - - 'en:vanillin' - 'en:vegetarian-status-unknown': - - 'en:skim-milk-powder-8' - - 'en:lean-cocoa-7' - - 'en:vanillin' - ingredients_analysis_tags: - - 'en:palm-oil' - - 'en:vegan-status-unknown' - - 'en:vegetarian-status-unknown' - ingredients_from_or_that_may_be_from_palm_oil_n: 0 - ingredients_from_palm_oil_n: 0 - ingredients_from_palm_oil_tags: [] - ingredients_hierarchy: - - 'en:sugar' - - 'en:added-sugar' - - 'en:disaccharide' - - 'en:palm-oil' - - 'en:oil-and-fat' - - 'en:vegetable-oil-and-fat' - - 'en:palm-oil-and-fat' - - 'en:hazelnut' - - 'en:nut' - - 'en:tree-nut' - - 'en:skim-milk-powder-8' - - 'en:lean-cocoa-7' - - 'en:emulsifier' - - 'en:vanillin' - - 'en:soya-lecithin' - - 'en:e322' - - 'en:e322i' - ingredients_n: 8 - ingredients_n_tags: - - '8' - - 1-10 - ingredients_original_tags: - - 'en:sugar' - - 'en:palm-oil' - - 'en:hazelnut' - - 'en:skim-milk-powder-8' - - 'en:lean-cocoa-7' - - 'en:emulsifier' - - 'en:vanillin' - - 'en:soya-lecithin' - ingredients_percent_analysis: 1 - ingredients_tags: - - 'en:sugar' - - 'en:added-sugar' - - 'en:disaccharide' - - 'en:palm-oil' - - 'en:oil-and-fat' - - 'en:vegetable-oil-and-fat' - - 'en:palm-oil-and-fat' - - 'en:hazelnut' - - 'en:nut' - - 'en:tree-nut' - - 'en:skim-milk-powder-8' - - 'en:lean-cocoa-7' - - 'en:emulsifier' - - 'en:vanillin' - - 'en:soya-lecithin' - - 'en:e322' - - 'en:e322i' - ingredients_text: 'sugar, palm oil, hazelnuts 13%, skim milk powder 8, 7%, lean cocoa 7, 4%, emulsifiers: soy lecithins, vanillin' - ingredients_text_en: 'sugar, palm oil, hazelnuts 13%, skim milk powder 8, 7%, lean cocoa 7, 4%, emulsifiers: soy lecithins, vanillin' - ingredients_text_fr: 'Sucre, huile de palme, _NOISETTES_ 13%, _LAIT_ écrémé en poudre 8,7%, cacao maigre 7,4%, émulsifiants: lécithine [SOJA]; vanilline. Sans gluten' - ingredients_text_with_allergens: 'sugar, palm oil, hazelnuts 13%, skim milk powder 8, 7%, lean cocoa 7, 4%, emulsifiers: soy lecithins, vanillin' - ingredients_text_with_allergens_en: 'sugar, palm oil, hazelnuts 13%, skim milk powder 8, 7%, lean cocoa 7, 4%, emulsifiers: soy lecithins, vanillin' - ingredients_text_with_allergens_fr: 'Sucre, huile de palme, NOISETTES 13%, LAIT écrémé en poudre 8,7%, cacao maigre 7,4%, émulsifiants: lécithine [SOJA]; vanilline. Sans gluten' - ingredients_that_may_be_from_palm_oil_n: 0 - ingredients_that_may_be_from_palm_oil_tags: [] - ingredients_with_specified_percent_n: 3 - ingredients_with_specified_percent_sum: 24 - ingredients_with_unspecified_percent_n: 4 - ingredients_with_unspecified_percent_sum: 76 - interface_version_created: '20120622' - interface_version_modified: 20150316.jqm2 - known_ingredients_n: 15 - labels: 'Sans gluten,en:nonorganic' - labels_hierarchy: - - 'en:no-gluten' - - 'en:nonorganic' - labels_lc: fr - labels_tags: - - 'en:no-gluten' - - 'en:nonorganic' - lang: en - languages: - 'en:arabic': 2 - 'en:english': 4 - 'en:french': 10 - 'en:german': 3 - 'en:italian': 3 - 'en:spanish': 7 - languages_codes: - en: 4 - fr: 10 - languages_hierarchy: - - 'en:english' - - 'en:french' - languages_tags: - - 'en:english' - - 'en:french' - - 'en:multilingual' - last_check_dates_tags: - - '2021-07-21' - - 2021-07 - - '2021' - last_checked_t: 1626872806 - last_checker: user3 - last_edit_dates_tags: - - '2022-07-29' - - 2022-07 - - '2022' - last_editor: user4 - last_image_dates_tags: - - '2022-07-29' - - 2022-07 - - '2022' - last_image_t: 1659084293 - last_modified_by: user4 - last_modified_t: 1659084329 - lc: en - link: '' - main_countries_tags: [] - manufacturing_places: '' - manufacturing_places_tags: [] - max_imgid: '121' - minerals_prev_tags: [] - minerals_tags: [] - misc_tags: - - 'en:nutrition-no-fiber' - - 'en:nutrition-fruits-vegetables-nuts-estimate-from-ingredients' - - 'en:nutrition-no-fiber-or-fruits-vegetables-nuts' - - 'en:nutriscore-computed' - - 'en:ecoscore-extended-data-computed' - - 'en:ecoscore-extended-data-version-4' - - 'en:ecoscore-missing-data-warning' - - 'en:ecoscore-missing-data-labels' - - 'en:ecoscore-missing-data-origins' - - 'en:ecoscore-missing-data-packagings' - - 'en:ecoscore-computed' - no_nutrition_data: 'null' - nova_group: 4 - nova_groups: '4' - nova_groups_markers: - '3': - - - ingredients - - 'en:sugar' - '4': - - - additives - - 'en:e322' - - - ingredients - - 'en:emulsifier' - nova_groups_tags: - - 'en:4-ultra-processed-food-and-drink-products' - nucleotides_prev_tags: [] - nucleotides_tags: [] - nutrient_levels: - fat: high - salt: low - saturated-fat: high - sugars: high - nutrient_levels_tags: - - 'en:fat-in-high-quantity' - - 'en:saturated-fat-in-high-quantity' - - 'en:sugars-in-high-quantity' - - 'en:salt-in-low-quantity' - nutriments: - alcohol: 0 - alcohol_100g: 0 - alcohol_serving: 0 - alcohol_unit: '% vol' - alcohol_value: 0 - carbohydrates: 57.5 - carbohydrates_100g: 57.5 - carbohydrates_serving: 8.62 - carbohydrates_unit: g - carbohydrates_value: 57.5 - carbon-footprint-from-known-ingredients_product: 135 - carbon-footprint-from-known-ingredients_serving: 5.07 - energy: 2252 - energy-kcal: 539 - energy-kcal_100g: 539 - energy-kcal_serving: 80.8 - energy-kcal_unit: kcal - energy-kcal_value: 539 - energy-kj: 2252 - energy-kj_100g: 2252 - energy-kj_serving: 338 - energy-kj_unit: kJ - energy-kj_value: 2252 - energy_100g: 2252 - energy_serving: 338 - energy_unit: kJ - energy_value: 2252 - fat: 30.9 - fat_100g: 30.9 - fat_serving: 4.63 - fat_unit: g - fat_value: 30.9 - fruits-vegetables-nuts-estimate-from-ingredients_100g: 13 - fruits-vegetables-nuts-estimate-from-ingredients_serving: 13 - nova-group: 4 - nova-group_100g: 4 - nova-group_serving: 4 - nutrition-score-fr: 26 - nutrition-score-fr_100g: 26 - proteins: 6.3 - proteins_100g: 6.3 - proteins_serving: 0.945 - proteins_unit: g - proteins_value: 6.3 - salt: 0.107 - salt_100g: 0.107 - salt_serving: 0.016 - salt_unit: g - salt_value: 0.107 - saturated-fat: 10.6 - saturated-fat_100g: 10.6 - saturated-fat_serving: 1.59 - saturated-fat_unit: g - saturated-fat_value: 10.6 - sodium: 0.0428 - sodium_100g: 0.0428 - sodium_serving: 0.00642 - sodium_unit: g - sodium_value: 0.0428 - sugars: 56.3 - sugars_100g: 56.3 - sugars_serving: 8.44 - sugars_unit: g - sugars_value: 56.3 - nutriscore_data: - energy: 2252 - energy_points: 6 - energy_value: 2252 - fiber: 0 - fiber_points: 0 - fiber_value: 0 - fruits_vegetables_nuts_colza_walnut_olive_oils: 13 - fruits_vegetables_nuts_colza_walnut_olive_oils_points: 0 - fruits_vegetables_nuts_colza_walnut_olive_oils_value: 13 - grade: e - is_beverage: 0 - is_cheese: 0 - is_fat: 0 - is_water: 0 - negative_points: 26 - positive_points: 0 - proteins: 6.3 - proteins_points: 3 - proteins_value: 6.3 - saturated_fat: 10.6 - saturated_fat_points: 10 - saturated_fat_ratio: 34.3042071197411 - saturated_fat_ratio_points: 5 - saturated_fat_ratio_value: 34.3 - saturated_fat_value: 10.6 - score: 26 - sodium: 42.8 - sodium_points: 0 - sodium_value: 42.8 - sugars: 56.3 - sugars_points: 10 - sugars_value: 56.3 - nutriscore_grade: e - nutriscore_score: 26 - nutriscore_score_opposite: -26 - nutrition_data: 'on' - nutrition_data_per: 100g - nutrition_data_prepared: '' - nutrition_data_prepared_per: 100g - nutrition_grade_fr: e - nutrition_grades: e - nutrition_grades_tags: - - e - nutrition_score_beverage: 0 - nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients: 1 - nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients_value: 13 - nutrition_score_warning_no_fiber: 1 - obsolete: '' - obsolete_since_date: '' - origin: '' - origins: '' - origins_hierarchy: [] - origins_lc: fr - origins_tags: [] - other_nutritional_substances_tags: [] - owner: org-ferrero-france-commerciale - owners_tags: org-ferrero-france-commerciale - packaging: PP 5 Ummi PLASTIQUE / PLASTIEK PAP 27 WWW PAPIER / PAPIER CIPAP 82 PANNEAU DE FIBRE COMPOSITES/ COMPOSIET VEZELPLAAT GL 70 VERRE / GLAS - packaging_hierarchy: - - 'fr:PP 5 Ummi PLASTIQUE / PLASTIEK PAP 27 WWW PAPIER / PAPIER CIPAP 82 PANNEAU DE FIBRE COMPOSITES/ COMPOSIET VEZELPLAAT GL 70 VERRE / GLAS' - packaging_lc: fr - packaging_tags: - - 'fr:pp-5-ummi-plastique-plastiek-pap-27-www-papier-papier-cipap-82-panneau-de-fibre-composites-composiet-vezelplaat-gl-70-verre-glas' - packaging_text: '' - packaging_text_ar: '' - packaging_text_de: '' - packaging_text_en: '' - packaging_text_es: 'Pot en verre, couvercle en plastique.' - packaging_text_fr: "1 couvercle plastique blanc opaque PP à jeter,\r\n1 plaque en carton PAP 21 à recycler,\r\n1 opercule en carton C/PAP 82 à recycler,\r\n1 pot en verre à recycler" - packaging_text_id: '' - packaging_text_it: '' - packaging_text_nl: '' - packagings: - - material: 'en:clear-glass' - photographers_tags: - - user1 - - user2 - - user3 - - user4 - pnns_groups_1: Sugary snacks - pnns_groups_1_tags: - - sugary-snacks - - known - pnns_groups_2: Sweets - pnns_groups_2_tags: - - sweets - - known - popularity_key: 20999992556 - popularity_tags: - - top-10-scans-2021 - - top-50-scans-2021 - - top-100-scans-2021 - - top-500-scans-2021 - - top-1000-scans-2021 - - top-5000-scans-2021 - - top-10000-scans-2021 - - top-50000-scans-2021 - - top-100000-scans-2021 - - top-10-fr-scans-2021 - - top-50-fr-scans-2021 - - top-100-fr-scans-2021 - - top-500-fr-scans-2021 - - top-1000-fr-scans-2021 - - top-5000-fr-scans-2021 - - top-10000-fr-scans-2021 - - top-50000-fr-scans-2021 - - top-100000-fr-scans-2021 - - top-country-fr-scans-2021 - - at-least-5-fr-scans-2021 - - at-least-10-fr-scans-2021 - product_name: Nutella - product_name_ar: نوتيلا - product_name_de: Nutella - product_name_en: Nutella - product_name_es: Nutella - product_name_fr: Pâte à tartiner Nutella noisettes et cacao - 400g - product_name_id: '' - product_name_it: Nutella - product_name_nl: '' - product_quantity: '400' - purchase_places: F - 77480 Mousseaux les Bray France - purchase_places_tags: - - f-77480-mousseaux-les-bray-france - quantity: 400g - removed_countries_tags: [] - rev: 421 - scans_n: 3713 - scores: {} - selected_images: - front: - display: - en: 'https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.400.jpg' - fr: 'https://images.openfoodfacts.org/images/products/301/762/042/2003/front_fr.415.400.jpg' - small: - en: 'https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.200.jpg' - fr: 'https://images.openfoodfacts.org/images/products/301/762/042/2003/front_fr.415.200.jpg' - thumb: - en: 'https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.100.jpg' - fr: 'https://images.openfoodfacts.org/images/products/301/762/042/2003/front_fr.415.100.jpg' - ingredients: - display: - fr: 'https://images.openfoodfacts.org/images/products/301/762/042/2003/ingredients_fr.299.400.jpg' - small: - fr: 'https://images.openfoodfacts.org/images/products/301/762/042/2003/ingredients_fr.299.200.jpg' - thumb: - fr: 'https://images.openfoodfacts.org/images/products/301/762/042/2003/ingredients_fr.299.100.jpg' - nutrition: - display: - en: 'https://images.openfoodfacts.org/images/products/301/762/042/2003/nutrition_en.400.400.jpg' - small: - en: 'https://images.openfoodfacts.org/images/products/301/762/042/2003/nutrition_en.400.200.jpg' - thumb: - en: 'https://images.openfoodfacts.org/images/products/301/762/042/2003/nutrition_en.400.100.jpg' - packaging: - display: - fr: 'https://images.openfoodfacts.org/images/products/301/762/042/2003/packaging_fr.420.400.jpg' - small: - fr: 'https://images.openfoodfacts.org/images/products/301/762/042/2003/packaging_fr.420.200.jpg' - thumb: - fr: 'https://images.openfoodfacts.org/images/products/301/762/042/2003/packaging_fr.420.100.jpg' - serving_quantity: '15' - serving_size: 15g - sortkey: 1610877517 - sources: - - fields: - - product_name_de - - product_name_it - - brands - - countries - id: openfood-ch - images: [] - import_t: 1548767279 - manufacturer: '0' - name: FoodRepo - source_licence: Creative Commons Attribution 4.0 International License - source_licence_url: 'https://creativecommons.org/licenses/by/4.0/' - url: 'https://www.foodrepo.org/ch/products/19413' - - fields: - - packaging - - ingredients_text_fr - id: ferrero - images: [] - import_t: 1552318840 - manufacturer: '1' - name: Ferrero - url: 'https://www.ferrero.fr' - sources_fields: - org-gs1: - gln: '3010176200101' - gpcCategoryCode: '10000187' - gpcCategoryName: Pâtes à Tartiner Sucrées (Longue Conservation) - isAllergenRelevantDataProvided: 'true' - lastChangeDateTime: '2022-07-13T16:01:41+02:00' - partyName: FERRERO FRANCE COMMERCIALE - productionVariantDescription: '2014' - publicationDateTime: '2022-07-13T16:01:41+02:00' - states: 'en:to-be-completed, en:nutrition-facts-completed, en:ingredients-completed, en:expiration-date-completed, en:packaging-code-to-be-completed, en:characteristics-to-be-completed, en:origins-to-be-completed, en:categories-completed, en:brands-completed, en:packaging-completed, en:quantity-completed, en:product-name-completed, en:photos-to-be-validated, en:packaging-photo-to-be-selected, en:nutrition-photo-selected, en:ingredients-photo-to-be-selected, en:front-photo-selected, en:photos-uploaded' - states_hierarchy: - - 'en:to-be-completed' - - 'en:nutrition-facts-completed' - - 'en:ingredients-completed' - - 'en:expiration-date-completed' - - 'en:packaging-code-to-be-completed' - - 'en:characteristics-to-be-completed' - - 'en:origins-to-be-completed' - - 'en:categories-completed' - - 'en:brands-completed' - - 'en:packaging-completed' - - 'en:quantity-completed' - - 'en:product-name-completed' - - 'en:photos-to-be-validated' - - 'en:packaging-photo-to-be-selected' - - 'en:nutrition-photo-selected' - - 'en:ingredients-photo-to-be-selected' - - 'en:front-photo-selected' - - 'en:photos-uploaded' - states_tags: - - 'en:to-be-completed' - - 'en:nutrition-facts-completed' - - 'en:ingredients-completed' - - 'en:expiration-date-completed' - - 'en:packaging-code-to-be-completed' - - 'en:characteristics-to-be-completed' - - 'en:origins-to-be-completed' - - 'en:categories-completed' - - 'en:brands-completed' - - 'en:packaging-completed' - - 'en:quantity-completed' - - 'en:product-name-completed' - - 'en:photos-to-be-validated' - - 'en:packaging-photo-to-be-selected' - - 'en:nutrition-photo-selected' - - 'en:ingredients-photo-to-be-selected' - - 'en:front-photo-selected' - - 'en:photos-uploaded' - stores: 'Bi1 Magasins U Carrefour Franprix Auchan Casino Intermarché,carrefour.fr' - stores_tags: - - bi1-magasins-u-carrefour-franprix-auchan-casino-intermarche - - carrefour-fr - teams: 'pain-au-chocolat,shark-attack,stakano,chocolatine,la-robe-est-bleue,vegan,m,b,c,vegancheck' - teams_tags: - - pain-au-chocolat - - shark-attack - - stakano - - chocolatine - - la-robe-est-bleue - - vegan - - m - - b - - c - - vegancheck - traces: '' - traces_from_ingredients: '' - traces_from_user: '(fr) ' - traces_hierarchy: [] - traces_lc: fr - traces_tags: [] - unique_scans_n: 2544 - unknown_ingredients_n: 2 - unknown_nutrients_tags: [] - update_key: ing20220322 - vitamins_prev_tags: [] - vitamins_tags: [] - status: 1 - status_verbose: product found \ No newline at end of file diff --git a/Tools/ref/requestBodies/add_or_edit_a_product.yaml b/Tools/ref/requestBodies/add_or_edit_a_product.yaml deleted file mode 100644 index 5cf65f1..0000000 --- a/Tools/ref/requestBodies/add_or_edit_a_product.yaml +++ /dev/null @@ -1,58 +0,0 @@ -type: object -description: | - You can provide most of the properties defined in the product schema. -properties: - code: - type: string - description: The barcode of the product to be added or edited - example: '0074570036004' - user_id: - type: string - description: A valid username. - example: myusername - password: - type: string - description: A valid corresponding password. - example: mypassword - comment: - type: string - description: A comment for the change. It will be shown in product changes history. - example: new packaging from super-app - brands: - schema: - type: array - items: - type: string - style: form - explode: false - description: The brands of the product (comma separated list of values). - example: Häagen-Dazs,General-mills - labels: - schema: - type: array - items: - type: string - style: form - explode: false - description: The labels of the product (comma separated list of values). - example: Kosher,Ferroro - categories: - schema: - type: array - items: - type: string - style: form - explode: false - description: The categories of the product (comma separated list of values). - example: Desserts,Frozen foods - packaging: - type: string - description: | - Packaging type, format, material. - The [v3 API documentation](https://openfoodfacts.github.io/openfoodfacts-server/api/ref-v3/#operation/post-api-v3-product-barcode) - has a more structured data for `packaging`. - example: Frozen -required: - - code - - user_id - - password diff --git a/Tools/ref/requestBodies/add_photo_to_existing_product.yaml b/Tools/ref/requestBodies/add_photo_to_existing_product.yaml deleted file mode 100644 index 97780c1..0000000 --- a/Tools/ref/requestBodies/add_photo_to_existing_product.yaml +++ /dev/null @@ -1,31 +0,0 @@ -type: object -properties: - code: - type: string - description: | - Barcode of the product - example: '3017620422003' - imagefield: - type: string - description: | - Indicates the type of the image and the corresponding language. It should - be in the format `{IMAGE_TYPE}_{LANG}` format, where `IMAGE_TYPE` is one - of `front|ingredients|nutrition|packaging|other` and `LANG` is the 2 - letter language code. Use `other` if you don't want the image to be - selected. Note that the first image of a product is always selected as front - picture. - example: front_en - imgupload_front_en: - type: string - format: binary - description: | - This field must contain image binary content. - The format and extension must be one of gif|jpeg|jpg|png|heic. - This field is dynamic and dependent on the value of imagefield in the - request body. It wil be imgupload_the value of the imagefield stated - earlier. For example, if `imagefield=front_en`, the name of this field - should be `imageupload_front_en`. -required: - - code - - imagefield - - imgupload_front_en diff --git a/Tools/ref/requestBodies/change_ref_properties.yaml b/Tools/ref/requestBodies/change_ref_properties.yaml deleted file mode 100644 index c98dbd9..0000000 --- a/Tools/ref/requestBodies/change_ref_properties.yaml +++ /dev/null @@ -1,32 +0,0 @@ -type: object -description: | - Properties that goes in change ref -properties: - comment: - type: string - description: | - A comment on the contribution. - Adding meaningful comments help moderators and users understand a single product history. - app_name: - type: string - description: | - Name of the app providing the information - app_version: - type: string - description: | - Version of the app providing the information - app_uuid: - type: string - description: | - When an app uses a single user to log its contributions, - it might be interesting to know which user of the app is providing the information. - You can use this field to provide an identifier (eg: an sha1 of the username) that's privacy preserving. Make sure that your salt is strong, perfectly random and secret - - In case we have trouble with one of your user, it helps our moderators revert edits. - User-Agent: - type: string - description: | - It is required that you pass a specific User-Agent header when you do an API request. - But some times it's not possible to modify such a header - (eg. request using JavaScript in a browser). - In such cases, you can override it with this parameter. diff --git a/Tools/ref/requestBodies/crop_a_photo.yaml b/Tools/ref/requestBodies/crop_a_photo.yaml deleted file mode 100644 index 2ab18bb..0000000 --- a/Tools/ref/requestBodies/crop_a_photo.yaml +++ /dev/null @@ -1,69 +0,0 @@ -type: object -description: | - Select a photo and optionally crop/rotate it. - The origin of the cropping coordinates is the top-left corner. - Note that rotation is applied *before* cropping, so the cropping bounding box - is relative to the rotated image. -required: - - id - - code - - imgid -properties: - code: - type: string - description: Barcode of the product. - example: "04963406" - imgid: - type: integer - description: identifier of the image to select, it should be a number - example: 2 - id: - type: string - description: | - identifier of the selected image field, should be in the format - `{IMAGE_TYPE}_{LANG}` format, where `IMAGE_TYPE` is one of - `front|ingredients|nutrition|packaging|other` and `LANG` is the 2 letter - language code. - Note that if you select an image for the main language of the product (ex: - `ingredients_it` if `it` is the main language), this image will be - displayed on Product Opener for all languages (ex: on - `https://fr.openfoodfacts.org`, unless `ingredients_fr` exists). - example: front_en - x1: - type: integer - example: 0 - description: X origin coordinate of the crop, it must be lower than x2 - y1: - type: integer - example: 0 - description: Y origin coordinate of the crop, it must be lower than y2 - x2: - type: integer - example: 145 - description: X end coordinate of the crop, it must be higher than x1 - y2: - type: integer - example: 145 - description: Y end coordinate of the crop, it must be higher than y1 - angle: - type: integer - example: 0 - description: | - angle of the rotation to apply on the selected image. - passing `90` as value rotate the image 90 degrees counter-clockwise. - normalize: - type: string - example: "false" - description: whether the selected image should be normalized using ImageMagick - enum: - - "true" - - "false" - white_magic: - type: string - default: "false" - description: | - whether the source image should be white magiced (background removal) using - ImageMagick. - enum: - - "true" - - "false" \ No newline at end of file diff --git a/Tools/ref/requestBodies/fields_tags_lc.yaml b/Tools/ref/requestBodies/fields_tags_lc.yaml deleted file mode 100644 index 7bb7443..0000000 --- a/Tools/ref/requestBodies/fields_tags_lc.yaml +++ /dev/null @@ -1,22 +0,0 @@ -title: Fields requested and language for taxonomized tags fields -x-stoplight: - id: dt27yo5v076qu -type: object -description: '' -properties: - fields: - type: string - description: 'Comma separated list of fields requested in the response. Special values: "updated": returns field that were updated by the query (e.g. sending "packagings" or "packagings_add" would return "packagings"), "none": returns no fields, "all": returns all fields except generated fields that need to be explicitly requested such as "knowledge_panels". Defaults to "updated" for WRITE requests, and "all" for READ requests.' - tags_lc: - type: string - description: |- - 2 letter language code to request names of tags in a specific language. - - For READ requets: if passed, all taxonomized tags of the response will include a lc_name property with the translation in the requested language, if available. Otherwise, the property value will contain the name in the original language, prefixed by the 2 language code and a colon. - - For WRITE requests: if passed, taxonomized tags fields with a lc_name property will be considered to be in this language. -examples: - - fields: 'product_name,packagings' - tags_lc: fr - - fields: updated - tags_lc: fr diff --git a/Tools/ref/requestBodies/lc_cc.yaml b/Tools/ref/requestBodies/lc_cc.yaml deleted file mode 100644 index 4012eee..0000000 --- a/Tools/ref/requestBodies/lc_cc.yaml +++ /dev/null @@ -1,15 +0,0 @@ -title: Language and country of the user -x-stoplight: - id: iemwzgz7wc8b9 -type: object -properties: - lc: - type: string - description: '2 letter code of the language of the interface. Used for localizing some fields in returned values (e.g. knowledge panels). If not passed, the language may be inferred by the country of the user (passed through the cc field or inferred by the IP address).' - cc: - type: string - description: '2 letter code of the country of the user. Used for localizing some fields in returned values (e.g. knowledge panels). If not passed, the country may be inferred by the IP address of the request.' -description: '' -examples: - - lc: fr - cc: fr diff --git a/Tools/ref/requestBodies/unselect_a_photo.yaml b/Tools/ref/requestBodies/unselect_a_photo.yaml deleted file mode 100644 index f0200c2..0000000 --- a/Tools/ref/requestBodies/unselect_a_photo.yaml +++ /dev/null @@ -1,10 +0,0 @@ -type: object -properties: - code: - type: string - description: code of the product - example: '4251105501381' - id: - type: string - description: image field (image id) of the photo to unselect - example: front_fr diff --git a/Tools/ref/responses/add_or_edit_a_product.yaml b/Tools/ref/responses/add_or_edit_a_product.yaml deleted file mode 100644 index 501d6e6..0000000 --- a/Tools/ref/responses/add_or_edit_a_product.yaml +++ /dev/null @@ -1,8 +0,0 @@ -type: object -properties: - status_verbose: - type: string - example: fields saved - status: - type: integer - example: 1 \ No newline at end of file diff --git a/Tools/ref/responses/add_photo_to_existing_product.yaml b/Tools/ref/responses/add_photo_to_existing_product.yaml deleted file mode 100644 index fe64c95..0000000 --- a/Tools/ref/responses/add_photo_to_existing_product.yaml +++ /dev/null @@ -1,47 +0,0 @@ -#TODO: Describe these response fields -type: object -properties: - files: - type: array - items: - type: object - properties: - url: - type: string - example: /product/3017620422003/nutella-ferrero - filename: - type: string - example: '' - name: - type: string - example: Nutella - Ferrero - 400g - thumbnailUrl: - type: string - example: /images/products/301/762/042/2003/123.100.jpg - code: - type: string - example: '3017620422003' - image: - type: object - properties: - thumb_url: - type: string - example: 123.100.jpg - imgid: - type: integer - example: 123 - crop_url: - type: string - example: 123.400.jpg - imgid: - type: integer - example: 123 - status: - type: string - example: status ok - imagefield: - type: string - example: front_en - code: - type: string - example: '3017620422003' diff --git a/Tools/ref/responses/change_ref_properties.yaml b/Tools/ref/responses/change_ref_properties.yaml deleted file mode 100644 index 501d6e6..0000000 --- a/Tools/ref/responses/change_ref_properties.yaml +++ /dev/null @@ -1,8 +0,0 @@ -type: object -properties: - status_verbose: - type: string - example: fields saved - status: - type: integer - example: 1 \ No newline at end of file diff --git a/Tools/ref/responses/get_attribute_groups.yaml b/Tools/ref/responses/get_attribute_groups.yaml deleted file mode 100644 index 91f13f7..0000000 --- a/Tools/ref/responses/get_attribute_groups.yaml +++ /dev/null @@ -1,45 +0,0 @@ -type: array -description: | - List of groups of attributes for personal search in a specific language. -items: - type: object - properties: - id: - type: string - description: unique id of the group - name: - type: string - description: Name of the group - attributes: - type: array - description: | - Attributes that are part of this group - items: - type: object - properties: - id: - type: string - description: unique id of the attribute - name: - type: string - description: Name of the attribute - icon_url: - type: string - description: url of icon to display next to the settings for this attribute - setting_name: - type: string - description: a description of the attribute to display to users - setting_note: - type: string - description: a complementary note on the attribute - default: - type: string - enum: - - "mandatory" - - "very_important" - - "important" - - "not_important" - description: Indicates the default setting for this attribute - panel_id: - type: string - description: Linked knowledge panel (optional) \ No newline at end of file diff --git a/Tools/ref/responses/get_nutrients.yaml b/Tools/ref/responses/get_nutrients.yaml deleted file mode 100644 index 4b1df7e..0000000 --- a/Tools/ref/responses/get_nutrients.yaml +++ /dev/null @@ -1 +0,0 @@ -$ref: ../schemas/nutrients.yaml \ No newline at end of file diff --git a/Tools/ref/responses/get_preferences.yaml b/Tools/ref/responses/get_preferences.yaml deleted file mode 100644 index 21a8527..0000000 --- a/Tools/ref/responses/get_preferences.yaml +++ /dev/null @@ -1,27 +0,0 @@ -type: array -description: | - Rules to apply to compute personal ranking of a product, - based upon the setting value of each attribute. -items: - type: object - properties: - id: - type: string - description: id for the setting value - enum: - - "not_important" - - "important" - - "very_important" - - "mandatory" - name: - type: string - description: name for the setting value, translated according to `lc` parameter - factor: - type: integer - description: | - factor to apply to the property of the product corresponding to attributes - having this setting value - minimum_match: - type: integer - description: | - FIXME diff --git a/Tools/ref/responses/get_product_by_barcode.yaml b/Tools/ref/responses/get_product_by_barcode.yaml deleted file mode 100644 index 38fb28b..0000000 --- a/Tools/ref/responses/get_product_by_barcode.yaml +++ /dev/null @@ -1,11 +0,0 @@ -x-stoplight: - id: cfk5obotr63sa -type: object -allOf: - - $ref: ./get_product_by_barcode_base.yaml - - type: object - properties: - product: - type: object - allOf: - - $ref: ../schemas/product.yaml \ No newline at end of file diff --git a/Tools/ref/responses/get_product_by_barcode_base.yaml b/Tools/ref/responses/get_product_by_barcode_base.yaml deleted file mode 100644 index 088c16c..0000000 --- a/Tools/ref/responses/get_product_by_barcode_base.yaml +++ /dev/null @@ -1,15 +0,0 @@ -type: object -x-stoplight: - id: s4gz59htj4gc3 -properties: - code: - type: string - description: | - Barcode of the product - (can be EAN-13 or internal codes for some food stores). - For products without a barcode, Open Food Facts assigns a - number starting with the 200 reserved prefix. - status: - type: integer - status_verbose: - type: string diff --git a/Tools/ref/responses/ocr_on_product.yaml b/Tools/ref/responses/ocr_on_product.yaml deleted file mode 100644 index c7899e7..0000000 --- a/Tools/ref/responses/ocr_on_product.yaml +++ /dev/null @@ -1,5 +0,0 @@ -type: object -properties: - status: - type: integer - example: 1 diff --git a/Tools/ref/responses/response-status/response_status.yaml b/Tools/ref/responses/response-status/response_status.yaml deleted file mode 100644 index 136dab1..0000000 --- a/Tools/ref/responses/response-status/response_status.yaml +++ /dev/null @@ -1,61 +0,0 @@ -title: Response status -x-stoplight: - id: 54bh0c5mejahn -type: object -description: 'A response object to describe if a READ or WRITE request was successful or not, and if there were errors or warnings, and what the impact of those errors or warnings was.' -examples: - - status_id: success_with_errors - result: - id: product_updated - name: Product updated - lc_name: Produit mis à jour - errors: - - message: - id: sugars_higher_than_carbohydrates - name: Sugars higher than carbohydrates - lc_name: Sucres plus élevés que les glucides - description: Sugars (40g) are higher than carbohydrates (35g). - lc_description: Les sucres (40g) sont plus élévés que les glucdes. - field: - id: nutriment.sugars - value: '40' - impact: - id: nutrients_not_updated - name: Nutrients not updated - lc_name: Nutriments non mis à jour - description: The nutrients were not updated. - lc_description: Les nutriments n'ont pas été mis à jour. -properties: - status_id: - type: string - enum: - - success - - success_with_warnings - - success_with_errors - - failure - description: 'Overall status of the request: whether it failed or succeeded, with or without warnings or errors.' - result: - type: object - description: |- - Overall result - of the request (e.g. a product has been created) - properties: - id: - type: string - description: Identifier of a response result entry - name: - type: string - description: Name of the response result entry in English. - lc_name: - type: string - description: 'Name of the response result entry in the language specified in tags_lc, if supplied.' - warnings: - type: array - description: 'List of warnings. Warnings are used to alert about something that may be wrong, but is not necessarily wrong (e.g. a nutrient value that is unexpectedly high).' - items: - $ref: ./warning-or-error.yaml - errors: - type: array - description: List of errors. Errors are used to alert about something that is definitely wrong (e.g. a nutrient value thaty is impossibly high). - items: - $ref: ./warning-or-error.yaml diff --git a/Tools/ref/responses/response-status/warning-or-error.yaml b/Tools/ref/responses/response-status/warning-or-error.yaml deleted file mode 100644 index 8b9bf73..0000000 --- a/Tools/ref/responses/response-status/warning-or-error.yaml +++ /dev/null @@ -1,64 +0,0 @@ -title: Warning or error message -x-stoplight: - id: eakkz8p7qfoj0 -type: object -description: 'Describes a warning or error for a READ or WRITE request, which field triggered it, and what the impact was (e.g. the field was ignored).' -examples: - - message: - id: sugars_higher_than_carbohydrates - name: Sugars higher than carbohydrates - lc_name: Sucres plus élevés que les glucides - description: Sugars (40g) are higher than carbohydrates (35g). - lc_description: Les sucres (40g) sont plus élévés que les glucdes. - field: - id: nutriment.sugars - value: '40' - impact: - id: nutrients_not_updated - name: Nutrients not updated - lc_name: Nutriments non mis à jour - description: The nutrients were not updated. - lc_description: Les nutriments n'ont pas été mis à jour. -properties: - message: - type: object - properties: - id: - type: string - description: | - Identifier of a response message. - name: - type: string - description: Name of the response message entry in English. - lc_name: - type: string - description: 'Name of the response message entry in the language specified in tags_lc, if supplied.' - description: - type: string - description: 'Description of the problem specific to the request, in English.' - lc_description: - type: string - description: 'Description of the problem specific to the request, in the language specified in tags_lc, if supplied.' - field: - type: object - description: Field that triggered the warning or error. - properties: - id: - type: string - description: Name of the field that triggered the warning or error. - value: - type: string - description: Value of the field that triggered the warning or error. - impact: - type: object - properties: - id: - type: string - name: - type: string - lc_name: - type: string - description: - type: string - lc_description: - type: string diff --git a/Tools/ref/responses/rotate_a_photo.yaml b/Tools/ref/responses/rotate_a_photo.yaml deleted file mode 100644 index c1a8284..0000000 --- a/Tools/ref/responses/rotate_a_photo.yaml +++ /dev/null @@ -1,17 +0,0 @@ -#TODO: Describe the response fields -#TODO: Api review to sort this response in a particular order. It is not fixed. -type: object -properties: - status: - type: string - example: status ok - imagefield: - type: string - example: nutrition_fr - image: - type: object - properties: - display_url: - type: string - example: nutrition_fr.67.400.jpg - diff --git a/Tools/ref/responses/search_for_products.yaml b/Tools/ref/responses/search_for_products.yaml deleted file mode 100644 index 40c9b3c..0000000 --- a/Tools/ref/responses/search_for_products.yaml +++ /dev/null @@ -1,38 +0,0 @@ -type: object -properties: - count: - type: integer - description: | - Total number of products found - example: 2701 - page: - type: integer - description: | - Page number of returned results. - - You can get a different page, by using the `page` query parameter. - example: 1 - page_count: - type: integer - description: | - Number of products in this page. - - This will differ from page_size only on the last page. - example: 24 - page_size: - type: integer - description: | - Requested number of products per pages - - To get the number of pages, divide count by page_size - (eg. `Math.floor( count / page_size) + 1 `) - example: 24 - products: - type: array - description: | - The products matching the query corresponding to current page - items: - $ref: ../schemas/product.yaml - skip: - type: integer - example: 0 diff --git a/Tools/ref/schemas/agribalyse.yaml b/Tools/ref/schemas/agribalyse.yaml deleted file mode 100644 index c8c990a..0000000 --- a/Tools/ref/schemas/agribalyse.yaml +++ /dev/null @@ -1,47 +0,0 @@ -type: object -properties: - agribalyse_food_code: - type: string - co2_agriculture: - type: number - co2_consumption: - type: integer - co2_distribution: - type: number - co2_packaging: - type: number - co2_processing: - type: number - co2_total: - type: number - co2_transportation: - type: number - code: - type: string - dqr: - type: string - ef_agriculture: - type: number - ef_consumption: - type: integer - ef_distribution: - type: number - ef_packaging: - type: number - ef_processing: - type: number - ef_total: - type: number - ef_transportation: - type: number - is_beverage: - type: integer - name_en: - type: string - description: | - This can be returned in many other languages - like name_fr (for french). - score: - type: integer - version: - type: string diff --git a/Tools/ref/schemas/image.yaml b/Tools/ref/schemas/image.yaml deleted file mode 100644 index ecf222b..0000000 --- a/Tools/ref/schemas/image.yaml +++ /dev/null @@ -1,36 +0,0 @@ -type: object -description: | - This object represent an image that was uploaded to a product. - "imgid" is an integer which is a sequential number unique to each picture. -properties: - sizes: - type: object - description: | - The available image sizes for the product (both reduced and full). - The reduced images are the ones with numbers as the key( 100, 200 etc) - while the full images have `full` as the key. - properties: - full: - description: | - properties of fullsize image - **TODO** explain how to compute name - $ref: ./image_size.yaml - patternProperties: - '(?100|400)': - description: | - properties of thumbnail of size `image_size`. - **TODO** explain how to compute name - - For real type: see description of property `full`. - (Put this way because of a [bug in rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) - type: string - uploaded_t: - type: string - example: '1457680652' - description: | - The time the image was uploaded (as unix timestamp). - uploader: - type: string - example: openfoodfacts-contributors - description: | - The contributor that uploaded the image. diff --git a/Tools/ref/schemas/image_role.yaml b/Tools/ref/schemas/image_role.yaml deleted file mode 100644 index b217778..0000000 --- a/Tools/ref/schemas/image_role.yaml +++ /dev/null @@ -1,57 +0,0 @@ -type: object -description: | - property of an image (or part thereof) selected for a particular role and a particular language. -properties: - angle: - type: integer - example: 0 - description: The angle of the image rotation (if it was rotated). - coordinates_image_size: - type: string - example: full - geometry: - type: string - example: "0x0--1--1" - imgid: - type: string - example: '121' - description: 'The id of the original/source image that was selected to edit(rotate, normalize etc) to produce this new image.' - normalize: - type: 'null' - example: null - description: Normalize colors. - rev: - type: string - example: '420' - sizes: - type: object - description: | - The available image sizes for the product (both reduced and full). - The reduced images are the ones with numbers as the key( 100, 200 etc) - while the full images have `full` as the key. - properties: - '100': - $ref: ./image_size.yaml - '200': - $ref: ./image_size.yaml - '400': - $ref: ./image_size.yaml - full: - $ref: ./image_size.yaml - white_magic: - type: 'null' - example: null - description: | - Photo on white background : Try to remove the background. - x1: - type: string - example: '-1' - x2: - type: string - example: '-1' - y1: - type: string - example: '-1' - y2: - type: string - example: '-1' diff --git a/Tools/ref/schemas/image_size.yaml b/Tools/ref/schemas/image_size.yaml deleted file mode 100644 index 58076d8..0000000 --- a/Tools/ref/schemas/image_size.yaml +++ /dev/null @@ -1,12 +0,0 @@ -type: object -properties: - h: - type: integer - example: 400 - description: | - The height of the reduced/full image in pixels. - w: - type: integer - example: 255 - description: | - The width of the reduced/full image in pixels. \ No newline at end of file diff --git a/Tools/ref/schemas/image_urls.yaml b/Tools/ref/schemas/image_urls.yaml deleted file mode 100644 index 10d56a6..0000000 --- a/Tools/ref/schemas/image_urls.yaml +++ /dev/null @@ -1,5 +0,0 @@ -type: object -patternProperties: - '(?\w\w)': - type: string - description: url of the image for language `language_code` \ No newline at end of file diff --git a/Tools/ref/schemas/ingredient.yaml b/Tools/ref/schemas/ingredient.yaml deleted file mode 100644 index 8e80443..0000000 --- a/Tools/ref/schemas/ingredient.yaml +++ /dev/null @@ -1,30 +0,0 @@ -type: array -description: | - This structure gives the different ingredients and some information about them, - like estimate on their quantity. -items: - type: object - properties: - id: - type: string - ingredients: - description: | - Sub ingredients composing this ingredients. - # self recursive - $ref: "#" - percent: - type: integer - percent_estimate: - type: - - number - percent_max: - type: - - number - percent_min: - type: integer - text: - type: string - vegan: - type: string - vegetarian: - type: string diff --git a/Tools/ref/schemas/knowledge_panels/elements/element.yaml b/Tools/ref/schemas/knowledge_panels/elements/element.yaml deleted file mode 100644 index 131312b..0000000 --- a/Tools/ref/schemas/knowledge_panels/elements/element.yaml +++ /dev/null @@ -1,39 +0,0 @@ -title: element -x-stoplight: - id: e2ybdrtmx0tme -type: object -description: | - Each element object contains one specific element object such as a text element or an image element. -properties: - type: - element_type: string - enum: - - text - - image - - action - - panel - - panel_group - - table - description: | - The type of the included element object. - The type also indicates which field contains the included element object. - e.g. if the type is "text", the included element object will be in the "text_element" field. - - Note that in the future, new type of element may be added, - so your code should ignore unrecognized types, and unknown properties. - - TODO: add Map type - text_element: - $ref: ./text_element.yaml - image_element: - $ref: ./image_element.yaml - action_element: - type: string - panel_element: - $ref: ./panel_element.yaml - panel_group_element: - $ref: ./panel_group_element.yaml - table_element: - $ref: ./table_element.yaml -required: - - type diff --git a/Tools/ref/schemas/knowledge_panels/elements/image_element.yaml b/Tools/ref/schemas/knowledge_panels/elements/image_element.yaml deleted file mode 100644 index 39b6410..0000000 --- a/Tools/ref/schemas/knowledge_panels/elements/image_element.yaml +++ /dev/null @@ -1,26 +0,0 @@ -title: image_element -x-stoplight: - id: k4v4kwt489q3j -type: object -properties: - url: - type: string - description: full URL of the image - width: - type: integer - description: | - Width of the image. - - This is just a suggestion coming from the server, - the client may choose to use its own dimensions for the image. - height: - type: integer - description: | - Height of the image. - - This is just a suggestion coming from the server, - the client may choose to use its own dimensions for the image. - alt_text: - type: string - description: Alt Text of the image. - diff --git a/Tools/ref/schemas/knowledge_panels/elements/panel_element.yaml b/Tools/ref/schemas/knowledge_panels/elements/panel_element.yaml deleted file mode 100644 index 6490202..0000000 --- a/Tools/ref/schemas/knowledge_panels/elements/panel_element.yaml +++ /dev/null @@ -1,9 +0,0 @@ -title: panel_element -x-stoplight: - id: ymx41elz4yrnj -type: object -description: Panels can include other panels as sub-panels using the panel_element. -properties: - panel_id: - type: string - description: The id of the panel to include. The id is the key of the panel in the panels object returned in the knowledge_panels field. diff --git a/Tools/ref/schemas/knowledge_panels/elements/panel_group_element.yaml b/Tools/ref/schemas/knowledge_panels/elements/panel_group_element.yaml deleted file mode 100644 index 9792c95..0000000 --- a/Tools/ref/schemas/knowledge_panels/elements/panel_group_element.yaml +++ /dev/null @@ -1,13 +0,0 @@ -title: panel_group_element -x-stoplight: - id: b7emlfrgiuue2 -type: object -properties: - title: - type: string - panel_ids: - type: array - description: The ids of the panels to include. The ids are the keys of the panels in the panels object returned in the knowledge_panels field. - items: - type: string -description: The panel group element is used to display an optional title followed by a number of sub-panels. diff --git a/Tools/ref/schemas/knowledge_panels/elements/table_element.yaml b/Tools/ref/schemas/knowledge_panels/elements/table_element.yaml deleted file mode 100644 index c408d4e..0000000 --- a/Tools/ref/schemas/knowledge_panels/elements/table_element.yaml +++ /dev/null @@ -1,32 +0,0 @@ -title: table_element -x-stoplight: - id: 38zu3z4sruqo7 -type: object -description: Element to display a table. -properties: - id: - type: string - description: An id for the table. - title: - type: string - description: | - Title of the column. - rows: - type: string - columns: - type: array - items: - type: object - properties: - type: - type: string - text: - type: string - text_for_small_screens: - type: string - style: - type: string - column_group_id: - type: string - shown_by_default: - type: boolean diff --git a/Tools/ref/schemas/knowledge_panels/elements/text_element.yaml b/Tools/ref/schemas/knowledge_panels/elements/text_element.yaml deleted file mode 100644 index 2309268..0000000 --- a/Tools/ref/schemas/knowledge_panels/elements/text_element.yaml +++ /dev/null @@ -1,51 +0,0 @@ -title: text_element -x-stoplight: - id: vdwxlt73qnqfa -type: object -description: |- - A text in simple HTML format to display. - - For some specific texts that correspond to a product field (e.g. a product name, the ingredients list of a product),the edit_field_* fields are used to indicate how to edit the field value. -properties: - type: - type: string - description: | - the type of text, might influence the way you display it. - enum: - - summary - - warning - - notes - html: - type: string - description: Text to display in HTML format. - language: - type: string - description: 'Language of the text. The name of the language is returned in the language requested when making the API call. e.g. if the text is in Polish, and the requested language is French, the language field will contain "Polonais" (French for "Polish"). Only set for specific fields such as the list of ingredients of a product.' - lc: - type: string - description: 2 letter language code for the text. Only set for specific fields such as the list of ingredients of a product. - edit_field_id: - type: string - description: id of the field used to edit this text in the product edit API. - edit_field_type: - type: string - description: Type of the product field. - edit_field_value: - type: string - description: Current value of the product field. This may differ from the html field which can contain extra formating. - source_url: - type: string - description: Link to the source - example: https://en.wikipedia.org/wiki/Sodium acetate - source_text: - type: string - description: name of the source - example: Wikipedia - source_lc: - type: string - description: Source locale name - example: en - source_language: - type: string - description: Human readable source locale name - example: English diff --git a/Tools/ref/schemas/knowledge_panels/elements/title_element.yaml b/Tools/ref/schemas/knowledge_panels/elements/title_element.yaml deleted file mode 100644 index 86f4fa1..0000000 --- a/Tools/ref/schemas/knowledge_panels/elements/title_element.yaml +++ /dev/null @@ -1,38 +0,0 @@ -title: title_element -x-stoplight: - id: lox0wvl9bdgy2 -type: object -description: The title of a panel. -properties: - name: - type: string - description: A short name of this panel, not including any actual values - title: - type: string - type: - type: string - enum: - - grade - - percentage - description: 'Used to indicate how the value of this item is measured, such as "grade" for Nutri-Score and Eco-Score or "percentage" for Salt' - grade: - type: string - description: The value for this panel where it corresponds to a A to E grade such as the Nutri-Score of the Eco-Score. - enum: - - a - - b - - c - - d - - e - - unknown - value: - type: number - description: 'The numeric value of the panel, where the type is "percentage"' - icon_url: - type: string - icon_color_from_evaluation: - type: string - icon_size: - type: string - description: | - If set to "small", the icon should be displayed at a small size. diff --git a/Tools/ref/schemas/knowledge_panels/panel.yaml b/Tools/ref/schemas/knowledge_panels/panel.yaml deleted file mode 100644 index 5c3e470..0000000 --- a/Tools/ref/schemas/knowledge_panels/panel.yaml +++ /dev/null @@ -1,50 +0,0 @@ -title: panel -x-stoplight: - id: mj9nhz3mqn05c -type: object -description: Each panel contains an optional title and an optional array of elements. -properties: - type: - type: string - description: 'Type of the panel. If set to "card", the panel and its sub-panels should be displayed in a card. If set to "inline", the panel should have its content always displayed.' - expanded: - type: boolean - description: 'If true, the panel is to be displayed already expanded. If false, only the title should be displayed, and the user should be able to click or tap it to open the panel and display the elements.' - expand_for: - type: string - description: 'If set to "large", the content of the panel should be expanded on large screens, but it should still be possible to unexpand it.' - evaluation: - type: string - description: A simple assessment of the panel value, typically used to format fonts, et.c e.g. bad = red - enum: - - good - - average - - neutral - - bad - - unknown - title_element: - $ref: ./elements/title_element.yaml - elements: - type: array - description: An ordered list of elements to display in the content of the panel. - items: - $ref: ./elements/element.yaml - level: - type: string - description: | - a message level, as levels we use in log. - It might help theming the panel visualy - example: info - size: - type: string - enum: - - small - description: | - size is either empty (normal display) - or small to indicate a panel that should have a smaller font size - example: small - topics: - type: array - items: - type: string - example: health diff --git a/Tools/ref/schemas/knowledge_panels/panels.yaml b/Tools/ref/schemas/knowledge_panels/panels.yaml deleted file mode 100644 index b6e982f..0000000 --- a/Tools/ref/schemas/knowledge_panels/panels.yaml +++ /dev/null @@ -1,15 +0,0 @@ -type: object -x-stoplight: - id: bcq3fkbtnwr5t -title: panels -description: |- - The panels object is a dictionary of individual panel objects. - Each key of the dictionary is the id of the panel, and the value is the panel object. - - Apps typically display a number of root panels with known panel ids (e.g. health_card and environment_card). Panels can reference other panels and display them as sub-panels. -examples: - - additionalProperties: string -properties: - additionalProperties: - $ref: ./panel.yaml -readOnly: true diff --git a/Tools/ref/schemas/nutrient_unit.yaml b/Tools/ref/schemas/nutrient_unit.yaml deleted file mode 100644 index 76458a7..0000000 --- a/Tools/ref/schemas/nutrient_unit.yaml +++ /dev/null @@ -1,21 +0,0 @@ -description: | - The unit in which the nutrient for 100g or per serving is measured. - - The possible values depends on the nutrient. - - * `g` for grams - * `mg` for milligrams - * `μg` for micrograms - * `cl` for centiliters - * `ml` for mililiters - * `dv` for recommended daily intakes (aka [Dietary Reference Intake](https://en.wikipedia.org/wiki/Dietary_Reference_Intake)) - * `% vol` for percentage per volume (e.g. alcohol vol per 100 ml) - * `%` for percentage - - 🤓 code: see the [Units module][units-module], - and [Food:default_unit_for_nid function][default-unit] - - [units-module]: https://openfoodfacts.github.io/openfoodfacts-server/dev/ref-perl-pod/ProductOpener/Units.html - [default-unit]: https://openfoodfacts.github.io/openfoodfacts-server/dev/ref-perl-pod/ProductOpener/Food.html#default_unit_for_nid_(_%24nid) -type: string -enum: ['g','mg','μg','cl','ml','dv','% vol','%'] diff --git a/Tools/ref/schemas/nutrients.yaml b/Tools/ref/schemas/nutrients.yaml deleted file mode 100644 index 7f2a14a..0000000 --- a/Tools/ref/schemas/nutrients.yaml +++ /dev/null @@ -1,26 +0,0 @@ -type: array -description: | - Nutrients and sub-nutrients of a product, with their name and default unit. -items: - type: object - properties: - id: - type: string - description: id of the nutrient - name: - type: string - description: Name of the nutrient in the requested language - important: - type: boolean - description: Indicates if the nutrient is always shown on the nutrition facts table - display_in_edit_form: - type: boolean - description: Indicates if the nutrient should be shown in the nutrition facts edit form - unit: - description: Default unit of the nutrient - $ref: "./nutrient_unit.yaml" - nutrients: - description: | - Sub-nutrients (e.g. saturated-fat is a sub-nutrient of fat). - # self recursive - $ref: "#/" \ No newline at end of file diff --git a/Tools/ref/schemas/nutrition_search.yaml b/Tools/ref/schemas/nutrition_search.yaml deleted file mode 100644 index cf5db20..0000000 --- a/Tools/ref/schemas/nutrition_search.yaml +++ /dev/null @@ -1,67 +0,0 @@ -type: object -description: Parameters of type nutrients (for search) -properties: - nutrient_lower_than: - in: query - name: '_lt_' - description: | - Search on nutrient lower than a value - schema: - type: object - patternProperties: - '(?\w+)(?_prepared)?(?100g|serving)<(?\d+)': - type: string - description: | - Will search for products with nutrients lower than `value` - per `portion` (100g or serving). - - If `prepared` is "prepared" search in prepared product instead of "as sold". - - Important: the parameter value is discarded and should be empty - examples: - - salt_100g_lt_2: - summary: salt per 100g is lower than 2g (in product as sold) - value: - "salt_100g<2": 1 - nutrient_greater_than: - in: query - name: '_gt_' - description: | - Search on nutrient greater than a value - schema: - type: object - patternProperties: - '(?\w+)(?_prepared)?(?100g|serving)>(?\d+)': - type: string - description: | - Will search for products with nutrients more than `value` - per `portion` (100g or serving). - - If `prepared` is "prepared" search in prepared product instead of "as sold". - - Important: the parameter value is discarded and should be empty - examples: - - carbohydrates_prepared_serving_gt_10: - summary: carbohydrates per serving is greater than 10g in prepared product - value: - "salt_100g>10": 1 - nutrient_equal: - in: query - name: '_eq_' - description: | - Search on nutrient for an exact quantity - schema: - type: object - patternProperties: - '(?\w+)(?_prepared)?(?100g|serving)': - type: string - description: | - Will search for products with nutrients exactl the parameter value - per `portion` (100g or serving). - - If `prepared` is "prepared" search in prepared product instead of "as sold". - examples: - - fat_100g_eq_5: - summary: fat per 100g is exactly equal to 5g (in product as sold) - value: - "fat_100g": 5 diff --git a/Tools/ref/schemas/packagings/input_taxonomy_tag.yaml b/Tools/ref/schemas/packagings/input_taxonomy_tag.yaml deleted file mode 100644 index 9433222..0000000 --- a/Tools/ref/schemas/packagings/input_taxonomy_tag.yaml +++ /dev/null @@ -1,14 +0,0 @@ -title: Input taxonomy tag -x-stoplight: - id: 7gx5uzyifakgo -type: string -description: |- - A tag entry, that will be matched against a taxonomy (e.g. a category, a label) - - The entry is a string that can contain either: - - - a taxonomy entry id, in the form [2 letter language code]:[normalized canonical name] (e.g. "en:green-teas") - - a string in a specific language, prefixed by the 2 letter language code (e.g. "fr:Thés verts") - - a string in the default language of the field (e.g. French for categories_tags_fr) or in the language indicated by the tags_lc request field (e.g. Thés verts) - - All entries will be matched to the corresponding taxonomy. It is possible to specify values that do not exist yet in the taxonomy. They may later be added as new taxonomy entries, or as new translations or synonyms of an existing entry. diff --git a/Tools/ref/schemas/packagings/material-write.yaml b/Tools/ref/schemas/packagings/material-write.yaml deleted file mode 100644 index 8125eba..0000000 --- a/Tools/ref/schemas/packagings/material-write.yaml +++ /dev/null @@ -1,17 +0,0 @@ -title: Packaging component material (WRITE) -x-stoplight: - id: vgm9p553p4vd9 -description: The material property is canonicalized using the packaging_materials taxonomy. -examples: - - id: string - - lc_name: bouteille -anyOf: - - properties: - id: - type: string - description: 'Canonical id of the entry in the taxonomy. If the value cannot be mapped to a taxonomy entry, the value must be the name of the entry in its original language prefixed by the language 2 letter code and a colon.' - - properties: - lc_name: - type: string - description: 'Name of the entry in the language specified in the tags_lc field of the request. If the translation is not available, the value must be the name of the entry in its original language prefixed by the language 2 letter code and a colon.' -type: object diff --git a/Tools/ref/schemas/packagings/material.yaml b/Tools/ref/schemas/packagings/material.yaml deleted file mode 100644 index 40adfa7..0000000 --- a/Tools/ref/schemas/packagings/material.yaml +++ /dev/null @@ -1,15 +0,0 @@ -title: Packaging component material -x-stoplight: - id: n6umazgqmwrd5 -type: object -description: The material property is canonicalized using the packaging_materials taxonomy. -examples: - - id: 'en:bottle' - lc_name: bouteille -properties: - id: - type: string - description: 'Canonical id of the entry in the taxonomy. If the value cannot be mapped to a taxonomy entry, the value will be the name of the entry in its original language prefixed by the language 2 letter code and a colon.' - lc_name: - type: string - description: 'Name of the entry in the language requested in the tags_lc field of the request. This field is returned only of tags_lc is specified. If the translation is not available, or if the entry does not exist in the taxonomy, the value will be the name of the entry in its original language prefixed by the language 2 letter code and a colon.' diff --git a/Tools/ref/schemas/packagings/packaging_component-write.yaml b/Tools/ref/schemas/packagings/packaging_component-write.yaml deleted file mode 100644 index 86196b5..0000000 --- a/Tools/ref/schemas/packagings/packaging_component-write.yaml +++ /dev/null @@ -1,53 +0,0 @@ -title: Packaging component (WRITE) -x-stoplight: - id: iacgfu9zaek8v -type: object -description: |- - Each packaging component has different properties to specify how many there are, its shape, material etc. - - The shape, material and recycling properties will be mapped to one entry in the packaging_shapes, packaging_materials and packaging_recycling taxonomies. - - For input, clients can either pass the id of a corresponding taxonomy entry (e.g. "en:pizza-box"), or a free text value prefixed with the language code of the text (e.g. "en:Pizza box", "fr:boite à pizza"). If the language code prefix is missing, the value of the "lc" field of the query will be used. - - The resulting structure will contain the id of the canonical entry in the taxonomy if it good be matched, or the free text value prefixed with the language code otherwise. - - For weights, the API is expecting a number with the number of grams. If a string is passed instead of a number, we will attempt to convert it to grams. The string may contain units (e.g. "6.9 g"), and use . or , as the decimal separator. Conversion may not work for all inputs. If a string was converted to a number, the API response will include a warning and specify the converted value. -examples: - - number_of_units: 6 - shape: - id: 'en:bottle' - material: - id: 'en:plastic' - recycling: - id: 'en:recycle' - quantity_per_unit: 25 cl - weight_measured: 10 -properties: - number_of_units: - type: integer - description: Number of units of this packaging component contained in the product (e.g. 6 for a pack of 6 bottles) - shape: - $ref: ./shape-write.yaml - material: - $ref: ./material-write.yaml - recycling: - $ref: ./recycling-write.yaml - quantity_per_unit: - type: string - description: Quantity (weight or volume) of food product contained in the packaging component. (e.g. 75cl for a wine bottle) - weight_specified: - type: - - number - - string - description: 'Weight (as specified by the manufacturer) of one unit of the empty packaging component (in grams). (e.g. for a 6 pack of 1.5l water bottles, it might be 30, the weight in grams of 1 empty water bottle without its cap which is a different packaging component). If passed a string - possibly with an unit - it will be converted to a number.' - weight_measured: - type: - - number - - string - description: 'Weight (as measured by one or more users) of one unit of the empty packaging component (in grams). (e.g. for a 6 pack of 1.5l water bottles, it might be 30, the weight in grams of 1 empty water bottle without its cap which is a different packaging component). If passed a string - possibly with an unit - it will be converted to a number.' - brands: - type: string - description: 'A comma separated list of brands / product names for the packaging component (e.g. "Tetra Pak", Tetra Brik"' - labels: - type: string - description: 'A comma separated list of labels, canonicalized with the packaging_labels taxonomy (e.g. "en:FSC, fr:Encre végétale")' diff --git a/Tools/ref/schemas/packagings/packaging_component.yaml b/Tools/ref/schemas/packagings/packaging_component.yaml deleted file mode 100644 index b1ada7e..0000000 --- a/Tools/ref/schemas/packagings/packaging_component.yaml +++ /dev/null @@ -1,61 +0,0 @@ -description: |- - Each packaging component has different properties to specify how many there are, its shape, material etc. - - The shape, material and recycling properties are mapped to one entry in the packaging_shapes, packaging_materials and packaging_recycling taxonomies, and the value of the property is the canonical name of the taxonomy entry (e.g. en:bottle). - - They may contain values that could not yet get matched to their respective taxonomy, in which case they will contain a free text value prefixed with the language code of this text value (e.g. "fr:Bouteille sphérique" might have been entered by a French user to indicate it is a spherical bottle). -title: Packaging component (READ) -type: object -examples: - - number_of_units: 6 - shape: - id: 'en:bottle' - lc_name: bouteille - material: - id: 'en:bottle' - lc_name: bouteille - recycling: - id: 'en:bottle' - lc_name: bouteille - quantity_per_unit: 25 cl - quantity_per_unit_value: 25 - quantity_per_unit_unit: cl - weight_specified: 30 - weight_measured: 32 - weight_estimated: 26 - weight: 30 - weight_source_id: specified -properties: - number_of_units: - type: integer - description: umber of units of this packaging component contained in the product (e.g. 6 for a pack of 6 bottles) - shape: - $ref: ./shape.yaml - material: - $ref: ./material.yaml - recycling: - $ref: ./recycling.yaml - quantity_per_unit: - type: string - description: Quantity (weight or volume) of food product contained in the packaging component. (e.g. 75cl for a wine bottle) - quantity_per_unit_value: - type: number - description: Value parsed from the quantity field. - quantity_per_unit_unit: - type: string - description: Unit parsed and normalized from the quantity field. - weight_specified: - type: number - description: 'Weight (as specified by the manufacturer) of one unit of the empty packaging component (in grams). (e.g. for a 6 pack of 1.5l water bottles, it might be 30, the weight in grams of 1 empty water bottle without its cap which is a different packaging component).' - weight_measured: - type: number - description: 'Weight (as measured by one or more users) of one unit of the empty packaging component (in grams). (e.g. for a 6 pack of 1.5l water bottles, it might be 30, the weight in grams of 1 empty water bottle without its cap which is a different packaging component).' - weight_estimated: - type: number - description: 'Weight (as estimated from similar products) of one unit of the empty packaging component (in grams). (e.g. for a 6 pack of 1.5l water bottles, it might be 30, the weight in grams of 1 empty water bottle without its cap which is a different packaging component).' - weight: - type: number - description: Weight of one unit of the empty packaging component. - weight_source_id: - type: string - description: 'Indicates which field was used to populate the "weight" field. Either "specified", "measured", or "estimated"' diff --git a/Tools/ref/schemas/packagings/packagings-write.yaml b/Tools/ref/schemas/packagings/packagings-write.yaml deleted file mode 100644 index e05839b..0000000 --- a/Tools/ref/schemas/packagings/packagings-write.yaml +++ /dev/null @@ -1,11 +0,0 @@ -type: array -x-stoplight: - id: 69xpogby1amz6 -title: Packagings (WRITE) -description: |- - The packagings object is an array of individual packaging component objects. - - The Packaging data document explains how packaging data is structured in Open Food Facts: https://openfoodfacts.github.io/openfoodfacts-server/dev/explain-packaging-data/ -examples: [] -items: - $ref: ./packaging_component-write.yaml diff --git a/Tools/ref/schemas/packagings/packagings.yaml b/Tools/ref/schemas/packagings/packagings.yaml deleted file mode 100644 index 174a519..0000000 --- a/Tools/ref/schemas/packagings/packagings.yaml +++ /dev/null @@ -1,38 +0,0 @@ -type: array -x-stoplight: - id: 1cyz4qo9njog7 -title: Packagings (READ) -description: |- - The packagings object is an array of individual packaging component objects. - - The Packaging data document explains how packaging data is structured in Open Food Facts: https://openfoodfacts.github.io/openfoodfacts-server/dev/explain-packaging-data/ - - The shape, material and recycling properties of each packaging component are linked to entries in the packaging_shapes, packaging_materials and packaging_recycling taxonomies: - - https://world.openfoodfacts.org/data/taxonomies/packaging_shapes.json - https://world.openfoodfacts.org/data/taxonomies/packaging_materials.json - https://world.openfoodfacts.org/data/taxonomies/packaging_recycling.json - - If the tags_lc field is set, the properties will include a lc_name field with the translation in the requested language. -examples: - - - number_of_units: 6 - shape: - id: 'en:bottle' - lc_name: bouteille - material: - id: 'en:bottle' - lc_name: bouteille - recycling: - id: 'en:bottle' - lc_name: bouteille - quantity_per_unit: 25 cl - quantity_per_unit_value: 25 - quantity_per_unit_unit: cl - weight_specified: 30 - weight_measured: 32 - weight_estimated: 26 - weight: 30 - weight_source_id: specified -items: - $ref: ./packaging_component.yaml -readOnly: true diff --git a/Tools/ref/schemas/packagings/packagings_complete.yaml b/Tools/ref/schemas/packagings/packagings_complete.yaml deleted file mode 100644 index 88b4b52..0000000 --- a/Tools/ref/schemas/packagings/packagings_complete.yaml +++ /dev/null @@ -1,7 +0,0 @@ -title: packagings_complete -x-stoplight: - id: hxnnsy954q1ey -type: integer -minimum: 0 -maximum: 1 -description: Indicate if the packagings array contains all the packaging parts of the product. This field can be set by users when they enter or verify packaging data. Possible values are 0 or 1. diff --git a/Tools/ref/schemas/packagings/recycling-write.yaml b/Tools/ref/schemas/packagings/recycling-write.yaml deleted file mode 100644 index bddbd11..0000000 --- a/Tools/ref/schemas/packagings/recycling-write.yaml +++ /dev/null @@ -1,17 +0,0 @@ -title: Packaging component recycling instruction (WRITE) -x-stoplight: - id: 72oyv89xtgc2n -description: The recycling property is canonicalized using the packaging_recycling taxonomy. -examples: - - id: string - - lc_name: bouteille -anyOf: - - properties: - id: - type: string - description: 'Canonical id of the entry in the taxonomy. If the value cannot be mapped to a taxonomy entry, the value must be the name of the entry in its original language prefixed by the language 2 letter code and a colon.' - - properties: - lc_name: - type: string - description: 'Name of the entry in the language specified in the tags_lc field of the request. If the translation is not available, the value must be the name of the entry in its original language prefixed by the language 2 letter code and a colon.' -type: object diff --git a/Tools/ref/schemas/packagings/recycling.yaml b/Tools/ref/schemas/packagings/recycling.yaml deleted file mode 100644 index 5396245..0000000 --- a/Tools/ref/schemas/packagings/recycling.yaml +++ /dev/null @@ -1,15 +0,0 @@ -title: Packaging component recycling instruction -x-stoplight: - id: 376tk8e2cmyh2 -type: object -description: The recycling property is canonicalized using the packaging_recycling taxonomy. -examples: - - id: 'en:bottle' - lc_name: bouteille -properties: - id: - type: string - description: 'Canonical id of the entry in the taxonomy. If the value cannot be mapped to a taxonomy entry, the value will be the name of the entry in its original language prefixed by the language 2 letter code and a colon.' - lc_name: - type: string - description: 'Name of the entry in the language requested in the tags_lc field of the request. This field is returned only of tags_lc is specified. If the translation is not available, or if the entry does not exist in the taxonomy, the value will be the name of the entry in its original language prefixed by the language 2 letter code and a colon.' diff --git a/Tools/ref/schemas/packagings/shape-write.yaml b/Tools/ref/schemas/packagings/shape-write.yaml deleted file mode 100644 index e16b14c..0000000 --- a/Tools/ref/schemas/packagings/shape-write.yaml +++ /dev/null @@ -1,17 +0,0 @@ -title: Packaging component shape (WRITE) -x-stoplight: - id: yi44igltu79cl -description: The shape property is canonicalized using the packaging_shapes taxonomy. -examples: - - id: string - - lc_name: bouteille -anyOf: - - properties: - id: - type: string - description: 'Canonical id of the entry in the taxonomy. If the value cannot be mapped to a taxonomy entry, the value must be the name of the entry in its original language prefixed by the language 2 letter code and a colon.' - - properties: - lc_name: - type: string - description: 'Name of the entry in the language specified in the tags_lc field of the request. If the translation is not available, the value must be the name of the entry in its original language prefixed by the language 2 letter code and a colon.' -type: object diff --git a/Tools/ref/schemas/packagings/shape.yaml b/Tools/ref/schemas/packagings/shape.yaml deleted file mode 100644 index f0e2896..0000000 --- a/Tools/ref/schemas/packagings/shape.yaml +++ /dev/null @@ -1,15 +0,0 @@ -title: Packaging component shape -x-stoplight: - id: xrj8agza3dwgf -type: object -description: The shape property is canonicalized using the packaging_shapes taxonomy. -examples: - - id: 'en:bottle' - lc_name: bouteille -properties: - id: - type: string - description: 'Canonical id of the entry in the taxonomy. If the value cannot be mapped to a taxonomy entry, the value will be the name of the entry in its original language prefixed by the language 2 letter code and a colon.' - lc_name: - type: string - description: 'Name of the entry in the language requested in the tags_lc field of the request. This field is returned only of tags_lc is specified. If the translation is not available, or if the entry does not exist in the taxonomy, the value will be the name of the entry in its original language prefixed by the language 2 letter code and a colon.' diff --git a/Tools/ref/schemas/product.yaml b/Tools/ref/schemas/product.yaml deleted file mode 100644 index 5cf3a8b..0000000 --- a/Tools/ref/schemas/product.yaml +++ /dev/null @@ -1,31 +0,0 @@ -type: object -description: | - This is all the fields describing a product and how to display it on a page. - - Refer to the different sub schema for more readable entries: - - * [Product Base](#cmp--schemas-product-base): Base fields of a product - * [Product Misc](#cmp--schemas-product-misc): Miscellaneous but important fields of a product - * [Product Tags](#cmp--schemas-product-tags): Tags fields on a product - * [Product Nutrition](#cmp--schemas-product-nutrition): Nutrition fields of a product - * [Product Ingredients](#cmp--schemas-product-ingredients): Fields about ingredients of a product - * [Product Images](#cmp--schemas-product-images): Information about Images of a product - * [Product Eco-Score](#cmp--schemas-product-images): Fields related to Eco-Score for a product - * [Product Metadata](#cmp--schemas-product-ecoscore): Metadata of a product (author, editors, etc.) - * [Product Data Quality](#cmp--schemas-product-quality): fields related to data quality for a product - * [Product Knowledge Panels](#cmp--schemas-product-knowledge-panels): Knowledge panels for a product - * [Product Attribute Groups](#cmp--schemas-product-attribute-groups): Attribute groups for personal product matching - -allOf: - - $ref: './product_base.yaml' - - $ref: './product_misc.yaml' - - $ref: './product_tags.yaml' - - $ref: './product_images.yaml' - - $ref: './product_ecoscore.yaml' - - $ref: './product_ingredients.yaml' - - $ref: './product_nutrition.yaml' - - $ref: './product_quality.yaml' - - $ref: './product_extended.yaml' - - $ref: './product_meta.yaml' - - $ref: './product_knowledge_panels.yaml' - - $ref: './product_attribute_groups.yaml' diff --git a/Tools/ref/schemas/product_attribute_groups.yaml b/Tools/ref/schemas/product_attribute_groups.yaml deleted file mode 100644 index c67814b..0000000 --- a/Tools/ref/schemas/product_attribute_groups.yaml +++ /dev/null @@ -1,51 +0,0 @@ -type: object -description: | - Specific data about a product to enable personal ranking -properties: - attribute_groups: - type: array - description: Each element is an attribute that can help compute a personal ranking for the product - items: - type: object - properties: - id: - type: string - description: | - Unique id of the attribute. - - It will be use to match against preferences parameters. - status: - type: string - enum: ["known", "unknown"] - description: wether we have the information to really compute this criteria or not. - title: - type: string - description: | - A descriptive sentence about the situation of the product concerning attribute - example: "Does not contain: Molluscs" - match: - type: number - format: float - minimum: 0 - maximum: 100 - description: | - a numeric value for the match, - telling how much the products ranks well for this particular attribute. - The higher the value, the better the match. - grade: - description: every attribute as a grade for a to e - type: string - enum: ['unknown', 'a', 'b', 'c', 'd', 'e'] - name: - type: string - description: The name of attribute, for eventual display - icon_url: - type: string - description: an icon representing the attribute match (often using a color) - description: - type: string - description: An eventual description of the value of the property upon which this attribute is based - description_short: - type: string - description: An eventual short description of the value of the property upon which this attribute is based - diff --git a/Tools/ref/schemas/product_base.yaml b/Tools/ref/schemas/product_base.yaml deleted file mode 100644 index 81a505d..0000000 --- a/Tools/ref/schemas/product_base.yaml +++ /dev/null @@ -1,96 +0,0 @@ -type: object -description: | - Base product data -properties: - abbreviated_product_name: - type: string - description: Abbreviated name in requested language - code: - type: string - description: | - barcode of the product (can be EAN-13 or internal codes for some food stores), - for products without a barcode, - Open Food Facts assigns a number starting with the 200 reserved prefix - codes_tags: - type: array - items: - type: string - description: | - A value which is the type of barcode "code-13" or "code-8" - and - A series of mask for the barcode - It helps retrieve barcodes starting by - example: | - ["code-13","3017620422xxx","301762042xxxx","30176204xxxxx","3017620xxxxxx","301762xxxxxxx","30176xxxxxxxx","3017xxxxxxxxx","301xxxxxxxxxx","30xxxxxxxxxxx","3xxxxxxxxxxxx"] - generic_name: - type: string - description: | - Legal name of the product as regulated - by the European authorities. - id: - description: | - internal identifier for the product, usually set to the value of `code`, - except on the producers platform where it is prefixed by the owner - type: string - lc: - type: string - description: | - Main language of the product. - This is a duplicate of `lang` property (for historical reasons). - lang: - type: string - description: | - Main language of the product. - - This should be the main language of product packaging (if one is predominant). - - Main language is also used to decide which ingredients list to parse. - nova_group: - type: integer - description: | - Nova group as an integer from 1 to 4. See https://world.openfoodfacts.org/nova - nova_groups: - type: string - obsolete: - type: string - obsolete_since_date: - description: | - A date at which the product was declared obsolete. - This means it's not produced any more. - type: string - product_name: - type: string - description: | - The name of the product - product_name_en: - type: string - description: | - The name of the product can also - be in many other languages like - product_name_fr (for French). - product_quantity: - type: string - description: | - The size in g or ml for the whole product. - It's a normalized version of the quantity field. - example: "500" - product_quantity_unit: - type: string - description: | - The unit (either g or ml) for the correponding product_quantity. - example: "g" - quantity: - type: string - description: | - Quantity and Unit. - - -patternProperties: - abbreviated_product_name_(?\w\w): - type: string - description: Abbreviated name in language `language_code`. - 'generic_name_(?\w\w)': - type: string - description: | - This can be returned in many other languages - like generic_name_fr (for French). diff --git a/Tools/ref/schemas/product_ecoscore.yaml b/Tools/ref/schemas/product_ecoscore.yaml deleted file mode 100644 index 31d0e6d..0000000 --- a/Tools/ref/schemas/product_ecoscore.yaml +++ /dev/null @@ -1,146 +0,0 @@ -type: object -description: | - Fields related to Eco-Score for a product. - - See also: `ecoscore_score`, `ecoscore_grade` and `ecoscore_tags`. - -properties: - ecoscore_data: - type: object - description: | - An object about a lot of details about data needed for Eco-Score computation - and complementary data of interest. - properties: - adjustments: - type: object - properties: - origins_of_ingredients: - type: object - properties: - aggregated_origins: - type: array - items: - type: object - properties: - origin: - type: string - percent: - type: integer - epi_score: - type: integer - epi_value: - type: integer - origins_from_origins_field: - type: array - items: - type: string - transportation_scores: - type: object - patternProperties: - (?\w\w): - type: integer - transportation_values: - type: object - patternProperties: - (?\w\w): - type: integer - - values: - type: object - patternProperties: - (?\w\w): - type: integer - warning: - type: string - packaging: - type: object - properties: - non_recyclable_and_non_biodegradable_materials: - type: integer - packagings: - type: array - items: - type: object - properties: - ecoscore_material_score: - type: integer - ecoscore_shape_ratio: - type: integer - material: - type: string - shape: - type: string - score: - type: integer - value: - type: integer - warning: - type: string - production_system: - type: object - properties: - labels: - type: array - example: "vegan, fat free, Kosher" - items: - type: string - value: - type: integer - warning: - type: string - threatened_species: - type: object - properties: - ingredient: - type: string - value: - type: integer - agribalyse: - $ref: "./agribalyse.yaml" - grade: - type: string - grades: - type: object - patternProperties: - (?\w\w): - type: string - missing: - type: object - properties: - labels: - type: integer - origins: - type: integer - packagings: - type: integer - - missing_data_warning: - type: integer - - previous_data: - type: object - properties: - grade: - type: string - score: - type: integer - agribalyse: - $ref: "./agribalyse.yaml" - score: - type: integer - scores: - type: object - patternProperties: - (?\w\w): - type: integer - status: - type: string - ecoscore_extended_data_version: - type: string - - environment_impact_level: - type: string - environment_impact_level_tags: - type: array - items: - type: object diff --git a/Tools/ref/schemas/product_extended.yaml b/Tools/ref/schemas/product_extended.yaml deleted file mode 100644 index b317ac6..0000000 --- a/Tools/ref/schemas/product_extended.yaml +++ /dev/null @@ -1,161 +0,0 @@ -type: object -properties: - additives_original_tags: - type: array - items: - type: string - additives_prev_original_tags: - type: array - items: - type: string - added_countries_tags: - type: array - items: - type: object - allergens_from_ingredients: - type: string - allergens_from_user: - type: string - - amino_acids_prev_tags: - type: array - items: - type: object - amino_acids_tags: - type: array - items: - type: object - carbon_footprint_percent_of_known_ingredients: - type: integer - categories_properties: - type: object - properties: - "agribalyse_food_code:en": - type: string - "agribalyse_proxy_food_code:en": - type: string - "ciqual_food_code:en": - type: string - categories_properties_tags: - type: array - items: - type: string - category_properties: - type: object - additionalProperties: - description: those are properties taken from the category taxonomy - type: string - ciqual_food_name_tags: - type: array - items: - type: string - compared_to_category: - type: string - description: | - the category to use for comparison. - - **TODO** explain how it is chosen. - conservation_conditions: - type: string - customer_service: - type: string - description: | - Contact info of customer service. - expiration_date: - type: string - - link: - type: string - description: | - link to the product on the website of the producer - - main_countries_tags: - type: array - items: - type: object - - minerals_prev_tags: - type: array - items: - type: object - minerals_tags: - type: array - items: - type: object - owner_fields: - type: object - description: | - Those are fields provided by the producer (through producers platform), - and the value he provided. - properties: - additionalProperties: - description: | - you can retrieve all kind of properties, the same as on the parent object (the product). - It's not processed entries (like tags for example) but raw ones. - oneOf: - - type: integer - - type: string - - type: object - nova_groups_markers: - type: object - description: | - Detail of ingredients or processing that makes the products having Nova 3 or 4 - properties: - "3": - description: | - Markers of level 3 - type: array - items: - type: array - description: | - This array has two element for each marker. - One - items: - type: string - "4": - description: | - Markers of level 4 - type: array - items: - # same as above - $ref: "#/properties/nova_groups_markers/properties/3/items" - - nucleotides_tags: - type: array - items: - type: object - origin: - type: string - purchase_places: - type: string - description: | - Country, state, or city where the product can be purchased. - example: Paris - purchase_places_tags: - type: array - items: - type: string - stores: - type: string - description: | - Distributor name. - example: Walmart - stores_tags: - type: array - items: - type: string - traces_from_ingredients: - type: string - traces_from_user: - type: string - - -patternProperties: - 'conservation_conditions_(?\w\w)': - type: string - 'customer_service_(?\w\w)': - type: string - 'origin_(?\w\w)': - type: string - description: | - `origin` in language indicated by `language_code` diff --git a/Tools/ref/schemas/product_hidden.yaml b/Tools/ref/schemas/product_hidden.yaml deleted file mode 100644 index 1ae3a7f..0000000 --- a/Tools/ref/schemas/product_hidden.yaml +++ /dev/null @@ -1,105 +0,0 @@ -type: object -detail: | - Here are referenced fields that one may found in the database but - either have no real meaning or should not be considered part of the API - -properties: - allergens_imported: - type: string - brands_imported: - type: string - countries_imported: - type: string - data_sources_imported: - type: string - lang_imported: - type: string - lc_imported: - type: string - no_nutrition_data_imported: - type: string - nutrition_data_per_imported: - type: string - obsolete_imported: - type: string - owner_imported: - type: string - packaging_imported: - type: string - producer_version_id_imported: - type: string - quantity_imported: - type: string - serving_size_imported: - type: string - - - grades: - type: object - - countries_beforescanbot: - type: string - nucleotides_prev_tags: - type: array - items: - type: object - - nutrition_data: - type: string - nutrition_data_prepared: - type: string - - _id: - type: string - description: id in database of the product, this normally is the barcode - _keywords: - type: array - items: - type: string - - max_imgid: - type: string - packaging: - type: string - packaging_hierarchy: - type: array - items: - type: string - packaging_lc: - type: string - packaging_tags: - type: array - items: - type: string - producer_version_id: - description: | - A version id internal to the producer. - We may grab those from PIM or GS1 platforms. - type: string - removed_countries_tags: - type: array - items: - type: object - sortkey: - type: integer - - vitamins_prev_tags: - type: array - items: - type: object - - scores: - type: object - -patternProperties: - 'abbreviated_product_name_(?\w\w)_imported': - type: string - 'conservation_conditions_(?\w\w)_imported': - type: string - 'customer_service_(?\w\w)_imported': - type: string - - 'ingredients_text_(?\w\w)_imported': - type: string - description: | - list of ingredients as imported by the producer in language_code \ No newline at end of file diff --git a/Tools/ref/schemas/product_images.yaml b/Tools/ref/schemas/product_images.yaml deleted file mode 100644 index 22d8ef5..0000000 --- a/Tools/ref/schemas/product_images.yaml +++ /dev/null @@ -1,98 +0,0 @@ -type: object -description: | - Information about Images of a product. - - Images ensure the reliability of Open Food Facts data. - It provides a primary source and proof of all the structured data. - You may therefore want to display it along the structured information. - - See also tutorials about images: - * [Getting images](https://openfoodfacts.github.io/openfoodfacts-server/api/how-to-download-images/) - * [Uploading images](https://openfoodfacts.github.io/openfoodfacts-server/api/tutorial-uploading-photo-to-a-product/) -properties: - images: - description: | - This contains properties for all images contained on the product. - type: object - properties: - 1: - type: object - description: | - This represents an image uploaded for this product. - $ref: ./image.yaml - front: - description: | - This represents an image (or part of it) selected for a specific role on this product. - type: object - $ref: ./image_role.yaml - patternProperties: - '(?\d+)': - description: | - See property `1` to get the real type of those objects - (Put this way because of a [bug in rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) - type: string - '(?front|nutrition|ingredients|packaging|other)_(?\w\w)': - description: | - See property `front` to get the real type of those objects - (Put this way because of a [bug in rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) - type: string - - last_image_dates_tags: - type: array - items: - type: string - last_image_t: - description: timestamp of last image upload (or update?) - type: integer - - selected_images: - type: object - description: | - URL for selected (important) images of the product. - - This is very handy if you display the product to users. - properties: - front: - type: object - description: URLs of thumbnails image of image of type `image_type` - properties: - display: - description: | - Thumbnail urls of product image (front) adapted to display on product page - type: object - $ref: 'image_urls.yaml' - small: - description: | - Thumbnail urls of product image (front) adapted to display on product list page - type: object - $ref: 'image_urls.yaml' - thumb: - description: | - Thumbnail urls of product image (front) in smallest format - type: object - $ref: 'image_urls.yaml' - patternProperties: - '(?front|packaging|ingredients|nutrition|other)': - description: | - See property `front` to get the real type of those objects - (Put this way because of a [bug in rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) - type: string - - image_small_url: - type: string - image_thumb_url: - type: string - image_url: - type: string - - patternProperties: - 'image(_(?front|packaging|ingredients|nutrition|other))?(_(?small|thumb))?_url': - description: | - the URL of image of type `image_type` in size `image_size` (or full size if not given). - - The `image_type` tells which image the url correspond to. `image_type` is `front` if not provided. - - The image is the one for current language (affected by `lc` parameter) if an image exists for this language, the image in main product language otherwise. - - **IMPORTANT:** you should use `selected_images` field instead of this one. - type: string diff --git a/Tools/ref/schemas/product_ingredients.yaml b/Tools/ref/schemas/product_ingredients.yaml deleted file mode 100644 index a3a797e..0000000 --- a/Tools/ref/schemas/product_ingredients.yaml +++ /dev/null @@ -1,167 +0,0 @@ -type: object -description: Fields about ingredients of a product -properties: - - additives_tags: - type: array - items: - type: string - allergens: - type: string - description: comma separated list of allergens - allergens_lc: - type: string - description: language in which `allergens` where input - allergens_hierarchy: - type: array - items: - type: string - allergens_tags: - type: array - items: - type: string - - ingredients: - $ref: ./ingredient.yaml - ingredients_analysis: - type: object - properties: - "en:palm-oil": - type: array - items: - type: string - "en:vegan-status-unknown": - type: array - items: - type: string - "en:vegetarian-status-unknown": - type: array - items: - type: string - ingredients_analysis_tags: - type: array - items: - type: string - ingredients_from_or_that_may_be_from_palm_oil_n: - type: integer - ingredients_from_palm_oil_n: - type: integer - ingredients_from_palm_oil_tags: - type: array - items: - type: object - ingredients_hierarchy: - type: array - items: - type: string - ingredients_n: - type: integer - ingredients_n_tags: - type: array - items: - type: string - ingredients_original_tags: - type: array - items: - type: string - ingredients_percent_analysis: - type: integer - ingredients_sweeteners_n: - type: integer - description: | - Number of sweeteners additives in the ingredients. Undefined if ingredients are not specified. - ingredients_non_nutritive_sweeteners_n: - type: integer - description: | - Number of non-nutritive sweeteners additives (as specified in the Nutri-Score formula) in the ingredients. Undefined if ingredients are not specified. - ingredients_tags: - type: array - items: - type: string - ingredients_lc: - type: string - description: | - Language that was used to parse the ingredient list. If `ingredients_text` is available - for the product main language (`lang`), `ingredients_lc=lang`, otherwise we look at - `ingredients_text` fields for other languages and set `ingredients_lc` to the first - non-empty `ingredient_text`. - ingredients_text: - type: string - description: | - Raw list of ingredients. This will get automatically - parsed and get used to compute the Eco-Score or find allergens, etc.. - - It's a copy of ingredients_text in the main language of the product (see `lang` proprety). - - example: | - Farine de blé* 67,4%, sucre de canne*, huile de tournesol oléique*, graines de chia* 5,2%, son de blé*, oranges déshydratées * 0,9%, farine de riz*, poudres à lever (acide citrique, carbonates de sodium), arôme naturel d'orange. - ingredients_text_with_allergens: - type: string - description: | - Same text as `ingredients_text` but where allergens have HTML elements around them to identify them - example: | - Farine de blé* 67,4%, sucre de canne*, huile de tournesol oléique*, graines de chia* 5,2%, son de blé*, oranges déshydratées * 0,9%, farine de riz*, poudres à lever (acide citrique, carbonates de sodium), arôme naturel d'orange. - ingredients_that_may_be_from_palm_oil_n: - type: integer - ingredients_that_may_be_from_palm_oil_tags: - type: array - items: - type: object - ingredients_with_specified_percent_n: - type: integer - ingredients_with_specified_percent_sum: - type: integer - ingredients_with_unspecified_percent_n: - type: integer - ingredients_with_unspecified_percent_sum: - type: integer - known_ingredients_n: - type: integer - origins: - type: string - description: | - Origins of ingredients - origins_hierarchy: - type: array - items: - type: object - origins_lc: - type: string - origins_tags: - type: array - items: - type: object - traces: - type: string - description: | - List of substances that might cause allergies - that are present in trace amounts in the product - (this does not include the ingredients, as they - are not only present in trace amounts). - It is taxonomized with the allergens taxonomy. - traces_hierarchy: - type: array - items: - type: object - traces_lc: - type: string - traces_tags: - type: array - items: - type: object - unknown_ingredients_n: - type: integer - - -patternProperties: - 'ingredients_text_(?\w\w)': - type: string - description: | - Raw list of ingredients in language given by 'language_code'. - - See `ingredients_text` - 'ingredients_text_with_allergens_(?\w\w)': - description: | - Like `ingredients_text_with_allergens` for a particular language - type: string - diff --git a/Tools/ref/schemas/product_knowledge_panels.yaml b/Tools/ref/schemas/product_knowledge_panels.yaml deleted file mode 100644 index 92dafe8..0000000 --- a/Tools/ref/schemas/product_knowledge_panels.yaml +++ /dev/null @@ -1,6 +0,0 @@ -type: object -description: | - Knowledge panels for a product -properties: - knowledge_panels: - $ref: ./knowledge_panels/panels.yaml diff --git a/Tools/ref/schemas/product_meta.yaml b/Tools/ref/schemas/product_meta.yaml deleted file mode 100644 index 6ff9c0d..0000000 --- a/Tools/ref/schemas/product_meta.yaml +++ /dev/null @@ -1,145 +0,0 @@ -type: object -description: | - Metadata of a product (author, editors, creation date, etc.) - -properties: - created_t: - type: integer - description: | - Date when the product was added (UNIX timestamp format). - See also `entry_dates_tags` - example: | - 1457680652 - creator: - type: string - description: | - The contributor who added the product first. - editors_tags: - description: | - List of editors who edited the product. - type: array - items: - type: string - - informers_tags: - type: array - items: - type: string - interface_version_created: - type: string - interface_version_modified: - type: string - languages: - type: object - patternProperties: - 'en:(?\w\w)': - type: integer - description: | - **TODO** explain ! - languages_codes: - type: object - patternProperties: - (?\w\w): - type: integer - description: | - Same as `languages` but by language code, instead of language tags - languages_hierarchy: - type: array - items: - type: string - languages_tags: - type: array - items: - type: string - last_edit_dates_tags: - type: array - items: - type: string - last_editor: - type: string - - last_modified_by: - type: string - description: | - The username of the user who last modified the product. - example: sebleouf - last_modified_t: - type: integer - description: | - Date when the product page was last modified. - owner: - description: | - Id of the producer in case he provides his own data about a product (producer platform). - type: string - owners_tags: - description: | - Tagyfied version of owner - type: string - photographers_tags: - type: array - items: - type: string - rev: - description: revision number of this product version (each edit adds a revision) - type: integer - sources: - type: array - items: - type: object - properties: - fields: - type: array - items: - type: string - id: - type: string - images: - type: array - items: - type: object - import_t: - type: integer - manufacturer: - type: - - integer - - string - name: - type: string - source_licence: - type: string - source_licence_url: - type: string - url: - type: - - "null" - - string - sources_fields: - type: object - properties: - org-gs1: - type: object - properties: - gln: - type: string - gpcCategoryCode: - type: string - gpcCategoryName: - type: string - isAllergenRelevantDataProvided: - type: string - lastChangeDateTime: - type: string - partyName: - type: string - productionVariantDescription: - type: string - publicationDateTime: - type: string - teams: - type: string - teams_tags: - type: array - items: - type: string - update_key: - type: string diff --git a/Tools/ref/schemas/product_misc.yaml b/Tools/ref/schemas/product_misc.yaml deleted file mode 100644 index 05ce5b5..0000000 --- a/Tools/ref/schemas/product_misc.yaml +++ /dev/null @@ -1,115 +0,0 @@ -type: object -description: | - Miscellaneous but important fields of a product -properties: - additives_n: - type: integer - description: | - Number of food additives. - checked: - type: string - complete: - type: integer - completeness: - type: number - ecoscore_grade: - type: string - description: | - See also: `ecoscore_tags` - ecoscore_score: - type: integer - description: | - See also: `ecoscore_tags` - food_groups: - type: string - food_groups_tags: - type: array - items: - type: string - nutrient_levels: - description: | - Traffic light indicators on main nutrients levels - type: object - properties: - fat: - type: string - enum: ["low", "moderate", "high"] - salt: - type: string - enum: ["low", "moderate", "high"] - saturated-fat: - type: string - enum: ["low", "moderate", "high"] - sugars: - type: string - enum: ["low", "moderate", "high"] - packaging_text: - type: string - description: | - Recycling instructions as raw text, e.g. Plastic - bottle to recycle, Plastic cap to recycle. - This will get automatically parsed and - will be used to compute the Eco-Score. - You can either request it (if it exists) or - send it in a specific language. - example: packaging_text_en - packagings: - $ref: ./packagings/packagings.yaml - packagings_complete: - $ref: ./packagings/packagings_complete.yaml - - pnns_groups_1: - description: | - Category of food according to [French Nutrition and Health Program](https://fr.wikipedia.org/wiki/Programme_national_nutrition_sant%C3%A9) - type: string - pnns_groups_1_tags: - type: array - items: - type: string - pnns_groups_2: - description: | - Sub Category of food according to [French Nutrition and Health Program](https://fr.wikipedia.org/wiki/Programme_national_nutrition_sant%C3%A9) - type: string - pnns_groups_2_tags: - type: array - items: - type: string - popularity_key: - description: | - An imprecise measurement of popularity based on Scan statistics. A higher value means higher popularity. - type: integer - popularity_tags: - description: | - Indicators for the popularity of a product, like the amount of scans in a specific year. - type: array - items: - type: string - scans_n: - type: integer - unique_scans_n: - type: integer - serving_quantity: - type: string - description: | - Normalized version of serving_size. - Note that this is NOT the number of servings by product. - (in perl, see `normalize_serving_size`) - serving_quantity_unit: - type: string - description: | - The unit (either g or ml) for the correponding serving_quantity. - example: "g" - serving_size: - type: string - description: | - Serving size text (generally in g or ml). - We expect a quantity + unit but the user is free to input any string. - -patternProperties: - 'food_groups_(?\w\w)': - type: string - description: see `food_groups` - 'packaging_text_(?\w\w)': - type: string - description: | - Packaging text in language designated by `language_code` diff --git a/Tools/ref/schemas/product_nutrition.yaml b/Tools/ref/schemas/product_nutrition.yaml deleted file mode 100644 index 3b22bfb..0000000 --- a/Tools/ref/schemas/product_nutrition.yaml +++ /dev/null @@ -1,339 +0,0 @@ -type: object -description: | - Nutrition fields of a product - - Most of these properties are read-only. - - See [how to add nutrition data](https://openfoodfacts.github.io/openfoodfacts-server/api/ref-cheatsheet/#add-nutrition-facts-values-units-and-base) -properties: - no_nutrition_data: - type: string - description: | - When a product does not have nutrition data displayed on the - packaging, the user can check the field "Nutrition facts are - not specified on the product". - By doing so, the no_nutrition_data field takes the value "on". - This case is frequent (thousands of products). - example: "on" - nutrition_data_per: - type: string - enum: - - serving - - 100g - description: | - The nutrition data on the package can be per serving or per 100g. - - This is essential to understand if `_value` and `` - values in `nutriments` applies for a serving or for 100g. - - **IMPORTANT:** - When writing products, - this setting applies to all existing nutrients values for the product, - not only the nutrient values sent in the write request. - So it should not be changed unless all nutrients values are provided - with values that match the nutrition_data_per field. - nutrition_data_prepared_per: - type: string - enum: - - serving - - 100g - description: | - The nutrition data for prepared product on the package (if any) can be per serving or per 100g. - - This is essential to understand if `_prepared_value` and `_prepared` - values in `nutriments` applies for a serving or for 100g. - - See also important note on `nutrition_data_per`. - nutriments: - type: object - description: | - All known nutrients for the product. - - Note that each nutrients are declined with a variety of suffixes like `_100g`, `_serving`, - see patternProperties below. - - A specific `_unit` is the unit used to measure the nutrient. - - Beware that some properties are to be interpreted based upon `nutrition_data_per` value. - - Also for products that have a nutrition table for prepared product - (eg. the nutrition facts for a bowl of milk with cocoa powder), - a `_prepared` suffix is added (before other suffixes). - - You can get all possible nutrients from the - [nutrients taxonomy](https://static.openfoodfacts.org/data/taxonomies/nutrients.json) - - **FIXME** add more nutrients with description. - properties: - alcohol: - description: | - Quantity of alcohol - - (per 100g or per serving) in a standard unit (g or ml) - type: number - carbohydrates: - type: number - energy: - type: number - description: | - It is the same as `energy-kj` if we have it, or computed from `energy-kcal` otherwise - - (per 100g or per serving) in kj - energy_value: - type: number - description: | - energy_value will be equal to energy-kj_value if we have it or to energy-kcal_value otherwise - energy_unit: - type: string - enum: ["kcal", "kj"] - description: | - Equal to energy-kj_unit if we have it or to energy-kcal_unit otherwise - energy-kcal: - type: number - description: | - energy in kcal, if it is specified - - (per 100g or per serving) in a standard unit (g or ml) - energy-kj: - type: number - description: | - energy in kj, if it is specified - - (per 100g or per serving) in a standard unit (g or ml) - fat: - type: number - fruits-vegetables-legumes-estimate-from-ingredients: - type: number - description: | - An estimate, from the ingredients list of the percentage of fruits, vegetable and legumes. - This is an important information for Nutri-Score (2023 version) computation. - fruits-vegetables-nuts-estimate-from-ingredients: - type: number - description: | - An estimate, from the ingredients list of the percentage of fruits, vegetable and nuts. - This is an important information for Nutri-Score (2021 version) computation. - nova-group: - type: integer - nutrition-score-fr: - description: | - Experimental nutrition score derived from - the UK FSA score and adapted for the French market - (formula defined by the team of Professor Hercberg). - proteins: - type: number - salt: - type: number - saturated-fat: - type: number - sodium: - type: number - sugars: - type: number - carbon-footprint-from-known-ingredients_product: - type: integer - carbon-footprint-from-known-ingredients_serving: - type: number - erythritol: - type: number - description: | - erythritol is a polyol which is not providing any energy. - As such, it needs not be taken into account when computing - the energy of a product. Eryhtritol is now displayed on - nutrition facts sheet of some products, mainly in the USA. - This value is entered either by contributors, either by - imports. - example: 12.5 - patternProperties: - '(?[\w-]+)_unit': - description: | - The unit in which the nutrient for 100g or per serving is measured. - - The possible values depends on the nutrient. - - * `g` for grams - * `mg` for milligrams - * `μg` for micrograms - * `cl` for centiliters - * `ml` for mililiters - * `dv` for recommended daily intakes (aka [Dietary Reference Intake](https://en.wikipedia.org/wiki/Dietary_Reference_Intake)) - * `% vol` for alcohol vol per 100 ml - - 🤓 code: see the [Units module][units-module], - and [Food:default_unit_for_nid function][default-unit] - - [units-module]: https://openfoodfacts.github.io/openfoodfacts-server/dev/ref-perl-pod/ProductOpener/Units.html - [default-unit]: https://openfoodfacts.github.io/openfoodfacts-server/dev/ref-perl-pod/ProductOpener/Food.html#default_unit_for_nid_(_%24nid) - type: string - enum: ['公斤', '公升', 'kg', 'кг', 'l', 'л', '毫克', 'mg', 'мг', 'mcg', 'µg', 'oz', 'fl oz', 'dl', 'дл', 'cl', 'кл', '斤', 'g', '', ' ', 'kj', '克', '公克', 'г', 'мл', 'ml', 'mmol/l', '毫升', '% vol', 'ph', '%', '% dv', '% vol (alcohol)', 'iu', 'mol/l', 'mval/l', 'ppm', '�rh', '�fh', '�e', '�dh', 'gpg'] - '(?[\w-]+)_100g': - description: | - The standardized value of a serving of 100g (or 100ml for liquids) - for the nutrient. - - This is computed from the `nutrient` property, - the serving size (if needed), and the `nutrient`_unit field. - - **Note**: - If you want to characterize products in a uniform way, this is the value you should use. - type: number - readOnly: true - '(?[\w-]+)_serving': - description: | - The standardized value of a serving for this product. - type: number - readOnly: true - '(?[\w-]+)_value': - description: | - The value input by the user / displayed on the product for the nutrient. - - * per 100g or serving, depending on `nutrition_data_per` - * in the unit of corresponding _unit field. - type: number - readOnly: true - '(?[\w-]+)_prepared': - description: | - The value for nutrient for **prepared** product. - type: number - '(?[\w-]+)_prepared_unit': - description: | - The unit in which the nutrient of **prepared** product is measured. - type: string - '(?[\w-]+)_prepared_100g': - description: | - The standardized value of a serving of 100g (or 100ml for liquids) - for the nutrient, for **prepared** product. - type: number - readOnly: true - '(?[\w-]+)_prepared_serving': - description: | - The standardized value of a serving for the **prepared** product. - type: number - readOnly: true - '(?[\w-]+)_prepared_value': - description: | - The standardized value for a serving or 100g (or 100ml for liquids), - depending on `nutrition_data_prepared_per` - for the nutrient for **prepared** product. - type: number - readOnly: true - nutriscore_data: - description: | - Detail of data the Nutri-Score was computed upon. - - **Note**: this might not be stable, don't rely too much on this, or, at least, tell us ! - - **TODO** document each property - type: object - properties: - energy: - type: integer - energy_points: - type: integer - energy_value: - type: integer - fiber: - type: integer - fiber_points: - type: integer - fiber_value: - type: integer - fruits_vegetables_nuts_colza_walnut_olive_oils: - type: integer - fruits_vegetables_nuts_colza_walnut_olive_oils_points: - type: integer - fruits_vegetables_nuts_colza_walnut_olive_oils_value: - type: integer - grade: - type: string - is_beverage: - type: integer - is_cheese: - type: integer - is_fat: - type: integer - is_water: - type: integer - negative_points: - type: integer - positive_points: - type: integer - proteins: - type: number - proteins_points: - type: integer - proteins_value: - type: number - saturated_fat: - type: number - saturated_fat_points: - type: integer - saturated_fat_ratio: - type: number - saturated_fat_ratio_points: - type: integer - saturated_fat_ratio_value: - type: number - saturated_fat_value: - type: number - score: - type: integer - sodium: - type: number - sodium_points: - type: integer - sodium_value: - type: number - sugars: - type: number - sugars_points: - type: integer - sugars_value: - type: number - nutriscore_grade: - description: | - Nutri-Score for the product as a letter. - - See https://world.openfoodfacts.org/nutriscore. - type: string - enum: ["a", "b", "c", "d", "e"] - nutriscore_score: - description: | - Nutri-Score for the product as an integer (see also `nutriscore_grade`). - type: integer - nutriscore_score_opposite: - type: integer - nutrition_grade_fr: - type: string - description: | - Nutrition grade (‘a’ to ‘e’), - https://world.openfoodfacts.org/nutriscore. - nutrition_grades: - description: | - Nutrition grades as a comma separated list. - - Some products with multiple components might have multiple Nutri-Score - type: string - nutrition_grades_tags: - type: array - items: - type: string - nutrition_score_beverage: - type: integer - nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients: - type: integer - nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients_value: - type: integer - nutrition_score_warning_no_fiber: - type: integer - other_nutritional_substances_tags: - type: array - items: - type: object - unknown_nutrients_tags: - type: array - items: - type: object - vitamins_tags: - type: array - items: - type: object diff --git a/Tools/ref/schemas/product_quality.yaml b/Tools/ref/schemas/product_quality.yaml deleted file mode 100644 index ae13f20..0000000 --- a/Tools/ref/schemas/product_quality.yaml +++ /dev/null @@ -1,66 +0,0 @@ -type: object -description: | - This is data that is linked to products data quality -properties: - data_quality_bugs_tags: - type: array - items: - type: object - data_quality_errors_tags: - type: array - items: - type: object - data_quality_info_tags: - type: array - items: - type: string - data_quality_tags: - type: array - items: - type: string - data_quality_warnings_tags: - type: array - items: - type: string - data_sources: - type: string - description: | - Source of data imported from producers. - data_sources_tags: - type: array - items: - type: string - last_check_dates_tags: - type: array - items: - type: string - last_checked_t: - type: integer - last_checker: - type: string - - states: - description: | - comma separated list of values indicating some states of the product, - like things to be done, or to be completed. - See [states taxonomy](https://static.openfoodfacts.net/data/taxonomies/states.json) - type: string - states_hierarchy: - type: array - items: - type: string - states_tags: - type: array - items: - description: | - Each state describe something that is completed or is to be done or improved on the product. - - Refer to [states taxonomy](https://static.openfoodfacts.net/data/taxonomies/states.json) - type: string - - misc_tags: - description: | - Information about different aspect of the product - type: array - items: - type: string diff --git a/Tools/ref/schemas/product_tags.yaml b/Tools/ref/schemas/product_tags.yaml deleted file mode 100644 index 314b51e..0000000 --- a/Tools/ref/schemas/product_tags.yaml +++ /dev/null @@ -1,119 +0,0 @@ -type: object -description: | - Data about a product which is represented as tags -properties: - - brands: - type: string - description: List of brands (not taxonomized) - brands_tags: - type: array - items: - type: string - description: List of brands (tags, not taxonomized) - - categories: - type: string - categories_hierarchy: - type: array - items: - type: string - categories_lc: - type: string - description: Categories language code - categories_tags: - type: array - items: - type: string - - checkers_tags: - type: array - items: - type: string - description: List of checkers (users who checked the product) tags - cities: - type: string - cities_tags: - type: array - items: - type: object - correctors_tags: - type: array - items: - type: string - - countries: - type: string - description: | - List of countries where the product is sold. - countries_hierarchy: - type: array - items: - type: string - countries_lc: - type: string - description: Countries language code - countries_tags: - type: array - items: - type: string - ecoscore_tags: - description: | - All ecoscore of a product. - Most of the time it's only one value, - but it might eventually be more for products composed of sub-products. - See also: `ecoscore_score`, `ecoscore_grade`. - type: array - items: - type: string - - emb_codes: - type: string - description: | - Packager code. EMB is the French system of traceability codes for packager. - example: EMB 2013330 - emb_codes_orig: - type: string - emb_codes_tags: - type: array - items: - type: object - - - labels: - type: string - labels_hierarchy: - type: array - items: - type: string - labels_lc: - type: string - labels_tags: - type: array - items: - type: string - - entry_dates_tags: - description: | - The data as a series of tag: `yyyy-mm-dd`, `yyyy-mm`, `yyyy` - type: array - items: - type: string - example: ["2016-03-11","2016-03","2016"] - - manufacturing_places: - type: string - description: | - Places where the product was manufactured or transformed. - manufacturing_places_tags: - type: array - items: - type: object - nova_groups_tags: - type: array - items: - type: string - nutrient_levels_tags: - type: array - items: - type: string diff --git a/Tools/ref/schemas/product_update_api_v3.yaml b/Tools/ref/schemas/product_update_api_v3.yaml deleted file mode 100644 index e700ac2..0000000 --- a/Tools/ref/schemas/product_update_api_v3.yaml +++ /dev/null @@ -1,28 +0,0 @@ -title: Product update API V3 (WRITE) -x-stoplight: - id: qnmmu2yuzc1xf -type: object -description: Model for creating or updating products using the v3 version of the product update API. -examples: [] -properties: - packagings: - $ref: ./packagings/packagings-write.yaml - packagings_add: - $ref: ./packagings/packagings-write.yaml - packagings_complete: - $ref: ./packagings/packagings_complete.yaml - lang: - type: string - minLength: 2 - maxLength: 2 - example: fr - description: 2 letter language code of the main language of the product (the most prominent on the packaging) - quantity: - type: string - serving_size: - type: string - categories_tags: - type: array - description: An array of categories - items: - $ref: ./packagings/input_taxonomy_tag.yaml diff --git a/Tools/ref/schemas/tags_parameters.yaml b/Tools/ref/schemas/tags_parameters.yaml deleted file mode 100644 index 53b99f1..0000000 --- a/Tools/ref/schemas/tags_parameters.yaml +++ /dev/null @@ -1,240 +0,0 @@ -type: object -description: Parameters of type tags (for search) -properties: - additives_tags: - style: form - explode: false - schema: - type: string - example: e322 - in: query - name: additives_tags - description: | - The additives_tags in english of product(s) you are searching for. - The [OFF App](https://world.openfoodfacts.org/additives) has a list of possible values for `additives`. - - You can use multiple values by using a comma separated list. - You can add a "-" before values to avoid matching a tag. - allergens_tags: - style: form - explode: false - schema: - type: string - example: m - in: query - name: allergens_tags - description: | - The allergens_tags in english of product(s) you are searching for. - The [OFF App](https://world.openfoodfacts.org/allergens) has a list of possible values for `allergens`. - - You can use multiple values by using a comma separated list. - You can add a "-" before values to avoid matching a tag. - brands_tags: - style: form - explode: false - schema: - type: string - example: ferrero - in: query - name: brands_tags - description: | - The brands_tags of product(s) you are searching for. - The [OFF App](https://world.openfoodfacts.org/brands) has a list of possible values for `brands`. - - You can use multiple values by using a comma separated list. - You can add a "-" before values to avoid matching a tag. - categories_tags: - style: form - explode: false - schema: - type: string - example: chocolates - in: query - name: categories_tags - description: | - The category of product(s) you are searching for. - The [OFF App](https://world.openfoodfacts.org/categories) has a list of possible values for `categories`. - - You can use multiple values by using a comma separated list. - You can add a "-" before values to avoid matching a tag. - countries_tags: - style: form - explode: false - schema: - type: string - example: united-kingdom - in: query - name: countries_tags_en - description: | - The countries_tags_en of product(s) you are searching for. - The [OFF App](https://world.openfoodfacts.org/countries) shows a list of possible values for `countries`. - - You can use multiple values by using a comma separated list. - You can add a "-" before values to avoid matching a tag. - emb_codes_tags: - style: form - explode: false - schema: - type: string - in: query - name: emb_codes_tags - description: | - The emb_codes_tags of product(s) you are searching for. - - You can use multiple values by using a comma separated list. - You can add a "-" before values to avoid matching a tag. - labels_tags: - style: form - explode: false - schema: - type: string - example: organic - in: query - name: labels_tags - description: | - The labels_tags in english of product(s) you are searching for. - The [OFF App](https://world.openfoodfacts.org/labels) has a list of possible values for `labels`. - - You can use multiple values by using a comma separated list. - You can add a "-" before values to avoid matching a tag. - manufacturing_places_tags: - style: form - explode: false - schema: - type: string - in: query - name: manufacturing_places_tags - description: | - The manufacturing_places_tags of product(s) you are searching for. - The [OFF App](https://world.openfoodfacts.org/manufacturing-places) has a list of possible values for `manufacturing-places`. - - You can use multiple values by using a comma separated list. - You can add a "-" before values to avoid matching a tag. - nutrition_grades_tags: - style: form - explode: false - schema: - type: string - example: e - in: query - name: nutrition_grades_tags - description: | - The nutrition_grades_tags of product(s) you are searching for. - The [OFF App](https://world.openfoodfacts.org/nutrition-grades) has a list of possible values for `nutrition-grades`. - - You can use multiple values by using a comma separated list. - You can add a "-" before values to avoid matching a tag. - origins_tags: - style: form - explode: false - schema: - type: string - in: query - name: origins_tags - description: | - The origins_tags of product(s) you are searching for. - - You can use multiple values by using a comma separated list. - You can add a "-" before values to avoid matching a tag. - packaging_tags: - style: form - explode: false - schema: - type: string - example: 1-jar-aus-klarglas - in: query - name: packaging_tags_de - description: | - The packaging_tag in german of product(s) you are searching for. - The [OFF App](https://world.openfoodfacts.org/packaging) has a list of possible values for `packaging`. - - You can use multiple values by using a comma separated list. - You can add a "-" before values to avoid matching a tag. - purchase_places_tags: - style: form - explode: false - schema: - type: string - in: query - name: purchase_places_tags - description: | - The purchase_places_tags of product(s) you are searching for. - - You can use multiple values by using a comma separated list. - You can add a "-" before values to avoid matching a tag. - states_tags: - style: form - explode: false - schema: - type: string - example: nutrition-facts-completed - in: query - name: states_tags - description: | - The states_tags in english of product(s) you are searching for. - The [OFF App](https://world.openfoodfacts.org/states) has a list of possible values for `states`. - - You can use multiple values by using a comma separated list. - You can add a "-" before values to avoid matching a tag. - stores_tags: - style: form - explode: false - schema: - type: string - example: aldi - in: query - name: stores_tags - description: | - The stores_tags of product(s) you are searching for. - - You can use multiple values by using a comma separated list. - You can add a "-" before values to avoid matching a tag. - traces_tags: - style: form - explode: false - schema: - type: string - in: query - name: traces_tags - description: | - The traces_tags of product(s) you are searching for. - The [OFF App](https://world.openfoodfacts.org/traces) shows a list of possible values for `traces`. - - You can use multiple values by using a comma separated list. - You can add a "-" before values to avoid matching a tag. - tag_name_with_language_code: - in: query - name: '_tags_' - description: | - You can add a language code to a specific tag to query it in a specific language - style: form - explode: false - schema: - type: object - patternProperties: - '(?\w+)_tags_(?\w\w)': - type: string - description: | - Will search in the tags corresponding to `tag_name`, - in the language corresponding to `language_code. - - `tag_name` is one of the field above which have the `_tags`` suffix: - categories, nutrition_grades, etc. - - `language_code` is a two letter iso language `language_code. - - You can use multiple values by using a comma separated list. - You can add a "-" before values to avoid matching a tag. - examples: - - packaging_tags_de: - summary: packaging in german - value: - packaging_tags_de: "de:Flasche" - - origins_tags_fr: - summary: origins in french - value: - origins_tags_fr: "fr:France" - - categories_tags_en: - summary: categories in english - value: - categories_tags_en: "en:Beer" diff --git a/Tools/ref/schemas/taxonomies/tagtype.yaml b/Tools/ref/schemas/taxonomies/tagtype.yaml deleted file mode 100644 index 412ff2f..0000000 --- a/Tools/ref/schemas/taxonomies/tagtype.yaml +++ /dev/null @@ -1,45 +0,0 @@ -title: tagtype -x-stoplight: - id: cyaecslbj8x2i -type: string -enum: - - additives_classes - - additives - - allergens - - amino_acids - - categories - - countries - - data_quality - - data_quality - - data_quality - - data_quality - - data_quality - - data_quality - - data_quality - - food_groups - - improvements - - ingredients_analysis - - ingredients_processing - - ingredients - - labels - - languages - - minerals - - misc - - nova_groups - - nucleotides - - nutrient_levels - - nutrients - - origins - - other_nutritional_substances - - packaging_materials - - packaging_recycling - - packaging - - packaging_shapes - - periods_after_opening - - preservation - - states - - test - - traces - - vitamins -description: 'Identifier of a taxonomy. See https://wiki.openfoodfacts.org/Global_taxonomies and https://github.com/openfoodfacts/openfoodfacts-server/tree/main/taxonomies' -examples: [] From ef06d5350e2cf16b95f4d3a9ccd13a8d78b7df87 Mon Sep 17 00:00:00 2001 From: Henadzi Rabkin Date: Fri, 3 Jan 2025 20:59:36 +0100 Subject: [PATCH 7/9] Switching to v2 as v3 not ready, chanigng encapsulation for the client depended properties, updating/adding product fields --- .../xcschemes/OpenFoodFactsSDK.xcscheme | 79 +++++++++++++++++++ Sources/Model/OFF/OpenFoodFactsLanguage.swift | 2 +- Sources/Model/OFF/Product.swift | 41 +++++++--- Sources/Model/OFF/ProductConfiguration.swift | 2 +- Sources/Model/OFF/ProductField.swift | 2 +- Sources/Model/OFF/ProductResponse.swift | 55 ++++++++++--- Sources/Model/OFF/UserAgent.swift | 7 +- Sources/Networking/OpenFoodAPIClient.swift | 4 +- Sources/OFFConfig.swift | 10 +-- 9 files changed, 168 insertions(+), 34 deletions(-) create mode 100644 .swiftpm/xcode/xcshareddata/xcschemes/OpenFoodFactsSDK.xcscheme diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/OpenFoodFactsSDK.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/OpenFoodFactsSDK.xcscheme new file mode 100644 index 0000000..c0ab5c1 --- /dev/null +++ b/.swiftpm/xcode/xcshareddata/xcschemes/OpenFoodFactsSDK.xcscheme @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Sources/Model/OFF/OpenFoodFactsLanguage.swift b/Sources/Model/OFF/OpenFoodFactsLanguage.swift index 4f5b373..7631846 100644 --- a/Sources/Model/OFF/OpenFoodFactsLanguage.swift +++ b/Sources/Model/OFF/OpenFoodFactsLanguage.swift @@ -195,7 +195,7 @@ public enum OpenFoodFactsLanguage: String, CaseIterable, Identifiable, Equatable case ZULU case UNDEFINED - var info: (code: String, description: String) { + public var info: (code: String, description: String) { switch self { case .ENGLISH: return ("en", "English") diff --git a/Sources/Model/OFF/Product.swift b/Sources/Model/OFF/Product.swift index c4af88b..38a3ced 100644 --- a/Sources/Model/OFF/Product.swift +++ b/Sources/Model/OFF/Product.swift @@ -46,9 +46,11 @@ public struct Product: Codable, Equatable, Sendable { public let brands: String? public let lang: OpenFoodFactsLanguage? public let quantity: String? - public let packagingQuantity: Double? + public let packagingQuantity: Double + public let packagingQuantityUnit: String public let servingSize: String? - public let servingQuantity: Double? + public let servingQuantity: Double + public let servingQuantityUnit: String public let dataPer: String? public let categories: String? public var nutriments: [String: Any]? @@ -56,6 +58,8 @@ public struct Product: Codable, Equatable, Sendable { public let imageIngredients: String? public let imageNutrition: String? public let keywords: [String]? + public let novaGroup: Double? + public let nutriScore: String? enum CodingKeys: String, CodingKey { case code @@ -63,17 +67,21 @@ public struct Product: Codable, Equatable, Sendable { case brands case quantity case packagingQuantity = "product_quantity" + case packagingQuantityUnit = "product_quantity_unit" case categories case images case productName = "product_name" case productNameEn = "product_name_en" case servingSize = "serving_size" case servingQuantity = "serving_quantity" + case servingQuantityUnit = "serving_quantity_unit" case dataPer = "nutrition_data_per" case nutriments = "nutriments" case imageFront = "image_front_url" case imageIngredients = "image_ingredients_url" case imageNutrition = "image_nutrition_url" + case novaGroup = "nova_group" + case nutriScore = "nutriscore_grade" case keywords = "_keywords" } @@ -91,23 +99,28 @@ public struct Product: Codable, Equatable, Sendable { imageIngredients = try container.decodeIfPresent(String.self, forKey: .imageIngredients) imageNutrition = try container.decodeIfPresent(String.self, forKey: .imageNutrition) keywords = try container.decodeIfPresent([String].self, forKey: .keywords) + nutriScore = try container.decodeIfPresent(String.self, forKey: .nutriScore) + novaGroup = try container.decodeIfPresent(Double.self, forKey: .novaGroup) + servingQuantityUnit = try container.decodeIfPresent(String.self, forKey: .servingQuantityUnit) ?? "g" + packagingQuantityUnit = try container.decodeIfPresent(String.self, forKey: .packagingQuantityUnit) ?? "g" if let packagingQuantityValue = try? container.decode(Double.self, forKey: .packagingQuantity) { packagingQuantity = packagingQuantityValue - } else if let packagingQuantityString = try? container.decode(String.self, forKey: .packagingQuantity), - let packagingQuantityValue = Double(packagingQuantityString) { - packagingQuantity = packagingQuantityValue + } else if let packagingQuantityString = try? container.decode(String.self, forKey: .packagingQuantity) { + let cleanedString = packagingQuantityString.filter { $0.isNumber || $0 == "." || $0 == "," } + packagingQuantity = Double(cleanedString) ?? 0.0 + } else { - packagingQuantity = nil + packagingQuantity = 100 } - + if let servingQuantityValue = try? container.decode(Double.self, forKey: .servingQuantity) { servingQuantity = servingQuantityValue - } else if let servingQuantityString = try? container.decode(String.self, forKey: .servingQuantity), - let servingQuantityValue = Double(servingQuantityString) { - servingQuantity = servingQuantityValue + } else if let servingQuantityString = try? container.decode(String.self, forKey: .servingQuantity) { + let cleanedString = servingQuantityString.filter { $0.isNumber || $0 == "." || $0 == "," } + servingQuantity = Double(cleanedString) ?? 0.0 } else { - servingQuantity = nil + servingQuantity = 100 } if let nutrimentsContainer = try? container.nestedContainer(keyedBy: AnyCodingKey.self, forKey: .nutriments) { @@ -136,15 +149,19 @@ public struct Product: Codable, Equatable, Sendable { try container.encodeIfPresent(productNameEn, forKey: .productNameEn) try container.encodeIfPresent(quantity, forKey: .quantity) try container.encodeIfPresent(packagingQuantity, forKey: .packagingQuantity) + try container.encodeIfPresent(packagingQuantityUnit, forKey: .packagingQuantityUnit) try container.encodeIfPresent(servingSize, forKey: .servingSize) try container.encodeIfPresent(servingQuantity, forKey: .servingQuantity) + try container.encodeIfPresent(servingQuantityUnit, forKey: .servingQuantityUnit) try container.encodeIfPresent(dataPer, forKey: .dataPer) try container.encodeIfPresent(categories, forKey: .categories) try container.encodeIfPresent(imageFront, forKey: .imageFront) try container.encodeIfPresent(imageIngredients, forKey: .imageIngredients) try container.encodeIfPresent(imageNutrition, forKey: .imageNutrition) try container.encodeIfPresent(keywords, forKey: .keywords) - try container.encodeIfPresent(self.lang?.rawValue, forKey: .lang) + try container.encodeIfPresent(lang?.rawValue, forKey: .lang) + try container.encodeIfPresent(nutriScore, forKey: .nutriScore) + try container.encodeIfPresent(novaGroup, forKey: .novaGroup) if let nutriments = self.nutriments { var nutrimentsContainer = container.nestedContainer(keyedBy: AnyCodingKey.self, forKey: .nutriments) diff --git a/Sources/Model/OFF/ProductConfiguration.swift b/Sources/Model/OFF/ProductConfiguration.swift index 8a17b95..1e8434e 100644 --- a/Sources/Model/OFF/ProductConfiguration.swift +++ b/Sources/Model/OFF/ProductConfiguration.swift @@ -12,7 +12,7 @@ public struct ProductQueryConfiguration { var languages: [OpenFoodFactsLanguage] var fields: [ProductField]? - init(barcode: String, + public init(barcode: String, languages: [OpenFoodFactsLanguage] = [], country: OpenFoodFactsCountry? = nil, fields: [ProductField]? = nil) { diff --git a/Sources/Model/OFF/ProductField.swift b/Sources/Model/OFF/ProductField.swift index 471d46f..572017a 100644 --- a/Sources/Model/OFF/ProductField.swift +++ b/Sources/Model/OFF/ProductField.swift @@ -7,7 +7,7 @@ import Foundation -enum ProductField: String { +public enum ProductField: String { case barcode = "code" case name = "product_name" case nameInLanguages = "product_name_" diff --git a/Sources/Model/OFF/ProductResponse.swift b/Sources/Model/OFF/ProductResponse.swift index 896b1ce..e9b342b 100644 --- a/Sources/Model/OFF/ProductResponse.swift +++ b/Sources/Model/OFF/ProductResponse.swift @@ -10,31 +10,66 @@ import Foundation public struct ProductResponse: Decodable { /// Possible value for [status]: the operation failed. - static let statusFailure = "failure" + public static let statusFailure = "failure" /// Possible value for [status]: the operation succeeded with warnings. - static let statusWarning = "success_with_warnings" + public static let statusWarning = "success_with_warnings" /// Possible value for [status]: the operation succeeded. - static let statusSuccess = "success" + public static let statusSuccess = "success" /// Possible value for [result.id]: product found - static let resultProductFound = "product_found" + public static let resultProductFound = "product_found" /// Possible value for [result.id]: product not found - static let resultProductNotFound = "product_not_found" + public static let resultProductNotFound = "product_not_found" - let barcode: String? - let status: String? - let product: Product? + public let barcode: String? + public let status: Int? + public let statusVerbose: String? + public let product: Product? - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case barcode = "code" case status case product + case statusVerbose = "status_verbose" } - func hasProduct() -> Bool { + public func hasProduct() -> Bool { + guard let status = self.statusVerbose else { return false } + return status == ProductResponse.resultProductFound || status == ProductResponse.statusSuccess || status == ProductResponse.statusWarning + } +} + +public struct ProductResponseV3: Decodable { + + /// Possible value for [status]: the operation failed. + public static let statusFailure = "failure" + + /// Possible value for [status]: the operation succeeded with warnings. + public static let statusWarning = "success_with_warnings" + + /// Possible value for [status]: the operation succeeded. + public static let statusSuccess = "success" + + /// Possible value for [result.id]: product found + public static let resultProductFound = "product_found" + + /// Possible value for [result.id]: product not found + public static let resultProductNotFound = "product_not_found" + + public let barcode: String? + public let status: String? + public let product: Product? + + public enum CodingKeys: String, CodingKey { + case barcode = "code" + case status + case product + } + + public func hasProduct() -> Bool { guard let status = self.status else { return false } return status == ProductResponse.resultProductFound || status == ProductResponse.statusSuccess || status == ProductResponse.statusWarning } diff --git a/Sources/Model/OFF/UserAgent.swift b/Sources/Model/OFF/UserAgent.swift index 1fea0a5..5cdaa5d 100644 --- a/Sources/Model/OFF/UserAgent.swift +++ b/Sources/Model/OFF/UserAgent.swift @@ -36,9 +36,12 @@ public struct UserAgent: Codable { var result = "" let mirror = Mirror(reflecting: self) - for child in mirror.children { + for (index, child) in mirror.children.enumerated() { if let value = child.value as? String { - result += " - \(value)" + result += "\(value)" + if index < mirror.children.count - 1 { + result += "-" + } } } diff --git a/Sources/Networking/OpenFoodAPIClient.swift b/Sources/Networking/OpenFoodAPIClient.swift index 5e4a1ec..8cfe5a8 100644 --- a/Sources/Networking/OpenFoodAPIClient.swift +++ b/Sources/Networking/OpenFoodAPIClient.swift @@ -53,7 +53,7 @@ final public actor OpenFoodAPIClient { let queryParameters = config.getParametersMap() - guard let uriPath = UriHelper.getUri(path: "/api/v3/product/\(config.barcode)", queryParameters: queryParameters) else { + guard let uriPath = UriHelper.getUri(path: "/api/v2/product/\(config.barcode)", queryParameters: queryParameters) else { throw NSError(domain: "Couldn't compose uri for \(#function) call", code: 400) } do { @@ -94,7 +94,7 @@ final public actor OpenFoodAPIClient { "limit": "\(limit)", ] - guard let uri = UriHelper.getUri(path: "/api/v3/taxonomy_suggestions", queryParameters: queryParameters) else { + guard let uri = UriHelper.getUri(path: "/api/v2/taxonomy_suggestions", queryParameters: queryParameters) else { throw NSError(domain: "Couldn't compose uri for \(#function) call", code: 400) } diff --git a/Sources/OFFConfig.swift b/Sources/OFFConfig.swift index 58c460d..decd864 100644 --- a/Sources/OFFConfig.swift +++ b/Sources/OFFConfig.swift @@ -53,10 +53,10 @@ final public class OFFConfig { withSystem: Bool = true, system: String = "", withId: Bool = true, id: String = "") -> String { var appInfo = "" - let infoDelimiter = " - " + let infoDelimiter = "-" if withName { - appInfo += infoDelimiter + name + appInfo += name } if withVersion { appInfo += infoDelimiter + version @@ -79,9 +79,9 @@ final public class OFFConfig { let appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "" let buildNumber = Bundle.main.infoDictionary?["CFBundleVersion"] as? String ?? "" - let version = "\(appVersion)+\(buildNumber)" - let system = "\(UIDevice.current.systemName)+\(UIDevice.current.systemVersion)" - let comment = getAppInfoComment(name: appName, version: version, system: system, id: uuid) + let version = "\(appVersion)_\(buildNumber)" + let system = "\(UIDevice.current.systemName)_\(UIDevice.current.systemVersion)" + let comment = getAppInfoComment(name: appName, version: version, system: system, id: uuid.replacingOccurrences(of: "-", with: "")) self.userAgent = UserAgent( name: appName, From 4697311f0f5094163e962c4a97875e341806b4bd Mon Sep 17 00:00:00 2001 From: Henadzi Rabkin Date: Thu, 9 Jan 2025 10:37:14 +0100 Subject: [PATCH 8/9] Public interfaces, small fixes --- Sources/Extensions/Extensions.swift | 60 ++++++++++++++++++++++ Sources/Model/OFF/Product.swift | 25 ++++++++- Sources/Model/OFF/SendImage.swift | 10 ++-- Sources/Networking/HttpHelper.swift | 5 +- Sources/Networking/UriHelper.swift | 2 +- Sources/OFFApi.swift | 5 ++ Sources/ProductPage.swift | 1 - Sources/ViewModels/ProductPageConfig.swift | 16 +++--- 8 files changed, 104 insertions(+), 20 deletions(-) diff --git a/Sources/Extensions/Extensions.swift b/Sources/Extensions/Extensions.swift index 7d05773..416478c 100644 --- a/Sources/Extensions/Extensions.swift +++ b/Sources/Extensions/Extensions.swift @@ -163,3 +163,63 @@ public extension [String: String] { } } } + +extension UIImage { + + func resized(toMaxSize maxSize: CGFloat = 1000.0) -> UIImage? { + guard let image = self.normalizedImage() else { return nil } + + let width = image.size.width + let height = image.size.height + let aspectRatio = width / height + + var newWidth: CGFloat + var newHeight: CGFloat + + if width <= height { + // Portrait or square + newHeight = min(height, maxSize) + newWidth = newHeight * aspectRatio + if newWidth > maxSize { + newWidth = maxSize + newHeight = newWidth / aspectRatio + } + } else { + // Landscape + newWidth = min(width, maxSize) + newHeight = newWidth / aspectRatio + if newHeight > maxSize { + newHeight = maxSize + newWidth = newHeight * aspectRatio + } + } + + let newSize = CGSize(width: newWidth, height: newHeight) + UIGraphicsBeginImageContextWithOptions(newSize, false, image.scale) + defer { UIGraphicsEndImageContext() } + + image.draw(in: CGRect(origin: .zero, size: newSize)) + return UIGraphicsGetImageFromCurrentImageContext() + } + + /// `Re-orientate` the image to `up`. + func normalizedImage() -> UIImage? + { + if self.imageOrientation == .up + { + return self + } + else + { + UIGraphicsBeginImageContextWithOptions(self.size, false, self.scale) + defer + { + UIGraphicsEndImageContext() + } + + self.draw(in: CGRect(origin: .zero, size: self.size)) + + return UIGraphicsGetImageFromCurrentImageContext() + } + } +} diff --git a/Sources/Model/OFF/Product.swift b/Sources/Model/OFF/Product.swift index 38a3ced..0ffb823 100644 --- a/Sources/Model/OFF/Product.swift +++ b/Sources/Model/OFF/Product.swift @@ -61,7 +61,7 @@ public struct Product: Codable, Equatable, Sendable { public let novaGroup: Double? public let nutriScore: String? - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case code case lang case brands @@ -85,6 +85,29 @@ public struct Product: Codable, Equatable, Sendable { case keywords = "_keywords" } + public init(code: String, productName: String? = nil, productNameEn: String? = nil, brands: String? = nil, lang: OpenFoodFactsLanguage = .ENGLISH, quantity: String? = nil, packagingQuantity: Double = 100, packagingQuantityUnit: String = "g", servingSize: String? = nil, servingQuantity: Double = 100, servingQuantityUnit: String = "g", dataPer: String? = nil, categories: String? = nil, nutriments: [String: Any]? = nil, imageFront: String? = nil, imageIngredients: String? = nil, imageNutrition: String? = nil, keywords: [String]? = nil, novaGroup: Double? = nil, nutriScore: String? = nil) { + self.code = code + self.productName = productName + self.productNameEn = productNameEn + self.brands = brands + self.lang = lang + self.quantity = quantity + self.packagingQuantity = packagingQuantity + self.packagingQuantityUnit = packagingQuantityUnit + self.servingSize = servingSize + self.servingQuantity = servingQuantity + self.servingQuantityUnit = servingQuantityUnit + self.dataPer = dataPer + self.categories = categories + self.nutriments = nutriments + self.imageFront = imageFront + self.imageIngredients = imageIngredients + self.imageNutrition = imageNutrition + self.keywords = keywords + self.novaGroup = novaGroup + self.nutriScore = nutriScore + } + public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) code = try container.decode(String.self, forKey: .code) diff --git a/Sources/Model/OFF/SendImage.swift b/Sources/Model/OFF/SendImage.swift index 36543e5..b20fa4a 100644 --- a/Sources/Model/OFF/SendImage.swift +++ b/Sources/Model/OFF/SendImage.swift @@ -28,13 +28,13 @@ public enum ImageField: String, CaseIterable, Decodable { public struct SendImage { - var barcode: String - var image: UIImage - var imageField: ImageField + public var barcode: String + public var image: UIImage + public var imageField: ImageField - var imageUri: String? + public var imageUri: String? - init(barcode: String, imageField: ImageField = .front, image: UIImage, imageUri: String? = nil) { + public init(barcode: String, imageField: ImageField = .front, image: UIImage, imageUri: String? = nil) { self.barcode = barcode self.image = image self.imageField = imageField diff --git a/Sources/Networking/HttpHelper.swift b/Sources/Networking/HttpHelper.swift index 7917068..190b9ea 100644 --- a/Sources/Networking/HttpHelper.swift +++ b/Sources/Networking/HttpHelper.swift @@ -72,8 +72,7 @@ final class HttpHelper { data.append("\(value)\r\n") } - // Files - if let fileData = sendImage.image.pngData() { + if let fileData = sendImage.image.resized()?.jpegData(compressionQuality: 0.8) { data.append("--\(boundary)\r\n") data.append("Content-Disposition: form-data; name=\"\(sendImage.getImageDataKey())\"; filename=\"\(fileData.hashValue)\"\r\n") data.append("Content-Type: application/octet-stream\r\n\r\n") @@ -90,6 +89,7 @@ final class HttpHelper { let (data, _) = try await URLSession.shared.data(for: request) return data } catch { + print("\(#function) \(uri) error: \(error)") throw error } } @@ -140,6 +140,7 @@ final class HttpHelper { return data } catch { // Re-throw the error to be caught by the caller + print("\(#function) \(uri) error: \(error)") throw error } } diff --git a/Sources/Networking/UriHelper.swift b/Sources/Networking/UriHelper.swift index 4509fd5..f809dc3 100644 --- a/Sources/Networking/UriHelper.swift +++ b/Sources/Networking/UriHelper.swift @@ -25,7 +25,7 @@ final class UriHelper { var components = URLComponents() components.scheme = OFFApi.scheme - components.host = OFFConfig.shared.api.host(for: .world) + components.host = OFFConfig.shared.api.host(for: .none) components.path = path components.queryItems = allQueryParams?.map { URLQueryItem(name: $0.key, value: $0.value) } diff --git a/Sources/OFFApi.swift b/Sources/OFFApi.swift index bb5cf07..6f44fcb 100644 --- a/Sources/OFFApi.swift +++ b/Sources/OFFApi.swift @@ -41,6 +41,7 @@ public struct OFFApi { case images case events case taxonomies + case none } func host(for endpoint: Endpoint) -> String { @@ -64,8 +65,12 @@ public struct OFFApi { subdomain = "static" case .events: subdomain = "events" + case .none: + subdomain = "" } + if subdomain.isEmpty { return domain } + return "\(subdomain).\(domain)" } } diff --git a/Sources/ProductPage.swift b/Sources/ProductPage.swift index 9a17447..da3f83f 100644 --- a/Sources/ProductPage.swift +++ b/Sources/ProductPage.swift @@ -121,7 +121,6 @@ public struct ProductPage: View { })) }) .onAppear(perform: { - UIApplication.shared.addTapGestureRecognizer() Task(priority: .userInitiated) { await pageConfig.fetchData(barcode: barcode) } diff --git a/Sources/ViewModels/ProductPageConfig.swift b/Sources/ViewModels/ProductPageConfig.swift index 93ca69d..57a1ebb 100644 --- a/Sources/ViewModels/ProductPageConfig.swift +++ b/Sources/ViewModels/ProductPageConfig.swift @@ -172,25 +172,21 @@ final class ProductPageConfig: ObservableObject { } } + @MainActor func uploadAllProductData(barcode: String) async { - await MainActor.run { - self.pageState = .loading - } + self.pageState = .loading await sendAllImages(barcode: barcode) do { let productBody = try await composeProductBody(barcode: barcode) try await OpenFoodAPIClient.shared.saveProduct(product: productBody) let productResponse = try await OpenFoodAPIClient.shared.getProduct(config: ProductQueryConfiguration(barcode: barcode)) - await MainActor.run { - self.pageState = .completed - } + + self.pageState = .completed try await Task.sleep(nanoseconds: 1_000_000_000 * UInt64(PageOverlay.completedAnimDuration)) - await MainActor.run { - self.pageState = ProductPageState.productDetails - self.submittedProduct = productResponse.product - } + self.pageState = ProductPageState.productDetails + self.submittedProduct = productResponse.product } catch { await MainActor.run { self.pageState = .error From 2813e1696a590a82c12d22a50b842eeee04d3139 Mon Sep 17 00:00:00 2001 From: Henadzi Rabkin Date: Thu, 9 Jan 2025 11:10:08 +0100 Subject: [PATCH 9/9] Removing autogenerated api as its not feasible at the moment to use openapi generator for it --- OpenFoodFactsService/.gitignore | 8 - OpenFoodFactsService/Package.resolved | 96 - OpenFoodFactsService/Package.swift | 27 - OpenFoodFactsService/README.md | 3 - .../Sources/OpenFoodFactsAPI.swift | 1585 --- OpenFoodFactsService/Sources/Types.swift | 8662 ----------------- .../Sources/openapi-generator-config.yaml | 4 - OpenFoodFactsService/Sources/openapi.yaml | 5063 ---------- Tools/clear_and_process.sh | 4 - Tools/generate.sh | 5 - Tools/process_yamls.py | 216 - 11 files changed, 15673 deletions(-) delete mode 100644 OpenFoodFactsService/.gitignore delete mode 100644 OpenFoodFactsService/Package.resolved delete mode 100644 OpenFoodFactsService/Package.swift delete mode 100644 OpenFoodFactsService/README.md delete mode 100644 OpenFoodFactsService/Sources/OpenFoodFactsAPI.swift delete mode 100644 OpenFoodFactsService/Sources/Types.swift delete mode 100644 OpenFoodFactsService/Sources/openapi-generator-config.yaml delete mode 100644 OpenFoodFactsService/Sources/openapi.yaml delete mode 100644 Tools/clear_and_process.sh delete mode 100644 Tools/generate.sh delete mode 100644 Tools/process_yamls.py diff --git a/OpenFoodFactsService/.gitignore b/OpenFoodFactsService/.gitignore deleted file mode 100644 index 0023a53..0000000 --- a/OpenFoodFactsService/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -.DS_Store -/.build -/Packages -xcuserdata/ -DerivedData/ -.swiftpm/configuration/registries.json -.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata -.netrc diff --git a/OpenFoodFactsService/Package.resolved b/OpenFoodFactsService/Package.resolved deleted file mode 100644 index c50a510..0000000 --- a/OpenFoodFactsService/Package.resolved +++ /dev/null @@ -1,96 +0,0 @@ -{ - "originHash" : "c8377a5ea306c72d0bd00c56d93f4bbdd637a27affb09403f9a5c8e87eff15b7", - "pins" : [ - { - "identity" : "openapikit", - "kind" : "remoteSourceControl", - "location" : "https://github.com/mattpolzin/OpenAPIKit", - "state" : { - "revision" : "35dd374038497a8118d89300851861fb40c36209", - "version" : "3.2.2" - } - }, - { - "identity" : "swift-algorithms", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-algorithms", - "state" : { - "revision" : "f6919dfc309e7f1b56224378b11e28bab5bccc42", - "version" : "1.2.0" - } - }, - { - "identity" : "swift-argument-parser", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-argument-parser", - "state" : { - "revision" : "41982a3656a71c768319979febd796c6fd111d5c", - "version" : "1.5.0" - } - }, - { - "identity" : "swift-collections", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-collections", - "state" : { - "revision" : "671108c96644956dddcd89dd59c203dcdb36cec7", - "version" : "1.1.4" - } - }, - { - "identity" : "swift-http-types", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-http-types", - "state" : { - "revision" : "ae67c8178eb46944fd85e4dc6dd970e1f3ed6ccd", - "version" : "1.3.0" - } - }, - { - "identity" : "swift-numerics", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-numerics.git", - "state" : { - "revision" : "0a5bc04095a675662cf24757cc0640aa2204253b", - "version" : "1.0.2" - } - }, - { - "identity" : "swift-openapi-generator", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-openapi-generator", - "state" : { - "revision" : "d5f6a6abf18549c8bae6526bf2c9d5773269c570", - "version" : "1.3.1" - } - }, - { - "identity" : "swift-openapi-runtime", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-openapi-runtime", - "state" : { - "revision" : "26e8ae3515d1ff3607e924ac96fc0094775f55e8", - "version" : "1.5.0" - } - }, - { - "identity" : "swift-openapi-urlsession", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-openapi-urlsession", - "state" : { - "revision" : "9bf4c712ad7989d6a91dbe68748b8829a50837e4", - "version" : "1.0.2" - } - }, - { - "identity" : "yams", - "kind" : "remoteSourceControl", - "location" : "https://github.com/jpsim/Yams", - "state" : { - "revision" : "3036ba9d69cf1fd04d433527bc339dc0dc75433d", - "version" : "5.1.3" - } - } - ], - "version" : 3 -} diff --git a/OpenFoodFactsService/Package.swift b/OpenFoodFactsService/Package.swift deleted file mode 100644 index 2056449..0000000 --- a/OpenFoodFactsService/Package.swift +++ /dev/null @@ -1,27 +0,0 @@ -// swift-tools-version: 5.10 -// The swift-tools-version declares the minimum version of Swift required to build this package. - -import PackageDescription - -let package = Package( - name: "OpenFoodFactsServiceClient", - platforms: [.macOS(.v10_15), .iOS(.v13), .tvOS(.v13), .watchOS(.v6), .visionOS(.v1)], - dependencies: [ - .package(url: "https://github.com/apple/swift-openapi-generator", from: "1.0.0"), - .package(url: "https://github.com/apple/swift-openapi-runtime", from: "1.0.0"), - .package(url: "https://github.com/apple/swift-openapi-urlsession", from: "1.0.0"), - ], - targets: [ - .executableTarget( - name: "OpenFoodFactsServiceClient", - dependencies: [ - .product(name: "OpenAPIRuntime", package: "swift-openapi-runtime"), - .product(name: "OpenAPIURLSession", package: "swift-openapi-urlsession"), - ], - plugins: [ - .plugin(name: "OpenAPIGenerator", package: "swift-openapi-generator"), - ] - ) - ] -) - diff --git a/OpenFoodFactsService/README.md b/OpenFoodFactsService/README.md deleted file mode 100644 index 62d9568..0000000 --- a/OpenFoodFactsService/README.md +++ /dev/null @@ -1,3 +0,0 @@ -curl -s https://api.github.com/repos/openfoodfacts/openfoodfacts-server/contents/docs/api/ref | jq -r '.[].download_url' > file_urls.txt - -wget https://raw.githubusercontent.com/openfoodfacts/openfoodfacts-server/main/docs/api/ref/api.yml \ No newline at end of file diff --git a/OpenFoodFactsService/Sources/OpenFoodFactsAPI.swift b/OpenFoodFactsService/Sources/OpenFoodFactsAPI.swift deleted file mode 100644 index 5062747..0000000 --- a/OpenFoodFactsService/Sources/OpenFoodFactsAPI.swift +++ /dev/null @@ -1,1585 +0,0 @@ -// Generated by swift-openapi-generator, do not modify. -@_spi(Generated) import OpenAPIRuntime -#if os(Linux) -@preconcurrency import struct Foundation.URL -@preconcurrency import struct Foundation.Data -@preconcurrency import struct Foundation.Date -#else -import struct Foundation.URL -import struct Foundation.Data -import struct Foundation.Date -#endif -import HTTPTypes -/// As a developer, the Open Food Facts API allows you to get information -/// and contribute to the products database. You can create great apps to -/// help people make better food choices and also provide data to enhance the database. -/// -public struct OpenFoodFactsAPI: APIProtocol { - /// The underlying HTTP client. - private let client: UniversalClient - /// Creates a new client. - /// - Parameters: - /// - serverURL: The server URL that the client connects to. Any server - /// URLs defined in the OpenAPI document are available as static methods - /// on the ``Servers`` type. - /// - configuration: A set of configuration values for the client. - /// - transport: A transport that performs HTTP operations. - /// - middlewares: A list of middlewares to call before the transport. - public init( - serverURL: Foundation.URL, - configuration: Configuration = .init(), - transport: any ClientTransport, - middlewares: [any ClientMiddleware] = [] - ) { - self.client = .init( - serverURL: serverURL, - configuration: configuration, - transport: transport, - middlewares: middlewares - ) - } - private var converter: Converter { - client.converter - } - /// Get information for a specific product by barcode - /// - /// A product can be fetched via its unique barcode. - /// It returns all the details of that product response. - /// - /// - /// - Remark: HTTP `GET /api/v2/product/{barcode}`. - /// - Remark: Generated from `#/paths//api/v2/product/{barcode}/get(getProductByBarcode)`. - public func getProductByBarcode(_ input: Operations.getProductByBarcode.Input) async throws -> Operations.getProductByBarcode.Output { - try await client.send( - input: input, - forOperation: Operations.getProductByBarcode.id, - serializer: { input in - let path = try converter.renderedPath( - template: "/api/v2/product/{}", - parameters: [ - input.path.barcode - ] - ) - var request: HTTPTypes.HTTPRequest = .init( - soar_path: path, - method: .get - ) - suppressMutabilityWarning(&request) - converter.setAcceptHeader( - in: &request.headerFields, - contentTypes: input.headers.accept - ) - return (request, nil) - }, - deserializer: { response, responseBody in - switch response.status.code { - case 200: - let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) - let body: Operations.getProductByBarcode.Output.Ok.Body - let chosenContentType = try converter.bestContentType( - received: contentType, - options: [ - "application/json" - ] - ) - switch chosenContentType { - case "application/json": - body = try await converter.getResponseBodyAsJSON( - Components.Schemas.get_product_by_barcode.self, - from: responseBody, - transforming: { value in - .json(value) - } - ) - default: - preconditionFailure("bestContentType chose an invalid content type.") - } - return .ok(.init(body: body)) - default: - return .undocumented( - statusCode: response.status.code, - .init( - headerFields: response.headerFields, - body: responseBody - ) - ) - } - } - ) - } - /// Get Knowledge panels for a specific product by barcode - /// (special case of get product) - /// - /// - /// Knowledge panels gives high leve informations about a product, - /// ready to display. - /// This is used by open food facts website, - /// and by the official mobile application - /// - /// - /// - Remark: HTTP `GET /api/v2/product/{barcode}?fields=knowledge_panels`. - /// - Remark: Generated from `#/paths//api/v2/product/{barcode}?fields=knowledge_panels/get(getProductByBarcodeKnowledgePanels)`. - public func getProductByBarcodeKnowledgePanels(_ input: Operations.getProductByBarcodeKnowledgePanels.Input) async throws -> Operations.getProductByBarcodeKnowledgePanels.Output { - try await client.send( - input: input, - forOperation: Operations.getProductByBarcodeKnowledgePanels.id, - serializer: { input in - let path = try converter.renderedPath( - template: "/api/v2/product/{}?fields=knowledge_panels", - parameters: [ - input.path.barcode - ] - ) - var request: HTTPTypes.HTTPRequest = .init( - soar_path: path, - method: .get - ) - suppressMutabilityWarning(&request) - converter.setAcceptHeader( - in: &request.headerFields, - contentTypes: input.headers.accept - ) - return (request, nil) - }, - deserializer: { response, responseBody in - switch response.status.code { - case 200: - let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) - let body: Operations.getProductByBarcodeKnowledgePanels.Output.Ok.Body - let chosenContentType = try converter.bestContentType( - received: contentType, - options: [ - "application/json" - ] - ) - switch chosenContentType { - case "application/json": - body = try await converter.getResponseBodyAsJSON( - Operations.getProductByBarcodeKnowledgePanels.Output.Ok.Body.jsonPayload.self, - from: responseBody, - transforming: { value in - .json(value) - } - ) - default: - preconditionFailure("bestContentType chose an invalid content type.") - } - return .ok(.init(body: body)) - default: - return .undocumented( - statusCode: response.status.code, - .init( - headerFields: response.headerFields, - body: responseBody - ) - ) - } - } - ) - } - /// Performing OCR on a Product - /// - /// Open Food Facts uses optical character recognition (OCR) to retrieve nutritional data and other information from the product labels. - /// - /// - /// - Remark: HTTP `GET /cgi/ingredients.pl`. - /// - Remark: Generated from `#/paths//cgi/ingredients.pl/get(getIngredients)`. - public func getIngredients(_ input: Operations.getIngredients.Input) async throws -> Operations.getIngredients.Output { - try await client.send( - input: input, - forOperation: Operations.getIngredients.id, - serializer: { input in - let path = try converter.renderedPath( - template: "/cgi/ingredients.pl", - parameters: [] - ) - var request: HTTPTypes.HTTPRequest = .init( - soar_path: path, - method: .get - ) - suppressMutabilityWarning(&request) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "id", - value: input.query.id - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "code", - value: input.query.code - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "process_image", - value: input.query.process_image - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "ocr_engine", - value: input.query.ocr_engine - ) - converter.setAcceptHeader( - in: &request.headerFields, - contentTypes: input.headers.accept - ) - return (request, nil) - }, - deserializer: { response, responseBody in - switch response.status.code { - case 200: - let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) - let body: Operations.getIngredients.Output.Ok.Body - let chosenContentType = try converter.bestContentType( - received: contentType, - options: [ - "application/json" - ] - ) - switch chosenContentType { - case "application/json": - body = try await converter.getResponseBodyAsJSON( - Components.Schemas.ocr_on_product.self, - from: responseBody, - transforming: { value in - .json(value) - } - ) - default: - preconditionFailure("bestContentType chose an invalid content type.") - } - return .ok(.init(body: body)) - default: - return .undocumented( - statusCode: response.status.code, - .init( - headerFields: response.headerFields, - body: responseBody - ) - ) - } - } - ) - } - /// Rotate A Photo - /// - /// Although we recommend rotating photos manually and uploading a new version of the image, - /// the OFF API allows you to make api calls to automate this process. - /// You can rotate existing photos by setting the angle to 90º, 180º, or 270º clockwise. - /// - /// - /// - Remark: HTTP `GET /cgi/product_image_crop.pl`. - /// - Remark: Generated from `#/paths//cgi/product_image_crop.pl/get(getProductImageCrop)`. - public func getProductImageCrop(_ input: Operations.getProductImageCrop.Input) async throws -> Operations.getProductImageCrop.Output { - try await client.send( - input: input, - forOperation: Operations.getProductImageCrop.id, - serializer: { input in - let path = try converter.renderedPath( - template: "/cgi/product_image_crop.pl", - parameters: [] - ) - var request: HTTPTypes.HTTPRequest = .init( - soar_path: path, - method: .get - ) - suppressMutabilityWarning(&request) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "code", - value: input.query.code - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "id", - value: input.query.id - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "imgid", - value: input.query.imgid - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "angle", - value: input.query.angle - ) - converter.setAcceptHeader( - in: &request.headerFields, - contentTypes: input.headers.accept - ) - return (request, nil) - }, - deserializer: { response, responseBody in - switch response.status.code { - case 200: - let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) - let body: Operations.getProductImageCrop.Output.Ok.Body - let chosenContentType = try converter.bestContentType( - received: contentType, - options: [ - "application/json" - ] - ) - switch chosenContentType { - case "application/json": - body = try await converter.getResponseBodyAsJSON( - Components.Schemas.rotate_a_photo.self, - from: responseBody, - transforming: { value in - .json(value) - } - ) - default: - preconditionFailure("bestContentType chose an invalid content type.") - } - return .ok(.init(body: body)) - default: - return .undocumented( - statusCode: response.status.code, - .init( - headerFields: response.headerFields, - body: responseBody - ) - ) - } - } - ) - } - /// Crop A Photo - /// - /// Cropping is only relevant for editing existing products. - /// You cannot crop an image the first time you upload it to the system. - /// - /// - /// - Remark: HTTP `POST /cgi/product_image_crop.pl`. - /// - Remark: Generated from `#/paths//cgi/product_image_crop.pl/post(productImageCrop)`. - public func productImageCrop(_ input: Operations.productImageCrop.Input) async throws -> Operations.productImageCrop.Output { - try await client.send( - input: input, - forOperation: Operations.productImageCrop.id, - serializer: { input in - let path = try converter.renderedPath( - template: "/cgi/product_image_crop.pl", - parameters: [] - ) - var request: HTTPTypes.HTTPRequest = .init( - soar_path: path, - method: .post - ) - suppressMutabilityWarning(&request) - converter.setAcceptHeader( - in: &request.headerFields, - contentTypes: input.headers.accept - ) - let body: OpenAPIRuntime.HTTPBody? - switch input.body { - case let .multipartForm(value): - body = try converter.setRequiredRequestBodyAsMultipart( - value, - headerFields: &request.headerFields, - contentType: "multipart/form-data", - allowsUnknownParts: true, - requiredExactlyOncePartNames: [ - "code", - "id", - "imgid" - ], - requiredAtLeastOncePartNames: [], - atMostOncePartNames: [ - "angle", - "normalize", - "white_magic", - "x1", - "x2", - "y1", - "y2" - ], - zeroOrMoreTimesPartNames: [], - encoding: { part in - switch part { - case let .code(wrapped): - var headerFields: HTTPTypes.HTTPFields = .init() - let value = wrapped.payload - let body = try converter.setRequiredRequestBodyAsBinary( - value.body, - headerFields: &headerFields, - contentType: "text/plain" - ) - return .init( - name: "code", - filename: wrapped.filename, - headerFields: headerFields, - body: body - ) - case let .imgid(wrapped): - var headerFields: HTTPTypes.HTTPFields = .init() - let value = wrapped.payload - let body = try converter.setRequiredRequestBodyAsBinary( - value.body, - headerFields: &headerFields, - contentType: "text/plain" - ) - return .init( - name: "imgid", - filename: wrapped.filename, - headerFields: headerFields, - body: body - ) - case let .id(wrapped): - var headerFields: HTTPTypes.HTTPFields = .init() - let value = wrapped.payload - let body = try converter.setRequiredRequestBodyAsBinary( - value.body, - headerFields: &headerFields, - contentType: "text/plain" - ) - return .init( - name: "id", - filename: wrapped.filename, - headerFields: headerFields, - body: body - ) - case let .x1(wrapped): - var headerFields: HTTPTypes.HTTPFields = .init() - let value = wrapped.payload - let body = try converter.setRequiredRequestBodyAsBinary( - value.body, - headerFields: &headerFields, - contentType: "text/plain" - ) - return .init( - name: "x1", - filename: wrapped.filename, - headerFields: headerFields, - body: body - ) - case let .y1(wrapped): - var headerFields: HTTPTypes.HTTPFields = .init() - let value = wrapped.payload - let body = try converter.setRequiredRequestBodyAsBinary( - value.body, - headerFields: &headerFields, - contentType: "text/plain" - ) - return .init( - name: "y1", - filename: wrapped.filename, - headerFields: headerFields, - body: body - ) - case let .x2(wrapped): - var headerFields: HTTPTypes.HTTPFields = .init() - let value = wrapped.payload - let body = try converter.setRequiredRequestBodyAsBinary( - value.body, - headerFields: &headerFields, - contentType: "text/plain" - ) - return .init( - name: "x2", - filename: wrapped.filename, - headerFields: headerFields, - body: body - ) - case let .y2(wrapped): - var headerFields: HTTPTypes.HTTPFields = .init() - let value = wrapped.payload - let body = try converter.setRequiredRequestBodyAsBinary( - value.body, - headerFields: &headerFields, - contentType: "text/plain" - ) - return .init( - name: "y2", - filename: wrapped.filename, - headerFields: headerFields, - body: body - ) - case let .angle(wrapped): - var headerFields: HTTPTypes.HTTPFields = .init() - let value = wrapped.payload - let body = try converter.setRequiredRequestBodyAsBinary( - value.body, - headerFields: &headerFields, - contentType: "text/plain" - ) - return .init( - name: "angle", - filename: wrapped.filename, - headerFields: headerFields, - body: body - ) - case let .normalize(wrapped): - var headerFields: HTTPTypes.HTTPFields = .init() - let value = wrapped.payload - let body = try converter.setRequiredRequestBodyAsBinary( - value.body, - headerFields: &headerFields, - contentType: "text/plain" - ) - return .init( - name: "normalize", - filename: wrapped.filename, - headerFields: headerFields, - body: body - ) - case let .white_magic(wrapped): - var headerFields: HTTPTypes.HTTPFields = .init() - let value = wrapped.payload - let body = try converter.setRequiredRequestBodyAsBinary( - value.body, - headerFields: &headerFields, - contentType: "text/plain" - ) - return .init( - name: "white_magic", - filename: wrapped.filename, - headerFields: headerFields, - body: body - ) - case let .undocumented(value): - return value - } - } - ) - } - return (request, body) - }, - deserializer: { response, responseBody in - switch response.status.code { - case 200: - let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) - let body: Operations.productImageCrop.Output.Ok.Body - let chosenContentType = try converter.bestContentType( - received: contentType, - options: [ - "application/json" - ] - ) - switch chosenContentType { - case "application/json": - body = try await converter.getResponseBodyAsJSON( - OpenAPIRuntime.OpenAPIObjectContainer.self, - from: responseBody, - transforming: { value in - .json(value) - } - ) - default: - preconditionFailure("bestContentType chose an invalid content type.") - } - return .ok(.init(body: body)) - default: - return .undocumented( - statusCode: response.status.code, - .init( - headerFields: response.headerFields, - body: responseBody - ) - ) - } - } - ) - } - /// Unselect A Photo - /// - /// - Remark: HTTP `POST /cgi/product_image_unselect.pl`. - /// - Remark: Generated from `#/paths//cgi/product_image_unselect.pl/post(postProductImageUnselect)`. - public func postProductImageUnselect(_ input: Operations.postProductImageUnselect.Input) async throws -> Operations.postProductImageUnselect.Output { - try await client.send( - input: input, - forOperation: Operations.postProductImageUnselect.id, - serializer: { input in - let path = try converter.renderedPath( - template: "/cgi/product_image_unselect.pl", - parameters: [] - ) - var request: HTTPTypes.HTTPRequest = .init( - soar_path: path, - method: .post - ) - suppressMutabilityWarning(&request) - converter.setAcceptHeader( - in: &request.headerFields, - contentTypes: input.headers.accept - ) - let body: OpenAPIRuntime.HTTPBody? - switch input.body { - case let .multipartForm(value): - body = try converter.setRequiredRequestBodyAsMultipart( - value, - headerFields: &request.headerFields, - contentType: "multipart/form-data", - allowsUnknownParts: true, - requiredExactlyOncePartNames: [], - requiredAtLeastOncePartNames: [], - atMostOncePartNames: [ - "code", - "id" - ], - zeroOrMoreTimesPartNames: [], - encoding: { part in - switch part { - case let .code(wrapped): - var headerFields: HTTPTypes.HTTPFields = .init() - let value = wrapped.payload - let body = try converter.setRequiredRequestBodyAsBinary( - value.body, - headerFields: &headerFields, - contentType: "text/plain" - ) - return .init( - name: "code", - filename: wrapped.filename, - headerFields: headerFields, - body: body - ) - case let .id(wrapped): - var headerFields: HTTPTypes.HTTPFields = .init() - let value = wrapped.payload - let body = try converter.setRequiredRequestBodyAsBinary( - value.body, - headerFields: &headerFields, - contentType: "text/plain" - ) - return .init( - name: "id", - filename: wrapped.filename, - headerFields: headerFields, - body: body - ) - case let .undocumented(value): - return value - } - } - ) - } - return (request, body) - }, - deserializer: { response, responseBody in - switch response.status.code { - case 200: - let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) - let body: Operations.postProductImageUnselect.Output.Ok.Body - let chosenContentType = try converter.bestContentType( - received: contentType, - options: [ - "application/json" - ] - ) - switch chosenContentType { - case "application/json": - body = try await converter.getResponseBodyAsJSON( - Operations.postProductImageUnselect.Output.Ok.Body.jsonPayload.self, - from: responseBody, - transforming: { value in - .json(value) - } - ) - default: - preconditionFailure("bestContentType chose an invalid content type.") - } - return .ok(.init(body: body)) - default: - return .undocumented( - statusCode: response.status.code, - .init( - headerFields: response.headerFields, - body: responseBody - ) - ) - } - } - ) - } - /// Add or Edit A Product - /// - /// This updates a product. - /// - /// Note: If the barcode exists then you will be editing the existing product, - /// However if it doesn''t you will be creating a new product with that unique barcode, - /// and adding properties to the product. - /// - /// - /// - Remark: HTTP `POST /cgi/product_jqm2.pl`. - /// - Remark: Generated from `#/paths//cgi/product_jqm2.pl/post(postProduct)`. - public func postProduct(_ input: Operations.postProduct.Input) async throws -> Operations.postProduct.Output { - try await client.send( - input: input, - forOperation: Operations.postProduct.id, - serializer: { input in - let path = try converter.renderedPath( - template: "/cgi/product_jqm2.pl", - parameters: [] - ) - var request: HTTPTypes.HTTPRequest = .init( - soar_path: path, - method: .post - ) - suppressMutabilityWarning(&request) - converter.setAcceptHeader( - in: &request.headerFields, - contentTypes: input.headers.accept - ) - let body: OpenAPIRuntime.HTTPBody? - switch input.body { - case let .multipartForm(value): - body = try converter.setRequiredRequestBodyAsMultipart( - value, - headerFields: &request.headerFields, - contentType: "multipart/form-data", - allowsUnknownParts: true, - requiredExactlyOncePartNames: [ - "code", - "imagefield", - "password", - "user_id" - ], - requiredAtLeastOncePartNames: [], - atMostOncePartNames: [ - "app_name", - "app_uuid", - "app_version", - "comment", - "packaging", - "user_agent" - ], - zeroOrMoreTimesPartNames: [ - "brands", - "categories", - "labels" - ], - encoding: { part in - switch part { - case let .code(wrapped): - var headerFields: HTTPTypes.HTTPFields = .init() - let value = wrapped.payload - let body = try converter.setRequiredRequestBodyAsBinary( - value.body, - headerFields: &headerFields, - contentType: "text/plain" - ) - return .init( - name: "code", - filename: wrapped.filename, - headerFields: headerFields, - body: body - ) - case let .user_id(wrapped): - var headerFields: HTTPTypes.HTTPFields = .init() - let value = wrapped.payload - let body = try converter.setRequiredRequestBodyAsBinary( - value.body, - headerFields: &headerFields, - contentType: "text/plain" - ) - return .init( - name: "user_id", - filename: wrapped.filename, - headerFields: headerFields, - body: body - ) - case let .password(wrapped): - var headerFields: HTTPTypes.HTTPFields = .init() - let value = wrapped.payload - let body = try converter.setRequiredRequestBodyAsBinary( - value.body, - headerFields: &headerFields, - contentType: "text/plain" - ) - return .init( - name: "password", - filename: wrapped.filename, - headerFields: headerFields, - body: body - ) - case let .comment(wrapped): - var headerFields: HTTPTypes.HTTPFields = .init() - let value = wrapped.payload - let body = try converter.setRequiredRequestBodyAsBinary( - value.body, - headerFields: &headerFields, - contentType: "text/plain" - ) - return .init( - name: "comment", - filename: wrapped.filename, - headerFields: headerFields, - body: body - ) - case let .brands(wrapped): - var headerFields: HTTPTypes.HTTPFields = .init() - let value = wrapped.payload - let body = try converter.setRequiredRequestBodyAsBinary( - value.body, - headerFields: &headerFields, - contentType: "text/plain" - ) - return .init( - name: "brands", - filename: wrapped.filename, - headerFields: headerFields, - body: body - ) - case let .labels(wrapped): - var headerFields: HTTPTypes.HTTPFields = .init() - let value = wrapped.payload - let body = try converter.setRequiredRequestBodyAsBinary( - value.body, - headerFields: &headerFields, - contentType: "text/plain" - ) - return .init( - name: "labels", - filename: wrapped.filename, - headerFields: headerFields, - body: body - ) - case let .categories(wrapped): - var headerFields: HTTPTypes.HTTPFields = .init() - let value = wrapped.payload - let body = try converter.setRequiredRequestBodyAsBinary( - value.body, - headerFields: &headerFields, - contentType: "text/plain" - ) - return .init( - name: "categories", - filename: wrapped.filename, - headerFields: headerFields, - body: body - ) - case let .packaging(wrapped): - var headerFields: HTTPTypes.HTTPFields = .init() - let value = wrapped.payload - let body = try converter.setRequiredRequestBodyAsBinary( - value.body, - headerFields: &headerFields, - contentType: "text/plain" - ) - return .init( - name: "packaging", - filename: wrapped.filename, - headerFields: headerFields, - body: body - ) - case let .app_name(wrapped): - var headerFields: HTTPTypes.HTTPFields = .init() - let value = wrapped.payload - let body = try converter.setRequiredRequestBodyAsBinary( - value.body, - headerFields: &headerFields, - contentType: "text/plain" - ) - return .init( - name: "app_name", - filename: wrapped.filename, - headerFields: headerFields, - body: body - ) - case let .app_version(wrapped): - var headerFields: HTTPTypes.HTTPFields = .init() - let value = wrapped.payload - let body = try converter.setRequiredRequestBodyAsBinary( - value.body, - headerFields: &headerFields, - contentType: "text/plain" - ) - return .init( - name: "app_version", - filename: wrapped.filename, - headerFields: headerFields, - body: body - ) - case let .app_uuid(wrapped): - var headerFields: HTTPTypes.HTTPFields = .init() - let value = wrapped.payload - let body = try converter.setRequiredRequestBodyAsBinary( - value.body, - headerFields: &headerFields, - contentType: "text/plain" - ) - return .init( - name: "app_uuid", - filename: wrapped.filename, - headerFields: headerFields, - body: body - ) - case let .user_agent(wrapped): - var headerFields: HTTPTypes.HTTPFields = .init() - let value = wrapped.payload - let body = try converter.setRequiredRequestBodyAsBinary( - value.body, - headerFields: &headerFields, - contentType: "text/plain" - ) - return .init( - name: "user_agent", - filename: wrapped.filename, - headerFields: headerFields, - body: body - ) - case let .imagefield(wrapped): - var headerFields: HTTPTypes.HTTPFields = .init() - let value = wrapped.payload - let body = try converter.setRequiredRequestBodyAsJSON( - value.body, - headerFields: &headerFields, - contentType: "application/json; charset=utf-8" - ) - return .init( - name: "imagefield", - filename: wrapped.filename, - headerFields: headerFields, - body: body - ) - case let .undocumented(value): - return value - } - } - ) - } - return (request, body) - }, - deserializer: { response, responseBody in - switch response.status.code { - case 200: - let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) - let body: Operations.postProduct.Output.Ok.Body - let chosenContentType = try converter.bestContentType( - received: contentType, - options: [ - "application/json" - ] - ) - switch chosenContentType { - case "application/json": - body = try await converter.getResponseBodyAsJSON( - Components.Schemas.add_or_edit_a_product.self, - from: responseBody, - transforming: { value in - .json(value) - } - ) - default: - preconditionFailure("bestContentType chose an invalid content type.") - } - return .ok(.init(body: body)) - default: - return .undocumented( - statusCode: response.status.code, - .init( - headerFields: response.headerFields, - body: responseBody - ) - ) - } - } - ) - } - /// Search for Products - /// - /// Search request allows you to get products that match your search criteria. - /// - /// It allows you create many custom APIs for your use case. - /// - /// If the search query parameter has 2 possible values, they are seperated by a comma(,). - /// When filtering via a parameter that has different language codes like `fr`, `de` or `en`, specify the language code in the parameter name e.g `categories_tags_en` - /// - /// **Important:** search API v2 does not support full text request (search_term), - /// you have to use [search API v1](https://wiki.openfoodfacts.org/API/Read/Search) for that. - /// Upcoming [search-a-licious project](https://github.com/openfoodfacts/search-a-licious) will fix that. - /// - /// ### Limiting results - /// - /// You can limit the size of returned objects thanks to the `fields` object (see below). - /// - /// eg: `fields=code,product_name,brands,attribute_groups`` - /// - /// Please use it as much as possible to avoid overloading the servers. - /// - /// The search use pagination, see `page` and `page_size` parameters. - /// - /// **Beware:** the `page_count` data in item is a bit counter intuitive…, read the description. - /// - /// ### Conditions on tags - /// - /// All `_tags`` parameters accepts either: - /// - /// * a single value - /// * or a comma-separated list of values (doing a AND) - /// * or a pipe separated list of values (doing a OR) - /// - /// You can exclude terms by using a "-" prefix. - /// - /// For taxonomized entries, you might either use the tag id (recommended), - /// or a known synonym (without language prefix) - /// - /// * `labels_tags=en:organic,en:fair-trade` find items that are fair-trade AND organic - /// * `labels_tags=en:organic|en:fair-trade` find items that are fair-trade OR organic - /// * `labels_tags=en:organic,en:-fair-trade` find items that are organic BUT NOT fair-trade - /// - /// - /// ### Conditions on nutriments - /// - /// To get a list of nutrients - /// - /// You can either query on nutrient per 100g (`_100g` suffix) - /// or per serving (`serving` suffix). - /// - /// You can also add `_prepared_` - /// to get the nutrients in the prepared product instead of as sold. - /// - /// You can add a comparison operator and value to the parameter name - /// to get products with nutrient above or bellow a value. - /// If you use a parameter value it exactly match it. - /// - /// * `energy-kj_100g<200` products where energy in kj for 100g is less than 200kj - /// * `sugars_serving>10` products where sugar per serving is greater than 10g - /// * `saturated-fat_100g=1` products where saturated fat per 100g is exactly 10g - /// * `salt_prepared_serving<0.1` products where salt per serving for prepared product is less than 0.1g - /// - /// ### More references - /// - /// See also [wiki page](https://wiki.openfoodfacts.org/Open_Food_Facts_Search_API_Version_2) - /// - /// - /// - Remark: HTTP `GET /api/v2/search`. - /// - Remark: Generated from `#/paths//api/v2/search/get(searchProducts)`. - public func searchProducts(_ input: Operations.searchProducts.Input) async throws -> Operations.searchProducts.Output { - try await client.send( - input: input, - forOperation: Operations.searchProducts.id, - serializer: { input in - let path = try converter.renderedPath( - template: "/api/v2/search", - parameters: [] - ) - var request: HTTPTypes.HTTPRequest = .init( - soar_path: path, - method: .get - ) - suppressMutabilityWarning(&request) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: false, - name: "additives_tags", - value: input.query.additives_tags - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: false, - name: "allergens_tags", - value: input.query.allergens_tags - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: false, - name: "brands_tags", - value: input.query.brands_tags - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: false, - name: "categories_tags", - value: input.query.categories_tags - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: false, - name: "countries_tags_en", - value: input.query.countries_tags_en - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: false, - name: "emb_codes_tags", - value: input.query.emb_codes_tags - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: false, - name: "labels_tags", - value: input.query.labels_tags - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: false, - name: "manufacturing_places_tags", - value: input.query.manufacturing_places_tags - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: false, - name: "nutrition_grades_tags", - value: input.query.nutrition_grades_tags - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: false, - name: "origins_tags", - value: input.query.origins_tags - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: false, - name: "packaging_tags_de", - value: input.query.packaging_tags_de - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: false, - name: "purchase_places_tags", - value: input.query.purchase_places_tags - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: false, - name: "states_tags", - value: input.query.states_tags - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: false, - name: "stores_tags", - value: input.query.stores_tags - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: false, - name: "traces_tags", - value: input.query.traces_tags - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: false, - name: "_tags_", - value: input.query._lt_tag_name_gt__tags__lt_language_code_gt_ - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "_lt_", - value: input.query._lt_nutrient_gt__lt__lt_value_gt_ - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "_gt_", - value: input.query._lt_nutrient_gt__gt__lt_value_gt_ - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "_eq_", - value: input.query._lt_nutrient_gt__eq__lt_value_gt_ - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "fields", - value: input.query.fields - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "sort_by", - value: input.query.sort_by - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "page", - value: input.query.page - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "page_size", - value: input.query.page_size - ) - converter.setAcceptHeader( - in: &request.headerFields, - contentTypes: input.headers.accept - ) - return (request, nil) - }, - deserializer: { response, responseBody in - switch response.status.code { - case 200: - let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) - let body: Operations.searchProducts.Output.Ok.Body - let chosenContentType = try converter.bestContentType( - received: contentType, - options: [ - "application/json" - ] - ) - switch chosenContentType { - case "application/json": - body = try await converter.getResponseBodyAsJSON( - Components.Schemas.search_for_products.self, - from: responseBody, - transforming: { value in - .json(value) - } - ) - default: - preconditionFailure("bestContentType chose an invalid content type.") - } - return .ok(.init(body: body)) - default: - return .undocumented( - statusCode: response.status.code, - .init( - headerFields: response.headerFields, - body: responseBody - ) - ) - } - } - ) - } - /// Get Suggestions to Aid Adding/Editing Products - /// - /// For example , Dave is looking for packaging_shapes that contain the term "fe", - /// all packaging_shapes containing "fe" will be returned. - /// This is useful if you have a search in your application, - /// for a specific product field. - /// - /// - /// - Remark: HTTP `GET /cgi/suggest.pl`. - /// - Remark: Generated from `#/paths//cgi/suggest.pl/get(getSuggestions)`. - public func getSuggestions(_ input: Operations.getSuggestions.Input) async throws -> Operations.getSuggestions.Output { - try await client.send( - input: input, - forOperation: Operations.getSuggestions.id, - serializer: { input in - let path = try converter.renderedPath( - template: "/cgi/suggest.pl", - parameters: [] - ) - var request: HTTPTypes.HTTPRequest = .init( - soar_path: path, - method: .get - ) - suppressMutabilityWarning(&request) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "tagtype", - value: input.query.tagtype - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "term", - value: input.query.term - ) - converter.setAcceptHeader( - in: &request.headerFields, - contentTypes: input.headers.accept - ) - return (request, nil) - }, - deserializer: { response, responseBody in - switch response.status.code { - case 200: - let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) - let body: Operations.getSuggestions.Output.Ok.Body - let chosenContentType = try converter.bestContentType( - received: contentType, - options: [ - "application/json" - ] - ) - switch chosenContentType { - case "application/json": - body = try await converter.getResponseBodyAsJSON( - OpenAPIRuntime.OpenAPIArrayContainer.self, - from: responseBody, - transforming: { value in - .json(value) - } - ) - default: - preconditionFailure("bestContentType chose an invalid content type.") - } - return .ok(.init(body: body)) - default: - return .undocumented( - statusCode: response.status.code, - .init( - headerFields: response.headerFields, - body: responseBody - ) - ) - } - } - ) - } - /// Get a nested list of nutrients that can be displayed in the nutrition facts table for a specific country and language - /// - /// Used to display the nutrition facts table of a product, or to display a form to input those nutrition facts. - /// - /// - /// - Remark: HTTP `GET /cgi/nutrients.pl`. - /// - Remark: Generated from `#/paths//cgi/nutrients.pl/get(getNutrients)`. - public func getNutrients(_ input: Operations.getNutrients.Input) async throws -> Operations.getNutrients.Output { - try await client.send( - input: input, - forOperation: Operations.getNutrients.id, - serializer: { input in - let path = try converter.renderedPath( - template: "/cgi/nutrients.pl", - parameters: [] - ) - var request: HTTPTypes.HTTPRequest = .init( - soar_path: path, - method: .get - ) - suppressMutabilityWarning(&request) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "cc", - value: input.query.cc - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "lc", - value: input.query.lc - ) - converter.setAcceptHeader( - in: &request.headerFields, - contentTypes: input.headers.accept - ) - return (request, nil) - }, - deserializer: { response, responseBody in - switch response.status.code { - case 200: - let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) - let body: Operations.getNutrients.Output.Ok.Body - let chosenContentType = try converter.bestContentType( - received: contentType, - options: [ - "application/json" - ] - ) - switch chosenContentType { - case "application/json": - body = try await converter.getResponseBodyAsJSON( - Components.Schemas.get_nutrients.self, - from: responseBody, - transforming: { value in - .json(value) - } - ) - default: - preconditionFailure("bestContentType chose an invalid content type.") - } - return .ok(.init(body: body)) - default: - return .undocumented( - statusCode: response.status.code, - .init( - headerFields: response.headerFields, - body: responseBody - ) - ) - } - } - ) - } - /// Get the list of attributes available for personal search. - /// - /// Attributes are at the heart of personal search. - /// They score the products according to different criterias, - /// which could then be matched to a user's preferences. - /// - /// This API helps you list attributes and display them in your application, - /// for the user to choose the importance of each criteria. - /// - /// note: /api/v2/attribute_groups_{lc} is also a valid route, but consider it deprecated - /// - /// - /// - Remark: HTTP `GET /api/v2/attribute_groups`. - /// - Remark: Generated from `#/paths//api/v2/attribute_groups/get(getAttributeGroups)`. - public func getAttributeGroups(_ input: Operations.getAttributeGroups.Input) async throws -> Operations.getAttributeGroups.Output { - try await client.send( - input: input, - forOperation: Operations.getAttributeGroups.id, - serializer: { input in - let path = try converter.renderedPath( - template: "/api/v2/attribute_groups", - parameters: [] - ) - var request: HTTPTypes.HTTPRequest = .init( - soar_path: path, - method: .get - ) - suppressMutabilityWarning(&request) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "lc", - value: input.query.lc - ) - converter.setAcceptHeader( - in: &request.headerFields, - contentTypes: input.headers.accept - ) - return (request, nil) - }, - deserializer: { response, responseBody in - switch response.status.code { - case 200: - let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) - let body: Operations.getAttributeGroups.Output.Ok.Body - let chosenContentType = try converter.bestContentType( - received: contentType, - options: [ - "application/json" - ] - ) - switch chosenContentType { - case "application/json": - body = try await converter.getResponseBodyAsJSON( - Components.Schemas.get_attribute_groups.self, - from: responseBody, - transforming: { value in - .json(value) - } - ) - default: - preconditionFailure("bestContentType chose an invalid content type.") - } - return .ok(.init(body: body)) - default: - return .undocumented( - statusCode: response.status.code, - .init( - headerFields: response.headerFields, - body: responseBody - ) - ) - } - } - ) - } - /// Get the weights corresponding to attributes preferences - /// to compute personal product - /// - /// - /// - Remark: HTTP `GET /api/v2/preferences`. - /// - Remark: Generated from `#/paths//api/v2/preferences/get(getPreferences)`. - public func getPreferences(_ input: Operations.getPreferences.Input) async throws -> Operations.getPreferences.Output { - try await client.send( - input: input, - forOperation: Operations.getPreferences.id, - serializer: { input in - let path = try converter.renderedPath( - template: "/api/v2/preferences", - parameters: [] - ) - var request: HTTPTypes.HTTPRequest = .init( - soar_path: path, - method: .get - ) - suppressMutabilityWarning(&request) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "lc", - value: input.query.lc - ) - converter.setAcceptHeader( - in: &request.headerFields, - contentTypes: input.headers.accept - ) - return (request, nil) - }, - deserializer: { response, responseBody in - switch response.status.code { - case 200: - let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) - let body: Operations.getPreferences.Output.Ok.Body - let chosenContentType = try converter.bestContentType( - received: contentType, - options: [ - "application/json" - ] - ) - switch chosenContentType { - case "application/json": - body = try await converter.getResponseBodyAsJSON( - Components.Schemas.get_preferences.self, - from: responseBody, - transforming: { value in - .json(value) - } - ) - default: - preconditionFailure("bestContentType chose an invalid content type.") - } - return .ok(.init(body: body)) - default: - return .undocumented( - statusCode: response.status.code, - .init( - headerFields: response.headerFields, - body: responseBody - ) - ) - } - } - ) - } -} diff --git a/OpenFoodFactsService/Sources/Types.swift b/OpenFoodFactsService/Sources/Types.swift deleted file mode 100644 index 5e537c4..0000000 --- a/OpenFoodFactsService/Sources/Types.swift +++ /dev/null @@ -1,8662 +0,0 @@ -// Generated by swift-openapi-generator, do not modify. -@_spi(Generated) import OpenAPIRuntime -#if os(Linux) -@preconcurrency import struct Foundation.URL -@preconcurrency import struct Foundation.Data -@preconcurrency import struct Foundation.Date -#else -import struct Foundation.URL -import struct Foundation.Data -import struct Foundation.Date -#endif -/// A type that performs HTTP operations defined by the OpenAPI document. -public protocol APIProtocol: Sendable { - /// Get information for a specific product by barcode - /// - /// A product can be fetched via its unique barcode. - /// It returns all the details of that product response. - /// - /// - /// - Remark: HTTP `GET /api/v2/product/{barcode}`. - /// - Remark: Generated from `#/paths//api/v2/product/{barcode}/get(getProductByBarcode)`. - func getProductByBarcode(_ input: Operations.getProductByBarcode.Input) async throws -> Operations.getProductByBarcode.Output - /// Get Knowledge panels for a specific product by barcode - /// (special case of get product) - /// - /// - /// Knowledge panels gives high leve informations about a product, - /// ready to display. - /// This is used by open food facts website, - /// and by the official mobile application - /// - /// - /// - Remark: HTTP `GET /api/v2/product/{barcode}?fields=knowledge_panels`. - /// - Remark: Generated from `#/paths//api/v2/product/{barcode}?fields=knowledge_panels/get(getProductByBarcodeKnowledgePanels)`. - func getProductByBarcodeKnowledgePanels(_ input: Operations.getProductByBarcodeKnowledgePanels.Input) async throws -> Operations.getProductByBarcodeKnowledgePanels.Output - /// Performing OCR on a Product - /// - /// Open Food Facts uses optical character recognition (OCR) to retrieve nutritional data and other information from the product labels. - /// - /// - /// - Remark: HTTP `GET /cgi/ingredients.pl`. - /// - Remark: Generated from `#/paths//cgi/ingredients.pl/get(getIngredients)`. - func getIngredients(_ input: Operations.getIngredients.Input) async throws -> Operations.getIngredients.Output - /// Rotate A Photo - /// - /// Although we recommend rotating photos manually and uploading a new version of the image, - /// the OFF API allows you to make api calls to automate this process. - /// You can rotate existing photos by setting the angle to 90º, 180º, or 270º clockwise. - /// - /// - /// - Remark: HTTP `GET /cgi/product_image_crop.pl`. - /// - Remark: Generated from `#/paths//cgi/product_image_crop.pl/get(getProductImageCrop)`. - func getProductImageCrop(_ input: Operations.getProductImageCrop.Input) async throws -> Operations.getProductImageCrop.Output - /// Crop A Photo - /// - /// Cropping is only relevant for editing existing products. - /// You cannot crop an image the first time you upload it to the system. - /// - /// - /// - Remark: HTTP `POST /cgi/product_image_crop.pl`. - /// - Remark: Generated from `#/paths//cgi/product_image_crop.pl/post(productImageCrop)`. - func productImageCrop(_ input: Operations.productImageCrop.Input) async throws -> Operations.productImageCrop.Output - /// Unselect A Photo - /// - /// - Remark: HTTP `POST /cgi/product_image_unselect.pl`. - /// - Remark: Generated from `#/paths//cgi/product_image_unselect.pl/post(postProductImageUnselect)`. - func postProductImageUnselect(_ input: Operations.postProductImageUnselect.Input) async throws -> Operations.postProductImageUnselect.Output - /// Add or Edit A Product - /// - /// This updates a product. - /// - /// Note: If the barcode exists then you will be editing the existing product, - /// However if it doesn''t you will be creating a new product with that unique barcode, - /// and adding properties to the product. - /// - /// - /// - Remark: HTTP `POST /cgi/product_jqm2.pl`. - /// - Remark: Generated from `#/paths//cgi/product_jqm2.pl/post(postProduct)`. - func postProduct(_ input: Operations.postProduct.Input) async throws -> Operations.postProduct.Output - /// Search for Products - /// - /// Search request allows you to get products that match your search criteria. - /// - /// It allows you create many custom APIs for your use case. - /// - /// If the search query parameter has 2 possible values, they are seperated by a comma(,). - /// When filtering via a parameter that has different language codes like `fr`, `de` or `en`, specify the language code in the parameter name e.g `categories_tags_en` - /// - /// **Important:** search API v2 does not support full text request (search_term), - /// you have to use [search API v1](https://wiki.openfoodfacts.org/API/Read/Search) for that. - /// Upcoming [search-a-licious project](https://github.com/openfoodfacts/search-a-licious) will fix that. - /// - /// ### Limiting results - /// - /// You can limit the size of returned objects thanks to the `fields` object (see below). - /// - /// eg: `fields=code,product_name,brands,attribute_groups`` - /// - /// Please use it as much as possible to avoid overloading the servers. - /// - /// The search use pagination, see `page` and `page_size` parameters. - /// - /// **Beware:** the `page_count` data in item is a bit counter intuitive…, read the description. - /// - /// ### Conditions on tags - /// - /// All `_tags`` parameters accepts either: - /// - /// * a single value - /// * or a comma-separated list of values (doing a AND) - /// * or a pipe separated list of values (doing a OR) - /// - /// You can exclude terms by using a "-" prefix. - /// - /// For taxonomized entries, you might either use the tag id (recommended), - /// or a known synonym (without language prefix) - /// - /// * `labels_tags=en:organic,en:fair-trade` find items that are fair-trade AND organic - /// * `labels_tags=en:organic|en:fair-trade` find items that are fair-trade OR organic - /// * `labels_tags=en:organic,en:-fair-trade` find items that are organic BUT NOT fair-trade - /// - /// - /// ### Conditions on nutriments - /// - /// To get a list of nutrients - /// - /// You can either query on nutrient per 100g (`_100g` suffix) - /// or per serving (`serving` suffix). - /// - /// You can also add `_prepared_` - /// to get the nutrients in the prepared product instead of as sold. - /// - /// You can add a comparison operator and value to the parameter name - /// to get products with nutrient above or bellow a value. - /// If you use a parameter value it exactly match it. - /// - /// * `energy-kj_100g<200` products where energy in kj for 100g is less than 200kj - /// * `sugars_serving>10` products where sugar per serving is greater than 10g - /// * `saturated-fat_100g=1` products where saturated fat per 100g is exactly 10g - /// * `salt_prepared_serving<0.1` products where salt per serving for prepared product is less than 0.1g - /// - /// ### More references - /// - /// See also [wiki page](https://wiki.openfoodfacts.org/Open_Food_Facts_Search_API_Version_2) - /// - /// - /// - Remark: HTTP `GET /api/v2/search`. - /// - Remark: Generated from `#/paths//api/v2/search/get(searchProducts)`. - func searchProducts(_ input: Operations.searchProducts.Input) async throws -> Operations.searchProducts.Output - /// Get Suggestions to Aid Adding/Editing Products - /// - /// For example , Dave is looking for packaging_shapes that contain the term "fe", - /// all packaging_shapes containing "fe" will be returned. - /// This is useful if you have a search in your application, - /// for a specific product field. - /// - /// - /// - Remark: HTTP `GET /cgi/suggest.pl`. - /// - Remark: Generated from `#/paths//cgi/suggest.pl/get(getSuggestions)`. - func getSuggestions(_ input: Operations.getSuggestions.Input) async throws -> Operations.getSuggestions.Output - /// Get a nested list of nutrients that can be displayed in the nutrition facts table for a specific country and language - /// - /// Used to display the nutrition facts table of a product, or to display a form to input those nutrition facts. - /// - /// - /// - Remark: HTTP `GET /cgi/nutrients.pl`. - /// - Remark: Generated from `#/paths//cgi/nutrients.pl/get(getNutrients)`. - func getNutrients(_ input: Operations.getNutrients.Input) async throws -> Operations.getNutrients.Output - /// Get the list of attributes available for personal search. - /// - /// Attributes are at the heart of personal search. - /// They score the products according to different criterias, - /// which could then be matched to a user's preferences. - /// - /// This API helps you list attributes and display them in your application, - /// for the user to choose the importance of each criteria. - /// - /// note: /api/v2/attribute_groups_{lc} is also a valid route, but consider it deprecated - /// - /// - /// - Remark: HTTP `GET /api/v2/attribute_groups`. - /// - Remark: Generated from `#/paths//api/v2/attribute_groups/get(getAttributeGroups)`. - func getAttributeGroups(_ input: Operations.getAttributeGroups.Input) async throws -> Operations.getAttributeGroups.Output - /// Get the weights corresponding to attributes preferences - /// to compute personal product - /// - /// - /// - Remark: HTTP `GET /api/v2/preferences`. - /// - Remark: Generated from `#/paths//api/v2/preferences/get(getPreferences)`. - func getPreferences(_ input: Operations.getPreferences.Input) async throws -> Operations.getPreferences.Output -} - -/// Convenience overloads for operation inputs. -extension APIProtocol { - /// Get information for a specific product by barcode - /// - /// A product can be fetched via its unique barcode. - /// It returns all the details of that product response. - /// - /// - /// - Remark: HTTP `GET /api/v2/product/{barcode}`. - /// - Remark: Generated from `#/paths//api/v2/product/{barcode}/get(getProductByBarcode)`. - public func getProductByBarcode( - path: Operations.getProductByBarcode.Input.Path, - headers: Operations.getProductByBarcode.Input.Headers = .init() - ) async throws -> Operations.getProductByBarcode.Output { - try await getProductByBarcode(Operations.getProductByBarcode.Input( - path: path, - headers: headers - )) - } - /// Get Knowledge panels for a specific product by barcode - /// (special case of get product) - /// - /// - /// Knowledge panels gives high leve informations about a product, - /// ready to display. - /// This is used by open food facts website, - /// and by the official mobile application - /// - /// - /// - Remark: HTTP `GET /api/v2/product/{barcode}?fields=knowledge_panels`. - /// - Remark: Generated from `#/paths//api/v2/product/{barcode}?fields=knowledge_panels/get(getProductByBarcodeKnowledgePanels)`. - public func getProductByBarcodeKnowledgePanels( - path: Operations.getProductByBarcodeKnowledgePanels.Input.Path, - headers: Operations.getProductByBarcodeKnowledgePanels.Input.Headers = .init() - ) async throws -> Operations.getProductByBarcodeKnowledgePanels.Output { - try await getProductByBarcodeKnowledgePanels(Operations.getProductByBarcodeKnowledgePanels.Input( - path: path, - headers: headers - )) - } - /// Performing OCR on a Product - /// - /// Open Food Facts uses optical character recognition (OCR) to retrieve nutritional data and other information from the product labels. - /// - /// - /// - Remark: HTTP `GET /cgi/ingredients.pl`. - /// - Remark: Generated from `#/paths//cgi/ingredients.pl/get(getIngredients)`. - public func getIngredients( - query: Operations.getIngredients.Input.Query, - headers: Operations.getIngredients.Input.Headers = .init() - ) async throws -> Operations.getIngredients.Output { - try await getIngredients(Operations.getIngredients.Input( - query: query, - headers: headers - )) - } - /// Rotate A Photo - /// - /// Although we recommend rotating photos manually and uploading a new version of the image, - /// the OFF API allows you to make api calls to automate this process. - /// You can rotate existing photos by setting the angle to 90º, 180º, or 270º clockwise. - /// - /// - /// - Remark: HTTP `GET /cgi/product_image_crop.pl`. - /// - Remark: Generated from `#/paths//cgi/product_image_crop.pl/get(getProductImageCrop)`. - public func getProductImageCrop( - query: Operations.getProductImageCrop.Input.Query, - headers: Operations.getProductImageCrop.Input.Headers = .init() - ) async throws -> Operations.getProductImageCrop.Output { - try await getProductImageCrop(Operations.getProductImageCrop.Input( - query: query, - headers: headers - )) - } - /// Crop A Photo - /// - /// Cropping is only relevant for editing existing products. - /// You cannot crop an image the first time you upload it to the system. - /// - /// - /// - Remark: HTTP `POST /cgi/product_image_crop.pl`. - /// - Remark: Generated from `#/paths//cgi/product_image_crop.pl/post(productImageCrop)`. - public func productImageCrop( - headers: Operations.productImageCrop.Input.Headers = .init(), - body: Operations.productImageCrop.Input.Body - ) async throws -> Operations.productImageCrop.Output { - try await productImageCrop(Operations.productImageCrop.Input( - headers: headers, - body: body - )) - } - /// Unselect A Photo - /// - /// - Remark: HTTP `POST /cgi/product_image_unselect.pl`. - /// - Remark: Generated from `#/paths//cgi/product_image_unselect.pl/post(postProductImageUnselect)`. - public func postProductImageUnselect( - headers: Operations.postProductImageUnselect.Input.Headers = .init(), - body: Operations.postProductImageUnselect.Input.Body - ) async throws -> Operations.postProductImageUnselect.Output { - try await postProductImageUnselect(Operations.postProductImageUnselect.Input( - headers: headers, - body: body - )) - } - /// Add or Edit A Product - /// - /// This updates a product. - /// - /// Note: If the barcode exists then you will be editing the existing product, - /// However if it doesn''t you will be creating a new product with that unique barcode, - /// and adding properties to the product. - /// - /// - /// - Remark: HTTP `POST /cgi/product_jqm2.pl`. - /// - Remark: Generated from `#/paths//cgi/product_jqm2.pl/post(postProduct)`. - public func postProduct( - headers: Operations.postProduct.Input.Headers = .init(), - body: Operations.postProduct.Input.Body - ) async throws -> Operations.postProduct.Output { - try await postProduct(Operations.postProduct.Input( - headers: headers, - body: body - )) - } - /// Search for Products - /// - /// Search request allows you to get products that match your search criteria. - /// - /// It allows you create many custom APIs for your use case. - /// - /// If the search query parameter has 2 possible values, they are seperated by a comma(,). - /// When filtering via a parameter that has different language codes like `fr`, `de` or `en`, specify the language code in the parameter name e.g `categories_tags_en` - /// - /// **Important:** search API v2 does not support full text request (search_term), - /// you have to use [search API v1](https://wiki.openfoodfacts.org/API/Read/Search) for that. - /// Upcoming [search-a-licious project](https://github.com/openfoodfacts/search-a-licious) will fix that. - /// - /// ### Limiting results - /// - /// You can limit the size of returned objects thanks to the `fields` object (see below). - /// - /// eg: `fields=code,product_name,brands,attribute_groups`` - /// - /// Please use it as much as possible to avoid overloading the servers. - /// - /// The search use pagination, see `page` and `page_size` parameters. - /// - /// **Beware:** the `page_count` data in item is a bit counter intuitive…, read the description. - /// - /// ### Conditions on tags - /// - /// All `_tags`` parameters accepts either: - /// - /// * a single value - /// * or a comma-separated list of values (doing a AND) - /// * or a pipe separated list of values (doing a OR) - /// - /// You can exclude terms by using a "-" prefix. - /// - /// For taxonomized entries, you might either use the tag id (recommended), - /// or a known synonym (without language prefix) - /// - /// * `labels_tags=en:organic,en:fair-trade` find items that are fair-trade AND organic - /// * `labels_tags=en:organic|en:fair-trade` find items that are fair-trade OR organic - /// * `labels_tags=en:organic,en:-fair-trade` find items that are organic BUT NOT fair-trade - /// - /// - /// ### Conditions on nutriments - /// - /// To get a list of nutrients - /// - /// You can either query on nutrient per 100g (`_100g` suffix) - /// or per serving (`serving` suffix). - /// - /// You can also add `_prepared_` - /// to get the nutrients in the prepared product instead of as sold. - /// - /// You can add a comparison operator and value to the parameter name - /// to get products with nutrient above or bellow a value. - /// If you use a parameter value it exactly match it. - /// - /// * `energy-kj_100g<200` products where energy in kj for 100g is less than 200kj - /// * `sugars_serving>10` products where sugar per serving is greater than 10g - /// * `saturated-fat_100g=1` products where saturated fat per 100g is exactly 10g - /// * `salt_prepared_serving<0.1` products where salt per serving for prepared product is less than 0.1g - /// - /// ### More references - /// - /// See also [wiki page](https://wiki.openfoodfacts.org/Open_Food_Facts_Search_API_Version_2) - /// - /// - /// - Remark: HTTP `GET /api/v2/search`. - /// - Remark: Generated from `#/paths//api/v2/search/get(searchProducts)`. - public func searchProducts( - query: Operations.searchProducts.Input.Query = .init(), - headers: Operations.searchProducts.Input.Headers = .init() - ) async throws -> Operations.searchProducts.Output { - try await searchProducts(Operations.searchProducts.Input( - query: query, - headers: headers - )) - } - /// Get Suggestions to Aid Adding/Editing Products - /// - /// For example , Dave is looking for packaging_shapes that contain the term "fe", - /// all packaging_shapes containing "fe" will be returned. - /// This is useful if you have a search in your application, - /// for a specific product field. - /// - /// - /// - Remark: HTTP `GET /cgi/suggest.pl`. - /// - Remark: Generated from `#/paths//cgi/suggest.pl/get(getSuggestions)`. - public func getSuggestions( - query: Operations.getSuggestions.Input.Query = .init(), - headers: Operations.getSuggestions.Input.Headers = .init() - ) async throws -> Operations.getSuggestions.Output { - try await getSuggestions(Operations.getSuggestions.Input( - query: query, - headers: headers - )) - } - /// Get a nested list of nutrients that can be displayed in the nutrition facts table for a specific country and language - /// - /// Used to display the nutrition facts table of a product, or to display a form to input those nutrition facts. - /// - /// - /// - Remark: HTTP `GET /cgi/nutrients.pl`. - /// - Remark: Generated from `#/paths//cgi/nutrients.pl/get(getNutrients)`. - public func getNutrients( - query: Operations.getNutrients.Input.Query = .init(), - headers: Operations.getNutrients.Input.Headers = .init() - ) async throws -> Operations.getNutrients.Output { - try await getNutrients(Operations.getNutrients.Input( - query: query, - headers: headers - )) - } - /// Get the list of attributes available for personal search. - /// - /// Attributes are at the heart of personal search. - /// They score the products according to different criterias, - /// which could then be matched to a user's preferences. - /// - /// This API helps you list attributes and display them in your application, - /// for the user to choose the importance of each criteria. - /// - /// note: /api/v2/attribute_groups_{lc} is also a valid route, but consider it deprecated - /// - /// - /// - Remark: HTTP `GET /api/v2/attribute_groups`. - /// - Remark: Generated from `#/paths//api/v2/attribute_groups/get(getAttributeGroups)`. - public func getAttributeGroups( - query: Operations.getAttributeGroups.Input.Query = .init(), - headers: Operations.getAttributeGroups.Input.Headers = .init() - ) async throws -> Operations.getAttributeGroups.Output { - try await getAttributeGroups(Operations.getAttributeGroups.Input( - query: query, - headers: headers - )) - } - /// Get the weights corresponding to attributes preferences - /// to compute personal product - /// - /// - /// - Remark: HTTP `GET /api/v2/preferences`. - /// - Remark: Generated from `#/paths//api/v2/preferences/get(getPreferences)`. - public func getPreferences( - query: Operations.getPreferences.Input.Query = .init(), - headers: Operations.getPreferences.Input.Headers = .init() - ) async throws -> Operations.getPreferences.Output { - try await getPreferences(Operations.getPreferences.Input( - query: query, - headers: headers - )) - } -} - -/// Server URLs defined in the OpenAPI document. -public enum Servers { - /// dev - public static func server1() throws -> Foundation.URL { - try Foundation.URL( - validatingOpenAPIServerURL: "https://world.openfoodfacts.net", - variables: [] - ) - } - /// prod - public static func server2() throws -> Foundation.URL { - try Foundation.URL( - validatingOpenAPIServerURL: "https://world.openfoodfacts.org", - variables: [] - ) - } -} - -/// Types generated from the components section of the OpenAPI document. -public enum Components { - /// Types generated from the `#/components/schemas` section of the OpenAPI document. - public enum Schemas { - /// - Remark: Generated from `#/components/schemas/Product-Base`. - public typealias Product_hyphen_Base = Components.Schemas.product_base - /// - Remark: Generated from `#/components/schemas/Product-Misc`. - public typealias Product_hyphen_Misc = Components.Schemas.product_misc - /// - Remark: Generated from `#/components/schemas/Product-Tags`. - public typealias Product_hyphen_Tags = Components.Schemas.product_tags - /// - Remark: Generated from `#/components/schemas/Product-Nutrition`. - public typealias Product_hyphen_Nutrition = Components.Schemas.product_nutrition - /// - Remark: Generated from `#/components/schemas/Product-Ingredients`. - public typealias Product_hyphen_Ingredients = Components.Schemas.product_ingredients - /// - Remark: Generated from `#/components/schemas/Product-Images`. - public typealias Product_hyphen_Images = Components.Schemas.product_images - /// - Remark: Generated from `#/components/schemas/Product-Eco-Score`. - public typealias Product_hyphen_Eco_hyphen_Score = Components.Schemas.product_ecoscore - /// - Remark: Generated from `#/components/schemas/Product-Metadata`. - public typealias Product_hyphen_Metadata = Components.Schemas.product_meta - /// - Remark: Generated from `#/components/schemas/Product-Data-Quality`. - public typealias Product_hyphen_Data_hyphen_Quality = Components.Schemas.product_quality - /// - Remark: Generated from `#/components/schemas/Product-Knowledge-Panels`. - public typealias Product_hyphen_Knowledge_hyphen_Panels = Components.Schemas.product_knowledge_panels - /// - Remark: Generated from `#/components/schemas/Product-Attribute-Groups`. - public typealias Product_hyphen_Attribute_hyphen_Groups = Components.Schemas.product_attribute_groups - /// - Remark: Generated from `#/components/schemas/Product`. - public typealias Product = Components.Schemas.product - /// - Remark: Generated from `#/components/schemas/get_product_by_barcode_base`. - public struct get_product_by_barcode_base: Codable, Hashable, Sendable { - /// Barcode of the product - /// (can be EAN-13 or internal codes for some food stores). - /// For products without a barcode, Open Food Facts assigns a - /// number starting with the 200 reserved prefix. - /// - /// - /// - Remark: Generated from `#/components/schemas/get_product_by_barcode_base/code`. - public var code: Swift.String? - /// - Remark: Generated from `#/components/schemas/get_product_by_barcode_base/status`. - public var status: Swift.Int? - /// - Remark: Generated from `#/components/schemas/get_product_by_barcode_base/status_verbose`. - public var status_verbose: Swift.String? - /// Creates a new `get_product_by_barcode_base`. - /// - /// - Parameters: - /// - code: Barcode of the product - /// - status: - /// - status_verbose: - public init( - code: Swift.String? = nil, - status: Swift.Int? = nil, - status_verbose: Swift.String? = nil - ) { - self.code = code - self.status = status - self.status_verbose = status_verbose - } - public enum CodingKeys: String, CodingKey { - case code - case status - case status_verbose - } - } - /// Base product data - /// - /// - /// - Remark: Generated from `#/components/schemas/product_base`. - public struct product_base: Codable, Hashable, Sendable { - /// Abbreviated name in requested language - /// - /// - Remark: Generated from `#/components/schemas/product_base/abbreviated_product_name`. - public var abbreviated_product_name: Swift.String? - /// barcode of the product (can be EAN-13 or internal codes for some food stores), - /// for products without a barcode, - /// Open Food Facts assigns a number starting with the 200 reserved prefix - /// - /// - /// - Remark: Generated from `#/components/schemas/product_base/code`. - public var code: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_base/codes_tags`. - public var codes_tags: [Swift.String]? - /// Legal name of the product as regulated - /// by the European authorities. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_base/generic_name`. - public var generic_name: Swift.String? - /// internal identifier for the product, usually set to the value of `code`, - /// except on the producers platform where it is prefixed by the owner - /// - /// - /// - Remark: Generated from `#/components/schemas/product_base/id`. - public var id: Swift.String? - /// Main language of the product. - /// This is a duplicate of `lang` property (for historical reasons). - /// - /// - /// - Remark: Generated from `#/components/schemas/product_base/lc`. - public var lc: Swift.String? - /// Main language of the product. - /// - /// This should be the main language of product packaging (if one is predominant). - /// - /// Main language is also used to decide which ingredients list to parse. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_base/lang`. - public var lang: Swift.String? - /// Nova group as an integer from 1 to 4. See https://world.openfoodfacts.org/nova - /// - /// - /// - Remark: Generated from `#/components/schemas/product_base/nova_group`. - public var nova_group: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_base/nova_groups`. - public var nova_groups: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_base/obsolete`. - public var obsolete: Swift.String? - /// A date at which the product was declared obsolete. - /// This means it's not produced any more. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_base/obsolete_since_date`. - public var obsolete_since_date: Swift.String? - /// The name of the product - /// - /// - /// - Remark: Generated from `#/components/schemas/product_base/product_name`. - public var product_name: Swift.String? - /// The name of the product can also - /// be in many other languages like - /// product_name_fr (for French). - /// - /// - /// - Remark: Generated from `#/components/schemas/product_base/product_name_en`. - public var product_name_en: Swift.String? - /// The size in g or ml for the whole product. - /// It's a normalized version of the quantity field. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_base/product_quantity`. - public var product_quantity: Swift.String? - /// The unit (either g or ml) for the correponding product_quantity. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_base/product_quantity_unit`. - public var product_quantity_unit: Swift.String? - /// Quantity and Unit. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_base/quantity`. - public var quantity: Swift.String? - /// Abbreviated name in language `language_code`. - /// - /// - Remark: Generated from `#/components/schemas/product_base/abbreviated_product_name_(?\w\w)`. - public var abbreviated_product_name__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: Swift.String? - /// This can be returned in many other languages - /// like generic_name_fr (for French). - /// - /// - /// - Remark: Generated from `#/components/schemas/product_base/generic_name_(?\w\w)`. - public var generic_name__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: Swift.String? - /// Creates a new `product_base`. - /// - /// - Parameters: - /// - abbreviated_product_name: Abbreviated name in requested language - /// - code: barcode of the product (can be EAN-13 or internal codes for some food stores), - /// - codes_tags: - /// - generic_name: Legal name of the product as regulated - /// - id: internal identifier for the product, usually set to the value of `code`, - /// - lc: Main language of the product. - /// - lang: Main language of the product. - /// - nova_group: Nova group as an integer from 1 to 4. See https://world.openfoodfacts.org/nova - /// - nova_groups: - /// - obsolete: - /// - obsolete_since_date: A date at which the product was declared obsolete. - /// - product_name: The name of the product - /// - product_name_en: The name of the product can also - /// - product_quantity: The size in g or ml for the whole product. - /// - product_quantity_unit: The unit (either g or ml) for the correponding product_quantity. - /// - quantity: Quantity and Unit. - /// - abbreviated_product_name__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: Abbreviated name in language `language_code`. - /// - generic_name__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: This can be returned in many other languages - public init( - abbreviated_product_name: Swift.String? = nil, - code: Swift.String? = nil, - codes_tags: [Swift.String]? = nil, - generic_name: Swift.String? = nil, - id: Swift.String? = nil, - lc: Swift.String? = nil, - lang: Swift.String? = nil, - nova_group: Swift.Int? = nil, - nova_groups: Swift.String? = nil, - obsolete: Swift.String? = nil, - obsolete_since_date: Swift.String? = nil, - product_name: Swift.String? = nil, - product_name_en: Swift.String? = nil, - product_quantity: Swift.String? = nil, - product_quantity_unit: Swift.String? = nil, - quantity: Swift.String? = nil, - abbreviated_product_name__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: Swift.String? = nil, - generic_name__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: Swift.String? = nil - ) { - self.abbreviated_product_name = abbreviated_product_name - self.code = code - self.codes_tags = codes_tags - self.generic_name = generic_name - self.id = id - self.lc = lc - self.lang = lang - self.nova_group = nova_group - self.nova_groups = nova_groups - self.obsolete = obsolete - self.obsolete_since_date = obsolete_since_date - self.product_name = product_name - self.product_name_en = product_name_en - self.product_quantity = product_quantity - self.product_quantity_unit = product_quantity_unit - self.quantity = quantity - self.abbreviated_product_name__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ = abbreviated_product_name__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ - self.generic_name__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ = generic_name__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ - } - public enum CodingKeys: String, CodingKey { - case abbreviated_product_name - case code - case codes_tags - case generic_name - case id - case lc - case lang - case nova_group - case nova_groups - case obsolete - case obsolete_since_date - case product_name - case product_name_en - case product_quantity - case product_quantity_unit - case quantity - case abbreviated_product_name__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ = #"abbreviated_product_name_(?\w\w)"# - case generic_name__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ = #"generic_name_(?\w\w)"# - } - } - /// The shape property is canonicalized using the packaging_shapes taxonomy. - /// - /// - Remark: Generated from `#/components/schemas/shape`. - public struct shape: Codable, Hashable, Sendable { - /// Canonical id of the entry in the taxonomy. If the value cannot be mapped to a taxonomy entry, the value will be the name of the entry in its original language prefixed by the language 2 letter code and a colon. - /// - /// - Remark: Generated from `#/components/schemas/shape/id`. - public var id: Swift.String? - /// Name of the entry in the language requested in the tags_lc field of the request. This field is returned only of tags_lc is specified. If the translation is not available, or if the entry does not exist in the taxonomy, the value will be the name of the entry in its original language prefixed by the language 2 letter code and a colon. - /// - /// - Remark: Generated from `#/components/schemas/shape/lc_name`. - public var lc_name: Swift.String? - /// Creates a new `shape`. - /// - /// - Parameters: - /// - id: Canonical id of the entry in the taxonomy. If the value cannot be mapped to a taxonomy entry, the value will be the name of the entry in its original language prefixed by the language 2 letter code and a colon. - /// - lc_name: Name of the entry in the language requested in the tags_lc field of the request. This field is returned only of tags_lc is specified. If the translation is not available, or if the entry does not exist in the taxonomy, the value will be the name of the entry in its original language prefixed by the language 2 letter code and a colon. - public init( - id: Swift.String? = nil, - lc_name: Swift.String? = nil - ) { - self.id = id - self.lc_name = lc_name - } - public enum CodingKeys: String, CodingKey { - case id - case lc_name - } - } - /// The material property is canonicalized using the packaging_materials taxonomy. - /// - /// - Remark: Generated from `#/components/schemas/material`. - public struct material: Codable, Hashable, Sendable { - /// Canonical id of the entry in the taxonomy. If the value cannot be mapped to a taxonomy entry, the value will be the name of the entry in its original language prefixed by the language 2 letter code and a colon. - /// - /// - Remark: Generated from `#/components/schemas/material/id`. - public var id: Swift.String? - /// Name of the entry in the language requested in the tags_lc field of the request. This field is returned only of tags_lc is specified. If the translation is not available, or if the entry does not exist in the taxonomy, the value will be the name of the entry in its original language prefixed by the language 2 letter code and a colon. - /// - /// - Remark: Generated from `#/components/schemas/material/lc_name`. - public var lc_name: Swift.String? - /// Creates a new `material`. - /// - /// - Parameters: - /// - id: Canonical id of the entry in the taxonomy. If the value cannot be mapped to a taxonomy entry, the value will be the name of the entry in its original language prefixed by the language 2 letter code and a colon. - /// - lc_name: Name of the entry in the language requested in the tags_lc field of the request. This field is returned only of tags_lc is specified. If the translation is not available, or if the entry does not exist in the taxonomy, the value will be the name of the entry in its original language prefixed by the language 2 letter code and a colon. - public init( - id: Swift.String? = nil, - lc_name: Swift.String? = nil - ) { - self.id = id - self.lc_name = lc_name - } - public enum CodingKeys: String, CodingKey { - case id - case lc_name - } - } - /// The recycling property is canonicalized using the packaging_recycling taxonomy. - /// - /// - Remark: Generated from `#/components/schemas/recycling`. - public struct recycling: Codable, Hashable, Sendable { - /// Canonical id of the entry in the taxonomy. If the value cannot be mapped to a taxonomy entry, the value will be the name of the entry in its original language prefixed by the language 2 letter code and a colon. - /// - /// - Remark: Generated from `#/components/schemas/recycling/id`. - public var id: Swift.String? - /// Name of the entry in the language requested in the tags_lc field of the request. This field is returned only of tags_lc is specified. If the translation is not available, or if the entry does not exist in the taxonomy, the value will be the name of the entry in its original language prefixed by the language 2 letter code and a colon. - /// - /// - Remark: Generated from `#/components/schemas/recycling/lc_name`. - public var lc_name: Swift.String? - /// Creates a new `recycling`. - /// - /// - Parameters: - /// - id: Canonical id of the entry in the taxonomy. If the value cannot be mapped to a taxonomy entry, the value will be the name of the entry in its original language prefixed by the language 2 letter code and a colon. - /// - lc_name: Name of the entry in the language requested in the tags_lc field of the request. This field is returned only of tags_lc is specified. If the translation is not available, or if the entry does not exist in the taxonomy, the value will be the name of the entry in its original language prefixed by the language 2 letter code and a colon. - public init( - id: Swift.String? = nil, - lc_name: Swift.String? = nil - ) { - self.id = id - self.lc_name = lc_name - } - public enum CodingKeys: String, CodingKey { - case id - case lc_name - } - } - /// Each packaging component has different properties to specify how many there are, its shape, material etc. - /// - /// The shape, material and recycling properties are mapped to one entry in the packaging_shapes, packaging_materials and packaging_recycling taxonomies, and the value of the property is the canonical name of the taxonomy entry (e.g. en:bottle). - /// - /// They may contain values that could not yet get matched to their respective taxonomy, in which case they will contain a free text value prefixed with the language code of this text value (e.g. "fr:Bouteille sphérique" might have been entered by a French user to indicate it is a spherical bottle). - /// - /// - Remark: Generated from `#/components/schemas/packaging_component`. - public struct packaging_component: Codable, Hashable, Sendable { - /// umber of units of this packaging component contained in the product (e.g. 6 for a pack of 6 bottles) - /// - /// - Remark: Generated from `#/components/schemas/packaging_component/number_of_units`. - public var number_of_units: Swift.Int? - /// - Remark: Generated from `#/components/schemas/packaging_component/shape`. - public var shape: Components.Schemas.shape? - /// - Remark: Generated from `#/components/schemas/packaging_component/material`. - public var material: Components.Schemas.material? - /// - Remark: Generated from `#/components/schemas/packaging_component/recycling`. - public var recycling: Components.Schemas.recycling? - /// Quantity (weight or volume) of food product contained in the packaging component. (e.g. 75cl for a wine bottle) - /// - /// - Remark: Generated from `#/components/schemas/packaging_component/quantity_per_unit`. - public var quantity_per_unit: Swift.String? - /// Value parsed from the quantity field. - /// - /// - Remark: Generated from `#/components/schemas/packaging_component/quantity_per_unit_value`. - public var quantity_per_unit_value: Swift.Double? - /// Unit parsed and normalized from the quantity field. - /// - /// - Remark: Generated from `#/components/schemas/packaging_component/quantity_per_unit_unit`. - public var quantity_per_unit_unit: Swift.String? - /// Weight (as specified by the manufacturer) of one unit of the empty packaging component (in grams). (e.g. for a 6 pack of 1.5l water bottles, it might be 30, the weight in grams of 1 empty water bottle without its cap which is a different packaging component). - /// - /// - Remark: Generated from `#/components/schemas/packaging_component/weight_specified`. - public var weight_specified: Swift.Double? - /// Weight (as measured by one or more users) of one unit of the empty packaging component (in grams). (e.g. for a 6 pack of 1.5l water bottles, it might be 30, the weight in grams of 1 empty water bottle without its cap which is a different packaging component). - /// - /// - Remark: Generated from `#/components/schemas/packaging_component/weight_measured`. - public var weight_measured: Swift.Double? - /// Weight (as estimated from similar products) of one unit of the empty packaging component (in grams). (e.g. for a 6 pack of 1.5l water bottles, it might be 30, the weight in grams of 1 empty water bottle without its cap which is a different packaging component). - /// - /// - Remark: Generated from `#/components/schemas/packaging_component/weight_estimated`. - public var weight_estimated: Swift.Double? - /// Weight of one unit of the empty packaging component. - /// - /// - Remark: Generated from `#/components/schemas/packaging_component/weight`. - public var weight: Swift.Double? - /// Indicates which field was used to populate the "weight" field. Either "specified", "measured", or "estimated" - /// - /// - Remark: Generated from `#/components/schemas/packaging_component/weight_source_id`. - public var weight_source_id: Swift.String? - /// Creates a new `packaging_component`. - /// - /// - Parameters: - /// - number_of_units: umber of units of this packaging component contained in the product (e.g. 6 for a pack of 6 bottles) - /// - shape: - /// - material: - /// - recycling: - /// - quantity_per_unit: Quantity (weight or volume) of food product contained in the packaging component. (e.g. 75cl for a wine bottle) - /// - quantity_per_unit_value: Value parsed from the quantity field. - /// - quantity_per_unit_unit: Unit parsed and normalized from the quantity field. - /// - weight_specified: Weight (as specified by the manufacturer) of one unit of the empty packaging component (in grams). (e.g. for a 6 pack of 1.5l water bottles, it might be 30, the weight in grams of 1 empty water bottle without its cap which is a different packaging component). - /// - weight_measured: Weight (as measured by one or more users) of one unit of the empty packaging component (in grams). (e.g. for a 6 pack of 1.5l water bottles, it might be 30, the weight in grams of 1 empty water bottle without its cap which is a different packaging component). - /// - weight_estimated: Weight (as estimated from similar products) of one unit of the empty packaging component (in grams). (e.g. for a 6 pack of 1.5l water bottles, it might be 30, the weight in grams of 1 empty water bottle without its cap which is a different packaging component). - /// - weight: Weight of one unit of the empty packaging component. - /// - weight_source_id: Indicates which field was used to populate the "weight" field. Either "specified", "measured", or "estimated" - public init( - number_of_units: Swift.Int? = nil, - shape: Components.Schemas.shape? = nil, - material: Components.Schemas.material? = nil, - recycling: Components.Schemas.recycling? = nil, - quantity_per_unit: Swift.String? = nil, - quantity_per_unit_value: Swift.Double? = nil, - quantity_per_unit_unit: Swift.String? = nil, - weight_specified: Swift.Double? = nil, - weight_measured: Swift.Double? = nil, - weight_estimated: Swift.Double? = nil, - weight: Swift.Double? = nil, - weight_source_id: Swift.String? = nil - ) { - self.number_of_units = number_of_units - self.shape = shape - self.material = material - self.recycling = recycling - self.quantity_per_unit = quantity_per_unit - self.quantity_per_unit_value = quantity_per_unit_value - self.quantity_per_unit_unit = quantity_per_unit_unit - self.weight_specified = weight_specified - self.weight_measured = weight_measured - self.weight_estimated = weight_estimated - self.weight = weight - self.weight_source_id = weight_source_id - } - public enum CodingKeys: String, CodingKey { - case number_of_units - case shape - case material - case recycling - case quantity_per_unit - case quantity_per_unit_value - case quantity_per_unit_unit - case weight_specified - case weight_measured - case weight_estimated - case weight - case weight_source_id - } - } - /// The packagings object is an array of individual packaging component objects. - /// - /// The Packaging data document explains how packaging data is structured in Open Food Facts: https://openfoodfacts.github.io/openfoodfacts-server/dev/explain-packaging-data/ - /// - /// The shape, material and recycling properties of each packaging component are linked to entries in the packaging_shapes, packaging_materials and packaging_recycling taxonomies: - /// - /// https://world.openfoodfacts.org/data/taxonomies/packaging_shapes.json - /// https://world.openfoodfacts.org/data/taxonomies/packaging_materials.json - /// https://world.openfoodfacts.org/data/taxonomies/packaging_recycling.json - /// - /// If the tags_lc field is set, the properties will include a lc_name field with the translation in the requested language. - /// - /// - Remark: Generated from `#/components/schemas/packagings`. - public typealias packagings = [Components.Schemas.packaging_component] - /// Indicate if the packagings array contains all the packaging parts of the product. This field can be set by users when they enter or verify packaging data. Possible values are 0 or 1. - /// - /// - Remark: Generated from `#/components/schemas/packagings_complete`. - public typealias packagings_complete = Swift.Int - /// Miscellaneous but important fields of a product - /// - /// - /// - Remark: Generated from `#/components/schemas/product_misc`. - public struct product_misc: Codable, Hashable, Sendable { - /// Number of food additives. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_misc/additives_n`. - public var additives_n: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_misc/checked`. - public var checked: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_misc/complete`. - public var complete: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_misc/completeness`. - public var completeness: Swift.Double? - /// See also: `ecoscore_tags` - /// - /// - /// - Remark: Generated from `#/components/schemas/product_misc/ecoscore_grade`. - public var ecoscore_grade: Swift.String? - /// See also: `ecoscore_tags` - /// - /// - /// - Remark: Generated from `#/components/schemas/product_misc/ecoscore_score`. - public var ecoscore_score: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_misc/food_groups`. - public var food_groups: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_misc/food_groups_tags`. - public var food_groups_tags: [Swift.String]? - /// Traffic light indicators on main nutrients levels - /// - /// - /// - Remark: Generated from `#/components/schemas/product_misc/nutrient_levels`. - public struct nutrient_levelsPayload: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/components/schemas/product_misc/nutrient_levels/fat`. - @frozen public enum fatPayload: String, Codable, Hashable, Sendable, CaseIterable { - case low = "low" - case moderate = "moderate" - case high = "high" - } - /// - Remark: Generated from `#/components/schemas/product_misc/nutrient_levels/fat`. - public var fat: Components.Schemas.product_misc.nutrient_levelsPayload.fatPayload? - /// - Remark: Generated from `#/components/schemas/product_misc/nutrient_levels/salt`. - @frozen public enum saltPayload: String, Codable, Hashable, Sendable, CaseIterable { - case low = "low" - case moderate = "moderate" - case high = "high" - } - /// - Remark: Generated from `#/components/schemas/product_misc/nutrient_levels/salt`. - public var salt: Components.Schemas.product_misc.nutrient_levelsPayload.saltPayload? - /// - Remark: Generated from `#/components/schemas/product_misc/nutrient_levels/saturated-fat`. - @frozen public enum saturated_hyphen_fatPayload: String, Codable, Hashable, Sendable, CaseIterable { - case low = "low" - case moderate = "moderate" - case high = "high" - } - /// - Remark: Generated from `#/components/schemas/product_misc/nutrient_levels/saturated-fat`. - public var saturated_hyphen_fat: Components.Schemas.product_misc.nutrient_levelsPayload.saturated_hyphen_fatPayload? - /// - Remark: Generated from `#/components/schemas/product_misc/nutrient_levels/sugars`. - @frozen public enum sugarsPayload: String, Codable, Hashable, Sendable, CaseIterable { - case low = "low" - case moderate = "moderate" - case high = "high" - } - /// - Remark: Generated from `#/components/schemas/product_misc/nutrient_levels/sugars`. - public var sugars: Components.Schemas.product_misc.nutrient_levelsPayload.sugarsPayload? - /// Creates a new `nutrient_levelsPayload`. - /// - /// - Parameters: - /// - fat: - /// - salt: - /// - saturated_hyphen_fat: - /// - sugars: - public init( - fat: Components.Schemas.product_misc.nutrient_levelsPayload.fatPayload? = nil, - salt: Components.Schemas.product_misc.nutrient_levelsPayload.saltPayload? = nil, - saturated_hyphen_fat: Components.Schemas.product_misc.nutrient_levelsPayload.saturated_hyphen_fatPayload? = nil, - sugars: Components.Schemas.product_misc.nutrient_levelsPayload.sugarsPayload? = nil - ) { - self.fat = fat - self.salt = salt - self.saturated_hyphen_fat = saturated_hyphen_fat - self.sugars = sugars - } - public enum CodingKeys: String, CodingKey { - case fat - case salt - case saturated_hyphen_fat = "saturated-fat" - case sugars - } - } - /// Traffic light indicators on main nutrients levels - /// - /// - /// - Remark: Generated from `#/components/schemas/product_misc/nutrient_levels`. - public var nutrient_levels: Components.Schemas.product_misc.nutrient_levelsPayload? - /// Recycling instructions as raw text, e.g. Plastic - /// bottle to recycle, Plastic cap to recycle. - /// This will get automatically parsed and - /// will be used to compute the Eco-Score. - /// You can either request it (if it exists) or - /// send it in a specific language. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_misc/packaging_text`. - public var packaging_text: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_misc/packagings`. - public var packagings: Components.Schemas.packagings? - /// - Remark: Generated from `#/components/schemas/product_misc/packagings_complete`. - public var packagings_complete: Components.Schemas.packagings_complete? - /// Category of food according to [French Nutrition and Health Program](https://fr.wikipedia.org/wiki/Programme_national_nutrition_sant%C3%A9) - /// - /// - /// - Remark: Generated from `#/components/schemas/product_misc/pnns_groups_1`. - public var pnns_groups_1: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_misc/pnns_groups_1_tags`. - public var pnns_groups_1_tags: [Swift.String]? - /// Sub Category of food according to [French Nutrition and Health Program](https://fr.wikipedia.org/wiki/Programme_national_nutrition_sant%C3%A9) - /// - /// - /// - Remark: Generated from `#/components/schemas/product_misc/pnns_groups_2`. - public var pnns_groups_2: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_misc/pnns_groups_2_tags`. - public var pnns_groups_2_tags: [Swift.String]? - /// An imprecise measurement of popularity based on Scan statistics. A higher value means higher popularity. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_misc/popularity_key`. - public var popularity_key: Swift.Int? - /// Indicators for the popularity of a product, like the amount of scans in a specific year. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_misc/popularity_tags`. - public var popularity_tags: [Swift.String]? - /// - Remark: Generated from `#/components/schemas/product_misc/scans_n`. - public var scans_n: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_misc/unique_scans_n`. - public var unique_scans_n: Swift.Int? - /// Normalized version of serving_size. - /// Note that this is NOT the number of servings by product. - /// (in perl, see `normalize_serving_size`) - /// - /// - /// - Remark: Generated from `#/components/schemas/product_misc/serving_quantity`. - public var serving_quantity: Swift.String? - /// The unit (either g or ml) for the correponding serving_quantity. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_misc/serving_quantity_unit`. - public var serving_quantity_unit: Swift.String? - /// Serving size text (generally in g or ml). - /// We expect a quantity + unit but the user is free to input any string. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_misc/serving_size`. - public var serving_size: Swift.String? - /// see `food_groups` - /// - /// - Remark: Generated from `#/components/schemas/product_misc/food_groups_(?\w\w)`. - public var food_groups__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: Swift.String? - /// Packaging text in language designated by `language_code` - /// - /// - /// - Remark: Generated from `#/components/schemas/product_misc/packaging_text_(?\w\w)`. - public var packaging_text__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: Swift.String? - /// Creates a new `product_misc`. - /// - /// - Parameters: - /// - additives_n: Number of food additives. - /// - checked: - /// - complete: - /// - completeness: - /// - ecoscore_grade: See also: `ecoscore_tags` - /// - ecoscore_score: See also: `ecoscore_tags` - /// - food_groups: - /// - food_groups_tags: - /// - nutrient_levels: Traffic light indicators on main nutrients levels - /// - packaging_text: Recycling instructions as raw text, e.g. Plastic - /// - packagings: - /// - packagings_complete: - /// - pnns_groups_1: Category of food according to [French Nutrition and Health Program](https://fr.wikipedia.org/wiki/Programme_national_nutrition_sant%C3%A9) - /// - pnns_groups_1_tags: - /// - pnns_groups_2: Sub Category of food according to [French Nutrition and Health Program](https://fr.wikipedia.org/wiki/Programme_national_nutrition_sant%C3%A9) - /// - pnns_groups_2_tags: - /// - popularity_key: An imprecise measurement of popularity based on Scan statistics. A higher value means higher popularity. - /// - popularity_tags: Indicators for the popularity of a product, like the amount of scans in a specific year. - /// - scans_n: - /// - unique_scans_n: - /// - serving_quantity: Normalized version of serving_size. - /// - serving_quantity_unit: The unit (either g or ml) for the correponding serving_quantity. - /// - serving_size: Serving size text (generally in g or ml). - /// - food_groups__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: see `food_groups` - /// - packaging_text__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: Packaging text in language designated by `language_code` - public init( - additives_n: Swift.Int? = nil, - checked: Swift.String? = nil, - complete: Swift.Int? = nil, - completeness: Swift.Double? = nil, - ecoscore_grade: Swift.String? = nil, - ecoscore_score: Swift.Int? = nil, - food_groups: Swift.String? = nil, - food_groups_tags: [Swift.String]? = nil, - nutrient_levels: Components.Schemas.product_misc.nutrient_levelsPayload? = nil, - packaging_text: Swift.String? = nil, - packagings: Components.Schemas.packagings? = nil, - packagings_complete: Components.Schemas.packagings_complete? = nil, - pnns_groups_1: Swift.String? = nil, - pnns_groups_1_tags: [Swift.String]? = nil, - pnns_groups_2: Swift.String? = nil, - pnns_groups_2_tags: [Swift.String]? = nil, - popularity_key: Swift.Int? = nil, - popularity_tags: [Swift.String]? = nil, - scans_n: Swift.Int? = nil, - unique_scans_n: Swift.Int? = nil, - serving_quantity: Swift.String? = nil, - serving_quantity_unit: Swift.String? = nil, - serving_size: Swift.String? = nil, - food_groups__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: Swift.String? = nil, - packaging_text__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: Swift.String? = nil - ) { - self.additives_n = additives_n - self.checked = checked - self.complete = complete - self.completeness = completeness - self.ecoscore_grade = ecoscore_grade - self.ecoscore_score = ecoscore_score - self.food_groups = food_groups - self.food_groups_tags = food_groups_tags - self.nutrient_levels = nutrient_levels - self.packaging_text = packaging_text - self.packagings = packagings - self.packagings_complete = packagings_complete - self.pnns_groups_1 = pnns_groups_1 - self.pnns_groups_1_tags = pnns_groups_1_tags - self.pnns_groups_2 = pnns_groups_2 - self.pnns_groups_2_tags = pnns_groups_2_tags - self.popularity_key = popularity_key - self.popularity_tags = popularity_tags - self.scans_n = scans_n - self.unique_scans_n = unique_scans_n - self.serving_quantity = serving_quantity - self.serving_quantity_unit = serving_quantity_unit - self.serving_size = serving_size - self.food_groups__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ = food_groups__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ - self.packaging_text__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ = packaging_text__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ - } - public enum CodingKeys: String, CodingKey { - case additives_n - case checked - case complete - case completeness - case ecoscore_grade - case ecoscore_score - case food_groups - case food_groups_tags - case nutrient_levels - case packaging_text - case packagings - case packagings_complete - case pnns_groups_1 - case pnns_groups_1_tags - case pnns_groups_2 - case pnns_groups_2_tags - case popularity_key - case popularity_tags - case scans_n - case unique_scans_n - case serving_quantity - case serving_quantity_unit - case serving_size - case food_groups__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ = #"food_groups_(?\w\w)"# - case packaging_text__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ = #"packaging_text_(?\w\w)"# - } - } - /// Data about a product which is represented as tags - /// - /// - /// - Remark: Generated from `#/components/schemas/product_tags`. - public struct product_tags: Codable, Hashable, Sendable { - /// List of brands (not taxonomized) - /// - /// - Remark: Generated from `#/components/schemas/product_tags/brands`. - public var brands: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_tags/brands_tags`. - public var brands_tags: [Swift.String]? - /// - Remark: Generated from `#/components/schemas/product_tags/categories`. - public var categories: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_tags/categories_hierarchy`. - public var categories_hierarchy: [Swift.String]? - /// Categories language code - /// - /// - Remark: Generated from `#/components/schemas/product_tags/categories_lc`. - public var categories_lc: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_tags/categories_tags`. - public var categories_tags: [Swift.String]? - /// - Remark: Generated from `#/components/schemas/product_tags/checkers_tags`. - public var checkers_tags: [Swift.String]? - /// - Remark: Generated from `#/components/schemas/product_tags/cities`. - public var cities: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_tags/cities_tags`. - public var cities_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? - /// - Remark: Generated from `#/components/schemas/product_tags/correctors_tags`. - public var correctors_tags: [Swift.String]? - /// List of countries where the product is sold. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_tags/countries`. - public var countries: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_tags/countries_hierarchy`. - public var countries_hierarchy: [Swift.String]? - /// Countries language code - /// - /// - Remark: Generated from `#/components/schemas/product_tags/countries_lc`. - public var countries_lc: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_tags/countries_tags`. - public var countries_tags: [Swift.String]? - /// All ecoscore of a product. - /// Most of the time it's only one value, - /// but it might eventually be more for products composed of sub-products. - /// See also: `ecoscore_score`, `ecoscore_grade`. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_tags/ecoscore_tags`. - public var ecoscore_tags: [Swift.String]? - /// Packager code. EMB is the French system of traceability codes for packager. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_tags/emb_codes`. - public var emb_codes: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_tags/emb_codes_orig`. - public var emb_codes_orig: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_tags/emb_codes_tags`. - public var emb_codes_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? - /// - Remark: Generated from `#/components/schemas/product_tags/labels`. - public var labels: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_tags/labels_hierarchy`. - public var labels_hierarchy: [Swift.String]? - /// - Remark: Generated from `#/components/schemas/product_tags/labels_lc`. - public var labels_lc: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_tags/labels_tags`. - public var labels_tags: [Swift.String]? - /// The data as a series of tag: `yyyy-mm-dd`, `yyyy-mm`, `yyyy` - /// - /// - /// - Remark: Generated from `#/components/schemas/product_tags/entry_dates_tags`. - public var entry_dates_tags: [Swift.String]? - /// Places where the product was manufactured or transformed. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_tags/manufacturing_places`. - public var manufacturing_places: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_tags/manufacturing_places_tags`. - public var manufacturing_places_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? - /// - Remark: Generated from `#/components/schemas/product_tags/nova_groups_tags`. - public var nova_groups_tags: [Swift.String]? - /// - Remark: Generated from `#/components/schemas/product_tags/nutrient_levels_tags`. - public var nutrient_levels_tags: [Swift.String]? - /// Creates a new `product_tags`. - /// - /// - Parameters: - /// - brands: List of brands (not taxonomized) - /// - brands_tags: - /// - categories: - /// - categories_hierarchy: - /// - categories_lc: Categories language code - /// - categories_tags: - /// - checkers_tags: - /// - cities: - /// - cities_tags: - /// - correctors_tags: - /// - countries: List of countries where the product is sold. - /// - countries_hierarchy: - /// - countries_lc: Countries language code - /// - countries_tags: - /// - ecoscore_tags: All ecoscore of a product. - /// - emb_codes: Packager code. EMB is the French system of traceability codes for packager. - /// - emb_codes_orig: - /// - emb_codes_tags: - /// - labels: - /// - labels_hierarchy: - /// - labels_lc: - /// - labels_tags: - /// - entry_dates_tags: The data as a series of tag: `yyyy-mm-dd`, `yyyy-mm`, `yyyy` - /// - manufacturing_places: Places where the product was manufactured or transformed. - /// - manufacturing_places_tags: - /// - nova_groups_tags: - /// - nutrient_levels_tags: - public init( - brands: Swift.String? = nil, - brands_tags: [Swift.String]? = nil, - categories: Swift.String? = nil, - categories_hierarchy: [Swift.String]? = nil, - categories_lc: Swift.String? = nil, - categories_tags: [Swift.String]? = nil, - checkers_tags: [Swift.String]? = nil, - cities: Swift.String? = nil, - cities_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? = nil, - correctors_tags: [Swift.String]? = nil, - countries: Swift.String? = nil, - countries_hierarchy: [Swift.String]? = nil, - countries_lc: Swift.String? = nil, - countries_tags: [Swift.String]? = nil, - ecoscore_tags: [Swift.String]? = nil, - emb_codes: Swift.String? = nil, - emb_codes_orig: Swift.String? = nil, - emb_codes_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? = nil, - labels: Swift.String? = nil, - labels_hierarchy: [Swift.String]? = nil, - labels_lc: Swift.String? = nil, - labels_tags: [Swift.String]? = nil, - entry_dates_tags: [Swift.String]? = nil, - manufacturing_places: Swift.String? = nil, - manufacturing_places_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? = nil, - nova_groups_tags: [Swift.String]? = nil, - nutrient_levels_tags: [Swift.String]? = nil - ) { - self.brands = brands - self.brands_tags = brands_tags - self.categories = categories - self.categories_hierarchy = categories_hierarchy - self.categories_lc = categories_lc - self.categories_tags = categories_tags - self.checkers_tags = checkers_tags - self.cities = cities - self.cities_tags = cities_tags - self.correctors_tags = correctors_tags - self.countries = countries - self.countries_hierarchy = countries_hierarchy - self.countries_lc = countries_lc - self.countries_tags = countries_tags - self.ecoscore_tags = ecoscore_tags - self.emb_codes = emb_codes - self.emb_codes_orig = emb_codes_orig - self.emb_codes_tags = emb_codes_tags - self.labels = labels - self.labels_hierarchy = labels_hierarchy - self.labels_lc = labels_lc - self.labels_tags = labels_tags - self.entry_dates_tags = entry_dates_tags - self.manufacturing_places = manufacturing_places - self.manufacturing_places_tags = manufacturing_places_tags - self.nova_groups_tags = nova_groups_tags - self.nutrient_levels_tags = nutrient_levels_tags - } - public enum CodingKeys: String, CodingKey { - case brands - case brands_tags - case categories - case categories_hierarchy - case categories_lc - case categories_tags - case checkers_tags - case cities - case cities_tags - case correctors_tags - case countries - case countries_hierarchy - case countries_lc - case countries_tags - case ecoscore_tags - case emb_codes - case emb_codes_orig - case emb_codes_tags - case labels - case labels_hierarchy - case labels_lc - case labels_tags - case entry_dates_tags - case manufacturing_places - case manufacturing_places_tags - case nova_groups_tags - case nutrient_levels_tags - } - } - /// - Remark: Generated from `#/components/schemas/image_size`. - public struct image_size: Codable, Hashable, Sendable { - /// The height of the reduced/full image in pixels. - /// - /// - /// - Remark: Generated from `#/components/schemas/image_size/h`. - public var h: Swift.Int? - /// The width of the reduced/full image in pixels. - /// - /// - Remark: Generated from `#/components/schemas/image_size/w`. - public var w: Swift.Int? - /// Creates a new `image_size`. - /// - /// - Parameters: - /// - h: The height of the reduced/full image in pixels. - /// - w: The width of the reduced/full image in pixels. - public init( - h: Swift.Int? = nil, - w: Swift.Int? = nil - ) { - self.h = h - self.w = w - } - public enum CodingKeys: String, CodingKey { - case h - case w - } - } - /// This object represent an image that was uploaded to a product. - /// "imgid" is an integer which is a sequential number unique to each picture. - /// - /// - /// - Remark: Generated from `#/components/schemas/image`. - public struct image: Codable, Hashable, Sendable { - /// The available image sizes for the product (both reduced and full). - /// The reduced images are the ones with numbers as the key( 100, 200 etc) - /// while the full images have `full` as the key. - /// - /// - /// - Remark: Generated from `#/components/schemas/image/sizes`. - public struct sizesPayload: Codable, Hashable, Sendable { - /// properties of fullsize image - /// **TODO** explain how to compute name - /// - /// - /// - Remark: Generated from `#/components/schemas/image/sizes/full`. - public var full: Components.Schemas.image_size? - /// properties of thumbnail of size `image_size`. - /// **TODO** explain how to compute name - /// - /// For real type: see description of property `full`. - /// (Put this way because of a [bug in rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) - /// - /// - /// - Remark: Generated from `#/components/schemas/image/sizes/image_size_example`. - public var image_size_example: Swift.String? - /// Creates a new `sizesPayload`. - /// - /// - Parameters: - /// - full: properties of fullsize image - /// - image_size_example: properties of thumbnail of size `image_size`. - public init( - full: Components.Schemas.image_size? = nil, - image_size_example: Swift.String? = nil - ) { - self.full = full - self.image_size_example = image_size_example - } - public enum CodingKeys: String, CodingKey { - case full - case image_size_example - } - } - /// The available image sizes for the product (both reduced and full). - /// The reduced images are the ones with numbers as the key( 100, 200 etc) - /// while the full images have `full` as the key. - /// - /// - /// - Remark: Generated from `#/components/schemas/image/sizes`. - public var sizes: Components.Schemas.image.sizesPayload? - /// The time the image was uploaded (as unix timestamp). - /// - /// - /// - Remark: Generated from `#/components/schemas/image/uploaded_t`. - public var uploaded_t: Swift.String? - /// The contributor that uploaded the image. - /// - /// - /// - Remark: Generated from `#/components/schemas/image/uploader`. - public var uploader: Swift.String? - /// Creates a new `image`. - /// - /// - Parameters: - /// - sizes: The available image sizes for the product (both reduced and full). - /// - uploaded_t: The time the image was uploaded (as unix timestamp). - /// - uploader: The contributor that uploaded the image. - public init( - sizes: Components.Schemas.image.sizesPayload? = nil, - uploaded_t: Swift.String? = nil, - uploader: Swift.String? = nil - ) { - self.sizes = sizes - self.uploaded_t = uploaded_t - self.uploader = uploader - } - public enum CodingKeys: String, CodingKey { - case sizes - case uploaded_t - case uploader - } - } - /// property of an image (or part thereof) selected for a particular role and a particular language. - /// - /// - /// - Remark: Generated from `#/components/schemas/image_role`. - public struct image_role: Codable, Hashable, Sendable { - /// The angle of the image rotation (if it was rotated). - /// - /// - Remark: Generated from `#/components/schemas/image_role/angle`. - public var angle: Swift.Int? - /// - Remark: Generated from `#/components/schemas/image_role/coordinates_image_size`. - public var coordinates_image_size: Swift.String? - /// - Remark: Generated from `#/components/schemas/image_role/geometry`. - public var geometry: Swift.String? - /// The id of the original/source image that was selected to edit(rotate, normalize etc) to produce this new image. - /// - /// - Remark: Generated from `#/components/schemas/image_role/imgid`. - public var imgid: Swift.String? - /// - Remark: Generated from `#/components/schemas/image_role/rev`. - public var rev: Swift.String? - /// The available image sizes for the product (both reduced and full). - /// The reduced images are the ones with numbers as the key( 100, 200 etc) - /// while the full images have `full` as the key. - /// - /// - /// - Remark: Generated from `#/components/schemas/image_role/sizes`. - public struct sizesPayload: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/components/schemas/image_role/sizes/100`. - public var _100: Components.Schemas.image_size? - /// - Remark: Generated from `#/components/schemas/image_role/sizes/200`. - public var _200: Components.Schemas.image_size? - /// - Remark: Generated from `#/components/schemas/image_role/sizes/400`. - public var _400: Components.Schemas.image_size? - /// - Remark: Generated from `#/components/schemas/image_role/sizes/full`. - public var full: Components.Schemas.image_size? - /// Creates a new `sizesPayload`. - /// - /// - Parameters: - /// - _100: - /// - _200: - /// - _400: - /// - full: - public init( - _100: Components.Schemas.image_size? = nil, - _200: Components.Schemas.image_size? = nil, - _400: Components.Schemas.image_size? = nil, - full: Components.Schemas.image_size? = nil - ) { - self._100 = _100 - self._200 = _200 - self._400 = _400 - self.full = full - } - public enum CodingKeys: String, CodingKey { - case _100 = "100" - case _200 = "200" - case _400 = "400" - case full - } - } - /// The available image sizes for the product (both reduced and full). - /// The reduced images are the ones with numbers as the key( 100, 200 etc) - /// while the full images have `full` as the key. - /// - /// - /// - Remark: Generated from `#/components/schemas/image_role/sizes`. - public var sizes: Components.Schemas.image_role.sizesPayload? - /// - Remark: Generated from `#/components/schemas/image_role/x1`. - public var x1: Swift.String? - /// - Remark: Generated from `#/components/schemas/image_role/x2`. - public var x2: Swift.String? - /// - Remark: Generated from `#/components/schemas/image_role/y1`. - public var y1: Swift.String? - /// - Remark: Generated from `#/components/schemas/image_role/y2`. - public var y2: Swift.String? - /// Creates a new `image_role`. - /// - /// - Parameters: - /// - angle: The angle of the image rotation (if it was rotated). - /// - coordinates_image_size: - /// - geometry: - /// - imgid: The id of the original/source image that was selected to edit(rotate, normalize etc) to produce this new image. - /// - rev: - /// - sizes: The available image sizes for the product (both reduced and full). - /// - x1: - /// - x2: - /// - y1: - /// - y2: - public init( - angle: Swift.Int? = nil, - coordinates_image_size: Swift.String? = nil, - geometry: Swift.String? = nil, - imgid: Swift.String? = nil, - rev: Swift.String? = nil, - sizes: Components.Schemas.image_role.sizesPayload? = nil, - x1: Swift.String? = nil, - x2: Swift.String? = nil, - y1: Swift.String? = nil, - y2: Swift.String? = nil - ) { - self.angle = angle - self.coordinates_image_size = coordinates_image_size - self.geometry = geometry - self.imgid = imgid - self.rev = rev - self.sizes = sizes - self.x1 = x1 - self.x2 = x2 - self.y1 = y1 - self.y2 = y2 - } - public enum CodingKeys: String, CodingKey { - case angle - case coordinates_image_size - case geometry - case imgid - case rev - case sizes - case x1 - case x2 - case y1 - case y2 - } - } - /// - Remark: Generated from `#/components/schemas/image_urls`. - public struct image_urls: Codable, Hashable, Sendable { - /// url of the image for language `language_code` - /// - /// - Remark: Generated from `#/components/schemas/image_urls/language_code_example`. - public var language_code_example: Swift.String? - /// Creates a new `image_urls`. - /// - /// - Parameters: - /// - language_code_example: url of the image for language `language_code` - public init(language_code_example: Swift.String? = nil) { - self.language_code_example = language_code_example - } - public enum CodingKeys: String, CodingKey { - case language_code_example - } - } - /// Information about Images of a product. - /// - /// Images ensure the reliability of Open Food Facts data. - /// It provides a primary source and proof of all the structured data. - /// You may therefore want to display it along the structured information. - /// - /// See also tutorials about images: - /// * [Getting images](https://openfoodfacts.github.io/openfoodfacts-server/api/how-to-download-images/) - /// * [Uploading images](https://openfoodfacts.github.io/openfoodfacts-server/api/tutorial-uploading-photo-to-a-product/) - /// - /// - /// - Remark: Generated from `#/components/schemas/product_images`. - public struct product_images: Codable, Hashable, Sendable { - /// This contains properties for all images contained on the product. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_images/images`. - public struct imagesPayload: Codable, Hashable, Sendable { - /// This represents an image uploaded for this product. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_images/images/1`. - public var _1: Components.Schemas.image? - /// This represents an image (or part of it) selected for a specific role on this product. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_images/images/front`. - public var front: Components.Schemas.image_role? - /// See property `1` to get the real type of those objects - /// (Put this way because of a [bug in rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) - /// - /// - /// - Remark: Generated from `#/components/schemas/product_images/images/imgid_example`. - public var imgid_example: Swift.String? - /// See property `front` to get the real type of those objects - /// (Put this way because of a [bug in rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) - /// - /// - /// - Remark: Generated from `#/components/schemas/product_images/images/image_type_example`. - public var image_type_example: Swift.String? - /// Creates a new `imagesPayload`. - /// - /// - Parameters: - /// - _1: This represents an image uploaded for this product. - /// - front: This represents an image (or part of it) selected for a specific role on this product. - /// - imgid_example: See property `1` to get the real type of those objects - /// - image_type_example: See property `front` to get the real type of those objects - public init( - _1: Components.Schemas.image? = nil, - front: Components.Schemas.image_role? = nil, - imgid_example: Swift.String? = nil, - image_type_example: Swift.String? = nil - ) { - self._1 = _1 - self.front = front - self.imgid_example = imgid_example - self.image_type_example = image_type_example - } - public enum CodingKeys: String, CodingKey { - case _1 = "1" - case front - case imgid_example - case image_type_example - } - } - /// This contains properties for all images contained on the product. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_images/images`. - public var images: Components.Schemas.product_images.imagesPayload? - /// - Remark: Generated from `#/components/schemas/product_images/last_image_dates_tags`. - public var last_image_dates_tags: [Swift.String]? - /// timestamp of last image upload (or update?) - /// - /// - Remark: Generated from `#/components/schemas/product_images/last_image_t`. - public var last_image_t: Swift.Int? - /// URL for selected (important) images of the product. - /// - /// This is very handy if you display the product to users. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_images/selected_images`. - public struct selected_imagesPayload: Codable, Hashable, Sendable { - /// URLs of thumbnails image of image of type `image_type` - /// - /// - Remark: Generated from `#/components/schemas/product_images/selected_images/front`. - public struct frontPayload: Codable, Hashable, Sendable { - /// Thumbnail urls of product image (front) adapted to display on product page - /// - /// - /// - Remark: Generated from `#/components/schemas/product_images/selected_images/front/display`. - public var display: Components.Schemas.image_urls? - /// Thumbnail urls of product image (front) adapted to display on product list page - /// - /// - /// - Remark: Generated from `#/components/schemas/product_images/selected_images/front/small`. - public var small: Components.Schemas.image_urls? - /// Thumbnail urls of product image (front) in smallest format - /// - /// - /// - Remark: Generated from `#/components/schemas/product_images/selected_images/front/thumb`. - public var thumb: Components.Schemas.image_urls? - /// Creates a new `frontPayload`. - /// - /// - Parameters: - /// - display: Thumbnail urls of product image (front) adapted to display on product page - /// - small: Thumbnail urls of product image (front) adapted to display on product list page - /// - thumb: Thumbnail urls of product image (front) in smallest format - public init( - display: Components.Schemas.image_urls? = nil, - small: Components.Schemas.image_urls? = nil, - thumb: Components.Schemas.image_urls? = nil - ) { - self.display = display - self.small = small - self.thumb = thumb - } - public enum CodingKeys: String, CodingKey { - case display - case small - case thumb - } - } - /// URLs of thumbnails image of image of type `image_type` - /// - /// - Remark: Generated from `#/components/schemas/product_images/selected_images/front`. - public var front: Components.Schemas.product_images.selected_imagesPayload.frontPayload? - /// See property `front` to get the real type of those objects - /// (Put this way because of a [bug in rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) - /// - /// - /// - Remark: Generated from `#/components/schemas/product_images/selected_images/image_type_example`. - public var image_type_example: Swift.String? - /// Creates a new `selected_imagesPayload`. - /// - /// - Parameters: - /// - front: URLs of thumbnails image of image of type `image_type` - /// - image_type_example: See property `front` to get the real type of those objects - public init( - front: Components.Schemas.product_images.selected_imagesPayload.frontPayload? = nil, - image_type_example: Swift.String? = nil - ) { - self.front = front - self.image_type_example = image_type_example - } - public enum CodingKeys: String, CodingKey { - case front - case image_type_example - } - } - /// URL for selected (important) images of the product. - /// - /// This is very handy if you display the product to users. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_images/selected_images`. - public var selected_images: Components.Schemas.product_images.selected_imagesPayload? - /// - Remark: Generated from `#/components/schemas/product_images/image_small_url`. - public var image_small_url: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_images/image_thumb_url`. - public var image_thumb_url: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_images/image_url`. - public var image_url: Swift.String? - /// Creates a new `product_images`. - /// - /// - Parameters: - /// - images: This contains properties for all images contained on the product. - /// - last_image_dates_tags: - /// - last_image_t: timestamp of last image upload (or update?) - /// - selected_images: URL for selected (important) images of the product. - /// - image_small_url: - /// - image_thumb_url: - /// - image_url: - public init( - images: Components.Schemas.product_images.imagesPayload? = nil, - last_image_dates_tags: [Swift.String]? = nil, - last_image_t: Swift.Int? = nil, - selected_images: Components.Schemas.product_images.selected_imagesPayload? = nil, - image_small_url: Swift.String? = nil, - image_thumb_url: Swift.String? = nil, - image_url: Swift.String? = nil - ) { - self.images = images - self.last_image_dates_tags = last_image_dates_tags - self.last_image_t = last_image_t - self.selected_images = selected_images - self.image_small_url = image_small_url - self.image_thumb_url = image_thumb_url - self.image_url = image_url - } - public enum CodingKeys: String, CodingKey { - case images - case last_image_dates_tags - case last_image_t - case selected_images - case image_small_url - case image_thumb_url - case image_url - } - } - /// - Remark: Generated from `#/components/schemas/agribalyse`. - public struct agribalyse: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/components/schemas/agribalyse/agribalyse_food_code`. - public var agribalyse_food_code: Swift.String? - /// - Remark: Generated from `#/components/schemas/agribalyse/co2_agriculture`. - public var co2_agriculture: Swift.Double? - /// - Remark: Generated from `#/components/schemas/agribalyse/co2_consumption`. - public var co2_consumption: Swift.Int? - /// - Remark: Generated from `#/components/schemas/agribalyse/co2_distribution`. - public var co2_distribution: Swift.Double? - /// - Remark: Generated from `#/components/schemas/agribalyse/co2_packaging`. - public var co2_packaging: Swift.Double? - /// - Remark: Generated from `#/components/schemas/agribalyse/co2_processing`. - public var co2_processing: Swift.Double? - /// - Remark: Generated from `#/components/schemas/agribalyse/co2_total`. - public var co2_total: Swift.Double? - /// - Remark: Generated from `#/components/schemas/agribalyse/co2_transportation`. - public var co2_transportation: Swift.Double? - /// - Remark: Generated from `#/components/schemas/agribalyse/code`. - public var code: Swift.String? - /// - Remark: Generated from `#/components/schemas/agribalyse/dqr`. - public var dqr: Swift.String? - /// - Remark: Generated from `#/components/schemas/agribalyse/ef_agriculture`. - public var ef_agriculture: Swift.Double? - /// - Remark: Generated from `#/components/schemas/agribalyse/ef_consumption`. - public var ef_consumption: Swift.Int? - /// - Remark: Generated from `#/components/schemas/agribalyse/ef_distribution`. - public var ef_distribution: Swift.Double? - /// - Remark: Generated from `#/components/schemas/agribalyse/ef_packaging`. - public var ef_packaging: Swift.Double? - /// - Remark: Generated from `#/components/schemas/agribalyse/ef_processing`. - public var ef_processing: Swift.Double? - /// - Remark: Generated from `#/components/schemas/agribalyse/ef_total`. - public var ef_total: Swift.Double? - /// - Remark: Generated from `#/components/schemas/agribalyse/ef_transportation`. - public var ef_transportation: Swift.Double? - /// - Remark: Generated from `#/components/schemas/agribalyse/is_beverage`. - public var is_beverage: Swift.Int? - /// This can be returned in many other languages - /// like name_fr (for french). - /// - /// - /// - Remark: Generated from `#/components/schemas/agribalyse/name_en`. - public var name_en: Swift.String? - /// - Remark: Generated from `#/components/schemas/agribalyse/score`. - public var score: Swift.Int? - /// - Remark: Generated from `#/components/schemas/agribalyse/version`. - public var version: Swift.String? - /// Creates a new `agribalyse`. - /// - /// - Parameters: - /// - agribalyse_food_code: - /// - co2_agriculture: - /// - co2_consumption: - /// - co2_distribution: - /// - co2_packaging: - /// - co2_processing: - /// - co2_total: - /// - co2_transportation: - /// - code: - /// - dqr: - /// - ef_agriculture: - /// - ef_consumption: - /// - ef_distribution: - /// - ef_packaging: - /// - ef_processing: - /// - ef_total: - /// - ef_transportation: - /// - is_beverage: - /// - name_en: This can be returned in many other languages - /// - score: - /// - version: - public init( - agribalyse_food_code: Swift.String? = nil, - co2_agriculture: Swift.Double? = nil, - co2_consumption: Swift.Int? = nil, - co2_distribution: Swift.Double? = nil, - co2_packaging: Swift.Double? = nil, - co2_processing: Swift.Double? = nil, - co2_total: Swift.Double? = nil, - co2_transportation: Swift.Double? = nil, - code: Swift.String? = nil, - dqr: Swift.String? = nil, - ef_agriculture: Swift.Double? = nil, - ef_consumption: Swift.Int? = nil, - ef_distribution: Swift.Double? = nil, - ef_packaging: Swift.Double? = nil, - ef_processing: Swift.Double? = nil, - ef_total: Swift.Double? = nil, - ef_transportation: Swift.Double? = nil, - is_beverage: Swift.Int? = nil, - name_en: Swift.String? = nil, - score: Swift.Int? = nil, - version: Swift.String? = nil - ) { - self.agribalyse_food_code = agribalyse_food_code - self.co2_agriculture = co2_agriculture - self.co2_consumption = co2_consumption - self.co2_distribution = co2_distribution - self.co2_packaging = co2_packaging - self.co2_processing = co2_processing - self.co2_total = co2_total - self.co2_transportation = co2_transportation - self.code = code - self.dqr = dqr - self.ef_agriculture = ef_agriculture - self.ef_consumption = ef_consumption - self.ef_distribution = ef_distribution - self.ef_packaging = ef_packaging - self.ef_processing = ef_processing - self.ef_total = ef_total - self.ef_transportation = ef_transportation - self.is_beverage = is_beverage - self.name_en = name_en - self.score = score - self.version = version - } - public enum CodingKeys: String, CodingKey { - case agribalyse_food_code - case co2_agriculture - case co2_consumption - case co2_distribution - case co2_packaging - case co2_processing - case co2_total - case co2_transportation - case code - case dqr - case ef_agriculture - case ef_consumption - case ef_distribution - case ef_packaging - case ef_processing - case ef_total - case ef_transportation - case is_beverage - case name_en - case score - case version - } - } - /// Fields related to Eco-Score for a product. - /// - /// See also: `ecoscore_score`, `ecoscore_grade` and `ecoscore_tags`. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_ecoscore`. - public struct product_ecoscore: Codable, Hashable, Sendable { - /// An object about a lot of details about data needed for Eco-Score computation - /// and complementary data of interest. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data`. - public struct ecoscore_dataPayload: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments`. - public struct adjustmentsPayload: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/origins_of_ingredients`. - public struct origins_of_ingredientsPayload: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/origins_of_ingredients/aggregated_originsPayload`. - public struct aggregated_originsPayloadPayload: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/origins_of_ingredients/aggregated_originsPayload/origin`. - public var origin: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/origins_of_ingredients/aggregated_originsPayload/percent`. - public var percent: Swift.Int? - /// Creates a new `aggregated_originsPayloadPayload`. - /// - /// - Parameters: - /// - origin: - /// - percent: - public init( - origin: Swift.String? = nil, - percent: Swift.Int? = nil - ) { - self.origin = origin - self.percent = percent - } - public enum CodingKeys: String, CodingKey { - case origin - case percent - } - } - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/origins_of_ingredients/aggregated_origins`. - public typealias aggregated_originsPayload = [Components.Schemas.product_ecoscore.ecoscore_dataPayload.adjustmentsPayload.origins_of_ingredientsPayload.aggregated_originsPayloadPayload] - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/origins_of_ingredients/aggregated_origins`. - public var aggregated_origins: Components.Schemas.product_ecoscore.ecoscore_dataPayload.adjustmentsPayload.origins_of_ingredientsPayload.aggregated_originsPayload? - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/origins_of_ingredients/epi_score`. - public var epi_score: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/origins_of_ingredients/epi_value`. - public var epi_value: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/origins_of_ingredients/origins_from_origins_field`. - public var origins_from_origins_field: [Swift.String]? - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/origins_of_ingredients/transportation_scores`. - public struct transportation_scoresPayload: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/origins_of_ingredients/transportation_scores/language_code_example`. - public var language_code_example: Swift.Int? - /// Creates a new `transportation_scoresPayload`. - /// - /// - Parameters: - /// - language_code_example: - public init(language_code_example: Swift.Int? = nil) { - self.language_code_example = language_code_example - } - public enum CodingKeys: String, CodingKey { - case language_code_example - } - } - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/origins_of_ingredients/transportation_scores`. - public var transportation_scores: Components.Schemas.product_ecoscore.ecoscore_dataPayload.adjustmentsPayload.origins_of_ingredientsPayload.transportation_scoresPayload? - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/origins_of_ingredients/transportation_values`. - public struct transportation_valuesPayload: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/origins_of_ingredients/transportation_values/language_code_example`. - public var language_code_example: Swift.Int? - /// Creates a new `transportation_valuesPayload`. - /// - /// - Parameters: - /// - language_code_example: - public init(language_code_example: Swift.Int? = nil) { - self.language_code_example = language_code_example - } - public enum CodingKeys: String, CodingKey { - case language_code_example - } - } - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/origins_of_ingredients/transportation_values`. - public var transportation_values: Components.Schemas.product_ecoscore.ecoscore_dataPayload.adjustmentsPayload.origins_of_ingredientsPayload.transportation_valuesPayload? - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/origins_of_ingredients/values`. - public struct valuesPayload: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/origins_of_ingredients/values/language_code_example`. - public var language_code_example: Swift.Int? - /// Creates a new `valuesPayload`. - /// - /// - Parameters: - /// - language_code_example: - public init(language_code_example: Swift.Int? = nil) { - self.language_code_example = language_code_example - } - public enum CodingKeys: String, CodingKey { - case language_code_example - } - } - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/origins_of_ingredients/values`. - public var values: Components.Schemas.product_ecoscore.ecoscore_dataPayload.adjustmentsPayload.origins_of_ingredientsPayload.valuesPayload? - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/origins_of_ingredients/warning`. - public var warning: Swift.String? - /// Creates a new `origins_of_ingredientsPayload`. - /// - /// - Parameters: - /// - aggregated_origins: - /// - epi_score: - /// - epi_value: - /// - origins_from_origins_field: - /// - transportation_scores: - /// - transportation_values: - /// - values: - /// - warning: - public init( - aggregated_origins: Components.Schemas.product_ecoscore.ecoscore_dataPayload.adjustmentsPayload.origins_of_ingredientsPayload.aggregated_originsPayload? = nil, - epi_score: Swift.Int? = nil, - epi_value: Swift.Int? = nil, - origins_from_origins_field: [Swift.String]? = nil, - transportation_scores: Components.Schemas.product_ecoscore.ecoscore_dataPayload.adjustmentsPayload.origins_of_ingredientsPayload.transportation_scoresPayload? = nil, - transportation_values: Components.Schemas.product_ecoscore.ecoscore_dataPayload.adjustmentsPayload.origins_of_ingredientsPayload.transportation_valuesPayload? = nil, - values: Components.Schemas.product_ecoscore.ecoscore_dataPayload.adjustmentsPayload.origins_of_ingredientsPayload.valuesPayload? = nil, - warning: Swift.String? = nil - ) { - self.aggregated_origins = aggregated_origins - self.epi_score = epi_score - self.epi_value = epi_value - self.origins_from_origins_field = origins_from_origins_field - self.transportation_scores = transportation_scores - self.transportation_values = transportation_values - self.values = values - self.warning = warning - } - public enum CodingKeys: String, CodingKey { - case aggregated_origins - case epi_score - case epi_value - case origins_from_origins_field - case transportation_scores - case transportation_values - case values - case warning - } - } - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/origins_of_ingredients`. - public var origins_of_ingredients: Components.Schemas.product_ecoscore.ecoscore_dataPayload.adjustmentsPayload.origins_of_ingredientsPayload? - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/packaging`. - public struct packagingPayload: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/packaging/non_recyclable_and_non_biodegradable_materials`. - public var non_recyclable_and_non_biodegradable_materials: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/packaging/packagingsPayload`. - public struct packagingsPayloadPayload: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/packaging/packagingsPayload/ecoscore_material_score`. - public var ecoscore_material_score: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/packaging/packagingsPayload/ecoscore_shape_ratio`. - public var ecoscore_shape_ratio: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/packaging/packagingsPayload/material`. - public var material: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/packaging/packagingsPayload/shape`. - public var shape: Swift.String? - /// Creates a new `packagingsPayloadPayload`. - /// - /// - Parameters: - /// - ecoscore_material_score: - /// - ecoscore_shape_ratio: - /// - material: - /// - shape: - public init( - ecoscore_material_score: Swift.Int? = nil, - ecoscore_shape_ratio: Swift.Int? = nil, - material: Swift.String? = nil, - shape: Swift.String? = nil - ) { - self.ecoscore_material_score = ecoscore_material_score - self.ecoscore_shape_ratio = ecoscore_shape_ratio - self.material = material - self.shape = shape - } - public enum CodingKeys: String, CodingKey { - case ecoscore_material_score - case ecoscore_shape_ratio - case material - case shape - } - } - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/packaging/packagings`. - public typealias packagingsPayload = [Components.Schemas.product_ecoscore.ecoscore_dataPayload.adjustmentsPayload.packagingPayload.packagingsPayloadPayload] - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/packaging/packagings`. - public var packagings: Components.Schemas.product_ecoscore.ecoscore_dataPayload.adjustmentsPayload.packagingPayload.packagingsPayload? - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/packaging/score`. - public var score: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/packaging/value`. - public var value: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/packaging/warning`. - public var warning: Swift.String? - /// Creates a new `packagingPayload`. - /// - /// - Parameters: - /// - non_recyclable_and_non_biodegradable_materials: - /// - packagings: - /// - score: - /// - value: - /// - warning: - public init( - non_recyclable_and_non_biodegradable_materials: Swift.Int? = nil, - packagings: Components.Schemas.product_ecoscore.ecoscore_dataPayload.adjustmentsPayload.packagingPayload.packagingsPayload? = nil, - score: Swift.Int? = nil, - value: Swift.Int? = nil, - warning: Swift.String? = nil - ) { - self.non_recyclable_and_non_biodegradable_materials = non_recyclable_and_non_biodegradable_materials - self.packagings = packagings - self.score = score - self.value = value - self.warning = warning - } - public enum CodingKeys: String, CodingKey { - case non_recyclable_and_non_biodegradable_materials - case packagings - case score - case value - case warning - } - } - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/packaging`. - public var packaging: Components.Schemas.product_ecoscore.ecoscore_dataPayload.adjustmentsPayload.packagingPayload? - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/production_system`. - public struct production_systemPayload: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/production_system/labels`. - public var labels: [Swift.String]? - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/production_system/value`. - public var value: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/production_system/warning`. - public var warning: Swift.String? - /// Creates a new `production_systemPayload`. - /// - /// - Parameters: - /// - labels: - /// - value: - /// - warning: - public init( - labels: [Swift.String]? = nil, - value: Swift.Int? = nil, - warning: Swift.String? = nil - ) { - self.labels = labels - self.value = value - self.warning = warning - } - public enum CodingKeys: String, CodingKey { - case labels - case value - case warning - } - } - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/production_system`. - public var production_system: Components.Schemas.product_ecoscore.ecoscore_dataPayload.adjustmentsPayload.production_systemPayload? - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/threatened_species`. - public struct threatened_speciesPayload: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/threatened_species/ingredient`. - public var ingredient: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/threatened_species/value`. - public var value: Swift.Int? - /// Creates a new `threatened_speciesPayload`. - /// - /// - Parameters: - /// - ingredient: - /// - value: - public init( - ingredient: Swift.String? = nil, - value: Swift.Int? = nil - ) { - self.ingredient = ingredient - self.value = value - } - public enum CodingKeys: String, CodingKey { - case ingredient - case value - } - } - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments/threatened_species`. - public var threatened_species: Components.Schemas.product_ecoscore.ecoscore_dataPayload.adjustmentsPayload.threatened_speciesPayload? - /// Creates a new `adjustmentsPayload`. - /// - /// - Parameters: - /// - origins_of_ingredients: - /// - packaging: - /// - production_system: - /// - threatened_species: - public init( - origins_of_ingredients: Components.Schemas.product_ecoscore.ecoscore_dataPayload.adjustmentsPayload.origins_of_ingredientsPayload? = nil, - packaging: Components.Schemas.product_ecoscore.ecoscore_dataPayload.adjustmentsPayload.packagingPayload? = nil, - production_system: Components.Schemas.product_ecoscore.ecoscore_dataPayload.adjustmentsPayload.production_systemPayload? = nil, - threatened_species: Components.Schemas.product_ecoscore.ecoscore_dataPayload.adjustmentsPayload.threatened_speciesPayload? = nil - ) { - self.origins_of_ingredients = origins_of_ingredients - self.packaging = packaging - self.production_system = production_system - self.threatened_species = threatened_species - } - public enum CodingKeys: String, CodingKey { - case origins_of_ingredients - case packaging - case production_system - case threatened_species - } - } - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/adjustments`. - public var adjustments: Components.Schemas.product_ecoscore.ecoscore_dataPayload.adjustmentsPayload? - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/agribalyse`. - public var agribalyse: Components.Schemas.agribalyse? - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/grade`. - public var grade: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/grades`. - public struct gradesPayload: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/grades/language_code_example`. - public var language_code_example: Swift.String? - /// Creates a new `gradesPayload`. - /// - /// - Parameters: - /// - language_code_example: - public init(language_code_example: Swift.String? = nil) { - self.language_code_example = language_code_example - } - public enum CodingKeys: String, CodingKey { - case language_code_example - } - } - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/grades`. - public var grades: Components.Schemas.product_ecoscore.ecoscore_dataPayload.gradesPayload? - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/missing`. - public struct missingPayload: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/missing/labels`. - public var labels: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/missing/origins`. - public var origins: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/missing/packagings`. - public var packagings: Swift.Int? - /// Creates a new `missingPayload`. - /// - /// - Parameters: - /// - labels: - /// - origins: - /// - packagings: - public init( - labels: Swift.Int? = nil, - origins: Swift.Int? = nil, - packagings: Swift.Int? = nil - ) { - self.labels = labels - self.origins = origins - self.packagings = packagings - } - public enum CodingKeys: String, CodingKey { - case labels - case origins - case packagings - } - } - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/missing`. - public var missing: Components.Schemas.product_ecoscore.ecoscore_dataPayload.missingPayload? - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/missing_data_warning`. - public var missing_data_warning: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/previous_data`. - public struct previous_dataPayload: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/previous_data/grade`. - public var grade: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/previous_data/score`. - public var score: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/previous_data/agribalyse`. - public var agribalyse: Components.Schemas.agribalyse? - /// Creates a new `previous_dataPayload`. - /// - /// - Parameters: - /// - grade: - /// - score: - /// - agribalyse: - public init( - grade: Swift.String? = nil, - score: Swift.Int? = nil, - agribalyse: Components.Schemas.agribalyse? = nil - ) { - self.grade = grade - self.score = score - self.agribalyse = agribalyse - } - public enum CodingKeys: String, CodingKey { - case grade - case score - case agribalyse - } - } - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/previous_data`. - public var previous_data: Components.Schemas.product_ecoscore.ecoscore_dataPayload.previous_dataPayload? - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/score`. - public var score: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/scores`. - public struct scoresPayload: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/scores/language_code_example`. - public var language_code_example: Swift.Int? - /// Creates a new `scoresPayload`. - /// - /// - Parameters: - /// - language_code_example: - public init(language_code_example: Swift.Int? = nil) { - self.language_code_example = language_code_example - } - public enum CodingKeys: String, CodingKey { - case language_code_example - } - } - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/scores`. - public var scores: Components.Schemas.product_ecoscore.ecoscore_dataPayload.scoresPayload? - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data/status`. - public var status: Swift.String? - /// Creates a new `ecoscore_dataPayload`. - /// - /// - Parameters: - /// - adjustments: - /// - agribalyse: - /// - grade: - /// - grades: - /// - missing: - /// - missing_data_warning: - /// - previous_data: - /// - score: - /// - scores: - /// - status: - public init( - adjustments: Components.Schemas.product_ecoscore.ecoscore_dataPayload.adjustmentsPayload? = nil, - agribalyse: Components.Schemas.agribalyse? = nil, - grade: Swift.String? = nil, - grades: Components.Schemas.product_ecoscore.ecoscore_dataPayload.gradesPayload? = nil, - missing: Components.Schemas.product_ecoscore.ecoscore_dataPayload.missingPayload? = nil, - missing_data_warning: Swift.Int? = nil, - previous_data: Components.Schemas.product_ecoscore.ecoscore_dataPayload.previous_dataPayload? = nil, - score: Swift.Int? = nil, - scores: Components.Schemas.product_ecoscore.ecoscore_dataPayload.scoresPayload? = nil, - status: Swift.String? = nil - ) { - self.adjustments = adjustments - self.agribalyse = agribalyse - self.grade = grade - self.grades = grades - self.missing = missing - self.missing_data_warning = missing_data_warning - self.previous_data = previous_data - self.score = score - self.scores = scores - self.status = status - } - public enum CodingKeys: String, CodingKey { - case adjustments - case agribalyse - case grade - case grades - case missing - case missing_data_warning - case previous_data - case score - case scores - case status - } - } - /// An object about a lot of details about data needed for Eco-Score computation - /// and complementary data of interest. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_data`. - public var ecoscore_data: Components.Schemas.product_ecoscore.ecoscore_dataPayload? - /// - Remark: Generated from `#/components/schemas/product_ecoscore/ecoscore_extended_data_version`. - public var ecoscore_extended_data_version: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_ecoscore/environment_impact_level`. - public var environment_impact_level: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_ecoscore/environment_impact_level_tags`. - public var environment_impact_level_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? - /// Creates a new `product_ecoscore`. - /// - /// - Parameters: - /// - ecoscore_data: An object about a lot of details about data needed for Eco-Score computation - /// - ecoscore_extended_data_version: - /// - environment_impact_level: - /// - environment_impact_level_tags: - public init( - ecoscore_data: Components.Schemas.product_ecoscore.ecoscore_dataPayload? = nil, - ecoscore_extended_data_version: Swift.String? = nil, - environment_impact_level: Swift.String? = nil, - environment_impact_level_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? = nil - ) { - self.ecoscore_data = ecoscore_data - self.ecoscore_extended_data_version = ecoscore_extended_data_version - self.environment_impact_level = environment_impact_level - self.environment_impact_level_tags = environment_impact_level_tags - } - public enum CodingKeys: String, CodingKey { - case ecoscore_data - case ecoscore_extended_data_version - case environment_impact_level - case environment_impact_level_tags - } - } - /// - Remark: Generated from `#/components/schemas/ingredient`. - public struct ingredientPayload: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/components/schemas/ingredient/id`. - public var id: Swift.String? - /// - Remark: Generated from `#/components/schemas/ingredient/percent`. - public var percent: Swift.Int? - /// - Remark: Generated from `#/components/schemas/ingredient/percent_estimate`. - public var percent_estimate: Swift.Double? - /// - Remark: Generated from `#/components/schemas/ingredient/percent_max`. - public var percent_max: Swift.Double? - /// - Remark: Generated from `#/components/schemas/ingredient/percent_min`. - public var percent_min: Swift.Int? - /// - Remark: Generated from `#/components/schemas/ingredient/text`. - public var text: Swift.String? - /// - Remark: Generated from `#/components/schemas/ingredient/vegan`. - public var vegan: Swift.String? - /// - Remark: Generated from `#/components/schemas/ingredient/vegetarian`. - public var vegetarian: Swift.String? - /// Creates a new `ingredientPayload`. - /// - /// - Parameters: - /// - id: - /// - percent: - /// - percent_estimate: - /// - percent_max: - /// - percent_min: - /// - text: - /// - vegan: - /// - vegetarian: - public init( - id: Swift.String? = nil, - percent: Swift.Int? = nil, - percent_estimate: Swift.Double? = nil, - percent_max: Swift.Double? = nil, - percent_min: Swift.Int? = nil, - text: Swift.String? = nil, - vegan: Swift.String? = nil, - vegetarian: Swift.String? = nil - ) { - self.id = id - self.percent = percent - self.percent_estimate = percent_estimate - self.percent_max = percent_max - self.percent_min = percent_min - self.text = text - self.vegan = vegan - self.vegetarian = vegetarian - } - public enum CodingKeys: String, CodingKey { - case id - case percent - case percent_estimate - case percent_max - case percent_min - case text - case vegan - case vegetarian - } - } - /// This structure gives the different ingredients and some information about them, - /// like estimate on their quantity. - /// - /// - /// - Remark: Generated from `#/components/schemas/ingredient`. - public typealias ingredient = [Components.Schemas.ingredientPayload] - /// Fields about ingredients of a product - /// - /// - Remark: Generated from `#/components/schemas/product_ingredients`. - public struct product_ingredients: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/components/schemas/product_ingredients/additives_tags`. - public var additives_tags: [Swift.String]? - /// comma separated list of allergens - /// - /// - Remark: Generated from `#/components/schemas/product_ingredients/allergens`. - public var allergens: Swift.String? - /// language in which `allergens` where input - /// - /// - Remark: Generated from `#/components/schemas/product_ingredients/allergens_lc`. - public var allergens_lc: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_ingredients/allergens_hierarchy`. - public var allergens_hierarchy: [Swift.String]? - /// - Remark: Generated from `#/components/schemas/product_ingredients/allergens_tags`. - public var allergens_tags: [Swift.String]? - /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients`. - public var ingredients: Components.Schemas.ingredient? - /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_analysis`. - public struct ingredients_analysisPayload: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_analysis/en:palm-oil`. - public var en_colon_palm_hyphen_oil: [Swift.String]? - /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_analysis/en:vegan-status-unknown`. - public var en_colon_vegan_hyphen_status_hyphen_unknown: [Swift.String]? - /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_analysis/en:vegetarian-status-unknown`. - public var en_colon_vegetarian_hyphen_status_hyphen_unknown: [Swift.String]? - /// Creates a new `ingredients_analysisPayload`. - /// - /// - Parameters: - /// - en_colon_palm_hyphen_oil: - /// - en_colon_vegan_hyphen_status_hyphen_unknown: - /// - en_colon_vegetarian_hyphen_status_hyphen_unknown: - public init( - en_colon_palm_hyphen_oil: [Swift.String]? = nil, - en_colon_vegan_hyphen_status_hyphen_unknown: [Swift.String]? = nil, - en_colon_vegetarian_hyphen_status_hyphen_unknown: [Swift.String]? = nil - ) { - self.en_colon_palm_hyphen_oil = en_colon_palm_hyphen_oil - self.en_colon_vegan_hyphen_status_hyphen_unknown = en_colon_vegan_hyphen_status_hyphen_unknown - self.en_colon_vegetarian_hyphen_status_hyphen_unknown = en_colon_vegetarian_hyphen_status_hyphen_unknown - } - public enum CodingKeys: String, CodingKey { - case en_colon_palm_hyphen_oil = "en:palm-oil" - case en_colon_vegan_hyphen_status_hyphen_unknown = "en:vegan-status-unknown" - case en_colon_vegetarian_hyphen_status_hyphen_unknown = "en:vegetarian-status-unknown" - } - } - /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_analysis`. - public var ingredients_analysis: Components.Schemas.product_ingredients.ingredients_analysisPayload? - /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_analysis_tags`. - public var ingredients_analysis_tags: [Swift.String]? - /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_from_or_that_may_be_from_palm_oil_n`. - public var ingredients_from_or_that_may_be_from_palm_oil_n: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_from_palm_oil_n`. - public var ingredients_from_palm_oil_n: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_from_palm_oil_tags`. - public var ingredients_from_palm_oil_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? - /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_hierarchy`. - public var ingredients_hierarchy: [Swift.String]? - /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_n`. - public var ingredients_n: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_n_tags`. - public var ingredients_n_tags: [Swift.String]? - /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_original_tags`. - public var ingredients_original_tags: [Swift.String]? - /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_percent_analysis`. - public var ingredients_percent_analysis: Swift.Int? - /// Number of sweeteners additives in the ingredients. Undefined if ingredients are not specified. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_sweeteners_n`. - public var ingredients_sweeteners_n: Swift.Int? - /// Number of non-nutritive sweeteners additives (as specified in the Nutri-Score formula) in the ingredients. Undefined if ingredients are not specified. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_non_nutritive_sweeteners_n`. - public var ingredients_non_nutritive_sweeteners_n: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_tags`. - public var ingredients_tags: [Swift.String]? - /// Language that was used to parse the ingredient list. If `ingredients_text` is available - /// for the product main language (`lang`), `ingredients_lc=lang`, otherwise we look at - /// `ingredients_text` fields for other languages and set `ingredients_lc` to the first - /// non-empty `ingredient_text`. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_lc`. - public var ingredients_lc: Swift.String? - /// Raw list of ingredients. This will get automatically - /// parsed and get used to compute the Eco-Score or find allergens, etc.. - /// - /// It's a copy of ingredients_text in the main language of the product (see `lang` proprety). - /// - /// - /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_text`. - public var ingredients_text: Swift.String? - /// Same text as `ingredients_text` but where allergens have HTML elements around them to identify them - /// - /// - /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_text_with_allergens`. - public var ingredients_text_with_allergens: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_that_may_be_from_palm_oil_n`. - public var ingredients_that_may_be_from_palm_oil_n: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_that_may_be_from_palm_oil_tags`. - public var ingredients_that_may_be_from_palm_oil_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? - /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_with_specified_percent_n`. - public var ingredients_with_specified_percent_n: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_with_specified_percent_sum`. - public var ingredients_with_specified_percent_sum: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_with_unspecified_percent_n`. - public var ingredients_with_unspecified_percent_n: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_with_unspecified_percent_sum`. - public var ingredients_with_unspecified_percent_sum: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_ingredients/known_ingredients_n`. - public var known_ingredients_n: Swift.Int? - /// Origins of ingredients - /// - /// - /// - Remark: Generated from `#/components/schemas/product_ingredients/origins`. - public var origins: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_ingredients/origins_hierarchy`. - public var origins_hierarchy: [OpenAPIRuntime.OpenAPIObjectContainer]? - /// - Remark: Generated from `#/components/schemas/product_ingredients/origins_lc`. - public var origins_lc: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_ingredients/origins_tags`. - public var origins_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? - /// List of substances that might cause allergies - /// that are present in trace amounts in the product - /// (this does not include the ingredients, as they - /// are not only present in trace amounts). - /// It is taxonomized with the allergens taxonomy. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_ingredients/traces`. - public var traces: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_ingredients/traces_hierarchy`. - public var traces_hierarchy: [OpenAPIRuntime.OpenAPIObjectContainer]? - /// - Remark: Generated from `#/components/schemas/product_ingredients/traces_lc`. - public var traces_lc: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_ingredients/traces_tags`. - public var traces_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? - /// - Remark: Generated from `#/components/schemas/product_ingredients/unknown_ingredients_n`. - public var unknown_ingredients_n: Swift.Int? - /// Raw list of ingredients in language given by 'language_code'. - /// - /// See `ingredients_text` - /// - /// - /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_text_(?\w\w)`. - public var ingredients_text__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: Swift.String? - /// Like `ingredients_text_with_allergens` for a particular language - /// - /// - /// - Remark: Generated from `#/components/schemas/product_ingredients/ingredients_text_with_allergens_(?\w\w)`. - public var ingredients_text_with_allergens__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: Swift.String? - /// Creates a new `product_ingredients`. - /// - /// - Parameters: - /// - additives_tags: - /// - allergens: comma separated list of allergens - /// - allergens_lc: language in which `allergens` where input - /// - allergens_hierarchy: - /// - allergens_tags: - /// - ingredients: - /// - ingredients_analysis: - /// - ingredients_analysis_tags: - /// - ingredients_from_or_that_may_be_from_palm_oil_n: - /// - ingredients_from_palm_oil_n: - /// - ingredients_from_palm_oil_tags: - /// - ingredients_hierarchy: - /// - ingredients_n: - /// - ingredients_n_tags: - /// - ingredients_original_tags: - /// - ingredients_percent_analysis: - /// - ingredients_sweeteners_n: Number of sweeteners additives in the ingredients. Undefined if ingredients are not specified. - /// - ingredients_non_nutritive_sweeteners_n: Number of non-nutritive sweeteners additives (as specified in the Nutri-Score formula) in the ingredients. Undefined if ingredients are not specified. - /// - ingredients_tags: - /// - ingredients_lc: Language that was used to parse the ingredient list. If `ingredients_text` is available - /// - ingredients_text: Raw list of ingredients. This will get automatically - /// - ingredients_text_with_allergens: Same text as `ingredients_text` but where allergens have HTML elements around them to identify them - /// - ingredients_that_may_be_from_palm_oil_n: - /// - ingredients_that_may_be_from_palm_oil_tags: - /// - ingredients_with_specified_percent_n: - /// - ingredients_with_specified_percent_sum: - /// - ingredients_with_unspecified_percent_n: - /// - ingredients_with_unspecified_percent_sum: - /// - known_ingredients_n: - /// - origins: Origins of ingredients - /// - origins_hierarchy: - /// - origins_lc: - /// - origins_tags: - /// - traces: List of substances that might cause allergies - /// - traces_hierarchy: - /// - traces_lc: - /// - traces_tags: - /// - unknown_ingredients_n: - /// - ingredients_text__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: Raw list of ingredients in language given by 'language_code'. - /// - ingredients_text_with_allergens__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: Like `ingredients_text_with_allergens` for a particular language - public init( - additives_tags: [Swift.String]? = nil, - allergens: Swift.String? = nil, - allergens_lc: Swift.String? = nil, - allergens_hierarchy: [Swift.String]? = nil, - allergens_tags: [Swift.String]? = nil, - ingredients: Components.Schemas.ingredient? = nil, - ingredients_analysis: Components.Schemas.product_ingredients.ingredients_analysisPayload? = nil, - ingredients_analysis_tags: [Swift.String]? = nil, - ingredients_from_or_that_may_be_from_palm_oil_n: Swift.Int? = nil, - ingredients_from_palm_oil_n: Swift.Int? = nil, - ingredients_from_palm_oil_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? = nil, - ingredients_hierarchy: [Swift.String]? = nil, - ingredients_n: Swift.Int? = nil, - ingredients_n_tags: [Swift.String]? = nil, - ingredients_original_tags: [Swift.String]? = nil, - ingredients_percent_analysis: Swift.Int? = nil, - ingredients_sweeteners_n: Swift.Int? = nil, - ingredients_non_nutritive_sweeteners_n: Swift.Int? = nil, - ingredients_tags: [Swift.String]? = nil, - ingredients_lc: Swift.String? = nil, - ingredients_text: Swift.String? = nil, - ingredients_text_with_allergens: Swift.String? = nil, - ingredients_that_may_be_from_palm_oil_n: Swift.Int? = nil, - ingredients_that_may_be_from_palm_oil_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? = nil, - ingredients_with_specified_percent_n: Swift.Int? = nil, - ingredients_with_specified_percent_sum: Swift.Int? = nil, - ingredients_with_unspecified_percent_n: Swift.Int? = nil, - ingredients_with_unspecified_percent_sum: Swift.Int? = nil, - known_ingredients_n: Swift.Int? = nil, - origins: Swift.String? = nil, - origins_hierarchy: [OpenAPIRuntime.OpenAPIObjectContainer]? = nil, - origins_lc: Swift.String? = nil, - origins_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? = nil, - traces: Swift.String? = nil, - traces_hierarchy: [OpenAPIRuntime.OpenAPIObjectContainer]? = nil, - traces_lc: Swift.String? = nil, - traces_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? = nil, - unknown_ingredients_n: Swift.Int? = nil, - ingredients_text__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: Swift.String? = nil, - ingredients_text_with_allergens__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: Swift.String? = nil - ) { - self.additives_tags = additives_tags - self.allergens = allergens - self.allergens_lc = allergens_lc - self.allergens_hierarchy = allergens_hierarchy - self.allergens_tags = allergens_tags - self.ingredients = ingredients - self.ingredients_analysis = ingredients_analysis - self.ingredients_analysis_tags = ingredients_analysis_tags - self.ingredients_from_or_that_may_be_from_palm_oil_n = ingredients_from_or_that_may_be_from_palm_oil_n - self.ingredients_from_palm_oil_n = ingredients_from_palm_oil_n - self.ingredients_from_palm_oil_tags = ingredients_from_palm_oil_tags - self.ingredients_hierarchy = ingredients_hierarchy - self.ingredients_n = ingredients_n - self.ingredients_n_tags = ingredients_n_tags - self.ingredients_original_tags = ingredients_original_tags - self.ingredients_percent_analysis = ingredients_percent_analysis - self.ingredients_sweeteners_n = ingredients_sweeteners_n - self.ingredients_non_nutritive_sweeteners_n = ingredients_non_nutritive_sweeteners_n - self.ingredients_tags = ingredients_tags - self.ingredients_lc = ingredients_lc - self.ingredients_text = ingredients_text - self.ingredients_text_with_allergens = ingredients_text_with_allergens - self.ingredients_that_may_be_from_palm_oil_n = ingredients_that_may_be_from_palm_oil_n - self.ingredients_that_may_be_from_palm_oil_tags = ingredients_that_may_be_from_palm_oil_tags - self.ingredients_with_specified_percent_n = ingredients_with_specified_percent_n - self.ingredients_with_specified_percent_sum = ingredients_with_specified_percent_sum - self.ingredients_with_unspecified_percent_n = ingredients_with_unspecified_percent_n - self.ingredients_with_unspecified_percent_sum = ingredients_with_unspecified_percent_sum - self.known_ingredients_n = known_ingredients_n - self.origins = origins - self.origins_hierarchy = origins_hierarchy - self.origins_lc = origins_lc - self.origins_tags = origins_tags - self.traces = traces - self.traces_hierarchy = traces_hierarchy - self.traces_lc = traces_lc - self.traces_tags = traces_tags - self.unknown_ingredients_n = unknown_ingredients_n - self.ingredients_text__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ = ingredients_text__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ - self.ingredients_text_with_allergens__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ = ingredients_text_with_allergens__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ - } - public enum CodingKeys: String, CodingKey { - case additives_tags - case allergens - case allergens_lc - case allergens_hierarchy - case allergens_tags - case ingredients - case ingredients_analysis - case ingredients_analysis_tags - case ingredients_from_or_that_may_be_from_palm_oil_n - case ingredients_from_palm_oil_n - case ingredients_from_palm_oil_tags - case ingredients_hierarchy - case ingredients_n - case ingredients_n_tags - case ingredients_original_tags - case ingredients_percent_analysis - case ingredients_sweeteners_n - case ingredients_non_nutritive_sweeteners_n - case ingredients_tags - case ingredients_lc - case ingredients_text - case ingredients_text_with_allergens - case ingredients_that_may_be_from_palm_oil_n - case ingredients_that_may_be_from_palm_oil_tags - case ingredients_with_specified_percent_n - case ingredients_with_specified_percent_sum - case ingredients_with_unspecified_percent_n - case ingredients_with_unspecified_percent_sum - case known_ingredients_n - case origins - case origins_hierarchy - case origins_lc - case origins_tags - case traces - case traces_hierarchy - case traces_lc - case traces_tags - case unknown_ingredients_n - case ingredients_text__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ = #"ingredients_text_(?\w\w)"# - case ingredients_text_with_allergens__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ = #"ingredients_text_with_allergens_(?\w\w)"# - } - } - /// Nutrition fields of a product - /// - /// Most of these properties are read-only. - /// - /// See [how to add nutrition data](https://openfoodfacts.github.io/openfoodfacts-server/api/ref-cheatsheet/#add-nutrition-facts-values-units-and-base) - /// - /// - /// - Remark: Generated from `#/components/schemas/product_nutrition`. - public struct product_nutrition: Codable, Hashable, Sendable { - /// When a product does not have nutrition data displayed on the - /// packaging, the user can check the field "Nutrition facts are - /// not specified on the product". - /// By doing so, the no_nutrition_data field takes the value "on". - /// This case is frequent (thousands of products). - /// - /// - /// - Remark: Generated from `#/components/schemas/product_nutrition/no_nutrition_data`. - public var no_nutrition_data: Swift.String? - /// The nutrition data on the package can be per serving or per 100g. - /// - /// This is essential to understand if `_value` and `` - /// values in `nutriments` applies for a serving or for 100g. - /// - /// **IMPORTANT:** - /// When writing products, - /// this setting applies to all existing nutrients values for the product, - /// not only the nutrient values sent in the write request. - /// So it should not be changed unless all nutrients values are provided - /// with values that match the nutrition_data_per field. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutrition_data_per`. - @frozen public enum nutrition_data_perPayload: String, Codable, Hashable, Sendable, CaseIterable { - case serving = "serving" - case _100g = "100g" - } - /// The nutrition data on the package can be per serving or per 100g. - /// - /// This is essential to understand if `_value` and `` - /// values in `nutriments` applies for a serving or for 100g. - /// - /// **IMPORTANT:** - /// When writing products, - /// this setting applies to all existing nutrients values for the product, - /// not only the nutrient values sent in the write request. - /// So it should not be changed unless all nutrients values are provided - /// with values that match the nutrition_data_per field. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutrition_data_per`. - public var nutrition_data_per: Components.Schemas.product_nutrition.nutrition_data_perPayload? - /// The nutrition data for prepared product on the package (if any) can be per serving or per 100g. - /// - /// This is essential to understand if `_prepared_value` and `_prepared` - /// values in `nutriments` applies for a serving or for 100g. - /// - /// See also important note on `nutrition_data_per`. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutrition_data_prepared_per`. - @frozen public enum nutrition_data_prepared_perPayload: String, Codable, Hashable, Sendable, CaseIterable { - case serving = "serving" - case _100g = "100g" - } - /// The nutrition data for prepared product on the package (if any) can be per serving or per 100g. - /// - /// This is essential to understand if `_prepared_value` and `_prepared` - /// values in `nutriments` applies for a serving or for 100g. - /// - /// See also important note on `nutrition_data_per`. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutrition_data_prepared_per`. - public var nutrition_data_prepared_per: Components.Schemas.product_nutrition.nutrition_data_prepared_perPayload? - /// All known nutrients for the product. - /// - /// Note that each nutrients are declined with a variety of suffixes like `_100g`, `_serving`, - /// see patternProperties below. - /// - /// A specific `_unit` is the unit used to measure the nutrient. - /// - /// Beware that some properties are to be interpreted based upon `nutrition_data_per` value. - /// - /// Also for products that have a nutrition table for prepared product - /// (eg. the nutrition facts for a bowl of milk with cocoa powder), - /// a `_prepared` suffix is added (before other suffixes). - /// - /// You can get all possible nutrients from the - /// [nutrients taxonomy](https://static.openfoodfacts.org/data/taxonomies/nutrients.json) - /// - /// **FIXME** add more nutrients with description. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriments`. - public struct nutrimentsPayload: Codable, Hashable, Sendable { - /// Quantity of alcohol - /// - /// (per 100g or per serving) in a standard unit (g or ml) - /// - /// - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriments/alcohol`. - public var alcohol: Swift.Double? - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriments/carbohydrates`. - public var carbohydrates: Swift.Double? - /// It is the same as `energy-kj` if we have it, or computed from `energy-kcal` otherwise - /// - /// (per 100g or per serving) in kj - /// - /// - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriments/energy`. - public var energy: Swift.Double? - /// energy_value will be equal to energy-kj_value if we have it or to energy-kcal_value otherwise - /// - /// - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriments/energy_value`. - public var energy_value: Swift.Double? - /// Equal to energy-kj_unit if we have it or to energy-kcal_unit otherwise - /// - /// - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriments/energy_unit`. - @frozen public enum energy_unitPayload: String, Codable, Hashable, Sendable, CaseIterable { - case kcal = "kcal" - case kj = "kj" - } - /// Equal to energy-kj_unit if we have it or to energy-kcal_unit otherwise - /// - /// - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriments/energy_unit`. - public var energy_unit: Components.Schemas.product_nutrition.nutrimentsPayload.energy_unitPayload? - /// energy in kcal, if it is specified - /// - /// (per 100g or per serving) in a standard unit (g or ml) - /// - /// - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriments/energy-kcal`. - public var energy_hyphen_kcal: Swift.Double? - /// energy in kj, if it is specified - /// - /// (per 100g or per serving) in a standard unit (g or ml) - /// - /// - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriments/energy-kj`. - public var energy_hyphen_kj: Swift.Double? - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriments/fat`. - public var fat: Swift.Double? - /// An estimate, from the ingredients list of the percentage of fruits, vegetable and legumes. - /// This is an important information for Nutri-Score (2023 version) computation. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriments/fruits-vegetables-legumes-estimate-from-ingredients`. - public var fruits_hyphen_vegetables_hyphen_legumes_hyphen_estimate_hyphen_from_hyphen_ingredients: Swift.Double? - /// An estimate, from the ingredients list of the percentage of fruits, vegetable and nuts. - /// This is an important information for Nutri-Score (2021 version) computation. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriments/fruits-vegetables-nuts-estimate-from-ingredients`. - public var fruits_hyphen_vegetables_hyphen_nuts_hyphen_estimate_hyphen_from_hyphen_ingredients: Swift.Double? - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriments/nova-group`. - public var nova_hyphen_group: Swift.Int? - /// Experimental nutrition score derived from - /// the UK FSA score and adapted for the French market - /// (formula defined by the team of Professor Hercberg). - /// - /// - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriments/nutrition-score-fr`. - public var nutrition_hyphen_score_hyphen_fr: OpenAPIRuntime.OpenAPIValueContainer? - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriments/proteins`. - public var proteins: Swift.Double? - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriments/salt`. - public var salt: Swift.Double? - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriments/saturated-fat`. - public var saturated_hyphen_fat: Swift.Double? - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriments/sodium`. - public var sodium: Swift.Double? - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriments/sugars`. - public var sugars: Swift.Double? - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriments/carbon-footprint-from-known-ingredients_product`. - public var carbon_hyphen_footprint_hyphen_from_hyphen_known_hyphen_ingredients_product: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriments/carbon-footprint-from-known-ingredients_serving`. - public var carbon_hyphen_footprint_hyphen_from_hyphen_known_hyphen_ingredients_serving: Swift.Double? - /// erythritol is a polyol which is not providing any energy. - /// As such, it needs not be taken into account when computing - /// the energy of a product. Eryhtritol is now displayed on - /// nutrition facts sheet of some products, mainly in the USA. - /// This value is entered either by contributors, either by - /// imports. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriments/erythritol`. - public var erythritol: Swift.Double? - /// The standardized value for a serving or 100g (or 100ml for liquids), - /// depending on `nutrition_data_prepared_per` - /// for the nutrient for **prepared** product. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriments/nutrient_example`. - public var nutrient_example: Swift.Double? - /// Creates a new `nutrimentsPayload`. - /// - /// - Parameters: - /// - alcohol: Quantity of alcohol - /// - carbohydrates: - /// - energy: It is the same as `energy-kj` if we have it, or computed from `energy-kcal` otherwise - /// - energy_value: energy_value will be equal to energy-kj_value if we have it or to energy-kcal_value otherwise - /// - energy_unit: Equal to energy-kj_unit if we have it or to energy-kcal_unit otherwise - /// - energy_hyphen_kcal: energy in kcal, if it is specified - /// - energy_hyphen_kj: energy in kj, if it is specified - /// - fat: - /// - fruits_hyphen_vegetables_hyphen_legumes_hyphen_estimate_hyphen_from_hyphen_ingredients: An estimate, from the ingredients list of the percentage of fruits, vegetable and legumes. - /// - fruits_hyphen_vegetables_hyphen_nuts_hyphen_estimate_hyphen_from_hyphen_ingredients: An estimate, from the ingredients list of the percentage of fruits, vegetable and nuts. - /// - nova_hyphen_group: - /// - nutrition_hyphen_score_hyphen_fr: Experimental nutrition score derived from - /// - proteins: - /// - salt: - /// - saturated_hyphen_fat: - /// - sodium: - /// - sugars: - /// - carbon_hyphen_footprint_hyphen_from_hyphen_known_hyphen_ingredients_product: - /// - carbon_hyphen_footprint_hyphen_from_hyphen_known_hyphen_ingredients_serving: - /// - erythritol: erythritol is a polyol which is not providing any energy. - /// - nutrient_example: The standardized value for a serving or 100g (or 100ml for liquids), - public init( - alcohol: Swift.Double? = nil, - carbohydrates: Swift.Double? = nil, - energy: Swift.Double? = nil, - energy_value: Swift.Double? = nil, - energy_unit: Components.Schemas.product_nutrition.nutrimentsPayload.energy_unitPayload? = nil, - energy_hyphen_kcal: Swift.Double? = nil, - energy_hyphen_kj: Swift.Double? = nil, - fat: Swift.Double? = nil, - fruits_hyphen_vegetables_hyphen_legumes_hyphen_estimate_hyphen_from_hyphen_ingredients: Swift.Double? = nil, - fruits_hyphen_vegetables_hyphen_nuts_hyphen_estimate_hyphen_from_hyphen_ingredients: Swift.Double? = nil, - nova_hyphen_group: Swift.Int? = nil, - nutrition_hyphen_score_hyphen_fr: OpenAPIRuntime.OpenAPIValueContainer? = nil, - proteins: Swift.Double? = nil, - salt: Swift.Double? = nil, - saturated_hyphen_fat: Swift.Double? = nil, - sodium: Swift.Double? = nil, - sugars: Swift.Double? = nil, - carbon_hyphen_footprint_hyphen_from_hyphen_known_hyphen_ingredients_product: Swift.Int? = nil, - carbon_hyphen_footprint_hyphen_from_hyphen_known_hyphen_ingredients_serving: Swift.Double? = nil, - erythritol: Swift.Double? = nil, - nutrient_example: Swift.Double? = nil - ) { - self.alcohol = alcohol - self.carbohydrates = carbohydrates - self.energy = energy - self.energy_value = energy_value - self.energy_unit = energy_unit - self.energy_hyphen_kcal = energy_hyphen_kcal - self.energy_hyphen_kj = energy_hyphen_kj - self.fat = fat - self.fruits_hyphen_vegetables_hyphen_legumes_hyphen_estimate_hyphen_from_hyphen_ingredients = fruits_hyphen_vegetables_hyphen_legumes_hyphen_estimate_hyphen_from_hyphen_ingredients - self.fruits_hyphen_vegetables_hyphen_nuts_hyphen_estimate_hyphen_from_hyphen_ingredients = fruits_hyphen_vegetables_hyphen_nuts_hyphen_estimate_hyphen_from_hyphen_ingredients - self.nova_hyphen_group = nova_hyphen_group - self.nutrition_hyphen_score_hyphen_fr = nutrition_hyphen_score_hyphen_fr - self.proteins = proteins - self.salt = salt - self.saturated_hyphen_fat = saturated_hyphen_fat - self.sodium = sodium - self.sugars = sugars - self.carbon_hyphen_footprint_hyphen_from_hyphen_known_hyphen_ingredients_product = carbon_hyphen_footprint_hyphen_from_hyphen_known_hyphen_ingredients_product - self.carbon_hyphen_footprint_hyphen_from_hyphen_known_hyphen_ingredients_serving = carbon_hyphen_footprint_hyphen_from_hyphen_known_hyphen_ingredients_serving - self.erythritol = erythritol - self.nutrient_example = nutrient_example - } - public enum CodingKeys: String, CodingKey { - case alcohol - case carbohydrates - case energy - case energy_value - case energy_unit - case energy_hyphen_kcal = "energy-kcal" - case energy_hyphen_kj = "energy-kj" - case fat - case fruits_hyphen_vegetables_hyphen_legumes_hyphen_estimate_hyphen_from_hyphen_ingredients = "fruits-vegetables-legumes-estimate-from-ingredients" - case fruits_hyphen_vegetables_hyphen_nuts_hyphen_estimate_hyphen_from_hyphen_ingredients = "fruits-vegetables-nuts-estimate-from-ingredients" - case nova_hyphen_group = "nova-group" - case nutrition_hyphen_score_hyphen_fr = "nutrition-score-fr" - case proteins - case salt - case saturated_hyphen_fat = "saturated-fat" - case sodium - case sugars - case carbon_hyphen_footprint_hyphen_from_hyphen_known_hyphen_ingredients_product = "carbon-footprint-from-known-ingredients_product" - case carbon_hyphen_footprint_hyphen_from_hyphen_known_hyphen_ingredients_serving = "carbon-footprint-from-known-ingredients_serving" - case erythritol - case nutrient_example - } - } - /// All known nutrients for the product. - /// - /// Note that each nutrients are declined with a variety of suffixes like `_100g`, `_serving`, - /// see patternProperties below. - /// - /// A specific `_unit` is the unit used to measure the nutrient. - /// - /// Beware that some properties are to be interpreted based upon `nutrition_data_per` value. - /// - /// Also for products that have a nutrition table for prepared product - /// (eg. the nutrition facts for a bowl of milk with cocoa powder), - /// a `_prepared` suffix is added (before other suffixes). - /// - /// You can get all possible nutrients from the - /// [nutrients taxonomy](https://static.openfoodfacts.org/data/taxonomies/nutrients.json) - /// - /// **FIXME** add more nutrients with description. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriments`. - public var nutriments: Components.Schemas.product_nutrition.nutrimentsPayload? - /// Detail of data the Nutri-Score was computed upon. - /// - /// **Note**: this might not be stable, don't rely too much on this, or, at least, tell us ! - /// - /// **TODO** document each property - /// - /// - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data`. - public struct nutriscore_dataPayload: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/energy`. - public var energy: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/energy_points`. - public var energy_points: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/energy_value`. - public var energy_value: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/fiber`. - public var fiber: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/fiber_points`. - public var fiber_points: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/fiber_value`. - public var fiber_value: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/fruits_vegetables_nuts_colza_walnut_olive_oils`. - public var fruits_vegetables_nuts_colza_walnut_olive_oils: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/fruits_vegetables_nuts_colza_walnut_olive_oils_points`. - public var fruits_vegetables_nuts_colza_walnut_olive_oils_points: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/fruits_vegetables_nuts_colza_walnut_olive_oils_value`. - public var fruits_vegetables_nuts_colza_walnut_olive_oils_value: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/grade`. - public var grade: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/is_beverage`. - public var is_beverage: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/is_cheese`. - public var is_cheese: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/is_fat`. - public var is_fat: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/is_water`. - public var is_water: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/negative_points`. - public var negative_points: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/positive_points`. - public var positive_points: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/proteins`. - public var proteins: Swift.Double? - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/proteins_points`. - public var proteins_points: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/proteins_value`. - public var proteins_value: Swift.Double? - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/saturated_fat`. - public var saturated_fat: Swift.Double? - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/saturated_fat_points`. - public var saturated_fat_points: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/saturated_fat_ratio`. - public var saturated_fat_ratio: Swift.Double? - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/saturated_fat_ratio_points`. - public var saturated_fat_ratio_points: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/saturated_fat_ratio_value`. - public var saturated_fat_ratio_value: Swift.Double? - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/saturated_fat_value`. - public var saturated_fat_value: Swift.Double? - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/score`. - public var score: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/sodium`. - public var sodium: Swift.Double? - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/sodium_points`. - public var sodium_points: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/sodium_value`. - public var sodium_value: Swift.Double? - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/sugars`. - public var sugars: Swift.Double? - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/sugars_points`. - public var sugars_points: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data/sugars_value`. - public var sugars_value: Swift.Double? - /// Creates a new `nutriscore_dataPayload`. - /// - /// - Parameters: - /// - energy: - /// - energy_points: - /// - energy_value: - /// - fiber: - /// - fiber_points: - /// - fiber_value: - /// - fruits_vegetables_nuts_colza_walnut_olive_oils: - /// - fruits_vegetables_nuts_colza_walnut_olive_oils_points: - /// - fruits_vegetables_nuts_colza_walnut_olive_oils_value: - /// - grade: - /// - is_beverage: - /// - is_cheese: - /// - is_fat: - /// - is_water: - /// - negative_points: - /// - positive_points: - /// - proteins: - /// - proteins_points: - /// - proteins_value: - /// - saturated_fat: - /// - saturated_fat_points: - /// - saturated_fat_ratio: - /// - saturated_fat_ratio_points: - /// - saturated_fat_ratio_value: - /// - saturated_fat_value: - /// - score: - /// - sodium: - /// - sodium_points: - /// - sodium_value: - /// - sugars: - /// - sugars_points: - /// - sugars_value: - public init( - energy: Swift.Int? = nil, - energy_points: Swift.Int? = nil, - energy_value: Swift.Int? = nil, - fiber: Swift.Int? = nil, - fiber_points: Swift.Int? = nil, - fiber_value: Swift.Int? = nil, - fruits_vegetables_nuts_colza_walnut_olive_oils: Swift.Int? = nil, - fruits_vegetables_nuts_colza_walnut_olive_oils_points: Swift.Int? = nil, - fruits_vegetables_nuts_colza_walnut_olive_oils_value: Swift.Int? = nil, - grade: Swift.String? = nil, - is_beverage: Swift.Int? = nil, - is_cheese: Swift.Int? = nil, - is_fat: Swift.Int? = nil, - is_water: Swift.Int? = nil, - negative_points: Swift.Int? = nil, - positive_points: Swift.Int? = nil, - proteins: Swift.Double? = nil, - proteins_points: Swift.Int? = nil, - proteins_value: Swift.Double? = nil, - saturated_fat: Swift.Double? = nil, - saturated_fat_points: Swift.Int? = nil, - saturated_fat_ratio: Swift.Double? = nil, - saturated_fat_ratio_points: Swift.Int? = nil, - saturated_fat_ratio_value: Swift.Double? = nil, - saturated_fat_value: Swift.Double? = nil, - score: Swift.Int? = nil, - sodium: Swift.Double? = nil, - sodium_points: Swift.Int? = nil, - sodium_value: Swift.Double? = nil, - sugars: Swift.Double? = nil, - sugars_points: Swift.Int? = nil, - sugars_value: Swift.Double? = nil - ) { - self.energy = energy - self.energy_points = energy_points - self.energy_value = energy_value - self.fiber = fiber - self.fiber_points = fiber_points - self.fiber_value = fiber_value - self.fruits_vegetables_nuts_colza_walnut_olive_oils = fruits_vegetables_nuts_colza_walnut_olive_oils - self.fruits_vegetables_nuts_colza_walnut_olive_oils_points = fruits_vegetables_nuts_colza_walnut_olive_oils_points - self.fruits_vegetables_nuts_colza_walnut_olive_oils_value = fruits_vegetables_nuts_colza_walnut_olive_oils_value - self.grade = grade - self.is_beverage = is_beverage - self.is_cheese = is_cheese - self.is_fat = is_fat - self.is_water = is_water - self.negative_points = negative_points - self.positive_points = positive_points - self.proteins = proteins - self.proteins_points = proteins_points - self.proteins_value = proteins_value - self.saturated_fat = saturated_fat - self.saturated_fat_points = saturated_fat_points - self.saturated_fat_ratio = saturated_fat_ratio - self.saturated_fat_ratio_points = saturated_fat_ratio_points - self.saturated_fat_ratio_value = saturated_fat_ratio_value - self.saturated_fat_value = saturated_fat_value - self.score = score - self.sodium = sodium - self.sodium_points = sodium_points - self.sodium_value = sodium_value - self.sugars = sugars - self.sugars_points = sugars_points - self.sugars_value = sugars_value - } - public enum CodingKeys: String, CodingKey { - case energy - case energy_points - case energy_value - case fiber - case fiber_points - case fiber_value - case fruits_vegetables_nuts_colza_walnut_olive_oils - case fruits_vegetables_nuts_colza_walnut_olive_oils_points - case fruits_vegetables_nuts_colza_walnut_olive_oils_value - case grade - case is_beverage - case is_cheese - case is_fat - case is_water - case negative_points - case positive_points - case proteins - case proteins_points - case proteins_value - case saturated_fat - case saturated_fat_points - case saturated_fat_ratio - case saturated_fat_ratio_points - case saturated_fat_ratio_value - case saturated_fat_value - case score - case sodium - case sodium_points - case sodium_value - case sugars - case sugars_points - case sugars_value - } - } - /// Detail of data the Nutri-Score was computed upon. - /// - /// **Note**: this might not be stable, don't rely too much on this, or, at least, tell us ! - /// - /// **TODO** document each property - /// - /// - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_data`. - public var nutriscore_data: Components.Schemas.product_nutrition.nutriscore_dataPayload? - /// Nutri-Score for the product as a letter. - /// - /// See https://world.openfoodfacts.org/nutriscore. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_grade`. - @frozen public enum nutriscore_gradePayload: String, Codable, Hashable, Sendable, CaseIterable { - case a = "a" - case b = "b" - case c = "c" - case d = "d" - case e = "e" - } - /// Nutri-Score for the product as a letter. - /// - /// See https://world.openfoodfacts.org/nutriscore. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_grade`. - public var nutriscore_grade: Components.Schemas.product_nutrition.nutriscore_gradePayload? - /// Nutri-Score for the product as an integer (see also `nutriscore_grade`). - /// - /// - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_score`. - public var nutriscore_score: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutriscore_score_opposite`. - public var nutriscore_score_opposite: Swift.Int? - /// Nutrition grade (‘a’ to ‘e’), - /// https://world.openfoodfacts.org/nutriscore. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutrition_grade_fr`. - public var nutrition_grade_fr: Swift.String? - /// Nutrition grades as a comma separated list. - /// - /// Some products with multiple components might have multiple Nutri-Score - /// - /// - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutrition_grades`. - public var nutrition_grades: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutrition_grades_tags`. - public var nutrition_grades_tags: [Swift.String]? - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutrition_score_beverage`. - public var nutrition_score_beverage: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients`. - public var nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients_value`. - public var nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients_value: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_nutrition/nutrition_score_warning_no_fiber`. - public var nutrition_score_warning_no_fiber: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_nutrition/other_nutritional_substances_tags`. - public var other_nutritional_substances_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? - /// - Remark: Generated from `#/components/schemas/product_nutrition/unknown_nutrients_tags`. - public var unknown_nutrients_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? - /// - Remark: Generated from `#/components/schemas/product_nutrition/vitamins_tags`. - public var vitamins_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? - /// Creates a new `product_nutrition`. - /// - /// - Parameters: - /// - no_nutrition_data: When a product does not have nutrition data displayed on the - /// - nutrition_data_per: The nutrition data on the package can be per serving or per 100g. - /// - nutrition_data_prepared_per: The nutrition data for prepared product on the package (if any) can be per serving or per 100g. - /// - nutriments: All known nutrients for the product. - /// - nutriscore_data: Detail of data the Nutri-Score was computed upon. - /// - nutriscore_grade: Nutri-Score for the product as a letter. - /// - nutriscore_score: Nutri-Score for the product as an integer (see also `nutriscore_grade`). - /// - nutriscore_score_opposite: - /// - nutrition_grade_fr: Nutrition grade (‘a’ to ‘e’), - /// - nutrition_grades: Nutrition grades as a comma separated list. - /// - nutrition_grades_tags: - /// - nutrition_score_beverage: - /// - nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients: - /// - nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients_value: - /// - nutrition_score_warning_no_fiber: - /// - other_nutritional_substances_tags: - /// - unknown_nutrients_tags: - /// - vitamins_tags: - public init( - no_nutrition_data: Swift.String? = nil, - nutrition_data_per: Components.Schemas.product_nutrition.nutrition_data_perPayload? = nil, - nutrition_data_prepared_per: Components.Schemas.product_nutrition.nutrition_data_prepared_perPayload? = nil, - nutriments: Components.Schemas.product_nutrition.nutrimentsPayload? = nil, - nutriscore_data: Components.Schemas.product_nutrition.nutriscore_dataPayload? = nil, - nutriscore_grade: Components.Schemas.product_nutrition.nutriscore_gradePayload? = nil, - nutriscore_score: Swift.Int? = nil, - nutriscore_score_opposite: Swift.Int? = nil, - nutrition_grade_fr: Swift.String? = nil, - nutrition_grades: Swift.String? = nil, - nutrition_grades_tags: [Swift.String]? = nil, - nutrition_score_beverage: Swift.Int? = nil, - nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients: Swift.Int? = nil, - nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients_value: Swift.Int? = nil, - nutrition_score_warning_no_fiber: Swift.Int? = nil, - other_nutritional_substances_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? = nil, - unknown_nutrients_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? = nil, - vitamins_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? = nil - ) { - self.no_nutrition_data = no_nutrition_data - self.nutrition_data_per = nutrition_data_per - self.nutrition_data_prepared_per = nutrition_data_prepared_per - self.nutriments = nutriments - self.nutriscore_data = nutriscore_data - self.nutriscore_grade = nutriscore_grade - self.nutriscore_score = nutriscore_score - self.nutriscore_score_opposite = nutriscore_score_opposite - self.nutrition_grade_fr = nutrition_grade_fr - self.nutrition_grades = nutrition_grades - self.nutrition_grades_tags = nutrition_grades_tags - self.nutrition_score_beverage = nutrition_score_beverage - self.nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients = nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients - self.nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients_value = nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients_value - self.nutrition_score_warning_no_fiber = nutrition_score_warning_no_fiber - self.other_nutritional_substances_tags = other_nutritional_substances_tags - self.unknown_nutrients_tags = unknown_nutrients_tags - self.vitamins_tags = vitamins_tags - } - public enum CodingKeys: String, CodingKey { - case no_nutrition_data - case nutrition_data_per - case nutrition_data_prepared_per - case nutriments - case nutriscore_data - case nutriscore_grade - case nutriscore_score - case nutriscore_score_opposite - case nutrition_grade_fr - case nutrition_grades - case nutrition_grades_tags - case nutrition_score_beverage - case nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients - case nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients_value - case nutrition_score_warning_no_fiber - case other_nutritional_substances_tags - case unknown_nutrients_tags - case vitamins_tags - } - } - /// This is data that is linked to products data quality - /// - /// - /// - Remark: Generated from `#/components/schemas/product_quality`. - public struct product_quality: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/components/schemas/product_quality/data_quality_bugs_tags`. - public var data_quality_bugs_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? - /// - Remark: Generated from `#/components/schemas/product_quality/data_quality_errors_tags`. - public var data_quality_errors_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? - /// - Remark: Generated from `#/components/schemas/product_quality/data_quality_info_tags`. - public var data_quality_info_tags: [Swift.String]? - /// - Remark: Generated from `#/components/schemas/product_quality/data_quality_tags`. - public var data_quality_tags: [Swift.String]? - /// - Remark: Generated from `#/components/schemas/product_quality/data_quality_warnings_tags`. - public var data_quality_warnings_tags: [Swift.String]? - /// Source of data imported from producers. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_quality/data_sources`. - public var data_sources: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_quality/data_sources_tags`. - public var data_sources_tags: [Swift.String]? - /// - Remark: Generated from `#/components/schemas/product_quality/last_check_dates_tags`. - public var last_check_dates_tags: [Swift.String]? - /// - Remark: Generated from `#/components/schemas/product_quality/last_checked_t`. - public var last_checked_t: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_quality/last_checker`. - public var last_checker: Swift.String? - /// comma separated list of values indicating some states of the product, - /// like things to be done, or to be completed. - /// See [states taxonomy](https://static.openfoodfacts.net/data/taxonomies/states.json) - /// - /// - /// - Remark: Generated from `#/components/schemas/product_quality/states`. - public var states: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_quality/states_hierarchy`. - public var states_hierarchy: [Swift.String]? - /// - Remark: Generated from `#/components/schemas/product_quality/states_tags`. - public var states_tags: [Swift.String]? - /// Information about different aspect of the product - /// - /// - /// - Remark: Generated from `#/components/schemas/product_quality/misc_tags`. - public var misc_tags: [Swift.String]? - /// Creates a new `product_quality`. - /// - /// - Parameters: - /// - data_quality_bugs_tags: - /// - data_quality_errors_tags: - /// - data_quality_info_tags: - /// - data_quality_tags: - /// - data_quality_warnings_tags: - /// - data_sources: Source of data imported from producers. - /// - data_sources_tags: - /// - last_check_dates_tags: - /// - last_checked_t: - /// - last_checker: - /// - states: comma separated list of values indicating some states of the product, - /// - states_hierarchy: - /// - states_tags: - /// - misc_tags: Information about different aspect of the product - public init( - data_quality_bugs_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? = nil, - data_quality_errors_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? = nil, - data_quality_info_tags: [Swift.String]? = nil, - data_quality_tags: [Swift.String]? = nil, - data_quality_warnings_tags: [Swift.String]? = nil, - data_sources: Swift.String? = nil, - data_sources_tags: [Swift.String]? = nil, - last_check_dates_tags: [Swift.String]? = nil, - last_checked_t: Swift.Int? = nil, - last_checker: Swift.String? = nil, - states: Swift.String? = nil, - states_hierarchy: [Swift.String]? = nil, - states_tags: [Swift.String]? = nil, - misc_tags: [Swift.String]? = nil - ) { - self.data_quality_bugs_tags = data_quality_bugs_tags - self.data_quality_errors_tags = data_quality_errors_tags - self.data_quality_info_tags = data_quality_info_tags - self.data_quality_tags = data_quality_tags - self.data_quality_warnings_tags = data_quality_warnings_tags - self.data_sources = data_sources - self.data_sources_tags = data_sources_tags - self.last_check_dates_tags = last_check_dates_tags - self.last_checked_t = last_checked_t - self.last_checker = last_checker - self.states = states - self.states_hierarchy = states_hierarchy - self.states_tags = states_tags - self.misc_tags = misc_tags - } - public enum CodingKeys: String, CodingKey { - case data_quality_bugs_tags - case data_quality_errors_tags - case data_quality_info_tags - case data_quality_tags - case data_quality_warnings_tags - case data_sources - case data_sources_tags - case last_check_dates_tags - case last_checked_t - case last_checker - case states - case states_hierarchy - case states_tags - case misc_tags - } - } - /// - Remark: Generated from `#/components/schemas/product_extended`. - public struct product_extended: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/components/schemas/product_extended/additives_original_tags`. - public var additives_original_tags: [Swift.String]? - /// - Remark: Generated from `#/components/schemas/product_extended/additives_prev_original_tags`. - public var additives_prev_original_tags: [Swift.String]? - /// - Remark: Generated from `#/components/schemas/product_extended/added_countries_tags`. - public var added_countries_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? - /// - Remark: Generated from `#/components/schemas/product_extended/allergens_from_ingredients`. - public var allergens_from_ingredients: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_extended/allergens_from_user`. - public var allergens_from_user: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_extended/amino_acids_prev_tags`. - public var amino_acids_prev_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? - /// - Remark: Generated from `#/components/schemas/product_extended/amino_acids_tags`. - public var amino_acids_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? - /// - Remark: Generated from `#/components/schemas/product_extended/carbon_footprint_percent_of_known_ingredients`. - public var carbon_footprint_percent_of_known_ingredients: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_extended/categories_properties`. - public struct categories_propertiesPayload: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/components/schemas/product_extended/categories_properties/agribalyse_food_code:en`. - public var agribalyse_food_code_colon_en: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_extended/categories_properties/agribalyse_proxy_food_code:en`. - public var agribalyse_proxy_food_code_colon_en: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_extended/categories_properties/ciqual_food_code:en`. - public var ciqual_food_code_colon_en: Swift.String? - /// Creates a new `categories_propertiesPayload`. - /// - /// - Parameters: - /// - agribalyse_food_code_colon_en: - /// - agribalyse_proxy_food_code_colon_en: - /// - ciqual_food_code_colon_en: - public init( - agribalyse_food_code_colon_en: Swift.String? = nil, - agribalyse_proxy_food_code_colon_en: Swift.String? = nil, - ciqual_food_code_colon_en: Swift.String? = nil - ) { - self.agribalyse_food_code_colon_en = agribalyse_food_code_colon_en - self.agribalyse_proxy_food_code_colon_en = agribalyse_proxy_food_code_colon_en - self.ciqual_food_code_colon_en = ciqual_food_code_colon_en - } - public enum CodingKeys: String, CodingKey { - case agribalyse_food_code_colon_en = "agribalyse_food_code:en" - case agribalyse_proxy_food_code_colon_en = "agribalyse_proxy_food_code:en" - case ciqual_food_code_colon_en = "ciqual_food_code:en" - } - } - /// - Remark: Generated from `#/components/schemas/product_extended/categories_properties`. - public var categories_properties: Components.Schemas.product_extended.categories_propertiesPayload? - /// - Remark: Generated from `#/components/schemas/product_extended/categories_properties_tags`. - public var categories_properties_tags: [Swift.String]? - /// - Remark: Generated from `#/components/schemas/product_extended/category_properties`. - public struct category_propertiesPayload: Codable, Hashable, Sendable { - /// A container of undocumented properties. - public var additionalProperties: [String: Swift.String] - /// Creates a new `category_propertiesPayload`. - /// - /// - Parameters: - /// - additionalProperties: A container of undocumented properties. - public init(additionalProperties: [String: Swift.String] = .init()) { - self.additionalProperties = additionalProperties - } - public init(from decoder: any Decoder) throws { - additionalProperties = try decoder.decodeAdditionalProperties(knownKeys: []) - } - public func encode(to encoder: any Encoder) throws { - try encoder.encodeAdditionalProperties(additionalProperties) - } - } - /// - Remark: Generated from `#/components/schemas/product_extended/category_properties`. - public var category_properties: Components.Schemas.product_extended.category_propertiesPayload? - /// - Remark: Generated from `#/components/schemas/product_extended/ciqual_food_name_tags`. - public var ciqual_food_name_tags: [Swift.String]? - /// the category to use for comparison. - /// - /// **TODO** explain how it is chosen. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_extended/compared_to_category`. - public var compared_to_category: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_extended/conservation_conditions`. - public var conservation_conditions: Swift.String? - /// Contact info of customer service. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_extended/customer_service`. - public var customer_service: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_extended/expiration_date`. - public var expiration_date: Swift.String? - /// link to the product on the website of the producer - /// - /// - /// - Remark: Generated from `#/components/schemas/product_extended/link`. - public var link: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_extended/main_countries_tags`. - public var main_countries_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? - /// - Remark: Generated from `#/components/schemas/product_extended/minerals_prev_tags`. - public var minerals_prev_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? - /// - Remark: Generated from `#/components/schemas/product_extended/minerals_tags`. - public var minerals_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? - /// Those are fields provided by the producer (through producers platform), - /// and the value he provided. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_extended/owner_fields`. - public struct owner_fieldsPayload: Codable, Hashable, Sendable { - /// you can retrieve all kind of properties, the same as on the parent object (the product). - /// It's not processed entries (like tags for example) but raw ones. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_extended/owner_fields/additionalProperties`. - @frozen public enum additionalPropertiesPayload: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/components/schemas/product_extended/owner_fields/additionalProperties/case1`. - case case1(Swift.Int) - /// - Remark: Generated from `#/components/schemas/product_extended/owner_fields/additionalProperties/case2`. - case case2(Swift.String) - /// - Remark: Generated from `#/components/schemas/product_extended/owner_fields/additionalProperties/case3`. - case case3(OpenAPIRuntime.OpenAPIObjectContainer) - public init(from decoder: any Decoder) throws { - var errors: [any Error] = [] - do { - self = .case1(try decoder.decodeFromSingleValueContainer()) - return - } catch { - errors.append(error) - } - do { - self = .case2(try decoder.decodeFromSingleValueContainer()) - return - } catch { - errors.append(error) - } - do { - self = .case3(try .init(from: decoder)) - return - } catch { - errors.append(error) - } - throw Swift.DecodingError.failedToDecodeOneOfSchema( - type: Self.self, - codingPath: decoder.codingPath, - errors: errors - ) - } - public func encode(to encoder: any Encoder) throws { - switch self { - case let .case1(value): - try encoder.encodeToSingleValueContainer(value) - case let .case2(value): - try encoder.encodeToSingleValueContainer(value) - case let .case3(value): - try value.encode(to: encoder) - } - } - } - /// you can retrieve all kind of properties, the same as on the parent object (the product). - /// It's not processed entries (like tags for example) but raw ones. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_extended/owner_fields/additionalProperties`. - public var additionalProperties: Components.Schemas.product_extended.owner_fieldsPayload.additionalPropertiesPayload? - /// Creates a new `owner_fieldsPayload`. - /// - /// - Parameters: - /// - additionalProperties: you can retrieve all kind of properties, the same as on the parent object (the product). - public init(additionalProperties: Components.Schemas.product_extended.owner_fieldsPayload.additionalPropertiesPayload? = nil) { - self.additionalProperties = additionalProperties - } - public enum CodingKeys: String, CodingKey { - case additionalProperties - } - } - /// Those are fields provided by the producer (through producers platform), - /// and the value he provided. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_extended/owner_fields`. - public var owner_fields: Components.Schemas.product_extended.owner_fieldsPayload? - /// Detail of ingredients or processing that makes the products having Nova 3 or 4 - /// - /// - /// - Remark: Generated from `#/components/schemas/product_extended/nova_groups_markers`. - public struct nova_groups_markersPayload: Codable, Hashable, Sendable { - /// Markers of level 3 - /// - /// - /// - Remark: Generated from `#/components/schemas/product_extended/nova_groups_markers/3`. - public var _3: [[Swift.String]]? - /// Markers of level 4 - /// - /// - /// - Remark: Generated from `#/components/schemas/product_extended/nova_groups_markers/4`. - public var _4: OpenAPIRuntime.OpenAPIArrayContainer? - /// Creates a new `nova_groups_markersPayload`. - /// - /// - Parameters: - /// - _3: Markers of level 3 - /// - _4: Markers of level 4 - public init( - _3: [[Swift.String]]? = nil, - _4: OpenAPIRuntime.OpenAPIArrayContainer? = nil - ) { - self._3 = _3 - self._4 = _4 - } - public enum CodingKeys: String, CodingKey { - case _3 = "3" - case _4 = "4" - } - } - /// Detail of ingredients or processing that makes the products having Nova 3 or 4 - /// - /// - /// - Remark: Generated from `#/components/schemas/product_extended/nova_groups_markers`. - public var nova_groups_markers: Components.Schemas.product_extended.nova_groups_markersPayload? - /// - Remark: Generated from `#/components/schemas/product_extended/nucleotides_tags`. - public var nucleotides_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? - /// - Remark: Generated from `#/components/schemas/product_extended/origin`. - public var origin: Swift.String? - /// Country, state, or city where the product can be purchased. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_extended/purchase_places`. - public var purchase_places: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_extended/purchase_places_tags`. - public var purchase_places_tags: [Swift.String]? - /// Distributor name. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_extended/stores`. - public var stores: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_extended/stores_tags`. - public var stores_tags: [Swift.String]? - /// - Remark: Generated from `#/components/schemas/product_extended/traces_from_ingredients`. - public var traces_from_ingredients: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_extended/traces_from_user`. - public var traces_from_user: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_extended/conservation_conditions_(?\w\w)`. - public var conservation_conditions__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_extended/customer_service_(?\w\w)`. - public var customer_service__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: Swift.String? - /// `origin` in language indicated by `language_code` - /// - /// - /// - Remark: Generated from `#/components/schemas/product_extended/origin_(?\w\w)`. - public var origin__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: Swift.String? - /// Creates a new `product_extended`. - /// - /// - Parameters: - /// - additives_original_tags: - /// - additives_prev_original_tags: - /// - added_countries_tags: - /// - allergens_from_ingredients: - /// - allergens_from_user: - /// - amino_acids_prev_tags: - /// - amino_acids_tags: - /// - carbon_footprint_percent_of_known_ingredients: - /// - categories_properties: - /// - categories_properties_tags: - /// - category_properties: - /// - ciqual_food_name_tags: - /// - compared_to_category: the category to use for comparison. - /// - conservation_conditions: - /// - customer_service: Contact info of customer service. - /// - expiration_date: - /// - link: link to the product on the website of the producer - /// - main_countries_tags: - /// - minerals_prev_tags: - /// - minerals_tags: - /// - owner_fields: Those are fields provided by the producer (through producers platform), - /// - nova_groups_markers: Detail of ingredients or processing that makes the products having Nova 3 or 4 - /// - nucleotides_tags: - /// - origin: - /// - purchase_places: Country, state, or city where the product can be purchased. - /// - purchase_places_tags: - /// - stores: Distributor name. - /// - stores_tags: - /// - traces_from_ingredients: - /// - traces_from_user: - /// - conservation_conditions__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: - /// - customer_service__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: - /// - origin__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: `origin` in language indicated by `language_code` - public init( - additives_original_tags: [Swift.String]? = nil, - additives_prev_original_tags: [Swift.String]? = nil, - added_countries_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? = nil, - allergens_from_ingredients: Swift.String? = nil, - allergens_from_user: Swift.String? = nil, - amino_acids_prev_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? = nil, - amino_acids_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? = nil, - carbon_footprint_percent_of_known_ingredients: Swift.Int? = nil, - categories_properties: Components.Schemas.product_extended.categories_propertiesPayload? = nil, - categories_properties_tags: [Swift.String]? = nil, - category_properties: Components.Schemas.product_extended.category_propertiesPayload? = nil, - ciqual_food_name_tags: [Swift.String]? = nil, - compared_to_category: Swift.String? = nil, - conservation_conditions: Swift.String? = nil, - customer_service: Swift.String? = nil, - expiration_date: Swift.String? = nil, - link: Swift.String? = nil, - main_countries_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? = nil, - minerals_prev_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? = nil, - minerals_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? = nil, - owner_fields: Components.Schemas.product_extended.owner_fieldsPayload? = nil, - nova_groups_markers: Components.Schemas.product_extended.nova_groups_markersPayload? = nil, - nucleotides_tags: [OpenAPIRuntime.OpenAPIObjectContainer]? = nil, - origin: Swift.String? = nil, - purchase_places: Swift.String? = nil, - purchase_places_tags: [Swift.String]? = nil, - stores: Swift.String? = nil, - stores_tags: [Swift.String]? = nil, - traces_from_ingredients: Swift.String? = nil, - traces_from_user: Swift.String? = nil, - conservation_conditions__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: Swift.String? = nil, - customer_service__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: Swift.String? = nil, - origin__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_: Swift.String? = nil - ) { - self.additives_original_tags = additives_original_tags - self.additives_prev_original_tags = additives_prev_original_tags - self.added_countries_tags = added_countries_tags - self.allergens_from_ingredients = allergens_from_ingredients - self.allergens_from_user = allergens_from_user - self.amino_acids_prev_tags = amino_acids_prev_tags - self.amino_acids_tags = amino_acids_tags - self.carbon_footprint_percent_of_known_ingredients = carbon_footprint_percent_of_known_ingredients - self.categories_properties = categories_properties - self.categories_properties_tags = categories_properties_tags - self.category_properties = category_properties - self.ciqual_food_name_tags = ciqual_food_name_tags - self.compared_to_category = compared_to_category - self.conservation_conditions = conservation_conditions - self.customer_service = customer_service - self.expiration_date = expiration_date - self.link = link - self.main_countries_tags = main_countries_tags - self.minerals_prev_tags = minerals_prev_tags - self.minerals_tags = minerals_tags - self.owner_fields = owner_fields - self.nova_groups_markers = nova_groups_markers - self.nucleotides_tags = nucleotides_tags - self.origin = origin - self.purchase_places = purchase_places - self.purchase_places_tags = purchase_places_tags - self.stores = stores - self.stores_tags = stores_tags - self.traces_from_ingredients = traces_from_ingredients - self.traces_from_user = traces_from_user - self.conservation_conditions__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ = conservation_conditions__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ - self.customer_service__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ = customer_service__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ - self.origin__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ = origin__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ - } - public enum CodingKeys: String, CodingKey { - case additives_original_tags - case additives_prev_original_tags - case added_countries_tags - case allergens_from_ingredients - case allergens_from_user - case amino_acids_prev_tags - case amino_acids_tags - case carbon_footprint_percent_of_known_ingredients - case categories_properties - case categories_properties_tags - case category_properties - case ciqual_food_name_tags - case compared_to_category - case conservation_conditions - case customer_service - case expiration_date - case link - case main_countries_tags - case minerals_prev_tags - case minerals_tags - case owner_fields - case nova_groups_markers - case nucleotides_tags - case origin - case purchase_places - case purchase_places_tags - case stores - case stores_tags - case traces_from_ingredients - case traces_from_user - case conservation_conditions__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ = #"conservation_conditions_(?\w\w)"# - case customer_service__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ = #"customer_service_(?\w\w)"# - case origin__lpar__quest__lt_language_code_gt__bsol_w_bsol_w_rpar_ = #"origin_(?\w\w)"# - } - } - /// Metadata of a product (author, editors, creation date, etc.) - /// - /// - /// - Remark: Generated from `#/components/schemas/product_meta`. - public struct product_meta: Codable, Hashable, Sendable { - /// Date when the product was added (UNIX timestamp format). - /// See also `entry_dates_tags` - /// - /// - /// - Remark: Generated from `#/components/schemas/product_meta/created_t`. - public var created_t: Swift.Int? - /// The contributor who added the product first. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_meta/creator`. - public var creator: Swift.String? - /// List of editors who edited the product. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_meta/editors_tags`. - public var editors_tags: [Swift.String]? - /// - Remark: Generated from `#/components/schemas/product_meta/informers_tags`. - public var informers_tags: [Swift.String]? - /// - Remark: Generated from `#/components/schemas/product_meta/interface_version_created`. - public var interface_version_created: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_meta/interface_version_modified`. - public var interface_version_modified: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_meta/languages`. - public struct languagesPayload: Codable, Hashable, Sendable { - /// **TODO** explain ! - /// - /// - /// - Remark: Generated from `#/components/schemas/product_meta/languages/en:(?\w\w)`. - public var en_colon__lpar__quest__lt_language_name_gt__bsol_w_bsol_w_rpar_: Swift.Int? - /// Creates a new `languagesPayload`. - /// - /// - Parameters: - /// - en_colon__lpar__quest__lt_language_name_gt__bsol_w_bsol_w_rpar_: **TODO** explain ! - public init(en_colon__lpar__quest__lt_language_name_gt__bsol_w_bsol_w_rpar_: Swift.Int? = nil) { - self.en_colon__lpar__quest__lt_language_name_gt__bsol_w_bsol_w_rpar_ = en_colon__lpar__quest__lt_language_name_gt__bsol_w_bsol_w_rpar_ - } - public enum CodingKeys: String, CodingKey { - case en_colon__lpar__quest__lt_language_name_gt__bsol_w_bsol_w_rpar_ = #"en:(?\w\w)"# - } - } - /// - Remark: Generated from `#/components/schemas/product_meta/languages`. - public var languages: Components.Schemas.product_meta.languagesPayload? - /// Same as `languages` but by language code, instead of language tags - /// - /// - /// - Remark: Generated from `#/components/schemas/product_meta/languages_codes`. - public struct languages_codesPayload: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/components/schemas/product_meta/languages_codes/language_code_example`. - public var language_code_example: Swift.Int? - /// Creates a new `languages_codesPayload`. - /// - /// - Parameters: - /// - language_code_example: - public init(language_code_example: Swift.Int? = nil) { - self.language_code_example = language_code_example - } - public enum CodingKeys: String, CodingKey { - case language_code_example - } - } - /// Same as `languages` but by language code, instead of language tags - /// - /// - /// - Remark: Generated from `#/components/schemas/product_meta/languages_codes`. - public var languages_codes: Components.Schemas.product_meta.languages_codesPayload? - /// - Remark: Generated from `#/components/schemas/product_meta/languages_hierarchy`. - public var languages_hierarchy: [Swift.String]? - /// - Remark: Generated from `#/components/schemas/product_meta/languages_tags`. - public var languages_tags: [Swift.String]? - /// - Remark: Generated from `#/components/schemas/product_meta/last_edit_dates_tags`. - public var last_edit_dates_tags: [Swift.String]? - /// - Remark: Generated from `#/components/schemas/product_meta/last_editor`. - public var last_editor: Swift.String? - /// The username of the user who last modified the product. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_meta/last_modified_by`. - public var last_modified_by: Swift.String? - /// Date when the product page was last modified. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_meta/last_modified_t`. - public var last_modified_t: Swift.Int? - /// Id of the producer in case he provides his own data about a product (producer platform). - /// - /// - /// - Remark: Generated from `#/components/schemas/product_meta/owner`. - public var owner: Swift.String? - /// Tagyfied version of owner - /// - /// - /// - Remark: Generated from `#/components/schemas/product_meta/owners_tags`. - public var owners_tags: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_meta/photographers_tags`. - public var photographers_tags: [Swift.String]? - /// revision number of this product version (each edit adds a revision) - /// - /// - Remark: Generated from `#/components/schemas/product_meta/rev`. - public var rev: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_meta/sourcesPayload`. - public struct sourcesPayloadPayload: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/components/schemas/product_meta/sourcesPayload/fields`. - public var fields: [Swift.String]? - /// - Remark: Generated from `#/components/schemas/product_meta/sourcesPayload/id`. - public var id: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_meta/sourcesPayload/images`. - public var images: [OpenAPIRuntime.OpenAPIObjectContainer]? - /// - Remark: Generated from `#/components/schemas/product_meta/sourcesPayload/import_t`. - public var import_t: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_meta/sourcesPayload/manufacturer`. - public var manufacturer: Swift.Int? - /// - Remark: Generated from `#/components/schemas/product_meta/sourcesPayload/name`. - public var name: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_meta/sourcesPayload/source_licence`. - public var source_licence: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_meta/sourcesPayload/source_licence_url`. - public var source_licence_url: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_meta/sourcesPayload/url`. - public var url: Swift.String? - /// Creates a new `sourcesPayloadPayload`. - /// - /// - Parameters: - /// - fields: - /// - id: - /// - images: - /// - import_t: - /// - manufacturer: - /// - name: - /// - source_licence: - /// - source_licence_url: - /// - url: - public init( - fields: [Swift.String]? = nil, - id: Swift.String? = nil, - images: [OpenAPIRuntime.OpenAPIObjectContainer]? = nil, - import_t: Swift.Int? = nil, - manufacturer: Swift.Int? = nil, - name: Swift.String? = nil, - source_licence: Swift.String? = nil, - source_licence_url: Swift.String? = nil, - url: Swift.String? = nil - ) { - self.fields = fields - self.id = id - self.images = images - self.import_t = import_t - self.manufacturer = manufacturer - self.name = name - self.source_licence = source_licence - self.source_licence_url = source_licence_url - self.url = url - } - public enum CodingKeys: String, CodingKey { - case fields - case id - case images - case import_t - case manufacturer - case name - case source_licence - case source_licence_url - case url - } - } - /// - Remark: Generated from `#/components/schemas/product_meta/sources`. - public typealias sourcesPayload = [Components.Schemas.product_meta.sourcesPayloadPayload] - /// - Remark: Generated from `#/components/schemas/product_meta/sources`. - public var sources: Components.Schemas.product_meta.sourcesPayload? - /// - Remark: Generated from `#/components/schemas/product_meta/sources_fields`. - public struct sources_fieldsPayload: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/components/schemas/product_meta/sources_fields/org-gs1`. - public struct org_hyphen_gs1Payload: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/components/schemas/product_meta/sources_fields/org-gs1/gln`. - public var gln: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_meta/sources_fields/org-gs1/gpcCategoryCode`. - public var gpcCategoryCode: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_meta/sources_fields/org-gs1/gpcCategoryName`. - public var gpcCategoryName: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_meta/sources_fields/org-gs1/isAllergenRelevantDataProvided`. - public var isAllergenRelevantDataProvided: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_meta/sources_fields/org-gs1/lastChangeDateTime`. - public var lastChangeDateTime: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_meta/sources_fields/org-gs1/partyName`. - public var partyName: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_meta/sources_fields/org-gs1/productionVariantDescription`. - public var productionVariantDescription: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_meta/sources_fields/org-gs1/publicationDateTime`. - public var publicationDateTime: Swift.String? - /// Creates a new `org_hyphen_gs1Payload`. - /// - /// - Parameters: - /// - gln: - /// - gpcCategoryCode: - /// - gpcCategoryName: - /// - isAllergenRelevantDataProvided: - /// - lastChangeDateTime: - /// - partyName: - /// - productionVariantDescription: - /// - publicationDateTime: - public init( - gln: Swift.String? = nil, - gpcCategoryCode: Swift.String? = nil, - gpcCategoryName: Swift.String? = nil, - isAllergenRelevantDataProvided: Swift.String? = nil, - lastChangeDateTime: Swift.String? = nil, - partyName: Swift.String? = nil, - productionVariantDescription: Swift.String? = nil, - publicationDateTime: Swift.String? = nil - ) { - self.gln = gln - self.gpcCategoryCode = gpcCategoryCode - self.gpcCategoryName = gpcCategoryName - self.isAllergenRelevantDataProvided = isAllergenRelevantDataProvided - self.lastChangeDateTime = lastChangeDateTime - self.partyName = partyName - self.productionVariantDescription = productionVariantDescription - self.publicationDateTime = publicationDateTime - } - public enum CodingKeys: String, CodingKey { - case gln - case gpcCategoryCode - case gpcCategoryName - case isAllergenRelevantDataProvided - case lastChangeDateTime - case partyName - case productionVariantDescription - case publicationDateTime - } - } - /// - Remark: Generated from `#/components/schemas/product_meta/sources_fields/org-gs1`. - public var org_hyphen_gs1: Components.Schemas.product_meta.sources_fieldsPayload.org_hyphen_gs1Payload? - /// Creates a new `sources_fieldsPayload`. - /// - /// - Parameters: - /// - org_hyphen_gs1: - public init(org_hyphen_gs1: Components.Schemas.product_meta.sources_fieldsPayload.org_hyphen_gs1Payload? = nil) { - self.org_hyphen_gs1 = org_hyphen_gs1 - } - public enum CodingKeys: String, CodingKey { - case org_hyphen_gs1 = "org-gs1" - } - } - /// - Remark: Generated from `#/components/schemas/product_meta/sources_fields`. - public var sources_fields: Components.Schemas.product_meta.sources_fieldsPayload? - /// - Remark: Generated from `#/components/schemas/product_meta/teams`. - public var teams: Swift.String? - /// - Remark: Generated from `#/components/schemas/product_meta/teams_tags`. - public var teams_tags: [Swift.String]? - /// - Remark: Generated from `#/components/schemas/product_meta/update_key`. - public var update_key: Swift.String? - /// Creates a new `product_meta`. - /// - /// - Parameters: - /// - created_t: Date when the product was added (UNIX timestamp format). - /// - creator: The contributor who added the product first. - /// - editors_tags: List of editors who edited the product. - /// - informers_tags: - /// - interface_version_created: - /// - interface_version_modified: - /// - languages: - /// - languages_codes: Same as `languages` but by language code, instead of language tags - /// - languages_hierarchy: - /// - languages_tags: - /// - last_edit_dates_tags: - /// - last_editor: - /// - last_modified_by: The username of the user who last modified the product. - /// - last_modified_t: Date when the product page was last modified. - /// - owner: Id of the producer in case he provides his own data about a product (producer platform). - /// - owners_tags: Tagyfied version of owner - /// - photographers_tags: - /// - rev: revision number of this product version (each edit adds a revision) - /// - sources: - /// - sources_fields: - /// - teams: - /// - teams_tags: - /// - update_key: - public init( - created_t: Swift.Int? = nil, - creator: Swift.String? = nil, - editors_tags: [Swift.String]? = nil, - informers_tags: [Swift.String]? = nil, - interface_version_created: Swift.String? = nil, - interface_version_modified: Swift.String? = nil, - languages: Components.Schemas.product_meta.languagesPayload? = nil, - languages_codes: Components.Schemas.product_meta.languages_codesPayload? = nil, - languages_hierarchy: [Swift.String]? = nil, - languages_tags: [Swift.String]? = nil, - last_edit_dates_tags: [Swift.String]? = nil, - last_editor: Swift.String? = nil, - last_modified_by: Swift.String? = nil, - last_modified_t: Swift.Int? = nil, - owner: Swift.String? = nil, - owners_tags: Swift.String? = nil, - photographers_tags: [Swift.String]? = nil, - rev: Swift.Int? = nil, - sources: Components.Schemas.product_meta.sourcesPayload? = nil, - sources_fields: Components.Schemas.product_meta.sources_fieldsPayload? = nil, - teams: Swift.String? = nil, - teams_tags: [Swift.String]? = nil, - update_key: Swift.String? = nil - ) { - self.created_t = created_t - self.creator = creator - self.editors_tags = editors_tags - self.informers_tags = informers_tags - self.interface_version_created = interface_version_created - self.interface_version_modified = interface_version_modified - self.languages = languages - self.languages_codes = languages_codes - self.languages_hierarchy = languages_hierarchy - self.languages_tags = languages_tags - self.last_edit_dates_tags = last_edit_dates_tags - self.last_editor = last_editor - self.last_modified_by = last_modified_by - self.last_modified_t = last_modified_t - self.owner = owner - self.owners_tags = owners_tags - self.photographers_tags = photographers_tags - self.rev = rev - self.sources = sources - self.sources_fields = sources_fields - self.teams = teams - self.teams_tags = teams_tags - self.update_key = update_key - } - public enum CodingKeys: String, CodingKey { - case created_t - case creator - case editors_tags - case informers_tags - case interface_version_created - case interface_version_modified - case languages - case languages_codes - case languages_hierarchy - case languages_tags - case last_edit_dates_tags - case last_editor - case last_modified_by - case last_modified_t - case owner - case owners_tags - case photographers_tags - case rev - case sources - case sources_fields - case teams - case teams_tags - case update_key - } - } - /// The title of a panel. - /// - /// - Remark: Generated from `#/components/schemas/title_element`. - public struct title_element: Codable, Hashable, Sendable { - /// A short name of this panel, not including any actual values - /// - /// - Remark: Generated from `#/components/schemas/title_element/name`. - public var name: Swift.String? - /// - Remark: Generated from `#/components/schemas/title_element/title`. - public var title: Swift.String? - /// Used to indicate how the value of this item is measured, such as "grade" for Nutri-Score and Eco-Score or "percentage" for Salt - /// - /// - Remark: Generated from `#/components/schemas/title_element/type`. - @frozen public enum _typePayload: String, Codable, Hashable, Sendable, CaseIterable { - case grade = "grade" - case percentage = "percentage" - } - /// Used to indicate how the value of this item is measured, such as "grade" for Nutri-Score and Eco-Score or "percentage" for Salt - /// - /// - Remark: Generated from `#/components/schemas/title_element/type`. - public var _type: Components.Schemas.title_element._typePayload? - /// The value for this panel where it corresponds to a A to E grade such as the Nutri-Score of the Eco-Score. - /// - /// - Remark: Generated from `#/components/schemas/title_element/grade`. - @frozen public enum gradePayload: String, Codable, Hashable, Sendable, CaseIterable { - case a = "a" - case b = "b" - case c = "c" - case d = "d" - case e = "e" - case unknown = "unknown" - } - /// The value for this panel where it corresponds to a A to E grade such as the Nutri-Score of the Eco-Score. - /// - /// - Remark: Generated from `#/components/schemas/title_element/grade`. - public var grade: Components.Schemas.title_element.gradePayload? - /// The numeric value of the panel, where the type is "percentage" - /// - /// - Remark: Generated from `#/components/schemas/title_element/value`. - public var value: Swift.Double? - /// - Remark: Generated from `#/components/schemas/title_element/icon_url`. - public var icon_url: Swift.String? - /// - Remark: Generated from `#/components/schemas/title_element/icon_color_from_evaluation`. - public var icon_color_from_evaluation: Swift.String? - /// If set to "small", the icon should be displayed at a small size. - /// - /// - /// - Remark: Generated from `#/components/schemas/title_element/icon_size`. - public var icon_size: Swift.String? - /// Creates a new `title_element`. - /// - /// - Parameters: - /// - name: A short name of this panel, not including any actual values - /// - title: - /// - _type: Used to indicate how the value of this item is measured, such as "grade" for Nutri-Score and Eco-Score or "percentage" for Salt - /// - grade: The value for this panel where it corresponds to a A to E grade such as the Nutri-Score of the Eco-Score. - /// - value: The numeric value of the panel, where the type is "percentage" - /// - icon_url: - /// - icon_color_from_evaluation: - /// - icon_size: If set to "small", the icon should be displayed at a small size. - public init( - name: Swift.String? = nil, - title: Swift.String? = nil, - _type: Components.Schemas.title_element._typePayload? = nil, - grade: Components.Schemas.title_element.gradePayload? = nil, - value: Swift.Double? = nil, - icon_url: Swift.String? = nil, - icon_color_from_evaluation: Swift.String? = nil, - icon_size: Swift.String? = nil - ) { - self.name = name - self.title = title - self._type = _type - self.grade = grade - self.value = value - self.icon_url = icon_url - self.icon_color_from_evaluation = icon_color_from_evaluation - self.icon_size = icon_size - } - public enum CodingKeys: String, CodingKey { - case name - case title - case _type = "type" - case grade - case value - case icon_url - case icon_color_from_evaluation - case icon_size - } - } - /// A text in simple HTML format to display. - /// - /// For some specific texts that correspond to a product field (e.g. a product name, the ingredients list of a product),the edit_field_* fields are used to indicate how to edit the field value. - /// - /// - Remark: Generated from `#/components/schemas/text_element`. - public struct text_element: Codable, Hashable, Sendable { - /// the type of text, might influence the way you display it. - /// - /// - /// - Remark: Generated from `#/components/schemas/text_element/type`. - @frozen public enum _typePayload: String, Codable, Hashable, Sendable, CaseIterable { - case summary = "summary" - case warning = "warning" - case notes = "notes" - } - /// the type of text, might influence the way you display it. - /// - /// - /// - Remark: Generated from `#/components/schemas/text_element/type`. - public var _type: Components.Schemas.text_element._typePayload? - /// Text to display in HTML format. - /// - /// - Remark: Generated from `#/components/schemas/text_element/html`. - public var html: Swift.String? - /// Language of the text. The name of the language is returned in the language requested when making the API call. e.g. if the text is in Polish, and the requested language is French, the language field will contain "Polonais" (French for "Polish"). Only set for specific fields such as the list of ingredients of a product. - /// - /// - Remark: Generated from `#/components/schemas/text_element/language`. - public var language: Swift.String? - /// 2 letter language code for the text. Only set for specific fields such as the list of ingredients of a product. - /// - /// - Remark: Generated from `#/components/schemas/text_element/lc`. - public var lc: Swift.String? - /// id of the field used to edit this text in the product edit API. - /// - /// - Remark: Generated from `#/components/schemas/text_element/edit_field_id`. - public var edit_field_id: Swift.String? - /// Type of the product field. - /// - /// - Remark: Generated from `#/components/schemas/text_element/edit_field_type`. - public var edit_field_type: Swift.String? - /// Current value of the product field. This may differ from the html field which can contain extra formating. - /// - /// - Remark: Generated from `#/components/schemas/text_element/edit_field_value`. - public var edit_field_value: Swift.String? - /// Link to the source - /// - /// - Remark: Generated from `#/components/schemas/text_element/source_url`. - public var source_url: Swift.String? - /// name of the source - /// - /// - Remark: Generated from `#/components/schemas/text_element/source_text`. - public var source_text: Swift.String? - /// Source locale name - /// - /// - Remark: Generated from `#/components/schemas/text_element/source_lc`. - public var source_lc: Swift.String? - /// Human readable source locale name - /// - /// - Remark: Generated from `#/components/schemas/text_element/source_language`. - public var source_language: Swift.String? - /// Creates a new `text_element`. - /// - /// - Parameters: - /// - _type: the type of text, might influence the way you display it. - /// - html: Text to display in HTML format. - /// - language: Language of the text. The name of the language is returned in the language requested when making the API call. e.g. if the text is in Polish, and the requested language is French, the language field will contain "Polonais" (French for "Polish"). Only set for specific fields such as the list of ingredients of a product. - /// - lc: 2 letter language code for the text. Only set for specific fields such as the list of ingredients of a product. - /// - edit_field_id: id of the field used to edit this text in the product edit API. - /// - edit_field_type: Type of the product field. - /// - edit_field_value: Current value of the product field. This may differ from the html field which can contain extra formating. - /// - source_url: Link to the source - /// - source_text: name of the source - /// - source_lc: Source locale name - /// - source_language: Human readable source locale name - public init( - _type: Components.Schemas.text_element._typePayload? = nil, - html: Swift.String? = nil, - language: Swift.String? = nil, - lc: Swift.String? = nil, - edit_field_id: Swift.String? = nil, - edit_field_type: Swift.String? = nil, - edit_field_value: Swift.String? = nil, - source_url: Swift.String? = nil, - source_text: Swift.String? = nil, - source_lc: Swift.String? = nil, - source_language: Swift.String? = nil - ) { - self._type = _type - self.html = html - self.language = language - self.lc = lc - self.edit_field_id = edit_field_id - self.edit_field_type = edit_field_type - self.edit_field_value = edit_field_value - self.source_url = source_url - self.source_text = source_text - self.source_lc = source_lc - self.source_language = source_language - } - public enum CodingKeys: String, CodingKey { - case _type = "type" - case html - case language - case lc - case edit_field_id - case edit_field_type - case edit_field_value - case source_url - case source_text - case source_lc - case source_language - } - } - /// - Remark: Generated from `#/components/schemas/image_element`. - public struct image_element: Codable, Hashable, Sendable { - /// full URL of the image - /// - /// - Remark: Generated from `#/components/schemas/image_element/url`. - public var url: Swift.String? - /// Width of the image. - /// - /// This is just a suggestion coming from the server, - /// the client may choose to use its own dimensions for the image. - /// - /// - /// - Remark: Generated from `#/components/schemas/image_element/width`. - public var width: Swift.Int? - /// Height of the image. - /// - /// This is just a suggestion coming from the server, - /// the client may choose to use its own dimensions for the image. - /// - /// - /// - Remark: Generated from `#/components/schemas/image_element/height`. - public var height: Swift.Int? - /// Alt Text of the image. - /// - /// - Remark: Generated from `#/components/schemas/image_element/alt_text`. - public var alt_text: Swift.String? - /// Creates a new `image_element`. - /// - /// - Parameters: - /// - url: full URL of the image - /// - width: Width of the image. - /// - height: Height of the image. - /// - alt_text: Alt Text of the image. - public init( - url: Swift.String? = nil, - width: Swift.Int? = nil, - height: Swift.Int? = nil, - alt_text: Swift.String? = nil - ) { - self.url = url - self.width = width - self.height = height - self.alt_text = alt_text - } - public enum CodingKeys: String, CodingKey { - case url - case width - case height - case alt_text - } - } - /// Panels can include other panels as sub-panels using the panel_element. - /// - /// - Remark: Generated from `#/components/schemas/panel_element`. - public struct panel_element: Codable, Hashable, Sendable { - /// The id of the panel to include. The id is the key of the panel in the panels object returned in the knowledge_panels field. - /// - /// - Remark: Generated from `#/components/schemas/panel_element/panel_id`. - public var panel_id: Swift.String? - /// Creates a new `panel_element`. - /// - /// - Parameters: - /// - panel_id: The id of the panel to include. The id is the key of the panel in the panels object returned in the knowledge_panels field. - public init(panel_id: Swift.String? = nil) { - self.panel_id = panel_id - } - public enum CodingKeys: String, CodingKey { - case panel_id - } - } - /// The panel group element is used to display an optional title followed by a number of sub-panels. - /// - /// - Remark: Generated from `#/components/schemas/panel_group_element`. - public struct panel_group_element: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/components/schemas/panel_group_element/title`. - public var title: Swift.String? - /// The ids of the panels to include. The ids are the keys of the panels in the panels object returned in the knowledge_panels field. - /// - /// - Remark: Generated from `#/components/schemas/panel_group_element/panel_ids`. - public var panel_ids: [Swift.String]? - /// Creates a new `panel_group_element`. - /// - /// - Parameters: - /// - title: - /// - panel_ids: The ids of the panels to include. The ids are the keys of the panels in the panels object returned in the knowledge_panels field. - public init( - title: Swift.String? = nil, - panel_ids: [Swift.String]? = nil - ) { - self.title = title - self.panel_ids = panel_ids - } - public enum CodingKeys: String, CodingKey { - case title - case panel_ids - } - } - /// Element to display a table. - /// - /// - Remark: Generated from `#/components/schemas/table_element`. - public struct table_element: Codable, Hashable, Sendable { - /// An id for the table. - /// - /// - Remark: Generated from `#/components/schemas/table_element/id`. - public var id: Swift.String? - /// Title of the column. - /// - /// - /// - Remark: Generated from `#/components/schemas/table_element/title`. - public var title: Swift.String? - /// - Remark: Generated from `#/components/schemas/table_element/rows`. - public var rows: Swift.String? - /// - Remark: Generated from `#/components/schemas/table_element/columnsPayload`. - public struct columnsPayloadPayload: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/components/schemas/table_element/columnsPayload/type`. - public var _type: Swift.String? - /// - Remark: Generated from `#/components/schemas/table_element/columnsPayload/text`. - public var text: Swift.String? - /// - Remark: Generated from `#/components/schemas/table_element/columnsPayload/text_for_small_screens`. - public var text_for_small_screens: Swift.String? - /// - Remark: Generated from `#/components/schemas/table_element/columnsPayload/style`. - public var style: Swift.String? - /// - Remark: Generated from `#/components/schemas/table_element/columnsPayload/column_group_id`. - public var column_group_id: Swift.String? - /// - Remark: Generated from `#/components/schemas/table_element/columnsPayload/shown_by_default`. - public var shown_by_default: Swift.Bool? - /// Creates a new `columnsPayloadPayload`. - /// - /// - Parameters: - /// - _type: - /// - text: - /// - text_for_small_screens: - /// - style: - /// - column_group_id: - /// - shown_by_default: - public init( - _type: Swift.String? = nil, - text: Swift.String? = nil, - text_for_small_screens: Swift.String? = nil, - style: Swift.String? = nil, - column_group_id: Swift.String? = nil, - shown_by_default: Swift.Bool? = nil - ) { - self._type = _type - self.text = text - self.text_for_small_screens = text_for_small_screens - self.style = style - self.column_group_id = column_group_id - self.shown_by_default = shown_by_default - } - public enum CodingKeys: String, CodingKey { - case _type = "type" - case text - case text_for_small_screens - case style - case column_group_id - case shown_by_default - } - } - /// - Remark: Generated from `#/components/schemas/table_element/columns`. - public typealias columnsPayload = [Components.Schemas.table_element.columnsPayloadPayload] - /// - Remark: Generated from `#/components/schemas/table_element/columns`. - public var columns: Components.Schemas.table_element.columnsPayload? - /// Creates a new `table_element`. - /// - /// - Parameters: - /// - id: An id for the table. - /// - title: Title of the column. - /// - rows: - /// - columns: - public init( - id: Swift.String? = nil, - title: Swift.String? = nil, - rows: Swift.String? = nil, - columns: Components.Schemas.table_element.columnsPayload? = nil - ) { - self.id = id - self.title = title - self.rows = rows - self.columns = columns - } - public enum CodingKeys: String, CodingKey { - case id - case title - case rows - case columns - } - } - /// Each element object contains one specific element object such as a text element or an image element. - /// - /// - /// - Remark: Generated from `#/components/schemas/element`. - public struct element: Codable, Hashable, Sendable { - /// The type of the included element object. - /// The type also indicates which field contains the included element object. - /// e.g. if the type is "text", the included element object will be in the "text_element" field. - /// - /// Note that in the future, new type of element may be added, - /// so your code should ignore unrecognized types, and unknown properties. - /// - /// TODO: add Map type - /// - /// - /// - Remark: Generated from `#/components/schemas/element/type`. - public var _type: OpenAPIRuntime.OpenAPIValueContainer - /// - Remark: Generated from `#/components/schemas/element/text_element`. - public var text_element: Components.Schemas.text_element? - /// - Remark: Generated from `#/components/schemas/element/image_element`. - public var image_element: Components.Schemas.image_element? - /// - Remark: Generated from `#/components/schemas/element/action_element`. - public var action_element: Swift.String? - /// - Remark: Generated from `#/components/schemas/element/panel_element`. - public var panel_element: Components.Schemas.panel_element? - /// - Remark: Generated from `#/components/schemas/element/panel_group_element`. - public var panel_group_element: Components.Schemas.panel_group_element? - /// - Remark: Generated from `#/components/schemas/element/table_element`. - public var table_element: Components.Schemas.table_element? - /// Creates a new `element`. - /// - /// - Parameters: - /// - _type: The type of the included element object. - /// - text_element: - /// - image_element: - /// - action_element: - /// - panel_element: - /// - panel_group_element: - /// - table_element: - public init( - _type: OpenAPIRuntime.OpenAPIValueContainer, - text_element: Components.Schemas.text_element? = nil, - image_element: Components.Schemas.image_element? = nil, - action_element: Swift.String? = nil, - panel_element: Components.Schemas.panel_element? = nil, - panel_group_element: Components.Schemas.panel_group_element? = nil, - table_element: Components.Schemas.table_element? = nil - ) { - self._type = _type - self.text_element = text_element - self.image_element = image_element - self.action_element = action_element - self.panel_element = panel_element - self.panel_group_element = panel_group_element - self.table_element = table_element - } - public enum CodingKeys: String, CodingKey { - case _type = "type" - case text_element - case image_element - case action_element - case panel_element - case panel_group_element - case table_element - } - } - /// Each panel contains an optional title and an optional array of elements. - /// - /// - Remark: Generated from `#/components/schemas/panel`. - public struct panel: Codable, Hashable, Sendable { - /// Type of the panel. If set to "card", the panel and its sub-panels should be displayed in a card. If set to "inline", the panel should have its content always displayed. - /// - /// - Remark: Generated from `#/components/schemas/panel/type`. - public var _type: Swift.String? - /// If true, the panel is to be displayed already expanded. If false, only the title should be displayed, and the user should be able to click or tap it to open the panel and display the elements. - /// - /// - Remark: Generated from `#/components/schemas/panel/expanded`. - public var expanded: Swift.Bool? - /// If set to "large", the content of the panel should be expanded on large screens, but it should still be possible to unexpand it. - /// - /// - Remark: Generated from `#/components/schemas/panel/expand_for`. - public var expand_for: Swift.String? - /// A simple assessment of the panel value, typically used to format fonts, et.c e.g. bad = red - /// - /// - Remark: Generated from `#/components/schemas/panel/evaluation`. - @frozen public enum evaluationPayload: String, Codable, Hashable, Sendable, CaseIterable { - case good = "good" - case average = "average" - case neutral = "neutral" - case bad = "bad" - case unknown = "unknown" - } - /// A simple assessment of the panel value, typically used to format fonts, et.c e.g. bad = red - /// - /// - Remark: Generated from `#/components/schemas/panel/evaluation`. - public var evaluation: Components.Schemas.panel.evaluationPayload? - /// - Remark: Generated from `#/components/schemas/panel/title_element`. - public var title_element: Components.Schemas.title_element? - /// An ordered list of elements to display in the content of the panel. - /// - /// - Remark: Generated from `#/components/schemas/panel/elements`. - public var elements: [Components.Schemas.element]? - /// a message level, as levels we use in log. - /// It might help theming the panel visualy - /// - /// - /// - Remark: Generated from `#/components/schemas/panel/level`. - public var level: Swift.String? - /// size is either empty (normal display) - /// or small to indicate a panel that should have a smaller font size - /// - /// - /// - Remark: Generated from `#/components/schemas/panel/size`. - @frozen public enum sizePayload: String, Codable, Hashable, Sendable, CaseIterable { - case small = "small" - } - /// size is either empty (normal display) - /// or small to indicate a panel that should have a smaller font size - /// - /// - /// - Remark: Generated from `#/components/schemas/panel/size`. - public var size: Components.Schemas.panel.sizePayload? - /// - Remark: Generated from `#/components/schemas/panel/topics`. - public var topics: [Swift.String]? - /// Creates a new `panel`. - /// - /// - Parameters: - /// - _type: Type of the panel. If set to "card", the panel and its sub-panels should be displayed in a card. If set to "inline", the panel should have its content always displayed. - /// - expanded: If true, the panel is to be displayed already expanded. If false, only the title should be displayed, and the user should be able to click or tap it to open the panel and display the elements. - /// - expand_for: If set to "large", the content of the panel should be expanded on large screens, but it should still be possible to unexpand it. - /// - evaluation: A simple assessment of the panel value, typically used to format fonts, et.c e.g. bad = red - /// - title_element: - /// - elements: An ordered list of elements to display in the content of the panel. - /// - level: a message level, as levels we use in log. - /// - size: size is either empty (normal display) - /// - topics: - public init( - _type: Swift.String? = nil, - expanded: Swift.Bool? = nil, - expand_for: Swift.String? = nil, - evaluation: Components.Schemas.panel.evaluationPayload? = nil, - title_element: Components.Schemas.title_element? = nil, - elements: [Components.Schemas.element]? = nil, - level: Swift.String? = nil, - size: Components.Schemas.panel.sizePayload? = nil, - topics: [Swift.String]? = nil - ) { - self._type = _type - self.expanded = expanded - self.expand_for = expand_for - self.evaluation = evaluation - self.title_element = title_element - self.elements = elements - self.level = level - self.size = size - self.topics = topics - } - public enum CodingKeys: String, CodingKey { - case _type = "type" - case expanded - case expand_for - case evaluation - case title_element - case elements - case level - case size - case topics - } - } - /// The panels object is a dictionary of individual panel objects. - /// Each key of the dictionary is the id of the panel, and the value is the panel object. - /// - /// Apps typically display a number of root panels with known panel ids (e.g. health_card and environment_card). Panels can reference other panels and display them as sub-panels. - /// - /// - Remark: Generated from `#/components/schemas/panels`. - public struct panels: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/components/schemas/panels/additionalProperties`. - public var additionalProperties: Components.Schemas.panel? - /// Creates a new `panels`. - /// - /// - Parameters: - /// - additionalProperties: - public init(additionalProperties: Components.Schemas.panel? = nil) { - self.additionalProperties = additionalProperties - } - public enum CodingKeys: String, CodingKey { - case additionalProperties - } - } - /// Knowledge panels for a product - /// - /// - /// - Remark: Generated from `#/components/schemas/product_knowledge_panels`. - public struct product_knowledge_panels: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/components/schemas/product_knowledge_panels/knowledge_panels`. - public var knowledge_panels: Components.Schemas.panels? - /// Creates a new `product_knowledge_panels`. - /// - /// - Parameters: - /// - knowledge_panels: - public init(knowledge_panels: Components.Schemas.panels? = nil) { - self.knowledge_panels = knowledge_panels - } - public enum CodingKeys: String, CodingKey { - case knowledge_panels - } - } - /// Specific data about a product to enable personal ranking - /// - /// - /// - Remark: Generated from `#/components/schemas/product_attribute_groups`. - public struct product_attribute_groups: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/components/schemas/product_attribute_groups/attribute_groupsPayload`. - public struct attribute_groupsPayloadPayload: Codable, Hashable, Sendable { - /// Unique id of the attribute. - /// - /// It will be use to match against preferences parameters. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_attribute_groups/attribute_groupsPayload/id`. - public var id: Swift.String? - /// wether we have the information to really compute this criteria or not. - /// - /// - Remark: Generated from `#/components/schemas/product_attribute_groups/attribute_groupsPayload/status`. - @frozen public enum statusPayload: String, Codable, Hashable, Sendable, CaseIterable { - case known = "known" - case unknown = "unknown" - } - /// wether we have the information to really compute this criteria or not. - /// - /// - Remark: Generated from `#/components/schemas/product_attribute_groups/attribute_groupsPayload/status`. - public var status: Components.Schemas.product_attribute_groups.attribute_groupsPayloadPayload.statusPayload? - /// A descriptive sentence about the situation of the product concerning attribute - /// - /// - /// - Remark: Generated from `#/components/schemas/product_attribute_groups/attribute_groupsPayload/title`. - public var title: Swift.String? - /// a numeric value for the match, - /// telling how much the products ranks well for this particular attribute. - /// The higher the value, the better the match. - /// - /// - /// - Remark: Generated from `#/components/schemas/product_attribute_groups/attribute_groupsPayload/match`. - public var match: Swift.Float? - /// every attribute as a grade for a to e - /// - /// - Remark: Generated from `#/components/schemas/product_attribute_groups/attribute_groupsPayload/grade`. - @frozen public enum gradePayload: String, Codable, Hashable, Sendable, CaseIterable { - case unknown = "unknown" - case a = "a" - case b = "b" - case c = "c" - case d = "d" - case e = "e" - } - /// every attribute as a grade for a to e - /// - /// - Remark: Generated from `#/components/schemas/product_attribute_groups/attribute_groupsPayload/grade`. - public var grade: Components.Schemas.product_attribute_groups.attribute_groupsPayloadPayload.gradePayload? - /// The name of attribute, for eventual display - /// - /// - Remark: Generated from `#/components/schemas/product_attribute_groups/attribute_groupsPayload/name`. - public var name: Swift.String? - /// an icon representing the attribute match (often using a color) - /// - /// - Remark: Generated from `#/components/schemas/product_attribute_groups/attribute_groupsPayload/icon_url`. - public var icon_url: Swift.String? - /// An eventual description of the value of the property upon which this attribute is based - /// - /// - Remark: Generated from `#/components/schemas/product_attribute_groups/attribute_groupsPayload/description`. - public var description: Swift.String? - /// An eventual short description of the value of the property upon which this attribute is based - /// - /// - Remark: Generated from `#/components/schemas/product_attribute_groups/attribute_groupsPayload/description_short`. - public var description_short: Swift.String? - /// Creates a new `attribute_groupsPayloadPayload`. - /// - /// - Parameters: - /// - id: Unique id of the attribute. - /// - status: wether we have the information to really compute this criteria or not. - /// - title: A descriptive sentence about the situation of the product concerning attribute - /// - match: a numeric value for the match, - /// - grade: every attribute as a grade for a to e - /// - name: The name of attribute, for eventual display - /// - icon_url: an icon representing the attribute match (often using a color) - /// - description: An eventual description of the value of the property upon which this attribute is based - /// - description_short: An eventual short description of the value of the property upon which this attribute is based - public init( - id: Swift.String? = nil, - status: Components.Schemas.product_attribute_groups.attribute_groupsPayloadPayload.statusPayload? = nil, - title: Swift.String? = nil, - match: Swift.Float? = nil, - grade: Components.Schemas.product_attribute_groups.attribute_groupsPayloadPayload.gradePayload? = nil, - name: Swift.String? = nil, - icon_url: Swift.String? = nil, - description: Swift.String? = nil, - description_short: Swift.String? = nil - ) { - self.id = id - self.status = status - self.title = title - self.match = match - self.grade = grade - self.name = name - self.icon_url = icon_url - self.description = description - self.description_short = description_short - } - public enum CodingKeys: String, CodingKey { - case id - case status - case title - case match - case grade - case name - case icon_url - case description - case description_short - } - } - /// Each element is an attribute that can help compute a personal ranking for the product - /// - /// - Remark: Generated from `#/components/schemas/product_attribute_groups/attribute_groups`. - public typealias attribute_groupsPayload = [Components.Schemas.product_attribute_groups.attribute_groupsPayloadPayload] - /// Each element is an attribute that can help compute a personal ranking for the product - /// - /// - Remark: Generated from `#/components/schemas/product_attribute_groups/attribute_groups`. - public var attribute_groups: Components.Schemas.product_attribute_groups.attribute_groupsPayload? - /// Creates a new `product_attribute_groups`. - /// - /// - Parameters: - /// - attribute_groups: Each element is an attribute that can help compute a personal ranking for the product - public init(attribute_groups: Components.Schemas.product_attribute_groups.attribute_groupsPayload? = nil) { - self.attribute_groups = attribute_groups - } - public enum CodingKeys: String, CodingKey { - case attribute_groups - } - } - /// This is all the fields describing a product and how to display it on a page. - /// - /// Refer to the different sub schema for more readable entries: - /// - /// * [Product Base](#cmp--schemas-product-base): Base fields of a product - /// * [Product Misc](#cmp--schemas-product-misc): Miscellaneous but important fields of a product - /// * [Product Tags](#cmp--schemas-product-tags): Tags fields on a product - /// * [Product Nutrition](#cmp--schemas-product-nutrition): Nutrition fields of a product - /// * [Product Ingredients](#cmp--schemas-product-ingredients): Fields about ingredients of a product - /// * [Product Images](#cmp--schemas-product-images): Information about Images of a product - /// * [Product Eco-Score](#cmp--schemas-product-images): Fields related to Eco-Score for a product - /// * [Product Metadata](#cmp--schemas-product-ecoscore): Metadata of a product (author, editors, etc.) - /// * [Product Data Quality](#cmp--schemas-product-quality): fields related to data quality for a product - /// * [Product Knowledge Panels](#cmp--schemas-product-knowledge-panels): Knowledge panels for a product - /// * [Product Attribute Groups](#cmp--schemas-product-attribute-groups): Attribute groups for personal product matching - /// - /// - /// - Remark: Generated from `#/components/schemas/product`. - public struct product: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/components/schemas/product/value1`. - public var value1: Components.Schemas.product_base - /// - Remark: Generated from `#/components/schemas/product/value2`. - public var value2: Components.Schemas.product_misc - /// - Remark: Generated from `#/components/schemas/product/value3`. - public var value3: Components.Schemas.product_tags - /// - Remark: Generated from `#/components/schemas/product/value4`. - public var value4: Components.Schemas.product_images - /// - Remark: Generated from `#/components/schemas/product/value5`. - public var value5: Components.Schemas.product_ecoscore - /// - Remark: Generated from `#/components/schemas/product/value6`. - public var value6: Components.Schemas.product_ingredients - /// - Remark: Generated from `#/components/schemas/product/value7`. - public var value7: Components.Schemas.product_nutrition - /// - Remark: Generated from `#/components/schemas/product/value8`. - public var value8: Components.Schemas.product_quality - /// - Remark: Generated from `#/components/schemas/product/value9`. - public var value9: Components.Schemas.product_extended - /// - Remark: Generated from `#/components/schemas/product/value10`. - public var value10: Components.Schemas.product_meta - /// - Remark: Generated from `#/components/schemas/product/value11`. - public var value11: Components.Schemas.product_knowledge_panels - /// - Remark: Generated from `#/components/schemas/product/value12`. - public var value12: Components.Schemas.product_attribute_groups - /// Creates a new `product`. - /// - /// - Parameters: - /// - value1: - /// - value2: - /// - value3: - /// - value4: - /// - value5: - /// - value6: - /// - value7: - /// - value8: - /// - value9: - /// - value10: - /// - value11: - /// - value12: - public init( - value1: Components.Schemas.product_base, - value2: Components.Schemas.product_misc, - value3: Components.Schemas.product_tags, - value4: Components.Schemas.product_images, - value5: Components.Schemas.product_ecoscore, - value6: Components.Schemas.product_ingredients, - value7: Components.Schemas.product_nutrition, - value8: Components.Schemas.product_quality, - value9: Components.Schemas.product_extended, - value10: Components.Schemas.product_meta, - value11: Components.Schemas.product_knowledge_panels, - value12: Components.Schemas.product_attribute_groups - ) { - self.value1 = value1 - self.value2 = value2 - self.value3 = value3 - self.value4 = value4 - self.value5 = value5 - self.value6 = value6 - self.value7 = value7 - self.value8 = value8 - self.value9 = value9 - self.value10 = value10 - self.value11 = value11 - self.value12 = value12 - } - public init(from decoder: any Decoder) throws { - value1 = try .init(from: decoder) - value2 = try .init(from: decoder) - value3 = try .init(from: decoder) - value4 = try .init(from: decoder) - value5 = try .init(from: decoder) - value6 = try .init(from: decoder) - value7 = try .init(from: decoder) - value8 = try .init(from: decoder) - value9 = try .init(from: decoder) - value10 = try .init(from: decoder) - value11 = try .init(from: decoder) - value12 = try .init(from: decoder) - } - public func encode(to encoder: any Encoder) throws { - try value1.encode(to: encoder) - try value2.encode(to: encoder) - try value3.encode(to: encoder) - try value4.encode(to: encoder) - try value5.encode(to: encoder) - try value6.encode(to: encoder) - try value7.encode(to: encoder) - try value8.encode(to: encoder) - try value9.encode(to: encoder) - try value10.encode(to: encoder) - try value11.encode(to: encoder) - try value12.encode(to: encoder) - } - } - /// - Remark: Generated from `#/components/schemas/get_product_by_barcode`. - public struct get_product_by_barcode: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/components/schemas/get_product_by_barcode/value1`. - public var value1: Components.Schemas.get_product_by_barcode_base - /// - Remark: Generated from `#/components/schemas/get_product_by_barcode/value2`. - public struct Value2Payload: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/components/schemas/get_product_by_barcode/value2/product`. - public struct productPayload: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/components/schemas/get_product_by_barcode/value2/product/value1`. - public var value1: Components.Schemas.product - /// Creates a new `productPayload`. - /// - /// - Parameters: - /// - value1: - public init(value1: Components.Schemas.product) { - self.value1 = value1 - } - public init(from decoder: any Decoder) throws { - value1 = try .init(from: decoder) - } - public func encode(to encoder: any Encoder) throws { - try value1.encode(to: encoder) - } - } - /// - Remark: Generated from `#/components/schemas/get_product_by_barcode/value2/product`. - public var product: Components.Schemas.get_product_by_barcode.Value2Payload.productPayload? - /// Creates a new `Value2Payload`. - /// - /// - Parameters: - /// - product: - public init(product: Components.Schemas.get_product_by_barcode.Value2Payload.productPayload? = nil) { - self.product = product - } - public enum CodingKeys: String, CodingKey { - case product - } - } - /// - Remark: Generated from `#/components/schemas/get_product_by_barcode/value2`. - public var value2: Components.Schemas.get_product_by_barcode.Value2Payload - /// Creates a new `get_product_by_barcode`. - /// - /// - Parameters: - /// - value1: - /// - value2: - public init( - value1: Components.Schemas.get_product_by_barcode_base, - value2: Components.Schemas.get_product_by_barcode.Value2Payload - ) { - self.value1 = value1 - self.value2 = value2 - } - public init(from decoder: any Decoder) throws { - value1 = try .init(from: decoder) - value2 = try .init(from: decoder) - } - public func encode(to encoder: any Encoder) throws { - try value1.encode(to: encoder) - try value2.encode(to: encoder) - } - } - /// - Remark: Generated from `#/components/schemas/ocr_on_product`. - public struct ocr_on_product: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/components/schemas/ocr_on_product/status`. - public var status: Swift.Int? - /// Creates a new `ocr_on_product`. - /// - /// - Parameters: - /// - status: - public init(status: Swift.Int? = nil) { - self.status = status - } - public enum CodingKeys: String, CodingKey { - case status - } - } - /// - Remark: Generated from `#/components/schemas/crop_a_photo`. - @frozen public enum crop_a_photo: Sendable, Hashable { - /// - Remark: Generated from `#/components/schemas/crop_a_photo/code`. - public struct codePayload: Sendable, Hashable { - public var body: OpenAPIRuntime.HTTPBody - /// Creates a new `codePayload`. - /// - /// - Parameters: - /// - body: - public init(body: OpenAPIRuntime.HTTPBody) { - self.body = body - } - } - case code(OpenAPIRuntime.MultipartPart) - /// - Remark: Generated from `#/components/schemas/crop_a_photo/imgid`. - public struct imgidPayload: Sendable, Hashable { - public var body: OpenAPIRuntime.HTTPBody - /// Creates a new `imgidPayload`. - /// - /// - Parameters: - /// - body: - public init(body: OpenAPIRuntime.HTTPBody) { - self.body = body - } - } - case imgid(OpenAPIRuntime.MultipartPart) - /// - Remark: Generated from `#/components/schemas/crop_a_photo/id`. - public struct idPayload: Sendable, Hashable { - public var body: OpenAPIRuntime.HTTPBody - /// Creates a new `idPayload`. - /// - /// - Parameters: - /// - body: - public init(body: OpenAPIRuntime.HTTPBody) { - self.body = body - } - } - case id(OpenAPIRuntime.MultipartPart) - /// - Remark: Generated from `#/components/schemas/crop_a_photo/x1`. - public struct x1Payload: Sendable, Hashable { - public var body: OpenAPIRuntime.HTTPBody - /// Creates a new `x1Payload`. - /// - /// - Parameters: - /// - body: - public init(body: OpenAPIRuntime.HTTPBody) { - self.body = body - } - } - case x1(OpenAPIRuntime.MultipartPart) - /// - Remark: Generated from `#/components/schemas/crop_a_photo/y1`. - public struct y1Payload: Sendable, Hashable { - public var body: OpenAPIRuntime.HTTPBody - /// Creates a new `y1Payload`. - /// - /// - Parameters: - /// - body: - public init(body: OpenAPIRuntime.HTTPBody) { - self.body = body - } - } - case y1(OpenAPIRuntime.MultipartPart) - /// - Remark: Generated from `#/components/schemas/crop_a_photo/x2`. - public struct x2Payload: Sendable, Hashable { - public var body: OpenAPIRuntime.HTTPBody - /// Creates a new `x2Payload`. - /// - /// - Parameters: - /// - body: - public init(body: OpenAPIRuntime.HTTPBody) { - self.body = body - } - } - case x2(OpenAPIRuntime.MultipartPart) - /// - Remark: Generated from `#/components/schemas/crop_a_photo/y2`. - public struct y2Payload: Sendable, Hashable { - public var body: OpenAPIRuntime.HTTPBody - /// Creates a new `y2Payload`. - /// - /// - Parameters: - /// - body: - public init(body: OpenAPIRuntime.HTTPBody) { - self.body = body - } - } - case y2(OpenAPIRuntime.MultipartPart) - /// - Remark: Generated from `#/components/schemas/crop_a_photo/angle`. - public struct anglePayload: Sendable, Hashable { - public var body: OpenAPIRuntime.HTTPBody - /// Creates a new `anglePayload`. - /// - /// - Parameters: - /// - body: - public init(body: OpenAPIRuntime.HTTPBody) { - self.body = body - } - } - case angle(OpenAPIRuntime.MultipartPart) - /// - Remark: Generated from `#/components/schemas/crop_a_photo/normalize`. - public struct normalizePayload: Sendable, Hashable { - public var body: OpenAPIRuntime.HTTPBody - /// Creates a new `normalizePayload`. - /// - /// - Parameters: - /// - body: - public init(body: OpenAPIRuntime.HTTPBody) { - self.body = body - } - } - case normalize(OpenAPIRuntime.MultipartPart) - /// - Remark: Generated from `#/components/schemas/crop_a_photo/white_magic`. - public struct white_magicPayload: Sendable, Hashable { - public var body: OpenAPIRuntime.HTTPBody - /// Creates a new `white_magicPayload`. - /// - /// - Parameters: - /// - body: - public init(body: OpenAPIRuntime.HTTPBody) { - self.body = body - } - } - case white_magic(OpenAPIRuntime.MultipartPart) - case undocumented(OpenAPIRuntime.MultipartRawPart) - } - /// - Remark: Generated from `#/components/schemas/rotate_a_photo`. - public struct rotate_a_photo: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/components/schemas/rotate_a_photo/status`. - public var status: Swift.String? - /// - Remark: Generated from `#/components/schemas/rotate_a_photo/imagefield`. - public var imagefield: Swift.String? - /// - Remark: Generated from `#/components/schemas/rotate_a_photo/image`. - public struct imagePayload: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/components/schemas/rotate_a_photo/image/display_url`. - public var display_url: Swift.String? - /// Creates a new `imagePayload`. - /// - /// - Parameters: - /// - display_url: - public init(display_url: Swift.String? = nil) { - self.display_url = display_url - } - public enum CodingKeys: String, CodingKey { - case display_url - } - } - /// - Remark: Generated from `#/components/schemas/rotate_a_photo/image`. - public var image: Components.Schemas.rotate_a_photo.imagePayload? - /// Creates a new `rotate_a_photo`. - /// - /// - Parameters: - /// - status: - /// - imagefield: - /// - image: - public init( - status: Swift.String? = nil, - imagefield: Swift.String? = nil, - image: Components.Schemas.rotate_a_photo.imagePayload? = nil - ) { - self.status = status - self.imagefield = imagefield - self.image = image - } - public enum CodingKeys: String, CodingKey { - case status - case imagefield - case image - } - } - /// - Remark: Generated from `#/components/schemas/unselect_a_photo`. - @frozen public enum unselect_a_photo: Sendable, Hashable { - /// - Remark: Generated from `#/components/schemas/unselect_a_photo/code`. - public struct codePayload: Sendable, Hashable { - public var body: OpenAPIRuntime.HTTPBody - /// Creates a new `codePayload`. - /// - /// - Parameters: - /// - body: - public init(body: OpenAPIRuntime.HTTPBody) { - self.body = body - } - } - case code(OpenAPIRuntime.MultipartPart) - /// - Remark: Generated from `#/components/schemas/unselect_a_photo/id`. - public struct idPayload: Sendable, Hashable { - public var body: OpenAPIRuntime.HTTPBody - /// Creates a new `idPayload`. - /// - /// - Parameters: - /// - body: - public init(body: OpenAPIRuntime.HTTPBody) { - self.body = body - } - } - case id(OpenAPIRuntime.MultipartPart) - case undocumented(OpenAPIRuntime.MultipartRawPart) - } - /// - Remark: Generated from `#/components/schemas/combined_add_or_edit_a_product_and_change_ref_properties`. - @frozen public enum combined_add_or_edit_a_product_and_change_ref_properties: Sendable, Hashable { - /// - Remark: Generated from `#/components/schemas/combined_add_or_edit_a_product_and_change_ref_properties/code`. - public struct codePayload: Sendable, Hashable { - public var body: OpenAPIRuntime.HTTPBody - /// Creates a new `codePayload`. - /// - /// - Parameters: - /// - body: - public init(body: OpenAPIRuntime.HTTPBody) { - self.body = body - } - } - case code(OpenAPIRuntime.MultipartPart) - /// - Remark: Generated from `#/components/schemas/combined_add_or_edit_a_product_and_change_ref_properties/user_id`. - public struct user_idPayload: Sendable, Hashable { - public var body: OpenAPIRuntime.HTTPBody - /// Creates a new `user_idPayload`. - /// - /// - Parameters: - /// - body: - public init(body: OpenAPIRuntime.HTTPBody) { - self.body = body - } - } - case user_id(OpenAPIRuntime.MultipartPart) - /// - Remark: Generated from `#/components/schemas/combined_add_or_edit_a_product_and_change_ref_properties/password`. - public struct passwordPayload: Sendable, Hashable { - public var body: OpenAPIRuntime.HTTPBody - /// Creates a new `passwordPayload`. - /// - /// - Parameters: - /// - body: - public init(body: OpenAPIRuntime.HTTPBody) { - self.body = body - } - } - case password(OpenAPIRuntime.MultipartPart) - /// - Remark: Generated from `#/components/schemas/combined_add_or_edit_a_product_and_change_ref_properties/comment`. - public struct commentPayload: Sendable, Hashable { - public var body: OpenAPIRuntime.HTTPBody - /// Creates a new `commentPayload`. - /// - /// - Parameters: - /// - body: - public init(body: OpenAPIRuntime.HTTPBody) { - self.body = body - } - } - case comment(OpenAPIRuntime.MultipartPart) - /// - Remark: Generated from `#/components/schemas/combined_add_or_edit_a_product_and_change_ref_properties/brands`. - public struct brandsPayload: Sendable, Hashable { - public var body: OpenAPIRuntime.HTTPBody - /// Creates a new `brandsPayload`. - /// - /// - Parameters: - /// - body: - public init(body: OpenAPIRuntime.HTTPBody) { - self.body = body - } - } - case brands(OpenAPIRuntime.MultipartPart) - /// - Remark: Generated from `#/components/schemas/combined_add_or_edit_a_product_and_change_ref_properties/labels`. - public struct labelsPayload: Sendable, Hashable { - public var body: OpenAPIRuntime.HTTPBody - /// Creates a new `labelsPayload`. - /// - /// - Parameters: - /// - body: - public init(body: OpenAPIRuntime.HTTPBody) { - self.body = body - } - } - case labels(OpenAPIRuntime.MultipartPart) - /// - Remark: Generated from `#/components/schemas/combined_add_or_edit_a_product_and_change_ref_properties/categories`. - public struct categoriesPayload: Sendable, Hashable { - public var body: OpenAPIRuntime.HTTPBody - /// Creates a new `categoriesPayload`. - /// - /// - Parameters: - /// - body: - public init(body: OpenAPIRuntime.HTTPBody) { - self.body = body - } - } - case categories(OpenAPIRuntime.MultipartPart) - /// - Remark: Generated from `#/components/schemas/combined_add_or_edit_a_product_and_change_ref_properties/packaging`. - public struct packagingPayload: Sendable, Hashable { - public var body: OpenAPIRuntime.HTTPBody - /// Creates a new `packagingPayload`. - /// - /// - Parameters: - /// - body: - public init(body: OpenAPIRuntime.HTTPBody) { - self.body = body - } - } - case packaging(OpenAPIRuntime.MultipartPart) - /// - Remark: Generated from `#/components/schemas/combined_add_or_edit_a_product_and_change_ref_properties/app_name`. - public struct app_namePayload: Sendable, Hashable { - public var body: OpenAPIRuntime.HTTPBody - /// Creates a new `app_namePayload`. - /// - /// - Parameters: - /// - body: - public init(body: OpenAPIRuntime.HTTPBody) { - self.body = body - } - } - case app_name(OpenAPIRuntime.MultipartPart) - /// - Remark: Generated from `#/components/schemas/combined_add_or_edit_a_product_and_change_ref_properties/app_version`. - public struct app_versionPayload: Sendable, Hashable { - public var body: OpenAPIRuntime.HTTPBody - /// Creates a new `app_versionPayload`. - /// - /// - Parameters: - /// - body: - public init(body: OpenAPIRuntime.HTTPBody) { - self.body = body - } - } - case app_version(OpenAPIRuntime.MultipartPart) - /// - Remark: Generated from `#/components/schemas/combined_add_or_edit_a_product_and_change_ref_properties/app_uuid`. - public struct app_uuidPayload: Sendable, Hashable { - public var body: OpenAPIRuntime.HTTPBody - /// Creates a new `app_uuidPayload`. - /// - /// - Parameters: - /// - body: - public init(body: OpenAPIRuntime.HTTPBody) { - self.body = body - } - } - case app_uuid(OpenAPIRuntime.MultipartPart) - /// - Remark: Generated from `#/components/schemas/combined_add_or_edit_a_product_and_change_ref_properties/user_agent`. - public struct user_agentPayload: Sendable, Hashable { - public var body: OpenAPIRuntime.HTTPBody - /// Creates a new `user_agentPayload`. - /// - /// - Parameters: - /// - body: - public init(body: OpenAPIRuntime.HTTPBody) { - self.body = body - } - } - case user_agent(OpenAPIRuntime.MultipartPart) - /// - Remark: Generated from `#/components/schemas/combined_add_or_edit_a_product_and_change_ref_properties/imagefield`. - public struct imagefieldPayload: Sendable, Hashable { - public var body: OpenAPIRuntime.OpenAPIValueContainer - /// Creates a new `imagefieldPayload`. - /// - /// - Parameters: - /// - body: - public init(body: OpenAPIRuntime.OpenAPIValueContainer) { - self.body = body - } - } - case imagefield(OpenAPIRuntime.MultipartPart) - case undocumented(OpenAPIRuntime.MultipartRawPart) - } - /// You can provide most of the properties defined in the product schema. - /// - /// - /// - Remark: Generated from `#/components/schemas/add_or_edit_a_product`. - public struct add_or_edit_a_product: Codable, Hashable, Sendable { - /// The barcode of the product to be added or edited - /// - /// - Remark: Generated from `#/components/schemas/add_or_edit_a_product/code`. - public var code: Swift.String - /// A valid username. - /// - /// - Remark: Generated from `#/components/schemas/add_or_edit_a_product/user_id`. - public var user_id: Swift.String - /// A valid corresponding password. - /// - /// - Remark: Generated from `#/components/schemas/add_or_edit_a_product/password`. - public var password: Swift.String - /// A comment for the change. It will be shown in product changes history. - /// - /// - Remark: Generated from `#/components/schemas/add_or_edit_a_product/comment`. - public var comment: Swift.String? - /// The brands of the product (comma separated list of values). - /// - /// - Remark: Generated from `#/components/schemas/add_or_edit_a_product/brands`. - public var brands: OpenAPIRuntime.OpenAPIValueContainer? - /// The labels of the product (comma separated list of values). - /// - /// - Remark: Generated from `#/components/schemas/add_or_edit_a_product/labels`. - public var labels: OpenAPIRuntime.OpenAPIValueContainer? - /// The categories of the product (comma separated list of values). - /// - /// - Remark: Generated from `#/components/schemas/add_or_edit_a_product/categories`. - public var categories: OpenAPIRuntime.OpenAPIValueContainer? - /// Packaging type, format, material. - /// The [v3 API documentation](https://openfoodfacts.github.io/openfoodfacts-server/api/ref-v3/#operation/post-api-v3-product-barcode) - /// has a more structured data for `packaging`. - /// - /// - /// - Remark: Generated from `#/components/schemas/add_or_edit_a_product/packaging`. - public var packaging: Swift.String? - /// Creates a new `add_or_edit_a_product`. - /// - /// - Parameters: - /// - code: The barcode of the product to be added or edited - /// - user_id: A valid username. - /// - password: A valid corresponding password. - /// - comment: A comment for the change. It will be shown in product changes history. - /// - brands: The brands of the product (comma separated list of values). - /// - labels: The labels of the product (comma separated list of values). - /// - categories: The categories of the product (comma separated list of values). - /// - packaging: Packaging type, format, material. - public init( - code: Swift.String, - user_id: Swift.String, - password: Swift.String, - comment: Swift.String? = nil, - brands: OpenAPIRuntime.OpenAPIValueContainer? = nil, - labels: OpenAPIRuntime.OpenAPIValueContainer? = nil, - categories: OpenAPIRuntime.OpenAPIValueContainer? = nil, - packaging: Swift.String? = nil - ) { - self.code = code - self.user_id = user_id - self.password = password - self.comment = comment - self.brands = brands - self.labels = labels - self.categories = categories - self.packaging = packaging - } - public enum CodingKeys: String, CodingKey { - case code - case user_id - case password - case comment - case brands - case labels - case categories - case packaging - } - } - /// Properties that goes in change ref - /// - /// - /// - Remark: Generated from `#/components/schemas/change_ref_properties`. - public struct change_ref_properties: Codable, Hashable, Sendable { - /// A comment on the contribution. - /// Adding meaningful comments help moderators and users understand a single product history. - /// - /// - /// - Remark: Generated from `#/components/schemas/change_ref_properties/comment`. - public var comment: Swift.String? - /// Name of the app providing the information - /// - /// - /// - Remark: Generated from `#/components/schemas/change_ref_properties/app_name`. - public var app_name: Swift.String? - /// Version of the app providing the information - /// - /// - /// - Remark: Generated from `#/components/schemas/change_ref_properties/app_version`. - public var app_version: Swift.String? - /// When an app uses a single user to log its contributions, - /// it might be interesting to know which user of the app is providing the information. - /// You can use this field to provide an identifier (eg: an sha1 of the username) that's privacy preserving. Make sure that your salt is strong, perfectly random and secret - /// - /// In case we have trouble with one of your user, it helps our moderators revert edits. - /// - /// - /// - Remark: Generated from `#/components/schemas/change_ref_properties/app_uuid`. - public var app_uuid: Swift.String? - /// It is required that you pass a specific User-Agent header when you do an API request. - /// But some times it's not possible to modify such a header - /// (eg. request using JavaScript in a browser). - /// In such cases, you can override it with this parameter. - /// - /// - /// - Remark: Generated from `#/components/schemas/change_ref_properties/User-Agent`. - public var User_hyphen_Agent: Swift.String? - /// Creates a new `change_ref_properties`. - /// - /// - Parameters: - /// - comment: A comment on the contribution. - /// - app_name: Name of the app providing the information - /// - app_version: Version of the app providing the information - /// - app_uuid: When an app uses a single user to log its contributions, - /// - User_hyphen_Agent: It is required that you pass a specific User-Agent header when you do an API request. - public init( - comment: Swift.String? = nil, - app_name: Swift.String? = nil, - app_version: Swift.String? = nil, - app_uuid: Swift.String? = nil, - User_hyphen_Agent: Swift.String? = nil - ) { - self.comment = comment - self.app_name = app_name - self.app_version = app_version - self.app_uuid = app_uuid - self.User_hyphen_Agent = User_hyphen_Agent - } - public enum CodingKeys: String, CodingKey { - case comment - case app_name - case app_version - case app_uuid - case User_hyphen_Agent = "User-Agent" - } - } - /// - Remark: Generated from `#/components/schemas/search_for_products`. - public struct search_for_products: Codable, Hashable, Sendable { - /// Total number of products found - /// - /// - /// - Remark: Generated from `#/components/schemas/search_for_products/count`. - public var count: Swift.Int? - /// Page number of returned results. - /// - /// You can get a different page, by using the `page` query parameter. - /// - /// - /// - Remark: Generated from `#/components/schemas/search_for_products/page`. - public var page: Swift.Int? - /// Number of products in this page. - /// - /// This will differ from page_size only on the last page. - /// - /// - /// - Remark: Generated from `#/components/schemas/search_for_products/page_count`. - public var page_count: Swift.Int? - /// Requested number of products per pages - /// - /// To get the number of pages, divide count by page_size - /// (eg. `Math.floor( count / page_size) + 1 `) - /// - /// - /// - Remark: Generated from `#/components/schemas/search_for_products/page_size`. - public var page_size: Swift.Int? - /// The products matching the query corresponding to current page - /// - /// - /// - Remark: Generated from `#/components/schemas/search_for_products/products`. - public var products: [Components.Schemas.product]? - /// - Remark: Generated from `#/components/schemas/search_for_products/skip`. - public var skip: Swift.Int? - /// Creates a new `search_for_products`. - /// - /// - Parameters: - /// - count: Total number of products found - /// - page: Page number of returned results. - /// - page_count: Number of products in this page. - /// - page_size: Requested number of products per pages - /// - products: The products matching the query corresponding to current page - /// - skip: - public init( - count: Swift.Int? = nil, - page: Swift.Int? = nil, - page_count: Swift.Int? = nil, - page_size: Swift.Int? = nil, - products: [Components.Schemas.product]? = nil, - skip: Swift.Int? = nil - ) { - self.count = count - self.page = page - self.page_count = page_count - self.page_size = page_size - self.products = products - self.skip = skip - } - public enum CodingKeys: String, CodingKey { - case count - case page - case page_count - case page_size - case products - case skip - } - } - /// The unit in which the nutrient for 100g or per serving is measured. - /// - /// The possible values depends on the nutrient. - /// - /// * `g` for grams - /// * `mg` for milligrams - /// * `μg` for micrograms - /// * `cl` for centiliters - /// * `ml` for mililiters - /// * `dv` for recommended daily intakes (aka [Dietary Reference Intake](https://en.wikipedia.org/wiki/Dietary_Reference_Intake)) - /// * `% vol` for percentage per volume (e.g. alcohol vol per 100 ml) - /// * `%` for percentage - /// - /// 🤓 code: see the [Units module][units-module], - /// and [Food:default_unit_for_nid function][default-unit] - /// - /// [units-module]: https://openfoodfacts.github.io/openfoodfacts-server/dev/ref-perl-pod/ProductOpener/Units.html - /// [default-unit]: https://openfoodfacts.github.io/openfoodfacts-server/dev/ref-perl-pod/ProductOpener/Food.html#default_unit_for_nid_(_%24nid) - /// - /// - /// - Remark: Generated from `#/components/schemas/nutrient_unit`. - @frozen public enum nutrient_unit: String, Codable, Hashable, Sendable, CaseIterable { - case g = "g" - case mg = "mg" - case μg = "μg" - case cl = "cl" - case ml = "ml" - case dv = "dv" - case _percnt__space_vol = "% vol" - case _percnt_ = "%" - } - /// - Remark: Generated from `#/components/schemas/nutrients`. - public struct nutrientsPayload: Codable, Hashable, Sendable { - /// id of the nutrient - /// - /// - Remark: Generated from `#/components/schemas/nutrients/id`. - public var id: Swift.String? - /// Name of the nutrient in the requested language - /// - /// - Remark: Generated from `#/components/schemas/nutrients/name`. - public var name: Swift.String? - /// Indicates if the nutrient is always shown on the nutrition facts table - /// - /// - Remark: Generated from `#/components/schemas/nutrients/important`. - public var important: Swift.Bool? - /// Indicates if the nutrient should be shown in the nutrition facts edit form - /// - /// - Remark: Generated from `#/components/schemas/nutrients/display_in_edit_form`. - public var display_in_edit_form: Swift.Bool? - /// Default unit of the nutrient - /// - /// - Remark: Generated from `#/components/schemas/nutrients/unit`. - public var unit: Components.Schemas.nutrient_unit? - /// Sub-nutrients (e.g. saturated-fat is a sub-nutrient of fat). - /// - /// - /// - Remark: Generated from `#/components/schemas/nutrients/nutrients`. - public var nutrients: OpenAPIRuntime.OpenAPIValueContainer? - /// Creates a new `nutrientsPayload`. - /// - /// - Parameters: - /// - id: id of the nutrient - /// - name: Name of the nutrient in the requested language - /// - important: Indicates if the nutrient is always shown on the nutrition facts table - /// - display_in_edit_form: Indicates if the nutrient should be shown in the nutrition facts edit form - /// - unit: Default unit of the nutrient - /// - nutrients: Sub-nutrients (e.g. saturated-fat is a sub-nutrient of fat). - public init( - id: Swift.String? = nil, - name: Swift.String? = nil, - important: Swift.Bool? = nil, - display_in_edit_form: Swift.Bool? = nil, - unit: Components.Schemas.nutrient_unit? = nil, - nutrients: OpenAPIRuntime.OpenAPIValueContainer? = nil - ) { - self.id = id - self.name = name - self.important = important - self.display_in_edit_form = display_in_edit_form - self.unit = unit - self.nutrients = nutrients - } - public enum CodingKeys: String, CodingKey { - case id - case name - case important - case display_in_edit_form - case unit - case nutrients - } - } - /// Nutrients and sub-nutrients of a product, with their name and default unit. - /// - /// - /// - Remark: Generated from `#/components/schemas/nutrients`. - public typealias nutrients = [Components.Schemas.nutrientsPayload] - /// - Remark: Generated from `#/components/schemas/get_nutrients`. - public typealias get_nutrients = Components.Schemas.nutrients - /// - Remark: Generated from `#/components/schemas/get_attribute_groups`. - public struct get_attribute_groupsPayload: Codable, Hashable, Sendable { - /// unique id of the group - /// - /// - Remark: Generated from `#/components/schemas/get_attribute_groups/id`. - public var id: Swift.String? - /// Name of the group - /// - /// - Remark: Generated from `#/components/schemas/get_attribute_groups/name`. - public var name: Swift.String? - /// - Remark: Generated from `#/components/schemas/get_attribute_groups/attributesPayload`. - public struct attributesPayloadPayload: Codable, Hashable, Sendable { - /// unique id of the attribute - /// - /// - Remark: Generated from `#/components/schemas/get_attribute_groups/attributesPayload/id`. - public var id: Swift.String? - /// Name of the attribute - /// - /// - Remark: Generated from `#/components/schemas/get_attribute_groups/attributesPayload/name`. - public var name: Swift.String? - /// url of icon to display next to the settings for this attribute - /// - /// - Remark: Generated from `#/components/schemas/get_attribute_groups/attributesPayload/icon_url`. - public var icon_url: Swift.String? - /// a description of the attribute to display to users - /// - /// - Remark: Generated from `#/components/schemas/get_attribute_groups/attributesPayload/setting_name`. - public var setting_name: Swift.String? - /// a complementary note on the attribute - /// - /// - Remark: Generated from `#/components/schemas/get_attribute_groups/attributesPayload/setting_note`. - public var setting_note: Swift.String? - /// Indicates the default setting for this attribute - /// - /// - Remark: Generated from `#/components/schemas/get_attribute_groups/attributesPayload/default`. - @frozen public enum _defaultPayload: String, Codable, Hashable, Sendable, CaseIterable { - case mandatory = "mandatory" - case very_important = "very_important" - case important = "important" - case not_important = "not_important" - } - /// Indicates the default setting for this attribute - /// - /// - Remark: Generated from `#/components/schemas/get_attribute_groups/attributesPayload/default`. - public var _default: Components.Schemas.get_attribute_groupsPayload.attributesPayloadPayload._defaultPayload? - /// Linked knowledge panel (optional) - /// - /// - Remark: Generated from `#/components/schemas/get_attribute_groups/attributesPayload/panel_id`. - public var panel_id: Swift.String? - /// Creates a new `attributesPayloadPayload`. - /// - /// - Parameters: - /// - id: unique id of the attribute - /// - name: Name of the attribute - /// - icon_url: url of icon to display next to the settings for this attribute - /// - setting_name: a description of the attribute to display to users - /// - setting_note: a complementary note on the attribute - /// - _default: Indicates the default setting for this attribute - /// - panel_id: Linked knowledge panel (optional) - public init( - id: Swift.String? = nil, - name: Swift.String? = nil, - icon_url: Swift.String? = nil, - setting_name: Swift.String? = nil, - setting_note: Swift.String? = nil, - _default: Components.Schemas.get_attribute_groupsPayload.attributesPayloadPayload._defaultPayload? = nil, - panel_id: Swift.String? = nil - ) { - self.id = id - self.name = name - self.icon_url = icon_url - self.setting_name = setting_name - self.setting_note = setting_note - self._default = _default - self.panel_id = panel_id - } - public enum CodingKeys: String, CodingKey { - case id - case name - case icon_url - case setting_name - case setting_note - case _default = "default" - case panel_id - } - } - /// Attributes that are part of this group - /// - /// - /// - Remark: Generated from `#/components/schemas/get_attribute_groups/attributes`. - public typealias attributesPayload = [Components.Schemas.get_attribute_groupsPayload.attributesPayloadPayload] - /// Attributes that are part of this group - /// - /// - /// - Remark: Generated from `#/components/schemas/get_attribute_groups/attributes`. - public var attributes: Components.Schemas.get_attribute_groupsPayload.attributesPayload? - /// Creates a new `get_attribute_groupsPayload`. - /// - /// - Parameters: - /// - id: unique id of the group - /// - name: Name of the group - /// - attributes: Attributes that are part of this group - public init( - id: Swift.String? = nil, - name: Swift.String? = nil, - attributes: Components.Schemas.get_attribute_groupsPayload.attributesPayload? = nil - ) { - self.id = id - self.name = name - self.attributes = attributes - } - public enum CodingKeys: String, CodingKey { - case id - case name - case attributes - } - } - /// List of groups of attributes for personal search in a specific language. - /// - /// - /// - Remark: Generated from `#/components/schemas/get_attribute_groups`. - public typealias get_attribute_groups = [Components.Schemas.get_attribute_groupsPayload] - /// - Remark: Generated from `#/components/schemas/get_preferences`. - public struct get_preferencesPayload: Codable, Hashable, Sendable { - /// id for the setting value - /// - /// - Remark: Generated from `#/components/schemas/get_preferences/id`. - @frozen public enum idPayload: String, Codable, Hashable, Sendable, CaseIterable { - case not_important = "not_important" - case important = "important" - case very_important = "very_important" - case mandatory = "mandatory" - } - /// id for the setting value - /// - /// - Remark: Generated from `#/components/schemas/get_preferences/id`. - public var id: Components.Schemas.get_preferencesPayload.idPayload? - /// name for the setting value, translated according to `lc` parameter - /// - /// - Remark: Generated from `#/components/schemas/get_preferences/name`. - public var name: Swift.String? - /// factor to apply to the property of the product corresponding to attributes - /// having this setting value - /// - /// - /// - Remark: Generated from `#/components/schemas/get_preferences/factor`. - public var factor: Swift.Int? - /// FIXME - /// - /// - /// - Remark: Generated from `#/components/schemas/get_preferences/minimum_match`. - public var minimum_match: Swift.Int? - /// Creates a new `get_preferencesPayload`. - /// - /// - Parameters: - /// - id: id for the setting value - /// - name: name for the setting value, translated according to `lc` parameter - /// - factor: factor to apply to the property of the product corresponding to attributes - /// - minimum_match: FIXME - public init( - id: Components.Schemas.get_preferencesPayload.idPayload? = nil, - name: Swift.String? = nil, - factor: Swift.Int? = nil, - minimum_match: Swift.Int? = nil - ) { - self.id = id - self.name = name - self.factor = factor - self.minimum_match = minimum_match - } - public enum CodingKeys: String, CodingKey { - case id - case name - case factor - case minimum_match - } - } - /// Rules to apply to compute personal ranking of a product, - /// based upon the setting value of each attribute. - /// - /// - /// - Remark: Generated from `#/components/schemas/get_preferences`. - public typealias get_preferences = [Components.Schemas.get_preferencesPayload] - } - /// Types generated from the `#/components/parameters` section of the OpenAPI document. - public enum Parameters { - /// - Remark: Generated from `#/components/parameters/id`. - public typealias id = Swift.String - /// 2 letter code of the country of the user. Used for localizing some fields in returned values (e.g. knowledge panels). If not passed, the country may be inferred by the IP address of the request. - /// - /// - Remark: Generated from `#/components/parameters/cc`. - public typealias cc = Swift.String - /// 2 letter code of the language of the user. - /// Used for localizing some fields in returned values (e.g. knowledge panels). - /// If not passed, the language may be inferred by the Accept-Language header of the request, - /// or from the domain name prefix. - /// - /// - /// - Remark: Generated from `#/components/parameters/lc`. - public typealias lc = Swift.String - /// Barcode of the product - /// - /// - Remark: Generated from `#/components/parameters/code`. - public typealias code = Swift.String - /// - Remark: Generated from `#/components/parameters/process_image`. - public typealias process_image = Swift.String - /// - Remark: Generated from `#/components/parameters/ocr_engine`. - public typealias ocr_engine = Swift.String - /// - Remark: Generated from `#/components/parameters/imgid`. - public typealias imgid = Swift.String - /// - Remark: Generated from `#/components/parameters/angle`. - public typealias angle = Swift.String - /// The page number you request to view (eg. in search results spanning multiple pages) - /// - /// - /// - Remark: Generated from `#/components/parameters/page`. - public typealias page = Swift.Int - /// The number of elements should be sent per page - /// - /// - /// - Remark: Generated from `#/components/parameters/page_size`. - public typealias page_size = Swift.Int - /// The allowed values used to sort/order the search results. - /// - /// * `product_name` sorts on name - /// * `ecoscore_score`, `nova_score`, `nutriscore_score` rank on the [Eco-Score](https://world.openfoodfacts.org/eco-score-the-environmental-impact-of-food-products), [Nova](https://world.openfoodfacts.org/nova), or [Nutri-Score](https://world.openfoodfacts.org/nutriscore) - /// * `scans_n`, `unique_scans_n` and `popularity_key` are about product popularity: number of scans on unique scans, rank of product - /// * `created_t`, `last_modified_t`, are about creation and modification dates - /// * `nothing`, tells not to sort at all (because if you do not provide the sort_by argument we default to sorting on popularity (for food) or last modification date) - /// - /// - /// - Remark: Generated from `#/components/parameters/sort_by`. - @frozen public enum sort_by: String, Codable, Hashable, Sendable, CaseIterable { - case product_name = "product_name" - case last_modified_t = "last_modified_t" - case scans_n = "scans_n" - case unique_scans_n = "unique_scans_n" - case created_t = "created_t" - case completeness = "completeness" - case popularity_key = "popularity_key" - case nutriscore_score = "nutriscore_score" - case nova_score = "nova_score" - case nothing = "nothing" - case ecoscore_score = "ecoscore_score" - } - /// The fields to be returned from the product object can also be limited. - /// If not specified, it returns the entire product object response. - /// - /// - /// - Remark: Generated from `#/components/parameters/fields`. - public typealias fields = Swift.String - /// When knowledge_panels are requested, you can specify which panels should be in the response. All the others will be excluded. - /// - /// - /// - Remark: Generated from `#/components/parameters/knowledge_panels_included`. - public typealias knowledge_panels_included = Swift.String - /// When knowledge_panels are requested, you can specify which panels to exclude from the response. All the others will be included. - /// If a panel is both excluded and included (with the knowledge_panels_excluded parameter), it will be excluded. - /// - /// - /// - Remark: Generated from `#/components/parameters/knowledge_panels_excluded`. - public typealias knowledge_panels_excluded = Swift.String - /// - Remark: Generated from `#/components/parameters/tagtype`. - public typealias tagtype = Swift.String - /// - Remark: Generated from `#/components/parameters/term`. - public typealias term = Swift.String - /// The additives_tags in english of product(s) you are searching for. - /// The [OFF App](https://world.openfoodfacts.org/additives) has a list of possible values for `additives`. - /// - /// You can use multiple values by using a comma separated list. - /// You can add a "-" before values to avoid matching a tag. - /// - /// - /// - Remark: Generated from `#/components/parameters/tags_parameters_properties_additives_tags`. - public typealias tags_parameters_properties_additives_tags = Swift.String - /// The allergens_tags in english of product(s) you are searching for. - /// The [OFF App](https://world.openfoodfacts.org/allergens) has a list of possible values for `allergens`. - /// - /// You can use multiple values by using a comma separated list. - /// You can add a "-" before values to avoid matching a tag. - /// - /// - /// - Remark: Generated from `#/components/parameters/tags_parameters_properties_allergens_tags`. - public typealias tags_parameters_properties_allergens_tags = Swift.String - /// The brands_tags of product(s) you are searching for. - /// The [OFF App](https://world.openfoodfacts.org/brands) has a list of possible values for `brands`. - /// - /// You can use multiple values by using a comma separated list. - /// You can add a "-" before values to avoid matching a tag. - /// - /// - /// - Remark: Generated from `#/components/parameters/tags_parameters_properties_brands_tags`. - public typealias tags_parameters_properties_brands_tags = Swift.String - /// The category of product(s) you are searching for. - /// The [OFF App](https://world.openfoodfacts.org/categories) has a list of possible values for `categories`. - /// - /// You can use multiple values by using a comma separated list. - /// You can add a "-" before values to avoid matching a tag. - /// - /// - /// - Remark: Generated from `#/components/parameters/tags_parameters_properties_categories_tags`. - public typealias tags_parameters_properties_categories_tags = Swift.String - /// The countries_tags_en of product(s) you are searching for. - /// The [OFF App](https://world.openfoodfacts.org/countries) shows a list of possible values for `countries`. - /// - /// You can use multiple values by using a comma separated list. - /// You can add a "-" before values to avoid matching a tag. - /// - /// - /// - Remark: Generated from `#/components/parameters/tags_parameters_properties_countries_tags`. - public typealias tags_parameters_properties_countries_tags = Swift.String - /// The emb_codes_tags of product(s) you are searching for. - /// - /// You can use multiple values by using a comma separated list. - /// You can add a "-" before values to avoid matching a tag. - /// - /// - /// - Remark: Generated from `#/components/parameters/tags_parameters_properties_emb_codes_tags`. - public typealias tags_parameters_properties_emb_codes_tags = Swift.String - /// The labels_tags in english of product(s) you are searching for. - /// The [OFF App](https://world.openfoodfacts.org/labels) has a list of possible values for `labels`. - /// - /// You can use multiple values by using a comma separated list. - /// You can add a "-" before values to avoid matching a tag. - /// - /// - /// - Remark: Generated from `#/components/parameters/tags_parameters_properties_labels_tags`. - public typealias tags_parameters_properties_labels_tags = Swift.String - /// The manufacturing_places_tags of product(s) you are searching for. - /// The [OFF App](https://world.openfoodfacts.org/manufacturing-places) has a list of possible values for `manufacturing-places`. - /// - /// You can use multiple values by using a comma separated list. - /// You can add a "-" before values to avoid matching a tag. - /// - /// - /// - Remark: Generated from `#/components/parameters/tags_parameters_properties_manufacturing_places_tags`. - public typealias tags_parameters_properties_manufacturing_places_tags = Swift.String - /// The nutrition_grades_tags of product(s) you are searching for. - /// The [OFF App](https://world.openfoodfacts.org/nutrition-grades) has a list of possible values for `nutrition-grades`. - /// - /// You can use multiple values by using a comma separated list. - /// You can add a "-" before values to avoid matching a tag. - /// - /// - /// - Remark: Generated from `#/components/parameters/tags_parameters_properties_nutrition_grades_tags`. - public typealias tags_parameters_properties_nutrition_grades_tags = Swift.String - /// The origins_tags of product(s) you are searching for. - /// - /// You can use multiple values by using a comma separated list. - /// You can add a "-" before values to avoid matching a tag. - /// - /// - /// - Remark: Generated from `#/components/parameters/tags_parameters_properties_origins_tags`. - public typealias tags_parameters_properties_origins_tags = Swift.String - /// The packaging_tag in german of product(s) you are searching for. - /// The [OFF App](https://world.openfoodfacts.org/packaging) has a list of possible values for `packaging`. - /// - /// You can use multiple values by using a comma separated list. - /// You can add a "-" before values to avoid matching a tag. - /// - /// - /// - Remark: Generated from `#/components/parameters/tags_parameters_properties_packaging_tags`. - public typealias tags_parameters_properties_packaging_tags = Swift.String - /// The purchase_places_tags of product(s) you are searching for. - /// - /// You can use multiple values by using a comma separated list. - /// You can add a "-" before values to avoid matching a tag. - /// - /// - /// - Remark: Generated from `#/components/parameters/tags_parameters_properties_purchase_places_tags`. - public typealias tags_parameters_properties_purchase_places_tags = Swift.String - /// The states_tags in english of product(s) you are searching for. - /// The [OFF App](https://world.openfoodfacts.org/states) has a list of possible values for `states`. - /// - /// You can use multiple values by using a comma separated list. - /// You can add a "-" before values to avoid matching a tag. - /// - /// - /// - Remark: Generated from `#/components/parameters/tags_parameters_properties_states_tags`. - public typealias tags_parameters_properties_states_tags = Swift.String - /// The stores_tags of product(s) you are searching for. - /// - /// You can use multiple values by using a comma separated list. - /// You can add a "-" before values to avoid matching a tag. - /// - /// - /// - Remark: Generated from `#/components/parameters/tags_parameters_properties_stores_tags`. - public typealias tags_parameters_properties_stores_tags = Swift.String - /// The traces_tags of product(s) you are searching for. - /// The [OFF App](https://world.openfoodfacts.org/traces) shows a list of possible values for `traces`. - /// - /// You can use multiple values by using a comma separated list. - /// You can add a "-" before values to avoid matching a tag. - /// - /// - /// - Remark: Generated from `#/components/parameters/tags_parameters_properties_traces_tags`. - public typealias tags_parameters_properties_traces_tags = Swift.String - /// You can add a language code to a specific tag to query it in a specific language - /// - /// - /// - Remark: Generated from `#/components/parameters/tags_parameters_properties_tag_name_with_language_code`. - public struct tags_parameters_properties_tag_name_with_language_code: Codable, Hashable, Sendable { - /// Will search in the tags corresponding to `tag_name`, - /// in the language corresponding to `language_code. - /// - /// `tag_name` is one of the field above which have the `_tags`` suffix: - /// categories, nutrition_grades, etc. - /// - /// `language_code` is a two letter iso language `language_code. - /// - /// You can use multiple values by using a comma separated list. - /// You can add a "-" before values to avoid matching a tag. - /// - /// - /// - Remark: Generated from `#/components/parameters/tags_parameters_properties_tag_name_with_language_code/tag_name_example`. - public var tag_name_example: Swift.String? - /// Creates a new `tags_parameters_properties_tag_name_with_language_code`. - /// - /// - Parameters: - /// - tag_name_example: Will search in the tags corresponding to `tag_name`, - public init(tag_name_example: Swift.String? = nil) { - self.tag_name_example = tag_name_example - } - public enum CodingKeys: String, CodingKey { - case tag_name_example - } - } - /// Search on nutrient lower than a value - /// - /// - /// - Remark: Generated from `#/components/parameters/nutrition_search_properties_nutrient_lower_than`. - public struct nutrition_search_properties_nutrient_lower_than: Codable, Hashable, Sendable { - /// Will search for products with nutrients lower than `value` - /// per `portion` (100g or serving). - /// - /// If `prepared` is "prepared" search in prepared product instead of "as sold". - /// - /// Important: the parameter value is discarded and should be empty - /// - /// - /// - Remark: Generated from `#/components/parameters/nutrition_search_properties_nutrient_lower_than/nutrient_example`. - public var nutrient_example: Swift.String? - /// Creates a new `nutrition_search_properties_nutrient_lower_than`. - /// - /// - Parameters: - /// - nutrient_example: Will search for products with nutrients lower than `value` - public init(nutrient_example: Swift.String? = nil) { - self.nutrient_example = nutrient_example - } - public enum CodingKeys: String, CodingKey { - case nutrient_example - } - } - /// Search on nutrient greater than a value - /// - /// - /// - Remark: Generated from `#/components/parameters/nutrition_search_properties_nutrient_greater_than`. - public struct nutrition_search_properties_nutrient_greater_than: Codable, Hashable, Sendable { - /// Will search for products with nutrients more than `value` - /// per `portion` (100g or serving). - /// - /// If `prepared` is "prepared" search in prepared product instead of "as sold". - /// - /// Important: the parameter value is discarded and should be empty - /// - /// - /// - Remark: Generated from `#/components/parameters/nutrition_search_properties_nutrient_greater_than/nutrient_example`. - public var nutrient_example: Swift.String? - /// Creates a new `nutrition_search_properties_nutrient_greater_than`. - /// - /// - Parameters: - /// - nutrient_example: Will search for products with nutrients more than `value` - public init(nutrient_example: Swift.String? = nil) { - self.nutrient_example = nutrient_example - } - public enum CodingKeys: String, CodingKey { - case nutrient_example - } - } - /// Search on nutrient for an exact quantity - /// - /// - /// - Remark: Generated from `#/components/parameters/nutrition_search_properties_nutrient_equal`. - public struct nutrition_search_properties_nutrient_equal: Codable, Hashable, Sendable { - /// Will search for products with nutrients exactl the parameter value - /// per `portion` (100g or serving). - /// - /// If `prepared` is "prepared" search in prepared product instead of "as sold". - /// - /// - /// - Remark: Generated from `#/components/parameters/nutrition_search_properties_nutrient_equal/nutrient_example`. - public var nutrient_example: Swift.String? - /// Creates a new `nutrition_search_properties_nutrient_equal`. - /// - /// - Parameters: - /// - nutrient_example: Will search for products with nutrients exactl the parameter value - public init(nutrient_example: Swift.String? = nil) { - self.nutrient_example = nutrient_example - } - public enum CodingKeys: String, CodingKey { - case nutrient_example - } - } - } - /// Types generated from the `#/components/requestBodies` section of the OpenAPI document. - public enum RequestBodies {} - /// Types generated from the `#/components/responses` section of the OpenAPI document. - public enum Responses {} - /// Types generated from the `#/components/headers` section of the OpenAPI document. - public enum Headers {} -} - -/// API operations, with input and output types, generated from `#/paths` in the OpenAPI document. -public enum Operations { - /// Get information for a specific product by barcode - /// - /// A product can be fetched via its unique barcode. - /// It returns all the details of that product response. - /// - /// - /// - Remark: HTTP `GET /api/v2/product/{barcode}`. - /// - Remark: Generated from `#/paths//api/v2/product/{barcode}/get(getProductByBarcode)`. - public enum getProductByBarcode { - public static let id: Swift.String = "getProductByBarcode" - public struct Input: Sendable, Hashable { - /// - Remark: Generated from `#/paths/api/v2/product/{barcode}/GET/path`. - public struct Path: Sendable, Hashable { - /// The barcode of the product to be fetched - /// - /// - /// - Remark: Generated from `#/paths/api/v2/product/{barcode}/GET/path/barcode`. - public var barcode: Swift.String - /// Creates a new `Path`. - /// - /// - Parameters: - /// - barcode: The barcode of the product to be fetched - public init(barcode: Swift.String) { - self.barcode = barcode - } - } - public var path: Operations.getProductByBarcode.Input.Path - /// - Remark: Generated from `#/paths/api/v2/product/{barcode}/GET/header`. - public struct Headers: Sendable, Hashable { - public var accept: [OpenAPIRuntime.AcceptHeaderContentType] - /// Creates a new `Headers`. - /// - /// - Parameters: - /// - accept: - public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { - self.accept = accept - } - } - public var headers: Operations.getProductByBarcode.Input.Headers - /// Creates a new `Input`. - /// - /// - Parameters: - /// - path: - /// - headers: - public init( - path: Operations.getProductByBarcode.Input.Path, - headers: Operations.getProductByBarcode.Input.Headers = .init() - ) { - self.path = path - self.headers = headers - } - } - @frozen public enum Output: Sendable, Hashable { - public struct Ok: Sendable, Hashable { - /// - Remark: Generated from `#/paths/api/v2/product/{barcode}/GET/responses/200/content`. - @frozen public enum Body: Sendable, Hashable { - /// - Remark: Generated from `#/paths/api/v2/product/{barcode}/GET/responses/200/content/application\/json`. - case json(Components.Schemas.get_product_by_barcode) - /// The associated value of the enum case if `self` is `.json`. - /// - /// - Throws: An error if `self` is not `.json`. - /// - SeeAlso: `.json`. - public var json: Components.Schemas.get_product_by_barcode { - get throws { - switch self { - case let .json(body): - return body - } - } - } - } - /// Received HTTP response body - public var body: Operations.getProductByBarcode.Output.Ok.Body - /// Creates a new `Ok`. - /// - /// - Parameters: - /// - body: Received HTTP response body - public init(body: Operations.getProductByBarcode.Output.Ok.Body) { - self.body = body - } - } - /// OK - /// - /// - Remark: Generated from `#/paths//api/v2/product/{barcode}/get(getProductByBarcode)/responses/200`. - /// - /// HTTP response code: `200 ok`. - case ok(Operations.getProductByBarcode.Output.Ok) - /// The associated value of the enum case if `self` is `.ok`. - /// - /// - Throws: An error if `self` is not `.ok`. - /// - SeeAlso: `.ok`. - public var ok: Operations.getProductByBarcode.Output.Ok { - get throws { - switch self { - case let .ok(response): - return response - default: - try throwUnexpectedResponseStatus( - expectedStatus: "ok", - response: self - ) - } - } - } - /// Undocumented response. - /// - /// A response with a code that is not documented in the OpenAPI document. - case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) - } - @frozen public enum AcceptableContentType: AcceptableProtocol { - case json - case other(Swift.String) - public init?(rawValue: Swift.String) { - switch rawValue.lowercased() { - case "application/json": - self = .json - default: - self = .other(rawValue) - } - } - public var rawValue: Swift.String { - switch self { - case let .other(string): - return string - case .json: - return "application/json" - } - } - public static var allCases: [Self] { - [ - .json - ] - } - } - } - /// Get Knowledge panels for a specific product by barcode - /// (special case of get product) - /// - /// - /// Knowledge panels gives high leve informations about a product, - /// ready to display. - /// This is used by open food facts website, - /// and by the official mobile application - /// - /// - /// - Remark: HTTP `GET /api/v2/product/{barcode}?fields=knowledge_panels`. - /// - Remark: Generated from `#/paths//api/v2/product/{barcode}?fields=knowledge_panels/get(getProductByBarcodeKnowledgePanels)`. - public enum getProductByBarcodeKnowledgePanels { - public static let id: Swift.String = "getProductByBarcodeKnowledgePanels" - public struct Input: Sendable, Hashable { - /// - Remark: Generated from `#/paths/api/v2/product/{barcode}?fields=knowledge_panels/GET/path`. - public struct Path: Sendable, Hashable { - /// The barcode of the product to be fetched - /// - /// - /// - Remark: Generated from `#/paths/api/v2/product/{barcode}?fields=knowledge_panels/GET/path/barcode`. - public var barcode: Swift.String - /// Creates a new `Path`. - /// - /// - Parameters: - /// - barcode: The barcode of the product to be fetched - public init(barcode: Swift.String) { - self.barcode = barcode - } - } - public var path: Operations.getProductByBarcodeKnowledgePanels.Input.Path - /// - Remark: Generated from `#/paths/api/v2/product/{barcode}?fields=knowledge_panels/GET/header`. - public struct Headers: Sendable, Hashable { - public var accept: [OpenAPIRuntime.AcceptHeaderContentType] - /// Creates a new `Headers`. - /// - /// - Parameters: - /// - accept: - public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { - self.accept = accept - } - } - public var headers: Operations.getProductByBarcodeKnowledgePanels.Input.Headers - /// Creates a new `Input`. - /// - /// - Parameters: - /// - path: - /// - headers: - public init( - path: Operations.getProductByBarcodeKnowledgePanels.Input.Path, - headers: Operations.getProductByBarcodeKnowledgePanels.Input.Headers = .init() - ) { - self.path = path - self.headers = headers - } - } - @frozen public enum Output: Sendable, Hashable { - public struct Ok: Sendable, Hashable { - /// - Remark: Generated from `#/paths/api/v2/product/{barcode}?fields=knowledge_panels/GET/responses/200/content`. - @frozen public enum Body: Sendable, Hashable { - /// - Remark: Generated from `#/paths/api/v2/product/{barcode}?fields=knowledge_panels/GET/responses/200/content/json`. - public struct jsonPayload: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/paths/api/v2/product/{barcode}?fields=knowledge_panels/GET/responses/200/content/json/value1`. - public var value1: Components.Schemas.get_product_by_barcode_base - /// - Remark: Generated from `#/paths/api/v2/product/{barcode}?fields=knowledge_panels/GET/responses/200/content/json/value2`. - public struct Value2Payload: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/paths/api/v2/product/{barcode}?fields=knowledge_panels/GET/responses/200/content/json/value2/product`. - public var product: Components.Schemas.product_knowledge_panels? - /// Creates a new `Value2Payload`. - /// - /// - Parameters: - /// - product: - public init(product: Components.Schemas.product_knowledge_panels? = nil) { - self.product = product - } - public enum CodingKeys: String, CodingKey { - case product - } - } - /// - Remark: Generated from `#/paths/api/v2/product/{barcode}?fields=knowledge_panels/GET/responses/200/content/json/value2`. - public var value2: Operations.getProductByBarcodeKnowledgePanels.Output.Ok.Body.jsonPayload.Value2Payload - /// Creates a new `jsonPayload`. - /// - /// - Parameters: - /// - value1: - /// - value2: - public init( - value1: Components.Schemas.get_product_by_barcode_base, - value2: Operations.getProductByBarcodeKnowledgePanels.Output.Ok.Body.jsonPayload.Value2Payload - ) { - self.value1 = value1 - self.value2 = value2 - } - public init(from decoder: any Decoder) throws { - value1 = try .init(from: decoder) - value2 = try .init(from: decoder) - } - public func encode(to encoder: any Encoder) throws { - try value1.encode(to: encoder) - try value2.encode(to: encoder) - } - } - /// - Remark: Generated from `#/paths/api/v2/product/{barcode}?fields=knowledge_panels/GET/responses/200/content/application\/json`. - case json(Operations.getProductByBarcodeKnowledgePanels.Output.Ok.Body.jsonPayload) - /// The associated value of the enum case if `self` is `.json`. - /// - /// - Throws: An error if `self` is not `.json`. - /// - SeeAlso: `.json`. - public var json: Operations.getProductByBarcodeKnowledgePanels.Output.Ok.Body.jsonPayload { - get throws { - switch self { - case let .json(body): - return body - } - } - } - } - /// Received HTTP response body - public var body: Operations.getProductByBarcodeKnowledgePanels.Output.Ok.Body - /// Creates a new `Ok`. - /// - /// - Parameters: - /// - body: Received HTTP response body - public init(body: Operations.getProductByBarcodeKnowledgePanels.Output.Ok.Body) { - self.body = body - } - } - /// OK - /// - /// - Remark: Generated from `#/paths//api/v2/product/{barcode}?fields=knowledge_panels/get(getProductByBarcodeKnowledgePanels)/responses/200`. - /// - /// HTTP response code: `200 ok`. - case ok(Operations.getProductByBarcodeKnowledgePanels.Output.Ok) - /// The associated value of the enum case if `self` is `.ok`. - /// - /// - Throws: An error if `self` is not `.ok`. - /// - SeeAlso: `.ok`. - public var ok: Operations.getProductByBarcodeKnowledgePanels.Output.Ok { - get throws { - switch self { - case let .ok(response): - return response - default: - try throwUnexpectedResponseStatus( - expectedStatus: "ok", - response: self - ) - } - } - } - /// Undocumented response. - /// - /// A response with a code that is not documented in the OpenAPI document. - case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) - } - @frozen public enum AcceptableContentType: AcceptableProtocol { - case json - case other(Swift.String) - public init?(rawValue: Swift.String) { - switch rawValue.lowercased() { - case "application/json": - self = .json - default: - self = .other(rawValue) - } - } - public var rawValue: Swift.String { - switch self { - case let .other(string): - return string - case .json: - return "application/json" - } - } - public static var allCases: [Self] { - [ - .json - ] - } - } - } - /// Performing OCR on a Product - /// - /// Open Food Facts uses optical character recognition (OCR) to retrieve nutritional data and other information from the product labels. - /// - /// - /// - Remark: HTTP `GET /cgi/ingredients.pl`. - /// - Remark: Generated from `#/paths//cgi/ingredients.pl/get(getIngredients)`. - public enum getIngredients { - public static let id: Swift.String = "getIngredients" - public struct Input: Sendable, Hashable { - /// - Remark: Generated from `#/paths/cgi/ingredients.pl/GET/query`. - public struct Query: Sendable, Hashable { - /// - Remark: Generated from `#/paths/cgi/ingredients.pl/GET/query/id`. - public var id: Components.Parameters.id - /// Barcode of the product - /// - /// - Remark: Generated from `#/paths/cgi/ingredients.pl/GET/query/code`. - public var code: Components.Parameters.code - /// - Remark: Generated from `#/paths/cgi/ingredients.pl/GET/query/process_image`. - public var process_image: Components.Parameters.process_image - /// - Remark: Generated from `#/paths/cgi/ingredients.pl/GET/query/ocr_engine`. - public var ocr_engine: Components.Parameters.ocr_engine - /// Creates a new `Query`. - /// - /// - Parameters: - /// - id: - /// - code: Barcode of the product - /// - process_image: - /// - ocr_engine: - public init( - id: Components.Parameters.id, - code: Components.Parameters.code, - process_image: Components.Parameters.process_image, - ocr_engine: Components.Parameters.ocr_engine - ) { - self.id = id - self.code = code - self.process_image = process_image - self.ocr_engine = ocr_engine - } - } - public var query: Operations.getIngredients.Input.Query - /// - Remark: Generated from `#/paths/cgi/ingredients.pl/GET/header`. - public struct Headers: Sendable, Hashable { - public var accept: [OpenAPIRuntime.AcceptHeaderContentType] - /// Creates a new `Headers`. - /// - /// - Parameters: - /// - accept: - public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { - self.accept = accept - } - } - public var headers: Operations.getIngredients.Input.Headers - /// Creates a new `Input`. - /// - /// - Parameters: - /// - query: - /// - headers: - public init( - query: Operations.getIngredients.Input.Query, - headers: Operations.getIngredients.Input.Headers = .init() - ) { - self.query = query - self.headers = headers - } - } - @frozen public enum Output: Sendable, Hashable { - public struct Ok: Sendable, Hashable { - /// - Remark: Generated from `#/paths/cgi/ingredients.pl/GET/responses/200/content`. - @frozen public enum Body: Sendable, Hashable { - /// - Remark: Generated from `#/paths/cgi/ingredients.pl/GET/responses/200/content/application\/json`. - case json(Components.Schemas.ocr_on_product) - /// The associated value of the enum case if `self` is `.json`. - /// - /// - Throws: An error if `self` is not `.json`. - /// - SeeAlso: `.json`. - public var json: Components.Schemas.ocr_on_product { - get throws { - switch self { - case let .json(body): - return body - } - } - } - } - /// Received HTTP response body - public var body: Operations.getIngredients.Output.Ok.Body - /// Creates a new `Ok`. - /// - /// - Parameters: - /// - body: Received HTTP response body - public init(body: Operations.getIngredients.Output.Ok.Body) { - self.body = body - } - } - /// OK - /// - /// - Remark: Generated from `#/paths//cgi/ingredients.pl/get(getIngredients)/responses/200`. - /// - /// HTTP response code: `200 ok`. - case ok(Operations.getIngredients.Output.Ok) - /// The associated value of the enum case if `self` is `.ok`. - /// - /// - Throws: An error if `self` is not `.ok`. - /// - SeeAlso: `.ok`. - public var ok: Operations.getIngredients.Output.Ok { - get throws { - switch self { - case let .ok(response): - return response - default: - try throwUnexpectedResponseStatus( - expectedStatus: "ok", - response: self - ) - } - } - } - /// Undocumented response. - /// - /// A response with a code that is not documented in the OpenAPI document. - case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) - } - @frozen public enum AcceptableContentType: AcceptableProtocol { - case json - case other(Swift.String) - public init?(rawValue: Swift.String) { - switch rawValue.lowercased() { - case "application/json": - self = .json - default: - self = .other(rawValue) - } - } - public var rawValue: Swift.String { - switch self { - case let .other(string): - return string - case .json: - return "application/json" - } - } - public static var allCases: [Self] { - [ - .json - ] - } - } - } - /// Rotate A Photo - /// - /// Although we recommend rotating photos manually and uploading a new version of the image, - /// the OFF API allows you to make api calls to automate this process. - /// You can rotate existing photos by setting the angle to 90º, 180º, or 270º clockwise. - /// - /// - /// - Remark: HTTP `GET /cgi/product_image_crop.pl`. - /// - Remark: Generated from `#/paths//cgi/product_image_crop.pl/get(getProductImageCrop)`. - public enum getProductImageCrop { - public static let id: Swift.String = "getProductImageCrop" - public struct Input: Sendable, Hashable { - /// - Remark: Generated from `#/paths/cgi/product_image_crop.pl/GET/query`. - public struct Query: Sendable, Hashable { - /// Barcode of the product - /// - /// - Remark: Generated from `#/paths/cgi/product_image_crop.pl/GET/query/code`. - public var code: Components.Parameters.code - /// - Remark: Generated from `#/paths/cgi/product_image_crop.pl/GET/query/id`. - public var id: Components.Parameters.id - /// - Remark: Generated from `#/paths/cgi/product_image_crop.pl/GET/query/imgid`. - public var imgid: Components.Parameters.imgid - /// - Remark: Generated from `#/paths/cgi/product_image_crop.pl/GET/query/angle`. - public var angle: Components.Parameters.angle - /// Creates a new `Query`. - /// - /// - Parameters: - /// - code: Barcode of the product - /// - id: - /// - imgid: - /// - angle: - public init( - code: Components.Parameters.code, - id: Components.Parameters.id, - imgid: Components.Parameters.imgid, - angle: Components.Parameters.angle - ) { - self.code = code - self.id = id - self.imgid = imgid - self.angle = angle - } - } - public var query: Operations.getProductImageCrop.Input.Query - /// - Remark: Generated from `#/paths/cgi/product_image_crop.pl/GET/header`. - public struct Headers: Sendable, Hashable { - public var accept: [OpenAPIRuntime.AcceptHeaderContentType] - /// Creates a new `Headers`. - /// - /// - Parameters: - /// - accept: - public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { - self.accept = accept - } - } - public var headers: Operations.getProductImageCrop.Input.Headers - /// Creates a new `Input`. - /// - /// - Parameters: - /// - query: - /// - headers: - public init( - query: Operations.getProductImageCrop.Input.Query, - headers: Operations.getProductImageCrop.Input.Headers = .init() - ) { - self.query = query - self.headers = headers - } - } - @frozen public enum Output: Sendable, Hashable { - public struct Ok: Sendable, Hashable { - /// - Remark: Generated from `#/paths/cgi/product_image_crop.pl/GET/responses/200/content`. - @frozen public enum Body: Sendable, Hashable { - /// - Remark: Generated from `#/paths/cgi/product_image_crop.pl/GET/responses/200/content/application\/json`. - case json(Components.Schemas.rotate_a_photo) - /// The associated value of the enum case if `self` is `.json`. - /// - /// - Throws: An error if `self` is not `.json`. - /// - SeeAlso: `.json`. - public var json: Components.Schemas.rotate_a_photo { - get throws { - switch self { - case let .json(body): - return body - } - } - } - } - /// Received HTTP response body - public var body: Operations.getProductImageCrop.Output.Ok.Body - /// Creates a new `Ok`. - /// - /// - Parameters: - /// - body: Received HTTP response body - public init(body: Operations.getProductImageCrop.Output.Ok.Body) { - self.body = body - } - } - /// OK - /// - /// - Remark: Generated from `#/paths//cgi/product_image_crop.pl/get(getProductImageCrop)/responses/200`. - /// - /// HTTP response code: `200 ok`. - case ok(Operations.getProductImageCrop.Output.Ok) - /// The associated value of the enum case if `self` is `.ok`. - /// - /// - Throws: An error if `self` is not `.ok`. - /// - SeeAlso: `.ok`. - public var ok: Operations.getProductImageCrop.Output.Ok { - get throws { - switch self { - case let .ok(response): - return response - default: - try throwUnexpectedResponseStatus( - expectedStatus: "ok", - response: self - ) - } - } - } - /// Undocumented response. - /// - /// A response with a code that is not documented in the OpenAPI document. - case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) - } - @frozen public enum AcceptableContentType: AcceptableProtocol { - case json - case other(Swift.String) - public init?(rawValue: Swift.String) { - switch rawValue.lowercased() { - case "application/json": - self = .json - default: - self = .other(rawValue) - } - } - public var rawValue: Swift.String { - switch self { - case let .other(string): - return string - case .json: - return "application/json" - } - } - public static var allCases: [Self] { - [ - .json - ] - } - } - } - /// Crop A Photo - /// - /// Cropping is only relevant for editing existing products. - /// You cannot crop an image the first time you upload it to the system. - /// - /// - /// - Remark: HTTP `POST /cgi/product_image_crop.pl`. - /// - Remark: Generated from `#/paths//cgi/product_image_crop.pl/post(productImageCrop)`. - public enum productImageCrop { - public static let id: Swift.String = "productImageCrop" - public struct Input: Sendable, Hashable { - /// - Remark: Generated from `#/paths/cgi/product_image_crop.pl/POST/header`. - public struct Headers: Sendable, Hashable { - public var accept: [OpenAPIRuntime.AcceptHeaderContentType] - /// Creates a new `Headers`. - /// - /// - Parameters: - /// - accept: - public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { - self.accept = accept - } - } - public var headers: Operations.productImageCrop.Input.Headers - /// - Remark: Generated from `#/paths/cgi/product_image_crop.pl/POST/requestBody`. - @frozen public enum Body: Sendable, Hashable { - /// - Remark: Generated from `#/paths/cgi/product_image_crop.pl/POST/requestBody/content/multipart\/form-data`. - case multipartForm(OpenAPIRuntime.MultipartBody) - } - public var body: Operations.productImageCrop.Input.Body - /// Creates a new `Input`. - /// - /// - Parameters: - /// - headers: - /// - body: - public init( - headers: Operations.productImageCrop.Input.Headers = .init(), - body: Operations.productImageCrop.Input.Body - ) { - self.headers = headers - self.body = body - } - } - @frozen public enum Output: Sendable, Hashable { - public struct Ok: Sendable, Hashable { - /// - Remark: Generated from `#/paths/cgi/product_image_crop.pl/POST/responses/200/content`. - @frozen public enum Body: Sendable, Hashable { - /// - Remark: Generated from `#/paths/cgi/product_image_crop.pl/POST/responses/200/content/application\/json`. - case json(OpenAPIRuntime.OpenAPIObjectContainer) - /// The associated value of the enum case if `self` is `.json`. - /// - /// - Throws: An error if `self` is not `.json`. - /// - SeeAlso: `.json`. - public var json: OpenAPIRuntime.OpenAPIObjectContainer { - get throws { - switch self { - case let .json(body): - return body - } - } - } - } - /// Received HTTP response body - public var body: Operations.productImageCrop.Output.Ok.Body - /// Creates a new `Ok`. - /// - /// - Parameters: - /// - body: Received HTTP response body - public init(body: Operations.productImageCrop.Output.Ok.Body) { - self.body = body - } - } - /// OK - /// - /// - Remark: Generated from `#/paths//cgi/product_image_crop.pl/post(productImageCrop)/responses/200`. - /// - /// HTTP response code: `200 ok`. - case ok(Operations.productImageCrop.Output.Ok) - /// The associated value of the enum case if `self` is `.ok`. - /// - /// - Throws: An error if `self` is not `.ok`. - /// - SeeAlso: `.ok`. - public var ok: Operations.productImageCrop.Output.Ok { - get throws { - switch self { - case let .ok(response): - return response - default: - try throwUnexpectedResponseStatus( - expectedStatus: "ok", - response: self - ) - } - } - } - /// Undocumented response. - /// - /// A response with a code that is not documented in the OpenAPI document. - case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) - } - @frozen public enum AcceptableContentType: AcceptableProtocol { - case json - case other(Swift.String) - public init?(rawValue: Swift.String) { - switch rawValue.lowercased() { - case "application/json": - self = .json - default: - self = .other(rawValue) - } - } - public var rawValue: Swift.String { - switch self { - case let .other(string): - return string - case .json: - return "application/json" - } - } - public static var allCases: [Self] { - [ - .json - ] - } - } - } - /// Unselect A Photo - /// - /// - Remark: HTTP `POST /cgi/product_image_unselect.pl`. - /// - Remark: Generated from `#/paths//cgi/product_image_unselect.pl/post(postProductImageUnselect)`. - public enum postProductImageUnselect { - public static let id: Swift.String = "postProductImageUnselect" - public struct Input: Sendable, Hashable { - /// - Remark: Generated from `#/paths/cgi/product_image_unselect.pl/POST/header`. - public struct Headers: Sendable, Hashable { - public var accept: [OpenAPIRuntime.AcceptHeaderContentType] - /// Creates a new `Headers`. - /// - /// - Parameters: - /// - accept: - public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { - self.accept = accept - } - } - public var headers: Operations.postProductImageUnselect.Input.Headers - /// - Remark: Generated from `#/paths/cgi/product_image_unselect.pl/POST/requestBody`. - @frozen public enum Body: Sendable, Hashable { - /// - Remark: Generated from `#/paths/cgi/product_image_unselect.pl/POST/requestBody/content/multipart\/form-data`. - case multipartForm(OpenAPIRuntime.MultipartBody) - } - public var body: Operations.postProductImageUnselect.Input.Body - /// Creates a new `Input`. - /// - /// - Parameters: - /// - headers: - /// - body: - public init( - headers: Operations.postProductImageUnselect.Input.Headers = .init(), - body: Operations.postProductImageUnselect.Input.Body - ) { - self.headers = headers - self.body = body - } - } - @frozen public enum Output: Sendable, Hashable { - public struct Ok: Sendable, Hashable { - /// - Remark: Generated from `#/paths/cgi/product_image_unselect.pl/POST/responses/200/content`. - @frozen public enum Body: Sendable, Hashable { - /// - Remark: Generated from `#/paths/cgi/product_image_unselect.pl/POST/responses/200/content/json`. - public struct jsonPayload: Codable, Hashable, Sendable { - /// status of the unselect operation - /// - /// - Remark: Generated from `#/paths/cgi/product_image_unselect.pl/POST/responses/200/content/json/status`. - public var status: Swift.String? - /// status code of the operation - /// - /// - Remark: Generated from `#/paths/cgi/product_image_unselect.pl/POST/responses/200/content/json/status_code`. - public var status_code: Swift.Double? - /// image field that was unselected - /// - /// - Remark: Generated from `#/paths/cgi/product_image_unselect.pl/POST/responses/200/content/json/imagefield`. - public var imagefield: Swift.String? - /// Creates a new `jsonPayload`. - /// - /// - Parameters: - /// - status: status of the unselect operation - /// - status_code: status code of the operation - /// - imagefield: image field that was unselected - public init( - status: Swift.String? = nil, - status_code: Swift.Double? = nil, - imagefield: Swift.String? = nil - ) { - self.status = status - self.status_code = status_code - self.imagefield = imagefield - } - public enum CodingKeys: String, CodingKey { - case status - case status_code - case imagefield - } - } - /// - Remark: Generated from `#/paths/cgi/product_image_unselect.pl/POST/responses/200/content/application\/json`. - case json(Operations.postProductImageUnselect.Output.Ok.Body.jsonPayload) - /// The associated value of the enum case if `self` is `.json`. - /// - /// - Throws: An error if `self` is not `.json`. - /// - SeeAlso: `.json`. - public var json: Operations.postProductImageUnselect.Output.Ok.Body.jsonPayload { - get throws { - switch self { - case let .json(body): - return body - } - } - } - } - /// Received HTTP response body - public var body: Operations.postProductImageUnselect.Output.Ok.Body - /// Creates a new `Ok`. - /// - /// - Parameters: - /// - body: Received HTTP response body - public init(body: Operations.postProductImageUnselect.Output.Ok.Body) { - self.body = body - } - } - /// OK - /// - /// - Remark: Generated from `#/paths//cgi/product_image_unselect.pl/post(postProductImageUnselect)/responses/200`. - /// - /// HTTP response code: `200 ok`. - case ok(Operations.postProductImageUnselect.Output.Ok) - /// The associated value of the enum case if `self` is `.ok`. - /// - /// - Throws: An error if `self` is not `.ok`. - /// - SeeAlso: `.ok`. - public var ok: Operations.postProductImageUnselect.Output.Ok { - get throws { - switch self { - case let .ok(response): - return response - default: - try throwUnexpectedResponseStatus( - expectedStatus: "ok", - response: self - ) - } - } - } - /// Undocumented response. - /// - /// A response with a code that is not documented in the OpenAPI document. - case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) - } - @frozen public enum AcceptableContentType: AcceptableProtocol { - case json - case other(Swift.String) - public init?(rawValue: Swift.String) { - switch rawValue.lowercased() { - case "application/json": - self = .json - default: - self = .other(rawValue) - } - } - public var rawValue: Swift.String { - switch self { - case let .other(string): - return string - case .json: - return "application/json" - } - } - public static var allCases: [Self] { - [ - .json - ] - } - } - } - /// Add or Edit A Product - /// - /// This updates a product. - /// - /// Note: If the barcode exists then you will be editing the existing product, - /// However if it doesn''t you will be creating a new product with that unique barcode, - /// and adding properties to the product. - /// - /// - /// - Remark: HTTP `POST /cgi/product_jqm2.pl`. - /// - Remark: Generated from `#/paths//cgi/product_jqm2.pl/post(postProduct)`. - public enum postProduct { - public static let id: Swift.String = "postProduct" - public struct Input: Sendable, Hashable { - /// - Remark: Generated from `#/paths/cgi/product_jqm2.pl/POST/header`. - public struct Headers: Sendable, Hashable { - public var accept: [OpenAPIRuntime.AcceptHeaderContentType] - /// Creates a new `Headers`. - /// - /// - Parameters: - /// - accept: - public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { - self.accept = accept - } - } - public var headers: Operations.postProduct.Input.Headers - /// - Remark: Generated from `#/paths/cgi/product_jqm2.pl/POST/requestBody`. - @frozen public enum Body: Sendable, Hashable { - /// - Remark: Generated from `#/paths/cgi/product_jqm2.pl/POST/requestBody/content/multipart\/form-data`. - case multipartForm(OpenAPIRuntime.MultipartBody) - } - public var body: Operations.postProduct.Input.Body - /// Creates a new `Input`. - /// - /// - Parameters: - /// - headers: - /// - body: - public init( - headers: Operations.postProduct.Input.Headers = .init(), - body: Operations.postProduct.Input.Body - ) { - self.headers = headers - self.body = body - } - } - @frozen public enum Output: Sendable, Hashable { - public struct Ok: Sendable, Hashable { - /// - Remark: Generated from `#/paths/cgi/product_jqm2.pl/POST/responses/200/content`. - @frozen public enum Body: Sendable, Hashable { - /// - Remark: Generated from `#/paths/cgi/product_jqm2.pl/POST/responses/200/content/application\/json`. - case json(Components.Schemas.add_or_edit_a_product) - /// The associated value of the enum case if `self` is `.json`. - /// - /// - Throws: An error if `self` is not `.json`. - /// - SeeAlso: `.json`. - public var json: Components.Schemas.add_or_edit_a_product { - get throws { - switch self { - case let .json(body): - return body - } - } - } - } - /// Received HTTP response body - public var body: Operations.postProduct.Output.Ok.Body - /// Creates a new `Ok`. - /// - /// - Parameters: - /// - body: Received HTTP response body - public init(body: Operations.postProduct.Output.Ok.Body) { - self.body = body - } - } - /// OK - /// - /// - Remark: Generated from `#/paths//cgi/product_jqm2.pl/post(postProduct)/responses/200`. - /// - /// HTTP response code: `200 ok`. - case ok(Operations.postProduct.Output.Ok) - /// The associated value of the enum case if `self` is `.ok`. - /// - /// - Throws: An error if `self` is not `.ok`. - /// - SeeAlso: `.ok`. - public var ok: Operations.postProduct.Output.Ok { - get throws { - switch self { - case let .ok(response): - return response - default: - try throwUnexpectedResponseStatus( - expectedStatus: "ok", - response: self - ) - } - } - } - /// Undocumented response. - /// - /// A response with a code that is not documented in the OpenAPI document. - case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) - } - @frozen public enum AcceptableContentType: AcceptableProtocol { - case json - case other(Swift.String) - public init?(rawValue: Swift.String) { - switch rawValue.lowercased() { - case "application/json": - self = .json - default: - self = .other(rawValue) - } - } - public var rawValue: Swift.String { - switch self { - case let .other(string): - return string - case .json: - return "application/json" - } - } - public static var allCases: [Self] { - [ - .json - ] - } - } - } - /// Search for Products - /// - /// Search request allows you to get products that match your search criteria. - /// - /// It allows you create many custom APIs for your use case. - /// - /// If the search query parameter has 2 possible values, they are seperated by a comma(,). - /// When filtering via a parameter that has different language codes like `fr`, `de` or `en`, specify the language code in the parameter name e.g `categories_tags_en` - /// - /// **Important:** search API v2 does not support full text request (search_term), - /// you have to use [search API v1](https://wiki.openfoodfacts.org/API/Read/Search) for that. - /// Upcoming [search-a-licious project](https://github.com/openfoodfacts/search-a-licious) will fix that. - /// - /// ### Limiting results - /// - /// You can limit the size of returned objects thanks to the `fields` object (see below). - /// - /// eg: `fields=code,product_name,brands,attribute_groups`` - /// - /// Please use it as much as possible to avoid overloading the servers. - /// - /// The search use pagination, see `page` and `page_size` parameters. - /// - /// **Beware:** the `page_count` data in item is a bit counter intuitive…, read the description. - /// - /// ### Conditions on tags - /// - /// All `_tags`` parameters accepts either: - /// - /// * a single value - /// * or a comma-separated list of values (doing a AND) - /// * or a pipe separated list of values (doing a OR) - /// - /// You can exclude terms by using a "-" prefix. - /// - /// For taxonomized entries, you might either use the tag id (recommended), - /// or a known synonym (without language prefix) - /// - /// * `labels_tags=en:organic,en:fair-trade` find items that are fair-trade AND organic - /// * `labels_tags=en:organic|en:fair-trade` find items that are fair-trade OR organic - /// * `labels_tags=en:organic,en:-fair-trade` find items that are organic BUT NOT fair-trade - /// - /// - /// ### Conditions on nutriments - /// - /// To get a list of nutrients - /// - /// You can either query on nutrient per 100g (`_100g` suffix) - /// or per serving (`serving` suffix). - /// - /// You can also add `_prepared_` - /// to get the nutrients in the prepared product instead of as sold. - /// - /// You can add a comparison operator and value to the parameter name - /// to get products with nutrient above or bellow a value. - /// If you use a parameter value it exactly match it. - /// - /// * `energy-kj_100g<200` products where energy in kj for 100g is less than 200kj - /// * `sugars_serving>10` products where sugar per serving is greater than 10g - /// * `saturated-fat_100g=1` products where saturated fat per 100g is exactly 10g - /// * `salt_prepared_serving<0.1` products where salt per serving for prepared product is less than 0.1g - /// - /// ### More references - /// - /// See also [wiki page](https://wiki.openfoodfacts.org/Open_Food_Facts_Search_API_Version_2) - /// - /// - /// - Remark: HTTP `GET /api/v2/search`. - /// - Remark: Generated from `#/paths//api/v2/search/get(searchProducts)`. - public enum searchProducts { - public static let id: Swift.String = "searchProducts" - public struct Input: Sendable, Hashable { - /// - Remark: Generated from `#/paths/api/v2/search/GET/query`. - public struct Query: Sendable, Hashable { - /// The additives_tags in english of product(s) you are searching for. - /// The [OFF App](https://world.openfoodfacts.org/additives) has a list of possible values for `additives`. - /// - /// You can use multiple values by using a comma separated list. - /// You can add a "-" before values to avoid matching a tag. - /// - /// - /// - Remark: Generated from `#/paths/api/v2/search/GET/query/additives_tags`. - public var additives_tags: Components.Parameters.tags_parameters_properties_additives_tags? - /// The allergens_tags in english of product(s) you are searching for. - /// The [OFF App](https://world.openfoodfacts.org/allergens) has a list of possible values for `allergens`. - /// - /// You can use multiple values by using a comma separated list. - /// You can add a "-" before values to avoid matching a tag. - /// - /// - /// - Remark: Generated from `#/paths/api/v2/search/GET/query/allergens_tags`. - public var allergens_tags: Components.Parameters.tags_parameters_properties_allergens_tags? - /// The brands_tags of product(s) you are searching for. - /// The [OFF App](https://world.openfoodfacts.org/brands) has a list of possible values for `brands`. - /// - /// You can use multiple values by using a comma separated list. - /// You can add a "-" before values to avoid matching a tag. - /// - /// - /// - Remark: Generated from `#/paths/api/v2/search/GET/query/brands_tags`. - public var brands_tags: Components.Parameters.tags_parameters_properties_brands_tags? - /// The category of product(s) you are searching for. - /// The [OFF App](https://world.openfoodfacts.org/categories) has a list of possible values for `categories`. - /// - /// You can use multiple values by using a comma separated list. - /// You can add a "-" before values to avoid matching a tag. - /// - /// - /// - Remark: Generated from `#/paths/api/v2/search/GET/query/categories_tags`. - public var categories_tags: Components.Parameters.tags_parameters_properties_categories_tags? - /// The countries_tags_en of product(s) you are searching for. - /// The [OFF App](https://world.openfoodfacts.org/countries) shows a list of possible values for `countries`. - /// - /// You can use multiple values by using a comma separated list. - /// You can add a "-" before values to avoid matching a tag. - /// - /// - /// - Remark: Generated from `#/paths/api/v2/search/GET/query/countries_tags_en`. - public var countries_tags_en: Components.Parameters.tags_parameters_properties_countries_tags? - /// The emb_codes_tags of product(s) you are searching for. - /// - /// You can use multiple values by using a comma separated list. - /// You can add a "-" before values to avoid matching a tag. - /// - /// - /// - Remark: Generated from `#/paths/api/v2/search/GET/query/emb_codes_tags`. - public var emb_codes_tags: Components.Parameters.tags_parameters_properties_emb_codes_tags? - /// The labels_tags in english of product(s) you are searching for. - /// The [OFF App](https://world.openfoodfacts.org/labels) has a list of possible values for `labels`. - /// - /// You can use multiple values by using a comma separated list. - /// You can add a "-" before values to avoid matching a tag. - /// - /// - /// - Remark: Generated from `#/paths/api/v2/search/GET/query/labels_tags`. - public var labels_tags: Components.Parameters.tags_parameters_properties_labels_tags? - /// The manufacturing_places_tags of product(s) you are searching for. - /// The [OFF App](https://world.openfoodfacts.org/manufacturing-places) has a list of possible values for `manufacturing-places`. - /// - /// You can use multiple values by using a comma separated list. - /// You can add a "-" before values to avoid matching a tag. - /// - /// - /// - Remark: Generated from `#/paths/api/v2/search/GET/query/manufacturing_places_tags`. - public var manufacturing_places_tags: Components.Parameters.tags_parameters_properties_manufacturing_places_tags? - /// The nutrition_grades_tags of product(s) you are searching for. - /// The [OFF App](https://world.openfoodfacts.org/nutrition-grades) has a list of possible values for `nutrition-grades`. - /// - /// You can use multiple values by using a comma separated list. - /// You can add a "-" before values to avoid matching a tag. - /// - /// - /// - Remark: Generated from `#/paths/api/v2/search/GET/query/nutrition_grades_tags`. - public var nutrition_grades_tags: Components.Parameters.tags_parameters_properties_nutrition_grades_tags? - /// The origins_tags of product(s) you are searching for. - /// - /// You can use multiple values by using a comma separated list. - /// You can add a "-" before values to avoid matching a tag. - /// - /// - /// - Remark: Generated from `#/paths/api/v2/search/GET/query/origins_tags`. - public var origins_tags: Components.Parameters.tags_parameters_properties_origins_tags? - /// The packaging_tag in german of product(s) you are searching for. - /// The [OFF App](https://world.openfoodfacts.org/packaging) has a list of possible values for `packaging`. - /// - /// You can use multiple values by using a comma separated list. - /// You can add a "-" before values to avoid matching a tag. - /// - /// - /// - Remark: Generated from `#/paths/api/v2/search/GET/query/packaging_tags_de`. - public var packaging_tags_de: Components.Parameters.tags_parameters_properties_packaging_tags? - /// The purchase_places_tags of product(s) you are searching for. - /// - /// You can use multiple values by using a comma separated list. - /// You can add a "-" before values to avoid matching a tag. - /// - /// - /// - Remark: Generated from `#/paths/api/v2/search/GET/query/purchase_places_tags`. - public var purchase_places_tags: Components.Parameters.tags_parameters_properties_purchase_places_tags? - /// The states_tags in english of product(s) you are searching for. - /// The [OFF App](https://world.openfoodfacts.org/states) has a list of possible values for `states`. - /// - /// You can use multiple values by using a comma separated list. - /// You can add a "-" before values to avoid matching a tag. - /// - /// - /// - Remark: Generated from `#/paths/api/v2/search/GET/query/states_tags`. - public var states_tags: Components.Parameters.tags_parameters_properties_states_tags? - /// The stores_tags of product(s) you are searching for. - /// - /// You can use multiple values by using a comma separated list. - /// You can add a "-" before values to avoid matching a tag. - /// - /// - /// - Remark: Generated from `#/paths/api/v2/search/GET/query/stores_tags`. - public var stores_tags: Components.Parameters.tags_parameters_properties_stores_tags? - /// The traces_tags of product(s) you are searching for. - /// The [OFF App](https://world.openfoodfacts.org/traces) shows a list of possible values for `traces`. - /// - /// You can use multiple values by using a comma separated list. - /// You can add a "-" before values to avoid matching a tag. - /// - /// - /// - Remark: Generated from `#/paths/api/v2/search/GET/query/traces_tags`. - public var traces_tags: Components.Parameters.tags_parameters_properties_traces_tags? - /// - Remark: Generated from `#/components/parameters/tags_parameters_properties_tag_name_with_language_code`. - public struct tags_parameters_properties_tag_name_with_language_code: Codable, Hashable, Sendable { - /// Will search in the tags corresponding to `tag_name`, - /// in the language corresponding to `language_code. - /// - /// `tag_name` is one of the field above which have the `_tags`` suffix: - /// categories, nutrition_grades, etc. - /// - /// `language_code` is a two letter iso language `language_code. - /// - /// You can use multiple values by using a comma separated list. - /// You can add a "-" before values to avoid matching a tag. - /// - /// - /// - Remark: Generated from `#/components/parameters/tags_parameters_properties_tag_name_with_language_code/tag_name_example`. - public var tag_name_example: Swift.String? - /// Creates a new `tags_parameters_properties_tag_name_with_language_code`. - /// - /// - Parameters: - /// - tag_name_example: Will search in the tags corresponding to `tag_name`, - public init(tag_name_example: Swift.String? = nil) { - self.tag_name_example = tag_name_example - } - public enum CodingKeys: String, CodingKey { - case tag_name_example - } - } - /// You can add a language code to a specific tag to query it in a specific language - /// - /// - /// - Remark: Generated from `#/paths/api/v2/search/GET/query/_tags_`. - public var _lt_tag_name_gt__tags__lt_language_code_gt_: Components.Parameters.tags_parameters_properties_tag_name_with_language_code? - /// - Remark: Generated from `#/components/parameters/nutrition_search_properties_nutrient_lower_than`. - public struct nutrition_search_properties_nutrient_lower_than: Codable, Hashable, Sendable { - /// Will search for products with nutrients lower than `value` - /// per `portion` (100g or serving). - /// - /// If `prepared` is "prepared" search in prepared product instead of "as sold". - /// - /// Important: the parameter value is discarded and should be empty - /// - /// - /// - Remark: Generated from `#/components/parameters/nutrition_search_properties_nutrient_lower_than/nutrient_example`. - public var nutrient_example: Swift.String? - /// Creates a new `nutrition_search_properties_nutrient_lower_than`. - /// - /// - Parameters: - /// - nutrient_example: Will search for products with nutrients lower than `value` - public init(nutrient_example: Swift.String? = nil) { - self.nutrient_example = nutrient_example - } - public enum CodingKeys: String, CodingKey { - case nutrient_example - } - } - /// Search on nutrient lower than a value - /// - /// - /// - Remark: Generated from `#/paths/api/v2/search/GET/query/_lt_`. - public var _lt_nutrient_gt__lt__lt_value_gt_: Components.Parameters.nutrition_search_properties_nutrient_lower_than? - /// - Remark: Generated from `#/components/parameters/nutrition_search_properties_nutrient_greater_than`. - public struct nutrition_search_properties_nutrient_greater_than: Codable, Hashable, Sendable { - /// Will search for products with nutrients more than `value` - /// per `portion` (100g or serving). - /// - /// If `prepared` is "prepared" search in prepared product instead of "as sold". - /// - /// Important: the parameter value is discarded and should be empty - /// - /// - /// - Remark: Generated from `#/components/parameters/nutrition_search_properties_nutrient_greater_than/nutrient_example`. - public var nutrient_example: Swift.String? - /// Creates a new `nutrition_search_properties_nutrient_greater_than`. - /// - /// - Parameters: - /// - nutrient_example: Will search for products with nutrients more than `value` - public init(nutrient_example: Swift.String? = nil) { - self.nutrient_example = nutrient_example - } - public enum CodingKeys: String, CodingKey { - case nutrient_example - } - } - /// Search on nutrient greater than a value - /// - /// - /// - Remark: Generated from `#/paths/api/v2/search/GET/query/_gt_`. - public var _lt_nutrient_gt__gt__lt_value_gt_: Components.Parameters.nutrition_search_properties_nutrient_greater_than? - /// - Remark: Generated from `#/components/parameters/nutrition_search_properties_nutrient_equal`. - public struct nutrition_search_properties_nutrient_equal: Codable, Hashable, Sendable { - /// Will search for products with nutrients exactl the parameter value - /// per `portion` (100g or serving). - /// - /// If `prepared` is "prepared" search in prepared product instead of "as sold". - /// - /// - /// - Remark: Generated from `#/components/parameters/nutrition_search_properties_nutrient_equal/nutrient_example`. - public var nutrient_example: Swift.String? - /// Creates a new `nutrition_search_properties_nutrient_equal`. - /// - /// - Parameters: - /// - nutrient_example: Will search for products with nutrients exactl the parameter value - public init(nutrient_example: Swift.String? = nil) { - self.nutrient_example = nutrient_example - } - public enum CodingKeys: String, CodingKey { - case nutrient_example - } - } - /// Search on nutrient for an exact quantity - /// - /// - /// - Remark: Generated from `#/paths/api/v2/search/GET/query/_eq_`. - public var _lt_nutrient_gt__eq__lt_value_gt_: Components.Parameters.nutrition_search_properties_nutrient_equal? - /// The fields to be returned from the product object can also be limited. - /// If not specified, it returns the entire product object response. - /// - /// - /// - Remark: Generated from `#/paths/api/v2/search/GET/query/fields`. - public var fields: Components.Parameters.fields? - /// - Remark: Generated from `#/components/parameters/sort_by`. - @frozen public enum sort_by: String, Codable, Hashable, Sendable, CaseIterable { - case product_name = "product_name" - case last_modified_t = "last_modified_t" - case scans_n = "scans_n" - case unique_scans_n = "unique_scans_n" - case created_t = "created_t" - case completeness = "completeness" - case popularity_key = "popularity_key" - case nutriscore_score = "nutriscore_score" - case nova_score = "nova_score" - case nothing = "nothing" - case ecoscore_score = "ecoscore_score" - } - /// The allowed values used to sort/order the search results. - /// - /// * `product_name` sorts on name - /// * `ecoscore_score`, `nova_score`, `nutriscore_score` rank on the [Eco-Score](https://world.openfoodfacts.org/eco-score-the-environmental-impact-of-food-products), [Nova](https://world.openfoodfacts.org/nova), or [Nutri-Score](https://world.openfoodfacts.org/nutriscore) - /// * `scans_n`, `unique_scans_n` and `popularity_key` are about product popularity: number of scans on unique scans, rank of product - /// * `created_t`, `last_modified_t`, are about creation and modification dates - /// * `nothing`, tells not to sort at all (because if you do not provide the sort_by argument we default to sorting on popularity (for food) or last modification date) - /// - /// - /// - Remark: Generated from `#/paths/api/v2/search/GET/query/sort_by`. - public var sort_by: Components.Parameters.sort_by? - /// The page number you request to view (eg. in search results spanning multiple pages) - /// - /// - /// - Remark: Generated from `#/paths/api/v2/search/GET/query/page`. - public var page: Components.Parameters.page? - /// The number of elements should be sent per page - /// - /// - /// - Remark: Generated from `#/paths/api/v2/search/GET/query/page_size`. - public var page_size: Components.Parameters.page_size? - /// Creates a new `Query`. - /// - /// - Parameters: - /// - additives_tags: The additives_tags in english of product(s) you are searching for. - /// - allergens_tags: The allergens_tags in english of product(s) you are searching for. - /// - brands_tags: The brands_tags of product(s) you are searching for. - /// - categories_tags: The category of product(s) you are searching for. - /// - countries_tags_en: The countries_tags_en of product(s) you are searching for. - /// - emb_codes_tags: The emb_codes_tags of product(s) you are searching for. - /// - labels_tags: The labels_tags in english of product(s) you are searching for. - /// - manufacturing_places_tags: The manufacturing_places_tags of product(s) you are searching for. - /// - nutrition_grades_tags: The nutrition_grades_tags of product(s) you are searching for. - /// - origins_tags: The origins_tags of product(s) you are searching for. - /// - packaging_tags_de: The packaging_tag in german of product(s) you are searching for. - /// - purchase_places_tags: The purchase_places_tags of product(s) you are searching for. - /// - states_tags: The states_tags in english of product(s) you are searching for. - /// - stores_tags: The stores_tags of product(s) you are searching for. - /// - traces_tags: The traces_tags of product(s) you are searching for. - /// - _lt_tag_name_gt__tags__lt_language_code_gt_: You can add a language code to a specific tag to query it in a specific language - /// - _lt_nutrient_gt__lt__lt_value_gt_: Search on nutrient lower than a value - /// - _lt_nutrient_gt__gt__lt_value_gt_: Search on nutrient greater than a value - /// - _lt_nutrient_gt__eq__lt_value_gt_: Search on nutrient for an exact quantity - /// - fields: The fields to be returned from the product object can also be limited. - /// - sort_by: The allowed values used to sort/order the search results. - /// - page: The page number you request to view (eg. in search results spanning multiple pages) - /// - page_size: The number of elements should be sent per page - public init( - additives_tags: Components.Parameters.tags_parameters_properties_additives_tags? = nil, - allergens_tags: Components.Parameters.tags_parameters_properties_allergens_tags? = nil, - brands_tags: Components.Parameters.tags_parameters_properties_brands_tags? = nil, - categories_tags: Components.Parameters.tags_parameters_properties_categories_tags? = nil, - countries_tags_en: Components.Parameters.tags_parameters_properties_countries_tags? = nil, - emb_codes_tags: Components.Parameters.tags_parameters_properties_emb_codes_tags? = nil, - labels_tags: Components.Parameters.tags_parameters_properties_labels_tags? = nil, - manufacturing_places_tags: Components.Parameters.tags_parameters_properties_manufacturing_places_tags? = nil, - nutrition_grades_tags: Components.Parameters.tags_parameters_properties_nutrition_grades_tags? = nil, - origins_tags: Components.Parameters.tags_parameters_properties_origins_tags? = nil, - packaging_tags_de: Components.Parameters.tags_parameters_properties_packaging_tags? = nil, - purchase_places_tags: Components.Parameters.tags_parameters_properties_purchase_places_tags? = nil, - states_tags: Components.Parameters.tags_parameters_properties_states_tags? = nil, - stores_tags: Components.Parameters.tags_parameters_properties_stores_tags? = nil, - traces_tags: Components.Parameters.tags_parameters_properties_traces_tags? = nil, - _lt_tag_name_gt__tags__lt_language_code_gt_: Components.Parameters.tags_parameters_properties_tag_name_with_language_code? = nil, - _lt_nutrient_gt__lt__lt_value_gt_: Components.Parameters.nutrition_search_properties_nutrient_lower_than? = nil, - _lt_nutrient_gt__gt__lt_value_gt_: Components.Parameters.nutrition_search_properties_nutrient_greater_than? = nil, - _lt_nutrient_gt__eq__lt_value_gt_: Components.Parameters.nutrition_search_properties_nutrient_equal? = nil, - fields: Components.Parameters.fields? = nil, - sort_by: Components.Parameters.sort_by? = nil, - page: Components.Parameters.page? = nil, - page_size: Components.Parameters.page_size? = nil - ) { - self.additives_tags = additives_tags - self.allergens_tags = allergens_tags - self.brands_tags = brands_tags - self.categories_tags = categories_tags - self.countries_tags_en = countries_tags_en - self.emb_codes_tags = emb_codes_tags - self.labels_tags = labels_tags - self.manufacturing_places_tags = manufacturing_places_tags - self.nutrition_grades_tags = nutrition_grades_tags - self.origins_tags = origins_tags - self.packaging_tags_de = packaging_tags_de - self.purchase_places_tags = purchase_places_tags - self.states_tags = states_tags - self.stores_tags = stores_tags - self.traces_tags = traces_tags - self._lt_tag_name_gt__tags__lt_language_code_gt_ = _lt_tag_name_gt__tags__lt_language_code_gt_ - self._lt_nutrient_gt__lt__lt_value_gt_ = _lt_nutrient_gt__lt__lt_value_gt_ - self._lt_nutrient_gt__gt__lt_value_gt_ = _lt_nutrient_gt__gt__lt_value_gt_ - self._lt_nutrient_gt__eq__lt_value_gt_ = _lt_nutrient_gt__eq__lt_value_gt_ - self.fields = fields - self.sort_by = sort_by - self.page = page - self.page_size = page_size - } - } - public var query: Operations.searchProducts.Input.Query - /// - Remark: Generated from `#/paths/api/v2/search/GET/header`. - public struct Headers: Sendable, Hashable { - public var accept: [OpenAPIRuntime.AcceptHeaderContentType] - /// Creates a new `Headers`. - /// - /// - Parameters: - /// - accept: - public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { - self.accept = accept - } - } - public var headers: Operations.searchProducts.Input.Headers - /// Creates a new `Input`. - /// - /// - Parameters: - /// - query: - /// - headers: - public init( - query: Operations.searchProducts.Input.Query = .init(), - headers: Operations.searchProducts.Input.Headers = .init() - ) { - self.query = query - self.headers = headers - } - } - @frozen public enum Output: Sendable, Hashable { - public struct Ok: Sendable, Hashable { - /// - Remark: Generated from `#/paths/api/v2/search/GET/responses/200/content`. - @frozen public enum Body: Sendable, Hashable { - /// - Remark: Generated from `#/paths/api/v2/search/GET/responses/200/content/application\/json`. - case json(Components.Schemas.search_for_products) - /// The associated value of the enum case if `self` is `.json`. - /// - /// - Throws: An error if `self` is not `.json`. - /// - SeeAlso: `.json`. - public var json: Components.Schemas.search_for_products { - get throws { - switch self { - case let .json(body): - return body - } - } - } - } - /// Received HTTP response body - public var body: Operations.searchProducts.Output.Ok.Body - /// Creates a new `Ok`. - /// - /// - Parameters: - /// - body: Received HTTP response body - public init(body: Operations.searchProducts.Output.Ok.Body) { - self.body = body - } - } - /// OK - /// - /// - Remark: Generated from `#/paths//api/v2/search/get(searchProducts)/responses/200`. - /// - /// HTTP response code: `200 ok`. - case ok(Operations.searchProducts.Output.Ok) - /// The associated value of the enum case if `self` is `.ok`. - /// - /// - Throws: An error if `self` is not `.ok`. - /// - SeeAlso: `.ok`. - public var ok: Operations.searchProducts.Output.Ok { - get throws { - switch self { - case let .ok(response): - return response - default: - try throwUnexpectedResponseStatus( - expectedStatus: "ok", - response: self - ) - } - } - } - /// Undocumented response. - /// - /// A response with a code that is not documented in the OpenAPI document. - case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) - } - @frozen public enum AcceptableContentType: AcceptableProtocol { - case json - case other(Swift.String) - public init?(rawValue: Swift.String) { - switch rawValue.lowercased() { - case "application/json": - self = .json - default: - self = .other(rawValue) - } - } - public var rawValue: Swift.String { - switch self { - case let .other(string): - return string - case .json: - return "application/json" - } - } - public static var allCases: [Self] { - [ - .json - ] - } - } - } - /// Get Suggestions to Aid Adding/Editing Products - /// - /// For example , Dave is looking for packaging_shapes that contain the term "fe", - /// all packaging_shapes containing "fe" will be returned. - /// This is useful if you have a search in your application, - /// for a specific product field. - /// - /// - /// - Remark: HTTP `GET /cgi/suggest.pl`. - /// - Remark: Generated from `#/paths//cgi/suggest.pl/get(getSuggestions)`. - public enum getSuggestions { - public static let id: Swift.String = "getSuggestions" - public struct Input: Sendable, Hashable { - /// - Remark: Generated from `#/paths/cgi/suggest.pl/GET/query`. - public struct Query: Sendable, Hashable { - /// - Remark: Generated from `#/paths/cgi/suggest.pl/GET/query/tagtype`. - public var tagtype: Components.Parameters.tagtype? - /// - Remark: Generated from `#/paths/cgi/suggest.pl/GET/query/term`. - public var term: Components.Parameters.term? - /// Creates a new `Query`. - /// - /// - Parameters: - /// - tagtype: - /// - term: - public init( - tagtype: Components.Parameters.tagtype? = nil, - term: Components.Parameters.term? = nil - ) { - self.tagtype = tagtype - self.term = term - } - } - public var query: Operations.getSuggestions.Input.Query - /// - Remark: Generated from `#/paths/cgi/suggest.pl/GET/header`. - public struct Headers: Sendable, Hashable { - public var accept: [OpenAPIRuntime.AcceptHeaderContentType] - /// Creates a new `Headers`. - /// - /// - Parameters: - /// - accept: - public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { - self.accept = accept - } - } - public var headers: Operations.getSuggestions.Input.Headers - /// Creates a new `Input`. - /// - /// - Parameters: - /// - query: - /// - headers: - public init( - query: Operations.getSuggestions.Input.Query = .init(), - headers: Operations.getSuggestions.Input.Headers = .init() - ) { - self.query = query - self.headers = headers - } - } - @frozen public enum Output: Sendable, Hashable { - public struct Ok: Sendable, Hashable { - /// - Remark: Generated from `#/paths/cgi/suggest.pl/GET/responses/200/content`. - @frozen public enum Body: Sendable, Hashable { - /// - Remark: Generated from `#/paths/cgi/suggest.pl/GET/responses/200/content/application\/json`. - case json(OpenAPIRuntime.OpenAPIArrayContainer) - /// The associated value of the enum case if `self` is `.json`. - /// - /// - Throws: An error if `self` is not `.json`. - /// - SeeAlso: `.json`. - public var json: OpenAPIRuntime.OpenAPIArrayContainer { - get throws { - switch self { - case let .json(body): - return body - } - } - } - } - /// Received HTTP response body - public var body: Operations.getSuggestions.Output.Ok.Body - /// Creates a new `Ok`. - /// - /// - Parameters: - /// - body: Received HTTP response body - public init(body: Operations.getSuggestions.Output.Ok.Body) { - self.body = body - } - } - /// OK - /// - /// - Remark: Generated from `#/paths//cgi/suggest.pl/get(getSuggestions)/responses/200`. - /// - /// HTTP response code: `200 ok`. - case ok(Operations.getSuggestions.Output.Ok) - /// The associated value of the enum case if `self` is `.ok`. - /// - /// - Throws: An error if `self` is not `.ok`. - /// - SeeAlso: `.ok`. - public var ok: Operations.getSuggestions.Output.Ok { - get throws { - switch self { - case let .ok(response): - return response - default: - try throwUnexpectedResponseStatus( - expectedStatus: "ok", - response: self - ) - } - } - } - /// Undocumented response. - /// - /// A response with a code that is not documented in the OpenAPI document. - case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) - } - @frozen public enum AcceptableContentType: AcceptableProtocol { - case json - case other(Swift.String) - public init?(rawValue: Swift.String) { - switch rawValue.lowercased() { - case "application/json": - self = .json - default: - self = .other(rawValue) - } - } - public var rawValue: Swift.String { - switch self { - case let .other(string): - return string - case .json: - return "application/json" - } - } - public static var allCases: [Self] { - [ - .json - ] - } - } - } - /// Get a nested list of nutrients that can be displayed in the nutrition facts table for a specific country and language - /// - /// Used to display the nutrition facts table of a product, or to display a form to input those nutrition facts. - /// - /// - /// - Remark: HTTP `GET /cgi/nutrients.pl`. - /// - Remark: Generated from `#/paths//cgi/nutrients.pl/get(getNutrients)`. - public enum getNutrients { - public static let id: Swift.String = "getNutrients" - public struct Input: Sendable, Hashable { - /// - Remark: Generated from `#/paths/cgi/nutrients.pl/GET/query`. - public struct Query: Sendable, Hashable { - /// 2 letter code of the country of the user. Used for localizing some fields in returned values (e.g. knowledge panels). If not passed, the country may be inferred by the IP address of the request. - /// - /// - Remark: Generated from `#/paths/cgi/nutrients.pl/GET/query/cc`. - public var cc: Components.Parameters.cc? - /// 2 letter code of the language of the user. - /// Used for localizing some fields in returned values (e.g. knowledge panels). - /// If not passed, the language may be inferred by the Accept-Language header of the request, - /// or from the domain name prefix. - /// - /// - /// - Remark: Generated from `#/paths/cgi/nutrients.pl/GET/query/lc`. - public var lc: Components.Parameters.lc? - /// Creates a new `Query`. - /// - /// - Parameters: - /// - cc: 2 letter code of the country of the user. Used for localizing some fields in returned values (e.g. knowledge panels). If not passed, the country may be inferred by the IP address of the request. - /// - lc: 2 letter code of the language of the user. - public init( - cc: Components.Parameters.cc? = nil, - lc: Components.Parameters.lc? = nil - ) { - self.cc = cc - self.lc = lc - } - } - public var query: Operations.getNutrients.Input.Query - /// - Remark: Generated from `#/paths/cgi/nutrients.pl/GET/header`. - public struct Headers: Sendable, Hashable { - public var accept: [OpenAPIRuntime.AcceptHeaderContentType] - /// Creates a new `Headers`. - /// - /// - Parameters: - /// - accept: - public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { - self.accept = accept - } - } - public var headers: Operations.getNutrients.Input.Headers - /// Creates a new `Input`. - /// - /// - Parameters: - /// - query: - /// - headers: - public init( - query: Operations.getNutrients.Input.Query = .init(), - headers: Operations.getNutrients.Input.Headers = .init() - ) { - self.query = query - self.headers = headers - } - } - @frozen public enum Output: Sendable, Hashable { - public struct Ok: Sendable, Hashable { - /// - Remark: Generated from `#/paths/cgi/nutrients.pl/GET/responses/200/content`. - @frozen public enum Body: Sendable, Hashable { - /// - Remark: Generated from `#/paths/cgi/nutrients.pl/GET/responses/200/content/application\/json`. - case json(Components.Schemas.get_nutrients) - /// The associated value of the enum case if `self` is `.json`. - /// - /// - Throws: An error if `self` is not `.json`. - /// - SeeAlso: `.json`. - public var json: Components.Schemas.get_nutrients { - get throws { - switch self { - case let .json(body): - return body - } - } - } - } - /// Received HTTP response body - public var body: Operations.getNutrients.Output.Ok.Body - /// Creates a new `Ok`. - /// - /// - Parameters: - /// - body: Received HTTP response body - public init(body: Operations.getNutrients.Output.Ok.Body) { - self.body = body - } - } - /// OK - /// - /// - Remark: Generated from `#/paths//cgi/nutrients.pl/get(getNutrients)/responses/200`. - /// - /// HTTP response code: `200 ok`. - case ok(Operations.getNutrients.Output.Ok) - /// The associated value of the enum case if `self` is `.ok`. - /// - /// - Throws: An error if `self` is not `.ok`. - /// - SeeAlso: `.ok`. - public var ok: Operations.getNutrients.Output.Ok { - get throws { - switch self { - case let .ok(response): - return response - default: - try throwUnexpectedResponseStatus( - expectedStatus: "ok", - response: self - ) - } - } - } - /// Undocumented response. - /// - /// A response with a code that is not documented in the OpenAPI document. - case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) - } - @frozen public enum AcceptableContentType: AcceptableProtocol { - case json - case other(Swift.String) - public init?(rawValue: Swift.String) { - switch rawValue.lowercased() { - case "application/json": - self = .json - default: - self = .other(rawValue) - } - } - public var rawValue: Swift.String { - switch self { - case let .other(string): - return string - case .json: - return "application/json" - } - } - public static var allCases: [Self] { - [ - .json - ] - } - } - } - /// Get the list of attributes available for personal search. - /// - /// Attributes are at the heart of personal search. - /// They score the products according to different criterias, - /// which could then be matched to a user's preferences. - /// - /// This API helps you list attributes and display them in your application, - /// for the user to choose the importance of each criteria. - /// - /// note: /api/v2/attribute_groups_{lc} is also a valid route, but consider it deprecated - /// - /// - /// - Remark: HTTP `GET /api/v2/attribute_groups`. - /// - Remark: Generated from `#/paths//api/v2/attribute_groups/get(getAttributeGroups)`. - public enum getAttributeGroups { - public static let id: Swift.String = "getAttributeGroups" - public struct Input: Sendable, Hashable { - /// - Remark: Generated from `#/paths/api/v2/attribute_groups/GET/query`. - public struct Query: Sendable, Hashable { - /// 2 letter code of the language of the user. - /// Used for localizing some fields in returned values (e.g. knowledge panels). - /// If not passed, the language may be inferred by the Accept-Language header of the request, - /// or from the domain name prefix. - /// - /// - /// - Remark: Generated from `#/paths/api/v2/attribute_groups/GET/query/lc`. - public var lc: Components.Parameters.lc? - /// Creates a new `Query`. - /// - /// - Parameters: - /// - lc: 2 letter code of the language of the user. - public init(lc: Components.Parameters.lc? = nil) { - self.lc = lc - } - } - public var query: Operations.getAttributeGroups.Input.Query - /// - Remark: Generated from `#/paths/api/v2/attribute_groups/GET/header`. - public struct Headers: Sendable, Hashable { - public var accept: [OpenAPIRuntime.AcceptHeaderContentType] - /// Creates a new `Headers`. - /// - /// - Parameters: - /// - accept: - public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { - self.accept = accept - } - } - public var headers: Operations.getAttributeGroups.Input.Headers - /// Creates a new `Input`. - /// - /// - Parameters: - /// - query: - /// - headers: - public init( - query: Operations.getAttributeGroups.Input.Query = .init(), - headers: Operations.getAttributeGroups.Input.Headers = .init() - ) { - self.query = query - self.headers = headers - } - } - @frozen public enum Output: Sendable, Hashable { - public struct Ok: Sendable, Hashable { - /// - Remark: Generated from `#/paths/api/v2/attribute_groups/GET/responses/200/content`. - @frozen public enum Body: Sendable, Hashable { - /// - Remark: Generated from `#/paths/api/v2/attribute_groups/GET/responses/200/content/application\/json`. - case json(Components.Schemas.get_attribute_groups) - /// The associated value of the enum case if `self` is `.json`. - /// - /// - Throws: An error if `self` is not `.json`. - /// - SeeAlso: `.json`. - public var json: Components.Schemas.get_attribute_groups { - get throws { - switch self { - case let .json(body): - return body - } - } - } - } - /// Received HTTP response body - public var body: Operations.getAttributeGroups.Output.Ok.Body - /// Creates a new `Ok`. - /// - /// - Parameters: - /// - body: Received HTTP response body - public init(body: Operations.getAttributeGroups.Output.Ok.Body) { - self.body = body - } - } - /// OK - /// - /// - Remark: Generated from `#/paths//api/v2/attribute_groups/get(getAttributeGroups)/responses/200`. - /// - /// HTTP response code: `200 ok`. - case ok(Operations.getAttributeGroups.Output.Ok) - /// The associated value of the enum case if `self` is `.ok`. - /// - /// - Throws: An error if `self` is not `.ok`. - /// - SeeAlso: `.ok`. - public var ok: Operations.getAttributeGroups.Output.Ok { - get throws { - switch self { - case let .ok(response): - return response - default: - try throwUnexpectedResponseStatus( - expectedStatus: "ok", - response: self - ) - } - } - } - /// Undocumented response. - /// - /// A response with a code that is not documented in the OpenAPI document. - case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) - } - @frozen public enum AcceptableContentType: AcceptableProtocol { - case json - case other(Swift.String) - public init?(rawValue: Swift.String) { - switch rawValue.lowercased() { - case "application/json": - self = .json - default: - self = .other(rawValue) - } - } - public var rawValue: Swift.String { - switch self { - case let .other(string): - return string - case .json: - return "application/json" - } - } - public static var allCases: [Self] { - [ - .json - ] - } - } - } - /// Get the weights corresponding to attributes preferences - /// to compute personal product - /// - /// - /// - Remark: HTTP `GET /api/v2/preferences`. - /// - Remark: Generated from `#/paths//api/v2/preferences/get(getPreferences)`. - public enum getPreferences { - public static let id: Swift.String = "getPreferences" - public struct Input: Sendable, Hashable { - /// - Remark: Generated from `#/paths/api/v2/preferences/GET/query`. - public struct Query: Sendable, Hashable { - /// 2 letter code of the language of the user. - /// Used for localizing some fields in returned values (e.g. knowledge panels). - /// If not passed, the language may be inferred by the Accept-Language header of the request, - /// or from the domain name prefix. - /// - /// - /// - Remark: Generated from `#/paths/api/v2/preferences/GET/query/lc`. - public var lc: Components.Parameters.lc? - /// Creates a new `Query`. - /// - /// - Parameters: - /// - lc: 2 letter code of the language of the user. - public init(lc: Components.Parameters.lc? = nil) { - self.lc = lc - } - } - public var query: Operations.getPreferences.Input.Query - /// - Remark: Generated from `#/paths/api/v2/preferences/GET/header`. - public struct Headers: Sendable, Hashable { - public var accept: [OpenAPIRuntime.AcceptHeaderContentType] - /// Creates a new `Headers`. - /// - /// - Parameters: - /// - accept: - public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { - self.accept = accept - } - } - public var headers: Operations.getPreferences.Input.Headers - /// Creates a new `Input`. - /// - /// - Parameters: - /// - query: - /// - headers: - public init( - query: Operations.getPreferences.Input.Query = .init(), - headers: Operations.getPreferences.Input.Headers = .init() - ) { - self.query = query - self.headers = headers - } - } - @frozen public enum Output: Sendable, Hashable { - public struct Ok: Sendable, Hashable { - /// - Remark: Generated from `#/paths/api/v2/preferences/GET/responses/200/content`. - @frozen public enum Body: Sendable, Hashable { - /// - Remark: Generated from `#/paths/api/v2/preferences/GET/responses/200/content/application\/json`. - case json(Components.Schemas.get_preferences) - /// The associated value of the enum case if `self` is `.json`. - /// - /// - Throws: An error if `self` is not `.json`. - /// - SeeAlso: `.json`. - public var json: Components.Schemas.get_preferences { - get throws { - switch self { - case let .json(body): - return body - } - } - } - } - /// Received HTTP response body - public var body: Operations.getPreferences.Output.Ok.Body - /// Creates a new `Ok`. - /// - /// - Parameters: - /// - body: Received HTTP response body - public init(body: Operations.getPreferences.Output.Ok.Body) { - self.body = body - } - } - /// OK - /// - /// - Remark: Generated from `#/paths//api/v2/preferences/get(getPreferences)/responses/200`. - /// - /// HTTP response code: `200 ok`. - case ok(Operations.getPreferences.Output.Ok) - /// The associated value of the enum case if `self` is `.ok`. - /// - /// - Throws: An error if `self` is not `.ok`. - /// - SeeAlso: `.ok`. - public var ok: Operations.getPreferences.Output.Ok { - get throws { - switch self { - case let .ok(response): - return response - default: - try throwUnexpectedResponseStatus( - expectedStatus: "ok", - response: self - ) - } - } - } - /// Undocumented response. - /// - /// A response with a code that is not documented in the OpenAPI document. - case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) - } - @frozen public enum AcceptableContentType: AcceptableProtocol { - case json - case other(Swift.String) - public init?(rawValue: Swift.String) { - switch rawValue.lowercased() { - case "application/json": - self = .json - default: - self = .other(rawValue) - } - } - public var rawValue: Swift.String { - switch self { - case let .other(string): - return string - case .json: - return "application/json" - } - } - public static var allCases: [Self] { - [ - .json - ] - } - } - } -} diff --git a/OpenFoodFactsService/Sources/openapi-generator-config.yaml b/OpenFoodFactsService/Sources/openapi-generator-config.yaml deleted file mode 100644 index 3e0f172..0000000 --- a/OpenFoodFactsService/Sources/openapi-generator-config.yaml +++ /dev/null @@ -1,4 +0,0 @@ -generate: - - types - - client -accessModifier: public \ No newline at end of file diff --git a/OpenFoodFactsService/Sources/openapi.yaml b/OpenFoodFactsService/Sources/openapi.yaml deleted file mode 100644 index 74fd3c1..0000000 --- a/OpenFoodFactsService/Sources/openapi.yaml +++ /dev/null @@ -1,5063 +0,0 @@ -openapi: 3.1.0 -info: - title: OpenFoodFactsOpenAPI - description: 'As a developer, the Open Food Facts API allows you to get information - - and contribute to the products database. You can create great apps to - - help people make better food choices and also provide data to enhance the database. - - ' - termsOfService: https://world.openfoodfacts.org/terms-of-use - contact: - name: Open Food Facts - url: https://slack.openfoodfacts.org/ - email: reuse@openfoodfacts.org - license: - name: 'data: ODbL' - url: https://opendatacommons.org/licenses/odbl/summary/index.html - x-identifier: ODbL-1.0 - version: '2' -externalDocs: - description: 'Please read the API introduction before using this API. - - ' - url: https://openfoodfacts.github.io/openfoodfacts-server/api/ -servers: -- description: dev - url: https://world.openfoodfacts.net -- url: https://world.openfoodfacts.org - description: prod -paths: - /api/v2/product/{barcode}: - get: - tags: - - Read Requests - summary: Get information for a specific product by barcode - parameters: - - name: barcode - in: path - description: 'The barcode of the product to be fetched - - ' - required: true - style: simple - explode: false - schema: - type: string - example: '3017620422003' - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/get_product_by_barcode' - examples: - spread-example: - summary: retrieved values for a well known chocolate and nut spread - value: - code: '3017620422003' - product: - _id: '3017620422003' - _keywords: - - et - - pate - - cacao - - produit - - ferrero - - gluten - - petit-dejeuner - - san - - au - - aux - - sucre - - nutella - abbreviated_product_name: Nutella t.400 - abbreviated_product_name_fr: Nutella t.400 - added_countries_tags: [] - additives_n: 1 - additives_original_tags: - - en:e322 - additives_prev_original_tags: - - en:e322 - additives_tags: - - en:e322 - allergens: en:milk,en:nuts,en:soybeans - allergens_from_ingredients: en:nuts, hazelnuts - allergens_from_user: (fr) en:milk,en:nuts,en:soybeans - allergens_hierarchy: - - en:milk - - en:nuts - - en:soybeans - allergens_lc: fr - allergens_tags: - - en:milk - - en:nuts - - en:soybeans - amino_acids_prev_tags: [] - amino_acids_tags: [] - brands: Ferrero - brands_tags: - - ferrero - carbon_footprint_percent_of_known_ingredients: 13 - categories: "Produits \xE0 tartiner,Petit-d\xE9jeuners,Produits\ - \ \xE0 tartiner sucr\xE9s,P\xE2tes \xE0 tartiner,P\xE2tes\ - \ \xE0 tartiner aux noisettes,P\xE2tes \xE0 tartiner aux noisettes\ - \ et au cacao" - categories_hierarchy: - - en:breakfasts - - en:spreads - - en:sweet-spreads - - en:hazelnut-spreads - - en:chocolate-spreads - - en:cocoa-and-hazelnuts-spreads - categories_lc: fr - categories_properties: - agribalyse_food_code:en: '31032' - agribalyse_proxy_food_code:en: '31032' - ciqual_food_code:en: '31032' - categories_properties_tags: - - all-products - - categories-known - - agribalyse-food-code-31032 - - agribalyse-food-code-known - - agribalyse-proxy-food-code-31032 - - agribalyse-proxy-food-code-known - - ciqual-food-code-31032 - - ciqual-food-code-known - - agribalyse-known - - agribalyse-31032 - categories_tags: - - en:breakfasts - - en:spreads - - en:sweet-spreads - - fr:pates-a-tartiner - - en:hazelnut-spreads - - en:chocolate-spreads - - en:cocoa-and-hazelnuts-spreads - category_properties: - ciqual_food_name:en: Chocolate spread with hazelnuts - checked: 'on' - checkers_tags: - - moon-rabbit - ciqual_food_name_tags: - - chocolate-spread-with-hazelnuts - cities_tags: [] - code: '3017620422003' - codes_tags: - - code-13 - - 3017620422xxx - - 301762042xxxx - - 30176204xxxxx - - 3017620xxxxxx - - 301762xxxxxxx - - 30176xxxxxxxx - - 3017xxxxxxxxx - - 301xxxxxxxxxx - - 30xxxxxxxxxxx - - 3xxxxxxxxxxxx - compared_to_category: en:cocoa-and-hazelnuts-spreads - complete: 0 - completeness: 0.875 - conservation_conditions: "A conserver au sec et \xE0 l'abri\ - \ de la chaleur. Ne pas mettre au r\xE9frig\xE9rateur." - conservation_conditions_fr: "A conserver au sec et \xE0 l'abri\ - \ de la chaleur. Ne pas mettre au r\xE9frig\xE9rateur." - correctors_tags: - - user1 - - user2 - - user3 - - user4 - countries: en:Algeria Austria Belgium Canada France Germany Italy Luxembourg Mexico Morocco Netherlands Portugal Senegal Spain Switzerland Tunisia United - Kingdom United States - countries_beforescanbot: Belgium,France - countries_hierarchy: - - en:Algeria Austria Belgium Canada France Germany Italy Luxembourg Mexico Morocco Netherlands Portugal Senegal Spain Switzerland Tunisia United - Kingdom United States - countries_lc: fr - countries_tags: - - en:algeria-austria-belgium-canada-france-germany-italy-luxembourg-mexico-morocco-netherlands-portugal-senegal-spain-switzerland-tunisia-united-kingdom-united-states - created_t: 1457680652 - creator: openfoodfacts-contributors - customer_service: FERRERO FRANCE COMMERCIALE - Service Consommateurs, - CS 90058 - 76136 MONT SAINT AIGNAN Cedex - customer_service_fr: FERRERO FRANCE COMMERCIALE - Service Consommateurs, - CS 90058 - 76136 MONT SAINT AIGNAN Cedex - data_quality_bugs_tags: [] - data_quality_errors_tags: [] - data_quality_info_tags: - - en:packaging-data-incomplete - - en:ingredients-percent-analysis-ok - - en:ecoscore-extended-data-computed - - en:ecoscore-extended-data-less-precise-than-agribalyse - - en:food-groups-1-known - - en:food-groups-2-known - - en:food-groups-3-unknown - data_quality_tags: - - en:packaging-data-incomplete - - en:ingredients-percent-analysis-ok - - en:ecoscore-extended-data-computed - - en:ecoscore-extended-data-less-precise-than-agribalyse - - en:food-groups-1-known - - en:food-groups-2-known - - en:food-groups-3-unknown - - en:ecoscore-origins-of-ingredients-origins-are-100-percent-unknown - - en:ecoscore-packaging-unspecified-shape - - en:ecoscore-production-system-no-label - data_quality_warnings_tags: - - en:ecoscore-origins-of-ingredients-origins-are-100-percent-unknown - - en:ecoscore-packaging-unspecified-shape - - en:ecoscore-production-system-no-label - data_sources: Database - FoodRepo / openfood.ch, Databases, - Producer - Ferrero, Producers, App - yuka, Apps, Producer - - ferrero-france-commerciale, Database - Equadis, Database - - GDSN, App - InFood, App - Open Food Facts, App - halal-healthy, - App - smoothie-openfoodfacts - data_sources_tags: - - database-foodrepo-openfood-ch - - databases - - producer-ferrero - - producers - - app-yuka - - apps - - producer-ferrero-france-commerciale - - database-equadis - - database-gdsn - - app-infood - - app-open-food-facts - - app-halal-healthy - - app-smoothie-openfoodfacts - ecoscore_data: - adjustments: - origins_of_ingredients: - aggregated_origins: - - origin: en:unknown - percent: 100 - epi_score: 0 - epi_value: -5 - origins_from_origins_field: - - en:unknown - transportation_scores: - fr: 0 - 'no': 0 - uk: 0 - us: 0 - world: 0 - transportation_values: - fr: 0 - 'no': 0 - uk: 0 - us: 0 - world: 0 - values: - fr: -5 - 'no': -5 - uk: -5 - us: -5 - world: -5 - warning: origins_are_100_percent_unknown - packaging: - non_recyclable_and_non_biodegradable_materials: 0 - packagings: - - ecoscore_material_score: 81 - ecoscore_shape_ratio: 1 - material: en:clear-glass - shape: en:unknown - score: 81 - value: -2 - warning: unspecified_shape - production_system: - labels: [] - value: 0 - warning: no_label - threatened_species: - ingredient: en:palm-oil - value: -10 - agribalyse: - agribalyse_food_code: '31032' - co2_agriculture: 8.7770996 - co2_consumption: 0 - co2_distribution: 0.014104999 - co2_packaging: 0.18864842 - co2_processing: 0.69167973 - co2_total: 9.8742343 - co2_transportation: 0.19708507 - code: '31032' - dqr: '2.54' - ef_agriculture: 0.61477708 - ef_consumption: 0 - ef_distribution: 0.0045906531 - ef_packaging: 0.020453714 - ef_processing: 0.085674643 - ef_total: 0.74366703 - ef_transportation: 0.017824104 - is_beverage: 0 - name_en: Chocolate spread with hazelnuts - name_fr: "P\xE2te \xE0 tartiner chocolat et noisette" - score: 40 - grade: d - grades: - fr: d - 'no': d - uk: d - us: d - world: d - missing: - labels: 1 - origins: 1 - packagings: 1 - missing_data_warning: 1 - score: 23 - scores: - fr: 23 - 'no': 23 - uk: 23 - us: 23 - world: 23 - status: known - ecoscore_extended_data: - impact: - ef_single_score_log_stddev: 0.0539895633164057 - likeliest_impacts: - Climate_change: 0.172717449218484 - EF_single_score: 0.023255035815491 - likeliest_recipe: - en:emulsifier: 0.388589430098073 - en:hazelnut_oil: 12.806852015349 - en:palm_oil: 16.6103749736231 - en:sugar: 52.9709312507153 - en:water: 4.90093151221936 - fr:Cacao_Maigre_7: 3.94056985087663 - fr:Lait__cr_m__En_Poudre_8: 6.8959972390341 - mass_ratio_uncharacterized: 0.11 - uncharacterized_ingredients: - impact: - - "fr:Lait \xC9cr\xE9m\xE9 En Poudre 8" - - fr:Cacao Maigre 7 - nutrition: - - "fr:Lait \xC9cr\xE9m\xE9 En Poudre 8" - - fr:Cacao Maigre 7 - uncharacterized_ingredients_mass_proportion: - impact: 0.11 - nutrition: 0.11 - uncharacterized_ingredients_ratio: - impact: 0.333333333333333 - nutrition: 0.333333333333333 - warnings: - - 'The product has a high number of nutrition uncharacterized - ingredients: 33%' - - 'The product has a high number of impact uncharacterized - ingredients: 33%' - - 'The estimated mass of nutrition uncharacterized ingredients - in the product is high: 11%' - - 'The estimated mass of impact uncharacterized ingredients - in the product is high: 11%' - ecoscore_extended_data_version: '4' - ecoscore_grade: d - ecoscore_score: 23 - ecoscore_tags: - - d - editors_tags: - - user1 - - user2 - - user3 - - user4 - emb_codes: '' - emb_codes_20141016: '' - emb_codes_orig: '' - emb_codes_tags: [] - entry_dates_tags: - - '2016-03-11' - - 2016-03 - - '2016' - environment_impact_level: '' - environment_impact_level_tags: [] - expiration_date: 09/2021 - food_groups: en:sweets - food_groups_tags: - - en:sugary-snacks - - en:sweets - fruits-vegetables-nuts_100g_estimate: 0 - generic_name: '' - generic_name_ar: "\u0646\u0648\u062A\u0644\u0627" - generic_name_de: Nuss-Nougat-Creme - generic_name_en: '' - generic_name_es: Crema de Avellanas con cacao - generic_name_fr: "P\xE2te \xE0 tartiner aux noisettes" - generic_name_id: '' - generic_name_it: Nutella - generic_name_nl: '' - grades: {} - id: '3017620422003' - image_front_small_url: https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.200.jpg - image_front_thumb_url: https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.100.jpg - image_front_url: https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.400.jpg - image_nutrition_small_url: https://images.openfoodfacts.org/images/products/301/762/042/2003/nutrition_en.400.200.jpg - image_nutrition_thumb_url: https://images.openfoodfacts.org/images/products/301/762/042/2003/nutrition_en.400.100.jpg - image_nutrition_url: https://images.openfoodfacts.org/images/products/301/762/042/2003/nutrition_en.400.400.jpg - image_small_url: https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.200.jpg - image_thumb_url: https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.100.jpg - image_url: https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.400.jpg - images: - '1': - sizes: - '100': - h: 100 - w: 56 - '400': - h: 400 - w: 225 - full: - h: 2000 - w: 1125 - uploaded_t: '1457680652' - uploader: openfoodfacts-contributors - '2': - sizes: - '100': - h: 100 - w: 75 - '400': - h: 400 - w: 300 - full: - h: 3264 - w: 2448 - uploaded_t: '1462829284' - uploader: openfoodfacts-contributors - '3': - sizes: - '100': - h: 100 - w: 56 - '400': - h: 400 - w: 225 - full: - h: 2000 - w: 1125 - uploaded_t: '1468510986' - uploader: user3 - front_en: - angle: '0' - coordinates_image_size: full - geometry: 0x0-0-0 - imgid: '1' - normalize: 'false' - rev: '399' - sizes: - '100': - h: 100 - w: 77 - '200': - h: 200 - w: 155 - '400': - h: 400 - w: 310 - full: - h: 1808 - w: 1400 - white_magic: 'false' - x1: '0' - x2: '0' - y1: '0' - y2: '0' - front_fr: - angle: 0 - coordinates_image_size: '400' - geometry: 0x0--5--5 - imgid: '2' - normalize: 'false' - rev: '415' - sizes: - '100': - h: 100 - w: 77 - '200': - h: 200 - w: 155 - '400': - h: 400 - w: 310 - full: - h: 1808 - w: 1400 - white_magic: 'false' - x1: '-1' - x2: '-1' - y1: '-1' - y2: '-1' - ingredients_fr: - angle: null - coordinates_image_size: '400' - geometry: 0x0-0-0 - imgid: '3' - normalize: null - rev: '299' - sizes: - '100': - h: 16 - w: 100 - '200': - h: 33 - w: 200 - '400': - h: 65 - w: 400 - full: - h: 334 - w: 2046 - white_magic: null - x1: null - x2: null - y1: null - y2: null - nutrition_en: - angle: '0' - coordinates_image_size: full - geometry: 0x0-0-0 - imgid: '3' - normalize: 'false' - rev: '400' - sizes: - '100': - h: 100 - w: 96 - '200': - h: 200 - w: 192 - '400': - h: 400 - w: 383 - full: - h: 572 - w: 548 - white_magic: 'false' - x1: '0' - x2: '0' - y1: '0' - y2: '0' - packaging_fr: - angle: 0 - coordinates_image_size: full - geometry: 0x0--1--1 - imgid: '3' - normalize: null - rev: '420' - sizes: - '100': - h: 31 - w: 100 - '200': - h: 61 - w: 200 - '400': - h: 122 - w: 400 - full: - h: 638 - w: 2084 - white_magic: null - x1: '-1' - x2: '-1' - y1: '-1' - y2: '-1' - informers_tags: - - user1 - - user2 - - user3 - - user4 - ingredients: - - id: en:sugar - percent_estimate: 46.5 - percent_max: 63 - percent_min: 30 - text: sugar - vegan: 'yes' - vegetarian: 'yes' - - from_palm_oil: 'yes' - id: en:palm-oil - percent_estimate: 25.5 - percent_max: 38 - percent_min: 13 - text: palm oil - vegan: 'yes' - vegetarian: 'yes' - - id: en:hazelnut - percent: 13 - percent_estimate: 13 - percent_max: 13 - percent_min: 13 - text: hazelnuts - vegan: 'yes' - vegetarian: 'yes' - - id: en:skim-milk-powder-8 - percent: 7 - percent_estimate: 7 - percent_max: 7 - percent_min: 7 - text: skim milk powder 8 - - id: en:lean-cocoa-7 - percent: 4 - percent_estimate: 4 - percent_max: 4 - percent_min: 4 - text: lean cocoa 7 - - id: en:emulsifier - ingredients: - - id: en:soya-lecithin - percent_estimate: 2 - percent_max: 4 - percent_min: 0 - text: soy lecithins - vegan: 'yes' - vegetarian: 'yes' - percent_estimate: 2 - percent_max: 4 - percent_min: 0 - text: emulsifiers - - id: en:vanillin - percent_estimate: 2 - percent_max: 4 - percent_min: 0 - text: vanillin - ingredients_analysis: - en:palm-oil: - - en:palm-oil - en:vegan-status-unknown: - - en:skim-milk-powder-8 - - en:lean-cocoa-7 - - en:vanillin - en:vegetarian-status-unknown: - - en:skim-milk-powder-8 - - en:lean-cocoa-7 - - en:vanillin - ingredients_analysis_tags: - - en:palm-oil - - en:vegan-status-unknown - - en:vegetarian-status-unknown - ingredients_from_or_that_may_be_from_palm_oil_n: 0 - ingredients_from_palm_oil_n: 0 - ingredients_from_palm_oil_tags: [] - ingredients_hierarchy: - - en:sugar - - en:added-sugar - - en:disaccharide - - en:palm-oil - - en:oil-and-fat - - en:vegetable-oil-and-fat - - en:palm-oil-and-fat - - en:hazelnut - - en:nut - - en:tree-nut - - en:skim-milk-powder-8 - - en:lean-cocoa-7 - - en:emulsifier - - en:vanillin - - en:soya-lecithin - - en:e322 - - en:e322i - ingredients_n: 8 - ingredients_n_tags: - - '8' - - 1-10 - ingredients_original_tags: - - en:sugar - - en:palm-oil - - en:hazelnut - - en:skim-milk-powder-8 - - en:lean-cocoa-7 - - en:emulsifier - - en:vanillin - - en:soya-lecithin - ingredients_percent_analysis: 1 - ingredients_tags: - - en:sugar - - en:added-sugar - - en:disaccharide - - en:palm-oil - - en:oil-and-fat - - en:vegetable-oil-and-fat - - en:palm-oil-and-fat - - en:hazelnut - - en:nut - - en:tree-nut - - en:skim-milk-powder-8 - - en:lean-cocoa-7 - - en:emulsifier - - en:vanillin - - en:soya-lecithin - - en:e322 - - en:e322i - ingredients_text: 'sugar, palm oil, hazelnuts 13%, skim milk - powder 8, 7%, lean cocoa 7, 4%, emulsifiers: soy lecithins, - vanillin' - ingredients_text_en: 'sugar, palm oil, hazelnuts 13%, skim - milk powder 8, 7%, lean cocoa 7, 4%, emulsifiers: soy lecithins, - vanillin' - ingredients_text_fr: "Sucre, huile de palme, _NOISETTES_ 13%,\ - \ _LAIT_ \xE9cr\xE9m\xE9 en poudre 8,7%, cacao maigre 7,4%,\ - \ \xE9mulsifiants: l\xE9cithine [SOJA]; vanilline. Sans gluten" - ingredients_text_with_allergens: 'sugar, palm oil, hazelnuts - 13%, skim milk powder 8, 7%, lean cocoa 7, 4%, emulsifiers: - soy lecithins, vanillin' - ingredients_text_with_allergens_en: 'sugar, palm oil, hazelnuts 13%, skim milk powder 8, - 7%, lean cocoa 7, 4%, emulsifiers: soy lecithins, vanillin' - ingredients_text_with_allergens_fr: "Sucre, huile de palme,\ - \ NOISETTES 13%, LAIT \xE9cr\xE9m\xE9 en poudre 8,7%, cacao\ - \ maigre 7,4%, \xE9mulsifiants: l\xE9cithine [SOJA]; vanilline. Sans gluten" - ingredients_that_may_be_from_palm_oil_n: 0 - ingredients_that_may_be_from_palm_oil_tags: [] - ingredients_with_specified_percent_n: 3 - ingredients_with_specified_percent_sum: 24 - ingredients_with_unspecified_percent_n: 4 - ingredients_with_unspecified_percent_sum: 76 - interface_version_created: '20120622' - interface_version_modified: 20150316.jqm2 - known_ingredients_n: 15 - labels: Sans gluten,en:nonorganic - labels_hierarchy: - - en:no-gluten - - en:nonorganic - labels_lc: fr - labels_tags: - - en:no-gluten - - en:nonorganic - lang: en - languages: - en:arabic: 2 - en:english: 4 - en:french: 10 - en:german: 3 - en:italian: 3 - en:spanish: 7 - languages_codes: - en: 4 - fr: 10 - languages_hierarchy: - - en:english - - en:french - languages_tags: - - en:english - - en:french - - en:multilingual - last_check_dates_tags: - - '2021-07-21' - - 2021-07 - - '2021' - last_checked_t: 1626872806 - last_checker: user3 - last_edit_dates_tags: - - '2022-07-29' - - 2022-07 - - '2022' - last_editor: user4 - last_image_dates_tags: - - '2022-07-29' - - 2022-07 - - '2022' - last_image_t: 1659084293 - last_modified_by: user4 - last_modified_t: 1659084329 - lc: en - link: '' - main_countries_tags: [] - manufacturing_places: '' - manufacturing_places_tags: [] - max_imgid: '121' - minerals_prev_tags: [] - minerals_tags: [] - misc_tags: - - en:nutrition-no-fiber - - en:nutrition-fruits-vegetables-nuts-estimate-from-ingredients - - en:nutrition-no-fiber-or-fruits-vegetables-nuts - - en:nutriscore-computed - - en:ecoscore-extended-data-computed - - en:ecoscore-extended-data-version-4 - - en:ecoscore-missing-data-warning - - en:ecoscore-missing-data-labels - - en:ecoscore-missing-data-origins - - en:ecoscore-missing-data-packagings - - en:ecoscore-computed - no_nutrition_data: 'null' - nova_group: 4 - nova_groups: '4' - nova_groups_markers: - '3': - - - ingredients - - en:sugar - '4': - - - additives - - en:e322 - - - ingredients - - en:emulsifier - nova_groups_tags: - - en:4-ultra-processed-food-and-drink-products - nucleotides_prev_tags: [] - nucleotides_tags: [] - nutrient_levels: - fat: high - salt: low - saturated-fat: high - sugars: high - nutrient_levels_tags: - - en:fat-in-high-quantity - - en:saturated-fat-in-high-quantity - - en:sugars-in-high-quantity - - en:salt-in-low-quantity - nutriments: - alcohol: 0 - alcohol_100g: 0 - alcohol_serving: 0 - alcohol_unit: '% vol' - alcohol_value: 0 - carbohydrates: 57.5 - carbohydrates_100g: 57.5 - carbohydrates_serving: 8.62 - carbohydrates_unit: g - carbohydrates_value: 57.5 - carbon-footprint-from-known-ingredients_product: 135 - carbon-footprint-from-known-ingredients_serving: 5.07 - energy: 2252 - energy-kcal: 539 - energy-kcal_100g: 539 - energy-kcal_serving: 80.8 - energy-kcal_unit: kcal - energy-kcal_value: 539 - energy-kj: 2252 - energy-kj_100g: 2252 - energy-kj_serving: 338 - energy-kj_unit: kJ - energy-kj_value: 2252 - energy_100g: 2252 - energy_serving: 338 - energy_unit: kJ - energy_value: 2252 - fat: 30.9 - fat_100g: 30.9 - fat_serving: 4.63 - fat_unit: g - fat_value: 30.9 - fruits-vegetables-nuts-estimate-from-ingredients_100g: 13 - fruits-vegetables-nuts-estimate-from-ingredients_serving: 13 - nova-group: 4 - nova-group_100g: 4 - nova-group_serving: 4 - nutrition-score-fr: 26 - nutrition-score-fr_100g: 26 - proteins: 6.3 - proteins_100g: 6.3 - proteins_serving: 0.945 - proteins_unit: g - proteins_value: 6.3 - salt: 0.107 - salt_100g: 0.107 - salt_serving: 0.016 - salt_unit: g - salt_value: 0.107 - saturated-fat: 10.6 - saturated-fat_100g: 10.6 - saturated-fat_serving: 1.59 - saturated-fat_unit: g - saturated-fat_value: 10.6 - sodium: 0.0428 - sodium_100g: 0.0428 - sodium_serving: 0.00642 - sodium_unit: g - sodium_value: 0.0428 - sugars: 56.3 - sugars_100g: 56.3 - sugars_serving: 8.44 - sugars_unit: g - sugars_value: 56.3 - nutriscore_data: - energy: 2252 - energy_points: 6 - energy_value: 2252 - fiber: 0 - fiber_points: 0 - fiber_value: 0 - fruits_vegetables_nuts_colza_walnut_olive_oils: 13 - fruits_vegetables_nuts_colza_walnut_olive_oils_points: 0 - fruits_vegetables_nuts_colza_walnut_olive_oils_value: 13 - grade: e - is_beverage: 0 - is_cheese: 0 - is_fat: 0 - is_water: 0 - negative_points: 26 - positive_points: 0 - proteins: 6.3 - proteins_points: 3 - proteins_value: 6.3 - saturated_fat: 10.6 - saturated_fat_points: 10 - saturated_fat_ratio: 34.3042071197411 - saturated_fat_ratio_points: 5 - saturated_fat_ratio_value: 34.3 - saturated_fat_value: 10.6 - score: 26 - sodium: 42.8 - sodium_points: 0 - sodium_value: 42.8 - sugars: 56.3 - sugars_points: 10 - sugars_value: 56.3 - nutriscore_grade: e - nutriscore_score: 26 - nutriscore_score_opposite: -26 - nutrition_data: 'on' - nutrition_data_per: 100g - nutrition_data_prepared: '' - nutrition_data_prepared_per: 100g - nutrition_grade_fr: e - nutrition_grades: e - nutrition_grades_tags: - - e - nutrition_score_beverage: 0 - nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients: 1 - nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients_value: 13 - nutrition_score_warning_no_fiber: 1 - obsolete: '' - obsolete_since_date: '' - origin: '' - origins: '' - origins_hierarchy: [] - origins_lc: fr - origins_tags: [] - other_nutritional_substances_tags: [] - owner: org-ferrero-france-commerciale - owners_tags: org-ferrero-france-commerciale - packaging: PP 5 Ummi PLASTIQUE / PLASTIEK PAP 27 WWW PAPIER - / PAPIER CIPAP 82 PANNEAU DE FIBRE COMPOSITES/ COMPOSIET VEZELPLAAT - GL 70 VERRE / GLAS - packaging_hierarchy: - - fr:PP 5 Ummi PLASTIQUE / PLASTIEK PAP 27 WWW PAPIER / PAPIER - CIPAP 82 PANNEAU DE FIBRE COMPOSITES/ COMPOSIET VEZELPLAAT - GL 70 VERRE / GLAS - packaging_lc: fr - packaging_tags: - - fr:pp-5-ummi-plastique-plastiek-pap-27-www-papier-papier-cipap-82-panneau-de-fibre-composites-composiet-vezelplaat-gl-70-verre-glas - packaging_text: '' - packaging_text_ar: '' - packaging_text_de: '' - packaging_text_en: '' - packaging_text_es: Pot en verre, couvercle en plastique. - packaging_text_fr: "1 couvercle plastique blanc opaque PP \xE0\ - \ jeter,\r\n1 plaque en carton PAP 21 \xE0 recycler,\r\n1\ - \ opercule en carton C/PAP 82 \xE0 recycler,\r\n1 pot en verre\ - \ \xE0 recycler" - packaging_text_id: '' - packaging_text_it: '' - packaging_text_nl: '' - packagings: - - material: en:clear-glass - photographers_tags: - - user1 - - user2 - - user3 - - user4 - pnns_groups_1: Sugary snacks - pnns_groups_1_tags: - - sugary-snacks - - known - pnns_groups_2: Sweets - pnns_groups_2_tags: - - sweets - - known - popularity_key: 20999992556 - popularity_tags: - - top-10-scans-2021 - - top-50-scans-2021 - - top-100-scans-2021 - - top-500-scans-2021 - - top-1000-scans-2021 - - top-5000-scans-2021 - - top-10000-scans-2021 - - top-50000-scans-2021 - - top-100000-scans-2021 - - top-10-fr-scans-2021 - - top-50-fr-scans-2021 - - top-100-fr-scans-2021 - - top-500-fr-scans-2021 - - top-1000-fr-scans-2021 - - top-5000-fr-scans-2021 - - top-10000-fr-scans-2021 - - top-50000-fr-scans-2021 - - top-100000-fr-scans-2021 - - top-country-fr-scans-2021 - - at-least-5-fr-scans-2021 - - at-least-10-fr-scans-2021 - product_name: Nutella - product_name_ar: "\u0646\u0648\u062A\u064A\u0644\u0627" - product_name_de: Nutella - product_name_en: Nutella - product_name_es: Nutella - product_name_fr: "P\xE2te \xE0 tartiner Nutella noisettes et\ - \ cacao - 400g" - product_name_id: '' - product_name_it: Nutella - product_name_nl: '' - product_quantity: '400' - purchase_places: F - 77480 Mousseaux les Bray France - purchase_places_tags: - - f-77480-mousseaux-les-bray-france - quantity: 400g - removed_countries_tags: [] - rev: 421 - scans_n: 3713 - scores: {} - selected_images: - front: - display: - en: https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.400.jpg - fr: https://images.openfoodfacts.org/images/products/301/762/042/2003/front_fr.415.400.jpg - small: - en: https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.200.jpg - fr: https://images.openfoodfacts.org/images/products/301/762/042/2003/front_fr.415.200.jpg - thumb: - en: https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.399.100.jpg - fr: https://images.openfoodfacts.org/images/products/301/762/042/2003/front_fr.415.100.jpg - ingredients: - display: - fr: https://images.openfoodfacts.org/images/products/301/762/042/2003/ingredients_fr.299.400.jpg - small: - fr: https://images.openfoodfacts.org/images/products/301/762/042/2003/ingredients_fr.299.200.jpg - thumb: - fr: https://images.openfoodfacts.org/images/products/301/762/042/2003/ingredients_fr.299.100.jpg - nutrition: - display: - en: https://images.openfoodfacts.org/images/products/301/762/042/2003/nutrition_en.400.400.jpg - small: - en: https://images.openfoodfacts.org/images/products/301/762/042/2003/nutrition_en.400.200.jpg - thumb: - en: https://images.openfoodfacts.org/images/products/301/762/042/2003/nutrition_en.400.100.jpg - packaging: - display: - fr: https://images.openfoodfacts.org/images/products/301/762/042/2003/packaging_fr.420.400.jpg - small: - fr: https://images.openfoodfacts.org/images/products/301/762/042/2003/packaging_fr.420.200.jpg - thumb: - fr: https://images.openfoodfacts.org/images/products/301/762/042/2003/packaging_fr.420.100.jpg - serving_quantity: '15' - serving_size: 15g - sortkey: 1610877517 - sources: - - fields: - - product_name_de - - product_name_it - - brands - - countries - id: openfood-ch - images: [] - import_t: 1548767279 - manufacturer: '0' - name: FoodRepo - source_licence: Creative Commons Attribution 4.0 International - License - source_licence_url: https://creativecommons.org/licenses/by/4.0/ - url: https://www.foodrepo.org/ch/products/19413 - - fields: - - packaging - - ingredients_text_fr - id: ferrero - images: [] - import_t: 1552318840 - manufacturer: '1' - name: Ferrero - url: https://www.ferrero.fr - sources_fields: - org-gs1: - gln: '3010176200101' - gpcCategoryCode: '10000187' - gpcCategoryName: "P\xE2tes \xE0 Tartiner Sucr\xE9es (Longue\ - \ Conservation)" - isAllergenRelevantDataProvided: 'true' - lastChangeDateTime: '2022-07-13T16:01:41+02:00' - partyName: FERRERO FRANCE COMMERCIALE - productionVariantDescription: '2014' - publicationDateTime: '2022-07-13T16:01:41+02:00' - states: en:to-be-completed, en:nutrition-facts-completed, en:ingredients-completed, - en:expiration-date-completed, en:packaging-code-to-be-completed, - en:characteristics-to-be-completed, en:origins-to-be-completed, - en:categories-completed, en:brands-completed, en:packaging-completed, - en:quantity-completed, en:product-name-completed, en:photos-to-be-validated, - en:packaging-photo-to-be-selected, en:nutrition-photo-selected, - en:ingredients-photo-to-be-selected, en:front-photo-selected, - en:photos-uploaded - states_hierarchy: - - en:to-be-completed - - en:nutrition-facts-completed - - en:ingredients-completed - - en:expiration-date-completed - - en:packaging-code-to-be-completed - - en:characteristics-to-be-completed - - en:origins-to-be-completed - - en:categories-completed - - en:brands-completed - - en:packaging-completed - - en:quantity-completed - - en:product-name-completed - - en:photos-to-be-validated - - en:packaging-photo-to-be-selected - - en:nutrition-photo-selected - - en:ingredients-photo-to-be-selected - - en:front-photo-selected - - en:photos-uploaded - states_tags: - - en:to-be-completed - - en:nutrition-facts-completed - - en:ingredients-completed - - en:expiration-date-completed - - en:packaging-code-to-be-completed - - en:characteristics-to-be-completed - - en:origins-to-be-completed - - en:categories-completed - - en:brands-completed - - en:packaging-completed - - en:quantity-completed - - en:product-name-completed - - en:photos-to-be-validated - - en:packaging-photo-to-be-selected - - en:nutrition-photo-selected - - en:ingredients-photo-to-be-selected - - en:front-photo-selected - - en:photos-uploaded - stores: "Bi1 Magasins U Carrefour Franprix Auchan Casino\ - \ Intermarch\xE9,carrefour.fr" - stores_tags: - - bi1-magasins-u-carrefour-franprix-auchan-casino-intermarche - - carrefour-fr - teams: pain-au-chocolat,shark-attack,stakano,chocolatine,la-robe-est-bleue,vegan,m,b,c,vegancheck - teams_tags: - - pain-au-chocolat - - shark-attack - - stakano - - chocolatine - - la-robe-est-bleue - - vegan - - m - - b - - c - - vegancheck - traces: '' - traces_from_ingredients: '' - traces_from_user: '(fr) ' - traces_hierarchy: [] - traces_lc: fr - traces_tags: [] - unique_scans_n: 2544 - unknown_ingredients_n: 2 - unknown_nutrients_tags: [] - update_key: ing20220322 - vitamins_prev_tags: [] - vitamins_tags: [] - status: 1 - status_verbose: product found - description: 'A product can be fetched via its unique barcode. - - It returns all the details of that product response. - - ' - operationId: getProductByBarcode - /api/v2/product/{barcode}?fields=knowledge_panels: - get: - tags: - - Read Requests - summary: 'Get Knowledge panels for a specific product by barcode - - (special case of get product) - - ' - parameters: - - name: barcode - in: path - description: 'The barcode of the product to be fetched - - ' - required: true - style: simple - explode: false - schema: - type: string - example: '3017620422003' - responses: - '200': - description: OK - content: - application/json: - schema: - allOf: - - $ref: '#/components/schemas/get_product_by_barcode_base' - - type: object - properties: - product: - $ref: '#/components/schemas/product_knowledge_panels' - description: 'Knowledge panels gives high leve informations about a product, - - ready to display. - - This is used by open food facts website, - - and by the official mobile application - - ' - operationId: getProductByBarcodeKnowledgePanels - /cgi/ingredients.pl: - parameters: [] - get: - summary: Performing OCR on a Product - operationId: getIngredients - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/ocr_on_product' - description: 'Open Food Facts uses optical character recognition (OCR) to retrieve - nutritional data and other information from the product labels. - - ' - parameters: - - $ref: '#/components/parameters/id' - - $ref: '#/components/parameters/code' - - $ref: '#/components/parameters/process_image' - - $ref: '#/components/parameters/ocr_engine' - tags: - - Read Requests - /cgi/product_image_crop.pl: - post: - summary: Crop A Photo - operationId: productImageCrop - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: {} - description: 'Cropping is only relevant for editing existing products. - - You cannot crop an image the first time you upload it to the system. - - ' - parameters: [] - requestBody: - required: true - content: - multipart/form-data: - schema: - $ref: '#/components/schemas/crop_a_photo' - tags: - - Write Requests - get: - summary: Rotate A Photo - operationId: getProductImageCrop - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/rotate_a_photo' - description: "Although we recommend rotating photos manually and uploading a\ - \ new version of the image,\nthe OFF API allows you to make api calls to automate\ - \ this process.\nYou can rotate existing photos by setting the angle to 90\xBA\ - , 180\xBA, or 270\xBA clockwise.\n" - parameters: - - $ref: '#/components/parameters/code' - - $ref: '#/components/parameters/id' - - $ref: '#/components/parameters/imgid' - - $ref: '#/components/parameters/angle' - tags: - - Write Requests - /cgi/product_image_unselect.pl: - post: - operationId: postProductImageUnselect - summary: Unselect A Photo - requestBody: - required: true - content: - multipart/form-data: - schema: - $ref: '#/components/schemas/unselect_a_photo' - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - status: - type: string - description: status of the unselect operation - example: status ok - status_code: - type: number - description: status code of the operation - example: 0 - imagefield: - type: string - example: front_fr - description: image field that was unselected - /cgi/product_jqm2.pl: - post: - summary: Add or Edit A Product - operationId: postProduct - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/add_or_edit_a_product' - parameters: [] - requestBody: - required: true - content: - multipart/form-data: - schema: - $ref: '#/components/schemas/combined_add_or_edit_a_product_and_change_ref_properties' - tags: - - Write Requests - description: 'This updates a product. - - - Note: If the barcode exists then you will be editing the existing product, - - However if it doesn''''t you will be creating a new product with that unique - barcode, - - and adding properties to the product. - - ' - /api/v2/search: - get: - summary: Search for Products - tags: - - Read Requests - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/search_for_products' - operationId: searchProducts - description: "Search request allows you to get products that match your search\ - \ criteria.\n\nIt allows you create many custom APIs for your use case.\n\n\ - If the search query parameter has 2 possible values, they are seperated by\ - \ a comma(,).\nWhen filtering via a parameter that has different language\ - \ codes like `fr`, `de` or `en`, specify the language code in the parameter\ - \ name e.g `categories_tags_en`\n\n**Important:** search API v2 does not support\ - \ full text request (search_term),\nyou have to use [search API v1](https://wiki.openfoodfacts.org/API/Read/Search)\ - \ for that.\nUpcoming [search-a-licious project](https://github.com/openfoodfacts/search-a-licious)\ - \ will fix that.\n\n### Limiting results\n\nYou can limit the size of returned\ - \ objects thanks to the `fields` object (see below).\n\neg: `fields=code,product_name,brands,attribute_groups``\n\ - \nPlease use it as much as possible to avoid overloading the servers.\n\n\ - The search use pagination, see `page` and `page_size` parameters.\n\n**Beware:**\ - \ the `page_count` data in item is a bit counter intuitive\u2026, read the\ - \ description.\n\n### Conditions on tags\n\nAll `_tags`` parameters accepts\ - \ either:\n\n* a single value\n* or a comma-separated list of values (doing\ - \ a AND)\n* or a pipe separated list of values (doing a OR)\n\nYou can exclude\ - \ terms by using a \"-\" prefix.\n\nFor taxonomized entries, you might either\ - \ use the tag id (recommended),\nor a known synonym (without language prefix)\n\ - \n* `labels_tags=en:organic,en:fair-trade` find items that are fair-trade\ - \ AND organic\n* `labels_tags=en:organic|en:fair-trade` find items that are\ - \ fair-trade OR organic\n* `labels_tags=en:organic,en:-fair-trade` find items\ - \ that are organic BUT NOT fair-trade\n\n\n### Conditions on nutriments\n\n\ - To get a list of nutrients\n\nYou can either query on nutrient per 100g (`_100g`\ - \ suffix)\nor per serving (`serving` suffix).\n\nYou can also add `_prepared_`\n\ - to get the nutrients in the prepared product instead of as sold.\n\nYou can\ - \ add a comparison operator and value to the parameter name\nto get products\ - \ with nutrient above or bellow a value.\nIf you use a parameter value it\ - \ exactly match it.\n\n* `energy-kj_100g<200` products where energy in kj\ - \ for 100g is less than 200kj\n* `sugars_serving>10` products where sugar\ - \ per serving is greater than 10g\n* `saturated-fat_100g=1` products where\ - \ saturated fat per 100g is exactly 10g\n* `salt_prepared_serving<0.1` products\ - \ where salt per serving for prepared product is less than 0.1g\n\n### More\ - \ references\n\nSee also [wiki page](https://wiki.openfoodfacts.org/Open_Food_Facts_Search_API_Version_2)\n" - parameters: - - $ref: '#/components/parameters/tags_parameters_properties_additives_tags' - - $ref: '#/components/parameters/tags_parameters_properties_allergens_tags' - - $ref: '#/components/parameters/tags_parameters_properties_brands_tags' - - $ref: '#/components/parameters/tags_parameters_properties_categories_tags' - - $ref: '#/components/parameters/tags_parameters_properties_countries_tags' - - $ref: '#/components/parameters/tags_parameters_properties_emb_codes_tags' - - $ref: '#/components/parameters/tags_parameters_properties_labels_tags' - - $ref: '#/components/parameters/tags_parameters_properties_manufacturing_places_tags' - - $ref: '#/components/parameters/tags_parameters_properties_nutrition_grades_tags' - - $ref: '#/components/parameters/tags_parameters_properties_origins_tags' - - $ref: '#/components/parameters/tags_parameters_properties_packaging_tags' - - $ref: '#/components/parameters/tags_parameters_properties_purchase_places_tags' - - $ref: '#/components/parameters/tags_parameters_properties_states_tags' - - $ref: '#/components/parameters/tags_parameters_properties_stores_tags' - - $ref: '#/components/parameters/tags_parameters_properties_traces_tags' - - $ref: '#/components/parameters/tags_parameters_properties_tag_name_with_language_code' - - $ref: '#/components/parameters/nutrition_search_properties_nutrient_lower_than' - - $ref: '#/components/parameters/nutrition_search_properties_nutrient_greater_than' - - $ref: '#/components/parameters/nutrition_search_properties_nutrient_equal' - - $ref: '#/components/parameters/fields' - - $ref: '#/components/parameters/sort_by' - - $ref: '#/components/parameters/page' - - $ref: '#/components/parameters/page_size' - parameters: [] - /cgi/suggest.pl: - get: - summary: Get Suggestions to Aid Adding/Editing Products - tags: - - Read Requests - responses: - '200': - description: OK - content: - application/json: - schema: - type: array - operationId: getSuggestions - parameters: - - $ref: '#/components/parameters/tagtype' - - $ref: '#/components/parameters/term' - description: 'For example , Dave is looking for packaging_shapes that contain - the term "fe", - - all packaging_shapes containing "fe" will be returned. - - This is useful if you have a search in your application, - - for a specific product field. - - ' - /cgi/nutrients.pl: - get: - summary: Get a nested list of nutrients that can be displayed in the nutrition - facts table for a specific country and language - tags: - - Read Requests - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/get_nutrients' - operationId: getNutrients - parameters: - - $ref: '#/components/parameters/cc' - - $ref: '#/components/parameters/lc' - description: 'Used to display the nutrition facts table of a product, or to - display a form to input those nutrition facts. - - ' - /api/v2/attribute_groups: - get: - summary: Get the list of attributes available for personal search. - description: 'Attributes are at the heart of personal search. - - They score the products according to different criterias, - - which could then be matched to a user''s preferences. - - - This API helps you list attributes and display them in your application, - - for the user to choose the importance of each criteria. - - - note: /api/v2/attribute_groups_{lc} is also a valid route, but consider it - deprecated - - ' - tags: - - Read Requests - - Personal search - operationId: getAttributeGroups - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/get_attribute_groups' - parameters: - - $ref: '#/components/parameters/lc' - /api/v2/preferences: - get: - summary: 'Get the weights corresponding to attributes preferences - - to compute personal product - - ' - tags: - - Read Requests - - Personal search - operationId: getPreferences - parameters: - - $ref: '#/components/parameters/lc' - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/get_preferences' -components: - schemas: - Product-Base: - $ref: '#/components/schemas/product_base' - Product-Misc: - $ref: '#/components/schemas/product_misc' - Product-Tags: - $ref: '#/components/schemas/product_tags' - Product-Nutrition: - $ref: '#/components/schemas/product_nutrition' - Product-Ingredients: - $ref: '#/components/schemas/product_ingredients' - Product-Images: - $ref: '#/components/schemas/product_images' - Product-Eco-Score: - $ref: '#/components/schemas/product_ecoscore' - Product-Metadata: - $ref: '#/components/schemas/product_meta' - Product-Data-Quality: - $ref: '#/components/schemas/product_quality' - Product-Knowledge-Panels: - $ref: '#/components/schemas/product_knowledge_panels' - Product-Attribute-Groups: - $ref: '#/components/schemas/product_attribute_groups' - Product: - $ref: '#/components/schemas/product' - get_product_by_barcode_base: - type: object - x-stoplight: - id: s4gz59htj4gc3 - properties: - code: - type: string - description: "Barcode of the product\n(can be EAN-13 or internal codes for\ - \ some food stores).\nFor products without a barcode, Open Food Facts\ - \ assigns a \nnumber starting with the 200 reserved prefix.\n" - status: - type: integer - status_verbose: - type: string - product_base: - type: object - description: 'Base product data - - ' - properties: - abbreviated_product_name: - type: string - description: Abbreviated name in requested language - code: - type: string - description: 'barcode of the product (can be EAN-13 or internal codes for - some food stores), - - for products without a barcode, - - Open Food Facts assigns a number starting with the 200 reserved prefix - - ' - codes_tags: - type: array - items: - type: string - description: 'A value which is the type of barcode "code-13" or "code-8" - - and - - A series of mask for the barcode - - It helps retrieve barcodes starting by - - ' - example: '["code-13","3017620422xxx","301762042xxxx","30176204xxxxx","3017620xxxxxx","301762xxxxxxx","30176xxxxxxxx","3017xxxxxxxxx","301xxxxxxxxxx","30xxxxxxxxxxx","3xxxxxxxxxxxx"] - - ' - generic_name: - type: string - description: 'Legal name of the product as regulated - - by the European authorities. - - ' - id: - description: 'internal identifier for the product, usually set to the value - of `code`, - - except on the producers platform where it is prefixed by the owner - - ' - type: string - lc: - type: string - description: 'Main language of the product. - - This is a duplicate of `lang` property (for historical reasons). - - ' - lang: - type: string - description: 'Main language of the product. - - - This should be the main language of product packaging (if one is predominant). - - - Main language is also used to decide which ingredients list to parse. - - ' - nova_group: - type: integer - description: 'Nova group as an integer from 1 to 4. See https://world.openfoodfacts.org/nova - - ' - nova_groups: - type: string - obsolete: - type: string - obsolete_since_date: - description: 'A date at which the product was declared obsolete. - - This means it''s not produced any more. - - ' - type: string - product_name: - type: string - description: 'The name of the product - - ' - product_name_en: - type: string - description: 'The name of the product can also - - be in many other languages like - - product_name_fr (for French). - - ' - product_quantity: - type: string - description: 'The size in g or ml for the whole product. - - It''s a normalized version of the quantity field. - - ' - example: '500' - product_quantity_unit: - type: string - description: 'The unit (either g or ml) for the correponding product_quantity. - - ' - example: g - quantity: - type: string - description: 'Quantity and Unit. - - ' - abbreviated_product_name_(?\w\w): - type: string - description: Abbreviated name in language `language_code`. - generic_name_(?\w\w): - type: string - description: 'This can be returned in many other languages - - like generic_name_fr (for French). - - ' - shape: - title: Packaging component shape - x-stoplight: - id: xrj8agza3dwgf - type: object - description: The shape property is canonicalized using the packaging_shapes - taxonomy. - examples: - - id: en:bottle - lc_name: bouteille - properties: - id: - type: string - description: Canonical id of the entry in the taxonomy. If the value cannot - be mapped to a taxonomy entry, the value will be the name of the entry - in its original language prefixed by the language 2 letter code and a - colon. - lc_name: - type: string - description: Name of the entry in the language requested in the tags_lc - field of the request. This field is returned only of tags_lc is specified. - If the translation is not available, or if the entry does not exist in - the taxonomy, the value will be the name of the entry in its original - language prefixed by the language 2 letter code and a colon. - material: - title: Packaging component material - x-stoplight: - id: n6umazgqmwrd5 - type: object - description: The material property is canonicalized using the packaging_materials - taxonomy. - examples: - - id: en:bottle - lc_name: bouteille - properties: - id: - type: string - description: Canonical id of the entry in the taxonomy. If the value cannot - be mapped to a taxonomy entry, the value will be the name of the entry - in its original language prefixed by the language 2 letter code and a - colon. - lc_name: - type: string - description: Name of the entry in the language requested in the tags_lc - field of the request. This field is returned only of tags_lc is specified. - If the translation is not available, or if the entry does not exist in - the taxonomy, the value will be the name of the entry in its original - language prefixed by the language 2 letter code and a colon. - recycling: - title: Packaging component recycling instruction - x-stoplight: - id: 376tk8e2cmyh2 - type: object - description: The recycling property is canonicalized using the packaging_recycling - taxonomy. - examples: - - id: en:bottle - lc_name: bouteille - properties: - id: - type: string - description: Canonical id of the entry in the taxonomy. If the value cannot - be mapped to a taxonomy entry, the value will be the name of the entry - in its original language prefixed by the language 2 letter code and a - colon. - lc_name: - type: string - description: Name of the entry in the language requested in the tags_lc - field of the request. This field is returned only of tags_lc is specified. - If the translation is not available, or if the entry does not exist in - the taxonomy, the value will be the name of the entry in its original - language prefixed by the language 2 letter code and a colon. - packaging_component: - description: "Each packaging component has different properties to specify how\ - \ many there are, its shape, material etc.\n\nThe shape, material and recycling\ - \ properties are mapped to one entry in the packaging_shapes, packaging_materials\ - \ and packaging_recycling taxonomies, and the value of the property is the\ - \ canonical name of the taxonomy entry (e.g. en:bottle).\n\nThey may contain\ - \ values that could not yet get matched to their respective taxonomy, in which\ - \ case they will contain a free text value prefixed with the language code\ - \ of this text value (e.g. \"fr:Bouteille sph\xE9rique\" might have been entered\ - \ by a French user to indicate it is a spherical bottle)." - title: Packaging component (READ) - type: object - examples: - - number_of_units: 6 - shape: - id: en:bottle - lc_name: bouteille - material: - id: en:bottle - lc_name: bouteille - recycling: - id: en:bottle - lc_name: bouteille - quantity_per_unit: 25 cl - quantity_per_unit_value: 25 - quantity_per_unit_unit: cl - weight_specified: 30 - weight_measured: 32 - weight_estimated: 26 - weight: 30 - weight_source_id: specified - properties: - number_of_units: - type: integer - description: umber of units of this packaging component contained in the - product (e.g. 6 for a pack of 6 bottles) - shape: - $ref: '#/components/schemas/shape' - material: - $ref: '#/components/schemas/material' - recycling: - $ref: '#/components/schemas/recycling' - quantity_per_unit: - type: string - description: Quantity (weight or volume) of food product contained in the - packaging component. (e.g. 75cl for a wine bottle) - quantity_per_unit_value: - type: number - description: Value parsed from the quantity field. - quantity_per_unit_unit: - type: string - description: Unit parsed and normalized from the quantity field. - weight_specified: - type: number - description: Weight (as specified by the manufacturer) of one unit of the - empty packaging component (in grams). (e.g. for a 6 pack of 1.5l water - bottles, it might be 30, the weight in grams of 1 empty water bottle without - its cap which is a different packaging component). - weight_measured: - type: number - description: Weight (as measured by one or more users) of one unit of the - empty packaging component (in grams). (e.g. for a 6 pack of 1.5l water - bottles, it might be 30, the weight in grams of 1 empty water bottle without - its cap which is a different packaging component). - weight_estimated: - type: number - description: Weight (as estimated from similar products) of one unit of - the empty packaging component (in grams). (e.g. for a 6 pack of 1.5l water - bottles, it might be 30, the weight in grams of 1 empty water bottle without - its cap which is a different packaging component). - weight: - type: number - description: Weight of one unit of the empty packaging component. - weight_source_id: - type: string - description: Indicates which field was used to populate the "weight" field. - Either "specified", "measured", or "estimated" - packagings: - type: array - x-stoplight: - id: 1cyz4qo9njog7 - title: Packagings (READ) - description: 'The packagings object is an array of individual packaging component - objects. - - - The Packaging data document explains how packaging data is structured in Open - Food Facts: https://openfoodfacts.github.io/openfoodfacts-server/dev/explain-packaging-data/ - - - The shape, material and recycling properties of each packaging component are - linked to entries in the packaging_shapes, packaging_materials and packaging_recycling - taxonomies: - - - https://world.openfoodfacts.org/data/taxonomies/packaging_shapes.json - - https://world.openfoodfacts.org/data/taxonomies/packaging_materials.json - - https://world.openfoodfacts.org/data/taxonomies/packaging_recycling.json - - - If the tags_lc field is set, the properties will include a lc_name field with - the translation in the requested language.' - examples: - - - number_of_units: 6 - shape: - id: en:bottle - lc_name: bouteille - material: - id: en:bottle - lc_name: bouteille - recycling: - id: en:bottle - lc_name: bouteille - quantity_per_unit: 25 cl - quantity_per_unit_value: 25 - quantity_per_unit_unit: cl - weight_specified: 30 - weight_measured: 32 - weight_estimated: 26 - weight: 30 - weight_source_id: specified - items: - $ref: '#/components/schemas/packaging_component' - readOnly: true - packagings_complete: - title: packagings_complete - x-stoplight: - id: hxnnsy954q1ey - type: integer - minimum: 0 - maximum: 1 - description: Indicate if the packagings array contains all the packaging parts - of the product. This field can be set by users when they enter or verify packaging - data. Possible values are 0 or 1. - product_misc: - type: object - description: 'Miscellaneous but important fields of a product - - ' - properties: - additives_n: - type: integer - description: 'Number of food additives. - - ' - checked: - type: string - complete: - type: integer - completeness: - type: number - ecoscore_grade: - type: string - description: 'See also: `ecoscore_tags` - - ' - ecoscore_score: - type: integer - description: 'See also: `ecoscore_tags` - - ' - food_groups: - type: string - food_groups_tags: - type: array - items: - type: string - nutrient_levels: - description: 'Traffic light indicators on main nutrients levels - - ' - type: object - properties: - fat: - type: string - enum: - - low - - moderate - - high - salt: - type: string - enum: - - low - - moderate - - high - saturated-fat: - type: string - enum: - - low - - moderate - - high - sugars: - type: string - enum: - - low - - moderate - - high - packaging_text: - type: string - description: 'Recycling instructions as raw text, e.g. Plastic - - bottle to recycle, Plastic cap to recycle. - - This will get automatically parsed and - - will be used to compute the Eco-Score. - - You can either request it (if it exists) or - - send it in a specific language. - - ' - example: packaging_text_en - packagings: - $ref: '#/components/schemas/packagings' - packagings_complete: - $ref: '#/components/schemas/packagings_complete' - pnns_groups_1: - description: 'Category of food according to [French Nutrition and Health - Program](https://fr.wikipedia.org/wiki/Programme_national_nutrition_sant%C3%A9) - - ' - type: string - pnns_groups_1_tags: - type: array - items: - type: string - pnns_groups_2: - description: 'Sub Category of food according to [French Nutrition and Health - Program](https://fr.wikipedia.org/wiki/Programme_national_nutrition_sant%C3%A9) - - ' - type: string - pnns_groups_2_tags: - type: array - items: - type: string - popularity_key: - description: 'An imprecise measurement of popularity based on Scan statistics. - A higher value means higher popularity. - - ' - type: integer - popularity_tags: - description: 'Indicators for the popularity of a product, like the amount - of scans in a specific year. - - ' - type: array - items: - type: string - scans_n: - type: integer - unique_scans_n: - type: integer - serving_quantity: - type: string - description: 'Normalized version of serving_size. - - Note that this is NOT the number of servings by product. - - (in perl, see `normalize_serving_size`) - - ' - serving_quantity_unit: - type: string - description: 'The unit (either g or ml) for the correponding serving_quantity. - - ' - example: g - serving_size: - type: string - description: 'Serving size text (generally in g or ml). - - We expect a quantity + unit but the user is free to input any string. - - ' - food_groups_(?\w\w): - type: string - description: see `food_groups` - packaging_text_(?\w\w): - type: string - description: 'Packaging text in language designated by `language_code` - - ' - product_tags: - type: object - description: 'Data about a product which is represented as tags - - ' - properties: - brands: - type: string - description: List of brands (not taxonomized) - brands_tags: - type: array - items: - type: string - description: List of brands (tags, not taxonomized) - categories: - type: string - categories_hierarchy: - type: array - items: - type: string - categories_lc: - type: string - description: Categories language code - categories_tags: - type: array - items: - type: string - checkers_tags: - type: array - items: - type: string - description: List of checkers (users who checked the product) tags - cities: - type: string - cities_tags: - type: array - items: - type: object - correctors_tags: - type: array - items: - type: string - countries: - type: string - description: 'List of countries where the product is sold. - - ' - countries_hierarchy: - type: array - items: - type: string - countries_lc: - type: string - description: Countries language code - countries_tags: - type: array - items: - type: string - ecoscore_tags: - description: 'All ecoscore of a product. - - Most of the time it''s only one value, - - but it might eventually be more for products composed of sub-products. - - See also: `ecoscore_score`, `ecoscore_grade`. - - ' - type: array - items: - type: string - emb_codes: - type: string - description: 'Packager code. EMB is the French system of traceability codes - for packager. - - ' - example: EMB 2013330 - emb_codes_orig: - type: string - emb_codes_tags: - type: array - items: - type: object - labels: - type: string - labels_hierarchy: - type: array - items: - type: string - labels_lc: - type: string - labels_tags: - type: array - items: - type: string - entry_dates_tags: - description: 'The data as a series of tag: `yyyy-mm-dd`, `yyyy-mm`, `yyyy` - - ' - type: array - items: - type: string - example: - - '2016-03-11' - - 2016-03 - - '2016' - manufacturing_places: - type: string - description: 'Places where the product was manufactured or transformed. - - ' - manufacturing_places_tags: - type: array - items: - type: object - nova_groups_tags: - type: array - items: - type: string - nutrient_levels_tags: - type: array - items: - type: string - image_size: - type: object - properties: - h: - type: integer - example: 400 - description: 'The height of the reduced/full image in pixels. - - ' - w: - type: integer - example: 255 - description: The width of the reduced/full image in pixels. - image: - type: object - description: 'This object represent an image that was uploaded to a product. - - "imgid" is an integer which is a sequential number unique to each picture. - - ' - properties: - sizes: - type: object - description: "The available image sizes for the product (both reduced and\ - \ full). \nThe reduced images are the ones with numbers as the key( 100,\ - \ 200 etc) \nwhile the full images have `full` as the key.\n" - properties: - full: - description: 'properties of fullsize image - - **TODO** explain how to compute name - - ' - $ref: '#/components/schemas/image_size' - image_size_example: - description: 'properties of thumbnail of size `image_size`. - - **TODO** explain how to compute name - - - For real type: see description of property `full`. - - (Put this way because of a [bug in rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) - - ' - type: string - uploaded_t: - type: string - example: '1457680652' - description: 'The time the image was uploaded (as unix timestamp). - - ' - uploader: - type: string - example: openfoodfacts-contributors - description: 'The contributor that uploaded the image. - - ' - image_role: - type: object - description: 'property of an image (or part thereof) selected for a particular - role and a particular language. - - ' - properties: - angle: - type: integer - example: 0 - description: The angle of the image rotation (if it was rotated). - coordinates_image_size: - type: string - example: full - geometry: - type: string - example: 0x0--1--1 - imgid: - type: string - example: '121' - description: The id of the original/source image that was selected to edit(rotate, - normalize etc) to produce this new image. - rev: - type: string - example: '420' - sizes: - type: object - description: "The available image sizes for the product (both reduced and\ - \ full). \nThe reduced images are the ones with numbers as the key( 100,\ - \ 200 etc)\nwhile the full images have `full` as the key.\n" - properties: - '100': - $ref: '#/components/schemas/image_size' - '200': - $ref: '#/components/schemas/image_size' - '400': - $ref: '#/components/schemas/image_size' - full: - $ref: '#/components/schemas/image_size' - x1: - type: string - example: '-1' - x2: - type: string - example: '-1' - y1: - type: string - example: '-1' - y2: - type: string - example: '-1' - image_urls: - type: object - properties: - language_code_example: - type: string - description: url of the image for language `language_code` - product_images: - type: object - description: 'Information about Images of a product. - - - Images ensure the reliability of Open Food Facts data. - - It provides a primary source and proof of all the structured data. - - You may therefore want to display it along the structured information. - - - See also tutorials about images: - - * [Getting images](https://openfoodfacts.github.io/openfoodfacts-server/api/how-to-download-images/) - - * [Uploading images](https://openfoodfacts.github.io/openfoodfacts-server/api/tutorial-uploading-photo-to-a-product/) - - ' - properties: - images: - description: 'This contains properties for all images contained on the product. - - ' - type: object - properties: - 1: - type: object - description: 'This represents an image uploaded for this product. - - ' - $ref: '#/components/schemas/image' - front: - description: 'This represents an image (or part of it) selected for - a specific role on this product. - - ' - type: object - $ref: '#/components/schemas/image_role' - imgid_example: - description: 'See property `1` to get the real type of those objects - - (Put this way because of a [bug in rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) - - ' - type: string - image_type_example: - description: 'See property `front` to get the real type of those objects - - (Put this way because of a [bug in rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) - - ' - type: string - last_image_dates_tags: - type: array - items: - type: string - last_image_t: - description: timestamp of last image upload (or update?) - type: integer - selected_images: - type: object - description: 'URL for selected (important) images of the product. - - - This is very handy if you display the product to users. - - ' - properties: - front: - type: object - description: URLs of thumbnails image of image of type `image_type` - properties: - display: - description: 'Thumbnail urls of product image (front) adapted to - display on product page - - ' - type: object - $ref: '#/components/schemas/image_urls' - small: - description: 'Thumbnail urls of product image (front) adapted to - display on product list page - - ' - type: object - $ref: '#/components/schemas/image_urls' - thumb: - description: 'Thumbnail urls of product image (front) in smallest - format - - ' - type: object - $ref: '#/components/schemas/image_urls' - image_type_example: - description: 'See property `front` to get the real type of those objects - - (Put this way because of a [bug in rapidoc](https://github.com/rapi-doc/RapiDoc/issues/880)) - - ' - type: string - image_small_url: - type: string - image_thumb_url: - type: string - image_url: - type: string - agribalyse: - type: object - properties: - agribalyse_food_code: - type: string - co2_agriculture: - type: number - co2_consumption: - type: integer - co2_distribution: - type: number - co2_packaging: - type: number - co2_processing: - type: number - co2_total: - type: number - co2_transportation: - type: number - code: - type: string - dqr: - type: string - ef_agriculture: - type: number - ef_consumption: - type: integer - ef_distribution: - type: number - ef_packaging: - type: number - ef_processing: - type: number - ef_total: - type: number - ef_transportation: - type: number - is_beverage: - type: integer - name_en: - type: string - description: 'This can be returned in many other languages - - like name_fr (for french). - - ' - score: - type: integer - version: - type: string - product_ecoscore: - type: object - description: 'Fields related to Eco-Score for a product. - - - See also: `ecoscore_score`, `ecoscore_grade` and `ecoscore_tags`. - - ' - properties: - ecoscore_data: - type: object - description: "An object about a lot of details about data needed for Eco-Score\ - \ computation \nand complementary data of interest.\n" - properties: - adjustments: - type: object - properties: - origins_of_ingredients: - type: object - properties: - aggregated_origins: - type: array - items: - type: object - properties: - origin: - type: string - percent: - type: integer - epi_score: - type: integer - epi_value: - type: integer - origins_from_origins_field: - type: array - items: - type: string - transportation_scores: - type: object - properties: - language_code_example: - type: integer - transportation_values: - type: object - properties: - language_code_example: - type: integer - values: - type: object - properties: - language_code_example: - type: integer - warning: - type: string - packaging: - type: object - properties: - non_recyclable_and_non_biodegradable_materials: - type: integer - packagings: - type: array - items: - type: object - properties: - ecoscore_material_score: - type: integer - ecoscore_shape_ratio: - type: integer - material: - type: string - shape: - type: string - score: - type: integer - value: - type: integer - warning: - type: string - production_system: - type: object - properties: - labels: - type: array - example: vegan, fat free, Kosher - items: - type: string - value: - type: integer - warning: - type: string - threatened_species: - type: object - properties: - ingredient: - type: string - value: - type: integer - agribalyse: - $ref: '#/components/schemas/agribalyse' - grade: - type: string - grades: - type: object - properties: - language_code_example: - type: string - missing: - type: object - properties: - labels: - type: integer - origins: - type: integer - packagings: - type: integer - missing_data_warning: - type: integer - previous_data: - type: object - properties: - grade: - type: string - score: - type: integer - agribalyse: - $ref: '#/components/schemas/agribalyse' - score: - type: integer - scores: - type: object - properties: - language_code_example: - type: integer - status: - type: string - ecoscore_extended_data_version: - type: string - environment_impact_level: - type: string - environment_impact_level_tags: - type: array - items: - type: object - ingredient: - type: array - description: 'This structure gives the different ingredients and some information - about them, - - like estimate on their quantity. - - ' - items: - type: object - properties: - id: - type: string - percent: - type: integer - percent_estimate: - type: - - number - percent_max: - type: - - number - percent_min: - type: integer - text: - type: string - vegan: - type: string - vegetarian: - type: string - product_ingredients: - type: object - description: Fields about ingredients of a product - properties: - additives_tags: - type: array - items: - type: string - allergens: - type: string - description: comma separated list of allergens - allergens_lc: - type: string - description: language in which `allergens` where input - allergens_hierarchy: - type: array - items: - type: string - allergens_tags: - type: array - items: - type: string - ingredients: - $ref: '#/components/schemas/ingredient' - ingredients_analysis: - type: object - properties: - en:palm-oil: - type: array - items: - type: string - en:vegan-status-unknown: - type: array - items: - type: string - en:vegetarian-status-unknown: - type: array - items: - type: string - ingredients_analysis_tags: - type: array - items: - type: string - ingredients_from_or_that_may_be_from_palm_oil_n: - type: integer - ingredients_from_palm_oil_n: - type: integer - ingredients_from_palm_oil_tags: - type: array - items: - type: object - ingredients_hierarchy: - type: array - items: - type: string - ingredients_n: - type: integer - ingredients_n_tags: - type: array - items: - type: string - ingredients_original_tags: - type: array - items: - type: string - ingredients_percent_analysis: - type: integer - ingredients_sweeteners_n: - type: integer - description: 'Number of sweeteners additives in the ingredients. Undefined - if ingredients are not specified. - - ' - ingredients_non_nutritive_sweeteners_n: - type: integer - description: 'Number of non-nutritive sweeteners additives (as specified - in the Nutri-Score formula) in the ingredients. Undefined if ingredients - are not specified. - - ' - ingredients_tags: - type: array - items: - type: string - ingredients_lc: - type: string - description: "Language that was used to parse the ingredient list. If `ingredients_text`\ - \ is available\nfor the product main language (`lang`), `ingredients_lc=lang`,\ - \ otherwise we look at\n`ingredients_text` fields for other languages\ - \ and set `ingredients_lc` to the first\nnon-empty `ingredient_text`.\ - \ \n" - ingredients_text: - type: string - description: 'Raw list of ingredients. This will get automatically - - parsed and get used to compute the Eco-Score or find allergens, etc.. - - - It''s a copy of ingredients_text in the main language of the product (see - `lang` proprety). - - ' - example: "Farine de bl\xE9* 67,4%, sucre de canne*, huile de tournesol ol\xE9\ - ique*, graines de chia* 5,2%, son de bl\xE9*, oranges d\xE9shydrat\xE9\ - es * 0,9%, farine de riz*, poudres \xE0 lever (acide citrique, carbonates\ - \ de sodium), ar\xF4me naturel d'orange.\n" - ingredients_text_with_allergens: - type: string - description: 'Same text as `ingredients_text` but where allergens have HTML - elements around them to identify them - - ' - example: "Farine de bl\xE9* 67,4%, sucre\ - \ de canne*, huile de tournesol ol\xE9ique*, graines de chia* 5,2%, son de bl\xE9*, oranges d\xE9shydrat\xE9es\ - \ * 0,9%, farine de riz*, poudres \xE0 lever (acide citrique, carbonates\ - \ de sodium), ar\xF4me naturel d'orange.\n" - ingredients_that_may_be_from_palm_oil_n: - type: integer - ingredients_that_may_be_from_palm_oil_tags: - type: array - items: - type: object - ingredients_with_specified_percent_n: - type: integer - ingredients_with_specified_percent_sum: - type: integer - ingredients_with_unspecified_percent_n: - type: integer - ingredients_with_unspecified_percent_sum: - type: integer - known_ingredients_n: - type: integer - origins: - type: string - description: 'Origins of ingredients - - ' - origins_hierarchy: - type: array - items: - type: object - origins_lc: - type: string - origins_tags: - type: array - items: - type: object - traces: - type: string - description: 'List of substances that might cause allergies - - that are present in trace amounts in the product - - (this does not include the ingredients, as they - - are not only present in trace amounts). - - It is taxonomized with the allergens taxonomy. - - ' - traces_hierarchy: - type: array - items: - type: object - traces_lc: - type: string - traces_tags: - type: array - items: - type: object - unknown_ingredients_n: - type: integer - ingredients_text_(?\w\w): - type: string - description: 'Raw list of ingredients in language given by ''language_code''. - - - See `ingredients_text` - - ' - ingredients_text_with_allergens_(?\w\w): - description: 'Like `ingredients_text_with_allergens` for a particular language - - ' - type: string - product_nutrition: - type: object - description: 'Nutrition fields of a product - - - Most of these properties are read-only. - - - See [how to add nutrition data](https://openfoodfacts.github.io/openfoodfacts-server/api/ref-cheatsheet/#add-nutrition-facts-values-units-and-base) - - ' - properties: - no_nutrition_data: - type: string - description: 'When a product does not have nutrition data displayed on the - - packaging, the user can check the field "Nutrition facts are - - not specified on the product". - - By doing so, the no_nutrition_data field takes the value "on". - - This case is frequent (thousands of products). - - ' - example: 'on' - nutrition_data_per: - type: string - enum: - - serving - - 100g - description: 'The nutrition data on the package can be per serving or per - 100g. - - - This is essential to understand if `_value` and `` - - values in `nutriments` applies for a serving or for 100g. - - - **IMPORTANT:** - - When writing products, - - this setting applies to all existing nutrients values for the product, - - not only the nutrient values sent in the write request. - - So it should not be changed unless all nutrients values are provided - - with values that match the nutrition_data_per field. - - ' - nutrition_data_prepared_per: - type: string - enum: - - serving - - 100g - description: 'The nutrition data for prepared product on the package (if - any) can be per serving or per 100g. - - - This is essential to understand if `_prepared_value` and `_prepared` - - values in `nutriments` applies for a serving or for 100g. - - - See also important note on `nutrition_data_per`. - - ' - nutriments: - type: object - description: 'All known nutrients for the product. - - - Note that each nutrients are declined with a variety of suffixes like - `_100g`, `_serving`, - - see patternProperties below. - - - A specific `_unit` is the unit used to measure the nutrient. - - - Beware that some properties are to be interpreted based upon `nutrition_data_per` - value. - - - Also for products that have a nutrition table for prepared product - - (eg. the nutrition facts for a bowl of milk with cocoa powder), - - a `_prepared` suffix is added (before other suffixes). - - - You can get all possible nutrients from the - - [nutrients taxonomy](https://static.openfoodfacts.org/data/taxonomies/nutrients.json) - - - **FIXME** add more nutrients with description. - - ' - properties: - alcohol: - description: 'Quantity of alcohol - - - (per 100g or per serving) in a standard unit (g or ml) - - ' - type: number - carbohydrates: - type: number - energy: - type: number - description: 'It is the same as `energy-kj` if we have it, or computed - from `energy-kcal` otherwise - - - (per 100g or per serving) in kj - - ' - energy_value: - type: number - description: 'energy_value will be equal to energy-kj_value if we have - it or to energy-kcal_value otherwise - - ' - energy_unit: - type: string - enum: - - kcal - - kj - description: 'Equal to energy-kj_unit if we have it or to energy-kcal_unit - otherwise - - ' - energy-kcal: - type: number - description: 'energy in kcal, if it is specified - - - (per 100g or per serving) in a standard unit (g or ml) - - ' - energy-kj: - type: number - description: 'energy in kj, if it is specified - - - (per 100g or per serving) in a standard unit (g or ml) - - ' - fat: - type: number - fruits-vegetables-legumes-estimate-from-ingredients: - type: number - description: 'An estimate, from the ingredients list of the percentage - of fruits, vegetable and legumes. - - This is an important information for Nutri-Score (2023 version) computation. - - ' - fruits-vegetables-nuts-estimate-from-ingredients: - type: number - description: 'An estimate, from the ingredients list of the percentage - of fruits, vegetable and nuts. - - This is an important information for Nutri-Score (2021 version) computation. - - ' - nova-group: - type: integer - nutrition-score-fr: - description: 'Experimental nutrition score derived from - - the UK FSA score and adapted for the French market - - (formula defined by the team of Professor Hercberg). - - ' - proteins: - type: number - salt: - type: number - saturated-fat: - type: number - sodium: - type: number - sugars: - type: number - carbon-footprint-from-known-ingredients_product: - type: integer - carbon-footprint-from-known-ingredients_serving: - type: number - erythritol: - type: number - description: 'erythritol is a polyol which is not providing any energy. - - As such, it needs not be taken into account when computing - - the energy of a product. Eryhtritol is now displayed on - - nutrition facts sheet of some products, mainly in the USA. - - This value is entered either by contributors, either by - - imports. - - ' - example: 12.5 - nutrient_example: - description: 'The standardized value for a serving or 100g (or 100ml - for liquids), - - depending on `nutrition_data_prepared_per` - - for the nutrient for **prepared** product. - - ' - type: number - readOnly: true - nutriscore_data: - description: "Detail of data the Nutri-Score was computed upon.\n\n**Note**:\_\ - this might not be stable, don't rely too much on this, or, at least, tell\ - \ us !\n\n**TODO** document each property\n" - type: object - properties: - energy: - type: integer - energy_points: - type: integer - energy_value: - type: integer - fiber: - type: integer - fiber_points: - type: integer - fiber_value: - type: integer - fruits_vegetables_nuts_colza_walnut_olive_oils: - type: integer - fruits_vegetables_nuts_colza_walnut_olive_oils_points: - type: integer - fruits_vegetables_nuts_colza_walnut_olive_oils_value: - type: integer - grade: - type: string - is_beverage: - type: integer - is_cheese: - type: integer - is_fat: - type: integer - is_water: - type: integer - negative_points: - type: integer - positive_points: - type: integer - proteins: - type: number - proteins_points: - type: integer - proteins_value: - type: number - saturated_fat: - type: number - saturated_fat_points: - type: integer - saturated_fat_ratio: - type: number - saturated_fat_ratio_points: - type: integer - saturated_fat_ratio_value: - type: number - saturated_fat_value: - type: number - score: - type: integer - sodium: - type: number - sodium_points: - type: integer - sodium_value: - type: number - sugars: - type: number - sugars_points: - type: integer - sugars_value: - type: number - nutriscore_grade: - description: 'Nutri-Score for the product as a letter. - - - See https://world.openfoodfacts.org/nutriscore. - - ' - type: string - enum: - - a - - b - - c - - d - - e - nutriscore_score: - description: 'Nutri-Score for the product as an integer (see also `nutriscore_grade`). - - ' - type: integer - nutriscore_score_opposite: - type: integer - nutrition_grade_fr: - type: string - description: "Nutrition grade (\u2018a\u2019 to \u2018e\u2019),\nhttps://world.openfoodfacts.org/nutriscore.\n" - nutrition_grades: - description: 'Nutrition grades as a comma separated list. - - - Some products with multiple components might have multiple Nutri-Score - - ' - type: string - nutrition_grades_tags: - type: array - items: - type: string - nutrition_score_beverage: - type: integer - nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients: - type: integer - nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients_value: - type: integer - nutrition_score_warning_no_fiber: - type: integer - other_nutritional_substances_tags: - type: array - items: - type: object - unknown_nutrients_tags: - type: array - items: - type: object - vitamins_tags: - type: array - items: - type: object - product_quality: - type: object - description: 'This is data that is linked to products data quality - - ' - properties: - data_quality_bugs_tags: - type: array - items: - type: object - data_quality_errors_tags: - type: array - items: - type: object - data_quality_info_tags: - type: array - items: - type: string - data_quality_tags: - type: array - items: - type: string - data_quality_warnings_tags: - type: array - items: - type: string - data_sources: - type: string - description: 'Source of data imported from producers. - - ' - data_sources_tags: - type: array - items: - type: string - last_check_dates_tags: - type: array - items: - type: string - last_checked_t: - type: integer - last_checker: - type: string - states: - description: 'comma separated list of values indicating some states of the - product, - - like things to be done, or to be completed. - - See [states taxonomy](https://static.openfoodfacts.net/data/taxonomies/states.json) - - ' - type: string - states_hierarchy: - type: array - items: - type: string - states_tags: - type: array - items: - description: 'Each state describe something that is completed or is to - be done or improved on the product. - - - Refer to [states taxonomy](https://static.openfoodfacts.net/data/taxonomies/states.json) - - ' - type: string - misc_tags: - description: 'Information about different aspect of the product - - ' - type: array - items: - type: string - product_extended: - type: object - properties: - additives_original_tags: - type: array - items: - type: string - additives_prev_original_tags: - type: array - items: - type: string - added_countries_tags: - type: array - items: - type: object - allergens_from_ingredients: - type: string - allergens_from_user: - type: string - amino_acids_prev_tags: - type: array - items: - type: object - amino_acids_tags: - type: array - items: - type: object - carbon_footprint_percent_of_known_ingredients: - type: integer - categories_properties: - type: object - properties: - agribalyse_food_code:en: - type: string - agribalyse_proxy_food_code:en: - type: string - ciqual_food_code:en: - type: string - categories_properties_tags: - type: array - items: - type: string - category_properties: - type: object - additionalProperties: - description: those are properties taken from the category taxonomy - type: string - ciqual_food_name_tags: - type: array - items: - type: string - compared_to_category: - type: string - description: 'the category to use for comparison. - - - **TODO** explain how it is chosen. - - ' - conservation_conditions: - type: string - customer_service: - type: string - description: 'Contact info of customer service. - - ' - expiration_date: - type: string - link: - type: string - description: 'link to the product on the website of the producer - - ' - main_countries_tags: - type: array - items: - type: object - minerals_prev_tags: - type: array - items: - type: object - minerals_tags: - type: array - items: - type: object - owner_fields: - type: object - description: 'Those are fields provided by the producer (through producers - platform), - - and the value he provided. - - ' - properties: - additionalProperties: - description: 'you can retrieve all kind of properties, the same as on - the parent object (the product). - - It''s not processed entries (like tags for example) but raw ones. - - ' - oneOf: - - type: integer - - type: string - - type: object - nova_groups_markers: - type: object - description: 'Detail of ingredients or processing that makes the products - having Nova 3 or 4 - - ' - properties: - '3': - description: 'Markers of level 3 - - ' - type: array - items: - type: array - description: 'This array has two element for each marker. - - One - - ' - items: - type: string - '4': - description: 'Markers of level 4 - - ' - type: array - nucleotides_tags: - type: array - items: - type: object - origin: - type: string - purchase_places: - type: string - description: 'Country, state, or city where the product can be purchased. - - ' - example: Paris - purchase_places_tags: - type: array - items: - type: string - stores: - type: string - description: 'Distributor name. - - ' - example: Walmart - stores_tags: - type: array - items: - type: string - traces_from_ingredients: - type: string - traces_from_user: - type: string - conservation_conditions_(?\w\w): - type: string - customer_service_(?\w\w): - type: string - origin_(?\w\w): - type: string - description: '`origin` in language indicated by `language_code` - - ' - product_meta: - type: object - description: 'Metadata of a product (author, editors, creation date, etc.) - - ' - properties: - created_t: - type: integer - description: 'Date when the product was added (UNIX timestamp format). - - See also `entry_dates_tags` - - ' - example: '1457680652 - - ' - creator: - type: string - description: 'The contributor who added the product first. - - ' - editors_tags: - description: 'List of editors who edited the product. - - ' - type: array - items: - type: string - informers_tags: - type: array - items: - type: string - interface_version_created: - type: string - interface_version_modified: - type: string - languages: - type: object - properties: - en:(?\w\w): - type: integer - description: '**TODO** explain ! - - ' - languages_codes: - type: object - description: 'Same as `languages` but by language code, instead of language - tags - - ' - properties: - language_code_example: - type: integer - languages_hierarchy: - type: array - items: - type: string - languages_tags: - type: array - items: - type: string - last_edit_dates_tags: - type: array - items: - type: string - last_editor: - type: string - last_modified_by: - type: string - description: 'The username of the user who last modified the product. - - ' - example: sebleouf - last_modified_t: - type: integer - description: 'Date when the product page was last modified. - - ' - owner: - description: 'Id of the producer in case he provides his own data about - a product (producer platform). - - ' - type: string - owners_tags: - description: 'Tagyfied version of owner - - ' - type: string - photographers_tags: - type: array - items: - type: string - rev: - description: revision number of this product version (each edit adds a revision) - type: integer - sources: - type: array - items: - type: object - properties: - fields: - type: array - items: - type: string - id: - type: string - images: - type: array - items: - type: object - import_t: - type: integer - manufacturer: - type: - - integer - - string - name: - type: string - source_licence: - type: string - source_licence_url: - type: string - url: - type: - - 'null' - - string - sources_fields: - type: object - properties: - org-gs1: - type: object - properties: - gln: - type: string - gpcCategoryCode: - type: string - gpcCategoryName: - type: string - isAllergenRelevantDataProvided: - type: string - lastChangeDateTime: - type: string - partyName: - type: string - productionVariantDescription: - type: string - publicationDateTime: - type: string - teams: - type: string - teams_tags: - type: array - items: - type: string - update_key: - type: string - title_element: - title: title_element - x-stoplight: - id: lox0wvl9bdgy2 - type: object - description: The title of a panel. - properties: - name: - type: string - description: A short name of this panel, not including any actual values - title: - type: string - type: - type: string - enum: - - grade - - percentage - description: Used to indicate how the value of this item is measured, such - as "grade" for Nutri-Score and Eco-Score or "percentage" for Salt - grade: - type: string - description: The value for this panel where it corresponds to a A to E grade - such as the Nutri-Score of the Eco-Score. - enum: - - a - - b - - c - - d - - e - - unknown - value: - type: number - description: The numeric value of the panel, where the type is "percentage" - icon_url: - type: string - icon_color_from_evaluation: - type: string - icon_size: - type: string - description: 'If set to "small", the icon should be displayed at a small - size. - - ' - text_element: - title: text_element - x-stoplight: - id: vdwxlt73qnqfa - type: object - description: 'A text in simple HTML format to display. - - - For some specific texts that correspond to a product field (e.g. a product - name, the ingredients list of a product),the edit_field_* fields are used - to indicate how to edit the field value.' - properties: - type: - type: string - description: 'the type of text, might influence the way you display it. - - ' - enum: - - summary - - warning - - notes - html: - type: string - description: Text to display in HTML format. - language: - type: string - description: Language of the text. The name of the language is returned - in the language requested when making the API call. e.g. if the text is - in Polish, and the requested language is French, the language field will - contain "Polonais" (French for "Polish"). Only set for specific fields - such as the list of ingredients of a product. - lc: - type: string - description: 2 letter language code for the text. Only set for specific - fields such as the list of ingredients of a product. - edit_field_id: - type: string - description: id of the field used to edit this text in the product edit - API. - edit_field_type: - type: string - description: Type of the product field. - edit_field_value: - type: string - description: Current value of the product field. This may differ from the - html field which can contain extra formating. - source_url: - type: string - description: Link to the source - example: https://en.wikipedia.org/wiki/Sodium acetate - source_text: - type: string - description: name of the source - example: Wikipedia - source_lc: - type: string - description: Source locale name - example: en - source_language: - type: string - description: Human readable source locale name - example: English - image_element: - title: image_element - x-stoplight: - id: k4v4kwt489q3j - type: object - properties: - url: - type: string - description: full URL of the image - width: - type: integer - description: "Width of the image.\n\nThis is just a suggestion coming from\ - \ the server, \nthe client may choose to use its own dimensions for the\ - \ image.\n" - height: - type: integer - description: 'Height of the image. - - - This is just a suggestion coming from the server, - - the client may choose to use its own dimensions for the image. - - ' - alt_text: - type: string - description: Alt Text of the image. - panel_element: - title: panel_element - x-stoplight: - id: ymx41elz4yrnj - type: object - description: Panels can include other panels as sub-panels using the panel_element. - properties: - panel_id: - type: string - description: The id of the panel to include. The id is the key of the panel - in the panels object returned in the knowledge_panels field. - panel_group_element: - title: panel_group_element - x-stoplight: - id: b7emlfrgiuue2 - type: object - properties: - title: - type: string - panel_ids: - type: array - description: The ids of the panels to include. The ids are the keys of the - panels in the panels object returned in the knowledge_panels field. - items: - type: string - description: The panel group element is used to display an optional title followed - by a number of sub-panels. - table_element: - title: table_element - x-stoplight: - id: 38zu3z4sruqo7 - type: object - description: Element to display a table. - properties: - id: - type: string - description: An id for the table. - title: - type: string - description: 'Title of the column. - - ' - rows: - type: string - columns: - type: array - items: - type: object - properties: - type: - type: string - text: - type: string - text_for_small_screens: - type: string - style: - type: string - column_group_id: - type: string - shown_by_default: - type: boolean - element: - title: element - x-stoplight: - id: e2ybdrtmx0tme - type: object - description: 'Each element object contains one specific element object such - as a text element or an image element. - - ' - properties: - type: - element_type: string - enum: - - text - - image - - action - - panel - - panel_group - - table - description: 'The type of the included element object. - - The type also indicates which field contains the included element object. - - e.g. if the type is "text", the included element object will be in the - "text_element" field. - - - Note that in the future, new type of element may be added, - - so your code should ignore unrecognized types, and unknown properties. - - - TODO: add Map type - - ' - text_element: - $ref: '#/components/schemas/text_element' - image_element: - $ref: '#/components/schemas/image_element' - action_element: - type: string - panel_element: - $ref: '#/components/schemas/panel_element' - panel_group_element: - $ref: '#/components/schemas/panel_group_element' - table_element: - $ref: '#/components/schemas/table_element' - required: - - type - panel: - title: panel - x-stoplight: - id: mj9nhz3mqn05c - type: object - description: Each panel contains an optional title and an optional array of - elements. - properties: - type: - type: string - description: Type of the panel. If set to "card", the panel and its sub-panels - should be displayed in a card. If set to "inline", the panel should have - its content always displayed. - expanded: - type: boolean - description: If true, the panel is to be displayed already expanded. If - false, only the title should be displayed, and the user should be able - to click or tap it to open the panel and display the elements. - expand_for: - type: string - description: If set to "large", the content of the panel should be expanded - on large screens, but it should still be possible to unexpand it. - evaluation: - type: string - description: A simple assessment of the panel value, typically used to format - fonts, et.c e.g. bad = red - enum: - - good - - average - - neutral - - bad - - unknown - title_element: - $ref: '#/components/schemas/title_element' - elements: - type: array - description: An ordered list of elements to display in the content of the - panel. - items: - $ref: '#/components/schemas/element' - level: - type: string - description: 'a message level, as levels we use in log. - - It might help theming the panel visualy - - ' - example: info - size: - type: string - enum: - - small - description: "size is either empty (normal display) \nor small to indicate\ - \ a panel that should have a smaller font size\n" - example: small - topics: - type: array - items: - type: string - example: health - panels: - type: object - x-stoplight: - id: bcq3fkbtnwr5t - title: panels - description: 'The panels object is a dictionary of individual panel objects. - - Each key of the dictionary is the id of the panel, and the value is the panel - object. - - - Apps typically display a number of root panels with known panel ids (e.g. - health_card and environment_card). Panels can reference other panels and display - them as sub-panels.' - examples: - - additionalProperties: string - properties: - additionalProperties: - $ref: '#/components/schemas/panel' - readOnly: true - product_knowledge_panels: - type: object - description: 'Knowledge panels for a product - - ' - properties: - knowledge_panels: - $ref: '#/components/schemas/panels' - product_attribute_groups: - type: object - description: 'Specific data about a product to enable personal ranking - - ' - properties: - attribute_groups: - type: array - description: Each element is an attribute that can help compute a personal - ranking for the product - items: - type: object - properties: - id: - type: string - description: 'Unique id of the attribute. - - - It will be use to match against preferences parameters. - - ' - status: - type: string - enum: - - known - - unknown - description: wether we have the information to really compute this - criteria or not. - title: - type: string - description: 'A descriptive sentence about the situation of the product - concerning attribute - - ' - example: 'Does not contain: Molluscs' - match: - type: number - format: float - minimum: 0 - maximum: 100 - description: 'a numeric value for the match, - - telling how much the products ranks well for this particular attribute. - - The higher the value, the better the match. - - ' - grade: - description: every attribute as a grade for a to e - type: string - enum: - - unknown - - a - - b - - c - - d - - e - name: - type: string - description: The name of attribute, for eventual display - icon_url: - type: string - description: an icon representing the attribute match (often using - a color) - description: - type: string - description: An eventual description of the value of the property - upon which this attribute is based - description_short: - type: string - description: An eventual short description of the value of the property - upon which this attribute is based - product: - type: object - description: 'This is all the fields describing a product and how to display - it on a page. - - - Refer to the different sub schema for more readable entries: - - - * [Product Base](#cmp--schemas-product-base): Base fields of a product - - * [Product Misc](#cmp--schemas-product-misc): Miscellaneous but important - fields of a product - - * [Product Tags](#cmp--schemas-product-tags): Tags fields on a product - - * [Product Nutrition](#cmp--schemas-product-nutrition): Nutrition fields of - a product - - * [Product Ingredients](#cmp--schemas-product-ingredients): Fields about ingredients - of a product - - * [Product Images](#cmp--schemas-product-images): Information about Images - of a product - - * [Product Eco-Score](#cmp--schemas-product-images): Fields related to Eco-Score - for a product - - * [Product Metadata](#cmp--schemas-product-ecoscore): Metadata of a product - (author, editors, etc.) - - * [Product Data Quality](#cmp--schemas-product-quality): fields related to - data quality for a product - - * [Product Knowledge Panels](#cmp--schemas-product-knowledge-panels): Knowledge - panels for a product - - * [Product Attribute Groups](#cmp--schemas-product-attribute-groups): Attribute - groups for personal product matching - - ' - allOf: - - $ref: '#/components/schemas/product_base' - - $ref: '#/components/schemas/product_misc' - - $ref: '#/components/schemas/product_tags' - - $ref: '#/components/schemas/product_images' - - $ref: '#/components/schemas/product_ecoscore' - - $ref: '#/components/schemas/product_ingredients' - - $ref: '#/components/schemas/product_nutrition' - - $ref: '#/components/schemas/product_quality' - - $ref: '#/components/schemas/product_extended' - - $ref: '#/components/schemas/product_meta' - - $ref: '#/components/schemas/product_knowledge_panels' - - $ref: '#/components/schemas/product_attribute_groups' - get_product_by_barcode: - x-stoplight: - id: cfk5obotr63sa - type: object - allOf: - - $ref: '#/components/schemas/get_product_by_barcode_base' - - type: object - properties: - product: - type: object - allOf: - - $ref: '#/components/schemas/product' - ocr_on_product: - type: object - properties: - status: - type: integer - example: 1 - crop_a_photo: - type: object - description: 'Select a photo and optionally crop/rotate it. - - The origin of the cropping coordinates is the top-left corner. - - Note that rotation is applied *before* cropping, so the cropping bounding - box - - is relative to the rotated image. - - ' - required: - - id - - code - - imgid - properties: - code: - type: string - description: Barcode of the product. - example: 04963406 - imgid: - type: integer - description: identifier of the image to select, it should be a number - example: 2 - id: - type: string - description: 'identifier of the selected image field, should be in the format - - `{IMAGE_TYPE}_{LANG}` format, where `IMAGE_TYPE` is one of - - `front|ingredients|nutrition|packaging|other` and `LANG` is the 2 letter - - language code. - - Note that if you select an image for the main language of the product - (ex: - - `ingredients_it` if `it` is the main language), this image will be - - displayed on Product Opener for all languages (ex: on - - `https://fr.openfoodfacts.org`, unless `ingredients_fr` exists). - - ' - example: front_en - x1: - type: integer - example: 0 - description: X origin coordinate of the crop, it must be lower than x2 - y1: - type: integer - example: 0 - description: Y origin coordinate of the crop, it must be lower than y2 - x2: - type: integer - example: 145 - description: X end coordinate of the crop, it must be higher than x1 - y2: - type: integer - example: 145 - description: Y end coordinate of the crop, it must be higher than y1 - angle: - type: integer - example: 0 - description: 'angle of the rotation to apply on the selected image. - - passing `90` as value rotate the image 90 degrees counter-clockwise. - - ' - normalize: - type: string - example: 'false' - description: whether the selected image should be normalized using ImageMagick - enum: - - 'true' - - 'false' - white_magic: - type: string - default: 'false' - description: 'whether the source image should be white magiced (background - removal) using - - ImageMagick. - - ' - enum: - - 'true' - - 'false' - rotate_a_photo: - type: object - properties: - status: - type: string - example: status ok - imagefield: - type: string - example: nutrition_fr - image: - type: object - properties: - display_url: - type: string - example: nutrition_fr.67.400.jpg - unselect_a_photo: - type: object - properties: - code: - type: string - description: code of the product - example: '4251105501381' - id: - type: string - description: image field (image id) of the photo to unselect - example: front_fr - combined_add_or_edit_a_product_and_change_ref_properties: - type: object - description: 'Combines properties of add_or_edit_a_product and change_ref_properties' - properties: - code: - type: string - description: The barcode of the product to be added or edited - example: '0074570036004' - user_id: - type: string - description: A valid username. - example: myusername - password: - type: string - description: A valid corresponding password. - example: mypassword - comment: - type: string - description: "A comment for the change. It will be shown in product changes history." - example: new packaging from super-app - brands: - type: array - items: - type: string - style: form - explode: false - description: The brands of the product (comma separated list of values). - example: "Häagen-Dazs,General-mills" - labels: - type: array - items: - type: string - style: form - explode: false - description: The labels of the product (comma separated list of values). - example: Kosher, Ferrero - categories: - type: array - items: - type: string - style: form - explode: false - description: The categories of the product (comma separated list of values). - example: Desserts, Frozen foods - packaging: - type: string - description: 'Packaging type, format, material. The [v3 API documentation](https://openfoodfacts.github.io/openfoodfacts-server/api/ref-v3/#operation/post-api-v3-product-barcode) has a more structured data for `packaging`.' - example: Frozen - app_name: - type: string - description: 'Name of the app providing the information' - app_version: - type: string - description: 'Version of the app providing the information' - app_uuid: - type: string - description: 'When an app uses a single user to log its contributions, it might be interesting to know which user of the app is providing the information. You can use this field to provide an identifier (e.g., a SHA1 of the username) that is privacy preserving. Make sure that your salt is strong, perfectly random, and secret. In case we have trouble with one of your users, it helps our moderators revert edits.' - user_agent: - type: string - description: 'It is required that you pass a specific User-Agent header when you do an API request. In some cases, where modification is not possible (e.g., JavaScript in a browser), you can use this parameter.' - required: - - code - - user_id - - password - - imagefield - add_or_edit_a_product: - type: object - description: 'You can provide most of the properties defined in the product - schema. - - ' - properties: - code: - type: string - description: The barcode of the product to be added or edited - example: '0074570036004' - user_id: - type: string - description: A valid username. - example: myusername - password: - type: string - description: A valid corresponding password. - example: mypassword - comment: - type: string - description: "A\_comment for the change. It will be shown in product changes\ - \ history." - example: new packaging from super-app - brands: - schema: - type: array - items: - type: string - style: form - explode: false - description: The brands of the product (comma separated list of values). - example: "H\xE4agen-Dazs,General-mills" - labels: - schema: - type: array - items: - type: string - style: form - explode: false - description: The labels of the product (comma separated list of values). - example: Kosher,Ferroro - categories: - schema: - type: array - items: - type: string - style: form - explode: false - description: The categories of the product (comma separated list of values). - example: Desserts,Frozen foods - packaging: - type: string - description: 'Packaging type, format, material. - - The [v3 API documentation](https://openfoodfacts.github.io/openfoodfacts-server/api/ref-v3/#operation/post-api-v3-product-barcode) - - has a more structured data for `packaging`. - - ' - example: Frozen - required: - - code - - user_id - - password - change_ref_properties: - type: object - description: 'Properties that goes in change ref - - ' - properties: - comment: - type: string - description: 'A comment on the contribution. - - Adding meaningful comments help moderators and users understand a single - product history. - - ' - app_name: - type: string - description: 'Name of the app providing the information - - ' - app_version: - type: string - description: 'Version of the app providing the information - - ' - app_uuid: - type: string - description: 'When an app uses a single user to log its contributions, - - it might be interesting to know which user of the app is providing the - information. - - You can use this field to provide an identifier (eg: an sha1 of the username) - that''s privacy preserving. Make sure that your salt is strong, perfectly - random and secret - - - In case we have trouble with one of your user, it helps our moderators - revert edits. - - ' - User-Agent: - type: string - description: 'It is required that you pass a specific User-Agent header - when you do an API request. - - But some times it''s not possible to modify such a header - - (eg. request using JavaScript in a browser). - - In such cases, you can override it with this parameter. - - ' - search_for_products: - type: object - properties: - count: - type: integer - description: 'Total number of products found - - ' - example: 2701 - page: - type: integer - description: 'Page number of returned results. - - - You can get a different page, by using the `page` query parameter. - - ' - example: 1 - page_count: - type: integer - description: 'Number of products in this page. - - - This will differ from page_size only on the last page. - - ' - example: 24 - page_size: - type: integer - description: 'Requested number of products per pages - - - To get the number of pages, divide count by page_size - - (eg. `Math.floor( count / page_size) + 1 `) - - ' - example: 24 - products: - type: array - description: 'The products matching the query corresponding to current page - - ' - items: - $ref: '#/components/schemas/product' - skip: - type: integer - example: 0 - nutrient_unit: - description: "The unit in which the nutrient for 100g or per serving is measured.\n\ - \nThe possible values depends on the nutrient.\n\n* `g` for grams\n* `mg`\ - \ for milligrams\n* `\u03BCg` for micrograms\n* `cl` for centiliters\n* `ml`\ - \ for mililiters\n* `dv` for recommended daily intakes (aka [Dietary Reference\ - \ Intake](https://en.wikipedia.org/wiki/Dietary_Reference_Intake))\n* `% vol`\ - \ for percentage per volume (e.g. alcohol vol per 100 ml)\n* `%` for percentage\n\ - \n\U0001F913 code: see the [Units module][units-module],\nand [Food:default_unit_for_nid\ - \ function][default-unit]\n\n[units-module]: https://openfoodfacts.github.io/openfoodfacts-server/dev/ref-perl-pod/ProductOpener/Units.html\n\ - [default-unit]: https://openfoodfacts.github.io/openfoodfacts-server/dev/ref-perl-pod/ProductOpener/Food.html#default_unit_for_nid_(_%24nid)\n" - type: string - enum: - - g - - mg - - "\u03BCg" - - cl - - ml - - dv - - '% vol' - - '%' - nutrients: - type: array - description: 'Nutrients and sub-nutrients of a product, with their name and - default unit. - - ' - items: - type: object - properties: - id: - type: string - description: id of the nutrient - name: - type: string - description: Name of the nutrient in the requested language - important: - type: boolean - description: Indicates if the nutrient is always shown on the nutrition - facts table - display_in_edit_form: - type: boolean - description: Indicates if the nutrient should be shown in the nutrition - facts edit form - unit: - description: Default unit of the nutrient - $ref: '#/components/schemas/nutrient_unit' - nutrients: - description: 'Sub-nutrients (e.g. saturated-fat is a sub-nutrient of fat). - - ' - get_nutrients: - $ref: '#/components/schemas/nutrients' - get_attribute_groups: - type: array - description: 'List of groups of attributes for personal search in a specific - language. - - ' - items: - type: object - properties: - id: - type: string - description: unique id of the group - name: - type: string - description: Name of the group - attributes: - type: array - description: 'Attributes that are part of this group - - ' - items: - type: object - properties: - id: - type: string - description: unique id of the attribute - name: - type: string - description: Name of the attribute - icon_url: - type: string - description: url of icon to display next to the settings for this - attribute - setting_name: - type: string - description: a description of the attribute to display to users - setting_note: - type: string - description: a complementary note on the attribute - default: - type: string - enum: - - mandatory - - very_important - - important - - not_important - description: Indicates the default setting for this attribute - panel_id: - type: string - description: Linked knowledge panel (optional) - get_preferences: - type: array - description: 'Rules to apply to compute personal ranking of a product, - - based upon the setting value of each attribute. - - ' - items: - type: object - properties: - id: - type: string - description: id for the setting value - enum: - - not_important - - important - - very_important - - mandatory - name: - type: string - description: name for the setting value, translated according to `lc` - parameter - factor: - type: integer - description: 'factor to apply to the property of the product corresponding - to attributes - - having this setting value - - ' - minimum_match: - type: integer - description: 'FIXME - - ' - parameters: - id: - schema: - type: string - example: ingredients_en - in: query - name: id - required: true - cc: - schema: - type: string - example: us - in: query - name: cc - required: false - description: 2 letter code of the country of the user. Used for localizing some - fields in returned values (e.g. knowledge panels). If not passed, the country - may be inferred by the IP address of the request. - lc: - schema: - type: string - example: fr - in: query - name: lc - required: false - description: '2 letter code of the language of the user. - - Used for localizing some fields in returned values (e.g. knowledge panels). - - If not passed, the language may be inferred by the Accept-Language header - of the request, - - or from the domain name prefix. - - ' - code: - schema: - type: string - example: '4251105501381' - in: query - name: code - description: Barcode of the product - required: true - process_image: - schema: - type: string - example: '1' - in: query - name: process_image - required: true - ocr_engine: - schema: - type: string - example: google_cloud_vision - in: query - name: ocr_engine - required: true - imgid: - schema: - type: string - example: '1' - in: query - name: imgid - required: true - angle: - schema: - type: string - example: '90' - in: query - name: angle - required: true - page: - schema: - type: integer - example: 24 - in: query - name: page - description: 'The page number you request to view (eg. in search results spanning - multiple pages) - - ' - page_size: - schema: - type: integer - example: 24 - in: query - name: page_size - description: 'The number of elements should be sent per page - - ' - sort_by: - schema: - type: string - example: product_name - enum: - - product_name - - last_modified_t - - scans_n - - unique_scans_n - - created_t - - completeness - - popularity_key - - nutriscore_score - - nova_score - - nothing - - ecoscore_score - in: query - name: sort_by - description: "The allowed values used to sort/order the search results.\n\n\ - * `product_name` sorts on name\n* `ecoscore_score`, `nova_score`, `nutriscore_score`\ - \ rank on the [Eco-Score](https://world.openfoodfacts.org/eco-score-the-environmental-impact-of-food-products),\ - \ [Nova](https://world.openfoodfacts.org/nova), or [Nutri-Score](https://world.openfoodfacts.org/nutriscore)\n\ - * `scans_n`, `unique_scans_n` and `popularity_key` are about product popularity:\_\ - number of scans on unique scans, rank of product\n* `created_t`, `last_modified_t`,\ - \ are about creation and modification dates\n* `nothing`, tells not to sort\ - \ at all (because if you do not provide the sort_by argument we default to\ - \ sorting on popularity (for food) or last modification date)\n" - fields: - schema: - type: string - example: code,product_name - in: query - name: fields - description: 'The fields to be returned from the product object can also be - limited. - - If not specified, it returns the entire product object response. - - ' - knowledge_panels_included: - schema: - type: string - example: heatlh_card, environment_card - in: query - name: knowledge_panels_included - description: 'When knowledge_panels are requested, you can specify which panels - should be in the response. All the others will be excluded. - - ' - knowledge_panels_excluded: - schema: - type: string - example: heatlh_card, environment_card - in: query - name: knowledge_panels_excluded - description: 'When knowledge_panels are requested, you can specify which panels - to exclude from the response. All the others will be included. - - If a panel is both excluded and included (with the knowledge_panels_excluded - parameter), it will be excluded. - - ' - tagtype: - schema: - type: string - example: additives - in: query - name: tagtype - term: - schema: - type: string - example: f - in: query - name: term - tags_parameters_properties_additives_tags: - style: form - explode: false - schema: - type: string - example: e322 - in: query - name: additives_tags - description: 'The additives_tags in english of product(s) you are searching - for. - - The [OFF App](https://world.openfoodfacts.org/additives) has a list of possible - values for `additives`. - - - You can use multiple values by using a comma separated list. - - You can add a "-" before values to avoid matching a tag. - - ' - tags_parameters_properties_allergens_tags: - style: form - explode: false - schema: - type: string - example: m - in: query - name: allergens_tags - description: 'The allergens_tags in english of product(s) you are searching - for. - - The [OFF App](https://world.openfoodfacts.org/allergens) has a list of possible - values for `allergens`. - - - You can use multiple values by using a comma separated list. - - You can add a "-" before values to avoid matching a tag. - - ' - tags_parameters_properties_brands_tags: - style: form - explode: false - schema: - type: string - example: ferrero - in: query - name: brands_tags - description: 'The brands_tags of product(s) you are searching for. - - The [OFF App](https://world.openfoodfacts.org/brands) has a list of possible - values for `brands`. - - - You can use multiple values by using a comma separated list. - - You can add a "-" before values to avoid matching a tag. - - ' - tags_parameters_properties_categories_tags: - style: form - explode: false - schema: - type: string - example: chocolates - in: query - name: categories_tags - description: 'The category of product(s) you are searching for. - - The [OFF App](https://world.openfoodfacts.org/categories) has a list of possible - values for `categories`. - - - You can use multiple values by using a comma separated list. - - You can add a "-" before values to avoid matching a tag. - - ' - tags_parameters_properties_countries_tags: - style: form - explode: false - schema: - type: string - example: united-kingdom - in: query - name: countries_tags_en - description: 'The countries_tags_en of product(s) you are searching for. - - The [OFF App](https://world.openfoodfacts.org/countries) shows a list of possible - values for `countries`. - - - You can use multiple values by using a comma separated list. - - You can add a "-" before values to avoid matching a tag. - - ' - tags_parameters_properties_emb_codes_tags: - style: form - explode: false - schema: - type: string - in: query - name: emb_codes_tags - description: 'The emb_codes_tags of product(s) you are searching for. - - - You can use multiple values by using a comma separated list. - - You can add a "-" before values to avoid matching a tag. - - ' - tags_parameters_properties_labels_tags: - style: form - explode: false - schema: - type: string - example: organic - in: query - name: labels_tags - description: 'The labels_tags in english of product(s) you are searching for. - - The [OFF App](https://world.openfoodfacts.org/labels) has a list of possible - values for `labels`. - - - You can use multiple values by using a comma separated list. - - You can add a "-" before values to avoid matching a tag. - - ' - tags_parameters_properties_manufacturing_places_tags: - style: form - explode: false - schema: - type: string - in: query - name: manufacturing_places_tags - description: 'The manufacturing_places_tags of product(s) you are searching - for. - - The [OFF App](https://world.openfoodfacts.org/manufacturing-places) has a - list of possible values for `manufacturing-places`. - - - You can use multiple values by using a comma separated list. - - You can add a "-" before values to avoid matching a tag. - - ' - tags_parameters_properties_nutrition_grades_tags: - style: form - explode: false - schema: - type: string - example: e - in: query - name: nutrition_grades_tags - description: 'The nutrition_grades_tags of product(s) you are searching for. - - The [OFF App](https://world.openfoodfacts.org/nutrition-grades) has a list - of possible values for `nutrition-grades`. - - - You can use multiple values by using a comma separated list. - - You can add a "-" before values to avoid matching a tag. - - ' - tags_parameters_properties_origins_tags: - style: form - explode: false - schema: - type: string - in: query - name: origins_tags - description: 'The origins_tags of product(s) you are searching for. - - - You can use multiple values by using a comma separated list. - - You can add a "-" before values to avoid matching a tag. - - ' - tags_parameters_properties_packaging_tags: - style: form - explode: false - schema: - type: string - example: 1-jar-aus-klarglas - in: query - name: packaging_tags_de - description: 'The packaging_tag in german of product(s) you are searching for. - - The [OFF App](https://world.openfoodfacts.org/packaging) has a list of possible - values for `packaging`. - - - You can use multiple values by using a comma separated list. - - You can add a "-" before values to avoid matching a tag. - - ' - tags_parameters_properties_purchase_places_tags: - style: form - explode: false - schema: - type: string - in: query - name: purchase_places_tags - description: 'The purchase_places_tags of product(s) you are searching for. - - - You can use multiple values by using a comma separated list. - - You can add a "-" before values to avoid matching a tag. - - ' - tags_parameters_properties_states_tags: - style: form - explode: false - schema: - type: string - example: nutrition-facts-completed - in: query - name: states_tags - description: 'The states_tags in english of product(s) you are searching for. - - The [OFF App](https://world.openfoodfacts.org/states) has a list of possible - values for `states`. - - - You can use multiple values by using a comma separated list. - - You can add a "-" before values to avoid matching a tag. - - ' - tags_parameters_properties_stores_tags: - style: form - explode: false - schema: - type: string - example: aldi - in: query - name: stores_tags - description: 'The stores_tags of product(s) you are searching for. - - - You can use multiple values by using a comma separated list. - - You can add a "-" before values to avoid matching a tag. - - ' - tags_parameters_properties_traces_tags: - style: form - explode: false - schema: - type: string - in: query - name: traces_tags - description: 'The traces_tags of product(s) you are searching for. - - The [OFF App](https://world.openfoodfacts.org/traces) shows a list of possible - values for `traces`. - - - You can use multiple values by using a comma separated list. - - You can add a "-" before values to avoid matching a tag. - - ' - tags_parameters_properties_tag_name_with_language_code: - in: query - name: _tags_ - description: 'You can add a language code to a specific tag to query it in a - specific language - - ' - style: form - explode: false - schema: - type: object - examples: - - packaging_tags_de: null - summary: packaging in german - value: - packaging_tags_de: de:Flasche - - origins_tags_fr: null - summary: origins in french - value: - origins_tags_fr: fr:France - - categories_tags_en: null - summary: categories in english - value: - categories_tags_en: en:Beer - properties: - tag_name_example: - type: string - description: 'Will search in the tags corresponding to `tag_name`, - - in the language corresponding to `language_code. - - - `tag_name` is one of the field above which have the `_tags`` suffix: - - categories, nutrition_grades, etc. - - - `language_code` is a two letter iso language `language_code. - - - You can use multiple values by using a comma separated list. - - You can add a "-" before values to avoid matching a tag. - - ' - nutrition_search_properties_nutrient_lower_than: - in: query - name: _lt_ - description: 'Search on nutrient lower than a value - - ' - schema: - type: object - examples: - - salt_100g_lt_2: null - summary: salt per 100g is lower than 2g (in product as sold) - value: - salt_100g<2: 1 - properties: - nutrient_example: - type: string - description: 'Will search for products with nutrients lower than `value` - - per `portion` (100g or serving). - - - If `prepared` is "prepared" search in prepared product instead of "as - sold". - - - Important: the parameter value is discarded and should be empty - - ' - nutrition_search_properties_nutrient_greater_than: - in: query - name: _gt_ - description: 'Search on nutrient greater than a value - - ' - schema: - type: object - examples: - - carbohydrates_prepared_serving_gt_10: null - summary: carbohydrates per serving is greater than 10g in prepared product - value: - salt_100g>10: 1 - properties: - nutrient_example: - type: string - description: 'Will search for products with nutrients more than `value` - - per `portion` (100g or serving). - - - If `prepared` is "prepared" search in prepared product instead of "as - sold". - - - Important: the parameter value is discarded and should be empty - - ' - nutrition_search_properties_nutrient_equal: - in: query - name: _eq_ - description: 'Search on nutrient for an exact quantity - - ' - schema: - type: object - examples: - - fat_100g_eq_5: null - summary: fat per 100g is exactly equal to 5g (in product as sold) - value: - fat_100g: 5 - properties: - nutrient_example: - type: string - description: 'Will search for products with nutrients exactl the parameter - value - - per `portion` (100g or serving). - - - If `prepared` is "prepared" search in prepared product instead of "as - sold". - - ' -tags: -- name: Read Requests -- name: Write Requests diff --git a/Tools/clear_and_process.sh b/Tools/clear_and_process.sh deleted file mode 100644 index 1463fda..0000000 --- a/Tools/clear_and_process.sh +++ /dev/null @@ -1,4 +0,0 @@ -#rm -rf ref -#cp -r ~/Projects/FoodIntake/FoodDatabases/OFF/openfoodfacts-server/docs/api/ref . -cp ./ref/api.yml Sources/openapi.yaml -python process_yamls.py Sources/openapi.yaml diff --git a/Tools/generate.sh b/Tools/generate.sh deleted file mode 100644 index e1698c9..0000000 --- a/Tools/generate.sh +++ /dev/null @@ -1,5 +0,0 @@ -swift run swift-openapi-generator generate \ - --mode types --mode client \ - --output-directory ../OpenFoodFactsService/Sources/ \ - --config ../OpenFoodFactsService/Sources/openapi-generator-config.yaml \ - ../OpenFoodFactsService/Sources/openapi.yaml diff --git a/Tools/process_yamls.py b/Tools/process_yamls.py deleted file mode 100644 index a279b51..0000000 --- a/Tools/process_yamls.py +++ /dev/null @@ -1,216 +0,0 @@ -import os -import yaml -import re - -def load_yaml(file_path): - if os.path.isdir(file_path): - print(f"Error: {file_path} is a directory, not a file.") - return None - print(f"Loading YAML file: {file_path}") - with open(file_path, 'r') as file: - return yaml.safe_load(file) - -def replace_references_bottom_up(openapi_data, current_file_path, components): - base_path = os.path.dirname(current_file_path) - # Find all references and replace them in a bottom-up manner - references_to_replace = [] - if isinstance(openapi_data, dict): - for key, value in openapi_data.items(): - if key == '$ref' and isinstance(value, str): - if not value.endswith('example'): - references_to_replace.append((key, value)) - elif key == 'examples' and isinstance(value, dict): - # Handle example references separately to directly insert them as YAML code - for example_key, example_value in value.items(): - if isinstance(example_value, dict) and '$ref' in example_value: - ref_file_path, ref_anchor = parse_reference(example_value['$ref'], base_path) - if os.path.exists(ref_file_path) and not os.path.isdir(ref_file_path): - referenced_data = load_yaml(ref_file_path) - if referenced_data is not None: - if ref_anchor: - referenced_data = traverse_to_anchor(referenced_data, ref_anchor) - value[example_key] = referenced_data - elif key == 'type' and value == 'int': - # Replace 'type: int' with 'type: integer' - openapi_data[key] = 'integer' - else: - replace_references_bottom_up(value, current_file_path, components) - elif isinstance(openapi_data, list): - for item in openapi_data: - replace_references_bottom_up(item, current_file_path, components) - - # Replace references after traversing deeply - for key, value in references_to_replace: - ref_file_path, ref_anchor = parse_reference(value, base_path) - print(f"Resolving reference for key: {key}, from file: {ref_file_path}, anchor: {ref_anchor}") - if os.path.exists(ref_file_path) and not os.path.isdir(ref_file_path): - referenced_data = load_yaml(ref_file_path) - if referenced_data is None: - continue - # Traverse to the desired anchor (property) if present - if ref_anchor: - referenced_data = traverse_to_anchor(referenced_data, ref_anchor) - replace_references_bottom_up(referenced_data, ref_file_path, components) - - # Add the referenced data into appropriate components section - component_name = generate_component_name(ref_file_path, ref_anchor) - if is_parameter_reference(ref_anchor, ref_file_path): - components.setdefault('parameters', {})[component_name] = referenced_data - openapi_data[key] = f"#/components/parameters/{component_name}" - else: - components.setdefault('schemas', {})[component_name] = referenced_data - openapi_data[key] = f"#/components/schemas/{component_name}" - else: - print(f"Reference file not found or is a directory: {ref_file_path}") - -def parse_reference(ref_value, base_path): - # Split the reference into the file path and anchor (if any) - ref_parts = ref_value.split('#') - ref_file_path = os.path.join(base_path, ref_parts[0]) - ref_file_path = os.path.normpath(ref_file_path) - ref_anchor = ref_parts[1] if len(ref_parts) > 1 else None - return ref_file_path, ref_anchor - -def traverse_to_anchor(data, anchor): - # Traverse the data structure to find the anchor location - parts = anchor.strip('/').split('/') - for part in parts: - if isinstance(data, dict) and part in data: - data = data[part] - else: - print(f"Anchor part '{part}' not found in data.") - return None - return data - -def generate_component_name(ref_file_path, ref_anchor): - # Generate a unique component name based on the file path and anchor - component_name = os.path.basename(ref_file_path).replace('.yaml', '') - if ref_anchor: - anchor_parts = ref_anchor.strip('/').split('/') - component_name += '_' + '_'.join(anchor_parts) - return component_name - -def is_parameter_reference(ref_anchor, ref_file_path): - # Determine if the reference should be placed under parameters or schemas - if ref_anchor and ('parameters' in ref_anchor or 'properties' in ref_anchor): - return True - if 'parameters' in ref_file_path: - return True - return False - -def dereference_yaml(input_file): - yaml_data = load_yaml(input_file) - if yaml_data is None: - print(f"Error: Failed to load YAML file: {input_file}") - return - components = yaml_data.setdefault('components', {}) - while True: - references_before = count_references(yaml_data) - replace_references_bottom_up(yaml_data, input_file, components) - references_after = count_references(yaml_data) - if references_before == references_after: - break - - # Save the fully dereferenced YAML data - with open(input_file, 'w') as file: - print(f"Saving dereferenced file: {input_file}") - yaml.dump(yaml_data, file, sort_keys=False) - -def unwind_pattern_properties(input_file): - yaml_data = load_yaml(input_file) - if yaml_data is None: - print(f"Error: Failed to load YAML file: {input_file}") - return - - def unwind_properties(data): - if isinstance(data, dict): - for key, value in list(data.items()): - if key == 'patternProperties' and isinstance(value, dict): - # Unwind patternProperties into simple properties - for pattern_key, pattern_value in value.items(): - # Handle regex keys like (?[\w-]+)_unit and replace with example key - regex_match = re.match(r'\(\?<(?P\w+)>.*\)', pattern_key) - if regex_match: - pattern_key = regex_match.group('key') + '_example' - print(f"Unwinding patternProperties: {pattern_key}") - data.setdefault('properties', {})[pattern_key] = pattern_value - del data['patternProperties'] - else: - unwind_properties(value) - elif isinstance(data, list): - for item in data: - unwind_properties(item) - - unwind_properties(yaml_data) - - # Save the updated YAML data - with open(input_file, 'w') as file: - print(f"Saving file after unwinding patternProperties: {input_file}") - yaml.dump(yaml_data, file, sort_keys=False) - -def replace_all_of(input_file): - yaml_data = load_yaml(input_file) - if yaml_data is None: - print(f"Error: Failed to load YAML file: {input_file}") - return - - def replace_all_of_recursive(data): - if isinstance(data, dict): - for key, value in list(data.items()): - if key == 'allOf' and isinstance(value, list): - combined_schema = {'type': 'object', 'properties': {}} - for item in value: - if isinstance(item, dict): - for k, v in item.get('properties', {}).items(): - combined_schema['properties'][k] = v - data.pop('allOf') - data.update(combined_schema) - else: - replace_all_of_recursive(value) - elif isinstance(data, list): - for item in data: - replace_all_of_recursive(item) - - replace_all_of_recursive(yaml_data) - - # Save the updated YAML data - with open(input_file, 'w') as file: - print(f"Saving file after replacing allOf: {input_file}") - yaml.dump(yaml_data, file, sort_keys=False) - -def count_references(openapi_data): - if isinstance(openapi_data, dict): - return sum(1 for key, value in openapi_data.items() if key == '$ref') + sum(count_references(value) for value in openapi_data.values()) - elif isinstance(openapi_data, list): - return sum(count_references(item) for item in openapi_data) - return 0 - -if __name__ == "__main__": - import sys - if len(sys.argv) < 2 or len(sys.argv) > 3: - print("Usage: python script.py []\nCommands:\n --dereference: Replace references with components.\n --unwind-pattern-properties: Unwind patternProperties into simple properties.\n --replace-all-of: Replace allOf with combined component.") - sys.exit(1) - - input_file = sys.argv[1] - command = sys.argv[2] if len(sys.argv) == 3 else None - - if command is None: - print(f"Starting to dereference and then unwind patternProperties in YAML file: {input_file}") - dereference_yaml(input_file) - unwind_pattern_properties(input_file) - print(f"All references have been dereferenced and all patternProperties have been unwound in the YAML file: {input_file}") - elif command == '--dereference': - print(f"Starting to dereference YAML file: {input_file}") - dereference_yaml(input_file) - print(f"All references have been dereferenced in the YAML file: {input_file}") - elif command == '--unwind-pattern-properties': - print(f"Starting to unwind patternProperties in YAML file: {input_file}") - unwind_pattern_properties(input_file) - print(f"All patternProperties have been unwound in the YAML file: {input_file}") - elif command == '--replace-all-of': - print(f"Starting to replace allOf in YAML file: {input_file}") - replace_all_of(input_file) - print(f"All allOf have been replaced in the YAML file: {input_file}") - else: - print("Unknown command. Use --dereference, --unwind-pattern-properties, or --replace-all-of.") - sys.exit(1) \ No newline at end of file