From 3d01f0faf3cc4855487b823e38af10ba799d460f Mon Sep 17 00:00:00 2001 From: Barnabas Balogh Date: Wed, 29 Apr 2026 18:04:52 +0200 Subject: [PATCH] feat: Added getGenre api wrapper function --- .../data/jellyfin/client/JellyfinApiClient.kt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/data/src/main/java/hu/bbara/purefin/data/jellyfin/client/JellyfinApiClient.kt b/data/src/main/java/hu/bbara/purefin/data/jellyfin/client/JellyfinApiClient.kt index 52a4e939..9c25bc90 100644 --- a/data/src/main/java/hu/bbara/purefin/data/jellyfin/client/JellyfinApiClient.kt +++ b/data/src/main/java/hu/bbara/purefin/data/jellyfin/client/JellyfinApiClient.kt @@ -11,6 +11,7 @@ import kotlinx.coroutines.flow.first import kotlinx.coroutines.withContext import org.jellyfin.sdk.api.client.Response import org.jellyfin.sdk.api.client.extensions.authenticateUserByName +import org.jellyfin.sdk.api.client.extensions.genresApi import org.jellyfin.sdk.api.client.extensions.itemsApi import org.jellyfin.sdk.api.client.extensions.mediaInfoApi import org.jellyfin.sdk.api.client.extensions.mediaSegmentsApi @@ -250,6 +251,18 @@ class JellyfinApiClient @Inject constructor( nextUpEpisodes } + suspend fun getGenres(id: UUID? = null) : List = withContext(Dispatchers.IO) { + if (!ensureConfigured()) { + return@withContext emptyList() + } + val result = api.genresApi.getGenres( + userId = getUserId(), + parentId = id, + ) + Log.d("getGenres", result.toString()) + result.content.items + } + suspend fun getMediaSources(mediaId: UUID): List = withContext(Dispatchers.IO) { if (!ensureConfigured()) { return@withContext emptyList()