Добавьте файлы проекта.

This commit is contained in:
FrigaT
2026-04-10 12:12:33 +03:00
parent 9615cf42ee
commit 11d0b0d72f
383 changed files with 9661 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
namespace YandexMusic.API.Models.Account
{
public class YAccessToken
{
[JsonProperty("status")]
public string Status { get; set; }
[JsonProperty("access_token")]
public string AccessToken { get; set; }
[JsonProperty("expires_in")]
public string Expires { get; set; }
[JsonProperty("token_type")]
public string TokenType { get; set; }
public string Uid { get; set; }
}
}

View File

@@ -0,0 +1,25 @@
using YandexMusic.API.Models.Common;
namespace YandexMusic.API.Models.Account
{
public class YAccount
{
public bool Child { get; set; }
public string Birthday { get; set; }
public string DisplayName { get; set; }
public string FirstName { get; set; }
public string FullName { get; set; }
public bool HostedUser { get; set; }
public string Login { get; set; }
public bool NonOwnerFamilyMember { get; set; }
public DateTime Now { get; set; }
[JsonProperty("passport-phones")]
public List<YPhone> PassportPhones { get; set; }
public int Region { get; set; }
public string RegionCode { get; set; }
public DateTime RegisteredAt { get; set; }
public string SecondName { get; set; }
public bool ServiceAvailable { get; set; }
public string Uid { get; set; }
}
}

View File

