You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Kotatsu/src/main/kotlin/org/koitharu/kotatsu/parsers/MangaParserAuthProvider.kt

31 lines
884 B
Kotlin

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
*/
public interface MangaParserAuthProvider {
/**
* Return link to the login page, which will be opened in browser.
* Must be an absolute url
*/
public val authUrl: String
/**
* Quick check if user is logged in.
* In most case you should check for cookies in [MangaLoaderContext.cookieJar].
*/
public 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
*/
public suspend fun getUsername(): String
}