from collections.abc import Mapping from typing import Any, TypeVar, Union, cast from attrs import define as _attrs_define from attrs import field as _attrs_field from ..types import UNSET, Unset T = TypeVar("T", bound="PluginConfExternalModel") @_attrs_define class PluginConfExternalModel: """Holds information about a plugin instance for one user. Attributes: capabilities (list[str]): Capabilities the plugin provides Example: ['webhook', 'display']. enabled (bool): Whether the plugin instance is enabled. Example: True. id (int): The plugin id. Example: 25. module_path (str): The module path of the plugin. Example: github.com/gotify/server/plugin/example/echo. name (str): The plugin name. Example: RSS poller. token (str): The user name. For login. Example: P1234. author (Union[Unset, str]): The author of the plugin. Example: jmattheis. license_ (Union[Unset, str]): The license of the plugin. Example: MIT. website (Union[Unset, str]): The website of the plugin. Example: gotify.net. """ capabilities: list[str] enabled: bool id: int module_path: str name: str token: str author: Union[Unset, str] = UNSET license_: Union[Unset, str] = UNSET website: Union[Unset, str] = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: capabilities = self.capabilities enabled = self.enabled id = self.id module_path = self.module_path name = self.name token = self.token author = self.author license_ = self.license_ website = self.website field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) field_dict.update( { "capabilities": capabilities, "enabled": enabled, "id": id, "modulePath": module_path, "name": name, "token": token, } ) if author is not UNSET: field_dict["author"] = author if license_ is not UNSET: field_dict["license"] = license_ if website is not UNSET: field_dict["website"] = website return field_dict @classmethod def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) capabilities = cast(list[str], d.pop("capabilities")) enabled = d.pop("enabled") id = d.pop("id") module_path = d.pop("modulePath") name = d.pop("name") token = d.pop("token") author = d.pop("author", UNSET) license_ = d.pop("license", UNSET) website = d.pop("website", UNSET) plugin_conf_external_model = cls( capabilities=capabilities, enabled=enabled, id=id, module_path=module_path, name=name, token=token, author=author, license_=license_, website=website, ) plugin_conf_external_model.additional_properties = d return plugin_conf_external_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