switch to pydantic

Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
Jess Frazelle
2023-11-28 23:50:50 -08:00
parent d9d73522fd
commit bc3d698539
230 changed files with 4467 additions and 25280 deletions

View File

@ -1,76 +1,15 @@
from typing import Any, Dict, List, Type, TypeVar, Union
from typing import Optional
import attr
from ..types import UNSET, Unset
DT = TypeVar("DT", bound="RtcIceCandidateInit")
from pydantic import BaseModel
@attr.s(auto_attribs=True)
class RtcIceCandidateInit:
"""ICECandidateInit is used to serialize ice candidates""" # noqa: E501
class RtcIceCandidateInit(BaseModel):
"""ICECandidateInit is used to serialize ice candidates"""
candidate: Union[Unset, str] = UNSET
sdp_m_line_index: Union[Unset, int] = UNSET
sdp_mid: Union[Unset, str] = UNSET
username_fragment: Union[Unset, str] = UNSET
candidate: str
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
sdpMLineIndex: Optional[int] = None
def to_dict(self) -> Dict[str, Any]:
candidate = self.candidate
sdp_m_line_index = self.sdp_m_line_index
sdp_mid = self.sdp_mid
username_fragment = self.username_fragment
sdpMid: Optional[str] = None
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if candidate is not UNSET:
field_dict["candidate"] = candidate
if sdp_m_line_index is not UNSET:
field_dict["sdpMLineIndex"] = sdp_m_line_index
if sdp_mid is not UNSET:
field_dict["sdpMid"] = sdp_mid
if username_fragment is not UNSET:
field_dict["usernameFragment"] = username_fragment
return field_dict
@classmethod
def from_dict(cls: Type[DT], src_dict: Dict[str, Any]) -> DT:
d = src_dict.copy()
candidate = d.pop("candidate", UNSET)
sdp_m_line_index = d.pop("sdpMLineIndex", UNSET)
sdp_mid = d.pop("sdpMid", UNSET)
username_fragment = d.pop("usernameFragment", UNSET)
rtc_ice_candidate_init = cls(
candidate=candidate,
sdp_m_line_index=sdp_m_line_index,
sdp_mid=sdp_mid,
username_fragment=username_fragment,
)
rtc_ice_candidate_init.additional_properties = d
return rtc_ice_candidate_init
@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
usernameFragment: Optional[str] = None