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

Automatically do paginated post requests #296

Open
nick-lehmann opened this issue Jan 20, 2022 · 4 comments
Open

Automatically do paginated post requests #296

nick-lehmann opened this issue Jan 20, 2022 · 4 comments
Labels
enhancement New feature or request

Comments

@nick-lehmann
Copy link

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.

@nick-lehmann nick-lehmann added the enhancement New feature or request label Jan 20, 2022
@ramsayleung
Copy link
Owner

Hi Nick, this idea sounds great!

Rspotify just supports automatically fetch the paginated requests, but it doesn't support automatically feed the paginated requests. It will be great if you could help us add this feature.

@marioortizmanero
Copy link
Collaborator

marioortizmanero commented Jan 23, 2022

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.

@nick-lehmann
Copy link
Author

@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...

@github-actions
Copy link

github-actions bot commented Jul 2, 2023

Message to comment on stale issues. If none provided, will not mark issues stale

@github-actions github-actions bot added the Stale label Jul 2, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jul 9, 2023
@ramsayleung ramsayleung removed the Stale label Dec 8, 2023
@ramsayleung ramsayleung reopened this Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants