Skip to content

Commit

Permalink
feat(client)!: add/rename methods for headers/query params (#365)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Nov 4, 2024
1 parent 3e9ec4f commit d2ab9bc
Show file tree
Hide file tree
Showing 159 changed files with 5,866 additions and 318 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,21 @@ class LithicOkHttpClient private constructor() {
clientOptions.putAllHeaders(headers)
}

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

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

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

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

fun removeAllHeaders(names: Set<String>) = apply { clientOptions.removeAllHeaders(names) }

fun queryParams(queryParams: Map<String, Iterable<String>>) = apply {
clientOptions.queryParams(queryParams)
Expand All @@ -70,7 +84,23 @@ class LithicOkHttpClient private constructor() {
clientOptions.putAllQueryParams(queryParams)
}

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

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

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

fun removeQueryParams(key: String) = apply { clientOptions.removeQueryParams(key) }

fun removeAllQueryParams(keys: Set<String>) = apply {
clientOptions.removeAllQueryParams(keys)
}

fun timeout(timeout: Duration) = apply { this.timeout = timeout }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,21 @@ class LithicOkHttpClientAsync private constructor() {
clientOptions.putAllHeaders(headers)
}

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

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

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

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

fun removeAllHeaders(names: Set<String>) = apply { clientOptions.removeAllHeaders(names) }

fun queryParams(queryParams: Map<String, Iterable<String>>) = apply {
clientOptions.queryParams(queryParams)
Expand All @@ -70,7 +84,23 @@ class LithicOkHttpClientAsync private constructor() {
clientOptions.putAllQueryParams(queryParams)
}

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

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

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

fun removeQueryParams(key: String) = apply { clientOptions.removeQueryParams(key) }

fun removeAllQueryParams(keys: Set<String>) = apply {
clientOptions.removeAllQueryParams(keys)
}

fun timeout(timeout: Duration) = apply { this.timeout = timeout }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,21 @@ private constructor(
headers.forEach(::putHeaders)
}

fun removeHeader(name: String) = apply { headers.removeAll(name) }
fun replaceHeaders(name: String, value: String) = apply {
headers.replaceValues(name, listOf(value))
}

fun replaceHeaders(name: String, values: Iterable<String>) = apply {
headers.replaceValues(name, values)
}

fun replaceAllHeaders(headers: Map<String, Iterable<String>>) = apply {
headers.forEach(::replaceHeaders)
}

fun removeHeaders(name: String) = apply { headers.removeAll(name) }

fun removeAllHeaders(names: Set<String>) = apply { names.forEach(::removeHeaders) }

fun queryParams(queryParams: Map<String, Iterable<String>>) = apply {
this.queryParams.clear()
Expand All @@ -104,7 +118,21 @@ private constructor(
queryParams.forEach(::putQueryParams)
}

fun removeQueryParam(key: String) = apply { queryParams.removeAll(key) }
fun replaceQueryParams(key: String, value: String) = apply {
queryParams.replaceValues(key, listOf(value))
}

fun replaceQueryParams(key: String, values: Iterable<String>) = apply {
queryParams.replaceValues(key, values)
}

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

fun removeQueryParams(key: String) = apply { queryParams.removeAll(key) }

fun removeAllQueryParams(keys: Set<String>) = apply { keys.forEach(::removeQueryParams) }

fun responseValidation(responseValidation: Boolean) = apply {
this.responseValidation = responseValidation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,23 @@ constructor(
additionalHeaders.forEach(::putAdditionalHeaders)
}

fun removeAdditionalHeader(name: String) = apply { additionalHeaders.removeAll(name) }
fun replaceAdditionalHeaders(name: String, value: String) = apply {
additionalHeaders.replaceValues(name, listOf(value))
}

fun replaceAdditionalHeaders(name: String, values: Iterable<String>) = apply {
additionalHeaders.replaceValues(name, values)
}

fun replaceAllAdditionalHeaders(additionalHeaders: Map<String, Iterable<String>>) = apply {
additionalHeaders.forEach(::replaceAdditionalHeaders)
}

fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) }

fun removeAllAdditionalHeaders(names: Set<String>) = apply {
names.forEach(::removeAdditionalHeaders)
}

fun additionalQueryParams(additionalQueryParams: Map<String, Iterable<String>>) = apply {
this.additionalQueryParams.clear()
Expand All @@ -267,7 +283,26 @@ constructor(
additionalQueryParams.forEach(::putAdditionalQueryParams)
}

fun removeAdditionalQueryParam(key: String) = apply { additionalQueryParams.removeAll(key) }
fun replaceAdditionalQueryParams(key: String, value: String) = apply {
additionalQueryParams.replaceValues(key, listOf(value))
}

fun replaceAdditionalQueryParams(key: String, values: Iterable<String>) = apply {
additionalQueryParams.replaceValues(key, values)
}

fun replaceAllAdditionalQueryParams(additionalQueryParams: Map<String, Iterable<String>>) =
apply {
additionalQueryParams.forEach(::replaceAdditionalQueryParams)
}

fun removeAdditionalQueryParams(key: String) = apply {
additionalQueryParams.removeAll(key)
}

fun removeAllAdditionalQueryParams(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalQueryParams)
}

fun build(): AccountHolderCreateParams =
AccountHolderCreateParams(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,23 @@ constructor(
additionalHeaders.forEach(::putAdditionalHeaders)
}

fun removeAdditionalHeader(name: String) = apply { additionalHeaders.removeAll(name) }
fun replaceAdditionalHeaders(name: String, value: String) = apply {
additionalHeaders.replaceValues(name, listOf(value))
}

fun replaceAdditionalHeaders(name: String, values: Iterable<String>) = apply {
additionalHeaders.replaceValues(name, values)
}

fun replaceAllAdditionalHeaders(additionalHeaders: Map<String, Iterable<String>>) = apply {
additionalHeaders.forEach(::replaceAdditionalHeaders)
}

fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) }

fun removeAllAdditionalHeaders(names: Set<String>) = apply {
names.forEach(::removeAdditionalHeaders)
}

fun additionalQueryParams(additionalQueryParams: Map<String, Iterable<String>>) = apply {
this.additionalQueryParams.clear()
Expand All @@ -110,7 +126,26 @@ constructor(
additionalQueryParams.forEach(::putAdditionalQueryParams)
}

fun removeAdditionalQueryParam(key: String) = apply { additionalQueryParams.removeAll(key) }
fun replaceAdditionalQueryParams(key: String, value: String) = apply {
additionalQueryParams.replaceValues(key, listOf(value))
}

fun replaceAdditionalQueryParams(key: String, values: Iterable<String>) = apply {
additionalQueryParams.replaceValues(key, values)
}

fun replaceAllAdditionalQueryParams(additionalQueryParams: Map<String, Iterable<String>>) =
apply {
additionalQueryParams.forEach(::replaceAdditionalQueryParams)
}

fun removeAdditionalQueryParams(key: String) = apply {
additionalQueryParams.removeAll(key)
}

fun removeAllAdditionalQueryParams(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalQueryParams)
}

fun build(): AccountHolderListDocumentsParams =
AccountHolderListDocumentsParams(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,23 @@ constructor(
additionalHeaders.forEach(::putAdditionalHeaders)
}

fun removeAdditionalHeader(name: String) = apply { additionalHeaders.removeAll(name) }
fun replaceAdditionalHeaders(name: String, value: String) = apply {
additionalHeaders.replaceValues(name, listOf(value))
}

fun replaceAdditionalHeaders(name: String, values: Iterable<String>) = apply {
additionalHeaders.replaceValues(name, values)
}

fun replaceAllAdditionalHeaders(additionalHeaders: Map<String, Iterable<String>>) = apply {
additionalHeaders.forEach(::replaceAdditionalHeaders)
}

fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) }

fun removeAllAdditionalHeaders(names: Set<String>) = apply {
names.forEach(::removeAdditionalHeaders)
}

fun additionalQueryParams(additionalQueryParams: Map<String, Iterable<String>>) = apply {
this.additionalQueryParams.clear()
Expand All @@ -227,7 +243,26 @@ constructor(
additionalQueryParams.forEach(::putAdditionalQueryParams)
}

fun removeAdditionalQueryParam(key: String) = apply { additionalQueryParams.removeAll(key) }
fun replaceAdditionalQueryParams(key: String, value: String) = apply {
additionalQueryParams.replaceValues(key, listOf(value))
}

fun replaceAdditionalQueryParams(key: String, values: Iterable<String>) = apply {
additionalQueryParams.replaceValues(key, values)
}

fun replaceAllAdditionalQueryParams(additionalQueryParams: Map<String, Iterable<String>>) =
apply {
additionalQueryParams.forEach(::replaceAdditionalQueryParams)
}

fun removeAdditionalQueryParams(key: String) = apply {
additionalQueryParams.removeAll(key)
}

fun removeAllAdditionalQueryParams(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalQueryParams)
}

fun build(): AccountHolderListParams =
AccountHolderListParams(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,23 @@ constructor(
additionalHeaders.forEach(::putAdditionalHeaders)
}

fun removeAdditionalHeader(name: String) = apply { additionalHeaders.removeAll(name) }
fun replaceAdditionalHeaders(name: String, value: String) = apply {
additionalHeaders.replaceValues(name, listOf(value))
}

fun replaceAdditionalHeaders(name: String, values: Iterable<String>) = apply {
additionalHeaders.replaceValues(name, values)
}

fun replaceAllAdditionalHeaders(additionalHeaders: Map<String, Iterable<String>>) = apply {
additionalHeaders.forEach(::replaceAdditionalHeaders)
}

fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) }

