Добавлен новый класс LicenceTextPart.
Поля cheapest, title, family_sub, fb_image, fb_name, family, intro_period_duration, intro_price, start_period_duration, start_price, licence_text_parts для Product.
Поля storage_dir, duplicates для Album.
Поле subscribed для ArtistEvent.
Поле description для GeneratedPlaylist.
Поле genre для Event.
Поле show_in_regions для Genre.
Поле cover_uri для MixLink.
Поля og_description, top_artist для Playlist.
Поля full_image_url, mts_full_image_url для Station.
Документация и тесты к новым поля. #339
2020-06-07 05:48:32 +09:00
|
|
|
|
from typing import TYPE_CHECKING, Optional, List
|
|
|
|
|
|
|
|
|
|
from yandex_music import YandexMusicObject
|
2021-09-19 22:47:19 +09:00
|
|
|
|
from yandex_music.utils import model
|
Добавлен новый класс LicenceTextPart.
Поля cheapest, title, family_sub, fb_image, fb_name, family, intro_period_duration, intro_price, start_period_duration, start_price, licence_text_parts для Product.
Поля storage_dir, duplicates для Album.
Поле subscribed для ArtistEvent.
Поле description для GeneratedPlaylist.
Поле genre для Event.
Поле show_in_regions для Genre.
Поле cover_uri для MixLink.
Поля og_description, top_artist для Playlist.
Поля full_image_url, mts_full_image_url для Station.
Документация и тесты к новым поля. #339
2020-06-07 05:48:32 +09:00
|
|
|
|
|
|
|
|
|
if TYPE_CHECKING:
|
|
|
|
|
from yandex_music import Client
|
|
|
|
|
|
|
|
|
|
|
2021-09-19 22:47:19 +09:00
|
|
|
|
@model
|
Добавлен новый класс LicenceTextPart.
Поля cheapest, title, family_sub, fb_image, fb_name, family, intro_period_duration, intro_price, start_period_duration, start_price, licence_text_parts для Product.
Поля storage_dir, duplicates для Album.
Поле subscribed для ArtistEvent.
Поле description для GeneratedPlaylist.
Поле genre для Event.
Поле show_in_regions для Genre.
Поле cover_uri для MixLink.
Поля og_description, top_artist для Playlist.
Поля full_image_url, mts_full_image_url для Station.
Документация и тесты к новым поля. #339
2020-06-07 05:48:32 +09:00
|
|
|
|
class LicenceTextPart(YandexMusicObject):
|
|
|
|
|
"""Класс, представляющий часть текста с ссылкой на лицензионное соглашение.
|
|
|
|
|
|
|
|
|
|
Attributes:
|
|
|
|
|
text (:obj:`str`): Часть текста (строка).
|
|
|
|
|
url (:obj:`str`, optional): Ссылка на лицензионное соглашение.
|
|
|
|
|
client (:obj:`yandex_music.Client`, optional): Клиент Yandex Music.
|
|
|
|
|
"""
|
|
|
|
|
|
2021-09-19 22:47:19 +09:00
|
|
|
|
text: str
|
|
|
|
|
url: Optional[str] = None
|
|
|
|
|
client: Optional['Client'] = None
|
Добавлен новый класс LicenceTextPart.
Поля cheapest, title, family_sub, fb_image, fb_name, family, intro_period_duration, intro_price, start_period_duration, start_price, licence_text_parts для Product.
Поля storage_dir, duplicates для Album.
Поле subscribed для ArtistEvent.
Поле description для GeneratedPlaylist.
Поле genre для Event.
Поле show_in_regions для Genre.
Поле cover_uri для MixLink.
Поля og_description, top_artist для Playlist.
Поля full_image_url, mts_full_image_url для Station.
Документация и тесты к новым поля. #339
2020-06-07 05:48:32 +09:00
|
|
|
|
|
2021-09-19 22:47:19 +09:00
|
|
|
|
def __post_init__(self):
|
Добавлен новый класс LicenceTextPart.
Поля cheapest, title, family_sub, fb_image, fb_name, family, intro_period_duration, intro_price, start_period_duration, start_price, licence_text_parts для Product.
Поля storage_dir, duplicates для Album.
Поле subscribed для ArtistEvent.
Поле description для GeneratedPlaylist.
Поле genre для Event.
Поле show_in_regions для Genre.
Поле cover_uri для MixLink.
Поля og_description, top_artist для Playlist.
Поля full_image_url, mts_full_image_url для Station.
Документация и тесты к новым поля. #339
2020-06-07 05:48:32 +09:00
|
|
|
|
self._id_attrs = (self.text,)
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
|
def de_json(cls, data: dict, client: 'Client') -> Optional['PassportPhone']:
|
|
|
|
|
"""Десериализация объекта.
|
|
|
|
|
|
|
|
|
|
Args:
|
|
|
|
|
data (:obj:`dict`): Поля и значения десериализуемого объекта.
|
|
|
|
|
client (:obj:`yandex_music.Client`, optional): Клиент Yandex Music.
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
:obj:`yandex_music.LicenceTextPart`: Строка лицензионного соглашения.
|
|
|
|
|
"""
|
|
|
|
|
if not data:
|
|
|
|
|
return None
|
|
|
|
|
|
|
|
|
|
data = super(LicenceTextPart, cls).de_json(data, client)
|
|
|
|
|
|
|
|
|
|
return cls(client=client, **data)
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
|
def de_list(cls, data: dict, client: 'Client') -> List['LicenceTextPart']:
|
|
|
|
|
"""Десериализация списка объектов.
|
|
|
|
|
|
|
|
|
|
Args:
|
|
|
|
|
data (:obj:`list`): Список словарей с полями и значениями десериализуемого объекта.
|
|
|
|
|
client (:obj:`yandex_music.Client`, optional): Клиент Yandex Music.
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
:obj:`list` из :obj:`yandex_music.LicenceTextPart`: Строки текста с ссылкой на лицензионное соглашение.
|
|
|
|
|
"""
|
|
|
|
|
if not data:
|
|
|
|
|
return []
|
|
|
|
|
|
|
|
|
|
return [cls.de_json(row, client) for row in data]
|