googleapis / nodejs-storage

Node.js client for Google Cloud Storage: unified object storage for developers and enterprises, from live data serving to data analytics/ML to data archiving.
https://cloud.google.com/storage/
Apache License 2.0
888 stars 368 forks source link

Missing interface's property #2464

Closed olishevskii closed 1 month ago

olishevskii commented 1 month ago

Why doesn't the second element of the array have the property pageToken? https://github.com/googleapis/nodejs-storage/blob/b4dbd73189b9fae4c23d614753670ee562bc717b/src/bucket.ts#L90

Screenshot 2024-05-12 at 21 11 41

This property will be present if you pass { autoPaginate: false } into Storage.getFiles.

bajajneha27 commented 1 month ago

Hi @olishevskii That's probably because you don't have enough objects for the next page. By default, we return 1000 objects. If you do want to limit the number of objects returned, use maxResults option and then you should be able to see nextPage as well.

let [files, nextPage] = await bucket.getFiles({autoPaginate: false, maxResults: 10});

Hope this helps. I'm closing the issue now. Please feel free to re-open it if there's any other issue.

olishevskii commented 1 month ago

Hi @bajajneha27. Thank you for your answer.

Unfortunately, it's not working because there's a problem with the type.

Screenshot 2024-05-14 at 15 30 10 Screenshot 2024-05-14 at 15 30 30

Moreover, I have around 11,500 files in my bucket.

bajajneha27 commented 1 month ago

I see. Well, I'm getting the nextPage populated. Can you help me with a code snippet so that I can try to reproduce this?

ddelgrosso1 commented 1 month ago

@bajajneha27 no need to reproduce, the currently defined type is just a generic object. The issue is that it should be more clearly typed which is what @olishevskii is working on in the linked PR.