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

Improve filter interface #84

Open
jhnns opened this issue Apr 7, 2022 · 1 comment
Open

Improve filter interface #84

jhnns opened this issue Apr 7, 2022 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@jhnns
Copy link
Member

jhnns commented Apr 7, 2022

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 jhnns added enhancement New feature or request good first issue Good for newcomers labels Apr 7, 2022
@jhnns
Copy link
Member Author

jhnns commented Apr 7, 2022

@tannerbaum what do you think? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant