diff --git a/src/main/kotlin/net/volcanomobile/weservsdk/Weserv.kt b/src/main/kotlin/net/volcanomobile/weservsdk/Weserv.kt index 0961c68..b231efd 100644 --- a/src/main/kotlin/net/volcanomobile/weservsdk/Weserv.kt +++ b/src/main/kotlin/net/volcanomobile/weservsdk/Weserv.kt @@ -13,10 +13,7 @@ data class Weserv internal constructor( val crop: Crop? ) -fun weserv(lambda: WeservBuilder.() -> Unit) = - WeservBuilder().apply(lambda).build() - -fun Weserv.buildUrl() = +private fun Weserv.buildUrl() = StringBuilder(BASE_URL).apply { append(URLEncoder.encode(url, "UTF-8")) @@ -33,4 +30,9 @@ fun Weserv.buildUrl() = if (crop != null) append(crop.toQueryString()) - }.toString() \ No newline at end of file + }.toString() + + +// DSL public entry point +fun weserv(lambda: WeservBuilder.() -> Unit) = + WeservBuilder().apply(lambda).build().buildUrl() \ No newline at end of file