SyncAPI

abstract class SyncAPI : AuthAPI(source)

Stateless synchronization class, used for syncing status about a specific movie/show.

All non-null AuthToken will be non-expired when each function is called.

Inheritors

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
abstract class AbstractSyncStatus
Link copied to clipboard
data class LibraryItem(val name: String, val url: String, val syncId: String, val episodesCompleted: Int?, val episodesTotal: Int?, val personalRating: Score?, val lastUpdatedUnixTime: Long?, val apiName: String, var type: TvType?, var posterUrl: String?, var posterHeaders: Map<String, String>?, var quality: SearchQuality?, val releaseDate: Date?, var id: Int? = null, val plot: String? = null, var score: Score? = null, val tags: List<String>? = null) : SearchResponse
Link copied to clipboard
data class LibraryList(val name: UiText, val items: List<SyncAPI.LibraryItem>)
Link copied to clipboard
data class LibraryMetadata(val allLibraryLists: List<SyncAPI.LibraryList>, val supportedListSorting: Set<ListSorting>)
Link copied to clipboard
data class Page(val title: UiText, var items: List<SyncAPI.LibraryItem>)
Link copied to clipboard
data class SyncResult(var id: String, var totalEpisodes: Int? = null, var title: String? = null, var publicScore: Score? = null, var duration: Int? = null, var synopsis: String? = null, var airStatus: ShowStatus? = null, var nextAiring: NextAiring? = null, var studio: List<String>? = null, var genres: List<String>? = null, var synonyms: List<String>? = null, var trailers: List<String>? = null, var isAdult: Boolean? = null, var posterUrl: String? = null, var backgroundPosterUrl: String? = null, var startDate: Long? = null, var endDate: Long? = null, var recommendations: List<SyncAPI.SyncSearchResult>? = null, var nextSeason: SyncAPI.SyncSearchResult? = null, var prevSeason: SyncAPI.SyncSearchResult? = null, var actors: List<ActorData>? = null)
Link copied to clipboard
data class SyncSearchResult(val name: String, val apiName: String, var syncId: String, val url: String, var posterUrl: String?, var type: TvType? = null, var quality: SearchQuality? = null, var posterHeaders: Map<String, String>? = null, var id: Int? = null, var score: Score? = null) : SearchResponse
Link copied to clipboard
data class SyncStatus(var status: SyncWatchType, var score: Score?, var watchedEpisodes: Int?, var isFavorite: Boolean? = null, var maxEpisodes: Int? = null) : SyncAPI.AbstractSyncStatus

Properties

Link copied to clipboard
open val createAccountUrl: String? = null

Link to a website for creating a new account

Link copied to clipboard
open val hasInApp: Boolean = false

Has in app login support, aka login with a dialog

Link copied to clipboard
open val hasOAuth2: Boolean = false

Has OAuth2 login support, including login, loginRequest and refreshToken

Link copied to clipboard
open val hasPin: Boolean = false

Has on device pin support, aka login with a QR code

Link copied to clipboard
open val icon: Int? = null

Drawable icon of the service

Link copied to clipboard
open val idPrefix: String
Link copied to clipboard

The requirements to login in app

Link copied to clipboard
open val mainUrl: String
Link copied to clipboard
open val name: String
Link copied to clipboard
open val redirectUrlIdentifier: String? = null

The sensitive redirect URL from OAuth should contain "/redirectUrlIdentifier" to trigger the login

Link copied to clipboard

Set this to true if the user updates something on the list like watch status or score

Link copied to clipboard
open val requiresLogin: Boolean = true

If this service requires an account to use

Link copied to clipboard

Currently unused, but will be used to correctly render the UI. This should specify what sync watch types can be used with this service.

Link copied to clipboard
open val syncIdName: SyncIdName? = null

Allows certain providers to open pages from library links.

Functions

Link copied to clipboard
Link copied to clipboard
open suspend fun invalidateToken(token: AuthToken): Nothing

An optional security measure to make sure that even if an attacker gets ahold of the token, it will be invalid.

Link copied to clipboard

Is this url a valid redirect url for this service?

Link copied to clipboard

Get the current library/bookmarks of this service

Link copied to clipboard
open suspend fun load(auth: AuthData?, id: String): SyncAPI.SyncResult?

Get metadata about an item

Link copied to clipboard
open suspend fun login(form: AuthLoginResponse): AuthToken?

In app login

open suspend fun login(payload: AuthPinData): AuthToken?

Pin login, this will be called periodically while logging in to check if the pin has been verified by the user

open suspend fun login(redirectUrl: String, payload: String?): AuthToken?

OAuth2 login from a valid redirectUrl, and payload given in loginRequest

Link copied to clipboard
Link copied to clipboard

OAuth2 login request, asking the service to provide a url to open in the browser

Link copied to clipboard
open suspend fun pinRequest(): AuthPinData?

Pin login request, asking the service to provide an verificationUrl to display with a QR code

Link copied to clipboard
open suspend fun refreshToken(token: AuthToken): AuthToken?

OAuth2 token refresh, this ensures that all token passed to other functions will be valid

Link copied to clipboard
open suspend fun search(auth: AuthData?, query: String): List<SyncAPI.SyncSearchResult>?

Search this service for any results for a given query

Link copied to clipboard

Get the current status of an item

Link copied to clipboard
Link copied to clipboard
open suspend fun updateStatus(auth: AuthData?, id: String, newStatus: SyncAPI.AbstractSyncStatus): Boolean

Modify the current status of an item

Link copied to clipboard
open fun urlToId(url: String): String?

Helper function, may be used in the future

Link copied to clipboard
open suspend fun user(token: AuthToken?): AuthUser?

Get the visible user account