Drand Http Api
class DrandHttpApi(baseUrl: String = "https://api.drand.sh", config: HttpConfig = HttpConfig(), httpClient: HttpClient = createDefaultHttpClient(config)) : DrandApi
HTTP implementation of the drand API using Ktor client.
Provides access to drand's v2 HTTP API with proper error handling and JSON serialization.
Example:
val api = DrandHttpApi()
val beacon = api.beacons.latest("default").getOrThrow()
api.close()Content copied to clipboard
Parameters
base Url
Base URL for the drand API (default: https://api.drand.sh)
config
HTTP timeout configuration (optional, uses defaults if not specified)
http Client
Custom HttpClient instance (optional, for testing/customization)
Throws
if baseUrl is invalid for HTTP transport
Constructors
Link copied to clipboard
constructor(baseUrl: String = "https://api.drand.sh", config: HttpConfig = HttpConfig(), httpClient: HttpClient = createDefaultHttpClient(config))