Skip to content

Commit 94a4abb

Browse files
Merge pull request #85 from OneBusAway/release-please--branches--main--changes--next
release: 0.1.0-alpha.29
2 parents 589e149 + a9d3e77 commit 94a4abb

File tree

7 files changed

+92
-28
lines changed

7 files changed

+92
-28
lines changed

.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.28"
2+
".": "0.1.0-alpha.29"
33
}

CHANGELOG.md

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

3+
## 0.1.0-alpha.29 (2025-07-22)
4+
5+
Full Changelog: [v0.1.0-alpha.28...v0.1.0-alpha.29](https://github.com/OneBusAway/java-sdk/compare/v0.1.0-alpha.28...v0.1.0-alpha.29)
6+
7+
### Features
8+
9+
* **client:** add `{QueryParams,Headers}#put(String, JsonValue)` methods ([6994f02](https://github.com/OneBusAway/java-sdk/commit/6994f026a6c7abb90a0bfec9ebb213f51dcf9347))
10+
* **client:** allow configuring env via system properties ([8f26ee5](https://github.com/OneBusAway/java-sdk/commit/8f26ee53d24819972943490215990c79d929b2fd))
11+
312
## 0.1.0-alpha.28 (2025-07-19)
413

514
Full Changelog: [v0.1.0-alpha.27...v0.1.0-alpha.28](https://github.com/OneBusAway/java-sdk/compare/v0.1.0-alpha.27...v0.1.0-alpha.28)

README.md

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

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

5-
[![Maven Central](https://img.shields.io/maven-central/v/org.onebusaway/onebusaway-sdk-java)](https://central.sonatype.com/artifact/org.onebusaway/onebusaway-sdk-java/0.1.0-alpha.28)
6-
[![javadoc](https://javadoc.io/badge2/org.onebusaway/onebusaway-sdk-java/0.1.0-alpha.28/javadoc.svg)](https://javadoc.io/doc/org.onebusaway/onebusaway-sdk-java/0.1.0-alpha.28)
5+
[![Maven Central](https://img.shields.io/maven-central/v/org.onebusaway/onebusaway-sdk-java)](https://central.sonatype.com/artifact/org.onebusaway/onebusaway-sdk-java/0.1.0-alpha.29)
6+
[![javadoc](https://javadoc.io/badge2/org.onebusaway/onebusaway-sdk-java/0.1.0-alpha.29/javadoc.svg)](https://javadoc.io/doc/org.onebusaway/onebusaway-sdk-java/0.1.0-alpha.29)
77

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

@@ -15,7 +15,7 @@ It is generated with [Stainless](https://www.stainless.com/).
1515

1616
<!-- x-release-please-start-version -->
1717

18-
The REST API documentation can be found on [developer.onebusaway.org](https://developer.onebusaway.org). Javadocs are available on [javadoc.io](https://javadoc.io/doc/org.onebusaway/onebusaway-sdk-java/0.1.0-alpha.28).
18+
The REST API documentation can be found on [developer.onebusaway.org](https://developer.onebusaway.org). Javadocs are available on [javadoc.io](https://javadoc.io/doc/org.onebusaway/onebusaway-sdk-java/0.1.0-alpha.29).
1919

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

@@ -26,7 +26,7 @@ The REST API documentation can be found on [developer.onebusaway.org](https://de
2626
### Gradle
2727

2828
```kotlin
29-
implementation("org.onebusaway:onebusaway-sdk-java:0.1.0-alpha.28")
29+
implementation("org.onebusaway:onebusaway-sdk-java:0.1.0-alpha.29")
3030
```
3131

3232
### Maven
@@ -35,7 +35,7 @@ implementation("org.onebusaway:onebusaway-sdk-java:0.1.0-alpha.28")
3535
<dependency>
3636
<groupId>org.onebusaway</groupId>
3737
<artifactId>onebusaway-sdk-java</artifactId>
38-
<version>0.1.0-alpha.28</version>
38+
<version>0.1.0-alpha.29</version>
3939
</dependency>
4040
```
4141

@@ -53,21 +53,23 @@ import org.onebusaway.client.okhttp.OnebusawaySdkOkHttpClient;
5353
import org.onebusaway.models.currenttime.CurrentTimeRetrieveParams;
5454
import org.onebusaway.models.currenttime.CurrentTimeRetrieveResponse;
5555

56-
// Configures using the `ONEBUSAWAY_API_KEY` and `ONEBUSAWAY_SDK_BASE_URL` environment variables
56+
// Configures using the `onebusawaysdk.onebusawayApiKey` and `onebusawaysdk.baseUrl` system properties
57+
// Or configures using the `ONEBUSAWAY_API_KEY` and `ONEBUSAWAY_SDK_BASE_URL` environment variables
5758
OnebusawaySdkClient client = OnebusawaySdkOkHttpClient.fromEnv();
5859

5960
CurrentTimeRetrieveResponse currentTime = client.currentTime().retrieve();
6061
```
6162

6263
## Client configuration
6364

64-
Configure the client using environment variables:
65+
Configure the client using system properties or environment variables:
6566

6667
```java
6768
import org.onebusaway.client.OnebusawaySdkClient;
6869
import org.onebusaway.client.okhttp.OnebusawaySdkOkHttpClient;
6970

70-
// Configures using the `ONEBUSAWAY_API_KEY` and `ONEBUSAWAY_SDK_BASE_URL` environment variables
71+
// Configures using the `onebusawaysdk.onebusawayApiKey` and `onebusawaysdk.baseUrl` system properties
72+
// Or configures using the `ONEBUSAWAY_API_KEY` and `ONEBUSAWAY_SDK_BASE_URL` environment variables
7173
OnebusawaySdkClient client = OnebusawaySdkOkHttpClient.fromEnv();
7274
```
7375

@@ -89,18 +91,21 @@ import org.onebusaway.client.OnebusawaySdkClient;
8991
import org.onebusaway.client.okhttp.OnebusawaySdkOkHttpClient;
9092

9193
OnebusawaySdkClient client = OnebusawaySdkOkHttpClient.builder()
92-
// Configures using the `ONEBUSAWAY_API_KEY` and `ONEBUSAWAY_SDK_BASE_URL` environment variables
94+
// Configures using the `onebusawaysdk.onebusawayApiKey` and `onebusawaysdk.baseUrl` system properties
95+
Or configures using the `ONEBUSAWAY_API_KEY` and `ONEBUSAWAY_SDK_BASE_URL` environment variables
9396
.fromEnv()
9497
.apiKey("My API Key")
9598
.build();
9699
```
97100

98101
See this table for the available options:
99102

100-
| Setter | Environment variable | Required | Default value |
101-
| --------- | ------------------------- | -------- | ----------------------------------------- |
102-
| `apiKey` | `ONEBUSAWAY_API_KEY` | true | - |
103-
| `baseUrl` | `ONEBUSAWAY_SDK_BASE_URL` | true | `"https://api.pugetsound.onebusaway.org"` |
103+
| Setter | System property | Environment variable | Required | Default value |
104+
| --------- | -------------------------------- | ------------------------- | -------- | ----------------------------------------- |
105+
| `apiKey` | `onebusawaysdk.onebusawayApiKey` | `ONEBUSAWAY_API_KEY` | true | - |
106+
| `baseUrl` | `onebusawaysdk.baseUrl` | `ONEBUSAWAY_SDK_BASE_URL` | true | `"https://api.pugetsound.onebusaway.org"` |
107+
108+
System properties take precedence over environment variables.
104109

105110
> [!TIP]
106111
> Don't create more than one client in the same application. Each client has a connection pool and
@@ -146,7 +151,8 @@ import org.onebusaway.client.okhttp.OnebusawaySdkOkHttpClient;
146151
import org.onebusaway.models.currenttime.CurrentTimeRetrieveParams;
147152
import org.onebusaway.models.currenttime.CurrentTimeRetrieveResponse;
148153

149-
// Configures using the `ONEBUSAWAY_API_KEY` and `ONEBUSAWAY_SDK_BASE_URL` environment variables
154+
// Configures using the `onebusawaysdk.onebusawayApiKey` and `onebusawaysdk.baseUrl` system properties
155+
// Or configures using the `ONEBUSAWAY_API_KEY` and `ONEBUSAWAY_SDK_BASE_URL` environment variables
150156
OnebusawaySdkClient client = OnebusawaySdkOkHttpClient.fromEnv();
151157

152158
CompletableFuture<CurrentTimeRetrieveResponse> currentTime = client.async().currentTime().retrieve();
@@ -161,7 +167,8 @@ import org.onebusaway.client.okhttp.OnebusawaySdkOkHttpClientAsync;
161167
import org.onebusaway.models.currenttime.CurrentTimeRetrieveParams;
162168
import org.onebusaway.models.currenttime.CurrentTimeRetrieveResponse;
163169

164-
// Configures using the `ONEBUSAWAY_API_KEY` and `ONEBUSAWAY_SDK_BASE_URL` environment variables
170+
// Configures using the `onebusawaysdk.onebusawayApiKey` and `onebusawaysdk.baseUrl` system properties
171+
// Or configures using the `ONEBUSAWAY_API_KEY` and `ONEBUSAWAY_SDK_BASE_URL` environment variables
165172
OnebusawaySdkClientAsync client = OnebusawaySdkOkHttpClientAsync.fromEnv();
166173

167174
CompletableFuture<CurrentTimeRetrieveResponse> currentTime = client.currentTime().retrieve();

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ repositories {
88

99
allprojects {
1010
group = "org.onebusaway"
11-
version = "0.1.0-alpha.28" // x-release-please-version
11+
version = "0.1.0-alpha.29" // x-release-please-version
1212
}
1313

1414
subprojects {

onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/core/ClientOptions.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,12 @@ private constructor(
220220
fun timeout(): Timeout = timeout
221221

222222
fun fromEnv() = apply {
223-
System.getenv("ONEBUSAWAY_SDK_BASE_URL")?.let { baseUrl(it) }
224-
System.getenv("ONEBUSAWAY_API_KEY")?.let { apiKey(it) }
223+
(System.getProperty("onebusawaysdk.baseUrl")
224+
?: System.getenv("ONEBUSAWAY_SDK_BASE_URL"))
225+
?.let { baseUrl(it) }
226+
(System.getProperty("onebusawaysdk.onebusawayApiKey")
227+
?: System.getenv("ONEBUSAWAY_API_KEY"))
228+
?.let { apiKey(it) }
225229
}
226230

227231
/**

onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/core/http/Headers.kt

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
1+
// File generated from our OpenAPI spec by Stainless.
2+
13
package org.onebusaway.core.http
24

35
import java.util.TreeMap
6+
import org.onebusaway.core.JsonArray
7+
import org.onebusaway.core.JsonBoolean
8+
import org.onebusaway.core.JsonMissing
9+
import org.onebusaway.core.JsonNull
10+
import org.onebusaway.core.JsonNumber
11+
import org.onebusaway.core.JsonObject
12+
import org.onebusaway.core.JsonString
13+
import org.onebusaway.core.JsonValue
414
import org.onebusaway.core.toImmutable
515

616
class Headers
@@ -28,6 +38,19 @@ private constructor(
2838
TreeMap(String.CASE_INSENSITIVE_ORDER)
2939
private var size: Int = 0
3040

41+
fun put(name: String, value: JsonValue): Builder = apply {
42+
when (value) {
43+
is JsonMissing,
44+
is JsonNull -> {}
45+
is JsonBoolean -> put(name, value.value.toString())
46+
is JsonNumber -> put(name, value.value.toString())
47+
is JsonString -> put(name, value.value)
48+
is JsonArray -> value.values.forEach { put(name, it) }
49+
is JsonObject ->
50+
value.values.forEach { (nestedName, value) -> put("$name.$nestedName", value) }
51+
}
52+
}
53+
3154
fun put(name: String, value: String) = apply {
3255
map.getOrPut(name) { mutableListOf() }.add(value)
3356
size++
@@ -41,15 +64,6 @@ private constructor(
4164
headers.names().forEach { put(it, headers.values(it)) }
4265
}
4366

44-
fun remove(name: String) = apply { size -= map.remove(name).orEmpty().size }
45-
46-
fun removeAll(names: Set<String>) = apply { names.forEach(::remove) }
47-
48-
fun clear() = apply {
49-
map.clear()
50-
size = 0
51-
}
52-
5367
fun replace(name: String, value: String) = apply {
5468
remove(name)
5569
put(name, value)
@@ -68,6 +82,15 @@ private constructor(
6882
headers.names().forEach { replace(it, headers.values(it)) }
6983
}
7084

85+
fun remove(name: String) = apply { size -= map.remove(name).orEmpty().size }
86+
87+
fun removeAll(names: Set<String>) = apply { names.forEach(::remove) }
88+
89+
fun clear() = apply {
90+
map.clear()
91+
size = 0
92+
}
93+
7194
fun build() =
7295
Headers(
7396
map.mapValuesTo(TreeMap(String.CASE_INSENSITIVE_ORDER)) { (_, values) ->

onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/core/http/QueryParams.kt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
package org.onebusaway.core.http
44

5+
import org.onebusaway.core.JsonArray
6+
import org.onebusaway.core.JsonBoolean
7+
import org.onebusaway.core.JsonMissing
8+
import org.onebusaway.core.JsonNull
9+
import org.onebusaway.core.JsonNumber
10+
import org.onebusaway.core.JsonObject
11+
import org.onebusaway.core.JsonString
12+
import org.onebusaway.core.JsonValue
513
import org.onebusaway.core.toImmutable
614

715
class QueryParams
@@ -28,6 +36,19 @@ private constructor(
2836
private val map: MutableMap<String, MutableList<String>> = mutableMapOf()
2937
private var size: Int = 0
3038

39+
fun put(key: String, value: JsonValue): Builder = apply {
40+
when (value) {
41+
is JsonMissing,
42+
is JsonNull -> {}
43+
is JsonBoolean -> put(key, value.value.toString())
44+
is JsonNumber -> put(key, value.value.toString())
45+
is JsonString -> put(key, value.value)
46+
is JsonArray -> value.values.forEach { put(key, it) }
47+
is JsonObject ->
48+
value.values.forEach { (nestedKey, value) -> put("$key[$nestedKey]", value) }
49+
}
50+
}
51+
3152
fun put(key: String, value: String) = apply {
3253
map.getOrPut(key) { mutableListOf() }.add(value)
3354
size++

0 commit comments

Comments
 (0)