Minor cleanup to ResolvableSource

This commit is contained in:
arkon 2023-10-21 21:50:53 -04:00
parent fcba2306e9
commit 7326598475

View file

@ -5,29 +5,31 @@ import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.source.model.SManga
/** /**
* A source that may handle opening an SManga for a given URI. * A source that may handle opening an SManga or SChapter for a given URI.
* *
* @since extensions-lib 1.5 * @since extensions-lib 1.5
*/ */
interface ResolvableSource : Source { interface ResolvableSource : Source {
/** /**
* Returns the UriType of the uri input. * Returns what the given URI may open.
* Returns Unknown if unable to resolve the URI * Returns [UriType.Unknown] if the source is not able to resolve the URI.
* *
* @since extensions-lib 1.5 * @since extensions-lib 1.5
*/ */
fun getUriType(uri: String): UriType fun getUriType(uri: String): UriType
/** /**
* Called if canHandleUri is true. Returns the corresponding SManga, if possible. * Called if [getUriType] is [UriType.Manga].
* Returns the corresponding SManga, if possible.
* *
* @since extensions-lib 1.5 * @since extensions-lib 1.5
*/ */
suspend fun getManga(uri: String): SManga? suspend fun getManga(uri: String): SManga?
/** /**
* Called if canHandleUri is true. Returns the corresponding SChapter, if possible. * Called if [getUriType] is [UriType.Chapter].
* Returns the corresponding SChapter, if possible.
* *
* @since extensions-lib 1.5 * @since extensions-lib 1.5
*/ */
@ -35,7 +37,7 @@ interface ResolvableSource : Source {
} }
sealed interface UriType { sealed interface UriType {
object Manga : UriType data object Manga : UriType
object Chapter : UriType data object Chapter : UriType
object Unknown : UriType data object Unknown : UriType
} }