Обнновлено до .net10

This commit is contained in:
FrigaT
2026-04-10 15:05:32 +03:00
parent 11d0b0d72f
commit 8444fc5f8e
386 changed files with 6361 additions and 7164 deletions

View File

@@ -1,71 +1,35 @@
namespace YandexMusic.API.Models.Common.Cover
using System.Text.Json;
using System.Text.Json.Serialization;
namespace YandexMusic.API.Models.Common.Cover;
public class YCoverConverter : JsonConverter<YCover>
{
public sealed class YCoverConverter : JsonConverter
public override YCover? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
public override bool CanConvert(Type objectType)
if (reader.TokenType != JsonTokenType.StartObject) return null;
using var doc = JsonDocument.ParseValue(ref reader);
var root = doc.RootElement;
var type = root.TryGetProperty("type", out var t) ? t.GetString() : null;
if (root.TryGetProperty("error", out _)) type = "error";
return type switch
{
return typeof(YCover).IsAssignableFrom(objectType);
}
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if (reader.TokenType == JsonToken.Null)
return null;
JObject jObject = JObject.Load(reader);
YCover cover;
try
{
// Фиктивный тип, т.к. у такой обложки нет поля с типом
if (jObject["type"] == null)
jObject.Add("type", "color");
YCoverType type = jObject["error"] != null
? YCoverType.Error
: jObject["type"].ToObject<YCoverType>();
switch (type)
{
case YCoverType.Error:
cover = jObject.ToObject<YCoverError>();
break;
case YCoverType.Color:
cover = jObject.ToObject<YCoverColor>();
break;
case YCoverType.FromAlbumCover:
case YCoverType.FromArtistPhotos:
cover = jObject.ToObject<YCoverImage>();
break;
case YCoverType.Pic:
cover = jObject.ToObject<YCoverPic>();
break;
case YCoverType.Mosaic:
cover = jObject.ToObject<YCoverMosaic>();
break;
default:
cover = jObject.ToObject<YCover>();
break;
}
}
catch (Exception ex)
{
throw new Exception($"Ошибка десериализации типа \"{objectType.Name}\".", ex);
}
return cover;
}
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
JObject cover = JObject.FromObject(value, serializer);
cover.WriteTo(writer);
}
"color" => JsonSerializer.Deserialize<YCoverColor>(root.GetRawText(), options),
"error" => JsonSerializer.Deserialize<YCoverError>(root.GetRawText(), options),
"from-artist-photos" or "from-album-cover" => JsonSerializer.Deserialize<YCoverImage>(root.GetRawText(), options),
"pic" => JsonSerializer.Deserialize<YCoverPic>(root.GetRawText(), options),
"mosaic" => JsonSerializer.Deserialize<YCoverMosaic>(root.GetRawText(), options),
_ => JsonSerializer.Deserialize<YCover>(root.GetRawText(), options)
};
}
public class YCover
{
public YCoverType Type { get; set; }
}
public override void Write(Utf8JsonWriter writer, YCover value, JsonSerializerOptions options)
=> JsonSerializer.Serialize(writer, value, options);
}
[JsonConverter(typeof(YCoverConverter))]
public class YCover
{
public YCoverType Type { get; set; }
}

View File

@@ -1,8 +1,7 @@
namespace YandexMusic.API.Models.Common.Cover
namespace YandexMusic.API.Models.Common.Cover;
public class YCoverColor : YCover
{
public class YCoverColor : YCover
{
public string Uri { get; set; }
public string Color { get; set; }
}
public string Uri { get; set; }
public string Color { get; set; }
}

View File

@@ -1,7 +1,6 @@
namespace YandexMusic.API.Models.Common.Cover
namespace YandexMusic.API.Models.Common.Cover;
public class YCoverError : YCover
{
public class YCoverError : YCover
{
public string Error { get; set; }
}
public string Error { get; set; }
}

View File

