diff --git a/.sdk-version b/.sdk-version index dd81097..1be1028 100644 --- a/.sdk-version +++ b/.sdk-version @@ -1 +1 @@ -v4.70.0 +v4.72.2 diff --git a/README.md b/README.md index 6d31997..f366e99 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Add this dependency to your project's POM: ai.reveng sdk - 4.70.0 + 4.72.2 compile ``` @@ -31,7 +31,7 @@ repositories { } dependencies { - implementation "ai.reveng:sdk:4.70.0" + implementation "ai.reveng:sdk:4.72.2" } ``` @@ -602,6 +602,8 @@ Class | Method | HTTP request | Description - [DynamicExecutionMetadata](docs/DynamicExecutionMetadata.md) - [DynamicExecutionStatus](docs/DynamicExecutionStatus.md) - [DynamicExecutionStatusResponse](docs/DynamicExecutionStatusResponse.md) + - [DynamicExecutionSummary](docs/DynamicExecutionSummary.md) + - [DynamicExecutionSummaryMetadata](docs/DynamicExecutionSummaryMetadata.md) - [ELFImportModel](docs/ELFImportModel.md) - [ELFModel](docs/ELFModel.md) - [ELFRelocation](docs/ELFRelocation.md) @@ -814,6 +816,7 @@ Class | Method | HTTP request | Description - [OperationCryptoExplainMetadataCryptoExplainResult](docs/OperationCryptoExplainMetadataCryptoExplainResult.md) - [OperationCryptoScanMetadataCryptoScanResult](docs/OperationCryptoScanMetadataCryptoScanResult.md) - [OperationDynamicExecutionMetadataDynamicExecutionResult](docs/OperationDynamicExecutionMetadataDynamicExecutionResult.md) + - [OperationDynamicExecutionSummaryMetadataDynamicExecutionSummaryResult](docs/OperationDynamicExecutionSummaryMetadataDynamicExecutionSummaryResult.md) - [OperationExecutionExplainMetadataExecutionExplainResult](docs/OperationExecutionExplainMetadataExecutionExplainResult.md) - [OperationExecutionScanMetadataExecutionScanResult](docs/OperationExecutionScanMetadataExecutionScanResult.md) - [OperationFilesystemAnalyseMetadataFilesystemAnalyseResult](docs/OperationFilesystemAnalyseMetadataFilesystemAnalyseResult.md) diff --git a/build.gradle b/build.gradle index 0a0689d..b13c39c 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,7 @@ apply plugin: 'java' apply plugin: 'com.diffplug.spotless' group = 'ai.reveng' -version = '4.70.0' +version = '4.72.2' @@ -174,7 +174,7 @@ mavenPublishing { // key, and signing without one fails the build. if (project.hasProperty("signingInMemoryKey")) signAllPublications() - coordinates("ai.reveng", "sdk", "4.70.0") + coordinates("ai.reveng", "sdk", "4.72.2") pom { name = "sdk" diff --git a/build.sbt b/build.sbt index ed524a3..81616af 100644 --- a/build.sbt +++ b/build.sbt @@ -2,7 +2,7 @@ lazy val root = (project in file(".")). settings( organization := "ai.reveng", name := "sdk", - version := "4.70.0", + version := "4.72.2", scalaVersion := "2.11.12", scalacOptions ++= Seq("-feature"), compile / javacOptions ++= Seq("-Xlint:deprecation"), diff --git a/docs/DynamicExecutionSummary.md b/docs/DynamicExecutionSummary.md new file mode 100644 index 0000000..1730e97 --- /dev/null +++ b/docs/DynamicExecutionSummary.md @@ -0,0 +1,14 @@ + + +# DynamicExecutionSummary + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**generatedAt** | **OffsetDateTime** | When the summary was generated | | +|**summary** | **String** | Markdown summary of the run | | + + + diff --git a/docs/DynamicExecutionSummaryMetadata.md b/docs/DynamicExecutionSummaryMetadata.md new file mode 100644 index 0000000..2f4f700 --- /dev/null +++ b/docs/DynamicExecutionSummaryMetadata.md @@ -0,0 +1,26 @@ + + +# DynamicExecutionSummaryMetadata + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | [**StatusEnum**](#StatusEnum) | Status of the most recent summary attempt. UNINITIALISED means no summary has been attempted for this analysis. | | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| UNINITIALISED | "UNINITIALISED" | +| PENDING | "PENDING" | +| RUNNING | "RUNNING" | +| COMPLETED | "COMPLETED" | +| FAILED | "FAILED" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/OperationDynamicExecutionSummaryMetadataDynamicExecutionSummaryResult.md b/docs/OperationDynamicExecutionSummaryMetadataDynamicExecutionSummaryResult.md new file mode 100644 index 0000000..d2cb0e9 --- /dev/null +++ b/docs/OperationDynamicExecutionSummaryMetadataDynamicExecutionSummaryResult.md @@ -0,0 +1,17 @@ + + +# OperationDynamicExecutionSummaryMetadataDynamicExecutionSummaryResult + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**done** | **Boolean** | Whether the operation has reached a terminal state. | | +|**error** | **Status** | Failure detail, populated only when done is true and the operation failed. | [optional] | +|**metadata** | **DynamicExecutionSummaryMetadata** | In-flight information and details. | [optional] | +|**name** | **String** | API resource name. | | +|**response** | **Object** | Result, set only when done is true and the operation succeeded. | [optional] | + + + diff --git a/pom.xml b/pom.xml index 10681a2..8bac465 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ sdk jar sdk - 4.70.0 + 4.72.2 https://github.com/RevEngAI/sdk-java Java SDK for the RevEng.AI API diff --git a/src/main/java/ai/reveng/invoker/ApiClient.java b/src/main/java/ai/reveng/invoker/ApiClient.java index f4dfb7e..7d9ccfa 100644 --- a/src/main/java/ai/reveng/invoker/ApiClient.java +++ b/src/main/java/ai/reveng/invoker/ApiClient.java @@ -148,7 +148,7 @@ protected void init() { json = new JSON(); // Set default User-Agent. - setUserAgent("OpenAPI-Generator/4.70.0/java"); + setUserAgent("OpenAPI-Generator/4.72.2/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 d0d6a13..a9ab5ea 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 = "4.70.0"; + public static final String VERSION = "4.72.2"; 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 7aaf86d..d55cbee 100644 --- a/src/main/java/ai/reveng/invoker/JSON.java +++ b/src/main/java/ai/reveng/invoker/JSON.java @@ -443,6 +443,8 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.DrakvufFileMetadata.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.DynamicExecutionMetadata.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.DynamicExecutionStatusResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.DynamicExecutionSummary.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.DynamicExecutionSummaryMetadata.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ELFImportModel.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ELFModel.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ELFRelocation.CustomTypeAdapterFactory()); @@ -647,6 +649,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.OperationCryptoExplainMetadataCryptoExplainResult.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.OperationCryptoScanMetadataCryptoScanResult.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.OperationDynamicExecutionMetadataDynamicExecutionResult.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.OperationDynamicExecutionSummaryMetadataDynamicExecutionSummaryResult.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.OperationExecutionExplainMetadataExecutionExplainResult.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.OperationExecutionScanMetadataExecutionScanResult.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.OperationFilesystemAnalyseMetadataFilesystemAnalyseResult.CustomTypeAdapterFactory()); diff --git a/src/main/java/ai/reveng/model/DynamicExecutionSummary.java b/src/main/java/ai/reveng/model/DynamicExecutionSummary.java new file mode 100644 index 0000000..b745397 --- /dev/null +++ b/src/main/java/ai/reveng/model/DynamicExecutionSummary.java @@ -0,0 +1,316 @@ +/* + * 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 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.time.OffsetDateTime; +import java.util.Arrays; + +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 ai.reveng.invoker.JSON; + +/** + * DynamicExecutionSummary + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DynamicExecutionSummary { + public static final String SERIALIZED_NAME_GENERATED_AT = "generated_at"; + @SerializedName(SERIALIZED_NAME_GENERATED_AT) + @javax.annotation.Nonnull + private OffsetDateTime generatedAt; + + public static final String SERIALIZED_NAME_SUMMARY = "summary"; + @SerializedName(SERIALIZED_NAME_SUMMARY) + @javax.annotation.Nonnull + private String summary; + + public DynamicExecutionSummary() { + } + + public DynamicExecutionSummary generatedAt(@javax.annotation.Nonnull OffsetDateTime generatedAt) { + this.generatedAt = generatedAt; + return this; + } + + /** + * When the summary was generated + * @return generatedAt + */ + @javax.annotation.Nonnull + public OffsetDateTime getGeneratedAt() { + return generatedAt; + } + + public void setGeneratedAt(@javax.annotation.Nonnull OffsetDateTime generatedAt) { + this.generatedAt = generatedAt; + } + + + public DynamicExecutionSummary summary(@javax.annotation.Nonnull String summary) { + this.summary = summary; + return this; + } + + /** + * Markdown summary of the run + * @return summary + */ + @javax.annotation.Nonnull + public String getSummary() { + return summary; + } + + public void setSummary(@javax.annotation.Nonnull String summary) { + this.summary = summary; + } + + /** + * 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 DynamicExecutionSummary instance itself + */ + public DynamicExecutionSummary 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; + } + DynamicExecutionSummary dynamicExecutionSummary = (DynamicExecutionSummary) o; + return Objects.equals(this.generatedAt, dynamicExecutionSummary.generatedAt) && + Objects.equals(this.summary, dynamicExecutionSummary.summary)&& + Objects.equals(this.additionalProperties, dynamicExecutionSummary.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(generatedAt, summary, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DynamicExecutionSummary {\n"); + sb.append(" generatedAt: ").append(toIndentedString(generatedAt)).append("\n"); + sb.append(" summary: ").append(toIndentedString(summary)).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) { + return o == null ? "null" : 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("generated_at", "summary")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("generated_at", "summary")); + } + + /** + * 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 DynamicExecutionSummary + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DynamicExecutionSummary.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in DynamicExecutionSummary is not found in the empty JSON string", DynamicExecutionSummary.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DynamicExecutionSummary.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("summary").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `summary` to be a primitive type in the JSON string but got `%s`", jsonObj.get("summary").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DynamicExecutionSummary.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DynamicExecutionSummary' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DynamicExecutionSummary.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DynamicExecutionSummary 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 DynamicExecutionSummary read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + DynamicExecutionSummary 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(java.util.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 DynamicExecutionSummary given an JSON string + * + * @param jsonString JSON string + * @return An instance of DynamicExecutionSummary + * @throws IOException if the JSON string is invalid with respect to DynamicExecutionSummary + */ + public static DynamicExecutionSummary fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DynamicExecutionSummary.class); + } + + /** + * Convert an instance of DynamicExecutionSummary to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/DynamicExecutionSummaryMetadata.java b/src/main/java/ai/reveng/model/DynamicExecutionSummaryMetadata.java new file mode 100644 index 0000000..ff91020 --- /dev/null +++ b/src/main/java/ai/reveng/model/DynamicExecutionSummaryMetadata.java @@ -0,0 +1,351 @@ +/* + * 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 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 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 ai.reveng.invoker.JSON; + +/** + * DynamicExecutionSummaryMetadata + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DynamicExecutionSummaryMetadata { + /** + * Status of the most recent summary attempt. UNINITIALISED means no summary has been attempted for this analysis. + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + UNINITIALISED("UNINITIALISED"), + + PENDING("PENDING"), + + RUNNING("RUNNING"), + + COMPLETED("COMPLETED"), + + FAILED("FAILED"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull + private StatusEnum status; + + public DynamicExecutionSummaryMetadata() { + } + + public DynamicExecutionSummaryMetadata status(@javax.annotation.Nonnull StatusEnum status) { + this.status = status; + return this; + } + + /** + * Status of the most recent summary attempt. UNINITIALISED means no summary has been attempted for this analysis. + * @return status + */ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nonnull StatusEnum status) { + this.status = status; + } + + /** + * 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 DynamicExecutionSummaryMetadata instance itself + */ + public DynamicExecutionSummaryMetadata 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; + } + DynamicExecutionSummaryMetadata dynamicExecutionSummaryMetadata = (DynamicExecutionSummaryMetadata) o; + return Objects.equals(this.status, dynamicExecutionSummaryMetadata.status)&& + Objects.equals(this.additionalProperties, dynamicExecutionSummaryMetadata.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(status, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DynamicExecutionSummaryMetadata {\n"); + sb.append(" status: ").append(toIndentedString(status)).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) { + return o == null ? "null" : 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("status")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("status")); + } + + /** + * 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 DynamicExecutionSummaryMetadata + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DynamicExecutionSummaryMetadata.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in DynamicExecutionSummaryMetadata is not found in the empty JSON string", DynamicExecutionSummaryMetadata.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DynamicExecutionSummaryMetadata.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the required field `status` + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DynamicExecutionSummaryMetadata.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DynamicExecutionSummaryMetadata' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DynamicExecutionSummaryMetadata.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DynamicExecutionSummaryMetadata 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 DynamicExecutionSummaryMetadata read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + DynamicExecutionSummaryMetadata 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(java.util.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 DynamicExecutionSummaryMetadata given an JSON string + * + * @param jsonString JSON string + * @return An instance of DynamicExecutionSummaryMetadata + * @throws IOException if the JSON string is invalid with respect to DynamicExecutionSummaryMetadata + */ + public static DynamicExecutionSummaryMetadata fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DynamicExecutionSummaryMetadata.class); + } + + /** + * Convert an instance of DynamicExecutionSummaryMetadata to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/OperationDynamicExecutionSummaryMetadataDynamicExecutionSummaryResult.java b/src/main/java/ai/reveng/model/OperationDynamicExecutionSummaryMetadataDynamicExecutionSummaryResult.java new file mode 100644 index 0000000..e007193 --- /dev/null +++ b/src/main/java/ai/reveng/model/OperationDynamicExecutionSummaryMetadataDynamicExecutionSummaryResult.java @@ -0,0 +1,395 @@ +/* + * 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 ai.reveng.model.DynamicExecutionSummaryMetadata; +import ai.reveng.model.Status; +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 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 ai.reveng.invoker.JSON; + +/** + * OperationDynamicExecutionSummaryMetadataDynamicExecutionSummaryResult + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class OperationDynamicExecutionSummaryMetadataDynamicExecutionSummaryResult { + public static final String SERIALIZED_NAME_DONE = "done"; + @SerializedName(SERIALIZED_NAME_DONE) + @javax.annotation.Nonnull + private Boolean done; + + public static final String SERIALIZED_NAME_ERROR = "error"; + @SerializedName(SERIALIZED_NAME_ERROR) + @javax.annotation.Nullable + private Status error; + + public static final String SERIALIZED_NAME_METADATA = "metadata"; + @SerializedName(SERIALIZED_NAME_METADATA) + @javax.annotation.Nullable + private DynamicExecutionSummaryMetadata metadata; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_RESPONSE = "response"; + @SerializedName(SERIALIZED_NAME_RESPONSE) + @javax.annotation.Nullable + private Object response; + + public OperationDynamicExecutionSummaryMetadataDynamicExecutionSummaryResult() { + } + + public OperationDynamicExecutionSummaryMetadataDynamicExecutionSummaryResult done(@javax.annotation.Nonnull Boolean done) { + this.done = done; + return this; + } + + /** + * Whether the operation has reached a terminal state. + * @return done + */ + @javax.annotation.Nonnull + public Boolean getDone() { + return done; + } + + public void setDone(@javax.annotation.Nonnull Boolean done) { + this.done = done; + } + + + public OperationDynamicExecutionSummaryMetadataDynamicExecutionSummaryResult error(@javax.annotation.Nullable Status error) { + this.error = error; + return this; + } + + /** + * Failure detail, populated only when done is true and the operation failed. + * @return error + */ + @javax.annotation.Nullable + public Status getError() { + return error; + } + + public void setError(@javax.annotation.Nullable Status error) { + this.error = error; + } + + + public OperationDynamicExecutionSummaryMetadataDynamicExecutionSummaryResult metadata(@javax.annotation.Nullable DynamicExecutionSummaryMetadata metadata) { + this.metadata = metadata; + return this; + } + + /** + * In-flight information and details. + * @return metadata + */ + @javax.annotation.Nullable + public DynamicExecutionSummaryMetadata getMetadata() { + return metadata; + } + + public void setMetadata(@javax.annotation.Nullable DynamicExecutionSummaryMetadata metadata) { + this.metadata = metadata; + } + + + public OperationDynamicExecutionSummaryMetadataDynamicExecutionSummaryResult name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * API resource name. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public OperationDynamicExecutionSummaryMetadataDynamicExecutionSummaryResult response(@javax.annotation.Nullable Object response) { + this.response = response; + return this; + } + + /** + * Result, set only when done is true and the operation succeeded. + * @return response + */ + @javax.annotation.Nullable + public Object getResponse() { + return response; + } + + public void setResponse(@javax.annotation.Nullable Object response) { + this.response = response; + } + + /** + * 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 OperationDynamicExecutionSummaryMetadataDynamicExecutionSummaryResult instance itself + */ + public OperationDynamicExecutionSummaryMetadataDynamicExecutionSummaryResult 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; + } + OperationDynamicExecutionSummaryMetadataDynamicExecutionSummaryResult operationDynamicExecutionSummaryMetadataDynamicExecutionSummaryResult = (OperationDynamicExecutionSummaryMetadataDynamicExecutionSummaryResult) o; + return Objects.equals(this.done, operationDynamicExecutionSummaryMetadataDynamicExecutionSummaryResult.done) && + Objects.equals(this.error, operationDynamicExecutionSummaryMetadataDynamicExecutionSummaryResult.error) && + Objects.equals(this.metadata, operationDynamicExecutionSummaryMetadataDynamicExecutionSummaryResult.metadata) && + Objects.equals(this.name, operationDynamicExecutionSummaryMetadataDynamicExecutionSummaryResult.name) && + Objects.equals(this.response, operationDynamicExecutionSummaryMetadataDynamicExecutionSummaryResult.response)&& + Objects.equals(this.additionalProperties, operationDynamicExecutionSummaryMetadataDynamicExecutionSummaryResult.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(done, error, metadata, name, response, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OperationDynamicExecutionSummaryMetadataDynamicExecutionSummaryResult {\n"); + sb.append(" done: ").append(toIndentedString(done)).append("\n"); + sb.append(" error: ").append(toIndentedString(error)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" response: ").append(toIndentedString(response)).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) { + return o == null ? "null" : 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("done", "error", "metadata", "name", "response")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("done", "name")); + } + + /** + * 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 OperationDynamicExecutionSummaryMetadataDynamicExecutionSummaryResult + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OperationDynamicExecutionSummaryMetadataDynamicExecutionSummaryResult.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in OperationDynamicExecutionSummaryMetadataDynamicExecutionSummaryResult is not found in the empty JSON string", OperationDynamicExecutionSummaryMetadataDynamicExecutionSummaryResult.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OperationDynamicExecutionSummaryMetadataDynamicExecutionSummaryResult.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OperationDynamicExecutionSummaryMetadataDynamicExecutionSummaryResult.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OperationDynamicExecutionSummaryMetadataDynamicExecutionSummaryResult' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OperationDynamicExecutionSummaryMetadataDynamicExecutionSummaryResult.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OperationDynamicExecutionSummaryMetadataDynamicExecutionSummaryResult 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 OperationDynamicExecutionSummaryMetadataDynamicExecutionSummaryResult read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + OperationDynamicExecutionSummaryMetadataDynamicExecutionSummaryResult 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(java.util.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 OperationDynamicExecutionSummaryMetadataDynamicExecutionSummaryResult given an JSON string + * + * @param jsonString JSON string + * @return An instance of OperationDynamicExecutionSummaryMetadataDynamicExecutionSummaryResult + * @throws IOException if the JSON string is invalid with respect to OperationDynamicExecutionSummaryMetadataDynamicExecutionSummaryResult + */ + public static OperationDynamicExecutionSummaryMetadataDynamicExecutionSummaryResult fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OperationDynamicExecutionSummaryMetadataDynamicExecutionSummaryResult.class); + } + + /** + * Convert an instance of OperationDynamicExecutionSummaryMetadataDynamicExecutionSummaryResult to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} +