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

feat: 831 - more parameters for the "get prices" API query #886

Merged
merged 1 commit into from
Feb 18, 2024

Conversation

monsieurtanuki
Copy link
Contributor

What

  • More refined parameters for the "get prices" API query.
  • Including the "order by" clause, useful for Smoothie (get the latest prices for that product).

Part of

Files

New files:

  • get_parameters_helper.dart: Helper class for API query parameters.
  • get_prices_order.dart: Order clause for "get prices".
  • get_prices_parameters.dart: Parameters for the "get prices" API query.

Impacted files:

  • api_prices_test.dart: elaborated the test of "get prices"
  • open_prices_api_client.dart: refactored
  • openfoodfacts.dart: 2 new exported files

New files:
* `get_parameters_helper.dart`: Helper class for API query parameters.
* `get_prices_order.dart`: Order clause for "get prices".
* `get_prices_parameters.dart`: Parameters for the "get prices" API query.

Impacted files:
* `api_prices_test.dart`: elaborated the test of "get prices"
* `open_prices_api_client.dart`: refactored
* `openfoodfacts.dart`: 2 new exported files
@codecov-commenter
Copy link

Codecov Report

Attention: 6 lines in your changes are missing coverage. Please review.

Comparison is base (7615fcb) 75.99% compared to head (bcd25c4) 76.33%.

Files Patch % Lines
lib/src/prices/get_parameters_helper.dart 85.18% 4 Missing ⚠️
test/api_prices_test.dart 96.92% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #886      +/-   ##
==========================================
+ Coverage   75.99%   76.33%   +0.33%     
==========================================
  Files         236      239       +3     
  Lines        8391     8494     +103     
==========================================
+ Hits         6377     6484     +107     
+ Misses       2014     2010       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@monsieurtanuki monsieurtanuki merged commit 820d145 into openfoodfacts:master Feb 18, 2024
5 checks passed
@monsieurtanuki
Copy link
Contributor Author

Thank you @teolemon for your review!

I think we're all set now for the MVP regarding prices in Smoothie:

  • create/get/delete session
  • create/get/delete price
  • upload/delete proof

Still not implemented:

  • get users (not really helpful in a first approach)
  • get proof (but it's somehow embedded in get price)
  • get product (but we can do that in "standard" off-dart)
  • get locations (but we can use OSM methods and it's somehow embedded in get price)

@monsieurtanuki
Copy link
Contributor Author

@raphael0202 @raphodn In a first approach I can retrieve my "monoprix daumesnil paris" shop with a nominatim query like https://nominatim.openstreetmap.org/search.php?q=monoprix+daumesnil+paris&format=jsonv2

I can find the same shop with https://prices.openfoodfacts.org/app/add/single

But I cannot get that shop with prices API api/v1/locations (no results).
Am i doing something wrong with api/v1/locations?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

3 participants