Полный рефакторинг api. Вынесено отдельно api passport

This commit is contained in:
2026-04-20 23:30:01 +03:00
parent 34261d02a9
commit eb1eba0162
61 changed files with 1074 additions and 640 deletions

View File

@@ -0,0 +1,13 @@
using System.Text.Json.Serialization;
using YandexMusic.API.Models.Account;
namespace YandexMusic.API.Models.Passport;
public class YPassportTrack : YAuthBase
{
[JsonPropertyName("track_id")]
public string TrackId { get; set; }
[JsonPropertyName("csrf_token")]
public string CsrfToken { get; set; }
}

View File

@@ -0,0 +1,22 @@
using System.Text.Json.Serialization;
using YandexMusic.API.Models.Account;
namespace YandexMusic.API.Models.Passport;
public class YAuthQrSession
{
[JsonPropertyName("default_uid")]
public int DefaultUid { get; set; }
[JsonPropertyName("retpath")]
public string RetPath { get; set; }
[JsonPropertyName("track_id")]
public string TrackId { get; set; }
public string Id { get; set; }
public string State { get; set; }
public YAuthCaptcha Captcha { get; set; }
}

View File

@@ -0,0 +1,12 @@
using System.Text.Json.Serialization;
namespace YandexMusic.API.Models.Passport;
public class YAuthQRStatus
{
[JsonPropertyName("state")]
public string? State { get; set; } = null;
[JsonPropertyName("trackId")]
public string TrackId { get; set; } = string.Empty;
}

View File

@@ -0,0 +1,39 @@
using System.Text.Json.Serialization;
namespace YandexMusic.API.Models.Passport;
public class YCheckAvailabilityResult
{
[JsonPropertyName("antifraudScore")]
public string AntifraudScore { get; set; } = string.Empty;
[JsonPropertyName("hasAvailableAccounts")]
public bool HasAvailableAccounts { get; set; }
[JsonPropertyName("flnFlowRequired")]
public bool FlnFlowRequired { get; set; }
[JsonPropertyName("can_use_push")]
public bool CanUsePush { get; set; }
[JsonPropertyName("can_use_webauthn")]
public bool CanUseWebauthn { get; set; }
[JsonPropertyName("has_master")]
public bool HasMaster { get; set; }
[JsonPropertyName("is_session_mastered")]
public bool IsSessionMastered { get; set; }
[JsonPropertyName("does_master_have_free_slots")]
public bool DoesMasterHaveFreeSlots { get; set; }
[JsonPropertyName("allowed_registration_flows")]
public List<object> AllowedRegistrationFlows { get; set; } = new();
[JsonPropertyName("SuggestBy")]
public string SuggestBy { get; set; } = string.Empty;
[JsonPropertyName("master_info")]
public YMasterInfo? MasterInfo { get; set; }
}

View File

@@ -0,0 +1,12 @@
using System.Text.Json.Serialization;
namespace YandexMusic.API.Models.Passport;
public class YMasterInfo
{
[JsonPropertyName("firstname")]
public string FirstName { get; set; } = string.Empty;
[JsonPropertyName("lastname")]
public string LastName { get; set; } = string.Empty;
}

View File

@@ -0,0 +1,42 @@
using System.Text.Json.Serialization;
namespace YandexMusic.API.Models.Passport;
public class YMultistepStart
{
[JsonPropertyName("track_id")]
public string TrackId { get; set; } = string.Empty;
[JsonPropertyName("can_authorize")]
public bool CanAuthorize { get; set; }
[JsonPropertyName("can_register")]
public bool CanRegister { get; set; }
[JsonPropertyName("is_rfc_2fa_enabled")]
public bool IsRfc2faEnabled { get; set; }
[JsonPropertyName("allowed_account_types")]
public List<string> AllowedAccountTypes { get; set; } = new();
[JsonPropertyName("location_id")]
public string LocationId { get; set; } = string.Empty;
[JsonPropertyName("primary_alias_type")]
public int PrimaryAliasType { get; set; }
[JsonPropertyName("auth_methods")]
public List<string> AuthMethods { get; set; } = new();
[JsonPropertyName("preferred_auth_method")]
public string PreferredAuthMethod { get; set; } = string.Empty;
[JsonPropertyName("csrf_token")]
public string CsrfToken { get; set; } = string.Empty;
[JsonPropertyName("error")]
public string? Error { get; set; }
[JsonPropertyName("errors")]
public List<string>? Errors { get; set; }
}

