You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Note: you can also call fromEnv() from the client builder, for example if you need to set additional properties
@@ -68,10 +71,10 @@ Read the documentation for more configuration options.
68
71
69
72
### Example: creating a resource
70
73
71
-
To create a new inference pipeline data, first use the `InferencePipelineDataStreamParams` builder to specify attributes,
72
-
then pass that to the `stream` method of the `data` service.
74
+
To create a new inference pipeline data, first use the `InferencePipelineDataStreamParams` builder to specify attributes, then pass that to the `stream` method of the `data` service.
To make a request to the Openlayer API, you generally build an instance of the appropriate `Params` class.
106
109
107
-
In [Example: creating a resource](#example-creating-a-resource) above, we used the `InferencePipelineDataStreamParams.builder()` to pass to
108
-
the `stream` method of the `data` service.
110
+
In [Example: creating a resource](#example-creating-a-resource) above, we used the `InferencePipelineDataStreamParams.builder()` to pass to the `stream` method of the `data` service.
109
111
110
-
Sometimes, the API may support other properties that are not yet supported in the Java SDK types. In that case,
111
-
you can attach them using the `putAdditionalProperty` method.
112
+
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.
When receiving a response, the Openlayer 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 `OpenlayerInvalidDataException` at runtime. If you would prefer to check in advance that that response is completely well-typed, call `.validate()` on the returned model.
In rare cases, you may want to access the underlying JSON value for a response property rather than using the typed version provided by
134
-
this SDK. Each model property has a corresponding JSON version, with an underscore before the method name, which returns a `JsonField` value.
138
+
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.
135
139
136
140
```java
141
+
importcom.openlayer.api.core.JsonField;
142
+
importjava.util.Optional;
143
+
137
144
JsonField field = responseObj._field();
138
145
139
146
if (field.isMissing()) {
@@ -155,6 +162,8 @@ if (field.isMissing()) {
155
162
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:
@@ -168,31 +177,33 @@ This library throws exceptions in a single hierarchy for easy handling:
168
177
169
178
-**`OpenlayerException`** - Base exception for all exceptions
170
179
171
-
-**`OpenlayerServiceException`** - 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.
180
+
-**`OpenlayerServiceException`** - 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.
-**`OpenlayerInvalidDataException`** - any other exceptions on the client side, e.g.:
194
+
- We failed to serialize the request body
195
+
- We failed to parse the response body (has access to response code and body)
187
196
188
197
## Network options
189
198
190
199
### Retries
191
200
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.
193
-
You can provide a `maxRetries` on the client builder to configure this:
201
+
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:
This library is typed for convenient access to the documented API. If you need to access undocumented
230
-
params or response properties, the library can still be used.
246
+
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.
231
247
232
248
### Undocumented request params
233
249
234
-
To make requests using undocumented parameters, you can provide or override parameters on the params object
235
-
while building it.
250
+
To make requests using undocumented parameters, you can provide or override parameters on the params object while building it.
To access undocumented response properties, you can use `res._additionalProperties()` on a response object to
247
-
get a map of untyped fields of type `Map<String, JsonValue>`. You can then access fields like
248
-
`._additionalProperties().get("secret_prop").asString()` or use other helpers defined on the `JsonValue` class
249
-
to extract it to a desired type.
261
+
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.
Copy file name to clipboardexpand all lines: openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/inferencePipelines/RowServiceTest.kt
0 commit comments