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
Jump to file
Failed to load files.
Loading
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.20.0"
".": "0.21.0"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 101
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-52bd3046e73f201c4d08edfa92756791c015be907691a7893f8e7782cc2aea6f.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-ac2f736602bc631b92de358a7edb395cf53ed506b2cb3d0494fffa31be9e2d9f.yml
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
# Changelog

## 0.21.0 (2025-01-15)

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

### Features

* **api:** api update ([#198](https://github.com/orbcorp/orb-java/issues/198)) ([5c3b405](https://github.com/orbcorp/orb-java/commit/5c3b4056210b7767bfb459a8aeebb89868ca94ed))
* **client:** add more builder convenience methods for lists ([#188](https://github.com/orbcorp/orb-java/issues/188)) ([2cc7b59](https://github.com/orbcorp/orb-java/commit/2cc7b59eef370132838b0a1c5035b54235e071e8))


### Chores

* **internal:** add and tweak check functions ([#195](https://github.com/orbcorp/orb-java/issues/195)) ([059140b](https://github.com/orbcorp/orb-java/commit/059140b58e537e077a1fdac7147b69f6a2287d3c))
* **internal:** codegen related update ([#186](https://github.com/orbcorp/orb-java/issues/186)) ([80ba077](https://github.com/orbcorp/orb-java/commit/80ba077b082aa2e8293b1389f3a24a6acf8f2d16))
* **internal:** codegen related update ([#189](https://github.com/orbcorp/orb-java/issues/189)) ([02ac7e7](https://github.com/orbcorp/orb-java/commit/02ac7e7f881d9474582f8c7a4e7ac6da9c08c24e))
* **internal:** extract a `checkRequired` function ([#194](https://github.com/orbcorp/orb-java/issues/194)) ([4d7ef18](https://github.com/orbcorp/orb-java/commit/4d7ef182abe288e73d704d490baea3129739aea9))
* **internal:** fix up root `build.gradle.kts` formatting ([#190](https://github.com/orbcorp/orb-java/issues/190)) ([c6877ff](https://github.com/orbcorp/orb-java/commit/c6877ff9cbf213990d401994bf09c11c40abfe48))
* **internal:** remove unused Gradle imports ([#191](https://github.com/orbcorp/orb-java/issues/191)) ([dc9baca](https://github.com/orbcorp/orb-java/commit/dc9bacac05d8cae6d70faee128ca9a2425a30275))
* **internal:** remove unused or unnecessary Gradle imports ([#192](https://github.com/orbcorp/orb-java/issues/192)) ([1d55476](https://github.com/orbcorp/orb-java/commit/1d55476c9984ae3c0b8bc3160c40466e04e96fad))
* **internal:** tweak client options nullability handling ([059140b](https://github.com/orbcorp/orb-java/commit/059140b58e537e077a1fdac7147b69f6a2287d3c))
* **internal:** update some gradle formatting ([#193](https://github.com/orbcorp/orb-java/issues/193)) ([84dffdc](https://github.com/orbcorp/orb-java/commit/84dffdce3a40890a70e8d486bc92efe7d7d40e7f))
* simplify examples involving lists ([#196](https://github.com/orbcorp/orb-java/issues/196)) ([087813e](https://github.com/orbcorp/orb-java/commit/087813e8217eaea12439a2b8c6df46ba32ea4d1d))
* simplify examples involving unions ([#197](https://github.com/orbcorp/orb-java/issues/197)) ([6f4b238](https://github.com/orbcorp/orb-java/commit/6f4b23885505fb6cd3cc8e94c3a405c01e7336f6))

## 0.20.0 (2025-01-07)

Full Changelog: [v0.19.0...v0.20.0](https://github.com/orbcorp/orb-java/compare/v0.19.0...v0.20.0)
Expand Down
8 changes: 4 additions & 4 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.20.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.21.0)

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

Expand All @@ -25,7 +25,7 @@ The REST API documentation can be found on [docs.withorb.com](https://docs.with
<!-- x-release-please-start-version -->

```kotlin
implementation("com.withorb.api:orb-java:0.20.0")
implementation("com.withorb.api:orb-java:0.21.0")
```

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

Expand Down Expand Up @@ -377,7 +377,7 @@ $ export ORB_LOG=debug

This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:

1. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals)_.
1. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_
2. Changes that we do not expect to impact the vast majority of users in practice.

We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
Expand Down
8 changes: 1 addition & 7 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
plugins {

}

allprojects {
group = "com.withorb.api"
version = "0.20.0" // x-release-please-version
version = "0.21.0" // x-release-please-version
}


4 changes: 0 additions & 4 deletions buildSrc/src/main/kotlin/orb.java.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import com.diffplug.gradle.spotless.SpotlessExtension
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import com.vanniktech.maven.publish.JavaLibrary
import com.vanniktech.maven.publish.JavadocJar
import com.vanniktech.maven.publish.MavenPublishBaseExtension
import com.vanniktech.maven.publish.SonatypeHost

plugins {
`java-library`
Expand Down
1 change: 0 additions & 1 deletion buildSrc/src/main/kotlin/orb.kotlin.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import com.diffplug.gradle.spotless.SpotlessExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import com.vanniktech.maven.publish.*

plugins {
id("orb.java")
Expand Down
9 changes: 1 addition & 8 deletions buildSrc/src/main/kotlin/orb.publish.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
import org.gradle.api.publish.PublishingExtension
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.register
import org.gradle.kotlin.dsl.get
import com.vanniktech.maven.publish.JavaLibrary
import com.vanniktech.maven.publish.JavadocJar
import com.vanniktech.maven.publish.MavenPublishBaseExtension
import com.vanniktech.maven.publish.SonatypeHost

Expand All @@ -25,7 +18,7 @@ configure<MavenPublishBaseExtension> {
signAllPublications()
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)

this.coordinates(project.group.toString(), project.name, project.version.toString())
coordinates(project.group.toString(), project.name, project.version.toString())

pom {
name.set("API Reference")
Expand Down
30 changes: 30 additions & 0 deletions orb-java-core/src/main/kotlin/com/withorb/api/core/Check.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
@file:JvmName("Check")

package com.withorb.api.core

@JvmSynthetic
internal fun <T : Any> checkRequired(name: String, value: T?): T =
checkNotNull(value) { "`$name` is required, but was not set" }

@JvmSynthetic
internal fun checkLength(name: String, value: String, length: Int): String =
value.also {
check(it.length == length) { "`$name` must have length $length, but was ${it.length}" }
}

@JvmSynthetic
internal fun checkMinLength(name: String, value: String, minLength: Int): String =
value.also {
check(it.length >= minLength) {
if (minLength == 1) "`$name` must be non-empty, but was empty"
else "`$name` must have at least length $minLength, but was ${it.length}"
}
}

@JvmSynthetic
internal fun checkMaxLength(name: String, value: String, maxLength: Int): String =
value.also {
check(it.length <= maxLength) {
"`$name` must have at most length $maxLength, but was ${it.length}"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ private constructor(
}

fun build(): ClientOptions {
checkNotNull(httpClient) { "`httpClient` is required but was not set" }
checkNotNull(apiKey) { "`apiKey` is required but was not set" }
val httpClient = checkRequired("httpClient", httpClient)
val apiKey = checkRequired("apiKey", apiKey)

val headers = Headers.builder()
val queryParams = QueryParams.builder()
Expand All @@ -183,7 +183,7 @@ private constructor(
headers.put("X-Stainless-Package-Version", getPackageVersion())
headers.put("X-Stainless-Runtime", "JRE")
headers.put("X-Stainless-Runtime-Version", getJavaVersion())
apiKey?.let {
apiKey.let {
if (!it.isEmpty()) {
headers.put("Authorization", "Bearer $it")
}
Expand All @@ -192,10 +192,10 @@ private constructor(
queryParams.replaceAll(this.queryParams.build())

return ClientOptions(
httpClient!!,
httpClient,
PhantomReachableClosingHttpClient(
RetryingHttpClient.builder()
.httpClient(httpClient!!)
.httpClient(httpClient)
.clock(clock)
.maxRetries(maxRetries)
.idempotencyHeader("Idempotency-Key")
Expand All @@ -208,7 +208,7 @@ private constructor(
queryParams.build(),
responseValidation,
maxRetries,
apiKey!!,
apiKey,
webhookSecret,
)
}
Expand Down
2 changes: 2 additions & 0 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 @@ -117,6 +117,8 @@ sealed class JsonField<out T : Any> {
is JsonValue -> this
}

@JvmSynthetic fun accept(consume: (T) -> Unit) = asKnown().ifPresent(consume)

fun <R> accept(visitor: Visitor<T, R>): R =
when (this) {
is KnownValue -> visitor.visitKnown(value)
Expand Down
Loading
Loading