View File

@@ -0,0 +1,48 @@
using System.Text.Json.Serialization;
namespace YandexMusic.API.Models.Passport;
public class YPassportAccount
{
[JsonPropertyName("avatar_url")]
public string AvatarUrl { get; set; } = string.Empty;
[JsonPropertyName("display_login")]
public string DisplayLogin { get; set; } = string.Empty;
[JsonPropertyName("display_name")]
public YPassportName? DisplayName { get; set; }
[JsonPropertyName("has_master")]
public bool HasMaster { get; set; }
[JsonPropertyName("has_plus")]
public bool HasPlus { get; set; }
[JsonPropertyName("has_secure_phone")]
public bool HasSecurePhone { get; set; }
[JsonPropertyName("is_2fa_enabled")]
public bool Is2faEnabled { get; set; }
[JsonPropertyName("is_rfc_2fa_enabled")]
public bool IsRfc2faEnabled { get; set; }
[JsonPropertyName("is_sms_2fa_enabled")]
public bool IsSms2faEnabled { get; set; }
[JsonPropertyName("is_workspace_user")]
public bool IsWorkspaceUser { get; set; }
[JsonPropertyName("is_yandexoid")]
public bool IsYandexoid { get; set; }
public bool Login { get; set; }
public YPassportPerson? Person { get; set; }
[JsonPropertyName("secure_phone_id")]
public int SecurePhoneId { get; set; }
public int Uid { get; set; }
}

View File

@@ -0,0 +1,11 @@
using System.Text.Json.Serialization;
namespace YandexMusic.API.Models.Passport;
public class YPassportName
{
[JsonPropertyName("default_avatar")]
public string DefaultAvatar { get; set; } = string.Empty;
public string Name { get; set; } = string.Empty;
}

View File

@@ -0,0 +1,11 @@
namespace YandexMusic.API.Models.Passport;
public class YPassportPerson
{
public string Birthday { get; set; } = string.Empty;
public string Country { get; set; } = string.Empty;
public string FirstName { get; set; } = string.Empty;
public int Gender { get; set; }
public string Language { get; set; } = string.Empty;
public string LastName { get; set; } = string.Empty;
}

View File

@@ -0,0 +1,12 @@
using System.Text.Json.Serialization;
namespace YandexMusic.API.Models.Passport;
public class YPassportSession
{
[JsonPropertyName("track_id")]
public string TrackId { get; set; } = string.Empty;
[JsonPropertyName("default_uid")]
public string DefaultUid { get; set; } = string.Empty;
}

View File

@@ -0,0 +1,12 @@
using System.Text.Json.Serialization;
namespace YandexMusic.API.Models.Passport;
public class YPassportSessionStatus
{
[JsonPropertyName("session_is_correct")]
public bool SessionIsCorrect { get; set; }
[JsonPropertyName("session_has_users")]
public bool SessionHasUsers { get; set; }
}

View File

@@ -0,0 +1,21 @@
using System.Text.Json.Serialization;
namespace YandexMusic.API.Models.Passport;
public class YPassportUser
{
[JsonPropertyName("track_id")]
public string TrackId { get; set; } = string.Empty;
[JsonPropertyName("state")]
public string State { get; set; } = string.Empty;
[JsonPropertyName("account")]
public YPassportAccount? Account { get; set; }
[JsonPropertyName("error")]
public string? Error { get; set; }
[JsonPropertyName("errors")]
public List<string>? Errors { get; set; }
}

View File

@@ -0,0 +1,7 @@
namespace YandexMusic.API.Models.Passport;
public class YPushApp
{
public string App { get; set; } = string.Empty;
public string Platform { get; set; } = string.Empty;
}

View File

