-
Notifications
You must be signed in to change notification settings - Fork 123
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
Automatically do paginated post requests #296
Comments
Hi Nick, this idea sounds great!
|
I think in this case there's no nerd to have a _manual and an iterator version right? Mainly because it doesn't really work with pages. It could just work transparently for user friendliness, as long as it's clearly commented. |
@ramsayleung thank you very much, I will try to get a PR going this week 👍🏻 @marioortizmanero I guess there is a always a nerd 😝 But no, I don't think we would need both. I don't see why anyone would need the manual version... |
Message to comment on stale issues. If none provided, will not mark issues stale |
Is your feature request related to a problem? Please describe.
After gathering some information from the Spotify API, I tried to add around 300 tracks to a single playlist. I knew that Spotify restricts the number of items that can be passed to an endpoint. For the Add Items to Playlist endpoint, Spotify imposes a limit of a 100 tracks in a single request. The API does not reflect this restriction in any way.
Describe the solution you'd like
While it would be possible to add some type information to functions like playlist_add_items, I would rather prefer that all method do chunking automatically. If the given number of items surpasses the limit of the API, a second request will be sent.
Describe alternatives you've considered
It is quite easy to implement the chunking on my own. However, it is dull and the returned responses with a status code of 400 might surprise some users.
Additional context
I am quite new to Rust and, given you agree to this proposal, I would love to create a PR for this.
The text was updated successfully, but these errors were encountered: