From 87a20b5ae4beec697deba6f1ae8ca9469120bc74 Mon Sep 17 00:00:00 2001 From: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Date: Wed, 24 Jun 2026 18:47:08 +0000 Subject: [PATCH] [fern-generated] Update SDK Generated by Fern CLI Version: unknown Generators: - fernapi/fern-java-sdk: 4.9.1 --- .fern/metadata.json | 6 +- README.md | 4 +- build.gradle | 4 +- reference.md | 361 ++++++++ src/main/java/com/icepanel/AdrsClient.java | 76 ++ .../java/com/icepanel/AsyncAdrsClient.java | 77 ++ .../com/icepanel/AsyncIcePanelClient.java | 7 + .../java/com/icepanel/AsyncRawAdrsClient.java | 598 ++++++++++++ .../java/com/icepanel/IcePanelClient.java | 7 + src/main/java/com/icepanel/RawAdrsClient.java | 445 +++++++++ .../java/com/icepanel/core/ClientOptions.java | 4 +- src/main/java/com/icepanel/types/Adr.java | 855 ++++++++++++++++++ .../com/icepanel/types/AdrCreateRequest.java | 166 ++++ .../com/icepanel/types/AdrDeleteRequest.java | 163 ++++ .../java/com/icepanel/types/AdrFilter.java | 222 +++++ .../com/icepanel/types/AdrFindRequest.java | 163 ++++ .../java/com/icepanel/types/AdrPartial.java | 284 ++++++ .../com/icepanel/types/AdrRelatedItem.java | 290 ++++++ .../icepanel/types/AdrRelatedItemType.java | 103 +++ .../java/com/icepanel/types/AdrRequired.java | 397 ++++++++ .../java/com/icepanel/types/AdrStatus.java | 92 ++ .../com/icepanel/types/AdrStatusChange.java | 194 ++++ .../com/icepanel/types/AdrUpdateRequest.java | 192 ++++ .../icepanel/types/AdrsCreateResponse.java | 118 +++ .../com/icepanel/types/AdrsGetResponse.java | 118 +++ .../com/icepanel/types/AdrsListRequest.java | 236 +++++ .../com/icepanel/types/AdrsListResponse.java | 139 +++ .../icepanel/types/AdrsUpdateResponse.java | 118 +++ .../icepanel/types/VersionIdPathParam.java | 161 ++++ 29 files changed, 5591 insertions(+), 9 deletions(-) create mode 100644 src/main/java/com/icepanel/AdrsClient.java create mode 100644 src/main/java/com/icepanel/AsyncAdrsClient.java create mode 100644 src/main/java/com/icepanel/AsyncRawAdrsClient.java create mode 100644 src/main/java/com/icepanel/RawAdrsClient.java create mode 100644 src/main/java/com/icepanel/types/Adr.java create mode 100644 src/main/java/com/icepanel/types/AdrCreateRequest.java create mode 100644 src/main/java/com/icepanel/types/AdrDeleteRequest.java create mode 100644 src/main/java/com/icepanel/types/AdrFilter.java create mode 100644 src/main/java/com/icepanel/types/AdrFindRequest.java create mode 100644 src/main/java/com/icepanel/types/AdrPartial.java create mode 100644 src/main/java/com/icepanel/types/AdrRelatedItem.java create mode 100644 src/main/java/com/icepanel/types/AdrRelatedItemType.java create mode 100644 src/main/java/com/icepanel/types/AdrRequired.java create mode 100644 src/main/java/com/icepanel/types/AdrStatus.java create mode 100644 src/main/java/com/icepanel/types/AdrStatusChange.java create mode 100644 src/main/java/com/icepanel/types/AdrUpdateRequest.java create mode 100644 src/main/java/com/icepanel/types/AdrsCreateResponse.java create mode 100644 src/main/java/com/icepanel/types/AdrsGetResponse.java create mode 100644 src/main/java/com/icepanel/types/AdrsListRequest.java create mode 100644 src/main/java/com/icepanel/types/AdrsListResponse.java create mode 100644 src/main/java/com/icepanel/types/AdrsUpdateResponse.java create mode 100644 src/main/java/com/icepanel/types/VersionIdPathParam.java diff --git a/.fern/metadata.json b/.fern/metadata.json index 3607ba3..53b5c9c 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -12,8 +12,8 @@ "package-layout": "flat", "use-local-date-for-dates": true }, - "originGitCommit": "9f29099c1e75f465353107fd18a048873a6f3f81", - "originGitCommitIsDirty": true, + "originGitCommit": "d8e4d8d4fcd255a3d1f4d5eb9576541c52344397", + "originGitCommitIsDirty": false, "invokedBy": "manual", - "sdkVersion": "0.1.5" + "sdkVersion": "0.1.6" } \ No newline at end of file diff --git a/README.md b/README.md index fe097fe..b3038d1 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Add the dependency in your `build.gradle` file: ```groovy dependencies { - implementation 'com.icepanel:sdk:0.1.5' + implementation 'com.icepanel:sdk:0.1.6' } ``` @@ -42,7 +42,7 @@ Add the dependency in your `pom.xml` file: com.icepanel sdk - 0.1.5 + 0.1.6 ``` diff --git a/build.gradle b/build.gradle index 2c35a52..514a13a 100644 --- a/build.gradle +++ b/build.gradle @@ -47,7 +47,7 @@ java { group = 'com.icepanel' -version = '0.1.5' +version = '0.1.6' jar { dependsOn(":generatePomFileForMavenPublication") @@ -78,7 +78,7 @@ publishing { maven(MavenPublication) { groupId = 'com.icepanel' artifactId = 'sdk' - version = '0.1.5' + version = '0.1.6' from components.java pom { name = 'IcePanel ' diff --git a/reference.md b/reference.md index 2c15b08..dfb1006 100644 --- a/reference.md +++ b/reference.md @@ -1,4 +1,365 @@ # Reference +## Adrs +
client.adrs.list(landscapeId, versionId) -> SyncPagingIterable&lt;Adr&gt; +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.adrs().list( + AdrsListRequest + .builder() + .landscapeId("landscapeId") + .versionId( + VersionIdPathParam.of("latest") + ) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**landscapeId:** `String` + +
+
+ +
+
+ +**versionId:** `VersionIdPathParam` + +
+
+ +
+
+ +**filter:** `Optional` + +
+
+ +
+
+ +**cursor:** `Optional` + +
+
+ +
+
+ +**limit:** `Optional` + +
+
+
+
+ + +
+
+
+ +
client.adrs.create(landscapeId, versionId, request) -> AdrsCreateResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.adrs().create( + AdrCreateRequest + .builder() + .landscapeId("landscapeId") + .versionId( + VersionIdPathParam.of("latest") + ) + .body( + AdrRequired + .builder() + .name("name") + .status(AdrStatus.ACCEPTED) + .handleId("handleId") + .build() + ) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**landscapeId:** `String` + +
+
+ +
+
+ +**versionId:** `VersionIdPathParam` + +
+
+ +
+
+ +**request:** `AdrRequired` + +
+
+
+
+ + +
+
+
+ +
client.adrs.get(landscapeId, versionId, adrId) -> AdrsGetResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.adrs().get( + AdrFindRequest + .builder() + .landscapeId("landscapeId") + .versionId( + VersionIdPathParam.of("latest") + ) + .adrId("adrId") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**landscapeId:** `String` + +
+
+ +
+
+ +**versionId:** `VersionIdPathParam` + +
+
+ +
+
+ +**adrId:** `String` + +
+
+
+
+ + +
+
+
+ +
client.adrs.delete(landscapeId, versionId, adrId) -> Map&lt;String, Object&gt; +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.adrs().delete( + AdrDeleteRequest + .builder() + .landscapeId("landscapeId") + .versionId( + VersionIdPathParam.of("latest") + ) + .adrId("adrId") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**landscapeId:** `String` + +
+
+ +
+
+ +**versionId:** `VersionIdPathParam` + +
+
+ +
+
+ +**adrId:** `String` + +
+
+
+
+ + +
+
+
+ +
client.adrs.update(landscapeId, versionId, adrId, request) -> AdrsUpdateResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.adrs().update( + AdrUpdateRequest + .builder() + .landscapeId("landscapeId") + .versionId( + VersionIdPathParam.of("latest") + ) + .adrId("adrId") + .body( + AdrPartial + .builder() + .build() + ) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**landscapeId:** `String` + +
+
+ +
+
+ +**versionId:** `VersionIdPathParam` + +
+
+ +
+
+ +**adrId:** `String` + +
+
+ +
+
+ +**request:** `AdrPartial` + +
+
+
+
+ + +
+
+
+ ## Comments
client.comments.list(landscapeId, versionId) -> CommentsListResponse
diff --git a/src/main/java/com/icepanel/AdrsClient.java b/src/main/java/com/icepanel/AdrsClient.java new file mode 100644 index 0000000..152f1d1 --- /dev/null +++ b/src/main/java/com/icepanel/AdrsClient.java @@ -0,0 +1,76 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.icepanel; + +import com.icepanel.core.ClientOptions; +import com.icepanel.core.RequestOptions; +import com.icepanel.core.SyncPagingIterable; +import com.icepanel.types.Adr; +import com.icepanel.types.AdrCreateRequest; +import com.icepanel.types.AdrDeleteRequest; +import com.icepanel.types.AdrFindRequest; +import com.icepanel.types.AdrUpdateRequest; +import com.icepanel.types.AdrsCreateResponse; +import com.icepanel.types.AdrsGetResponse; +import com.icepanel.types.AdrsListRequest; +import com.icepanel.types.AdrsUpdateResponse; +import java.util.Map; + +public class AdrsClient { + protected final ClientOptions clientOptions; + + private final RawAdrsClient rawClient; + + public AdrsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawAdrsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawAdrsClient withRawResponse() { + return this.rawClient; + } + + public SyncPagingIterable list(AdrsListRequest request) { + return this.rawClient.list(request).body(); + } + + public SyncPagingIterable list(AdrsListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + public AdrsCreateResponse create(AdrCreateRequest request) { + return this.rawClient.create(request).body(); + } + + public AdrsCreateResponse create(AdrCreateRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + public AdrsGetResponse get(AdrFindRequest request) { + return this.rawClient.get(request).body(); + } + + public AdrsGetResponse get(AdrFindRequest request, RequestOptions requestOptions) { + return this.rawClient.get(request, requestOptions).body(); + } + + public Map delete(AdrDeleteRequest request) { + return this.rawClient.delete(request).body(); + } + + public Map delete(AdrDeleteRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(request, requestOptions).body(); + } + + public AdrsUpdateResponse update(AdrUpdateRequest request) { + return this.rawClient.update(request).body(); + } + + public AdrsUpdateResponse update(AdrUpdateRequest request, RequestOptions requestOptions) { + return this.rawClient.update(request, requestOptions).body(); + } +} diff --git a/src/main/java/com/icepanel/AsyncAdrsClient.java b/src/main/java/com/icepanel/AsyncAdrsClient.java new file mode 100644 index 0000000..1cdcb6f --- /dev/null +++ b/src/main/java/com/icepanel/AsyncAdrsClient.java @@ -0,0 +1,77 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.icepanel; + +import com.icepanel.core.ClientOptions; +import com.icepanel.core.RequestOptions; +import com.icepanel.core.SyncPagingIterable; +import com.icepanel.types.Adr; +import com.icepanel.types.AdrCreateRequest; +import com.icepanel.types.AdrDeleteRequest; +import com.icepanel.types.AdrFindRequest; +import com.icepanel.types.AdrUpdateRequest; +import com.icepanel.types.AdrsCreateResponse; +import com.icepanel.types.AdrsGetResponse; +import com.icepanel.types.AdrsListRequest; +import com.icepanel.types.AdrsUpdateResponse; +import java.util.Map; +import java.util.concurrent.CompletableFuture; + +public class AsyncAdrsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawAdrsClient rawClient; + + public AsyncAdrsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawAdrsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawAdrsClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture> list(AdrsListRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + public CompletableFuture> list(AdrsListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture create(AdrCreateRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + public CompletableFuture create(AdrCreateRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture get(AdrFindRequest request) { + return this.rawClient.get(request).thenApply(response -> response.body()); + } + + public CompletableFuture get(AdrFindRequest request, RequestOptions requestOptions) { + return this.rawClient.get(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture> delete(AdrDeleteRequest request) { + return this.rawClient.delete(request).thenApply(response -> response.body()); + } + + public CompletableFuture> delete(AdrDeleteRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture update(AdrUpdateRequest request) { + return this.rawClient.update(request).thenApply(response -> response.body()); + } + + public CompletableFuture update(AdrUpdateRequest request, RequestOptions requestOptions) { + return this.rawClient.update(request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/icepanel/AsyncIcePanelClient.java b/src/main/java/com/icepanel/AsyncIcePanelClient.java index eba3ac6..41088fa 100644 --- a/src/main/java/com/icepanel/AsyncIcePanelClient.java +++ b/src/main/java/com/icepanel/AsyncIcePanelClient.java @@ -12,6 +12,8 @@ public class AsyncIcePanelClient { protected final ClientOptions clientOptions; + protected final Supplier adrsClient; + protected final Supplier commentsClient; protected final Supplier diagramsClient; @@ -40,6 +42,7 @@ public class AsyncIcePanelClient { public AsyncIcePanelClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; + this.adrsClient = Suppliers.memoize(() -> new AsyncAdrsClient(clientOptions)); this.commentsClient = Suppliers.memoize(() -> new AsyncCommentsClient(clientOptions)); this.diagramsClient = Suppliers.memoize(() -> new AsyncDiagramsClient(clientOptions)); this.domainsClient = Suppliers.memoize(() -> new AsyncDomainsClient(clientOptions)); @@ -55,6 +58,10 @@ public AsyncIcePanelClient(ClientOptions clientOptions) { this.modelClient = Suppliers.memoize(() -> new AsyncModelClient(clientOptions)); } + public AsyncAdrsClient adrs() { + return this.adrsClient.get(); + } + public AsyncCommentsClient comments() { return this.commentsClient.get(); } diff --git a/src/main/java/com/icepanel/AsyncRawAdrsClient.java b/src/main/java/com/icepanel/AsyncRawAdrsClient.java new file mode 100644 index 0000000..55b3164 --- /dev/null +++ b/src/main/java/com/icepanel/AsyncRawAdrsClient.java @@ -0,0 +1,598 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.icepanel; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.icepanel.core.ClientOptions; +import com.icepanel.core.IcePanelClientApiException; +import com.icepanel.core.IcePanelClientException; +import com.icepanel.core.IcePanelClientHttpResponse; +import com.icepanel.core.MediaTypes; +import com.icepanel.core.ObjectMappers; +import com.icepanel.core.QueryStringMapper; +import com.icepanel.core.RequestOptions; +import com.icepanel.core.SyncPagingIterable; +import com.icepanel.errors.BadRequestError; +import com.icepanel.errors.ConflictError; +import com.icepanel.errors.ForbiddenError; +import com.icepanel.errors.InternalServerError; +import com.icepanel.errors.NotFoundError; +import com.icepanel.errors.ServiceUnavailableError; +import com.icepanel.errors.TooManyRequestsError; +import com.icepanel.errors.UnauthorizedError; +import com.icepanel.errors.UnprocessableEntityError; +import com.icepanel.types.Adr; +import com.icepanel.types.AdrCreateRequest; +import com.icepanel.types.AdrDeleteRequest; +import com.icepanel.types.AdrFindRequest; +import com.icepanel.types.AdrUpdateRequest; +import com.icepanel.types.AdrsCreateResponse; +import com.icepanel.types.AdrsGetResponse; +import com.icepanel.types.AdrsListRequest; +import com.icepanel.types.AdrsListResponse; +import com.icepanel.types.AdrsUpdateResponse; +import com.icepanel.types.Error; +import java.io.IOException; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawAdrsClient { + protected final ClientOptions clientOptions; + + public AsyncRawAdrsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture>> list(AdrsListRequest request) { + return list(request, null); + } + + public CompletableFuture>> list( + AdrsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("landscapes") + .addPathSegment(request.getLandscapeId()) + .addPathSegments("versions") + .addPathSegment(request.getVersionId().toString()) + .addPathSegments("adrs"); + if (request.getFilter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "filter", request.getFilter().get(), false); + } + if (request.getCursor().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "cursor", request.getCursor().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + AdrsListResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AdrsListResponse.class); + Optional startingAfter = parsedResponse.getNextCursor(); + AdrsListRequest nextRequest = AdrsListRequest.builder() + .from(request) + .cursor(startingAfter) + .build(); + List result = parsedResponse.getAdrs(); + future.complete(new IcePanelClientHttpResponse<>( + new SyncPagingIterable(startingAfter.isPresent(), result, parsedResponse, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new IcePanelClientApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally( + new IcePanelClientException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new IcePanelClientException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> create(AdrCreateRequest request) { + return create(request, null); + } + + public CompletableFuture> create( + AdrCreateRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("landscapes") + .addPathSegment(request.getLandscapeId()) + .addPathSegments("versions") + .addPathSegment(request.getVersionId().toString()) + .addPathSegments("adrs"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new IcePanelClientException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new IcePanelClientHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AdrsCreateResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 503: + future.completeExceptionally(new ServiceUnavailableError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new IcePanelClientApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally( + new IcePanelClientException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new IcePanelClientException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> get(AdrFindRequest request) { + return get(request, null); + } + + public CompletableFuture> get( + AdrFindRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("landscapes") + .addPathSegment(request.getLandscapeId()) + .addPathSegments("versions") + .addPathSegment(request.getVersionId().toString()) + .addPathSegments("adrs") + .addPathSegment(request.getAdrId()); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new IcePanelClientHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AdrsGetResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new IcePanelClientApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally( + new IcePanelClientException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new IcePanelClientException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture>> delete(AdrDeleteRequest request) { + return delete(request, null); + } + + public CompletableFuture>> delete( + AdrDeleteRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("landscapes") + .addPathSegment(request.getLandscapeId()) + .addPathSegments("versions") + .addPathSegment(request.getVersionId().toString()) + .addPathSegments("adrs") + .addPathSegment(request.getAdrId()); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new IcePanelClientHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, new TypeReference>() {}), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 503: + future.completeExceptionally(new ServiceUnavailableError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new IcePanelClientApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally( + new IcePanelClientException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new IcePanelClientException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> update(AdrUpdateRequest request) { + return update(request, null); + } + + public CompletableFuture> update( + AdrUpdateRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("landscapes") + .addPathSegment(request.getLandscapeId()) + .addPathSegments("versions") + .addPathSegment(request.getVersionId().toString()) + .addPathSegments("adrs") + .addPathSegment(request.getAdrId()); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new IcePanelClientException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new IcePanelClientHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AdrsUpdateResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 429: + future.completeExceptionally(new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + case 503: + future.completeExceptionally(new ServiceUnavailableError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new IcePanelClientApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally( + new IcePanelClientException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new IcePanelClientException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/icepanel/IcePanelClient.java b/src/main/java/com/icepanel/IcePanelClient.java index 20ae48d..9404e3a 100644 --- a/src/main/java/com/icepanel/IcePanelClient.java +++ b/src/main/java/com/icepanel/IcePanelClient.java @@ -12,6 +12,8 @@ public class IcePanelClient { protected final ClientOptions clientOptions; + protected final Supplier adrsClient; + protected final Supplier commentsClient; protected final Supplier diagramsClient; @@ -40,6 +42,7 @@ public class IcePanelClient { public IcePanelClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; + this.adrsClient = Suppliers.memoize(() -> new AdrsClient(clientOptions)); this.commentsClient = Suppliers.memoize(() -> new CommentsClient(clientOptions)); this.diagramsClient = Suppliers.memoize(() -> new DiagramsClient(clientOptions)); this.domainsClient = Suppliers.memoize(() -> new DomainsClient(clientOptions)); @@ -55,6 +58,10 @@ public IcePanelClient(ClientOptions clientOptions) { this.modelClient = Suppliers.memoize(() -> new ModelClient(clientOptions)); } + public AdrsClient adrs() { + return this.adrsClient.get(); + } + public CommentsClient comments() { return this.commentsClient.get(); } diff --git a/src/main/java/com/icepanel/RawAdrsClient.java b/src/main/java/com/icepanel/RawAdrsClient.java new file mode 100644 index 0000000..4a0e847 --- /dev/null +++ b/src/main/java/com/icepanel/RawAdrsClient.java @@ -0,0 +1,445 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.icepanel; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.icepanel.core.ClientOptions; +import com.icepanel.core.IcePanelClientApiException; +import com.icepanel.core.IcePanelClientException; +import com.icepanel.core.IcePanelClientHttpResponse; +import com.icepanel.core.MediaTypes; +import com.icepanel.core.ObjectMappers; +import com.icepanel.core.QueryStringMapper; +import com.icepanel.core.RequestOptions; +import com.icepanel.core.SyncPagingIterable; +import com.icepanel.errors.BadRequestError; +import com.icepanel.errors.ConflictError; +import com.icepanel.errors.ForbiddenError; +import com.icepanel.errors.InternalServerError; +import com.icepanel.errors.NotFoundError; +import com.icepanel.errors.ServiceUnavailableError; +import com.icepanel.errors.TooManyRequestsError; +import com.icepanel.errors.UnauthorizedError; +import com.icepanel.errors.UnprocessableEntityError; +import com.icepanel.types.Adr; +import com.icepanel.types.AdrCreateRequest; +import com.icepanel.types.AdrDeleteRequest; +import com.icepanel.types.AdrFindRequest; +import com.icepanel.types.AdrUpdateRequest; +import com.icepanel.types.AdrsCreateResponse; +import com.icepanel.types.AdrsGetResponse; +import com.icepanel.types.AdrsListRequest; +import com.icepanel.types.AdrsListResponse; +import com.icepanel.types.AdrsUpdateResponse; +import com.icepanel.types.Error; +import java.io.IOException; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawAdrsClient { + protected final ClientOptions clientOptions; + + public RawAdrsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public IcePanelClientHttpResponse> list(AdrsListRequest request) { + return list(request, null); + } + + public IcePanelClientHttpResponse> list( + AdrsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("landscapes") + .addPathSegment(request.getLandscapeId()) + .addPathSegments("versions") + .addPathSegment(request.getVersionId().toString()) + .addPathSegments("adrs"); + if (request.getFilter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "filter", request.getFilter().get(), false); + } + if (request.getCursor().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "cursor", request.getCursor().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + AdrsListResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AdrsListResponse.class); + Optional startingAfter = parsedResponse.getNextCursor(); + AdrsListRequest nextRequest = AdrsListRequest.builder() + .from(request) + .cursor(startingAfter) + .build(); + List result = parsedResponse.getAdrs(); + return new IcePanelClientHttpResponse<>( + new SyncPagingIterable(startingAfter.isPresent(), result, parsedResponse, () -> list( + nextRequest, requestOptions) + .body()), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new IcePanelClientApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new IcePanelClientException("Network error executing HTTP request", e); + } + } + + public IcePanelClientHttpResponse create(AdrCreateRequest request) { + return create(request, null); + } + + public IcePanelClientHttpResponse create( + AdrCreateRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("landscapes") + .addPathSegment(request.getLandscapeId()) + .addPathSegments("versions") + .addPathSegment(request.getVersionId().toString()) + .addPathSegments("adrs"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new IcePanelClientException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new IcePanelClientHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AdrsCreateResponse.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 503: + throw new ServiceUnavailableError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new IcePanelClientApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new IcePanelClientException("Network error executing HTTP request", e); + } + } + + public IcePanelClientHttpResponse get(AdrFindRequest request) { + return get(request, null); + } + + public IcePanelClientHttpResponse get(AdrFindRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("landscapes") + .addPathSegment(request.getLandscapeId()) + .addPathSegments("versions") + .addPathSegment(request.getVersionId().toString()) + .addPathSegments("adrs") + .addPathSegment(request.getAdrId()); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new IcePanelClientHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AdrsGetResponse.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new IcePanelClientApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new IcePanelClientException("Network error executing HTTP request", e); + } + } + + public IcePanelClientHttpResponse> delete(AdrDeleteRequest request) { + return delete(request, null); + } + + public IcePanelClientHttpResponse> delete( + AdrDeleteRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("landscapes") + .addPathSegment(request.getLandscapeId()) + .addPathSegments("versions") + .addPathSegment(request.getVersionId().toString()) + .addPathSegments("adrs") + .addPathSegment(request.getAdrId()); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new IcePanelClientHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, new TypeReference>() {}), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 503: + throw new ServiceUnavailableError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new IcePanelClientApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new IcePanelClientException("Network error executing HTTP request", e); + } + } + + public IcePanelClientHttpResponse update(AdrUpdateRequest request) { + return update(request, null); + } + + public IcePanelClientHttpResponse update( + AdrUpdateRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("landscapes") + .addPathSegment(request.getLandscapeId()) + .addPathSegments("versions") + .addPathSegment(request.getVersionId().toString()) + .addPathSegments("adrs") + .addPathSegment(request.getAdrId()); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new IcePanelClientException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new IcePanelClientHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AdrsUpdateResponse.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 429: + throw new TooManyRequestsError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + case 503: + throw new ServiceUnavailableError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new IcePanelClientApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new IcePanelClientException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/icepanel/core/ClientOptions.java b/src/main/java/com/icepanel/core/ClientOptions.java index 5c990b8..faf25e9 100644 --- a/src/main/java/com/icepanel/core/ClientOptions.java +++ b/src/main/java/com/icepanel/core/ClientOptions.java @@ -38,10 +38,10 @@ private ClientOptions( this.headers.putAll(headers); this.headers.putAll(new HashMap() { { - put("User-Agent", "com.icepanel:sdk/0.1.5"); + put("User-Agent", "com.icepanel:sdk/0.1.6"); put("X-Fern-Language", "JAVA"); put("X-Fern-SDK-Name", "com.icepanel.fern:api-sdk"); - put("X-Fern-SDK-Version", "0.1.5"); + put("X-Fern-SDK-Version", "0.1.6"); } }); this.headerSuppliers = headerSuppliers; diff --git a/src/main/java/com/icepanel/types/Adr.java b/src/main/java/com/icepanel/types/Adr.java new file mode 100644 index 0000000..a1004b9 --- /dev/null +++ b/src/main/java/com/icepanel/types/Adr.java @@ -0,0 +1,855 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.icepanel.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.icepanel.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Adr.Builder.class) +public final class Adr { + private final double commit; + + private final Optional content; + + private final Optional description; + + private final String name; + + private final Optional> relatedItems; + + private final AdrStatus status; + + private final Optional> statusChanges; + + private final String handleId; + + private final OffsetDateTime createdAt; + + private final AuthType createdBy; + + private final String createdById; + + private final Optional deletedAt; + + private final Optional deletedBy; + + private final Optional deletedById; + + private final String id; + + private final String landscapeId; + + private final Optional latestEntityId; + + private final double number; + + private final OffsetDateTime updatedAt; + + private final AuthType updatedBy; + + private final String updatedById; + + private final double version; + + private final String versionId; + + private final Map additionalProperties; + + private Adr( + double commit, + Optional content, + Optional description, + String name, + Optional> relatedItems, + AdrStatus status, + Optional> statusChanges, + String handleId, + OffsetDateTime createdAt, + AuthType createdBy, + String createdById, + Optional deletedAt, + Optional deletedBy, + Optional deletedById, + String id, + String landscapeId, + Optional latestEntityId, + double number, + OffsetDateTime updatedAt, + AuthType updatedBy, + String updatedById, + double version, + String versionId, + Map additionalProperties) { + this.commit = commit; + this.content = content; + this.description = description; + this.name = name; + this.relatedItems = relatedItems; + this.status = status; + this.statusChanges = statusChanges; + this.handleId = handleId; + this.createdAt = createdAt; + this.createdBy = createdBy; + this.createdById = createdById; + this.deletedAt = deletedAt; + this.deletedBy = deletedBy; + this.deletedById = deletedById; + this.id = id; + this.landscapeId = landscapeId; + this.latestEntityId = latestEntityId; + this.number = number; + this.updatedAt = updatedAt; + this.updatedBy = updatedBy; + this.updatedById = updatedById; + this.version = version; + this.versionId = versionId; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("commit") + public double getCommit() { + return commit; + } + + /** + * @return The markdown content of the ADR + */ + @JsonProperty("content") + public Optional getContent() { + return content; + } + + /** + * @return The description of the ADR + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return The name of the ADR + */ + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("relatedItems") + public Optional> getRelatedItems() { + return relatedItems; + } + + /** + * @return The status of the ADR + */ + @JsonProperty("status") + public AdrStatus getStatus() { + return status; + } + + @JsonProperty("statusChanges") + public Optional> getStatusChanges() { + return statusChanges; + } + + /** + * @return The handle id of the ADR + */ + @JsonProperty("handleId") + public String getHandleId() { + return handleId; + } + + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty("createdBy") + public AuthType getCreatedBy() { + return createdBy; + } + + @JsonProperty("createdById") + public String getCreatedById() { + return createdById; + } + + @JsonProperty("deletedAt") + public Optional getDeletedAt() { + return deletedAt; + } + + @JsonProperty("deletedBy") + public Optional getDeletedBy() { + return deletedBy; + } + + @JsonProperty("deletedById") + public Optional getDeletedById() { + return deletedById; + } + + /** + * @return The id of the ADR + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The id of the landscape that the ADR belongs to + */ + @JsonProperty("landscapeId") + public String getLandscapeId() { + return landscapeId; + } + + @JsonProperty("latestEntityId") + public Optional getLatestEntityId() { + return latestEntityId; + } + + /** + * @return The incremental number of the ADR + */ + @JsonProperty("number") + public double getNumber() { + return number; + } + + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @JsonProperty("updatedBy") + public AuthType getUpdatedBy() { + return updatedBy; + } + + @JsonProperty("updatedById") + public String getUpdatedById() { + return updatedById; + } + + @JsonProperty("version") + public double getVersion() { + return version; + } + + @JsonProperty("versionId") + public String getVersionId() { + return versionId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Adr && equalTo((Adr) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Adr other) { + return commit == other.commit + && content.equals(other.content) + && description.equals(other.description) + && name.equals(other.name) + && relatedItems.equals(other.relatedItems) + && status.equals(other.status) + && statusChanges.equals(other.statusChanges) + && handleId.equals(other.handleId) + && createdAt.equals(other.createdAt) + && createdBy.equals(other.createdBy) + && createdById.equals(other.createdById) + && deletedAt.equals(other.deletedAt) + && deletedBy.equals(other.deletedBy) + && deletedById.equals(other.deletedById) + && id.equals(other.id) + && landscapeId.equals(other.landscapeId) + && latestEntityId.equals(other.latestEntityId) + && number == other.number + && updatedAt.equals(other.updatedAt) + && updatedBy.equals(other.updatedBy) + && updatedById.equals(other.updatedById) + && version == other.version + && versionId.equals(other.versionId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.commit, + this.content, + this.description, + this.name, + this.relatedItems, + this.status, + this.statusChanges, + this.handleId, + this.createdAt, + this.createdBy, + this.createdById, + this.deletedAt, + this.deletedBy, + this.deletedById, + this.id, + this.landscapeId, + this.latestEntityId, + this.number, + this.updatedAt, + this.updatedBy, + this.updatedById, + this.version, + this.versionId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CommitStage builder() { + return new Builder(); + } + + public interface CommitStage { + NameStage commit(double commit); + + Builder from(Adr other); + } + + public interface NameStage { + /** + *

The name of the ADR

+ */ + StatusStage name(@NotNull String name); + } + + public interface StatusStage { + /** + *

The status of the ADR

+ */ + HandleIdStage status(@NotNull AdrStatus status); + } + + public interface HandleIdStage { + /** + *

The handle id of the ADR

+ */ + CreatedAtStage handleId(@NotNull String handleId); + } + + public interface CreatedAtStage { + CreatedByStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface CreatedByStage { + CreatedByIdStage createdBy(@NotNull AuthType createdBy); + } + + public interface CreatedByIdStage { + IdStage createdById(@NotNull String createdById); + } + + public interface IdStage { + /** + *

The id of the ADR

+ */ + LandscapeIdStage id(@NotNull String id); + } + + public interface LandscapeIdStage { + /** + *

The id of the landscape that the ADR belongs to

+ */ + NumberStage landscapeId(@NotNull String landscapeId); + } + + public interface NumberStage { + /** + *

The incremental number of the ADR

+ */ + UpdatedAtStage number(double number); + } + + public interface UpdatedAtStage { + UpdatedByStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface UpdatedByStage { + UpdatedByIdStage updatedBy(@NotNull AuthType updatedBy); + } + + public interface UpdatedByIdStage { + VersionStage updatedById(@NotNull String updatedById); + } + + public interface VersionStage { + VersionIdStage version(double version); + } + + public interface VersionIdStage { + _FinalStage versionId(@NotNull String versionId); + } + + public interface _FinalStage { + Adr build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The markdown content of the ADR

+ */ + _FinalStage content(Optional content); + + _FinalStage content(String content); + + /** + *

The description of the ADR

+ */ + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage relatedItems(Optional> relatedItems); + + _FinalStage relatedItems(Map relatedItems); + + _FinalStage statusChanges(Optional> statusChanges); + + _FinalStage statusChanges(List statusChanges); + + _FinalStage deletedAt(Optional deletedAt); + + _FinalStage deletedAt(OffsetDateTime deletedAt); + + _FinalStage deletedBy(Optional deletedBy); + + _FinalStage deletedBy(AuthType deletedBy); + + _FinalStage deletedById(Optional deletedById); + + _FinalStage deletedById(String deletedById); + + _FinalStage latestEntityId(Optional latestEntityId); + + _FinalStage latestEntityId(String latestEntityId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CommitStage, + NameStage, + StatusStage, + HandleIdStage, + CreatedAtStage, + CreatedByStage, + CreatedByIdStage, + IdStage, + LandscapeIdStage, + NumberStage, + UpdatedAtStage, + UpdatedByStage, + UpdatedByIdStage, + VersionStage, + VersionIdStage, + _FinalStage { + private double commit; + + private String name; + + private AdrStatus status; + + private String handleId; + + private OffsetDateTime createdAt; + + private AuthType createdBy; + + private String createdById; + + private String id; + + private String landscapeId; + + private double number; + + private OffsetDateTime updatedAt; + + private AuthType updatedBy; + + private String updatedById; + + private double version; + + private String versionId; + + private Optional latestEntityId = Optional.empty(); + + private Optional deletedById = Optional.empty(); + + private Optional deletedBy = Optional.empty(); + + private Optional deletedAt = Optional.empty(); + + private Optional> statusChanges = Optional.empty(); + + private Optional> relatedItems = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional content = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Adr other) { + commit(other.getCommit()); + content(other.getContent()); + description(other.getDescription()); + name(other.getName()); + relatedItems(other.getRelatedItems()); + status(other.getStatus()); + statusChanges(other.getStatusChanges()); + handleId(other.getHandleId()); + createdAt(other.getCreatedAt()); + createdBy(other.getCreatedBy()); + createdById(other.getCreatedById()); + deletedAt(other.getDeletedAt()); + deletedBy(other.getDeletedBy()); + deletedById(other.getDeletedById()); + id(other.getId()); + landscapeId(other.getLandscapeId()); + latestEntityId(other.getLatestEntityId()); + number(other.getNumber()); + updatedAt(other.getUpdatedAt()); + updatedBy(other.getUpdatedBy()); + updatedById(other.getUpdatedById()); + version(other.getVersion()); + versionId(other.getVersionId()); + return this; + } + + @java.lang.Override + @JsonSetter("commit") + public NameStage commit(double commit) { + this.commit = commit; + return this; + } + + /** + *

The name of the ADR

+ *

The name of the ADR

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public StatusStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

The status of the ADR

+ *

The status of the ADR

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public HandleIdStage status(@NotNull AdrStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

The handle id of the ADR

+ *

The handle id of the ADR

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("handleId") + public CreatedAtStage handleId(@NotNull String handleId) { + this.handleId = Objects.requireNonNull(handleId, "handleId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("createdAt") + public CreatedByStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("createdBy") + public CreatedByIdStage createdBy(@NotNull AuthType createdBy) { + this.createdBy = Objects.requireNonNull(createdBy, "createdBy must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("createdById") + public IdStage createdById(@NotNull String createdById) { + this.createdById = Objects.requireNonNull(createdById, "createdById must not be null"); + return this; + } + + /** + *

The id of the ADR

+ *

The id of the ADR

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public LandscapeIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The id of the landscape that the ADR belongs to

+ *

The id of the landscape that the ADR belongs to

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("landscapeId") + public NumberStage landscapeId(@NotNull String landscapeId) { + this.landscapeId = Objects.requireNonNull(landscapeId, "landscapeId must not be null"); + return this; + } + + /** + *

The incremental number of the ADR

+ *

The incremental number of the ADR

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("number") + public UpdatedAtStage number(double number) { + this.number = number; + return this; + } + + @java.lang.Override + @JsonSetter("updatedAt") + public UpdatedByStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("updatedBy") + public UpdatedByIdStage updatedBy(@NotNull AuthType updatedBy) { + this.updatedBy = Objects.requireNonNull(updatedBy, "updatedBy must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("updatedById") + public VersionStage updatedById(@NotNull String updatedById) { + this.updatedById = Objects.requireNonNull(updatedById, "updatedById must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("version") + public VersionIdStage version(double version) { + this.version = version; + return this; + } + + @java.lang.Override + @JsonSetter("versionId") + public _FinalStage versionId(@NotNull String versionId) { + this.versionId = Objects.requireNonNull(versionId, "versionId must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage latestEntityId(String latestEntityId) { + this.latestEntityId = Optional.ofNullable(latestEntityId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "latestEntityId", nulls = Nulls.SKIP) + public _FinalStage latestEntityId(Optional latestEntityId) { + this.latestEntityId = latestEntityId; + return this; + } + + @java.lang.Override + public _FinalStage deletedById(String deletedById) { + this.deletedById = Optional.ofNullable(deletedById); + return this; + } + + @java.lang.Override + @JsonSetter(value = "deletedById", nulls = Nulls.SKIP) + public _FinalStage deletedById(Optional deletedById) { + this.deletedById = deletedById; + return this; + } + + @java.lang.Override + public _FinalStage deletedBy(AuthType deletedBy) { + this.deletedBy = Optional.ofNullable(deletedBy); + return this; + } + + @java.lang.Override + @JsonSetter(value = "deletedBy", nulls = Nulls.SKIP) + public _FinalStage deletedBy(Optional deletedBy) { + this.deletedBy = deletedBy; + return this; + } + + @java.lang.Override + public _FinalStage deletedAt(OffsetDateTime deletedAt) { + this.deletedAt = Optional.ofNullable(deletedAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "deletedAt", nulls = Nulls.SKIP) + public _FinalStage deletedAt(Optional deletedAt) { + this.deletedAt = deletedAt; + return this; + } + + @java.lang.Override + public _FinalStage statusChanges(List statusChanges) { + this.statusChanges = Optional.ofNullable(statusChanges); + return this; + } + + @java.lang.Override + @JsonSetter(value = "statusChanges", nulls = Nulls.SKIP) + public _FinalStage statusChanges(Optional> statusChanges) { + this.statusChanges = statusChanges; + return this; + } + + @java.lang.Override + public _FinalStage relatedItems(Map relatedItems) { + this.relatedItems = Optional.ofNullable(relatedItems); + return this; + } + + @java.lang.Override + @JsonSetter(value = "relatedItems", nulls = Nulls.SKIP) + public _FinalStage relatedItems(Optional> relatedItems) { + this.relatedItems = relatedItems; + return this; + } + + /** + *

The description of the ADR

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

The description of the ADR

+ */ + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + /** + *

The markdown content of the ADR

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage content(String content) { + this.content = Optional.ofNullable(content); + return this; + } + + /** + *

The markdown content of the ADR

+ */ + @java.lang.Override + @JsonSetter(value = "content", nulls = Nulls.SKIP) + public _FinalStage content(Optional content) { + this.content = content; + return this; + } + + @java.lang.Override + public Adr build() { + return new Adr( + commit, + content, + description, + name, + relatedItems, + status, + statusChanges, + handleId, + createdAt, + createdBy, + createdById, + deletedAt, + deletedBy, + deletedById, + id, + landscapeId, + latestEntityId, + number, + updatedAt, + updatedBy, + updatedById, + version, + versionId, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/icepanel/types/AdrCreateRequest.java b/src/main/java/com/icepanel/types/AdrCreateRequest.java new file mode 100644 index 0000000..e02aff4 --- /dev/null +++ b/src/main/java/com/icepanel/types/AdrCreateRequest.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.icepanel.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.icepanel.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdrCreateRequest.Builder.class) +public final class AdrCreateRequest { + private final String landscapeId; + + private final VersionIdPathParam versionId; + + private final AdrRequired body; + + private final Map additionalProperties; + + private AdrCreateRequest( + String landscapeId, + VersionIdPathParam versionId, + AdrRequired body, + Map additionalProperties) { + this.landscapeId = landscapeId; + this.versionId = versionId; + this.body = body; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("landscapeId") + public String getLandscapeId() { + return landscapeId; + } + + @JsonProperty("versionId") + public VersionIdPathParam getVersionId() { + return versionId; + } + + @JsonProperty("body") + public AdrRequired getBody() { + return body; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdrCreateRequest && equalTo((AdrCreateRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdrCreateRequest other) { + return landscapeId.equals(other.landscapeId) && versionId.equals(other.versionId) && body.equals(other.body); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.landscapeId, this.versionId, this.body); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static LandscapeIdStage builder() { + return new Builder(); + } + + public interface LandscapeIdStage { + VersionIdStage landscapeId(@NotNull String landscapeId); + + Builder from(AdrCreateRequest other); + } + + public interface VersionIdStage { + BodyStage versionId(@NotNull VersionIdPathParam versionId); + } + + public interface BodyStage { + _FinalStage body(@NotNull AdrRequired body); + } + + public interface _FinalStage { + AdrCreateRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements LandscapeIdStage, VersionIdStage, BodyStage, _FinalStage { + private String landscapeId; + + private VersionIdPathParam versionId; + + private AdrRequired body; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AdrCreateRequest other) { + landscapeId(other.getLandscapeId()); + versionId(other.getVersionId()); + body(other.getBody()); + return this; + } + + @java.lang.Override + @JsonSetter("landscapeId") + public VersionIdStage landscapeId(@NotNull String landscapeId) { + this.landscapeId = Objects.requireNonNull(landscapeId, "landscapeId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("versionId") + public BodyStage versionId(@NotNull VersionIdPathParam versionId) { + this.versionId = Objects.requireNonNull(versionId, "versionId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("body") + public _FinalStage body(@NotNull AdrRequired body) { + this.body = Objects.requireNonNull(body, "body must not be null"); + return this; + } + + @java.lang.Override + public AdrCreateRequest build() { + return new AdrCreateRequest(landscapeId, versionId, body, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/icepanel/types/AdrDeleteRequest.java b/src/main/java/com/icepanel/types/AdrDeleteRequest.java new file mode 100644 index 0000000..ad88a0c --- /dev/null +++ b/src/main/java/com/icepanel/types/AdrDeleteRequest.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.icepanel.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.icepanel.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdrDeleteRequest.Builder.class) +public final class AdrDeleteRequest { + private final String landscapeId; + + private final VersionIdPathParam versionId; + + private final String adrId; + + private final Map additionalProperties; + + private AdrDeleteRequest( + String landscapeId, VersionIdPathParam versionId, String adrId, Map additionalProperties) { + this.landscapeId = landscapeId; + this.versionId = versionId; + this.adrId = adrId; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("landscapeId") + public String getLandscapeId() { + return landscapeId; + } + + @JsonProperty("versionId") + public VersionIdPathParam getVersionId() { + return versionId; + } + + @JsonProperty("adrId") + public String getAdrId() { + return adrId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdrDeleteRequest && equalTo((AdrDeleteRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdrDeleteRequest other) { + return landscapeId.equals(other.landscapeId) && versionId.equals(other.versionId) && adrId.equals(other.adrId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.landscapeId, this.versionId, this.adrId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static LandscapeIdStage builder() { + return new Builder(); + } + + public interface LandscapeIdStage { + VersionIdStage landscapeId(@NotNull String landscapeId); + + Builder from(AdrDeleteRequest other); + } + + public interface VersionIdStage { + AdrIdStage versionId(@NotNull VersionIdPathParam versionId); + } + + public interface AdrIdStage { + _FinalStage adrId(@NotNull String adrId); + } + + public interface _FinalStage { + AdrDeleteRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements LandscapeIdStage, VersionIdStage, AdrIdStage, _FinalStage { + private String landscapeId; + + private VersionIdPathParam versionId; + + private String adrId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AdrDeleteRequest other) { + landscapeId(other.getLandscapeId()); + versionId(other.getVersionId()); + adrId(other.getAdrId()); + return this; + } + + @java.lang.Override + @JsonSetter("landscapeId") + public VersionIdStage landscapeId(@NotNull String landscapeId) { + this.landscapeId = Objects.requireNonNull(landscapeId, "landscapeId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("versionId") + public AdrIdStage versionId(@NotNull VersionIdPathParam versionId) { + this.versionId = Objects.requireNonNull(versionId, "versionId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("adrId") + public _FinalStage adrId(@NotNull String adrId) { + this.adrId = Objects.requireNonNull(adrId, "adrId must not be null"); + return this; + } + + @java.lang.Override + public AdrDeleteRequest build() { + return new AdrDeleteRequest(landscapeId, versionId, adrId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/icepanel/types/AdrFilter.java b/src/main/java/com/icepanel/types/AdrFilter.java new file mode 100644 index 0000000..1b0ee53 --- /dev/null +++ b/src/main/java/com/icepanel/types/AdrFilter.java @@ -0,0 +1,222 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.icepanel.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.icepanel.core.ObjectMappers; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdrFilter.Builder.class) +public final class AdrFilter { + private final Optional name; + + private final Optional status; + + private final Map additionalProperties; + + private AdrFilter(Optional name, Optional status, Map additionalProperties) { + this.name = name; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return The name of the ADR + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdrFilter && equalTo((AdrFilter) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdrFilter other) { + return name.equals(other.name) && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.name, this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional name = Optional.empty(); + + private Optional status = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AdrFilter other) { + name(other.getName()); + status(other.getStatus()); + return this; + } + + /** + *

The name of the ADR

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(Status status) { + this.status = Optional.ofNullable(status); + return this; + } + + public AdrFilter build() { + return new AdrFilter(name, status, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } + + @JsonDeserialize(using = Status.Deserializer.class) + public static final class Status { + private final Object value; + + private final int type; + + private Status(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + @SuppressWarnings("unchecked") + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((AdrStatus) this.value); + } else if (this.type == 1) { + return visitor.visit((List) this.value); + } + throw new IllegalStateException("Failed to visit value. This should never happen."); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Status && equalTo((Status) other); + } + + private boolean equalTo(Status other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return this.value.toString(); + } + + public static Status of(AdrStatus value) { + return new Status(value, 0); + } + + public static Status of(List value) { + return new Status(value, 1); + } + + public interface Visitor { + T visit(AdrStatus value); + + T visit(List value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(Status.class); + } + + @java.lang.Override + public Status deserialize(JsonParser p, DeserializationContext context) throws IOException { + Object value = p.readValueAs(Object.class); + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, AdrStatus.class)); + } catch (RuntimeException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, new TypeReference>() {})); + } catch (RuntimeException e) { + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } + } +} diff --git a/src/main/java/com/icepanel/types/AdrFindRequest.java b/src/main/java/com/icepanel/types/AdrFindRequest.java new file mode 100644 index 0000000..349089b --- /dev/null +++ b/src/main/java/com/icepanel/types/AdrFindRequest.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.icepanel.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.icepanel.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdrFindRequest.Builder.class) +public final class AdrFindRequest { + private final String landscapeId; + + private final VersionIdPathParam versionId; + + private final String adrId; + + private final Map additionalProperties; + + private AdrFindRequest( + String landscapeId, VersionIdPathParam versionId, String adrId, Map additionalProperties) { + this.landscapeId = landscapeId; + this.versionId = versionId; + this.adrId = adrId; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("landscapeId") + public String getLandscapeId() { + return landscapeId; + } + + @JsonProperty("versionId") + public VersionIdPathParam getVersionId() { + return versionId; + } + + @JsonProperty("adrId") + public String getAdrId() { + return adrId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdrFindRequest && equalTo((AdrFindRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdrFindRequest other) { + return landscapeId.equals(other.landscapeId) && versionId.equals(other.versionId) && adrId.equals(other.adrId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.landscapeId, this.versionId, this.adrId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static LandscapeIdStage builder() { + return new Builder(); + } + + public interface LandscapeIdStage { + VersionIdStage landscapeId(@NotNull String landscapeId); + + Builder from(AdrFindRequest other); + } + + public interface VersionIdStage { + AdrIdStage versionId(@NotNull VersionIdPathParam versionId); + } + + public interface AdrIdStage { + _FinalStage adrId(@NotNull String adrId); + } + + public interface _FinalStage { + AdrFindRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements LandscapeIdStage, VersionIdStage, AdrIdStage, _FinalStage { + private String landscapeId; + + private VersionIdPathParam versionId; + + private String adrId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AdrFindRequest other) { + landscapeId(other.getLandscapeId()); + versionId(other.getVersionId()); + adrId(other.getAdrId()); + return this; + } + + @java.lang.Override + @JsonSetter("landscapeId") + public VersionIdStage landscapeId(@NotNull String landscapeId) { + this.landscapeId = Objects.requireNonNull(landscapeId, "landscapeId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("versionId") + public AdrIdStage versionId(@NotNull VersionIdPathParam versionId) { + this.versionId = Objects.requireNonNull(versionId, "versionId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("adrId") + public _FinalStage adrId(@NotNull String adrId) { + this.adrId = Objects.requireNonNull(adrId, "adrId must not be null"); + return this; + } + + @java.lang.Override + public AdrFindRequest build() { + return new AdrFindRequest(landscapeId, versionId, adrId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/icepanel/types/AdrPartial.java b/src/main/java/com/icepanel/types/AdrPartial.java new file mode 100644 index 0000000..d1dbf5d --- /dev/null +++ b/src/main/java/com/icepanel/types/AdrPartial.java @@ -0,0 +1,284 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.icepanel.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.icepanel.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdrPartial.Builder.class) +public final class AdrPartial { + private final Optional commit; + + private final Optional content; + + private final Optional description; + + private final Optional name; + + private final Optional> relatedItems; + + private final Optional status; + + private final Optional> statusChanges; + + private final Map additionalProperties; + + private AdrPartial( + Optional commit, + Optional content, + Optional description, + Optional name, + Optional> relatedItems, + Optional status, + Optional> statusChanges, + Map additionalProperties) { + this.commit = commit; + this.content = content; + this.description = description; + this.name = name; + this.relatedItems = relatedItems; + this.status = status; + this.statusChanges = statusChanges; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("commit") + public Optional getCommit() { + return commit; + } + + /** + * @return The markdown content of the ADR + */ + @JsonProperty("content") + public Optional getContent() { + return content; + } + + /** + * @return The description of the ADR + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return The name of the ADR + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + @JsonProperty("relatedItems") + public Optional> getRelatedItems() { + return relatedItems; + } + + /** + * @return The status of the ADR + */ + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + @JsonProperty("statusChanges") + public Optional> getStatusChanges() { + return statusChanges; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdrPartial && equalTo((AdrPartial) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdrPartial other) { + return commit.equals(other.commit) + && content.equals(other.content) + && description.equals(other.description) + && name.equals(other.name) + && relatedItems.equals(other.relatedItems) + && status.equals(other.status) + && statusChanges.equals(other.statusChanges); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.commit, + this.content, + this.description, + this.name, + this.relatedItems, + this.status, + this.statusChanges); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional commit = Optional.empty(); + + private Optional content = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional> relatedItems = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional> statusChanges = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AdrPartial other) { + commit(other.getCommit()); + content(other.getContent()); + description(other.getDescription()); + name(other.getName()); + relatedItems(other.getRelatedItems()); + status(other.getStatus()); + statusChanges(other.getStatusChanges()); + return this; + } + + @JsonSetter(value = "commit", nulls = Nulls.SKIP) + public Builder commit(Optional commit) { + this.commit = commit; + return this; + } + + public Builder commit(Double commit) { + this.commit = Optional.ofNullable(commit); + return this; + } + + /** + *

The markdown content of the ADR

+ */ + @JsonSetter(value = "content", nulls = Nulls.SKIP) + public Builder content(Optional content) { + this.content = content; + return this; + } + + public Builder content(String content) { + this.content = Optional.ofNullable(content); + return this; + } + + /** + *

The description of the ADR

+ */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

The name of the ADR

+ */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @JsonSetter(value = "relatedItems", nulls = Nulls.SKIP) + public Builder relatedItems(Optional> relatedItems) { + this.relatedItems = relatedItems; + return this; + } + + public Builder relatedItems(Map relatedItems) { + this.relatedItems = Optional.ofNullable(relatedItems); + return this; + } + + /** + *

The status of the ADR

+ */ + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(AdrStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + @JsonSetter(value = "statusChanges", nulls = Nulls.SKIP) + public Builder statusChanges(Optional> statusChanges) { + this.statusChanges = statusChanges; + return this; + } + + public Builder statusChanges(List statusChanges) { + this.statusChanges = Optional.ofNullable(statusChanges); + return this; + } + + public AdrPartial build() { + return new AdrPartial( + commit, content, description, name, relatedItems, status, statusChanges, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/icepanel/types/AdrRelatedItem.java b/src/main/java/com/icepanel/types/AdrRelatedItem.java new file mode 100644 index 0000000..2d49608 --- /dev/null +++ b/src/main/java/com/icepanel/types/AdrRelatedItem.java @@ -0,0 +1,290 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.icepanel.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.icepanel.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdrRelatedItem.Builder.class) +public final class AdrRelatedItem { + private final Optional adrId; + + private final Optional diagramId; + + private final Optional draftId; + + private final String id; + + private final double index; + + private final Optional link; + + private final AdrRelatedItemType type; + + private final Map additionalProperties; + + private AdrRelatedItem( + Optional adrId, + Optional diagramId, + Optional draftId, + String id, + double index, + Optional link, + AdrRelatedItemType type, + Map additionalProperties) { + this.adrId = adrId; + this.diagramId = diagramId; + this.draftId = draftId; + this.id = id; + this.index = index; + this.link = link; + this.type = type; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("adrId") + public Optional getAdrId() { + return adrId; + } + + @JsonProperty("diagramId") + public Optional getDiagramId() { + return diagramId; + } + + @JsonProperty("draftId") + public Optional getDraftId() { + return draftId; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("index") + public double getIndex() { + return index; + } + + @JsonProperty("link") + public Optional getLink() { + return link; + } + + @JsonProperty("type") + public AdrRelatedItemType getType() { + return type; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdrRelatedItem && equalTo((AdrRelatedItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdrRelatedItem other) { + return adrId.equals(other.adrId) + && diagramId.equals(other.diagramId) + && draftId.equals(other.draftId) + && id.equals(other.id) + && index == other.index + && link.equals(other.link) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.adrId, this.diagramId, this.draftId, this.id, this.index, this.link, this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + IndexStage id(@NotNull String id); + + Builder from(AdrRelatedItem other); + } + + public interface IndexStage { + TypeStage index(double index); + } + + public interface TypeStage { + _FinalStage type(@NotNull AdrRelatedItemType type); + } + + public interface _FinalStage { + AdrRelatedItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage adrId(Optional adrId); + + _FinalStage adrId(String adrId); + + _FinalStage diagramId(Optional diagramId); + + _FinalStage diagramId(String diagramId); + + _FinalStage draftId(Optional draftId); + + _FinalStage draftId(String draftId); + + _FinalStage link(Optional link); + + _FinalStage link(RealityLink link); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, IndexStage, TypeStage, _FinalStage { + private String id; + + private double index; + + private AdrRelatedItemType type; + + private Optional link = Optional.empty(); + + private Optional draftId = Optional.empty(); + + private Optional diagramId = Optional.empty(); + + private Optional adrId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AdrRelatedItem other) { + adrId(other.getAdrId()); + diagramId(other.getDiagramId()); + draftId(other.getDraftId()); + id(other.getId()); + index(other.getIndex()); + link(other.getLink()); + type(other.getType()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public IndexStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("index") + public TypeStage index(double index) { + this.index = index; + return this; + } + + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull AdrRelatedItemType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage link(RealityLink link) { + this.link = Optional.ofNullable(link); + return this; + } + + @java.lang.Override + @JsonSetter(value = "link", nulls = Nulls.SKIP) + public _FinalStage link(Optional link) { + this.link = link; + return this; + } + + @java.lang.Override + public _FinalStage draftId(String draftId) { + this.draftId = Optional.ofNullable(draftId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "draftId", nulls = Nulls.SKIP) + public _FinalStage draftId(Optional draftId) { + this.draftId = draftId; + return this; + } + + @java.lang.Override + public _FinalStage diagramId(String diagramId) { + this.diagramId = Optional.ofNullable(diagramId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "diagramId", nulls = Nulls.SKIP) + public _FinalStage diagramId(Optional diagramId) { + this.diagramId = diagramId; + return this; + } + + @java.lang.Override + public _FinalStage adrId(String adrId) { + this.adrId = Optional.ofNullable(adrId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "adrId", nulls = Nulls.SKIP) + public _FinalStage adrId(Optional adrId) { + this.adrId = adrId; + return this; + } + + @java.lang.Override + public AdrRelatedItem build() { + return new AdrRelatedItem(adrId, diagramId, draftId, id, index, link, type, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/icepanel/types/AdrRelatedItemType.java b/src/main/java/com/icepanel/types/AdrRelatedItemType.java new file mode 100644 index 0000000..08985cb --- /dev/null +++ b/src/main/java/com/icepanel/types/AdrRelatedItemType.java @@ -0,0 +1,103 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.icepanel.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AdrRelatedItemType { + public static final AdrRelatedItemType DIAGRAM = new AdrRelatedItemType(Value.DIAGRAM, "diagram"); + + public static final AdrRelatedItemType LINK = new AdrRelatedItemType(Value.LINK, "link"); + + public static final AdrRelatedItemType ADR = new AdrRelatedItemType(Value.ADR, "adr"); + + public static final AdrRelatedItemType DRAFT = new AdrRelatedItemType(Value.DRAFT, "draft"); + + private final Value value; + + private final String string; + + AdrRelatedItemType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AdrRelatedItemType && this.string.equals(((AdrRelatedItemType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DIAGRAM: + return visitor.visitDiagram(); + case LINK: + return visitor.visitLink(); + case ADR: + return visitor.visitAdr(); + case DRAFT: + return visitor.visitDraft(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AdrRelatedItemType valueOf(String value) { + switch (value) { + case "diagram": + return DIAGRAM; + case "link": + return LINK; + case "adr": + return ADR; + case "draft": + return DRAFT; + default: + return new AdrRelatedItemType(Value.UNKNOWN, value); + } + } + + public enum Value { + ADR, + + DIAGRAM, + + DRAFT, + + LINK, + + UNKNOWN + } + + public interface Visitor { + T visitAdr(); + + T visitDiagram(); + + T visitDraft(); + + T visitLink(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/icepanel/types/AdrRequired.java b/src/main/java/com/icepanel/types/AdrRequired.java new file mode 100644 index 0000000..bdbafbb --- /dev/null +++ b/src/main/java/com/icepanel/types/AdrRequired.java @@ -0,0 +1,397 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.icepanel.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.icepanel.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdrRequired.Builder.class) +public final class AdrRequired { + private final Optional commit; + + private final Optional content; + + private final Optional description; + + private final String name; + + private final Optional> relatedItems; + + private final AdrStatus status; + + private final Optional> statusChanges; + + private final String handleId; + + private final Map additionalProperties; + + private AdrRequired( + Optional commit, + Optional content, + Optional description, + String name, + Optional> relatedItems, + AdrStatus status, + Optional> statusChanges, + String handleId, + Map additionalProperties) { + this.commit = commit; + this.content = content; + this.description = description; + this.name = name; + this.relatedItems = relatedItems; + this.status = status; + this.statusChanges = statusChanges; + this.handleId = handleId; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("commit") + public Optional getCommit() { + return commit; + } + + /** + * @return The markdown content of the ADR + */ + @JsonProperty("content") + public Optional getContent() { + return content; + } + + /** + * @return The description of the ADR + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return The name of the ADR + */ + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("relatedItems") + public Optional> getRelatedItems() { + return relatedItems; + } + + /** + * @return The status of the ADR + */ + @JsonProperty("status") + public AdrStatus getStatus() { + return status; + } + + @JsonProperty("statusChanges") + public Optional> getStatusChanges() { + return statusChanges; + } + + /** + * @return The handle id of the ADR + */ + @JsonProperty("handleId") + public String getHandleId() { + return handleId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdrRequired && equalTo((AdrRequired) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdrRequired other) { + return commit.equals(other.commit) + && content.equals(other.content) + && description.equals(other.description) + && name.equals(other.name) + && relatedItems.equals(other.relatedItems) + && status.equals(other.status) + && statusChanges.equals(other.statusChanges) + && handleId.equals(other.handleId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.commit, + this.content, + this.description, + this.name, + this.relatedItems, + this.status, + this.statusChanges, + this.handleId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static NameStage builder() { + return new Builder(); + } + + public interface NameStage { + /** + *

The name of the ADR

+ */ + StatusStage name(@NotNull String name); + + Builder from(AdrRequired other); + } + + public interface StatusStage { + /** + *

The status of the ADR

+ */ + HandleIdStage status(@NotNull AdrStatus status); + } + + public interface HandleIdStage { + /** + *

The handle id of the ADR

+ */ + _FinalStage handleId(@NotNull String handleId); + } + + public interface _FinalStage { + AdrRequired build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage commit(Optional commit); + + _FinalStage commit(Double commit); + + /** + *

The markdown content of the ADR

+ */ + _FinalStage content(Optional content); + + _FinalStage content(String content); + + /** + *

The description of the ADR

+ */ + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage relatedItems(Optional> relatedItems); + + _FinalStage relatedItems(Map relatedItems); + + _FinalStage statusChanges(Optional> statusChanges); + + _FinalStage statusChanges(List statusChanges); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements NameStage, StatusStage, HandleIdStage, _FinalStage { + private String name; + + private AdrStatus status; + + private String handleId; + + private Optional> statusChanges = Optional.empty(); + + private Optional> relatedItems = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional content = Optional.empty(); + + private Optional commit = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AdrRequired other) { + commit(other.getCommit()); + content(other.getContent()); + description(other.getDescription()); + name(other.getName()); + relatedItems(other.getRelatedItems()); + status(other.getStatus()); + statusChanges(other.getStatusChanges()); + handleId(other.getHandleId()); + return this; + } + + /** + *

The name of the ADR

+ *

The name of the ADR

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public StatusStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

The status of the ADR

+ *

The status of the ADR

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public HandleIdStage status(@NotNull AdrStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

The handle id of the ADR

+ *

The handle id of the ADR

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("handleId") + public _FinalStage handleId(@NotNull String handleId) { + this.handleId = Objects.requireNonNull(handleId, "handleId must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage statusChanges(List statusChanges) { + this.statusChanges = Optional.ofNullable(statusChanges); + return this; + } + + @java.lang.Override + @JsonSetter(value = "statusChanges", nulls = Nulls.SKIP) + public _FinalStage statusChanges(Optional> statusChanges) { + this.statusChanges = statusChanges; + return this; + } + + @java.lang.Override + public _FinalStage relatedItems(Map relatedItems) { + this.relatedItems = Optional.ofNullable(relatedItems); + return this; + } + + @java.lang.Override + @JsonSetter(value = "relatedItems", nulls = Nulls.SKIP) + public _FinalStage relatedItems(Optional> relatedItems) { + this.relatedItems = relatedItems; + return this; + } + + /** + *

The description of the ADR

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

The description of the ADR

+ */ + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + /** + *

The markdown content of the ADR

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage content(String content) { + this.content = Optional.ofNullable(content); + return this; + } + + /** + *

The markdown content of the ADR

+ */ + @java.lang.Override + @JsonSetter(value = "content", nulls = Nulls.SKIP) + public _FinalStage content(Optional content) { + this.content = content; + return this; + } + + @java.lang.Override + public _FinalStage commit(Double commit) { + this.commit = Optional.ofNullable(commit); + return this; + } + + @java.lang.Override + @JsonSetter(value = "commit", nulls = Nulls.SKIP) + public _FinalStage commit(Optional commit) { + this.commit = commit; + return this; + } + + @java.lang.Override + public AdrRequired build() { + return new AdrRequired( + commit, + content, + description, + name, + relatedItems, + status, + statusChanges, + handleId, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/icepanel/types/AdrStatus.java b/src/main/java/com/icepanel/types/AdrStatus.java new file mode 100644 index 0000000..c84ff57 --- /dev/null +++ b/src/main/java/com/icepanel/types/AdrStatus.java @@ -0,0 +1,92 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.icepanel.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AdrStatus { + public static final AdrStatus ACCEPTED = new AdrStatus(Value.ACCEPTED, "accepted"); + + public static final AdrStatus DRAFT = new AdrStatus(Value.DRAFT, "draft"); + + public static final AdrStatus REJECTED = new AdrStatus(Value.REJECTED, "rejected"); + + private final Value value; + + private final String string; + + AdrStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) || (other instanceof AdrStatus && this.string.equals(((AdrStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ACCEPTED: + return visitor.visitAccepted(); + case DRAFT: + return visitor.visitDraft(); + case REJECTED: + return visitor.visitRejected(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AdrStatus valueOf(String value) { + switch (value) { + case "accepted": + return ACCEPTED; + case "draft": + return DRAFT; + case "rejected": + return REJECTED; + default: + return new AdrStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + ACCEPTED, + + DRAFT, + + REJECTED, + + UNKNOWN + } + + public interface Visitor { + T visitAccepted(); + + T visitDraft(); + + T visitRejected(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/icepanel/types/AdrStatusChange.java b/src/main/java/com/icepanel/types/AdrStatusChange.java new file mode 100644 index 0000000..f58b0a7 --- /dev/null +++ b/src/main/java/com/icepanel/types/AdrStatusChange.java @@ -0,0 +1,194 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.icepanel.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.icepanel.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdrStatusChange.Builder.class) +public final class AdrStatusChange { + private final OffsetDateTime createdAt; + + private final AuthType createdBy; + + private final String createdById; + + private final AdrStatus status; + + private final Map additionalProperties; + + private AdrStatusChange( + OffsetDateTime createdAt, + AuthType createdBy, + String createdById, + AdrStatus status, + Map additionalProperties) { + this.createdAt = createdAt; + this.createdBy = createdBy; + this.createdById = createdById; + this.status = status; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty("createdBy") + public AuthType getCreatedBy() { + return createdBy; + } + + @JsonProperty("createdById") + public String getCreatedById() { + return createdById; + } + + @JsonProperty("status") + public AdrStatus getStatus() { + return status; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdrStatusChange && equalTo((AdrStatusChange) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdrStatusChange other) { + return createdAt.equals(other.createdAt) + && createdBy.equals(other.createdBy) + && createdById.equals(other.createdById) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.createdAt, this.createdBy, this.createdById, this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + CreatedByStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(AdrStatusChange other); + } + + public interface CreatedByStage { + CreatedByIdStage createdBy(@NotNull AuthType createdBy); + } + + public interface CreatedByIdStage { + StatusStage createdById(@NotNull String createdById); + } + + public interface StatusStage { + _FinalStage status(@NotNull AdrStatus status); + } + + public interface _FinalStage { + AdrStatusChange build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CreatedAtStage, CreatedByStage, CreatedByIdStage, StatusStage, _FinalStage { + private OffsetDateTime createdAt; + + private AuthType createdBy; + + private String createdById; + + private AdrStatus status; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AdrStatusChange other) { + createdAt(other.getCreatedAt()); + createdBy(other.getCreatedBy()); + createdById(other.getCreatedById()); + status(other.getStatus()); + return this; + } + + @java.lang.Override + @JsonSetter("createdAt") + public CreatedByStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("createdBy") + public CreatedByIdStage createdBy(@NotNull AuthType createdBy) { + this.createdBy = Objects.requireNonNull(createdBy, "createdBy must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("createdById") + public StatusStage createdById(@NotNull String createdById) { + this.createdById = Objects.requireNonNull(createdById, "createdById must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull AdrStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + @java.lang.Override + public AdrStatusChange build() { + return new AdrStatusChange(createdAt, createdBy, createdById, status, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/icepanel/types/AdrUpdateRequest.java b/src/main/java/com/icepanel/types/AdrUpdateRequest.java new file mode 100644 index 0000000..cc0194f --- /dev/null +++ b/src/main/java/com/icepanel/types/AdrUpdateRequest.java @@ -0,0 +1,192 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.icepanel.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.icepanel.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdrUpdateRequest.Builder.class) +public final class AdrUpdateRequest { + private final String landscapeId; + + private final VersionIdPathParam versionId; + + private final String adrId; + + private final AdrPartial body; + + private final Map additionalProperties; + + private AdrUpdateRequest( + String landscapeId, + VersionIdPathParam versionId, + String adrId, + AdrPartial body, + Map additionalProperties) { + this.landscapeId = landscapeId; + this.versionId = versionId; + this.adrId = adrId; + this.body = body; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("landscapeId") + public String getLandscapeId() { + return landscapeId; + } + + @JsonProperty("versionId") + public VersionIdPathParam getVersionId() { + return versionId; + } + + @JsonProperty("adrId") + public String getAdrId() { + return adrId; + } + + @JsonProperty("body") + public AdrPartial getBody() { + return body; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdrUpdateRequest && equalTo((AdrUpdateRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdrUpdateRequest other) { + return landscapeId.equals(other.landscapeId) + && versionId.equals(other.versionId) + && adrId.equals(other.adrId) + && body.equals(other.body); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.landscapeId, this.versionId, this.adrId, this.body); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static LandscapeIdStage builder() { + return new Builder(); + } + + public interface LandscapeIdStage { + VersionIdStage landscapeId(@NotNull String landscapeId); + + Builder from(AdrUpdateRequest other); + } + + public interface VersionIdStage { + AdrIdStage versionId(@NotNull VersionIdPathParam versionId); + } + + public interface AdrIdStage { + BodyStage adrId(@NotNull String adrId); + } + + public interface BodyStage { + _FinalStage body(@NotNull AdrPartial body); + } + + public interface _FinalStage { + AdrUpdateRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements LandscapeIdStage, VersionIdStage, AdrIdStage, BodyStage, _FinalStage { + private String landscapeId; + + private VersionIdPathParam versionId; + + private String adrId; + + private AdrPartial body; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AdrUpdateRequest other) { + landscapeId(other.getLandscapeId()); + versionId(other.getVersionId()); + adrId(other.getAdrId()); + body(other.getBody()); + return this; + } + + @java.lang.Override + @JsonSetter("landscapeId") + public VersionIdStage landscapeId(@NotNull String landscapeId) { + this.landscapeId = Objects.requireNonNull(landscapeId, "landscapeId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("versionId") + public AdrIdStage versionId(@NotNull VersionIdPathParam versionId) { + this.versionId = Objects.requireNonNull(versionId, "versionId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("adrId") + public BodyStage adrId(@NotNull String adrId) { + this.adrId = Objects.requireNonNull(adrId, "adrId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("body") + public _FinalStage body(@NotNull AdrPartial body) { + this.body = Objects.requireNonNull(body, "body must not be null"); + return this; + } + + @java.lang.Override + public AdrUpdateRequest build() { + return new AdrUpdateRequest(landscapeId, versionId, adrId, body, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/icepanel/types/AdrsCreateResponse.java b/src/main/java/com/icepanel/types/AdrsCreateResponse.java new file mode 100644 index 0000000..4479056 --- /dev/null +++ b/src/main/java/com/icepanel/types/AdrsCreateResponse.java @@ -0,0 +1,118 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.icepanel.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.icepanel.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdrsCreateResponse.Builder.class) +public final class AdrsCreateResponse { + private final Adr adr; + + private final Map additionalProperties; + + private AdrsCreateResponse(Adr adr, Map additionalProperties) { + this.adr = adr; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("adr") + public Adr getAdr() { + return adr; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdrsCreateResponse && equalTo((AdrsCreateResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdrsCreateResponse other) { + return adr.equals(other.adr); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.adr); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AdrStage builder() { + return new Builder(); + } + + public interface AdrStage { + _FinalStage adr(@NotNull Adr adr); + + Builder from(AdrsCreateResponse other); + } + + public interface _FinalStage { + AdrsCreateResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AdrStage, _FinalStage { + private Adr adr; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AdrsCreateResponse other) { + adr(other.getAdr()); + return this; + } + + @java.lang.Override + @JsonSetter("adr") + public _FinalStage adr(@NotNull Adr adr) { + this.adr = Objects.requireNonNull(adr, "adr must not be null"); + return this; + } + + @java.lang.Override + public AdrsCreateResponse build() { + return new AdrsCreateResponse(adr, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/icepanel/types/AdrsGetResponse.java b/src/main/java/com/icepanel/types/AdrsGetResponse.java new file mode 100644 index 0000000..5b5cfdd --- /dev/null +++ b/src/main/java/com/icepanel/types/AdrsGetResponse.java @@ -0,0 +1,118 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.icepanel.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.icepanel.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdrsGetResponse.Builder.class) +public final class AdrsGetResponse { + private final Adr adr; + + private final Map additionalProperties; + + private AdrsGetResponse(Adr adr, Map additionalProperties) { + this.adr = adr; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("adr") + public Adr getAdr() { + return adr; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdrsGetResponse && equalTo((AdrsGetResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdrsGetResponse other) { + return adr.equals(other.adr); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.adr); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AdrStage builder() { + return new Builder(); + } + + public interface AdrStage { + _FinalStage adr(@NotNull Adr adr); + + Builder from(AdrsGetResponse other); + } + + public interface _FinalStage { + AdrsGetResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AdrStage, _FinalStage { + private Adr adr; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AdrsGetResponse other) { + adr(other.getAdr()); + return this; + } + + @java.lang.Override + @JsonSetter("adr") + public _FinalStage adr(@NotNull Adr adr) { + this.adr = Objects.requireNonNull(adr, "adr must not be null"); + return this; + } + + @java.lang.Override + public AdrsGetResponse build() { + return new AdrsGetResponse(adr, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/icepanel/types/AdrsListRequest.java b/src/main/java/com/icepanel/types/AdrsListRequest.java new file mode 100644 index 0000000..8f9d8e8 --- /dev/null +++ b/src/main/java/com/icepanel/types/AdrsListRequest.java @@ -0,0 +1,236 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.icepanel.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.icepanel.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdrsListRequest.Builder.class) +public final class AdrsListRequest { + private final String landscapeId; + + private final VersionIdPathParam versionId; + + private final Optional filter; + + private final Optional cursor; + + private final Optional limit; + + private final Map additionalProperties; + + private AdrsListRequest( + String landscapeId, + VersionIdPathParam versionId, + Optional filter, + Optional cursor, + Optional limit, + Map additionalProperties) { + this.landscapeId = landscapeId; + this.versionId = versionId; + this.filter = filter; + this.cursor = cursor; + this.limit = limit; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("landscapeId") + public String getLandscapeId() { + return landscapeId; + } + + @JsonProperty("versionId") + public VersionIdPathParam getVersionId() { + return versionId; + } + + @JsonProperty("filter") + public Optional getFilter() { + return filter; + } + + @JsonProperty("cursor") + public Optional getCursor() { + return cursor; + } + + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdrsListRequest && equalTo((AdrsListRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdrsListRequest other) { + return landscapeId.equals(other.landscapeId) + && versionId.equals(other.versionId) + && filter.equals(other.filter) + && cursor.equals(other.cursor) + && limit.equals(other.limit); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.landscapeId, this.versionId, this.filter, this.cursor, this.limit); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static LandscapeIdStage builder() { + return new Builder(); + } + + public interface LandscapeIdStage { + VersionIdStage landscapeId(@NotNull String landscapeId); + + Builder from(AdrsListRequest other); + } + + public interface VersionIdStage { + _FinalStage versionId(@NotNull VersionIdPathParam versionId); + } + + public interface _FinalStage { + AdrsListRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage filter(Optional filter); + + _FinalStage filter(AdrFilter filter); + + _FinalStage cursor(Optional cursor); + + _FinalStage cursor(String cursor); + + _FinalStage limit(Optional limit); + + _FinalStage limit(Double limit); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements LandscapeIdStage, VersionIdStage, _FinalStage { + private String landscapeId; + + private VersionIdPathParam versionId; + + private Optional limit = Optional.empty(); + + private Optional cursor = Optional.empty(); + + private Optional filter = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AdrsListRequest other) { + landscapeId(other.getLandscapeId()); + versionId(other.getVersionId()); + filter(other.getFilter()); + cursor(other.getCursor()); + limit(other.getLimit()); + return this; + } + + @java.lang.Override + @JsonSetter("landscapeId") + public VersionIdStage landscapeId(@NotNull String landscapeId) { + this.landscapeId = Objects.requireNonNull(landscapeId, "landscapeId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("versionId") + public _FinalStage versionId(@NotNull VersionIdPathParam versionId) { + this.versionId = Objects.requireNonNull(versionId, "versionId must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage limit(Double limit) { + this.limit = Optional.ofNullable(limit); + return this; + } + + @java.lang.Override + @JsonSetter(value = "limit", nulls = Nulls.SKIP) + public _FinalStage limit(Optional limit) { + this.limit = limit; + return this; + } + + @java.lang.Override + public _FinalStage cursor(String cursor) { + this.cursor = Optional.ofNullable(cursor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "cursor", nulls = Nulls.SKIP) + public _FinalStage cursor(Optional cursor) { + this.cursor = cursor; + return this; + } + + @java.lang.Override + public _FinalStage filter(AdrFilter filter) { + this.filter = Optional.ofNullable(filter); + return this; + } + + @java.lang.Override + @JsonSetter(value = "filter", nulls = Nulls.SKIP) + public _FinalStage filter(Optional filter) { + this.filter = filter; + return this; + } + + @java.lang.Override + public AdrsListRequest build() { + return new AdrsListRequest(landscapeId, versionId, filter, cursor, limit, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/icepanel/types/AdrsListResponse.java b/src/main/java/com/icepanel/types/AdrsListResponse.java new file mode 100644 index 0000000..183d9e5 --- /dev/null +++ b/src/main/java/com/icepanel/types/AdrsListResponse.java @@ -0,0 +1,139 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.icepanel.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.icepanel.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdrsListResponse.Builder.class) +public final class AdrsListResponse { + private final List adrs; + + private final Optional nextCursor; + + private final Map additionalProperties; + + private AdrsListResponse(List adrs, Optional nextCursor, Map additionalProperties) { + this.adrs = adrs; + this.nextCursor = nextCursor; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("adrs") + public List getAdrs() { + return adrs; + } + + @JsonProperty("nextCursor") + public Optional getNextCursor() { + return nextCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdrsListResponse && equalTo((AdrsListResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdrsListResponse other) { + return adrs.equals(other.adrs) && nextCursor.equals(other.nextCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.adrs, this.nextCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List adrs = new ArrayList<>(); + + private Optional nextCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AdrsListResponse other) { + adrs(other.getAdrs()); + nextCursor(other.getNextCursor()); + return this; + } + + @JsonSetter(value = "adrs", nulls = Nulls.SKIP) + public Builder adrs(List adrs) { + this.adrs.clear(); + if (adrs != null) { + this.adrs.addAll(adrs); + } + return this; + } + + public Builder addAdrs(Adr adrs) { + this.adrs.add(adrs); + return this; + } + + public Builder addAllAdrs(List adrs) { + if (adrs != null) { + this.adrs.addAll(adrs); + } + return this; + } + + @JsonSetter(value = "nextCursor", nulls = Nulls.SKIP) + public Builder nextCursor(Optional nextCursor) { + this.nextCursor = nextCursor; + return this; + } + + public Builder nextCursor(String nextCursor) { + this.nextCursor = Optional.ofNullable(nextCursor); + return this; + } + + public AdrsListResponse build() { + return new AdrsListResponse(adrs, nextCursor, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/icepanel/types/AdrsUpdateResponse.java b/src/main/java/com/icepanel/types/AdrsUpdateResponse.java new file mode 100644 index 0000000..1ff2fcf --- /dev/null +++ b/src/main/java/com/icepanel/types/AdrsUpdateResponse.java @@ -0,0 +1,118 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.icepanel.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.icepanel.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AdrsUpdateResponse.Builder.class) +public final class AdrsUpdateResponse { + private final Adr adr; + + private final Map additionalProperties; + + private AdrsUpdateResponse(Adr adr, Map additionalProperties) { + this.adr = adr; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("adr") + public Adr getAdr() { + return adr; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AdrsUpdateResponse && equalTo((AdrsUpdateResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AdrsUpdateResponse other) { + return adr.equals(other.adr); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.adr); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AdrStage builder() { + return new Builder(); + } + + public interface AdrStage { + _FinalStage adr(@NotNull Adr adr); + + Builder from(AdrsUpdateResponse other); + } + + public interface _FinalStage { + AdrsUpdateResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AdrStage, _FinalStage { + private Adr adr; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AdrsUpdateResponse other) { + adr(other.getAdr()); + return this; + } + + @java.lang.Override + @JsonSetter("adr") + public _FinalStage adr(@NotNull Adr adr) { + this.adr = Objects.requireNonNull(adr, "adr must not be null"); + return this; + } + + @java.lang.Override + public AdrsUpdateResponse build() { + return new AdrsUpdateResponse(adr, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/icepanel/types/VersionIdPathParam.java b/src/main/java/com/icepanel/types/VersionIdPathParam.java new file mode 100644 index 0000000..289af04 --- /dev/null +++ b/src/main/java/com/icepanel/types/VersionIdPathParam.java @@ -0,0 +1,161 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.icepanel.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.icepanel.core.ObjectMappers; +import java.io.IOException; +import java.util.Objects; + +@JsonDeserialize(using = VersionIdPathParam.Deserializer.class) +public final class VersionIdPathParam { + private final Object value; + + private final int type; + + private VersionIdPathParam(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + @SuppressWarnings("unchecked") + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((String) this.value); + } else if (this.type == 1) { + return visitor.visit((One) this.value); + } + throw new IllegalStateException("Failed to visit value. This should never happen."); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VersionIdPathParam && equalTo((VersionIdPathParam) other); + } + + private boolean equalTo(VersionIdPathParam other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return this.value.toString(); + } + + public static VersionIdPathParam of(String value) { + return new VersionIdPathParam(value, 0); + } + + public static VersionIdPathParam of(One value) { + return new VersionIdPathParam(value, 1); + } + + public interface Visitor { + T visit(String value); + + T visit(One value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(VersionIdPathParam.class); + } + + @java.lang.Override + public VersionIdPathParam deserialize(JsonParser p, DeserializationContext context) throws IOException { + Object value = p.readValueAs(Object.class); + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, String.class)); + } catch (RuntimeException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, One.class)); + } catch (RuntimeException e) { + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } + + public static final class One { + public static final One LATEST = new One(Value.LATEST, "latest"); + + private final Value value; + + private final String string; + + One(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) || (other instanceof One && this.string.equals(((One) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case LATEST: + return visitor.visitLatest(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static One valueOf(String value) { + switch (value) { + case "latest": + return LATEST; + default: + return new One(Value.UNKNOWN, value); + } + } + + public enum Value { + LATEST, + + UNKNOWN + } + + public interface Visitor { + T visitLatest(); + + T visitUnknown(String unknownType); + } + } +}