pulsar-edit / package-backend

Pulsar Server Backend for Packages
https://api.pulsar-edit.dev
MIT License
11 stars 11 forks source link

Service Filter #135

Closed confused-Techie closed 1 year ago

confused-Techie commented 1 year ago

Requirements

Description of the Change

This PR adds the capability to filter packages results by the provided, or consumed service.

Allowing the editor to take advantage of this functionality to help users find packages that meet the consumed services of a package they install, or vice versa.


This PR extends the already existing GET /api/packages API endpoint with new query parameters to include this functionality.

The new query parameters for this endpoint are as follows:


Any and all results of this endpoint will continue to match the existing standards, and the return should not have changed at all from this new feature inclusion.

An example request would look like so:

https://api.pulsar-edit.dev/api/packages?service=autocomplete.watchEditor&serviceType=provided

All other previous query parameter for this endpoint are still supported when filtering, and will still take effect. Meaning you can still take these results and sort them by 'downloads', 'created_at', 'updated_at', 'stars' and then change the direction of their ordering in 'desc', or 'asc'.

The above example on our current database returns the autocomplete-plus package as it's the only provider.

But if we use https://api.pulsar-edit.dev/api/packages?service=autocomplete.watchEditor&serviceType=consumed

We get: