Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor ObjectList implementation #278

Open
whyscream opened this issue Nov 8, 2022 · 0 comments
Open

Refactor ObjectList implementation #278

whyscream opened this issue Nov 8, 2022 · 0 comments

Comments

@whyscream
Copy link
Contributor

whyscream commented Nov 8, 2022

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:
    # 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant