Add documentation comments
parent
b6e2182069
commit
4a2f899a64
@ -1,10 +1,30 @@
|
||||
package org.koitharu.kotatsu.parsers
|
||||
|
||||
import org.koitharu.kotatsu.parsers.exception.AuthRequiredException
|
||||
import org.koitharu.kotatsu.parsers.exception.ParseException
|
||||
|
||||
/**
|
||||
* Implement this in your parser for authorization support
|
||||
*/
|
||||
interface MangaParserAuthProvider {
|
||||
|
||||
/**
|
||||
* Return link to the login page, which will be opened in browser.
|
||||
* Must be an absolute url
|
||||
*/
|
||||
val authUrl: String
|
||||
|
||||
/**
|
||||
* Quick check if user is logged in.
|
||||
* In most case you should check for cookies in [MangaLoaderContext.cookieJar].
|
||||
*/
|
||||
val isAuthorized: Boolean
|
||||
|
||||
/**
|
||||
* Fetch and return current user`s name or login.
|
||||
* Normally should not be called if [isAuthorized] returns false
|
||||
* @throws [AuthRequiredException] if user is not logged in or authorization is expired
|
||||
* @throws [ParseException] on parsing error
|
||||
*/
|
||||
suspend fun getUsername(): String
|
||||
}
|
||||
@ -1,8 +1,20 @@
|
||||
package org.koitharu.kotatsu.parsers
|
||||
|
||||
/**
|
||||
* Annotate each [MangaParser] implementation with this annotation, used by codegen
|
||||
*/
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
annotation class MangaSourceParser(
|
||||
/**
|
||||
* Name of manga source. Used as an Enum value, must be UPPER_CASE and unique.
|
||||
*/
|
||||
val name: String,
|
||||
/**
|
||||
* User-friendly title of manga source. In most case equals the website name.
|
||||
*/
|
||||
val title: String,
|
||||
/**
|
||||
* Language code (for example "en" or "ru") or blank if parser provide manga on different languages.
|
||||
*/
|
||||
val locale: String = "",
|
||||
)
|
||||
@ -1,6 +1,6 @@
|
||||
package org.koitharu.kotatsu.parsers.exception
|
||||
|
||||
class ParseException(
|
||||
message: String? = null,
|
||||
class ParseException @JvmOverloads constructor(
|
||||
message: String?,
|
||||
cause: Throwable? = null,
|
||||
) : RuntimeException(message, cause)
|
||||
@ -1,3 +1,5 @@
|
||||
@file:JvmName("Constants")
|
||||
|
||||
package org.koitharu.kotatsu.parsers.model
|
||||
|
||||
internal const val RATING_UNKNOWN = -1f
|
||||
const val RATING_UNKNOWN = -1f
|
||||
Loading…
Reference in New Issue