Skip to content

Commit 4f4903e

Browse files
authored
Merge pull request #319 from adamint/dev/generate-rest-action-methods-update-api
Dev/generate rest action methods update api
2 parents 5bff8a7 + fbcf8e5 commit 4f4903e

File tree

129 files changed

+3730
-5619
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+3730
-5619
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ on:
1414
jobs:
1515
test_android_jvm_linux_trusted:
1616
runs-on: ubuntu-latest
17+
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
1718
environment: testing
1819
env:
1920
SPOTIFY_CLIENT_ID: ${{ secrets.SPOTIFY_CLIENT_ID }}
@@ -28,20 +29,23 @@ jobs:
2829
java-version: '11'
2930
- name: Install curl
3031
run: sudo apt-get install -y curl libcurl4-openssl-dev
31-
- name: Test secret
32-
run: echo "client id secret is $SPOTIFY_CLIENT_ID"
3332
- name: Test android
3433
run: ./gradlew testDebugUnitTest
3534
- name: Test jvm
3635
run: ./gradlew jvmTest
3736
- name: Archive test results
3837
uses: actions/upload-artifact@v2
38+
if: always()
3939
with:
4040
name: code-coverage-report
4141
path: build/reports
42-
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
4342
test_android_jvm_linux_untrusted:
4443
runs-on: ubuntu-latest
44+
if:
45+
github.event_name == 'repository_dispatch' &&
46+
github.event.client_payload.slash_command.sha != '' &&
47+
contains(github.event.client_payload.pull_request.head.sha, github.event.client_payload.slash_command.sha) &&
48+
github.event.pull_request.head.repo.full_name != github.repository
4549
environment: testing
4650
env:
4751
SPOTIFY_CLIENT_ID: ${{ secrets.SPOTIFY_CLIENT_ID }}
@@ -58,19 +62,13 @@ jobs:
5862
java-version: '11'
5963
- name: Install curl
6064
run: sudo apt-get install -y curl libcurl4-openssl-dev
61-
- name: Test secret
62-
run: echo "client id secret is $SPOTIFY_CLIENT_ID"
6365
- name: Test android
6466
run: ./gradlew testDebugUnitTest
6567
- name: Test jvm
6668
run: ./gradlew jvmTest
6769
- name: Archive test results
6870
uses: actions/upload-artifact@v2
71+
if: always()
6972
with:
7073
name: code-coverage-report
71-
path: build/reports
72-
if:
73-
github.event_name == 'repository_dispatch' &&
74-
github.event.client_payload.slash_command.sha != '' &&
75-
contains(github.event.client_payload.pull_request.head.sha, github.event.client_payload.slash_command.sha) &&
76-
github.event.pull_request.head.repo.full_name != github.repository
74+
path: build/reports

README.md

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -388,33 +388,8 @@ APIs available only in `SpotifyClientApi` and `SpotifyImplicitGrantApi` instance
388388

389389
### Java
390390
This library has first-class support for Java! You have two choices when using this library: async-only with Kotlin
391-
suspend functions (using SpotifyContinuation), or by using the `SpotifyRestAction` class. Using `SpotifyRestAction`s are
392-
recommended.
393-
394-
#### What is the SpotifyRestAction class and how do I use it?
395-
Abstracting requests into a `SpotifyRestAction` class allows for a lot of flexibility in sending and receiving requests.
396-
This class includes options for asynchronous and blocking execution in all endpoints. However,
397-
due to this, you **must** call one of the provided methods in order for the call
398-
to execute! The `SpotifyRestAction` provides many methods and fields for use, including blocking and asynchronous ones. For example,
399-
- `hasRun()` tells you whether the rest action has been *started*
400-
- `hasCompleted()` tells you whether this rest action has been fully executed and *completed*
401-
- `complete()` blocks the current thread and returns the result
402-
- `suspendComplete(context: CoroutineContext = Dispatchers.Default)` switches to given context, invokes the supplier, and synchronously retrieves the result.
403-
- `suspendQueue()` suspends the coroutine, invokes the supplier asynchronously, and resumes with the result
404-
- `queue()` executes and immediately returns
405-
- `queue(consumer: (T) -> Unit)` executes the provided callback as soon as the request
406-
is asynchronously evaluated
407-
- `queueAfter(quantity: Int, timeUnit: TimeUnit, consumer: (T) -> Unit)` executes the
408-
provided callback after the provided time. As long as supplier execution is less than the provided
409-
time, this will likely be accurate within a few milliseconds.
410-
- `asFuture()` transforms the supplier into a `CompletableFuture` (only JVM)
411-
412-
Here's an example of how easy it is to use `spotify-web-api-kotlin` with a `SpotifyRestAction`:
413-
```java
414-
var api = SpotifyApiBuilderKt.spotifyAppApi(Const.clientId, Const.clientSecret).buildRestAction(true).complete();
415-
var album = api.getAlbums().getAlbumRestAction("spotify:album:0b23AHutIA1BOW0u1dZ6wM", null).complete();
416-
System.out.println("Album name is: " + album.getName());
417-
```
391+
suspend functions (using SpotifyContinuation).
392+
418393

419394
#### Integrating with Kotlin suspend functions via Java `Continuation`s
420395
Unfortunately, coroutines don't play very nicely with Java code. Fortunately, however, we provide a wrapper around Kotlin's

0 commit comments

Comments
 (0)