@@ -1,8 +1,7 @@
namespace YandexMusic.API.Models.Common.Cover
namespace YandexMusic.API.Models.Common.Cover;
public class YCoverImage : YCover
{
public class YCoverImage : YCover
{
public string Prefix { get; set; }
public string Uri { get; set; }
}
public string Prefix { get; set; }
public string Uri { get; set; }
}

View File

@@ -1,8 +1,7 @@
namespace YandexMusic.API.Models.Common.Cover
namespace YandexMusic.API.Models.Common.Cover;
public class YCoverMosaic : YCover
{
public class YCoverMosaic : YCover
{
public bool Custom { get; set; }
public List<string> ItemsUri { get; set; }
}
public bool Custom { get; set; }
public List<string> ItemsUri { get; set; }
}

View File

@@ -1,11 +1,10 @@
namespace YandexMusic.API.Models.Common.Cover
namespace YandexMusic.API.Models.Common.Cover;
public class YCoverPic : YCover
{
public class YCoverPic : YCover
{
public bool Custom { get; set; }
public string Dir { get; set; }
public bool IsCustom { get; set; }
public string Uri { get; set; }
public string Version { get; set; }
}
public bool Custom { get; set; }
public string Dir { get; set; }
public bool IsCustom { get; set; }
public string Uri { get; set; }
public string Version { get; set; }
}

View File

@@ -1,17 +1,17 @@
using System.Runtime.Serialization;
using System.Text.Json.Serialization;
namespace YandexMusic.API.Models.Common.Cover
namespace YandexMusic.API.Models.Common.Cover;
[JsonConverter(typeof(JsonStringEnumConverter))]
public enum YCoverType
{
[JsonConverter(typeof(StringEnumConverter))]
public enum YCoverType
{
Color,
Error,
[EnumMember(Value = "from-artist-photos")]
FromArtistPhotos,
[EnumMember(Value = "from-album-cover")]
FromAlbumCover,
Mosaic,
Pic
}
Color,
Error,
[EnumMember(Value = "from-artist-photos")]
FromArtistPhotos,
[EnumMember(Value = "from-album-cover")]
FromAlbumCover,
Mosaic,
Pic,
}

View File

@@ -1,8 +1,9 @@
namespace YandexMusic.API.Models.Common
using System.Text.Json.Serialization;
namespace YandexMusic.API.Models.Common;
public class YBaseModel
{
public class YBaseModel
{
[JsonIgnore]
public YExecutionContext Context { get; set; }
}
[JsonIgnore]
public YExecutionContext Context { get; set; }
}

View File

@@ -1,12 +1,10 @@
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public class YButton : YStyle
{
public class YButton : YStyle
{
public string Text { get; set; }
public string Url { get; set; }
#warning Дублирование?
public string Uri { get; set; }
public string Color { get; set; }
public bool ViewBrowser { get; set; }
}
public string Text { get; set; }
public string Url { get; set; }
public string Uri { get; set; }
public string Color { get; set; }
public bool ViewBrowser { get; set; }
}

View File

@@ -1,7 +1,6 @@
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public class YCashback
{
public class YCashback
{
public string Title { get; set; }
}
public string Title { get; set; }
}

View File

@@ -1,12 +1,11 @@
using YandexMusic.API.Models.Landing.Entity.Entities;
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public class YChart
{
public class YChart
{
public int Position { get; set; }
public int Listeners { get; set; }
public int Shift { get; set; }
public YChartProgress Progress { get; set; }
}
public int Position { get; set; }
public int Listeners { get; set; }
public int Shift { get; set; }
public YChartProgress Progress { get; set; }
}

View File

