Skip to content

Commit

Permalink
chore(internal): codegen related update (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Sep 5, 2024
1 parent 73ed069 commit 837e1ed
Show file tree
Hide file tree
Showing 455 changed files with 128,760 additions and 128,417 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,27 @@ import com.google.common.collect.ListMultimap
import com.google.common.collect.MultimapBuilder
import com.withorb.api.core.RequestOptions
import com.withorb.api.core.http.HttpClient
import com.withorb.api.core.http.HttpMethod
import com.withorb.api.core.http.HttpRequest
import com.withorb.api.core.http.HttpRequestBody
import com.withorb.api.core.http.HttpResponse
import com.withorb.api.core.http.HttpMethod
import com.withorb.api.errors.OrbIoException
import java.io.IOException
import java.io.InputStream
import java.net.Proxy
import java.time.Duration
import java.util.concurrent.CompletableFuture
import java.util.concurrent.TimeUnit
import okhttp3.Call
import okhttp3.Callback
import okhttp3.HttpUrl
import okhttp3.Response
import okhttp3.Request
import okhttp3.RequestBody
import okhttp3.MediaType
import okhttp3.Headers
import okhttp3.HttpUrl
import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.MediaType
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.Request
import okhttp3.RequestBody
import okhttp3.RequestBody.Companion.toRequestBody
import okhttp3.Response
import okio.BufferedSink

class OkHttpClient
Expand All @@ -34,7 +33,8 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val

private fun getClient(requestOptions: RequestOptions): okhttp3.OkHttpClient {
val timeout = requestOptions.timeout ?: return okHttpClient
return okHttpClient.newBuilder()
return okHttpClient
.newBuilder()
.connectTimeout(timeout)
.readTimeout(timeout)
.writeTimeout(timeout)
Expand Down Expand Up @@ -76,7 +76,8 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val
override fun onFailure(call: Call, e: IOException) {
future.completeExceptionally(OrbIoException("Request failed", e))
}
})
}
)

return future
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,20 @@
package com.withorb.api.client.okhttp

import com.fasterxml.jackson.databind.json.JsonMapper
import com.google.common.collect.Multimap
import com.withorb.api.client.OrbClient
import com.withorb.api.client.OrbClientImpl
import com.withorb.api.core.ClientOptions
import java.net.Proxy
import java.time.Clock
import java.time.Duration
import java.util.Optional
import com.withorb.api.core.ClientOptions
import com.withorb.api.core.http.HttpClient
import com.withorb.api.client.OrbClient
import com.withorb.api.client.OrbClientImpl

