Skip to content

Commit a24fdef

Browse files
committed
Merge branch 'master' into dev
Signed-off-by: Adam Ratzman <[email protected]> # Conflicts: # build.gradle.kts # gradle/wrapper/gradle-wrapper.properties # settings.gradle.kts # src/commonMain/kotlin/com.adamratzman.spotify/endpoints/client/ClientFollowingApi.kt # src/commonMain/kotlin/com.adamratzman.spotify/endpoints/client/ClientLibraryApi.kt # src/commonMain/kotlin/com.adamratzman.spotify/endpoints/client/ClientPlayerApi.kt # src/commonMain/kotlin/com.adamratzman.spotify/endpoints/client/ClientPlaylistApi.kt # src/commonMain/kotlin/com.adamratzman.spotify/endpoints/public/BrowseApi.kt # src/commonMain/kotlin/com.adamratzman.spotify/http/HttpConnection.kt # src/commonMain/kotlin/com.adamratzman.spotify/models/Playable.kt # src/commonTest/kotlin/com.adamratzman/spotify/utilities/JsonTests.kt # src/commonTest/kotlin/com.adamratzman/spotify/utilities/UrisTests.kt
2 parents 1a099a3 + ed5ee68 commit a24fdef

File tree

4 files changed

+35
-2
lines changed

4 files changed

+35
-2
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,15 @@ data class SimpleArtist(
2323
val type: String
2424
) : CoreObject() {
2525

26+
/**
27+
* This [SimpleArtist] into a full [Artist] object
28+
*/
29+
val fullArtist by lazy { api.artists.getArtist(id) }
30+
2631
/**
2732
* Converts this [SimpleArtist] into a full [Artist] object
2833
*/
34+
@Deprecated("Replaced with a lazy fullArtist property", ReplaceWith("fullArtist"))
2935
fun toFullArtist() = api.artists.getArtist(id)
3036
}
3137

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

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

4+
import com.adamratzman.spotify.SpotifyClientApi
45
import com.adamratzman.spotify.SpotifyScope
56
import com.adamratzman.spotify.utils.Locale
7+
import com.adamratzman.spotify.utils.Market
68
import kotlinx.serialization.SerialName
79
import kotlinx.serialization.Serializable
810
import kotlinx.serialization.Transient
@@ -104,6 +106,13 @@ data class SimpleEpisode(
104106
val languages
105107
get() = (language?.let { showLanguagesPrivate + it } ?: showLanguagesPrivate)
106108
.map { Locale.valueOf(it.replace("-", "_")) }
109+
110+
/**
111+
* Converts this [SimpleEpisode] into a full [Episode] object
112+
*
113+
* @param market Provide this parameter if you want the list of returned items to be relevant to a particular country.
114+
*/
115+
fun toFullEpisode(market: Market? = null) = (api as? SpotifyClientApi)?.episodes?.getEpisode(id, market)
107116
}
108117

109118
/**

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

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

4+
import com.adamratzman.spotify.utils.Market
45
import kotlinx.serialization.SerialName
56
import kotlinx.serialization.Serializable
67

@@ -68,4 +69,15 @@ data class LocalTrack(
6869
@SerialName("track_number") val trackNumber: Int? = null,
6970
override val type: String,
7071
override val uri: LocalTrackUri
71-
) : IdentifiableNullable(), Playable
72+
) : IdentifiableNullable(), Playable {
73+
74+
/**
75+
* Search for this local track by name in Spotify's track catalog.
76+
*
77+
* @param limit The number of objects to return. Default: 50 (or api limit). Minimum: 1. Maximum: 50.
78+
* @param offset The index of the first item to return. Default: 0. Use with limit to get the next set of items
79+
* @param market Provide this parameter if you want the list of returned items to be relevant to a particular country.
80+
* If omitted, the returned items will be relevant to all countries.
81+
*/
82+
fun searchForSpotifyTrack(limit: Int? = null, offset: Int? = null, market: Market? = null) = api.search.searchTrack(name, limit, offset, market)
83+
}

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

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

4+
import com.adamratzman.spotify.SpotifyClientApi
45
import com.adamratzman.spotify.utils.Locale
56
import com.adamratzman.spotify.utils.Market
67
import kotlinx.serialization.SerialName
@@ -53,7 +54,12 @@ data class SimpleShow(
5354

5455
val languages get() = languagesString.map { Locale.valueOf(it.replace("-", "_")) }
5556

56-
// TODO fun toFullShow(market: Market? = null) = api.tracks.getTrack(id, market)
57+
/**
58+
* Converts this [SimpleShow] to a full [Show] object
59+
*
60+
* @param market Provide this parameter if you want the list of returned items to be relevant to a particular country.
61+
*/
62+
fun toFullShow(market: Market? = null) = (api as? SpotifyClientApi)?.shows?.getShow(id, market)
5763
}
5864

5965
/**

0 commit comments

Comments
 (0)