diff --git a/.sdk-version b/.sdk-version index 637d249..df46356 100644 --- a/.sdk-version +++ b/.sdk-version @@ -1 +1 @@ -v3.96.3 +v3.97.0 diff --git a/README.md b/README.md index 170e860..e667601 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Add this dependency to your project's POM: ai.reveng sdk - 3.96.3 + 3.97.0 compile ``` @@ -31,7 +31,7 @@ repositories { } dependencies { - implementation "ai.reveng:sdk:3.96.3" + implementation "ai.reveng:sdk:3.97.0" } ``` @@ -116,6 +116,7 @@ Class | Method | HTTP request | Description *AnalysesCoreApi* | [**uploadFile**](docs/AnalysesCoreApi.md#uploadFile) | **POST** /v2/upload | Upload File *AnalysesCoreApi* | [**v3GetAnalysisStrings**](docs/AnalysesCoreApi.md#v3GetAnalysisStrings) | **GET** /v3/analyses/{analysis_id}/functions/strings | List strings for an analysis. *AnalysesCoreApi* | [**v3GetAnalysisStringsStatus**](docs/AnalysesCoreApi.md#v3GetAnalysisStringsStatus) | **GET** /v3/analyses/{analysis_id}/functions/strings/status | Get the string-extraction status for an analysis. +*AnalysesCoreApi* | [**v3ListExampleAnalyses**](docs/AnalysesCoreApi.md#v3ListExampleAnalyses) | **GET** /v3/analyses/examples | List example analyses *AnalysesResultsMetadataApi* | [**getAnalysisFunctionsPaginated**](docs/AnalysesResultsMetadataApi.md#getAnalysisFunctionsPaginated) | **GET** /v2/analyses/{analysis_id}/functions | Get functions from analysis *AnalysesResultsMetadataApi* | [**getCapabilities**](docs/AnalysesResultsMetadataApi.md#getCapabilities) | **GET** /v2/analyses/{analysis_id}/capabilities | Gets the capabilities from the analysis *AnalysesResultsMetadataApi* | [**getFunctionsList**](docs/AnalysesResultsMetadataApi.md#getFunctionsList) | **GET** /v2/analyses/{analysis_id}/functions/list | Gets functions from analysis @@ -479,6 +480,7 @@ Class | Method | HTTP request | Description - [EventTOOLCALLSTART](docs/EventTOOLCALLSTART.md) - [EventTOOLCONFIRMATIONREQUIRED](docs/EventTOOLCONFIRMATIONREQUIRED.md) - [EventWarning](docs/EventWarning.md) + - [Example](docs/Example.md) - [ExportModel](docs/ExportModel.md) - [ExternalResponse](docs/ExternalResponse.md) - [ExtractedURL](docs/ExtractedURL.md) @@ -555,6 +557,7 @@ Class | Method | HTTP request | Description - [ListAnalysisStringsOutputBody](docs/ListAnalysisStringsOutputBody.md) - [ListCollectionResults](docs/ListCollectionResults.md) - [ListCollectionsOutputBody](docs/ListCollectionsOutputBody.md) + - [ListExampleAnalysesOutputBody](docs/ListExampleAnalysesOutputBody.md) - [ListFunctionStringsOutputBody](docs/ListFunctionStringsOutputBody.md) - [ListFunctionsDataTypesOutputBody](docs/ListFunctionsDataTypesOutputBody.md) - [ListTeamsOutputBody](docs/ListTeamsOutputBody.md) diff --git a/build.gradle b/build.gradle index fad16c6..1ff73e8 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,7 @@ apply plugin: 'java' apply plugin: 'com.diffplug.spotless' group = 'ai.reveng' -version = '3.96.3' +version = '3.97.0' @@ -171,7 +171,7 @@ mavenPublishing { publishToMavenCentral(true) signAllPublications() - coordinates("ai.reveng", "sdk", "3.96.3") + coordinates("ai.reveng", "sdk", "3.97.0") pom { name = "sdk" diff --git a/build.sbt b/build.sbt index 6635987..4b1b5bf 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.96.3", + version := "3.97.0", scalaVersion := "2.11.12", scalacOptions ++= Seq("-feature"), compile / javacOptions ++= Seq("-Xlint:deprecation"), diff --git a/docs/AnalysesCoreApi.md b/docs/AnalysesCoreApi.md index 78738bb..5fc6403 100644 --- a/docs/AnalysesCoreApi.md +++ b/docs/AnalysesCoreApi.md @@ -29,6 +29,7 @@ All URIs are relative to *https://api.reveng.ai* | [**uploadFile**](AnalysesCoreApi.md#uploadFile) | **POST** /v2/upload | Upload File | | [**v3GetAnalysisStrings**](AnalysesCoreApi.md#v3GetAnalysisStrings) | **GET** /v3/analyses/{analysis_id}/functions/strings | List strings for an analysis. | | [**v3GetAnalysisStringsStatus**](AnalysesCoreApi.md#v3GetAnalysisStringsStatus) | **GET** /v3/analyses/{analysis_id}/functions/strings/status | Get the string-extraction status for an analysis. | +| [**v3ListExampleAnalyses**](AnalysesCoreApi.md#v3ListExampleAnalyses) | **GET** /v3/analyses/examples | List example analyses | @@ -1873,3 +1874,69 @@ public class Example { | **422** | Unprocessable Entity | - | | **500** | Internal Server Error | - | + +# **v3ListExampleAnalyses** +> ListExampleAnalysesOutputBody v3ListExampleAnalyses() + +List example analyses + +Returns the curated example Analyses. + +### Example +```java +// Import classes: +import ai.reveng.invoker.ApiClient; +import ai.reveng.invoker.ApiException; +import ai.reveng.invoker.Configuration; +import ai.reveng.invoker.auth.*; +import ai.reveng.invoker.models.*; +import ai.reveng.api.AnalysesCoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.reveng.ai"); + + // Configure API key authorization: APIKey + ApiKeyAuth APIKey = (ApiKeyAuth) defaultClient.getAuthentication("APIKey"); + APIKey.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //APIKey.setApiKeyPrefix("Token"); + + AnalysesCoreApi apiInstance = new AnalysesCoreApi(defaultClient); + try { + ListExampleAnalysesOutputBody result = apiInstance.v3ListExampleAnalyses(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnalysesCoreApi#v3ListExampleAnalyses"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**ListExampleAnalysesOutputBody**](ListExampleAnalysesOutputBody.md) + +### Authorization + +[APIKey](../README.md#APIKey) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **0** | Error | - | + diff --git a/docs/Example.md b/docs/Example.md new file mode 100644 index 0000000..44599c7 --- /dev/null +++ b/docs/Example.md @@ -0,0 +1,33 @@ + + +# Example + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**analysisId** | **Long** | Analysis ID | | +|**analysisScope** | [**AnalysisScopeEnum**](#AnalysisScopeEnum) | Scope of the analysis (always PUBLIC for examples) | | +|**binaryId** | **Long** | Binary ID | | +|**binaryName** | **String** | Binary filename | | +|**binarySize** | **Long** | Binary size in bytes | | +|**creation** | **OffsetDateTime** | When the analysis was created | | +|**isOwner** | **Boolean** | True when the caller owns the analysis | | +|**modelId** | **Long** | Model ID | | +|**sha256Hash** | **String** | SHA-256 hash of the binary | | +|**status** | **String** | Analysis status | | +|**tags** | **List<String>** | Tags associated with this binary | | +|**username** | **String** | Username of the analysis owner | | + + + +## Enum: AnalysisScopeEnum + +| Name | Value | +|---- | -----| +| PUBLIC | "PUBLIC" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/ListExampleAnalysesOutputBody.md b/docs/ListExampleAnalysesOutputBody.md new file mode 100644 index 0000000..0f205f8 --- /dev/null +++ b/docs/ListExampleAnalysesOutputBody.md @@ -0,0 +1,13 @@ + + +# ListExampleAnalysesOutputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**analyses** | [**List<Example>**](Example.md) | List of example analyses | | + + + diff --git a/pom.xml b/pom.xml index 1773ea9..4874fb2 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ sdk jar sdk - 3.96.3 + 3.97.0 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 63150dc..196b7e5 100644 --- a/src/main/java/ai/reveng/api/AnalysesCoreApi.java +++ b/src/main/java/ai/reveng/api/AnalysesCoreApi.java @@ -55,6 +55,7 @@ import ai.reveng.model.GetMatchesStatusOutputBody; import ai.reveng.model.InsertAnalysisLogRequest; import ai.reveng.model.ListAnalysisStringsOutputBody; +import ai.reveng.model.ListExampleAnalysesOutputBody; import ai.reveng.model.ModelName; import ai.reveng.model.Order; import ai.reveng.model.PutAnalysisStringsRequest; @@ -3791,4 +3792,125 @@ public okhttp3.Call v3GetAnalysisStringsStatusAsync(@javax.annotation.Nonnull Lo localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** + * Build call for v3ListExampleAnalyses + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
0 Error -
+ */ + public okhttp3.Call v3ListExampleAnalysesCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v3/analyses/examples"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "APIKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call v3ListExampleAnalysesValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return v3ListExampleAnalysesCall(_callback); + + } + + /** + * List example analyses + * Returns the curated example Analyses. + * @return ListExampleAnalysesOutputBody + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
0 Error -
+ */ + public ListExampleAnalysesOutputBody v3ListExampleAnalyses() throws ApiException { + ApiResponse localVarResp = v3ListExampleAnalysesWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * List example analyses + * Returns the curated example Analyses. + * @return ApiResponse<ListExampleAnalysesOutputBody> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
0 Error -
+ */ + public ApiResponse v3ListExampleAnalysesWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = v3ListExampleAnalysesValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List example analyses (asynchronously) + * Returns the curated example Analyses. + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
0 Error -
+ */ + public okhttp3.Call v3ListExampleAnalysesAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3ListExampleAnalysesValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } } diff --git a/src/main/java/ai/reveng/invoker/ApiClient.java b/src/main/java/ai/reveng/invoker/ApiClient.java index 86406df..5fbbd85 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.96.3/java"); + setUserAgent("OpenAPI-Generator/3.97.0/java"); authentications = new HashMap(); } diff --git a/src/main/java/ai/reveng/invoker/Configuration.java b/src/main/java/ai/reveng/invoker/Configuration.java index 2bae968..c43efc1 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.96.3"; + public static final String VERSION = "3.97.0"; private static final AtomicReference defaultApiClient = new AtomicReference<>(); private static volatile Supplier apiClientFactory = ApiClient::new; diff --git a/src/main/java/ai/reveng/invoker/JSON.java b/src/main/java/ai/reveng/invoker/JSON.java index 2e52547..4ced6ba 100644 --- a/src/main/java/ai/reveng/invoker/JSON.java +++ b/src/main/java/ai/reveng/invoker/JSON.java @@ -333,6 +333,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.EventTOOLCALLSTART.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.EventTOOLCONFIRMATIONREQUIRED.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.EventWarning.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Example.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ExportModel.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ExternalResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ExtractedURL.CustomTypeAdapterFactory()); @@ -405,6 +406,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ListAnalysisStringsOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ListCollectionResults.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ListCollectionsOutputBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ListExampleAnalysesOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ListFunctionStringsOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ListFunctionsDataTypesOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ListTeamsOutputBody.CustomTypeAdapterFactory()); diff --git a/src/main/java/ai/reveng/model/Example.java b/src/main/java/ai/reveng/model/Example.java new file mode 100644 index 0000000..2fe3bad --- /dev/null +++ b/src/main/java/ai/reveng/model/Example.java @@ -0,0 +1,658 @@ +/* + * 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.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * Example + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Example { + public static final String SERIALIZED_NAME_ANALYSIS_ID = "analysis_id"; + @SerializedName(SERIALIZED_NAME_ANALYSIS_ID) + @javax.annotation.Nonnull + private Long analysisId; + + /** + * Scope of the analysis (always PUBLIC for examples) + */ + @JsonAdapter(AnalysisScopeEnum.Adapter.class) + public enum AnalysisScopeEnum { + PUBLIC("PUBLIC"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + AnalysisScopeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static AnalysisScopeEnum fromValue(String value) { + for (AnalysisScopeEnum b : AnalysisScopeEnum.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 AnalysisScopeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public AnalysisScopeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return AnalysisScopeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + AnalysisScopeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_ANALYSIS_SCOPE = "analysis_scope"; + @SerializedName(SERIALIZED_NAME_ANALYSIS_SCOPE) + @javax.annotation.Nonnull + private AnalysisScopeEnum analysisScope; + + public static final String SERIALIZED_NAME_BINARY_ID = "binary_id"; + @SerializedName(SERIALIZED_NAME_BINARY_ID) + @javax.annotation.Nonnull + private Long binaryId; + + public static final String SERIALIZED_NAME_BINARY_NAME = "binary_name"; + @SerializedName(SERIALIZED_NAME_BINARY_NAME) + @javax.annotation.Nonnull + private String binaryName; + + public static final String SERIALIZED_NAME_BINARY_SIZE = "binary_size"; + @SerializedName(SERIALIZED_NAME_BINARY_SIZE) + @javax.annotation.Nonnull + private Long binarySize; + + public static final String SERIALIZED_NAME_CREATION = "creation"; + @SerializedName(SERIALIZED_NAME_CREATION) + @javax.annotation.Nonnull + private OffsetDateTime creation; + + public static final String SERIALIZED_NAME_IS_OWNER = "is_owner"; + @SerializedName(SERIALIZED_NAME_IS_OWNER) + @javax.annotation.Nonnull + private Boolean isOwner; + + public static final String SERIALIZED_NAME_MODEL_ID = "model_id"; + @SerializedName(SERIALIZED_NAME_MODEL_ID) + @javax.annotation.Nonnull + private Long modelId; + + public static final String SERIALIZED_NAME_SHA256_HASH = "sha_256_hash"; + @SerializedName(SERIALIZED_NAME_SHA256_HASH) + @javax.annotation.Nonnull + private String sha256Hash; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull + private String status; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + @javax.annotation.Nullable + private List tags; + + public static final String SERIALIZED_NAME_USERNAME = "username"; + @SerializedName(SERIALIZED_NAME_USERNAME) + @javax.annotation.Nonnull + private String username; + + public Example() { + } + + public Example analysisId(@javax.annotation.Nonnull Long analysisId) { + this.analysisId = analysisId; + return this; + } + + /** + * Analysis ID + * @return analysisId + */ + @javax.annotation.Nonnull + public Long getAnalysisId() { + return analysisId; + } + + public void setAnalysisId(@javax.annotation.Nonnull Long analysisId) { + this.analysisId = analysisId; + } + + + public Example analysisScope(@javax.annotation.Nonnull AnalysisScopeEnum analysisScope) { + this.analysisScope = analysisScope; + return this; + } + + /** + * Scope of the analysis (always PUBLIC for examples) + * @return analysisScope + */ + @javax.annotation.Nonnull + public AnalysisScopeEnum getAnalysisScope() { + return analysisScope; + } + + public void setAnalysisScope(@javax.annotation.Nonnull AnalysisScopeEnum analysisScope) { + this.analysisScope = analysisScope; + } + + + public Example binaryId(@javax.annotation.Nonnull Long binaryId) { + this.binaryId = binaryId; + return this; + } + + /** + * Binary ID + * @return binaryId + */ + @javax.annotation.Nonnull + public Long getBinaryId() { + return binaryId; + } + + public void setBinaryId(@javax.annotation.Nonnull Long binaryId) { + this.binaryId = binaryId; + } + + + public Example binaryName(@javax.annotation.Nonnull String binaryName) { + this.binaryName = binaryName; + return this; + } + + /** + * Binary filename + * @return binaryName + */ + @javax.annotation.Nonnull + public String getBinaryName() { + return binaryName; + } + + public void setBinaryName(@javax.annotation.Nonnull String binaryName) { + this.binaryName = binaryName; + } + + + public Example binarySize(@javax.annotation.Nonnull Long binarySize) { + this.binarySize = binarySize; + return this; + } + + /** + * Binary size in bytes + * @return binarySize + */ + @javax.annotation.Nonnull + public Long getBinarySize() { + return binarySize; + } + + public void setBinarySize(@javax.annotation.Nonnull Long binarySize) { + this.binarySize = binarySize; + } + + + public Example creation(@javax.annotation.Nonnull OffsetDateTime creation) { + this.creation = creation; + return this; + } + + /** + * When the analysis was created + * @return creation + */ + @javax.annotation.Nonnull + public OffsetDateTime getCreation() { + return creation; + } + + public void setCreation(@javax.annotation.Nonnull OffsetDateTime creation) { + this.creation = creation; + } + + + public Example isOwner(@javax.annotation.Nonnull Boolean isOwner) { + this.isOwner = isOwner; + return this; + } + + /** + * True when the caller owns the analysis + * @return isOwner + */ + @javax.annotation.Nonnull + public Boolean getIsOwner() { + return isOwner; + } + + public void setIsOwner(@javax.annotation.Nonnull Boolean isOwner) { + this.isOwner = isOwner; + } + + + public Example modelId(@javax.annotation.Nonnull Long modelId) { + this.modelId = modelId; + return this; + } + + /** + * Model ID + * @return modelId + */ + @javax.annotation.Nonnull + public Long getModelId() { + return modelId; + } + + public void setModelId(@javax.annotation.Nonnull Long modelId) { + this.modelId = modelId; + } + + + public Example sha256Hash(@javax.annotation.Nonnull String sha256Hash) { + this.sha256Hash = sha256Hash; + return this; + } + + /** + * SHA-256 hash of the binary + * @return sha256Hash + */ + @javax.annotation.Nonnull + public String getSha256Hash() { + return sha256Hash; + } + + public void setSha256Hash(@javax.annotation.Nonnull String sha256Hash) { + this.sha256Hash = sha256Hash; + } + + + public Example status(@javax.annotation.Nonnull String status) { + this.status = status; + return this; + } + + /** + * Analysis status + * @return status + */ + @javax.annotation.Nonnull + public String getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nonnull String status) { + this.status = status; + } + + + public Example tags(@javax.annotation.Nullable List tags) { + this.tags = tags; + return this; + } + + public Example addTagsItem(String tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Tags associated with this binary + * @return tags + */ + @javax.annotation.Nullable + public List getTags() { + return tags; + } + + public void setTags(@javax.annotation.Nullable List tags) { + this.tags = tags; + } + + + public Example username(@javax.annotation.Nonnull String username) { + this.username = username; + return this; + } + + /** + * Username of the analysis owner + * @return username + */ + @javax.annotation.Nonnull + public String getUsername() { + return username; + } + + public void setUsername(@javax.annotation.Nonnull String username) { + this.username = username; + } + + /** + * 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 Example instance itself + */ + public Example 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; + } + Example example = (Example) o; + return Objects.equals(this.analysisId, example.analysisId) && + Objects.equals(this.analysisScope, example.analysisScope) && + Objects.equals(this.binaryId, example.binaryId) && + Objects.equals(this.binaryName, example.binaryName) && + Objects.equals(this.binarySize, example.binarySize) && + Objects.equals(this.creation, example.creation) && + Objects.equals(this.isOwner, example.isOwner) && + Objects.equals(this.modelId, example.modelId) && + Objects.equals(this.sha256Hash, example.sha256Hash) && + Objects.equals(this.status, example.status) && + Objects.equals(this.tags, example.tags) && + Objects.equals(this.username, example.username)&& + Objects.equals(this.additionalProperties, example.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(analysisId, analysisScope, binaryId, binaryName, binarySize, creation, isOwner, modelId, sha256Hash, status, tags, username, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Example {\n"); + sb.append(" analysisId: ").append(toIndentedString(analysisId)).append("\n"); + sb.append(" analysisScope: ").append(toIndentedString(analysisScope)).append("\n"); + sb.append(" binaryId: ").append(toIndentedString(binaryId)).append("\n"); + sb.append(" binaryName: ").append(toIndentedString(binaryName)).append("\n"); + sb.append(" binarySize: ").append(toIndentedString(binarySize)).append("\n"); + sb.append(" creation: ").append(toIndentedString(creation)).append("\n"); + sb.append(" isOwner: ").append(toIndentedString(isOwner)).append("\n"); + sb.append(" modelId: ").append(toIndentedString(modelId)).append("\n"); + sb.append(" sha256Hash: ").append(toIndentedString(sha256Hash)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" username: ").append(toIndentedString(username)).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("analysis_id", "analysis_scope", "binary_id", "binary_name", "binary_size", "creation", "is_owner", "model_id", "sha_256_hash", "status", "tags", "username")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("analysis_id", "analysis_scope", "binary_id", "binary_name", "binary_size", "creation", "is_owner", "model_id", "sha_256_hash", "status", "tags", "username")); + } + + /** + * 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 Example + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Example.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 Example is not found in the empty JSON string", Example.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Example.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("analysis_scope").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `analysis_scope` to be a primitive type in the JSON string but got `%s`", jsonObj.get("analysis_scope").toString())); + } + // validate the required field `analysis_scope` + AnalysisScopeEnum.validateJsonElement(jsonObj.get("analysis_scope")); + if (!jsonObj.get("binary_name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `binary_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("binary_name").toString())); + } + if (!jsonObj.get("sha_256_hash").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `sha_256_hash` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sha_256_hash").toString())); + } + 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())); + } + // ensure the required json array is present + if (jsonObj.get("tags") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("tags").isJsonArray() && !jsonObj.get("tags").isJsonNull()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString())); + } + if (!jsonObj.get("username").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `username` to be a primitive type in the JSON string but got `%s`", jsonObj.get("username").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Example.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Example' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Example.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Example 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 Example read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Example 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 Example given an JSON string + * + * @param jsonString JSON string + * @return An instance of Example + * @throws IOException if the JSON string is invalid with respect to Example + */ + public static Example fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Example.class); + } + + /** + * Convert an instance of Example to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/ListExampleAnalysesOutputBody.java b/src/main/java/ai/reveng/model/ListExampleAnalysesOutputBody.java new file mode 100644 index 0000000..9f81653 --- /dev/null +++ b/src/main/java/ai/reveng/model/ListExampleAnalysesOutputBody.java @@ -0,0 +1,226 @@ +/* + * 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.Example; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * ListExampleAnalysesOutputBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ListExampleAnalysesOutputBody { + public static final String SERIALIZED_NAME_ANALYSES = "analyses"; + @SerializedName(SERIALIZED_NAME_ANALYSES) + @javax.annotation.Nullable + private List analyses; + + public ListExampleAnalysesOutputBody() { + } + + public ListExampleAnalysesOutputBody analyses(@javax.annotation.Nullable List analyses) { + this.analyses = analyses; + return this; + } + + public ListExampleAnalysesOutputBody addAnalysesItem(Example analysesItem) { + if (this.analyses == null) { + this.analyses = new ArrayList<>(); + } + this.analyses.add(analysesItem); + return this; + } + + /** + * List of example analyses + * @return analyses + */ + @javax.annotation.Nullable + public List getAnalyses() { + return analyses; + } + + public void setAnalyses(@javax.annotation.Nullable List analyses) { + this.analyses = analyses; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListExampleAnalysesOutputBody listExampleAnalysesOutputBody = (ListExampleAnalysesOutputBody) o; + return Objects.equals(this.analyses, listExampleAnalysesOutputBody.analyses); + } + + @Override + public int hashCode() { + return Objects.hash(analyses); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListExampleAnalysesOutputBody {\n"); + sb.append(" analyses: ").append(toIndentedString(analyses)).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("analyses")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("analyses")); + } + + /** + * 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 ListExampleAnalysesOutputBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ListExampleAnalysesOutputBody.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 ListExampleAnalysesOutputBody is not found in the empty JSON string", ListExampleAnalysesOutputBody.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ListExampleAnalysesOutputBody.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `ListExampleAnalysesOutputBody` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ListExampleAnalysesOutputBody.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("analyses") != null && !jsonObj.get("analyses").isJsonNull()) { + if (!jsonObj.get("analyses").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `analyses` to be an array in the JSON string but got `%s`", jsonObj.get("analyses").toString())); + } + JsonArray jsonArrayanalyses = jsonObj.getAsJsonArray("analyses"); + // validate the required field `analyses` (array) + for (int i = 0; i < jsonArrayanalyses.size(); i++) { + Example.validateJsonElement(jsonArrayanalyses.get(i)); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ListExampleAnalysesOutputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ListExampleAnalysesOutputBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ListExampleAnalysesOutputBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ListExampleAnalysesOutputBody value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ListExampleAnalysesOutputBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ListExampleAnalysesOutputBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of ListExampleAnalysesOutputBody + * @throws IOException if the JSON string is invalid with respect to ListExampleAnalysesOutputBody + */ + public static ListExampleAnalysesOutputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ListExampleAnalysesOutputBody.class); + } + + /** + * Convert an instance of ListExampleAnalysesOutputBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} +