Skip to content

Commit

Permalink
feat(client): propagate headers/query params methods to client builde…
Browse files Browse the repository at this point in the history
…rs (#363)
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Nov 1, 2024
1 parent bf72ea4 commit 9d140e6
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,24 @@ class LithicOkHttpClient private constructor() {

fun removeHeader(name: String) = apply { clientOptions.removeHeader(name) }

fun queryParams(queryParams: Map<String, Iterable<String>>) = apply {
clientOptions.queryParams(queryParams)
}

fun putQueryParam(key: String, value: String) = apply {
clientOptions.putQueryParam(key, value)
}

fun putQueryParams(key: String, values: Iterable<String>) = apply {
clientOptions.putQueryParams(key, values)
}

fun putAllQueryParams(queryParams: Map<String, Iterable<String>>) = 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) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,24 @@ class LithicOkHttpClientAsync private constructor() {

fun removeHeader(name: String) = apply { clientOptions.removeHeader(name) }

fun queryParams(queryParams: Map<String, Iterable<String>>) = apply {
clientOptions.queryParams(queryParams)
}

fun putQueryParam(key: String, value: String) = apply {
clientOptions.putQueryParam(key, value)
}

fun putQueryParams(key: String, values: Iterable<String>) = apply {
clientOptions.putQueryParams(key, values)
}

fun putAllQueryParams(queryParams: Map<String, Iterable<String>>) = 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) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,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<String>) = apply {
queryParams.putAll(name, values)
fun putQueryParams(key: String, values: Iterable<String>) = apply {
queryParams.putAll(key, values)
}

fun putAllQueryParams(queryParams: Map<String, Iterable<String>>) = 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
Expand Down

0 comments on commit 9d140e6

Please sign in to comment.