2023-08-16 16:31:50 -07:00
|
|
|
from typing import Any, Dict, List, Type, TypeVar, Union
|
|
|
|
|
|
|
|
import attr
|
|
|
|
|
2023-08-30 15:59:51 -07:00
|
|
|
from ..models.base64data import Base64Data
|
2023-08-16 16:31:50 -07:00
|
|
|
from ..types import UNSET, Unset
|
|
|
|
|
2023-11-28 14:29:16 -08:00
|
|
|
EN = TypeVar("EN", bound="ExportFile")
|
2023-11-27 16:01:20 -08:00
|
|
|
|
2023-08-16 16:31:50 -07:00
|
|
|
|
|
|
|
@attr.s(auto_attribs=True)
|
|
|
|
class ExportFile:
|
2023-11-27 16:01:20 -08:00
|
|
|
"""A file to be exported to the client.""" # noqa: E501
|
2023-08-16 16:31:50 -07:00
|
|
|
|
2023-11-27 16:01:20 -08:00
|
|
|
contents: Union[Unset, Base64Data] = UNSET
|
|
|
|
name: Union[Unset, str] = UNSET
|
2023-08-16 16:31:50 -07:00
|
|
|
|
2023-11-27 16:01:20 -08:00
|
|
|
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
2023-08-16 16:31:50 -07:00
|
|
|
|
2023-11-27 16:01:20 -08:00
|
|
|
def to_dict(self) -> Dict[str, Any]:
|
|
|
|
contents: Union[Unset, str] = UNSET
|
|
|
|
if not isinstance(self.contents, Unset):
|
|
|
|
contents = self.contents.get_encoded()
|
|
|
|
name = self.name
|
2023-08-16 16:31:50 -07:00
|
|
|
|
2023-11-27 16:01:20 -08:00
|
|
|
field_dict: Dict[str, Any] = {}
|
|
|
|
field_dict.update(self.additional_properties)
|
|
|
|
field_dict.update({})
|
|
|
|
if contents is not UNSET:
|
|
|
|
field_dict["contents"] = contents
|
|
|
|
if name is not UNSET:
|
|
|
|
field_dict["name"] = name
|
2023-08-16 16:31:50 -07:00
|
|
|
|
2023-11-27 16:01:20 -08:00
|
|
|
return field_dict
|
2023-08-16 16:31:50 -07:00
|
|
|
|
2023-11-27 16:01:20 -08:00
|
|
|
@classmethod
|
2023-11-28 14:29:16 -08:00
|
|
|
def from_dict(cls: Type[EN], src_dict: Dict[str, Any]) -> EN:
|
2023-11-27 16:01:20 -08:00
|
|
|
d = src_dict.copy()
|
|
|
|
_contents = d.pop("contents", UNSET)
|
|
|
|
contents: Union[Unset, Base64Data]
|
|
|
|
if isinstance(_contents, Unset):
|
|
|
|
contents = UNSET
|
|
|
|
else:
|
|
|
|
contents = Base64Data(bytes(_contents, "utf-8"))
|
2023-08-16 16:31:50 -07:00
|
|
|
|
2023-11-27 16:01:20 -08:00
|
|
|
name = d.pop("name", UNSET)
|
2023-08-16 16:31:50 -07:00
|
|
|
|
2023-11-27 16:01:20 -08:00
|
|
|
export_file = cls(
|
|
|
|
contents=contents,
|
|
|
|
name=name,
|
|
|
|
)
|
2023-08-16 16:31:50 -07:00
|
|
|
|
2023-11-27 16:01:20 -08:00
|
|
|
export_file.additional_properties = d
|
|
|
|
return export_file
|
2023-08-16 16:31:50 -07:00
|
|
|
|
2023-11-27 16:01:20 -08:00
|
|
|
@property
|
|
|
|
def additional_keys(self) -> List[str]:
|
|
|
|
return list(self.additional_properties.keys())
|
2023-08-16 16:31:50 -07:00
|
|
|
|
2023-11-27 16:01:20 -08:00
|
|
|
def __getitem__(self, key: str) -> Any:
|
|
|
|
return self.additional_properties[key]
|
2023-08-16 16:31:50 -07:00
|
|
|
|
2023-11-27 16:01:20 -08:00
|
|
|
def __setitem__(self, key: str, value: Any) -> None:
|
|
|
|
self.additional_properties[key] = value
|
2023-08-16 16:31:50 -07:00
|
|
|
|
2023-11-27 16:01:20 -08:00
|
|
|
def __delitem__(self, key: str) -> None:
|
|
|
|
del self.additional_properties[key]
|
2023-08-16 16:31:50 -07:00
|
|
|
|
2023-11-27 16:01:20 -08:00
|
|
|
def __contains__(self, key: str) -> bool:
|
|
|
|
return key in self.additional_properties
|