Skip to content

Commit 4e1e870

Browse files
committed
update readme and testing documentation
Signed-off-by: Adam Ratzman <[email protected]>
1 parent e05c67c commit 4e1e870

File tree

3 files changed

+34
-30
lines changed

3 files changed

+34
-30
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ 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+
89
## Testing
910
Please see [testing.md](TESTING.md) for full testing instructions. Your contributions should be able to pass every test
1011

README.md

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,32 @@
66

77
This is the [Kotlin](https://kotlinlang.org/) implementation of the [Spotify Web API](https://developer.spotify.com/web-api/)
88

9-
## Install it
9+
## Table of Contents
10+
* [Library installing](#library-installing)
11+
+ [JVM, Android, JS](#jvm-android-js)
12+
+ [Android information](#android)
13+
* [Documentation](#documentation)
14+
* [Need help, have a question, or want to contribute?](#have-a-question)
15+
* [Creating a new api instance](#creating-a-new-api-instance)
16+
+ [SpotifyAppApi](#spotifyappapi)
17+
+ [SpotifyClientApi](#spotifyclientapi)
18+
* [PKCE](#pkce)
19+
* [Non-PKCE](#non-pkce-backend-applications-requires-client-secret)
20+
+ [SpotifyImplicitGrantApi](#spotifyimplicitgrantapi)
21+
+ [SpotifyApiBuilder block & setting API options](#spotifyapibuilder-block--setting-api-options)
22+
* [API options](#api-options)
23+
+ [Using the API](#using-the-api)
24+
* [Tips](#tips)
25+
+ [Building the API](#building-the-api)
26+
+ [What is the SpotifyRestAction class?](#what-is-the-spotifyrestaction-class)
27+
+ [SpotifyRestPagingAction](#spotifyrestpagingaction)
28+
* [Notes](#notes)
29+
+ [The benefits of LinkedResults, PagingObjects, and Cursor-based Paging Objects](#the-benefits-of-linkedresults-pagingobjects-and-cursor-based-paging-objects)
30+
+ [Generic Requests](#generic-request)
31+
+ [Track Relinking](#track-relinking)
32+
* [Contributing](#contributing)
33+
34+
## Library installing
1035

1136
### JVM, Android, JS
1237
```
@@ -368,7 +393,7 @@ for `AbstractPagingObject` (`PagingObject` and `CursorBasedPagingObject`). This
368393
but you also have the ability to retrieve *all* of its items or linked PagingObjects, or a *subset* of its items or linked PagingObjects with one call, with
369394
a single method call to `getAllItems()` or `getAllPagingObjects()`, or `getWithNext(total: Int, context: CoroutineContext = Dispatchers.Default)` or `getWithNextItems(total: Int, context: CoroutineContext = Dispatchers.Default)` respectively
370395

371-
## Design Notes
396+
## Notes
372397
### The benefits of LinkedResults, PagingObjects, and Cursor-based Paging Objects
373398
Spotify provides these three object models in order to simplify our lives as developers. So let's see what we
374399
can do with them!
@@ -433,5 +458,5 @@ will be populated with the href, uri, and, most importantly, the id of the track
433458
You can then use this track in `SpotifyClientApi` endpoints such as playing or saving the track, knowing that it will be playable
434459
in your market!
435460

436-
### Contributing
461+
## Contributing
437462
See [CONTRIBUTING.md](CONTRIBUTING.md)

TESTING.md

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,42 +7,20 @@ You must create a Spotify application [here](https://developer.spotify.com/dashb
77

88
To run **only** public endpoint tests, run
99

10-
`gradle check`
10+
`gradle jvmTest` and `gradle testDebugUnitTest`
1111

1212
Note: You must have `SPOTIFY_CLIENT_ID` and `SPOTIFY_CLIENT_SECRET` as environment variables.
1313

1414
To run **all** tests, you need a valid Spotify application, redirect uri, and token string. use:
1515

16-
`gradle check`
16+
`gradle jvmTest` and `gradle testDebugUnitTest`
1717

1818
Note: In addition to `SPOTIFY_CLIENT_ID` and `SPOTIFY_CLIENT_SECRET`, you also must have the following environment
1919
variables set up: `SPOTIFY_REDIRECT_URI` and `SPOTIFY_TOKEN_STRING`
2020

2121
Some tests may fail if you do not allow access to all required scopes. To mitigate this, you can individually grant
2222
each scope or use the following code snippet to print out the Spotify token string (given a generated authorization code)
2323

24-
**How to generate an authorization URL**
25-
```kotlin
26-
import com.adamratzman.spotify.SpotifyScope
27-
val api = spotifyClientApi(
28-
"SPOTIFY_CLIENT_ID",
29-
"SPOTIFY_CLIENT_SECRET",
30-
"SPOTIFY_REDIRECT_URI") {
31-
authorization {
32-
tokenString = "SPOTIFY_TOKEN_STRING"
33-
}
34-
}.getAuthorizationUrl(*SpotifyScope.values())
35-
36-
```
37-
38-
**How to get a Spotify token**
39-
```kotlin
40-
val api = spotifyClientApi(
41-
"SPOTIFY_CLIENT_ID",
42-
"SPOTIFY_CLIENT_SECRET",
43-
"SPOTIFY_REDIRECT_URI") {
44-
authorization {
45-
tokenString = "SPOTIFY_TOKEN_STRING"
46-
}
47-
}.build().token.accessToken.let { println(it) }
48-
```
24+
To build the maven artifact locally, you will need to follow these steps:
25+
- Create `gradle.properties` if it doesn't exist already.
26+
- Follow [this guide](https://gist.github.com/phit/bd3c6d156a2fa5f3b1bc15fa94b3256c). Instead of `.gpg` extension, use `.kbx` for your secring.

0 commit comments

Comments
 (0)