From d5cfe02d1ab1724b71cae9d94626dc3f020ce291 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 27 May 2026 15:39:09 +0000 Subject: [PATCH] Update SDK to version v3.86.3 - Generated from OpenAPI spec version v3.86.3 - Auto-generated by GitHub Actions --- .sdk-version | 2 +- README.md | 6 +- build.gradle | 4 +- build.sbt | 2 +- docs/AnalysesCoreApi.md | 4 +- docs/AnalysisReport.md | 1 + docs/ExtractedFileEntry.md | 22 + docs/ProcessExtractedFiles.md | 14 + pom.xml | 2 +- .../java/ai/reveng/api/AnalysesCoreApi.java | 11 +- .../java/ai/reveng/invoker/ApiClient.java | 2 +- .../java/ai/reveng/invoker/Configuration.java | 2 +- src/main/java/ai/reveng/invoker/JSON.java | 2 + .../java/ai/reveng/model/AnalysisReport.java | 45 +- .../ai/reveng/model/ExtractedFileEntry.java | 558 ++++++++++++++++++ .../reveng/model/ProcessExtractedFiles.java | 344 +++++++++++ 16 files changed, 1002 insertions(+), 19 deletions(-) create mode 100644 docs/ExtractedFileEntry.md create mode 100644 docs/ProcessExtractedFiles.md create mode 100644 src/main/java/ai/reveng/model/ExtractedFileEntry.java create mode 100644 src/main/java/ai/reveng/model/ProcessExtractedFiles.java diff --git a/.sdk-version b/.sdk-version index 963acd8f..8f4fe4d5 100644 --- a/.sdk-version +++ b/.sdk-version @@ -1 +1 @@ -v3.86.1 +v3.86.3 diff --git a/README.md b/README.md index 2c23c37b..8c7f0e32 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Add this dependency to your project's POM: ai.reveng sdk - 3.86.1 + 3.86.3 compile ``` @@ -31,7 +31,7 @@ repositories { } dependencies { - implementation "ai.reveng:sdk:3.86.1" + implementation "ai.reveng:sdk:3.86.3" } ``` @@ -415,6 +415,7 @@ Class | Method | HTTP request | Description - [EventWarning](docs/EventWarning.md) - [ExportModel](docs/ExportModel.md) - [ExternalResponse](docs/ExternalResponse.md) + - [ExtractedFileEntry](docs/ExtractedFileEntry.md) - [ExtractedURL](docs/ExtractedURL.md) - [FileActivityEntry](docs/FileActivityEntry.md) - [FileFormat](docs/FileFormat.md) @@ -500,6 +501,7 @@ Class | Method | HTTP request | Description - [PatchCommentBody](docs/PatchCommentBody.md) - [Platform](docs/Platform.md) - [ProcessActivityEntry](docs/ProcessActivityEntry.md) + - [ProcessExtractedFiles](docs/ProcessExtractedFiles.md) - [ProcessMemdumps](docs/ProcessMemdumps.md) - [ProcessNode](docs/ProcessNode.md) - [ProcessTree](docs/ProcessTree.md) diff --git a/build.gradle b/build.gradle index 35b652fc..d50de635 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,7 @@ apply plugin: 'java' apply plugin: 'com.diffplug.spotless' group = 'ai.reveng' -version = '3.86.1' +version = '3.86.3' @@ -171,7 +171,7 @@ mavenPublishing { publishToMavenCentral(true) signAllPublications() - coordinates("ai.reveng", "sdk", "3.86.1") + coordinates("ai.reveng", "sdk", "3.86.3") pom { name = "sdk" diff --git a/build.sbt b/build.sbt index 238d6ff3..5d806d8b 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.86.1", + version := "3.86.3", scalaVersion := "2.11.12", scalacOptions ++= Seq("-feature"), compile / javacOptions ++= Seq("-Xlint:deprecation"), diff --git a/docs/AnalysesCoreApi.md b/docs/AnalysesCoreApi.md index 1388c271..05680048 100644 --- a/docs/AnalysesCoreApi.md +++ b/docs/AnalysesCoreApi.md @@ -1220,7 +1220,7 @@ public class Example { AnalysesCoreApi apiInstance = new AnalysesCoreApi(defaultClient); UploadFileType uploadFileType = UploadFileType.fromValue("BINARY"); // UploadFileType | - String _file = "_file_example"; // String | + File _file = new File("/path/to/file"); // File | String packedPassword = "packedPassword_example"; // String | Boolean forceOverwrite = false; // Boolean | try { @@ -1242,7 +1242,7 @@ public class Example { | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| | **uploadFileType** | [**UploadFileType**](UploadFileType.md)| | [enum: BINARY, DEBUG, PACKED, FIRMWARE] | -| **_file** | **String**| | | +| **_file** | **File**| | | | **packedPassword** | **String**| | [optional] | | **forceOverwrite** | **Boolean**| | [optional] [default to false] | diff --git a/docs/AnalysisReport.md b/docs/AnalysisReport.md index 3441ebb7..b80b7461 100644 --- a/docs/AnalysisReport.md +++ b/docs/AnalysisReport.md @@ -7,6 +7,7 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| +|**extractedFiles** | **List<ProcessExtractedFiles>** | | [optional] | |**fileActivity** | **List<FileActivityEntry>** | | [optional] | |**info** | **ReportInfo** | | | |**memdumps** | **List<ProcessMemdumps>** | | [optional] | diff --git a/docs/ExtractedFileEntry.md b/docs/ExtractedFileEntry.md new file mode 100644 index 00000000..156ce940 --- /dev/null +++ b/docs/ExtractedFileEntry.md @@ -0,0 +1,22 @@ + + +# ExtractedFileEntry + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**fileHash** | **String** | | [optional] | +|**fileSize** | **Long** | | | +|**fileType** | **String** | | [optional] | +|**filename** | **String** | | | +|**isPe** | **Boolean** | | [optional] | +|**mimeType** | **String** | | [optional] | +|**reason** | **String** | | [optional] | +|**seqNum** | **Long** | | | +|**sha256** | **String** | | [optional] | +|**zipFilename** | **String** | | | + + + diff --git a/docs/ProcessExtractedFiles.md b/docs/ProcessExtractedFiles.md new file mode 100644 index 00000000..6c3b7cb9 --- /dev/null +++ b/docs/ProcessExtractedFiles.md @@ -0,0 +1,14 @@ + + +# ProcessExtractedFiles + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**files** | **List<ExtractedFileEntry>** | | [optional] | +|**processSeqid** | **Long** | | | + + + diff --git a/pom.xml b/pom.xml index 95d3e68b..5b57a115 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ sdk jar sdk - 3.86.1 + 3.86.3 https://github.com/RevEngAI/sdk-java Java SDK for the RevEng.AI API diff --git a/src/main/java/ai/reveng/api/AnalysesCoreApi.java b/src/main/java/ai/reveng/api/AnalysesCoreApi.java index c2539cf9..31114f41 100644 --- a/src/main/java/ai/reveng/api/AnalysesCoreApi.java +++ b/src/main/java/ai/reveng/api/AnalysesCoreApi.java @@ -45,6 +45,7 @@ import ai.reveng.model.BaseResponseStatus; import ai.reveng.model.BaseResponseUploadResponse; import ai.reveng.model.DynamicExecutionStatus; +import java.io.File; import ai.reveng.model.InsertAnalysisLogRequest; import ai.reveng.model.ModelName; import ai.reveng.model.Order; @@ -2413,7 +2414,7 @@ public okhttp3.Call updateAnalysisTagsAsync(@javax.annotation.Nonnull Integer an 422 Invalid request parameters - */ - public okhttp3.Call uploadFileCall(@javax.annotation.Nonnull UploadFileType uploadFileType, @javax.annotation.Nonnull String _file, @javax.annotation.Nullable String packedPassword, @javax.annotation.Nullable Boolean forceOverwrite, final ApiCallback _callback) throws ApiException { + public okhttp3.Call uploadFileCall(@javax.annotation.Nonnull UploadFileType uploadFileType, @javax.annotation.Nonnull File _file, @javax.annotation.Nullable String packedPassword, @javax.annotation.Nullable Boolean forceOverwrite, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers String[] localBasePaths = new String[] { }; @@ -2475,7 +2476,7 @@ public okhttp3.Call uploadFileCall(@javax.annotation.Nonnull UploadFileType uplo } @SuppressWarnings("rawtypes") - private okhttp3.Call uploadFileValidateBeforeCall(@javax.annotation.Nonnull UploadFileType uploadFileType, @javax.annotation.Nonnull String _file, @javax.annotation.Nullable String packedPassword, @javax.annotation.Nullable Boolean forceOverwrite, final ApiCallback _callback) throws ApiException { + private okhttp3.Call uploadFileValidateBeforeCall(@javax.annotation.Nonnull UploadFileType uploadFileType, @javax.annotation.Nonnull File _file, @javax.annotation.Nullable String packedPassword, @javax.annotation.Nullable Boolean forceOverwrite, final ApiCallback _callback) throws ApiException { // verify the required parameter 'uploadFileType' is set if (uploadFileType == null) { throw new ApiException("Missing the required parameter 'uploadFileType' when calling uploadFile(Async)"); @@ -2507,7 +2508,7 @@ private okhttp3.Call uploadFileValidateBeforeCall(@javax.annotation.Nonnull Uplo 422 Invalid request parameters - */ - public BaseResponseUploadResponse uploadFile(@javax.annotation.Nonnull UploadFileType uploadFileType, @javax.annotation.Nonnull String _file, @javax.annotation.Nullable String packedPassword, @javax.annotation.Nullable Boolean forceOverwrite) throws ApiException { + public BaseResponseUploadResponse uploadFile(@javax.annotation.Nonnull UploadFileType uploadFileType, @javax.annotation.Nonnull File _file, @javax.annotation.Nullable String packedPassword, @javax.annotation.Nullable Boolean forceOverwrite) throws ApiException { ApiResponse localVarResp = uploadFileWithHttpInfo(uploadFileType, _file, packedPassword, forceOverwrite); return localVarResp.getData(); } @@ -2529,7 +2530,7 @@ public BaseResponseUploadResponse uploadFile(@javax.annotation.Nonnull UploadFil 422 Invalid request parameters - */ - public ApiResponse uploadFileWithHttpInfo(@javax.annotation.Nonnull UploadFileType uploadFileType, @javax.annotation.Nonnull String _file, @javax.annotation.Nullable String packedPassword, @javax.annotation.Nullable Boolean forceOverwrite) throws ApiException { + public ApiResponse uploadFileWithHttpInfo(@javax.annotation.Nonnull UploadFileType uploadFileType, @javax.annotation.Nonnull File _file, @javax.annotation.Nullable String packedPassword, @javax.annotation.Nullable Boolean forceOverwrite) throws ApiException { okhttp3.Call localVarCall = uploadFileValidateBeforeCall(uploadFileType, _file, packedPassword, forceOverwrite, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); @@ -2553,7 +2554,7 @@ public ApiResponse uploadFileWithHttpInfo(@javax.ann 422 Invalid request parameters - */ - public okhttp3.Call uploadFileAsync(@javax.annotation.Nonnull UploadFileType uploadFileType, @javax.annotation.Nonnull String _file, @javax.annotation.Nullable String packedPassword, @javax.annotation.Nullable Boolean forceOverwrite, final ApiCallback _callback) throws ApiException { + public okhttp3.Call uploadFileAsync(@javax.annotation.Nonnull UploadFileType uploadFileType, @javax.annotation.Nonnull File _file, @javax.annotation.Nullable String packedPassword, @javax.annotation.Nullable Boolean forceOverwrite, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = uploadFileValidateBeforeCall(uploadFileType, _file, packedPassword, forceOverwrite, _callback); Type localVarReturnType = new TypeToken(){}.getType(); diff --git a/src/main/java/ai/reveng/invoker/ApiClient.java b/src/main/java/ai/reveng/invoker/ApiClient.java index b707b977..6142ed94 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.86.1/java"); + setUserAgent("OpenAPI-Generator/3.86.3/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 a6617066..a28bc3aa 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.86.1"; + public static final String VERSION = "3.86.3"; 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 5c2fa619..a9c47262 100644 --- a/src/main/java/ai/reveng/invoker/JSON.java +++ b/src/main/java/ai/reveng/invoker/JSON.java @@ -295,6 +295,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.EventWarning.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ExportModel.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ExternalResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ExtractedFileEntry.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ExtractedURL.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FileActivityEntry.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FileHashes.CustomTypeAdapterFactory()); @@ -372,6 +373,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Params.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.PatchCommentBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ProcessActivityEntry.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ProcessExtractedFiles.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ProcessMemdumps.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ProcessNode.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ProcessTree.CustomTypeAdapterFactory()); diff --git a/src/main/java/ai/reveng/model/AnalysisReport.java b/src/main/java/ai/reveng/model/AnalysisReport.java index 3f8fa0c7..a77eb5c7 100644 --- a/src/main/java/ai/reveng/model/AnalysisReport.java +++ b/src/main/java/ai/reveng/model/AnalysisReport.java @@ -19,6 +19,7 @@ import ai.reveng.model.MutexEntry; import ai.reveng.model.NetworkActivity; import ai.reveng.model.ProcessActivityEntry; +import ai.reveng.model.ProcessExtractedFiles; import ai.reveng.model.ProcessMemdumps; import ai.reveng.model.ProcessTree; import ai.reveng.model.RegistryOperation; @@ -67,6 +68,11 @@ */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class AnalysisReport { + public static final String SERIALIZED_NAME_EXTRACTED_FILES = "extracted_files"; + @SerializedName(SERIALIZED_NAME_EXTRACTED_FILES) + @javax.annotation.Nullable + private List extractedFiles; + public static final String SERIALIZED_NAME_FILE_ACTIVITY = "file_activity"; @SerializedName(SERIALIZED_NAME_FILE_ACTIVITY) @javax.annotation.Nullable @@ -140,6 +146,33 @@ public class AnalysisReport { public AnalysisReport() { } + public AnalysisReport extractedFiles(@javax.annotation.Nullable List extractedFiles) { + this.extractedFiles = extractedFiles; + return this; + } + + public AnalysisReport addExtractedFilesItem(ProcessExtractedFiles extractedFilesItem) { + if (this.extractedFiles == null) { + this.extractedFiles = new ArrayList<>(); + } + this.extractedFiles.add(extractedFilesItem); + return this; + } + + /** + * Get extractedFiles + * @return extractedFiles + */ + @javax.annotation.Nullable + public List getExtractedFiles() { + return extractedFiles; + } + + public void setExtractedFiles(@javax.annotation.Nullable List extractedFiles) { + this.extractedFiles = extractedFiles; + } + + public AnalysisReport fileActivity(@javax.annotation.Nullable List fileActivity) { this.fileActivity = fileActivity; return this; @@ -532,7 +565,8 @@ public boolean equals(Object o) { return false; } AnalysisReport analysisReport = (AnalysisReport) o; - return Objects.equals(this.fileActivity, analysisReport.fileActivity) && + return Objects.equals(this.extractedFiles, analysisReport.extractedFiles) && + Objects.equals(this.fileActivity, analysisReport.fileActivity) && Objects.equals(this.info, analysisReport.info) && Objects.equals(this.memdumps, analysisReport.memdumps) && Objects.equals(this.moduleLoadAddresses, analysisReport.moduleLoadAddresses) && @@ -555,7 +589,7 @@ private static boolean equalsNullable(JsonNullable a, JsonNullable b) @Override public int hashCode() { - return Objects.hash(fileActivity, info, memdumps, moduleLoadAddresses, mutexes, networkActivity, processActivity, processTree, registryOperations, scheduledTasks, services, startup, threatScore, ttps, additionalProperties); + return Objects.hash(extractedFiles, fileActivity, info, memdumps, moduleLoadAddresses, mutexes, networkActivity, processActivity, processTree, registryOperations, scheduledTasks, services, startup, threatScore, ttps, additionalProperties); } private static int hashCodeNullable(JsonNullable a) { @@ -569,6 +603,7 @@ private static int hashCodeNullable(JsonNullable a) { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class AnalysisReport {\n"); + sb.append(" extractedFiles: ").append(toIndentedString(extractedFiles)).append("\n"); sb.append(" fileActivity: ").append(toIndentedString(fileActivity)).append("\n"); sb.append(" info: ").append(toIndentedString(info)).append("\n"); sb.append(" memdumps: ").append(toIndentedString(memdumps)).append("\n"); @@ -605,7 +640,7 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("file_activity", "info", "memdumps", "module_load_addresses", "mutexes", "network_activity", "process_activity", "process_tree", "registry_operations", "scheduled_tasks", "services", "startup", "threat_score", "ttps")); + openapiFields = new HashSet(Arrays.asList("extracted_files", "file_activity", "info", "memdumps", "module_load_addresses", "mutexes", "network_activity", "process_activity", "process_tree", "registry_operations", "scheduled_tasks", "services", "startup", "threat_score", "ttps")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(Arrays.asList("info", "threat_score")); @@ -632,6 +667,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } JsonObject jsonObj = jsonElement.getAsJsonObject(); // ensure the optional json data is an array if present + if (jsonObj.get("extracted_files") != null && !jsonObj.get("extracted_files").isJsonNull() && !jsonObj.get("extracted_files").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `extracted_files` to be an array in the JSON string but got `%s`", jsonObj.get("extracted_files").toString())); + } + // ensure the optional json data is an array if present if (jsonObj.get("file_activity") != null && !jsonObj.get("file_activity").isJsonNull() && !jsonObj.get("file_activity").isJsonArray()) { throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `file_activity` to be an array in the JSON string but got `%s`", jsonObj.get("file_activity").toString())); } diff --git a/src/main/java/ai/reveng/model/ExtractedFileEntry.java b/src/main/java/ai/reveng/model/ExtractedFileEntry.java new file mode 100644 index 00000000..302e7f28 --- /dev/null +++ b/src/main/java/ai/reveng/model/ExtractedFileEntry.java @@ -0,0 +1,558 @@ +/* + * 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 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; + +/** + * ExtractedFileEntry + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExtractedFileEntry { + public static final String SERIALIZED_NAME_FILE_HASH = "file_hash"; + @SerializedName(SERIALIZED_NAME_FILE_HASH) + @javax.annotation.Nullable + private String fileHash; + + public static final String SERIALIZED_NAME_FILE_SIZE = "file_size"; + @SerializedName(SERIALIZED_NAME_FILE_SIZE) + @javax.annotation.Nonnull + private Long fileSize; + + public static final String SERIALIZED_NAME_FILE_TYPE = "file_type"; + @SerializedName(SERIALIZED_NAME_FILE_TYPE) + @javax.annotation.Nullable + private String fileType; + + public static final String SERIALIZED_NAME_FILENAME = "filename"; + @SerializedName(SERIALIZED_NAME_FILENAME) + @javax.annotation.Nullable + private String filename; + + public static final String SERIALIZED_NAME_IS_PE = "is_pe"; + @SerializedName(SERIALIZED_NAME_IS_PE) + @javax.annotation.Nullable + private Boolean isPe; + + public static final String SERIALIZED_NAME_MIME_TYPE = "mime_type"; + @SerializedName(SERIALIZED_NAME_MIME_TYPE) + @javax.annotation.Nullable + private String mimeType; + + public static final String SERIALIZED_NAME_REASON = "reason"; + @SerializedName(SERIALIZED_NAME_REASON) + @javax.annotation.Nullable + private String reason; + + public static final String SERIALIZED_NAME_SEQ_NUM = "seq_num"; + @SerializedName(SERIALIZED_NAME_SEQ_NUM) + @javax.annotation.Nonnull + private Long seqNum; + + public static final String SERIALIZED_NAME_SHA256 = "sha256"; + @SerializedName(SERIALIZED_NAME_SHA256) + @javax.annotation.Nullable + private String sha256; + + public static final String SERIALIZED_NAME_ZIP_FILENAME = "zip_filename"; + @SerializedName(SERIALIZED_NAME_ZIP_FILENAME) + @javax.annotation.Nullable + private String zipFilename; + + public ExtractedFileEntry() { + } + + public ExtractedFileEntry fileHash(@javax.annotation.Nullable String fileHash) { + this.fileHash = fileHash; + return this; + } + + /** + * Get fileHash + * @return fileHash + */ + @javax.annotation.Nullable + public String getFileHash() { + return fileHash; + } + + public void setFileHash(@javax.annotation.Nullable String fileHash) { + this.fileHash = fileHash; + } + + + public ExtractedFileEntry fileSize(@javax.annotation.Nonnull Long fileSize) { + this.fileSize = fileSize; + return this; + } + + /** + * Get fileSize + * @return fileSize + */ + @javax.annotation.Nonnull + public Long getFileSize() { + return fileSize; + } + + public void setFileSize(@javax.annotation.Nonnull Long fileSize) { + this.fileSize = fileSize; + } + + + public ExtractedFileEntry fileType(@javax.annotation.Nullable String fileType) { + this.fileType = fileType; + return this; + } + + /** + * Get fileType + * @return fileType + */ + @javax.annotation.Nullable + public String getFileType() { + return fileType; + } + + public void setFileType(@javax.annotation.Nullable String fileType) { + this.fileType = fileType; + } + + + public ExtractedFileEntry filename(@javax.annotation.Nullable String filename) { + this.filename = filename; + return this; + } + + /** + * Get filename + * @return filename + */ + @javax.annotation.Nullable + public String getFilename() { + return filename; + } + + public void setFilename(@javax.annotation.Nullable String filename) { + this.filename = filename; + } + + + public ExtractedFileEntry isPe(@javax.annotation.Nullable Boolean isPe) { + this.isPe = isPe; + return this; + } + + /** + * Get isPe + * @return isPe + */ + @javax.annotation.Nullable + public Boolean getIsPe() { + return isPe; + } + + public void setIsPe(@javax.annotation.Nullable Boolean isPe) { + this.isPe = isPe; + } + + + public ExtractedFileEntry mimeType(@javax.annotation.Nullable String mimeType) { + this.mimeType = mimeType; + return this; + } + + /** + * Get mimeType + * @return mimeType + */ + @javax.annotation.Nullable + public String getMimeType() { + return mimeType; + } + + public void setMimeType(@javax.annotation.Nullable String mimeType) { + this.mimeType = mimeType; + } + + + public ExtractedFileEntry reason(@javax.annotation.Nullable String reason) { + this.reason = reason; + return this; + } + + /** + * Get reason + * @return reason + */ + @javax.annotation.Nullable + public String getReason() { + return reason; + } + + public void setReason(@javax.annotation.Nullable String reason) { + this.reason = reason; + } + + + public ExtractedFileEntry seqNum(@javax.annotation.Nonnull Long seqNum) { + this.seqNum = seqNum; + return this; + } + + /** + * Get seqNum + * @return seqNum + */ + @javax.annotation.Nonnull + public Long getSeqNum() { + return seqNum; + } + + public void setSeqNum(@javax.annotation.Nonnull Long seqNum) { + this.seqNum = seqNum; + } + + + public ExtractedFileEntry sha256(@javax.annotation.Nullable String sha256) { + this.sha256 = sha256; + return this; + } + + /** + * Get sha256 + * @return sha256 + */ + @javax.annotation.Nullable + public String getSha256() { + return sha256; + } + + public void setSha256(@javax.annotation.Nullable String sha256) { + this.sha256 = sha256; + } + + + public ExtractedFileEntry zipFilename(@javax.annotation.Nullable String zipFilename) { + this.zipFilename = zipFilename; + return this; + } + + /** + * Get zipFilename + * @return zipFilename + */ + @javax.annotation.Nullable + public String getZipFilename() { + return zipFilename; + } + + public void setZipFilename(@javax.annotation.Nullable String zipFilename) { + this.zipFilename = zipFilename; + } + + /** + * 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 ExtractedFileEntry instance itself + */ + public ExtractedFileEntry 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; + } + ExtractedFileEntry extractedFileEntry = (ExtractedFileEntry) o; + return Objects.equals(this.fileHash, extractedFileEntry.fileHash) && + Objects.equals(this.fileSize, extractedFileEntry.fileSize) && + Objects.equals(this.fileType, extractedFileEntry.fileType) && + Objects.equals(this.filename, extractedFileEntry.filename) && + Objects.equals(this.isPe, extractedFileEntry.isPe) && + Objects.equals(this.mimeType, extractedFileEntry.mimeType) && + Objects.equals(this.reason, extractedFileEntry.reason) && + Objects.equals(this.seqNum, extractedFileEntry.seqNum) && + Objects.equals(this.sha256, extractedFileEntry.sha256) && + Objects.equals(this.zipFilename, extractedFileEntry.zipFilename)&& + Objects.equals(this.additionalProperties, extractedFileEntry.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(fileHash, fileSize, fileType, filename, isPe, mimeType, reason, seqNum, sha256, zipFilename, 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 ExtractedFileEntry {\n"); + sb.append(" fileHash: ").append(toIndentedString(fileHash)).append("\n"); + sb.append(" fileSize: ").append(toIndentedString(fileSize)).append("\n"); + sb.append(" fileType: ").append(toIndentedString(fileType)).append("\n"); + sb.append(" filename: ").append(toIndentedString(filename)).append("\n"); + sb.append(" isPe: ").append(toIndentedString(isPe)).append("\n"); + sb.append(" mimeType: ").append(toIndentedString(mimeType)).append("\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append(" seqNum: ").append(toIndentedString(seqNum)).append("\n"); + sb.append(" sha256: ").append(toIndentedString(sha256)).append("\n"); + sb.append(" zipFilename: ").append(toIndentedString(zipFilename)).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("file_hash", "file_size", "file_type", "filename", "is_pe", "mime_type", "reason", "seq_num", "sha256", "zip_filename")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("file_size", "filename", "seq_num", "zip_filename")); + } + + /** + * 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 ExtractedFileEntry + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExtractedFileEntry.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in ExtractedFileEntry is not found in the empty JSON string", ExtractedFileEntry.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ExtractedFileEntry.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("file_hash") != null && !jsonObj.get("file_hash").isJsonNull()) && !jsonObj.get("file_hash").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `file_hash` to be a primitive type in the JSON string but got `%s`", jsonObj.get("file_hash").toString())); + } + if ((jsonObj.get("file_type") != null && !jsonObj.get("file_type").isJsonNull()) && !jsonObj.get("file_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `file_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("file_type").toString())); + } + if ((jsonObj.get("filename") != null && !jsonObj.get("filename").isJsonNull()) && !jsonObj.get("filename").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `filename` to be a primitive type in the JSON string but got `%s`", jsonObj.get("filename").toString())); + } + if ((jsonObj.get("mime_type") != null && !jsonObj.get("mime_type").isJsonNull()) && !jsonObj.get("mime_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `mime_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("mime_type").toString())); + } + if ((jsonObj.get("reason") != null && !jsonObj.get("reason").isJsonNull()) && !jsonObj.get("reason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `reason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reason").toString())); + } + if ((jsonObj.get("sha256") != null && !jsonObj.get("sha256").isJsonNull()) && !jsonObj.get("sha256").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `sha256` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sha256").toString())); + } + if ((jsonObj.get("zip_filename") != null && !jsonObj.get("zip_filename").isJsonNull()) && !jsonObj.get("zip_filename").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `zip_filename` to be a primitive type in the JSON string but got `%s`", jsonObj.get("zip_filename").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExtractedFileEntry.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExtractedFileEntry' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExtractedFileEntry.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExtractedFileEntry 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 ExtractedFileEntry read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ExtractedFileEntry 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 ExtractedFileEntry given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExtractedFileEntry + * @throws IOException if the JSON string is invalid with respect to ExtractedFileEntry + */ + public static ExtractedFileEntry fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExtractedFileEntry.class); + } + + /** + * Convert an instance of ExtractedFileEntry to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/ProcessExtractedFiles.java b/src/main/java/ai/reveng/model/ProcessExtractedFiles.java new file mode 100644 index 00000000..6e8ce610 --- /dev/null +++ b/src/main/java/ai/reveng/model/ProcessExtractedFiles.java @@ -0,0 +1,344 @@ +/* + * 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.ExtractedFileEntry; +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 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; + +/** + * ProcessExtractedFiles + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ProcessExtractedFiles { + public static final String SERIALIZED_NAME_FILES = "files"; + @SerializedName(SERIALIZED_NAME_FILES) + @javax.annotation.Nullable + private List files; + + public static final String SERIALIZED_NAME_PROCESS_SEQID = "process_seqid"; + @SerializedName(SERIALIZED_NAME_PROCESS_SEQID) + @javax.annotation.Nonnull + private Long processSeqid; + + public ProcessExtractedFiles() { + } + + public ProcessExtractedFiles files(@javax.annotation.Nullable List files) { + this.files = files; + return this; + } + + public ProcessExtractedFiles addFilesItem(ExtractedFileEntry filesItem) { + if (this.files == null) { + this.files = new ArrayList<>(); + } + this.files.add(filesItem); + return this; + } + + /** + * Get files + * @return files + */ + @javax.annotation.Nullable + public List getFiles() { + return files; + } + + public void setFiles(@javax.annotation.Nullable List files) { + this.files = files; + } + + + public ProcessExtractedFiles processSeqid(@javax.annotation.Nonnull Long processSeqid) { + this.processSeqid = processSeqid; + return this; + } + + /** + * Get processSeqid + * @return processSeqid + */ + @javax.annotation.Nonnull + public Long getProcessSeqid() { + return processSeqid; + } + + public void setProcessSeqid(@javax.annotation.Nonnull Long processSeqid) { + this.processSeqid = processSeqid; + } + + /** + * 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 ProcessExtractedFiles instance itself + */ + public ProcessExtractedFiles 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; + } + ProcessExtractedFiles processExtractedFiles = (ProcessExtractedFiles) o; + return Objects.equals(this.files, processExtractedFiles.files) && + Objects.equals(this.processSeqid, processExtractedFiles.processSeqid)&& + Objects.equals(this.additionalProperties, processExtractedFiles.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(files, processSeqid, 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 ProcessExtractedFiles {\n"); + sb.append(" files: ").append(toIndentedString(files)).append("\n"); + sb.append(" processSeqid: ").append(toIndentedString(processSeqid)).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("files", "process_seqid")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("process_seqid")); + } + + /** + * 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 ProcessExtractedFiles + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProcessExtractedFiles.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in ProcessExtractedFiles is not found in the empty JSON string", ProcessExtractedFiles.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ProcessExtractedFiles.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 optional json data is an array if present + if (jsonObj.get("files") != null && !jsonObj.get("files").isJsonNull() && !jsonObj.get("files").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `files` to be an array in the JSON string but got `%s`", jsonObj.get("files").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProcessExtractedFiles.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProcessExtractedFiles' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProcessExtractedFiles.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProcessExtractedFiles 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 ProcessExtractedFiles read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ProcessExtractedFiles 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 ProcessExtractedFiles given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProcessExtractedFiles + * @throws IOException if the JSON string is invalid with respect to ProcessExtractedFiles + */ + public static ProcessExtractedFiles fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProcessExtractedFiles.class); + } + + /** + * Convert an instance of ProcessExtractedFiles to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} +