Skip to content

Refactor ObjectList implementation #278

@whyscream

Description

@whyscream

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions