Добавлены тайп хинты в соответствии с документацией для следуюшщих классов: YandexMusicObject, Cover, Captcha, DownloadInfo, Experiments, Icon, InvocationInfo, Pager, PermissionAlerts, PromoCodeStatus, Settings, TrackShort, TracksList, Video #120
2019-12-24 16:17:04 +09:00
|
|
|
|
from typing import TYPE_CHECKING, Optional
|
|
|
|
|
|
2020-01-26 21:19:22 +09:00
|
|
|
|
from yandex_music import YandexMusicObject
|
2021-09-19 22:47:19 +09:00
|
|
|
|
from yandex_music.utils import model
|
2020-01-26 21:19:22 +09:00
|
|
|
|
|
Добавлены тайп хинты в соответствии с документацией для следуюшщих классов: YandexMusicObject, Cover, Captcha, DownloadInfo, Experiments, Icon, InvocationInfo, Pager, PermissionAlerts, PromoCodeStatus, Settings, TrackShort, TracksList, Video #120
2019-12-24 16:17:04 +09:00
|
|
|
|
if TYPE_CHECKING:
|
|
|
|
|
from yandex_music import Client, Status
|
|
|
|
|
|
2019-05-16 21:45:25 +09:00
|
|
|
|
|
2021-09-19 22:47:19 +09:00
|
|
|
|
@model
|
2019-05-16 21:45:25 +09:00
|
|
|
|
class PromoCodeStatus(YandexMusicObject):
|
2020-01-26 08:55:56 +09:00
|
|
|
|
"""Класс, представляющий статус активации промо-кода.
|
2019-07-05 02:21:54 +09:00
|
|
|
|
|
|
|
|
|
Attributes:
|
|
|
|
|
status (:obj:`str`): Статус операции.
|
|
|
|
|
status_desc (:obj:`str`): Описание статуса.
|
2020-03-22 06:29:34 +09:00
|
|
|
|
account_status (:obj:`yandex_music.Status`): Информация об аккаунте пользователя.
|
Удаление избыточной информации (#247)
Классы: Account, AutoRenewable, PassportPhone, Permissions, Plus, Price,
Product, Status, Subscription, UserSettings, Album, Label,
TrackPosition, Playlist
У всех классов изменено описание атрибута client
2020-03-22 04:49:20 +09:00
|
|
|
|
client (:obj:`yandex_music.Client`, optional): Клиент Yandex Music.
|
2019-07-05 02:21:54 +09:00
|
|
|
|
"""
|
|
|
|
|
|
2021-09-19 22:47:19 +09:00
|
|
|
|
status: str
|
|
|
|
|
status_desc: str
|
|
|
|
|
account_status: Optional['Status']
|
|
|
|
|
client: Optional['Client'] = None
|
2019-05-16 21:45:25 +09:00
|
|
|
|
|
2021-09-19 22:47:19 +09:00
|
|
|
|
def __post_init__(self):
|
|
|
|
|
self._id_attrs = (self.status, self.status_desc, self.account_status)
|
2020-05-16 04:14:44 +09:00
|
|
|
|
|
2019-05-16 21:45:25 +09:00
|
|
|
|
@classmethod
|
Добавлены тайп хинты в соответствии с документацией для следуюшщих классов: YandexMusicObject, Cover, Captcha, DownloadInfo, Experiments, Icon, InvocationInfo, Pager, PermissionAlerts, PromoCodeStatus, Settings, TrackShort, TracksList, Video #120
2019-12-24 16:17:04 +09:00
|
|
|
|
def de_json(cls, data: dict, client: 'Client') -> Optional['PromoCodeStatus']:
|
2019-07-05 02:21:54 +09:00
|
|
|
|
"""Десериализация объекта.
|
|
|
|
|
|
|
|
|
|
Args:
|
|
|
|
|
data (:obj:`dict`): Поля и значения десериализуемого объекта.
|
Удаление избыточной информации (#247)
Классы: Account, AutoRenewable, PassportPhone, Permissions, Plus, Price,
Product, Status, Subscription, UserSettings, Album, Label,
TrackPosition, Playlist
У всех классов изменено описание атрибута client
2020-03-22 04:49:20 +09:00
|
|
|
|
client (:obj:`yandex_music.Client`, optional): Клиент Yandex Music.
|
2019-07-05 02:21:54 +09:00
|
|
|
|
|
|
|
|
|
Returns:
|
2020-03-22 06:29:34 +09:00
|
|
|
|
:obj:`yandex_music.PromoCodeStatus`: Статус активации промо-кода.
|
2019-07-05 02:21:54 +09:00
|
|
|
|
"""
|
2019-05-16 21:45:25 +09:00
|
|
|
|
if not data:
|
|
|
|
|
return None
|
|
|
|
|
|
|
|
|
|
data = super(PromoCodeStatus, cls).de_json(data, client)
|
|
|
|
|
from yandex_music import Status
|
2021-02-03 21:28:10 +09:00
|
|
|
|
|
2019-05-16 21:45:25 +09:00
|
|
|
|
data['account_status'] = Status.de_json(data.get('account_status'), client)
|
|
|
|
|
|
|
|
|
|
return cls(client=client, **data)
|