Improve filter interface
Open
Nobody has claimed this yet.
enhancement
good first issue
- Dominant language
- TypeScript
- Stars
- 23
- Forks
- 7
- Avg merge
- 6h 22m
- Merged PRs (30d)
- 8
Description
There are two issues with the current filter interface (that is used by getEntries for instance):
- We need to maintain a separate query param mapping
- The return type of a filtered response is not accurate. If I call
getEntries()with a filter oncustomersId, I'd expect the returnedfilterproperty to only havecustomersId.
I'd like to have an interface like this:
const response = await clockodo.getEntries({
filter: {
customersId: 123
}
});
// response is now a type that looks like this
type Response = {
paging: Paging
filter: {
customersId: number
},
entries: Array<Entry>
}
This allows us to type the filter for each endpoint. This should be doable with generics.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at getEntries and the filter definitions for each endpoint. Trace how filter values become query parameters and how the response type is declared. Done when endpoint filters have separate query mappings and a filtered getEntries response narrows its filter property to the supplied fields.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, backend-api-design
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100