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
@@ -31,6 +31,7 @@ For more information about the API: [Apideck Developer Docs](https://developers.
31
31
*[Server Selection](#server-selection)
32
32
*[Asynchronous Support](#asynchronous-support)
33
33
*[Authentication](#authentication)
34
+
*[Custom HTTP Client](#custom-http-client)
34
35
*[Debugging](#debugging)
35
36
*[Development](#development)
36
37
*[Maturity](#maturity)
@@ -49,15 +50,15 @@ The samples below show how a published SDK artifact is used:
49
50
50
51
Gradle:
51
52
```groovy
52
-
implementation 'com.apideck:unify:0.22.1'
53
+
implementation 'com.apideck:unify:0.23.0'
53
54
```
54
55
55
56
Maven:
56
57
```xml
57
58
<dependency>
58
59
<groupId>com.apideck</groupId>
59
60
<artifactId>unify</artifactId>
60
-
<version>0.22.1</version>
61
+
<version>0.23.0</version>
61
62
</dependency>
62
63
```
63
64
@@ -1003,19 +1004,19 @@ public class Application {
1003
1004
1004
1005
Handling errors in this SDK should largely match your expectations. All operations return a response object or raise an exception.
1005
1006
1006
-
By default, an API error will throw a `models/errors/APIException` exception. When custom error responses are specified for an operation, the SDK may also throw their associated exception. You can refer to respective *Errors* tables in SDK docs for more details on possible exception types for each operation. For example, the `list` method throws the following exceptions:
|`body()`|`byte[]`| HTTP body as a byte array. Can be empty array if no body is returned. |
1016
+
|`bodyAsString()`|`String`| HTTP body as a UTF-8 string. Can be empty string if no body is returned. |
1017
+
|`rawResponse()`|`HttpResponse<?>`| Raw HTTP response (body already read and not available for re-read) |
1018
1018
1019
+
### Example
1019
1020
```java
1020
1021
packagehello.world;
1021
1022
@@ -1061,6 +1062,31 @@ public class Application {
1061
1062
}
1062
1063
}
1063
1064
```
1065
+
1066
+
### Error Classes
1067
+
**Primary errors:**
1068
+
*[`ApideckError`](./src/main/java/models/errors/ApideckError.java): The base class for HTTP error responses.
1069
+
*[`com.apideck.unify.models.errors.UnauthorizedResponse`](./src/main/java/models/errors/com.apideck.unify.models.errors.UnauthorizedResponse.java): Unauthorized. Status code `401`.
1070
+
*[`com.apideck.unify.models.errors.PaymentRequiredResponse`](./src/main/java/models/errors/com.apideck.unify.models.errors.PaymentRequiredResponse.java): Payment Required. Status code `402`.
1071
+
*[`com.apideck.unify.models.errors.NotFoundResponse`](./src/main/java/models/errors/com.apideck.unify.models.errors.NotFoundResponse.java): The specified resource was not found. Status code `404`. *
1072
+
*[`com.apideck.unify.models.errors.BadRequestResponse`](./src/main/java/models/errors/com.apideck.unify.models.errors.BadRequestResponse.java): Bad Request. Status code `400`. *
1073
+
*[`com.apideck.unify.models.errors.UnprocessableResponse`](./src/main/java/models/errors/com.apideck.unify.models.errors.UnprocessableResponse.java): Unprocessable. Status code `422`. *
1074
+
1075
+
<details><summary>Less common errors (6)</summary>
1076
+
1077
+
<br />
1078
+
1079
+
**Network errors:**
1080
+
*`java.io.IOException` (always wrapped by `java.io.UncheckedIOException`). Commonly encountered subclasses of
1081
+
`IOException` include `java.net.ConnectException`, `java.net.SocketTimeoutException`, `EOFException` (there are
1082
+
many more subclasses in the JDK platform).
1083
+
1084
+
**Inherit from [`ApideckError`](./src/main/java/models/errors/ApideckError.java)**:
1085
+
1086
+
1087
+
</details>
1088
+
1089
+
\* Check [the method documentation](#available-resources-and-operations) to see if the error is applicable.
1064
1090
<!-- End Error Handling [errors] -->
1065
1091
1066
1092
<!-- Start Server Selection [server] -->
@@ -1283,6 +1309,142 @@ public class Application {
1283
1309
```
1284
1310
<!-- End Authentication [security] -->
1285
1311
1312
+
<!-- Start Custom HTTP Client [http-client] -->
1313
+
## Custom HTTP Client
1314
+
1315
+
The Java SDK makes API calls using an `HTTPClient` that wraps the native
1316
+
[HttpClient](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpClient.html). This
1317
+
client provides the ability to attach hooks around the request lifecycle that can be used to modify the request or handle
1318
+
errors and response.
1319
+
1320
+
The `HTTPClient` interface allows you to either use the default `SpeakeasyHTTPClient` that comes with the SDK,
1321
+
or provide your own custom implementation with customized configuration such as custom executors, SSL context,
1322
+
connection pools, and other HTTP client settings.
1323
+
1324
+
The interface provides synchronous (`send`) methods and asynchronous (`sendAsync`) methods. The `sendAsync` method
1325
+
is used to power the async SDK methods and returns a `CompletableFuture<HttpResponse<Blob>>` for non-blocking operations.
1326
+
1327
+
The following example shows how to add a custom header and handle errors:
0 commit comments