Open jkuester opened 2 weeks ago
After a bit of assessment, I've decided to break this task down into smaller tasks in the following way.
cht-datasource
. (#9237)iterator
in the cht-datasource
. (#9238)cht-datasource
. (#9239)iterator
in the cht-datasource
. (#9240)api/v1/person
. (#9241)api/v1/place?type=clinic
(#9242)I will be pushing each sub-task changes to this branch 9193-api-endpoints-for-getting-contacts-by-type
.
Is your feature request related to a problem? Please describe. As noted in https://github.com/medic/cht-core/issues/8889, getting the contacts of a specific type is needed for cht-user-managment.
Describe the solution you'd like
Endpoints should also accept the following query parameters to allow for paging through the data:
limit
- default is100
skip
- default0
When it comes to the cht-datasource api, things will be a bit interesting. On one hand, most consumers of the lib will not want to manually deal with paging, but instead we should return something like an
async Iterable
so the paging it completely abstracted away. However, the api code will need to be able to make a targeted request for a specific limit/skip since that is what it will be receiving as a request and for best performance we will need to be able to pass those though directly to the Couch view query... Perhaps we just provide both functions in cht-datasource:limit/skip
and returns an array of values.Describe alternatives you've considered Other ways to structure the API include:
api/v1/clinic
api/v1/place/clinic
However, these do not seem any more clear than just using a query parameter and are definitely less flexible.