Skip to content

Commit ce8941f

Browse files
authored
Merge pull request #4 from orbcorp/release-please--branches--main--changes--next
release: 0.1.0-alpha.2
2 parents 4487f4e + 1874f69 commit ce8941f

File tree

78 files changed

+1334
-644
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+1334
-644
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.prism.log
12
.gradle
23
.idea
34
build

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.1.0-alpha.1"
2+
".": "0.1.0-alpha.2"
33
}

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 90
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb-6bef7452aabfcad0e298c7e0bbbd90aa6a1d954ad99a04fe756b827fd12a7ce9.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb-75733a914692b0abe72ba99d622fc55b20da1c7fa7f73e2bfee30dfe32b66a51.yml

CHANGELOG.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,38 @@
11
# Changelog
22

3+
## 0.1.0-alpha.2 (2024-06-28)
4+
5+
Full Changelog: [v0.1.0-alpha.1...v0.1.0-alpha.2](https://github.com/orbcorp/orb-java/compare/v0.1.0-alpha.1...v0.1.0-alpha.2)
6+
7+
### ⚠ BREAKING CHANGES
8+
9+
* **api:** endpoint expects amount of new allocation price to be a string, not a number ([#10](https://github.com/orbcorp/orb-java/issues/10))
10+
11+
### Features
12+
13+
* **api:** add support for adding allocation price to subscription ([#8](https://github.com/orbcorp/orb-java/issues/8)) ([d150c33](https://github.com/orbcorp/orb-java/commit/d150c33743c505658aeb09b639ea4b739ad4322c))
14+
* **api:** add support for query param include_all_blocks ([#11](https://github.com/orbcorp/orb-java/issues/11)) ([73d5e94](https://github.com/orbcorp/orb-java/commit/73d5e9453745dda4c138bed77c3dc71b306f37f3))
15+
* **api:** external connections made optional when updating items ([#9](https://github.com/orbcorp/orb-java/issues/9)) ([d1a63a3](https://github.com/orbcorp/orb-java/commit/d1a63a3edcd71535e421b9ded0f749e96d18b253))
16+
* **api:** updates ([#5](https://github.com/orbcorp/orb-java/issues/5)) ([fb8c7d9](https://github.com/orbcorp/orb-java/commit/fb8c7d974e51d260d1bb9aa1f93021a64288589a))
17+
* **client:** add support for `putQueryParam` on `ClientOptions` ([#6](https://github.com/orbcorp/orb-java/issues/6)) ([71d82b0](https://github.com/orbcorp/orb-java/commit/71d82b0545a51df2abb8ebfe852991d9f740d498))
18+
19+
20+
### Bug Fixes
21+
22+
* **api:** endpoint expects amount of new allocation price to be a string, not a number ([#10](https://github.com/orbcorp/orb-java/issues/10)) ([f38419a](https://github.com/orbcorp/orb-java/commit/f38419a6c6b10b5137d573dfc9c7f5a96a302348))
23+
24+
25+
### Chores
26+
27+
* **docs:** improve Coupon description ([#7](https://github.com/orbcorp/orb-java/issues/7)) ([4d1d183](https://github.com/orbcorp/orb-java/commit/4d1d183eba7883c30007edc2aac0ab27c5e62600))
28+
* **docs:** updates price intervals docs ([#12](https://github.com/orbcorp/orb-java/issues/12)) ([554df1b](https://github.com/orbcorp/orb-java/commit/554df1b92b83237d8f88cea66bee47524ee8d9db))
29+
* gitignore test server logs ([#13](https://github.com/orbcorp/orb-java/issues/13)) ([11e4ebc](https://github.com/orbcorp/orb-java/commit/11e4ebc52501ab8c6ea3ba15eff0ef82134eda89))
30+
31+
32+
### Documentation
33+
34+
* small updates ([#3](https://github.com/orbcorp/orb-java/issues/3)) ([11b888b](https://github.com/orbcorp/orb-java/commit/11b888b44a0063a15bb0bdee64273659b9cc4514))
35+
336
## 0.1.0-alpha.1 (2024-06-06)
437

538
Full Changelog: [v0.0.1-alpha.0...v0.1.0-alpha.1](https://github.com/orbcorp/orb-java/compare/v0.0.1-alpha.0...v0.1.0-alpha.1)

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

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

5-
[![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.1.0-alpha.1)
5+
[![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.1.0-alpha.2)
66

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

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

2727
```kotlin
28-
implementation("com.withorb.api:orb-java:0.1.0-alpha.1")
28+
implementation("com.withorb.api:orb-java:0.1.0-alpha.2")
2929
```
3030

3131
#### Maven
@@ -34,7 +34,7 @@ implementation("com.withorb.api:orb-java:0.1.0-alpha.1")
3434
<dependency>
3535
<groupId>com.withorb.api</groupId>
3636
<artifactId>orb-java</artifactId>
37-
<version>0.1.0-alpha.1</version>
37+
<version>0.1.0-alpha.2</version>
3838
</dependency>
3939
```
4040

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44

55
allprojects {
66
group = "com.withorb.api"
7-
version = "0.1.0-alpha.1" // x-release-please-version
7+
version = "0.1.0-alpha.2" // x-release-please-version
88
}
99

1010

orb-java-core/src/main/kotlin/com/withorb/api/core/ClientOptions.kt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ private constructor(
1818
@get:JvmName("apiKey") val apiKey: String,
1919
@get:JvmName("webhookSecret") val webhookSecret: String?,
2020
@get:JvmName("headers") val headers: ListMultimap<String, String>,
21+
@get:JvmName("queryParams") val queryParams: ListMultimap<String, String>,
2122
@get:JvmName("responseValidation") val responseValidation: Boolean,
2223
) {
2324

@@ -37,6 +38,7 @@ private constructor(
3738
private var clock: Clock = Clock.systemUTC()
3839
private var baseUrl: String = PRODUCTION_URL
3940
private var headers: MutableMap<String, MutableList<String>> = mutableMapOf()
41+
private var queryParams: MutableMap<String, MutableList<String>> = mutableMapOf()
4042
private var responseValidation: Boolean = false
4143
private var maxRetries: Int = 2
4244
private var apiKey: String? = null
@@ -69,6 +71,25 @@ private constructor(
6971

7072
fun removeHeader(name: String) = apply { this.headers.put(name, mutableListOf()) }
7173

74+
fun queryParams(queryParams: Map<String, Iterable<String>>) = apply {
75+
this.queryParams.clear()
76+
putAllQueryParams(queryParams)
77+
}
78+
79+
fun putQueryParam(name: String, value: String) = apply {
80+
this.queryParams.getOrPut(name) { mutableListOf() }.add(value)
81+
}
82+
83+
fun putQueryParams(name: String, values: Iterable<String>) = apply {
84+
this.queryParams.getOrPut(name) { mutableListOf() }.addAll(values)
85+
}
86+
87+
fun putAllQueryParams(queryParams: Map<String, Iterable<String>>) = apply {
88+
queryParams.forEach(this::putQueryParams)
89+
}
90+
91+
fun removeQueryParam(name: String) = apply { this.queryParams.put(name, mutableListOf()) }
92+
7293
fun responseValidation(responseValidation: Boolean) = apply {
7394
this.responseValidation = responseValidation
7495
}
@@ -89,6 +110,7 @@ private constructor(
89110
checkNotNull(apiKey) { "`apiKey` is required but was not set" }
90111

91112
val headers = ArrayListMultimap.create<String, String>()
113+
val queryParams = ArrayListMultimap.create<String, String>()
92114
headers.put("X-Stainless-Lang", "java")
93115
headers.put("X-Stainless-Arch", getOsArch())
94116
headers.put("X-Stainless-OS", getOsName())
@@ -99,6 +121,7 @@ private constructor(
99121
headers.put("Authorization", "Bearer ${apiKey}")
100122
}
101123
this.headers.forEach(headers::replaceValues)
124+
this.queryParams.forEach(queryParams::replaceValues)
102125

103126
return ClientOptions(
104127
RetryingHttpClient.builder()
@@ -113,6 +136,7 @@ private constructor(
113136
apiKey!!,
114137
webhookSecret,
115138
headers.toUnmodifiable(),
139+
queryParams.toUnmodifiable(),
116140
responseValidation,
117141
)
118142
}

orb-java-core/src/main/kotlin/com/withorb/api/models/Coupon.kt

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,29 @@ import java.util.Objects
2929
import java.util.Optional
3030

3131
/**
32-
* A coupon represents a reusable discount configuration, and have an attached redemption code that
33-
* can be issued to your end users. Coupons are most often used in self-serve signup or upgrade
34-
* flows in your checkout experience or billing portal.
32+
* A coupon represents a reusable discount configuration that can be applied either as a fixed
33+
* currency amount or as a percentage of the usage cost. Coupons are activated using a redemption
34+
* code, which applies the discount to a subscription or invoice. The duration of a coupon
35+
* determines how long it remains available for use by end users.
3536
*
36-
* To redeem a coupon, pass the `redemption_code` property in the
37-
* [create subscription](create-subscription.api.mdx) or
38-
* [schedule plan change](schedule-plan-change.api.mdx) request.
37+
* ## How to use coupons
38+
*
39+
* Coupons can be created using the Orb dashboard or programmatically through the API. Once a coupon
40+
* is created, it can be managed and applied programmatically via the API. To redeem a coupon, use
41+
* the `redemption_code` property when [creating a subscription](create-subscription.api.mdx) or
42+
* when scheduling a [plan change](schedule-plan-change.api.mdx).
43+
*
44+
* ## When to use coupons
45+
*
46+
* A common use case for coupons is through self-serve signup or upgrade flows in your checkout
47+
* experience or billing portal. Coupons can also be used as one-off to incentivize use for custom
48+
* agreements.
49+
*
50+
* Coupons are effective when launching new features and encouraging existing users to upgrade to a
51+
* higher tier. For example, you could create a coupon code "UPGRADE20" that offers a 20% discount
52+
* on the first month of the new plan. This code can be applied during the upgrade process in your
53+
* billing portal, making it straightforward for users to benefit from the new features at a reduced
54+
* cost.
3955
*/
4056
@JsonDeserialize(builder = Coupon.Builder::class)
4157
@NoAutoDetect

orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListByExternalIdParams.kt

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ constructor(
1414
private val externalCustomerId: String,
1515
private val currency: String?,
1616
private val cursor: String?,
17+
private val includeAllBlocks: Boolean?,
1718
private val limit: Long?,
1819
private val additionalQueryParams: Map<String, List<String>>,
1920
private val additionalHeaders: Map<String, List<String>>,
@@ -26,13 +27,16 @@ constructor(
2627

2728
fun cursor(): Optional<String> = Optional.ofNullable(cursor)
2829

30+
fun includeAllBlocks(): Optional<Boolean> = Optional.ofNullable(includeAllBlocks)
31+
2932
fun limit(): Optional<Long> = Optional.ofNullable(limit)
3033

3134
@JvmSynthetic
3235
internal fun getQueryParams(): Map<String, List<String>> {
3336
val params = mutableMapOf<String, List<String>>()
3437
this.currency?.let { params.put("currency", listOf(it.toString())) }
3538
this.cursor?.let { params.put("cursor", listOf(it.toString())) }
39+
this.includeAllBlocks?.let { params.put("include_all_blocks", listOf(it.toString())) }
3640
this.limit?.let { params.put("limit", listOf(it.toString())) }
3741
params.putAll(additionalQueryParams)
3842
return params.toUnmodifiable()
@@ -62,6 +66,7 @@ constructor(
6266
this.externalCustomerId == other.externalCustomerId &&
6367
this.currency == other.currency &&
6468
this.cursor == other.cursor &&
69+
this.includeAllBlocks == other.includeAllBlocks &&
6570
this.limit == other.limit &&
6671
this.additionalQueryParams == other.additionalQueryParams &&
6772
this.additionalHeaders == other.additionalHeaders &&
@@ -73,6 +78,7 @@ constructor(
7378
externalCustomerId,
7479
currency,
7580
cursor,
81+
includeAllBlocks,
7682
limit,
7783
additionalQueryParams,
7884
additionalHeaders,
@@ -81,7 +87,7 @@ constructor(
8187
}
8288

8389
override fun toString() =
84-
"CustomerCreditListByExternalIdParams{externalCustomerId=$externalCustomerId, currency=$currency, cursor=$cursor, limit=$limit, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}"
90+
"CustomerCreditListByExternalIdParams{externalCustomerId=$externalCustomerId, currency=$currency, cursor=$cursor, includeAllBlocks=$includeAllBlocks, limit=$limit, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}"
8591

8692
fun toBuilder() = Builder().from(this)
8793

@@ -96,6 +102,7 @@ constructor(
96102
private var externalCustomerId: String? = null
97103
private var currency: String? = null
98104
private var cursor: String? = null
105+
private var includeAllBlocks: Boolean? = null
99106
private var limit: Long? = null
100107
private var additionalQueryParams: MutableMap<String, MutableList<String>> = mutableMapOf()
101108
private var additionalHeaders: MutableMap<String, MutableList<String>> = mutableMapOf()
@@ -108,6 +115,7 @@ constructor(
108115
this.externalCustomerId = customerCreditListByExternalIdParams.externalCustomerId
109116
this.currency = customerCreditListByExternalIdParams.currency
110117
this.cursor = customerCreditListByExternalIdParams.cursor
118+
this.includeAllBlocks = customerCreditListByExternalIdParams.includeAllBlocks
111119
this.limit = customerCreditListByExternalIdParams.limit
112120
additionalQueryParams(customerCreditListByExternalIdParams.additionalQueryParams)
113121
additionalHeaders(customerCreditListByExternalIdParams.additionalHeaders)
@@ -127,6 +135,11 @@ constructor(
127135
*/
128136
fun cursor(cursor: String) = apply { this.cursor = cursor }
129137

138+
/** Include all blocks, not just active ones. */
139+
fun includeAllBlocks(includeAllBlocks: Boolean) = apply {
140+
this.includeAllBlocks = includeAllBlocks
141+
}
142+
130143
/** The number of items to fetch. Defaults to 20. */
131144
fun limit(limit: Long) = apply { this.limit = limit }
132145

@@ -191,6 +204,7 @@ constructor(
191204
},
192205
currency,
193206
cursor,
207+
includeAllBlocks,
194208
limit,
195209
additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(),
196210
additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(),

orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListByExternalIdResponse.kt

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ private constructor(
2929
private val expiryDate: JsonField<OffsetDateTime>,
3030
private val perUnitCostBasis: JsonField<String>,
3131
private val status: JsonField<Status>,
32+
private val maximumInitialBalance: JsonField<Double>,
3233
private val additionalProperties: Map<String, JsonValue>,
3334
) {
3435

@@ -51,6 +52,9 @@ private constructor(
5152

5253
fun status(): Status = status.getRequired("status")
5354

55+
fun maximumInitialBalance(): Optional<Double> =
56+
Optional.ofNullable(maximumInitialBalance.getNullable("maximum_initial_balance"))
57+
5458
@JsonProperty("id") @ExcludeMissing fun _id() = id
5559

5660
@JsonProperty("balance") @ExcludeMissing fun _balance() = balance
@@ -63,6 +67,10 @@ private constructor(
6367

6468
@JsonProperty("status") @ExcludeMissing fun _status() = status
6569

70+
@JsonProperty("maximum_initial_balance")
71+
@ExcludeMissing
72+
fun _maximumInitialBalance() = maximumInitialBalance
73+
6674
@JsonAnyGetter
6775
@ExcludeMissing
6876
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
@@ -75,6 +83,7 @@ private constructor(
7583
expiryDate()
7684
perUnitCostBasis()
7785
status()
86+
maximumInitialBalance()
7887
validated = true
7988
}
8089
}
@@ -93,6 +102,7 @@ private constructor(
93102
this.expiryDate == other.expiryDate &&
94103
this.perUnitCostBasis == other.perUnitCostBasis &&
95104
this.status == other.status &&
105+
this.maximumInitialBalance == other.maximumInitialBalance &&
96106
this.additionalProperties == other.additionalProperties
97107
}
98108

@@ -106,14 +116,15 @@ private constructor(
106116
expiryDate,
107117
perUnitCostBasis,
108118
status,
119+
maximumInitialBalance,
109120
additionalProperties,
110121
)
111122
}
112123
return hashCode
113124
}
114125

115126
override fun toString() =
116-
"CustomerCreditListByExternalIdResponse{id=$id, balance=$balance, effectiveDate=$effectiveDate, expiryDate=$expiryDate, perUnitCostBasis=$perUnitCostBasis, status=$status, additionalProperties=$additionalProperties}"
127+
"CustomerCreditListByExternalIdResponse{id=$id, balance=$balance, effectiveDate=$effectiveDate, expiryDate=$expiryDate, perUnitCostBasis=$perUnitCostBasis, status=$status, maximumInitialBalance=$maximumInitialBalance, additionalProperties=$additionalProperties}"
117128

118129
companion object {
119130

@@ -128,6 +139,7 @@ private constructor(
128139
private var expiryDate: JsonField<OffsetDateTime> = JsonMissing.of()
129140
private var perUnitCostBasis: JsonField<String> = JsonMissing.of()
130141
private var status: JsonField<Status> = JsonMissing.of()
142+
private var maximumInitialBalance: JsonField<Double> = JsonMissing.of()
131143
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
132144

133145
@JvmSynthetic
@@ -140,6 +152,8 @@ private constructor(
140152
this.expiryDate = customerCreditListByExternalIdResponse.expiryDate
141153
this.perUnitCostBasis = customerCreditListByExternalIdResponse.perUnitCostBasis
142154
this.status = customerCreditListByExternalIdResponse.status
155+
this.maximumInitialBalance =
156+
customerCreditListByExternalIdResponse.maximumInitialBalance
143157
additionalProperties(customerCreditListByExternalIdResponse.additionalProperties)
144158
}
145159

@@ -185,6 +199,15 @@ private constructor(
185199
@ExcludeMissing
186200
fun status(status: JsonField<Status>) = apply { this.status = status }
187201

202+
fun maximumInitialBalance(maximumInitialBalance: Double) =
203+
maximumInitialBalance(JsonField.of(maximumInitialBalance))
204+
205+
@JsonProperty("maximum_initial_balance")
206+
@ExcludeMissing
207+
fun maximumInitialBalance(maximumInitialBalance: JsonField<Double>) = apply {
208+
this.maximumInitialBalance = maximumInitialBalance
209+
}
210+
188211
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
189212
this.additionalProperties.clear()
190213
this.additionalProperties.putAll(additionalProperties)
@@ -207,6 +230,7 @@ private constructor(
207230
expiryDate,
208231
perUnitCostBasis,
209232
status,
233+
maximumInitialBalance,
210234
additionalProperties.toUnmodifiable(),
211235
)
212236
}

0 commit comments

Comments
 (0)