SportsDbFutures

class SportsDbFutures(val client: SportsDbClient, scope: CoroutineScope) : AutoCloseable

A Java-friendly wrapper: every SportsDbClient method, returning a CompletableFuture.

SportsDbConfig config = new SportsDbConfig();
config.setApiKey(System.getenv("THESPORTSDB_API_KEY"));
try (SportsDbFutures db = new SportsDbFutures(config)) {
Team team = db.v1().lookup().team(133604).join();
db.v2().schedule().leagueNext(4328).thenAccept(events -> ...);
}

Single lookups complete with null when nothing is found. Failures complete the future exceptionally with a SportsDbException (wrapped in CompletionException by join()). close cancels calls still running.

Constructors

Link copied to clipboard
constructor(client: SportsDbClient, scope: CoroutineScope)
constructor(client: SportsDbClient)
constructor(config: SportsDbConfig)
constructor()

Types

Link copied to clipboard
inner class HelpersFutures

CompletableFuture versions of Helpers.

Link copied to clipboard
inner class V1

CompletableFuture versions of V1Api.

Link copied to clipboard
inner class V1Lists

CompletableFuture versions of V1Api.Lists.

Link copied to clipboard
inner class V1Live

CompletableFuture versions of V1Api.Live.

Link copied to clipboard
inner class V1Lookup

CompletableFuture versions of V1Api.Lookup.

Link copied to clipboard
inner class V1Schedule

CompletableFuture versions of V1Api.Schedule.

Link copied to clipboard
inner class V1Search

CompletableFuture versions of V1Api.Search.

Link copied to clipboard
inner class V1Tv

CompletableFuture versions of V1Api.Tv.

Link copied to clipboard
inner class V1Video

CompletableFuture versions of V1Api.Video.

Link copied to clipboard
inner class V2

CompletableFuture versions of V2Api.

Link copied to clipboard
inner class V2All

CompletableFuture versions of V2Api.All.

Link copied to clipboard
inner class V2Lists

CompletableFuture versions of V2Api.Lists.

Link copied to clipboard
inner class V2Live

CompletableFuture versions of V2Api.Live.

Link copied to clipboard
inner class V2Lookup

CompletableFuture versions of V2Api.Lookup.

Link copied to clipboard
inner class V2Schedule

CompletableFuture versions of V2Api.Schedule.

Link copied to clipboard
inner class V2Search

CompletableFuture versions of V2Api.Search.

Link copied to clipboard
inner class V2Tv

CompletableFuture versions of V2Api.Tv.

Properties

Link copied to clipboard

The underlying client, for Kotlin callers or for sharing its cache and rate limiter.

Link copied to clipboard
Link copied to clipboard
@get:JvmName(name = "v1")
val v1: SportsDbFutures.V1
Link copied to clipboard
@get:JvmName(name = "v2")
val v2: SportsDbFutures.V2

Functions

Link copied to clipboard
open override fun close()