webflow / js-webflow-api

Node.js SDK for the Webflow Data API
https://www.npmjs.com/package/webflow-api
296 stars 95 forks source link

Getall #16

Closed LMDoc closed 4 years ago

LMDoc commented 5 years ago

Added "allItems" method and test, which gets all items in a collection using pagination and returns them all in a single array.

wivern-co-uk commented 5 years ago

Hi @n-johnson and happy 2019! Are you still maintaining this repo and is there a chance PR could be reviewed?

kyleshevlin commented 4 years ago

I can't speak for everyone at Webflow, and I know this issue is almost two years old, but I wanted to give an update about this PR and offer some reasons for not accepting it.

Looking at the code and understanding its intention, I don't believe the project really benefits from adding an additional method to get all the items of the collection and would only increase confusion. Let's address the confusion first.

Adding another method that looks like it should do the same as items would certainly cause confusion. Eventually, someone would have to ask, "How is the items end point different than the allItems endpoint?" Then we'd have to justify why we need to limit the number of items collected and returned and we would wind up very quickly going down a rabbit hole.

I believe the intention of the response object when you fetch items is to inform you, the consumer, how to proceed getting more of your items. Using the offset in the response, you should be able to continue to fetch more items. While it might be somewhat frustrating to implement as a consumer of the API, you've demonstrated that it's relatively easy to implement. I think leaving this flexibility to the consumer makes sense for now.

A better solution in the future, if possible, I'm not personally certain of the history or limitations of our queries, would be to make a breaking change and make it possible to have a bigger, or even infinite, limit on collections. That said, the limit is a good guard for our system, and easy enough to work around.

I want to thank you for making a contribution and sorry that a response was very long in the making. There is currently no dedicated team that owns this particular project at Webflow, so I can understand how this was probably frustrating. Without going into too much detail, we're working hard to make it easier for people to interact with their data in the long run.

I'm going to close this. If a team takes ownership of this project in the future, they may revisit this if they like.

LMDoc commented 4 years ago

@kyleshevlin Thanks for getting back to me on this, I'd actually forgotten about it. Your reasons for not accepting make complete sense, this was more of a "I'm making it for my company so might as well share" kinda thing.