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

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

package `in`.shabinder.soundbound.providers

import app.cash.zipline.ZiplineService
import `in`.shabinder.soundbound.models.DownloadQueryResult
import `in`.shabinder.soundbound.models.DownloadQueryResults
import `in`.shabinder.soundbound.models.QueryParams
import `in`.shabinder.soundbound.models.SongModel

interface DownloadableProvider : QueryableProvider, ZiplineService {

    /*
    * The Provider Guarantees that TrackEntity has a method to return a download Link,
    *   so one can be assured tracks from this `Source` can be DOWNLOADED
    *
    * Can Throw DownloadLinkFetchFailed.
    * */
    // suspend fun getDownloadLink(entity: TrackEntity): DownloadQueryResult

    /*
    * Search and find the closest match for provided QueryParams
    * */
    suspend fun findBestMatchURL(
        queryParams: QueryParams
    ): DownloadQueryResults /*= sortByBestMatch(
        search(queryParams),
        queryParams
    ).let { bestMatch ->
        getDownloadLink(bestMatch)
    }*/

    /*
    * Search and find the closest match for provided TrackDetails
    * */
    suspend fun findBestMatchURL(songModel: SongModel) =
        findBestMatchURL(songModel.makeQueryParams())
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy