-
Notifications
You must be signed in to change notification settings - Fork 41
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
Preliminary pagination support API #61
Conversation
c893208
to
7a57741
Compare
docs/index.rst
Outdated
@@ -169,6 +169,27 @@ You can also specify filters | |||
|
|||
tasks = api.tasks.list(project=1) | |||
|
|||
By defaults list returns all objects, eventually getting the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/By defaults/By default,/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, fixed
docs/index.rst
Outdated
|
||
.. code:: python | ||
|
||
tasks_page_1 = api.tasks.list(lazy_pagination) # Will only return page 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add example to get everything
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a plain api.tasks.list()
will still return all the results, like it does now, but using the pagination to get all the results
@erikw thanks for your feedback. Does it look a sane API to you? |
@erikw I added the |
329a2cb
to
8f2bb5b
Compare
@yakky I was thinking it was a bit confusing with the different combinations you can make with Maybe a matrix in the documentation like this one could help?
or possible reduce the number of use cases to support to maybe only have one input variable (with page number var too) |
@yakky Looks good! I was thinking it was a bit confusing though with the different combinations you can make with Maybe a matrix in the documentation like this one could help?
or possible reduce the number of use cases to support to maybe only have one input variable (with page number var too) |
@erikw thanks for your feedback. We can use a 3-state argument (let's call it
|
@yakky I agree, mixing types even for the same variable is not good. As long as it's clear or alternatively documented what will happen for which values of the argument, it's all good :) |
@erikw how about this signature (basically merges
|
8f2bb5b
to
cd70698
Compare
@fmarco could you also give a look at this plz? |
@yakky this last one looks sounder to me! |
Thanks @erikw we will complete this with some tests in the next days and we'll likely release a new version sometimes next week |
docs/index.rst
Outdated
|
||
tasks = api.tasks.list(paginate=False) | ||
|
||
.. warning:: be aware that if the unpaginated results may exceed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove if
?
taiga/models/base.py
Outdated
remote objects are retrieved and appended in a single list. | ||
|
||
If pagination is disabled, all the objects are fetched from the | ||
endpojnt and returned. This may trigger some parsing error if the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
endpoint
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yakky except for @carloratm's comments, lgtm
Thanks y'all. I'll fix those and I'll implement the tests for this. Hopefully we will be able to merge this and release a new version |
@carloratm @fmarco could you have a look at the tests? |
Codecov Report
@@ Coverage Diff @@
## master #61 +/- ##
=========================================
Coverage ? 99.21%
=========================================
Files ? 8
Lines ? 896
Branches ? 0
=========================================
Hits ? 889
Misses ? 7
Partials ? 0
Continue to review full report at Codecov.
|
b656ed1
to
5531d32
Compare
5531d32
to
499534f
Compare
Awesome! When can we expect a new release of python-taiga that includes this? |
@erikw with a bit of luck within the weekend 🤞 |
@yakky or maybe this weekend? :) 🙏 |
@erikw early next week 🙇 (but 0.9rc1 is already on PyPi) |
@erikw 0.9.0 released! |
@yakky Many thanks! I've now updated my project https://github.com/erikw/taiga-stats to use this release :) |
Nice tool! |
Good idea! |
This implements support for pagination
Fix #59
By default
list
method retrieves all the objects navigating the pages returned by the APIall
argument allows to disable pagination and return all the results (implementing current behavior)lazy_pagination
argument allows to load a single page