Skip to content

Commit c6cc646

Browse files
authored
Merge pull request #173 from adamint/dev
urgent: fix inclusion of uris in a project
2 parents a63df4b + bb796f1 commit c6cc646

File tree

10 files changed

+180
-113
lines changed

10 files changed

+180
-113
lines changed

build.gradle.kts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
import org.jetbrains.dokka.gradle.DokkaTask
23
import org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile
34

@@ -34,9 +35,9 @@ kotlin {
3435
targets {
3536
sourceSets {
3637
val coroutineVersion = "1.3.2"
37-
val serializationVersion = "0.13.0"
38+
val serializationVersion = "0.14.0"
3839
val spekVersion = "2.0.8"
39-
val ktorVersion = "1.2.5"
40+
val ktorVersion = "1.2.6"
4041

4142
val commonMain by getting {
4243
dependencies {
@@ -123,6 +124,7 @@ nexusStaging {
123124
packageGroup = "com.adamratzman"
124125
}
125126

127+
126128
publishing {
127129
publications {
128130
val jvm by getting(MavenPublication::class) {
@@ -258,4 +260,4 @@ tasks {
258260
dependsOn.add(dokka)
259261
dependsOn.add("publishJvmPublicationToNexusRepository")
260262
}
261-
}
263+
}

gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
systemProp.org.gradle.internal.publish.checksums.insecure=true

gradle/wrapper/gradle-wrapper.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#Sun Nov 17 20:55:43 EST 2019
2-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0-all.zip
1+
#Sat Nov 30 21:26:10 EST 2019
2+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip
33
distributionBase=GRADLE_USER_HOME
44
distributionPath=wrapper/dists
55
zipStorePath=wrapper/dists

gradlew.bat

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
@rem
2+
@rem Copyright 2015 the original author or authors.
3+
@rem
4+
@rem Licensed under the Apache License, Version 2.0 (the "License");
5+
@rem you may not use this file except in compliance with the License.
6+
@rem You may obtain a copy of the License at
7+
@rem
8+
@rem https://www.apache.org/licenses/LICENSE-2.0
9+
@rem
10+
@rem Unless required by applicable law or agreed to in writing, software
11+
@rem distributed under the License is distributed on an "AS IS" BASIS,
12+
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
@rem See the License for the specific language governing permissions and
14+
@rem limitations under the License.
15+
@rem
16+
17+
@if "%DEBUG%" == "" @echo off
18+
@rem ##########################################################################
19+
@rem
20+
@rem Gradle startup script for Windows
21+
@rem
22+
@rem ##########################################################################
23+
24+
@rem Set local scope for the variables with windows NT shell
25+
if "%OS%"=="Windows_NT" setlocal
26+
27+
set DIRNAME=%~dp0
28+
if "%DIRNAME%" == "" set DIRNAME=.
29+
set APP_BASE_NAME=%~n0
30+
set APP_HOME=%DIRNAME%
31+
32+
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
33+
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
34+
35+
@rem Find java.exe
36+
if defined JAVA_HOME goto findJavaFromJavaHome
37+
38+
set JAVA_EXE=java.exe
39+
%JAVA_EXE% -version >NUL 2>&1
40+
if "%ERRORLEVEL%" == "0" goto init
41+
42+
echo.
43+
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
44+
echo.
45+
echo Please set the JAVA_HOME variable in your environment to match the
46+
echo location of your Java installation.
47+
48+
goto fail
49+
50+
:findJavaFromJavaHome
51+
set JAVA_HOME=%JAVA_HOME:"=%
52+
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
53+
54+
if exist "%JAVA_EXE%" goto init
55+
56+
echo.
57+
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
58+
echo.
59+
echo Please set the JAVA_HOME variable in your environment to match the
60+
echo location of your Java installation.
61+
62+
goto fail
63+
64+
:init
65+
@rem Get command-line arguments, handling Windows variants
66+
67+
if not "%OS%" == "Windows_NT" goto win9xME_args
68+
69+
:win9xME_args
70+
@rem Slurp the command line arguments.
71+
set CMD_LINE_ARGS=
72+
set _SKIP=2
73+
74+
:win9xME_args_slurp
75+
if "x%~1" == "x" goto execute
76+
77+
set CMD_LINE_ARGS=%*
78+
79+
:execute
80+
@rem Setup the command line
81+
82+
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
83+
84+
@rem Execute Gradle
85+
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
86+
87+
:end
88+
@rem End local scope for the variables with windows NT shell
89+
if "%ERRORLEVEL%"=="0" goto mainEnd
90+
91+
:fail
92+
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
93+
rem the _cmd.exe /c_ return code!
94+
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
95+
exit /b 1
96+
97+
:mainEnd
98+
if "%OS%"=="Windows_NT" endlocal
99+
100+
:omega

src/commonMain/kotlin/com.adamratzman.spotify/endpoints/client/ClientLibraryApi.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ import com.adamratzman.spotify.http.EndpointBuilder
99
import com.adamratzman.spotify.http.SpotifyEndpoint
1010
import com.adamratzman.spotify.http.encodeUrl
1111
import com.adamratzman.spotify.models.AlbumUri
12-
import com.adamratzman.spotify.models.CountryCode
1312
import com.adamratzman.spotify.models.PagingObject
1413
import com.adamratzman.spotify.models.SavedAlbum
1514
import com.adamratzman.spotify.models.SavedTrack
1615
import com.adamratzman.spotify.models.TrackUri
1716
import com.adamratzman.spotify.models.serialization.toList
1817
import com.adamratzman.spotify.models.serialization.toPagingObject
18+
import com.adamratzman.spotify.utils.Market
1919
import kotlinx.serialization.list
2020
import kotlinx.serialization.serializer
2121

@@ -41,7 +41,7 @@ class ClientLibraryApi(api: SpotifyApi<*, *>) : SpotifyEndpoint(api) {
4141
fun getSavedTracks(
4242
limit: Int? = null,
4343
offset: Int? = null,
44-
market: CountryCode? = null
44+
market: Market? = null
4545
): SpotifyRestActionPaging<SavedTrack, PagingObject<SavedTrack>> {
4646
return toActionPaging {
4747
get(
@@ -66,7 +66,7 @@ class ClientLibraryApi(api: SpotifyApi<*, *>) : SpotifyEndpoint(api) {
6666
fun getSavedAlbums(
6767
limit: Int? = null,
6868
offset: Int? = null,
69-
market: CountryCode? = null
69+
market: Market? = null
7070
): SpotifyRestActionPaging<SavedAlbum, PagingObject<SavedAlbum>> {
7171
return toActionPaging {
7272
get(

src/commonMain/kotlin/com.adamratzman.spotify/models/Albums.kt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* Spotify Web API - Kotlin Wrapper; MIT License, 2019; Original author: Adam Ratzman */
22
package com.adamratzman.spotify.models
33

4+
import com.adamratzman.spotify.utils.Market
45
import com.adamratzman.spotify.utils.match
56
import kotlinx.serialization.SerialName
67
import kotlinx.serialization.Serializable
@@ -51,7 +52,7 @@ data class SimpleAlbum(
5152
override val uri: AlbumUri get() = super.uri as AlbumUri
5253

5354
@Transient
54-
val availableMarkets = availableMarketsString.map { CountryCode.valueOf(it) }
55+
val availableMarkets = availableMarketsString.map { Market.valueOf(it) }
5556

5657
@Transient
5758
val albumType: AlbumResultType = albumTypeString.let { _ ->
@@ -69,7 +70,7 @@ data class SimpleAlbum(
6970
*
7071
* @param market Provide this parameter if you want the list of returned items to be relevant to a particular country.
7172
*/
72-
fun toFullAlbum(market: CountryCode? = null) = api.albums.getAlbum(id, market)
73+
fun toFullAlbum(market: Market? = null) = api.albums.getAlbum(id, market)
7374
}
7475

7576
/**
@@ -140,7 +141,7 @@ data class Album(
140141
override val uri: AlbumUri get() = super.uri as AlbumUri
141142

142143
@Transient
143-
val availableMarkets = availableMarketsString.map { CountryCode.valueOf(it) }
144+
val availableMarkets = availableMarketsString.map { Market.valueOf(it) }
144145

145146
@Transient
146147
val externalIds = externalIdsString.map { ExternalId(it.key, it.value) }
@@ -163,9 +164,9 @@ data class SpotifyCopyright(
163164
) {
164165
@Transient
165166
val text = textString
166-
.removePrefix("(P)")
167-
.removePrefix("(C)")
168-
.trim()
167+
.removePrefix("(P)")
168+
.removePrefix("(C)")
169+
.trim()
169170
@Transient
170171
val type = CopyrightType.values().match(typeString)!!
171172
}

src/commonMain/kotlin/com.adamratzman.spotify/models/Playlist.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package com.adamratzman.spotify.models
33

44
import com.adamratzman.spotify.SpotifyRestAction
55
import com.adamratzman.spotify.endpoints.client.PlaylistSnapshot
6+
import com.adamratzman.spotify.utils.Market
67
import kotlinx.serialization.SerialName
78
import kotlinx.serialization.Serializable
89
import kotlinx.serialization.Transient
@@ -58,8 +59,8 @@ data class SimplePlaylist(
5859
*
5960
* @param market Provide this parameter if you want the list of returned items to be relevant to a particular country.
6061
*/
61-
fun toFullPlaylist(market: CountryCode? = null): SpotifyRestAction<Playlist?> =
62-
api.playlists.getPlaylist(id, market)
62+
fun toFullPlaylist(market: Market? = null): SpotifyRestAction<Playlist?> =
63+
api.playlists.getPlaylist(id, market)
6364
}
6465

6566
/**

0 commit comments

Comments
 (0)