Skip to content

Commit 61ea733

Browse files
axshaniYaelleverilyamerman
authored
version 0.0.3 (#16)
* remove old org.openapitools.client files * update tests * added unit.sdk.client generated files * comment out create document and upload png file * update - build files * without tests for now * tiny fix to tests * re-run CI check * merge README.md * update README.md --------- Co-authored-by: Yael Lever <[email protected]> Co-authored-by: Ilya Merman <[email protected]>
1 parent 774e362 commit 61ea733

File tree

2,313 files changed

+247443
-229193
lines changed

Some content is hidden

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

2,313 files changed

+247443
-229193
lines changed

README.md

Lines changed: 13 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ The official Java client library for the [Unit API](https://unit.co/docs/api/).
66
## Requirements
77

88
Building the API client library requires:
9-
1. Java 1.8+
10-
2. Maven (3.8.3+)/Gradle (7.2+)
9+
10+
1. Java 11+
11+
2. Maven/Gradle
1112

1213
## Installation
1314
Add this dependency to your project's POM:
@@ -23,7 +24,7 @@ Add this dependency to your project's POM:
2324
<dependency>
2425
<groupId>co.unit</groupId>
2526
<artifactId>java-sdk</artifactId>
26-
<version>0.0.1</version>
27+
<version>0.0.3</version>
2728
</dependency>
2829
</dependencies>
2930
```
@@ -33,9 +34,8 @@ For more examples of basic usage, see the [Test suites](https://github.com/unit-
3334

3435
```java
3536
String access_token = System.getenv("access_token");
36-
ApiClient cl = new ApiClient();
37-
cl.setBearerToken(access_token);
38-
Configuration.setDefaultApiClient(cl);
37+
ApiClient apiClient = new ApiClient();
38+
apiClient.setRequestInterceptor(r -> r.header("Authorization", "Bearer " + access_token));
3939

4040
CreateIndividualApplication createIndividualApplication = new CreateIndividualApplication();
4141
CreateIndividualApplicationAttributes attr = new CreateIndividualApplicationAttributes();
@@ -65,35 +65,19 @@ attr.setOccupation(Occupation.ARCHITECTORENGINEER);
6565

6666
createIndividualApplication.setAttributes(attr);
6767

68-
CreateApplication request = new CreateApplication();
69-
request.data(new CreateApplicationData(createIndividualApplication));
70-
68+
CreateApplication ca = new CreateApplication();
69+
ca.data(new CreateApplicationData(createIndividualApplication));
7170

72-
CreateApplicationApi apiClient = new CreateApplicationApi();
71+
CreateApplicationApi createApiClient = new CreateApplicationApi(apiClient);
7372
UnitCreateApplicationResponse res = apiClient.execute(request);
7473
```
7574

7675
## About
7776
To generate a customized version of the unit-java-sdk using our [OpenAPI project](https://github.com/unit-finance/openapi-unit-sdk)
7877
we suggest using the open-generator-cli to generate the Java client using the following command:
7978
```commandline
80-
openapi-generator-cli generate -g java -i openapi.json -o unit-java-sdk
81-
--additional-properties hideGenerationTimestamp=true
82-
```
83-
Please note that the current generator version lacks support for deepObjects. After generating the Java client, if you wish to enable functionality for list parameters, you'll need to implement a serialization function. A sample of this function, named `toParams()`, can be found in `client/model/ExecuteFilterParameter.java`.
84-
85-
Additionally, modifications need to be made to the executeCall function in each GetList file that utilizes parameters:
86-
```java
87-
if (page != null) {
88-
localVarQueryParams.addAll(page.toParams());
89-
}
90-
91-
if (filter != null) {
92-
localVarQueryParams.addAll(filter.toParams());
93-
}
94-
95-
if (include != null) {
96-
localVarQueryParams.addAll(localVarApiClient.parameterToPair("include", include));
97-
}
79+
openapi-generator-cli generate -g java -i openapi.json -o unit
80+
-p hideGenerationTimestamp=true -p packageName=unit.java.sdk
81+
-p modelPackage=unit.java.sdk.model -p apiPackage=unit.java.sdk.api
82+
--library native -p useJakartaEe=true
9883
```
99-
For parameters defined as deepObjects (beyond primitive types), these should be appended to localVarQueryParams after serialization using the `toParams()` function, rather than using `localVarApiClient.parameterToPair()` which is designed for primitive types exclusively.

0 commit comments

Comments
 (0)