Skip to content

Commit

Permalink
Обновлены модели, добавлен метод для плейлиста "Большая перемотка"
Browse files Browse the repository at this point in the history
  • Loading branch information
K1llMan committed Oct 24, 2020
1 parent eb0589a commit 98fdeb2
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 7 deletions.
17 changes: 13 additions & 4 deletions Yandex.Music.Api.Tests/Tests/API/PlaylistAPITest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,15 @@ public void Podcasts_ValidData_True()

[Fact, YandexTrait(TraitGroup.PlaylistAPI)]
[Order(8)]
public void Rewind_ValidData_True()
{
YResponse<YPlaylist> response = Fixture.API.Playlist.Rewind(Fixture.Storage);

response.Should().NotBeNull();
}

[Fact, YandexTrait(TraitGroup.PlaylistAPI)]
[Order(9)]
public void Create_ValidData_True()
{
Fixture.CreatedPlaylist = Fixture.API.Playlist.Create(Fixture.Storage, "Test Playlist").Result;
Expand All @@ -112,7 +121,7 @@ public void Create_ValidData_True()
}

[Fact, YandexTrait(TraitGroup.PlaylistAPI)]
[Order(9)]
[Order(10)]
public void InsertTrack_ValidData_True()
{
Fixture.CreatedPlaylist.Should().NotBeNull();
Expand All @@ -124,7 +133,7 @@ public void InsertTrack_ValidData_True()
}

[Fact, YandexTrait(TraitGroup.PlaylistAPI)]
[Order(10)]
[Order(11)]
public void DeleteTrack_ValidData_True()
{
Fixture.CreatedPlaylist.Should().NotBeNull();
Expand All @@ -136,7 +145,7 @@ public void DeleteTrack_ValidData_True()
}

[Fact, YandexTrait(TraitGroup.PlaylistAPI)]
[Order(11)]
[Order(12)]
public void Rename_ValidData_True()
{
Fixture.CreatedPlaylist.Should().NotBeNull();
Expand All @@ -147,7 +156,7 @@ public void Rename_ValidData_True()
}

[Fact, YandexTrait(TraitGroup.PlaylistAPI)]
[Order(12)]
[Order(13)]
public void Remove_ValidData_True()
{
Fixture.CreatedPlaylist.Should().NotBeNull();
Expand Down
20 changes: 20 additions & 0 deletions Yandex.Music.Api/API/YPlaylistAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,26 @@ public YResponse<YPlaylist> Podcasts(AuthStorage storage)
return PodcastsAsync(storage).GetAwaiter().GetResult();
}

/// <summary>
/// Большая перемотка
/// </summary>
/// <param name="storage">Хранилище</param>
/// <returns></returns>
public async Task<YResponse<YPlaylist>> RewindAsync(AuthStorage storage)
{
return await GetPersonalPlaylist(storage, YGeneratedPlaylistType.Rewind10);
}

/// <summary>
/// Большая перемотка
/// </summary>
/// <param name="storage">Хранилище</param>
/// <returns></returns>
public YResponse<YPlaylist> Rewind(AuthStorage storage)
{
return RewindAsync(storage).GetAwaiter().GetResult();
}

#endregion Стандартные плейлисты

#region Получение плейлиста
Expand Down
10 changes: 9 additions & 1 deletion Yandex.Music.Api/Models/Account/YAccountResult.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using Yandex.Music.Api.Models.Common;
using Newtonsoft.Json;

using Yandex.Music.Api.Models.Common;

namespace Yandex.Music.Api.Models.Account
{
Expand All @@ -13,6 +15,12 @@ public class YAccountResult
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;
}

#endregion
}
Expand Down
13 changes: 13 additions & 0 deletions Yandex.Music.Api/Models/Account/YBar.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace Yandex.Music.Api.Models.Account
{
public class YBar
{
public string AlertId { get; set; }
public string Text { get; set; }
public string BgColor { get; set; }
public string TextColor { get; set; }
public string AlertType { get; set; }
public YButton Button { get; set; }
public bool CloseButton { get; set; }
}
}
10 changes: 10 additions & 0 deletions Yandex.Music.Api/Models/Account/YButton.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Yandex.Music.Api.Models.Account
{
public class YButton
{
public string Text { get; set; }
public string BgColor { get; set; }
public string TextColor { get; set; }
public string Uri { get; set; }
}
}
7 changes: 6 additions & 1 deletion Yandex.Music.Api/Models/Playlist/YGeneratedPlaylistType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ public enum YGeneratedPlaylistType
/// <summary>
/// Подкасты
/// </summary>
Podcasts
Podcasts,

/// <summary>
/// Большая перемотка
/// </summary>
Rewind10
}
}
2 changes: 2 additions & 0 deletions Yandex.Music.Api/Models/Radio/YStation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ public class YStation : YBaseModel
public YStationData Data { get; set; }
public string Explanation { get; set; }
public List<YPrerolls> Prerolls { get; set; }
public string RupTitle { get; set; }
public string RupDescription { get; set; }
public YStationSettings Settings { get; set; }
public YStationSettings2 Settings2 { get; set; }
public YStationDescription Station { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ namespace Yandex.Music.Api.Models.Search.Playlist
{
public class YSearchPlaylistModel
{
public bool Available { get; set; }
[JsonConverter(typeof(YCoverConverter))]
public YCover Cover { get; set; }

public string CoverUri { get; set; }
public string Description { get; set; }
public string DescriptionFormatted { get; set; }
public string Kind { get; set; }
Expand Down
1 change: 1 addition & 0 deletions Yandex.Music.Api/Models/Search/Track/YSearchTrackModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class YSearchTrackModel
public bool AvailableAsRbt { get; set; }
public bool AvailableForPremiumUsers { get; set; }
public string ContentWarning { get; set; }
public string CoverUri { get; set; }
public long DurationMs { get; set; }
public bool Explicit { get; set; }
public string Id { get; set; }
Expand Down

0 comments on commit 98fdeb2

Please sign in to comment.