@@ -0,0 +1,18 @@
using System.Text.Json.Serialization;
namespace YandexMusic.API.Models.Passport;
public class YSendPushResult
{
[JsonPropertyName("pushes_devices_list")]
public List<object> PushesDevicesList { get; set; } = new();
[JsonPropertyName("deny_resend_until")]
public int DenyResendUntil { get; set; }
[JsonPropertyName("is_push_silent")]
public bool IsPushSilent { get; set; }
[JsonPropertyName("apps_for_bright_push")]
public List<YPushApp> AppsForBrightPush { get; set; } = new();
}

View File

@@ -0,0 +1,54 @@
using System.Text.Json.Serialization;
namespace YandexMusic.API.Models.Passport;
public class YSuggestAccount
{
[JsonPropertyName("allowed_auth_flows")]
public List<string> AllowedAuthFlows { get; set; } = new();
[JsonPropertyName("avatar_url")]
public string AvatarUrl { get; set; } = string.Empty;
[JsonPropertyName("default_avatar")]
public string DefaultAvatar { get; set; } = string.Empty;
[JsonPropertyName("display_name")]
public YPassportName? DisplayName { get; set; }
[JsonPropertyName("has_bank_card")]
public bool HasBankCard { get; set; }
[JsonPropertyName("has_family")]
public bool HasFamily { get; set; }
[JsonPropertyName("has_master")]
public bool HasMaster { get; set; }
[JsonPropertyName("has_plus")]
public bool HasPlus { get; set; }
[JsonPropertyName("is_communal")]
public bool IsCommunal { get; set; }
[JsonPropertyName("location_id")]
public string LocationId { get; set; } = string.Empty;
[JsonPropertyName("login")]
public string Login { get; set; } = string.Empty;
[JsonPropertyName("primary_alias_type")]
public int PrimaryAliasType { get; set; }
[JsonPropertyName("priority")]
public int Priority { get; set; }
[JsonPropertyName("uid")]
public long Uid { get; set; }
[JsonPropertyName("shields")]
public List<string> Shields { get; set; } = new();
[JsonPropertyName("require_additional_sms_to_login")]
public bool RequireAdditionalSmsToLogin { get; set; }
}

View File

@@ -0,0 +1,15 @@
using System.Text.Json.Serialization;
namespace YandexMusic.API.Models.Passport;
public class YSuggestByPhoneResult
{
[JsonPropertyName("accounts")]
public List<YSuggestAccount> Accounts { get; set; } = new();
[JsonPropertyName("allowed_registration_flows")]
public List<string> AllowedRegistrationFlows { get; set; } = new();
[JsonPropertyName("uid_from_bb")]
public string UidFromBb { get; set; } = string.Empty;
}

View File

@@ -0,0 +1,37 @@
using System.Text.Json.Serialization;
using YandexMusic.API.Models.Account;
namespace YandexMusic.API.Models.Passport;
public class YValidatePhoneNumberResult
{
[JsonPropertyName("phone_number")]
public YPhoneNumber? PhoneNumber { get; set; }
[JsonPropertyName("valid_for_flash_call")]
public bool ValidForFlashCall { get; set; }
[JsonPropertyName("location_id")]
public string LocationId { get; set; } = string.Empty;
[JsonPropertyName("valid_for_viber")]
public bool ValidForViber { get; set; }
[JsonPropertyName("valid_for_whatsapp")]
public bool ValidForWhatsapp { get; set; }
[JsonPropertyName("valid_for_telegram")]
public bool ValidForTelegram { get; set; }
[JsonPropertyName("valid_for_sms")]
public bool ValidForSms { get; set; }
[JsonPropertyName("track_id")]
public string TrackId { get; set; } = string.Empty;
[JsonPropertyName("error")]
public string? Error { get; set; }
[JsonPropertyName("errors")]
public List<string>? Errors { get; set; }
}

View File

@@ -0,0 +1,18 @@
using System.Text.Json.Serialization;
namespace YandexMusic.API.Models.Passport;
public class YValidateSquatter
{
[JsonPropertyName("require_flow_with_fio")]
public bool RequireFlowWithFio { get; set; }
[JsonPropertyName("require_flow_with_auth_hint")]
public bool RequireFlowWithAuthHint { get; set; }
[JsonPropertyName("auth_hint_question_id")]
public string AuthHintQuestionId { get; set; } = string.Empty;
[JsonPropertyName("suggestBy")]
public string SuggestBy { get; set; } = string.Empty;
}