Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.31.0"
".": "0.31.1"
}
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# Changelog

## 0.31.1 (2025-02-17)

Full Changelog: [v0.31.0...v0.31.1](https://github.com/orbcorp/orb-java/compare/v0.31.0...v0.31.1)

### Bug Fixes

* format webhooks ([143457b](https://github.com/orbcorp/orb-java/commit/143457bb6f9d9953def62bddc78e09ad6f42c158))


### Chores

* **internal:** make body class constructors private ([3a15ffd](https://github.com/orbcorp/orb-java/commit/3a15ffd13a547878c837c9ef6dbf4b555c9e1255))
* **internal:** make body classes for multipart requests ([3a15ffd](https://github.com/orbcorp/orb-java/commit/3a15ffd13a547878c837c9ef6dbf4b555c9e1255))
* **internal:** misc formatting changes ([3a15ffd](https://github.com/orbcorp/orb-java/commit/3a15ffd13a547878c837c9ef6dbf4b555c9e1255))
* **internal:** optimize build and test perf ([be128e3](https://github.com/orbcorp/orb-java/commit/be128e35f2113a4e96a1c52171cc83cfe66bce74))
* **internal:** rename internal body classes ([3a15ffd](https://github.com/orbcorp/orb-java/commit/3a15ffd13a547878c837c9ef6dbf4b555c9e1255))
* **internal:** update formatter ([#247](https://github.com/orbcorp/orb-java/issues/247)) ([be128e3](https://github.com/orbcorp/orb-java/commit/be128e35f2113a4e96a1c52171cc83cfe66bce74))
* **internal:** use better test example values ([#249](https://github.com/orbcorp/orb-java/issues/249)) ([3a15ffd](https://github.com/orbcorp/orb-java/commit/3a15ffd13a547878c837c9ef6dbf4b555c9e1255))

## 0.31.0 (2025-02-14)

Full Changelog: [v0.30.0...v0.31.0](https://github.com/orbcorp/orb-java/compare/v0.30.0...v0.31.0)
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<!-- x-release-please-start-version -->

[![Maven Central](https://img.shields.io/maven-central/v/com.withorb.api/orb-java)](https://central.sonatype.com/artifact/com.withorb.api/orb-java/0.31.0)
[![Maven Central](https://img.shields.io/maven-central/v/com.withorb.api/orb-java)](https://central.sonatype.com/artifact/com.withorb.api/orb-java/0.31.1)

<!-- x-release-please-end -->

Expand All @@ -19,7 +19,7 @@ The REST API documentation can be found on [docs.withorb.com](https://docs.witho
### Gradle

```kotlin
implementation("com.withorb.api:orb-java:0.31.0")
implementation("com.withorb.api:orb-java:0.31.1")
```

### Maven
Expand All @@ -28,7 +28,7 @@ implementation("com.withorb.api:orb-java:0.31.0")
<dependency>
<groupId>com.withorb.api</groupId>
<artifactId>orb-java</artifactId>
<version>0.31.0</version>
<version>0.31.1</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
allprojects {
group = "com.withorb.api"
version = "0.31.0" // x-release-please-version
version = "0.31.1" // x-release-please-version
}
6 changes: 3 additions & 3 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
`kotlin-dsl`
kotlin("jvm") version "2.1.0"
kotlin("jvm") version "2.1.10"
id("com.vanniktech.maven.publish") version "0.28.0"
}

Expand All @@ -10,7 +10,7 @@ repositories {
}

dependencies {
implementation("com.diffplug.spotless:spotless-plugin-gradle:6.25.0")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.23")
implementation("com.diffplug.spotless:spotless-plugin-gradle:7.0.2")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:2.1.10")
implementation("com.vanniktech:gradle-maven-publish-plugin:0.28.0")
}
6 changes: 5 additions & 1 deletion buildSrc/src/main/kotlin/orb.java.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,13 @@ tasks.named<Jar>("jar") {
}
}

tasks.named<Test>("test") {
tasks.withType<Test>().configureEach {
useJUnitPlatform()

// Run tests in parallel to some degree.
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1)
forkEvery = 100

testLogging {
exceptionFormat = TestExceptionFormat.FULL
}
Expand Down
11 changes: 9 additions & 2 deletions buildSrc/src/main/kotlin/orb.kotlin.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import com.diffplug.gradle.spotless.SpotlessExtension
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
Expand All @@ -20,13 +21,19 @@ configure<SpotlessExtension> {
}

tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
compilerOptions {
freeCompilerArgs = listOf(
"-Xjvm-default=all",
"-Xjdk-release=1.8",
// Suppress deprecation warnings because we may still reference and test deprecated members.
"-Xsuppress-warning=DEPRECATION"
)
jvmTarget = "1.8"
jvmTarget.set(JvmTarget.JVM_1_8)
}
}

// Run tests in parallel to some degree.
tasks.withType<Test>().configureEach {
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1)
forkEvery = 100
}
4 changes: 3 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
org.gradle.configuration-cache=true
org.gradle.caching=true
org.gradle.jvmargs=-Xmx4g
org.gradle.parallel=true
org.gradle.daemon=false
org.gradle.jvmargs=-Xmx4g
kotlin.daemon.jvmargs=-Xmx4g
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@ class OkHttpClient
private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val baseUrl: HttpUrl) :
HttpClient {

override fun execute(
request: HttpRequest,
requestOptions: RequestOptions,
): HttpResponse {
override fun execute(request: HttpRequest, requestOptions: RequestOptions): HttpResponse {
val call = newCall(request, requestOptions)

return try {
Expand Down Expand Up @@ -120,13 +117,13 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val
) {
builder.header(
"X-Stainless-Read-Timeout",
Duration.ofMillis(client.readTimeoutMillis.toLong()).seconds.toString()
Duration.ofMillis(client.readTimeoutMillis.toLong()).seconds.toString(),
)
}
if (!headers.names().contains("X-Stainless-Timeout") && client.callTimeoutMillis != 0) {
builder.header(
"X-Stainless-Timeout",
Duration.ofMillis(client.callTimeoutMillis.toLong()).seconds.toString()
Duration.ofMillis(client.callTimeoutMillis.toLong()).seconds.toString(),
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ import com.withorb.api.services.async.SubscriptionServiceAsyncImpl
import com.withorb.api.services.async.TopLevelServiceAsync
import com.withorb.api.services.async.TopLevelServiceAsyncImpl

class OrbClientAsyncImpl(
private val clientOptions: ClientOptions,
) : OrbClientAsync {
class OrbClientAsyncImpl(private val clientOptions: ClientOptions) : OrbClientAsync {

private val clientOptionsWithUserAgent =
if (clientOptions.headers.names().contains("User-Agent")) clientOptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ import com.withorb.api.services.blocking.TopLevelServiceImpl
import com.withorb.api.services.blocking.WebhookService
import com.withorb.api.services.blocking.WebhookServiceImpl

class OrbClientImpl(
private val clientOptions: ClientOptions,
) : OrbClient {
class OrbClientImpl(private val clientOptions: ClientOptions) : OrbClient {

private val clientOptionsWithUserAgent =
if (clientOptions.headers.names().contains("User-Agent")) clientOptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ abstract class BaseDeserializer<T : Any>(type: KClass<T>) :

override fun createContextual(
context: DeserializationContext,
property: BeanProperty?
property: BeanProperty?,
): JsonDeserializer<T> {
return this
}
Expand All @@ -32,7 +32,7 @@ abstract class BaseDeserializer<T : Any>(type: KClass<T>) :
protected fun <T> ObjectCodec.tryDeserialize(
node: JsonNode,
type: TypeReference<T>,
validate: (T) -> Unit = {}
validate: (T) -> Unit = {},
): T? {
return try {
readValue(treeAsTokens(node), type).apply(validate)
Expand All @@ -46,7 +46,7 @@ abstract class BaseDeserializer<T : Any>(type: KClass<T>) :
protected fun <T> ObjectCodec.tryDeserialize(
node: JsonNode,
type: JavaType,
validate: (T) -> Unit = {}
validate: (T) -> Unit = {},
): T? {
return try {
readValue<T>(treeAsTokens(node), type).apply(validate)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ import java.io.OutputStream
import org.apache.hc.client5.http.entity.mime.MultipartEntityBuilder

@JvmSynthetic
internal inline fun <reified T> json(
jsonMapper: JsonMapper,
value: T,
): HttpRequestBody {
internal inline fun <reified T> json(jsonMapper: JsonMapper, value: T): HttpRequestBody {
return object : HttpRequestBody {
private var cachedBytes: ByteArray? = null

Expand Down Expand Up @@ -49,7 +46,7 @@ internal inline fun <reified T> json(
@JvmSynthetic
internal fun multipartFormData(
jsonMapper: JsonMapper,
parts: Array<MultipartFormValue<*>?>
parts: Array<MultipartFormValue<*>?>,
): HttpRequestBody {
val builder = MultipartEntityBuilder.create()
parts.forEach { part ->
Expand All @@ -66,14 +63,14 @@ internal fun multipartFormData(
part.name,
buffer.toByteArray(),
part.contentType,
part.filename
part.filename,
)
}
is Boolean ->
builder.addTextBody(
part.name,
if (part.value) "true" else "false",
part.contentType
part.contentType,
)
is Int -> builder.addTextBody(part.name, part.value.toString(), part.contentType)
is Long -> builder.addTextBody(part.name, part.value.toString(), part.contentType)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ internal fun HttpRequest.prepare(clientOptions: ClientOptions, params: Params):
@JvmSynthetic
internal fun HttpRequest.prepareAsync(
clientOptions: ClientOptions,
params: Params
params: Params,
): CompletableFuture<HttpRequest> =
// This async version exists to make it easier to add async specific preparation logic in the
// future.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ package com.withorb.api.core

import java.time.Duration

class RequestOptions
private constructor(
val responseValidation: Boolean?,
val timeout: Duration?,
) {
class RequestOptions private constructor(val responseValidation: Boolean?, val timeout: Duration?) {
fun applyDefaults(options: RequestOptions): RequestOptions {
return RequestOptions(
responseValidation = this.responseValidation ?: options.responseValidation,
Expand Down
19 changes: 8 additions & 11 deletions orb-java-core/src/main/kotlin/com/withorb/api/core/Values.kt
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ class JsonMissing : JsonValue() {
override fun serialize(
value: JsonMissing,
generator: JsonGenerator,
provider: SerializerProvider
provider: SerializerProvider,
) {
throw RuntimeException("JsonMissing cannot be serialized")
}
Expand Down Expand Up @@ -422,10 +422,7 @@ private constructor(
}

@JacksonAnnotationsInside
@JsonInclude(
JsonInclude.Include.CUSTOM,
valueFilter = JsonField.IsMissing::class,
)
@JsonInclude(JsonInclude.Include.CUSTOM, valueFilter = JsonField.IsMissing::class)
annotation class ExcludeMissing

@JacksonAnnotationsInside
Expand All @@ -434,7 +431,7 @@ annotation class ExcludeMissing
isGetterVisibility = Visibility.NONE,
setterVisibility = Visibility.NONE,
creatorVisibility = Visibility.NONE,
fieldVisibility = Visibility.NONE
fieldVisibility = Visibility.NONE,
)
annotation class NoAutoDetect

Expand All @@ -443,7 +440,7 @@ internal constructor(
val name: String,
val value: T,
val contentType: ContentType,
val filename: String? = null
val filename: String? = null,
) {

private var hashCode: Int = 0
Expand All @@ -462,7 +459,7 @@ internal constructor(
is Long -> value
is Double -> value
else -> value?.hashCode()
}
},
)
}
return hashCode
Expand Down Expand Up @@ -496,7 +493,7 @@ internal constructor(
internal fun fromString(
name: String,
value: String,
contentType: ContentType
contentType: ContentType,
): MultipartFormValue<String> = MultipartFormValue(name, value, contentType)

internal fun fromBoolean(
Expand All @@ -520,14 +517,14 @@ internal constructor(
internal fun <T : Enum> fromEnum(
name: String,
value: T,
contentType: ContentType
contentType: ContentType,
): MultipartFormValue<T> = MultipartFormValue(name, value, contentType)

internal fun fromByteArray(
name: String,
value: ByteArray,
contentType: ContentType,
filename: String? = null
filename: String? = null,
): MultipartFormValue<ByteArray> = MultipartFormValue(name, value, contentType, filename)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import java.util.TreeMap
class Headers
private constructor(
private val map: Map<String, List<String>>,
@get:JvmName("size") val size: Int
@get:JvmName("size") val size: Int,
) {

fun isEmpty(): Boolean = map.isEmpty()
Expand Down Expand Up @@ -74,7 +74,7 @@ private constructor(
values.toImmutable()
}
.toImmutable(),
size
size,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ internal class PhantomReachableClosingHttpClient(private val httpClient: HttpCli

override fun executeAsync(
request: HttpRequest,
requestOptions: RequestOptions
requestOptions: RequestOptions,
): CompletableFuture<HttpResponse> = httpClient.executeAsync(request, requestOptions)

override fun close() = httpClient.close()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.withorb.api.core.toImmutable
class QueryParams
private constructor(
private val map: Map<String, List<String>>,
@get:JvmName("size") val size: Int
@get:JvmName("size") val size: Int,
) {

fun isEmpty(): Boolean = map.isEmpty()
Expand Down
Loading