Endpoint
fun <T : Any> Endpoint(id: String, decode: (HttpResponse) -> Result<T>, configure: Endpoint.Builder.() -> Unit = {}): Endpoint<T>(source)
Builds an Endpoint. Stable Core. Endpoint("heroes", ::decodeHeroes) { ttl = 10.minutes; cost = 2; misses(404) }.
Return
the endpoint.
Parameters
id
the stable id: the cache key's first part and the name in logs; not blank.
decode
turns a response classified for decoding into a value or a failure; see Endpoint.
configure
assigns the optional settings; empty by default.
Type Parameters
T
the decoded value's type, inferred from decode.
Throws
if the id or name is blank, a duration is negative, cost is below 1, or a miss status is outside 100..599 or is 429; the message names the property and never a value.