@@ -0,0 +1,26 @@
using YandexMusic.API.Models.Common;
namespace YandexMusic.API.Models.Account
{
public class YAccountResult
{
public YAccount Account { get; set; }
public string DefaultEmail { get; set; }
public List<string> HasOptions { get; set; }
public YMasterHub MasterHub { get; set; }
public YPermissions Permissions { get; set; }
public YPlus Plus { get; set; }
public bool PretrialActive { get; set; }
public bool SubEditor { get; set; }
public int SubEditorLevel { get; set; }
public YSubscription Subscription { get; set; }
public YBar BarBelow { get; set; }
// Повторяющееся свойство с другим названием
[JsonProperty("bar-below")]
private YBar BarBelow2
{
set => BarBelow = value;
}
public string Userhash { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
namespace YandexMusic.API.Models.Account
{
public class YAuthBase
{
public YAuthStatus Status { get; set; }
[JsonProperty("redirect_url")]
public string RedirectUrl { get; set; }
public List<YAuthError> Errors { get; set; }
}
}

View File

@@ -0,0 +1,28 @@
namespace YandexMusic.API.Models.Account
{
public class YAuthCaptcha : YAuthBase
{
public string Id { get; set; }
public string Name { get; set; }
public string Label { get; set; }
public string Mode { get; set; }
public List<YAuthCaptchaError> Error { get; set; }
public bool CountryFromAudioWhiteList { get; set; }
public YAuthCaptchaOptions Options { get; set; }
public YAuthCaptchaVoice Voice { get; set; }
[JsonProperty("image_url")]
public string ImageUrl { get; set; }
public string Key { get; set; }
public string Static { get; set; }
}
}

View File

@@ -0,0 +1,8 @@
namespace YandexMusic.API.Models.Account
{
public class YAuthCaptchaError
{
public string Message { get; set; }
public YAuthCaptchaErrorCode Code { get; set; }
}
}

View File

@@ -0,0 +1,9 @@
namespace YandexMusic.API.Models.Account
{
public enum YAuthCaptchaErrorCode
{
MissingValue,
CaptchaLocate,
Incorrect
}
}

View File

@@ -0,0 +1,7 @@
namespace YandexMusic.API.Models.Account
{
public class YAuthCaptchaOptions
{
public bool AsyncCheck { get; set; }
}
}

View File

@@ -0,0 +1,10 @@
namespace YandexMusic.API.Models.Account
{
public class YAuthCaptchaVoice
{
public string Url { get; set; }
[JsonProperty("intro_url")]
public string IntroUrl { get; set; }
}
}

View File

@@ -0,0 +1,22 @@
using System.Runtime.Serialization;
namespace YandexMusic.API.Models.Account
{
public enum YAuthError
{
[EnumMember(Value = "authorization.invalid")]
AuthorizationInvalid,
[EnumMember(Value = "sessionid.invalid")]
SessionIdInvalid,
[EnumMember(Value = "password.not_matched")]
PasswordNotMatched,
[EnumMember(Value = "password.empty")]
PasswordEmpty,
[EnumMember(Value = "captcha.required")]
CaptchaRequired,
[EnumMember(Value = "captcha.not_matched")]
CaptchaNotMatched,
[EnumMember(Value = "oauth_token.invalid")]
OAuthTokenInvalid
}
}

View File

@@ -0,0 +1,9 @@
namespace YandexMusic.API.Models.Account
{
public class YAuthLetter : YAuthBase
{
public List<string> Code { get; set; }
public string Id { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
namespace YandexMusic.API.Models.Account
{
public class YAuthLetterStatus : YAuthBase
{
[JsonProperty("magic_link_confirmed")]
public bool MagicLinkConfirmed { get; set; }
[JsonProperty("track_id")]
public string TrackId { get; set; }
}
}

View File

@@ -0,0 +1,22 @@
using System.Runtime.Serialization;
namespace YandexMusic.API.Models.Account
{
public enum YAuthMethod
{
Password,
[EnumMember(Value = "magic_x_token")]
MagicToken,
[EnumMember(Value = "magic_x_token_with_pictures")]
MagicTokenWithPictures,
[EnumMember(Value = "magic_link")]
MagicLink,
Magic,
Otp,
[EnumMember(Value = "social_gg")]
Social,
WebAuthN,
[EnumMember(Value = "sms_code")]
SmsCode
}
}

View File

@@ -0,0 +1,11 @@
namespace YandexMusic.API.Models.Account
{
public class YAuthQR : YAuthBase
{
[JsonProperty("track_id")]
public string TrackId { get; set; }
[JsonProperty("csrf_token")]
public string CsrfToken { get; set; }
}
}

View File

@@ -0,0 +1,19 @@
namespace YandexMusic.API.Models.Account
{
public class YAuthQRStatus : YAuthBase
{
[JsonProperty("default_uid")]
public int DefaultUid { get; set; }
public string RetPath { get; set; }
[JsonProperty("track_id")]
public string TrackId { get; set; }
public string Id { get; set; }
public string State { get; set; }
public YAuthCaptcha Captcha { get; set; }
}
}

View File

@@ -0,0 +1,8 @@
namespace YandexMusic.API.Models.Account
{
public enum YAuthStatus
{
Ok,
Error
}
}

View File

@@ -0,0 +1,11 @@
namespace YandexMusic.API.Models.Account
{
public class YAuthToken
{
[JsonProperty("csfr_token")]
public string CsfrToken { get; set; }
[JsonProperty("track_id")]
public string TrackId { get; set; }
}
}

View File

@@ -0,0 +1,47 @@
namespace YandexMusic.API.Models.Account
{
public class YAuthTypes : YAuthBase
{
[JsonProperty("primary_alias_type")]
public string PrimaryAliasType { get; set; }
[JsonProperty("csrf_token")]
public string CsrfToken { get; set; }
public string LocCsrf { get; set; }
[JsonProperty("use_new_suggest_by_phone")]
public bool UseNewSuggestByPhone { get; set; }
[JsonProperty("is_rfc_2fa_enabled")]
public bool IsRfc2faEnabled { get; set; }
[JsonProperty("track_id")]
public string TrackId { get; set; }
[JsonProperty("can_authorize")]
public string CanAuthorize { get; set; }
[JsonProperty("preferred_auth_method")]
public YAuthMethod PreferredAuthMethod { get; set; }
[JsonProperty("auth_methods")]
public List<YAuthMethod> AuthMethods { get; set; }
[JsonProperty("can_register")]
public bool CanRegister { get; set; }
[JsonProperty("location_id")]
public string LocationId { get; set; }
public string Country { get; set; }
[JsonProperty("phone_number")]
public YPhoneNumber PhoneNumberNumber { get; set; }
[JsonProperty("magic_link_email")]
public string MagicLinkEmail { get; set; }
public string TractorTargetLocationHost { get; set; }
}
}

View File

@@ -0,0 +1,14 @@
using YandexMusic.API.Models.Common;
namespace YandexMusic.API.Models.Account
{
public class YBar : YStyle
{
public string AlertId { get; set; }
public string Text { get; set; }
public string AlertType { get; set; }
public YButton Button { get; set; }
public bool CloseButton { get; set; }
public YCloseButtonStyles CloseButtonStyles { get; set; }
}
}

View File

@@ -0,0 +1,31 @@
namespace YandexMusic.API.Models.Account
{
public class YLoginInfo
{
public string Id { get; set; }
public string Login { get; set; }
[JsonProperty("client_id")]
public string ClientId { get; set; }
[JsonProperty("display_name")]
public string DisplayName { get; set; }
[JsonProperty("real_name")]
public string RealName { get; set; }
[JsonProperty("first_name")]
public string FirstName { get; set; }
[JsonProperty("last_name")]
public string LastName { get; set; }
public string Sex { get; set; }
[JsonProperty("default_email")]
public string DefaultEmail { get; set; }
public List<string> Emails { get; set; }
public string Birthday { get; set; }
[JsonProperty("default_avatar_id")]
public string DefaultAvatarId { get; set; }
public string AvatarUrl => $"https://avatars.mds.yandex.net/get-yapic/{DefaultAvatarId}/islands-200";
[JsonProperty("is_avatar_empty")]
public bool IsAvatarEmpty { get; set; }
public string PsuId { get; set; }
}
}

View File

@@ -0,0 +1,20 @@
namespace YandexMusic.API.Models.Account
{
public class YPhoneNumber
{
[JsonProperty("masked_e164")]
public string MaskedE164 { get; set; }
public string E164 { get; set; }
public string International { get; set; }
[JsonProperty("masked_original")]
public string MaskedOriginal { get; set; }
public string Original { get; set; }
[JsonProperty("masked_international")]
public string MaskedInternational { get; set; }
}
}

View File

@@ -0,0 +1,81 @@
namespace YandexMusic.API.Models.Account
{
public class YShortAccountInfo : YAuthBase
{
[JsonProperty("public_id")]
public string PublicId { get; set; }
public string Uid { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string Birthday { get; set; }
[JsonProperty("has_password")]
public bool HasPassword { get; set; }
public List<string> Partitions { get; set; }
[JsonProperty("primary_alias_type")]
public int PrimaryAliasType { get; set; }
[JsonProperty("display_name")]
public string DisplayName { get; set; }
[JsonProperty("normalized_display_login")]
public string NormalizedDisplayLogin { get; set; }
[JsonProperty("x_token_issued_at")]
public int XTokenIssuedAt { get; set; }
[JsonProperty("display_login")]
public string DisplayLogin { get; set; }
[JsonProperty("public_name")]
public string PublicName { get; set; }
[JsonProperty("avatar_url")]
public string AvatarUrl { get; set; }
[JsonProperty("native_default_email")]
public string NativeDefaultEmail { get; set; }
[JsonProperty("has_plus")]
public bool HasPlus { get; set; }
[JsonProperty("location_id")]
public int LocationId { get; set; }
[JsonProperty("gender")]
public string Gender { get; set; }
[JsonProperty("is_avatar_empty")]
public bool IsAvatarEmpty { get; set; }
[JsonProperty("machine_readable_login")]
public string MachineReadableLogin { get; set; }
[JsonProperty("has_cards")]
public bool HasCards { get; set; }
[JsonProperty("has_family")]
public bool HasFamily { get; set; }
[JsonProperty("picture_login_forbidden")]
public bool PictureLoginForbidden { get; set; }
[JsonProperty("can_account_join_master")]
public bool CanAccountJoinMaster { get; set; }
[JsonProperty("secure_phone_number")]
public string SecurePhoneNumber { get; set; }
[JsonProperty("x_token_client_id")]
public string XTokenClientId { get; set; }
[JsonProperty("x_token_need_reset")]
public bool XTokenNeedReset { get; set; }
}
}

View File

@@ -0,0 +1,98 @@
using YandexMusic.API.Models.Artist;
using YandexMusic.API.Models.Common;
using YandexMusic.API.Models.Common.Cover;
using YandexMusic.API.Models.Track;
namespace YandexMusic.API.Models.Album
{
public sealed class YLabelConverter : JsonConverter
{
public override bool CanConvert(Type objectType)
{
throw new NotImplementedException();
}
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if (reader.TokenType == JsonToken.Null)
return null;
JArray jArray = JArray.Load(reader);
JTokenType tokenType = jArray.FirstOrDefault()?.Type ?? JTokenType.String;
object label;
try
{
label = tokenType switch
{
JTokenType.Object => jArray.ToObject<List<YLabel>>(),
_ => jArray.ToObject<List<string>>()
};
}
catch (Exception ex)
{
throw new Exception($"Ошибка десериализации типа \"{objectType.Name}\".", ex);
}
return label;
}
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
JArray array = JArray.FromObject(value);
array.WriteTo(writer);
}
}
public class YAlbum : YBaseModel
{
public YButton ActionButton { get; set; }
public List<YArtist> Artists { get; set; }
public bool Available { get; set; }
public bool AvailableForMobile { get; set; }
public List<string> AvailableForOptions { get; set; }
public bool AvailableForPremiumUsers { get; set; }
public bool AvailablePartially { get; set; }
public string BackgroundImageUrl { get; set; }
public string BackgroundVideoUrl { get; set; }
public List<string> Bests { get; set; }
public List<string> Buy { get; set; }
public bool ChildContent { get; set; }
public string ContentWarning { get; set; }
public string CoverUri { get; set; }
[JsonConverter(typeof(YCoverConverter))]
public YCover Cover { get; set; }
public YCustomWave CustomWave { get; set; }
public YDerivedColors DerivedColors { get; set; }
public string Description { get; set; }
public List<string> Disclaimers { get; set; }
public List<YAlbum> Duplicates { get; set; }
public bool HasTrailer { get; set; }
public string Genre { get; set; }
public string Id { get; set; }
[JsonConverter(typeof(YLabelConverter))]
public dynamic Labels { get; set; }
public int LikesCount { get; set; }
public bool ListeningFinished { get; set; }
public string MetaTagId { get; set; }
public YMetaType MetaType { get; set; }
public string OgImage { get; set; }
public YPager Pager { get; set; }
public List<YPrerolls> Prerolls { get; set; }
public bool Recent { get; set; }
public DateTime ReleaseDate { get; set; }
public string ShortDescription { get; set; }
public YSortOrder SortOrder { get; set; }
public string StorageDir { get; set; }
public string Title { get; set; }
public int TrackCount { get; set; }
public YTrackPosition TrackPosition { get; set; }
public YTrailer Trailer { get; set; }
public string Type { get; set; }
public string Version { get; set; }
public bool VeryImportant { get; set; }
public List<List<YTrack>> Volumes { get; set; }
public int Year { get; set; }
}
}

View File

@@ -0,0 +1,41 @@
using YandexMusic.API.Models.Common;
using YandexMusic.API.Models.Common.Cover;
namespace YandexMusic.API.Models.Artist
{
public class YArtist : YBaseModel
{
public YButton ActionButton { get; set; }
public bool Available { get; set; }
public bool Composer { get; set; }
public List<string> Countries { get; set; }
public YArtistCounts Counts { get; set; }
[JsonConverter(typeof(YCoverConverter))]
public YCover Cover { get; set; }
public List<string> DbAliases { get; set; }
#warning Непонятная коллекция с содержимым разных типов
public List<object> Decomposed { get; set; }
public YDerivedColors DerivedColors { get; set; }
public YDescription Description { get; set; }
public YDeprecation Deprecation { get; set; }
public List<string> Disclaimers { get; set; }
public string EndDate { get; set; }
public string EnWikipediaLink { get; set; }
public List<YExtraAction> ExtraActions { get; set; }
public List<string> Genres { get; set; }
public string Id { get; set; }
public string InitDate { get; set; }
public int LikesCount { get; set; }
public List<YLink> Links { get; set; }
public string Name { get; set; }
public bool NoPicturesFromSearch { get; set; }
public string OgImage { get; set; }
public YArtistRatings Ratings { get; set; }
public bool TicketsAvailable { get; set; }
public DateTime Timestamp { get; set; }
public bool Various { get; set; }
public string YaMoneyId { get; set; }
public bool HasTrailer { get; set; }
public YTrailer Trailer { get; set; }
}
}

View File

@@ -0,0 +1,36 @@
using YandexMusic.API.Models.Album;
using YandexMusic.API.Models.Common;
using YandexMusic.API.Models.Common.Cover;
using YandexMusic.API.Models.Playlist;
using YandexMusic.API.Models.Track;
namespace YandexMusic.API.Models.Artist
{
public class YArtistBriefInfo
{
public YButton ActionButton { get; set; }
public List<YAlbum> Albums { get; set; }
[JsonProperty(ItemConverterType = typeof(YCoverConverter))]
public List<YCover> AllCovers { get; set; }
public List<YAlbum> AlsoAlbums { get; set; }
public YArtist Artist { get; set; }
public string BackgroundVideoUrl { get; set; }
public YBandlinkScannerLink BandlinkScannerLink { get; set; }
public List<YClip> Clips { get; set; }
public List<YConcert> Concerts { get; set; }
public YCustomWave CustomWave { get; set; }
public List<YExtraAction> ExtraActions { get; set; }
public bool HasPromotions { get; set; }
public bool HasTrailer { get; set; }
public List<string> LastReleaseIds { get; set; }
public List<YAlbum> LastReleases { get; set; }
public List<YPlaylistUidPair> PlaylistIds { get; set; }
public List<YPlaylist> Playlists { get; set; }
public List<YTrack> PopularTracks { get; set; }
public List<YArtist> SimilarArtists { get; set; }
public YStats Stats { get; set; }
public List<YVideo> Videos { get; set; }
public List<YVinyl> Vinyls { get; set; }
public List<YLink> Links { get; set; }
}
}

View File

@@ -0,0 +1,10 @@
namespace YandexMusic.API.Models.Artist
{
public class YArtistCounts
{
public int AlsoAlbums { get; set; }
public int AlsoTracks { get; set; }
public int DirectAlbums { get; set; }
public int Tracks { get; set; }
}
}

View File

@@ -0,0 +1,9 @@
namespace YandexMusic.API.Models.Artist
{
public class YArtistRatings
{
public int Day { get; set; }
public int Month { get; set; }
public int Week { get; set; }
}
}

View File

@@ -0,0 +1,10 @@
namespace YandexMusic.API.Models.Artist
{
public class YBandlinkScannerLink
{
public string Title { get; set; }
public string Subtitle { get; set; }
public string Url { get; set; }
public string ImgUrl { get; set; }
}
}

View File

@@ -0,0 +1,29 @@
using YandexMusic.API.Models.Common;
namespace YandexMusic.API.Models.Artist
{
public class YConcert
{
public string Address { get; set; }
public string AfishaUrl { get; set; }
public YArtist Artist { get; set; }
public string City { get; set; }
public string ConcertTitle { get; set; }
public string ContentRating { get; set; }
public List<decimal> Coordinates { get; set; }
public YCashback Cashback { get; set; }
[JsonProperty("data-session-id")]
public string DataSessionId { get; set; }
public DateTime DateTime { get; set; }
public string Hash { get; set; }
public string Id { get; set; }
public List<string> Images { get; set; }
public string ImageUrl { get; set; }
public string Map { get; set; }
public string MapUrl { get; set; }
[JsonProperty("metro-stations")]
public List<YMetroStation> MetroStations { get; set; }
public string Place { get; set; }
public YPrice MinPrice { get; set; }
}
}

View File

@@ -0,0 +1,7 @@
namespace YandexMusic.API.Models.Artist
{
public class YDeprecation
{
public string TargetArtistId { get; set; }
}
}

View File

@@ -0,0 +1,9 @@
namespace YandexMusic.API.Models.Artist
{
public class YMetroStation
{
[JsonProperty("line-color")]
public string LineColor { get; set; }
public string Title { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
using YandexMusic.API.Models.Common;
using YandexMusic.API.Models.Track;
namespace YandexMusic.API.Models.Artist
{
public class YTracksPage
{
public YPager Pager { get; set; }
public List<YTrack> Tracks { get; set; }
}
}

View File

@@ -0,0 +1,71 @@
namespace YandexMusic.API.Models.Common.Cover
{
public sealed class YCoverConverter : JsonConverter
{
public override bool CanConvert(Type objectType)
{
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);
}
}
public class YCover
{
public YCoverType Type { get; set; }
}
}

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,11 @@
namespace YandexMusic.API.Models.Common.Cover
{
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; }
}
}

View File

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

View File

@@ -0,0 +1,8 @@
namespace YandexMusic.API.Models.Common
{
public class YBaseModel
{
[JsonIgnore]
public YExecutionContext Context { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
namespace YandexMusic.API.Models.Common
{
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; }
}
}

View File

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

View File

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

View File

@@ -0,0 +1,19 @@
using YandexMusic.API.Models.Artist;
namespace YandexMusic.API.Models.Common
{
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; }
}
}

View File

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

View File

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

View File

@@ -0,0 +1,11 @@
namespace YandexMusic.API.Models.Common
{
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; }
}
}

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,57 @@
using YandexMusic.API.Common;
namespace YandexMusic.API.Models.Common
{
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; }
}
}

