Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: 0.1.0-alpha.29 #81

Merged
merged 2 commits into from
Nov 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.1.0-alpha.28"
".": "0.1.0-alpha.29"
}
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 0.1.0-alpha.29 (2024-11-23)

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

### Chores

* **internal:** codegen related update ([#80](https://github.com/OneBusAway/kotlin-sdk/issues/80)) ([9ac39b3](https://github.com/OneBusAway/kotlin-sdk/commit/9ac39b3f01c37c9f177749f185be4e6374b9f469))

## 0.1.0-alpha.28 (2024-11-21)

Full Changelog: [v0.1.0-alpha.27...v0.1.0-alpha.28](https://github.com/OneBusAway/kotlin-sdk/compare/v0.1.0-alpha.27...v0.1.0-alpha.28)
Expand Down
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The REST API documentation can be found on [developer.onebusaway.org](https://d
<!-- x-release-please-start-version -->

```kotlin
implementation("org.onebusaway:onebusaway-sdk-kotlin:0.1.0-alpha.28")
implementation("org.onebusaway:onebusaway-sdk-kotlin:0.1.0-alpha.29")
```

#### Maven
Expand All @@ -30,7 +30,7 @@ implementation("org.onebusaway:onebusaway-sdk-kotlin:0.1.0-alpha.28")
<dependency>
<groupId>org.onebusaway</groupId>
<artifactId>onebusaway-sdk-kotlin</artifactId>
<version>0.1.0-alpha.28</version>
<version>0.1.0-alpha.29</version>
</dependency>
```

Expand Down Expand Up @@ -210,6 +210,22 @@ val client = OnebusawaySdkOkHttpClient.builder()
.build()
```

## Logging

We use the standard [OkHttp logging interceptor](https://github.com/square/okhttp/tree/master/okhttp-logging-interceptor).

You can enable logging by setting the environment variable `ONEBUSAWAY_SDK_LOG` to `info`.

```sh
$ export ONEBUSAWAY_SDK_LOG=info
```

Or to `debug` for more verbose logging.

```sh
$ export ONEBUSAWAY_SDK_LOG=debug
```

## Semantic versioning

This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {

allprojects {
group = "org.onebusaway"
version = "0.1.0-alpha.28" // x-release-please-version
version = "0.1.0-alpha.29" // x-release-please-version
}

nexusPublishing {
Expand Down
1 change: 1 addition & 0 deletions onebusaway-sdk-kotlin-client-okhttp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ dependencies {
api(project(":onebusaway-sdk-kotlin-core"))

implementation("com.squareup.okhttp3:okhttp:4.12.0")
implementation("com.squareup.okhttp3:logging-interceptor:4.12.0")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.0")

testImplementation(kotlin("test"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import okhttp3.Request
import okhttp3.RequestBody
import okhttp3.RequestBody.Companion.toRequestBody
import okhttp3.Response
import okhttp3.logging.HttpLoggingInterceptor
import okio.BufferedSink
import org.onebusaway.core.RequestOptions
import org.onebusaway.core.http.Headers
Expand All @@ -30,14 +31,28 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val
HttpClient {

private fun getClient(requestOptions: RequestOptions): okhttp3.OkHttpClient {
val timeout = requestOptions.timeout ?: return okHttpClient
return okHttpClient
.newBuilder()
.connectTimeout(timeout)
.readTimeout(timeout)
.writeTimeout(timeout)
.callTimeout(if (timeout.seconds == 0L) timeout else timeout.plusSeconds(30))
.build()
val clientBuilder = okHttpClient.newBuilder()

val logLevel =
when (System.getenv("ONEBUSAWAY_SDK_LOG")?.lowercase()) {
"info" -> HttpLoggingInterceptor.Level.BASIC
"debug" -> HttpLoggingInterceptor.Level.BODY
else -> null
}
if (logLevel != null) {
clientBuilder.addNetworkInterceptor(HttpLoggingInterceptor().setLevel(logLevel))
}

val timeout = requestOptions.timeout
if (timeout != null) {
clientBuilder
.connectTimeout(timeout)
.readTimeout(timeout)
.writeTimeout(timeout)
.callTimeout(if (timeout.seconds == 0L) timeout else timeout.plusSeconds(30))
}

return clientBuilder.build()
}

override fun execute(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,13 @@ constructor(
private val additionalQueryParams: QueryParams,
) {

internal fun getHeaders(): Headers = additionalHeaders

internal fun getQueryParams(): QueryParams = additionalQueryParams

fun _additionalHeaders(): Headers = additionalHeaders

fun _additionalQueryParams(): QueryParams = additionalQueryParams

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}

return /* spotless:off */ other is AgenciesWithCoverageListParams && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */
}

override fun hashCode(): Int = /* spotless:off */ Objects.hash(additionalHeaders, additionalQueryParams) /* spotless:on */
internal fun getHeaders(): Headers = additionalHeaders

override fun toString() =
"AgenciesWithCoverageListParams{additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
internal fun getQueryParams(): QueryParams = additionalQueryParams

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

Expand All @@ -49,8 +36,8 @@ constructor(
private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()

internal fun from(agenciesWithCoverageListParams: AgenciesWithCoverageListParams) = apply {
additionalHeaders(agenciesWithCoverageListParams.additionalHeaders)
additionalQueryParams(agenciesWithCoverageListParams.additionalQueryParams)
additionalHeaders = agenciesWithCoverageListParams.additionalHeaders.toBuilder()
additionalQueryParams = agenciesWithCoverageListParams.additionalQueryParams.toBuilder()
}

fun additionalHeaders(additionalHeaders: Headers) = apply {
Expand Down Expand Up @@ -154,4 +141,17 @@ constructor(
fun build(): AgenciesWithCoverageListParams =
AgenciesWithCoverageListParams(additionalHeaders.build(), additionalQueryParams.build())
}

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}

return /* spotless:off */ other is AgenciesWithCoverageListParams && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */
}

override fun hashCode(): Int = /* spotless:off */ Objects.hash(additionalHeaders, additionalQueryParams) /* spotless:on */

override fun toString() =
"AgenciesWithCoverageListParams{additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ constructor(

fun agencyId(): String = agencyId

fun _additionalHeaders(): Headers = additionalHeaders

fun _additionalQueryParams(): QueryParams = additionalQueryParams

internal fun getHeaders(): Headers = additionalHeaders

internal fun getQueryParams(): QueryParams = additionalQueryParams
Expand All @@ -28,23 +32,6 @@ constructor(
}
}

fun _additionalHeaders(): Headers = additionalHeaders

fun _additionalQueryParams(): QueryParams = additionalQueryParams

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}

return /* spotless:off */ other is AgencyRetrieveParams && agencyId == other.agencyId && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */
}

override fun hashCode(): Int = /* spotless:off */ Objects.hash(agencyId, additionalHeaders, additionalQueryParams) /* spotless:on */

override fun toString() =
"AgencyRetrieveParams{agencyId=$agencyId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"

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

companion object {
Expand All @@ -60,9 +47,9 @@ constructor(
private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()

internal fun from(agencyRetrieveParams: AgencyRetrieveParams) = apply {
this.agencyId = agencyRetrieveParams.agencyId
additionalHeaders(agencyRetrieveParams.additionalHeaders)
additionalQueryParams(agencyRetrieveParams.additionalQueryParams)
agencyId = agencyRetrieveParams.agencyId
additionalHeaders = agencyRetrieveParams.additionalHeaders.toBuilder()
additionalQueryParams = agencyRetrieveParams.additionalQueryParams.toBuilder()
}

fun agencyId(agencyId: String) = apply { this.agencyId = agencyId }
Expand Down Expand Up @@ -172,4 +159,17 @@ constructor(
additionalQueryParams.build(),
)
}

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}

return /* spotless:off */ other is AgencyRetrieveParams && agencyId == other.agencyId && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */
}

override fun hashCode(): Int = /* spotless:off */ Objects.hash(agencyId, additionalHeaders, additionalQueryParams) /* spotless:on */

override fun toString() =
"AgencyRetrieveParams{agencyId=$agencyId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ constructor(

fun time(): OffsetDateTime? = time

fun _additionalHeaders(): Headers = additionalHeaders

fun _additionalQueryParams(): QueryParams = additionalQueryParams

internal fun getHeaders(): Headers = additionalHeaders

internal fun getQueryParams(): QueryParams {
Expand All @@ -48,23 +52,6 @@ constructor(
}
}

fun _additionalHeaders(): Headers = additionalHeaders

fun _additionalQueryParams(): QueryParams = additionalQueryParams

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}

return /* spotless:off */ other is ArrivalAndDepartureListParams && stopId == other.stopId && minutesAfter == other.minutesAfter && minutesBefore == other.minutesBefore && time == other.time && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */
}

override fun hashCode(): Int = /* spotless:off */ Objects.hash(stopId, minutesAfter, minutesBefore, time, additionalHeaders, additionalQueryParams) /* spotless:on */

override fun toString() =
"ArrivalAndDepartureListParams{stopId=$stopId, minutesAfter=$minutesAfter, minutesBefore=$minutesBefore, time=$time, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"

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

companion object {
Expand All @@ -83,12 +70,12 @@ constructor(
private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()

internal fun from(arrivalAndDepartureListParams: ArrivalAndDepartureListParams) = apply {
this.stopId = arrivalAndDepartureListParams.stopId
this.minutesAfter = arrivalAndDepartureListParams.minutesAfter
this.minutesBefore = arrivalAndDepartureListParams.minutesBefore
this.time = arrivalAndDepartureListParams.time
additionalHeaders(arrivalAndDepartureListParams.additionalHeaders)
additionalQueryParams(arrivalAndDepartureListParams.additionalQueryParams)
stopId = arrivalAndDepartureListParams.stopId
minutesAfter = arrivalAndDepartureListParams.minutesAfter
minutesBefore = arrivalAndDepartureListParams.minutesBefore
time = arrivalAndDepartureListParams.time
additionalHeaders = arrivalAndDepartureListParams.additionalHeaders.toBuilder()
additionalQueryParams = arrivalAndDepartureListParams.additionalQueryParams.toBuilder()
}

fun stopId(stopId: String) = apply { this.stopId = stopId }
Expand Down Expand Up @@ -210,4 +197,17 @@ constructor(
additionalQueryParams.build(),
)
}

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}

return /* spotless:off */ other is ArrivalAndDepartureListParams && stopId == other.stopId && minutesAfter == other.minutesAfter && minutesBefore == other.minutesBefore && time == other.time && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */
}

override fun hashCode(): Int = /* spotless:off */ Objects.hash(stopId, minutesAfter, minutesBefore, time, additionalHeaders, additionalQueryParams) /* spotless:on */

override fun toString() =
"ArrivalAndDepartureListParams{stopId=$stopId, minutesAfter=$minutesAfter, minutesBefore=$minutesBefore, time=$time, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ constructor(

fun vehicleId(): String? = vehicleId

fun _additionalHeaders(): Headers = additionalHeaders

fun _additionalQueryParams(): QueryParams = additionalQueryParams

internal fun getHeaders(): Headers = additionalHeaders

internal fun getQueryParams(): QueryParams {
Expand All @@ -52,23 +56,6 @@ constructor(
}
}

fun _additionalHeaders(): Headers = additionalHeaders

fun _additionalQueryParams(): QueryParams = additionalQueryParams

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}

return /* spotless:off */ other is ArrivalAndDepartureRetrieveParams && stopId == other.stopId && serviceDate == other.serviceDate && tripId == other.tripId && stopSequence == other.stopSequence && time == other.time && vehicleId == other.vehicleId && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */
}

override fun hashCode(): Int = /* spotless:off */ Objects.hash(stopId, serviceDate, tripId, stopSequence, time, vehicleId, additionalHeaders, additionalQueryParams) /* spotless:on */

override fun toString() =
"ArrivalAndDepartureRetrieveParams{stopId=$stopId, serviceDate=$serviceDate, tripId=$tripId, stopSequence=$stopSequence, time=$time, vehicleId=$vehicleId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"

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

companion object {
Expand All @@ -90,14 +77,15 @@ constructor(

internal fun from(arrivalAndDepartureRetrieveParams: ArrivalAndDepartureRetrieveParams) =
apply {
this.stopId = arrivalAndDepartureRetrieveParams.stopId
this.serviceDate = arrivalAndDepartureRetrieveParams.serviceDate
this.tripId = arrivalAndDepartureRetrieveParams.tripId
this.stopSequence = arrivalAndDepartureRetrieveParams.stopSequence
this.time = arrivalAndDepartureRetrieveParams.time
this.vehicleId = arrivalAndDepartureRetrieveParams.vehicleId
additionalHeaders(arrivalAndDepartureRetrieveParams.additionalHeaders)
additionalQueryParams(arrivalAndDepartureRetrieveParams.additionalQueryParams)
stopId = arrivalAndDepartureRetrieveParams.stopId
serviceDate = arrivalAndDepartureRetrieveParams.serviceDate
tripId = arrivalAndDepartureRetrieveParams.tripId
stopSequence = arrivalAndDepartureRetrieveParams.stopSequence
time = arrivalAndDepartureRetrieveParams.time
vehicleId = arrivalAndDepartureRetrieveParams.vehicleId
additionalHeaders = arrivalAndDepartureRetrieveParams.additionalHeaders.toBuilder()
additionalQueryParams =
arrivalAndDepartureRetrieveParams.additionalQueryParams.toBuilder()
}

fun stopId(stopId: String) = apply { this.stopId = stopId }
Expand Down Expand Up @@ -222,4 +210,17 @@ constructor(
additionalQueryParams.build(),
)
}

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}

return /* spotless:off */ other is ArrivalAndDepartureRetrieveParams && stopId == other.stopId && serviceDate == other.serviceDate && tripId == other.tripId && stopSequence == other.stopSequence && time == other.time && vehicleId == other.vehicleId && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */
}

override fun hashCode(): Int = /* spotless:off */ Objects.hash(stopId, serviceDate, tripId, stopSequence, time, vehicleId, additionalHeaders, additionalQueryParams) /* spotless:on */

override fun toString() =
"ArrivalAndDepartureRetrieveParams{stopId=$stopId, serviceDate=$serviceDate, tripId=$tripId, stopSequence=$stopSequence, time=$time, vehicleId=$vehicleId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
}
Loading
Loading