Обнновлено до .net10
This commit is contained in:
@@ -1,15 +1,20 @@
|
||||
namespace YandexMusic.API.Models.Account
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace YandexMusic.API.Models.Account;
|
||||
|
||||
public class YAccessToken
|
||||
{
|
||||
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; }
|
||||
}
|
||||
[JsonPropertyName("status")]
|
||||
public string Status { get; set; }
|
||||
|
||||
[JsonPropertyName("access_token")]
|
||||
public string AccessToken { get; set; }
|
||||
|
||||
[JsonPropertyName("expires_in")]
|
||||
public string Expires { get; set; }
|
||||
|
||||
[JsonPropertyName("token_type")]
|
||||
public string TokenType { get; set; }
|
||||
|
||||
public string Uid { get; set; }
|
||||
}
|
||||
|
||||
@@ -1,25 +1,40 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using YandexMusic.API.Models.Common;
|
||||
|
||||
namespace YandexMusic.API.Models.Account
|
||||
namespace YandexMusic.API.Models.Account;
|
||||
|
||||
public class YAccount
|
||||
{
|
||||
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; }
|
||||
}
|
||||
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; }
|
||||
|
||||
[JsonPropertyName("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; }
|
||||
}
|
||||
@@ -1,26 +1,37 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using YandexMusic.API.Models.Common;
|
||||
|
||||
namespace YandexMusic.API.Models.Account
|
||||
namespace YandexMusic.API.Models.Account;
|
||||
|
||||
public class YAccountResult
|
||||
{
|
||||
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; }
|
||||
|
||||
[JsonPropertyName("bar-below")]
|
||||
private YBar BarBelow2
|
||||
{
|
||||
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; }
|
||||
set => BarBelow = value;
|
||||
}
|
||||
|
||||
public string Userhash { get; set; }
|
||||
}
|
||||
@@ -1,12 +1,13 @@
|
||||
namespace YandexMusic.API.Models.Account
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace YandexMusic.API.Models.Account;
|
||||
|
||||
public class YAuthBase
|
||||
{
|
||||
public class YAuthBase
|
||||
{
|
||||
public YAuthStatus Status { get; set; }
|
||||
public YAuthStatus Status { get; set; }
|
||||
|
||||
[JsonProperty("redirect_url")]
|
||||
public string RedirectUrl { get; set; }
|
||||
[JsonPropertyName("redirect_url")]
|
||||
public string RedirectUrl { get; set; }
|
||||
|
||||
public List<YAuthError> Errors { get; set; }
|
||||
}
|
||||
public List<YAuthError> Errors { get; set; }
|
||||
}
|
||||
|
||||
@@ -1,28 +1,29 @@
|
||||
namespace YandexMusic.API.Models.Account
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace YandexMusic.API.Models.Account;
|
||||
|
||||
public class YAuthCaptcha : YAuthBase
|
||||
{
|
||||
public class YAuthCaptcha : YAuthBase
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public string Id { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
public string Name { get; set; }
|
||||
|
||||
public string Label { get; set; }
|
||||
public string Label { get; set; }
|
||||
|
||||
public string Mode { get; set; }
|
||||
public string Mode { get; set; }
|
||||
|
||||
public List<YAuthCaptchaError> Error { get; set; }
|
||||
public List<YAuthCaptchaError> Error { get; set; }
|
||||
|
||||
public bool CountryFromAudioWhiteList { get; set; }
|
||||
public bool CountryFromAudioWhiteList { get; set; }
|
||||
|
||||
public YAuthCaptchaOptions Options { get; set; }
|
||||
public YAuthCaptchaOptions Options { get; set; }
|
||||
|
||||
public YAuthCaptchaVoice Voice { get; set; }
|
||||
public YAuthCaptchaVoice Voice { get; set; }
|
||||
|
||||
[JsonProperty("image_url")]
|
||||
public string ImageUrl { get; set; }
|
||||
[JsonPropertyName("image_url")]
|
||||
public string ImageUrl { get; set; }
|
||||
|
||||
public string Key { get; set; }
|
||||
public string Key { get; set; }
|
||||
|
||||
public string Static { get; set; }
|
||||
}
|
||||
public string Static { get; set; }
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
namespace YandexMusic.API.Models.Account
|
||||
namespace YandexMusic.API.Models.Account;
|
||||
|
||||
public class YAuthCaptchaError
|
||||
{
|
||||
public class YAuthCaptchaError
|
||||
{
|
||||
public string Message { get; set; }
|
||||
public YAuthCaptchaErrorCode Code { get; set; }
|
||||
}
|
||||
public string Message { get; set; }
|
||||
public YAuthCaptchaErrorCode Code { get; set; }
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
namespace YandexMusic.API.Models.Account
|
||||
namespace YandexMusic.API.Models.Account;
|
||||
|
||||
public enum YAuthCaptchaErrorCode
|
||||
{
|
||||
public enum YAuthCaptchaErrorCode
|
||||
{
|
||||
MissingValue,
|
||||
CaptchaLocate,
|
||||
Incorrect
|
||||
}
|
||||
MissingValue,
|
||||
CaptchaLocate,
|
||||
Incorrect
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
namespace YandexMusic.API.Models.Account
|
||||
namespace YandexMusic.API.Models.Account;
|
||||
|
||||
public class YAuthCaptchaOptions
|
||||
{
|
||||
public class YAuthCaptchaOptions
|
||||
{
|
||||
public bool AsyncCheck { get; set; }
|
||||
}
|
||||
public bool AsyncCheck { get; set; }
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
namespace YandexMusic.API.Models.Account
|
||||
{
|
||||
public class YAuthCaptchaVoice
|
||||
{
|
||||
public string Url { get; set; }
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
[JsonProperty("intro_url")]
|
||||
public string IntroUrl { get; set; }
|
||||
}
|
||||
namespace YandexMusic.API.Models.Account;
|
||||
|
||||
public class YAuthCaptchaVoice
|
||||
{
|
||||
public string Url { get; set; }
|
||||
|
||||
[JsonPropertyName("intro_url")]
|
||||
public string IntroUrl { get; set; }
|
||||
}
|
||||
@@ -1,22 +1,27 @@
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace YandexMusic.API.Models.Account
|
||||
namespace YandexMusic.API.Models.Account;
|
||||
|
||||
public enum YAuthError
|
||||
{
|
||||
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
|
||||
}
|
||||
[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,
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
namespace YandexMusic.API.Models.Account
|
||||
{
|
||||
public class YAuthLetter : YAuthBase
|
||||
{
|
||||
public List<string> Code { get; set; }
|
||||
namespace YandexMusic.API.Models.Account;
|
||||
|
||||
public string Id { get; set; }
|
||||
}
|
||||
public class YAuthLetter : YAuthBase
|
||||
{
|
||||
public List<string> Code { get; set; }
|
||||
|
||||
public string Id { get; set; }
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
namespace YandexMusic.API.Models.Account
|
||||
{
|
||||
public class YAuthLetterStatus : YAuthBase
|
||||
{
|
||||
[JsonProperty("magic_link_confirmed")]
|
||||
public bool MagicLinkConfirmed { get; set; }
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
[JsonProperty("track_id")]
|
||||
public string TrackId { get; set; }
|
||||
}
|
||||
namespace YandexMusic.API.Models.Account;
|
||||
|
||||
public class YAuthLetterStatus : YAuthBase
|
||||
{
|
||||
[JsonPropertyName("magic_link_confirmed")]
|
||||
public bool MagicLinkConfirmed { get; set; }
|
||||
|
||||
[JsonPropertyName("track_id")]
|
||||
public string TrackId { get; set; }
|
||||
}
|
||||
@@ -1,22 +1,29 @@
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace YandexMusic.API.Models.Account
|
||||
namespace YandexMusic.API.Models.Account;
|
||||
|
||||
public enum YAuthMethod
|
||||
{
|
||||
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
|
||||
}
|
||||
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,
|
||||
}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
namespace YandexMusic.API.Models.Account
|
||||
{
|
||||
public class YAuthQR : YAuthBase
|
||||
{
|
||||
[JsonProperty("track_id")]
|
||||
public string TrackId { get; set; }
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
[JsonProperty("csrf_token")]
|
||||
public string CsrfToken { get; set; }
|
||||
}
|
||||
namespace YandexMusic.API.Models.Account;
|
||||
|
||||
public class YAuthQR : YAuthBase
|
||||
{
|
||||
[JsonPropertyName("track_id")]
|
||||
public string TrackId { get; set; }
|
||||
|
||||
[JsonPropertyName("csrf_token")]
|
||||
public string CsrfToken { get; set; }
|
||||
}
|
||||
@@ -1,19 +1,20 @@
|
||||
namespace YandexMusic.API.Models.Account
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace YandexMusic.API.Models.Account;
|
||||
|
||||
public class YAuthQRStatus : YAuthBase
|
||||
{
|
||||
public class YAuthQRStatus : YAuthBase
|
||||
{
|
||||
[JsonProperty("default_uid")]
|
||||
public int DefaultUid { get; set; }
|
||||
[JsonPropertyName("default_uid")]
|
||||
public int DefaultUid { get; set; }
|
||||
|
||||
public string RetPath { get; set; }
|
||||
public string RetPath { get; set; }
|
||||
|
||||
[JsonProperty("track_id")]
|
||||
public string TrackId { get; set; }
|
||||
[JsonPropertyName("track_id")]
|
||||
public string TrackId { get; set; }
|
||||
|
||||
public string Id { get; set; }
|
||||
public string Id { get; set; }
|
||||
|
||||
public string State { get; set; }
|
||||
public string State { get; set; }
|
||||
|
||||
public YAuthCaptcha Captcha { get; set; }
|
||||
}
|
||||
public YAuthCaptcha Captcha { get; set; }
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
namespace YandexMusic.API.Models.Account
|
||||
namespace YandexMusic.API.Models.Account;
|
||||
|
||||
public enum YAuthStatus
|
||||
{
|
||||
public enum YAuthStatus
|
||||
{
|
||||
Ok,
|
||||
Error
|
||||
}
|
||||
Ok,
|
||||
Error
|
||||
}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
namespace YandexMusic.API.Models.Account
|
||||
{
|
||||
public class YAuthToken
|
||||
{
|
||||
[JsonProperty("csfr_token")]
|
||||
public string CsfrToken { get; set; }
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
[JsonProperty("track_id")]
|
||||
public string TrackId { get; set; }
|
||||
}
|
||||
namespace YandexMusic.API.Models.Account;
|
||||
|
||||
public class YAuthToken
|
||||
{
|
||||
[JsonPropertyName("csfr_token")]
|
||||
public string CsfrToken { get; set; }
|
||||
|
||||
[JsonPropertyName("track_id")]
|
||||
public string TrackId { get; set; }
|
||||
}
|
||||
@@ -1,47 +1,48 @@
|
||||
namespace YandexMusic.API.Models.Account
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace YandexMusic.API.Models.Account;
|
||||
|
||||
public class YAuthTypes : YAuthBase
|
||||
{
|
||||
public class YAuthTypes : YAuthBase
|
||||
{
|
||||
[JsonProperty("primary_alias_type")]
|
||||
public string PrimaryAliasType { get; set; }
|
||||
[JsonPropertyName("primary_alias_type")]
|
||||
public string PrimaryAliasType { get; set; }
|
||||
|
||||
[JsonProperty("csrf_token")]
|
||||
public string CsrfToken { get; set; }
|
||||
[JsonPropertyName("csrf_token")]
|
||||
public string CsrfToken { get; set; }
|
||||
|
||||
public string LocCsrf { get; set; }
|
||||
public string LocCsrf { get; set; }
|
||||
|
||||
[JsonProperty("use_new_suggest_by_phone")]
|
||||
public bool UseNewSuggestByPhone { get; set; }
|
||||
[JsonPropertyName("use_new_suggest_by_phone")]
|
||||
public bool UseNewSuggestByPhone { get; set; }
|
||||
|
||||
[JsonProperty("is_rfc_2fa_enabled")]
|
||||
public bool IsRfc2faEnabled { get; set; }
|
||||
[JsonPropertyName("is_rfc_2fa_enabled")]
|
||||
public bool IsRfc2faEnabled { get; set; }
|
||||
|
||||
[JsonProperty("track_id")]
|
||||
public string TrackId { get; set; }
|
||||
[JsonPropertyName("track_id")]
|
||||
public string TrackId { get; set; }
|
||||
|
||||
[JsonProperty("can_authorize")]
|
||||
public string CanAuthorize { get; set; }
|
||||
[JsonPropertyName("can_authorize")]
|
||||
public string CanAuthorize { get; set; }
|
||||
|
||||
[JsonProperty("preferred_auth_method")]
|
||||
public YAuthMethod PreferredAuthMethod { get; set; }
|
||||
[JsonPropertyName("preferred_auth_method")]
|
||||
public YAuthMethod PreferredAuthMethod { get; set; }
|
||||
|
||||
[JsonProperty("auth_methods")]
|
||||
public List<YAuthMethod> AuthMethods { get; set; }
|
||||
[JsonPropertyName("auth_methods")]
|
||||
public List<YAuthMethod> AuthMethods { get; set; }
|
||||
|
||||
[JsonProperty("can_register")]
|
||||
public bool CanRegister { get; set; }
|
||||
[JsonPropertyName("can_register")]
|
||||
public bool CanRegister { get; set; }
|
||||
|
||||
[JsonProperty("location_id")]
|
||||
public string LocationId { get; set; }
|
||||
[JsonPropertyName("location_id")]
|
||||
public string LocationId { get; set; }
|
||||
|
||||
public string Country { get; set; }
|
||||
public string Country { get; set; }
|
||||
|
||||
[JsonProperty("phone_number")]
|
||||
public YPhoneNumber PhoneNumberNumber { get; set; }
|
||||
[JsonPropertyName("phone_number")]
|
||||
public YPhoneNumber PhoneNumberNumber { get; set; }
|
||||
|
||||
[JsonProperty("magic_link_email")]
|
||||
public string MagicLinkEmail { get; set; }
|
||||
[JsonPropertyName("magic_link_email")]
|
||||
public string MagicLinkEmail { get; set; }
|
||||
|
||||
public string TractorTargetLocationHost { get; set; }
|
||||
}
|
||||
public string TractorTargetLocationHost { get; set; }
|
||||
}
|
||||
@@ -1,14 +1,13 @@
|
||||
using YandexMusic.API.Models.Common;
|
||||
|
||||
namespace YandexMusic.API.Models.Account
|
||||
namespace YandexMusic.API.Models.Account;
|
||||
|
||||
public class YBar : YStyle
|
||||
{
|
||||
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; }
|
||||
}
|
||||
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; }
|
||||
}
|
||||
|
||||
@@ -1,31 +1,32 @@
|
||||
namespace YandexMusic.API.Models.Account
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace YandexMusic.API.Models.Account;
|
||||
|
||||
public class YLoginInfo
|
||||
{
|
||||
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 Id { get; set; }
|
||||
public string Login { get; set; }
|
||||
[JsonPropertyName("client_id")]
|
||||
public string ClientId { get; set; }
|
||||
[JsonPropertyName("display_name")]
|
||||
public string DisplayName { get; set; }
|
||||
[JsonPropertyName("real_name")]
|
||||
public string RealName { get; set; }
|
||||
[JsonPropertyName("first_name")]
|
||||
public string FirstName { get; set; }
|
||||
[JsonPropertyName("last_name")]
|
||||
public string LastName { get; set; }
|
||||
public string Sex { get; set; }
|
||||
[JsonPropertyName("default_email")]
|
||||
public string DefaultEmail { get; set; }
|
||||
public List<string> Emails { get; set; }
|
||||
public string Birthday { get; set; }
|
||||
[JsonPropertyName("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; }
|
||||
public string AvatarUrl => $"https://avatars.mds.yandex.net/get-yapic/{DefaultAvatarId}/islands-200";
|
||||
[JsonPropertyName("is_avatar_empty")]
|
||||
public bool IsAvatarEmpty { get; set; }
|
||||
public string PsuId { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,21 @@
|
||||
namespace YandexMusic.API.Models.Account
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace YandexMusic.API.Models.Account;
|
||||
|
||||
public class YPhoneNumber
|
||||
{
|
||||
public class YPhoneNumber
|
||||
{
|
||||
[JsonProperty("masked_e164")]
|
||||
public string MaskedE164 { get; set; }
|
||||
[JsonPropertyName("masked_e164")]
|
||||
public string MaskedE164 { get; set; }
|
||||
|
||||
public string E164 { get; set; }
|
||||
public string E164 { get; set; }
|
||||
|
||||
public string International { get; set; }
|
||||
public string International { get; set; }
|
||||
|
||||
[JsonProperty("masked_original")]
|
||||
public string MaskedOriginal { get; set; }
|
||||
[JsonPropertyName("masked_original")]
|
||||
public string MaskedOriginal { get; set; }
|
||||
|
||||
public string Original { get; set; }
|
||||
public string Original { get; set; }
|
||||
|
||||
[JsonProperty("masked_international")]
|
||||
public string MaskedInternational { get; set; }
|
||||
}
|
||||
[JsonPropertyName("masked_international")]
|
||||
public string MaskedInternational { get; set; }
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
namespace YandexMusic.API.Models.Account
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace YandexMusic.API.Models.Account
|
||||
{
|
||||
public class YShortAccountInfo : YAuthBase
|
||||
{
|
||||
[JsonProperty("public_id")]
|
||||
[JsonPropertyName("public_id")]
|
||||
public string PublicId { get; set; }
|
||||
|
||||
public string Uid { get; set; }
|
||||
@@ -13,69 +15,69 @@
|
||||
|
||||
public string Birthday { get; set; }
|
||||
|
||||
[JsonProperty("has_password")]
|
||||
[JsonPropertyName("has_password")]
|
||||
public bool HasPassword { get; set; }
|
||||
|
||||
public List<string> Partitions { get; set; }
|
||||
|
||||
[JsonProperty("primary_alias_type")]
|
||||
[JsonPropertyName("primary_alias_type")]
|
||||
public int PrimaryAliasType { get; set; }
|
||||
|
||||
[JsonProperty("display_name")]
|
||||
[JsonPropertyName("display_name")]
|
||||
public string DisplayName { get; set; }
|
||||
|
||||
[JsonProperty("normalized_display_login")]
|
||||
[JsonPropertyName("normalized_display_login")]
|
||||
public string NormalizedDisplayLogin { get; set; }
|
||||
|
||||
[JsonProperty("x_token_issued_at")]
|
||||
[JsonPropertyName("x_token_issued_at")]
|
||||
public int XTokenIssuedAt { get; set; }
|
||||
|
||||
[JsonProperty("display_login")]
|
||||
[JsonPropertyName("display_login")]
|
||||
public string DisplayLogin { get; set; }
|
||||
|
||||
[JsonProperty("public_name")]
|
||||
[JsonPropertyName("public_name")]
|
||||
public string PublicName { get; set; }
|
||||
|
||||
[JsonProperty("avatar_url")]
|
||||
[JsonPropertyName("avatar_url")]
|
||||
public string AvatarUrl { get; set; }
|
||||
|
||||
[JsonProperty("native_default_email")]
|
||||
[JsonPropertyName("native_default_email")]
|
||||
public string NativeDefaultEmail { get; set; }
|
||||
|
||||
[JsonProperty("has_plus")]
|
||||
[JsonPropertyName("has_plus")]
|
||||
public bool HasPlus { get; set; }
|
||||
|
||||
[JsonProperty("location_id")]
|
||||
[JsonPropertyName("location_id")]
|
||||
public int LocationId { get; set; }
|
||||
|
||||
[JsonProperty("gender")]
|
||||
[JsonPropertyName("gender")]
|
||||
public string Gender { get; set; }
|
||||
|
||||
[JsonProperty("is_avatar_empty")]
|
||||
[JsonPropertyName("is_avatar_empty")]
|
||||
public bool IsAvatarEmpty { get; set; }
|
||||
|
||||
[JsonProperty("machine_readable_login")]
|
||||
[JsonPropertyName("machine_readable_login")]
|
||||
public string MachineReadableLogin { get; set; }
|
||||
|
||||
[JsonProperty("has_cards")]
|
||||
[JsonPropertyName("has_cards")]
|
||||
public bool HasCards { get; set; }
|
||||
|
||||
[JsonProperty("has_family")]
|
||||
[JsonPropertyName("has_family")]
|
||||
public bool HasFamily { get; set; }
|
||||
|
||||
[JsonProperty("picture_login_forbidden")]
|
||||
[JsonPropertyName("picture_login_forbidden")]
|
||||
public bool PictureLoginForbidden { get; set; }
|
||||
|
||||
[JsonProperty("can_account_join_master")]
|
||||
[JsonPropertyName("can_account_join_master")]
|
||||
public bool CanAccountJoinMaster { get; set; }
|
||||
|
||||
[JsonProperty("secure_phone_number")]
|
||||
[JsonPropertyName("secure_phone_number")]
|
||||
public string SecurePhoneNumber { get; set; }
|
||||
|
||||
[JsonProperty("x_token_client_id")]
|
||||
[JsonPropertyName("x_token_client_id")]
|
||||
public string XTokenClientId { get; set; }
|
||||
|
||||
[JsonProperty("x_token_need_reset")]
|
||||
[JsonPropertyName("x_token_need_reset")]
|
||||
public bool XTokenNeedReset { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,98 +1,59 @@
|
||||
using System.Text.Json.Serialization;
|
||||
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
|
||||
namespace YandexMusic.API.Models.Album;
|
||||
|
||||
/// <summary>Модель альбома.</summary>
|
||||
public class YAlbum : YBaseModel
|
||||
{
|
||||
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; }
|
||||
}
|
||||
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; }
|
||||
}
|
||||
32
YandexMusic.API/Models/Album/YLabelConverter.cs
Normal file
32
YandexMusic.API/Models/Album/YLabelConverter.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using YandexMusic.API.Models.Common;
|
||||
|
||||
namespace YandexMusic.API.Models.Album;
|
||||
|
||||
/// <summary>Конвертер для поля Labels, которое может быть списком строк или объектов.</summary>
|
||||
public sealed class YLabelConverter : JsonConverter<object>
|
||||
{
|
||||
public override object Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||
{
|
||||
if (reader.TokenType != JsonTokenType.StartArray)
|
||||
throw new JsonException("Ожидается массив");
|
||||
|
||||
var list = new List<object>();
|
||||
while (reader.Read())
|
||||
{
|
||||
if (reader.TokenType == JsonTokenType.EndArray) break;
|
||||
if (reader.TokenType == JsonTokenType.String)
|
||||
list.Add(reader.GetString()!);
|
||||
else if (reader.TokenType == JsonTokenType.StartObject)
|
||||
{
|
||||
var label = JsonSerializer.Deserialize<YLabel>(ref reader, options);
|
||||
list.Add(label!);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public override void Write(Utf8JsonWriter writer, object value, JsonSerializerOptions options)
|
||||
=> JsonSerializer.Serialize(writer, value, options);
|
||||
}
|
||||
@@ -1,41 +1,41 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using YandexMusic.API.Models.Common;
|
||||
using YandexMusic.API.Models.Common.Cover;
|
||||
|
||||
namespace YandexMusic.API.Models.Artist
|
||||
namespace YandexMusic.API.Models.Artist;
|
||||
|
||||
public class YArtist : YBaseModel
|
||||
{
|
||||
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; }
|
||||
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; }
|
||||
}
|
||||
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; }
|
||||
}
|
||||
|
||||
@@ -1,36 +1,36 @@
|
||||
using System.Text.Json.Serialization;
|
||||
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
|
||||
namespace YandexMusic.API.Models.Artist;
|
||||
|
||||
public class YArtistBriefInfo
|
||||
{
|
||||
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; }
|
||||
}
|
||||
public YButton ActionButton { get; set; }
|
||||
public List<YAlbum> Albums { get; set; }
|
||||
[JsonConverter(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; }
|
||||
}
|
||||
@@ -1,10 +1,9 @@
|
||||
namespace YandexMusic.API.Models.Artist
|
||||
namespace YandexMusic.API.Models.Artist;
|
||||
|
||||
public class YArtistCounts
|
||||
{
|
||||
public class YArtistCounts
|
||||
{
|
||||
public int AlsoAlbums { get; set; }
|
||||
public int AlsoTracks { get; set; }
|
||||
public int DirectAlbums { get; set; }
|
||||
public int Tracks { get; set; }
|
||||
}
|
||||
public int AlsoAlbums { get; set; }
|
||||
public int AlsoTracks { get; set; }
|
||||
public int DirectAlbums { get; set; }
|
||||
public int Tracks { get; set; }
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
namespace YandexMusic.API.Models.Artist
|
||||
namespace YandexMusic.API.Models.Artist;
|
||||
|
||||
public class YArtistRatings
|
||||
{
|
||||
public class YArtistRatings
|
||||
{
|
||||
public int Day { get; set; }
|
||||
public int Month { get; set; }
|
||||
public int Week { get; set; }
|
||||
}
|
||||
public int Day { get; set; }
|
||||
public int Month { get; set; }
|
||||
public int Week { get; set; }
|
||||
}
|
||||
@@ -1,10 +1,9 @@
|
||||
namespace YandexMusic.API.Models.Artist
|
||||
namespace YandexMusic.API.Models.Artist;
|
||||
|
||||
public class YBandlinkScannerLink
|
||||
{
|
||||
public class YBandlinkScannerLink
|
||||
{
|
||||
public string Title { get; set; }
|
||||
public string Subtitle { get; set; }
|
||||
public string Url { get; set; }
|
||||
public string ImgUrl { get; set; }
|
||||
}
|
||||
public string Title { get; set; }
|
||||
public string Subtitle { get; set; }
|
||||
public string Url { get; set; }
|
||||
public string ImgUrl { get; set; }
|
||||
}
|
||||
@@ -1,29 +1,29 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using YandexMusic.API.Models.Common;
|
||||
|
||||
namespace YandexMusic.API.Models.Artist
|
||||
namespace YandexMusic.API.Models.Artist;
|
||||
|
||||
public class YConcert
|
||||
{
|
||||
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; }
|
||||
}
|
||||
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; }
|
||||
[JsonPropertyName("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; }
|
||||
[JsonPropertyName("metro-stations")]
|
||||
public List<YMetroStation> MetroStations { get; set; }
|
||||
public string Place { get; set; }
|
||||
public YPrice MinPrice { get; set; }
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
namespace YandexMusic.API.Models.Artist
|
||||
namespace YandexMusic.API.Models.Artist;
|
||||
|
||||
public class YDeprecation
|
||||
{
|
||||
public class YDeprecation
|
||||
{
|
||||
public string TargetArtistId { get; set; }
|
||||
}
|
||||
public string TargetArtistId { get; set; }
|
||||
}
|
||||
@@ -1,9 +1,10 @@
|
||||
namespace YandexMusic.API.Models.Artist
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace YandexMusic.API.Models.Artist;
|
||||
|
||||
public class YMetroStation
|
||||
{
|
||||
public class YMetroStation
|
||||
{
|
||||
[JsonProperty("line-color")]
|
||||
public string LineColor { get; set; }
|
||||
public string Title { get; set; }
|
||||
}
|
||||
[JsonPropertyName("line-color")]
|
||||
public string LineColor { get; set; }
|
||||
public string Title { get; set; }
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
using YandexMusic.API.Models.Common;
|
||||
using YandexMusic.API.Models.Track;
|
||||
|
||||
namespace YandexMusic.API.Models.Artist
|
||||
{
|
||||
public class YTracksPage
|
||||
{
|
||||
public YPager Pager { get; set; }
|
||||
namespace YandexMusic.API.Models.Artist;
|
||||
|
||||
public List<YTrack> Tracks { get; set; }
|
||||
}
|
||||
public class YTracksPage
|
||||
{
|
||||
public YPager Pager { get; set; }
|
||||
|
||||
public List<YTrack> Tracks { get; set; }
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -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,
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
|
||||
@@ -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; }
|
||||
}
|
||||
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -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!;
|
||||
}
|
||||
41
YandexMusic.API/Models/Common/YExecutionContextConverter.cs
Normal file
41
YandexMusic.API/Models/Common/YExecutionContextConverter.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -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,
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
namespace YandexMusic.API.Models.Common
|
||||
namespace YandexMusic.API.Models.Common;
|
||||
|
||||
public enum YMetaType
|
||||
{
|
||||
public enum YMetaType
|
||||
{
|
||||
Music,
|
||||
Podcast
|
||||
}
|
||||
Music,
|
||||
Podcast,
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
|
||||
@@ -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; }
|
||||
}
|
||||
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -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,
|
||||
}
|
||||
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
|
||||
@@ -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; }
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
namespace YandexMusic.API.Models.Common
|
||||
namespace YandexMusic.API.Models.Common;
|
||||
|
||||
public enum YProductType
|
||||
{
|
||||
public enum YProductType
|
||||
{
|
||||
Subscription
|
||||
}
|
||||
Subscription
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
namespace YandexMusic.API.Models.Common
|
||||
namespace YandexMusic.API.Models.Common;
|
||||
|
||||
public enum YSortOrder
|
||||
{
|
||||
public enum YSortOrder
|
||||
{
|
||||
Asc,
|
||||
Desc
|
||||
}
|
||||
Asc,
|
||||
Desc
|
||||
}
|
||||
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -1,10 +1,9 @@
|
||||
using YandexMusic.API.Models.Artist;
|
||||
|
||||
namespace YandexMusic.API.Models.Feed.Event
|
||||
namespace YandexMusic.API.Models.Feed.Event;
|
||||
|
||||
public class YArtistsFromHistory
|
||||
{
|
||||
public class YArtistsFromHistory
|
||||
{
|
||||
public YArtist Artist { get; set; }
|
||||
public List<YArtist> ArtistsFromHistory { get; set; }
|
||||
}
|
||||
public YArtist Artist { get; set; }
|
||||
public List<YArtist> ArtistsFromHistory { get; set; }
|
||||
}
|
||||
@@ -1,104 +1,9 @@
|
||||
namespace YandexMusic.API.Models.Feed.Event
|
||||
using YandexMusic.API.Models.Feed.Event;
|
||||
|
||||
namespace YandexMusic.API.Models.Feed;
|
||||
|
||||
public class YFeedEvent
|
||||
{
|
||||
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; }
|
||||
}
|
||||
public string Id { get; set; }
|
||||
public YFeedEventType Type { get; set; }
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
using YandexMusic.API.Models.Album;
|
||||
|
||||
namespace YandexMusic.API.Models.Feed.Event
|
||||
namespace YandexMusic.API.Models.Feed.Event;
|
||||
|
||||
public class YFeedEventAlbums : YFeedEventTitled
|
||||
{
|
||||
public class YFeedEventAlbums : YFeedEventTitled
|
||||
{
|
||||
public List<YAlbum> Albums { get; set; }
|
||||
}
|
||||
public List<YAlbum> Albums { get; set; }
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user