Skip to content

Commit c6788b4

Browse files
committed
update markdown files
1 parent caec344 commit c6788b4

File tree

5 files changed

+55
-14
lines changed

5 files changed

+55
-14
lines changed

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CONTRIBUTING.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ email, or any other method with the owners of this repository before making a ch
55

66
Please note we have a code of conduct, please follow it in all your interactions with the project.
77

8+
## Testing
9+
Please see [testing.md](TESTING.md) for full testing instructions. Your contributions should be able to pass every test
10+
811
## Pull Request Process
912

1013
1. Ensure any install or build dependencies are removed before the end of the layer when doing a

README.md

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ This library is available via Maven Central.
1515
<dependency>
1616
<groupId>com.adamratzman</groupId>
1717
<artifactId>spotify-api-kotlin</artifactId>
18-
<version>1.0.4</version>
18+
<version>2.0.0</version>
1919
</dependency>
2020
```
2121

2222
### Gradle
2323
```
24-
compile group: 'com.adamratzman', name: 'spotify-api-kotlin', version: '1.0.4'
24+
compile group: 'com.adamratzman', name: 'spotify-api-kotlin', version: '2.0.0'
2525
```
2626

2727
To use the latest snapshot instead, you must add the Jitpack repository
@@ -68,6 +68,7 @@ includes options for asynchronous and blocking execution in all endpoints. Howev
6868
due to this, you **must** call one of the provided methods in order for the call
6969
to execute! The `SpotifyRestAction` provides four methods for use: 1 blocking and 3 async.
7070
- `complete()` blocks the current thread and returns the result
71+
- `queue()` executes and immediately returns
7172
- `queue(consumer: (T) -> Unit)` executes the provided callback as soon as the request
7273
is asynchronously evaluated
7374
- `queueAfter(quantity: Int, timeUnit: TimeUnit, consumer: (T) -> Unit)` executes the
@@ -135,16 +136,8 @@ will be populated with the href, uri, and, most importantly, the id of the track
135136
You can then use this track in clientApi actions such as playing or saving the track, knowing that it will be playable
136137
in your market!
137138

138-
### Testing
139-
We use [Spek](https://github.com/spekframework/spek), which integrates with the JUnit runner, for testing. To run any test, you
140-
need to run `gradle test -PclientId=YOUR_CLIENT_ID -PclientSecret=YOUR_CLIENT_SECRET`. If you'd like to run the client tests
141-
as well, you need to add the `spotifyRedirectUri` parameter, along with `spotifyTokenString`
142-
143-
Some tests may fail if you do not allow access to all required scopes. Look carefully to see which ones fail,
144-
as there's a high probability that it's a scope issue.
145-
146-
An example: `gradle test -PclientId=YOUR_CLIENT_ID -PclientSecret=YOUR_CLIENT_SECRET -PspotifyRedirectUri=SPOTIFY_REDIRECT_URI -PspotifyTokenString=SPOTIFY_TOKEN`
147-
139+
### How to test
140+
See [TESTING.md](testing.md)
148141

149142
### Endpoint List
150143
#### SpotifyAPI:

TESTING.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Testing
2+
3+
We use [Spek](https://github.com/spekframework/spek) to run unit tests.
4+
5+
To run **only** public endpoint tests, run
6+
7+
`gradle test -PclientId=YOUR_CLIENT_ID -PclientSecret=YOUR_CLIENT_SECRET`
8+
9+
To run **all** tests, you need a valid Spotify application, redirect uri, and token string. use:
10+
11+
An example: `gradle test -PclientId=YOUR_CLIENT_ID -PclientSecret=YOUR_CLIENT_SECRET -PspotifyRedirectUri=SPOTIFY_REDIRECT_URI -PspotifyTokenString=SPOTIFY_TOKEN`
12+
13+
Some tests may fail if you do not allow access to all required scopes. To mitigate this, you can individually grant
14+
each scope or use the following code snippet to print out the Spotify token string (given a generated authorization code)
15+
16+
**Generate authorization URL**
17+
```kotlin
18+
import com.adamratzman.spotify.main.SpotifyScope
19+
import com.adamratzman.spotify.main.spotifyApi
20+
21+
spotifyApi {
22+
credentials {
23+
clientId = "YOUR_CLIENT_ID"
24+
clientSecret = "YOUR_CLIENT_SECRET"
25+
redirectUri = "YOUR_REDIRECT_URI"
26+
}
27+
}.getAuthorizationUrl(*SpotifyScope.values())
28+
29+
```
30+
31+
**Get Spotify token**
32+
```kotlin
33+
import com.adamratzman.spotify.main.spotifyApi
34+
35+
spotifyApi {
36+
credentials {
37+
clientId = "YOUR_CLIENT_ID"
38+
clientSecret = "YOUR_CLIENT_SECRET"
39+
redirectUri = "YOUR_REDIRECT_URI"
40+
}
41+
clientAuthentication {
42+
authorizationCode = "SPOTIFY_AUTHORIZATION_CODE"
43+
}
44+
}.buildClient().token.access_token.let { println(it) }
45+
```

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
group 'com.adamratzman'
2-
version '1.0.4'
2+
version '2.0.0'
33

44
buildscript {
55
ext.kotlin_version = '1.3.11'

0 commit comments

Comments
 (0)