diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index ef24b0c..1d05e3b 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -7,12 +7,17 @@ on:
- 'integrated/**'
- 'stl-preview-head/**'
- 'stl-preview-base/**'
+ pull_request:
+ branches-ignore:
+ - 'stl-preview-head/**'
+ - 'stl-preview-base/**'
jobs:
lint:
timeout-minutes: 10
name: lint
runs-on: ${{ github.repository == 'stainless-sdks/open-transit-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
+ if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
steps:
- uses: actions/checkout@v4
@@ -35,6 +40,7 @@ jobs:
timeout-minutes: 10
name: test
runs-on: ${{ github.repository == 'stainless-sdks/open-transit-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
+ if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
steps:
- uses: actions/checkout@v4
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 380b6f9..3188ced 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.1.0-alpha.24"
+ ".": "0.1.0-alpha.25"
}
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ae94241..b1fe952 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,13 @@
# Changelog
+## 0.1.0-alpha.25 (2025-07-07)
+
+Full Changelog: [v0.1.0-alpha.24...v0.1.0-alpha.25](https://github.com/OneBusAway/java-sdk/compare/v0.1.0-alpha.24...v0.1.0-alpha.25)
+
+### Chores
+
+* **internal:** version bump ([97b8b21](https://github.com/OneBusAway/java-sdk/commit/97b8b21fb686dbf3ec55c42b57a69353a14ee6e8))
+
## 0.1.0-alpha.24 (2025-07-07)
Full Changelog: [v0.1.0-alpha.23...v0.1.0-alpha.24](https://github.com/OneBusAway/java-sdk/compare/v0.1.0-alpha.23...v0.1.0-alpha.24)
diff --git a/README.md b/README.md
index a9ef60f..1aa8aef 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,8 @@
-[](https://central.sonatype.com/artifact/org.onebusaway/onebusaway-sdk-java/0.1.0-alpha.24)
-[](https://javadoc.io/doc/org.onebusaway/onebusaway-sdk-java/0.1.0-alpha.24)
+[](https://central.sonatype.com/artifact/org.onebusaway/onebusaway-sdk-java/0.1.0-alpha.25)
+[](https://javadoc.io/doc/org.onebusaway/onebusaway-sdk-java/0.1.0-alpha.25)
@@ -15,7 +15,7 @@ It is generated with [Stainless](https://www.stainless.com/).
-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.24).
+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.25).
@@ -26,7 +26,7 @@ The REST API documentation can be found on [developer.onebusaway.org](https://de
### Gradle
```kotlin
-implementation("org.onebusaway:onebusaway-sdk-java:0.1.0-alpha.24")
+implementation("org.onebusaway:onebusaway-sdk-java:0.1.0-alpha.25")
```
### Maven
@@ -35,7 +35,7 @@ implementation("org.onebusaway:onebusaway-sdk-java:0.1.0-alpha.24")
org.onebusaway
onebusaway-sdk-java
- 0.1.0-alpha.24
+ 0.1.0-alpha.25
```
@@ -106,6 +106,21 @@ See this table for the available options:
> Don't create more than one client in the same application. Each client has a connection pool and
> thread pools, which are more efficient to share between requests.
+### Modifying configuration
+
+To temporarily use a modified client configuration, while reusing the same connection and thread pools, call `withOptions()` on any client or service:
+
+```java
+import org.onebusaway.client.OnebusawaySdkClient;
+
+OnebusawaySdkClient clientWithOptions = client.withOptions(optionsBuilder -> {
+ optionsBuilder.baseUrl("https://example.com");
+ optionsBuilder.maxRetries(42);
+});
+```
+
+The `withOptions()` method does not affect the original client or service.
+
## Requests and responses
To send a request to the Onebusaway SDK API, build an instance of some `Params` class and pass it to the corresponding client method. When the response is received, it will be deserialized into an instance of a Java class.
diff --git a/SECURITY.md b/SECURITY.md
index 8be07dc..8b844a0 100644
--- a/SECURITY.md
+++ b/SECURITY.md
@@ -16,11 +16,11 @@ before making any information public.
## Reporting Non-SDK Related Security Issues
If you encounter security issues that are not directly related to SDKs but pertain to the services
-or products provided by Onebusaway SDK please follow the respective company's security reporting guidelines.
+or products provided by Onebusaway SDK, please follow the respective company's security reporting guidelines.
### Onebusaway SDK Terms and Policies
-Please contact info@onebusaway.org for any questions or concerns regarding security of our services.
+Please contact info@onebusaway.org for any questions or concerns regarding the security of our services.
---
diff --git a/bin/check-release-environment b/bin/check-release-environment
index 7dd019c..3a6a7b4 100644
--- a/bin/check-release-environment
+++ b/bin/check-release-environment
@@ -3,19 +3,19 @@
errors=()
if [ -z "${SONATYPE_USERNAME}" ]; then
- errors+=("The ONEBUSAWAY_SDK_SONATYPE_USERNAME secret has not been set. Please set it in either this repository's secrets or your organization secrets")
+ errors+=("The SONATYPE_USERNAME secret has not been set. Please set it in either this repository's secrets or your organization secrets")
fi
if [ -z "${SONATYPE_PASSWORD}" ]; then
- errors+=("The ONEBUSAWAY_SDK_SONATYPE_PASSWORD secret has not been set. Please set it in either this repository's secrets or your organization secrets")
+ errors+=("The SONATYPE_PASSWORD secret has not been set. Please set it in either this repository's secrets or your organization secrets")
fi
if [ -z "${GPG_SIGNING_KEY}" ]; then
- errors+=("The ONEBUSAWAY_SDK_SONATYPE_GPG_SIGNING_KEY secret has not been set. Please set it in either this repository's secrets or your organization secrets")
+ errors+=("The GPG_SIGNING_KEY secret has not been set. Please set it in either this repository's secrets or your organization secrets")
fi
if [ -z "${GPG_SIGNING_PASSWORD}" ]; then
- errors+=("The ONEBUSAWAY_SDK_SONATYPE_GPG_SIGNING_PASSWORD secret has not been set. Please set it in either this repository's secrets or your organization secrets")
+ errors+=("The GPG_SIGNING_PASSWORD secret has not been set. Please set it in either this repository's secrets or your organization secrets")
fi
lenErrors=${#errors[@]}
diff --git a/build.gradle.kts b/build.gradle.kts
index a036b20..852ee9e 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -8,7 +8,7 @@ repositories {
allprojects {
group = "org.onebusaway"
- version = "0.1.0-alpha.24" // x-release-please-version
+ version = "0.1.0-alpha.25" // x-release-please-version
}
subprojects {
diff --git a/onebusaway-sdk-java-client-okhttp/src/main/kotlin/org/onebusaway/client/okhttp/OkHttpClient.kt b/onebusaway-sdk-java-client-okhttp/src/main/kotlin/org/onebusaway/client/okhttp/OkHttpClient.kt
index 32d8d5e..c748bbb 100644
--- a/onebusaway-sdk-java-client-okhttp/src/main/kotlin/org/onebusaway/client/okhttp/OkHttpClient.kt
+++ b/onebusaway-sdk-java-client-okhttp/src/main/kotlin/org/onebusaway/client/okhttp/OkHttpClient.kt
@@ -7,7 +7,6 @@ import java.time.Duration
import java.util.concurrent.CompletableFuture
import okhttp3.Call
import okhttp3.Callback
-import okhttp3.HttpUrl
import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.Interceptor
import okhttp3.MediaType
@@ -20,7 +19,6 @@ import okhttp3.logging.HttpLoggingInterceptor
import okio.BufferedSink
import org.onebusaway.core.RequestOptions
import org.onebusaway.core.Timeout
-import org.onebusaway.core.checkRequired
import org.onebusaway.core.http.Headers
import org.onebusaway.core.http.HttpClient
import org.onebusaway.core.http.HttpMethod
@@ -29,8 +27,7 @@ import org.onebusaway.core.http.HttpRequestBody
import org.onebusaway.core.http.HttpResponse
import org.onebusaway.errors.OnebusawaySdkIoException
-class OkHttpClient
-private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val baseUrl: HttpUrl) :
+class OkHttpClient private constructor(private val okHttpClient: okhttp3.OkHttpClient) :
HttpClient {
override fun execute(request: HttpRequest, requestOptions: RequestOptions): HttpResponse {
@@ -142,11 +139,7 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val
}
private fun HttpRequest.toUrl(): String {
- url?.let {
- return it
- }
-
- val builder = baseUrl.newBuilder()
+ val builder = baseUrl.toHttpUrl().newBuilder()
pathSegments.forEach(builder::addPathSegment)
queryParams.keys().forEach { key ->
queryParams.values(key).forEach { builder.addQueryParameter(key, it) }
@@ -196,12 +189,9 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val
class Builder internal constructor() {
- private var baseUrl: HttpUrl? = null
private var timeout: Timeout = Timeout.default()
private var proxy: Proxy? = null
- fun baseUrl(baseUrl: String) = apply { this.baseUrl = baseUrl.toHttpUrl() }
-
fun timeout(timeout: Timeout) = apply { this.timeout = timeout }
fun timeout(timeout: Duration) = timeout(Timeout.builder().request(timeout).build())
@@ -216,8 +206,12 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val
.writeTimeout(timeout.write())
.callTimeout(timeout.request())
.proxy(proxy)
- .build(),
- checkRequired("baseUrl", baseUrl),
+ .build()
+ .apply {
+ // We usually make all our requests to the same host so it makes sense to
+ // raise the per-host limit to the overall limit.
+ dispatcher.maxRequestsPerHost = dispatcher.maxRequests
+ }
)
}
}
diff --git a/onebusaway-sdk-java-client-okhttp/src/main/kotlin/org/onebusaway/client/okhttp/OnebusawaySdkOkHttpClient.kt b/onebusaway-sdk-java-client-okhttp/src/main/kotlin/org/onebusaway/client/okhttp/OnebusawaySdkOkHttpClient.kt
index 1c947e1..feeb9a0 100644
--- a/onebusaway-sdk-java-client-okhttp/src/main/kotlin/org/onebusaway/client/okhttp/OnebusawaySdkOkHttpClient.kt
+++ b/onebusaway-sdk-java-client-okhttp/src/main/kotlin/org/onebusaway/client/okhttp/OnebusawaySdkOkHttpClient.kt
@@ -163,13 +163,7 @@ class OnebusawaySdkOkHttpClient private constructor() {
fun build(): OnebusawaySdkClient =
OnebusawaySdkClientImpl(
clientOptions
- .httpClient(
- OkHttpClient.builder()
- .baseUrl(clientOptions.baseUrl())
- .timeout(timeout)
- .proxy(proxy)
- .build()
- )
+ .httpClient(OkHttpClient.builder().timeout(timeout).proxy(proxy).build())
.build()
)
}
diff --git a/onebusaway-sdk-java-client-okhttp/src/main/kotlin/org/onebusaway/client/okhttp/OnebusawaySdkOkHttpClientAsync.kt b/onebusaway-sdk-java-client-okhttp/src/main/kotlin/org/onebusaway/client/okhttp/OnebusawaySdkOkHttpClientAsync.kt
index 40b84fd..7a64e64 100644
--- a/onebusaway-sdk-java-client-okhttp/src/main/kotlin/org/onebusaway/client/okhttp/OnebusawaySdkOkHttpClientAsync.kt
+++ b/onebusaway-sdk-java-client-okhttp/src/main/kotlin/org/onebusaway/client/okhttp/OnebusawaySdkOkHttpClientAsync.kt
@@ -164,13 +164,7 @@ class OnebusawaySdkOkHttpClientAsync private constructor() {
fun build(): OnebusawaySdkClientAsync =
OnebusawaySdkClientAsyncImpl(
clientOptions
- .httpClient(
- OkHttpClient.builder()
- .baseUrl(clientOptions.baseUrl())
- .timeout(timeout)
- .proxy(proxy)
- .build()
- )
+ .httpClient(OkHttpClient.builder().timeout(timeout).proxy(proxy).build())
.build()
)
}
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/client/OnebusawaySdkClient.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/client/OnebusawaySdkClient.kt
index 6128438..5706000 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/client/OnebusawaySdkClient.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/client/OnebusawaySdkClient.kt
@@ -2,6 +2,8 @@
package org.onebusaway.client
+import java.util.function.Consumer
+import org.onebusaway.core.ClientOptions
import org.onebusaway.services.blocking.AgenciesWithCoverageService
import org.onebusaway.services.blocking.AgencyService
import org.onebusaway.services.blocking.ArrivalAndDepartureService
@@ -60,6 +62,13 @@ interface OnebusawaySdkClient {
*/
fun withRawResponse(): WithRawResponse
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(modifier: Consumer): OnebusawaySdkClient
+
fun agenciesWithCoverage(): AgenciesWithCoverageService
fun agency(): AgencyService
@@ -134,6 +143,15 @@ interface OnebusawaySdkClient {
*/
interface WithRawResponse {
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(
+ modifier: Consumer
+ ): OnebusawaySdkClient.WithRawResponse
+
fun agenciesWithCoverage(): AgenciesWithCoverageService.WithRawResponse
fun agency(): AgencyService.WithRawResponse
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/client/OnebusawaySdkClientAsync.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/client/OnebusawaySdkClientAsync.kt
index df8c27f..ddd6cf9 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/client/OnebusawaySdkClientAsync.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/client/OnebusawaySdkClientAsync.kt
@@ -2,6 +2,8 @@
package org.onebusaway.client
+import java.util.function.Consumer
+import org.onebusaway.core.ClientOptions
import org.onebusaway.services.async.AgenciesWithCoverageServiceAsync
import org.onebusaway.services.async.AgencyServiceAsync
import org.onebusaway.services.async.ArrivalAndDepartureServiceAsync
@@ -60,6 +62,13 @@ interface OnebusawaySdkClientAsync {
*/
fun withRawResponse(): WithRawResponse
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(modifier: Consumer): OnebusawaySdkClientAsync
+
fun agenciesWithCoverage(): AgenciesWithCoverageServiceAsync
fun agency(): AgencyServiceAsync
@@ -135,6 +144,15 @@ interface OnebusawaySdkClientAsync {
*/
interface WithRawResponse {
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(
+ modifier: Consumer
+ ): OnebusawaySdkClientAsync.WithRawResponse
+
fun agenciesWithCoverage(): AgenciesWithCoverageServiceAsync.WithRawResponse
fun agency(): AgencyServiceAsync.WithRawResponse
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/client/OnebusawaySdkClientAsyncImpl.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/client/OnebusawaySdkClientAsyncImpl.kt
index b03336a..0b67cc5 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/client/OnebusawaySdkClientAsyncImpl.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/client/OnebusawaySdkClientAsyncImpl.kt
@@ -2,6 +2,7 @@
package org.onebusaway.client
+import java.util.function.Consumer
import org.onebusaway.core.ClientOptions
import org.onebusaway.core.getPackageVersion
import org.onebusaway.services.async.AgenciesWithCoverageServiceAsync
@@ -191,6 +192,9 @@ class OnebusawaySdkClientAsyncImpl(private val clientOptions: ClientOptions) :
override fun withRawResponse(): OnebusawaySdkClientAsync.WithRawResponse = withRawResponse
+ override fun withOptions(modifier: Consumer): OnebusawaySdkClientAsync =
+ OnebusawaySdkClientAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build())
+
override fun agenciesWithCoverage(): AgenciesWithCoverageServiceAsync = agenciesWithCoverage
override fun agency(): AgencyServiceAsync = agency
@@ -366,6 +370,13 @@ class OnebusawaySdkClientAsyncImpl(private val clientOptions: ClientOptions) :
ShapeServiceAsyncImpl.WithRawResponseImpl(clientOptions)
}
+ override fun withOptions(
+ modifier: Consumer
+ ): OnebusawaySdkClientAsync.WithRawResponse =
+ OnebusawaySdkClientAsyncImpl.WithRawResponseImpl(
+ clientOptions.toBuilder().apply(modifier::accept).build()
+ )
+
override fun agenciesWithCoverage(): AgenciesWithCoverageServiceAsync.WithRawResponse =
agenciesWithCoverage
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/client/OnebusawaySdkClientImpl.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/client/OnebusawaySdkClientImpl.kt
index b3213c5..e3cde43 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/client/OnebusawaySdkClientImpl.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/client/OnebusawaySdkClientImpl.kt
@@ -2,6 +2,7 @@
package org.onebusaway.client
+import java.util.function.Consumer
import org.onebusaway.core.ClientOptions
import org.onebusaway.core.getPackageVersion
import org.onebusaway.services.blocking.AgenciesWithCoverageService
@@ -182,6 +183,9 @@ class OnebusawaySdkClientImpl(private val clientOptions: ClientOptions) : Onebus
override fun withRawResponse(): OnebusawaySdkClient.WithRawResponse = withRawResponse
+ override fun withOptions(modifier: Consumer): OnebusawaySdkClient =
+ OnebusawaySdkClientImpl(clientOptions.toBuilder().apply(modifier::accept).build())
+
override fun agenciesWithCoverage(): AgenciesWithCoverageService = agenciesWithCoverage
override fun agency(): AgencyService = agency
@@ -355,6 +359,13 @@ class OnebusawaySdkClientImpl(private val clientOptions: ClientOptions) : Onebus
ShapeServiceImpl.WithRawResponseImpl(clientOptions)
}
+ override fun withOptions(
+ modifier: Consumer
+ ): OnebusawaySdkClient.WithRawResponse =
+ OnebusawaySdkClientImpl.WithRawResponseImpl(
+ clientOptions.toBuilder().apply(modifier::accept).build()
+ )
+
override fun agenciesWithCoverage(): AgenciesWithCoverageService.WithRawResponse =
agenciesWithCoverage
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/core/ClientOptions.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/core/ClientOptions.kt
index 07ee264..c391485 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/core/ClientOptions.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/core/ClientOptions.kt
@@ -4,6 +4,8 @@ package org.onebusaway.core
import com.fasterxml.jackson.databind.json.JsonMapper
import java.time.Clock
+import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
import org.onebusaway.core.http.Headers
import org.onebusaway.core.http.HttpClient
import org.onebusaway.core.http.PhantomReachableClosingHttpClient
@@ -17,7 +19,7 @@ private constructor(
@get:JvmName("checkJacksonVersionCompatibility") val checkJacksonVersionCompatibility: Boolean,
@get:JvmName("jsonMapper") val jsonMapper: JsonMapper,
@get:JvmName("clock") val clock: Clock,
- @get:JvmName("baseUrl") val baseUrl: String,
+ private val baseUrl: String?,
@get:JvmName("headers") val headers: Headers,
@get:JvmName("queryParams") val queryParams: QueryParams,
@get:JvmName("responseValidation") val responseValidation: Boolean,
@@ -32,6 +34,8 @@ private constructor(
}
}
+ fun baseUrl(): String = baseUrl ?: PRODUCTION_URL
+
fun toBuilder() = Builder().from(this)
companion object {
@@ -59,7 +63,7 @@ private constructor(
private var checkJacksonVersionCompatibility: Boolean = true
private var jsonMapper: JsonMapper = jsonMapper()
private var clock: Clock = Clock.systemUTC()
- private var baseUrl: String = PRODUCTION_URL
+ private var baseUrl: String? = null
private var headers: Headers.Builder = Headers.builder()
private var queryParams: QueryParams.Builder = QueryParams.builder()
private var responseValidation: Boolean = false
@@ -82,7 +86,9 @@ private constructor(
apiKey = clientOptions.apiKey
}
- fun httpClient(httpClient: HttpClient) = apply { this.httpClient = httpClient }
+ fun httpClient(httpClient: HttpClient) = apply {
+ this.httpClient = PhantomReachableClosingHttpClient(httpClient)
+ }
fun checkJacksonVersionCompatibility(checkJacksonVersionCompatibility: Boolean) = apply {
this.checkJacksonVersionCompatibility = checkJacksonVersionCompatibility
@@ -92,7 +98,10 @@ private constructor(
fun clock(clock: Clock) = apply { this.clock = clock }
- fun baseUrl(baseUrl: String) = apply { this.baseUrl = baseUrl }
+ fun baseUrl(baseUrl: String?) = apply { this.baseUrl = baseUrl }
+
+ /** Alias for calling [Builder.baseUrl] with `baseUrl.orElse(null)`. */
+ fun baseUrl(baseUrl: Optional) = baseUrl(baseUrl.getOrNull())
fun responseValidation(responseValidation: Boolean) = apply {
this.responseValidation = responseValidation
@@ -184,8 +193,6 @@ private constructor(
fun removeAllQueryParams(keys: Set) = apply { queryParams.removeAll(keys) }
- fun baseUrl(): String = baseUrl
-
fun fromEnv() = apply {
System.getenv("ONEBUSAWAY_SDK_BASE_URL")?.let { baseUrl(it) }
System.getenv("ONEBUSAWAY_API_KEY")?.let { apiKey(it) }
@@ -227,13 +234,11 @@ private constructor(
return ClientOptions(
httpClient,
- PhantomReachableClosingHttpClient(
- RetryingHttpClient.builder()
- .httpClient(httpClient)
- .clock(clock)
- .maxRetries(maxRetries)
- .build()
- ),
+ RetryingHttpClient.builder()
+ .httpClient(httpClient)
+ .clock(clock)
+ .maxRetries(maxRetries)
+ .build(),
checkJacksonVersionCompatibility,
jsonMapper,
clock,
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/core/http/HttpRequest.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/core/http/HttpRequest.kt
index 1b4396b..81a3ed9 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/core/http/HttpRequest.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/core/http/HttpRequest.kt
@@ -6,7 +6,7 @@ import org.onebusaway.core.toImmutable
class HttpRequest
private constructor(
@get:JvmName("method") val method: HttpMethod,
- @get:JvmName("url") val url: String?,
+ @get:JvmName("baseUrl") val baseUrl: String,
@get:JvmName("pathSegments") val pathSegments: List,
@get:JvmName("headers") val headers: Headers,
@get:JvmName("queryParams") val queryParams: QueryParams,
@@ -16,7 +16,7 @@ private constructor(
fun toBuilder(): Builder = Builder().from(this)
override fun toString(): String =
- "HttpRequest{method=$method, url=$url, pathSegments=$pathSegments, headers=$headers, queryParams=$queryParams, body=$body}"
+ "HttpRequest{method=$method, baseUrl=$baseUrl, pathSegments=$pathSegments, headers=$headers, queryParams=$queryParams, body=$body}"
companion object {
@JvmStatic fun builder() = Builder()
@@ -25,7 +25,7 @@ private constructor(
class Builder internal constructor() {
private var method: HttpMethod? = null
- private var url: String? = null
+ private var baseUrl: String? = null
private var pathSegments: MutableList = mutableListOf()
private var headers: Headers.Builder = Headers.builder()
private var queryParams: QueryParams.Builder = QueryParams.builder()
@@ -34,7 +34,7 @@ private constructor(
@JvmSynthetic
internal fun from(request: HttpRequest) = apply {
method = request.method
- url = request.url
+ baseUrl = request.baseUrl
pathSegments = request.pathSegments.toMutableList()
headers = request.headers.toBuilder()
queryParams = request.queryParams.toBuilder()
@@ -43,7 +43,7 @@ private constructor(
fun method(method: HttpMethod) = apply { this.method = method }
- fun url(url: String) = apply { this.url = url }
+ fun baseUrl(baseUrl: String) = apply { this.baseUrl = baseUrl }
fun addPathSegment(pathSegment: String) = apply { pathSegments.add(pathSegment) }
@@ -136,7 +136,7 @@ private constructor(
fun build(): HttpRequest =
HttpRequest(
checkRequired("method", method),
- url,
+ checkRequired("baseUrl", baseUrl),
pathSegments.toImmutable(),
headers.build(),
queryParams.build(),
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/AgenciesWithCoverageServiceAsync.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/AgenciesWithCoverageServiceAsync.kt
index 3b4ca66..a811647 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/AgenciesWithCoverageServiceAsync.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/AgenciesWithCoverageServiceAsync.kt
@@ -2,8 +2,9 @@
package org.onebusaway.services.async
-import com.google.errorprone.annotations.MustBeClosed
import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
+import org.onebusaway.core.ClientOptions
import org.onebusaway.core.RequestOptions
import org.onebusaway.core.http.HttpResponseFor
import org.onebusaway.models.agencieswithcoverage.AgenciesWithCoverageListParams
@@ -16,6 +17,13 @@ interface AgenciesWithCoverageServiceAsync {
*/
fun withRawResponse(): WithRawResponse
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(modifier: Consumer): AgenciesWithCoverageServiceAsync
+
/**
* Returns a list of all transit agencies currently supported by OneBusAway along with the
* center of their coverage area.
@@ -44,30 +52,35 @@ interface AgenciesWithCoverageServiceAsync {
*/
interface WithRawResponse {
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(
+ modifier: Consumer
+ ): AgenciesWithCoverageServiceAsync.WithRawResponse
+
/**
* Returns a raw HTTP response for `get /api/where/agencies-with-coverage.json`, but is
* otherwise the same as [AgenciesWithCoverageServiceAsync.list].
*/
- @MustBeClosed
fun list(): CompletableFuture> =
list(AgenciesWithCoverageListParams.none())
/** @see [list] */
- @MustBeClosed
fun list(
params: AgenciesWithCoverageListParams = AgenciesWithCoverageListParams.none(),
requestOptions: RequestOptions = RequestOptions.none(),
): CompletableFuture>
/** @see [list] */
- @MustBeClosed
fun list(
params: AgenciesWithCoverageListParams = AgenciesWithCoverageListParams.none()
): CompletableFuture> =
list(params, RequestOptions.none())
/** @see [list] */
- @MustBeClosed
fun list(
requestOptions: RequestOptions
): CompletableFuture> =
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/AgenciesWithCoverageServiceAsyncImpl.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/AgenciesWithCoverageServiceAsyncImpl.kt
index ae8826a..44dbbc8 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/AgenciesWithCoverageServiceAsyncImpl.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/AgenciesWithCoverageServiceAsyncImpl.kt
@@ -3,6 +3,7 @@
package org.onebusaway.services.async
import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
import org.onebusaway.core.ClientOptions
import org.onebusaway.core.JsonValue
import org.onebusaway.core.RequestOptions
@@ -28,6 +29,13 @@ internal constructor(private val clientOptions: ClientOptions) : AgenciesWithCov
override fun withRawResponse(): AgenciesWithCoverageServiceAsync.WithRawResponse =
withRawResponse
+ override fun withOptions(
+ modifier: Consumer
+ ): AgenciesWithCoverageServiceAsync =
+ AgenciesWithCoverageServiceAsyncImpl(
+ clientOptions.toBuilder().apply(modifier::accept).build()
+ )
+
override fun list(
params: AgenciesWithCoverageListParams,
requestOptions: RequestOptions,
@@ -40,6 +48,13 @@ internal constructor(private val clientOptions: ClientOptions) : AgenciesWithCov
private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ override fun withOptions(
+ modifier: Consumer
+ ): AgenciesWithCoverageServiceAsync.WithRawResponse =
+ AgenciesWithCoverageServiceAsyncImpl.WithRawResponseImpl(
+ clientOptions.toBuilder().apply(modifier::accept).build()
+ )
+
private val listHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
.withErrorHandler(errorHandler)
@@ -51,6 +66,7 @@ internal constructor(private val clientOptions: ClientOptions) : AgenciesWithCov
val request =
HttpRequest.builder()
.method(HttpMethod.GET)
+ .baseUrl(clientOptions.baseUrl())
.addPathSegments("api", "where", "agencies-with-coverage.json")
.build()
.prepareAsync(clientOptions, params)
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/AgencyServiceAsync.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/AgencyServiceAsync.kt
index 65fa413..9dfd554 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/AgencyServiceAsync.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/AgencyServiceAsync.kt
@@ -2,8 +2,9 @@
package org.onebusaway.services.async
-import com.google.errorprone.annotations.MustBeClosed
import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
+import org.onebusaway.core.ClientOptions
import org.onebusaway.core.RequestOptions
import org.onebusaway.core.http.HttpResponseFor
import org.onebusaway.models.agency.AgencyRetrieveParams
@@ -16,6 +17,13 @@ interface AgencyServiceAsync {
*/
fun withRawResponse(): WithRawResponse
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(modifier: Consumer): AgencyServiceAsync
+
/** Retrieve information for a specific transit agency identified by its unique ID. */
fun retrieve(agencyId: String): CompletableFuture =
retrieve(agencyId, AgencyRetrieveParams.none())
@@ -56,16 +64,23 @@ interface AgencyServiceAsync {
*/
interface WithRawResponse {
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(
+ modifier: Consumer
+ ): AgencyServiceAsync.WithRawResponse
+
/**
* Returns a raw HTTP response for `get /api/where/agency/{agencyID}.json`, but is otherwise
* the same as [AgencyServiceAsync.retrieve].
*/
- @MustBeClosed
fun retrieve(agencyId: String): CompletableFuture> =
retrieve(agencyId, AgencyRetrieveParams.none())
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
agencyId: String,
params: AgencyRetrieveParams = AgencyRetrieveParams.none(),
@@ -74,7 +89,6 @@ interface AgencyServiceAsync {
retrieve(params.toBuilder().agencyId(agencyId).build(), requestOptions)
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
agencyId: String,
params: AgencyRetrieveParams = AgencyRetrieveParams.none(),
@@ -82,21 +96,18 @@ interface AgencyServiceAsync {
retrieve(agencyId, params, RequestOptions.none())
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
params: AgencyRetrieveParams,
requestOptions: RequestOptions = RequestOptions.none(),
): CompletableFuture>
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
params: AgencyRetrieveParams
): CompletableFuture> =
retrieve(params, RequestOptions.none())
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
agencyId: String,
requestOptions: RequestOptions,
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/AgencyServiceAsyncImpl.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/AgencyServiceAsyncImpl.kt
index b4ee1be..c8d1328 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/AgencyServiceAsyncImpl.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/AgencyServiceAsyncImpl.kt
@@ -3,6 +3,7 @@
package org.onebusaway.services.async
import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
import kotlin.jvm.optionals.getOrNull
import org.onebusaway.core.ClientOptions
import org.onebusaway.core.JsonValue
@@ -29,6 +30,9 @@ class AgencyServiceAsyncImpl internal constructor(private val clientOptions: Cli
override fun withRawResponse(): AgencyServiceAsync.WithRawResponse = withRawResponse
+ override fun withOptions(modifier: Consumer): AgencyServiceAsync =
+ AgencyServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build())
+
override fun retrieve(
params: AgencyRetrieveParams,
requestOptions: RequestOptions,
@@ -41,6 +45,13 @@ class AgencyServiceAsyncImpl internal constructor(private val clientOptions: Cli
private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ override fun withOptions(
+ modifier: Consumer
+ ): AgencyServiceAsync.WithRawResponse =
+ AgencyServiceAsyncImpl.WithRawResponseImpl(
+ clientOptions.toBuilder().apply(modifier::accept).build()
+ )
+
private val retrieveHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
.withErrorHandler(errorHandler)
@@ -55,6 +66,7 @@ class AgencyServiceAsyncImpl internal constructor(private val clientOptions: Cli
val request =
HttpRequest.builder()
.method(HttpMethod.GET)
+ .baseUrl(clientOptions.baseUrl())
.addPathSegments("api", "where", "agency", "${params._pathParam(0)}.json")
.build()
.prepareAsync(clientOptions, params)
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ArrivalAndDepartureServiceAsync.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ArrivalAndDepartureServiceAsync.kt
index 5d85667..c7ec1ec 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ArrivalAndDepartureServiceAsync.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ArrivalAndDepartureServiceAsync.kt
@@ -2,8 +2,9 @@
package org.onebusaway.services.async
-import com.google.errorprone.annotations.MustBeClosed
import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
+import org.onebusaway.core.ClientOptions
import org.onebusaway.core.RequestOptions
import org.onebusaway.core.http.HttpResponseFor
import org.onebusaway.models.arrivalanddeparture.ArrivalAndDepartureListParams
@@ -18,6 +19,13 @@ interface ArrivalAndDepartureServiceAsync {
*/
fun withRawResponse(): WithRawResponse
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(modifier: Consumer): ArrivalAndDepartureServiceAsync
+
/** arrival-and-departure-for-stop */
fun retrieve(
stopId: String,
@@ -88,12 +96,20 @@ interface ArrivalAndDepartureServiceAsync {
*/
interface WithRawResponse {
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(
+ modifier: Consumer
+ ): ArrivalAndDepartureServiceAsync.WithRawResponse
+
/**
* Returns a raw HTTP response for `get
* /api/where/arrival-and-departure-for-stop/{stopID}.json`, but is otherwise the same as
* [ArrivalAndDepartureServiceAsync.retrieve].
*/
- @MustBeClosed
fun retrieve(
stopId: String,
params: ArrivalAndDepartureRetrieveParams,
@@ -101,7 +117,6 @@ interface ArrivalAndDepartureServiceAsync {
retrieve(stopId, params, RequestOptions.none())
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
stopId: String,
params: ArrivalAndDepartureRetrieveParams,
@@ -110,14 +125,12 @@ interface ArrivalAndDepartureServiceAsync {
retrieve(params.toBuilder().stopId(stopId).build(), requestOptions)
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
params: ArrivalAndDepartureRetrieveParams
): CompletableFuture> =
retrieve(params, RequestOptions.none())
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
params: ArrivalAndDepartureRetrieveParams,
requestOptions: RequestOptions = RequestOptions.none(),
@@ -128,14 +141,12 @@ interface ArrivalAndDepartureServiceAsync {
* /api/where/arrivals-and-departures-for-stop/{stopID}.json`, but is otherwise the same as
* [ArrivalAndDepartureServiceAsync.list].
*/
- @MustBeClosed
fun list(
stopId: String
): CompletableFuture> =
list(stopId, ArrivalAndDepartureListParams.none())
/** @see [list] */
- @MustBeClosed
fun list(
stopId: String,
params: ArrivalAndDepartureListParams = ArrivalAndDepartureListParams.none(),
@@ -144,7 +155,6 @@ interface ArrivalAndDepartureServiceAsync {
list(params.toBuilder().stopId(stopId).build(), requestOptions)
/** @see [list] */
- @MustBeClosed
fun list(
stopId: String,
params: ArrivalAndDepartureListParams = ArrivalAndDepartureListParams.none(),
@@ -152,21 +162,18 @@ interface ArrivalAndDepartureServiceAsync {
list(stopId, params, RequestOptions.none())
/** @see [list] */
- @MustBeClosed
fun list(
params: ArrivalAndDepartureListParams,
requestOptions: RequestOptions = RequestOptions.none(),
): CompletableFuture>
/** @see [list] */
- @MustBeClosed
fun list(
params: ArrivalAndDepartureListParams
): CompletableFuture> =
list(params, RequestOptions.none())
/** @see [list] */
- @MustBeClosed
fun list(
stopId: String,
requestOptions: RequestOptions,
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ArrivalAndDepartureServiceAsyncImpl.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ArrivalAndDepartureServiceAsyncImpl.kt
index bc5c1ea..f7562bf 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ArrivalAndDepartureServiceAsyncImpl.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ArrivalAndDepartureServiceAsyncImpl.kt
@@ -3,6 +3,7 @@
package org.onebusaway.services.async
import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
import kotlin.jvm.optionals.getOrNull
import org.onebusaway.core.ClientOptions
import org.onebusaway.core.JsonValue
@@ -32,6 +33,13 @@ internal constructor(private val clientOptions: ClientOptions) : ArrivalAndDepar
override fun withRawResponse(): ArrivalAndDepartureServiceAsync.WithRawResponse =
withRawResponse
+ override fun withOptions(
+ modifier: Consumer
+ ): ArrivalAndDepartureServiceAsync =
+ ArrivalAndDepartureServiceAsyncImpl(
+ clientOptions.toBuilder().apply(modifier::accept).build()
+ )
+
override fun retrieve(
params: ArrivalAndDepartureRetrieveParams,
requestOptions: RequestOptions,
@@ -51,6 +59,13 @@ internal constructor(private val clientOptions: ClientOptions) : ArrivalAndDepar
private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ override fun withOptions(
+ modifier: Consumer
+ ): ArrivalAndDepartureServiceAsync.WithRawResponse =
+ ArrivalAndDepartureServiceAsyncImpl.WithRawResponseImpl(
+ clientOptions.toBuilder().apply(modifier::accept).build()
+ )
+
private val retrieveHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
.withErrorHandler(errorHandler)
@@ -65,6 +80,7 @@ internal constructor(private val clientOptions: ClientOptions) : ArrivalAndDepar
val request =
HttpRequest.builder()
.method(HttpMethod.GET)
+ .baseUrl(clientOptions.baseUrl())
.addPathSegments(
"api",
"where",
@@ -103,6 +119,7 @@ internal constructor(private val clientOptions: ClientOptions) : ArrivalAndDepar
val request =
HttpRequest.builder()
.method(HttpMethod.GET)
+ .baseUrl(clientOptions.baseUrl())
.addPathSegments(
"api",
"where",
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/BlockServiceAsync.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/BlockServiceAsync.kt
index 543b005..157b478 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/BlockServiceAsync.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/BlockServiceAsync.kt
@@ -2,8 +2,9 @@
package org.onebusaway.services.async
-import com.google.errorprone.annotations.MustBeClosed
import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
+import org.onebusaway.core.ClientOptions
import org.onebusaway.core.RequestOptions
import org.onebusaway.core.http.HttpResponseFor
import org.onebusaway.models.block.BlockRetrieveParams
@@ -16,6 +17,13 @@ interface BlockServiceAsync {
*/
fun withRawResponse(): WithRawResponse
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(modifier: Consumer): BlockServiceAsync
+
/** Get details of a specific block by ID */
fun retrieve(blockId: String): CompletableFuture =
retrieve(blockId, BlockRetrieveParams.none())
@@ -54,16 +62,23 @@ interface BlockServiceAsync {
/** A view of [BlockServiceAsync] that provides access to raw HTTP responses for each method. */
interface WithRawResponse {
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(
+ modifier: Consumer
+ ): BlockServiceAsync.WithRawResponse
+
/**
* Returns a raw HTTP response for `get /api/where/block/{blockID}.json`, but is otherwise
* the same as [BlockServiceAsync.retrieve].
*/
- @MustBeClosed
fun retrieve(blockId: String): CompletableFuture> =
retrieve(blockId, BlockRetrieveParams.none())
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
blockId: String,
params: BlockRetrieveParams = BlockRetrieveParams.none(),
@@ -72,7 +87,6 @@ interface BlockServiceAsync {
retrieve(params.toBuilder().blockId(blockId).build(), requestOptions)
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
blockId: String,
params: BlockRetrieveParams = BlockRetrieveParams.none(),
@@ -80,21 +94,18 @@ interface BlockServiceAsync {
retrieve(blockId, params, RequestOptions.none())
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
params: BlockRetrieveParams,
requestOptions: RequestOptions = RequestOptions.none(),
): CompletableFuture>
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
params: BlockRetrieveParams
): CompletableFuture> =
retrieve(params, RequestOptions.none())
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
blockId: String,
requestOptions: RequestOptions,
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/BlockServiceAsyncImpl.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/BlockServiceAsyncImpl.kt
index 30df072..eacb824 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/BlockServiceAsyncImpl.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/BlockServiceAsyncImpl.kt
@@ -3,6 +3,7 @@
package org.onebusaway.services.async
import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
import kotlin.jvm.optionals.getOrNull
import org.onebusaway.core.ClientOptions
import org.onebusaway.core.JsonValue
@@ -29,6 +30,9 @@ class BlockServiceAsyncImpl internal constructor(private val clientOptions: Clie
override fun withRawResponse(): BlockServiceAsync.WithRawResponse = withRawResponse
+ override fun withOptions(modifier: Consumer): BlockServiceAsync =
+ BlockServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build())
+
override fun retrieve(
params: BlockRetrieveParams,
requestOptions: RequestOptions,
@@ -41,6 +45,13 @@ class BlockServiceAsyncImpl internal constructor(private val clientOptions: Clie
private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ override fun withOptions(
+ modifier: Consumer
+ ): BlockServiceAsync.WithRawResponse =
+ BlockServiceAsyncImpl.WithRawResponseImpl(
+ clientOptions.toBuilder().apply(modifier::accept).build()
+ )
+
private val retrieveHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
.withErrorHandler(errorHandler)
@@ -55,6 +66,7 @@ class BlockServiceAsyncImpl internal constructor(private val clientOptions: Clie
val request =
HttpRequest.builder()
.method(HttpMethod.GET)
+ .baseUrl(clientOptions.baseUrl())
.addPathSegments("api", "where", "block", "${params._pathParam(0)}.json")
.build()
.prepareAsync(clientOptions, params)
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ConfigServiceAsync.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ConfigServiceAsync.kt
index 13c3253..82559da 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ConfigServiceAsync.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ConfigServiceAsync.kt
@@ -2,8 +2,9 @@
package org.onebusaway.services.async
-import com.google.errorprone.annotations.MustBeClosed
import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
+import org.onebusaway.core.ClientOptions
import org.onebusaway.core.RequestOptions
import org.onebusaway.core.http.HttpResponseFor
import org.onebusaway.models.config.ConfigRetrieveParams
@@ -16,6 +17,13 @@ interface ConfigServiceAsync {
*/
fun withRawResponse(): WithRawResponse
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(modifier: Consumer): ConfigServiceAsync
+
/** config */
fun retrieve(): CompletableFuture =
retrieve(ConfigRetrieveParams.none())
@@ -40,30 +48,35 @@ interface ConfigServiceAsync {
*/
interface WithRawResponse {
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(
+ modifier: Consumer
+ ): ConfigServiceAsync.WithRawResponse
+
/**
* Returns a raw HTTP response for `get /api/where/config.json`, but is otherwise the same
* as [ConfigServiceAsync.retrieve].
*/
- @MustBeClosed
fun retrieve(): CompletableFuture> =
retrieve(ConfigRetrieveParams.none())
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
params: ConfigRetrieveParams = ConfigRetrieveParams.none(),
requestOptions: RequestOptions = RequestOptions.none(),
): CompletableFuture>
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
params: ConfigRetrieveParams = ConfigRetrieveParams.none()
): CompletableFuture> =
retrieve(params, RequestOptions.none())
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
requestOptions: RequestOptions
): CompletableFuture> =
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ConfigServiceAsyncImpl.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ConfigServiceAsyncImpl.kt
index c575a72..7806738 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ConfigServiceAsyncImpl.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ConfigServiceAsyncImpl.kt
@@ -3,6 +3,7 @@
package org.onebusaway.services.async
import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
import org.onebusaway.core.ClientOptions
import org.onebusaway.core.JsonValue
import org.onebusaway.core.RequestOptions
@@ -27,6 +28,9 @@ class ConfigServiceAsyncImpl internal constructor(private val clientOptions: Cli
override fun withRawResponse(): ConfigServiceAsync.WithRawResponse = withRawResponse
+ override fun withOptions(modifier: Consumer): ConfigServiceAsync =
+ ConfigServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build())
+
override fun retrieve(
params: ConfigRetrieveParams,
requestOptions: RequestOptions,
@@ -39,6 +43,13 @@ class ConfigServiceAsyncImpl internal constructor(private val clientOptions: Cli
private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ override fun withOptions(
+ modifier: Consumer
+ ): ConfigServiceAsync.WithRawResponse =
+ ConfigServiceAsyncImpl.WithRawResponseImpl(
+ clientOptions.toBuilder().apply(modifier::accept).build()
+ )
+
private val retrieveHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
.withErrorHandler(errorHandler)
@@ -50,6 +61,7 @@ class ConfigServiceAsyncImpl internal constructor(private val clientOptions: Cli
val request =
HttpRequest.builder()
.method(HttpMethod.GET)
+ .baseUrl(clientOptions.baseUrl())
.addPathSegments("api", "where", "config.json")
.build()
.prepareAsync(clientOptions, params)
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/CurrentTimeServiceAsync.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/CurrentTimeServiceAsync.kt
index 6702fa8..4fe380f 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/CurrentTimeServiceAsync.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/CurrentTimeServiceAsync.kt
@@ -2,8 +2,9 @@
package org.onebusaway.services.async
-import com.google.errorprone.annotations.MustBeClosed
import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
+import org.onebusaway.core.ClientOptions
import org.onebusaway.core.RequestOptions
import org.onebusaway.core.http.HttpResponseFor
import org.onebusaway.models.currenttime.CurrentTimeRetrieveParams
@@ -16,6 +17,13 @@ interface CurrentTimeServiceAsync {
*/
fun withRawResponse(): WithRawResponse
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(modifier: Consumer): CurrentTimeServiceAsync
+
/** current-time */
fun retrieve(): CompletableFuture =
retrieve(CurrentTimeRetrieveParams.none())
@@ -41,30 +49,35 @@ interface CurrentTimeServiceAsync {
*/
interface WithRawResponse {
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(
+ modifier: Consumer
+ ): CurrentTimeServiceAsync.WithRawResponse
+
/**
* Returns a raw HTTP response for `get /api/where/current-time.json`, but is otherwise the
* same as [CurrentTimeServiceAsync.retrieve].
*/
- @MustBeClosed
fun retrieve(): CompletableFuture> =
retrieve(CurrentTimeRetrieveParams.none())
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
params: CurrentTimeRetrieveParams = CurrentTimeRetrieveParams.none(),
requestOptions: RequestOptions = RequestOptions.none(),
): CompletableFuture>
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
params: CurrentTimeRetrieveParams = CurrentTimeRetrieveParams.none()
): CompletableFuture> =
retrieve(params, RequestOptions.none())
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
requestOptions: RequestOptions
): CompletableFuture> =
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/CurrentTimeServiceAsyncImpl.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/CurrentTimeServiceAsyncImpl.kt
index c6e7e08..bdc80a2 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/CurrentTimeServiceAsyncImpl.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/CurrentTimeServiceAsyncImpl.kt
@@ -3,6 +3,7 @@
package org.onebusaway.services.async
import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
import org.onebusaway.core.ClientOptions
import org.onebusaway.core.JsonValue
import org.onebusaway.core.RequestOptions
@@ -27,6 +28,9 @@ class CurrentTimeServiceAsyncImpl internal constructor(private val clientOptions
override fun withRawResponse(): CurrentTimeServiceAsync.WithRawResponse = withRawResponse
+ override fun withOptions(modifier: Consumer): CurrentTimeServiceAsync =
+ CurrentTimeServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build())
+
override fun retrieve(
params: CurrentTimeRetrieveParams,
requestOptions: RequestOptions,
@@ -39,6 +43,13 @@ class CurrentTimeServiceAsyncImpl internal constructor(private val clientOptions
private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ override fun withOptions(
+ modifier: Consumer
+ ): CurrentTimeServiceAsync.WithRawResponse =
+ CurrentTimeServiceAsyncImpl.WithRawResponseImpl(
+ clientOptions.toBuilder().apply(modifier::accept).build()
+ )
+
private val retrieveHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
.withErrorHandler(errorHandler)
@@ -50,6 +61,7 @@ class CurrentTimeServiceAsyncImpl internal constructor(private val clientOptions
val request =
HttpRequest.builder()
.method(HttpMethod.GET)
+ .baseUrl(clientOptions.baseUrl())
.addPathSegments("api", "where", "current-time.json")
.build()
.prepareAsync(clientOptions, params)
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ReportProblemWithStopServiceAsync.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ReportProblemWithStopServiceAsync.kt
index 9c5fadc..c3077cc 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ReportProblemWithStopServiceAsync.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ReportProblemWithStopServiceAsync.kt
@@ -2,8 +2,9 @@
package org.onebusaway.services.async
-import com.google.errorprone.annotations.MustBeClosed
import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
+import org.onebusaway.core.ClientOptions
import org.onebusaway.core.RequestOptions
import org.onebusaway.core.http.HttpResponseFor
import org.onebusaway.models.ResponseWrapper
@@ -16,6 +17,13 @@ interface ReportProblemWithStopServiceAsync {
*/
fun withRawResponse(): WithRawResponse
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(modifier: Consumer): ReportProblemWithStopServiceAsync
+
/** Submit a user-generated problem report for a stop */
fun retrieve(stopId: String): CompletableFuture =
retrieve(stopId, ReportProblemWithStopRetrieveParams.none())
@@ -57,16 +65,23 @@ interface ReportProblemWithStopServiceAsync {
*/
interface WithRawResponse {
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(
+ modifier: Consumer
+ ): ReportProblemWithStopServiceAsync.WithRawResponse
+
/**
* Returns a raw HTTP response for `get /api/where/report-problem-with-stop/{stopID}.json`,
* but is otherwise the same as [ReportProblemWithStopServiceAsync.retrieve].
*/
- @MustBeClosed
fun retrieve(stopId: String): CompletableFuture> =
retrieve(stopId, ReportProblemWithStopRetrieveParams.none())
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
stopId: String,
params: ReportProblemWithStopRetrieveParams =
@@ -76,7 +91,6 @@ interface ReportProblemWithStopServiceAsync {
retrieve(params.toBuilder().stopId(stopId).build(), requestOptions)
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
stopId: String,
params: ReportProblemWithStopRetrieveParams = ReportProblemWithStopRetrieveParams.none(),
@@ -84,21 +98,18 @@ interface ReportProblemWithStopServiceAsync {
retrieve(stopId, params, RequestOptions.none())
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
params: ReportProblemWithStopRetrieveParams,
requestOptions: RequestOptions = RequestOptions.none(),
): CompletableFuture>
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
params: ReportProblemWithStopRetrieveParams
): CompletableFuture> =
retrieve(params, RequestOptions.none())
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
stopId: String,
requestOptions: RequestOptions,
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ReportProblemWithStopServiceAsyncImpl.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ReportProblemWithStopServiceAsyncImpl.kt
index ff5765e..40c8069 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ReportProblemWithStopServiceAsyncImpl.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ReportProblemWithStopServiceAsyncImpl.kt
@@ -3,6 +3,7 @@
package org.onebusaway.services.async
import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
import kotlin.jvm.optionals.getOrNull
import org.onebusaway.core.ClientOptions
import org.onebusaway.core.JsonValue
@@ -30,6 +31,13 @@ internal constructor(private val clientOptions: ClientOptions) : ReportProblemWi
override fun withRawResponse(): ReportProblemWithStopServiceAsync.WithRawResponse =
withRawResponse
+ override fun withOptions(
+ modifier: Consumer
+ ): ReportProblemWithStopServiceAsync =
+ ReportProblemWithStopServiceAsyncImpl(
+ clientOptions.toBuilder().apply(modifier::accept).build()
+ )
+
override fun retrieve(
params: ReportProblemWithStopRetrieveParams,
requestOptions: RequestOptions,
@@ -42,6 +50,13 @@ internal constructor(private val clientOptions: ClientOptions) : ReportProblemWi
private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ override fun withOptions(
+ modifier: Consumer
+ ): ReportProblemWithStopServiceAsync.WithRawResponse =
+ ReportProblemWithStopServiceAsyncImpl.WithRawResponseImpl(
+ clientOptions.toBuilder().apply(modifier::accept).build()
+ )
+
private val retrieveHandler: Handler =
jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
@@ -55,6 +70,7 @@ internal constructor(private val clientOptions: ClientOptions) : ReportProblemWi
val request =
HttpRequest.builder()
.method(HttpMethod.GET)
+ .baseUrl(clientOptions.baseUrl())
.addPathSegments(
"api",
"where",
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ReportProblemWithTripServiceAsync.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ReportProblemWithTripServiceAsync.kt
index 4ed86c7..cee5005 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ReportProblemWithTripServiceAsync.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ReportProblemWithTripServiceAsync.kt
@@ -2,8 +2,9 @@
package org.onebusaway.services.async
-import com.google.errorprone.annotations.MustBeClosed
import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
+import org.onebusaway.core.ClientOptions
import org.onebusaway.core.RequestOptions
import org.onebusaway.core.http.HttpResponseFor
import org.onebusaway.models.ResponseWrapper
@@ -16,6 +17,13 @@ interface ReportProblemWithTripServiceAsync {
*/
fun withRawResponse(): WithRawResponse
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(modifier: Consumer): ReportProblemWithTripServiceAsync
+
/** Submit a user-generated problem report for a particular trip. */
fun retrieve(tripId: String): CompletableFuture =
retrieve(tripId, ReportProblemWithTripRetrieveParams.none())
@@ -57,16 +65,23 @@ interface ReportProblemWithTripServiceAsync {
*/
interface WithRawResponse {
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(
+ modifier: Consumer
+ ): ReportProblemWithTripServiceAsync.WithRawResponse
+
/**
* Returns a raw HTTP response for `get /api/where/report-problem-with-trip/{tripID}.json`,
* but is otherwise the same as [ReportProblemWithTripServiceAsync.retrieve].
*/
- @MustBeClosed
fun retrieve(tripId: String): CompletableFuture> =
retrieve(tripId, ReportProblemWithTripRetrieveParams.none())
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
tripId: String,
params: ReportProblemWithTripRetrieveParams =
@@ -76,7 +91,6 @@ interface ReportProblemWithTripServiceAsync {
retrieve(params.toBuilder().tripId(tripId).build(), requestOptions)
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
tripId: String,
params: ReportProblemWithTripRetrieveParams = ReportProblemWithTripRetrieveParams.none(),
@@ -84,21 +98,18 @@ interface ReportProblemWithTripServiceAsync {
retrieve(tripId, params, RequestOptions.none())
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
params: ReportProblemWithTripRetrieveParams,
requestOptions: RequestOptions = RequestOptions.none(),
): CompletableFuture>
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
params: ReportProblemWithTripRetrieveParams
): CompletableFuture> =
retrieve(params, RequestOptions.none())
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
tripId: String,
requestOptions: RequestOptions,
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ReportProblemWithTripServiceAsyncImpl.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ReportProblemWithTripServiceAsyncImpl.kt
index c3f940e..aa61330 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ReportProblemWithTripServiceAsyncImpl.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ReportProblemWithTripServiceAsyncImpl.kt
@@ -3,6 +3,7 @@
package org.onebusaway.services.async
import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
import kotlin.jvm.optionals.getOrNull
import org.onebusaway.core.ClientOptions
import org.onebusaway.core.JsonValue
@@ -30,6 +31,13 @@ internal constructor(private val clientOptions: ClientOptions) : ReportProblemWi
override fun withRawResponse(): ReportProblemWithTripServiceAsync.WithRawResponse =
withRawResponse
+ override fun withOptions(
+ modifier: Consumer
+ ): ReportProblemWithTripServiceAsync =
+ ReportProblemWithTripServiceAsyncImpl(
+ clientOptions.toBuilder().apply(modifier::accept).build()
+ )
+
override fun retrieve(
params: ReportProblemWithTripRetrieveParams,
requestOptions: RequestOptions,
@@ -42,6 +50,13 @@ internal constructor(private val clientOptions: ClientOptions) : ReportProblemWi
private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ override fun withOptions(
+ modifier: Consumer
+ ): ReportProblemWithTripServiceAsync.WithRawResponse =
+ ReportProblemWithTripServiceAsyncImpl.WithRawResponseImpl(
+ clientOptions.toBuilder().apply(modifier::accept).build()
+ )
+
private val retrieveHandler: Handler =
jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
@@ -55,6 +70,7 @@ internal constructor(private val clientOptions: ClientOptions) : ReportProblemWi
val request =
HttpRequest.builder()
.method(HttpMethod.GET)
+ .baseUrl(clientOptions.baseUrl())
.addPathSegments(
"api",
"where",
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/RouteIdsForAgencyServiceAsync.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/RouteIdsForAgencyServiceAsync.kt
index af5ad86..c1550a2 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/RouteIdsForAgencyServiceAsync.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/RouteIdsForAgencyServiceAsync.kt
@@ -2,8 +2,9 @@
package org.onebusaway.services.async
-import com.google.errorprone.annotations.MustBeClosed
import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
+import org.onebusaway.core.ClientOptions
import org.onebusaway.core.RequestOptions
import org.onebusaway.core.http.HttpResponseFor
import org.onebusaway.models.routeidsforagency.RouteIdsForAgencyListParams
@@ -16,6 +17,13 @@ interface RouteIdsForAgencyServiceAsync {
*/
fun withRawResponse(): WithRawResponse
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(modifier: Consumer): RouteIdsForAgencyServiceAsync
+
/** Get route IDs for a specific agency */
fun list(agencyId: String): CompletableFuture =
list(agencyId, RouteIdsForAgencyListParams.none())
@@ -59,18 +67,25 @@ interface RouteIdsForAgencyServiceAsync {
*/
interface WithRawResponse {
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(
+ modifier: Consumer
+ ): RouteIdsForAgencyServiceAsync.WithRawResponse
+
/**
* Returns a raw HTTP response for `get /api/where/route-ids-for-agency/{agencyID}.json`,
* but is otherwise the same as [RouteIdsForAgencyServiceAsync.list].
*/
- @MustBeClosed
fun list(
agencyId: String
): CompletableFuture> =
list(agencyId, RouteIdsForAgencyListParams.none())
/** @see [list] */
- @MustBeClosed
fun list(
agencyId: String,
params: RouteIdsForAgencyListParams = RouteIdsForAgencyListParams.none(),
@@ -79,7 +94,6 @@ interface RouteIdsForAgencyServiceAsync {
list(params.toBuilder().agencyId(agencyId).build(), requestOptions)
/** @see [list] */
- @MustBeClosed
fun list(
agencyId: String,
params: RouteIdsForAgencyListParams = RouteIdsForAgencyListParams.none(),
@@ -87,21 +101,18 @@ interface RouteIdsForAgencyServiceAsync {
list(agencyId, params, RequestOptions.none())
/** @see [list] */
- @MustBeClosed
fun list(
params: RouteIdsForAgencyListParams,
requestOptions: RequestOptions = RequestOptions.none(),
): CompletableFuture>
/** @see [list] */
- @MustBeClosed
fun list(
params: RouteIdsForAgencyListParams
): CompletableFuture> =
list(params, RequestOptions.none())
/** @see [list] */
- @MustBeClosed
fun list(
agencyId: String,
requestOptions: RequestOptions,
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/RouteIdsForAgencyServiceAsyncImpl.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/RouteIdsForAgencyServiceAsyncImpl.kt
index 7040fa2..b79cf71 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/RouteIdsForAgencyServiceAsyncImpl.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/RouteIdsForAgencyServiceAsyncImpl.kt
@@ -3,6 +3,7 @@
package org.onebusaway.services.async
import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
import kotlin.jvm.optionals.getOrNull
import org.onebusaway.core.ClientOptions
import org.onebusaway.core.JsonValue
@@ -29,6 +30,11 @@ internal constructor(private val clientOptions: ClientOptions) : RouteIdsForAgen
override fun withRawResponse(): RouteIdsForAgencyServiceAsync.WithRawResponse = withRawResponse
+ override fun withOptions(
+ modifier: Consumer
+ ): RouteIdsForAgencyServiceAsync =
+ RouteIdsForAgencyServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build())
+
override fun list(
params: RouteIdsForAgencyListParams,
requestOptions: RequestOptions,
@@ -41,6 +47,13 @@ internal constructor(private val clientOptions: ClientOptions) : RouteIdsForAgen
private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ override fun withOptions(
+ modifier: Consumer
+ ): RouteIdsForAgencyServiceAsync.WithRawResponse =
+ RouteIdsForAgencyServiceAsyncImpl.WithRawResponseImpl(
+ clientOptions.toBuilder().apply(modifier::accept).build()
+ )
+
private val listHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
.withErrorHandler(errorHandler)
@@ -55,6 +68,7 @@ internal constructor(private val clientOptions: ClientOptions) : RouteIdsForAgen
val request =
HttpRequest.builder()
.method(HttpMethod.GET)
+ .baseUrl(clientOptions.baseUrl())
.addPathSegments(
"api",
"where",
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/RouteServiceAsync.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/RouteServiceAsync.kt
index 96edd41..3b88408 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/RouteServiceAsync.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/RouteServiceAsync.kt
@@ -2,8 +2,9 @@
package org.onebusaway.services.async
-import com.google.errorprone.annotations.MustBeClosed
import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
+import org.onebusaway.core.ClientOptions
import org.onebusaway.core.RequestOptions
import org.onebusaway.core.http.HttpResponseFor
import org.onebusaway.models.route.RouteRetrieveParams
@@ -16,6 +17,13 @@ interface RouteServiceAsync {
*/
fun withRawResponse(): WithRawResponse
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(modifier: Consumer): RouteServiceAsync
+
/** Retrieve information for a specific route identified by its unique ID. */
fun retrieve(routeId: String): CompletableFuture =
retrieve(routeId, RouteRetrieveParams.none())
@@ -54,16 +62,23 @@ interface RouteServiceAsync {
/** A view of [RouteServiceAsync] that provides access to raw HTTP responses for each method. */
interface WithRawResponse {
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(
+ modifier: Consumer
+ ): RouteServiceAsync.WithRawResponse
+
/**
* Returns a raw HTTP response for `get /api/where/route/{routeID}.json`, but is otherwise
* the same as [RouteServiceAsync.retrieve].
*/
- @MustBeClosed
fun retrieve(routeId: String): CompletableFuture> =
retrieve(routeId, RouteRetrieveParams.none())
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
routeId: String,
params: RouteRetrieveParams = RouteRetrieveParams.none(),
@@ -72,7 +87,6 @@ interface RouteServiceAsync {
retrieve(params.toBuilder().routeId(routeId).build(), requestOptions)
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
routeId: String,
params: RouteRetrieveParams = RouteRetrieveParams.none(),
@@ -80,21 +94,18 @@ interface RouteServiceAsync {
retrieve(routeId, params, RequestOptions.none())
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
params: RouteRetrieveParams,
requestOptions: RequestOptions = RequestOptions.none(),
): CompletableFuture>
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
params: RouteRetrieveParams
): CompletableFuture> =
retrieve(params, RequestOptions.none())
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
routeId: String,
requestOptions: RequestOptions,
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/RouteServiceAsyncImpl.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/RouteServiceAsyncImpl.kt
index fa3f4c6..c390847 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/RouteServiceAsyncImpl.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/RouteServiceAsyncImpl.kt
@@ -3,6 +3,7 @@
package org.onebusaway.services.async
import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
import kotlin.jvm.optionals.getOrNull
import org.onebusaway.core.ClientOptions
import org.onebusaway.core.JsonValue
@@ -29,6 +30,9 @@ class RouteServiceAsyncImpl internal constructor(private val clientOptions: Clie
override fun withRawResponse(): RouteServiceAsync.WithRawResponse = withRawResponse
+ override fun withOptions(modifier: Consumer): RouteServiceAsync =
+ RouteServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build())
+
override fun retrieve(
params: RouteRetrieveParams,
requestOptions: RequestOptions,
@@ -41,6 +45,13 @@ class RouteServiceAsyncImpl internal constructor(private val clientOptions: Clie
private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ override fun withOptions(
+ modifier: Consumer
+ ): RouteServiceAsync.WithRawResponse =
+ RouteServiceAsyncImpl.WithRawResponseImpl(
+ clientOptions.toBuilder().apply(modifier::accept).build()
+ )
+
private val retrieveHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
.withErrorHandler(errorHandler)
@@ -55,6 +66,7 @@ class RouteServiceAsyncImpl internal constructor(private val clientOptions: Clie
val request =
HttpRequest.builder()
.method(HttpMethod.GET)
+ .baseUrl(clientOptions.baseUrl())
.addPathSegments("api", "where", "route", "${params._pathParam(0)}.json")
.build()
.prepareAsync(clientOptions, params)
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/RoutesForAgencyServiceAsync.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/RoutesForAgencyServiceAsync.kt
index 579e603..fa95fee 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/RoutesForAgencyServiceAsync.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/RoutesForAgencyServiceAsync.kt
@@ -2,8 +2,9 @@
package org.onebusaway.services.async
-import com.google.errorprone.annotations.MustBeClosed
import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
+import org.onebusaway.core.ClientOptions
import org.onebusaway.core.RequestOptions
import org.onebusaway.core.http.HttpResponseFor
import org.onebusaway.models.routesforagency.RoutesForAgencyListParams
@@ -16,6 +17,13 @@ interface RoutesForAgencyServiceAsync {
*/
fun withRawResponse(): WithRawResponse
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(modifier: Consumer): RoutesForAgencyServiceAsync
+
/** Retrieve the list of all routes for a particular agency by id */
fun list(agencyId: String): CompletableFuture =
list(agencyId, RoutesForAgencyListParams.none())
@@ -58,18 +66,25 @@ interface RoutesForAgencyServiceAsync {
*/
interface WithRawResponse {
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(
+ modifier: Consumer
+ ): RoutesForAgencyServiceAsync.WithRawResponse
+
/**
* Returns a raw HTTP response for `get /api/where/routes-for-agency/{agencyID}.json`, but
* is otherwise the same as [RoutesForAgencyServiceAsync.list].
*/
- @MustBeClosed
fun list(
agencyId: String
): CompletableFuture> =
list(agencyId, RoutesForAgencyListParams.none())
/** @see [list] */
- @MustBeClosed
fun list(
agencyId: String,
params: RoutesForAgencyListParams = RoutesForAgencyListParams.none(),
@@ -78,7 +93,6 @@ interface RoutesForAgencyServiceAsync {
list(params.toBuilder().agencyId(agencyId).build(), requestOptions)
/** @see [list] */
- @MustBeClosed
fun list(
agencyId: String,
params: RoutesForAgencyListParams = RoutesForAgencyListParams.none(),
@@ -86,21 +100,18 @@ interface RoutesForAgencyServiceAsync {
list(agencyId, params, RequestOptions.none())
/** @see [list] */
- @MustBeClosed
fun list(
params: RoutesForAgencyListParams,
requestOptions: RequestOptions = RequestOptions.none(),
): CompletableFuture>
/** @see [list] */
- @MustBeClosed
fun list(
params: RoutesForAgencyListParams
): CompletableFuture> =
list(params, RequestOptions.none())
/** @see [list] */
- @MustBeClosed
fun list(
agencyId: String,
requestOptions: RequestOptions,
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/RoutesForAgencyServiceAsyncImpl.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/RoutesForAgencyServiceAsyncImpl.kt
index 8401bec..b8648f9 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/RoutesForAgencyServiceAsyncImpl.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/RoutesForAgencyServiceAsyncImpl.kt
@@ -3,6 +3,7 @@
package org.onebusaway.services.async
import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
import kotlin.jvm.optionals.getOrNull
import org.onebusaway.core.ClientOptions
import org.onebusaway.core.JsonValue
@@ -29,6 +30,11 @@ internal constructor(private val clientOptions: ClientOptions) : RoutesForAgency
override fun withRawResponse(): RoutesForAgencyServiceAsync.WithRawResponse = withRawResponse
+ override fun withOptions(
+ modifier: Consumer
+ ): RoutesForAgencyServiceAsync =
+ RoutesForAgencyServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build())
+
override fun list(
params: RoutesForAgencyListParams,
requestOptions: RequestOptions,
@@ -41,6 +47,13 @@ internal constructor(private val clientOptions: ClientOptions) : RoutesForAgency
private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ override fun withOptions(
+ modifier: Consumer
+ ): RoutesForAgencyServiceAsync.WithRawResponse =
+ RoutesForAgencyServiceAsyncImpl.WithRawResponseImpl(
+ clientOptions.toBuilder().apply(modifier::accept).build()
+ )
+
private val listHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
.withErrorHandler(errorHandler)
@@ -55,6 +68,7 @@ internal constructor(private val clientOptions: ClientOptions) : RoutesForAgency
val request =
HttpRequest.builder()
.method(HttpMethod.GET)
+ .baseUrl(clientOptions.baseUrl())
.addPathSegments(
"api",
"where",
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/RoutesForLocationServiceAsync.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/RoutesForLocationServiceAsync.kt
index 3be0354..7d81a56 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/RoutesForLocationServiceAsync.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/RoutesForLocationServiceAsync.kt
@@ -2,8 +2,9 @@
package org.onebusaway.services.async
-import com.google.errorprone.annotations.MustBeClosed
import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
+import org.onebusaway.core.ClientOptions
import org.onebusaway.core.RequestOptions
import org.onebusaway.core.http.HttpResponseFor
import org.onebusaway.models.routesforlocation.RoutesForLocationListParams
@@ -16,6 +17,13 @@ interface RoutesForLocationServiceAsync {
*/
fun withRawResponse(): WithRawResponse
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(modifier: Consumer): RoutesForLocationServiceAsync
+
/** routes-for-location */
fun list(
params: RoutesForLocationListParams
@@ -33,18 +41,25 @@ interface RoutesForLocationServiceAsync {
*/
interface WithRawResponse {
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(
+ modifier: Consumer
+ ): RoutesForLocationServiceAsync.WithRawResponse
+
/**
* Returns a raw HTTP response for `get /api/where/routes-for-location.json`, but is
* otherwise the same as [RoutesForLocationServiceAsync.list].
*/
- @MustBeClosed
fun list(
params: RoutesForLocationListParams
): CompletableFuture> =
list(params, RequestOptions.none())
/** @see [list] */
- @MustBeClosed
fun list(
params: RoutesForLocationListParams,
requestOptions: RequestOptions = RequestOptions.none(),
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/RoutesForLocationServiceAsyncImpl.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/RoutesForLocationServiceAsyncImpl.kt
index 4208b4d..97be387 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/RoutesForLocationServiceAsyncImpl.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/RoutesForLocationServiceAsyncImpl.kt
@@ -3,6 +3,7 @@
package org.onebusaway.services.async
import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
import org.onebusaway.core.ClientOptions
import org.onebusaway.core.JsonValue
import org.onebusaway.core.RequestOptions
@@ -27,6 +28,11 @@ internal constructor(private val clientOptions: ClientOptions) : RoutesForLocati
override fun withRawResponse(): RoutesForLocationServiceAsync.WithRawResponse = withRawResponse
+ override fun withOptions(
+ modifier: Consumer
+ ): RoutesForLocationServiceAsync =
+ RoutesForLocationServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build())
+
override fun list(
params: RoutesForLocationListParams,
requestOptions: RequestOptions,
@@ -39,6 +45,13 @@ internal constructor(private val clientOptions: ClientOptions) : RoutesForLocati
private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ override fun withOptions(
+ modifier: Consumer
+ ): RoutesForLocationServiceAsync.WithRawResponse =
+ RoutesForLocationServiceAsyncImpl.WithRawResponseImpl(
+ clientOptions.toBuilder().apply(modifier::accept).build()
+ )
+
private val listHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
.withErrorHandler(errorHandler)
@@ -50,6 +63,7 @@ internal constructor(private val clientOptions: ClientOptions) : RoutesForLocati
val request =
HttpRequest.builder()
.method(HttpMethod.GET)
+ .baseUrl(clientOptions.baseUrl())
.addPathSegments("api", "where", "routes-for-location.json")
.build()
.prepareAsync(clientOptions, params)
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ScheduleForRouteServiceAsync.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ScheduleForRouteServiceAsync.kt
index adf72f3..20c6989 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ScheduleForRouteServiceAsync.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ScheduleForRouteServiceAsync.kt
@@ -2,8 +2,9 @@
package org.onebusaway.services.async
-import com.google.errorprone.annotations.MustBeClosed
import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
+import org.onebusaway.core.ClientOptions
import org.onebusaway.core.RequestOptions
import org.onebusaway.core.http.HttpResponseFor
import org.onebusaway.models.scheduleforroute.ScheduleForRouteRetrieveParams
@@ -16,6 +17,13 @@ interface ScheduleForRouteServiceAsync {
*/
fun withRawResponse(): WithRawResponse
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(modifier: Consumer): ScheduleForRouteServiceAsync
+
/** Retrieve the full schedule for a route on a particular day */
fun retrieve(routeId: String): CompletableFuture =
retrieve(routeId, ScheduleForRouteRetrieveParams.none())
@@ -59,18 +67,25 @@ interface ScheduleForRouteServiceAsync {
*/
interface WithRawResponse {
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(
+ modifier: Consumer
+ ): ScheduleForRouteServiceAsync.WithRawResponse
+
/**
* Returns a raw HTTP response for `get /api/where/schedule-for-route/{routeID}.json`, but
* is otherwise the same as [ScheduleForRouteServiceAsync.retrieve].
*/
- @MustBeClosed
fun retrieve(
routeId: String
): CompletableFuture> =
retrieve(routeId, ScheduleForRouteRetrieveParams.none())
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
routeId: String,
params: ScheduleForRouteRetrieveParams = ScheduleForRouteRetrieveParams.none(),
@@ -79,7 +94,6 @@ interface ScheduleForRouteServiceAsync {
retrieve(params.toBuilder().routeId(routeId).build(), requestOptions)
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
routeId: String,
params: ScheduleForRouteRetrieveParams = ScheduleForRouteRetrieveParams.none(),
@@ -87,21 +101,18 @@ interface ScheduleForRouteServiceAsync {
retrieve(routeId, params, RequestOptions.none())
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
params: ScheduleForRouteRetrieveParams,
requestOptions: RequestOptions = RequestOptions.none(),
): CompletableFuture>
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
params: ScheduleForRouteRetrieveParams
): CompletableFuture> =
retrieve(params, RequestOptions.none())
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
routeId: String,
requestOptions: RequestOptions,
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ScheduleForRouteServiceAsyncImpl.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ScheduleForRouteServiceAsyncImpl.kt
index e2d9e81..ca8ca7e 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ScheduleForRouteServiceAsyncImpl.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ScheduleForRouteServiceAsyncImpl.kt
@@ -3,6 +3,7 @@
package org.onebusaway.services.async
import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
import kotlin.jvm.optionals.getOrNull
import org.onebusaway.core.ClientOptions
import org.onebusaway.core.JsonValue
@@ -29,6 +30,11 @@ internal constructor(private val clientOptions: ClientOptions) : ScheduleForRout
override fun withRawResponse(): ScheduleForRouteServiceAsync.WithRawResponse = withRawResponse
+ override fun withOptions(
+ modifier: Consumer
+ ): ScheduleForRouteServiceAsync =
+ ScheduleForRouteServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build())
+
override fun retrieve(
params: ScheduleForRouteRetrieveParams,
requestOptions: RequestOptions,
@@ -41,6 +47,13 @@ internal constructor(private val clientOptions: ClientOptions) : ScheduleForRout
private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ override fun withOptions(
+ modifier: Consumer
+ ): ScheduleForRouteServiceAsync.WithRawResponse =
+ ScheduleForRouteServiceAsyncImpl.WithRawResponseImpl(
+ clientOptions.toBuilder().apply(modifier::accept).build()
+ )
+
private val retrieveHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
.withErrorHandler(errorHandler)
@@ -55,6 +68,7 @@ internal constructor(private val clientOptions: ClientOptions) : ScheduleForRout
val request =
HttpRequest.builder()
.method(HttpMethod.GET)
+ .baseUrl(clientOptions.baseUrl())
.addPathSegments(
"api",
"where",
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ScheduleForStopServiceAsync.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ScheduleForStopServiceAsync.kt
index 886f4a1..2907c69 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ScheduleForStopServiceAsync.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ScheduleForStopServiceAsync.kt
@@ -2,8 +2,9 @@
package org.onebusaway.services.async
-import com.google.errorprone.annotations.MustBeClosed
import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
+import org.onebusaway.core.ClientOptions
import org.onebusaway.core.RequestOptions
import org.onebusaway.core.http.HttpResponseFor
import org.onebusaway.models.scheduleforstop.ScheduleForStopRetrieveParams
@@ -16,6 +17,13 @@ interface ScheduleForStopServiceAsync {
*/
fun withRawResponse(): WithRawResponse
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(modifier: Consumer): ScheduleForStopServiceAsync
+
/** Get schedule for a specific stop */
fun retrieve(stopId: String): CompletableFuture =
retrieve(stopId, ScheduleForStopRetrieveParams.none())
@@ -59,18 +67,25 @@ interface ScheduleForStopServiceAsync {
*/
interface WithRawResponse {
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(
+ modifier: Consumer
+ ): ScheduleForStopServiceAsync.WithRawResponse
+
/**
* Returns a raw HTTP response for `get /api/where/schedule-for-stop/{stopID}.json`, but is
* otherwise the same as [ScheduleForStopServiceAsync.retrieve].
*/
- @MustBeClosed
fun retrieve(
stopId: String
): CompletableFuture> =
retrieve(stopId, ScheduleForStopRetrieveParams.none())
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
stopId: String,
params: ScheduleForStopRetrieveParams = ScheduleForStopRetrieveParams.none(),
@@ -79,7 +94,6 @@ interface ScheduleForStopServiceAsync {
retrieve(params.toBuilder().stopId(stopId).build(), requestOptions)
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
stopId: String,
params: ScheduleForStopRetrieveParams = ScheduleForStopRetrieveParams.none(),
@@ -87,21 +101,18 @@ interface ScheduleForStopServiceAsync {
retrieve(stopId, params, RequestOptions.none())
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
params: ScheduleForStopRetrieveParams,
requestOptions: RequestOptions = RequestOptions.none(),
): CompletableFuture>
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
params: ScheduleForStopRetrieveParams
): CompletableFuture> =
retrieve(params, RequestOptions.none())
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
stopId: String,
requestOptions: RequestOptions,
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ScheduleForStopServiceAsyncImpl.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ScheduleForStopServiceAsyncImpl.kt
index 96f3b3d..05351f7 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ScheduleForStopServiceAsyncImpl.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ScheduleForStopServiceAsyncImpl.kt
@@ -3,6 +3,7 @@
package org.onebusaway.services.async
import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
import kotlin.jvm.optionals.getOrNull
import org.onebusaway.core.ClientOptions
import org.onebusaway.core.JsonValue
@@ -29,6 +30,11 @@ internal constructor(private val clientOptions: ClientOptions) : ScheduleForStop
override fun withRawResponse(): ScheduleForStopServiceAsync.WithRawResponse = withRawResponse
+ override fun withOptions(
+ modifier: Consumer
+ ): ScheduleForStopServiceAsync =
+ ScheduleForStopServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build())
+
override fun retrieve(
params: ScheduleForStopRetrieveParams,
requestOptions: RequestOptions,
@@ -41,6 +47,13 @@ internal constructor(private val clientOptions: ClientOptions) : ScheduleForStop
private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ override fun withOptions(
+ modifier: Consumer
+ ): ScheduleForStopServiceAsync.WithRawResponse =
+ ScheduleForStopServiceAsyncImpl.WithRawResponseImpl(
+ clientOptions.toBuilder().apply(modifier::accept).build()
+ )
+
private val retrieveHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
.withErrorHandler(errorHandler)
@@ -55,6 +68,7 @@ internal constructor(private val clientOptions: ClientOptions) : ScheduleForStop
val request =
HttpRequest.builder()
.method(HttpMethod.GET)
+ .baseUrl(clientOptions.baseUrl())
.addPathSegments(
"api",
"where",
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/SearchForRouteServiceAsync.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/SearchForRouteServiceAsync.kt
index ea62172..671f10f 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/SearchForRouteServiceAsync.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/SearchForRouteServiceAsync.kt
@@ -2,8 +2,9 @@
package org.onebusaway.services.async
-import com.google.errorprone.annotations.MustBeClosed
import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
+import org.onebusaway.core.ClientOptions
import org.onebusaway.core.RequestOptions
import org.onebusaway.core.http.HttpResponseFor
import org.onebusaway.models.searchforroute.SearchForRouteListParams
@@ -16,6 +17,13 @@ interface SearchForRouteServiceAsync {
*/
fun withRawResponse(): WithRawResponse
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(modifier: Consumer): SearchForRouteServiceAsync
+
/** Search for a route based on its name. */
fun list(params: SearchForRouteListParams): CompletableFuture =
list(params, RequestOptions.none())
@@ -32,18 +40,25 @@ interface SearchForRouteServiceAsync {
*/
interface WithRawResponse {
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(
+ modifier: Consumer
+ ): SearchForRouteServiceAsync.WithRawResponse
+
/**
* Returns a raw HTTP response for `get /api/where/search/route.json`, but is otherwise the
* same as [SearchForRouteServiceAsync.list].
*/
- @MustBeClosed
fun list(
params: SearchForRouteListParams
): CompletableFuture> =
list(params, RequestOptions.none())
/** @see [list] */
- @MustBeClosed
fun list(
params: SearchForRouteListParams,
requestOptions: RequestOptions = RequestOptions.none(),
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/SearchForRouteServiceAsyncImpl.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/SearchForRouteServiceAsyncImpl.kt
index 574b9ee..20dfb0f 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/SearchForRouteServiceAsyncImpl.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/SearchForRouteServiceAsyncImpl.kt
@@ -3,6 +3,7 @@
package org.onebusaway.services.async
import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
import org.onebusaway.core.ClientOptions
import org.onebusaway.core.JsonValue
import org.onebusaway.core.RequestOptions
@@ -27,6 +28,11 @@ internal constructor(private val clientOptions: ClientOptions) : SearchForRouteS
override fun withRawResponse(): SearchForRouteServiceAsync.WithRawResponse = withRawResponse
+ override fun withOptions(
+ modifier: Consumer
+ ): SearchForRouteServiceAsync =
+ SearchForRouteServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build())
+
override fun list(
params: SearchForRouteListParams,
requestOptions: RequestOptions,
@@ -39,6 +45,13 @@ internal constructor(private val clientOptions: ClientOptions) : SearchForRouteS
private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ override fun withOptions(
+ modifier: Consumer
+ ): SearchForRouteServiceAsync.WithRawResponse =
+ SearchForRouteServiceAsyncImpl.WithRawResponseImpl(
+ clientOptions.toBuilder().apply(modifier::accept).build()
+ )
+
private val listHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
.withErrorHandler(errorHandler)
@@ -50,6 +63,7 @@ internal constructor(private val clientOptions: ClientOptions) : SearchForRouteS
val request =
HttpRequest.builder()
.method(HttpMethod.GET)
+ .baseUrl(clientOptions.baseUrl())
.addPathSegments("api", "where", "search", "route.json")
.build()
.prepareAsync(clientOptions, params)
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/SearchForStopServiceAsync.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/SearchForStopServiceAsync.kt
index 525689c..c2f7d7f 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/SearchForStopServiceAsync.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/SearchForStopServiceAsync.kt
@@ -2,8 +2,9 @@
package org.onebusaway.services.async
-import com.google.errorprone.annotations.MustBeClosed
import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
+import org.onebusaway.core.ClientOptions
import org.onebusaway.core.RequestOptions
import org.onebusaway.core.http.HttpResponseFor
import org.onebusaway.models.searchforstop.SearchForStopListParams
@@ -16,6 +17,13 @@ interface SearchForStopServiceAsync {
*/
fun withRawResponse(): WithRawResponse
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(modifier: Consumer): SearchForStopServiceAsync
+
/** Search for a stop based on its name. */
fun list(params: SearchForStopListParams): CompletableFuture =
list(params, RequestOptions.none())
@@ -32,18 +40,25 @@ interface SearchForStopServiceAsync {
*/
interface WithRawResponse {
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(
+ modifier: Consumer
+ ): SearchForStopServiceAsync.WithRawResponse
+
/**
* Returns a raw HTTP response for `get /api/where/search/stop.json`, but is otherwise the
* same as [SearchForStopServiceAsync.list].
*/
- @MustBeClosed
fun list(
params: SearchForStopListParams
): CompletableFuture> =
list(params, RequestOptions.none())
/** @see [list] */
- @MustBeClosed
fun list(
params: SearchForStopListParams,
requestOptions: RequestOptions = RequestOptions.none(),
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/SearchForStopServiceAsyncImpl.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/SearchForStopServiceAsyncImpl.kt
index 51078e2..ea2cde3 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/SearchForStopServiceAsyncImpl.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/SearchForStopServiceAsyncImpl.kt
@@ -3,6 +3,7 @@
package org.onebusaway.services.async
import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
import org.onebusaway.core.ClientOptions
import org.onebusaway.core.JsonValue
import org.onebusaway.core.RequestOptions
@@ -27,6 +28,9 @@ class SearchForStopServiceAsyncImpl internal constructor(private val clientOptio
override fun withRawResponse(): SearchForStopServiceAsync.WithRawResponse = withRawResponse
+ override fun withOptions(modifier: Consumer): SearchForStopServiceAsync =
+ SearchForStopServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build())
+
override fun list(
params: SearchForStopListParams,
requestOptions: RequestOptions,
@@ -39,6 +43,13 @@ class SearchForStopServiceAsyncImpl internal constructor(private val clientOptio
private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ override fun withOptions(
+ modifier: Consumer
+ ): SearchForStopServiceAsync.WithRawResponse =
+ SearchForStopServiceAsyncImpl.WithRawResponseImpl(
+ clientOptions.toBuilder().apply(modifier::accept).build()
+ )
+
private val listHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
.withErrorHandler(errorHandler)
@@ -50,6 +61,7 @@ class SearchForStopServiceAsyncImpl internal constructor(private val clientOptio
val request =
HttpRequest.builder()
.method(HttpMethod.GET)
+ .baseUrl(clientOptions.baseUrl())
.addPathSegments("api", "where", "search", "stop.json")
.build()
.prepareAsync(clientOptions, params)
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ShapeServiceAsync.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ShapeServiceAsync.kt
index 4614a08..0cda608 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ShapeServiceAsync.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ShapeServiceAsync.kt
@@ -2,8 +2,9 @@
package org.onebusaway.services.async
-import com.google.errorprone.annotations.MustBeClosed
import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
+import org.onebusaway.core.ClientOptions
import org.onebusaway.core.RequestOptions
import org.onebusaway.core.http.HttpResponseFor
import org.onebusaway.models.shape.ShapeRetrieveParams
@@ -16,6 +17,13 @@ interface ShapeServiceAsync {
*/
fun withRawResponse(): WithRawResponse
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(modifier: Consumer): ShapeServiceAsync
+
/** Retrieve a shape (the path traveled by a transit vehicle) by ID. */
fun retrieve(shapeId: String): CompletableFuture =
retrieve(shapeId, ShapeRetrieveParams.none())
@@ -54,16 +62,23 @@ interface ShapeServiceAsync {
/** A view of [ShapeServiceAsync] that provides access to raw HTTP responses for each method. */
interface WithRawResponse {
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(
+ modifier: Consumer
+ ): ShapeServiceAsync.WithRawResponse
+
/**
* Returns a raw HTTP response for `get /api/where/shape/{shapeID}.json`, but is otherwise
* the same as [ShapeServiceAsync.retrieve].
*/
- @MustBeClosed
fun retrieve(shapeId: String): CompletableFuture> =
retrieve(shapeId, ShapeRetrieveParams.none())
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
shapeId: String,
params: ShapeRetrieveParams = ShapeRetrieveParams.none(),
@@ -72,7 +87,6 @@ interface ShapeServiceAsync {
retrieve(params.toBuilder().shapeId(shapeId).build(), requestOptions)
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
shapeId: String,
params: ShapeRetrieveParams = ShapeRetrieveParams.none(),
@@ -80,21 +94,18 @@ interface ShapeServiceAsync {
retrieve(shapeId, params, RequestOptions.none())
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
params: ShapeRetrieveParams,
requestOptions: RequestOptions = RequestOptions.none(),
): CompletableFuture>
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
params: ShapeRetrieveParams
): CompletableFuture> =
retrieve(params, RequestOptions.none())
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
shapeId: String,
requestOptions: RequestOptions,
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ShapeServiceAsyncImpl.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ShapeServiceAsyncImpl.kt
index 17d585e..69df6ac 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ShapeServiceAsyncImpl.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/ShapeServiceAsyncImpl.kt
@@ -3,6 +3,7 @@
package org.onebusaway.services.async
import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
import kotlin.jvm.optionals.getOrNull
import org.onebusaway.core.ClientOptions
import org.onebusaway.core.JsonValue
@@ -29,6 +30,9 @@ class ShapeServiceAsyncImpl internal constructor(private val clientOptions: Clie
override fun withRawResponse(): ShapeServiceAsync.WithRawResponse = withRawResponse
+ override fun withOptions(modifier: Consumer): ShapeServiceAsync =
+ ShapeServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build())
+
override fun retrieve(
params: ShapeRetrieveParams,
requestOptions: RequestOptions,
@@ -41,6 +45,13 @@ class ShapeServiceAsyncImpl internal constructor(private val clientOptions: Clie
private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ override fun withOptions(
+ modifier: Consumer
+ ): ShapeServiceAsync.WithRawResponse =
+ ShapeServiceAsyncImpl.WithRawResponseImpl(
+ clientOptions.toBuilder().apply(modifier::accept).build()
+ )
+
private val retrieveHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
.withErrorHandler(errorHandler)
@@ -55,6 +66,7 @@ class ShapeServiceAsyncImpl internal constructor(private val clientOptions: Clie
val request =
HttpRequest.builder()
.method(HttpMethod.GET)
+ .baseUrl(clientOptions.baseUrl())
.addPathSegments("api", "where", "shape", "${params._pathParam(0)}.json")
.build()
.prepareAsync(clientOptions, params)
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/StopIdsForAgencyServiceAsync.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/StopIdsForAgencyServiceAsync.kt
index 6a2c5f9..34e9a4b 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/StopIdsForAgencyServiceAsync.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/StopIdsForAgencyServiceAsync.kt
@@ -2,8 +2,9 @@
package org.onebusaway.services.async
-import com.google.errorprone.annotations.MustBeClosed
import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
+import org.onebusaway.core.ClientOptions
import org.onebusaway.core.RequestOptions
import org.onebusaway.core.http.HttpResponseFor
import org.onebusaway.models.stopidsforagency.StopIdsForAgencyListParams
@@ -16,6 +17,13 @@ interface StopIdsForAgencyServiceAsync {
*/
fun withRawResponse(): WithRawResponse
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(modifier: Consumer): StopIdsForAgencyServiceAsync
+
/** Get stop IDs for a specific agency */
fun list(agencyId: String): CompletableFuture =
list(agencyId, StopIdsForAgencyListParams.none())
@@ -58,18 +66,25 @@ interface StopIdsForAgencyServiceAsync {
*/
interface WithRawResponse {
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(
+ modifier: Consumer
+ ): StopIdsForAgencyServiceAsync.WithRawResponse
+
/**
* Returns a raw HTTP response for `get /api/where/stop-ids-for-agency/{agencyID}.json`, but
* is otherwise the same as [StopIdsForAgencyServiceAsync.list].
*/
- @MustBeClosed
fun list(
agencyId: String
): CompletableFuture> =
list(agencyId, StopIdsForAgencyListParams.none())
/** @see [list] */
- @MustBeClosed
fun list(
agencyId: String,
params: StopIdsForAgencyListParams = StopIdsForAgencyListParams.none(),
@@ -78,7 +93,6 @@ interface StopIdsForAgencyServiceAsync {
list(params.toBuilder().agencyId(agencyId).build(), requestOptions)
/** @see [list] */
- @MustBeClosed
fun list(
agencyId: String,
params: StopIdsForAgencyListParams = StopIdsForAgencyListParams.none(),
@@ -86,21 +100,18 @@ interface StopIdsForAgencyServiceAsync {
list(agencyId, params, RequestOptions.none())
/** @see [list] */
- @MustBeClosed
fun list(
params: StopIdsForAgencyListParams,
requestOptions: RequestOptions = RequestOptions.none(),
): CompletableFuture>
/** @see [list] */
- @MustBeClosed
fun list(
params: StopIdsForAgencyListParams
): CompletableFuture> =
list(params, RequestOptions.none())
/** @see [list] */
- @MustBeClosed
fun list(
agencyId: String,
requestOptions: RequestOptions,
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/StopIdsForAgencyServiceAsyncImpl.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/StopIdsForAgencyServiceAsyncImpl.kt
index bbe0917..78999aa 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/StopIdsForAgencyServiceAsyncImpl.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/StopIdsForAgencyServiceAsyncImpl.kt
@@ -3,6 +3,7 @@
package org.onebusaway.services.async
import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
import kotlin.jvm.optionals.getOrNull
import org.onebusaway.core.ClientOptions
import org.onebusaway.core.JsonValue
@@ -29,6 +30,11 @@ internal constructor(private val clientOptions: ClientOptions) : StopIdsForAgenc
override fun withRawResponse(): StopIdsForAgencyServiceAsync.WithRawResponse = withRawResponse
+ override fun withOptions(
+ modifier: Consumer
+ ): StopIdsForAgencyServiceAsync =
+ StopIdsForAgencyServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build())
+
override fun list(
params: StopIdsForAgencyListParams,
requestOptions: RequestOptions,
@@ -41,6 +47,13 @@ internal constructor(private val clientOptions: ClientOptions) : StopIdsForAgenc
private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ override fun withOptions(
+ modifier: Consumer
+ ): StopIdsForAgencyServiceAsync.WithRawResponse =
+ StopIdsForAgencyServiceAsyncImpl.WithRawResponseImpl(
+ clientOptions.toBuilder().apply(modifier::accept).build()
+ )
+
private val listHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
.withErrorHandler(errorHandler)
@@ -55,6 +68,7 @@ internal constructor(private val clientOptions: ClientOptions) : StopIdsForAgenc
val request =
HttpRequest.builder()
.method(HttpMethod.GET)
+ .baseUrl(clientOptions.baseUrl())
.addPathSegments(
"api",
"where",
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/StopServiceAsync.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/StopServiceAsync.kt
index 597b17d..25761a3 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/StopServiceAsync.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/StopServiceAsync.kt
@@ -2,8 +2,9 @@
package org.onebusaway.services.async
-import com.google.errorprone.annotations.MustBeClosed
import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
+import org.onebusaway.core.ClientOptions
import org.onebusaway.core.RequestOptions
import org.onebusaway.core.http.HttpResponseFor
import org.onebusaway.models.stop.StopRetrieveParams
@@ -16,6 +17,13 @@ interface StopServiceAsync {
*/
fun withRawResponse(): WithRawResponse
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(modifier: Consumer): StopServiceAsync
+
/** Get details of a specific stop */
fun retrieve(stopId: String): CompletableFuture =
retrieve(stopId, StopRetrieveParams.none())
@@ -54,16 +62,21 @@ interface StopServiceAsync {
/** A view of [StopServiceAsync] that provides access to raw HTTP responses for each method. */
interface WithRawResponse {
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(modifier: Consumer): StopServiceAsync.WithRawResponse
+
/**
* Returns a raw HTTP response for `get /api/where/stop/{stopID}.json`, but is otherwise the
* same as [StopServiceAsync.retrieve].
*/
- @MustBeClosed
fun retrieve(stopId: String): CompletableFuture> =
retrieve(stopId, StopRetrieveParams.none())
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
stopId: String,
params: StopRetrieveParams = StopRetrieveParams.none(),
@@ -72,7 +85,6 @@ interface StopServiceAsync {
retrieve(params.toBuilder().stopId(stopId).build(), requestOptions)
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
stopId: String,
params: StopRetrieveParams = StopRetrieveParams.none(),
@@ -80,21 +92,18 @@ interface StopServiceAsync {
retrieve(stopId, params, RequestOptions.none())
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
params: StopRetrieveParams,
requestOptions: RequestOptions = RequestOptions.none(),
): CompletableFuture>
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
params: StopRetrieveParams
): CompletableFuture> =
retrieve(params, RequestOptions.none())
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
stopId: String,
requestOptions: RequestOptions,
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/StopServiceAsyncImpl.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/StopServiceAsyncImpl.kt
index 81d7c5a..ae752dd 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/StopServiceAsyncImpl.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/StopServiceAsyncImpl.kt
@@ -3,6 +3,7 @@
package org.onebusaway.services.async
import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
import kotlin.jvm.optionals.getOrNull
import org.onebusaway.core.ClientOptions
import org.onebusaway.core.JsonValue
@@ -29,6 +30,9 @@ class StopServiceAsyncImpl internal constructor(private val clientOptions: Clien
override fun withRawResponse(): StopServiceAsync.WithRawResponse = withRawResponse
+ override fun withOptions(modifier: Consumer): StopServiceAsync =
+ StopServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build())
+
override fun retrieve(
params: StopRetrieveParams,
requestOptions: RequestOptions,
@@ -41,6 +45,13 @@ class StopServiceAsyncImpl internal constructor(private val clientOptions: Clien
private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ override fun withOptions(
+ modifier: Consumer
+ ): StopServiceAsync.WithRawResponse =
+ StopServiceAsyncImpl.WithRawResponseImpl(
+ clientOptions.toBuilder().apply(modifier::accept).build()
+ )
+
private val retrieveHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
.withErrorHandler(errorHandler)
@@ -55,6 +66,7 @@ class StopServiceAsyncImpl internal constructor(private val clientOptions: Clien
val request =
HttpRequest.builder()
.method(HttpMethod.GET)
+ .baseUrl(clientOptions.baseUrl())
.addPathSegments("api", "where", "stop", "${params._pathParam(0)}.json")
.build()
.prepareAsync(clientOptions, params)
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/StopsForAgencyServiceAsync.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/StopsForAgencyServiceAsync.kt
index af0198f..e68be44 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/StopsForAgencyServiceAsync.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/StopsForAgencyServiceAsync.kt
@@ -2,8 +2,9 @@
package org.onebusaway.services.async
-import com.google.errorprone.annotations.MustBeClosed
import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
+import org.onebusaway.core.ClientOptions
import org.onebusaway.core.RequestOptions
import org.onebusaway.core.http.HttpResponseFor
import org.onebusaway.models.stopsforagency.StopsForAgencyListParams
@@ -16,6 +17,13 @@ interface StopsForAgencyServiceAsync {
*/
fun withRawResponse(): WithRawResponse
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(modifier: Consumer): StopsForAgencyServiceAsync
+
/** Get stops for a specific agency */
fun list(agencyId: String): CompletableFuture =
list(agencyId, StopsForAgencyListParams.none())
@@ -57,16 +65,23 @@ interface StopsForAgencyServiceAsync {
*/
interface WithRawResponse {
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(
+ modifier: Consumer
+ ): StopsForAgencyServiceAsync.WithRawResponse
+
/**
* Returns a raw HTTP response for `get /api/where/stops-for-agency/{agencyID}.json`, but is
* otherwise the same as [StopsForAgencyServiceAsync.list].
*/
- @MustBeClosed
fun list(agencyId: String): CompletableFuture> =
list(agencyId, StopsForAgencyListParams.none())
/** @see [list] */
- @MustBeClosed
fun list(
agencyId: String,
params: StopsForAgencyListParams = StopsForAgencyListParams.none(),
@@ -75,7 +90,6 @@ interface StopsForAgencyServiceAsync {
list(params.toBuilder().agencyId(agencyId).build(), requestOptions)
/** @see [list] */
- @MustBeClosed
fun list(
agencyId: String,
params: StopsForAgencyListParams = StopsForAgencyListParams.none(),
@@ -83,21 +97,18 @@ interface StopsForAgencyServiceAsync {
list(agencyId, params, RequestOptions.none())
/** @see [list] */
- @MustBeClosed
fun list(
params: StopsForAgencyListParams,
requestOptions: RequestOptions = RequestOptions.none(),
): CompletableFuture>
/** @see [list] */
- @MustBeClosed
fun list(
params: StopsForAgencyListParams
): CompletableFuture> =
list(params, RequestOptions.none())
/** @see [list] */
- @MustBeClosed
fun list(
agencyId: String,
requestOptions: RequestOptions,
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/StopsForAgencyServiceAsyncImpl.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/StopsForAgencyServiceAsyncImpl.kt
index 08a34be..e9a4151 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/StopsForAgencyServiceAsyncImpl.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/StopsForAgencyServiceAsyncImpl.kt
@@ -3,6 +3,7 @@
package org.onebusaway.services.async
import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
import kotlin.jvm.optionals.getOrNull
import org.onebusaway.core.ClientOptions
import org.onebusaway.core.JsonValue
@@ -29,6 +30,11 @@ internal constructor(private val clientOptions: ClientOptions) : StopsForAgencyS
override fun withRawResponse(): StopsForAgencyServiceAsync.WithRawResponse = withRawResponse
+ override fun withOptions(
+ modifier: Consumer
+ ): StopsForAgencyServiceAsync =
+ StopsForAgencyServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build())
+
override fun list(
params: StopsForAgencyListParams,
requestOptions: RequestOptions,
@@ -41,6 +47,13 @@ internal constructor(private val clientOptions: ClientOptions) : StopsForAgencyS
private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ override fun withOptions(
+ modifier: Consumer
+ ): StopsForAgencyServiceAsync.WithRawResponse =
+ StopsForAgencyServiceAsyncImpl.WithRawResponseImpl(
+ clientOptions.toBuilder().apply(modifier::accept).build()
+ )
+
private val listHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
.withErrorHandler(errorHandler)
@@ -55,6 +68,7 @@ internal constructor(private val clientOptions: ClientOptions) : StopsForAgencyS
val request =
HttpRequest.builder()
.method(HttpMethod.GET)
+ .baseUrl(clientOptions.baseUrl())
.addPathSegments(
"api",
"where",
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/StopsForLocationServiceAsync.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/StopsForLocationServiceAsync.kt
index 764ff9a..def885d 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/StopsForLocationServiceAsync.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/StopsForLocationServiceAsync.kt
@@ -2,8 +2,9 @@
package org.onebusaway.services.async
-import com.google.errorprone.annotations.MustBeClosed
import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
+import org.onebusaway.core.ClientOptions
import org.onebusaway.core.RequestOptions
import org.onebusaway.core.http.HttpResponseFor
import org.onebusaway.models.stopsforlocation.StopsForLocationListParams
@@ -16,6 +17,13 @@ interface StopsForLocationServiceAsync {
*/
fun withRawResponse(): WithRawResponse
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(modifier: Consumer): StopsForLocationServiceAsync
+
/** stops-for-location */
fun list(params: StopsForLocationListParams): CompletableFuture =
list(params, RequestOptions.none())
@@ -32,18 +40,25 @@ interface StopsForLocationServiceAsync {
*/
interface WithRawResponse {
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(
+ modifier: Consumer
+ ): StopsForLocationServiceAsync.WithRawResponse
+
/**
* Returns a raw HTTP response for `get /api/where/stops-for-location.json`, but is
* otherwise the same as [StopsForLocationServiceAsync.list].
*/
- @MustBeClosed
fun list(
params: StopsForLocationListParams
): CompletableFuture> =
list(params, RequestOptions.none())
/** @see [list] */
- @MustBeClosed
fun list(
params: StopsForLocationListParams,
requestOptions: RequestOptions = RequestOptions.none(),
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/StopsForLocationServiceAsyncImpl.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/StopsForLocationServiceAsyncImpl.kt
index 586b618..31aefd9 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/StopsForLocationServiceAsyncImpl.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/StopsForLocationServiceAsyncImpl.kt
@@ -3,6 +3,7 @@
package org.onebusaway.services.async
import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
import org.onebusaway.core.ClientOptions
import org.onebusaway.core.JsonValue
import org.onebusaway.core.RequestOptions
@@ -27,6 +28,11 @@ internal constructor(private val clientOptions: ClientOptions) : StopsForLocatio
override fun withRawResponse(): StopsForLocationServiceAsync.WithRawResponse = withRawResponse
+ override fun withOptions(
+ modifier: Consumer
+ ): StopsForLocationServiceAsync =
+ StopsForLocationServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build())
+
override fun list(
params: StopsForLocationListParams,
requestOptions: RequestOptions,
@@ -39,6 +45,13 @@ internal constructor(private val clientOptions: ClientOptions) : StopsForLocatio
private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ override fun withOptions(
+ modifier: Consumer
+ ): StopsForLocationServiceAsync.WithRawResponse =
+ StopsForLocationServiceAsyncImpl.WithRawResponseImpl(
+ clientOptions.toBuilder().apply(modifier::accept).build()
+ )
+
private val listHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
.withErrorHandler(errorHandler)
@@ -50,6 +63,7 @@ internal constructor(private val clientOptions: ClientOptions) : StopsForLocatio
val request =
HttpRequest.builder()
.method(HttpMethod.GET)
+ .baseUrl(clientOptions.baseUrl())
.addPathSegments("api", "where", "stops-for-location.json")
.build()
.prepareAsync(clientOptions, params)
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/StopsForRouteServiceAsync.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/StopsForRouteServiceAsync.kt
index 59f7969..6695f1a 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/StopsForRouteServiceAsync.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/StopsForRouteServiceAsync.kt
@@ -2,8 +2,9 @@
package org.onebusaway.services.async
-import com.google.errorprone.annotations.MustBeClosed
import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
+import org.onebusaway.core.ClientOptions
import org.onebusaway.core.RequestOptions
import org.onebusaway.core.http.HttpResponseFor
import org.onebusaway.models.stopsforroute.StopsForRouteListParams
@@ -16,6 +17,13 @@ interface StopsForRouteServiceAsync {
*/
fun withRawResponse(): WithRawResponse
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(modifier: Consumer): StopsForRouteServiceAsync
+
/** Get stops for a specific route */
fun list(routeId: String): CompletableFuture =
list(routeId, StopsForRouteListParams.none())
@@ -57,16 +65,23 @@ interface StopsForRouteServiceAsync {
*/
interface WithRawResponse {
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(
+ modifier: Consumer
+ ): StopsForRouteServiceAsync.WithRawResponse
+
/**
* Returns a raw HTTP response for `get /api/where/stops-for-route/{routeID}.json`, but is
* otherwise the same as [StopsForRouteServiceAsync.list].
*/
- @MustBeClosed
fun list(routeId: String): CompletableFuture> =
list(routeId, StopsForRouteListParams.none())
/** @see [list] */
- @MustBeClosed
fun list(
routeId: String,
params: StopsForRouteListParams = StopsForRouteListParams.none(),
@@ -75,7 +90,6 @@ interface StopsForRouteServiceAsync {
list(params.toBuilder().routeId(routeId).build(), requestOptions)
/** @see [list] */
- @MustBeClosed
fun list(
routeId: String,
params: StopsForRouteListParams = StopsForRouteListParams.none(),
@@ -83,21 +97,18 @@ interface StopsForRouteServiceAsync {
list(routeId, params, RequestOptions.none())
/** @see [list] */
- @MustBeClosed
fun list(
params: StopsForRouteListParams,
requestOptions: RequestOptions = RequestOptions.none(),
): CompletableFuture>
/** @see [list] */
- @MustBeClosed
fun list(
params: StopsForRouteListParams
): CompletableFuture> =
list(params, RequestOptions.none())
/** @see [list] */
- @MustBeClosed
fun list(
routeId: String,
requestOptions: RequestOptions,
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/StopsForRouteServiceAsyncImpl.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/StopsForRouteServiceAsyncImpl.kt
index 4739e7d..b8f821f 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/StopsForRouteServiceAsyncImpl.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/StopsForRouteServiceAsyncImpl.kt
@@ -3,6 +3,7 @@
package org.onebusaway.services.async
import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
import kotlin.jvm.optionals.getOrNull
import org.onebusaway.core.ClientOptions
import org.onebusaway.core.JsonValue
@@ -29,6 +30,9 @@ class StopsForRouteServiceAsyncImpl internal constructor(private val clientOptio
override fun withRawResponse(): StopsForRouteServiceAsync.WithRawResponse = withRawResponse
+ override fun withOptions(modifier: Consumer): StopsForRouteServiceAsync =
+ StopsForRouteServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build())
+
override fun list(
params: StopsForRouteListParams,
requestOptions: RequestOptions,
@@ -41,6 +45,13 @@ class StopsForRouteServiceAsyncImpl internal constructor(private val clientOptio
private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ override fun withOptions(
+ modifier: Consumer
+ ): StopsForRouteServiceAsync.WithRawResponse =
+ StopsForRouteServiceAsyncImpl.WithRawResponseImpl(
+ clientOptions.toBuilder().apply(modifier::accept).build()
+ )
+
private val listHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
.withErrorHandler(errorHandler)
@@ -55,6 +66,7 @@ class StopsForRouteServiceAsyncImpl internal constructor(private val clientOptio
val request =
HttpRequest.builder()
.method(HttpMethod.GET)
+ .baseUrl(clientOptions.baseUrl())
.addPathSegments(
"api",
"where",
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/TripDetailServiceAsync.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/TripDetailServiceAsync.kt
index 5de78ae..1a7804a 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/TripDetailServiceAsync.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/TripDetailServiceAsync.kt
@@ -2,8 +2,9 @@
package org.onebusaway.services.async
-import com.google.errorprone.annotations.MustBeClosed
import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
+import org.onebusaway.core.ClientOptions
import org.onebusaway.core.RequestOptions
import org.onebusaway.core.http.HttpResponseFor
import org.onebusaway.models.tripdetails.TripDetailRetrieveParams
@@ -16,6 +17,13 @@ interface TripDetailServiceAsync {
*/
fun withRawResponse(): WithRawResponse
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(modifier: Consumer): TripDetailServiceAsync
+
/** Retrieve Trip Details */
fun retrieve(tripId: String): CompletableFuture =
retrieve(tripId, TripDetailRetrieveParams.none())
@@ -58,18 +66,25 @@ interface TripDetailServiceAsync {
*/
interface WithRawResponse {
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(
+ modifier: Consumer
+ ): TripDetailServiceAsync.WithRawResponse
+
/**
* Returns a raw HTTP response for `get /api/where/trip-details/{tripID}.json`, but is
* otherwise the same as [TripDetailServiceAsync.retrieve].
*/
- @MustBeClosed
fun retrieve(
tripId: String
): CompletableFuture> =
retrieve(tripId, TripDetailRetrieveParams.none())
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
tripId: String,
params: TripDetailRetrieveParams = TripDetailRetrieveParams.none(),
@@ -78,7 +93,6 @@ interface TripDetailServiceAsync {
retrieve(params.toBuilder().tripId(tripId).build(), requestOptions)
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
tripId: String,
params: TripDetailRetrieveParams = TripDetailRetrieveParams.none(),
@@ -86,21 +100,18 @@ interface TripDetailServiceAsync {
retrieve(tripId, params, RequestOptions.none())
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
params: TripDetailRetrieveParams,
requestOptions: RequestOptions = RequestOptions.none(),
): CompletableFuture>
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
params: TripDetailRetrieveParams
): CompletableFuture> =
retrieve(params, RequestOptions.none())
/** @see [retrieve] */
- @MustBeClosed
fun retrieve(
tripId: String,
requestOptions: RequestOptions,
diff --git a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/TripDetailServiceAsyncImpl.kt b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/TripDetailServiceAsyncImpl.kt
index 95045d3..b8d3d76 100644
--- a/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/TripDetailServiceAsyncImpl.kt
+++ b/onebusaway-sdk-java-core/src/main/kotlin/org/onebusaway/services/async/TripDetailServiceAsyncImpl.kt
@@ -3,6 +3,7 @@
package org.onebusaway.services.async
import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
import kotlin.jvm.optionals.getOrNull
import org.onebusaway.core.ClientOptions
import org.onebusaway.core.JsonValue
@@ -29,6 +30,9 @@ class TripDetailServiceAsyncImpl internal constructor(private val clientOptions:
override fun withRawResponse(): TripDetailServiceAsync.WithRawResponse = withRawResponse
+ override fun withOptions(modifier: Consumer): TripDetailServiceAsync =
+ TripDetailServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build())
+
override fun retrieve(
params: TripDetailRetrieveParams,
requestOptions: RequestOptions,
@@ -41,6 +45,13 @@ class TripDetailServiceAsyncImpl internal constructor(private val clientOptions:
private val errorHandler: Handler