All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.models.ResolveResultSet.kt Maven / Gradle / Ivy

The newest version!
package torrentsearch.models

/**
 * [ResolveResultSet] is a container for a collection of [ProviderResult]s
 * which simplifies accessing the resolve details across multiple providers.
 */
public class ResolveResultSet(
    /**
     * The original list of [ResolveResult]s from each provider.
     */
    public val results: List,
) {

    /**
     * Contains a list of all the successfully resolved [TorrentDescription]s.
     */
    public val resolved: List = results.flatMap { it.torrents }

    /**
     * Indicates if any of the [ResolveResult]s in [results] are an error.
     */
    public val hasErrors: Boolean = results.any { it is ResolveResult.Error }

    /**
     * Returns a list of all the collected [ResolveResult.Error] results.
     */
    public val failed: List = results.filterIsInstance()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy