diff --git a/.sdk-version b/.sdk-version index 89f17c0..100a28e 100644 --- a/.sdk-version +++ b/.sdk-version @@ -1 +1 @@ -v3.46.0 +v3.51.0 diff --git a/README.md b/README.md index a50b7ea..349dfac 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Add this dependency to your project's POM: ai.reveng sdk - 3.46.0 + 3.51.0 compile ``` @@ -31,7 +31,7 @@ repositories { } dependencies { - implementation "ai.reveng:sdk:3.46.0" + implementation "ai.reveng:sdk:3.51.0" } ``` @@ -114,6 +114,8 @@ Class | Method | HTTP request | Description *AnalysesSecurityChecksApi* | [**getSecurityChecks**](docs/AnalysesSecurityChecksApi.md#getSecurityChecks) | **GET** /v2/analyses/{analysis_id}/security-checks | Get Security Checks *AnalysesSecurityChecksApi* | [**getSecurityChecksTaskStatus**](docs/AnalysesSecurityChecksApi.md#getSecurityChecksTaskStatus) | **GET** /v2/analyses/{analysis_id}/security-checks/status | Check the status of a security check process *AnalysesXRefsApi* | [**getXrefByVaddr**](docs/AnalysesXRefsApi.md#getXrefByVaddr) | **GET** /v2/analyses/{analysis_id}/xrefs/{vaddr} | [Beta] Look up xrefs by virtual address +*AnalysisStagesApi* | [**getAnalysisStages**](docs/AnalysisStagesApi.md#getAnalysisStages) | **GET** /v2/analysis-stages/{analysis_id} | Get Analysis Stages +*AnalysisStagesApi* | [**getPipelineStatus**](docs/AnalysisStagesApi.md#getPipelineStatus) | **GET** /v2/analysis-stages/{analysis_id}/pipeline-status | Get Pipeline Status *AuthenticationUsersApi* | [**getRequesterUserInfo**](docs/AuthenticationUsersApi.md#getRequesterUserInfo) | **GET** /v2/users/me | Get the requesters user information *AuthenticationUsersApi* | [**getUser**](docs/AuthenticationUsersApi.md#getUser) | **GET** /v2/users/{user_id} | Get a user's public information *AuthenticationUsersApi* | [**getUserActivity**](docs/AuthenticationUsersApi.md#getUserActivity) | **GET** /v2/users/activity | Get auth user activity @@ -208,6 +210,9 @@ Class | Method | HTTP request | Description - [AnalysisFunctionsList](docs/AnalysisFunctionsList.md) - [AnalysisRecord](docs/AnalysisRecord.md) - [AnalysisScope](docs/AnalysisScope.md) + - [AnalysisStage](docs/AnalysisStage.md) + - [AnalysisStageStatus](docs/AnalysisStageStatus.md) + - [AnalysisStagesResponse](docs/AnalysisStagesResponse.md) - [AnalysisStringsResponse](docs/AnalysisStringsResponse.md) - [AnalysisStringsStatusResponse](docs/AnalysisStringsStatusResponse.md) - [AnalysisTags](docs/AnalysisTags.md) @@ -232,6 +237,7 @@ Class | Method | HTTP request | Description - [BaseResponseAnalysisFunctionMapping](docs/BaseResponseAnalysisFunctionMapping.md) - [BaseResponseAnalysisFunctions](docs/BaseResponseAnalysisFunctions.md) - [BaseResponseAnalysisFunctionsList](docs/BaseResponseAnalysisFunctionsList.md) + - [BaseResponseAnalysisStagesResponse](docs/BaseResponseAnalysisStagesResponse.md) - [BaseResponseAnalysisStringsResponse](docs/BaseResponseAnalysisStringsResponse.md) - [BaseResponseAnalysisStringsStatusResponse](docs/BaseResponseAnalysisStringsStatusResponse.md) - [BaseResponseAnalysisTags](docs/BaseResponseAnalysisTags.md) @@ -286,6 +292,7 @@ Class | Method | HTTP request | Description - [BaseResponseModelsResponse](docs/BaseResponseModelsResponse.md) - [BaseResponseNetworkOverviewResponse](docs/BaseResponseNetworkOverviewResponse.md) - [BaseResponseParams](docs/BaseResponseParams.md) + - [BaseResponsePipelineStatusResponse](docs/BaseResponsePipelineStatusResponse.md) - [BaseResponseProcessDumps](docs/BaseResponseProcessDumps.md) - [BaseResponseProcessRegistry](docs/BaseResponseProcessRegistry.md) - [BaseResponseProcessTree](docs/BaseResponseProcessTree.md) @@ -435,6 +442,8 @@ Class | Method | HTTP request | Description - [PEModel](docs/PEModel.md) - [PaginationModel](docs/PaginationModel.md) - [Params](docs/Params.md) + - [PipelineStageStatus](docs/PipelineStageStatus.md) + - [PipelineStatusResponse](docs/PipelineStatusResponse.md) - [Platform](docs/Platform.md) - [Process](docs/Process.md) - [ProcessDump](docs/ProcessDump.md) @@ -463,6 +472,8 @@ Class | Method | HTTP request | Description - [SinglePDBEntryModel](docs/SinglePDBEntryModel.md) - [SingleSectionModel](docs/SingleSectionModel.md) - [StackVariable](docs/StackVariable.md) + - [StageEvent](docs/StageEvent.md) + - [StageStatus](docs/StageStatus.md) - [StatusInput](docs/StatusInput.md) - [StatusOutput](docs/StatusOutput.md) - [StringFunctions](docs/StringFunctions.md) diff --git a/build.gradle b/build.gradle index cccca94..9382fc1 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,7 @@ apply plugin: 'java' apply plugin: 'com.diffplug.spotless' group = 'ai.reveng' -version = '3.46.0' +version = '3.51.0' @@ -171,7 +171,7 @@ mavenPublishing { publishToMavenCentral(true) signAllPublications() - coordinates("ai.reveng", "sdk", "3.46.0") + coordinates("ai.reveng", "sdk", "3.51.0") pom { name = "sdk" diff --git a/build.sbt b/build.sbt index 845e679..344cf63 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.46.0", + version := "3.51.0", scalaVersion := "2.11.12", scalacOptions ++= Seq("-feature"), compile / javacOptions ++= Seq("-Xlint:deprecation"), diff --git a/docs/AnalysisStage.md b/docs/AnalysisStage.md new file mode 100644 index 0000000..2ad31b6 --- /dev/null +++ b/docs/AnalysisStage.md @@ -0,0 +1,15 @@ + + +# AnalysisStage + +## Enum + + +* `ANALYSIS` (value: `"ANALYSIS"`) + +* `POST_PROCESSING` (value: `"POST_PROCESSING"`) + +* `INFERENCE` (value: `"INFERENCE"`) + + + diff --git a/docs/AnalysisStageStatus.md b/docs/AnalysisStageStatus.md new file mode 100644 index 0000000..1ccee69 --- /dev/null +++ b/docs/AnalysisStageStatus.md @@ -0,0 +1,17 @@ + + +# AnalysisStageStatus + +## Enum + + +* `QUEUED` (value: `"QUEUED"`) + +* `STARTED` (value: `"STARTED"`) + +* `FINISHED` (value: `"FINISHED"`) + +* `ERROR` (value: `"ERROR"`) + + + diff --git a/docs/AnalysisStagesApi.md b/docs/AnalysisStagesApi.md new file mode 100644 index 0000000..a64ea12 --- /dev/null +++ b/docs/AnalysisStagesApi.md @@ -0,0 +1,150 @@ +# AnalysisStagesApi + +All URIs are relative to *https://api.reveng.ai* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**getAnalysisStages**](AnalysisStagesApi.md#getAnalysisStages) | **GET** /v2/analysis-stages/{analysis_id} | Get Analysis Stages | +| [**getPipelineStatus**](AnalysisStagesApi.md#getPipelineStatus) | **GET** /v2/analysis-stages/{analysis_id}/pipeline-status | Get Pipeline Status | + + + +# **getAnalysisStages** +> BaseResponseAnalysisStagesResponse getAnalysisStages(analysisId) + +Get Analysis Stages + +Returns all stage events for an analysis ordered by timestamp. + +### 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.AnalysisStagesApi; + +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"); + + AnalysisStagesApi apiInstance = new AnalysisStagesApi(defaultClient); + Integer analysisId = 56; // Integer | + try { + BaseResponseAnalysisStagesResponse result = apiInstance.getAnalysisStages(analysisId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnalysisStagesApi#getAnalysisStages"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **analysisId** | **Integer**| | | + +### Return type + +[**BaseResponseAnalysisStagesResponse**](BaseResponseAnalysisStagesResponse.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** | Successful Response | - | +| **422** | Invalid request parameters | - | + + +# **getPipelineStatus** +> BaseResponsePipelineStatusResponse getPipelineStatus(analysisId) + +Get Pipeline Status + +Returns the latest status for each core pipeline stage with the number of analyses ahead in the queue. + +### 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.AnalysisStagesApi; + +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"); + + AnalysisStagesApi apiInstance = new AnalysisStagesApi(defaultClient); + Integer analysisId = 56; // Integer | + try { + BaseResponsePipelineStatusResponse result = apiInstance.getPipelineStatus(analysisId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnalysisStagesApi#getPipelineStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **analysisId** | **Integer**| | | + +### Return type + +[**BaseResponsePipelineStatusResponse**](BaseResponsePipelineStatusResponse.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** | Successful Response | - | +| **422** | Invalid request parameters | - | + diff --git a/docs/AnalysisStagesResponse.md b/docs/AnalysisStagesResponse.md new file mode 100644 index 0000000..a1acf5a --- /dev/null +++ b/docs/AnalysisStagesResponse.md @@ -0,0 +1,13 @@ + + +# AnalysisStagesResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**events** | [**List<StageEvent>**](StageEvent.md) | | | + + + diff --git a/docs/BaseResponseAnalysisStagesResponse.md b/docs/BaseResponseAnalysisStagesResponse.md new file mode 100644 index 0000000..31e644a --- /dev/null +++ b/docs/BaseResponseAnalysisStagesResponse.md @@ -0,0 +1,17 @@ + + +# BaseResponseAnalysisStagesResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **Boolean** | Response status on whether the request succeeded | [optional] | +|**data** | [**AnalysisStagesResponse**](AnalysisStagesResponse.md) | | [optional] | +|**message** | **String** | | [optional] | +|**errors** | [**List<ErrorModel>**](ErrorModel.md) | | [optional] | +|**meta** | [**MetaModel**](MetaModel.md) | Metadata | [optional] | + + + diff --git a/docs/BaseResponsePipelineStatusResponse.md b/docs/BaseResponsePipelineStatusResponse.md new file mode 100644 index 0000000..b63d3e9 --- /dev/null +++ b/docs/BaseResponsePipelineStatusResponse.md @@ -0,0 +1,17 @@ + + +# BaseResponsePipelineStatusResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **Boolean** | Response status on whether the request succeeded | [optional] | +|**data** | [**PipelineStatusResponse**](PipelineStatusResponse.md) | | [optional] | +|**message** | **String** | | [optional] | +|**errors** | [**List<ErrorModel>**](ErrorModel.md) | | [optional] | +|**meta** | [**MetaModel**](MetaModel.md) | Metadata | [optional] | + + + diff --git a/docs/PipelineStageStatus.md b/docs/PipelineStageStatus.md new file mode 100644 index 0000000..cc1c268 --- /dev/null +++ b/docs/PipelineStageStatus.md @@ -0,0 +1,19 @@ + + +# PipelineStageStatus + +## Enum + + +* `PENDING` (value: `"PENDING"`) + +* `QUEUED` (value: `"QUEUED"`) + +* `STARTED` (value: `"STARTED"`) + +* `FINISHED` (value: `"FINISHED"`) + +* `ERROR` (value: `"ERROR"`) + + + diff --git a/docs/PipelineStatusResponse.md b/docs/PipelineStatusResponse.md new file mode 100644 index 0000000..69924c9 --- /dev/null +++ b/docs/PipelineStatusResponse.md @@ -0,0 +1,13 @@ + + +# PipelineStatusResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**stages** | [**List<StageStatus>**](StageStatus.md) | | | + + + diff --git a/docs/StageEvent.md b/docs/StageEvent.md new file mode 100644 index 0000000..f46d32d --- /dev/null +++ b/docs/StageEvent.md @@ -0,0 +1,15 @@ + + +# StageEvent + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**stage** | **AnalysisStage** | | | +|**status** | **AnalysisStageStatus** | | | +|**timestamp** | **String** | | | + + + diff --git a/docs/StageStatus.md b/docs/StageStatus.md new file mode 100644 index 0000000..1c8c0bd --- /dev/null +++ b/docs/StageStatus.md @@ -0,0 +1,15 @@ + + +# StageStatus + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**stage** | **AnalysisStage** | | | +|**status** | **PipelineStageStatus** | | | +|**numAhead** | **Integer** | | | + + + diff --git a/pom.xml b/pom.xml index 3ecab7e..66de9db 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ sdk jar sdk - 3.46.0 + 3.51.0 https://github.com/RevEngAI/sdk-java Java SDK for the RevEng.AI API diff --git a/src/main/java/ai/reveng/api/AnalysisStagesApi.java b/src/main/java/ai/reveng/api/AnalysisStagesApi.java new file mode 100644 index 0000000..31de277 --- /dev/null +++ b/src/main/java/ai/reveng/api/AnalysisStagesApi.java @@ -0,0 +1,338 @@ +/* + * 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.api; + +import ai.reveng.invoker.ApiCallback; +import ai.reveng.invoker.ApiClient; +import ai.reveng.invoker.ApiException; +import ai.reveng.invoker.ApiResponse; +import ai.reveng.invoker.Configuration; +import ai.reveng.invoker.Pair; +import ai.reveng.invoker.ProgressRequestBody; +import ai.reveng.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import ai.reveng.model.BaseResponse; +import ai.reveng.model.BaseResponseAnalysisStagesResponse; +import ai.reveng.model.BaseResponsePipelineStatusResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class AnalysisStagesApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public AnalysisStagesApi() { + this(Configuration.getDefaultApiClient()); + } + + public AnalysisStagesApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for getAnalysisStages + * @param analysisId (required) + * @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 Successful Response -
422 Invalid request parameters -
+ */ + public okhttp3.Call getAnalysisStagesCall(@javax.annotation.Nonnull Integer analysisId, 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 = "/v2/analysis-stages/{analysis_id}" + .replace("{" + "analysis_id" + "}", localVarApiClient.escapeString(analysisId.toString())); + + 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 getAnalysisStagesValidateBeforeCall(@javax.annotation.Nonnull Integer analysisId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'analysisId' is set + if (analysisId == null) { + throw new ApiException("Missing the required parameter 'analysisId' when calling getAnalysisStages(Async)"); + } + + return getAnalysisStagesCall(analysisId, _callback); + + } + + /** + * Get Analysis Stages + * Returns all stage events for an analysis ordered by timestamp. + * @param analysisId (required) + * @return BaseResponseAnalysisStagesResponse + * @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 Successful Response -
422 Invalid request parameters -
+ */ + public BaseResponseAnalysisStagesResponse getAnalysisStages(@javax.annotation.Nonnull Integer analysisId) throws ApiException { + ApiResponse localVarResp = getAnalysisStagesWithHttpInfo(analysisId); + return localVarResp.getData(); + } + + /** + * Get Analysis Stages + * Returns all stage events for an analysis ordered by timestamp. + * @param analysisId (required) + * @return ApiResponse<BaseResponseAnalysisStagesResponse> + * @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 Successful Response -
422 Invalid request parameters -
+ */ + public ApiResponse getAnalysisStagesWithHttpInfo(@javax.annotation.Nonnull Integer analysisId) throws ApiException { + okhttp3.Call localVarCall = getAnalysisStagesValidateBeforeCall(analysisId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Analysis Stages (asynchronously) + * Returns all stage events for an analysis ordered by timestamp. + * @param analysisId (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 Successful Response -
422 Invalid request parameters -
+ */ + public okhttp3.Call getAnalysisStagesAsync(@javax.annotation.Nonnull Integer analysisId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getAnalysisStagesValidateBeforeCall(analysisId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getPipelineStatus + * @param analysisId (required) + * @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 Successful Response -
422 Invalid request parameters -
+ */ + public okhttp3.Call getPipelineStatusCall(@javax.annotation.Nonnull Integer analysisId, 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 = "/v2/analysis-stages/{analysis_id}/pipeline-status" + .replace("{" + "analysis_id" + "}", localVarApiClient.escapeString(analysisId.toString())); + + 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 getPipelineStatusValidateBeforeCall(@javax.annotation.Nonnull Integer analysisId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'analysisId' is set + if (analysisId == null) { + throw new ApiException("Missing the required parameter 'analysisId' when calling getPipelineStatus(Async)"); + } + + return getPipelineStatusCall(analysisId, _callback); + + } + + /** + * Get Pipeline Status + * Returns the latest status for each core pipeline stage with the number of analyses ahead in the queue. + * @param analysisId (required) + * @return BaseResponsePipelineStatusResponse + * @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 Successful Response -
422 Invalid request parameters -
+ */ + public BaseResponsePipelineStatusResponse getPipelineStatus(@javax.annotation.Nonnull Integer analysisId) throws ApiException { + ApiResponse localVarResp = getPipelineStatusWithHttpInfo(analysisId); + return localVarResp.getData(); + } + + /** + * Get Pipeline Status + * Returns the latest status for each core pipeline stage with the number of analyses ahead in the queue. + * @param analysisId (required) + * @return ApiResponse<BaseResponsePipelineStatusResponse> + * @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 Successful Response -
422 Invalid request parameters -
+ */ + public ApiResponse getPipelineStatusWithHttpInfo(@javax.annotation.Nonnull Integer analysisId) throws ApiException { + okhttp3.Call localVarCall = getPipelineStatusValidateBeforeCall(analysisId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Pipeline Status (asynchronously) + * Returns the latest status for each core pipeline stage with the number of analyses ahead in the queue. + * @param analysisId (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 Successful Response -
422 Invalid request parameters -
+ */ + public okhttp3.Call getPipelineStatusAsync(@javax.annotation.Nonnull Integer analysisId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getPipelineStatusValidateBeforeCall(analysisId, _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 ce98ec5..864b7bf 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.46.0/java"); + setUserAgent("OpenAPI-Generator/3.51.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 4d6d529..a07d2bd 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.46.0"; + public static final String VERSION = "3.51.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 1119980..e6e80f9 100644 --- a/src/main/java/ai/reveng/invoker/JSON.java +++ b/src/main/java/ai/reveng/invoker/JSON.java @@ -114,6 +114,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisFunctions.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisFunctionsList.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisRecord.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisStagesResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisStringsResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisStringsStatusResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisTags.CustomTypeAdapterFactory()); @@ -135,6 +136,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseAnalysisFunctionMapping.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseAnalysisFunctions.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseAnalysisFunctionsList.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseAnalysisStagesResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseAnalysisStringsResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseAnalysisStringsStatusResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseAnalysisTags.CustomTypeAdapterFactory()); @@ -189,6 +191,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseModelsResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseNetworkOverviewResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseParams.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponsePipelineStatusResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseProcessDumps.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseProcessRegistry.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseProcessTree.CustomTypeAdapterFactory()); @@ -326,6 +329,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.PEModel.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.PaginationModel.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Params.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.PipelineStatusResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Process.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ProcessDump.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ProcessDumpMetadata.CustomTypeAdapterFactory()); @@ -352,6 +356,8 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SinglePDBEntryModel.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SingleSectionModel.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.StackVariable.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.StageEvent.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.StageStatus.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.StatusOutput.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.StringFunctions.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Structure.CustomTypeAdapterFactory()); diff --git a/src/main/java/ai/reveng/model/AnalysisStage.java b/src/main/java/ai/reveng/model/AnalysisStage.java new file mode 100644 index 0000000..0ad83ae --- /dev/null +++ b/src/main/java/ai/reveng/model/AnalysisStage.java @@ -0,0 +1,81 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import java.util.Locale; +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Gets or Sets AnalysisStage + */ +@JsonAdapter(AnalysisStage.Adapter.class) +public enum AnalysisStage { + + ANALYSIS("ANALYSIS"), + + POST_PROCESSING("POST_PROCESSING"), + + INFERENCE("INFERENCE"); + + private String value; + + AnalysisStage(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static AnalysisStage fromValue(String value) { + for (AnalysisStage b : AnalysisStage.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final AnalysisStage enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public AnalysisStage read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return AnalysisStage.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + AnalysisStage.fromValue(value); + } +} + diff --git a/src/main/java/ai/reveng/model/AnalysisStageStatus.java b/src/main/java/ai/reveng/model/AnalysisStageStatus.java new file mode 100644 index 0000000..e5b8785 --- /dev/null +++ b/src/main/java/ai/reveng/model/AnalysisStageStatus.java @@ -0,0 +1,83 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import java.util.Locale; +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Gets or Sets AnalysisStageStatus + */ +@JsonAdapter(AnalysisStageStatus.Adapter.class) +public enum AnalysisStageStatus { + + QUEUED("QUEUED"), + + STARTED("STARTED"), + + FINISHED("FINISHED"), + + ERROR("ERROR"); + + private String value; + + AnalysisStageStatus(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static AnalysisStageStatus fromValue(String value) { + for (AnalysisStageStatus b : AnalysisStageStatus.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final AnalysisStageStatus enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public AnalysisStageStatus read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return AnalysisStageStatus.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + AnalysisStageStatus.fromValue(value); + } +} + diff --git a/src/main/java/ai/reveng/model/AnalysisStagesResponse.java b/src/main/java/ai/reveng/model/AnalysisStagesResponse.java new file mode 100644 index 0000000..d7fae1a --- /dev/null +++ b/src/main/java/ai/reveng/model/AnalysisStagesResponse.java @@ -0,0 +1,312 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import ai.reveng.model.StageEvent; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * AnalysisStagesResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AnalysisStagesResponse { + public static final String SERIALIZED_NAME_EVENTS = "events"; + @SerializedName(SERIALIZED_NAME_EVENTS) + @javax.annotation.Nonnull + private List events = new ArrayList<>(); + + public AnalysisStagesResponse() { + } + + public AnalysisStagesResponse events(@javax.annotation.Nonnull List events) { + this.events = events; + return this; + } + + public AnalysisStagesResponse addEventsItem(StageEvent eventsItem) { + if (this.events == null) { + this.events = new ArrayList<>(); + } + this.events.add(eventsItem); + return this; + } + + /** + * Get events + * @return events + */ + @javax.annotation.Nonnull + public List getEvents() { + return events; + } + + public void setEvents(@javax.annotation.Nonnull List events) { + this.events = events; + } + + /** + * 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 AnalysisStagesResponse instance itself + */ + public AnalysisStagesResponse 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; + } + AnalysisStagesResponse analysisStagesResponse = (AnalysisStagesResponse) o; + return Objects.equals(this.events, analysisStagesResponse.events)&& + Objects.equals(this.additionalProperties, analysisStagesResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(events, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnalysisStagesResponse {\n"); + sb.append(" events: ").append(toIndentedString(events)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("events")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("events")); + } + + /** + * 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 AnalysisStagesResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AnalysisStagesResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in AnalysisStagesResponse is not found in the empty JSON string", AnalysisStagesResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AnalysisStagesResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("events").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `events` to be an array in the JSON string but got `%s`", jsonObj.get("events").toString())); + } + + JsonArray jsonArrayevents = jsonObj.getAsJsonArray("events"); + // validate the required field `events` (array) + for (int i = 0; i < jsonArrayevents.size(); i++) { + StageEvent.validateJsonElement(jsonArrayevents.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AnalysisStagesResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AnalysisStagesResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AnalysisStagesResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AnalysisStagesResponse 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 AnalysisStagesResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AnalysisStagesResponse instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AnalysisStagesResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of AnalysisStagesResponse + * @throws IOException if the JSON string is invalid with respect to AnalysisStagesResponse + */ + public static AnalysisStagesResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AnalysisStagesResponse.class); + } + + /** + * Convert an instance of AnalysisStagesResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/BaseResponseAnalysisStagesResponse.java b/src/main/java/ai/reveng/model/BaseResponseAnalysisStagesResponse.java new file mode 100644 index 0000000..362b400 --- /dev/null +++ b/src/main/java/ai/reveng/model/BaseResponseAnalysisStagesResponse.java @@ -0,0 +1,438 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import ai.reveng.model.AnalysisStagesResponse; +import ai.reveng.model.ErrorModel; +import ai.reveng.model.MetaModel; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * BaseResponseAnalysisStagesResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class BaseResponseAnalysisStagesResponse { + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private Boolean status = true; + + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nullable + private AnalysisStagesResponse data; + + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + @javax.annotation.Nullable + private String message; + + public static final String SERIALIZED_NAME_ERRORS = "errors"; + @SerializedName(SERIALIZED_NAME_ERRORS) + @javax.annotation.Nullable + private List errors; + + public static final String SERIALIZED_NAME_META = "meta"; + @SerializedName(SERIALIZED_NAME_META) + @javax.annotation.Nullable + private MetaModel meta; + + public BaseResponseAnalysisStagesResponse() { + } + + public BaseResponseAnalysisStagesResponse status(@javax.annotation.Nullable Boolean status) { + this.status = status; + return this; + } + + /** + * Response status on whether the request succeeded + * @return status + */ + @javax.annotation.Nullable + public Boolean getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable Boolean status) { + this.status = status; + } + + + public BaseResponseAnalysisStagesResponse data(@javax.annotation.Nullable AnalysisStagesResponse data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nullable + public AnalysisStagesResponse getData() { + return data; + } + + public void setData(@javax.annotation.Nullable AnalysisStagesResponse data) { + this.data = data; + } + + + public BaseResponseAnalysisStagesResponse message(@javax.annotation.Nullable String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + */ + @javax.annotation.Nullable + public String getMessage() { + return message; + } + + public void setMessage(@javax.annotation.Nullable String message) { + this.message = message; + } + + + public BaseResponseAnalysisStagesResponse errors(@javax.annotation.Nullable List errors) { + this.errors = errors; + return this; + } + + public BaseResponseAnalysisStagesResponse addErrorsItem(ErrorModel errorsItem) { + if (this.errors == null) { + this.errors = new ArrayList<>(); + } + this.errors.add(errorsItem); + return this; + } + + /** + * Get errors + * @return errors + */ + @javax.annotation.Nullable + public List getErrors() { + return errors; + } + + public void setErrors(@javax.annotation.Nullable List errors) { + this.errors = errors; + } + + + public BaseResponseAnalysisStagesResponse meta(@javax.annotation.Nullable MetaModel meta) { + this.meta = meta; + return this; + } + + /** + * Metadata + * @return meta + */ + @javax.annotation.Nullable + public MetaModel getMeta() { + return meta; + } + + public void setMeta(@javax.annotation.Nullable MetaModel meta) { + this.meta = meta; + } + + /** + * 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 BaseResponseAnalysisStagesResponse instance itself + */ + public BaseResponseAnalysisStagesResponse 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; + } + BaseResponseAnalysisStagesResponse baseResponseAnalysisStagesResponse = (BaseResponseAnalysisStagesResponse) o; + return Objects.equals(this.status, baseResponseAnalysisStagesResponse.status) && + Objects.equals(this.data, baseResponseAnalysisStagesResponse.data) && + Objects.equals(this.message, baseResponseAnalysisStagesResponse.message) && + Objects.equals(this.errors, baseResponseAnalysisStagesResponse.errors) && + Objects.equals(this.meta, baseResponseAnalysisStagesResponse.meta)&& + Objects.equals(this.additionalProperties, baseResponseAnalysisStagesResponse.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(status, data, message, errors, meta, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BaseResponseAnalysisStagesResponse {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); + sb.append(" meta: ").append(toIndentedString(meta)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("status", "data", "message", "errors", "meta")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * 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 BaseResponseAnalysisStagesResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BaseResponseAnalysisStagesResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in BaseResponseAnalysisStagesResponse is not found in the empty JSON string", BaseResponseAnalysisStagesResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + AnalysisStagesResponse.validateJsonElement(jsonObj.get("data")); + } + if ((jsonObj.get("message") != null && !jsonObj.get("message").isJsonNull()) && !jsonObj.get("message").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); + } + if (jsonObj.get("errors") != null && !jsonObj.get("errors").isJsonNull()) { + JsonArray jsonArrayerrors = jsonObj.getAsJsonArray("errors"); + if (jsonArrayerrors != null) { + // ensure the json data is an array + if (!jsonObj.get("errors").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `errors` to be an array in the JSON string but got `%s`", jsonObj.get("errors").toString())); + } + + // validate the optional field `errors` (array) + for (int i = 0; i < jsonArrayerrors.size(); i++) { + ErrorModel.validateJsonElement(jsonArrayerrors.get(i)); + }; + } + } + // validate the optional field `meta` + if (jsonObj.get("meta") != null && !jsonObj.get("meta").isJsonNull()) { + MetaModel.validateJsonElement(jsonObj.get("meta")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BaseResponseAnalysisStagesResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BaseResponseAnalysisStagesResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BaseResponseAnalysisStagesResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BaseResponseAnalysisStagesResponse 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 BaseResponseAnalysisStagesResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + BaseResponseAnalysisStagesResponse instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BaseResponseAnalysisStagesResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of BaseResponseAnalysisStagesResponse + * @throws IOException if the JSON string is invalid with respect to BaseResponseAnalysisStagesResponse + */ + public static BaseResponseAnalysisStagesResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BaseResponseAnalysisStagesResponse.class); + } + + /** + * Convert an instance of BaseResponseAnalysisStagesResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/BaseResponsePipelineStatusResponse.java b/src/main/java/ai/reveng/model/BaseResponsePipelineStatusResponse.java new file mode 100644 index 0000000..2e41aaa --- /dev/null +++ b/src/main/java/ai/reveng/model/BaseResponsePipelineStatusResponse.java @@ -0,0 +1,438 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import ai.reveng.model.ErrorModel; +import ai.reveng.model.MetaModel; +import ai.reveng.model.PipelineStatusResponse; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * BaseResponsePipelineStatusResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class BaseResponsePipelineStatusResponse { + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private Boolean status = true; + + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nullable + private PipelineStatusResponse data; + + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + @javax.annotation.Nullable + private String message; + + public static final String SERIALIZED_NAME_ERRORS = "errors"; + @SerializedName(SERIALIZED_NAME_ERRORS) + @javax.annotation.Nullable + private List errors; + + public static final String SERIALIZED_NAME_META = "meta"; + @SerializedName(SERIALIZED_NAME_META) + @javax.annotation.Nullable + private MetaModel meta; + + public BaseResponsePipelineStatusResponse() { + } + + public BaseResponsePipelineStatusResponse status(@javax.annotation.Nullable Boolean status) { + this.status = status; + return this; + } + + /** + * Response status on whether the request succeeded + * @return status + */ + @javax.annotation.Nullable + public Boolean getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable Boolean status) { + this.status = status; + } + + + public BaseResponsePipelineStatusResponse data(@javax.annotation.Nullable PipelineStatusResponse data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nullable + public PipelineStatusResponse getData() { + return data; + } + + public void setData(@javax.annotation.Nullable PipelineStatusResponse data) { + this.data = data; + } + + + public BaseResponsePipelineStatusResponse message(@javax.annotation.Nullable String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + */ + @javax.annotation.Nullable + public String getMessage() { + return message; + } + + public void setMessage(@javax.annotation.Nullable String message) { + this.message = message; + } + + + public BaseResponsePipelineStatusResponse errors(@javax.annotation.Nullable List errors) { + this.errors = errors; + return this; + } + + public BaseResponsePipelineStatusResponse addErrorsItem(ErrorModel errorsItem) { + if (this.errors == null) { + this.errors = new ArrayList<>(); + } + this.errors.add(errorsItem); + return this; + } + + /** + * Get errors + * @return errors + */ + @javax.annotation.Nullable + public List getErrors() { + return errors; + } + + public void setErrors(@javax.annotation.Nullable List errors) { + this.errors = errors; + } + + + public BaseResponsePipelineStatusResponse meta(@javax.annotation.Nullable MetaModel meta) { + this.meta = meta; + return this; + } + + /** + * Metadata + * @return meta + */ + @javax.annotation.Nullable + public MetaModel getMeta() { + return meta; + } + + public void setMeta(@javax.annotation.Nullable MetaModel meta) { + this.meta = meta; + } + + /** + * 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 BaseResponsePipelineStatusResponse instance itself + */ + public BaseResponsePipelineStatusResponse 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; + } + BaseResponsePipelineStatusResponse baseResponsePipelineStatusResponse = (BaseResponsePipelineStatusResponse) o; + return Objects.equals(this.status, baseResponsePipelineStatusResponse.status) && + Objects.equals(this.data, baseResponsePipelineStatusResponse.data) && + Objects.equals(this.message, baseResponsePipelineStatusResponse.message) && + Objects.equals(this.errors, baseResponsePipelineStatusResponse.errors) && + Objects.equals(this.meta, baseResponsePipelineStatusResponse.meta)&& + Objects.equals(this.additionalProperties, baseResponsePipelineStatusResponse.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(status, data, message, errors, meta, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BaseResponsePipelineStatusResponse {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); + sb.append(" meta: ").append(toIndentedString(meta)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("status", "data", "message", "errors", "meta")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * 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 BaseResponsePipelineStatusResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BaseResponsePipelineStatusResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in BaseResponsePipelineStatusResponse is not found in the empty JSON string", BaseResponsePipelineStatusResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + PipelineStatusResponse.validateJsonElement(jsonObj.get("data")); + } + if ((jsonObj.get("message") != null && !jsonObj.get("message").isJsonNull()) && !jsonObj.get("message").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); + } + if (jsonObj.get("errors") != null && !jsonObj.get("errors").isJsonNull()) { + JsonArray jsonArrayerrors = jsonObj.getAsJsonArray("errors"); + if (jsonArrayerrors != null) { + // ensure the json data is an array + if (!jsonObj.get("errors").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `errors` to be an array in the JSON string but got `%s`", jsonObj.get("errors").toString())); + } + + // validate the optional field `errors` (array) + for (int i = 0; i < jsonArrayerrors.size(); i++) { + ErrorModel.validateJsonElement(jsonArrayerrors.get(i)); + }; + } + } + // validate the optional field `meta` + if (jsonObj.get("meta") != null && !jsonObj.get("meta").isJsonNull()) { + MetaModel.validateJsonElement(jsonObj.get("meta")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BaseResponsePipelineStatusResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BaseResponsePipelineStatusResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BaseResponsePipelineStatusResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BaseResponsePipelineStatusResponse 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 BaseResponsePipelineStatusResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + BaseResponsePipelineStatusResponse instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BaseResponsePipelineStatusResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of BaseResponsePipelineStatusResponse + * @throws IOException if the JSON string is invalid with respect to BaseResponsePipelineStatusResponse + */ + public static BaseResponsePipelineStatusResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BaseResponsePipelineStatusResponse.class); + } + + /** + * Convert an instance of BaseResponsePipelineStatusResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/PipelineStageStatus.java b/src/main/java/ai/reveng/model/PipelineStageStatus.java new file mode 100644 index 0000000..71033f7 --- /dev/null +++ b/src/main/java/ai/reveng/model/PipelineStageStatus.java @@ -0,0 +1,85 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import java.util.Locale; +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Gets or Sets PipelineStageStatus + */ +@JsonAdapter(PipelineStageStatus.Adapter.class) +public enum PipelineStageStatus { + + PENDING("PENDING"), + + QUEUED("QUEUED"), + + STARTED("STARTED"), + + FINISHED("FINISHED"), + + ERROR("ERROR"); + + private String value; + + PipelineStageStatus(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static PipelineStageStatus fromValue(String value) { + for (PipelineStageStatus b : PipelineStageStatus.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final PipelineStageStatus enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public PipelineStageStatus read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return PipelineStageStatus.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + PipelineStageStatus.fromValue(value); + } +} + diff --git a/src/main/java/ai/reveng/model/PipelineStatusResponse.java b/src/main/java/ai/reveng/model/PipelineStatusResponse.java new file mode 100644 index 0000000..5704b58 --- /dev/null +++ b/src/main/java/ai/reveng/model/PipelineStatusResponse.java @@ -0,0 +1,312 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import ai.reveng.model.StageStatus; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * PipelineStatusResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PipelineStatusResponse { + public static final String SERIALIZED_NAME_STAGES = "stages"; + @SerializedName(SERIALIZED_NAME_STAGES) + @javax.annotation.Nonnull + private List stages = new ArrayList<>(); + + public PipelineStatusResponse() { + } + + public PipelineStatusResponse stages(@javax.annotation.Nonnull List stages) { + this.stages = stages; + return this; + } + + public PipelineStatusResponse addStagesItem(StageStatus stagesItem) { + if (this.stages == null) { + this.stages = new ArrayList<>(); + } + this.stages.add(stagesItem); + return this; + } + + /** + * Get stages + * @return stages + */ + @javax.annotation.Nonnull + public List getStages() { + return stages; + } + + public void setStages(@javax.annotation.Nonnull List stages) { + this.stages = stages; + } + + /** + * 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 PipelineStatusResponse instance itself + */ + public PipelineStatusResponse 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; + } + PipelineStatusResponse pipelineStatusResponse = (PipelineStatusResponse) o; + return Objects.equals(this.stages, pipelineStatusResponse.stages)&& + Objects.equals(this.additionalProperties, pipelineStatusResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(stages, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PipelineStatusResponse {\n"); + sb.append(" stages: ").append(toIndentedString(stages)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("stages")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("stages")); + } + + /** + * 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 PipelineStatusResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PipelineStatusResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in PipelineStatusResponse is not found in the empty JSON string", PipelineStatusResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PipelineStatusResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("stages").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `stages` to be an array in the JSON string but got `%s`", jsonObj.get("stages").toString())); + } + + JsonArray jsonArraystages = jsonObj.getAsJsonArray("stages"); + // validate the required field `stages` (array) + for (int i = 0; i < jsonArraystages.size(); i++) { + StageStatus.validateJsonElement(jsonArraystages.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PipelineStatusResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PipelineStatusResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PipelineStatusResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PipelineStatusResponse 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 PipelineStatusResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PipelineStatusResponse instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PipelineStatusResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of PipelineStatusResponse + * @throws IOException if the JSON string is invalid with respect to PipelineStatusResponse + */ + public static PipelineStatusResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PipelineStatusResponse.class); + } + + /** + * Convert an instance of PipelineStatusResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/StageEvent.java b/src/main/java/ai/reveng/model/StageEvent.java new file mode 100644 index 0000000..e601538 --- /dev/null +++ b/src/main/java/ai/reveng/model/StageEvent.java @@ -0,0 +1,352 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import ai.reveng.model.AnalysisStage; +import ai.reveng.model.AnalysisStageStatus; +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 java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * StageEvent + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class StageEvent { + public static final String SERIALIZED_NAME_STAGE = "stage"; + @SerializedName(SERIALIZED_NAME_STAGE) + @javax.annotation.Nonnull + private AnalysisStage stage; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull + private AnalysisStageStatus status; + + public static final String SERIALIZED_NAME_TIMESTAMP = "timestamp"; + @SerializedName(SERIALIZED_NAME_TIMESTAMP) + @javax.annotation.Nonnull + private String timestamp; + + public StageEvent() { + } + + public StageEvent stage(@javax.annotation.Nonnull AnalysisStage stage) { + this.stage = stage; + return this; + } + + /** + * Get stage + * @return stage + */ + @javax.annotation.Nonnull + public AnalysisStage getStage() { + return stage; + } + + public void setStage(@javax.annotation.Nonnull AnalysisStage stage) { + this.stage = stage; + } + + + public StageEvent status(@javax.annotation.Nonnull AnalysisStageStatus status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nonnull + public AnalysisStageStatus getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nonnull AnalysisStageStatus status) { + this.status = status; + } + + + public StageEvent timestamp(@javax.annotation.Nonnull String timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Get timestamp + * @return timestamp + */ + @javax.annotation.Nonnull + public String getTimestamp() { + return timestamp; + } + + public void setTimestamp(@javax.annotation.Nonnull String timestamp) { + this.timestamp = timestamp; + } + + /** + * 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 StageEvent instance itself + */ + public StageEvent 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; + } + StageEvent stageEvent = (StageEvent) o; + return Objects.equals(this.stage, stageEvent.stage) && + Objects.equals(this.status, stageEvent.status) && + Objects.equals(this.timestamp, stageEvent.timestamp)&& + Objects.equals(this.additionalProperties, stageEvent.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(stage, status, timestamp, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StageEvent {\n"); + sb.append(" stage: ").append(toIndentedString(stage)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("stage", "status", "timestamp")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("stage", "status", "timestamp")); + } + + /** + * 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 StageEvent + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!StageEvent.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in StageEvent is not found in the empty JSON string", StageEvent.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : StageEvent.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `stage` + AnalysisStage.validateJsonElement(jsonObj.get("stage")); + // validate the required field `status` + AnalysisStageStatus.validateJsonElement(jsonObj.get("status")); + if (!jsonObj.get("timestamp").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `timestamp` to be a primitive type in the JSON string but got `%s`", jsonObj.get("timestamp").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!StageEvent.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StageEvent' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(StageEvent.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, StageEvent 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 StageEvent read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + StageEvent instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of StageEvent given an JSON string + * + * @param jsonString JSON string + * @return An instance of StageEvent + * @throws IOException if the JSON string is invalid with respect to StageEvent + */ + public static StageEvent fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StageEvent.class); + } + + /** + * Convert an instance of StageEvent to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/StageStatus.java b/src/main/java/ai/reveng/model/StageStatus.java new file mode 100644 index 0000000..e979cca --- /dev/null +++ b/src/main/java/ai/reveng/model/StageStatus.java @@ -0,0 +1,349 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import ai.reveng.model.AnalysisStage; +import ai.reveng.model.PipelineStageStatus; +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 java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * StageStatus + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class StageStatus { + public static final String SERIALIZED_NAME_STAGE = "stage"; + @SerializedName(SERIALIZED_NAME_STAGE) + @javax.annotation.Nonnull + private AnalysisStage stage; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull + private PipelineStageStatus status; + + public static final String SERIALIZED_NAME_NUM_AHEAD = "num_ahead"; + @SerializedName(SERIALIZED_NAME_NUM_AHEAD) + @javax.annotation.Nonnull + private Integer numAhead; + + public StageStatus() { + } + + public StageStatus stage(@javax.annotation.Nonnull AnalysisStage stage) { + this.stage = stage; + return this; + } + + /** + * Get stage + * @return stage + */ + @javax.annotation.Nonnull + public AnalysisStage getStage() { + return stage; + } + + public void setStage(@javax.annotation.Nonnull AnalysisStage stage) { + this.stage = stage; + } + + + public StageStatus status(@javax.annotation.Nonnull PipelineStageStatus status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nonnull + public PipelineStageStatus getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nonnull PipelineStageStatus status) { + this.status = status; + } + + + public StageStatus numAhead(@javax.annotation.Nonnull Integer numAhead) { + this.numAhead = numAhead; + return this; + } + + /** + * Get numAhead + * @return numAhead + */ + @javax.annotation.Nonnull + public Integer getNumAhead() { + return numAhead; + } + + public void setNumAhead(@javax.annotation.Nonnull Integer numAhead) { + this.numAhead = numAhead; + } + + /** + * 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 StageStatus instance itself + */ + public StageStatus 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; + } + StageStatus stageStatus = (StageStatus) o; + return Objects.equals(this.stage, stageStatus.stage) && + Objects.equals(this.status, stageStatus.status) && + Objects.equals(this.numAhead, stageStatus.numAhead)&& + Objects.equals(this.additionalProperties, stageStatus.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(stage, status, numAhead, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StageStatus {\n"); + sb.append(" stage: ").append(toIndentedString(stage)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" numAhead: ").append(toIndentedString(numAhead)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("stage", "status", "num_ahead")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("stage", "status", "num_ahead")); + } + + /** + * 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 StageStatus + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!StageStatus.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in StageStatus is not found in the empty JSON string", StageStatus.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : StageStatus.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `stage` + AnalysisStage.validateJsonElement(jsonObj.get("stage")); + // validate the required field `status` + PipelineStageStatus.validateJsonElement(jsonObj.get("status")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!StageStatus.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StageStatus' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(StageStatus.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, StageStatus 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 StageStatus read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + StageStatus instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of StageStatus given an JSON string + * + * @param jsonString JSON string + * @return An instance of StageStatus + * @throws IOException if the JSON string is invalid with respect to StageStatus + */ + public static StageStatus fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StageStatus.class); + } + + /** + * Convert an instance of StageStatus to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} +