@@ -1,19 +1,18 @@
using YandexMusic.API.Models.Artist;
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public class YClip
{
public class YClip
{
public List<YArtist> Artists { get; set; }
public string ClipId { get; set; }
public List<string> Disclaimers { get; set; }
public int Duration { get; set; }
public bool Explicit { get; set; }
public string PlayerId { get; set; }
public string PreviewUrl { get; set; }
public string Uuid { get; set; }
public string Thumbnail { get; set; }
public string Title { get; set; }
public List<string> TrackIds { get; set; }
}
public List<YArtist> Artists { get; set; }
public string ClipId { get; set; }
public List<string> Disclaimers { get; set; }
public int Duration { get; set; }
public bool Explicit { get; set; }
public string PlayerId { get; set; }
public string PreviewUrl { get; set; }
public string Uuid { get; set; }
public string Thumbnail { get; set; }
public string Title { get; set; }
public List<string> TrackIds { get; set; }
}

View File

@@ -1,8 +1,7 @@
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public class YCloseButtonStyles
{
public class YCloseButtonStyles
{
public YStyle White { get; set; }
public YStyle Black { get; set; }
}
public YStyle White { get; set; }
public YStyle Black { get; set; }
}

View File

@@ -1,9 +1,8 @@
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public class YCountsTracks
{
public class YCountsTracks
{
public int All { get; set; }
public int Favorite { get; set; }
public int Ugc { get; set; }
}
public int All { get; set; }
public int Favorite { get; set; }
public int Ugc { get; set; }
}

View File

@@ -1,11 +1,10 @@
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public class YCustomWave
{
public class YCustomWave
{
public string AnimationUrl { get; set; }
public string BackgroundImageUrl { get; set; }
public string Header { get; set; }
public string Position { get; set; }
public string Title { get; set; }
}
public string AnimationUrl { get; set; }
public string BackgroundImageUrl { get; set; }
public string Header { get; set; }
public string Position { get; set; }
public string Title { get; set; }
}

View File

@@ -1,10 +1,9 @@
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public class YDerivedColors
{
public class YDerivedColors
{
public string Average { get; set; }
public string WaveText { get; set; }
public string MiniPlayer { get; set; }
public string Accent { get; set; }
}
public string Average { get; set; }
public string WaveText { get; set; }
public string MiniPlayer { get; set; }
public string Accent { get; set; }
}

View File

@@ -1,8 +1,7 @@
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public class YDescription
{
public class YDescription
{
public string Text { get; set; }
public string Uri { get; set; }
}
public string Text { get; set; }
public string Uri { get; set; }
}

View File

@@ -1,8 +1,7 @@
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public class YError
{
public class YError
{
public string Name { get; set; }
public string Message { get; set; }
}
public string Name { get; set; }
public string Message { get; set; }
}

View File

@@ -1,8 +1,7 @@
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public class YErrorResponse : Exception
{
public class YErrorResponse : Exception
{
public YInvocationInfo InvocationInfo { get; set; }
public YError Error { get; set; }
}
public YInvocationInfo InvocationInfo { get; set; }
public YError Error { get; set; }
}

View File

@@ -1,57 +1,12 @@
using YandexMusic.API.Common;
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
/// <summary>Контекст выполнения, содержащий ссылки на API и хранилище.</summary>
public class YExecutionContext
{
public sealed class YExecutionContextConverter : JsonConverter
{
#region Поля
private YandexMusicApi api;
private AuthStorage storage;
#endregion Поля
public override bool CanConvert(Type objectType)
{
return typeof(YBaseModel).IsAssignableFrom(objectType);
}
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
try
{
YBaseModel obj = (YBaseModel)Activator.CreateInstance(objectType);
serializer.Populate(reader, obj);
obj.Context = new YExecutionContext
{
API = api,
Storage = storage
};
return obj;
}
catch (Exception ex)
{
throw new Exception($"Ошибка десериализации типа \"{objectType.Name}\".", ex);
}
}
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
throw new NotImplementedException();
}
public YExecutionContextConverter(YandexMusicApi yandex, AuthStorage auth)
{
api = yandex;
storage = auth;
}
}
public class YExecutionContext
{
public YandexMusicApi API { get; internal set; }
public AuthStorage Storage { get; internal set; }
}
}
/// <summary>Экземпляр основного API.</summary>
public YandexMusicApi API { get; internal set; } = null!;
/// <summary>Хранилище данных авторизации.</summary>
public AuthStorage Storage { get; internal set; } = null!;
}

