2023-08-17 12:48:13 -07:00
|
|
|
from typing import Any, Dict, List, Type, TypeVar, Union
|
|
|
|
|
|
|
|
import attr
|
|
|
|
|
|
|
|
from ..models.rtc_sdp_type import RtcSdpType
|
|
|
|
from ..types import UNSET, Unset
|
|
|
|
|
2023-10-17 15:35:56 -07:00
|
|
|
KU = TypeVar("KU", bound="RtcSessionDescription")
|
2023-08-17 12:48:13 -07:00
|
|
|
|
|
|
|
@attr.s(auto_attribs=True)
|
|
|
|
class RtcSessionDescription:
|
2023-09-29 16:05:40 -07:00
|
|
|
""" SessionDescription is used to expose local and remote session descriptions. """ # noqa: E501
|
|
|
|
sdp: Union[Unset, str] = UNSET
|
|
|
|
type: Union[Unset, RtcSdpType] = UNSET
|
2023-08-17 12:48:13 -07:00
|
|
|
|
2023-09-29 16:05:40 -07:00
|
|
|
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
2023-08-17 12:48:13 -07:00
|
|
|
|
2023-09-29 16:05:40 -07:00
|
|
|
def to_dict(self) -> Dict[str, Any]:
|
|
|
|
sdp = self.sdp
|
|
|
|
if not isinstance(self.type, Unset):
|
|
|
|
type = self.type
|
2023-08-17 12:48:13 -07:00
|
|
|
|
2023-09-29 16:05:40 -07:00
|
|
|
field_dict: Dict[str, Any] = {}
|
|
|
|
field_dict.update(self.additional_properties)
|
|
|
|
field_dict.update({})
|
|
|
|
if sdp is not UNSET:
|
|
|
|
field_dict['sdp'] = sdp
|
|
|
|
if type is not UNSET:
|
|
|
|
field_dict['type'] = type
|
2023-08-17 12:48:13 -07:00
|
|
|
|
2023-09-29 16:05:40 -07:00
|
|
|
return field_dict
|
2023-08-17 12:48:13 -07:00
|
|
|
|
2023-09-29 16:05:40 -07:00
|
|
|
@classmethod
|
2023-10-17 15:35:56 -07:00
|
|
|
def from_dict(cls: Type[KU], src_dict: Dict[str, Any]) -> KU:
|
2023-09-29 16:05:40 -07:00
|
|
|
d = src_dict.copy()
|
|
|
|
sdp = d.pop("sdp", UNSET)
|
2023-08-17 12:48:13 -07:00
|
|
|
|
2023-09-29 16:05:40 -07:00
|
|
|
_type = d.pop("type", UNSET)
|
|
|
|
type: Union[Unset, RtcSdpType]
|
|
|
|
if isinstance(_type, Unset):
|
|
|
|
type = UNSET
|
|
|
|
else:
|
|
|
|
type = _type # type: ignore[arg-type]
|
2023-08-17 12:48:13 -07:00
|
|
|
|
|
|
|
|
2023-09-29 16:05:40 -07:00
|
|
|
rtc_session_description = cls(
|
|
|
|
sdp= sdp,
|
|
|
|
type= type,
|
|
|
|
)
|
2023-08-17 12:48:13 -07:00
|
|
|
|
2023-09-29 16:05:40 -07:00
|
|
|
rtc_session_description.additional_properties = d
|
|
|
|
return rtc_session_description
|
2023-08-17 12:48:13 -07:00
|
|
|
|
2023-09-29 16:05:40 -07:00
|
|
|
@property
|
|
|
|
def additional_keys(self) -> List[str]:
|
|
|
|
return list(self.additional_properties.keys())
|
2023-08-17 12:48:13 -07:00
|
|
|
|
2023-09-29 16:05:40 -07:00
|
|
|
def __getitem__(self, key: str) -> Any:
|
|
|
|
return self.additional_properties[key]
|
2023-08-17 12:48:13 -07:00
|
|
|
|
2023-09-29 16:05:40 -07:00
|
|
|
def __setitem__(self, key: str, value: Any) -> None:
|
|
|
|
self.additional_properties[key] = value
|
2023-08-17 12:48:13 -07:00
|
|
|
|
2023-09-29 16:05:40 -07:00
|
|
|
def __delitem__(self, key: str) -> None:
|
|
|
|
del self.additional_properties[key]
|
2023-08-17 12:48:13 -07:00
|
|
|
|
2023-09-29 16:05:40 -07:00
|
|
|
def __contains__(self, key: str) -> bool:
|
|
|
|
return key in self.additional_properties
|