You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, field-specific queries for resources are implemented in retrieveXByY methods which don't actually use the filter or sort params. This is an issue especially for methods such as retrieveUsersByUsername() as you are not guaranteed to receive the expected results due to the use of manual filtering.
Consider this example: the API returns user objects ordered by their ID, so user 1's username may be "Dev", user 2 is "Joe", etc. But you want to list all users with username "Matt", using retrieveUsersByUsername() will only return users that appear within the first 50 results which does not guarantee that you will get all the Matts, even less so if there are 50+ users in the panel.
This can be fixed by implementing a way to specify query options for requests in the retrieve methods, or changing the retrieveXByY methods to use the filter/sort params. WDYT?
The text was updated successfully, but these errors were encountered:
retrieveUsersByUsername should paginate over all the users, and then filter.
I was working on a PR that properly implements filters and sorts by having FilterablePteroAction and SortablePteroAction where you could chain filters and sorts to your calls, and then the retrieveUsersByUsername would just wrap this stuff for convenience and backwards compatibility.
The manual filtering will still return the same result, it's just considerably slower. If you had 3000 users, and named Matt, you'd have to paginate over all of those vs. just filtering and getting a list of the 3 Matt's in a single API call
I believe I have a local branch where I was hacking on this, but it got super long and enterprise Java feely due to the way I was handling generics for it
Currently, field-specific queries for resources are implemented in
retrieveXByY
methods which don't actually use thefilter
orsort
params. This is an issue especially for methods such asretrieveUsersByUsername()
as you are not guaranteed to receive the expected results due to the use of manual filtering.Consider this example: the API returns user objects ordered by their ID, so user 1's username may be "Dev", user 2 is "Joe", etc. But you want to list all users with username "Matt", using
retrieveUsersByUsername()
will only return users that appear within the first 50 results which does not guarantee that you will get all the Matts, even less so if there are 50+ users in the panel.This can be fixed by implementing a way to specify query options for requests in the retrieve methods, or changing the
retrieveXByY
methods to use thefilter
/sort
params. WDYT?The text was updated successfully, but these errors were encountered: