Skip to content

Commit 2202c23

Browse files
committed
instantiate data class with data points
1 parent 13e3878 commit 2202c23

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/msgraph_core/tasks/page_iterator.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,10 @@ async def next(self) -> Optional[PageResult]:
141141
if self.current_page is not None and not self.current_page.odata_next_link:
142142
return None
143143
response = self.convert_to_page(await self.fetch_next_page())
144-
page: PageResult = PageResult()
145-
page.odata_next_link = response.odata_next_link
146-
page.value = response.get('value', []) if isinstance(response, dict) else []
144+
page: PageResult = PageResult(
145+
response.odata_next_link,
146+
response.get('value', []) if isinstance(response, dict) else []
147+
)
147148
return page
148149

149150
@staticmethod
@@ -176,9 +177,7 @@ def convert_to_page(response: Union[T, list, object]) -> PageResult:
176177
parsable_page, dict
177178
) else getattr(parsable_page, 'odata_next_link', '')
178179

179-
page: PageResult = PageResult()
180-
page.odata_next_link = next_link
181-
page.value = value
180+
page: PageResult = PageResult(next_link, value)
182181
return page
183182

184183
async def fetch_next_page(self) -> dict:

0 commit comments

Comments
 (0)