View File

@@ -0,0 +1,41 @@
using System.Text.Json;
using System.Text.Json.Serialization;
using YandexMusic.API.Common;
namespace YandexMusic.API.Models.Common;
/// <summary>Конвертер для внедрения контекста выполнения (API и хранилище) в модели.</summary>
public class YExecutionContextConverter : JsonConverter<YBaseModel>
{
private readonly YandexMusicApi _api;
private readonly AuthStorage _storage;
public YExecutionContextConverter(YandexMusicApi api, AuthStorage storage)
{
_api = api;
_storage = storage;
}
public override YBaseModel? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
// Десериализуем объект без контекста
var obj = (YBaseModel?)JsonSerializer.Deserialize(ref reader, typeToConvert, options);
if (obj != null)
{
obj.Context = new YExecutionContext
{
API = _api,
Storage = _storage
};
}
return obj;
}
public override void Write(Utf8JsonWriter writer, YBaseModel value, JsonSerializerOptions options)
{
// При сериализации игнорируем контекст
var cloneOptions = new JsonSerializerOptions(options);
cloneOptions.Converters.Remove(this);
JsonSerializer.Serialize(writer, value, cloneOptions);
}
}

View File

@@ -1,11 +1,10 @@
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public class YExtraAction
{
public class YExtraAction
{
public string Type { get; set; }
public string Title { get; set; }
public string Color { get; set; }
public string Url { get; set; }
public bool ViewBrowser { get; set; }
}
public string Type { get; set; }
public string Title { get; set; }
public string Color { get; set; }
public string Url { get; set; }
public bool ViewBrowser { get; set; }
}

View File

@@ -1,7 +1,6 @@
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public class YId
{
public class YId
{
public string Id { get; set; }
}
public string Id { get; set; }
}

View File

@@ -1,13 +1,14 @@
namespace YandexMusic.API.Models.Common
using System.Text.Json.Serialization;
namespace YandexMusic.API.Models.Common;
public class YInvocationInfo
{
public class YInvocationInfo
{
[JsonProperty("app-name")]
public string AppName { get; set; }
[JsonProperty("exec-duration-millis")]
public int ExecDurationMillis { get; set; }
public string HostName { get; set; }
[JsonProperty("req-id")]
public string ReqId { get; set; }
}
[JsonPropertyName("app-name")]
public string AppName { get; set; }
[JsonPropertyName("exec-duration-millis")]
public int ExecDurationMillis { get; set; }
public string HostName { get; set; }
[JsonPropertyName("req-id")]
public string ReqId { get; set; }
}

View File

@@ -1,8 +1,7 @@
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public class YLabel
{
public class YLabel
{
public string Id { get; set; }
public string Name { get; set; }
}
public string Id { get; set; }
public string Name { get; set; }
}

View File

@@ -1,8 +1,7 @@
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public class YLikedCounts
{
public class YLikedCounts
{
public long LikedAlbums { get; set; }
public long LikedArtists { get; set; }
}
public long LikedAlbums { get; set; }
public long LikedArtists { get; set; }
}

View File

@@ -1,13 +1,12 @@
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public class YLink
{
public class YLink
{
public string Href { get; set; }
public string Url { get; set; }
public string ImgUrl { get; set; }
public string SocialNetwork { get; set; }
public string Subtitle { get; set; }
public string Title { get; set; }
public YLinkType Type { get; set; }
}
public string Href { get; set; }
public string Url { get; set; }
public string ImgUrl { get; set; }
public string SocialNetwork { get; set; }
public string Subtitle { get; set; }
public string Title { get; set; }
public YLinkType Type { get; set; }
}

View File

