Skip to content

Commit 23f0da4

Browse files
chore(internal): codegen related update (#145)
1 parent 33fa7ab commit 23f0da4

539 files changed

Lines changed: 77745 additions & 71080 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.

braintrust-java-client-okhttp/src/main/kotlin/com/braintrustdata/api/client/okhttp/BraintrustOkHttpClient.kt

Lines changed: 192 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,15 @@ class BraintrustOkHttpClient private constructor() {
1919

2020
companion object {
2121

22-
/** Returns a mutable builder for constructing an instance of [BraintrustOkHttpClient]. */
23-
@JvmStatic fun builder() = Builder()
22+
/**
23+
* Returns a mutable builder for constructing an instance of
24+
* [BraintrustOkHttpClient].
25+
*/
26+
@JvmStatic
27+
fun builder() = Builder()
2428

25-
@JvmStatic fun fromEnv(): BraintrustClient = builder().fromEnv().build()
29+
@JvmStatic
30+
fun fromEnv(): BraintrustClient = builder().fromEnv().build()
2631
}
2732

2833
/** A builder for [BraintrustOkHttpClient]. */
@@ -33,99 +38,163 @@ class BraintrustOkHttpClient private constructor() {
3338
private var timeout: Timeout = Timeout.default()
3439
private var proxy: Proxy? = null
3540

36-
fun baseUrl(baseUrl: String) = apply {
37-
clientOptions.baseUrl(baseUrl)
38-
this.baseUrl = baseUrl
39-
}
40-
41-
fun jsonMapper(jsonMapper: JsonMapper) = apply { clientOptions.jsonMapper(jsonMapper) }
42-
43-
fun clock(clock: Clock) = apply { clientOptions.clock(clock) }
44-
45-
fun headers(headers: Headers) = apply { clientOptions.headers(headers) }
46-
47-
fun headers(headers: Map<String, Iterable<String>>) = apply {
48-
clientOptions.headers(headers)
49-
}
50-
51-
fun putHeader(name: String, value: String) = apply { clientOptions.putHeader(name, value) }
52-
53-
fun putHeaders(name: String, values: Iterable<String>) = apply {
54-
clientOptions.putHeaders(name, values)
55-
}
56-
57-
fun putAllHeaders(headers: Headers) = apply { clientOptions.putAllHeaders(headers) }
58-
59-
fun putAllHeaders(headers: Map<String, Iterable<String>>) = apply {
60-
clientOptions.putAllHeaders(headers)
61-
}
62-
63-
fun replaceHeaders(name: String, value: String) = apply {
64-
clientOptions.replaceHeaders(name, value)
65-
}
66-
67-
fun replaceHeaders(name: String, values: Iterable<String>) = apply {
68-
clientOptions.replaceHeaders(name, values)
69-
}
70-
71-
fun replaceAllHeaders(headers: Headers) = apply { clientOptions.replaceAllHeaders(headers) }
72-
73-
fun replaceAllHeaders(headers: Map<String, Iterable<String>>) = apply {
74-
clientOptions.replaceAllHeaders(headers)
75-
}
76-
77-
fun removeHeaders(name: String) = apply { clientOptions.removeHeaders(name) }
78-
79-
fun removeAllHeaders(names: Set<String>) = apply { clientOptions.removeAllHeaders(names) }
80-
81-
fun queryParams(queryParams: QueryParams) = apply { clientOptions.queryParams(queryParams) }
82-
83-
fun queryParams(queryParams: Map<String, Iterable<String>>) = apply {
84-
clientOptions.queryParams(queryParams)
85-
}
86-
87-
fun putQueryParam(key: String, value: String) = apply {
88-
clientOptions.putQueryParam(key, value)
89-
}
90-
91-
fun putQueryParams(key: String, values: Iterable<String>) = apply {
92-
clientOptions.putQueryParams(key, values)
93-
}
94-
95-
fun putAllQueryParams(queryParams: QueryParams) = apply {
96-
clientOptions.putAllQueryParams(queryParams)
97-
}
98-
99-
fun putAllQueryParams(queryParams: Map<String, Iterable<String>>) = apply {
100-
clientOptions.putAllQueryParams(queryParams)
101-
}
102-
103-
fun replaceQueryParams(key: String, value: String) = apply {
104-
clientOptions.replaceQueryParams(key, value)
105-
}
106-
107-
fun replaceQueryParams(key: String, values: Iterable<String>) = apply {
108-
clientOptions.replaceQueryParams(key, values)
109-
}
110-
111-
fun replaceAllQueryParams(queryParams: QueryParams) = apply {
112-
clientOptions.replaceAllQueryParams(queryParams)
113-
}
114-
115-
fun replaceAllQueryParams(queryParams: Map<String, Iterable<String>>) = apply {
116-
clientOptions.replaceAllQueryParams(queryParams)
117-
}
118-
119-
fun removeQueryParams(key: String) = apply { clientOptions.removeQueryParams(key) }
120-
121-
fun removeAllQueryParams(keys: Set<String>) = apply {
122-
clientOptions.removeAllQueryParams(keys)
123-
}
124-
125-
fun timeout(timeout: Timeout) = apply {
126-
clientOptions.timeout(timeout)
127-
this.timeout = timeout
128-
}
41+
fun baseUrl(baseUrl: String) =
42+
apply {
43+
clientOptions.baseUrl(baseUrl)
44+
this.baseUrl = baseUrl
45+
}
46+
47+
fun jsonMapper(jsonMapper: JsonMapper) =
48+
apply {
49+
clientOptions.jsonMapper(jsonMapper)
50+
}
51+
52+
fun clock(clock: Clock) =
53+
apply {
54+
clientOptions.clock(clock)
55+
}
56+
57+
fun headers(headers: Headers) =
58+
apply {
59+
clientOptions.headers(headers)
60+
}
61+
62+
fun headers(headers: Map<String, Iterable<String>>) =
63+
apply {
64+
clientOptions.headers(headers)
65+
}
66+
67+
fun putHeader(name: String, value: String) =
68+
apply {
69+
clientOptions.putHeader(
70+
name, value
71+
)
72+
}
73+
74+
fun putHeaders(name: String, values: Iterable<String>) =
75+
apply {
76+
clientOptions.putHeaders(
77+
name, values
78+
)
79+
}
80+
81+
fun putAllHeaders(headers: Headers) =
82+
apply {
83+
clientOptions.putAllHeaders(headers)
84+
}
85+
86+
fun putAllHeaders(headers: Map<String, Iterable<String>>) =
87+
apply {
88+
clientOptions.putAllHeaders(headers)
89+
}
90+
91+
fun replaceHeaders(name: String, value: String) =
92+
apply {
93+
clientOptions.replaceHeaders(
94+
name, value
95+
)
96+
}
97+
98+
fun replaceHeaders(name: String, values: Iterable<String>) =
99+
apply {
100+
clientOptions.replaceHeaders(
101+
name, values
102+
)
103+
}
104+
105+
fun replaceAllHeaders(headers: Headers) =
106+
apply {
107+
clientOptions.replaceAllHeaders(headers)
108+
}
109+
110+
fun replaceAllHeaders(headers: Map<String, Iterable<String>>) =
111+
apply {
112+
clientOptions.replaceAllHeaders(headers)
113+
}
114+
115+
fun removeHeaders(name: String) =
116+
apply {
117+
clientOptions.removeHeaders(name)
118+
}
119+
120+
fun removeAllHeaders(names: Set<String>) =
121+
apply {
122+
clientOptions.removeAllHeaders(names)
123+
}
124+
125+
fun queryParams(queryParams: QueryParams) =
126+
apply {
127+
clientOptions.queryParams(queryParams)
128+
}
129+
130+
fun queryParams(queryParams: Map<String, Iterable<String>>) =
131+
apply {
132+
clientOptions.queryParams(queryParams)
133+
}
134+
135+
fun putQueryParam(key: String, value: String) =
136+
apply {
137+
clientOptions.putQueryParam(
138+
key, value
139+
)
140+
}
141+
142+
fun putQueryParams(key: String, values: Iterable<String>) =
143+
apply {
144+
clientOptions.putQueryParams(
145+
key, values
146+
)
147+
}
148+
149+
fun putAllQueryParams(queryParams: QueryParams) =
150+
apply {
151+
clientOptions.putAllQueryParams(queryParams)
152+
}
153+
154+
fun putAllQueryParams(queryParams: Map<String, Iterable<String>>) =
155+
apply {
156+
clientOptions.putAllQueryParams(queryParams)
157+
}
158+
159+
fun replaceQueryParams(key: String, value: String) =
160+
apply {
161+
clientOptions.replaceQueryParams(
162+
key, value
163+
)
164+
}
165+
166+
fun replaceQueryParams(key: String, values: Iterable<String>) =
167+
apply {
168+
clientOptions.replaceQueryParams(
169+
key, values
170+
)
171+
}
172+
173+
fun replaceAllQueryParams(queryParams: QueryParams) =
174+
apply {
175+
clientOptions.replaceAllQueryParams(queryParams)
176+
}
177+
178+
fun replaceAllQueryParams(queryParams: Map<String, Iterable<String>>) =
179+
apply {
180+
clientOptions.replaceAllQueryParams(queryParams)
181+
}
182+
183+
fun removeQueryParams(key: String) =
184+
apply {
185+
clientOptions.removeQueryParams(key)
186+
}
187+
188+
fun removeAllQueryParams(keys: Set<String>) =
189+
apply {
190+
clientOptions.removeAllQueryParams(keys)
191+
}
192+
193+
fun timeout(timeout: Timeout) =
194+
apply {
195+
clientOptions.timeout(timeout)
196+
this.timeout = timeout
197+
}
129198

130199
/**
131200
* Sets the maximum time allowed for a complete HTTP call, not including retries.
@@ -136,31 +205,40 @@ class BraintrustOkHttpClient private constructor() {
136205
*/
137206
fun timeout(timeout: Duration) = timeout(Timeout.builder().request(timeout).build())
138207

139-
fun maxRetries(maxRetries: Int) = apply { clientOptions.maxRetries(maxRetries) }
208+
fun maxRetries(maxRetries: Int) =
209+
apply {
210+
clientOptions.maxRetries(maxRetries)
211+
}
140212

141-
fun proxy(proxy: Proxy) = apply { this.proxy = proxy }
213+
fun proxy(proxy: Proxy) =
214+
apply {
215+
this.proxy = proxy
216+
}
142217

143-
fun responseValidation(responseValidation: Boolean) = apply {
144-
clientOptions.responseValidation(responseValidation)
145-
}
218+
fun responseValidation(responseValidation: Boolean) =
219+
apply {
220+
clientOptions.responseValidation(responseValidation)
221+
}
146222

147-
fun apiKey(apiKey: String?) = apply { clientOptions.apiKey(apiKey) }
223+
fun apiKey(apiKey: String?) =
224+
apply {
225+
clientOptions.apiKey(apiKey)
226+
}
148227

149228
fun apiKey(apiKey: Optional<String>) = apiKey(apiKey.getOrNull())
150229

151-
fun fromEnv() = apply { clientOptions.fromEnv() }
230+
fun fromEnv() =
231+
apply {
232+
clientOptions.fromEnv()
233+
}
152234

153235
fun build(): BraintrustClient =
154-
BraintrustClientImpl(
155-
clientOptions
156-
.httpClient(
157-
OkHttpClient.builder()
158-
.baseUrl(baseUrl)
159-
.timeout(timeout)
160-
.proxy(proxy)
161-
.build()
162-
)
163-
.build()
164-
)
236+
BraintrustClientImpl(clientOptions
237+
.httpClient(OkHttpClient.builder()
238+
.baseUrl(baseUrl)
239+
.timeout(timeout)
240+
.proxy(proxy)
241+
.build())
242+
.build())
165243
}
166244
}

0 commit comments

Comments
 (0)