From b2384a43cea982755f48cdc0f129dd014d88eb0f Mon Sep 17 00:00:00 2001 From: Yahor Berdnikau Date: Sat, 16 Dec 2017 22:14:01 +0100 Subject: [PATCH] Update api definition to use String type for ids. Signed-off-by: Yahor Berdnikau --- .../subsonic/SubsonicApiCreateBookmarkTest.kt | 10 ++-- .../subsonic/SubsonicApiCreatePlaylistTest.kt | 4 +- .../subsonic/SubsonicApiDeleteBookmarkTest.kt | 6 +- .../subsonic/SubsonicApiDeletePlaylistTest.kt | 6 +- .../subsonic/SubsonicApiDeleteShareTest.kt | 6 +- .../subsonic/SubsonicApiGetAlbumList2Test.kt | 2 +- .../SubsonicApiGetAlbumListRequestTest.kt | 2 +- .../api/subsonic/SubsonicApiGetAlbumTest.kt | 6 +- .../api/subsonic/SubsonicApiGetArtistTest.kt | 6 +- .../api/subsonic/SubsonicApiGetArtistsTest.kt | 2 +- .../api/subsonic/SubsonicApiGetIndexesTest.kt | 2 +- .../SubsonicApiGetMusicDirectoryTest.kt | 6 +- .../subsonic/SubsonicApiGetPlaylistTest.kt | 6 +- .../subsonic/SubsonicApiGetPodcastsTest.kt | 2 +- .../subsonic/SubsonicApiGetRandomSongsTest.kt | 2 +- .../SubsonicApiGetSongsByGenreTest.kt | 2 +- .../subsonic/SubsonicApiGetStarred2Test.kt | 2 +- .../api/subsonic/SubsonicApiGetStarredTest.kt | 2 +- .../subsonic/SubsonicApiSearchThreeTest.kt | 2 +- .../api/subsonic/SubsonicApiSearchTwoTest.kt | 2 +- .../api/subsonic/SubsonicApiStarTest.kt | 6 +- .../api/subsonic/SubsonicApiUnstarTest.kt | 6 +- .../subsonic/SubsonicApiUpdatePlaylistTest.kt | 18 +++--- .../subsonic/SubsonicApiUpdateShareTest.kt | 10 ++-- .../api/subsonic/ApiVersionCheckWrapper.kt | 46 +++++++------- .../api/subsonic/SubsonicAPIDefinition.kt | 60 +++++++++---------- .../subsonic/ApiVersionCheckWrapperTest.kt | 4 +- .../ultrasonic/service/RESTMusicService.java | 51 ++++++---------- 28 files changed, 131 insertions(+), 148 deletions(-) diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiCreateBookmarkTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiCreateBookmarkTest.kt index 10f253c8..6cfba699 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiCreateBookmarkTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiCreateBookmarkTest.kt @@ -9,7 +9,7 @@ class SubsonicApiCreateBookmarkTest : SubsonicAPIClientTest() { @Test fun `Should handle error response`() { checkErrorCallParsed(mockWebServerRule) { - client.api.createBookmark(1, 1).execute() + client.api.createBookmark("1", 1).execute() } } @@ -17,14 +17,14 @@ class SubsonicApiCreateBookmarkTest : SubsonicAPIClientTest() { fun `Should handle ok response`() { mockWebServerRule.enqueueResponse("ping_ok.json") - val response = client.api.createBookmark(213, 123213L).execute() + val response = client.api.createBookmark("213", 123213L).execute() assertResponseSuccessful(response) } @Test fun `Should pass id in request params`() { - val id = 544 + val id = "544" mockWebServerRule.assertRequestParam(expectedParam = "id=$id") { client.api.createBookmark(id = id, position = 123).execute() @@ -36,7 +36,7 @@ class SubsonicApiCreateBookmarkTest : SubsonicAPIClientTest() { val position = 4412333L mockWebServerRule.assertRequestParam(expectedParam = "position=$position") { - client.api.createBookmark(id = 12, position = position).execute() + client.api.createBookmark(id = "12", position = position).execute() } } @@ -45,7 +45,7 @@ class SubsonicApiCreateBookmarkTest : SubsonicAPIClientTest() { val comment = "some-comment" mockWebServerRule.assertRequestParam(expectedParam = "comment=$comment") { - client.api.createBookmark(id = 1, position = 1, comment = comment).execute() + client.api.createBookmark(id = "1", position = 1, comment = comment).execute() } } } diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiCreatePlaylistTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiCreatePlaylistTest.kt index f7450c6c..e41e580f 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiCreatePlaylistTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiCreatePlaylistTest.kt @@ -24,7 +24,7 @@ class SubsonicApiCreatePlaylistTest : SubsonicAPIClientTest() { @Test fun `Should pass id param in request`() { - val id = 56L + val id = "56" mockWebServerRule.assertRequestParam(responseResourceName = "ping_ok.json", expectedParam = "playlistId=$id") { @@ -44,7 +44,7 @@ class SubsonicApiCreatePlaylistTest : SubsonicAPIClientTest() { @Test fun `Should pass song id param in request`() { - val songId = listOf(4410L, 852L) + val songId = listOf("4410", "852") mockWebServerRule.assertRequestParam(responseResourceName = "ping_ok.json", expectedParam = "songId=${songId[0]}&songId=${songId[1]}") { diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiDeleteBookmarkTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiDeleteBookmarkTest.kt index c38a0e02..bd16192f 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiDeleteBookmarkTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiDeleteBookmarkTest.kt @@ -9,7 +9,7 @@ class SubsonicApiDeleteBookmarkTest : SubsonicAPIClientTest() { @Test fun `Should handle error response`() { checkErrorCallParsed(mockWebServerRule) { - client.api.deleteBookmark(1).execute() + client.api.deleteBookmark("1").execute() } } @@ -17,14 +17,14 @@ class SubsonicApiDeleteBookmarkTest : SubsonicAPIClientTest() { fun `Should handle ok response`() { mockWebServerRule.enqueueResponse("ping_ok.json") - val response = client.api.deleteBookmark(1).execute() + val response = client.api.deleteBookmark("1").execute() assertResponseSuccessful(response) } @Test fun `Should pass id in request params`() { - val id = 233 + val id = "233" mockWebServerRule.assertRequestParam(expectedParam = "id=$id") { client.api.deleteBookmark(id).execute() diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiDeletePlaylistTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiDeletePlaylistTest.kt index 749975cd..ec9c0227 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiDeletePlaylistTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiDeletePlaylistTest.kt @@ -9,7 +9,7 @@ class SubsonicApiDeletePlaylistTest : SubsonicAPIClientTest() { @Test fun `Should handle error response`() { checkErrorCallParsed(mockWebServerRule) { - client.api.deletePlaylist(10).execute() + client.api.deletePlaylist("10").execute() } } @@ -17,14 +17,14 @@ class SubsonicApiDeletePlaylistTest : SubsonicAPIClientTest() { fun `Should handle ok response`() { mockWebServerRule.enqueueResponse("ping_ok.json") - val response = client.api.deletePlaylist(10).execute() + val response = client.api.deletePlaylist("10").execute() assertResponseSuccessful(response) } @Test fun `Should pass id param in request`() { - val id = 534L + val id = "534" mockWebServerRule.assertRequestParam(responseResourceName = "ping_ok.json", expectedParam = "id=$id") { diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiDeleteShareTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiDeleteShareTest.kt index 82852c48..a0a95014 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiDeleteShareTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiDeleteShareTest.kt @@ -9,7 +9,7 @@ class SubsonicApiDeleteShareTest : SubsonicAPIClientTest() { @Test fun `Should handle error response`() { checkErrorCallParsed(mockWebServerRule) { - client.api.deleteShare(123).execute() + client.api.deleteShare("123").execute() } } @@ -17,14 +17,14 @@ class SubsonicApiDeleteShareTest : SubsonicAPIClientTest() { fun `Should handle ok response`() { mockWebServerRule.enqueueResponse("ping_ok.json") - val response = client.api.deleteShare(12).execute() + val response = client.api.deleteShare("12").execute() assertResponseSuccessful(response) } @Test fun `Should pass id in request params`() { - val id = 224L + val id = "224" mockWebServerRule.assertRequestParam(expectedParam = "id=$id") { client.api.deleteShare(id).execute() diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetAlbumList2Test.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetAlbumList2Test.kt index 952490f5..817a9f36 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetAlbumList2Test.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetAlbumList2Test.kt @@ -103,7 +103,7 @@ class SubsonicApiGetAlbumList2Test : SubsonicAPIClientTest() { @Test fun `Should pass music folder id in request param`() { - val musicFolderId = 9422L + val musicFolderId = "9422" mockWebServerRule.assertRequestParam(responseResourceName = "get_album_list_2_ok.json", expectedParam = "musicFolderId=$musicFolderId") { diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetAlbumListRequestTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetAlbumListRequestTest.kt index 7aa4ec80..eb2ffb6f 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetAlbumListRequestTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetAlbumListRequestTest.kt @@ -99,7 +99,7 @@ class SubsonicApiGetAlbumListRequestTest : SubsonicAPIClientTest() { @Test fun `Should pass music folder id in request params`() { - val folderId = 545L + val folderId = "545" mockWebServerRule.assertRequestParam(responseResourceName = "get_album_list_ok.json", expectedParam = "musicFolderId=$folderId") { diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetAlbumTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetAlbumTest.kt index 6a7fc5a8..14ad35ba 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetAlbumTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetAlbumTest.kt @@ -14,7 +14,7 @@ class SubsonicApiGetAlbumTest : SubsonicAPIClientTest() { @Test fun `Should parse error responce`() { val response = checkErrorCallParsed(mockWebServerRule) { - client.api.getAlbum(56L).execute() + client.api.getAlbum("56").execute() } response.album `should not be` null @@ -23,7 +23,7 @@ class SubsonicApiGetAlbumTest : SubsonicAPIClientTest() { @Test fun `Should add id to request params`() { - val id = 76L + val id = "76" mockWebServerRule.assertRequestParam(responseResourceName = "get_album_ok.json", expectedParam = "id=$id") { @@ -35,7 +35,7 @@ class SubsonicApiGetAlbumTest : SubsonicAPIClientTest() { fun `Should parse ok response`() { mockWebServerRule.enqueueResponse("get_album_ok.json") - val response = client.api.getAlbum(512L).execute() + val response = client.api.getAlbum("512").execute() assertResponseSuccessful(response) with(response.body().album) { diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetArtistTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetArtistTest.kt index 47bd3387..5904ee6c 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetArtistTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetArtistTest.kt @@ -14,7 +14,7 @@ class SubsonicApiGetArtistTest : SubsonicAPIClientTest() { @Test fun `Should parse error call`() { val response = checkErrorCallParsed(mockWebServerRule) { - client.api.getArtist(101L).execute() + client.api.getArtist("101").execute() } response.artist `should not be` null @@ -23,7 +23,7 @@ class SubsonicApiGetArtistTest : SubsonicAPIClientTest() { @Test fun `Should pass id param in request`() { - val id = 929L + val id = "929" mockWebServerRule.assertRequestParam(responseResourceName = "get_artist_ok.json", expectedParam = "id=$id") { @@ -35,7 +35,7 @@ class SubsonicApiGetArtistTest : SubsonicAPIClientTest() { fun `Should parse ok response`() { mockWebServerRule.enqueueResponse("get_artist_ok.json") - val response = client.api.getArtist(100L).execute() + val response = client.api.getArtist("100").execute() assertResponseSuccessful(response) with(response.body().artist) { diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetArtistsTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetArtistsTest.kt index 8ce70097..ac23364d 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetArtistsTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetArtistsTest.kt @@ -50,7 +50,7 @@ class SubsonicApiGetArtistsTest : SubsonicAPIClientTest() { @Test fun `Should pass param on query for get artists call`() { mockWebServerRule.enqueueResponse("get_artists_ok.json") - val musicFolderId = 101L + val musicFolderId = "101" mockWebServerRule.assertRequestParam(responseResourceName = "get_artists_ok.json", expectedParam = "musicFolderId=$musicFolderId") { diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetIndexesTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetIndexesTest.kt index 2e8fafcf..b9bbc34c 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetIndexesTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetIndexesTest.kt @@ -42,7 +42,7 @@ class SubsonicApiGetIndexesTest : SubsonicAPIClientTest() { @Test fun `Should add music folder id as a query param for getIndexes api call`() { - val musicFolderId = 9L + val musicFolderId = "9" mockWebServerRule.assertRequestParam(responseResourceName = "get_indexes_ok.json", expectedParam = "musicFolderId=$musicFolderId") { diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetMusicDirectoryTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetMusicDirectoryTest.kt index 7502d669..b4deff6b 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetMusicDirectoryTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetMusicDirectoryTest.kt @@ -15,7 +15,7 @@ class SubsonicApiGetMusicDirectoryTest : SubsonicAPIClientTest() { @Test fun `Should parse getMusicDirectory error response`() { val response = checkErrorCallParsed(mockWebServerRule) { - client.api.getMusicDirectory(1).execute() + client.api.getMusicDirectory("1").execute() } response.musicDirectory `should not be` null @@ -24,7 +24,7 @@ class SubsonicApiGetMusicDirectoryTest : SubsonicAPIClientTest() { @Test fun `GetMusicDirectory should add directory id to query params`() { - val directoryId = 124L + val directoryId = "124" mockWebServerRule.assertRequestParam(responseResourceName = "get_music_directory_ok.json", expectedParam = "id=$directoryId") { @@ -36,7 +36,7 @@ class SubsonicApiGetMusicDirectoryTest : SubsonicAPIClientTest() { fun `Should parse get music directory ok response`() { mockWebServerRule.enqueueResponse("get_music_directory_ok.json") - val response = client.api.getMusicDirectory(1).execute() + val response = client.api.getMusicDirectory("1").execute() assertResponseSuccessful(response) diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetPlaylistTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetPlaylistTest.kt index a62ef203..d542d0db 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetPlaylistTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetPlaylistTest.kt @@ -14,7 +14,7 @@ class SubsonicApiGetPlaylistTest : SubsonicAPIClientTest() { @Test fun `Should parse error response`() { val response = checkErrorCallParsed(mockWebServerRule) { - client.api.getPlaylist(10).execute() + client.api.getPlaylist("10").execute() } response.playlist `should not be` null @@ -25,7 +25,7 @@ class SubsonicApiGetPlaylistTest : SubsonicAPIClientTest() { fun `Should parse ok response`() { mockWebServerRule.enqueueResponse("get_playlist_ok.json") - val response = client.api.getPlaylist(4).execute() + val response = client.api.getPlaylist("4").execute() assertResponseSuccessful(response) with(response.body().playlist) { @@ -53,7 +53,7 @@ class SubsonicApiGetPlaylistTest : SubsonicAPIClientTest() { @Test fun `Should pass id as request param`() { - val playlistId = 453L + val playlistId = "453" mockWebServerRule.assertRequestParam(responseResourceName = "get_playlist_ok.json", expectedParam = "id=$playlistId") { diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetPodcastsTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetPodcastsTest.kt index 7f7efbb5..e5ead1e3 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetPodcastsTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetPodcastsTest.kt @@ -72,7 +72,7 @@ class SubsonicApiGetPodcastsTest : SubsonicAPIClientTest() { @Test fun `Should pass id in request param`() { - val id = 249L + val id = "249" mockWebServerRule.assertRequestParam(responseResourceName = "get_podcasts_ok.json", expectedParam = "id=$id") { diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetRandomSongsTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetRandomSongsTest.kt index 1a24ed48..8f06b174 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetRandomSongsTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetRandomSongsTest.kt @@ -80,7 +80,7 @@ class SubsonicApiGetRandomSongsTest : SubsonicAPIClientTest() { @Test fun `Should pass music folder id in request param`() { - val musicFolderId = 4919L + val musicFolderId = "4919" mockWebServerRule.assertRequestParam(responseResourceName = "get_random_songs_ok.json", expectedParam = "musicFolderId=$musicFolderId") { diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetSongsByGenreTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetSongsByGenreTest.kt index 39bec40f..2be1b688 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetSongsByGenreTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetSongsByGenreTest.kt @@ -73,7 +73,7 @@ class SubsonicApiGetSongsByGenreTest : SubsonicAPIClientTest() { @Test fun `Should pass music folder id in request param`() { - val musicFolderId = 1010L + val musicFolderId = "1010" mockWebServerRule.assertRequestParam(expectedParam = "musicFolderId=$musicFolderId") { client.api.getSongsByGenre("Trance", musicFolderId = musicFolderId).execute() diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetStarred2Test.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetStarred2Test.kt index 2c97e048..b8409cd0 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetStarred2Test.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetStarred2Test.kt @@ -38,7 +38,7 @@ class SubsonicApiGetStarred2Test : SubsonicAPIClientTest() { @Test fun `Should pass music folder id in request param`() { - val musicFolderId = 441L + val musicFolderId = "441" mockWebServerRule.assertRequestParam(responseResourceName = "get_starred_2_ok.json", expectedParam = "musicFolderId=$musicFolderId") { diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetStarredTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetStarredTest.kt index c412d2e7..3fd5fb9c 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetStarredTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetStarredTest.kt @@ -37,7 +37,7 @@ class SubsonicApiGetStarredTest : SubsonicAPIClientTest() { @Test fun `Should pass music folder id in request param`() { - val musicFolderId = 441L + val musicFolderId = "441" mockWebServerRule.assertRequestParam(responseResourceName = "get_starred_ok.json", expectedParam = "musicFolderId=$musicFolderId") { diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiSearchThreeTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiSearchThreeTest.kt index ac45a389..21ee05f6 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiSearchThreeTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiSearchThreeTest.kt @@ -113,7 +113,7 @@ class SubsonicApiSearchThreeTest : SubsonicAPIClientTest() { @Test fun `Should pass music folder id as request param`() { - val musicFolderId = 43L + val musicFolderId = "43" mockWebServerRule.assertRequestParam(responseResourceName = "search3_ok.json", expectedParam = "musicFolderId=$musicFolderId") { diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiSearchTwoTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiSearchTwoTest.kt index 5115079f..835ac77e 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiSearchTwoTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiSearchTwoTest.kt @@ -113,7 +113,7 @@ class SubsonicApiSearchTwoTest : SubsonicAPIClientTest() { @Test fun `Should pass music folder id in request param`() { - val musicFolderId = 565L + val musicFolderId = "565" mockWebServerRule.assertRequestParam(responseResourceName = "search2_ok.json", expectedParam = "musicFolderId=$musicFolderId") { diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiStarTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiStarTest.kt index b551c8ca..12377e3d 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiStarTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiStarTest.kt @@ -27,7 +27,7 @@ class SubsonicApiStarTest : SubsonicAPIClientTest() { @Test fun `Should pass id param`() { - val id = 110L + val id = "110" mockWebServerRule.assertRequestParam(responseResourceName = "ping_ok.json", expectedParam = "id=$id") { @@ -37,7 +37,7 @@ class SubsonicApiStarTest : SubsonicAPIClientTest() { @Test fun `Should pass artist id param`() { - val artistId = 123L + val artistId = "123" mockWebServerRule.assertRequestParam(responseResourceName = "ping_ok.json", expectedParam = "artistId=$artistId") { @@ -47,7 +47,7 @@ class SubsonicApiStarTest : SubsonicAPIClientTest() { @Test fun `Should pass album id param`() { - val albumId = 1001L + val albumId = "1001" mockWebServerRule.assertRequestParam(responseResourceName = "ping_ok.json", expectedParam = "albumId=$albumId") { diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiUnstarTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiUnstarTest.kt index fc7c27a1..a47a120a 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiUnstarTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiUnstarTest.kt @@ -27,7 +27,7 @@ class SubsonicApiUnstarTest : SubsonicAPIClientTest() { @Test fun `Should pass id param`() { - val id = 545L + val id = "545" mockWebServerRule.assertRequestParam(responseResourceName = "ping_ok.json", expectedParam = "id=$id") { @@ -37,7 +37,7 @@ class SubsonicApiUnstarTest : SubsonicAPIClientTest() { @Test fun `Should pass artistId param`() { - val artistId = 644L + val artistId = "644" mockWebServerRule.assertRequestParam(responseResourceName = "ping_ok.json", expectedParam = "artistId=$artistId") { @@ -47,7 +47,7 @@ class SubsonicApiUnstarTest : SubsonicAPIClientTest() { @Test fun `Should pass albumId param`() { - val albumId = 3344L + val albumId = "3344" mockWebServerRule.assertRequestParam(responseResourceName = "ping_ok.json", expectedParam = "albumId=$albumId") { diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiUpdatePlaylistTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiUpdatePlaylistTest.kt index 19369665..41f43af9 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiUpdatePlaylistTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiUpdatePlaylistTest.kt @@ -9,7 +9,7 @@ class SubsonicApiUpdatePlaylistTest : SubsonicAPIClientTest() { @Test fun `Should handle error response`() { checkErrorCallParsed(mockWebServerRule) { - client.api.updatePlaylist(10).execute() + client.api.updatePlaylist("10").execute() } } @@ -17,14 +17,14 @@ class SubsonicApiUpdatePlaylistTest : SubsonicAPIClientTest() { fun `Should handle ok response`() { mockWebServerRule.enqueueResponse("ping_ok.json") - val response = client.api.updatePlaylist(15).execute() + val response = client.api.updatePlaylist("15").execute() assertResponseSuccessful(response) } @Test fun `Should pass playlist id param in request`() { - val id = 5453L + val id = "5453" mockWebServerRule.assertRequestParam(responseResourceName = "ping_ok.json", expectedParam = "playlistId=$id") { @@ -38,7 +38,7 @@ class SubsonicApiUpdatePlaylistTest : SubsonicAPIClientTest() { mockWebServerRule.assertRequestParam(responseResourceName = "ping_ok.json", expectedParam = "name=$name") { - client.api.updatePlaylist(22, name = name).execute() + client.api.updatePlaylist("22", name = name).execute() } } @@ -48,7 +48,7 @@ class SubsonicApiUpdatePlaylistTest : SubsonicAPIClientTest() { mockWebServerRule.assertRequestParam(responseResourceName = "ping_ok.json", expectedParam = "comment=$comment") { - client.api.updatePlaylist(42, comment = comment).execute() + client.api.updatePlaylist("42", comment = comment).execute() } } @@ -58,17 +58,17 @@ class SubsonicApiUpdatePlaylistTest : SubsonicAPIClientTest() { mockWebServerRule.assertRequestParam(responseResourceName = "ping_ok.json", expectedParam = "public=$public") { - client.api.updatePlaylist(53, public = public).execute() + client.api.updatePlaylist("53", public = public).execute() } } @Test fun `Should pass song ids to update in request`() { - val songIds = listOf(45L, 81L) + val songIds = listOf("45", "81") mockWebServerRule.assertRequestParam(responseResourceName = "ping_ok.json", expectedParam = "songIdToAdd=${songIds[0]}&songIdToAdd=${songIds[1]}") { - client.api.updatePlaylist(25, songIdsToAdd = songIds).execute() + client.api.updatePlaylist("25", songIdsToAdd = songIds).execute() } } @@ -79,7 +79,7 @@ class SubsonicApiUpdatePlaylistTest : SubsonicAPIClientTest() { mockWebServerRule.assertRequestParam(responseResourceName = "ping_ok.json", expectedParam = "songIndexToRemove=${songIndexesToRemove[0]}&" + "songIndexToRemove=${songIndexesToRemove[1]}") { - client.api.updatePlaylist(49, songIndexesToRemove = songIndexesToRemove).execute() + client.api.updatePlaylist("49", songIndexesToRemove = songIndexesToRemove).execute() } } } diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiUpdateShareTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiUpdateShareTest.kt index bd2f46cd..a65d86bd 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiUpdateShareTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiUpdateShareTest.kt @@ -9,7 +9,7 @@ class SubsonicApiUpdateShareTest : SubsonicAPIClientTest() { @Test fun `Should handle error response`() { checkErrorCallParsed(mockWebServerRule) { - client.api.updateShare(11).execute() + client.api.updateShare("11").execute() } } @@ -17,14 +17,14 @@ class SubsonicApiUpdateShareTest : SubsonicAPIClientTest() { fun `Should handle ok response`() { mockWebServerRule.enqueueResponse("ping_ok.json") - val response = client.api.updateShare(12).execute() + val response = client.api.updateShare("12").execute() assertResponseSuccessful(response) } @Test fun `Should pass id in request params`() { - val id = 4432L + val id = "4432" mockWebServerRule.assertRequestParam(expectedParam = "id=$id") { client.api.updateShare(id = id).execute() @@ -36,7 +36,7 @@ class SubsonicApiUpdateShareTest : SubsonicAPIClientTest() { val description = "some-description" mockWebServerRule.assertRequestParam(expectedParam = "description=$description") { - client.api.updateShare(123, description = description).execute() + client.api.updateShare("123", description = description).execute() } } @@ -45,7 +45,7 @@ class SubsonicApiUpdateShareTest : SubsonicAPIClientTest() { val expires = 223123123L mockWebServerRule.assertRequestParam(expectedParam = "expires=$expires") { - client.api.updateShare(12, expires = expires).execute() + client.api.updateShare("12", expires = expires).execute() } } } diff --git a/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/ApiVersionCheckWrapper.kt b/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/ApiVersionCheckWrapper.kt index 55bbfc36..e97ecd07 100644 --- a/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/ApiVersionCheckWrapper.kt +++ b/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/ApiVersionCheckWrapper.kt @@ -45,27 +45,27 @@ import retrofit2.Call internal class ApiVersionCheckWrapper( val api: SubsonicAPIDefinition, var currentApiVersion: SubsonicAPIVersions) : SubsonicAPIDefinition by api { - override fun getArtists(musicFolderId: Long?): Call { + override fun getArtists(musicFolderId: String?): Call { checkVersion(V1_8_0) return api.getArtists(musicFolderId) } - override fun star(id: Long?, albumId: Long?, artistId: Long?): Call { + override fun star(id: String?, albumId: String?, artistId: String?): Call { checkVersion(V1_8_0) return api.star(id, albumId, artistId) } - override fun unstar(id: Long?, albumId: Long?, artistId: Long?): Call { + override fun unstar(id: String?, albumId: String?, artistId: String?): Call { checkVersion(V1_8_0) return api.unstar(id, albumId, artistId) } - override fun getArtist(id: Long): Call { + override fun getArtist(id: String): Call { checkVersion(V1_8_0) return api.getArtist(id) } - override fun getAlbum(id: Long): Call { + override fun getAlbum(id: String): Call { checkVersion(V1_8_0) return api.getAlbum(id) } @@ -76,7 +76,7 @@ internal class ApiVersionCheckWrapper( albumCount: Int?, albumOffset: Int?, songCount: Int?, - musicFolderId: Long?): Call { + musicFolderId: String?): Call { checkVersion(V1_4_0) checkParamVersion(musicFolderId, V1_12_0) return api.search2(query, artistCount, artistOffset, albumCount, albumOffset, songCount, @@ -89,7 +89,7 @@ internal class ApiVersionCheckWrapper( albumCount: Int?, albumOffset: Int?, songCount: Int?, - musicFolderId: Long?): Call { + musicFolderId: String?): Call { checkVersion(V1_8_0) checkParamVersion(musicFolderId, V1_12_0) return api.search3(query, artistCount, artistOffset, albumCount, albumOffset, @@ -101,29 +101,29 @@ internal class ApiVersionCheckWrapper( return api.getPlaylists(username) } - override fun createPlaylist(id: Long?, + override fun createPlaylist(id: String?, name: String?, - songIds: List?): Call { + songIds: List?): Call { checkVersion(V1_2_0) return api.createPlaylist(id, name, songIds) } - override fun deletePlaylist(id: Long): Call { + override fun deletePlaylist(id: String): Call { checkVersion(V1_2_0) return api.deletePlaylist(id) } - override fun updatePlaylist(id: Long, + override fun updatePlaylist(id: String, name: String?, comment: String?, public: Boolean?, - songIdsToAdd: List?, + songIdsToAdd: List?, songIndexesToRemove: List?): Call { checkVersion(V1_8_0) return api.updatePlaylist(id, name, comment, public, songIdsToAdd, songIndexesToRemove) } - override fun getPodcasts(includeEpisodes: Boolean?, id: Long?): Call { + override fun getPodcasts(includeEpisodes: Boolean?, id: String?): Call { checkVersion(V1_6_0) checkParamVersion(includeEpisodes, V1_9_0) checkParamVersion(id, V1_9_0) @@ -147,7 +147,7 @@ internal class ApiVersionCheckWrapper( fromYear: Int?, toYear: Int?, genre: String?, - musicFolderId: Long?): Call { + musicFolderId: String?): Call { checkVersion(V1_2_0) checkParamVersion(musicFolderId, V1_11_0) return api.getAlbumList(type, size, offset, fromYear, toYear, genre, musicFolderId) @@ -159,7 +159,7 @@ internal class ApiVersionCheckWrapper( fromYear: Int?, toYear: Int?, genre: String?, - musicFolderId: Long?): Call { + musicFolderId: String?): Call { checkVersion(V1_8_0) checkParamVersion(musicFolderId, V1_12_0) return api.getAlbumList2(type, size, offset, fromYear, toYear, genre, musicFolderId) @@ -169,18 +169,18 @@ internal class ApiVersionCheckWrapper( genre: String?, fromYear: Int?, toYear: Int?, - musicFolderId: Long?): Call { + musicFolderId: String?): Call { checkVersion(V1_2_0) return api.getRandomSongs(size, genre, fromYear, toYear, musicFolderId) } - override fun getStarred(musicFolderId: Long?): Call { + override fun getStarred(musicFolderId: String?): Call { checkVersion(V1_8_0) checkParamVersion(musicFolderId, V1_12_0) return api.getStarred(musicFolderId) } - override fun getStarred2(musicFolderId: Long?): Call { + override fun getStarred2(musicFolderId: String?): Call { checkVersion(V1_8_0) checkParamVersion(musicFolderId, V1_12_0) return api.getStarred2(musicFolderId) @@ -225,12 +225,12 @@ internal class ApiVersionCheckWrapper( return api.createShare(idsToShare, description, expires) } - override fun deleteShare(id: Long): Call { + override fun deleteShare(id: String): Call { checkVersion(V1_6_0) return api.deleteShare(id) } - override fun updateShare(id: Long, + override fun updateShare(id: String, description: String?, expires: Long?): Call { checkVersion(V1_6_0) @@ -245,7 +245,7 @@ internal class ApiVersionCheckWrapper( override fun getSongsByGenre(genre: String, count: Int, offset: Int, - musicFolderId: Long?): Call { + musicFolderId: String?): Call { checkVersion(V1_9_0) checkParamVersion(musicFolderId, V1_12_0) return api.getSongsByGenre(genre, count, offset, musicFolderId) @@ -271,12 +271,12 @@ internal class ApiVersionCheckWrapper( return api.getBookmarks() } - override fun createBookmark(id: Int, position: Long, comment: String?): Call { + override fun createBookmark(id: String, position: Long, comment: String?): Call { checkVersion(V1_9_0) return api.createBookmark(id, position, comment) } - override fun deleteBookmark(id: Int): Call { + override fun deleteBookmark(id: String): Call { checkVersion(V1_9_0) return api.deleteBookmark(id) } diff --git a/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicAPIDefinition.kt b/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicAPIDefinition.kt index 7e086af9..85887348 100644 --- a/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicAPIDefinition.kt +++ b/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicAPIDefinition.kt @@ -54,30 +54,30 @@ interface SubsonicAPIDefinition { fun getMusicFolders(): Call @GET("getIndexes.view") - fun getIndexes(@Query("musicFolderId") musicFolderId: Long?, + fun getIndexes(@Query("musicFolderId") musicFolderId: String?, @Query("ifModifiedSince") ifModifiedSince: Long?): Call @GET("getMusicDirectory.view") - fun getMusicDirectory(@Query("id") id: Long): Call + fun getMusicDirectory(@Query("id") id: String): Call @GET("getArtists.view") - fun getArtists(@Query("musicFolderId") musicFolderId: Long?): Call + fun getArtists(@Query("musicFolderId") musicFolderId: String?): Call @GET("star.view") - fun star(@Query("id") id: Long? = null, - @Query("albumId") albumId: Long? = null, - @Query("artistId") artistId: Long? = null): Call + fun star(@Query("id") id: String? = null, + @Query("albumId") albumId: String? = null, + @Query("artistId") artistId: String? = null): Call @GET("unstar.view") - fun unstar(@Query("id") id: Long? = null, - @Query("albumId") albumId: Long? = null, - @Query("artistId") artistId: Long? = null): Call + fun unstar(@Query("id") id: String? = null, + @Query("albumId") albumId: String? = null, + @Query("artistId") artistId: String? = null): Call @GET("getArtist.view") - fun getArtist(@Query("id") id: Long): Call + fun getArtist(@Query("id") id: String): Call @GET("getAlbum.view") - fun getAlbum(@Query("id") id: Long): Call + fun getAlbum(@Query("id") id: String): Call @GET("search.view") fun search(@Query("artist") artist: String? = null, @@ -95,7 +95,7 @@ interface SubsonicAPIDefinition { @Query("albumCount") albumCount: Int? = null, @Query("albumOffset") albumOffset: Int? = null, @Query("songCount") songCount: Int? = null, - @Query("musicFolderId") musicFolderId: Long? = null): Call + @Query("musicFolderId") musicFolderId: String? = null): Call @GET("search3.view") fun search3(@Query("query") query: String, @@ -104,34 +104,34 @@ interface SubsonicAPIDefinition { @Query("albumCount") albumCount: Int? = null, @Query("albumOffset") albumOffset: Int? = null, @Query("songCount") songCount: Int? = null, - @Query("musicFolderId") musicFolderId: Long? = null): Call + @Query("musicFolderId") musicFolderId: String? = null): Call @GET("getPlaylist.view") - fun getPlaylist(@Query("id") id: Long): Call + fun getPlaylist(@Query("id") id: String): Call @GET("getPlaylists.view") fun getPlaylists(@Query("username") username: String? = null): Call @GET("createPlaylist.view") - fun createPlaylist(@Query("playlistId") id: Long? = null, + fun createPlaylist(@Query("playlistId") id: String? = null, @Query("name") name: String? = null, - @Query("songId") songIds: List? = null): Call + @Query("songId") songIds: List? = null): Call @GET("deletePlaylist.view") - fun deletePlaylist(@Query("id") id: Long): Call + fun deletePlaylist(@Query("id") id: String): Call @GET("updatePlaylist.view") fun updatePlaylist( - @Query("playlistId") id: Long, + @Query("playlistId") id: String, @Query("name") name: String? = null, @Query("comment") comment: String? = null, @Query("public") public: Boolean? = null, - @Query("songIdToAdd") songIdsToAdd: List? = null, + @Query("songIdToAdd") songIdsToAdd: List? = null, @Query("songIndexToRemove") songIndexesToRemove: List? = null): Call @GET("getPodcasts.view") fun getPodcasts(@Query("includeEpisodes") includeEpisodes: Boolean? = null, - @Query("id") id: Long? = null): Call + @Query("id") id: String? = null): Call @GET("getLyrics.view") fun getLyrics(@Query("artist") artist: String? = null, @@ -149,7 +149,7 @@ interface SubsonicAPIDefinition { @Query("fromYear") fromYear: Int? = null, @Query("toYear") toYear: Int? = null, @Query("genre") genre: String? = null, - @Query("musicFolderId") musicFolderId: Long? = null): Call + @Query("musicFolderId") musicFolderId: String? = null): Call @GET("getAlbumList2.view") fun getAlbumList2(@Query("type") type: AlbumListType, @@ -158,20 +158,20 @@ interface SubsonicAPIDefinition { @Query("fromYear") fromYear: Int? = null, @Query("toYear") toYear: Int? = null, @Query("genre") genre: String? = null, - @Query("musicFolderId") musicFolderId: Long? = null): Call + @Query("musicFolderId") musicFolderId: String? = null): Call @GET("getRandomSongs.view") fun getRandomSongs(@Query("size") size: Int? = null, @Query("genre") genre: String? = null, @Query("fromYear") fromYear: Int? = null, @Query("toYear") toYear: Int? = null, - @Query("musicFolderId") musicFolderId: Long? = null): Call + @Query("musicFolderId") musicFolderId: String? = null): Call @GET("getStarred.view") - fun getStarred(@Query("musicFolderId") musicFolderId: Long? = null): Call + fun getStarred(@Query("musicFolderId") musicFolderId: String? = null): Call @GET("getStarred2.view") - fun getStarred2(@Query("musicFolderId") musicFolderId: Long? = null): Call + fun getStarred2(@Query("musicFolderId") musicFolderId: String? = null): Call @Streaming @GET("getCoverArt.view") @@ -205,10 +205,10 @@ interface SubsonicAPIDefinition { @Query("expires") expires: Long? = null): Call @GET("deleteShare.view") - fun deleteShare(@Query("id") id: Long): Call + fun deleteShare(@Query("id") id: String): Call @GET("updateShare.view") - fun updateShare(@Query("id") id: Long, + fun updateShare(@Query("id") id: String, @Query("description") description: String? = null, @Query("expires") expires: Long? = null): Call @@ -220,7 +220,7 @@ interface SubsonicAPIDefinition { @Query("genre") genre: String, @Query("count") count: Int = 10, @Query("offset") offset: Int = 0, - @Query("musicFolderId") musicFolderId: Long? = null): Call + @Query("musicFolderId") musicFolderId: String? = null): Call @GET("getUser.view") fun getUser(@Query("username") username: String): Call @@ -236,12 +236,12 @@ interface SubsonicAPIDefinition { @GET("createBookmark.view") fun createBookmark( - @Query("id") id: Int, + @Query("id") id: String, @Query("position") position: Long, @Query("comment") comment: String? = null): Call @GET("deleteBookmark.view") - fun deleteBookmark(@Query("id") id: Int): Call + fun deleteBookmark(@Query("id") id: String): Call @GET("getVideos.view") fun getVideos(): Call diff --git a/subsonic-api/src/test/kotlin/org/moire/ultrasonic/api/subsonic/ApiVersionCheckWrapperTest.kt b/subsonic-api/src/test/kotlin/org/moire/ultrasonic/api/subsonic/ApiVersionCheckWrapperTest.kt index d139b863..ec3d2aac 100644 --- a/subsonic-api/src/test/kotlin/org/moire/ultrasonic/api/subsonic/ApiVersionCheckWrapperTest.kt +++ b/subsonic-api/src/test/kotlin/org/moire/ultrasonic/api/subsonic/ApiVersionCheckWrapperTest.kt @@ -37,10 +37,10 @@ class ApiVersionCheckWrapperTest { wrapper.getAlbumList(BY_GENRE) - val throwCall = { wrapper.getAlbumList(BY_GENRE, musicFolderId = 12L) } + val throwCall = { wrapper.getAlbumList(BY_GENRE, musicFolderId = "12") } throwCall `should throw` ApiNotSupportedException::class verify(apiMock).getAlbumList(BY_GENRE) - verify(apiMock, never()).getAlbumList(BY_GENRE, musicFolderId = 12L) + verify(apiMock, never()).getAlbumList(BY_GENRE, musicFolderId = "12") } } diff --git a/ultrasonic/src/main/java/org/moire/ultrasonic/service/RESTMusicService.java b/ultrasonic/src/main/java/org/moire/ultrasonic/service/RESTMusicService.java index 18d8df3e..a4c6c116 100644 --- a/ultrasonic/src/main/java/org/moire/ultrasonic/service/RESTMusicService.java +++ b/ultrasonic/src/main/java/org/moire/ultrasonic/service/RESTMusicService.java @@ -188,7 +188,7 @@ public class RESTMusicService implements MusicService { updateProgressListener(progressListener, R.string.parser_reading); Response response = subsonicAPIClient.getApi() - .getIndexes(musicFolderId == null ? null : Long.valueOf(musicFolderId), null).execute(); + .getIndexes(musicFolderId, null).execute(); checkResponseSuccessful(response); Indexes indexes = APIIndexesConverter.toDomainEntity(response.body().getIndexes()); @@ -251,13 +251,9 @@ public class RESTMusicService implements MusicService { String artistId, Context context, ProgressListener progressListener) throws Exception { - Long apiId = id == null ? null : Long.valueOf(id); - Long apiAlbumId = albumId == null ? null : Long.valueOf(albumId); - Long apiArtistId = artistId == null ? null : Long.valueOf(artistId); - updateProgressListener(progressListener, R.string.parser_reading); Response response = subsonicAPIClient.getApi() - .star(apiId, apiAlbumId, apiArtistId).execute(); + .star(id, albumId, artistId).execute(); checkResponseSuccessful(response); } @@ -267,13 +263,9 @@ public class RESTMusicService implements MusicService { String artistId, Context context, ProgressListener progressListener) throws Exception { - Long apiId = id == null ? null : Long.valueOf(id); - Long apiAlbumId = albumId == null ? null : Long.valueOf(albumId); - Long apiArtistId = artistId == null ? null : Long.valueOf(artistId); - updateProgressListener(progressListener, R.string.parser_reading); Response response = subsonicAPIClient.getApi() - .unstar(apiId, apiAlbumId, apiArtistId).execute(); + .unstar(id, albumId, artistId).execute(); checkResponseSuccessful(response); } @@ -289,7 +281,7 @@ public class RESTMusicService implements MusicService { updateProgressListener(progressListener, R.string.parser_reading); Response response = subsonicAPIClient.getApi() - .getMusicDirectory(Long.valueOf(id)).execute(); + .getMusicDirectory(id).execute(); checkResponseSuccessful(response); return APIMusicDirectoryConverter.toDomainEntity(response.body().getMusicDirectory()); @@ -306,8 +298,7 @@ public class RESTMusicService implements MusicService { } updateProgressListener(progressListener, R.string.parser_reading); - Response response = subsonicAPIClient.getApi() - .getArtist(Long.valueOf(id)).execute(); + Response response = subsonicAPIClient.getApi().getArtist(id).execute(); checkResponseSuccessful(response); return APIArtistConverter.toMusicDirectoryDomainEntity(response.body().getArtist()); @@ -324,8 +315,7 @@ public class RESTMusicService implements MusicService { } updateProgressListener(progressListener, R.string.parser_reading); - Response response = subsonicAPIClient.getApi() - .getAlbum(Long.valueOf(id)).execute(); + Response response = subsonicAPIClient.getApi().getAlbum(id).execute(); checkResponseSuccessful(response); return APIAlbumConverter.toMusicDirectoryDomainEntity(response.body().getAlbum()); @@ -406,7 +396,7 @@ public class RESTMusicService implements MusicService { updateProgressListener(progressListener, R.string.parser_reading); Response response = subsonicAPIClient.getApi() - .getPlaylist(Long.valueOf(id)).execute(); + .getPlaylist(id).execute(); checkResponseSuccessful(response); MusicDirectory playlist = APIPlaylistConverter @@ -459,17 +449,16 @@ public class RESTMusicService implements MusicService { List entries, Context context, ProgressListener progressListener) throws Exception { - Long pId = id == null ? null : Long.valueOf(id); - List pSongIds = new ArrayList<>(entries.size()); + List pSongIds = new ArrayList<>(entries.size()); for (MusicDirectory.Entry entry : entries) { if (entry.getId() != null) { - pSongIds.add(Long.valueOf(entry.getId())); + pSongIds.add(entry.getId()); } } updateProgressListener(progressListener, R.string.parser_reading); Response response = subsonicAPIClient.getApi() - .createPlaylist(pId, name, pSongIds).execute(); + .createPlaylist(id, name, pSongIds).execute(); checkResponseSuccessful(response); } @@ -477,11 +466,9 @@ public class RESTMusicService implements MusicService { public void deletePlaylist(String id, Context context, ProgressListener progressListener) throws Exception { - Long pId = id == null ? null : Long.valueOf(id); - updateProgressListener(progressListener, R.string.parser_reading); Response response = subsonicAPIClient.getApi() - .deletePlaylist(pId).execute(); + .deletePlaylist(id).execute(); checkResponseSuccessful(response); } @@ -494,7 +481,7 @@ public class RESTMusicService implements MusicService { ProgressListener progressListener) throws Exception { updateProgressListener(progressListener, R.string.parser_reading); Response response = subsonicAPIClient.getApi() - .updatePlaylist(Long.valueOf(id), name, comment, pub, null, null).execute(); + .updatePlaylist(id, name, comment, pub, null, null).execute(); checkResponseSuccessful(response); } @@ -521,7 +508,7 @@ public class RESTMusicService implements MusicService { updateProgressListener(progressListener, R.string.parser_reading); Response response = subsonicAPIClient.getApi() - .getPodcasts(true, Long.valueOf(podcastChannelId)).execute(); + .getPodcasts(true, podcastChannelId).execute(); checkResponseSuccessful(response); List podcastEntries = response.body().getPodcastChannels().get(0) @@ -947,10 +934,9 @@ public class RESTMusicService implements MusicService { if (id == null) { throw new IllegalArgumentException("Item id should not be null"); } - Integer itemId = Integer.valueOf(id); updateProgressListener(progressListener, R.string.parser_reading); Response response = subsonicAPIClient.getApi() - .createBookmark(itemId, position, null).execute(); + .createBookmark(id, position, null).execute(); checkResponseSuccessful(response); } @@ -965,7 +951,7 @@ public class RESTMusicService implements MusicService { updateProgressListener(progressListener, R.string.parser_reading); Response response = subsonicAPIClient.getApi() - .deleteBookmark(itemId).execute(); + .deleteBookmark(id).execute(); checkResponseSuccessful(response); } @@ -1008,8 +994,7 @@ public class RESTMusicService implements MusicService { Long shareId = Long.valueOf(id); updateProgressListener(progressListener, R.string.parser_reading); - Response response = subsonicAPIClient.getApi() - .deleteShare(shareId).execute(); + Response response = subsonicAPIClient.getApi().deleteShare(id).execute(); checkResponseSuccessful(response); } @@ -1027,11 +1012,9 @@ public class RESTMusicService implements MusicService { expires = null; } - Long shareId = Long.valueOf(id); - updateProgressListener(progressListener, R.string.parser_reading); Response response = subsonicAPIClient.getApi() - .updateShare(shareId, description, expires).execute(); + .updateShare(id, description, expires).execute(); checkResponseSuccessful(response); }