-
-
Notifications
You must be signed in to change notification settings - Fork 67
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
feat: #349 - added support for Events API #386
feat: #349 - added support for Events API #386
Conversation
New files: * `api_events_test.dart`: Tests around Events API. * `BadgeBase.dart`: Events API: badge. * `BadgeBase.g.dart`: generated * `EventCreate.dart`: Events API: event create. * `EventCreate.g.dart`: generated * `events.dart`: Client calls of the Events API (Open Food Facts). * `EventsBase.dart`: Events API: event. * `EventsBase.g.dart`: generated * `LeaderboardEntry.dart`: Events API: leaderboard entry. * `LeaderboardEntry.g.dart`: generated Impacted files: * `JsonHelper.dart`: added a nullable timestamp conversion method. * `OpenFoodAPIConfiguration.dart`: added host entries for Events API. * `openfoodfacts.dart`: exported new Events related files. * `UriHelper.dart`: added Events related method `getEventsUri`.
Oh great :-) gamification in Smoothie 🎉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks @monsieurtanuki good start that it is in it's own class
Thank you @teolemon @M123-dev for your review! As mentioned earlier, there's one method that I could not test, the only one that writes: "create events", because I get the following error: |
@ocervell ping |
@monsieurtanuki events are currently created by the admin user, set on the API side by the env variables The request flow should be:
The problem with client app authenticating directly to the Events API is that anyone could add as many events as they want by simply using the API, thus falsifying the data (imagine if I just trace the API calls to events API I could add myself 20 "product_add" events and thus increase my score artifically). |
Oh, I really goofed on that one. I'm so sorry. |
Note that only the CreateEvent method is obsolete, the rest is still valid (querying badges for a user, querying leaderboard, querying events ...) so the PR is still mostly valid. |
Thank you @ocervell for your answers. If I understand correctly, that means that we need the off backend to directly call CreateEvent each time an "event" is detected, like "product_add". And there's nothing we have to do on the app side, except read/count the events, right? |
Yes, that's correct, |
Still missing: couldn't test how to create an event. Are we talking about the same users as in the "official OpenFoodFacts" API? (aka "off off"). Good news is that the TEST env works - which is not the case for Folksonomy.
New files:
api_events_test.dart
: Tests around Events API.BadgeBase.dart
: Events API: badge.BadgeBase.g.dart
: generatedEventCreate.dart
: Events API: event create.EventCreate.g.dart
: generatedevents.dart
: Client calls of the Events API (Open Food Facts).EventsBase.dart
: Events API: event.EventsBase.g.dart
: generatedLeaderboardEntry.dart
: Events API: leaderboard entry.LeaderboardEntry.g.dart
: generatedImpacted files:
JsonHelper.dart
: added a nullable timestamp conversion method.OpenFoodAPIConfiguration.dart
: added host entries for Events API.openfoodfacts.dart
: exported new Events related files.UriHelper.dart
: added Events related methodgetEventsUri
.