2020-06-14 21:09:50 +09:00
|
|
|
|
from typing import List, TYPE_CHECKING, Optional
|
|
|
|
|
|
|
|
|
|
from yandex_music import YandexMusicObject
|
2021-09-19 22:47:19 +09:00
|
|
|
|
from yandex_music.utils import model
|
2020-06-14 21:09:50 +09:00
|
|
|
|
|
|
|
|
|
if TYPE_CHECKING:
|
|
|
|
|
from yandex_music import Client
|
|
|
|
|
|
|
|
|
|
|
2021-09-19 22:47:19 +09:00
|
|
|
|
@model
|
2020-06-14 21:09:50 +09:00
|
|
|
|
class Deactivation(YandexMusicObject):
|
|
|
|
|
"""Класс, представляющий способы деактивации мобильной услуги.
|
|
|
|
|
|
|
|
|
|
Note:
|
|
|
|
|
Известные значения поля `method`: `ussd`.
|
|
|
|
|
|
|
|
|
|
Attributes:
|
|
|
|
|
method (:obj:`str`): Метод отключения.
|
2021-02-01 21:57:06 +09:00
|
|
|
|
instructions (:obj:`str`, optional): Инструкция.
|
2020-06-14 21:09:50 +09:00
|
|
|
|
client (:obj:`yandex_music.Client`, optional): Клиент Yandex Music.
|
|
|
|
|
"""
|
|
|
|
|
|
2021-09-19 22:47:19 +09:00
|
|
|
|
method: str
|
|
|
|
|
instructions: Optional[str] = None
|
|
|
|
|
client: Optional['Client'] = None
|
2020-06-14 21:09:50 +09:00
|
|
|
|
|
2021-09-19 22:47:19 +09:00
|
|
|
|
def __post_init__(self):
|
2020-06-14 21:09:50 +09:00
|
|
|
|
self._id_attrs = (self.method, self.instructions)
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
|
def de_json(cls, data: dict, client: 'Client') -> Optional['Deactivation']:
|
|
|
|
|
"""Десериализация объекта.
|
|
|
|
|
|
|
|
|
|
Args:
|
|
|
|
|
data (:obj:`dict`): Поля и значения десериализуемого объекта.
|
|
|
|
|
client (:obj:`yandex_music.Client`, optional): Клиент Yandex Music.
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
:obj:`yandex_music.Deactivation`: Способ отключения услуги.
|
|
|
|
|
"""
|
|
|
|
|
if not data:
|
|
|
|
|
return None
|
|
|
|
|
|
|
|
|
|
data = super(Deactivation, cls).de_json(data, client)
|
|
|
|
|
|
|
|
|
|
return cls(client=client, **data)
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
|
def de_list(cls, data: dict, client: 'Client') -> List['Deactivation']:
|
|
|
|
|
"""Десериализация списка объектов.
|
|
|
|
|
|
|
|
|
|
Args:
|
|
|
|
|
data (:obj:`list`): Список словарей с полями и значениями десериализуемого объекта.
|
|
|
|
|
client (:obj:`yandex_music.Client`, optional): Клиент Yandex Music.
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
:obj:`list` из :obj:`yandex_music.Deactivation`: Способы отключения услуги.
|
|
|
|
|
"""
|
|
|
|
|
if not data:
|
|
|
|
|
return []
|
|
|
|
|
|
|
|
|
|
return [cls.de_json(deactivation, client) for deactivation in data]
|