|
| 1 | +from collections.abc import Mapping |
| 2 | +from typing import TYPE_CHECKING, Any, TypeVar, Union |
| 3 | + |
| 4 | +from attrs import define as _attrs_define |
| 5 | +from attrs import field as _attrs_field |
| 6 | + |
| 7 | +from ..types import UNSET, Unset |
| 8 | + |
| 9 | +if TYPE_CHECKING: |
| 10 | + from ..models.attachment_info_dto import AttachmentInfoDto |
| 11 | + |
| 12 | + |
| 13 | +T = TypeVar("T", bound="AttachmentInfosDto") |
| 14 | + |
| 15 | + |
| 16 | +@_attrs_define |
| 17 | +class AttachmentInfosDto: |
| 18 | + """Attachment infos result |
| 19 | +
|
| 20 | + Attributes: |
| 21 | + attachment_infos (Union[Unset, list['AttachmentInfoDto']]): |
| 22 | + """ |
| 23 | + |
| 24 | + attachment_infos: Union[Unset, list["AttachmentInfoDto"]] = UNSET |
| 25 | + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) |
| 26 | + |
| 27 | + def to_dict(self) -> dict[str, Any]: |
| 28 | + attachment_infos: Union[Unset, list[dict[str, Any]]] = UNSET |
| 29 | + if not isinstance(self.attachment_infos, Unset): |
| 30 | + attachment_infos = [] |
| 31 | + for attachment_infos_item_data in self.attachment_infos: |
| 32 | + attachment_infos_item = attachment_infos_item_data.to_dict() |
| 33 | + attachment_infos.append(attachment_infos_item) |
| 34 | + |
| 35 | + field_dict: dict[str, Any] = {} |
| 36 | + field_dict.update(self.additional_properties) |
| 37 | + field_dict.update({}) |
| 38 | + if attachment_infos is not UNSET: |
| 39 | + field_dict["attachmentInfos"] = attachment_infos |
| 40 | + |
| 41 | + return field_dict |
| 42 | + |
| 43 | + @classmethod |
| 44 | + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: |
| 45 | + from ..models.attachment_info_dto import AttachmentInfoDto |
| 46 | + |
| 47 | + d = dict(src_dict) |
| 48 | + attachment_infos = [] |
| 49 | + _attachment_infos = d.pop("attachmentInfos", UNSET) |
| 50 | + for attachment_infos_item_data in _attachment_infos or []: |
| 51 | + attachment_infos_item = AttachmentInfoDto.from_dict(attachment_infos_item_data) |
| 52 | + |
| 53 | + attachment_infos.append(attachment_infos_item) |
| 54 | + |
| 55 | + attachment_infos_dto = cls( |
| 56 | + attachment_infos=attachment_infos, |
| 57 | + ) |
| 58 | + |
| 59 | + attachment_infos_dto.additional_properties = d |
| 60 | + return attachment_infos_dto |
| 61 | + |
| 62 | + @property |
| 63 | + def additional_keys(self) -> list[str]: |
| 64 | + return list(self.additional_properties.keys()) |
| 65 | + |
| 66 | + def __getitem__(self, key: str) -> Any: |
| 67 | + return self.additional_properties[key] |
| 68 | + |
| 69 | + def __setitem__(self, key: str, value: Any) -> None: |
| 70 | + self.additional_properties[key] = value |
| 71 | + |
| 72 | + def __delitem__(self, key: str) -> None: |
| 73 | + del self.additional_properties[key] |
| 74 | + |
| 75 | + def __contains__(self, key: str) -> bool: |
| 76 | + return key in self.additional_properties |
0 commit comments