Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Knowledge panels: add new "action" element #495

Closed
monsieurtanuki opened this issue Jun 26, 2022 · 0 comments · Fixed by #496
Closed

Knowledge panels: add new "action" element #495

monsieurtanuki opened this issue Jun 26, 2022 · 0 comments · Fixed by #496
Assignees

Comments

@monsieurtanuki
Copy link
Contributor

Is your feature request related to a problem? Please describe.
Featured in openfoodfacts/smooth-app#1136 and https://world.openfoodfacts.org/api/v2/product/4006922007543.json?fields=knowledge_panels, we need to decode a new KnowledgePanelElementType like that:

{
	"action_element": {
		"actions": ["add_categories", "add_nutrition_facts"],
		"html": "Could you add the information needed to compute the Nutri-Score?"
	},
	"element_type": "action"
}

Describe the solution you'd like
There's probably a limited list of possible values for "actions", but we'll be safer with static const String values than with enums.

@monsieurtanuki monsieurtanuki self-assigned this Jun 26, 2022
monsieurtanuki added a commit to monsieurtanuki/openfoodfacts-dart that referenced this issue Jun 26, 2022
Impacted files:
* `KnowledgePanelElement.dart`: added `KnowledgePanelActionElement`
* `KnowledgePanelElement.g.dart`: generated
* `main.dart`: unrelated minor fix.
monsieurtanuki added a commit that referenced this issue Jun 29, 2022
Impacted files:
* `KnowledgePanelElement.dart`: added `KnowledgePanelActionElement`
* `KnowledgePanelElement.g.dart`: generated
* `main.dart`: unrelated minor fix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant