mirror of
https://github.com/MelisaDev/melisa.git
synced 2024-11-11 19:07:28 +03:00
feat(interactions): InteractionResponse Model
This commit is contained in:
parent
7344d96d87
commit
240025351d
1 changed files with 30 additions and 0 deletions
|
@ -78,6 +78,36 @@ class InteractionCallbackType(IntEnum):
|
||||||
return self.value
|
return self.value
|
||||||
|
|
||||||
|
|
||||||
|
class InteractionResponse(APIModelBase):
|
||||||
|
"""Interaction Response
|
||||||
|
|
||||||
|
Attributes
|
||||||
|
----------
|
||||||
|
type: InteractionType
|
||||||
|
The type of response
|
||||||
|
data: Optional[Any]
|
||||||
|
An optional response message
|
||||||
|
"""
|
||||||
|
type: InteractionCallbackType
|
||||||
|
data: Optional[Any]
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls, data: Dict[str, Any]) -> InteractionResponse:
|
||||||
|
"""Generate a InteractionResponse from the given data.
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
data: :class:`dict`
|
||||||
|
The dictionary to convert into a InteractionResponse.
|
||||||
|
"""
|
||||||
|
self: InteractionResponse = super().__new__(cls)
|
||||||
|
|
||||||
|
self.type = try_enum(InteractionCallbackType, data["type"])
|
||||||
|
self.data = data.get("data", None)
|
||||||
|
|
||||||
|
return self
|
||||||
|
|
||||||
|
|
||||||
@dataclass(repr=False)
|
@dataclass(repr=False)
|
||||||
class Interaction(APIModelBase):
|
class Interaction(APIModelBase):
|
||||||
"""Interaction
|
"""Interaction
|
||||||
|
|
Loading…
Reference in a new issue