Skip to content

Commit

Permalink
Merge pull request #5 from SKProCH/dev
Browse files Browse the repository at this point in the history
Add YandexCredentials class for YandexCredentialsProvider
  • Loading branch information
SKProCH authored Mar 5, 2023
2 parents a26b7c4 + 7cd915a commit 012a064
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 12 deletions.
26 changes: 26 additions & 0 deletions YandexMusicResolver/Config/YandexCredentials.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
namespace YandexMusicResolver.Config;

/// <summary>
/// Class for storing credentials for <see cref="YandexCredentialsProvider"/>
/// </summary>
public class YandexCredentials {
/// <summary>
/// Login for authorizing in Yandex
/// </summary>
public string? Login { get; set; }

/// <summary>
/// Password for authorizing in Yandex
/// </summary>
public string? Password { get; set; }

/// <summary>
/// Token for authorizing in Yandex
/// </summary>
public string? Token { get; set; }

/// <summary>
/// Is anonymous access allowed
/// </summary>
public bool AllowAnonymous { get; set; }
}
7 changes: 5 additions & 2 deletions YandexMusicResolver/Config/YandexCredentialsProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,12 @@ public YandexCredentialsProvider(IYandexMusicAuthService yandexMusicAuthService,
/// <summary>
/// Initializes a new <see cref="YandexCredentialsProvider"/> with anonymizes access
/// </summary>
public YandexCredentialsProvider(IYandexMusicAuthService yandexMusicAuthService) {
public YandexCredentialsProvider(IYandexMusicAuthService yandexMusicAuthService, YandexCredentials credentials) {
_yandexMusicAuthService = yandexMusicAuthService;
AllowAnonymous = true;
_login = credentials.Login;
_password = credentials.Login;
_token = credentials.Token;
AllowAnonymous = credentials.AllowAnonymous;
}

/// <inheritdoc />
Expand Down
13 changes: 3 additions & 10 deletions YandexMusicResolver/YandexMusicResolver.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,10 @@
<Description>A library aimed at searching, resolving and getting direct links to tracks, playlists or albums in Yandex.Music. Can work without authorization.</Description>
<RepositoryType>Git</RepositoryType>
<PackageProjectUrl>https://github.com/SKProCH/YandexMusicResolver</PackageProjectUrl>
<Version>5.0.1</Version>
<Version>5.1.0</Version>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageReleaseNotes>
- Removed all `IYandexConfig` infrastructure. Use `IYandexCredentialProvider` or implement your own.
- Remove YandexMusicAuth class, use IYandexMusicAuthService or implement your own.
- All List replaced with IReadOnlyCollections in API
- Make `YandexMusicTrack` ID long instead of string
- Migrate to System.Text.Json and IHttpClientFactory (still can be used with just HttpClient)
- Remove Proxy specifying. Set proxy in IHttpClientFactory or HttpClient.
- Target framework lowered to netstandard2.0
- Change type of IYandexMusicDirectUrlLoader.GetDirectUrl TrackId parameter to long
- Add YandexCredentials class for YandexCredentialsProvider
</PackageReleaseNotes>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageIcon>icon.png</PackageIcon>
Expand All @@ -37,7 +30,7 @@
</ItemGroup>

<ItemGroup>
<None Include="../README.md" Pack="true" PackagePath="\"/>
<None Include="../README.md" Pack="true" PackagePath="\" />
<None Include="../icon.png" Pack="true" PackagePath="/" />
</ItemGroup>
</Project>

0 comments on commit 012a064

Please sign in to comment.