@@ -1,25 +1,24 @@
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public enum YLinkType
{
public enum YLinkType
{
/// <summary>
/// Официальный сайт
/// </summary>
Official,
/// <summary>
/// Официальный сайт
/// </summary>
Official,
/// <summary>
/// Социальная сеть
/// </summary>
Social,
/// <summary>
/// Социальная сеть
/// </summary>
Social,
/// <summary>
/// Twitter
/// </summary>
Twitter,
/// <summary>
/// Twitter
/// </summary>
Twitter,
/// <summary>
/// YouTube
/// </summary>
YouTube
}
/// <summary>
/// YouTube
/// </summary>
YouTube,
}

View File

@@ -1,12 +1,11 @@
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public class YLyrics
{
public class YLyrics
{
public string Id { get; set; }
public string Lyrics { get; set; }
public string FullLyrics { get; set; }
public bool HasRights { get; set; }
public bool ShowTranslation { get; set; }
public string TextLanguage { get; set; }
}
public string Id { get; set; }
public string Lyrics { get; set; }
public string FullLyrics { get; set; }
public bool HasRights { get; set; }
public bool ShowTranslation { get; set; }
public string TextLanguage { get; set; }
}

View File

@@ -1,8 +1,7 @@
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public class YLyricsInfo
{
public class YLyricsInfo
{
public bool HasAvailableSyncLyrics { get; set; }
public bool HasAvailableTextLyrics { get; set; }
}
public bool HasAvailableSyncLyrics { get; set; }
public bool HasAvailableTextLyrics { get; set; }
}

View File

@@ -1,8 +1,7 @@
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public class YMajor
{
public class YMajor
{
public string Id { get; set; }
public string Name { get; set; }
}
public string Id { get; set; }
public string Name { get; set; }
}

View File

@@ -1,8 +1,7 @@
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public class YMasterHub
{
public class YMasterHub
{
public YSubscription[] ActiveSubscriptions { get; set; }
public YSubscription[] AvailableSubscriptions { get; set; }
}
public YSubscription[] ActiveSubscriptions { get; set; }
public YSubscription[] AvailableSubscriptions { get; set; }
}

View File

@@ -1,8 +1,7 @@
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public enum YMetaType
{
public enum YMetaType
{
Music,
Podcast
}
Music,
Podcast,
}

View File

@@ -1,11 +1,10 @@
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public class YOwner
{
public class YOwner
{
public string Login { get; set; }
public string Name { get; set; }
public string Sex { get; set; }
public string Uid { get; set; }
public bool Verified { get; set; }
}
public string Login { get; set; }
public string Name { get; set; }
public string Sex { get; set; }
public string Uid { get; set; }
public bool Verified { get; set; }
}

View File

@@ -1,9 +1,8 @@
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public class YPager
{
public class YPager
{
public int Total { get; set; }
public int Page { get; set; }
public int PerPage { get; set; }
}
public int Total { get; set; }
public int Page { get; set; }
public int PerPage { get; set; }
}

View File

@@ -1,8 +1,7 @@
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public class YPeriod
{
public class YPeriod
{
public DateTime Start { get; set; }
public DateTime End { get; set; }
}
public DateTime Start { get; set; }
public DateTime End { get; set; }
}

View File

@@ -1,9 +1,8 @@
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public class YPermissions
{
public class YPermissions
{
public List<string> Default { get; set; }
public DateTime Until { get; set; }
public List<string> Values { get; set; }
}
public List<string> Default { get; set; }
public DateTime Until { get; set; }
public List<string> Values { get; set; }
}

View File

@@ -1,7 +1,6 @@
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public class YPhone
{
public class YPhone
{
public string Phone { get; set; }
}
public string Phone { get; set; }
}

View File

@@ -1,8 +1,7 @@
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public class YPlus
{
public class YPlus
{
public bool HasPlus { get; set; }
public bool IsTutorialCompleted { get; set; }
}
public bool HasPlus { get; set; }
public bool IsTutorialCompleted { get; set; }
}

View File

