From aa55910f7b8aa17134ccc221f0521898b991b3a2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 18 Mar 2026 07:21:45 +0000 Subject: [PATCH] Update SDK to version v3.43.0 - Generated from OpenAPI spec version v3.43.0 - Auto-generated by GitHub Actions --- .sdk-version | 2 +- README.md | 12 +- build.gradle | 4 +- build.sbt | 2 +- docs/AnalysesXRefsApi.md | 14 +- ...nseXRef.md => BaseResponseXrefResponse.md} | 4 +- docs/{XRef.md => XrefFromResponse.md} | 6 +- docs/XrefResponse.md | 14 + docs/XrefToResponse.md | 21 + pom.xml | 2 +- .../java/ai/reveng/api/AnalysesXRefsApi.java | 32 +- .../java/ai/reveng/invoker/ApiClient.java | 2 +- .../java/ai/reveng/invoker/Configuration.java | 2 +- src/main/java/ai/reveng/invoker/JSON.java | 6 +- ...Ref.java => BaseResponseXrefResponse.java} | 82 +-- .../{XRef.java => XrefFromResponse.java} | 154 ++--- .../java/ai/reveng/model/XrefResponse.java | 357 ++++++++++++ .../java/ai/reveng/model/XrefToResponse.java | 528 ++++++++++++++++++ 18 files changed, 1085 insertions(+), 159 deletions(-) rename docs/{BaseResponseXRef.md => BaseResponseXrefResponse.md} (81%) rename docs/{XRef.md => XrefFromResponse.md} (88%) create mode 100644 docs/XrefResponse.md create mode 100644 docs/XrefToResponse.md rename src/main/java/ai/reveng/model/{BaseResponseXRef.java => BaseResponseXrefResponse.java} (81%) rename src/main/java/ai/reveng/model/{XRef.java => XrefFromResponse.java} (80%) create mode 100644 src/main/java/ai/reveng/model/XrefResponse.java create mode 100644 src/main/java/ai/reveng/model/XrefToResponse.java diff --git a/.sdk-version b/.sdk-version index 235075b..005235b 100644 --- a/.sdk-version +++ b/.sdk-version @@ -1 +1 @@ -v3.42.1 +v3.43.0 diff --git a/README.md b/README.md index f6105d7..27c29bc 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Add this dependency to your project's POM: ai.reveng sdk - 3.42.1 + 3.43.0 compile ``` @@ -31,7 +31,7 @@ repositories { } dependencies { - implementation "ai.reveng:sdk:3.42.1" + implementation "ai.reveng:sdk:3.43.0" } ``` @@ -113,7 +113,7 @@ Class | Method | HTTP request | Description *AnalysesSecurityChecksApi* | [**createScurityChecksTask**](docs/AnalysesSecurityChecksApi.md#createScurityChecksTask) | **POST** /v2/analyses/{analysis_id}/security-checks | Queues a security check process *AnalysesSecurityChecksApi* | [**getSecurityChecks**](docs/AnalysesSecurityChecksApi.md#getSecurityChecks) | **GET** /v2/analyses/{analysis_id}/security-checks | Get Security Checks *AnalysesSecurityChecksApi* | [**getSecurityChecksTaskStatus**](docs/AnalysesSecurityChecksApi.md#getSecurityChecksTaskStatus) | **GET** /v2/analyses/{analysis_id}/security-checks/status | Check the status of a security check process -*AnalysesXRefsApi* | [**getXrefByVaddr**](docs/AnalysesXRefsApi.md#getXrefByVaddr) | **GET** /v2/analyses/{analysis_id}/xrefs/{vaddr} | [Beta] Look up an xref by virtual address +*AnalysesXRefsApi* | [**getXrefByVaddr**](docs/AnalysesXRefsApi.md#getXrefByVaddr) | **GET** /v2/analyses/{analysis_id}/xrefs/{vaddr} | [Beta] Look up xrefs by virtual address *AuthenticationUsersApi* | [**getRequesterUserInfo**](docs/AuthenticationUsersApi.md#getRequesterUserInfo) | **GET** /v2/users/me | Get the requesters user information *AuthenticationUsersApi* | [**getUser**](docs/AuthenticationUsersApi.md#getUser) | **GET** /v2/users/{user_id} | Get a user's public information *AuthenticationUsersApi* | [**getUserActivity**](docs/AuthenticationUsersApi.md#getUserActivity) | **GET** /v2/users/activity | Get auth user activity @@ -299,7 +299,7 @@ Class | Method | HTTP request | Description - [BaseResponseTaskResponse](docs/BaseResponseTaskResponse.md) - [BaseResponseUploadResponse](docs/BaseResponseUploadResponse.md) - [BaseResponseVulnerabilities](docs/BaseResponseVulnerabilities.md) - - [BaseResponseXRef](docs/BaseResponseXRef.md) + - [BaseResponseXrefResponse](docs/BaseResponseXrefResponse.md) - [Basic](docs/Basic.md) - [BinariesRelatedStatusResponse](docs/BinariesRelatedStatusResponse.md) - [BinariesTaskStatus](docs/BinariesTaskStatus.md) @@ -492,7 +492,9 @@ Class | Method | HTTP request | Description - [Vulnerability](docs/Vulnerability.md) - [VulnerabilityType](docs/VulnerabilityType.md) - [Workspace](docs/Workspace.md) - - [XRef](docs/XRef.md) + - [XrefFromResponse](docs/XrefFromResponse.md) + - [XrefResponse](docs/XrefResponse.md) + - [XrefToResponse](docs/XrefToResponse.md) ## Recommendation diff --git a/build.gradle b/build.gradle index 958f530..db79b5d 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,7 @@ apply plugin: 'java' apply plugin: 'com.diffplug.spotless' group = 'ai.reveng' -version = '3.42.1' +version = '3.43.0' @@ -171,7 +171,7 @@ mavenPublishing { publishToMavenCentral(true) signAllPublications() - coordinates("ai.reveng", "sdk", "3.42.1") + coordinates("ai.reveng", "sdk", "3.43.0") pom { name = "sdk" diff --git a/build.sbt b/build.sbt index 80c38f9..b18db86 100644 --- a/build.sbt +++ b/build.sbt @@ -2,7 +2,7 @@ lazy val root = (project in file(".")). settings( organization := "ai.reveng", name := "sdk", - version := "3.42.1", + version := "3.43.0", scalaVersion := "2.11.12", scalacOptions ++= Seq("-feature"), compile / javacOptions ++= Seq("-Xlint:deprecation"), diff --git a/docs/AnalysesXRefsApi.md b/docs/AnalysesXRefsApi.md index 2c5d10f..a9e267f 100644 --- a/docs/AnalysesXRefsApi.md +++ b/docs/AnalysesXRefsApi.md @@ -4,14 +4,14 @@ All URIs are relative to *https://api.reveng.ai* | Method | HTTP request | Description | |------------- | ------------- | -------------| -| [**getXrefByVaddr**](AnalysesXRefsApi.md#getXrefByVaddr) | **GET** /v2/analyses/{analysis_id}/xrefs/{vaddr} | [Beta] Look up an xref by virtual address | +| [**getXrefByVaddr**](AnalysesXRefsApi.md#getXrefByVaddr) | **GET** /v2/analyses/{analysis_id}/xrefs/{vaddr} | [Beta] Look up xrefs by virtual address | # **getXrefByVaddr** -> BaseResponseXRef getXrefByVaddr(analysisId, vaddr) +> BaseResponseXrefResponse getXrefByVaddr(analysisId, vaddr) -[Beta] Look up an xref by virtual address +[Beta] Look up xrefs by virtual address **This endpoint is in beta and may change without notice.** @@ -38,9 +38,9 @@ public class Example { AnalysesXRefsApi apiInstance = new AnalysesXRefsApi(defaultClient); Integer analysisId = 56; // Integer | - Integer vaddr = 56; // Integer | Virtual address to match against xref_to + Integer vaddr = 56; // Integer | Virtual address to match against xrefs try { - BaseResponseXRef result = apiInstance.getXrefByVaddr(analysisId, vaddr); + BaseResponseXrefResponse result = apiInstance.getXrefByVaddr(analysisId, vaddr); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling AnalysesXRefsApi#getXrefByVaddr"); @@ -58,11 +58,11 @@ public class Example { | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| | **analysisId** | **Integer**| | | -| **vaddr** | **Integer**| Virtual address to match against xref_to | | +| **vaddr** | **Integer**| Virtual address to match against xrefs | | ### Return type -[**BaseResponseXRef**](BaseResponseXRef.md) +[**BaseResponseXrefResponse**](BaseResponseXrefResponse.md) ### Authorization diff --git a/docs/BaseResponseXRef.md b/docs/BaseResponseXrefResponse.md similarity index 81% rename from docs/BaseResponseXRef.md rename to docs/BaseResponseXrefResponse.md index 00cf7fa..275a552 100644 --- a/docs/BaseResponseXRef.md +++ b/docs/BaseResponseXrefResponse.md @@ -1,6 +1,6 @@ -# BaseResponseXRef +# BaseResponseXrefResponse ## Properties @@ -8,7 +8,7 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| |**status** | **Boolean** | Response status on whether the request succeeded | [optional] | -|**data** | [**XRef**](XRef.md) | | [optional] | +|**data** | [**XrefResponse**](XrefResponse.md) | | [optional] | |**message** | **String** | | [optional] | |**errors** | [**List<ErrorModel>**](ErrorModel.md) | | [optional] | |**meta** | [**MetaModel**](MetaModel.md) | Metadata | [optional] | diff --git a/docs/XRef.md b/docs/XrefFromResponse.md similarity index 88% rename from docs/XRef.md rename to docs/XrefFromResponse.md index 5aa1e42..a042e78 100644 --- a/docs/XRef.md +++ b/docs/XrefFromResponse.md @@ -1,6 +1,6 @@ -# XRef +# XrefFromResponse ## Properties @@ -8,14 +8,14 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| |**value** | **String** | | | -|**xrefTo** | **String** | | | |**isScalar** | **Boolean** | | [optional] | |**isCall** | **Boolean** | | [optional] | |**isData** | **Boolean** | | [optional] | |**isString** | **Boolean** | | [optional] | -|**rawData** | **File** | | [optional] | +|**rawData** | **String** | | [optional] | |**segment** | [**SegmentInfo**](SegmentInfo.md) | | [optional] | |**origStrEncoding** | **String** | | [optional] | +|**xrefTo** | **String** | | | diff --git a/docs/XrefResponse.md b/docs/XrefResponse.md new file mode 100644 index 0000000..905083f --- /dev/null +++ b/docs/XrefResponse.md @@ -0,0 +1,14 @@ + + +# XrefResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**xrefToList** | [**List<XrefToResponse>**](XrefToResponse.md) | | | +|**xrefFromList** | [**List<XrefFromResponse>**](XrefFromResponse.md) | | | + + + diff --git a/docs/XrefToResponse.md b/docs/XrefToResponse.md new file mode 100644 index 0000000..36955f0 --- /dev/null +++ b/docs/XrefToResponse.md @@ -0,0 +1,21 @@ + + +# XrefToResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**value** | **String** | | | +|**isScalar** | **Boolean** | | [optional] | +|**isCall** | **Boolean** | | [optional] | +|**isData** | **Boolean** | | [optional] | +|**isString** | **Boolean** | | [optional] | +|**rawData** | **String** | | [optional] | +|**segment** | [**SegmentInfo**](SegmentInfo.md) | | [optional] | +|**origStrEncoding** | **String** | | [optional] | +|**xrefFrom** | **String** | | | + + + diff --git a/pom.xml b/pom.xml index ee5edc8..7c1ff01 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ sdk jar sdk - 3.42.1 + 3.43.0 https://github.com/RevEngAI/sdk-java Java SDK for the RevEng.AI API diff --git a/src/main/java/ai/reveng/api/AnalysesXRefsApi.java b/src/main/java/ai/reveng/api/AnalysesXRefsApi.java index 67ca7cf..b8b4584 100644 --- a/src/main/java/ai/reveng/api/AnalysesXRefsApi.java +++ b/src/main/java/ai/reveng/api/AnalysesXRefsApi.java @@ -27,7 +27,7 @@ import ai.reveng.model.BaseResponse; -import ai.reveng.model.BaseResponseXRef; +import ai.reveng.model.BaseResponseXrefResponse; import ai.reveng.model.ErrorModel; import java.lang.reflect.Type; @@ -76,7 +76,7 @@ public void setCustomBaseUrl(String customBaseUrl) { /** * Build call for getXrefByVaddr * @param analysisId (required) - * @param vaddr Virtual address to match against xref_to (required) + * @param vaddr Virtual address to match against xrefs (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -152,11 +152,11 @@ private okhttp3.Call getXrefByVaddrValidateBeforeCall(@javax.annotation.Nonnull } /** - * [Beta] Look up an xref by virtual address + * [Beta] Look up xrefs by virtual address * **This endpoint is in beta and may change without notice.** * @param analysisId (required) - * @param vaddr Virtual address to match against xref_to (required) - * @return BaseResponseXRef + * @param vaddr Virtual address to match against xrefs (required) + * @return BaseResponseXrefResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -167,17 +167,17 @@ private okhttp3.Call getXrefByVaddrValidateBeforeCall(@javax.annotation.Nonnull
404 Xref or analysis cache not found -
*/ - public BaseResponseXRef getXrefByVaddr(@javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nonnull Integer vaddr) throws ApiException { - ApiResponse localVarResp = getXrefByVaddrWithHttpInfo(analysisId, vaddr); + public BaseResponseXrefResponse getXrefByVaddr(@javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nonnull Integer vaddr) throws ApiException { + ApiResponse localVarResp = getXrefByVaddrWithHttpInfo(analysisId, vaddr); return localVarResp.getData(); } /** - * [Beta] Look up an xref by virtual address + * [Beta] Look up xrefs by virtual address * **This endpoint is in beta and may change without notice.** * @param analysisId (required) - * @param vaddr Virtual address to match against xref_to (required) - * @return ApiResponse<BaseResponseXRef> + * @param vaddr Virtual address to match against xrefs (required) + * @return ApiResponse<BaseResponseXrefResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -188,17 +188,17 @@ public BaseResponseXRef getXrefByVaddr(@javax.annotation.Nonnull Integer analysi
404 Xref or analysis cache not found -
*/ - public ApiResponse getXrefByVaddrWithHttpInfo(@javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nonnull Integer vaddr) throws ApiException { + public ApiResponse getXrefByVaddrWithHttpInfo(@javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nonnull Integer vaddr) throws ApiException { okhttp3.Call localVarCall = getXrefByVaddrValidateBeforeCall(analysisId, vaddr, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * [Beta] Look up an xref by virtual address (asynchronously) + * [Beta] Look up xrefs by virtual address (asynchronously) * **This endpoint is in beta and may change without notice.** * @param analysisId (required) - * @param vaddr Virtual address to match against xref_to (required) + * @param vaddr Virtual address to match against xrefs (required) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object @@ -211,10 +211,10 @@ public ApiResponse getXrefByVaddrWithHttpInfo(@javax.annotatio 404 Xref or analysis cache not found - */ - public okhttp3.Call getXrefByVaddrAsync(@javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nonnull Integer vaddr, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getXrefByVaddrAsync(@javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nonnull Integer vaddr, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = getXrefByVaddrValidateBeforeCall(analysisId, vaddr, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } diff --git a/src/main/java/ai/reveng/invoker/ApiClient.java b/src/main/java/ai/reveng/invoker/ApiClient.java index f6b913c..af3ff22 100644 --- a/src/main/java/ai/reveng/invoker/ApiClient.java +++ b/src/main/java/ai/reveng/invoker/ApiClient.java @@ -146,7 +146,7 @@ protected void init() { json = new JSON(); // Set default User-Agent. - setUserAgent("OpenAPI-Generator/3.42.1/java"); + setUserAgent("OpenAPI-Generator/3.43.0/java"); authentications = new HashMap(); } diff --git a/src/main/java/ai/reveng/invoker/Configuration.java b/src/main/java/ai/reveng/invoker/Configuration.java index 9414317..3fdc16c 100644 --- a/src/main/java/ai/reveng/invoker/Configuration.java +++ b/src/main/java/ai/reveng/invoker/Configuration.java @@ -18,7 +18,7 @@ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class Configuration { - public static final String VERSION = "3.42.1"; + public static final String VERSION = "3.43.0"; private static final AtomicReference defaultApiClient = new AtomicReference<>(); private static volatile Supplier apiClientFactory = ApiClient::new; diff --git a/src/main/java/ai/reveng/invoker/JSON.java b/src/main/java/ai/reveng/invoker/JSON.java index 9478d14..1119980 100644 --- a/src/main/java/ai/reveng/invoker/JSON.java +++ b/src/main/java/ai/reveng/invoker/JSON.java @@ -202,7 +202,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseTaskResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseUploadResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseVulnerabilities.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseXRef.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseXrefResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Basic.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BinariesRelatedStatusResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BinaryAdditionalDetailsDataResponse.CustomTypeAdapterFactory()); @@ -376,7 +376,9 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UserActivityResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Vulnerabilities.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Vulnerability.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.XRef.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.XrefFromResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.XrefResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.XrefToResponse.CustomTypeAdapterFactory()); gson = gsonBuilder.create(); } diff --git a/src/main/java/ai/reveng/model/BaseResponseXRef.java b/src/main/java/ai/reveng/model/BaseResponseXrefResponse.java similarity index 81% rename from src/main/java/ai/reveng/model/BaseResponseXRef.java rename to src/main/java/ai/reveng/model/BaseResponseXrefResponse.java index 49adb06..3ab0e7e 100644 --- a/src/main/java/ai/reveng/model/BaseResponseXRef.java +++ b/src/main/java/ai/reveng/model/BaseResponseXrefResponse.java @@ -16,7 +16,7 @@ import java.util.Locale; import ai.reveng.model.ErrorModel; import ai.reveng.model.MetaModel; -import ai.reveng.model.XRef; +import ai.reveng.model.XrefResponse; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -53,10 +53,10 @@ import ai.reveng.invoker.JSON; /** - * BaseResponseXRef + * BaseResponseXrefResponse */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class BaseResponseXRef { +public class BaseResponseXrefResponse { public static final String SERIALIZED_NAME_STATUS = "status"; @SerializedName(SERIALIZED_NAME_STATUS) @javax.annotation.Nullable @@ -65,7 +65,7 @@ public class BaseResponseXRef { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) @javax.annotation.Nullable - private XRef data; + private XrefResponse data; public static final String SERIALIZED_NAME_MESSAGE = "message"; @SerializedName(SERIALIZED_NAME_MESSAGE) @@ -82,10 +82,10 @@ public class BaseResponseXRef { @javax.annotation.Nullable private MetaModel meta; - public BaseResponseXRef() { + public BaseResponseXrefResponse() { } - public BaseResponseXRef status(@javax.annotation.Nullable Boolean status) { + public BaseResponseXrefResponse status(@javax.annotation.Nullable Boolean status) { this.status = status; return this; } @@ -104,7 +104,7 @@ public void setStatus(@javax.annotation.Nullable Boolean status) { } - public BaseResponseXRef data(@javax.annotation.Nullable XRef data) { + public BaseResponseXrefResponse data(@javax.annotation.Nullable XrefResponse data) { this.data = data; return this; } @@ -114,16 +114,16 @@ public BaseResponseXRef data(@javax.annotation.Nullable XRef data) { * @return data */ @javax.annotation.Nullable - public XRef getData() { + public XrefResponse getData() { return data; } - public void setData(@javax.annotation.Nullable XRef data) { + public void setData(@javax.annotation.Nullable XrefResponse data) { this.data = data; } - public BaseResponseXRef message(@javax.annotation.Nullable String message) { + public BaseResponseXrefResponse message(@javax.annotation.Nullable String message) { this.message = message; return this; } @@ -142,12 +142,12 @@ public void setMessage(@javax.annotation.Nullable String message) { } - public BaseResponseXRef errors(@javax.annotation.Nullable List errors) { + public BaseResponseXrefResponse errors(@javax.annotation.Nullable List errors) { this.errors = errors; return this; } - public BaseResponseXRef addErrorsItem(ErrorModel errorsItem) { + public BaseResponseXrefResponse addErrorsItem(ErrorModel errorsItem) { if (this.errors == null) { this.errors = new ArrayList<>(); } @@ -169,7 +169,7 @@ public void setErrors(@javax.annotation.Nullable List errors) { } - public BaseResponseXRef meta(@javax.annotation.Nullable MetaModel meta) { + public BaseResponseXrefResponse meta(@javax.annotation.Nullable MetaModel meta) { this.meta = meta; return this; } @@ -200,9 +200,9 @@ public void setMeta(@javax.annotation.Nullable MetaModel meta) { * * @param key name of the property * @param value value of the property - * @return the BaseResponseXRef instance itself + * @return the BaseResponseXrefResponse instance itself */ - public BaseResponseXRef putAdditionalProperty(String key, Object value) { + public BaseResponseXrefResponse putAdditionalProperty(String key, Object value) { if (this.additionalProperties == null) { this.additionalProperties = new HashMap(); } @@ -241,13 +241,13 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - BaseResponseXRef baseResponseXRef = (BaseResponseXRef) o; - return Objects.equals(this.status, baseResponseXRef.status) && - Objects.equals(this.data, baseResponseXRef.data) && - Objects.equals(this.message, baseResponseXRef.message) && - Objects.equals(this.errors, baseResponseXRef.errors) && - Objects.equals(this.meta, baseResponseXRef.meta)&& - Objects.equals(this.additionalProperties, baseResponseXRef.additionalProperties); + BaseResponseXrefResponse baseResponseXrefResponse = (BaseResponseXrefResponse) o; + return Objects.equals(this.status, baseResponseXrefResponse.status) && + Objects.equals(this.data, baseResponseXrefResponse.data) && + Objects.equals(this.message, baseResponseXrefResponse.message) && + Objects.equals(this.errors, baseResponseXrefResponse.errors) && + Objects.equals(this.meta, baseResponseXrefResponse.meta)&& + Objects.equals(this.additionalProperties, baseResponseXrefResponse.additionalProperties); } private static boolean equalsNullable(JsonNullable a, JsonNullable b) { @@ -269,7 +269,7 @@ private static int hashCodeNullable(JsonNullable a) { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class BaseResponseXRef {\n"); + sb.append("class BaseResponseXrefResponse {\n"); sb.append(" status: ").append(toIndentedString(status)).append("\n"); sb.append(" data: ").append(toIndentedString(data)).append("\n"); sb.append(" message: ").append(toIndentedString(message)).append("\n"); @@ -307,18 +307,18 @@ private String toIndentedString(Object o) { * Validates the JSON Element and throws an exception if issues found * * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to BaseResponseXRef + * @throws IOException if the JSON Element is invalid with respect to BaseResponseXrefResponse */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { - if (!BaseResponseXRef.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in BaseResponseXRef is not found in the empty JSON string", BaseResponseXRef.openapiRequiredFields.toString())); + if (!BaseResponseXrefResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in BaseResponseXrefResponse is not found in the empty JSON string", BaseResponseXrefResponse.openapiRequiredFields.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); // validate the optional field `data` if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { - XRef.validateJsonElement(jsonObj.get("data")); + XrefResponse.validateJsonElement(jsonObj.get("data")); } if ((jsonObj.get("message") != null && !jsonObj.get("message").isJsonNull()) && !jsonObj.get("message").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); @@ -347,16 +347,16 @@ public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!BaseResponseXRef.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'BaseResponseXRef' and its subtypes + if (!BaseResponseXrefResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BaseResponseXrefResponse' and its subtypes } final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(BaseResponseXRef.class)); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BaseResponseXrefResponse.class)); - return (TypeAdapter) new TypeAdapter() { + return (TypeAdapter) new TypeAdapter() { @Override - public void write(JsonWriter out, BaseResponseXRef value) throws IOException { + public void write(JsonWriter out, BaseResponseXrefResponse value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); obj.remove("additionalProperties"); // serialize additional properties @@ -384,12 +384,12 @@ else if (entry.getValue() instanceof Character) } @Override - public BaseResponseXRef read(JsonReader in) throws IOException { + public BaseResponseXrefResponse read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); JsonObject jsonObj = jsonElement.getAsJsonObject(); // store additional fields in the deserialized instance - BaseResponseXRef instance = thisAdapter.fromJsonTree(jsonObj); + BaseResponseXrefResponse instance = thisAdapter.fromJsonTree(jsonObj); for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type @@ -416,18 +416,18 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } /** - * Create an instance of BaseResponseXRef given an JSON string + * Create an instance of BaseResponseXrefResponse given an JSON string * * @param jsonString JSON string - * @return An instance of BaseResponseXRef - * @throws IOException if the JSON string is invalid with respect to BaseResponseXRef + * @return An instance of BaseResponseXrefResponse + * @throws IOException if the JSON string is invalid with respect to BaseResponseXrefResponse */ - public static BaseResponseXRef fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, BaseResponseXRef.class); + public static BaseResponseXrefResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BaseResponseXrefResponse.class); } /** - * Convert an instance of BaseResponseXRef to an JSON string + * Convert an instance of BaseResponseXrefResponse to an JSON string * * @return JSON string */ diff --git a/src/main/java/ai/reveng/model/XRef.java b/src/main/java/ai/reveng/model/XrefFromResponse.java similarity index 80% rename from src/main/java/ai/reveng/model/XRef.java rename to src/main/java/ai/reveng/model/XrefFromResponse.java index 0a00722..9f6e53a 100644 --- a/src/main/java/ai/reveng/model/XRef.java +++ b/src/main/java/ai/reveng/model/XrefFromResponse.java @@ -20,7 +20,6 @@ import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import java.io.File; import java.io.IOException; import java.util.Arrays; import org.openapitools.jackson.nullable.JsonNullable; @@ -50,20 +49,15 @@ import ai.reveng.invoker.JSON; /** - * XRef + * XrefFromResponse */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class XRef { +public class XrefFromResponse { public static final String SERIALIZED_NAME_VALUE = "value"; @SerializedName(SERIALIZED_NAME_VALUE) @javax.annotation.Nullable private String value; - public static final String SERIALIZED_NAME_XREF_TO = "xref_to"; - @SerializedName(SERIALIZED_NAME_XREF_TO) - @javax.annotation.Nullable - private String xrefTo; - public static final String SERIALIZED_NAME_IS_SCALAR = "is_scalar"; @SerializedName(SERIALIZED_NAME_IS_SCALAR) @javax.annotation.Nullable @@ -87,7 +81,7 @@ public class XRef { public static final String SERIALIZED_NAME_RAW_DATA = "raw_data"; @SerializedName(SERIALIZED_NAME_RAW_DATA) @javax.annotation.Nullable - private File rawData; + private String rawData; public static final String SERIALIZED_NAME_SEGMENT = "segment"; @SerializedName(SERIALIZED_NAME_SEGMENT) @@ -99,10 +93,15 @@ public class XRef { @javax.annotation.Nullable private String origStrEncoding; - public XRef() { + public static final String SERIALIZED_NAME_XREF_TO = "xref_to"; + @SerializedName(SERIALIZED_NAME_XREF_TO) + @javax.annotation.Nullable + private String xrefTo; + + public XrefFromResponse() { } - public XRef value(@javax.annotation.Nullable String value) { + public XrefFromResponse value(@javax.annotation.Nullable String value) { this.value = value; return this; } @@ -121,26 +120,7 @@ public void setValue(@javax.annotation.Nullable String value) { } - public XRef xrefTo(@javax.annotation.Nullable String xrefTo) { - this.xrefTo = xrefTo; - return this; - } - - /** - * Get xrefTo - * @return xrefTo - */ - @javax.annotation.Nullable - public String getXrefTo() { - return xrefTo; - } - - public void setXrefTo(@javax.annotation.Nullable String xrefTo) { - this.xrefTo = xrefTo; - } - - - public XRef isScalar(@javax.annotation.Nullable Boolean isScalar) { + public XrefFromResponse isScalar(@javax.annotation.Nullable Boolean isScalar) { this.isScalar = isScalar; return this; } @@ -159,7 +139,7 @@ public void setIsScalar(@javax.annotation.Nullable Boolean isScalar) { } - public XRef isCall(@javax.annotation.Nullable Boolean isCall) { + public XrefFromResponse isCall(@javax.annotation.Nullable Boolean isCall) { this.isCall = isCall; return this; } @@ -178,7 +158,7 @@ public void setIsCall(@javax.annotation.Nullable Boolean isCall) { } - public XRef isData(@javax.annotation.Nullable Boolean isData) { + public XrefFromResponse isData(@javax.annotation.Nullable Boolean isData) { this.isData = isData; return this; } @@ -197,7 +177,7 @@ public void setIsData(@javax.annotation.Nullable Boolean isData) { } - public XRef isString(@javax.annotation.Nullable Boolean isString) { + public XrefFromResponse isString(@javax.annotation.Nullable Boolean isString) { this.isString = isString; return this; } @@ -216,7 +196,7 @@ public void setIsString(@javax.annotation.Nullable Boolean isString) { } - public XRef rawData(@javax.annotation.Nullable File rawData) { + public XrefFromResponse rawData(@javax.annotation.Nullable String rawData) { this.rawData = rawData; return this; } @@ -226,16 +206,16 @@ public XRef rawData(@javax.annotation.Nullable File rawData) { * @return rawData */ @javax.annotation.Nullable - public File getRawData() { + public String getRawData() { return rawData; } - public void setRawData(@javax.annotation.Nullable File rawData) { + public void setRawData(@javax.annotation.Nullable String rawData) { this.rawData = rawData; } - public XRef segment(@javax.annotation.Nullable SegmentInfo segment) { + public XrefFromResponse segment(@javax.annotation.Nullable SegmentInfo segment) { this.segment = segment; return this; } @@ -254,7 +234,7 @@ public void setSegment(@javax.annotation.Nullable SegmentInfo segment) { } - public XRef origStrEncoding(@javax.annotation.Nullable String origStrEncoding) { + public XrefFromResponse origStrEncoding(@javax.annotation.Nullable String origStrEncoding) { this.origStrEncoding = origStrEncoding; return this; } @@ -272,6 +252,25 @@ public void setOrigStrEncoding(@javax.annotation.Nullable String origStrEncoding this.origStrEncoding = origStrEncoding; } + + public XrefFromResponse xrefTo(@javax.annotation.Nullable String xrefTo) { + this.xrefTo = xrefTo; + return this; + } + + /** + * Get xrefTo + * @return xrefTo + */ + @javax.annotation.Nullable + public String getXrefTo() { + return xrefTo; + } + + public void setXrefTo(@javax.annotation.Nullable String xrefTo) { + this.xrefTo = xrefTo; + } + /** * A container for additional, undeclared properties. * This is a holder for any undeclared properties as specified with @@ -285,9 +284,9 @@ public void setOrigStrEncoding(@javax.annotation.Nullable String origStrEncoding * * @param key name of the property * @param value value of the property - * @return the XRef instance itself + * @return the XrefFromResponse instance itself */ - public XRef putAdditionalProperty(String key, Object value) { + public XrefFromResponse putAdditionalProperty(String key, Object value) { if (this.additionalProperties == null) { this.additionalProperties = new HashMap(); } @@ -326,17 +325,17 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - XRef xref = (XRef) o; - return Objects.equals(this.value, xref.value) && - Objects.equals(this.xrefTo, xref.xrefTo) && - Objects.equals(this.isScalar, xref.isScalar) && - Objects.equals(this.isCall, xref.isCall) && - Objects.equals(this.isData, xref.isData) && - Objects.equals(this.isString, xref.isString) && - Objects.equals(this.rawData, xref.rawData) && - Objects.equals(this.segment, xref.segment) && - Objects.equals(this.origStrEncoding, xref.origStrEncoding)&& - Objects.equals(this.additionalProperties, xref.additionalProperties); + XrefFromResponse xrefFromResponse = (XrefFromResponse) o; + return Objects.equals(this.value, xrefFromResponse.value) && + Objects.equals(this.isScalar, xrefFromResponse.isScalar) && + Objects.equals(this.isCall, xrefFromResponse.isCall) && + Objects.equals(this.isData, xrefFromResponse.isData) && + Objects.equals(this.isString, xrefFromResponse.isString) && + Objects.equals(this.rawData, xrefFromResponse.rawData) && + Objects.equals(this.segment, xrefFromResponse.segment) && + Objects.equals(this.origStrEncoding, xrefFromResponse.origStrEncoding) && + Objects.equals(this.xrefTo, xrefFromResponse.xrefTo)&& + Objects.equals(this.additionalProperties, xrefFromResponse.additionalProperties); } private static boolean equalsNullable(JsonNullable a, JsonNullable b) { @@ -345,7 +344,7 @@ private static boolean equalsNullable(JsonNullable a, JsonNullable b) @Override public int hashCode() { - return Objects.hash(value, xrefTo, isScalar, isCall, isData, isString, rawData, segment, origStrEncoding, additionalProperties); + return Objects.hash(value, isScalar, isCall, isData, isString, rawData, segment, origStrEncoding, xrefTo, additionalProperties); } private static int hashCodeNullable(JsonNullable a) { @@ -358,9 +357,8 @@ private static int hashCodeNullable(JsonNullable a) { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class XRef {\n"); + sb.append("class XrefFromResponse {\n"); sb.append(" value: ").append(toIndentedString(value)).append("\n"); - sb.append(" xrefTo: ").append(toIndentedString(xrefTo)).append("\n"); sb.append(" isScalar: ").append(toIndentedString(isScalar)).append("\n"); sb.append(" isCall: ").append(toIndentedString(isCall)).append("\n"); sb.append(" isData: ").append(toIndentedString(isData)).append("\n"); @@ -368,6 +366,7 @@ public String toString() { sb.append(" rawData: ").append(toIndentedString(rawData)).append("\n"); sb.append(" segment: ").append(toIndentedString(segment)).append("\n"); sb.append(" origStrEncoding: ").append(toIndentedString(origStrEncoding)).append("\n"); + sb.append(" xrefTo: ").append(toIndentedString(xrefTo)).append("\n"); sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); @@ -390,7 +389,7 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("value", "xref_to", "is_scalar", "is_call", "is_data", "is_string", "raw_data", "segment", "orig_str_encoding")); + openapiFields = new HashSet(Arrays.asList("value", "is_scalar", "is_call", "is_data", "is_string", "raw_data", "segment", "orig_str_encoding", "xref_to")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(Arrays.asList("value", "xref_to")); @@ -400,17 +399,17 @@ private String toIndentedString(Object o) { * Validates the JSON Element and throws an exception if issues found * * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to XRef + * @throws IOException if the JSON Element is invalid with respect to XrefFromResponse */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { - if (!XRef.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in XRef is not found in the empty JSON string", XRef.openapiRequiredFields.toString())); + if (!XrefFromResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in XrefFromResponse is not found in the empty JSON string", XrefFromResponse.openapiRequiredFields.toString())); } } // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : XRef.openapiRequiredFields) { + for (String requiredField : XrefFromResponse.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } @@ -419,8 +418,8 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti if ((jsonObj.get("value") != null && !jsonObj.get("value").isJsonNull()) && !jsonObj.get("value").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `value` to be a primitive type in the JSON string but got `%s`", jsonObj.get("value").toString())); } - if ((jsonObj.get("xref_to") != null && !jsonObj.get("xref_to").isJsonNull()) && !jsonObj.get("xref_to").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `xref_to` to be a primitive type in the JSON string but got `%s`", jsonObj.get("xref_to").toString())); + if ((jsonObj.get("raw_data") != null && !jsonObj.get("raw_data").isJsonNull()) && !jsonObj.get("raw_data").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `raw_data` to be a primitive type in the JSON string but got `%s`", jsonObj.get("raw_data").toString())); } // validate the optional field `segment` if (jsonObj.get("segment") != null && !jsonObj.get("segment").isJsonNull()) { @@ -429,22 +428,25 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti if ((jsonObj.get("orig_str_encoding") != null && !jsonObj.get("orig_str_encoding").isJsonNull()) && !jsonObj.get("orig_str_encoding").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `orig_str_encoding` to be a primitive type in the JSON string but got `%s`", jsonObj.get("orig_str_encoding").toString())); } + if ((jsonObj.get("xref_to") != null && !jsonObj.get("xref_to").isJsonNull()) && !jsonObj.get("xref_to").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `xref_to` to be a primitive type in the JSON string but got `%s`", jsonObj.get("xref_to").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!XRef.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'XRef' and its subtypes + if (!XrefFromResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'XrefFromResponse' and its subtypes } final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(XRef.class)); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(XrefFromResponse.class)); - return (TypeAdapter) new TypeAdapter() { + return (TypeAdapter) new TypeAdapter() { @Override - public void write(JsonWriter out, XRef value) throws IOException { + public void write(JsonWriter out, XrefFromResponse value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); obj.remove("additionalProperties"); // serialize additional properties @@ -472,12 +474,12 @@ else if (entry.getValue() instanceof Character) } @Override - public XRef read(JsonReader in) throws IOException { + public XrefFromResponse read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); JsonObject jsonObj = jsonElement.getAsJsonObject(); // store additional fields in the deserialized instance - XRef instance = thisAdapter.fromJsonTree(jsonObj); + XrefFromResponse instance = thisAdapter.fromJsonTree(jsonObj); for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type @@ -504,18 +506,18 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } /** - * Create an instance of XRef given an JSON string + * Create an instance of XrefFromResponse given an JSON string * * @param jsonString JSON string - * @return An instance of XRef - * @throws IOException if the JSON string is invalid with respect to XRef + * @return An instance of XrefFromResponse + * @throws IOException if the JSON string is invalid with respect to XrefFromResponse */ - public static XRef fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, XRef.class); + public static XrefFromResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, XrefFromResponse.class); } /** - * Convert an instance of XRef to an JSON string + * Convert an instance of XrefFromResponse to an JSON string * * @return JSON string */ diff --git a/src/main/java/ai/reveng/model/XrefResponse.java b/src/main/java/ai/reveng/model/XrefResponse.java new file mode 100644 index 0000000..79b3aaf --- /dev/null +++ b/src/main/java/ai/reveng/model/XrefResponse.java @@ -0,0 +1,357 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import ai.reveng.model.XrefFromResponse; +import ai.reveng.model.XrefToResponse; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * XrefResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class XrefResponse { + public static final String SERIALIZED_NAME_XREF_TO_LIST = "xref_to_list"; + @SerializedName(SERIALIZED_NAME_XREF_TO_LIST) + @javax.annotation.Nonnull + private List xrefToList = new ArrayList<>(); + + public static final String SERIALIZED_NAME_XREF_FROM_LIST = "xref_from_list"; + @SerializedName(SERIALIZED_NAME_XREF_FROM_LIST) + @javax.annotation.Nonnull + private List xrefFromList = new ArrayList<>(); + + public XrefResponse() { + } + + public XrefResponse xrefToList(@javax.annotation.Nonnull List xrefToList) { + this.xrefToList = xrefToList; + return this; + } + + public XrefResponse addXrefToListItem(XrefToResponse xrefToListItem) { + if (this.xrefToList == null) { + this.xrefToList = new ArrayList<>(); + } + this.xrefToList.add(xrefToListItem); + return this; + } + + /** + * Get xrefToList + * @return xrefToList + */ + @javax.annotation.Nonnull + public List getXrefToList() { + return xrefToList; + } + + public void setXrefToList(@javax.annotation.Nonnull List xrefToList) { + this.xrefToList = xrefToList; + } + + + public XrefResponse xrefFromList(@javax.annotation.Nonnull List xrefFromList) { + this.xrefFromList = xrefFromList; + return this; + } + + public XrefResponse addXrefFromListItem(XrefFromResponse xrefFromListItem) { + if (this.xrefFromList == null) { + this.xrefFromList = new ArrayList<>(); + } + this.xrefFromList.add(xrefFromListItem); + return this; + } + + /** + * Get xrefFromList + * @return xrefFromList + */ + @javax.annotation.Nonnull + public List getXrefFromList() { + return xrefFromList; + } + + public void setXrefFromList(@javax.annotation.Nonnull List xrefFromList) { + this.xrefFromList = xrefFromList; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the XrefResponse instance itself + */ + public XrefResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + XrefResponse xrefResponse = (XrefResponse) o; + return Objects.equals(this.xrefToList, xrefResponse.xrefToList) && + Objects.equals(this.xrefFromList, xrefResponse.xrefFromList)&& + Objects.equals(this.additionalProperties, xrefResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(xrefToList, xrefFromList, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class XrefResponse {\n"); + sb.append(" xrefToList: ").append(toIndentedString(xrefToList)).append("\n"); + sb.append(" xrefFromList: ").append(toIndentedString(xrefFromList)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("xref_to_list", "xref_from_list")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("xref_to_list", "xref_from_list")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to XrefResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!XrefResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in XrefResponse is not found in the empty JSON string", XrefResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : XrefResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("xref_to_list").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `xref_to_list` to be an array in the JSON string but got `%s`", jsonObj.get("xref_to_list").toString())); + } + + JsonArray jsonArrayxrefToList = jsonObj.getAsJsonArray("xref_to_list"); + // validate the required field `xref_to_list` (array) + for (int i = 0; i < jsonArrayxrefToList.size(); i++) { + XrefToResponse.validateJsonElement(jsonArrayxrefToList.get(i)); + }; + // ensure the json data is an array + if (!jsonObj.get("xref_from_list").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `xref_from_list` to be an array in the JSON string but got `%s`", jsonObj.get("xref_from_list").toString())); + } + + JsonArray jsonArrayxrefFromList = jsonObj.getAsJsonArray("xref_from_list"); + // validate the required field `xref_from_list` (array) + for (int i = 0; i < jsonArrayxrefFromList.size(); i++) { + XrefFromResponse.validateJsonElement(jsonArrayxrefFromList.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!XrefResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'XrefResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(XrefResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, XrefResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public XrefResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + XrefResponse instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of XrefResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of XrefResponse + * @throws IOException if the JSON string is invalid with respect to XrefResponse + */ + public static XrefResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, XrefResponse.class); + } + + /** + * Convert an instance of XrefResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/XrefToResponse.java b/src/main/java/ai/reveng/model/XrefToResponse.java new file mode 100644 index 0000000..b35dfef --- /dev/null +++ b/src/main/java/ai/reveng/model/XrefToResponse.java @@ -0,0 +1,528 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import ai.reveng.model.SegmentInfo; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * XrefToResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class XrefToResponse { + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nullable + private String value; + + public static final String SERIALIZED_NAME_IS_SCALAR = "is_scalar"; + @SerializedName(SERIALIZED_NAME_IS_SCALAR) + @javax.annotation.Nullable + private Boolean isScalar; + + public static final String SERIALIZED_NAME_IS_CALL = "is_call"; + @SerializedName(SERIALIZED_NAME_IS_CALL) + @javax.annotation.Nullable + private Boolean isCall; + + public static final String SERIALIZED_NAME_IS_DATA = "is_data"; + @SerializedName(SERIALIZED_NAME_IS_DATA) + @javax.annotation.Nullable + private Boolean isData; + + public static final String SERIALIZED_NAME_IS_STRING = "is_string"; + @SerializedName(SERIALIZED_NAME_IS_STRING) + @javax.annotation.Nullable + private Boolean isString; + + public static final String SERIALIZED_NAME_RAW_DATA = "raw_data"; + @SerializedName(SERIALIZED_NAME_RAW_DATA) + @javax.annotation.Nullable + private String rawData; + + public static final String SERIALIZED_NAME_SEGMENT = "segment"; + @SerializedName(SERIALIZED_NAME_SEGMENT) + @javax.annotation.Nullable + private SegmentInfo segment; + + public static final String SERIALIZED_NAME_ORIG_STR_ENCODING = "orig_str_encoding"; + @SerializedName(SERIALIZED_NAME_ORIG_STR_ENCODING) + @javax.annotation.Nullable + private String origStrEncoding; + + public static final String SERIALIZED_NAME_XREF_FROM = "xref_from"; + @SerializedName(SERIALIZED_NAME_XREF_FROM) + @javax.annotation.Nullable + private String xrefFrom; + + public XrefToResponse() { + } + + public XrefToResponse value(@javax.annotation.Nullable String value) { + this.value = value; + return this; + } + + /** + * Get value + * @return value + */ + @javax.annotation.Nullable + public String getValue() { + return value; + } + + public void setValue(@javax.annotation.Nullable String value) { + this.value = value; + } + + + public XrefToResponse isScalar(@javax.annotation.Nullable Boolean isScalar) { + this.isScalar = isScalar; + return this; + } + + /** + * Get isScalar + * @return isScalar + */ + @javax.annotation.Nullable + public Boolean getIsScalar() { + return isScalar; + } + + public void setIsScalar(@javax.annotation.Nullable Boolean isScalar) { + this.isScalar = isScalar; + } + + + public XrefToResponse isCall(@javax.annotation.Nullable Boolean isCall) { + this.isCall = isCall; + return this; + } + + /** + * Get isCall + * @return isCall + */ + @javax.annotation.Nullable + public Boolean getIsCall() { + return isCall; + } + + public void setIsCall(@javax.annotation.Nullable Boolean isCall) { + this.isCall = isCall; + } + + + public XrefToResponse isData(@javax.annotation.Nullable Boolean isData) { + this.isData = isData; + return this; + } + + /** + * Get isData + * @return isData + */ + @javax.annotation.Nullable + public Boolean getIsData() { + return isData; + } + + public void setIsData(@javax.annotation.Nullable Boolean isData) { + this.isData = isData; + } + + + public XrefToResponse isString(@javax.annotation.Nullable Boolean isString) { + this.isString = isString; + return this; + } + + /** + * Get isString + * @return isString + */ + @javax.annotation.Nullable + public Boolean getIsString() { + return isString; + } + + public void setIsString(@javax.annotation.Nullable Boolean isString) { + this.isString = isString; + } + + + public XrefToResponse rawData(@javax.annotation.Nullable String rawData) { + this.rawData = rawData; + return this; + } + + /** + * Get rawData + * @return rawData + */ + @javax.annotation.Nullable + public String getRawData() { + return rawData; + } + + public void setRawData(@javax.annotation.Nullable String rawData) { + this.rawData = rawData; + } + + + public XrefToResponse segment(@javax.annotation.Nullable SegmentInfo segment) { + this.segment = segment; + return this; + } + + /** + * Get segment + * @return segment + */ + @javax.annotation.Nullable + public SegmentInfo getSegment() { + return segment; + } + + public void setSegment(@javax.annotation.Nullable SegmentInfo segment) { + this.segment = segment; + } + + + public XrefToResponse origStrEncoding(@javax.annotation.Nullable String origStrEncoding) { + this.origStrEncoding = origStrEncoding; + return this; + } + + /** + * Get origStrEncoding + * @return origStrEncoding + */ + @javax.annotation.Nullable + public String getOrigStrEncoding() { + return origStrEncoding; + } + + public void setOrigStrEncoding(@javax.annotation.Nullable String origStrEncoding) { + this.origStrEncoding = origStrEncoding; + } + + + public XrefToResponse xrefFrom(@javax.annotation.Nullable String xrefFrom) { + this.xrefFrom = xrefFrom; + return this; + } + + /** + * Get xrefFrom + * @return xrefFrom + */ + @javax.annotation.Nullable + public String getXrefFrom() { + return xrefFrom; + } + + public void setXrefFrom(@javax.annotation.Nullable String xrefFrom) { + this.xrefFrom = xrefFrom; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the XrefToResponse instance itself + */ + public XrefToResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + XrefToResponse xrefToResponse = (XrefToResponse) o; + return Objects.equals(this.value, xrefToResponse.value) && + Objects.equals(this.isScalar, xrefToResponse.isScalar) && + Objects.equals(this.isCall, xrefToResponse.isCall) && + Objects.equals(this.isData, xrefToResponse.isData) && + Objects.equals(this.isString, xrefToResponse.isString) && + Objects.equals(this.rawData, xrefToResponse.rawData) && + Objects.equals(this.segment, xrefToResponse.segment) && + Objects.equals(this.origStrEncoding, xrefToResponse.origStrEncoding) && + Objects.equals(this.xrefFrom, xrefToResponse.xrefFrom)&& + Objects.equals(this.additionalProperties, xrefToResponse.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(value, isScalar, isCall, isData, isString, rawData, segment, origStrEncoding, xrefFrom, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class XrefToResponse {\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" isScalar: ").append(toIndentedString(isScalar)).append("\n"); + sb.append(" isCall: ").append(toIndentedString(isCall)).append("\n"); + sb.append(" isData: ").append(toIndentedString(isData)).append("\n"); + sb.append(" isString: ").append(toIndentedString(isString)).append("\n"); + sb.append(" rawData: ").append(toIndentedString(rawData)).append("\n"); + sb.append(" segment: ").append(toIndentedString(segment)).append("\n"); + sb.append(" origStrEncoding: ").append(toIndentedString(origStrEncoding)).append("\n"); + sb.append(" xrefFrom: ").append(toIndentedString(xrefFrom)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("value", "is_scalar", "is_call", "is_data", "is_string", "raw_data", "segment", "orig_str_encoding", "xref_from")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("value", "xref_from")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to XrefToResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!XrefToResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in XrefToResponse is not found in the empty JSON string", XrefToResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : XrefToResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("value") != null && !jsonObj.get("value").isJsonNull()) && !jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `value` to be a primitive type in the JSON string but got `%s`", jsonObj.get("value").toString())); + } + if ((jsonObj.get("raw_data") != null && !jsonObj.get("raw_data").isJsonNull()) && !jsonObj.get("raw_data").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `raw_data` to be a primitive type in the JSON string but got `%s`", jsonObj.get("raw_data").toString())); + } + // validate the optional field `segment` + if (jsonObj.get("segment") != null && !jsonObj.get("segment").isJsonNull()) { + SegmentInfo.validateJsonElement(jsonObj.get("segment")); + } + if ((jsonObj.get("orig_str_encoding") != null && !jsonObj.get("orig_str_encoding").isJsonNull()) && !jsonObj.get("orig_str_encoding").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `orig_str_encoding` to be a primitive type in the JSON string but got `%s`", jsonObj.get("orig_str_encoding").toString())); + } + if ((jsonObj.get("xref_from") != null && !jsonObj.get("xref_from").isJsonNull()) && !jsonObj.get("xref_from").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `xref_from` to be a primitive type in the JSON string but got `%s`", jsonObj.get("xref_from").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!XrefToResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'XrefToResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(XrefToResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, XrefToResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public XrefToResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + XrefToResponse instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of XrefToResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of XrefToResponse + * @throws IOException if the JSON string is invalid with respect to XrefToResponse + */ + public static XrefToResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, XrefToResponse.class); + } + + /** + * Convert an instance of XrefToResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} +