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

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,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; }
}
}