mirror of
https://github.com/Sarsoo/Spotify.NET.git
synced 2024-12-23 22:56:25 +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
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v2
|
||||||
- uses: actions/setup-dotnet@v3
|
- uses: actions/setup-dotnet@v1
|
||||||
with:
|
with:
|
||||||
dotnet-version: "5.x"
|
dotnet-version: "5.x"
|
||||||
- uses: actions/setup-dotnet@v3
|
- uses: actions/setup-dotnet@v1
|
||||||
with:
|
with:
|
||||||
dotnet-version: "6.x"
|
dotnet-version: "6.x"
|
||||||
- uses: actions/setup-dotnet@v3
|
- uses: actions/setup-dotnet@v1
|
||||||
with:
|
with:
|
||||||
dotnet-version: "7.0.203"
|
dotnet-version: "7.0.203"
|
||||||
- name: Set RELEASE_VERSION
|
- name: Set RELEASE_VERSION
|
||||||
@ -49,28 +49,25 @@ 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-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-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-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/*
|
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/*
|
zip -j SpotifyAPI.Web.Auth-net7.0.zip SpotifyAPI.Web.Auth/bin/Release/net7.0/*
|
||||||
|
|
||||||
gh release upload "$RELEASE_VERSION" \
|
hub release edit \
|
||||||
"SpotifyAPI.Web-netstandard2.0.zip" \
|
-a "SpotifyAPI.Web-netstandard2.1.zip" \
|
||||||
"SpotifyAPI.Web-netstandard2.1.zip" \
|
-a "SpotifyAPI.Web-net5.0.zip" \
|
||||||
"SpotifyAPI.Web-net5.0.zip" \
|
-a "SpotifyAPI.Web-net6.0.zip" \
|
||||||
"SpotifyAPI.Web-net6.0.zip" \
|
-a "SpotifyAPI.Web-net7.0.zip" \
|
||||||
"SpotifyAPI.Web-net7.0.zip" \
|
-a "SpotifyAPI.Web.Auth-netstandard2.1.zip" \
|
||||||
"SpotifyAPI.Web.Auth-netstandard2.0.zip" \
|
-a "SpotifyAPI.Web.Auth-net5.0.zip" \
|
||||||
"SpotifyAPI.Web.Auth-netstandard2.1.zip" \
|
-a "SpotifyAPI.Web.Auth-net6.0.zip" \
|
||||||
"SpotifyAPI.Web.Auth-net5.0.zip" \
|
-a "SpotifyAPI.Web.Auth-net7.0.zip" \
|
||||||
"SpotifyAPI.Web.Auth-net6.0.zip" \
|
-m "" "$RELEASE_VERSION"
|
||||||
"SpotifyAPI.Web.Auth-net7.0.zip"
|
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
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
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v2
|
||||||
- uses: pnpm/action-setup@v2
|
|
||||||
with:
|
|
||||||
version: 8
|
|
||||||
- name: Use Node.JS
|
- name: Use Node.JS
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v1
|
||||||
with:
|
with:
|
||||||
node-version: v20.9.0
|
node-version: 18.12.1
|
||||||
cache: "pnpm"
|
|
||||||
cache-dependency-path: |
|
|
||||||
SpotifyAPI.Docs/pnpm-lock.yaml
|
|
||||||
- name: Setup GitHub Deploy SSH Key
|
- name: Setup GitHub Deploy SSH Key
|
||||||
uses: webfactory/ssh-agent@v0.4.1
|
uses: webfactory/ssh-agent@v0.4.1
|
||||||
with:
|
with:
|
||||||
|
@ -5,13 +5,13 @@ This website is built using [Docusaurus 2](https://v2.docusaurus.io/), a modern
|
|||||||
### Installation
|
### Installation
|
||||||
|
|
||||||
```
|
```
|
||||||
$ pnpm
|
$ yarn
|
||||||
```
|
```
|
||||||
|
|
||||||
### Local Development
|
### 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.
|
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
|
### Build
|
||||||
|
|
||||||
```
|
```
|
||||||
$ pnpm build
|
$ yarn build
|
||||||
```
|
```
|
||||||
|
|
||||||
This command generates static content into the `build` directory and can be served using any static contents hosting service.
|
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
|
### 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.
|
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"
|
git config --global user.name "GH Actions Docs Builder"
|
||||||
|
|
||||||
cd ./SpotifyAPI.Docs
|
cd ./SpotifyAPI.Docs
|
||||||
pnpm i --frozen-lockfile
|
yarn
|
||||||
USE_SSH=true GIT_USER=JohnnyCrazy pnpm run deploy
|
USE_SSH=true GIT_USER=JohnnyCrazy yarn deploy
|
||||||
|
@ -14,12 +14,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@docusaurus/core": "^3.0.0",
|
"@docusaurus/core": "^2.4.1",
|
||||||
"@docusaurus/preset-classic": "^3.0.0",
|
"@docusaurus/preset-classic": "^2.4.1",
|
||||||
"@mdx-js/react": "^3.0.0",
|
|
||||||
"classnames": "^2.3.1",
|
"classnames": "^2.3.1",
|
||||||
"react": "^18.2.0",
|
"react": "^17.0.2",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^17.0.2",
|
||||||
"react-github-btn": "^1.2.0"
|
"react-github-btn": "^1.2.0"
|
||||||
},
|
},
|
||||||
"browserslist": {
|
"browserslist": {
|
||||||
@ -36,7 +35,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"import-sort-style-module": "^6.0.0",
|
"import-sort-style-module": "^6.0.0",
|
||||||
"prettier": "^3.0.3",
|
"prettier": "^2.8.8",
|
||||||
"prettier-plugin-import-sort": "^0.0.7"
|
"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",
|
"type": "category",
|
||||||
"label": "SpotifyAPI-NET",
|
"label": "SpotifyAPI-NET",
|
||||||
"items": [
|
"items": [
|
||||||
{
|
{
|
||||||
"type": "doc",
|
"type": "doc",
|
||||||
"id": "home"
|
"id": "version-5.1.1/home"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -16,59 +16,59 @@
|
|||||||
"items": [
|
"items": [
|
||||||
{
|
{
|
||||||
"type": "doc",
|
"type": "doc",
|
||||||
"id": "web/getting_started"
|
"id": "version-5.1.1/web/getting_started"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "doc",
|
"type": "doc",
|
||||||
"id": "web/albums"
|
"id": "version-5.1.1/web/albums"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "doc",
|
"type": "doc",
|
||||||
"id": "web/artists"
|
"id": "version-5.1.1/web/artists"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "doc",
|
"type": "doc",
|
||||||
"id": "web/browse"
|
"id": "version-5.1.1/web/browse"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "doc",
|
"type": "doc",
|
||||||
"id": "web/follow"
|
"id": "version-5.1.1/web/follow"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "doc",
|
"type": "doc",
|
||||||
"id": "web/library"
|
"id": "version-5.1.1/web/library"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "doc",
|
"type": "doc",
|
||||||
"id": "web/personalization"
|
"id": "version-5.1.1/web/personalization"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "doc",
|
"type": "doc",
|
||||||
"id": "web/player"
|
"id": "version-5.1.1/web/player"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "doc",
|
"type": "doc",
|
||||||
"id": "web/playlists"
|
"id": "version-5.1.1/web/playlists"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "doc",
|
"type": "doc",
|
||||||
"id": "web/profiles"
|
"id": "version-5.1.1/web/profiles"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "doc",
|
"type": "doc",
|
||||||
"id": "web/proxy"
|
"id": "version-5.1.1/web/proxy"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "doc",
|
"type": "doc",
|
||||||
"id": "web/search"
|
"id": "version-5.1.1/web/search"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "doc",
|
"type": "doc",
|
||||||
"id": "web/tracks"
|
"id": "version-5.1.1/web/tracks"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "doc",
|
"type": "doc",
|
||||||
"id": "web/utilities"
|
"id": "version-5.1.1/web/utilities"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -78,23 +78,23 @@
|
|||||||
"items": [
|
"items": [
|
||||||
{
|
{
|
||||||
"type": "doc",
|
"type": "doc",
|
||||||
"id": "auth/getting_started"
|
"id": "version-5.1.1/auth/getting_started"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "doc",
|
"type": "doc",
|
||||||
"id": "auth/implicit_grant"
|
"id": "version-5.1.1/auth/implicit_grant"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "doc",
|
"type": "doc",
|
||||||
"id": "auth/authorization_code"
|
"id": "version-5.1.1/auth/authorization_code"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "doc",
|
"type": "doc",
|
||||||
"id": "auth/client_credentials"
|
"id": "version-5.1.1/auth/client_credentials"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "doc",
|
"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">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<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>
|
<LangVersion>9.0</LangVersion>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<PackageId>SpotifyAPI.Web.Auth</PackageId>
|
<PackageId>SpotifyAPI.Web.Auth</PackageId>
|
||||||
@ -23,7 +23,6 @@
|
|||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
<EmbedUntrackedSources>true</EmbedUntrackedSources>
|
<EmbedUntrackedSources>true</EmbedUntrackedSources>
|
||||||
<NoWarn>1591</NoWarn>
|
<NoWarn>1591</NoWarn>
|
||||||
<CheckEolTargetFramework>false</CheckEolTargetFramework>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(APPVEYOR)' == 'true'">
|
<PropertyGroup Condition="'$(APPVEYOR)' == 'true'">
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
<TargetFrameworks>net7.0;net6.0;net5.0</TargetFrameworks>
|
<TargetFrameworks>net7.0;net6.0;net5.0</TargetFrameworks>
|
||||||
<LangVersion>9.0</LangVersion>
|
<LangVersion>9.0</LangVersion>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
<CheckEolTargetFramework>false</CheckEolTargetFramework>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -42,7 +42,6 @@ namespace SpotifyAPI.Web
|
|||||||
CancellationToken cancel = default
|
CancellationToken cancel = default
|
||||||
);
|
);
|
||||||
|
|
||||||
#if NETSTANDARD2_1_OR_GREATER || NET5_0_OR_GREATER
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fetches all pages and returns one by one using IAsyncEnumerable
|
/// Fetches all pages and returns one by one using IAsyncEnumerable
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -72,6 +71,5 @@ namespace SpotifyAPI.Web
|
|||||||
IAPIConnector connector,
|
IAPIConnector connector,
|
||||||
CancellationToken cancel = default
|
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="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="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="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="T">The Paging-Type</typeparam>
|
||||||
/// <typeparam name="TNext">The Response-Type</typeparam>
|
/// <typeparam name="TNext">The Response-Type</typeparam>
|
||||||
/// <returns>A list containing all fetched pages</returns>
|
/// <returns>A list containing all fetched pages</returns>
|
||||||
Task<IList<T>> PaginateAll<T, TNext>(
|
Task<IList<T>> PaginateAll<T, TNext>(
|
||||||
IPaginatable<T, TNext> firstPage,
|
IPaginatable<T, TNext> firstPage,
|
||||||
Func<TNext, IPaginatable<T, TNext>> mapper,
|
Func<TNext, IPaginatable<T, TNext>> mapper,
|
||||||
IPaginator? paginator = default!,
|
IPaginator? paginator = default!
|
||||||
CancellationToken cancellationToken = default!
|
|
||||||
);
|
);
|
||||||
|
|
||||||
#if NETSTANDARD2_1_OR_GREATER || NET5_0_OR_GREATER
|
|
||||||
/// <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.
|
||||||
@ -145,7 +142,7 @@ namespace SpotifyAPI.Web
|
|||||||
IAsyncEnumerable<T> Paginate<T>(
|
IAsyncEnumerable<T> Paginate<T>(
|
||||||
IPaginatable<T> firstPage,
|
IPaginatable<T> firstPage,
|
||||||
IPaginator? paginator = default!,
|
IPaginator? paginator = default!,
|
||||||
CancellationToken cancel = default
|
CancellationToken cancel = default!
|
||||||
);
|
);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -168,7 +165,6 @@ namespace SpotifyAPI.Web
|
|||||||
IPaginator? paginator = default!,
|
IPaginator? paginator = default!,
|
||||||
CancellationToken cancel = default!
|
CancellationToken cancel = default!
|
||||||
);
|
);
|
||||||
#endif
|
|
||||||
|
|
||||||
public Task<Paging<T>> NextPage<T>(Paging<T> paging);
|
public Task<Paging<T>> NextPage<T>(Paging<T> paging);
|
||||||
|
|
||||||
|
@ -69,7 +69,6 @@ namespace SpotifyAPI.Web
|
|||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if NETSTANDARD2_1_OR_GREATER || NET5_0_OR_GREATER
|
|
||||||
public async IAsyncEnumerable<T> Paginate<T>(
|
public async IAsyncEnumerable<T> Paginate<T>(
|
||||||
IPaginatable<T> firstPage,
|
IPaginatable<T> firstPage,
|
||||||
IAPIConnector connector,
|
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="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="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="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="T">The Paging-Type</typeparam>
|
||||||
/// <typeparam name="TNext">The Response-Type</typeparam>
|
/// <typeparam name="TNext">The Response-Type</typeparam>
|
||||||
/// <returns>A list containing all fetched pages</returns>
|
/// <returns>A list containing all fetched pages</returns>
|
||||||
public Task<IList<T>> PaginateAll<T, TNext>(
|
public Task<IList<T>> PaginateAll<T, TNext>(
|
||||||
IPaginatable<T, TNext> firstPage,
|
IPaginatable<T, TNext> firstPage,
|
||||||
Func<TNext, IPaginatable<T, TNext>> mapper,
|
Func<TNext, IPaginatable<T, TNext>> mapper,
|
||||||
IPaginator? paginator = null,
|
IPaginator? paginator = null
|
||||||
CancellationToken cancellationToken = default
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return (paginator ?? DefaultPaginator).PaginateAll(firstPage, mapper, _apiConnector, cancellationToken);
|
return (paginator ?? DefaultPaginator).PaginateAll(firstPage, mapper, _apiConnector);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Task<T> FetchPage<T>(string? nextUrl)
|
private Task<T> FetchPage<T>(string? nextUrl)
|
||||||
@ -196,7 +194,7 @@ namespace SpotifyAPI.Web
|
|||||||
return FetchPage<TNext>(paging.Previous);
|
return FetchPage<TNext>(paging.Previous);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if NETSTANDARD2_1_OR_GREATER || NET5_0_OR_GREATER
|
|
||||||
/// <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.
|
||||||
@ -303,6 +301,5 @@ namespace SpotifyAPI.Web
|
|||||||
yield return item;
|
yield return item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -221,11 +221,7 @@ namespace SpotifyAPI.Web.Http
|
|||||||
{
|
{
|
||||||
if (_authenticator != null
|
if (_authenticator != null
|
||||||
&& !request.Endpoint.IsAbsoluteUri
|
&& !request.Endpoint.IsAbsoluteUri
|
||||||
#if NETSTANDARD2_1_OR_GREATER || NET5_0_OR_GREATER
|
|
||||||
|| request.Endpoint.AbsoluteUri.Contains("https://api.spotify.com", StringComparison.InvariantCulture))
|
|| 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);
|
await _authenticator!.Apply(request, this).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
@ -50,10 +50,10 @@ namespace SpotifyAPI.Web.Http
|
|||||||
// We only support text stuff for now
|
// We only support text stuff for now
|
||||||
using var content = responseMsg.Content;
|
using var content = responseMsg.Content;
|
||||||
var headers = responseMsg.Headers.ToDictionary(header => header.Key, header => header.Value.First());
|
var headers = responseMsg.Headers.ToDictionary(header => header.Key, header => header.Value.First());
|
||||||
#if NET5_0_OR_GREATER
|
#if NETSTANDARD2_1
|
||||||
var body = await responseMsg.Content.ReadAsStringAsync(cancel).ConfigureAwait(false);
|
|
||||||
#else
|
|
||||||
var body = await responseMsg.Content.ReadAsStringAsync().ConfigureAwait(false);
|
var body = await responseMsg.Content.ReadAsStringAsync().ConfigureAwait(false);
|
||||||
|
#else
|
||||||
|
var body = await responseMsg.Content.ReadAsStringAsync(cancel).ConfigureAwait(false);
|
||||||
#endif
|
#endif
|
||||||
var contentType = content.Headers?.ContentType?.MediaType;
|
var contentType = content.Headers?.ContentType?.MediaType;
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ namespace SpotifyAPI.Web.Http
|
|||||||
{
|
{
|
||||||
private const string OnRequestFormat = "\n{0} {1} [{2}] {3}";
|
private const string OnRequestFormat = "\n{0} {1} [{2}] {3}";
|
||||||
|
|
||||||
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1303")]
|
||||||
public void OnRequest(IRequest request)
|
public void OnRequest(IRequest request)
|
||||||
{
|
{
|
||||||
Ensure.ArgumentNotNull(request, nameof(request));
|
Ensure.ArgumentNotNull(request, nameof(request));
|
||||||
@ -22,14 +23,12 @@ namespace SpotifyAPI.Web.Http
|
|||||||
Console.WriteLine(OnRequestFormat, request.Method, request.Endpoint, parameters, request.Body);
|
Console.WriteLine(OnRequestFormat, request.Method, request.Endpoint, parameters, request.Body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1303")]
|
||||||
public void OnResponse(IResponse response)
|
public void OnResponse(IResponse response)
|
||||||
{
|
{
|
||||||
Ensure.ArgumentNotNull(response, nameof(response));
|
Ensure.ArgumentNotNull(response, nameof(response));
|
||||||
#if NETSTANDARD2_1_OR_GREATER || NET5_0_OR_GREATER
|
|
||||||
string? body = response.Body?.ToString()?.Replace("\n", "", StringComparison.InvariantCulture);
|
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));
|
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);
|
||||||
}
|
}
|
||||||
|
@ -21,9 +21,9 @@ namespace SpotifyAPI.Web
|
|||||||
var body = new JObject();
|
var body = new JObject();
|
||||||
var type = GetType();
|
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);
|
AddBodyParam(body, info, attribute);
|
||||||
}
|
}
|
||||||
@ -70,9 +70,9 @@ namespace SpotifyAPI.Web
|
|||||||
var queryParams = new Dictionary<string, string>();
|
var queryParams = new Dictionary<string, string>();
|
||||||
var type = GetType();
|
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);
|
AddQueryParam(queryParams, info, attribute);
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<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>
|
<LangVersion>9.0</LangVersion>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<PackageId>SpotifyAPI.Web</PackageId>
|
<PackageId>SpotifyAPI.Web</PackageId>
|
||||||
@ -24,7 +24,6 @@
|
|||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
<EmbedUntrackedSources>true</EmbedUntrackedSources>
|
<EmbedUntrackedSources>true</EmbedUntrackedSources>
|
||||||
<NoWarn>1591</NoWarn>
|
<NoWarn>1591</NoWarn>
|
||||||
<CheckEolTargetFramework>false</CheckEolTargetFramework>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
|
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
|
||||||
|
@ -63,12 +63,8 @@ namespace SpotifyAPI.Web
|
|||||||
|
|
||||||
private static byte[] ComputeSHA256(string value)
|
private static byte[] ComputeSHA256(string value)
|
||||||
{
|
{
|
||||||
#if NET5_0_OR_GREATER
|
|
||||||
return SHA256.HashData(Encoding.UTF8.GetBytes(value));
|
|
||||||
#else
|
|
||||||
using var hash = SHA256.Create();
|
using var hash = SHA256.Create();
|
||||||
return hash.ComputeHash(Encoding.UTF8.GetBytes(value));
|
return hash.ComputeHash(Encoding.UTF8.GetBytes(value));
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,11 +15,7 @@ namespace SpotifyAPI.Web
|
|||||||
|
|
||||||
public string Value { get; }
|
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)
|
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(enumType, nameof(enumType));
|
||||||
Ensure.ArgumentNotNull(enumValue, nameof(enumValue));
|
Ensure.ArgumentNotNull(enumValue, nameof(enumValue));
|
||||||
|
Loading…
Reference in New Issue
Block a user