SportsDbConfig

Client settings. Build with SportsDbClient's DSL:

val client = SportsDbClient { apiKey = System.getenv("THESPORTSDB_API_KEY") }

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Your API key. Defaults to the public free key 123 (v1 only, small result limits).

Link copied to clipboard

Change only for testing or a proxy.

Link copied to clipboard

Optional response cache; null (the default) disables caching.

Link copied to clipboard

Time-to-live per kind of data, used when cache is set.

Link copied to clipboard

Share one HTTP request between identical calls made at the same time (same URL and key), so ten coroutines asking for the same table cause one request, not ten.

Link copied to clipboard

True when apiKey is one of the public free keys (FREE_API_KEYS). Any other key the API accepts is a paid key; see SportsDbClient.isPremiumKey to check one.

Link copied to clipboard

Retries for network errors and HTTP 5xx, with exponential backoff.

Link copied to clipboard

How long to wait after a 429 when the server does not say. The docs say one minute.

Link copied to clipboard

Called once per call, after it finishes: for logging and metrics. See RequestEvent.

Link copied to clipboard

Client-side limit, in requests per minute, shared by v1 and v2. null picks the documented limit for the key: 30 for the free key, 100 for a premium key. Set it to 120 on a business plan, or 0 to turn limiting off.

Link copied to clipboard

First backoff delay; doubles on every retry.

Link copied to clipboard

On HTTP 429, wait (the Retry-After time, or rateLimitWait) and try once more.

Link copied to clipboard

Time allowed for one HTTP request (connect, send and read). Applies to the default transport.

Link copied to clipboard

The HTTP stack. null (the default) uses OkHttp with timeout. Pass OkHttpTransport(yourClient) to share an OkHttp client (its own timeouts then apply).

Link copied to clipboard

Functions

Link copied to clipboard

Java: sets rateLimitWait.

Link copied to clipboard

Java: sets retryBackoff.

Link copied to clipboard
fun setTimeout(value: Duration)

Java: sets timeout.