89 lines
2.5 KiB
Python
89 lines
2.5 KiB
Python
from collections.abc import Mapping
|
|
from typing import Any, TypeVar, Union
|
|
|
|
from attrs import define as _attrs_define
|
|
from attrs import field as _attrs_field
|
|
|
|
from ..types import UNSET, Unset
|
|
|
|
T = TypeVar("T", bound="PagingModel")
|
|
|
|
|
|
@_attrs_define
|
|
class PagingModel:
|
|
"""The Paging holds information about the limit and making requests to the next page.
|
|
|
|
Attributes:
|
|
limit (int): The limit of the messages for the current request. Example: 123.
|
|
since (int): The ID of the last message returned in the current request. Use this as alternative to the next
|
|
link. Example: 5.
|
|
size (int): The amount of messages that got returned in the current request. Example: 5.
|
|
next_ (Union[Unset, str]): The request url for the next page. Empty/Null when no next page is available.
|
|
Example: http://example.com/message?limit=50&since=123456.
|
|
"""
|
|
|
|
limit: int
|
|
since: int
|
|
size: int
|
|
next_: Union[Unset, str] = UNSET
|
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
|
|
def to_dict(self) -> dict[str, Any]:
|
|
limit = self.limit
|
|
|
|
since = self.since
|
|
|
|
size = self.size
|
|
|
|
next_ = self.next_
|
|
|
|
field_dict: dict[str, Any] = {}
|
|
field_dict.update(self.additional_properties)
|
|
field_dict.update(
|
|
{
|
|
"limit": limit,
|
|
"since": since,
|
|
"size": size,
|
|
}
|
|
)
|
|
if next_ is not UNSET:
|
|
field_dict["next"] = next_
|
|
|
|
return field_dict
|
|
|
|
@classmethod
|
|
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
d = dict(src_dict)
|
|
limit = d.pop("limit")
|
|
|
|
since = d.pop("since")
|
|
|
|
size = d.pop("size")
|
|
|
|
next_ = d.pop("next", UNSET)
|
|
|
|
paging_model = cls(
|
|
limit=limit,
|
|
since=since,
|
|
size=size,
|
|
next_=next_,
|
|
)
|
|
|
|
paging_model.additional_properties = d
|
|
return paging_model
|
|
|
|
@property
|
|
def additional_keys(self) -> list[str]:
|
|
return list(self.additional_properties.keys())
|
|
|
|
def __getitem__(self, key: str) -> Any:
|
|
return self.additional_properties[key]
|
|
|
|
def __setitem__(self, key: str, value: Any) -> None:
|
|
self.additional_properties[key] = value
|
|
|
|
def __delitem__(self, key: str) -> None:
|
|
del self.additional_properties[key]
|
|
|
|
def __contains__(self, key: str) -> bool:
|
|
return key in self.additional_properties
|