|
17 | 17 | and models modules. |
18 | 18 | """ |
19 | 19 |
|
20 | | -from typing import Callable, Optional, Union, Dict, Any |
| 20 | +from typing import Callable, Optional, Union, Dict, List |
21 | 21 |
|
22 | 22 | from typing import TypeVar |
23 | 23 | from requests.exceptions import InvalidURL |
|
28 | 28 | from kiota_abstractions.request_information import RequestInformation |
29 | 29 | from kiota_abstractions.serialization.parsable import Parsable |
30 | 30 |
|
31 | | -from msgraph_core.models import PageResult # pylint: disable=no-name-in-module, import-error |
| 31 | +from msgraph_core.models.page_result import PageResult # pylint: disable=no-name-in-module, import-error |
32 | 32 |
|
33 | 33 | T = TypeVar('T', bound=Parsable) |
34 | 34 |
|
@@ -75,9 +75,9 @@ def __init__( |
75 | 75 | self.object_type = self.current_page.value[ |
76 | 76 | 0].__class__.__name__ if self.current_page.value else None |
77 | 77 | page = self.current_page |
78 | | - self._next_link = response.get('@odata.nextLink', '') if isinstance( |
| 78 | + self._next_link = response.get('odata_next_link', '') if isinstance( |
79 | 79 | response, dict |
80 | | - ) else getattr(response, '@odata.nextLink', '') |
| 80 | + ) else getattr(response, 'odata_next_link', '') |
81 | 81 | self._delta_link = response.get('@odata.deltaLink', '') if isinstance( |
82 | 82 | response, dict |
83 | 83 | ) else getattr(response, '@odata.deltaLink', '') |
@@ -140,11 +140,8 @@ async def next(self) -> Optional[PageResult]: |
140 | 140 | """ |
141 | 141 | if self.current_page is not None and not self.current_page.odata_next_link: |
142 | 142 | return None |
143 | | - response = self.convert_to_page(await self.fetch_next_page()) |
144 | | - page: PageResult = PageResult( |
145 | | - response.odata_next_link, |
146 | | - response.get('value', []) if isinstance(response, dict) else [] |
147 | | - ) |
| 143 | + response = await self.fetch_next_page() |
| 144 | + page: PageResult = PageResult(response.odata_next_link, response.value) |
148 | 145 | return page |
149 | 146 |
|
150 | 147 | @staticmethod |
@@ -180,7 +177,7 @@ def convert_to_page(response: Union[T, list, object]) -> PageResult: |
180 | 177 | page: PageResult = PageResult(next_link, value) |
181 | 178 | return page |
182 | 179 |
|
183 | | - async def fetch_next_page(self) -> dict: |
| 180 | + async def fetch_next_page(self) -> List[Parsable]: |
184 | 181 | """ |
185 | 182 | Fetches the next page of items from the server. |
186 | 183 | Returns: |
|
0 commit comments