Skip to content

Commit 3993648

Browse files
Stainless Botstainless-app[bot]
authored andcommitted
chore(internal): version bump (#100)
1 parent c2ec52c commit 3993648

146 files changed

Lines changed: 8198 additions & 4051 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OrbOkHttpClient.kt

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,21 @@ class OrbOkHttpClient private constructor() {
5050
clientOptions.putAllHeaders(headers)
5151
}
5252

53-
fun removeHeader(name: String) = apply { clientOptions.removeHeader(name) }
53+
fun replaceHeaders(name: String, value: String) = apply {
54+
clientOptions.replaceHeaders(name, value)
55+
}
56+
57+
fun replaceHeaders(name: String, values: Iterable<String>) = apply {
58+
clientOptions.replaceHeaders(name, values)
59+
}
60+
61+
fun replaceAllHeaders(headers: Map<String, Iterable<String>>) = apply {
62+
clientOptions.replaceAllHeaders(headers)
63+
}
64+
65+
fun removeHeaders(name: String) = apply { clientOptions.removeHeaders(name) }
66+
67+
fun removeAllHeaders(names: Set<String>) = apply { clientOptions.removeAllHeaders(names) }
5468

5569
fun queryParams(queryParams: Map<String, Iterable<String>>) = apply {
5670
clientOptions.queryParams(queryParams)
@@ -68,7 +82,23 @@ class OrbOkHttpClient private constructor() {
6882
clientOptions.putAllQueryParams(queryParams)
6983
}
7084

71-
fun removeQueryParam(key: String) = apply { clientOptions.removeQueryParam(key) }
85+
fun replaceQueryParams(key: String, value: String) = apply {
86+
clientOptions.replaceQueryParams(key, value)
87+
}
88+
89+
fun replaceQueryParams(key: String, values: Iterable<String>) = apply {
90+
clientOptions.replaceQueryParams(key, values)
91+
}
92+
93+
fun replaceAllQueryParams(queryParams: Map<String, Iterable<String>>) = apply {
94+
clientOptions.replaceAllQueryParams(queryParams)
95+
}
96+
97+
fun removeQueryParams(key: String) = apply { clientOptions.removeQueryParams(key) }
98+
99+
fun removeAllQueryParams(keys: Set<String>) = apply {
100+
clientOptions.removeAllQueryParams(keys)
101+
}
72102

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

orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OrbOkHttpClientAsync.kt

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,21 @@ class OrbOkHttpClientAsync private constructor() {
5050
clientOptions.putAllHeaders(headers)
5151
}
5252

53-
fun removeHeader(name: String) = apply { clientOptions.removeHeader(name) }
53+
fun replaceHeaders(name: String, value: String) = apply {
54+
clientOptions.replaceHeaders(name, value)
55+
}
56+
57+
fun replaceHeaders(name: String, values: Iterable<String>) = apply {
58+
clientOptions.replaceHeaders(name, values)
59+
}
60+
61+
fun replaceAllHeaders(headers: Map<String, Iterable<String>>) = apply {
62+
clientOptions.replaceAllHeaders(headers)
63+
}
64+
65+
fun removeHeaders(name: String) = apply { clientOptions.removeHeaders(name) }
66+
67+
fun removeAllHeaders(names: Set<String>) = apply { clientOptions.removeAllHeaders(names) }
5468

5569
fun queryParams(queryParams: Map<String, Iterable<String>>) = apply {
5670
clientOptions.queryParams(queryParams)
@@ -68,7 +82,23 @@ class OrbOkHttpClientAsync private constructor() {
6882
clientOptions.putAllQueryParams(queryParams)
6983
}
7084

71-
fun removeQueryParam(key: String) = apply { clientOptions.removeQueryParam(key) }
85+
fun replaceQueryParams(key: String, value: String) = apply {
86+
clientOptions.replaceQueryParams(key, value)
87+
}
88+
89+
fun replaceQueryParams(key: String, values: Iterable<String>) = apply {
90+
clientOptions.replaceQueryParams(key, values)
91+
}
92+
93+
fun replaceAllQueryParams(queryParams: Map<String, Iterable<String>>) = apply {
94+
clientOptions.replaceAllQueryParams(queryParams)
95+
}
96+
97+
fun removeQueryParams(key: String) = apply { clientOptions.removeQueryParams(key) }
98+
99+
fun removeAllQueryParams(keys: Set<String>) = apply {
100+
clientOptions.removeAllQueryParams(keys)
101+
}
72102

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

orb-java-core/src/main/kotlin/com/withorb/api/core/ClientOptions.kt

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,21 @@ private constructor(
9494
headers.forEach(this::putHeaders)
9595
}
9696

97-
fun removeHeader(name: String) = apply { this.headers.put(name, mutableListOf()) }
97+
fun replaceHeaders(name: String, value: String) = apply {
98+
headers.replaceValues(name, listOf(value))
99+
}
100+
101+
fun replaceHeaders(name: String, values: Iterable<String>) = apply {
102+
headers.replaceValues(name, values)
103+
}
104+
105+
fun replaceAllHeaders(headers: Map<String, Iterable<String>>) = apply {
106+
headers.forEach(::replaceHeaders)
107+
}
108+
109+
fun removeHeaders(name: String) = apply { headers.removeAll(name) }
110+
111+
fun removeAllHeaders(names: Set<String>) = apply { names.forEach(::removeHeaders) }
98112

99113
fun queryParams(queryParams: Map<String, Iterable<String>>) = apply {
100114
this.queryParams.clear()
@@ -111,7 +125,21 @@ private constructor(
111125
queryParams.forEach(this::putQueryParams)
112126
}
113127

114-
fun removeQueryParam(key: String) = apply { queryParams.removeAll(key) }
128+
fun replaceQueryParams(key: String, value: String) = apply {
129+
queryParams.replaceValues(key, listOf(value))
130+
}
131+
132+
fun replaceQueryParams(key: String, values: Iterable<String>) = apply {
133+
queryParams.replaceValues(key, values)
134+
}
135+
136+
fun replaceAllQueryParams(queryParams: Map<String, Iterable<String>>) = apply {
137+
queryParams.forEach(::replaceQueryParams)
138+
}
139+
140+
fun removeQueryParams(key: String) = apply { queryParams.removeAll(key) }
141+
142+
fun removeAllQueryParams(keys: Set<String>) = apply { keys.forEach(::removeQueryParams) }
115143

116144
fun responseValidation(responseValidation: Boolean) = apply {
117145
this.responseValidation = responseValidation

orb-java-core/src/main/kotlin/com/withorb/api/core/http/HttpRequest.kt

Lines changed: 54 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package com.withorb.api.core.http
22

33
import com.google.common.collect.ArrayListMultimap
44
import com.google.common.collect.ListMultimap
5-
import com.google.common.collect.Multimap
65
import com.google.common.collect.MultimapBuilder
76
import com.withorb.api.core.toImmutable
87

@@ -11,13 +10,13 @@ private constructor(
1110
@get:JvmName("method") val method: HttpMethod,
1211
@get:JvmName("url") val url: String?,
1312
@get:JvmName("pathSegments") val pathSegments: List<String>,
14-
@get:JvmName("queryParams") val queryParams: ListMultimap<String, String>,
1513
@get:JvmName("headers") val headers: ListMultimap<String, String>,
14+
@get:JvmName("queryParams") val queryParams: ListMultimap<String, String>,
1615
@get:JvmName("body") val body: HttpRequestBody?,
1716
) {
1817

1918
override fun toString(): String =
20-
"HttpRequest{method=$method, pathSegments=$pathSegments, queryParams=$queryParams, headers=$headers, body=$body}"
19+
"HttpRequest{method=$method, url=$url, pathSegments=$pathSegments, headers=$headers, queryParams=$queryParams, body=$body}"
2120

2221
companion object {
2322
@JvmStatic fun builder() = Builder()
@@ -27,65 +26,93 @@ private constructor(
2726

2827
private var method: HttpMethod? = null
2928
private var url: String? = null
30-
private var pathSegments: MutableList<String> = ArrayList()
31-
private var queryParams: ListMultimap<String, String> = ArrayListMultimap.create()
32-
private var body: HttpRequestBody? = null
29+
private var pathSegments: MutableList<String> = mutableListOf()
3330
private var headers: ListMultimap<String, String> =
3431
MultimapBuilder.treeKeys(String.CASE_INSENSITIVE_ORDER).arrayListValues().build()
32+
private var queryParams: ListMultimap<String, String> = ArrayListMultimap.create()
33+
private var body: HttpRequestBody? = null
3534

3635
fun method(method: HttpMethod) = apply { this.method = method }
3736

3837
fun url(url: String) = apply { this.url = url }
3938

40-
fun addPathSegment(pathSegment: String) = apply { this.pathSegments.add(pathSegment) }
39+
fun addPathSegment(pathSegment: String) = apply { pathSegments.add(pathSegment) }
4140

4241
fun addPathSegments(vararg pathSegments: String) = apply {
43-
for (pathSegment in pathSegments) {
44-
this.pathSegments.add(pathSegment)
45-
}
42+
this.pathSegments.addAll(pathSegments)
4643
}
4744

48-
fun putQueryParam(name: String, value: String) = apply {
49-
this.queryParams.replaceValues(name, listOf(value))
45+
fun headers(headers: Map<String, Iterable<String>>) = apply {
46+
this.headers.clear()
47+
putAllHeaders(headers)
5048
}
5149

52-
fun putQueryParams(name: String, values: Iterable<String>) = apply {
53-
this.queryParams.replaceValues(name, values)
50+
fun putHeader(name: String, value: String) = apply { headers.put(name, value) }
51+
52+
fun putHeaders(name: String, values: Iterable<String>) = apply {
53+
headers.putAll(name, values)
5454
}
5555

56-
fun putAllQueryParams(queryParams: Map<String, Iterable<String>>) = apply {
57-
queryParams.forEach(this::putQueryParams)
56+
fun putAllHeaders(headers: Map<String, Iterable<String>>) = apply {
57+
headers.forEach(::putHeaders)
5858
}
5959

60-
fun putAllQueryParams(queryParams: Multimap<String, String>) = apply {
61-
queryParams.asMap().forEach(this::putQueryParams)
60+
fun replaceHeaders(name: String, value: String) = apply {
61+
headers.replaceValues(name, listOf(value))
6262
}
6363

64-
fun putHeader(name: String, value: String) = apply {
65-
this.headers.replaceValues(name, listOf(value))
64+
fun replaceHeaders(name: String, values: Iterable<String>) = apply {
65+
headers.replaceValues(name, values)
6666
}
6767

68-
fun putHeaders(name: String, values: Iterable<String>) = apply {
69-
this.headers.replaceValues(name, values)
68+
fun replaceAllHeaders(headers: Map<String, Iterable<String>>) = apply {
69+
headers.forEach(::replaceHeaders)
7070
}
7171

72-
fun putAllHeaders(headers: Map<String, Iterable<String>>) = apply {
73-
headers.forEach(this::putHeaders)
72+
fun removeHeaders(name: String) = apply { headers.removeAll(name) }
73+
74+
fun removeAllHeaders(names: Set<String>) = apply { names.forEach(::removeHeaders) }
75+
76+
fun queryParams(queryParams: Map<String, Iterable<String>>) = apply {
77+
this.queryParams.clear()
78+
putAllQueryParams(queryParams)
7479
}
7580

76-
fun putAllHeaders(headers: Multimap<String, String>) = apply {
77-
headers.asMap().forEach(this::putHeaders)
81+
fun putQueryParam(key: String, value: String) = apply { queryParams.put(key, value) }
82+
83+
fun putQueryParams(key: String, values: Iterable<String>) = apply {
84+
queryParams.putAll(key, values)
85+
}
86+
87+
fun putAllQueryParams(queryParams: Map<String, Iterable<String>>) = apply {
88+
queryParams.forEach(::putQueryParams)
89+
}
90+
91+
fun replaceQueryParams(key: String, value: String) = apply {
92+
queryParams.replaceValues(key, listOf(value))
93+
}
94+
95+
fun replaceQueryParams(key: String, values: Iterable<String>) = apply {
96+
queryParams.replaceValues(key, values)
97+
}
98+
99+
fun replaceAllQueryParams(queryParams: Map<String, Iterable<String>>) = apply {
100+
queryParams.forEach(::replaceQueryParams)
78101
}
79102

103+
fun removeQueryParams(key: String) = apply { queryParams.removeAll(key) }
104+
105+
fun removeAllQueryParams(keys: Set<String>) = apply { keys.forEach(::removeQueryParams) }
106+
80107
fun body(body: HttpRequestBody) = apply { this.body = body }
81108

82109
fun build(): HttpRequest =
83110
HttpRequest(
84111
checkNotNull(method) { "`method` is required but was not set" },
85112
url,
86113
pathSegments.toImmutable(),
87-
queryParams.toImmutable(),
88114
headers,
115+
queryParams.toImmutable(),
89116
body,
90117
)
91118
}

0 commit comments

Comments
 (0)