@@ -1,9 +1,8 @@
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public enum YPodcastEpisodeType
{
public enum YPodcastEpisodeType
{
Full,
Trailer,
Bonus
}
Full,
Trailer,
Bonus,
}

View File

@@ -1,8 +1,7 @@
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public class YPrerolls
{
public class YPrerolls
{
public string Id { get; set; }
public string Link { get; set; }
}
public string Id { get; set; }
public string Link { get; set; }
}

View File

@@ -1,10 +1,9 @@
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public class YPrice
{
public class YPrice
{
public decimal Amount { get; set; }
public string Currency { get; set; }
public string CurrencySymbol { get; set; }
public decimal Value { get; set; }
}
public decimal Amount { get; set; }
public string Currency { get; set; }
public string CurrencySymbol { get; set; }
public decimal Value { get; set; }
}

View File

@@ -1,22 +1,21 @@
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public class YProduct
{
public class YProduct
{
public string IntroPeriodDuration { get; set; }
public string StartPeriodDuration { get; set; }
public string CommonPeriodDuration { get; set; }
public string TrialPeriodDuration { get; set; }
public bool Debug { get; set; }
public int Duration { get; set; }
public bool Family { get; set; }
public string Feature { get; set; }
public List<string> Features { get; set; }
public bool Plus { get; set; }
public YPrice IntroPrice { get; set; }
public YPrice StartPrice { get; set; }
public YPrice Price { get; set; }
public string ProductId { get; set; }
public int TrialDuration { get; set; }
public YProductType Type { get; set; }
}
public string IntroPeriodDuration { get; set; }
public string StartPeriodDuration { get; set; }
public string CommonPeriodDuration { get; set; }
public string TrialPeriodDuration { get; set; }
public bool Debug { get; set; }
public int Duration { get; set; }
public bool Family { get; set; }
public string Feature { get; set; }
public List<string> Features { get; set; }
public bool Plus { get; set; }
public YPrice IntroPrice { get; set; }
public YPrice StartPrice { get; set; }
public YPrice Price { get; set; }
public string ProductId { get; set; }
public int TrialDuration { get; set; }
public YProductType Type { get; set; }
}

View File

@@ -1,7 +1,6 @@
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public enum YProductType
{
public enum YProductType
{
Subscription
}
Subscription
}

View File

@@ -1,8 +1,7 @@
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public class YProfile
{
public class YProfile
{
public List<string> Addresses { get; set; }
public string Provider { get; set; }
}
public List<string> Addresses { get; set; }
public string Provider { get; set; }
}

View File

@@ -1,7 +1,6 @@
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public class YReminder
{
public class YReminder
{
public int Days { get; set; }
}
public int Days { get; set; }
}

View File

@@ -1,12 +1,11 @@
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
/// <summary>
/// Модель ответа от API
/// </summary>
public class YResponse<T>
{
/// <summary>
/// Модель ответа от API
/// </summary>
public class YResponse<T>
{
public YInvocationInfo InvocationInfo { get; set; }
public T Result { get; set; }
public YPager Pager { get; set; }
}
public YInvocationInfo InvocationInfo { get; set; }
public T Result { get; set; }
public YPager Pager { get; set; }
}

View File

@@ -1,7 +1,6 @@
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public class YRevision
{
public class YRevision
{
public int Revision { get; set; }
}
public int Revision { get; set; }
}

View File