View File

@@ -0,0 +1,11 @@
namespace YandexMusic.API.Models.Common
{
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; }
}
}

View File

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

View File

@@ -0,0 +1,13 @@
namespace YandexMusic.API.Models.Common
{
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; }
}
}

View File

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

View File

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

View File

@@ -0,0 +1,13 @@
namespace YandexMusic.API.Models.Common
{
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; }
}
}

View File

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

View File

@@ -0,0 +1,12 @@
namespace YandexMusic.API.Models.Common
{
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; }
}
}

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,11 @@
namespace YandexMusic.API.Models.Common
{
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; }
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,22 @@
namespace YandexMusic.API.Models.Common
{
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; }
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,12 @@
namespace YandexMusic.API.Models.Common
{
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; }
}
}

View File

@@ -0,0 +1,13 @@
namespace YandexMusic.API.Models.Common
{
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; }
}
}

View File

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

View File

@@ -0,0 +1,12 @@
namespace YandexMusic.API.Models.Common
{
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; }
}
}

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,17 @@
namespace YandexMusic.API.Models.Common
{
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; }
}
}

View File

@@ -0,0 +1,11 @@
namespace YandexMusic.API.Models.Common
{
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; }
}
}

View File

@@ -0,0 +1,14 @@
namespace YandexMusic.API.Models.Common
{
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; }
}
}

