mollie-api-python
mollie-api-python copied to clipboard
Refactor `ObjectList` implementation
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: https://github.com/mollie/mollie-api-python/blob/5b63136b4a7f5543ded9fb4141b7b6feaaada7a1/mollie/api/objects/list.py#L17-L19)
- Automatic iteration over paginated API results
- Expose only list behavior
In #285 a POC is available. This should be properly integrated and tested.