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

gaia.sdk.rain.RainClientBuilder.kt Maven / Gradle / Ivy

There is a newer version: 0.17.0
Show newest version
package gaia.sdk.rain

import gaia.sdk.api.ClientOptions
import gaia.sdk.support.HMAC
import gaia.sdk.transport.HttpTransport

class RainClientBuilder private constructor(private val url: String) {

    lateinit var apiKey: String;
    lateinit var secret: String;

    companion object {
        @JvmStatic
        fun http(url: String): RainClientBuilder {
            return RainClientBuilder(url)
        }
    }

    fun withApiKey(key: String): RainClientBuilder {
        this.apiKey = key
        return this
    }

    fun withSecret(secret: String): RainClientBuilder {
        this.secret = secret
        return this
    }

    fun build(): RainClient {
        val options = ClientOptions(url, apiKey, HMAC(secret))
        return RainClient(options) { HttpTransport }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy