clockodo icon indicating copy to clipboard operation
clockodo copied to clipboard

Improve filter interface

Open jhnns opened this issue 3 years ago • 1 comments

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 on customersId, I'd expect the returned filter property to only have customersId.

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.

jhnns avatar Apr 07 '22 16:04 jhnns

@tannerbaum what do you think? :)

jhnns avatar Apr 07 '22 16:04 jhnns