Skip to content

Commit 2bbdf4d

Browse files
authored
Merge pull request #180 from adamint/dev
Update documentation, add samples, add PagingObject#getWithNext
2 parents 14c55e2 + 00ec1e5 commit 2bbdf4d

File tree

1,057 files changed

+19809
-2540
lines changed

Some content is hidden

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

1,057 files changed

+19809
-2540
lines changed

README.md

Lines changed: 137 additions & 111 deletions
Large diffs are not rendered by default.

TESTING.md

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,52 @@
11
# Testing
22

3-
We use [Spek](https://github.com/spekframework/spek) to run unit tests.
3+
We use [Spek](https://github.com/spekframework/spek) to run unit tests. You must add Maven Central to the gradle repositories
4+
in order to pull Spek.
45

5-
To run any test, you must have two environment variables, `SPOTIFY_CLIENT_ID` and `SPOTIFY_CLIENT_SECRET` set to a Spotify application in your current shell.
6+
You must create a Spotify application [here](https://developer.spotify.com/dashboard/applications) to get credentials.
67

7-
`export SPOTIFY_CLIENT_ID=your_client_id`
8+
To run **only** public endpoint tests, run
89

9-
`export SPOTIFY_CLIENT_SECRET=your_client_secret`
10+
`gradle check`
1011

11-
To run **only** public endpoint and utility tests, run `gradle check`
12+
Note: You must have `SPOTIFY_CLIENT_ID` and `SPOTIFY_CLIENT_SECRET` as environment variables.
1213

13-
To run **all** tests, you need a valid Spotify redirect uri, and token (string). These are `SPOTIFY_REDIRECT_URI` and `SPOTIFY_TOKEN_STRING` respectively.
14+
To run **all** tests, you need a valid Spotify application, redirect uri, and token string. use:
1415

15-
Then: `gradle check`
16+
`gradle check`
17+
18+
Note: In addition to `SPOTIFY_CLIENT_ID` and `SPOTIFY_CLIENT_SECRET`, you also must have the following environment
19+
variables set up: `SPOTIFY_REDIRECT_URI` and `SPOTIFY_TOKEN_STRING`
1620

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

2024
**How to generate an authorization URL**
2125
```kotlin
22-
import com.adamratzman.spotify.SpotifyScope
23-
import com.adamratzman.spotify.spotifyClientApi
24-
25-
spotifyClientApi {
26-
credentials {
27-
clientId = "YOUR_CLIENT_ID"
28-
clientSecret = "YOUR_CLIENT_SECRET"
29-
redirectUri = "YOUR_REDIRECT_URI"
26+
import com.adamratzman.spotify.main.SpotifyScope
27+
import com.adamratzman.spotify.SpotifyApi.Companion.spotifyClientApi
28+
29+
val api = spotifyClientApi(
30+
"SPOTIFY_CLIENT_ID",
31+
"SPOTIFY_CLIENT_SECRET",
32+
"SPOTIFY_REDIRECT_URI") {
33+
authorization {
34+
tokenString = "SPOTIFY_TOKEN_STRING"
3035
}
3136
}.getAuthorizationUrl(*SpotifyScope.values())
3237

3338
```
3439

3540
**How to get a Spotify token**
3641
```kotlin
37-
import com.adamratzman.spotify.spotifyClientApi
42+
import com.adamratzman.spotify.SpotifyApi.Companion.spotifyClientApi
3843

39-
spotifyClientApi {
40-
credentials {
41-
clientId = "YOUR_CLIENT_ID"
42-
clientSecret = "YOUR_CLIENT_SECRET"
43-
redirectUri = "YOUR_REDIRECT_URI"
44-
}
44+
val api = spotifyClientApi(
45+
"SPOTIFY_CLIENT_ID",
46+
"SPOTIFY_CLIENT_SECRET",
47+
"SPOTIFY_REDIRECT_URI") {
4548
authorization {
46-
authorizationCode = "SPOTIFY_AUTHORIZATION_CODE"
49+
tokenString = "SPOTIFY_TOKEN_STRING"
4750
}
4851
}.build().token.accessToken.let { println(it) }
4952
```

build.gradle.kts

Lines changed: 39 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import org.jetbrains.dokka.gradle.DokkaTask
22
import org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile
3+
import java.net.URI
34

45
plugins {
56
`maven-publish`
@@ -21,6 +22,12 @@ java {
2122
withJavadocJar()
2223
}
2324

25+
tasks.withType<Test> {
26+
this.testLogging {
27+
this.showStandardStreams = true
28+
}
29+
}
30+
2431
repositories {
2532
mavenCentral()
2633
jcenter()
@@ -95,6 +102,9 @@ kotlin {
95102
}
96103
}
97104

105+
all {
106+
languageSettings.useExperimentalAnnotation("kotlin.Experimental")
107+
}
98108
}
99109
}
100110
}
@@ -113,7 +123,7 @@ tasks.named<Test>("jvmTest") {
113123
spotless {
114124
kotlin {
115125
target("**/*.kt")
116-
licenseHeader("/* Spotify Web API - Kotlin Wrapper; MIT License, 2019; Original author: Adam Ratzman */")
126+
licenseHeader("/* Spotify Web API, Kotlin Wrapper; MIT License, 2017-2020; Original author: Adam Ratzman */")
117127
ktlint()
118128
}
119129
}
@@ -123,6 +133,10 @@ nexusStaging {
123133
}
124134

125135

136+
tasks.withType<GenerateModuleMetadata> {
137+
enabled = false
138+
}
139+
126140
publishing {
127141
publications {
128142
val jvm by getting(MavenPublication::class) {
@@ -165,17 +179,30 @@ publishing {
165179
}
166180
}
167181
repositories {
168-
maven {
169-
name = "nexus"
170-
val releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
171-
val snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
172-
url = uri(if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl)
173-
174-
credentials {
175-
val nexusUsername: String? by project.extra
176-
val nexusPassword: String? by project.extra
177-
username = nexusUsername
178-
password = nexusPassword
182+
if (project.hasProperty("publishToCentral")) {
183+
maven {
184+
name = "nexus"
185+
val releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
186+
val snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
187+
url = uri(if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl)
188+
189+
credentials {
190+
val nexusUsername: String? by project.extra
191+
val nexusPassword: String? by project.extra
192+
username = nexusUsername
193+
password = nexusPassword
194+
}
195+
}
196+
} else {
197+
if (project.extra.has("spaceUser") && project.extra.has("spacePassword")) {
198+
maven {
199+
credentials {
200+
username = project.extra["spaceUser"]?.toString()
201+
password = project.extra["spacePassword"]?.toString()
202+
}
203+
204+
url = URI.create("https://maven.jetbrains.space/adam/ratzman")
205+
}
179206
}
180207
}
181208
}

docs/docs/spotify-web-api-kotlin/alltypes/index.html

Lines changed: 57 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,12 @@ <h5><a href="../com.adamratzman.spotify.models/-audio-segment/index.html">com.ad
104104
<tr>
105105
(common, js, jvm)
106106
<h5><a href="../com.adamratzman.spotify.models/-authentication-error/index.html">com.adamratzman.spotify.models.AuthenticationError</a></h5>
107+
<p>An exception during the authentication process</p>
107108
</tr>
108109
<tr>
109110
(common, js, jvm)
110111
<h5><a href="../com.adamratzman.spotify/-authorization-type/index.html">com.adamratzman.spotify.AuthorizationType</a></h5>
112+
<p>The type of Spotify authorization used to build an Api instance</p>
111113
</tr>
112114
<tr>
113115
(common, js, jvm)
@@ -157,7 +159,7 @@ <h5><a href="../com.adamratzman.spotify.endpoints.client/-client-player-a-p-i.ht
157159
(common, js, jvm)
158160
<h5><a href="../com.adamratzman.spotify.endpoints.client/-client-player-api/index.html">com.adamratzman.spotify.endpoints.client.ClientPlayerApi</a></h5>
159161
<p>These endpoints allow for viewing and controlling user playback. Please view <a href="https://developer.spotify.com/web-api/working-with-connect/">the official documentation</a>
160-
for more information on how this works. This is in beta and is available for <strong>premium users only</strong>. Endpoints are <strong>not</strong> guaranteed to work</p>
162+
for more information on how this works. This is in beta and is available for <strong>premium users only</strong>. Endpoints are <strong>not</strong> guaranteed to work and are subject to change!</p>
161163
</tr>
162164
<tr>
163165
(common, js, jvm)
@@ -250,7 +252,7 @@ <h5><a href="../com.adamratzman.spotify.models/-error-object/index.html">com.ada
250252
<tr>
251253
(common, js, jvm)
252254
<h5><a href="../com.adamratzman.spotify.models/-error-response/index.html">com.adamratzman.spotify.models.ErrorResponse</a></h5>
253-
<p>Wraps around <a href="../com.adamratzman.spotify.models/-error-object/index.html#com.adamratzman.spotify.models.ErrorObject">ErrorObject</a></p>
255+
<p>Wraps around <a href="../com.adamratzman.spotify.models/-error-object/index.html#com.adamratzman.spotify.models.ErrorObject">ErrorObject</a>. Serialized raw Spotify error response</p>
254256
</tr>
255257
<tr>
256258
(common, js, jvm)
@@ -264,6 +266,7 @@ <h5><a href="../com.adamratzman.spotify.models/-external-id/index.html">com.adam
264266
<tr>
265267
(common, js, jvm)
266268
<h5><a href="../com.adamratzman.spotify.models/-external-url/index.html">com.adamratzman.spotify.models.ExternalUrl</a></h5>
269+
<p>Key/value pair mapping a name to an arbitrary url</p>
267270
</tr>
268271
<tr>
269272
(common, js, jvm)
@@ -290,10 +293,27 @@ <h5><a href="../com.adamratzman.spotify.utils/kotlin.collections.-hash-map/index
290293
</tr>
291294
<tr>
292295
(common, js, jvm)
296+
<h5><a href="../com.adamratzman.spotify.http/-http-connection/index.html">com.adamratzman.spotify.http.HttpConnection</a></h5>
297+
<p>Provides a fast, easy, and slim way to execute and retrieve HTTP GET, POST, PUT, and DELETE requests</p>
298+
</tr>
299+
<tr>
300+
(common, js, jvm)
301+
<h5><a href="../com.adamratzman.spotify.http/-http-connection-status/index.html">com.adamratzman.spotify.http.HttpConnectionStatus</a></h5>
302+
</tr>
303+
<tr>
304+
(common, js, jvm)
305+
<h5><a href="../com.adamratzman.spotify.http/-http-header/index.html">com.adamratzman.spotify.http.HttpHeader</a></h5>
306+
</tr>
307+
<tr>
308+
(common, js, jvm)
293309
<h5><a href="../com.adamratzman.spotify.http/-http-request-method/index.html">com.adamratzman.spotify.http.HttpRequestMethod</a></h5>
294310
</tr>
295311
<tr>
296312
(common, js, jvm)
313+
<h5><a href="../com.adamratzman.spotify.http/-http-response/index.html">com.adamratzman.spotify.http.HttpResponse</a></h5>
314+
</tr>
315+
<tr>
316+
(common, js, jvm)
297317
<h5><a href="../com.adamratzman.spotify.models/-identifiable/index.html">com.adamratzman.spotify.models.Identifiable</a></h5>
298318
<p>Represents an identifiable Spotify object such as an Album or Recommendation Seed</p>
299319
</tr>
@@ -305,14 +325,23 @@ <h5><a href="../com.adamratzman.spotify.models/-identifiable-nullable/index.html
305325
<tr>
306326
(common, js, jvm)
307327
<h5><a href="../com.adamratzman.spotify/-i-spotify-api-builder/index.html">com.adamratzman.spotify.ISpotifyApiBuilder</a></h5>
328+
<p>Spotify Api builder interface</p>
308329
</tr>
309330
<tr>
310331
(common, js, jvm)
311332
<h5><a href="../com.adamratzman.spotify/-i-spotify-app-api-builder.html">com.adamratzman.spotify.ISpotifyAppApiBuilder</a></h5>
333+
<p>App Api builder interface</p>
312334
</tr>
313335
<tr>
314336
(common, js, jvm)
315337
<h5><a href="../com.adamratzman.spotify/-i-spotify-client-api-builder/index.html">com.adamratzman.spotify.ISpotifyClientApiBuilder</a></h5>
338+
<p>Client interface exposing <a href="../com.adamratzman.spotify/-i-spotify-client-api-builder/get-authorization-url.html#com.adamratzman.spotify.ISpotifyClientApiBuilder$getAuthorizationUrl(kotlin.Array((com.adamratzman.spotify.SpotifyScope)))">getAuthorizationUrl</a></p>
339+
</tr>
340+
<tr>
341+
(common, js, jvm)
342+
<h5><a href="../com.adamratzman.spotify.utils/-language/index.html">com.adamratzman.spotify.utils.Language</a></h5>
343+
<p><a href="http://en.wikipedia.org/wiki/ISO_639-1">ISO 639-1</a>
344+
language code.</p>
316345
</tr>
317346
<tr>
318347
(common, js, jvm)
@@ -327,6 +356,11 @@ <h5><a href="../com.adamratzman.spotify.models/-linked-track/index.html">com.ada
327356
</tr>
328357
<tr>
329358
(common, js, jvm)
359+
<h5><a href="../com.adamratzman.spotify.utils/-locale/index.html">com.adamratzman.spotify.utils.Locale</a></h5>
360+
<p>Locale code.</p>
361+
</tr>
362+
<tr>
363+
(common, js, jvm)
330364
<h5><a href="../com.adamratzman.spotify.models/-local-track-uri/index.html">com.adamratzman.spotify.models.LocalTrackUri</a></h5>
331365
<p>Represents a Spotify <strong>local track</strong> URI</p>
332366
</tr>
@@ -426,7 +460,12 @@ <h5><a href="../com.adamratzman.spotify.models/-recommendation-seed/index.html">
426460
</tr>
427461
<tr>
428462
(common, js, jvm)
463+
<h5><a href="../com.adamratzman.spotify.models/-release-date/index.html">com.adamratzman.spotify.models.ReleaseDate</a></h5>
464+
</tr>
465+
<tr>
466+
(common, js, jvm)
429467
<h5><a href="../com.adamratzman.spotify.models/-relinking-available-response/index.html">com.adamratzman.spotify.models.RelinkingAvailableResponse</a></h5>
468+
<p>Represents a response for which a relinked track could be available</p>
430469
</tr>
431470
<tr>
432471
(common, js, jvm)
@@ -441,6 +480,7 @@ <h5><a href="../com.adamratzman.spotify.models/-restrictions/index.html">com.ada
441480
<tr>
442481
(common, js, jvm)
443482
<h5><a href="../com.adamratzman.spotify.models/-result-enum/index.html">com.adamratzman.spotify.models.ResultEnum</a></h5>
483+
<p>Interface that allows easy identifier retrieval for children with an implemented identifier</p>
444484
</tr>
445485
<tr>
446486
(common, js, jvm)
@@ -500,6 +540,7 @@ <h5><a href="../com.adamratzman.spotify/-spotify-api-builder/index.html">com.ada
500540
<tr>
501541
(common, js, jvm)
502542
<h5><a href="../com.adamratzman.spotify/-spotify-api-options/index.html">com.adamratzman.spotify.SpotifyApiOptions</a></h5>
543+
<p>API Utilities</p>
503544
</tr>
504545
<tr>
505546
(common, js, jvm)
@@ -519,6 +560,7 @@ <h5><a href="../com.adamratzman.spotify/-spotify-app-a-p-i.html">com.adamratzman
519560
<tr>
520561
(common, js, jvm)
521562
<h5><a href="../com.adamratzman.spotify/-spotify-app-api-builder/index.html">com.adamratzman.spotify.SpotifyAppApiBuilder</a></h5>
563+
<p><a href="../com.adamratzman.spotify/-spotify-app-api/index.html#com.adamratzman.spotify.SpotifyAppApi">SpotifyAppApi</a> builder for api creation using client authorization</p>
522564
</tr>
523565
<tr>
524566
(common, js, jvm)
@@ -542,6 +584,7 @@ <h5><a href="../com.adamratzman.spotify/-spotify-client-a-p-i.html">com.adamratz
542584
<tr>
543585
(common, js, jvm)
544586
<h5><a href="../com.adamratzman.spotify/-spotify-client-api-builder/index.html">com.adamratzman.spotify.SpotifyClientApiBuilder</a></h5>
587+
<p><a href="../com.adamratzman.spotify/-spotify-client-api/index.html#com.adamratzman.spotify.SpotifyClientApi">SpotifyClientApi</a> builder for api creation using client authorization</p>
545588
</tr>
546589
<tr>
547590
(common, js, jvm)
@@ -567,6 +610,14 @@ <h5><a href="../com.adamratzman.spotify/-spotify-exception/index.html">com.adamr
567610
</tr>
568611
<tr>
569612
(common, js, jvm)
613+
<h5><a href="../com.adamratzman.spotify.annotations/-spotify-experimental-function-api/index.html">com.adamratzman.spotify.annotations.SpotifyExperimentalFunctionApi</a></h5>
614+
</tr>
615+
<tr>
616+
(common, js, jvm)
617+
<h5><a href="../com.adamratzman.spotify.annotations/-spotify-experimental-http-api/index.html">com.adamratzman.spotify.annotations.SpotifyExperimentalHttpApi</a></h5>
618+
</tr>
619+
<tr>
620+
(common, js, jvm)
570621
<h5><a href="../com.adamratzman.spotify.models/-spotify-image/index.html">com.adamratzman.spotify.models.SpotifyImage</a></h5>
571622
<p>A Spotify image</p>
572623
</tr>
@@ -625,10 +676,12 @@ <h5><a href="../com.adamratzman.spotify.models/-spotify-uri/index.html">com.adam
625676
<tr>
626677
(common, js, jvm)
627678
<h5><a href="../com.adamratzman.spotify.models/-spotify-uri-exception/index.html">com.adamratzman.spotify.models.SpotifyUriException</a></h5>
679+
<p>Exception instantiating or deserializing a uri perceived as invalid</p>
628680
</tr>
629681
<tr>
630682
(common, js, jvm)
631683
<h5><a href="../com.adamratzman.spotify/-spotify-user-authorization/index.html">com.adamratzman.spotify.SpotifyUserAuthorization</a></h5>
684+
<p>User-defined authorization parameters</p>
632685
</tr>
633686
<tr>
634687
(common, js, jvm)
@@ -664,7 +717,7 @@ <h5><a href="../com.adamratzman.spotify.utils/-time-unit/index.html">com.adamrat
664717
<tr>
665718
(common, js, jvm)
666719
<h5><a href="../com.adamratzman.spotify.models/-token/index.html">com.adamratzman.spotify.models.Token</a></h5>
667-
<p>Represents a Spotify Token, retrieved through instantiating a <a href="#">SpotifyAPI</a></p>
720+
<p>Represents a Spotify Token, retrieved through instantiating a <a href="../com.adamratzman.spotify/-spotify-api/index.html#com.adamratzman.spotify.SpotifyApi">SpotifyApi</a></p>
668721
</tr>
669722
<tr>
670723
(common, js, jvm)
@@ -692,6 +745,7 @@ <h5><a href="../com.adamratzman.spotify.endpoints.public/-track-api/index.html">
692745
<tr>
693746
(common, js, jvm)
694747
<h5><a href="../com.adamratzman.spotify.endpoints.public/-track-attribute/index.html">com.adamratzman.spotify.endpoints.public.TrackAttribute</a></h5>
748+
<p>The track attribute wrapper contains a set value for a specific <a href="../com.adamratzman.spotify.endpoints.public/-tuneable-track-attribute/index.html#com.adamratzman.spotify.endpoints.public.TuneableTrackAttribute">TuneableTrackAttribute</a></p>
695749
</tr>
696750
<tr>
697751
(common, js, jvm)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<HTML>
2+
<HEAD>
3+
<meta charset="UTF-8">
4+
<title>com.adamratzman.spotify.annotations.SpotifyExperimentalFunctionApi.<init> - spotify-web-api-kotlin</title>
5+
<link rel="stylesheet" href="../../../style.css">
6+
</HEAD>
7+
<BODY>
8+
<a href="../../index.html">spotify-web-api-kotlin</a>&nbsp;/&nbsp;<a href="../index.html">com.adamratzman.spotify.annotations</a>&nbsp;/&nbsp;<a href="index.html">SpotifyExperimentalFunctionApi</a>&nbsp;/&nbsp;<a href="./-init-.html">&lt;init&gt;</a><br/>
9+
<br/>
10+
<h1>&lt;init&gt;</h1>
11+
<a name="com.adamratzman.spotify.annotations.SpotifyExperimentalFunctionApi$&lt;init&gt;()"></a>
12+
(common, js, jvm) <code><span class="identifier">&lt;init&gt;</span><span class="symbol">(</span><span class="symbol">)</span></code>
13+
</BODY>
14+
</HTML>

0 commit comments

Comments
 (0)