Skip to content

Commit 2c21caa

Browse files
feat(api): manual updates (#74)
1 parent 4b1d141 commit 2c21caa

File tree

125 files changed

+6591
-5245
lines changed

Some content is hidden

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

125 files changed

+6591
-5245
lines changed

README.md

Lines changed: 49 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ OnebusawaySdkClient client = OnebusawaySdkOkHttpClient.builder()
5858
Alternately, set the environment with `ONEBUSAWAY_API_KEY`, and use `OnebusawaySdkOkHttpClient.fromEnv()` to read from the environment.
5959

6060
```java
61+
import org.onebusaway.client.OnebusawaySdkClient;
62+
import org.onebusaway.client.okhttp.OnebusawaySdkOkHttpClient;
63+
6164
OnebusawaySdkClient client = OnebusawaySdkOkHttpClient.fromEnv();
6265

6366
// Note: you can also call fromEnv() from the client builder, for example if you need to set additional properties
@@ -77,8 +80,7 @@ Read the documentation for more configuration options.
7780

7881
### Example: creating a resource
7982

80-
To create a new current time, first use the `CurrentTimeRetrieveParams` builder to specify attributes,
81-
then pass that to the `retrieve` method of the `currentTime` service.
83+
To create a new current time, first use the `CurrentTimeRetrieveParams` builder to specify attributes, then pass that to the `retrieve` method of the `currentTime` service.
8284

8385
```java
8486
import org.onebusaway.models.CurrentTimeRetrieveParams;
@@ -96,14 +98,14 @@ CurrentTimeRetrieveResponse currentTime = client.currentTime().retrieve(params);
9698

9799
To make a request to the Onebusaway SDK API, you generally build an instance of the appropriate `Params` class.
98100

99-
In [Example: creating a resource](#example-creating-a-resource) above, we used the `CurrentTimeRetrieveParams.builder()` to pass to
100-
the `retrieve` method of the `currentTime` service.
101+
In [Example: creating a resource](#example-creating-a-resource) above, we used the `CurrentTimeRetrieveParams.builder()` to pass to the `retrieve` method of the `currentTime` service.
101102

102-
Sometimes, the API may support other properties that are not yet supported in the Java SDK types. In that case,
103-
you can attach them using the `putAdditionalProperty` method.
103+
Sometimes, the API may support other properties that are not yet supported in the Java SDK types. In that case, you can attach them using the `putAdditionalProperty` method.
104104

105105
```java
106-
import org.onebusaway.models.core.JsonValue;
106+
import org.onebusaway.core.JsonValue;
107+
import org.onebusaway.models.CurrentTimeRetrieveParams;
108+
107109
CurrentTimeRetrieveParams params = CurrentTimeRetrieveParams.builder()
108110
// ... normal properties
109111
.putAdditionalProperty("secret_param", JsonValue.from("4242"))
@@ -117,15 +119,19 @@ CurrentTimeRetrieveParams params = CurrentTimeRetrieveParams.builder()
117119
When receiving a response, the Onebusaway SDK Java SDK will deserialize it into instances of the typed model classes. In rare cases, the API may return a response property that doesn't match the expected Java type. If you directly access the mistaken property, the SDK will throw an unchecked `OnebusawaySdkInvalidDataException` at runtime. If you would prefer to check in advance that that response is completely well-typed, call `.validate()` on the returned model.
118120

119121
```java
122+
import org.onebusaway.models.CurrentTimeRetrieveResponse;
123+
120124
CurrentTimeRetrieveResponse currentTime = client.currentTime().retrieve().validate();
121125
```
122126

123127
### Response properties as JSON
124128

125-
In rare cases, you may want to access the underlying JSON value for a response property rather than using the typed version provided by
126-
this SDK. Each model property has a corresponding JSON version, with an underscore before the method name, which returns a `JsonField` value.
129+
In rare cases, you may want to access the underlying JSON value for a response property rather than using the typed version provided by this SDK. Each model property has a corresponding JSON version, with an underscore before the method name, which returns a `JsonField` value.
127130

128131
```java
132+
import java.util.Optional;
133+
import org.onebusaway.core.JsonField;
134+
129135
JsonField field = responseObj._field();
130136

131137
if (field.isMissing()) {
@@ -147,6 +153,8 @@ if (field.isMissing()) {
147153
Sometimes, the server response may include additional properties that are not yet available in this library's types. You can access them using the model's `_additionalProperties` method:
148154

149155
```java
156+
import org.onebusaway.core.JsonValue;
157+
150158
JsonValue secret = references._additionalProperties().get("secret_field");
151159
```
152160

@@ -160,31 +168,33 @@ This library throws exceptions in a single hierarchy for easy handling:
160168

161169
- **`OnebusawaySdkException`** - Base exception for all exceptions
162170

163-
- **`OnebusawaySdkServiceException`** - HTTP errors with a well-formed response body we were able to parse. The exception message and the `.debuggingRequestId()` will be set by the server.
171+
- **`OnebusawaySdkServiceException`** - HTTP errors with a well-formed response body we were able to parse. The exception message and the `.debuggingRequestId()` will be set by the server.
164172

165-
| 400 | BadRequestException |
166-
| ------ | ----------------------------- |
167-
| 401 | AuthenticationException |
168-
| 403 | PermissionDeniedException |
169-
| 404 | NotFoundException |
170-
| 422 | UnprocessableEntityException |
171-
| 429 | RateLimitException |
172-
| 5xx | InternalServerException |
173-
| others | UnexpectedStatusCodeException |
173+
| 400 | BadRequestException |
174+
| ------ | ----------------------------- |
175+
| 401 | AuthenticationException |
176+
| 403 | PermissionDeniedException |
177+
| 404 | NotFoundException |
178+
| 422 | UnprocessableEntityException |
179+
| 429 | RateLimitException |
180+
| 5xx | InternalServerException |
181+
| others | UnexpectedStatusCodeException |
174182

175-
- **`OnebusawaySdkIoException`** - I/O networking errors
176-
- **`OnebusawaySdkInvalidDataException`** - any other exceptions on the client side, e.g.:
177-
- We failed to serialize the request body
178-
- We failed to parse the response body (has access to response code and body)
183+
- **`OnebusawaySdkIoException`** - I/O networking errors
184+
- **`OnebusawaySdkInvalidDataException`** - any other exceptions on the client side, e.g.:
185+
- We failed to serialize the request body
186+
- We failed to parse the response body (has access to response code and body)
179187

180188
## Network options
181189

182190
### Retries
183191

184-
Requests that experience certain errors are automatically retried 2 times by default, with a short exponential backoff. Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict, 429 Rate Limit, and >=500 Internal errors will all be retried by default.
185-
You can provide a `maxRetries` on the client builder to configure this:
192+
Requests that experience certain errors are automatically retried 2 times by default, with a short exponential backoff. Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict, 429 Rate Limit, and >=500 Internal errors will all be retried by default. You can provide a `maxRetries` on the client builder to configure this:
186193

187194
```java
195+
import org.onebusaway.client.OnebusawaySdkClient;
196+
import org.onebusaway.client.okhttp.OnebusawaySdkOkHttpClient;
197+
188198
OnebusawaySdkClient client = OnebusawaySdkOkHttpClient.builder()
189199
.fromEnv()
190200
.maxRetries(4)
@@ -196,6 +206,10 @@ OnebusawaySdkClient client = OnebusawaySdkOkHttpClient.builder()
196206
Requests time out after 1 minute by default. You can configure this on the client builder:
197207

198208
```java
209+
import java.time.Duration;
210+
import org.onebusaway.client.OnebusawaySdkClient;
211+
import org.onebusaway.client.okhttp.OnebusawaySdkOkHttpClient;
212+
199213
OnebusawaySdkClient client = OnebusawaySdkOkHttpClient.builder()
200214
.fromEnv()
201215
.timeout(Duration.ofSeconds(30))
@@ -207,26 +221,26 @@ OnebusawaySdkClient client = OnebusawaySdkOkHttpClient.builder()
207221
Requests can be routed through a proxy. You can configure this on the client builder:
208222

209223
```java
224+
import java.net.InetSocketAddress;
225+
import java.net.Proxy;
226+
import org.onebusaway.client.OnebusawaySdkClient;
227+
import org.onebusaway.client.okhttp.OnebusawaySdkOkHttpClient;
228+
210229
OnebusawaySdkClient client = OnebusawaySdkOkHttpClient.builder()
211230
.fromEnv()
212-
.proxy(new Proxy(
213-
Type.HTTP,
214-
new InetSocketAddress("proxy.com", 8080)
215-
))
231+
.proxy(new Proxy(Proxy.Type.HTTP, new InetSocketAddress("example.com", 8080)))
216232
.build();
217233
```
218234

219235
## Making custom/undocumented requests
220236

221-
This library is typed for convenient access to the documented API. If you need to access undocumented
222-
params or response properties, the library can still be used.
237+
This library is typed for convenient access to the documented API. If you need to access undocumented params or response properties, the library can still be used.
223238

224239
### Undocumented request params
225240

226-
To make requests using undocumented parameters, you can provide or override parameters on the params object
227-
while building it.
241+
To make requests using undocumented parameters, you can provide or override parameters on the params object while building it.
228242

229-
```kotlin
243+
```java
230244
FooCreateParams address = FooCreateParams.builder()
231245
.id("my_id")
232246
.putAdditionalProperty("secret_prop", JsonValue.from("hello"))
@@ -235,10 +249,7 @@ FooCreateParams address = FooCreateParams.builder()
235249

236250
### Undocumented response properties
237251

238-
To access undocumented response properties, you can use `res._additionalProperties()` on a response object to
239-
get a map of untyped fields of type `Map<String, JsonValue>`. You can then access fields like
240-
`._additionalProperties().get("secret_prop").asString()` or use other helpers defined on the `JsonValue` class
241-
to extract it to a desired type.
252+
To access undocumented response properties, you can use `res._additionalProperties()` on a response object to get a map of untyped fields of type `Map<String, JsonValue>`. You can then access fields like `._additionalProperties().get("secret_prop").asString()` or use other helpers defined on the `JsonValue` class to extract it to a desired type.
242253

243254
## Logging
244255

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

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

33
package org.onebusaway.client
44

5-
import org.onebusaway.models.*
6-
import org.onebusaway.services.blocking.*
5+
import org.onebusaway.services.blocking.AgenciesWithCoverageService
6+
import org.onebusaway.services.blocking.AgencyService
7+
import org.onebusaway.services.blocking.ArrivalAndDepartureService
8+
import org.onebusaway.services.blocking.BlockService
9+
import org.onebusaway.services.blocking.ConfigService
10+
import org.onebusaway.services.blocking.CurrentTimeService
11+
import org.onebusaway.services.blocking.ReportProblemWithStopService
12+
import org.onebusaway.services.blocking.ReportProblemWithTripService
13+
import org.onebusaway.services.blocking.RouteIdsForAgencyService
14+
import org.onebusaway.services.blocking.RouteService
15+
import org.onebusaway.services.blocking.RoutesForAgencyService
16+
import org.onebusaway.services.blocking.RoutesForLocationService
17+
import org.onebusaway.services.blocking.ScheduleForRouteService
18+
import org.onebusaway.services.blocking.ScheduleForStopService
19+
import org.onebusaway.services.blocking.SearchForRouteService
20+
import org.onebusaway.services.blocking.SearchForStopService
21+
import org.onebusaway.services.blocking.ShapeService
22+
import org.onebusaway.services.blocking.StopIdsForAgencyService
23+
import org.onebusaway.services.blocking.StopService
24+
import org.onebusaway.services.blocking.StopsForAgencyService
25+
import org.onebusaway.services.blocking.StopsForLocationService
26+
import org.onebusaway.services.blocking.StopsForRouteService
27+
import org.onebusaway.services.blocking.TripDetailService
28+
import org.onebusaway.services.blocking.TripForVehicleService
29+
import org.onebusaway.services.blocking.TripService
30+
import org.onebusaway.services.blocking.TripsForLocationService
31+
import org.onebusaway.services.blocking.TripsForRouteService
32+
import org.onebusaway.services.blocking.VehiclesForAgencyService
733

834
interface OnebusawaySdkClient {
935

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

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

33
package org.onebusaway.client
44

5-
import org.onebusaway.models.*
6-
import org.onebusaway.services.async.*
5+
import org.onebusaway.services.async.AgenciesWithCoverageServiceAsync
6+
import org.onebusaway.services.async.AgencyServiceAsync
7+
import org.onebusaway.services.async.ArrivalAndDepartureServiceAsync
8+
import org.onebusaway.services.async.BlockServiceAsync
9+
import org.onebusaway.services.async.ConfigServiceAsync
10+
import org.onebusaway.services.async.CurrentTimeServiceAsync
11+
import org.onebusaway.services.async.ReportProblemWithStopServiceAsync
12+
import org.onebusaway.services.async.ReportProblemWithTripServiceAsync
13+
import org.onebusaway.services.async.RouteIdsForAgencyServiceAsync
14+
import org.onebusaway.services.async.RouteServiceAsync
15+
import org.onebusaway.services.async.RoutesForAgencyServiceAsync
16+
import org.onebusaway.services.async.RoutesForLocationServiceAsync
17+
import org.onebusaway.services.async.ScheduleForRouteServiceAsync
18+
import org.onebusaway.services.async.ScheduleForStopServiceAsync
19+
import org.onebusaway.services.async.SearchForRouteServiceAsync
20+
import org.onebusaway.services.async.SearchForStopServiceAsync
21+
import org.onebusaway.services.async.ShapeServiceAsync
22+
import org.onebusaway.services.async.StopIdsForAgencyServiceAsync
23+
import org.onebusaway.services.async.StopServiceAsync
24+
import org.onebusaway.services.async.StopsForAgencyServiceAsync
25+
import org.onebusaway.services.async.StopsForLocationServiceAsync
26+
import org.onebusaway.services.async.StopsForRouteServiceAsync
27+
import org.onebusaway.services.async.TripDetailServiceAsync
28+
import org.onebusaway.services.async.TripForVehicleServiceAsync
29+
import org.onebusaway.services.async.TripServiceAsync
30+
import org.onebusaway.services.async.TripsForLocationServiceAsync
31+
import org.onebusaway.services.async.TripsForRouteServiceAsync
32+
import org.onebusaway.services.async.VehiclesForAgencyServiceAsync
733

834
interface OnebusawaySdkClientAsync {
935

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

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,62 @@ package org.onebusaway.client
44

55
import org.onebusaway.core.ClientOptions
66
import org.onebusaway.core.getPackageVersion
7-
import org.onebusaway.models.*
8-
import org.onebusaway.services.async.*
7+
import org.onebusaway.services.async.AgenciesWithCoverageServiceAsync
8+
import org.onebusaway.services.async.AgenciesWithCoverageServiceAsyncImpl
9+
import org.onebusaway.services.async.AgencyServiceAsync
10+
import org.onebusaway.services.async.AgencyServiceAsyncImpl
11+
import org.onebusaway.services.async.ArrivalAndDepartureServiceAsync
12+
import org.onebusaway.services.async.ArrivalAndDepartureServiceAsyncImpl
13+
import org.onebusaway.services.async.BlockServiceAsync
14+
import org.onebusaway.services.async.BlockServiceAsyncImpl
15+
import org.onebusaway.services.async.ConfigServiceAsync
16+
import org.onebusaway.services.async.ConfigServiceAsyncImpl
17+
import org.onebusaway.services.async.CurrentTimeServiceAsync
18+
import org.onebusaway.services.async.CurrentTimeServiceAsyncImpl
19+
import org.onebusaway.services.async.ReportProblemWithStopServiceAsync
20+
import org.onebusaway.services.async.ReportProblemWithStopServiceAsyncImpl
21+
import org.onebusaway.services.async.ReportProblemWithTripServiceAsync
22+
import org.onebusaway.services.async.ReportProblemWithTripServiceAsyncImpl
23+
import org.onebusaway.services.async.RouteIdsForAgencyServiceAsync
24+
import org.onebusaway.services.async.RouteIdsForAgencyServiceAsyncImpl
25+
import org.onebusaway.services.async.RouteServiceAsync
26+
import org.onebusaway.services.async.RouteServiceAsyncImpl
27+
import org.onebusaway.services.async.RoutesForAgencyServiceAsync
28+
import org.onebusaway.services.async.RoutesForAgencyServiceAsyncImpl
29+
import org.onebusaway.services.async.RoutesForLocationServiceAsync
30+
import org.onebusaway.services.async.RoutesForLocationServiceAsyncImpl
31+
import org.onebusaway.services.async.ScheduleForRouteServiceAsync
32+
import org.onebusaway.services.async.ScheduleForRouteServiceAsyncImpl
33+
import org.onebusaway.services.async.ScheduleForStopServiceAsync
34+
import org.onebusaway.services.async.ScheduleForStopServiceAsyncImpl
35+
import org.onebusaway.services.async.SearchForRouteServiceAsync
36+
import org.onebusaway.services.async.SearchForRouteServiceAsyncImpl
37+
import org.onebusaway.services.async.SearchForStopServiceAsync
38+
import org.onebusaway.services.async.SearchForStopServiceAsyncImpl
39+
import org.onebusaway.services.async.ShapeServiceAsync
40+
import org.onebusaway.services.async.ShapeServiceAsyncImpl
41+
import org.onebusaway.services.async.StopIdsForAgencyServiceAsync
42+
import org.onebusaway.services.async.StopIdsForAgencyServiceAsyncImpl
43+
import org.onebusaway.services.async.StopServiceAsync
44+
import org.onebusaway.services.async.StopServiceAsyncImpl
45+
import org.onebusaway.services.async.StopsForAgencyServiceAsync
46+
import org.onebusaway.services.async.StopsForAgencyServiceAsyncImpl
47+
import org.onebusaway.services.async.StopsForLocationServiceAsync
48+
import org.onebusaway.services.async.StopsForLocationServiceAsyncImpl
49+
import org.onebusaway.services.async.StopsForRouteServiceAsync
50+
import org.onebusaway.services.async.StopsForRouteServiceAsyncImpl
51+
import org.onebusaway.services.async.TripDetailServiceAsync
52+
import org.onebusaway.services.async.TripDetailServiceAsyncImpl
53+
import org.onebusaway.services.async.TripForVehicleServiceAsync
54+
import org.onebusaway.services.async.TripForVehicleServiceAsyncImpl
55+
import org.onebusaway.services.async.TripServiceAsync
56+
import org.onebusaway.services.async.TripServiceAsyncImpl
57+
import org.onebusaway.services.async.TripsForLocationServiceAsync
58+
import org.onebusaway.services.async.TripsForLocationServiceAsyncImpl
59+
import org.onebusaway.services.async.TripsForRouteServiceAsync
60+
import org.onebusaway.services.async.TripsForRouteServiceAsyncImpl
61+
import org.onebusaway.services.async.VehiclesForAgencyServiceAsync
62+
import org.onebusaway.services.async.VehiclesForAgencyServiceAsyncImpl
963

1064
class OnebusawaySdkClientAsyncImpl
1165
constructor(

0 commit comments

Comments
 (0)