tachiyomi/source-api/src/commonMain/kotlin/eu/kanade/tachiyomi/source/Source.kt

96 lines
2.5 KiB
Kotlin
Raw Normal View History

package eu.kanade.tachiyomi.source
import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.util.awaitSingle
import rx.Observable
/**
2023-04-22 17:15:45 +02:00
* A basic interface for creating a source. It could be an online source, a local source, etc.
*/
2022-08-18 20:07:13 +02:00
interface Source {
/**
2023-04-22 17:15:45 +02:00
* ID for the source. Must be unique.
*/
2022-08-18 20:07:13 +02:00
val id: Long
/**
* Name of the source.
*/
2022-08-18 20:07:13 +02:00
val name: String
2022-08-18 20:07:13 +02:00
val lang: String
get() = ""
2023-08-26 16:30:26 +02:00
/**
* Get the updated details for a manga.
*
* @param manga the manga to update.
*/
@Suppress("DEPRECATION")
suspend fun getMangaDetails(manga: SManga): SManga {
return fetchMangaDetails(manga).awaitSingle()
}
/**
* Get all the available chapters for a manga.
*
* @param manga the manga to update.
*/
@Suppress("DEPRECATION")
suspend fun getChapterList(manga: SManga): List<SChapter> {
return fetchChapterList(manga).awaitSingle()
}
/**
* Get the list of pages a chapter has. Pages should be returned
* in the expected order; the index is ignored.
*
* @param chapter the chapter.
*/
@Suppress("DEPRECATION")
suspend fun getPageList(chapter: SChapter): List<Page> {
return fetchPageList(chapter).awaitSingle()
}
/**
* Returns an observable with the updated details for a manga.
*
* @param manga the manga to update.
*/
@Deprecated(
2023-08-26 16:30:26 +02:00
"Use the non-RxJava API instead",
2022-04-08 22:44:23 +02:00
ReplaceWith("getMangaDetails"),
)
fun fetchMangaDetails(manga: SManga): Observable<SManga> = throw IllegalStateException(
"Not used",
)
/**
* Returns an observable with all the available chapters for a manga.
*
* @param manga the manga to update.
*/
@Deprecated(
2023-08-26 16:30:26 +02:00
"Use the non-RxJava API instead",
2022-04-08 22:44:23 +02:00
ReplaceWith("getChapterList"),
)
fun fetchChapterList(manga: SManga): Observable<List<SChapter>> = throw IllegalStateException(
"Not used",
)
/**
2023-04-22 17:15:45 +02:00
* Returns an observable with the list of pages a chapter has. Pages should be returned
* in the expected order; the index is ignored.
*
* @param chapter the chapter.
*/
@Deprecated(
2023-08-26 16:30:26 +02:00
"Use the non-RxJava API instead",
2022-04-08 22:44:23 +02:00
ReplaceWith("getPageList"),
)
fun fetchPageList(chapter: SChapter): Observable<List<Page>> = Observable.empty()
2020-02-27 00:03:34 +01:00
}