Skip to content

Commit e475600

Browse files
committed
Add Player.activeElement, make AuthenticationError.error_description nullable
Signed-off-by: Adam Ratzman <[email protected]>
1 parent b1ed652 commit e475600

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

src/commonMain/kotlin/com.adamratzman.spotify/endpoints/pub/BrowseApi.kt

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,8 @@ public class BrowseApi(api: GenericSpotifyApi) : SpotifyEndpoint(api) {
7676
offset: Int? = null,
7777
market: Market? = null
7878
): PagingObject<SimpleAlbum> = get(
79-
endpointBuilder("/browse/new-releases").with("limit", limit).with("offset", offset).with(
80-
"country",
81-
market?.name
82-
).toString()
79+
endpointBuilder("/browse/new-releases").with("limit", limit)
80+
.with("offset", offset).with("country", market?.name).toString()
8381
).toNonNullablePagingObject(SimpleAlbum.serializer(), "albums", api = api, json = json)
8482

8583
/**
@@ -281,11 +279,10 @@ public class BrowseApi(api: GenericSpotifyApi) : SpotifyEndpoint(api) {
281279
offset: Int? = null,
282280
market: Market? = null
283281
): PagingObject<SimplePlaylist> = get(
284-
endpointBuilder("/browse/categories/${categoryId.encodeUrl()}/playlists").with(
285-
"limit",
286-
limit
287-
).with("offset", offset)
288-
.with("market", market?.name).toString()
282+
endpointBuilder("/browse/categories/${categoryId.encodeUrl()}/playlists")
283+
.with("limit", limit)
284+
.with("offset", offset)
285+
.with("country", market?.name).toString()
289286
).toNonNullablePagingObject((SimplePlaylist.serializer()), "playlists", api = api, json = json)
290287

291288
/**

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public data class ErrorObject(val status: Int, val message: String, val reason:
129129
@Serializable
130130
public data class AuthenticationError(
131131
val error: String,
132-
@SerialName("error_description") val description: String
132+
@SerialName("error_description") val description: String? = null
133133
)
134134

135135
/**

src/jsMain/kotlin/com/adamratzman/spotify/webplayer/WebPlaybackSdk.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,14 @@ public open external class Player(options: PlayerInit) {
132132
*/
133133
public open fun getCurrentState(): Promise<PlaybackState?>
134134

135+
/**
136+
* Some browsers prevent autoplay of media by ensuring that all playback is triggered by
137+
* synchronous event-paths originating from user interaction such as a click.
138+
* This event allows you to manually activate the element if action is deferred or done
139+
* in a separate execution context than the user action.
140+
*/
141+
public fun activateElement(): Promise<Any>
142+
135143
/**
136144
* Get the local volume currently set in the Web Playback SDK.
137145
* @return Returns a Promise containing the local volume (as a Float between 0 and 1).

0 commit comments

Comments
 (0)