Skip to content

Commit 884fca4

Browse files
committed
convert PageResult to dataclass
1 parent 0b8c58e commit 884fca4

File tree

1 file changed

+5
-43
lines changed

1 file changed

+5
-43
lines changed

src/msgraph_core/models/page_result.py

Lines changed: 5 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
PageResult: Represents a page of items in a paged response.
1111
"""
1212
from typing import Any, List, Optional
13+
from dataclasses import dataclass
1314
from __future__ import annotations
1415

1516
from kiota_abstractions.serialization.parsable import Parsable # type: ignore
@@ -21,53 +22,14 @@
2122
T = TypeVar('T')
2223

2324

25+
@dataclass
2426
class PageResult(Parsable, Generic[T]):
2527
"""
2628
Represents a page of items in a paged response.
2729
"""
28-
object_type = None
29-
30-
def __init__(self, object_type: Optional[Any] = None) -> None:
31-
PageResult.object_type = object_type
32-
self._odata_next_link: Optional[str] = None
33-
self._value: Optional[List[T]] = None
34-
35-
@property
36-
def odata_next_link(self) -> Optional[str]:
37-
"""
38-
Gets the next link for the page.
39-
Returns:
40-
Optional[str]: The next link, or None if there is no next link.
41-
"""
42-
return self._odata_next_link
43-
44-
@odata_next_link.setter
45-
def odata_next_link(self, next_link: Optional[str]) -> None:
46-
"""
47-
Sets the next link for the page.
48-
Args:
49-
next_link (Optional[str]): The next link to set.
50-
"""
51-
self._odata_next_link = next_link
52-
53-
@property
54-
def value(self) -> Optional[List[T]]:
55-
"""
56-
Gets the items in the page.
57-
Returns:
58-
Optional[List[Any]]: The items in the page, or None if there
59-
are no items.
60-
"""
61-
return self._value
62-
63-
@value.setter
64-
def value(self, value: Optional[List[T]]) -> None:
65-
"""
66-
Sets the items in the page.
67-
Args:
68-
value (Optional[List[Any]]): The items to set.
69-
"""
70-
self._value = value
30+
object_type: Optional[Any] = None
31+
odata_next_link: Optional[str] = None
32+
value: Optional[List[T]] = None
7133

7234
@staticmethod
7335
def create_from_discriminator_value(parse_node: ParseNode) -> PageResult: # pylint: disable=unused-argument

0 commit comments

Comments
 (0)