-
Notifications
You must be signed in to change notification settings - Fork 58
Open
Labels
Description
Problem
The current Objectlist (the object that wraps a collection of API results, f.i. "get payments") is a messy class.
- It supports some methods that make it behave as a list, but also some dictionary-like behaviors.
- Iterating over paginated results is something that a developer must do in code, it is not provided by the client.
- It is initialized using a complex data structure (a full API response) which makes the code handling this data hard to read
Improvements
- Consume only the list data from the API response (Also see the TODO in code: )
mollie-api-python/mollie/api/objects/list.py
Lines 17 to 19 in 5b63136
# TODO: it would be better if the ObjectList was initiated with a list of results, rather than with # the full datastructure as it is now, so we can remove all this mucking around with fake data, # mocked result objects, and loads of lengthy accessor workarounds everywhere in the ObjectList. - Automatic iteration over paginated API results
- Expose only list behavior
In #285 a POC is available. This should be properly integrated and tested.