Skip to content

Commit 7386e9b

Browse files
authored
Merge pull request #2 from siper/fix-star-method
Fix star method
2 parents ceee6df + fad1975 commit 7386e9b

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

library/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ plugins {
99
}
1010

1111
group = "ru.stersh"
12-
version = "1.0.5"
12+
version = "1.0.6"
1313

1414
kotlin {
1515
jvm()

library/src/commonMain/kotlin/ru/stersh/subsonic/api/SubsonicApi.kt

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import io.ktor.client.request.parameter
1010
import io.ktor.http.URLBuilder
1111
import io.ktor.http.Url
1212
import io.ktor.http.appendPathSegments
13+
import io.ktor.http.buildUrl
1314
import io.ktor.serialization.kotlinx.json.json
1415
import kotlinx.serialization.json.Json
1516
import ru.stersh.subsonic.api.model.AlbumList2Response
@@ -205,7 +206,9 @@ class SubsonicApi(
205206
): SubsonicResponse<EmptyResponse> {
206207
return client
207208
.get("rest/savePlayQueue") {
208-
parameter("id", id)
209+
id.forEach {
210+
parameter("id", it)
211+
}
209212
parameter("current", current)
210213
parameter("position", position)
211214
}
@@ -219,9 +222,15 @@ class SubsonicApi(
219222
): SubsonicResponse<EmptyResponse> {
220223
return client
221224
.get("rest/star") {
222-
parameter("id", id)
223-
parameter("albumId", albumId)
224-
parameter("artistId", artistId)
225+
id?.let {
226+
parameter("id", it)
227+
}
228+
albumId?.let {
229+
parameter("albumId", it)
230+
}
231+
artistId?.let {
232+
parameter("artistId", it)
233+
}
225234
}
226235
.body<SubsonicResponse<EmptyResponse>>()
227236
}
@@ -233,9 +242,15 @@ class SubsonicApi(
233242
): SubsonicResponse<EmptyResponse> {
234243
return client
235244
.get("rest/unstar") {
236-
parameter("id", id)
237-
parameter("albumId", albumId)
238-
parameter("artistId", artistId)
245+
id?.let {
246+
parameter("id", it)
247+
}
248+
albumId?.let {
249+
parameter("albumId", it)
250+
}
251+
artistId?.let {
252+
parameter("artistId", it)
253+
}
239254
}
240255
.body<SubsonicResponse<EmptyResponse>>()
241256
}

0 commit comments

Comments
 (0)