@@ -1,56 +1,55 @@
using System.Runtime.Serialization;
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
/// <summary>
/// Тип объекта поиска
/// </summary>
public enum YSearchType
{
/// <summary>
/// Тип объекта поиска
/// Отсутствует значение
/// </summary>
public enum YSearchType
{
/// <summary>
/// Отсутствует значение
/// </summary>
None,
None,
/// <summary>
/// Артисты
/// </summary>
Artist,
/// <summary>
/// Артисты
/// </summary>
Artist,
/// <summary>
/// Альбомы
/// </summary>
Album,
/// <summary>
/// Альбомы
/// </summary>
Album,
/// <summary>
/// Все
/// </summary>
All,
/// <summary>
/// Все
/// </summary>
All,
/// <summary>
/// Плейлисты
/// </summary>
Playlist,
/// <summary>
/// Плейлисты
/// </summary>
Playlist,
/// <summary>
/// Эпизод подкаста
/// </summary>
[EnumMember(Value = "podcast_episode")]
PodcastEpisode,
/// <summary>
/// Эпизод подкаста
/// </summary>
[EnumMember(Value = "podcast_episode")]
PodcastEpisode,
/// <summary>
/// Видео
/// </summary>
Video,
/// <summary>
/// Видео
/// </summary>
Video,
/// <summary>
/// Треки
/// </summary>
Track,
/// <summary>
/// Треки
/// </summary>
Track,
/// <summary>
/// Пользователи
/// </summary>
User
}
/// <summary>
/// Пользователи
/// </summary>
User
}

View File

@@ -1,8 +1,7 @@
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public enum YSortOrder
{
public enum YSortOrder
{
Asc,
Desc
}
Asc,
Desc
}

View File

@@ -1,8 +1,7 @@
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public class YStats
{
public class YStats
{
public int LastMonthListeners { get; set; }
public int LastMonthListenersDelta { get; set; }
}
public int LastMonthListeners { get; set; }
public int LastMonthListenersDelta { get; set; }
}

View File

@@ -1,10 +1,9 @@
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public class YStorageDownloadFile
{
public class YStorageDownloadFile
{
public string Host { get; set; }
public string Path { get; set; }
public string S { get; set; }
public string Ts { get; set; }
}
public string Host { get; set; }
public string Path { get; set; }
public string S { get; set; }
public string Ts { get; set; }
}

View File

@@ -1,9 +1,8 @@
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public class YStyle
{
public class YStyle
{
public string BgColor { get; set; }
public string BorderColor { get; set; }
public string TextColor { get; set; }
}
public string BgColor { get; set; }
public string BorderColor { get; set; }
public string TextColor { get; set; }
}

View File

@@ -1,12 +1,11 @@
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public class YSubscription
{
public class YSubscription
{
public List<YSubscriptionService> AutoRenewable { get; set; }
public bool CanStartTrial { get; set; }
public bool HadAnySubscription { get; set; }
public bool McDonalds { get; set; }
public YPeriod NonAutoRenewable { get; set; }
public YReminder NonAutoRenewableRemainder { get; set; }
}
public List<YSubscriptionService> AutoRenewable { get; set; }
public bool CanStartTrial { get; set; }
public bool HadAnySubscription { get; set; }
public bool McDonalds { get; set; }
public YPeriod NonAutoRenewable { get; set; }
public YReminder NonAutoRenewableRemainder { get; set; }
}

View File

@@ -1,13 +1,12 @@
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public class YSubscriptionService
{
public class YSubscriptionService
{
public DateTime Expires { get; set; }
public bool Finished { get; set; }
public decimal OrderId { get; set; }
public string ProductId { get; set; }
public YProduct Product { get; set; }
public string Vendor { get; set; }
public string VendorHelpUrl { get; set; }
}
public DateTime Expires { get; set; }
public bool Finished { get; set; }
public decimal OrderId { get; set; }
public string ProductId { get; set; }
public YProduct Product { get; set; }
public string Vendor { get; set; }
public string VendorHelpUrl { get; set; }
}

View File

@@ -1,8 +1,7 @@
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public class YTag
{
public class YTag
{
public string Id { get; set; }
public string Value { get; set; }
}
public string Id { get; set; }
public string Value { get; set; }
}

View File

@@ -1,12 +1,11 @@
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public class YTrackDownloadInfo
{
public class YTrackDownloadInfo
{
public int BitrateInKbps { get; set; }
public string Codec { get; set; }
public bool Direct { get; set; }
public string DownloadInfoUrl { get; set; }
public bool Gain { get; set; }
public bool Preview { get; set; }
}
public int BitrateInKbps { get; set; }
public string Codec { get; set; }
public bool Direct { get; set; }
public string DownloadInfoUrl { get; set; }
public bool Gain { get; set; }
public bool Preview { get; set; }
}

