mirror of
https://github.com/Sarsoo/Spotify.NET.git
synced 2024-12-23 14:46:26 +00:00
Compare commits
No commits in common. "46be74abd03b64246f06baae0e9c03717ac69fcb" and "fdde87e4760c3554b4c82c0b59084f1b22ba10b4" have entirely different histories.
46be74abd0
...
fdde87e476
31
.github/workflows/cicd.yaml
vendored
31
.github/workflows/cicd.yaml
vendored
@ -9,14 +9,14 @@ jobs:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- uses: actions/setup-dotnet@v3
|
||||
uses: actions/checkout@v2
|
||||
- uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: "5.x"
|
||||
- uses: actions/setup-dotnet@v3
|
||||
- uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: "6.x"
|
||||
- uses: actions/setup-dotnet@v3
|
||||
- uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: "7.0.203"
|
||||
- name: Set RELEASE_VERSION
|
||||
@ -49,28 +49,25 @@ jobs:
|
||||
- name: Upload to GH Release
|
||||
if: startsWith( github.ref, 'refs/tags/')
|
||||
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-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-net7.0.zip SpotifyAPI.Web/bin/Release/net7.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-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/*
|
||||
zip -j SpotifyAPI.Web.Auth-net7.0.zip SpotifyAPI.Web.Auth/bin/Release/net7.0/*
|
||||
|
||||
gh release upload "$RELEASE_VERSION" \
|
||||
"SpotifyAPI.Web-netstandard2.0.zip" \
|
||||
"SpotifyAPI.Web-netstandard2.1.zip" \
|
||||
"SpotifyAPI.Web-net5.0.zip" \
|
||||
"SpotifyAPI.Web-net6.0.zip" \
|
||||
"SpotifyAPI.Web-net7.0.zip" \
|
||||
"SpotifyAPI.Web.Auth-netstandard2.0.zip" \
|
||||
"SpotifyAPI.Web.Auth-netstandard2.1.zip" \
|
||||
"SpotifyAPI.Web.Auth-net5.0.zip" \
|
||||
"SpotifyAPI.Web.Auth-net6.0.zip" \
|
||||
"SpotifyAPI.Web.Auth-net7.0.zip"
|
||||
hub release edit \
|
||||
-a "SpotifyAPI.Web-netstandard2.1.zip" \
|
||||
-a "SpotifyAPI.Web-net5.0.zip" \
|
||||
-a "SpotifyAPI.Web-net6.0.zip" \
|
||||
-a "SpotifyAPI.Web-net7.0.zip" \
|
||||
-a "SpotifyAPI.Web.Auth-netstandard2.1.zip" \
|
||||
-a "SpotifyAPI.Web.Auth-net5.0.zip" \
|
||||
-a "SpotifyAPI.Web.Auth-net6.0.zip" \
|
||||
-a "SpotifyAPI.Web.Auth-net7.0.zip" \
|
||||
-m "" "$RELEASE_VERSION"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
12
.github/workflows/docs.yaml
vendored
12
.github/workflows/docs.yaml
vendored
@ -10,17 +10,11 @@ jobs:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- uses: pnpm/action-setup@v2
|
||||
with:
|
||||
version: 8
|
||||
uses: actions/checkout@v2
|
||||
- name: Use Node.JS
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: v20.9.0
|
||||
cache: "pnpm"
|
||||
cache-dependency-path: |
|
||||
SpotifyAPI.Docs/pnpm-lock.yaml
|
||||
node-version: 18.12.1
|
||||
- name: Setup GitHub Deploy SSH Key
|
||||
uses: webfactory/ssh-agent@v0.4.1
|
||||
with:
|
||||
|
@ -5,13 +5,13 @@ This website is built using [Docusaurus 2](https://v2.docusaurus.io/), a modern
|
||||
### Installation
|
||||
|
||||
```
|
||||
$ pnpm
|
||||
$ yarn
|
||||
```
|
||||
|
||||
### Local Development
|
||||
|
||||
```
|
||||
$ pnpm start
|
||||
$ yarn start
|
||||
```
|
||||
|
||||
This command starts a local development server and open up a browser window. Most changes are reflected live without having to restart the server.
|
||||
@ -19,7 +19,7 @@ This command starts a local development server and open up a browser window. Mos
|
||||
### Build
|
||||
|
||||
```
|
||||
$ pnpm build
|
||||
$ yarn build
|
||||
```
|
||||
|
||||
This command generates static content into the `build` directory and can be served using any static contents hosting service.
|
||||
@ -27,7 +27,7 @@ This command generates static content into the `build` directory and can be serv
|
||||
### Deployment
|
||||
|
||||
```
|
||||
$ GIT_USER=<Your GitHub username> USE_SSH=true pnpm deploy
|
||||
$ GIT_USER=<Your GitHub username> USE_SSH=true yarn deploy
|
||||
```
|
||||
|
||||
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
|
||||
|
@ -8,5 +8,5 @@ git config --global user.email "jonas@dellinger.dev"
|
||||
git config --global user.name "GH Actions Docs Builder"
|
||||
|
||||
cd ./SpotifyAPI.Docs
|
||||
pnpm i --frozen-lockfile
|
||||
USE_SSH=true GIT_USER=JohnnyCrazy pnpm run deploy
|
||||
yarn
|
||||
USE_SSH=true GIT_USER=JohnnyCrazy yarn deploy
|
||||
|
@ -14,12 +14,11 @@
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "^3.0.0",
|
||||
"@docusaurus/preset-classic": "^3.0.0",
|
||||
"@mdx-js/react": "^3.0.0",
|
||||
"@docusaurus/core": "^2.4.1",
|
||||
"@docusaurus/preset-classic": "^2.4.1",
|
||||
"classnames": "^2.3.1",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2",
|
||||
"react-github-btn": "^1.2.0"
|
||||
},
|
||||
"browserslist": {
|
||||
@ -36,7 +35,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"import-sort-style-module": "^6.0.0",
|
||||
"prettier": "^3.0.3",
|
||||
"prettier": "^2.8.8",
|
||||
"prettier-plugin-import-sort": "^0.0.7"
|
||||
}
|
||||
}
|
||||
|
9635
SpotifyAPI.Docs/pnpm-lock.yaml
generated
9635
SpotifyAPI.Docs/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -1,12 +1,12 @@
|
||||
{
|
||||
"someSidebar": [
|
||||
"version-5.1.1/someSidebar": [
|
||||
{
|
||||
"type": "category",
|
||||
"label": "SpotifyAPI-NET",
|
||||
"items": [
|
||||
{
|
||||
"type": "doc",
|
||||
"id": "home"
|
||||
"id": "version-5.1.1/home"
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -16,59 +16,59 @@
|
||||
"items": [
|
||||
{
|
||||
"type": "doc",
|
||||
"id": "web/getting_started"
|
||||
"id": "version-5.1.1/web/getting_started"
|
||||
},
|
||||
{
|
||||
"type": "doc",
|
||||
"id": "web/albums"
|
||||
"id": "version-5.1.1/web/albums"
|
||||
},
|
||||
{
|
||||
"type": "doc",
|
||||
"id": "web/artists"
|
||||
"id": "version-5.1.1/web/artists"
|
||||
},
|
||||
{
|
||||
"type": "doc",
|
||||
"id": "web/browse"
|
||||
"id": "version-5.1.1/web/browse"
|
||||
},
|
||||
{
|
||||
"type": "doc",
|
||||
"id": "web/follow"
|
||||
"id": "version-5.1.1/web/follow"
|
||||
},
|
||||
{
|
||||
"type": "doc",
|
||||
"id": "web/library"
|
||||
"id": "version-5.1.1/web/library"
|
||||
},
|
||||
{
|
||||
"type": "doc",
|
||||
"id": "web/personalization"
|
||||
"id": "version-5.1.1/web/personalization"
|
||||
},
|
||||
{
|
||||
"type": "doc",
|
||||
"id": "web/player"
|
||||
"id": "version-5.1.1/web/player"
|
||||
},
|
||||
{
|
||||
"type": "doc",
|
||||
"id": "web/playlists"
|
||||
"id": "version-5.1.1/web/playlists"
|
||||
},
|
||||
{
|
||||
"type": "doc",
|
||||
"id": "web/profiles"
|
||||
"id": "version-5.1.1/web/profiles"
|
||||
},
|
||||
{
|
||||
"type": "doc",
|
||||
"id": "web/proxy"
|
||||
"id": "version-5.1.1/web/proxy"
|
||||
},
|
||||
{
|
||||
"type": "doc",
|
||||
"id": "web/search"
|
||||
"id": "version-5.1.1/web/search"
|
||||
},
|
||||
{
|
||||
"type": "doc",
|
||||
"id": "web/tracks"
|
||||
"id": "version-5.1.1/web/tracks"
|
||||
},
|
||||
{
|
||||
"type": "doc",
|
||||
"id": "web/utilities"
|
||||
"id": "version-5.1.1/web/utilities"
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -78,23 +78,23 @@
|
||||
"items": [
|
||||
{
|
||||
"type": "doc",
|
||||
"id": "auth/getting_started"
|
||||
"id": "version-5.1.1/auth/getting_started"
|
||||
},
|
||||
{
|
||||
"type": "doc",
|
||||
"id": "auth/implicit_grant"
|
||||
"id": "version-5.1.1/auth/implicit_grant"
|
||||
},
|
||||
{
|
||||
"type": "doc",
|
||||
"id": "auth/authorization_code"
|
||||
"id": "version-5.1.1/auth/authorization_code"
|
||||
},
|
||||
{
|
||||
"type": "doc",
|
||||
"id": "auth/client_credentials"
|
||||
"id": "version-5.1.1/auth/client_credentials"
|
||||
},
|
||||
{
|
||||
"type": "doc",
|
||||
"id": "auth/token_swap"
|
||||
"id": "version-5.1.1/auth/token_swap"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
7979
SpotifyAPI.Docs/yarn.lock
Normal file
7979
SpotifyAPI.Docs/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net7.0;net6.0;net5.0;netstandard2.1;netstandard2.0</TargetFrameworks>
|
||||
<TargetFrameworks>net7.0;net6.0;net5.0;netstandard2.1</TargetFrameworks>
|
||||
<LangVersion>9.0</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<PackageId>SpotifyAPI.Web.Auth</PackageId>
|
||||
@ -23,7 +23,6 @@
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<EmbedUntrackedSources>true</EmbedUntrackedSources>
|
||||
<NoWarn>1591</NoWarn>
|
||||
<CheckEolTargetFramework>false</CheckEolTargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(APPVEYOR)' == 'true'">
|
||||
|
@ -4,7 +4,6 @@
|
||||
<TargetFrameworks>net7.0;net6.0;net5.0</TargetFrameworks>
|
||||
<LangVersion>9.0</LangVersion>
|
||||
<IsPackable>false</IsPackable>
|
||||
<CheckEolTargetFramework>false</CheckEolTargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -42,7 +42,6 @@ namespace SpotifyAPI.Web
|
||||
CancellationToken cancel = default
|
||||
);
|
||||
|
||||
#if NETSTANDARD2_1_OR_GREATER || NET5_0_OR_GREATER
|
||||
/// <summary>
|
||||
/// Fetches all pages and returns one by one using IAsyncEnumerable
|
||||
/// </summary>
|
||||
@ -72,6 +71,5 @@ namespace SpotifyAPI.Web
|
||||
IAPIConnector connector,
|
||||
CancellationToken cancel = default
|
||||
);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -120,18 +120,15 @@ namespace SpotifyAPI.Web
|
||||
/// <param name="firstPage">A first page, will be included in the output list!</param>
|
||||
/// <param name="mapper">A function which maps response objects to the next paging object</param>
|
||||
/// <param name="paginator">Optional. If not supplied, DefaultPaginator will be used</param>
|
||||
/// <param name="cancellationToken">The cancellation-token to allow to cancel the request.</param>
|
||||
/// <typeparam name="T">The Paging-Type</typeparam>
|
||||
/// <typeparam name="TNext">The Response-Type</typeparam>
|
||||
/// <returns>A list containing all fetched pages</returns>
|
||||
Task<IList<T>> PaginateAll<T, TNext>(
|
||||
IPaginatable<T, TNext> firstPage,
|
||||
Func<TNext, IPaginatable<T, TNext>> mapper,
|
||||
IPaginator? paginator = default!,
|
||||
CancellationToken cancellationToken = default!
|
||||
IPaginator? paginator = default!
|
||||
);
|
||||
|
||||
#if NETSTANDARD2_1_OR_GREATER || NET5_0_OR_GREATER
|
||||
/// <summary>
|
||||
/// Paginate through pages by using IAsyncEnumerable, introduced in C# 8
|
||||
/// The default paginator will fetch all available resources without a delay between requests.
|
||||
@ -145,7 +142,7 @@ namespace SpotifyAPI.Web
|
||||
IAsyncEnumerable<T> Paginate<T>(
|
||||
IPaginatable<T> firstPage,
|
||||
IPaginator? paginator = default!,
|
||||
CancellationToken cancel = default
|
||||
CancellationToken cancel = default!
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
@ -168,7 +165,6 @@ namespace SpotifyAPI.Web
|
||||
IPaginator? paginator = default!,
|
||||
CancellationToken cancel = default!
|
||||
);
|
||||
#endif
|
||||
|
||||
public Task<Paging<T>> NextPage<T>(Paging<T> paging);
|
||||
|
||||
|
@ -69,7 +69,6 @@ namespace SpotifyAPI.Web
|
||||
return results;
|
||||
}
|
||||
|
||||
#if NETSTANDARD2_1_OR_GREATER || NET5_0_OR_GREATER
|
||||
public async IAsyncEnumerable<T> Paginate<T>(
|
||||
IPaginatable<T> firstPage,
|
||||
IAPIConnector connector,
|
||||
@ -126,6 +125,5 @@ namespace SpotifyAPI.Web
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -109,18 +109,16 @@ namespace SpotifyAPI.Web
|
||||
/// <param name="firstPage">A first page, will be included in the output list!</param>
|
||||
/// <param name="mapper">A function which maps response objects to the next paging object</param>
|
||||
/// <param name="paginator">Optional. If not supplied, DefaultPaginator will be used</param>
|
||||
/// <param name="cancellationToken">The cancellation-token to allow to cancel the request.</param>
|
||||
/// <typeparam name="T">The Paging-Type</typeparam>
|
||||
/// <typeparam name="TNext">The Response-Type</typeparam>
|
||||
/// <returns>A list containing all fetched pages</returns>
|
||||
public Task<IList<T>> PaginateAll<T, TNext>(
|
||||
IPaginatable<T, TNext> firstPage,
|
||||
Func<TNext, IPaginatable<T, TNext>> mapper,
|
||||
IPaginator? paginator = null,
|
||||
CancellationToken cancellationToken = default
|
||||
IPaginator? paginator = null
|
||||
)
|
||||
{
|
||||
return (paginator ?? DefaultPaginator).PaginateAll(firstPage, mapper, _apiConnector, cancellationToken);
|
||||
return (paginator ?? DefaultPaginator).PaginateAll(firstPage, mapper, _apiConnector);
|
||||
}
|
||||
|
||||
private Task<T> FetchPage<T>(string? nextUrl)
|
||||
@ -196,7 +194,7 @@ namespace SpotifyAPI.Web
|
||||
return FetchPage<TNext>(paging.Previous);
|
||||
}
|
||||
|
||||
#if NETSTANDARD2_1_OR_GREATER || NET5_0_OR_GREATER
|
||||
|
||||
/// <summary>
|
||||
/// Paginate through pages by using IAsyncEnumerable, introduced in C# 8
|
||||
/// The default paginator will fetch all available resources without a delay between requests.
|
||||
@ -303,6 +301,5 @@ namespace SpotifyAPI.Web
|
||||
yield return item;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -221,11 +221,7 @@ namespace SpotifyAPI.Web.Http
|
||||
{
|
||||
if (_authenticator != null
|
||||
&& !request.Endpoint.IsAbsoluteUri
|
||||
#if NETSTANDARD2_1_OR_GREATER || NET5_0_OR_GREATER
|
||||
|| request.Endpoint.AbsoluteUri.Contains("https://api.spotify.com", StringComparison.InvariantCulture))
|
||||
#else
|
||||
|| request.Endpoint.AbsoluteUri.Contains("https://api.spotify.com"))
|
||||
#endif
|
||||
{
|
||||
await _authenticator!.Apply(request, this).ConfigureAwait(false);
|
||||
}
|
||||
|
@ -50,10 +50,10 @@ namespace SpotifyAPI.Web.Http
|
||||
// We only support text stuff for now
|
||||
using var content = responseMsg.Content;
|
||||
var headers = responseMsg.Headers.ToDictionary(header => header.Key, header => header.Value.First());
|
||||
#if NET5_0_OR_GREATER
|
||||
var body = await responseMsg.Content.ReadAsStringAsync(cancel).ConfigureAwait(false);
|
||||
#else
|
||||
#if NETSTANDARD2_1
|
||||
var body = await responseMsg.Content.ReadAsStringAsync().ConfigureAwait(false);
|
||||
#else
|
||||
var body = await responseMsg.Content.ReadAsStringAsync(cancel).ConfigureAwait(false);
|
||||
#endif
|
||||
var contentType = content.Headers?.ContentType?.MediaType;
|
||||
|
||||
|
@ -7,6 +7,7 @@ namespace SpotifyAPI.Web.Http
|
||||
{
|
||||
private const string OnRequestFormat = "\n{0} {1} [{2}] {3}";
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1303")]
|
||||
public void OnRequest(IRequest request)
|
||||
{
|
||||
Ensure.ArgumentNotNull(request, nameof(request));
|
||||
@ -22,14 +23,12 @@ namespace SpotifyAPI.Web.Http
|
||||
Console.WriteLine(OnRequestFormat, request.Method, request.Endpoint, parameters, request.Body);
|
||||
}
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1303")]
|
||||
public void OnResponse(IResponse response)
|
||||
{
|
||||
Ensure.ArgumentNotNull(response, nameof(response));
|
||||
#if NETSTANDARD2_1_OR_GREATER || NET5_0_OR_GREATER
|
||||
string? body = response.Body?.ToString()?.Replace("\n", "", StringComparison.InvariantCulture);
|
||||
#else
|
||||
string? body = response.Body?.ToString()?.Replace("\n", "");
|
||||
#endif
|
||||
|
||||
body = body?.Substring(0, Math.Min(50, body.Length));
|
||||
Console.WriteLine("--> {0} {1} {2}\n", response.StatusCode, response.ContentType, body);
|
||||
}
|
||||
|
@ -21,9 +21,9 @@ namespace SpotifyAPI.Web
|
||||
var body = new JObject();
|
||||
var type = GetType();
|
||||
|
||||
if (!_bodyParamsCache.IsEmpty && _bodyParamsCache.TryGetValue(type, out var bodyParamsCached))
|
||||
if (!_bodyParamsCache.IsEmpty && _bodyParamsCache.ContainsKey(type))
|
||||
{
|
||||
foreach (var (info, attribute) in bodyParamsCached)
|
||||
foreach (var (info, attribute) in _bodyParamsCache[type])
|
||||
{
|
||||
AddBodyParam(body, info, attribute);
|
||||
}
|
||||
@ -70,9 +70,9 @@ namespace SpotifyAPI.Web
|
||||
var queryParams = new Dictionary<string, string>();
|
||||
var type = GetType();
|
||||
|
||||
if (!_queryParamsCache.IsEmpty && _queryParamsCache.TryGetValue(type, out var queryParamsCached))
|
||||
if (!_queryParamsCache.IsEmpty && _queryParamsCache.ContainsKey(type))
|
||||
{
|
||||
foreach (var (info, attribute) in queryParamsCached)
|
||||
foreach (var (info, attribute) in _queryParamsCache[type])
|
||||
{
|
||||
AddQueryParam(queryParams, info, attribute);
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net7.0;net6.0;net5.0;netstandard2.1;netstandard2.0</TargetFrameworks>
|
||||
<TargetFrameworks>net7.0;net6.0;net5.0;netstandard2.1</TargetFrameworks>
|
||||
<LangVersion>9.0</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<PackageId>SpotifyAPI.Web</PackageId>
|
||||
@ -24,7 +24,6 @@
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<EmbedUntrackedSources>true</EmbedUntrackedSources>
|
||||
<NoWarn>1591</NoWarn>
|
||||
<CheckEolTargetFramework>false</CheckEolTargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
|
||||
|
@ -63,12 +63,8 @@ namespace SpotifyAPI.Web
|
||||
|
||||
private static byte[] ComputeSHA256(string value)
|
||||
{
|
||||
#if NET5_0_OR_GREATER
|
||||
return SHA256.HashData(Encoding.UTF8.GetBytes(value));
|
||||
#else
|
||||
using var hash = SHA256.Create();
|
||||
return hash.ComputeHash(Encoding.UTF8.GetBytes(value));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,11 +15,7 @@ namespace SpotifyAPI.Web
|
||||
|
||||
public string Value { get; }
|
||||
|
||||
#if NETSTANDARD2_1_OR_GREATER || NET5_0_OR_GREATER
|
||||
public static bool GetValue(Type enumType, Enum enumValue, [NotNullWhen(true)] out string? result)
|
||||
#else
|
||||
public static bool GetValue(Type enumType, Enum enumValue, out string? result)
|
||||
#endif
|
||||
{
|
||||
Ensure.ArgumentNotNull(enumType, nameof(enumType));
|
||||
Ensure.ArgumentNotNull(enumValue, nameof(enumValue));
|
||||
|
Loading…
Reference in New Issue
Block a user