mirror of
https://github.com/Sarsoo/Spotify.NET.git
synced 2024-12-23 22:56:25 +00:00
Updated to .net 6.0 and remove .net-standard2.0 support
This commit is contained in:
parent
adbf7eb99f
commit
5cebb910f7
12
.github/workflows/cicd.yaml
vendored
12
.github/workflows/cicd.yaml
vendored
@ -15,10 +15,10 @@ jobs:
|
|||||||
dotnet-version: "3.1.x"
|
dotnet-version: "3.1.x"
|
||||||
- uses: actions/setup-dotnet@v1
|
- uses: actions/setup-dotnet@v1
|
||||||
with:
|
with:
|
||||||
dotnet-version: "2.2.x"
|
dotnet-version: "5.0.x"
|
||||||
- uses: actions/setup-dotnet@v1
|
- uses: actions/setup-dotnet@v1
|
||||||
with:
|
with:
|
||||||
dotnet-version: "5.0.x"
|
dotnet-version: "6.0.x"
|
||||||
- name: Set RELEASE_VERSION
|
- name: Set RELEASE_VERSION
|
||||||
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
||||||
- name: Restore Packages
|
- name: Restore Packages
|
||||||
@ -47,21 +47,21 @@ jobs:
|
|||||||
- name: Upload to GH Release
|
- name: Upload to GH Release
|
||||||
if: startsWith( github.ref, 'refs/tags/')
|
if: startsWith( github.ref, 'refs/tags/')
|
||||||
run: |
|
run: |
|
||||||
zip -j SpotifyAPI.Web-netstandard2.0.zip SpotifyAPI.Web/bin/Release/netstandard2.0/*
|
|
||||||
zip -j SpotifyAPI.Web-netstandard2.1.zip SpotifyAPI.Web/bin/Release/netstandard2.1/*
|
zip -j SpotifyAPI.Web-netstandard2.1.zip SpotifyAPI.Web/bin/Release/netstandard2.1/*
|
||||||
zip -j SpotifyAPI.Web-net5.0.zip SpotifyAPI.Web/bin/Release/net5.0/*
|
zip -j SpotifyAPI.Web-net5.0.zip SpotifyAPI.Web/bin/Release/net5.0/*
|
||||||
|
zip -j SpotifyAPI.Web-net6.0.zip SpotifyAPI.Web/bin/Release/net6.0/*
|
||||||
|
|
||||||
zip -j SpotifyAPI.Web.Auth-netstandard2.0.zip SpotifyAPI.Web.Auth/bin/Release/netstandard2.0/*
|
|
||||||
zip -j SpotifyAPI.Web.Auth-netstandard2.1.zip SpotifyAPI.Web.Auth/bin/Release/netstandard2.1/*
|
zip -j SpotifyAPI.Web.Auth-netstandard2.1.zip SpotifyAPI.Web.Auth/bin/Release/netstandard2.1/*
|
||||||
zip -j SpotifyAPI.Web.Auth-net5.0.zip SpotifyAPI.Web.Auth/bin/Release/net5.0/*
|
zip -j SpotifyAPI.Web.Auth-net5.0.zip SpotifyAPI.Web.Auth/bin/Release/net5.0/*
|
||||||
|
zip -j SpotifyAPI.Web.Auth-net6.0.zip SpotifyAPI.Web.Auth/bin/Release/net6.0/*
|
||||||
|
|
||||||
hub release edit \
|
hub release edit \
|
||||||
-a "SpotifyAPI.Web-netstandard2.0.zip" \
|
|
||||||
-a "SpotifyAPI.Web-netstandard2.1.zip" \
|
-a "SpotifyAPI.Web-netstandard2.1.zip" \
|
||||||
-a "SpotifyAPI.Web-net5.0.zip" \
|
-a "SpotifyAPI.Web-net5.0.zip" \
|
||||||
-a "SpotifyAPI.Web.Auth-netstandard2.0.zip" \
|
-a "SpotifyAPI.Web-net6.0.zip" \
|
||||||
-a "SpotifyAPI.Web.Auth-netstandard2.1.zip" \
|
-a "SpotifyAPI.Web.Auth-netstandard2.1.zip" \
|
||||||
-a "SpotifyAPI.Web.Auth-net5.0.zip" \
|
-a "SpotifyAPI.Web.Auth-net5.0.zip" \
|
||||||
|
-a "SpotifyAPI.Web.Auth-net6.0.zip" \
|
||||||
-m "" "$RELEASE_VERSION"
|
-m "" "$RELEASE_VERSION"
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>net5.0;netstandard2.1;netstandard2.0</TargetFrameworks>
|
<TargetFrameworks>net6.0;net5.0;netstandard2.1</TargetFrameworks>
|
||||||
<LangVersion>9.0</LangVersion>
|
<LangVersion>9.0</LangVersion>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<PackageId>SpotifyAPI.Web.Auth</PackageId>
|
<PackageId>SpotifyAPI.Web.Auth</PackageId>
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<UserSecretsId>da29eac4-4c22-4a7f-b393-379e83b60998</UserSecretsId>
|
<UserSecretsId>da29eac4-4c22-4a7f-b393-379e83b60998</UserSecretsId>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AspNet.Security.OAuth.Spotify" Version="5.0.18" />
|
<PackageReference Include="AspNet.Security.OAuth.Spotify" Version="6.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\SpotifyAPI.Web\SpotifyAPI.Web.csproj" />
|
<ProjectReference Include="..\..\SpotifyAPI.Web\SpotifyAPI.Web.csproj" />
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
|
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="5.0.10" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="6.0.0" PrivateAssets="all" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="6.0.0" PrivateAssets="all" />
|
||||||
<PackageReference Include="System.Net.Http.Json" Version="5.0.0" />
|
<PackageReference Include="System.Net.Http.Json" Version="6.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<LangVersion>8.0</LangVersion>
|
<LangVersion>8.0</LangVersion>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>net5.0;netcoreapp3.1;netcoreapp2.2</TargetFrameworks>
|
<TargetFrameworks>net6.0;net5.0;netcoreapp3.1</TargetFrameworks>
|
||||||
<LangVersion>9.0</LangVersion>
|
<LangVersion>9.0</LangVersion>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
@ -39,7 +39,6 @@ namespace SpotifyAPI.Web
|
|||||||
IAPIConnector connector
|
IAPIConnector connector
|
||||||
);
|
);
|
||||||
|
|
||||||
#if !NETSTANDARD2_0
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fetches all pages and returns one by one using IAsyncEnumerable
|
/// Fetches all pages and returns one by one using IAsyncEnumerable
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -69,6 +68,5 @@ namespace SpotifyAPI.Web
|
|||||||
IAPIConnector connector,
|
IAPIConnector connector,
|
||||||
CancellationToken cancel = default
|
CancellationToken cancel = default
|
||||||
);
|
);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,6 @@ namespace SpotifyAPI.Web
|
|||||||
IPaginator? paginator = default!
|
IPaginator? paginator = default!
|
||||||
);
|
);
|
||||||
|
|
||||||
#if !NETSTANDARD2_0
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Paginate through pages by using IAsyncEnumerable, introduced in C# 8
|
/// Paginate through pages by using IAsyncEnumerable, introduced in C# 8
|
||||||
/// The default paginator will fetch all available resources without a delay between requests.
|
/// The default paginator will fetch all available resources without a delay between requests.
|
||||||
@ -166,8 +165,6 @@ namespace SpotifyAPI.Web
|
|||||||
CancellationToken cancellationToken = default!
|
CancellationToken cancellationToken = default!
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
public Task<Paging<T>> NextPage<T>(Paging<T> paging);
|
public Task<Paging<T>> NextPage<T>(Paging<T> paging);
|
||||||
|
|
||||||
public Task<CursorPaging<T>> NextPage<T>(CursorPaging<T> cursorPaging);
|
public Task<CursorPaging<T>> NextPage<T>(CursorPaging<T> cursorPaging);
|
||||||
|
@ -68,7 +68,6 @@ namespace SpotifyAPI.Web
|
|||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !NETSTANDARD2_0
|
|
||||||
public async IAsyncEnumerable<T> Paginate<T>(
|
public async IAsyncEnumerable<T> Paginate<T>(
|
||||||
IPaginatable<T> firstPage,
|
IPaginatable<T> firstPage,
|
||||||
IAPIConnector connector,
|
IAPIConnector connector,
|
||||||
@ -125,6 +124,5 @@ namespace SpotifyAPI.Web
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -190,7 +190,6 @@ namespace SpotifyAPI.Web
|
|||||||
return FetchPage<TNext>(paging.Previous);
|
return FetchPage<TNext>(paging.Previous);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !NETSTANDARD2_0
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Paginate through pages by using IAsyncEnumerable, introduced in C# 8
|
/// Paginate through pages by using IAsyncEnumerable, introduced in C# 8
|
||||||
@ -298,6 +297,5 @@ namespace SpotifyAPI.Web
|
|||||||
yield return item;
|
yield return item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -218,15 +218,9 @@ namespace SpotifyAPI.Web.Http
|
|||||||
|
|
||||||
private async Task ApplyAuthenticator(IRequest request)
|
private async Task ApplyAuthenticator(IRequest request)
|
||||||
{
|
{
|
||||||
#if NETSTANDARD2_0
|
|
||||||
if (_authenticator != null
|
|
||||||
&& !request.Endpoint.IsAbsoluteUri
|
|
||||||
|| request.Endpoint.AbsoluteUri.Contains("https://api.spotify.com"))
|
|
||||||
#else
|
|
||||||
if (_authenticator != null
|
if (_authenticator != null
|
||||||
&& !request.Endpoint.IsAbsoluteUri
|
&& !request.Endpoint.IsAbsoluteUri
|
||||||
|| request.Endpoint.AbsoluteUri.Contains("https://api.spotify.com", StringComparison.InvariantCulture))
|
|| request.Endpoint.AbsoluteUri.Contains("https://api.spotify.com", StringComparison.InvariantCulture))
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
await _authenticator!.Apply(request, this).ConfigureAwait(false);
|
await _authenticator!.Apply(request, this).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
@ -27,11 +27,7 @@ namespace SpotifyAPI.Web.Http
|
|||||||
public void OnResponse(IResponse response)
|
public void OnResponse(IResponse response)
|
||||||
{
|
{
|
||||||
Ensure.ArgumentNotNull(response, nameof(response));
|
Ensure.ArgumentNotNull(response, nameof(response));
|
||||||
#if NETSTANDARD2_0
|
|
||||||
string? body = response.Body?.ToString().Replace("\n", "");
|
|
||||||
#else
|
|
||||||
string? body = response.Body?.ToString()?.Replace("\n", "", StringComparison.InvariantCulture);
|
string? body = response.Body?.ToString()?.Replace("\n", "", StringComparison.InvariantCulture);
|
||||||
#endif
|
|
||||||
|
|
||||||
body = body?.Substring(0, Math.Min(50, body.Length));
|
body = body?.Substring(0, Math.Min(50, body.Length));
|
||||||
Console.WriteLine("--> {0} {1} {2}\n", response.StatusCode, response.ContentType, body);
|
Console.WriteLine("--> {0} {1} {2}\n", response.StatusCode, response.ContentType, body);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>net5.0;netstandard2.1;netstandard2.0</TargetFrameworks>
|
<TargetFrameworks>net6.0;net5.0;netstandard2.1</TargetFrameworks>
|
||||||
<LangVersion>9.0</LangVersion>
|
<LangVersion>9.0</LangVersion>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<PackageId>SpotifyAPI.Web</PackageId>
|
<PackageId>SpotifyAPI.Web</PackageId>
|
||||||
|
@ -52,11 +52,12 @@ namespace SpotifyAPI.Web
|
|||||||
|
|
||||||
private static string GenerateRandomURLSafeString(int length)
|
private static string GenerateRandomURLSafeString(int length)
|
||||||
{
|
{
|
||||||
using var rng = new RNGCryptoServiceProvider();
|
|
||||||
var bit_count = length * 6;
|
var bit_count = length * 6;
|
||||||
var byte_count = (bit_count + 7) / 8; // rounded up
|
var byte_count = (bit_count + 7) / 8; // rounded up
|
||||||
var bytes = new byte[byte_count];
|
var bytes = new byte[byte_count];
|
||||||
rng.GetBytes(bytes);
|
|
||||||
|
using var generator = RandomNumberGenerator.Create();
|
||||||
|
generator.GetBytes(bytes);
|
||||||
return Base64Util.UrlEncode(bytes);
|
return Base64Util.UrlEncode(bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,11 +15,7 @@ namespace SpotifyAPI.Web
|
|||||||
|
|
||||||
public string Value { get; }
|
public string Value { get; }
|
||||||
|
|
||||||
#if NETSTANDARD2_0
|
|
||||||
public static bool GetValue(Type enumType, Enum enumValue, out string? result)
|
|
||||||
#else
|
|
||||||
public static bool GetValue(Type enumType, Enum enumValue, [NotNullWhen(true)] out string? result)
|
public static bool GetValue(Type enumType, Enum enumValue, [NotNullWhen(true)] out string? result)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
Ensure.ArgumentNotNull(enumType, nameof(enumType));
|
Ensure.ArgumentNotNull(enumType, nameof(enumType));
|
||||||
Ensure.ArgumentNotNull(enumValue, nameof(enumValue));
|
Ensure.ArgumentNotNull(enumValue, nameof(enumValue));
|
||||||
|
Loading…
Reference in New Issue
Block a user