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.37.0"
".": "0.38.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: 103
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-7b65f996788617c2d2f2e8e941d366edd1a2844f15eefec555e220b03bbc6d4c.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-d4f03b16daf0bae33be634c959dafb0e21b0bcb156beb162f8235394dca88e7c.yml
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
# Changelog

## 0.38.0 (2025-02-27)

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

### Features

* **api:** api update ([#286](https://github.com/orbcorp/orb-java/issues/286)) ([a0ba171](https://github.com/orbcorp/orb-java/commit/a0ba171d068ac12040aa4081a3985db0e2f0f4e3))


### Chores

* **client:** use deep identity methods for primitive array types ([#283](https://github.com/orbcorp/orb-java/issues/283)) ([6e2862d](https://github.com/orbcorp/orb-java/commit/6e2862d364872246891f5b1f37a137f27edd3c39))
* **internal:** add async service tests ([#281](https://github.com/orbcorp/orb-java/issues/281)) ([8171ba6](https://github.com/orbcorp/orb-java/commit/8171ba671b8a5fb9d55477984a765f7235d50c53))
* **internal:** improve sync service tests ([8171ba6](https://github.com/orbcorp/orb-java/commit/8171ba671b8a5fb9d55477984a765f7235d50c53))
* **internal:** refactor `ServiceParamsTest` ([#285](https://github.com/orbcorp/orb-java/issues/285)) ([7894edb](https://github.com/orbcorp/orb-java/commit/7894edb4bd1b2a0780d839c23e08861e10aa080e))


### Documentation

* readme parameter tweaks ([8171ba6](https://github.com/orbcorp/orb-java/commit/8171ba671b8a5fb9d55477984a765f7235d50c53))

## 0.37.0 (2025-02-26)

Full Changelog: [v0.36.0...v0.37.0](https://github.com/orbcorp/orb-java/compare/v0.36.0...v0.37.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.37.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.38.0)

<!-- 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.37.0")
implementation("com.withorb.api:orb-java:0.38.0")
```

### Maven
Expand All @@ -28,7 +28,7 @@ implementation("com.withorb.api:orb-java:0.37.0")
<dependency>
<groupId>com.withorb.api</groupId>
<artifactId>orb-java</artifactId>
<version>0.37.0</version>
<version>0.38.0</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.37.0" // x-release-please-version
version = "0.38.0" // x-release-please-version
}
36 changes: 36 additions & 0 deletions orb-java-core/src/main/kotlin/com/withorb/api/core/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,42 @@ internal fun <K : Comparable<K>, V> SortedMap<K, V>.toImmutable(): SortedMap<K,
if (isEmpty()) Collections.emptySortedMap()
else Collections.unmodifiableSortedMap(toSortedMap(comparator()))

/**
* Returns whether [this] is equal to [other].
*
* This differs from [Object.equals] because it also deeply equates arrays based on their contents,
* even when there are arrays directly nested within other arrays.
*/
@JvmSynthetic
internal infix fun Any?.contentEquals(other: Any?): Boolean =
arrayOf(this).contentDeepEquals(arrayOf(other))

/**
* Returns a hash of the given sequence of [values].
*
* This differs from [java.util.Objects.hash] because it also deeply hashes arrays based on their
* contents, even when there are arrays directly nested within other arrays.
*/
@JvmSynthetic internal fun contentHash(vararg values: Any?): Int = values.contentDeepHashCode()

/**
* Returns a [String] representation of [this].
*
* This differs from [Object.toString] because it also deeply stringifies arrays based on their
* contents, even when there are arrays directly nested within other arrays.
*/
@JvmSynthetic
internal fun Any?.contentToString(): String {
var string = arrayOf(this).contentDeepToString()
if (string.startsWith('[')) {
string = string.substring(1)
}
if (string.endsWith(']')) {
string = string.substring(0, string.length - 1)
}
return string
}

@JvmSynthetic
internal fun Headers.getRequiredHeader(name: String): String =
values(name).firstOrNull() ?: throw OrbInvalidDataException("Could not find $name header")
Expand Down
43 changes: 11 additions & 32 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 @@ -470,41 +470,20 @@ internal constructor(
val filename: String? = null,
) {

private var hashCode: Int = 0

override fun hashCode(): Int {
if (hashCode == 0) {
hashCode =
Objects.hash(
name,
contentType,
filename,
when (value) {
is ByteArray -> value.contentHashCode()
is String -> value
is Boolean -> value
is Long -> value
is Double -> value
else -> value?.hashCode()
},
)
}
return hashCode
}

override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other == null || this.javaClass != other.javaClass) return false
private val hashCode: Int by lazy { contentHash(name, value, contentType, filename) }

other as MultipartFormValue<*>
override fun hashCode(): Int = hashCode

if (name != other.name || contentType != other.contentType || filename != other.filename)
return false

return when {
value is ByteArray && other.value is ByteArray -> value contentEquals other.value
else -> value?.equals(other.value) ?: (other.value == null)
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}

return other is MultipartFormValue<*> &&
name == other.name &&
value contentEquals other.value &&
contentType == other.contentType &&
filename == other.filename
}

override fun toString(): String =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ import com.withorb.api.core.toImmutable
import java.util.Objects
import java.util.Optional

/** Delete top-up by external ID */
/**
* This deactivates the top-up and voids any invoices associated with pending credit blocks
* purchased through the top-up.
*/
class CustomerCreditTopUpDeleteByExternalIdParams
private constructor(
private val externalCustomerId: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ import com.withorb.api.core.toImmutable
import java.util.Objects
import java.util.Optional

/** Delete top-up */
/**
* This deactivates the top-up and voids any invoices associated with pending credit blocks
* purchased through the top-up.
*/
class CustomerCreditTopUpDeleteParams
private constructor(
private val customerId: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5766,6 +5766,9 @@ private constructor(
@JsonProperty("end_date")
@ExcludeMissing
private val endDate: JsonField<OffsetDateTime> = JsonMissing.of(),
@JsonProperty("filter")
@ExcludeMissing
private val filter: JsonField<String> = JsonMissing.of(),
@JsonProperty("fixed_fee_quantity_transitions")
@ExcludeMissing
private val fixedFeeQuantityTransitions: JsonField<List<FixedFeeQuantityTransition>> =
Expand All @@ -5776,6 +5779,9 @@ private constructor(
@JsonProperty("start_date")
@ExcludeMissing
private val startDate: JsonField<OffsetDateTime> = JsonMissing.of(),
@JsonProperty("usage_customer_ids")
@ExcludeMissing
private val usageCustomerIds: JsonField<List<String>> = JsonMissing.of(),
@JsonAnySetter
private val additionalProperties: Map<String, JsonValue> = immutableEmptyMap(),
) {
Expand Down Expand Up @@ -5812,6 +5818,9 @@ private constructor(
fun endDate(): Optional<OffsetDateTime> =
Optional.ofNullable(endDate.getNullable("end_date"))

/** An additional filter to apply to usage queries. */
fun filter(): Optional<String> = Optional.ofNullable(filter.getNullable("filter"))

/**
* The fixed fee quantity transitions for this price interval. This is only relevant for
* fixed fees.
Expand Down Expand Up @@ -5841,6 +5850,13 @@ private constructor(
*/
fun startDate(): OffsetDateTime = startDate.getRequired("start_date")

/**
* A list of customer IDs whose usage events will be aggregated and billed under this price
* interval.
*/
fun usageCustomerIds(): Optional<List<String>> =
Optional.ofNullable(usageCustomerIds.getNullable("usage_customer_ids"))

@JsonProperty("id") @ExcludeMissing fun _id(): JsonField<String> = id

/** The day of the month that Orb bills for this price */
Expand Down Expand Up @@ -5875,6 +5891,9 @@ private constructor(
@ExcludeMissing
fun _endDate(): JsonField<OffsetDateTime> = endDate

/** An additional filter to apply to usage queries. */
@JsonProperty("filter") @ExcludeMissing fun _filter(): JsonField<String> = filter

/**
* The fixed fee quantity transitions for this price interval. This is only relevant for
* fixed fees.
Expand Down Expand Up @@ -5906,6 +5925,14 @@ private constructor(
@ExcludeMissing
fun _startDate(): JsonField<OffsetDateTime> = startDate

/**
* A list of customer IDs whose usage events will be aggregated and billed under this price
* interval.
*/
@JsonProperty("usage_customer_ids")
@ExcludeMissing
fun _usageCustomerIds(): JsonField<List<String>> = usageCustomerIds

@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
Expand All @@ -5922,9 +5949,11 @@ private constructor(
currentBillingPeriodEndDate()
currentBillingPeriodStartDate()
endDate()
filter()
fixedFeeQuantityTransitions().ifPresent { it.forEach { it.validate() } }
price().validate()
startDate()
usageCustomerIds()
validated = true
}

Expand All @@ -5943,11 +5972,13 @@ private constructor(
private var currentBillingPeriodEndDate: JsonField<OffsetDateTime>? = null
private var currentBillingPeriodStartDate: JsonField<OffsetDateTime>? = null
private var endDate: JsonField<OffsetDateTime>? = null
private var filter: JsonField<String>? = null
private var fixedFeeQuantityTransitions:
JsonField<MutableList<FixedFeeQuantityTransition>>? =
null
private var price: JsonField<Price>? = null
private var startDate: JsonField<OffsetDateTime>? = null
private var usageCustomerIds: JsonField<MutableList<String>>? = null
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

@JvmSynthetic
Expand All @@ -5957,10 +5988,12 @@ private constructor(
currentBillingPeriodEndDate = priceInterval.currentBillingPeriodEndDate
currentBillingPeriodStartDate = priceInterval.currentBillingPeriodStartDate
endDate = priceInterval.endDate
filter = priceInterval.filter
fixedFeeQuantityTransitions =
priceInterval.fixedFeeQuantityTransitions.map { it.toMutableList() }
price = priceInterval.price
startDate = priceInterval.startDate
usageCustomerIds = priceInterval.usageCustomerIds.map { it.toMutableList() }
additionalProperties = priceInterval.additionalProperties.toMutableMap()
}

Expand Down Expand Up @@ -6046,6 +6079,15 @@ private constructor(
*/
fun endDate(endDate: JsonField<OffsetDateTime>) = apply { this.endDate = endDate }

/** An additional filter to apply to usage queries. */
fun filter(filter: String?) = filter(JsonField.ofNullable(filter))

/** An additional filter to apply to usage queries. */
fun filter(filter: Optional<String>) = filter(filter.orElse(null))

/** An additional filter to apply to usage queries. */
fun filter(filter: JsonField<String>) = apply { this.filter = filter }

/**
* The fixed fee quantity transitions for this price interval. This is only relevant for
* fixed fees.
Expand Down Expand Up @@ -6546,6 +6588,45 @@ private constructor(
this.startDate = startDate
}

/**
* A list of customer IDs whose usage events will be aggregated and billed under this
* price interval.
*/
fun usageCustomerIds(usageCustomerIds: List<String>?) =
usageCustomerIds(JsonField.ofNullable(usageCustomerIds))

/**
* A list of customer IDs whose usage events will be aggregated and billed under this
* price interval.
*/
fun usageCustomerIds(usageCustomerIds: Optional<List<String>>) =
usageCustomerIds(usageCustomerIds.orElse(null))

/**
* A list of customer IDs whose usage events will be aggregated and billed under this
* price interval.
*/
fun usageCustomerIds(usageCustomerIds: JsonField<List<String>>) = apply {
this.usageCustomerIds = usageCustomerIds.map { it.toMutableList() }
}

/**
* A list of customer IDs whose usage events will be aggregated and billed under this
* price interval.
*/
fun addUsageCustomerId(usageCustomerId: String) = apply {
usageCustomerIds =
(usageCustomerIds ?: JsonField.of(mutableListOf())).apply {
asKnown()
.orElseThrow {
IllegalStateException(
"Field was set to non-list type: ${javaClass.simpleName}"
)
}
.add(usageCustomerId)
}
}

fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
Expand All @@ -6572,11 +6653,13 @@ private constructor(
checkRequired("currentBillingPeriodEndDate", currentBillingPeriodEndDate),
checkRequired("currentBillingPeriodStartDate", currentBillingPeriodStartDate),
checkRequired("endDate", endDate),
checkRequired("filter", filter),
checkRequired("fixedFeeQuantityTransitions", fixedFeeQuantityTransitions).map {
it.toImmutable()
},
checkRequired("price", price),
checkRequired("startDate", startDate),
checkRequired("usageCustomerIds", usageCustomerIds).map { it.toImmutable() },
additionalProperties.toImmutable(),
)
}
Expand Down Expand Up @@ -6722,17 +6805,17 @@ private constructor(
return true
}

return /* spotless:off */ other is PriceInterval && id == other.id && billingCycleDay == other.billingCycleDay && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && endDate == other.endDate && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && price == other.price && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */
return /* spotless:off */ other is PriceInterval && id == other.id && billingCycleDay == other.billingCycleDay && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && endDate == other.endDate && filter == other.filter && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && price == other.price && startDate == other.startDate && usageCustomerIds == other.usageCustomerIds && additionalProperties == other.additionalProperties /* spotless:on */
}

/* spotless:off */
private val hashCode: Int by lazy { Objects.hash(id, billingCycleDay, currentBillingPeriodEndDate, currentBillingPeriodStartDate, endDate, fixedFeeQuantityTransitions, price, startDate, additionalProperties) }
private val hashCode: Int by lazy { Objects.hash(id, billingCycleDay, currentBillingPeriodEndDate, currentBillingPeriodStartDate, endDate, filter, fixedFeeQuantityTransitions, price, startDate, usageCustomerIds, additionalProperties) }
/* spotless:on */

override fun hashCode(): Int = hashCode

override fun toString() =
"PriceInterval{id=$id, billingCycleDay=$billingCycleDay, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, endDate=$endDate, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, price=$price, startDate=$startDate, additionalProperties=$additionalProperties}"
"PriceInterval{id=$id, billingCycleDay=$billingCycleDay, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, endDate=$endDate, filter=$filter, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, price=$price, startDate=$startDate, usageCustomerIds=$usageCustomerIds, additionalProperties=$additionalProperties}"
}

@NoAutoDetect
Expand Down
Loading
Loading