fun removeAllAdditionalHeaders(names: Set<String>) = apply {
names.forEach(::removeAdditionalHeaders)
}

fun additionalQueryParams(additionalQueryParams: Map<String, Iterable<String>>) = apply {
this.additionalQueryParams.clear()
Expand All @@ -273,7 +289,26 @@ constructor(
additionalQueryParams.forEach(::putAdditionalQueryParams)
}

fun removeAdditionalQueryParam(key: String) = apply { additionalQueryParams.removeAll(key) }
fun replaceAdditionalQueryParams(key: String, value: String) = apply {
additionalQueryParams.replaceValues(key, listOf(value))
}

fun replaceAdditionalQueryParams(key: String, values: Iterable<String>) = apply {
additionalQueryParams.replaceValues(key, values)
}

fun replaceAllAdditionalQueryParams(additionalQueryParams: Map<String, Iterable<String>>) =
apply {
additionalQueryParams.forEach(::replaceAdditionalQueryParams)
}

fun removeAdditionalQueryParams(key: String) = apply {
additionalQueryParams.removeAll(key)
}

fun removeAllAdditionalQueryParams(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalQueryParams)
}

fun additionalBodyProperties(additionalBodyProperties: Map<String, JsonValue>) = apply {
this.additionalBodyProperties.clear()
Expand Down
Loading

0 comments on commit d2ab9bc

Please sign in to comment.