class OrbOkHttpClient private constructor() {

companion object {

@JvmStatic
fun builder() = Builder()
@JvmStatic fun builder() = Builder()

@JvmStatic
fun fromEnv(): OrbClient = builder().fromEnv().build()
@JvmStatic fun fromEnv(): OrbClient = builder().fromEnv().build()
}

class Builder {
Expand All @@ -37,21 +32,15 @@ class OrbOkHttpClient private constructor() {
this.baseUrl = baseUrl
}

fun jsonMapper(jsonMapper: JsonMapper) = apply {
clientOptions.jsonMapper(jsonMapper)
}
fun jsonMapper(jsonMapper: JsonMapper) = apply { clientOptions.jsonMapper(jsonMapper) }

fun clock(clock: Clock) = apply {
clientOptions.clock(clock)
}
fun clock(clock: Clock) = apply { clientOptions.clock(clock) }

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

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

fun putHeaders(name: String, values: Iterable<String>) = apply {
clientOptions.putHeaders(name, values)
Expand All @@ -61,46 +50,38 @@ class OrbOkHttpClient private constructor() {
clientOptions.putAllHeaders(headers)
}

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

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

fun maxRetries(maxRetries: Int) = apply {
clientOptions.maxRetries(maxRetries)
}
fun maxRetries(maxRetries: Int) = apply { clientOptions.maxRetries(maxRetries) }

fun proxy(proxy: Proxy) = apply {
this.proxy = proxy
}
fun proxy(proxy: Proxy) = apply { this.proxy = proxy }

fun responseValidation(responseValidation: Boolean) = apply {
clientOptions.responseValidation(responseValidation)
}

fun apiKey(apiKey: String) = apply {
clientOptions.apiKey(apiKey)
}
fun apiKey(apiKey: String) = apply { clientOptions.apiKey(apiKey) }

fun webhookSecret(webhookSecret: String?) = apply {
clientOptions.webhookSecret(webhookSecret)
}

fun fromEnv() = apply {
clientOptions.fromEnv()
}
fun fromEnv() = apply { clientOptions.fromEnv() }

fun build(): OrbClient {
return OrbClientImpl(clientOptions
.httpClient(OkHttpClient.builder()
.baseUrl(baseUrl)
.timeout(timeout)
.proxy(proxy)
.build())
.build())
return OrbClientImpl(
clientOptions
.httpClient(
OkHttpClient.builder()
.baseUrl(baseUrl)
.timeout(timeout)
.proxy(proxy)
.build()
)
.build()
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,20 @@
package com.withorb.api.client.okhttp

import com.fasterxml.jackson.databind.json.JsonMapper
import com.google.common.collect.Multimap
import com.withorb.api.client.OrbClientAsync
import com.withorb.api.client.OrbClientAsyncImpl
import com.withorb.api.core.ClientOptions
import java.net.Proxy
import java.time.Clock
import java.time.Duration
import java.util.Optional
import com.withorb.api.core.ClientOptions
import com.withorb.api.core.http.HttpClient
import com.withorb.api.client.OrbClientAsync
import com.withorb.api.client.OrbClientAsyncImpl

class OrbOkHttpClientAsync private constructor() {

companion object {

@JvmStatic
fun builder() = Builder()
@JvmStatic fun builder() = Builder()

@JvmStatic
fun fromEnv(): OrbClientAsync = builder().fromEnv().build()
@JvmStatic fun fromEnv(): OrbClientAsync = builder().fromEnv().build()
}

class Builder {
Expand All @@ -37,21 +32,15 @@ class OrbOkHttpClientAsync private constructor() {
this.baseUrl = baseUrl
}

fun jsonMapper(jsonMapper: JsonMapper) = apply {
clientOptions.jsonMapper(jsonMapper)
}
fun jsonMapper(jsonMapper: JsonMapper) = apply { clientOptions.jsonMapper(jsonMapper) }

fun clock(clock: Clock) = apply {
clientOptions.clock(clock)
}
fun clock(clock: Clock) = apply { clientOptions.clock(clock) }

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

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

fun putHeaders(name: String, values: Iterable<String>) = apply {
clientOptions.putHeaders(name, values)
Expand All @@ -61,46 +50,38 @@ class OrbOkHttpClientAsync private constructor() {
clientOptions.putAllHeaders(headers)
}

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

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

fun maxRetries(maxRetries: Int) = apply {
clientOptions.maxRetries(maxRetries)
}
fun maxRetries(maxRetries: Int) = apply { clientOptions.maxRetries(maxRetries) }

fun proxy(proxy: Proxy) = apply {
this.proxy = proxy
}
fun proxy(proxy: Proxy) = apply { this.proxy = proxy }

fun responseValidation(responseValidation: Boolean) = apply {
clientOptions.responseValidation(responseValidation)
}

fun apiKey(apiKey: String) = apply {
clientOptions.apiKey(apiKey)
}
fun apiKey(apiKey: String) = apply { clientOptions.apiKey(apiKey) }

fun webhookSecret(webhookSecret: String?) = apply {
clientOptions.webhookSecret(webhookSecret)
}

fun fromEnv() = apply {
clientOptions.fromEnv()
}
fun fromEnv() = apply { clientOptions.fromEnv() }

fun build(): OrbClientAsync {
return OrbClientAsyncImpl(clientOptions
.httpClient(OkHttpClient.builder()
.baseUrl(baseUrl)
.timeout(timeout)
.proxy(proxy)
.build())
.build())
return OrbClientAsyncImpl(
clientOptions
.httpClient(
OkHttpClient.builder()
.baseUrl(baseUrl)
.timeout(timeout)
.proxy(proxy)
.build()
)
.build()
)
}
}
}
19 changes: 0 additions & 19 deletions orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,8 @@

package com.withorb.api.client

import java.time.Duration
import java.util.Base64
import java.util.Optional
import java.util.concurrent.CompletableFuture
import com.withorb.api.core.ClientOptions
import com.withorb.api.core.http.HttpMethod
import com.withorb.api.core.http.HttpRequest
import com.withorb.api.core.http.HttpResponse.Handler
import com.withorb.api.core.JsonField
import com.withorb.api.core.RequestOptions
import com.withorb.api.errors.OrbError
import com.withorb.api.errors.OrbInvalidDataException
import com.withorb.api.models.*
import com.withorb.api.services.blocking.*
import com.withorb.api.services.emptyHandler
import com.withorb.api.services.errorHandler
import com.withorb.api.services.json
import com.withorb.api.services.jsonHandler
import com.withorb.api.services.stringHandler
import com.withorb.api.services.binaryHandler
import com.withorb.api.services.withErrorHandler

interface OrbClient {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,8 @@

package com.withorb.api.client

import java.time.Duration
import java.util.Base64
import java.util.Optional
import java.util.concurrent.CompletableFuture
import com.withorb.api.core.ClientOptions
import com.withorb.api.core.http.HttpMethod
import com.withorb.api.core.http.HttpRequest
import com.withorb.api.core.http.HttpResponse.Handler
import com.withorb.api.core.JsonField
import com.withorb.api.core.RequestOptions
import com.withorb.api.errors.OrbError
import com.withorb.api.errors.OrbInvalidDataException
import com.withorb.api.models.*
import com.withorb.api.services.async.*
import com.withorb.api.services.emptyHandler
import com.withorb.api.services.errorHandler
import com.withorb.api.services.json
import com.withorb.api.services.jsonHandler
import com.withorb.api.services.stringHandler
import com.withorb.api.services.binaryHandler
import com.withorb.api.services.withErrorHandler

interface OrbClientAsync {

Expand Down
Loading

0 comments on commit 837e1ed

Please sign in to comment.