-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlist_sites_response.py
More file actions
74 lines (54 loc) · 2.1 KB
/
list_sites_response.py
File metadata and controls
74 lines (54 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union
from attrs import define as _attrs_define
from ..types import UNSET, Unset
if TYPE_CHECKING:
from ..models.list_site_response_errors import ListSiteResponseErrors
from ..models.site_summary import SiteSummary
T = TypeVar("T", bound="ListSitesResponse")
@_attrs_define
class ListSitesResponse:
"""
Attributes:
sites (List['SiteSummary']): List of Sites
errors (ListSiteResponseErrors): If there is an error accessing a vendor API then error details are provided
next_page_token (Union[Unset, str]): A token to request the next page, if any. If absent, there are no more
pages.
"""
sites: List["SiteSummary"]
errors: "ListSiteResponseErrors"
next_page_token: Union[Unset, str] = UNSET
def to_dict(self) -> Dict[str, Any]:
sites = []
for sites_item_data in self.sites:
sites_item = sites_item_data.to_dict()
sites.append(sites_item)
errors = self.errors.to_dict()
next_page_token = self.next_page_token
field_dict: Dict[str, Any] = {}
field_dict.update(
{
"sites": sites,
"errors": errors,
}
)
if next_page_token is not UNSET:
field_dict["nextPageToken"] = next_page_token
return field_dict
@classmethod
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
from ..models.list_site_response_errors import ListSiteResponseErrors
from ..models.site_summary import SiteSummary
d = src_dict.copy()
sites = []
_sites = d.pop("sites")
for sites_item_data in _sites:
sites_item = SiteSummary.from_dict(sites_item_data)
sites.append(sites_item)
errors = ListSiteResponseErrors.from_dict(d.pop("errors"))
next_page_token = d.pop("nextPageToken", UNSET)
list_sites_response = cls(
sites=sites,
errors=errors,
next_page_token=next_page_token,
)
return list_sites_response