Skip to content

Commit 547bffe

Browse files
author
Tom Hendrikx
committed
Improve docstrings on list classes
1 parent 92e68d9 commit 547bffe

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

mollie/api/objects/list.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,13 @@ def new(self, result):
9090

9191

9292
class PaginationList(ListBase):
93+
"""
94+
Pagination lists are used to return a paginated list of Objects.
95+
96+
You can use the `has_next` and `get_next` methods to get the next page of result data from the API.
97+
The `has_previous` and `get_previous` methods return the previous page.
98+
"""
99+
93100
_parent: "ResourceBase"
94101

95102
def __init__(self, result: Any, parent: "ResourceBase", client: "Client"):
@@ -105,15 +112,15 @@ def __init__(self, result: Any, parent: "ResourceBase", client: "Client"):
105112
super().__init__(result, client)
106113

107114
def get_next(self):
108-
"""Return the next set of objects in an ObjectList."""
115+
"""Return the next set of objects in the paginated list."""
109116
url = self._get_link("next")
110117
if url is None:
111118
return None
112119
resp = self._parent.perform_api_call(self._parent.REST_READ, url)
113120
return PaginationList(resp, self._parent, self.client)
114121

115122
def get_previous(self):
116-
"""Return the previous set of objects in an ObjectList."""
123+
"""Return the previous set of objects in the paginated list."""
117124
url = self._get_link("previous")
118125
if url is None:
119126
return None
@@ -129,6 +136,12 @@ def new(self, result):
129136

130137

131138
class ObjectList(ListBase):
139+
"""
140+
Object lists are used to return an embedded list on an object.
141+
142+
It works to similar to PaginationList, but has no pagination (as all data is already embedded).
143+
"""
144+
132145
_object_type: Type[ObjectBase]
133146

134147
def __init__(self, result: Any, object_type: Type[ObjectBase], client: Optional["Client"] = None):

0 commit comments

Comments
 (0)