diff --git a/onebusaway-sdk-java-client-okhttp/src/main/kotlin/org/onebusaway/client/okhttp/OnebusawaySdkOkHttpClient.kt b/onebusaway-sdk-java-client-okhttp/src/main/kotlin/org/onebusaway/client/okhttp/OnebusawaySdkOkHttpClient.kt index fd30fd4..3b3eb92 100644 --- a/onebusaway-sdk-java-client-okhttp/src/main/kotlin/org/onebusaway/client/okhttp/OnebusawaySdkOkHttpClient.kt +++ b/onebusaway-sdk-java-client-okhttp/src/main/kotlin/org/onebusaway/client/okhttp/OnebusawaySdkOkHttpClient.kt @@ -52,6 +52,24 @@ class OnebusawaySdkOkHttpClient private constructor() { fun removeHeader(name: String) = apply { clientOptions.removeHeader(name) } + fun queryParams(queryParams: Map>) = apply { + clientOptions.queryParams(queryParams) + } + + fun putQueryParam(key: String, value: String) = apply { + clientOptions.putQueryParam(key, value) + } + + fun putQueryParams(key: String, values: Iterable) = apply { + clientOptions.putQueryParams(key, values) + } + + fun putAllQueryParams(queryParams: Map>) = apply { + clientOptions.putAllQueryParams(queryParams) + } + + fun removeQueryParam(key: String) = apply { clientOptions.removeQueryParam(key) } + fun timeout(timeout: Duration) = apply { this.timeout = timeout } fun maxRetries(maxRetries: Int) = apply { clientOptions.maxRetries(maxRetries) } diff --git a/onebusaway-sdk-java-client-okhttp/src/main/kotlin/org/onebusaway/client/okhttp/OnebusawaySdkOkHttpClientAsync.kt b/onebusaway-sdk-java-client-okhttp/src/main/kotlin/org/onebusaway/client/okhttp/OnebusawaySdkOkHttpClientAsync.kt index 1611a81..08a4330 100644 --- a/onebusaway-sdk-java-client-okhttp/src/main/kotlin/org/onebusaway/client/okhttp/OnebusawaySdkOkHttpClientAsync.kt +++ b/onebusaway-sdk-java-client-okhttp/src/main/kotlin/org/onebusaway/client/okhttp/OnebusawaySdkOkHttpClientAsync.kt @@ -52,6 +52,24 @@ class OnebusawaySdkOkHttpClientAsync private constructor() { fun removeHeader(name: String) = apply { clientOptions.removeHeader(name) } + fun queryParams(queryParams: Map>) = apply { + clientOptions.queryParams(queryParams) + } + + fun putQueryParam(key: String, value: String) = apply { + clientOptions.putQueryParam(key, value) + } + + fun putQueryParams(key: String, values: Iterable) = apply { + clientOptions.putQueryParams(key, values) + } + + fun putAllQueryParams(queryParams: Map>) = apply { + clientOptions.putAllQueryParams(queryParams) + } + + fun removeQueryParam(key: String) = apply { clientOptions.removeQueryParam(key) } + fun timeout(timeout: Duration) = apply { this.timeout = timeout } fun maxRetries(maxRetries: Int) = apply { clientOptions.maxRetries(maxRetries) } diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/core/ClientOptions.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/core/ClientOptions.kt index c24bf3b..d741e49 100644 --- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/core/ClientOptions.kt +++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/core/ClientOptions.kt @@ -90,17 +90,17 @@ private constructor( putAllQueryParams(queryParams) } - fun putQueryParam(name: String, value: String) = apply { queryParams.put(name, value) } + fun putQueryParam(key: String, value: String) = apply { queryParams.put(key, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - queryParams.putAll(name, values) + fun putQueryParams(key: String, values: Iterable) = apply { + queryParams.putAll(key, values) } fun putAllQueryParams(queryParams: Map>) = apply { queryParams.forEach(::putQueryParams) } - fun removeQueryParam(name: String) = apply { queryParams.removeAll(name) } + fun removeQueryParam(key: String) = apply { queryParams.removeAll(key) } fun responseValidation(responseValidation: Boolean) = apply { this.responseValidation = responseValidation