Полностью переписанное api
All checks were successful
Release / pack-and-publish (release) Successful in 36s
All checks were successful
Release / pack-and-publish (release) Successful in 36s
This commit is contained in:
@@ -1,26 +1,19 @@
|
||||
using System.Net;
|
||||
|
||||
using YandexMusic.API.Common;
|
||||
using YandexMusic.API.Models.Account;
|
||||
using YandexMusic.API.Requests.Common;
|
||||
using YandexMusic.API.Requests.Common.Attributes;
|
||||
|
||||
namespace YandexMusic.API.Requests.Account;
|
||||
|
||||
[YPassportRequest(WebRequestMethods.Http.Post, "registration-validations/auth/multi_step/commit_password")]
|
||||
internal class YGetAuthAppPasswordBuilder : YRequestBuilder<YAuthBase, string>
|
||||
public class YGetAuthAppPasswordBuilder : YAuthRequestBuilder<YAuthBase?, string>
|
||||
{
|
||||
public YGetAuthAppPasswordBuilder(YandexMusicApi yandex, AuthStorage auth) : base(yandex, auth)
|
||||
{
|
||||
}
|
||||
|
||||
protected override HttpContent GetContent(string tuple)
|
||||
{
|
||||
return new FormUrlEncodedContent(new Dictionary<string, string> {
|
||||
{ "csrf_token", storage.AuthToken.CsfrToken },
|
||||
{ "track_id", storage.AuthToken.TrackId },
|
||||
{ "password", tuple },
|
||||
public YGetAuthAppPasswordBuilder(YandexMusicApi api) : base(api) { }
|
||||
protected override string Method => WebRequestMethods.Http.Post;
|
||||
protected override string PathTemplate => "registration-validations/auth/multi_step/commit_password";
|
||||
protected override HttpContent? GetContent(string password)
|
||||
=> new FormUrlEncodedContent(new Dictionary<string, string>
|
||||
{
|
||||
{ "csrf_token", Api.Storage.AuthToken.CsfrToken },
|
||||
{ "track_id", Api.Storage.AuthToken.TrackId },
|
||||
{ "password", password },
|
||||
{ "retpath", "https://passport.yandex.ru/am/finish?status=ok&from=Login" }
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,29 +1,13 @@
|
||||
using System.Net;
|
||||
using System.Net.Http.Headers;
|
||||
|
||||
using YandexMusic.API.Common;
|
||||
using YandexMusic.API.Requests.Common;
|
||||
using YandexMusic.API.Requests.Common.Attributes;
|
||||
using YandexMusic.API.Models.Account;
|
||||
|
||||
namespace YandexMusic.API.Requests.Account;
|
||||
|
||||
[YPassportRequest(WebRequestMethods.Http.Post, "registration-validations/textcaptcha")]
|
||||
internal class YGetAuthCaptchaBuilder : YRequestBuilder<Models.Account.YAuthCaptcha, string>
|
||||
public class YGetAuthCaptchaBuilder : YAuthRequestBuilder<YAuthCaptcha?, object>
|
||||
{
|
||||
public YGetAuthCaptchaBuilder(YandexMusicApi yandex, AuthStorage auth) : base(yandex, auth)
|
||||
{
|
||||
}
|
||||
|
||||
protected override HttpContent GetContent(string tuple)
|
||||
{
|
||||
return new FormUrlEncodedContent(new Dictionary<string, string> {
|
||||
{ "csrf_token", storage.AuthToken.CsfrToken },
|
||||
{ "track_id", storage.AuthToken.TrackId },
|
||||
});
|
||||
}
|
||||
|
||||
protected override void SetCustomHeaders(HttpRequestHeaders headers)
|
||||
{
|
||||
headers.Add("X-Requested-With", "XMLHttpRequest");
|
||||
}
|
||||
public YGetAuthCaptchaBuilder(YandexMusicApi api) : base(api) { }
|
||||
protected override string Method => WebRequestMethods.Http.Post;
|
||||
protected override string PathTemplate => "registration-validations/textcaptcha";
|
||||
protected override HttpContent? GetContent(object _)
|
||||
=> new FormUrlEncodedContent(new Dictionary<string, string> { { "csrf_token", Api.Storage.AuthToken.CsfrToken }, { "track_id", Api.Storage.AuthToken.TrackId } });
|
||||
}
|
||||
@@ -1,36 +1,14 @@
|
||||
using System.Net;
|
||||
using System.Net.Http.Headers;
|
||||
|
||||
using YandexMusic.API.Common;
|
||||
using YandexMusic.API.Models.Account;
|
||||
using YandexMusic.API.Requests.Common;
|
||||
using YandexMusic.API.Requests.Common.Attributes;
|
||||
|
||||
namespace YandexMusic.API.Requests.Account;
|
||||
|
||||
[YMobileProxyRequest(WebRequestMethods.Http.Post, "1/bundle/oauth/token_by_sessionid")]
|
||||
internal class YGetAuthCookiesBuilder : YRequestBuilder<YAccessToken, string>
|
||||
public class YGetAuthCookiesBuilder : YAuthRequestBuilder<YAccessToken?, object>
|
||||
{
|
||||
public YGetAuthCookiesBuilder(YandexMusicApi yandex, AuthStorage auth) : base(yandex, auth)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void SetCustomHeaders(HttpRequestHeaders headers)
|
||||
{
|
||||
CookieCollection cookieCollection = new() {
|
||||
storage.Context.Cookies.GetCookies(new Uri("https://yandex.ru/")),
|
||||
storage.Context.Cookies.GetCookies(new Uri("https://passport.yandex.ru/"))
|
||||
};
|
||||
|
||||
headers.Add("Ya-Client-Cookie", string.Join(";", cookieCollection.Select(c => $"{c.Name}={c.Value}")));
|
||||
headers.Add("Ya-Client-Host", "passport.yandex.ru");
|
||||
}
|
||||
|
||||
protected override HttpContent GetContent(string tuple)
|
||||
{
|
||||
return new FormUrlEncodedContent(new Dictionary<string, string> {
|
||||
{ "client_id", YConstants.XClientId },
|
||||
{ "client_secret", YConstants.XClientSecret }
|
||||
});
|
||||
}
|
||||
public YGetAuthCookiesBuilder(YandexMusicApi api) : base(api) { }
|
||||
protected override string Method => WebRequestMethods.Http.Post;
|
||||
protected override string PathTemplate => "1/bundle/oauth/token_by_sessionid";
|
||||
protected override HttpContent? GetContent(object _)
|
||||
=> new FormUrlEncodedContent(new Dictionary<string, string> { { "client_id", YConstants.XClientId }, { "client_secret", YConstants.XClientSecret } });
|
||||
}
|
||||
@@ -1,17 +1,11 @@
|
||||
using System.Net;
|
||||
|
||||
using YandexMusic.API.Common;
|
||||
using YandexMusic.API.Models.Account;
|
||||
using YandexMusic.API.Models.Common;
|
||||
using YandexMusic.API.Requests.Common;
|
||||
using YandexMusic.API.Requests.Common.Attributes;
|
||||
|
||||
namespace YandexMusic.API.Requests.Account;
|
||||
|
||||
[YApiRequest(WebRequestMethods.Http.Get, "account/status")]
|
||||
public class YGetAuthInfoBuilder : YRequestBuilder<YResponse<YAccountResult>, object>
|
||||
public class YGetAuthInfoBuilder : YMusicRequestBuilder<YAccountResult?, object>
|
||||
{
|
||||
public YGetAuthInfoBuilder(YandexMusicApi yandex, AuthStorage auth) : base(yandex, auth)
|
||||
{
|
||||
}
|
||||
public YGetAuthInfoBuilder(YandexMusicApi api) : base(api) { }
|
||||
protected override string Method => WebRequestMethods.Http.Get;
|
||||
protected override string PathTemplate => "account/status";
|
||||
}
|
||||
@@ -1,29 +1,13 @@
|
||||
using System.Net;
|
||||
|
||||
using YandexMusic.API.Common;
|
||||
using YandexMusic.API.Requests.Common;
|
||||
using YandexMusic.API.Requests.Common.Attributes;
|
||||
using YandexMusic.API.Models.Account;
|
||||
|
||||
namespace YandexMusic.API.Requests.Account;
|
||||
|
||||
[YPassportRequest(WebRequestMethods.Http.Post, "registration-validations/auth/send_magic_letter")]
|
||||
internal class YGetAuthLetterBuilder : YRequestBuilder<Models.Account.YAuthLetter, string>
|
||||
public class YGetAuthLetterBuilder : YAuthRequestBuilder<YAuthLetter?, object>
|
||||
{
|
||||
public YGetAuthLetterBuilder(YandexMusicApi yandex, AuthStorage auth) : base(yandex, auth)
|
||||
{
|
||||
}
|
||||
|
||||
protected override HttpContent GetContent(string tuple)
|
||||
{
|
||||
if (storage.AuthToken == null)
|
||||
{
|
||||
throw new Exception("Не найдена сессия входа.");
|
||||
}
|
||||
|
||||
return new FormUrlEncodedContent(new Dictionary<string, string>
|
||||
{
|
||||
{ "csrf_token", storage.AuthToken.CsfrToken },
|
||||
{ "track_id", storage.AuthToken.TrackId },
|
||||
});
|
||||
}
|
||||
public YGetAuthLetterBuilder(YandexMusicApi api) : base(api) { }
|
||||
protected override string Method => WebRequestMethods.Http.Post;
|
||||
protected override string PathTemplate => "registration-validations/auth/send_magic_letter";
|
||||
protected override HttpContent? GetContent(object _)
|
||||
=> new FormUrlEncodedContent(new Dictionary<string, string> { { "csrf_token", Api.Storage.AuthToken.CsfrToken }, { "track_id", Api.Storage.AuthToken.TrackId } });
|
||||
}
|
||||
@@ -1,31 +1,13 @@
|
||||
using System.Net;
|
||||
using System.Net.Http.Headers;
|
||||
|
||||
using YandexMusic.API.Common;
|
||||
using YandexMusic.API.Models.Account;
|
||||
using YandexMusic.API.Requests.Common;
|
||||
using YandexMusic.API.Requests.Common.Attributes;
|
||||
|
||||
namespace YandexMusic.API.Requests.Account;
|
||||
|
||||
[YPassportRequest(WebRequestMethods.Http.Post, "registration-validations/checkHuman")]
|
||||
internal class YGetAuthLoginCaptchaBuilder : YRequestBuilder<YAuthBase, string>
|
||||
public class YGetAuthLoginCaptchaBuilder : YAuthRequestBuilder<YAuthBase?, string>
|
||||
{
|
||||
public YGetAuthLoginCaptchaBuilder(YandexMusicApi yandex, AuthStorage auth) : base(yandex, auth)
|
||||
{
|
||||
}
|
||||
|
||||
protected override HttpContent GetContent(string tuple)
|
||||
{
|
||||
return new FormUrlEncodedContent(new Dictionary<string, string> {
|
||||
{ "csrf_token", storage.AuthToken.CsfrToken },
|
||||
{ "track_id", storage.AuthToken.TrackId },
|
||||
{ "answer", tuple }
|
||||
});
|
||||
}
|
||||
|
||||
protected override void SetCustomHeaders(HttpRequestHeaders headers)
|
||||
{
|
||||
headers.Add("X-Requested-With", "XMLHttpRequest");
|
||||
}
|
||||
public YGetAuthLoginCaptchaBuilder(YandexMusicApi api) : base(api) { }
|
||||
protected override string Method => WebRequestMethods.Http.Post;
|
||||
protected override string PathTemplate => "registration-validations/checkHuman";
|
||||
protected override HttpContent? GetContent(string captchaAnswer)
|
||||
=> new FormUrlEncodedContent(new Dictionary<string, string> { { "csrf_token", Api.Storage.AuthToken.CsfrToken }, { "track_id", Api.Storage.AuthToken.TrackId }, { "answer", captchaAnswer } });
|
||||
}
|
||||
@@ -1,24 +1,13 @@
|
||||
using System.Net;
|
||||
|
||||
using YandexMusic.API.Common;
|
||||
using YandexMusic.API.Models.Account;
|
||||
using YandexMusic.API.Requests.Common;
|
||||
using YandexMusic.API.Requests.Common.Attributes;
|
||||
|
||||
namespace YandexMusic.API.Requests.Account;
|
||||
|
||||
[YPassportRequest(WebRequestMethods.Http.Post, "auth/letter/status/")]
|
||||
internal class YGetAuthLoginLetterBuilder : YRequestBuilder<YAuthLetterStatus, string>
|
||||
public class YGetAuthLoginLetterBuilder : YAuthRequestBuilder<YAuthLetterStatus?, object>
|
||||
{
|
||||
public YGetAuthLoginLetterBuilder(YandexMusicApi yandex, AuthStorage auth) : base(yandex, auth)
|
||||
{
|
||||
}
|
||||
|
||||
protected override HttpContent GetContent(string tuple)
|
||||
{
|
||||
return new FormUrlEncodedContent(new Dictionary<string, string> {
|
||||
{ "csrf_token", storage.AuthToken.CsfrToken },
|
||||
{ "track_id", storage.AuthToken.TrackId },
|
||||
});
|
||||
}
|
||||
public YGetAuthLoginLetterBuilder(YandexMusicApi api) : base(api) { }
|
||||
protected override string Method => WebRequestMethods.Http.Post;
|
||||
protected override string PathTemplate => "auth/letter/status/";
|
||||
protected override HttpContent? GetContent(object _)
|
||||
=> new FormUrlEncodedContent(new Dictionary<string, string> { { "csrf_token", Api.Storage.AuthToken.CsfrToken }, { "track_id", Api.Storage.AuthToken.TrackId } });
|
||||
}
|
||||
@@ -1,24 +1,23 @@
|
||||
using System.Net;
|
||||
|
||||
using YandexMusic.API.Common;
|
||||
using YandexMusic.API.Models.Account;
|
||||
using YandexMusic.API.Requests.Common;
|
||||
using YandexMusic.API.Requests.Common.Attributes;
|
||||
|
||||
namespace YandexMusic.API.Requests.Account;
|
||||
|
||||
[YPassportRequest(WebRequestMethods.Http.Post, "auth/new/magic/status/")]
|
||||
internal class YGetAuthLoginQRBuilder : YRequestBuilder<YAuthQRStatus, string>
|
||||
internal class YGetAuthLoginQRBuilder : YAuthRequestBuilder<YAuthQRStatus, string>
|
||||
{
|
||||
public YGetAuthLoginQRBuilder(YandexMusicApi yandex, AuthStorage auth) : base(yandex, auth)
|
||||
public YGetAuthLoginQRBuilder(YandexMusicApi yandex) : base(yandex)
|
||||
{
|
||||
}
|
||||
|
||||
protected override string Method => WebRequestMethods.Http.Post;
|
||||
|
||||
protected override string PathTemplate => "auth/new/magic/status/";
|
||||
|
||||
protected override HttpContent GetContent(string tuple)
|
||||
{
|
||||
return new FormUrlEncodedContent(new Dictionary<string, string> {
|
||||
{ "csrf_token", storage.AuthToken.CsfrToken },
|
||||
{ "track_id", storage.AuthToken.TrackId }
|
||||
{ "csrf_token", Api.Storage.AuthToken.CsfrToken },
|
||||
{ "track_id", Api.Storage.AuthToken.TrackId }
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,24 +1,13 @@
|
||||
using System.Net;
|
||||
|
||||
using YandexMusic.API.Common;
|
||||
using YandexMusic.API.Models.Account;
|
||||
using YandexMusic.API.Requests.Common;
|
||||
using YandexMusic.API.Requests.Common.Attributes;
|
||||
|
||||
namespace YandexMusic.API.Requests.Account;
|
||||
|
||||
[YPassportRequest(WebRequestMethods.Http.Post, "registration-validations/auth/multi_step/start")]
|
||||
internal class YGetAuthLoginUserBuilder : YRequestBuilder<YAuthTypes, (string token, string login)>
|
||||
public class YGetAuthLoginUserBuilder : YAuthRequestBuilder<YAuthTypes?, (string token, string login)>
|
||||
{
|
||||
public YGetAuthLoginUserBuilder(YandexMusicApi yandex, AuthStorage auth) : base(yandex, auth)
|
||||
{
|
||||
}
|
||||
|
||||
protected override HttpContent GetContent((string token, string login) tuple)
|
||||
{
|
||||
return new FormUrlEncodedContent(new Dictionary<string, string> {
|
||||
{ "csrf_token", tuple.token },
|
||||
{ "login", tuple.login }
|
||||
});
|
||||
}
|
||||
public YGetAuthLoginUserBuilder(YandexMusicApi api) : base(api) { }
|
||||
protected override string Method => WebRequestMethods.Http.Post;
|
||||
protected override string PathTemplate => "registration-validations/auth/multi_step/start";
|
||||
protected override HttpContent? GetContent((string token, string login) tuple)
|
||||
=> new FormUrlEncodedContent(new Dictionary<string, string> { { "csrf_token", tuple.token }, { "login", tuple.login } });
|
||||
}
|
||||
@@ -1,23 +1,13 @@
|
||||
using System.Collections.Specialized;
|
||||
using System.Net;
|
||||
|
||||
using YandexMusic.API.Common;
|
||||
using System.Net;
|
||||
using YandexMusic.API.Requests.Common;
|
||||
using YandexMusic.API.Requests.Common.Attributes;
|
||||
|
||||
namespace YandexMusic.API.Requests.Account;
|
||||
|
||||
[YPassportRequest(WebRequestMethods.Http.Get, "am")]
|
||||
internal class YGetAuthMethodsBuilder : YRequestBuilder<HttpResponseMessage, string>
|
||||
public class YGetAuthMethodsBuilder : YRequestBuilder<object>
|
||||
{
|
||||
public YGetAuthMethodsBuilder(YandexMusicApi yandex, AuthStorage auth) : base(yandex, auth)
|
||||
{
|
||||
}
|
||||
public YGetAuthMethodsBuilder(YandexMusicApi api) : base(api) { }
|
||||
protected override string Method => WebRequestMethods.Http.Get;
|
||||
protected override string PathTemplate => "am";
|
||||
|
||||
protected override NameValueCollection GetQueryParams(string tuple)
|
||||
{
|
||||
return new NameValueCollection {
|
||||
{ "app_platform", "android" }
|
||||
};
|
||||
}
|
||||
protected override string BaseUrl => YConstants.Endpoints.PassportUrl;
|
||||
}
|
||||
@@ -1,25 +1,19 @@
|
||||
using System.Net;
|
||||
|
||||
using YandexMusic.API.Common;
|
||||
using System.Net.Http.Headers;
|
||||
using YandexMusic.API.Models.Account;
|
||||
using YandexMusic.API.Requests.Common;
|
||||
using YandexMusic.API.Requests.Common.Attributes;
|
||||
|
||||
namespace YandexMusic.API.Requests.Account;
|
||||
|
||||
[YPassportRequest(WebRequestMethods.Http.Post, "registration-validations/auth/password/submit")]
|
||||
internal class YGetAuthQRBuilder : YRequestBuilder<YAuthQR, string>
|
||||
public class YGetAuthQRBuilder : YAuthRequestBuilder<YAuthQR?, object>
|
||||
{
|
||||
public YGetAuthQRBuilder(YandexMusicApi yandex, AuthStorage auth) : base(yandex, auth)
|
||||
public YGetAuthQRBuilder(YandexMusicApi api) : base(api) { }
|
||||
protected override string Method => WebRequestMethods.Http.Post;
|
||||
protected override string PathTemplate => "pwl-yandex/api/passport/auth/password/submit";
|
||||
protected override HttpContent? GetContent(object _)
|
||||
=> new FormUrlEncodedContent(new Dictionary<string, string> { { "retpath", "" } });
|
||||
protected override void SetCustomHeaders(HttpRequestHeaders headers)
|
||||
{
|
||||
}
|
||||
|
||||
protected override HttpContent GetContent(string tuple)
|
||||
{
|
||||
return new FormUrlEncodedContent(new Dictionary<string, string> {
|
||||
{ "csrf_token", storage.AuthToken.CsfrToken },
|
||||
{ "retpath", "https://passport.yandex.ru/profile" },
|
||||
{ "with_code", "1" },
|
||||
});
|
||||
headers.Add("X-Csrf-Token", Api.Storage.AuthToken.CsfrToken);
|
||||
headers.Add("Process-Uuid", Api.Storage.AuthToken.ProcessUuid);
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,12 @@
|
||||
using System.Net;
|
||||
|
||||
using YandexMusic.API.Common;
|
||||
using YandexMusic.API.Models.Account;
|
||||
using YandexMusic.API.Requests.Common;
|
||||
using YandexMusic.API.Requests.Common.Attributes;
|
||||
|
||||
namespace YandexMusic.API.Requests.Account;
|
||||
|
||||
[YLoginRequest(WebRequestMethods.Http.Get, "info")]
|
||||
public class YGetLoginInfoBuilder : YRequestBuilder<YLoginInfo, object>
|
||||
public class YGetLoginInfoBuilder : YAuthRequestBuilder<YLoginInfo?, object>
|
||||
{
|
||||
public YGetLoginInfoBuilder(YandexMusicApi yandex, AuthStorage auth) : base(yandex, auth)
|
||||
{
|
||||
}
|
||||
public YGetLoginInfoBuilder(YandexMusicApi api) : base(api) { }
|
||||
protected override string Method => WebRequestMethods.Http.Get;
|
||||
protected override string PathTemplate => "info";
|
||||
}
|
||||
@@ -1,35 +1,25 @@
|
||||
using System.Net;
|
||||
using System.Net.Http.Headers;
|
||||
|
||||
using YandexMusic.API.Common;
|
||||
using YandexMusic.API.Models.Account;
|
||||
using YandexMusic.API.Requests.Common;
|
||||
using YandexMusic.API.Requests.Common.Attributes;
|
||||
|
||||
namespace YandexMusic.API.Requests.Account;
|
||||
|
||||
[YOAuthMobile(WebRequestMethods.Http.Post, "/1/token")]
|
||||
internal class YGetMusicTokenBuilder : YRequestBuilder<YAccessToken, string>
|
||||
public class YGetMusicTokenBuilder : YAuthRequestBuilder<YAccessToken?, object>
|
||||
{
|
||||
public YGetMusicTokenBuilder(YandexMusicApi yandex, AuthStorage auth) : base(yandex, auth)
|
||||
{
|
||||
}
|
||||
|
||||
protected override HttpContent GetContent(string tuple)
|
||||
{
|
||||
return new FormUrlEncodedContent(new Dictionary<string, string>
|
||||
public YGetMusicTokenBuilder(YandexMusicApi api) : base(api) { }
|
||||
protected override string Method => WebRequestMethods.Http.Post;
|
||||
protected override string PathTemplate => "/1/token";
|
||||
protected override HttpContent? GetContent(object _)
|
||||
=> new FormUrlEncodedContent(new Dictionary<string, string>
|
||||
{
|
||||
{ "client_id", YConstants.ClientId },
|
||||
{ "client_secret", YConstants.ClientSecret },
|
||||
{ "grant_type", "x-token" },
|
||||
{ "access_token", storage.AccessToken.AccessToken }
|
||||
{ "access_token", Api.Storage.AccessToken.AccessToken }
|
||||
});
|
||||
}
|
||||
|
||||
protected override void SetCustomHeaders(HttpRequestHeaders headers)
|
||||
{
|
||||
headers.Remove("Authorization");
|
||||
|
||||
base.SetCustomHeaders(headers);
|
||||
}
|
||||
}
|
||||
@@ -1,30 +1,19 @@
|
||||
using System.Collections.Specialized;
|
||||
using System.Net;
|
||||
using System.Net.Http.Headers;
|
||||
|
||||
using YandexMusic.API.Common;
|
||||
using YandexMusic.API.Models.Account;
|
||||
using YandexMusic.API.Requests.Common;
|
||||
using YandexMusic.API.Requests.Common.Attributes;
|
||||
|
||||
namespace YandexMusic.API.Requests.Account;
|
||||
|
||||
[YMobileProxyRequest(WebRequestMethods.Http.Get, "/1/bundle/account/short_info/")]
|
||||
internal class YGetShortAccountInifoBuilder : YRequestBuilder<YShortAccountInfo, object>
|
||||
public class YGetShortAccountInfoBuilder : YAuthRequestBuilder<YShortAccountInfo?, object>
|
||||
{
|
||||
public YGetShortAccountInifoBuilder(YandexMusicApi yandex, AuthStorage auth) : base(yandex, auth)
|
||||
{
|
||||
}
|
||||
|
||||
protected override NameValueCollection GetQueryParams(object tuple)
|
||||
{
|
||||
return new NameValueCollection {
|
||||
{ "avatar_size", "islands-300" }
|
||||
};
|
||||
}
|
||||
|
||||
public YGetShortAccountInfoBuilder(YandexMusicApi api) : base(api) { }
|
||||
protected override string Method => WebRequestMethods.Http.Get;
|
||||
protected override string PathTemplate => "1/bundle/account/short_info/";
|
||||
protected override NameValueCollection GetQueryParams(object _)
|
||||
=> new() { { "avatar_size", "islands-300" } };
|
||||
protected override void SetCustomHeaders(HttpRequestHeaders headers)
|
||||
{
|
||||
headers.Add("Ya-Consumer-Authorization", $"OAuth {storage.AccessToken.AccessToken}");
|
||||
headers.Add("Ya-Consumer-Authorization", $"OAuth {Api.Storage.AccessToken.AccessToken}");
|
||||
}
|
||||
}
|
||||
19
YandexMusic.API/Requests/Account/YPostAuthStats.cs
Normal file
19
YandexMusic.API/Requests/Account/YPostAuthStats.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System.Net;
|
||||
using System.Net.Http.Headers;
|
||||
using YandexMusic.API.Models.Account;
|
||||
|
||||
namespace YandexMusic.API.Requests.Account;
|
||||
|
||||
public class YPostAuthStats : YAuthRequestBuilder<YAuthEmpty?, object>
|
||||
{
|
||||
public YPostAuthStats(YandexMusicApi api) : base(api) { }
|
||||
protected override string Method => WebRequestMethods.Http.Post;
|
||||
protected override string PathTemplate => "pwl-yandex/api/passport/stats";
|
||||
protected override HttpContent? GetContent(object _)
|
||||
=> new FormUrlEncodedContent(new Dictionary<string, string> { { "messageType", "CLIENT_READY" } });
|
||||
protected override void SetCustomHeaders(HttpRequestHeaders headers)
|
||||
{
|
||||
headers.Add("X-Csrf-Token", Api.Storage.AuthToken.CsfrToken);
|
||||
headers.Add("Process-Uuid", Api.Storage.AuthToken.ProcessUuid);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user