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.27.0"
".": "0.27.1"
}
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
# Changelog

## 0.27.1 (2025-02-05)

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

### Bug Fixes

* **api:** add missing `@MustBeClosed` annotations ([#231](https://github.com/orbcorp/orb-java/issues/231)) ([bc11828](https://github.com/orbcorp/orb-java/commit/bc11828c79268b321e6940c2f894af5a7c306cc4))
* **api:** switch `CompletableFuture&lt;Void&gt;` to `CompletableFuture<Void?>` ([bc11828](https://github.com/orbcorp/orb-java/commit/bc11828c79268b321e6940c2f894af5a7c306cc4))
* **client:** add missing validation calls on response ([bc11828](https://github.com/orbcorp/orb-java/commit/bc11828c79268b321e6940c2f894af5a7c306cc4))
* **client:** always provide a body for `PATCH` methods ([bc11828](https://github.com/orbcorp/orb-java/commit/bc11828c79268b321e6940c2f894af5a7c306cc4))


### Chores

* **internal:** minor formatting/style changes ([bc11828](https://github.com/orbcorp/orb-java/commit/bc11828c79268b321e6940c2f894af5a7c306cc4))
* **internal:** rename some tests ([bc11828](https://github.com/orbcorp/orb-java/commit/bc11828c79268b321e6940c2f894af5a7c306cc4))

## 0.27.0 (2025-02-04)

Full Changelog: [v0.26.0...v0.27.0](https://github.com/orbcorp/orb-java/compare/v0.26.0...v0.27.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.27.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.27.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.27.0")
implementation("com.withorb.api:orb-java:0.27.1")
```

### Maven
Expand All @@ -28,7 +28,7 @@ implementation("com.withorb.api:orb-java:0.27.0")
<dependency>
<groupId>com.withorb.api</groupId>
<artifactId>orb-java</artifactId>
<version>0.27.0</version>
<version>0.27.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.27.0" // x-release-please-version
version = "0.27.1" // x-release-please-version
}
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val

private fun HttpRequest.toRequest(client: okhttp3.OkHttpClient): Request {
var body: RequestBody? = body?.toRequestBody()
// OkHttpClient always requires a request body for PUT and POST methods.
if (body == null && (method == HttpMethod.PUT || method == HttpMethod.POST)) {
if (body == null && requiresBody(method)) {
body = "".toRequestBody()
}

Expand All @@ -134,6 +133,15 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val
return builder.build()
}

/** `OkHttpClient` always requires a request body for some methods. */
private fun requiresBody(method: HttpMethod): Boolean =
when (method) {
HttpMethod.POST,
HttpMethod.PUT,
HttpMethod.PATCH -> true
else -> false
}

private fun HttpRequest.toUrl(): String {
url?.let {
return it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ internal constructor(
.thenApply { response ->
response
.use { retrieveHandler.handle(it) }
.apply {
.also {
if (requestOptions.responseValidation ?: clientOptions.responseValidation) {
validate()
it.validate()
}
}
}
Expand All @@ -79,9 +79,9 @@ internal constructor(
.thenApply { response ->
response
.use { updateHandler.handle(it) }
.apply {
.also {
if (requestOptions.responseValidation ?: clientOptions.responseValidation) {
validate()
it.validate()
}
}
}
Expand Down Expand Up @@ -117,9 +117,9 @@ internal constructor(
.thenApply { response ->
response
.use { listHandler.handle(it) }
.apply {
.also {
if (requestOptions.responseValidation ?: clientOptions.responseValidation) {
validate()
it.validate()
}
}
.let { AlertListPageAsync.of(this, params, it) }
Expand Down Expand Up @@ -153,9 +153,9 @@ internal constructor(
.thenApply { response ->
response
.use { createForCustomerHandler.handle(it) }
.apply {
.also {
if (requestOptions.responseValidation ?: clientOptions.responseValidation) {
validate()
it.validate()
}
}
}
Expand Down Expand Up @@ -188,9 +188,9 @@ internal constructor(
.thenApply { response ->
response
.use { createForExternalCustomerHandler.handle(it) }
.apply {
.also {
if (requestOptions.responseValidation ?: clientOptions.responseValidation) {
validate()
it.validate()
}
}
}
Expand Down Expand Up @@ -227,9 +227,9 @@ internal constructor(
.thenApply { response ->
response
.use { createForSubscriptionHandler.handle(it) }
.apply {
.also {
if (requestOptions.responseValidation ?: clientOptions.responseValidation) {
validate()
it.validate()
}
}
}
Expand Down Expand Up @@ -259,9 +259,9 @@ internal constructor(
.thenApply { response ->
response
.use { disableHandler.handle(it) }
.apply {
.also {
if (requestOptions.responseValidation ?: clientOptions.responseValidation) {
validate()
it.validate()
}
}
}
Expand Down Expand Up @@ -291,9 +291,9 @@ internal constructor(
.thenApply { response ->
response
.use { enableHandler.handle(it) }
.apply {
.also {
if (requestOptions.responseValidation ?: clientOptions.responseValidation) {
validate()
it.validate()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ internal constructor(
.thenApply { response ->
response
.use { createHandler.handle(it) }
.apply {
.also {
if (requestOptions.responseValidation ?: clientOptions.responseValidation) {
validate()
it.validate()
}
}
}
Expand Down Expand Up @@ -94,9 +94,9 @@ internal constructor(
.thenApply { response ->
response
.use { listHandler.handle(it) }
.apply {
.also {
if (requestOptions.responseValidation ?: clientOptions.responseValidation) {
validate()
it.validate()
}
}
.let { CouponListPageAsync.of(this, params, it) }
Expand Down Expand Up @@ -127,9 +127,9 @@ internal constructor(
.thenApply { response ->
response
.use { archiveHandler.handle(it) }
.apply {
.also {
if (requestOptions.responseValidation ?: clientOptions.responseValidation) {
validate()
it.validate()
}
}
}
Expand Down Expand Up @@ -157,9 +157,9 @@ internal constructor(
.thenApply { response ->
response
.use { fetchHandler.handle(it) }
.apply {
.also {
if (requestOptions.responseValidation ?: clientOptions.responseValidation) {
validate()
it.validate()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ internal constructor(
.thenApply { response ->
response
.use { createHandler.handle(it) }
.apply {
.also {
if (requestOptions.responseValidation ?: clientOptions.responseValidation) {
validate()
it.validate()
}
}
}
Expand Down Expand Up @@ -79,9 +79,9 @@ internal constructor(
.thenApply { response ->
response
.use { listHandler.handle(it) }
.apply {
.also {
if (requestOptions.responseValidation ?: clientOptions.responseValidation) {
validate()
it.validate()
}
}
.let { CreditNoteListPageAsync.of(this, params, it) }
Expand Down Expand Up @@ -110,9 +110,9 @@ internal constructor(
.thenApply { response ->
response
.use { fetchHandler.handle(it) }
.apply {
.also {
if (requestOptions.responseValidation ?: clientOptions.responseValidation) {
validate()
it.validate()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ interface CustomerServiceAsync {
fun delete(
params: CustomerDeleteParams,
requestOptions: RequestOptions = RequestOptions.none()
): CompletableFuture<Void>
): CompletableFuture<Void?>

/**
* This endpoint is used to fetch customer details given an identifier. If the `Customer` is in
Expand Down Expand Up @@ -132,7 +132,7 @@ interface CustomerServiceAsync {
fun syncPaymentMethodsFromGateway(
params: CustomerSyncPaymentMethodsFromGatewayParams,
requestOptions: RequestOptions = RequestOptions.none()
): CompletableFuture<Void>
): CompletableFuture<Void?>

/**
* Sync Orb's payment methods for the customer with their gateway.
Expand All @@ -146,7 +146,7 @@ interface CustomerServiceAsync {
fun syncPaymentMethodsFromGatewayByExternalCustomerId(
params: CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams,
requestOptions: RequestOptions = RequestOptions.none()
): CompletableFuture<Void>
): CompletableFuture<Void?>

/**
* This endpoint is used to update customer details given an `external_customer_id` (see
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ internal constructor(
.thenApply { response ->
response
.use { createHandler.handle(it) }
.apply {
.also {
if (requestOptions.responseValidation ?: clientOptions.responseValidation) {
validate()
it.validate()
}
}
}
Expand Down Expand Up @@ -119,9 +119,9 @@ internal constructor(
.thenApply { response ->
response
.use { updateHandler.handle(it) }
.apply {
.also {
if (requestOptions.responseValidation ?: clientOptions.responseValidation) {
validate()
it.validate()
}
}
}
Expand Down Expand Up @@ -153,9 +153,9 @@ internal constructor(
.thenApply { response ->
response
.use { listHandler.handle(it) }
.apply {
.also {
if (requestOptions.responseValidation ?: clientOptions.responseValidation) {
validate()
it.validate()
}
}
.let { CustomerListPageAsync.of(this, params, it) }
Expand All @@ -182,7 +182,7 @@ internal constructor(
override fun delete(
params: CustomerDeleteParams,
requestOptions: RequestOptions
): CompletableFuture<Void> {
): CompletableFuture<Void?> {
val request =
HttpRequest.builder()
.method(HttpMethod.DELETE)
Expand Down Expand Up @@ -220,9 +220,9 @@ internal constructor(
.thenApply { response ->
response
.use { fetchHandler.handle(it) }
.apply {
.also {
if (requestOptions.responseValidation ?: clientOptions.responseValidation) {
validate()
it.validate()
}
}
}
Expand Down Expand Up @@ -253,9 +253,9 @@ internal constructor(
.thenApply { response ->
response
.use { fetchByExternalIdHandler.handle(it) }
.apply {
.also {
if (requestOptions.responseValidation ?: clientOptions.responseValidation) {
validate()
it.validate()
}
}
}
Expand All @@ -275,7 +275,7 @@ internal constructor(
override fun syncPaymentMethodsFromGateway(
params: CustomerSyncPaymentMethodsFromGatewayParams,
requestOptions: RequestOptions
): CompletableFuture<Void> {
): CompletableFuture<Void?> {
val request =
HttpRequest.builder()
.method(HttpMethod.POST)
Expand Down Expand Up @@ -309,7 +309,7 @@ internal constructor(
override fun syncPaymentMethodsFromGatewayByExternalCustomerId(
params: CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams,
requestOptions: RequestOptions
): CompletableFuture<Void> {
): CompletableFuture<Void?> {
val request =
HttpRequest.builder()
.method(HttpMethod.POST)
Expand Down Expand Up @@ -352,9 +352,9 @@ internal constructor(
.thenApply { response ->
response
.use { updateByExternalIdHandler.handle(it) }
.apply {
.also {
if (requestOptions.responseValidation ?: clientOptions.responseValidation) {
validate()
it.validate()
}
}
}
Expand Down
Loading