82 lines
2.5 KiB
Python
82 lines
2.5 KiB
Python
from collections.abc import Mapping
|
|
from typing import Any, TypeVar, Union
|
|
|
|
from attrs import define as _attrs_define
|
|
from attrs import field as _attrs_field
|
|
|
|
from ..types import UNSET, Unset
|
|
|
|
T = TypeVar("T", bound="ApplicationParamsModel")
|
|
|
|
|
|
@_attrs_define
|
|
class ApplicationParamsModel:
|
|
"""Params allowed to create or update Applications.
|
|
|
|
Attributes:
|
|
name (str): The application name. This is how the application should be displayed to the user. Example: Backup
|
|
Server.
|
|
default_priority (Union[Unset, int]): The default priority of messages sent by this application. Defaults to 0.
|
|
Example: 5.
|
|
description (Union[Unset, str]): The description of the application. Example: Backup server for the interwebs.
|
|
"""
|
|
|
|
name: str
|
|
default_priority: Union[Unset, int] = UNSET
|
|
description: Union[Unset, str] = UNSET
|
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
|
|
def to_dict(self) -> dict[str, Any]:
|
|
name = self.name
|
|
|
|
default_priority = self.default_priority
|
|
|
|
description = self.description
|
|
|
|
field_dict: dict[str, Any] = {}
|
|
field_dict.update(self.additional_properties)
|
|
field_dict.update(
|
|
{
|
|
"name": name,
|
|
}
|
|
)
|
|
if default_priority is not UNSET:
|
|
field_dict["defaultPriority"] = default_priority
|
|
if description is not UNSET:
|
|
field_dict["description"] = description
|
|
|
|
return field_dict
|
|
|
|
@classmethod
|
|
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
d = dict(src_dict)
|
|
name = d.pop("name")
|
|
|
|
default_priority = d.pop("defaultPriority", UNSET)
|
|
|
|
description = d.pop("description", UNSET)
|
|
|
|
application_params_model = cls(
|
|
name=name,
|
|
default_priority=default_priority,
|
|
description=description,
|
|
)
|
|
|
|
application_params_model.additional_properties = d
|
|
return application_params_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
|