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

GBFS/Commons-API: Add filter hook for item processing #1549

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

datengraben
Copy link
Contributor

@datengraben datengraben commented Mar 9, 2024

This has the goal to enable users of the cb plugin, to alter api responses for gbfs and commons-api requests.
The motivation behind it: Item data of an instance can be many different things and endpoint response data has to be very specific. For example can an initiative lend bikes and cars, but the GBFS endpoint only should return data for bike items.

Long term goal: Through the power of filter hooks, each initiative can implement their own filter logic, if they need it. Without touching the core implementation, this shifts work from the core-team to the users.

Scope of a first implentation-step would be filter hooks. Scope of potential second step would be to implement it backed by the Options array, which then can be accessed easily via web interface.

TODO and thoughts on this PR:

  • discuss filter names and filter apis
  • Add filter hooks for all commons-api endpoints
  • Filter for gbfs item processing. But it is buried in endpoint implementation and coupled. In contrast to the gbfs location processing, which is in the base impl.

This enables users to alter api responses for gbfs and commons-api requests.
Copy link

codecov bot commented Mar 9, 2024

Codecov Report

Attention: Patch coverage is 0% with 8 lines in your changes are missing coverage. Please review.

Project coverage is 45.67%. Comparing base (9493bfe) to head (c4793f5).
Report is 1 commits behind head on master.

Files Patch % Lines
src/API/GBFS/BaseRoute.php 0.00% 5 Missing ⚠️
src/API/ItemsRoute.php 0.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1549      +/-   ##
============================================
- Coverage     45.70%   45.67%   -0.03%     
- Complexity     2560     2562       +2     
============================================
  Files            93       93              
  Lines         10095    10101       +6     
============================================
  Hits           4614     4614              
- Misses         5481     5487       +6     

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

@datengraben datengraben self-assigned this Mar 9, 2024
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 this pull request may close these issues.

None yet

1 participant