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.15.0"
".": "0.16.0"
}
131 changes: 131 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2024 Orb
Copyright 2025 Orb

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
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.15.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.16.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.15.0")
implementation("com.withorb.api:orb-java:0.16.0")
```

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

Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {

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


Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import com.withorb.api.services.blocking.CustomerService
import com.withorb.api.services.blocking.CustomerServiceImpl
import com.withorb.api.services.blocking.DimensionalPriceGroupService
import com.withorb.api.services.blocking.DimensionalPriceGroupServiceImpl
import com.withorb.api.services.blocking.WebhookService
import com.withorb.api.services.blocking.WebhookServiceImpl
import com.withorb.api.services.blocking.EventService
import com.withorb.api.services.blocking.EventServiceImpl
import com.withorb.api.services.blocking.InvoiceLineItemService
Expand All @@ -34,6 +32,8 @@ import com.withorb.api.services.blocking.SubscriptionService
import com.withorb.api.services.blocking.SubscriptionServiceImpl
import com.withorb.api.services.blocking.TopLevelService
import com.withorb.api.services.blocking.TopLevelServiceImpl
import com.withorb.api.services.blocking.WebhookService
import com.withorb.api.services.blocking.WebhookServiceImpl

class OrbClientImpl
constructor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,37 +22,29 @@ import java.util.Optional
class AlertCreateForCustomerParams
constructor(
private val customerId: String,
private val currency: String,
private val type: Type,
private val thresholds: List<Threshold>?,
private val body: AlertCreateForCustomerBody,
private val additionalHeaders: Headers,
private val additionalQueryParams: QueryParams,
private val additionalBodyProperties: Map<String, JsonValue>,
) {

fun customerId(): String = customerId

fun currency(): String = currency
/** The case sensitive currency or custom pricing unit to use for this alert. */
fun currency(): String = body.currency()

fun type(): Type = type
/** The type of alert to create. This must be a valid alert type. */
fun type(): Type = body.type()

fun thresholds(): Optional<List<Threshold>> = Optional.ofNullable(thresholds)
/** The thresholds that define the values at which the alert will be triggered. */
fun thresholds(): Optional<List<Threshold>> = body.thresholds()

fun _additionalHeaders(): Headers = additionalHeaders

fun _additionalQueryParams(): QueryParams = additionalQueryParams

fun _additionalBodyProperties(): Map<String, JsonValue> = additionalBodyProperties
fun _additionalBodyProperties(): Map<String, JsonValue> = body._additionalProperties()

@JvmSynthetic
internal fun getBody(): AlertCreateForCustomerBody {
return AlertCreateForCustomerBody(
currency,
type,
thresholds,
additionalBodyProperties,
)
}
@JvmSynthetic internal fun getBody(): AlertCreateForCustomerBody = body

@JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders

Expand Down Expand Up @@ -101,7 +93,7 @@ constructor(

private var currency: String? = null
private var type: Type? = null
private var thresholds: List<Threshold>? = null
private var thresholds: MutableList<Threshold>? = null
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

@JvmSynthetic
Expand All @@ -120,7 +112,14 @@ constructor(
fun type(type: Type) = apply { this.type = type }

/** The thresholds that define the values at which the alert will be triggered. */
fun thresholds(thresholds: List<Threshold>) = apply { this.thresholds = thresholds }
fun thresholds(thresholds: List<Threshold>) = apply {
this.thresholds = thresholds.toMutableList()
}

/** The thresholds that define the values at which the alert will be triggered. */
fun addThreshold(threshold: Threshold) = apply {
thresholds = (thresholds ?: mutableListOf()).apply { add(threshold) }
}

fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
Expand Down Expand Up @@ -179,41 +178,31 @@ constructor(
class Builder {

private var customerId: String? = null
private var currency: String? = null
private var type: Type? = null
private var thresholds: MutableList<Threshold> = mutableListOf()
private var body: AlertCreateForCustomerBody.Builder = AlertCreateForCustomerBody.builder()
private var additionalHeaders: Headers.Builder = Headers.builder()
private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
private var additionalBodyProperties: MutableMap<String, JsonValue> = mutableMapOf()

@JvmSynthetic
internal fun from(alertCreateForCustomerParams: AlertCreateForCustomerParams) = apply {
customerId = alertCreateForCustomerParams.customerId
currency = alertCreateForCustomerParams.currency
type = alertCreateForCustomerParams.type
thresholds = alertCreateForCustomerParams.thresholds?.toMutableList() ?: mutableListOf()
body = alertCreateForCustomerParams.body.toBuilder()
additionalHeaders = alertCreateForCustomerParams.additionalHeaders.toBuilder()
additionalQueryParams = alertCreateForCustomerParams.additionalQueryParams.toBuilder()
additionalBodyProperties =
alertCreateForCustomerParams.additionalBodyProperties.toMutableMap()
}

fun customerId(customerId: String) = apply { this.customerId = customerId }

/** The case sensitive currency or custom pricing unit to use for this alert. */
fun currency(currency: String) = apply { this.currency = currency }
fun currency(currency: String) = apply { body.currency(currency) }

/** The type of alert to create. This must be a valid alert type. */
fun type(type: Type) = apply { this.type = type }
fun type(type: Type) = apply { body.type(type) }

/** The thresholds that define the values at which the alert will be triggered. */
fun thresholds(thresholds: List<Threshold>) = apply {
this.thresholds.clear()
this.thresholds.addAll(thresholds)
}
fun thresholds(thresholds: List<Threshold>) = apply { body.thresholds(thresholds) }

/** The thresholds that define the values at which the alert will be triggered. */
fun addThreshold(threshold: Threshold) = apply { this.thresholds.add(threshold) }
fun addThreshold(threshold: Threshold) = apply { body.addThreshold(threshold) }

fun additionalHeaders(additionalHeaders: Headers) = apply {
this.additionalHeaders.clear()
Expand Down Expand Up @@ -314,36 +303,30 @@ constructor(
}

fun additionalBodyProperties(additionalBodyProperties: Map<String, JsonValue>) = apply {
this.additionalBodyProperties.clear()
putAllAdditionalBodyProperties(additionalBodyProperties)
body.additionalProperties(additionalBodyProperties)
}

fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply {
additionalBodyProperties.put(key, value)
body.putAdditionalProperty(key, value)
}

fun putAllAdditionalBodyProperties(additionalBodyProperties: Map<String, JsonValue>) =
apply {
this.additionalBodyProperties.putAll(additionalBodyProperties)
body.putAllAdditionalProperties(additionalBodyProperties)
}

fun removeAdditionalBodyProperty(key: String) = apply {
additionalBodyProperties.remove(key)
}
fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) }

fun removeAllAdditionalBodyProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalBodyProperty)
body.removeAllAdditionalProperties(keys)
}

fun build(): AlertCreateForCustomerParams =
AlertCreateForCustomerParams(
checkNotNull(customerId) { "`customerId` is required but was not set" },
checkNotNull(currency) { "`currency` is required but was not set" },
checkNotNull(type) { "`type` is required but was not set" },
thresholds.toImmutable().ifEmpty { null },
body.build(),
additionalHeaders.build(),
additionalQueryParams.build(),
additionalBodyProperties.toImmutable(),
)
}

Expand Down Expand Up @@ -517,11 +500,11 @@ constructor(
return true
}

return /* spotless:off */ other is AlertCreateForCustomerParams && customerId == other.customerId && currency == other.currency && type == other.type && thresholds == other.thresholds && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */
return /* spotless:off */ other is AlertCreateForCustomerParams && customerId == other.customerId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */
}

override fun hashCode(): Int = /* spotless:off */ Objects.hash(customerId, currency, type, thresholds, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */
override fun hashCode(): Int = /* spotless:off */ Objects.hash(customerId, body, additionalHeaders, additionalQueryParams) /* spotless:on */

override fun toString() =
"AlertCreateForCustomerParams{customerId=$customerId, currency=$currency, type=$type, thresholds=$thresholds, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}"
"AlertCreateForCustomerParams{customerId=$customerId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
}
Loading
Loading