View File

@@ -0,0 +1,10 @@
using YandexMusic.API.Models.Artist;
namespace YandexMusic.API.Models.Feed.Event
{
public class YArtistsFromHistory
{
public YArtist Artist { get; set; }
public List<YArtist> ArtistsFromHistory { get; set; }
}
}

View File

@@ -0,0 +1,104 @@
namespace YandexMusic.API.Models.Feed.Event
{
public sealed class YFeedEventConverter : JsonConverter
{
private YFeedEventTitled GetEvent(JToken jObject)
{
YFeedEventTitled feedEvent;
YFeedEventType type = jObject[jObject["typeForFrom"] != null ? "typeForFrom" : "type"]
.ToObject<YFeedEventType>();
switch (type)
{
case YFeedEventType.GenreTop:
feedEvent = jObject.ToObject<YFeedEventGenreTracksTop>();
break;
case YFeedEventType.NewAlbums:
feedEvent = jObject.ToObject<YFeedEventAlbums>();
break;
case YFeedEventType.NewAlbumsOfFavoriteGenre:
feedEvent = jObject.ToObject<YFeedEventGenreAlbums>();
break;
case YFeedEventType.Notification:
feedEvent = jObject.ToObject<YFeedEventNotification>();
break;
case YFeedEventType.Promotion:
feedEvent = jObject.ToObject<YFeedEventPromotion>();
break;
case YFeedEventType.RecentTrackLikeToTracks:
feedEvent = jObject.ToObject<YFeedEventLikeTrack>();
break;
case YFeedEventType.RecommendedArtistsWithArtistsFromHistory:
feedEvent = jObject.ToObject<YFeedEventArtistWithArtists>();
break;
case YFeedEventType.RecommendedSimilarArtists:
feedEvent = jObject.ToObject<YFeedEventSimilarArtists>();
break;
case YFeedEventType.RecommendedSimilarGenre:
feedEvent = jObject.ToObject<YFeedEventSimilarGenre>();
break;
case YFeedEventType.MissedTracksByArtist:
case YFeedEventType.RareArtist:
case YFeedEventType.RecommendedTracksByArtistFromHistory:
feedEvent = jObject.ToObject<YFeedEventArtist>();
break;
case YFeedEventType.NewTracksOfFavoriteGenre:
case YFeedEventType.TracksByGenre:
feedEvent = jObject.ToObject<YFeedEventGenreTracks>();
break;
case YFeedEventType.WellForgottenOldArtists:
feedEvent = jObject.ToObject<YFeedEventArtists>();
break;
case YFeedEventType.NeverHeardFromLibrary:
case YFeedEventType.WellForgottenOldTracks:
feedEvent = jObject.ToObject<YFeedEventTracks>();
break;
default:
feedEvent = jObject.ToObject<YFeedEventTitled>();
break;
}
return feedEvent;
}
public override bool CanConvert(Type objectType)
{
return typeof(YFeedEventTitled).IsAssignableFrom(objectType);
}
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if (reader.TokenType == JsonToken.Null)
return null;
return JArray.Load(reader)
.Select(GetEvent)
.ToList();
}
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
throw new NotImplementedException();
}
}
public class YFeedEvent
{
public string Id { get; set; }
public YFeedEventType Type { get; set; }
}
}

View File

@@ -0,0 +1,9 @@
using YandexMusic.API.Models.Album;
namespace YandexMusic.API.Models.Feed.Event
{
public class YFeedEventAlbums : YFeedEventTitled
{
public List<YAlbum> Albums { get; set; }
}
}

View File

@@ -0,0 +1,9 @@
using YandexMusic.API.Models.Artist;
namespace YandexMusic.API.Models.Feed.Event
{
public class YFeedEventArtist : YFeedEventTracks
{
public YArtist Artist { get; set; }
}
}

View File

@@ -0,0 +1,7 @@
namespace YandexMusic.API.Models.Feed.Event
{
public class YFeedEventArtistWithArtists : YFeedEventTitled
{
public List<YArtistsFromHistory> ArtistsWithArtistsFromHistory { get; set; }
}
}

Some files were not shown because too many files have changed in this diff Show More