View File

@@ -1,10 +1,9 @@
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public class YTrackId
{
public class YTrackId
{
public string Id { get; set; }
public string TrackId { get; set; }
public string AlbumId { get; set; }
public string From { get; set; }
}
public string Id { get; set; }
public string TrackId { get; set; }
public string AlbumId { get; set; }
public string From { get; set; }
}

View File

@@ -1,12 +1,11 @@
using System.Runtime.Serialization;
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public enum YTrackSharingFlag
{
public enum YTrackSharingFlag
{
[EnumMember(Value = "VIDEO_ALLOWED")]
VideoAllowed,
[EnumMember(Value = "COVER_ONLY")]
CoverOnly
}
[EnumMember(Value = "VIDEO_ALLOWED")]
VideoAllowed,
[EnumMember(Value = "COVER_ONLY")]
CoverOnly
}

View File

@@ -1,18 +1,17 @@
using System.ComponentModel;
using System.Runtime.Serialization;
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public enum YTrackSource
{
public enum YTrackSource
{
[EnumMember(Value = "OWN")]
Own,
[EnumMember(Value = "OWN")]
Own,
[EnumMember(Value = "UGC")]
[Description("User Generated Content")]
UGC,
[EnumMember(Value = "UGC")]
[Description("User Generated Content")]
UGC,
[EnumMember(Value = "OWN_REPLACED_TO_UGC")]
OwnReplacedToUGC,
}
[EnumMember(Value = "OWN_REPLACED_TO_UGC")]
OwnReplacedToUGC,
}

View File

@@ -1,7 +1,6 @@
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public class YTrailer
{
public class YTrailer
{
public bool Available { get; set; }
}
public bool Available { get; set; }
}

View File

@@ -1,17 +1,16 @@
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public class YUser
{
public class YUser
{
public string DeviceId { get; set; }
public string Experiments { get; set; }
public string FirstName { get; set; }
public string Lang { get; set; }
public string Login { get; set; }
public string Name { get; set; }
public string SecondName { get; set; }
public string Sign { get; set; }
public long Timestamp { get; set; }
public string Uid { get; set; }
public string YandexId { get; set; }
}
public string DeviceId { get; set; }
public string Experiments { get; set; }
public string FirstName { get; set; }
public string Lang { get; set; }
public string Login { get; set; }
public string Name { get; set; }
public string SecondName { get; set; }
public string Sign { get; set; }
public long Timestamp { get; set; }
public string Uid { get; set; }
public string YandexId { get; set; }
}

View File

@@ -1,11 +1,10 @@
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public class YVideo
{
public class YVideo
{
public string Cover { get; set; }
public string EmbedUrl { get; set; }
public string Provider { get; set; }
public string ProviderVideoId { get; set; }
public string Title { get; set; }
}
public string Cover { get; set; }
public string EmbedUrl { get; set; }
public string Provider { get; set; }
public string ProviderVideoId { get; set; }
public string Title { get; set; }
}

View File

@@ -1,14 +1,13 @@
namespace YandexMusic.API.Models.Common
namespace YandexMusic.API.Models.Common;
public class YVinyl
{
public class YVinyl
{
public List<string> ArtistIds { get; set; }
public string Media { get; set; }
public string OfferId { get; set; }
public string Picture { get; set; }
public decimal Price { get; set; }
public string Title { get; set; }
public string Url { get; set; }
public int Year { get; set; }
}
public List<string> ArtistIds { get; set; }
public string Media { get; set; }
public string OfferId { get; set; }
public string Picture { get; set; }
public decimal Price { get; set; }
public string Title { get; set; }
public string Url { get; set; }
public int Year { get; set; }
}