packet-python icon indicating copy to clipboard operation
packet-python copied to clipboard

Response metadata and pagination

Open ngrewe opened this issue 9 years ago • 4 comments

Hi guys,

I've seen that the ‘meta’ attribute of the API response has been added in c41315cece4b7134e2e3fc9a40af81a7f536c9d6, and I'm now wondering how to deal with pagination of results from the API. I actually haven't tried it yet, but it seems a bit odd that the metadata will be attached to the manager object when you call any of the list_* methods. I'd rather expect the metadata to be pertinent to the list of objects returned, preferably with some mechanism to simply fetch the next batch of entities when you've reached the end of the list. Do you already have plans on how to handle this?

Thanks,

Niels

ngrewe avatar Jul 01 '16 21:07 ngrewe

@jasmingacic can you review this and see about any action?

jacobsmith928 avatar Aug 26 '19 15:08 jacobsmith928

@jacobsmith928 there has been a discussion about this here and it seems that the plan was to implement this on the API side.

jasmingacic avatar Aug 26 '19 19:08 jasmingacic

Since current implementation of all list_* functions returns a simple collection of objects in question adding metadata object in any way would introduce breaking changes. The best solution to keep the implementation unchanged is to use manager's property meta as shown here

jasmingacic avatar Aug 26 '19 20:08 jasmingacic

I'm fond of the approach taken in another provider's API client. I haven't looked deeply enough to determine if that is viable here without breaking existing packet-python consumers.

displague avatar Jul 10 '20 00:07 displague