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