All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.in.shabinder.soundbound.providers.Provider.kt Maven / Gradle / Ivy

The newest version!
package `in`.shabinder.soundbound.providers

import androidx.compose.runtime.Immutable
import app.cash.zipline.ZiplineService
import `in`.shabinder.soundbound.models.PlatformQueryResult
import `in`.shabinder.soundbound.models.SourceModel
import `in`.shabinder.soundbound.providers.auth.AuthHandler
import `in`.shabinder.soundbound.providers.catalog.Catalogue
import `in`.shabinder.soundbound.providers.lyrics.LyricsProvider

@Immutable
interface Provider : ConfigHandler, Dependencies, ZiplineService, Catalogue, LyricsProvider,
    AuthHandler {

    /*
    * Preference priority
    * 0 -> 10 ,
    *   0 will make this the best extension when multiple are registered for same `source`
    * */
    val priority: Int

    /*
    * Source Name
    * ex: GAANA, JIOSAAVN, SOUNDCLOUD, etc
    * */
    val source: SourceModel

    override val prefKey: String get() = source.sourceName
    override val authDataConfigKey: String get() = source.sourceName

    /*
    * For a Particular URL, will return if this Extension Supports it for metadata fetching
    * */
    fun isLinkSupported(URL: String): Boolean

    suspend fun fetchPlatformQueryResult(URL: String): PlatformQueryResult

    suspend fun init() {}

    val isCatalogueAvailable: Boolean
        get() = this !is Catalogue.CatalogueNotAvailable

    val isLyricsAvailable: Boolean
        get() = this !is LyricsProvider.LyricsNotAvailable
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy