diff --git a/.sdk-version b/.sdk-version index 0217dae..75a91e0 100644 --- a/.sdk-version +++ b/.sdk-version @@ -1 +1 @@ -v3.67.0 +v3.70.0 diff --git a/README.md b/README.md index 24ebd9a..a3714cd 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Add this dependency to your project's POM: ai.reveng sdk - 3.67.0 + 3.70.0 compile ``` @@ -31,7 +31,7 @@ repositories { } dependencies { - implementation "ai.reveng:sdk:3.67.0" + implementation "ai.reveng:sdk:3.70.0" } ``` @@ -76,6 +76,15 @@ All URIs are relative to *https://api.reveng.ai* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- +*AgentApi* | [**checkCapabilitiesTaskStatusV2AnalysesAnalysisIdAgentCapabilitiesStatusGet**](docs/AgentApi.md#checkCapabilitiesTaskStatusV2AnalysesAnalysisIdAgentCapabilitiesStatusGet) | **GET** /v2/analyses/{analysis_id}/agent/capabilities/status | Check the status of a capabilities analysis workflow +*AgentApi* | [**checkReportAnalysisTaskStatusV2AnalysesAnalysisIdAgentReportAnalysisStatusGet**](docs/AgentApi.md#checkReportAnalysisTaskStatusV2AnalysesAnalysisIdAgentReportAnalysisStatusGet) | **GET** /v2/analyses/{analysis_id}/agent/report-analysis/status | Check the status of a report analysis workflow +*AgentApi* | [**checkTriageTaskStatusV2AnalysesAnalysisIdAgentTriageStatusGet**](docs/AgentApi.md#checkTriageTaskStatusV2AnalysesAnalysisIdAgentTriageStatusGet) | **GET** /v2/analyses/{analysis_id}/agent/triage/status | Check the status of a triage analysis workflow +*AgentApi* | [**createCapabilitiesTaskV2AnalysesAnalysisIdAgentCapabilitiesPost**](docs/AgentApi.md#createCapabilitiesTaskV2AnalysesAnalysisIdAgentCapabilitiesPost) | **POST** /v2/analyses/{analysis_id}/agent/capabilities | Queues a capabilities analysis workflow process +*AgentApi* | [**createReportAnalysisTaskV2AnalysesAnalysisIdAgentReportAnalysisPost**](docs/AgentApi.md#createReportAnalysisTaskV2AnalysesAnalysisIdAgentReportAnalysisPost) | **POST** /v2/analyses/{analysis_id}/agent/report-analysis | Queues a combined report analysis workflow process +*AgentApi* | [**createTriageTaskV2AnalysesAnalysisIdAgentTriagePost**](docs/AgentApi.md#createTriageTaskV2AnalysesAnalysisIdAgentTriagePost) | **POST** /v2/analyses/{analysis_id}/agent/triage | Queues a triage analysis workflow process +*AgentApi* | [**getCapabilitiesResultV2AnalysesAnalysisIdAgentCapabilitiesGet**](docs/AgentApi.md#getCapabilitiesResultV2AnalysesAnalysisIdAgentCapabilitiesGet) | **GET** /v2/analyses/{analysis_id}/agent/capabilities | Get Capabilities Result +*AgentApi* | [**getReportAnalysisResultV2AnalysesAnalysisIdAgentReportAnalysisGet**](docs/AgentApi.md#getReportAnalysisResultV2AnalysesAnalysisIdAgentReportAnalysisGet) | **GET** /v2/analyses/{analysis_id}/agent/report-analysis | Get Report Analysis Result +*AgentApi* | [**getTriageResultV2AnalysesAnalysisIdAgentTriageGet**](docs/AgentApi.md#getTriageResultV2AnalysesAnalysisIdAgentTriageGet) | **GET** /v2/analyses/{analysis_id}/agent/triage | Get Triage Result *AnalysesCommentsApi* | [**createAnalysisComment**](docs/AnalysesCommentsApi.md#createAnalysisComment) | **POST** /v2/analyses/{analysis_id}/comments | Create a comment for this analysis *AnalysesCommentsApi* | [**deleteAnalysisComment**](docs/AnalysesCommentsApi.md#deleteAnalysisComment) | **DELETE** /v2/analyses/{analysis_id}/comments/{comment_id} | Delete a comment *AnalysesCommentsApi* | [**getAnalysisComments**](docs/AnalysesCommentsApi.md#getAnalysisComments) | **GET** /v2/analyses/{analysis_id}/comments | Get comments for this analysis @@ -212,11 +221,13 @@ Class | Method | HTTP request | Description - [AnalysisUpdateRequest](docs/AnalysisUpdateRequest.md) - [AnalysisUpdateTagsRequest](docs/AnalysisUpdateTagsRequest.md) - [AnalysisUpdateTagsResponse](docs/AnalysisUpdateTagsResponse.md) + - [AppApiRestV2AgentSchemaCapability](docs/AppApiRestV2AgentSchemaCapability.md) - [AppApiRestV2AnalysesEnumsDynamicExecutionStatus](docs/AppApiRestV2AnalysesEnumsDynamicExecutionStatus.md) - [AppApiRestV2AnalysesEnumsOrderBy](docs/AppApiRestV2AnalysesEnumsOrderBy.md) - [AppApiRestV2CollectionsEnumsOrderBy](docs/AppApiRestV2CollectionsEnumsOrderBy.md) - [AppApiRestV2FunctionsResponsesFunction](docs/AppApiRestV2FunctionsResponsesFunction.md) - [AppApiRestV2FunctionsTypesFunction](docs/AppApiRestV2FunctionsTypesFunction.md) + - [AppApiRestV2InfoTypesCapability](docs/AppApiRestV2InfoTypesCapability.md) - [AppServicesDynamicExecutionSchemasDynamicExecutionStatus](docs/AppServicesDynamicExecutionSchemasDynamicExecutionStatus.md) - [Argument](docs/Argument.md) - [AutoRunAgents](docs/AutoRunAgents.md) @@ -244,6 +255,7 @@ Class | Method | HTTP request | Description - [BaseResponseBool](docs/BaseResponseBool.md) - [BaseResponseCalleesCallerFunctionsResponse](docs/BaseResponseCalleesCallerFunctionsResponse.md) - [BaseResponseCapabilities](docs/BaseResponseCapabilities.md) + - [BaseResponseCapabilitiesAgentResponse](docs/BaseResponseCapabilitiesAgentResponse.md) - [BaseResponseChildBinariesResponse](docs/BaseResponseChildBinariesResponse.md) - [BaseResponseCollectionBinariesUpdateResponse](docs/BaseResponseCollectionBinariesUpdateResponse.md) - [BaseResponseCollectionResponse](docs/BaseResponseCollectionResponse.md) @@ -284,12 +296,16 @@ Class | Method | HTTP request | Description - [BaseResponseProcessDumps](docs/BaseResponseProcessDumps.md) - [BaseResponseProcessRegistry](docs/BaseResponseProcessRegistry.md) - [BaseResponseProcessTree](docs/BaseResponseProcessTree.md) + - [BaseResponseQueuedWorkflowTaskResponse](docs/BaseResponseQueuedWorkflowTaskResponse.md) - [BaseResponseRecent](docs/BaseResponseRecent.md) + - [BaseResponseReportAnalysisResponse](docs/BaseResponseReportAnalysisResponse.md) - [BaseResponseStatus](docs/BaseResponseStatus.md) - [BaseResponseStr](docs/BaseResponseStr.md) - [BaseResponseTTPS](docs/BaseResponseTTPS.md) - [BaseResponseTagSearchResponse](docs/BaseResponseTagSearchResponse.md) - [BaseResponseTaskResponse](docs/BaseResponseTaskResponse.md) + - [BaseResponseTaskStatusResponse](docs/BaseResponseTaskStatusResponse.md) + - [BaseResponseTriageReportResponse](docs/BaseResponseTriageReportResponse.md) - [BaseResponseUnionGetAiDecompilationRatingResponseNoneType](docs/BaseResponseUnionGetAiDecompilationRatingResponseNoneType.md) - [BaseResponseUploadResponse](docs/BaseResponseUploadResponse.md) - [BaseResponseVulnerabilities](docs/BaseResponseVulnerabilities.md) @@ -304,12 +320,13 @@ Class | Method | HTTP request | Description - [BinaryExternalsResponse](docs/BinaryExternalsResponse.md) - [BinarySearchResponse](docs/BinarySearchResponse.md) - [BinarySearchResult](docs/BinarySearchResult.md) + - [BinaryTaskStatus](docs/BinaryTaskStatus.md) - [BulkDeleteAnalysesRequest](docs/BulkDeleteAnalysesRequest.md) - [CalleeFunctionInfo](docs/CalleeFunctionInfo.md) - [CalleesCallerFunctionsResponse](docs/CalleesCallerFunctionsResponse.md) - [CallerFunctionInfo](docs/CallerFunctionInfo.md) - [Capabilities](docs/Capabilities.md) - - [Capability](docs/Capability.md) + - [CapabilitiesAgentResponse](docs/CapabilitiesAgentResponse.md) - [ChildBinariesResponse](docs/ChildBinariesResponse.md) - [CodeSignatureModel](docs/CodeSignatureModel.md) - [CollectionBinariesUpdateRequest](docs/CollectionBinariesUpdateRequest.md) @@ -396,6 +413,7 @@ Class | Method | HTTP request | Description - [GetMeResponse](docs/GetMeResponse.md) - [GetPublicUserResponse](docs/GetPublicUserResponse.md) - [GlobalVariable](docs/GlobalVariable.md) + - [IOC](docs/IOC.md) - [ISA](docs/ISA.md) - [IconModel](docs/IconModel.md) - [ImportModel](docs/ImportModel.md) @@ -407,6 +425,7 @@ Class | Method | HTTP request | Description - [LoginRequest](docs/LoginRequest.md) - [LoginResponse](docs/LoginResponse.md) - [Logs](docs/Logs.md) + - [MITRETechnique](docs/MITRETechnique.md) - [MatchedFunction](docs/MatchedFunction.md) - [MatchedFunctionSuggestion](docs/MatchedFunctionSuggestion.md) - [MetaModel](docs/MetaModel.md) @@ -434,10 +453,12 @@ Class | Method | HTTP request | Description - [ProcessRegistry](docs/ProcessRegistry.md) - [ProcessTree](docs/ProcessTree.md) - [PutAnalysisStringsRequest](docs/PutAnalysisStringsRequest.md) + - [QueuedWorkflowTaskResponse](docs/QueuedWorkflowTaskResponse.md) - [ReAnalysisForm](docs/ReAnalysisForm.md) - [Recent](docs/Recent.md) - [Registry](docs/Registry.md) - [RelativeBinaryResponse](docs/RelativeBinaryResponse.md) + - [ReportAnalysisResponse](docs/ReportAnalysisResponse.md) - [SBOM](docs/SBOM.md) - [SBOMPackage](docs/SBOMPackage.md) - [SandboxOptions](docs/SandboxOptions.md) @@ -472,7 +493,10 @@ Class | Method | HTTP request | Description - [TagSearchResult](docs/TagSearchResult.md) - [TaskResponse](docs/TaskResponse.md) - [TaskStatus](docs/TaskStatus.md) + - [TaskStatusResponse](docs/TaskStatusResponse.md) - [TimestampModel](docs/TimestampModel.md) + - [TriageFunctionResponse](docs/TriageFunctionResponse.md) + - [TriageReportResponse](docs/TriageReportResponse.md) - [TypeDefinition](docs/TypeDefinition.md) - [UpdateFunctionDataTypes](docs/UpdateFunctionDataTypes.md) - [UploadFileType](docs/UploadFileType.md) diff --git a/build.gradle b/build.gradle index bddbc4c..7109947 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,7 @@ apply plugin: 'java' apply plugin: 'com.diffplug.spotless' group = 'ai.reveng' -version = '3.67.0' +version = '3.70.0' @@ -171,7 +171,7 @@ mavenPublishing { publishToMavenCentral(true) signAllPublications() - coordinates("ai.reveng", "sdk", "3.67.0") + coordinates("ai.reveng", "sdk", "3.70.0") pom { name = "sdk" diff --git a/build.sbt b/build.sbt index 8bcd76e..7e081cf 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.67.0", + version := "3.70.0", scalaVersion := "2.11.12", scalacOptions ++= Seq("-feature"), compile / javacOptions ++= Seq("-Xlint:deprecation"), diff --git a/docs/AgentApi.md b/docs/AgentApi.md new file mode 100644 index 0000000..5b90fbc --- /dev/null +++ b/docs/AgentApi.md @@ -0,0 +1,630 @@ +# AgentApi + +All URIs are relative to *https://api.reveng.ai* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**checkCapabilitiesTaskStatusV2AnalysesAnalysisIdAgentCapabilitiesStatusGet**](AgentApi.md#checkCapabilitiesTaskStatusV2AnalysesAnalysisIdAgentCapabilitiesStatusGet) | **GET** /v2/analyses/{analysis_id}/agent/capabilities/status | Check the status of a capabilities analysis workflow | +| [**checkReportAnalysisTaskStatusV2AnalysesAnalysisIdAgentReportAnalysisStatusGet**](AgentApi.md#checkReportAnalysisTaskStatusV2AnalysesAnalysisIdAgentReportAnalysisStatusGet) | **GET** /v2/analyses/{analysis_id}/agent/report-analysis/status | Check the status of a report analysis workflow | +| [**checkTriageTaskStatusV2AnalysesAnalysisIdAgentTriageStatusGet**](AgentApi.md#checkTriageTaskStatusV2AnalysesAnalysisIdAgentTriageStatusGet) | **GET** /v2/analyses/{analysis_id}/agent/triage/status | Check the status of a triage analysis workflow | +| [**createCapabilitiesTaskV2AnalysesAnalysisIdAgentCapabilitiesPost**](AgentApi.md#createCapabilitiesTaskV2AnalysesAnalysisIdAgentCapabilitiesPost) | **POST** /v2/analyses/{analysis_id}/agent/capabilities | Queues a capabilities analysis workflow process | +| [**createReportAnalysisTaskV2AnalysesAnalysisIdAgentReportAnalysisPost**](AgentApi.md#createReportAnalysisTaskV2AnalysesAnalysisIdAgentReportAnalysisPost) | **POST** /v2/analyses/{analysis_id}/agent/report-analysis | Queues a combined report analysis workflow process | +| [**createTriageTaskV2AnalysesAnalysisIdAgentTriagePost**](AgentApi.md#createTriageTaskV2AnalysesAnalysisIdAgentTriagePost) | **POST** /v2/analyses/{analysis_id}/agent/triage | Queues a triage analysis workflow process | +| [**getCapabilitiesResultV2AnalysesAnalysisIdAgentCapabilitiesGet**](AgentApi.md#getCapabilitiesResultV2AnalysesAnalysisIdAgentCapabilitiesGet) | **GET** /v2/analyses/{analysis_id}/agent/capabilities | Get Capabilities Result | +| [**getReportAnalysisResultV2AnalysesAnalysisIdAgentReportAnalysisGet**](AgentApi.md#getReportAnalysisResultV2AnalysesAnalysisIdAgentReportAnalysisGet) | **GET** /v2/analyses/{analysis_id}/agent/report-analysis | Get Report Analysis Result | +| [**getTriageResultV2AnalysesAnalysisIdAgentTriageGet**](AgentApi.md#getTriageResultV2AnalysesAnalysisIdAgentTriageGet) | **GET** /v2/analyses/{analysis_id}/agent/triage | Get Triage Result | + + + +# **checkCapabilitiesTaskStatusV2AnalysesAnalysisIdAgentCapabilitiesStatusGet** +> TaskStatusResponse checkCapabilitiesTaskStatusV2AnalysesAnalysisIdAgentCapabilitiesStatusGet(analysisId) + +Check the status of a capabilities analysis workflow + +### 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.AgentApi; + +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"); + + AgentApi apiInstance = new AgentApi(defaultClient); + Integer analysisId = 56; // Integer | + try { + TaskStatusResponse result = apiInstance.checkCapabilitiesTaskStatusV2AnalysesAnalysisIdAgentCapabilitiesStatusGet(analysisId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AgentApi#checkCapabilitiesTaskStatusV2AnalysesAnalysisIdAgentCapabilitiesStatusGet"); + 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 + +[**TaskStatusResponse**](TaskStatusResponse.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 | - | + + +# **checkReportAnalysisTaskStatusV2AnalysesAnalysisIdAgentReportAnalysisStatusGet** +> TaskStatusResponse checkReportAnalysisTaskStatusV2AnalysesAnalysisIdAgentReportAnalysisStatusGet(analysisId) + +Check the status of a report analysis workflow + +### 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.AgentApi; + +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"); + + AgentApi apiInstance = new AgentApi(defaultClient); + Integer analysisId = 56; // Integer | + try { + TaskStatusResponse result = apiInstance.checkReportAnalysisTaskStatusV2AnalysesAnalysisIdAgentReportAnalysisStatusGet(analysisId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AgentApi#checkReportAnalysisTaskStatusV2AnalysesAnalysisIdAgentReportAnalysisStatusGet"); + 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 + +[**TaskStatusResponse**](TaskStatusResponse.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 | - | + + +# **checkTriageTaskStatusV2AnalysesAnalysisIdAgentTriageStatusGet** +> TaskStatusResponse checkTriageTaskStatusV2AnalysesAnalysisIdAgentTriageStatusGet(analysisId) + +Check the status of a triage analysis workflow + +### 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.AgentApi; + +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"); + + AgentApi apiInstance = new AgentApi(defaultClient); + Integer analysisId = 56; // Integer | + try { + TaskStatusResponse result = apiInstance.checkTriageTaskStatusV2AnalysesAnalysisIdAgentTriageStatusGet(analysisId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AgentApi#checkTriageTaskStatusV2AnalysesAnalysisIdAgentTriageStatusGet"); + 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 + +[**TaskStatusResponse**](TaskStatusResponse.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 | - | + + +# **createCapabilitiesTaskV2AnalysesAnalysisIdAgentCapabilitiesPost** +> BaseResponseQueuedWorkflowTaskResponse createCapabilitiesTaskV2AnalysesAnalysisIdAgentCapabilitiesPost(analysisId) + +Queues a capabilities analysis workflow process + +### 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.AgentApi; + +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"); + + AgentApi apiInstance = new AgentApi(defaultClient); + Integer analysisId = 56; // Integer | + try { + BaseResponseQueuedWorkflowTaskResponse result = apiInstance.createCapabilitiesTaskV2AnalysesAnalysisIdAgentCapabilitiesPost(analysisId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AgentApi#createCapabilitiesTaskV2AnalysesAnalysisIdAgentCapabilitiesPost"); + 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 + +[**BaseResponseQueuedWorkflowTaskResponse**](BaseResponseQueuedWorkflowTaskResponse.md) + +### Authorization + +[APIKey](../README.md#APIKey) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **202** | Successful Response | - | +| **422** | Invalid request parameters | - | + + +# **createReportAnalysisTaskV2AnalysesAnalysisIdAgentReportAnalysisPost** +> QueuedWorkflowTaskResponse createReportAnalysisTaskV2AnalysesAnalysisIdAgentReportAnalysisPost(analysisId) + +Queues a combined report analysis workflow process + +### 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.AgentApi; + +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"); + + AgentApi apiInstance = new AgentApi(defaultClient); + Integer analysisId = 56; // Integer | + try { + QueuedWorkflowTaskResponse result = apiInstance.createReportAnalysisTaskV2AnalysesAnalysisIdAgentReportAnalysisPost(analysisId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AgentApi#createReportAnalysisTaskV2AnalysesAnalysisIdAgentReportAnalysisPost"); + 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 + +[**QueuedWorkflowTaskResponse**](QueuedWorkflowTaskResponse.md) + +### Authorization + +[APIKey](../README.md#APIKey) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **202** | Successful Response | - | +| **422** | Invalid request parameters | - | +| **409** | Task already completed or queued | - | + + +# **createTriageTaskV2AnalysesAnalysisIdAgentTriagePost** +> BaseResponseQueuedWorkflowTaskResponse createTriageTaskV2AnalysesAnalysisIdAgentTriagePost(analysisId) + +Queues a triage analysis workflow process + +### 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.AgentApi; + +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"); + + AgentApi apiInstance = new AgentApi(defaultClient); + Integer analysisId = 56; // Integer | + try { + BaseResponseQueuedWorkflowTaskResponse result = apiInstance.createTriageTaskV2AnalysesAnalysisIdAgentTriagePost(analysisId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AgentApi#createTriageTaskV2AnalysesAnalysisIdAgentTriagePost"); + 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 + +[**BaseResponseQueuedWorkflowTaskResponse**](BaseResponseQueuedWorkflowTaskResponse.md) + +### Authorization + +[APIKey](../README.md#APIKey) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **202** | Successful Response | - | +| **422** | Invalid request parameters | - | + + +# **getCapabilitiesResultV2AnalysesAnalysisIdAgentCapabilitiesGet** +> BaseResponseCapabilitiesAgentResponse getCapabilitiesResultV2AnalysesAnalysisIdAgentCapabilitiesGet(analysisId) + +Get Capabilities Result + +### 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.AgentApi; + +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"); + + AgentApi apiInstance = new AgentApi(defaultClient); + Integer analysisId = 56; // Integer | + try { + BaseResponseCapabilitiesAgentResponse result = apiInstance.getCapabilitiesResultV2AnalysesAnalysisIdAgentCapabilitiesGet(analysisId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AgentApi#getCapabilitiesResultV2AnalysesAnalysisIdAgentCapabilitiesGet"); + 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 + +[**BaseResponseCapabilitiesAgentResponse**](BaseResponseCapabilitiesAgentResponse.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 | - | + + +# **getReportAnalysisResultV2AnalysesAnalysisIdAgentReportAnalysisGet** +> BaseResponseReportAnalysisResponse getReportAnalysisResultV2AnalysesAnalysisIdAgentReportAnalysisGet(analysisId) + +Get Report Analysis Result + +### 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.AgentApi; + +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"); + + AgentApi apiInstance = new AgentApi(defaultClient); + Integer analysisId = 56; // Integer | + try { + BaseResponseReportAnalysisResponse result = apiInstance.getReportAnalysisResultV2AnalysesAnalysisIdAgentReportAnalysisGet(analysisId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AgentApi#getReportAnalysisResultV2AnalysesAnalysisIdAgentReportAnalysisGet"); + 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 + +[**BaseResponseReportAnalysisResponse**](BaseResponseReportAnalysisResponse.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 | - | + + +# **getTriageResultV2AnalysesAnalysisIdAgentTriageGet** +> BaseResponseTriageReportResponse getTriageResultV2AnalysesAnalysisIdAgentTriageGet(analysisId) + +Get Triage Result + +### 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.AgentApi; + +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"); + + AgentApi apiInstance = new AgentApi(defaultClient); + Integer analysisId = 56; // Integer | + try { + BaseResponseTriageReportResponse result = apiInstance.getTriageResultV2AnalysesAnalysisIdAgentTriageGet(analysisId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AgentApi#getTriageResultV2AnalysesAnalysisIdAgentTriageGet"); + 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 + +[**BaseResponseTriageReportResponse**](BaseResponseTriageReportResponse.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/AppApiRestV2AgentSchemaCapability.md b/docs/AppApiRestV2AgentSchemaCapability.md new file mode 100644 index 0000000..bc5f563 --- /dev/null +++ b/docs/AppApiRestV2AgentSchemaCapability.md @@ -0,0 +1,34 @@ + + +# AppApiRestV2AgentSchemaCapability + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**functionVaddr** | **String** | Vaddr of the function containing the capability | | +|**description** | **String** | Description of the capability | | +|**capability** | **String** | Name of the capability | | +|**type** | [**TypeEnum**](#TypeEnum) | Type of the capability | | +|**functionName** | **String** | Name of the function containing the capability | | +|**functionId** | **Integer** | ID of the function containing the capability | | + + + +## Enum: TypeEnum + +| Name | Value | +|---- | -----| +| EXECUTE | "Execute" | +| CRYPTO | "Crypto" | +| NETWORK | "Network" | +| FILES | "Files" | +| MEMORY | "Memory" | +| STRING | "String" | +| ENVIRONMENT | "Environment" | +| FILE_HEADER | "File Header" | +| OTHER | "Other" | + + + diff --git a/docs/Capability.md b/docs/AppApiRestV2InfoTypesCapability.md similarity index 92% rename from docs/Capability.md rename to docs/AppApiRestV2InfoTypesCapability.md index 8ea31df..8014713 100644 --- a/docs/Capability.md +++ b/docs/AppApiRestV2InfoTypesCapability.md @@ -1,6 +1,6 @@ -# Capability +# AppApiRestV2InfoTypesCapability ## Properties diff --git a/docs/BaseResponseCapabilitiesAgentResponse.md b/docs/BaseResponseCapabilitiesAgentResponse.md new file mode 100644 index 0000000..8ac1ff1 --- /dev/null +++ b/docs/BaseResponseCapabilitiesAgentResponse.md @@ -0,0 +1,17 @@ + + +# BaseResponseCapabilitiesAgentResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **Boolean** | Response status on whether the request succeeded | [optional] | +|**data** | [**CapabilitiesAgentResponse**](CapabilitiesAgentResponse.md) | | [optional] | +|**message** | **String** | | [optional] | +|**errors** | [**List<ErrorModel>**](ErrorModel.md) | | [optional] | +|**meta** | [**MetaModel**](MetaModel.md) | Metadata | [optional] | + + + diff --git a/docs/BaseResponseQueuedWorkflowTaskResponse.md b/docs/BaseResponseQueuedWorkflowTaskResponse.md new file mode 100644 index 0000000..1fff1b2 --- /dev/null +++ b/docs/BaseResponseQueuedWorkflowTaskResponse.md @@ -0,0 +1,17 @@ + + +# BaseResponseQueuedWorkflowTaskResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **Boolean** | Response status on whether the request succeeded | [optional] | +|**data** | [**QueuedWorkflowTaskResponse**](QueuedWorkflowTaskResponse.md) | | [optional] | +|**message** | **String** | | [optional] | +|**errors** | [**List<ErrorModel>**](ErrorModel.md) | | [optional] | +|**meta** | [**MetaModel**](MetaModel.md) | Metadata | [optional] | + + + diff --git a/docs/BaseResponseReportAnalysisResponse.md b/docs/BaseResponseReportAnalysisResponse.md new file mode 100644 index 0000000..1369341 --- /dev/null +++ b/docs/BaseResponseReportAnalysisResponse.md @@ -0,0 +1,17 @@ + + +# BaseResponseReportAnalysisResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **Boolean** | Response status on whether the request succeeded | [optional] | +|**data** | [**ReportAnalysisResponse**](ReportAnalysisResponse.md) | | [optional] | +|**message** | **String** | | [optional] | +|**errors** | [**List<ErrorModel>**](ErrorModel.md) | | [optional] | +|**meta** | [**MetaModel**](MetaModel.md) | Metadata | [optional] | + + + diff --git a/docs/BaseResponseTaskStatusResponse.md b/docs/BaseResponseTaskStatusResponse.md new file mode 100644 index 0000000..bc72e9e --- /dev/null +++ b/docs/BaseResponseTaskStatusResponse.md @@ -0,0 +1,17 @@ + + +# BaseResponseTaskStatusResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **Boolean** | Response status on whether the request succeeded | [optional] | +|**data** | [**TaskStatusResponse**](TaskStatusResponse.md) | | [optional] | +|**message** | **String** | | [optional] | +|**errors** | [**List<ErrorModel>**](ErrorModel.md) | | [optional] | +|**meta** | [**MetaModel**](MetaModel.md) | Metadata | [optional] | + + + diff --git a/docs/BaseResponseTriageReportResponse.md b/docs/BaseResponseTriageReportResponse.md new file mode 100644 index 0000000..62c2e89 --- /dev/null +++ b/docs/BaseResponseTriageReportResponse.md @@ -0,0 +1,17 @@ + + +# BaseResponseTriageReportResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **Boolean** | Response status on whether the request succeeded | [optional] | +|**data** | [**TriageReportResponse**](TriageReportResponse.md) | | [optional] | +|**message** | **String** | | [optional] | +|**errors** | [**List<ErrorModel>**](ErrorModel.md) | | [optional] | +|**meta** | [**MetaModel**](MetaModel.md) | Metadata | [optional] | + + + diff --git a/docs/BinaryTaskStatus.md b/docs/BinaryTaskStatus.md new file mode 100644 index 0000000..a5cb003 --- /dev/null +++ b/docs/BinaryTaskStatus.md @@ -0,0 +1,19 @@ + + +# BinaryTaskStatus + +## Enum + + +* `UNINITIALISED` (value: `"UNINITIALISED"`) + +* `PENDING` (value: `"PENDING"`) + +* `RUNNING` (value: `"RUNNING"`) + +* `COMPLETED` (value: `"COMPLETED"`) + +* `FAILED` (value: `"FAILED"`) + + + diff --git a/docs/Capabilities.md b/docs/Capabilities.md index 815f01b..750d320 100644 --- a/docs/Capabilities.md +++ b/docs/Capabilities.md @@ -7,7 +7,7 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| -|**capabilities** | [**List<Capability>**](Capability.md) | List of capabilities for a given analysis | | +|**capabilities** | [**List<AppApiRestV2InfoTypesCapability>**](AppApiRestV2InfoTypesCapability.md) | List of capabilities for a given analysis | | diff --git a/docs/CapabilitiesAgentResponse.md b/docs/CapabilitiesAgentResponse.md new file mode 100644 index 0000000..a59296d --- /dev/null +++ b/docs/CapabilitiesAgentResponse.md @@ -0,0 +1,13 @@ + + +# CapabilitiesAgentResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**capabilities** | [**List<AppApiRestV2AgentSchemaCapability>**](AppApiRestV2AgentSchemaCapability.md) | List of enriched capability data | | + + + diff --git a/docs/IOC.md b/docs/IOC.md new file mode 100644 index 0000000..0c5175f --- /dev/null +++ b/docs/IOC.md @@ -0,0 +1,48 @@ + + +# IOC + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**type** | [**TypeEnum**](#TypeEnum) | Type of the IOC | | +|**value** | **String** | Value of the IOC | | +|**description** | **String** | Description of the IOC | | +|**source** | **String** | | [optional] | +|**functionId** | **Integer** | | [optional] | +|**functionName** | **String** | | [optional] | + + + +## Enum: TypeEnum + +| Name | Value | +|---- | -----| +| IP | "ip" | +| DOMAIN | "domain" | +| URL | "url" | +| USERNAMES | "usernames" | +| PASSWORDS | "passwords" | +| FILE_HASH | "file_hash" | +| MUTEX | "mutex" | +| REGISTRY_KEY | "registry_key" | +| FILENAME | "filename" | +| EMAIL | "email" | +| C2_ENDPOINT | "c2_endpoint" | +| USER_AGENT | "user_agent" | +| PEM_KEY | "pem_key" | +| SSH_KEY | "ssh_key" | +| NETWORK_PORT | "network_port" | +| JA3 | "ja3" | +| SSL_CERT_FINGERPRINT | "ssl_cert_fingerprint" | +| HTTP_HEADER | "http_header" | +| SERVICE | "service" | +| SCHEDULED_TASK | "scheduled_task" | +| PE_HEADER | "pe_header" | +| ENTROPY | "entropy" | +| OTHER | "other" | + + + diff --git a/docs/MITRETechnique.md b/docs/MITRETechnique.md new file mode 100644 index 0000000..7c66e7c --- /dev/null +++ b/docs/MITRETechnique.md @@ -0,0 +1,22 @@ + + +# MITRETechnique + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**startAddr** | **String** | Starting address of the technique | | +|**endAddr** | **String** | Ending address of the technique | | +|**functionAddr** | **String** | Function address where the technique is found | | +|**techniqueId** | **String** | MITRE technique identifier | | +|**techniqueName** | **String** | Name of the MITRE technique | | +|**description** | **String** | Description of the technique | | +|**functionId** | **Integer** | Unique identifier of the function containing the technique | | +|**functionName** | **String** | Name of the function containing the technique | | +|**techniqueUrl** | **String** | URL to the MITRE ATT&CK technique page | | +|**techniqueDescription** | **String** | Full description of the MITRE technique from ATT&CK | | + + + diff --git a/docs/QueuedWorkflowTaskResponse.md b/docs/QueuedWorkflowTaskResponse.md new file mode 100644 index 0000000..e371e56 --- /dev/null +++ b/docs/QueuedWorkflowTaskResponse.md @@ -0,0 +1,13 @@ + + +# QueuedWorkflowTaskResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**taskId** | **String** | | | + + + diff --git a/docs/ReportAnalysisResponse.md b/docs/ReportAnalysisResponse.md new file mode 100644 index 0000000..f12e02c --- /dev/null +++ b/docs/ReportAnalysisResponse.md @@ -0,0 +1,32 @@ + + +# ReportAnalysisResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**summary** | **String** | A markdown summary of the report | | +|**softwareType** | [**SoftwareTypeEnum**](#SoftwareTypeEnum) | The type of software being analyzed | | +|**totalNumberOfFunctions** | **Integer** | The total number of functions identified in the binary | | +|**numberOfAnalysedFunctions** | **Integer** | The number of functions that were analyzed in the binary | | +|**attackFlowSummary** | **String** | A summary in markdown format of the attack flow | | +|**ioCs** | [**List<IOC>**](IOC.md) | A list of IOCs (Indicators of Compromise) found in the analysis | | +|**executableTechniques** | [**List<MITRETechnique>**](MITRETechnique.md) | A series of MITRE Techniques found | | +|**yaraRule** | **String** | The YARA rule generated for the binary | | + + + +## Enum: SoftwareTypeEnum + +| Name | Value | +|---- | -----| +| MALICIOUS | "Malicious" | +| BENIGN | "Benign" | +| POTENTIALLY_UNWANTED_APPLICATION_PUA_ | "Potentially Unwanted Application (PUA)" | +| LEGITIMATE | "Legitimate" | +| BACKDOORED_LEGITIMATE_SOFTWARE | "Backdoored Legitimate Software" | + + + diff --git a/docs/TaskStatusResponse.md b/docs/TaskStatusResponse.md new file mode 100644 index 0000000..883898f --- /dev/null +++ b/docs/TaskStatusResponse.md @@ -0,0 +1,13 @@ + + +# TaskStatusResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **BinaryTaskStatus** | | | + + + diff --git a/docs/TriageFunctionResponse.md b/docs/TriageFunctionResponse.md new file mode 100644 index 0000000..c6535ec --- /dev/null +++ b/docs/TriageFunctionResponse.md @@ -0,0 +1,35 @@ + + +# TriageFunctionResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Integer** | Unique identifier of the function | | +|**address** | **Integer** | Address of the function in the binary | | +|**summary** | **String** | Summary of the function's behaviour | | +|**score** | **BigDecimal** | Score indicating the function's relevance | | +|**capabilities** | [**List<CapabilitiesEnum>**](#List<CapabilitiesEnum>) | List of capabilities exhibited by the function | | + + + +## Enum: List<CapabilitiesEnum> + +| Name | Value | +|---- | -----| +| PACKING_AND_OBFUSCATION | "packing_and_obfuscation" | +| DEFENSE_EVASION | "defense_evasion" | +| PRIVILEGE_ESCALATION | "privilege_escalation" | +| PERSISTENCE_MECHANISMS | "persistence_mechanisms" | +| DISCOVERY_AND_RECONNAISSANCE | "discovery_and_reconnaissance" | +| CREDENTIAL_AND_DATA_COLLECTION | "credential_and_data_collection" | +| COMMUNICATION_AND_C2 | "communication_and_c2" | +| CRYPTOGRAPHIC_OPERATIONS | "cryptographic_operations" | +| PROCESS_AND_MEMORY_MANIPULATION | "process_and_memory_manipulation" | +| PROCESS_AND_COMMAND_EXECUTION | "process_and_command_execution" | +| FILE_ACTIVITY | "file_activity" | + + + diff --git a/docs/TriageReportResponse.md b/docs/TriageReportResponse.md new file mode 100644 index 0000000..bb2f34f --- /dev/null +++ b/docs/TriageReportResponse.md @@ -0,0 +1,15 @@ + + +# TriageReportResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**softwareScore** | **BigDecimal** | Overall triage score for the software | | +|**summary** | **String** | Summary of the triage analysis | | +|**functions** | [**List<TriageFunctionResponse>**](TriageFunctionResponse.md) | List of triaged functions | | + + + diff --git a/pom.xml b/pom.xml index 73f241f..6612286 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ sdk jar sdk - 3.67.0 + 3.70.0 https://github.com/RevEngAI/sdk-java Java SDK for the RevEng.AI API diff --git a/src/main/java/ai/reveng/api/AgentApi.java b/src/main/java/ai/reveng/api/AgentApi.java new file mode 100644 index 0000000..4f37e7d --- /dev/null +++ b/src/main/java/ai/reveng/api/AgentApi.java @@ -0,0 +1,1264 @@ +/* + * 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.BaseResponseCapabilitiesAgentResponse; +import ai.reveng.model.BaseResponseQueuedWorkflowTaskResponse; +import ai.reveng.model.BaseResponseReportAnalysisResponse; +import ai.reveng.model.BaseResponseTriageReportResponse; +import ai.reveng.model.ErrorModel; +import ai.reveng.model.QueuedWorkflowTaskResponse; +import ai.reveng.model.TaskStatusResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class AgentApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public AgentApi() { + this(Configuration.getDefaultApiClient()); + } + + public AgentApi(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 checkCapabilitiesTaskStatusV2AnalysesAnalysisIdAgentCapabilitiesStatusGet + * @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 checkCapabilitiesTaskStatusV2AnalysesAnalysisIdAgentCapabilitiesStatusGetCall(@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/analyses/{analysis_id}/agent/capabilities/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 checkCapabilitiesTaskStatusV2AnalysesAnalysisIdAgentCapabilitiesStatusGetValidateBeforeCall(@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 checkCapabilitiesTaskStatusV2AnalysesAnalysisIdAgentCapabilitiesStatusGet(Async)"); + } + + return checkCapabilitiesTaskStatusV2AnalysesAnalysisIdAgentCapabilitiesStatusGetCall(analysisId, _callback); + + } + + /** + * Check the status of a capabilities analysis workflow + * + * @param analysisId (required) + * @return TaskStatusResponse + * @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 TaskStatusResponse checkCapabilitiesTaskStatusV2AnalysesAnalysisIdAgentCapabilitiesStatusGet(@javax.annotation.Nonnull Integer analysisId) throws ApiException { + ApiResponse localVarResp = checkCapabilitiesTaskStatusV2AnalysesAnalysisIdAgentCapabilitiesStatusGetWithHttpInfo(analysisId); + return localVarResp.getData(); + } + + /** + * Check the status of a capabilities analysis workflow + * + * @param analysisId (required) + * @return ApiResponse<TaskStatusResponse> + * @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 checkCapabilitiesTaskStatusV2AnalysesAnalysisIdAgentCapabilitiesStatusGetWithHttpInfo(@javax.annotation.Nonnull Integer analysisId) throws ApiException { + okhttp3.Call localVarCall = checkCapabilitiesTaskStatusV2AnalysesAnalysisIdAgentCapabilitiesStatusGetValidateBeforeCall(analysisId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Check the status of a capabilities analysis workflow (asynchronously) + * + * @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 checkCapabilitiesTaskStatusV2AnalysesAnalysisIdAgentCapabilitiesStatusGetAsync(@javax.annotation.Nonnull Integer analysisId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = checkCapabilitiesTaskStatusV2AnalysesAnalysisIdAgentCapabilitiesStatusGetValidateBeforeCall(analysisId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for checkReportAnalysisTaskStatusV2AnalysesAnalysisIdAgentReportAnalysisStatusGet + * @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 checkReportAnalysisTaskStatusV2AnalysesAnalysisIdAgentReportAnalysisStatusGetCall(@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/analyses/{analysis_id}/agent/report-analysis/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 checkReportAnalysisTaskStatusV2AnalysesAnalysisIdAgentReportAnalysisStatusGetValidateBeforeCall(@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 checkReportAnalysisTaskStatusV2AnalysesAnalysisIdAgentReportAnalysisStatusGet(Async)"); + } + + return checkReportAnalysisTaskStatusV2AnalysesAnalysisIdAgentReportAnalysisStatusGetCall(analysisId, _callback); + + } + + /** + * Check the status of a report analysis workflow + * + * @param analysisId (required) + * @return TaskStatusResponse + * @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 TaskStatusResponse checkReportAnalysisTaskStatusV2AnalysesAnalysisIdAgentReportAnalysisStatusGet(@javax.annotation.Nonnull Integer analysisId) throws ApiException { + ApiResponse localVarResp = checkReportAnalysisTaskStatusV2AnalysesAnalysisIdAgentReportAnalysisStatusGetWithHttpInfo(analysisId); + return localVarResp.getData(); + } + + /** + * Check the status of a report analysis workflow + * + * @param analysisId (required) + * @return ApiResponse<TaskStatusResponse> + * @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 checkReportAnalysisTaskStatusV2AnalysesAnalysisIdAgentReportAnalysisStatusGetWithHttpInfo(@javax.annotation.Nonnull Integer analysisId) throws ApiException { + okhttp3.Call localVarCall = checkReportAnalysisTaskStatusV2AnalysesAnalysisIdAgentReportAnalysisStatusGetValidateBeforeCall(analysisId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Check the status of a report analysis workflow (asynchronously) + * + * @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 checkReportAnalysisTaskStatusV2AnalysesAnalysisIdAgentReportAnalysisStatusGetAsync(@javax.annotation.Nonnull Integer analysisId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = checkReportAnalysisTaskStatusV2AnalysesAnalysisIdAgentReportAnalysisStatusGetValidateBeforeCall(analysisId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for checkTriageTaskStatusV2AnalysesAnalysisIdAgentTriageStatusGet + * @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 checkTriageTaskStatusV2AnalysesAnalysisIdAgentTriageStatusGetCall(@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/analyses/{analysis_id}/agent/triage/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 checkTriageTaskStatusV2AnalysesAnalysisIdAgentTriageStatusGetValidateBeforeCall(@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 checkTriageTaskStatusV2AnalysesAnalysisIdAgentTriageStatusGet(Async)"); + } + + return checkTriageTaskStatusV2AnalysesAnalysisIdAgentTriageStatusGetCall(analysisId, _callback); + + } + + /** + * Check the status of a triage analysis workflow + * + * @param analysisId (required) + * @return TaskStatusResponse + * @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 TaskStatusResponse checkTriageTaskStatusV2AnalysesAnalysisIdAgentTriageStatusGet(@javax.annotation.Nonnull Integer analysisId) throws ApiException { + ApiResponse localVarResp = checkTriageTaskStatusV2AnalysesAnalysisIdAgentTriageStatusGetWithHttpInfo(analysisId); + return localVarResp.getData(); + } + + /** + * Check the status of a triage analysis workflow + * + * @param analysisId (required) + * @return ApiResponse<TaskStatusResponse> + * @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 checkTriageTaskStatusV2AnalysesAnalysisIdAgentTriageStatusGetWithHttpInfo(@javax.annotation.Nonnull Integer analysisId) throws ApiException { + okhttp3.Call localVarCall = checkTriageTaskStatusV2AnalysesAnalysisIdAgentTriageStatusGetValidateBeforeCall(analysisId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Check the status of a triage analysis workflow (asynchronously) + * + * @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 checkTriageTaskStatusV2AnalysesAnalysisIdAgentTriageStatusGetAsync(@javax.annotation.Nonnull Integer analysisId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = checkTriageTaskStatusV2AnalysesAnalysisIdAgentTriageStatusGetValidateBeforeCall(analysisId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for createCapabilitiesTaskV2AnalysesAnalysisIdAgentCapabilitiesPost + * @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
202 Successful Response -
422 Invalid request parameters -
+ */ + public okhttp3.Call createCapabilitiesTaskV2AnalysesAnalysisIdAgentCapabilitiesPostCall(@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/analyses/{analysis_id}/agent/capabilities" + .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, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createCapabilitiesTaskV2AnalysesAnalysisIdAgentCapabilitiesPostValidateBeforeCall(@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 createCapabilitiesTaskV2AnalysesAnalysisIdAgentCapabilitiesPost(Async)"); + } + + return createCapabilitiesTaskV2AnalysesAnalysisIdAgentCapabilitiesPostCall(analysisId, _callback); + + } + + /** + * Queues a capabilities analysis workflow process + * + * @param analysisId (required) + * @return BaseResponseQueuedWorkflowTaskResponse + * @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
202 Successful Response -
422 Invalid request parameters -
+ */ + public BaseResponseQueuedWorkflowTaskResponse createCapabilitiesTaskV2AnalysesAnalysisIdAgentCapabilitiesPost(@javax.annotation.Nonnull Integer analysisId) throws ApiException { + ApiResponse localVarResp = createCapabilitiesTaskV2AnalysesAnalysisIdAgentCapabilitiesPostWithHttpInfo(analysisId); + return localVarResp.getData(); + } + + /** + * Queues a capabilities analysis workflow process + * + * @param analysisId (required) + * @return ApiResponse<BaseResponseQueuedWorkflowTaskResponse> + * @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
202 Successful Response -
422 Invalid request parameters -
+ */ + public ApiResponse createCapabilitiesTaskV2AnalysesAnalysisIdAgentCapabilitiesPostWithHttpInfo(@javax.annotation.Nonnull Integer analysisId) throws ApiException { + okhttp3.Call localVarCall = createCapabilitiesTaskV2AnalysesAnalysisIdAgentCapabilitiesPostValidateBeforeCall(analysisId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Queues a capabilities analysis workflow process (asynchronously) + * + * @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
202 Successful Response -
422 Invalid request parameters -
+ */ + public okhttp3.Call createCapabilitiesTaskV2AnalysesAnalysisIdAgentCapabilitiesPostAsync(@javax.annotation.Nonnull Integer analysisId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createCapabilitiesTaskV2AnalysesAnalysisIdAgentCapabilitiesPostValidateBeforeCall(analysisId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for createReportAnalysisTaskV2AnalysesAnalysisIdAgentReportAnalysisPost + * @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
202 Successful Response -
422 Invalid request parameters -
409 Task already completed or queued -
+ */ + public okhttp3.Call createReportAnalysisTaskV2AnalysesAnalysisIdAgentReportAnalysisPostCall(@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/analyses/{analysis_id}/agent/report-analysis" + .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, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createReportAnalysisTaskV2AnalysesAnalysisIdAgentReportAnalysisPostValidateBeforeCall(@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 createReportAnalysisTaskV2AnalysesAnalysisIdAgentReportAnalysisPost(Async)"); + } + + return createReportAnalysisTaskV2AnalysesAnalysisIdAgentReportAnalysisPostCall(analysisId, _callback); + + } + + /** + * Queues a combined report analysis workflow process + * + * @param analysisId (required) + * @return QueuedWorkflowTaskResponse + * @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
202 Successful Response -
422 Invalid request parameters -
409 Task already completed or queued -
+ */ + public QueuedWorkflowTaskResponse createReportAnalysisTaskV2AnalysesAnalysisIdAgentReportAnalysisPost(@javax.annotation.Nonnull Integer analysisId) throws ApiException { + ApiResponse localVarResp = createReportAnalysisTaskV2AnalysesAnalysisIdAgentReportAnalysisPostWithHttpInfo(analysisId); + return localVarResp.getData(); + } + + /** + * Queues a combined report analysis workflow process + * + * @param analysisId (required) + * @return ApiResponse<QueuedWorkflowTaskResponse> + * @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
202 Successful Response -
422 Invalid request parameters -
409 Task already completed or queued -
+ */ + public ApiResponse createReportAnalysisTaskV2AnalysesAnalysisIdAgentReportAnalysisPostWithHttpInfo(@javax.annotation.Nonnull Integer analysisId) throws ApiException { + okhttp3.Call localVarCall = createReportAnalysisTaskV2AnalysesAnalysisIdAgentReportAnalysisPostValidateBeforeCall(analysisId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Queues a combined report analysis workflow process (asynchronously) + * + * @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
202 Successful Response -
422 Invalid request parameters -
409 Task already completed or queued -
+ */ + public okhttp3.Call createReportAnalysisTaskV2AnalysesAnalysisIdAgentReportAnalysisPostAsync(@javax.annotation.Nonnull Integer analysisId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createReportAnalysisTaskV2AnalysesAnalysisIdAgentReportAnalysisPostValidateBeforeCall(analysisId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for createTriageTaskV2AnalysesAnalysisIdAgentTriagePost + * @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
202 Successful Response -
422 Invalid request parameters -
+ */ + public okhttp3.Call createTriageTaskV2AnalysesAnalysisIdAgentTriagePostCall(@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/analyses/{analysis_id}/agent/triage" + .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, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createTriageTaskV2AnalysesAnalysisIdAgentTriagePostValidateBeforeCall(@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 createTriageTaskV2AnalysesAnalysisIdAgentTriagePost(Async)"); + } + + return createTriageTaskV2AnalysesAnalysisIdAgentTriagePostCall(analysisId, _callback); + + } + + /** + * Queues a triage analysis workflow process + * + * @param analysisId (required) + * @return BaseResponseQueuedWorkflowTaskResponse + * @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
202 Successful Response -
422 Invalid request parameters -
+ */ + public BaseResponseQueuedWorkflowTaskResponse createTriageTaskV2AnalysesAnalysisIdAgentTriagePost(@javax.annotation.Nonnull Integer analysisId) throws ApiException { + ApiResponse localVarResp = createTriageTaskV2AnalysesAnalysisIdAgentTriagePostWithHttpInfo(analysisId); + return localVarResp.getData(); + } + + /** + * Queues a triage analysis workflow process + * + * @param analysisId (required) + * @return ApiResponse<BaseResponseQueuedWorkflowTaskResponse> + * @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
202 Successful Response -
422 Invalid request parameters -
+ */ + public ApiResponse createTriageTaskV2AnalysesAnalysisIdAgentTriagePostWithHttpInfo(@javax.annotation.Nonnull Integer analysisId) throws ApiException { + okhttp3.Call localVarCall = createTriageTaskV2AnalysesAnalysisIdAgentTriagePostValidateBeforeCall(analysisId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Queues a triage analysis workflow process (asynchronously) + * + * @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
202 Successful Response -
422 Invalid request parameters -
+ */ + public okhttp3.Call createTriageTaskV2AnalysesAnalysisIdAgentTriagePostAsync(@javax.annotation.Nonnull Integer analysisId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createTriageTaskV2AnalysesAnalysisIdAgentTriagePostValidateBeforeCall(analysisId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getCapabilitiesResultV2AnalysesAnalysisIdAgentCapabilitiesGet + * @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 getCapabilitiesResultV2AnalysesAnalysisIdAgentCapabilitiesGetCall(@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/analyses/{analysis_id}/agent/capabilities" + .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 getCapabilitiesResultV2AnalysesAnalysisIdAgentCapabilitiesGetValidateBeforeCall(@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 getCapabilitiesResultV2AnalysesAnalysisIdAgentCapabilitiesGet(Async)"); + } + + return getCapabilitiesResultV2AnalysesAnalysisIdAgentCapabilitiesGetCall(analysisId, _callback); + + } + + /** + * Get Capabilities Result + * + * @param analysisId (required) + * @return BaseResponseCapabilitiesAgentResponse + * @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 BaseResponseCapabilitiesAgentResponse getCapabilitiesResultV2AnalysesAnalysisIdAgentCapabilitiesGet(@javax.annotation.Nonnull Integer analysisId) throws ApiException { + ApiResponse localVarResp = getCapabilitiesResultV2AnalysesAnalysisIdAgentCapabilitiesGetWithHttpInfo(analysisId); + return localVarResp.getData(); + } + + /** + * Get Capabilities Result + * + * @param analysisId (required) + * @return ApiResponse<BaseResponseCapabilitiesAgentResponse> + * @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 getCapabilitiesResultV2AnalysesAnalysisIdAgentCapabilitiesGetWithHttpInfo(@javax.annotation.Nonnull Integer analysisId) throws ApiException { + okhttp3.Call localVarCall = getCapabilitiesResultV2AnalysesAnalysisIdAgentCapabilitiesGetValidateBeforeCall(analysisId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Capabilities Result (asynchronously) + * + * @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 getCapabilitiesResultV2AnalysesAnalysisIdAgentCapabilitiesGetAsync(@javax.annotation.Nonnull Integer analysisId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getCapabilitiesResultV2AnalysesAnalysisIdAgentCapabilitiesGetValidateBeforeCall(analysisId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getReportAnalysisResultV2AnalysesAnalysisIdAgentReportAnalysisGet + * @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 getReportAnalysisResultV2AnalysesAnalysisIdAgentReportAnalysisGetCall(@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/analyses/{analysis_id}/agent/report-analysis" + .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 getReportAnalysisResultV2AnalysesAnalysisIdAgentReportAnalysisGetValidateBeforeCall(@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 getReportAnalysisResultV2AnalysesAnalysisIdAgentReportAnalysisGet(Async)"); + } + + return getReportAnalysisResultV2AnalysesAnalysisIdAgentReportAnalysisGetCall(analysisId, _callback); + + } + + /** + * Get Report Analysis Result + * + * @param analysisId (required) + * @return BaseResponseReportAnalysisResponse + * @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 BaseResponseReportAnalysisResponse getReportAnalysisResultV2AnalysesAnalysisIdAgentReportAnalysisGet(@javax.annotation.Nonnull Integer analysisId) throws ApiException { + ApiResponse localVarResp = getReportAnalysisResultV2AnalysesAnalysisIdAgentReportAnalysisGetWithHttpInfo(analysisId); + return localVarResp.getData(); + } + + /** + * Get Report Analysis Result + * + * @param analysisId (required) + * @return ApiResponse<BaseResponseReportAnalysisResponse> + * @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 getReportAnalysisResultV2AnalysesAnalysisIdAgentReportAnalysisGetWithHttpInfo(@javax.annotation.Nonnull Integer analysisId) throws ApiException { + okhttp3.Call localVarCall = getReportAnalysisResultV2AnalysesAnalysisIdAgentReportAnalysisGetValidateBeforeCall(analysisId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Report Analysis Result (asynchronously) + * + * @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 getReportAnalysisResultV2AnalysesAnalysisIdAgentReportAnalysisGetAsync(@javax.annotation.Nonnull Integer analysisId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getReportAnalysisResultV2AnalysesAnalysisIdAgentReportAnalysisGetValidateBeforeCall(analysisId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getTriageResultV2AnalysesAnalysisIdAgentTriageGet + * @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 getTriageResultV2AnalysesAnalysisIdAgentTriageGetCall(@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/analyses/{analysis_id}/agent/triage" + .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 getTriageResultV2AnalysesAnalysisIdAgentTriageGetValidateBeforeCall(@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 getTriageResultV2AnalysesAnalysisIdAgentTriageGet(Async)"); + } + + return getTriageResultV2AnalysesAnalysisIdAgentTriageGetCall(analysisId, _callback); + + } + + /** + * Get Triage Result + * + * @param analysisId (required) + * @return BaseResponseTriageReportResponse + * @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 BaseResponseTriageReportResponse getTriageResultV2AnalysesAnalysisIdAgentTriageGet(@javax.annotation.Nonnull Integer analysisId) throws ApiException { + ApiResponse localVarResp = getTriageResultV2AnalysesAnalysisIdAgentTriageGetWithHttpInfo(analysisId); + return localVarResp.getData(); + } + + /** + * Get Triage Result + * + * @param analysisId (required) + * @return ApiResponse<BaseResponseTriageReportResponse> + * @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 getTriageResultV2AnalysesAnalysisIdAgentTriageGetWithHttpInfo(@javax.annotation.Nonnull Integer analysisId) throws ApiException { + okhttp3.Call localVarCall = getTriageResultV2AnalysesAnalysisIdAgentTriageGetValidateBeforeCall(analysisId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Triage Result (asynchronously) + * + * @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 getTriageResultV2AnalysesAnalysisIdAgentTriageGetAsync(@javax.annotation.Nonnull Integer analysisId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getTriageResultV2AnalysesAnalysisIdAgentTriageGetValidateBeforeCall(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 bfa2b9f..b8c4f08 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.67.0/java"); + setUserAgent("OpenAPI-Generator/3.70.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 8267c7e..fffadfe 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.67.0"; + public static final String VERSION = "3.70.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 450fa58..f56a697 100644 --- a/src/main/java/ai/reveng/invoker/JSON.java +++ b/src/main/java/ai/reveng/invoker/JSON.java @@ -122,8 +122,10 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisUpdateRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisUpdateTagsRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisUpdateTagsResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AppApiRestV2AgentSchemaCapability.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AppApiRestV2FunctionsResponsesFunction.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AppApiRestV2FunctionsTypesFunction.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AppApiRestV2InfoTypesCapability.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AppServicesDynamicExecutionSchemasDynamicExecutionStatus.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Argument.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AutoRunAgents.CustomTypeAdapterFactory()); @@ -151,6 +153,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseBool.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseCalleesCallerFunctionsResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseCapabilities.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseCapabilitiesAgentResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseChildBinariesResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseCollectionBinariesUpdateResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseCollectionResponse.CustomTypeAdapterFactory()); @@ -191,12 +194,16 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseProcessDumps.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseProcessRegistry.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseProcessTree.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseQueuedWorkflowTaskResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseRecent.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseReportAnalysisResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseStatus.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseStr.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseTTPS.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseTagSearchResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseTaskResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseTaskStatusResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseTriageReportResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseUnionGetAiDecompilationRatingResponseNoneType.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseUploadResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseVulnerabilities.CustomTypeAdapterFactory()); @@ -215,7 +222,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CalleesCallerFunctionsResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CallerFunctionInfo.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Capabilities.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Capability.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CapabilitiesAgentResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ChildBinariesResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CodeSignatureModel.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CollectionBinariesUpdateRequest.CustomTypeAdapterFactory()); @@ -296,6 +303,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.GetMeResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.GetPublicUserResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.GlobalVariable.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.IOC.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.IconModel.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ImportModel.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.InsertAnalysisLogRequest.CustomTypeAdapterFactory()); @@ -306,6 +314,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.LoginRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.LoginResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Logs.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.MITRETechnique.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.MatchedFunction.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.MatchedFunctionSuggestion.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.MetaModel.CustomTypeAdapterFactory()); @@ -329,10 +338,12 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ProcessRegistry.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ProcessTree.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.PutAnalysisStringsRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.QueuedWorkflowTaskResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ReAnalysisForm.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Recent.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Registry.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.RelativeBinaryResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ReportAnalysisResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SBOM.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SBOMPackage.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SandboxOptions.CustomTypeAdapterFactory()); @@ -364,7 +375,10 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TagSearchResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TagSearchResult.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TaskResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TaskStatusResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TimestampModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TriageFunctionResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TriageReportResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TypeDefinition.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UpdateFunctionDataTypes.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UploadResponse.CustomTypeAdapterFactory()); diff --git a/src/main/java/ai/reveng/model/AppApiRestV2AgentSchemaCapability.java b/src/main/java/ai/reveng/model/AppApiRestV2AgentSchemaCapability.java new file mode 100644 index 0000000..14deaa6 --- /dev/null +++ b/src/main/java/ai/reveng/model/AppApiRestV2AgentSchemaCapability.java @@ -0,0 +1,504 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import 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; + +/** + * AppApiRestV2AgentSchemaCapability + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AppApiRestV2AgentSchemaCapability { + public static final String SERIALIZED_NAME_FUNCTION_VADDR = "function_vaddr"; + @SerializedName(SERIALIZED_NAME_FUNCTION_VADDR) + @javax.annotation.Nonnull + private String functionVaddr; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nonnull + private String description; + + public static final String SERIALIZED_NAME_CAPABILITY = "capability"; + @SerializedName(SERIALIZED_NAME_CAPABILITY) + @javax.annotation.Nonnull + private String capability; + + /** + * Type of the capability + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + EXECUTE("Execute"), + + CRYPTO("Crypto"), + + NETWORK("Network"), + + FILES("Files"), + + MEMORY("Memory"), + + STRING("String"), + + ENVIRONMENT("Environment"), + + FILE_HEADER("File Header"), + + OTHER("Other"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.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 TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private TypeEnum type; + + public static final String SERIALIZED_NAME_FUNCTION_NAME = "function_name"; + @SerializedName(SERIALIZED_NAME_FUNCTION_NAME) + @javax.annotation.Nonnull + private String functionName; + + public static final String SERIALIZED_NAME_FUNCTION_ID = "function_id"; + @SerializedName(SERIALIZED_NAME_FUNCTION_ID) + @javax.annotation.Nonnull + private Integer functionId; + + public AppApiRestV2AgentSchemaCapability() { + } + + public AppApiRestV2AgentSchemaCapability functionVaddr(@javax.annotation.Nonnull String functionVaddr) { + this.functionVaddr = functionVaddr; + return this; + } + + /** + * Vaddr of the function containing the capability + * @return functionVaddr + */ + @javax.annotation.Nonnull + public String getFunctionVaddr() { + return functionVaddr; + } + + public void setFunctionVaddr(@javax.annotation.Nonnull String functionVaddr) { + this.functionVaddr = functionVaddr; + } + + + public AppApiRestV2AgentSchemaCapability description(@javax.annotation.Nonnull String description) { + this.description = description; + return this; + } + + /** + * Description of the capability + * @return description + */ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nonnull String description) { + this.description = description; + } + + + public AppApiRestV2AgentSchemaCapability capability(@javax.annotation.Nonnull String capability) { + this.capability = capability; + return this; + } + + /** + * Name of the capability + * @return capability + */ + @javax.annotation.Nonnull + public String getCapability() { + return capability; + } + + public void setCapability(@javax.annotation.Nonnull String capability) { + this.capability = capability; + } + + + public AppApiRestV2AgentSchemaCapability type(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + return this; + } + + /** + * Type of the capability + * @return type + */ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + } + + + public AppApiRestV2AgentSchemaCapability functionName(@javax.annotation.Nonnull String functionName) { + this.functionName = functionName; + return this; + } + + /** + * Name of the function containing the capability + * @return functionName + */ + @javax.annotation.Nonnull + public String getFunctionName() { + return functionName; + } + + public void setFunctionName(@javax.annotation.Nonnull String functionName) { + this.functionName = functionName; + } + + + public AppApiRestV2AgentSchemaCapability functionId(@javax.annotation.Nonnull Integer functionId) { + this.functionId = functionId; + return this; + } + + /** + * ID of the function containing the capability + * @return functionId + */ + @javax.annotation.Nonnull + public Integer getFunctionId() { + return functionId; + } + + public void setFunctionId(@javax.annotation.Nonnull Integer functionId) { + this.functionId = functionId; + } + + /** + * 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 AppApiRestV2AgentSchemaCapability instance itself + */ + public AppApiRestV2AgentSchemaCapability 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; + } + AppApiRestV2AgentSchemaCapability appApiRestV2AgentSchemaCapability = (AppApiRestV2AgentSchemaCapability) o; + return Objects.equals(this.functionVaddr, appApiRestV2AgentSchemaCapability.functionVaddr) && + Objects.equals(this.description, appApiRestV2AgentSchemaCapability.description) && + Objects.equals(this.capability, appApiRestV2AgentSchemaCapability.capability) && + Objects.equals(this.type, appApiRestV2AgentSchemaCapability.type) && + Objects.equals(this.functionName, appApiRestV2AgentSchemaCapability.functionName) && + Objects.equals(this.functionId, appApiRestV2AgentSchemaCapability.functionId)&& + Objects.equals(this.additionalProperties, appApiRestV2AgentSchemaCapability.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(functionVaddr, description, capability, type, functionName, functionId, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AppApiRestV2AgentSchemaCapability {\n"); + sb.append(" functionVaddr: ").append(toIndentedString(functionVaddr)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" capability: ").append(toIndentedString(capability)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" functionName: ").append(toIndentedString(functionName)).append("\n"); + sb.append(" functionId: ").append(toIndentedString(functionId)).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("function_vaddr", "description", "capability", "type", "function_name", "function_id")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("function_vaddr", "description", "capability", "type", "function_name", "function_id")); + } + + /** + * 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 AppApiRestV2AgentSchemaCapability + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AppApiRestV2AgentSchemaCapability.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in AppApiRestV2AgentSchemaCapability is not found in the empty JSON string", AppApiRestV2AgentSchemaCapability.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AppApiRestV2AgentSchemaCapability.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("function_vaddr").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `function_vaddr` to be a primitive type in the JSON string but got `%s`", jsonObj.get("function_vaddr").toString())); + } + if (!jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if (!jsonObj.get("capability").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `capability` to be a primitive type in the JSON string but got `%s`", jsonObj.get("capability").toString())); + } + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + if (!jsonObj.get("function_name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `function_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("function_name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AppApiRestV2AgentSchemaCapability.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AppApiRestV2AgentSchemaCapability' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AppApiRestV2AgentSchemaCapability.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AppApiRestV2AgentSchemaCapability 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 AppApiRestV2AgentSchemaCapability read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AppApiRestV2AgentSchemaCapability 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 AppApiRestV2AgentSchemaCapability given an JSON string + * + * @param jsonString JSON string + * @return An instance of AppApiRestV2AgentSchemaCapability + * @throws IOException if the JSON string is invalid with respect to AppApiRestV2AgentSchemaCapability + */ + public static AppApiRestV2AgentSchemaCapability fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AppApiRestV2AgentSchemaCapability.class); + } + + /** + * Convert an instance of AppApiRestV2AgentSchemaCapability to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/Capability.java b/src/main/java/ai/reveng/model/AppApiRestV2InfoTypesCapability.java similarity index 80% rename from src/main/java/ai/reveng/model/Capability.java rename to src/main/java/ai/reveng/model/AppApiRestV2InfoTypesCapability.java index 4792de5..a1e502c 100644 --- a/src/main/java/ai/reveng/model/Capability.java +++ b/src/main/java/ai/reveng/model/AppApiRestV2InfoTypesCapability.java @@ -49,10 +49,10 @@ import ai.reveng.invoker.JSON; /** - * Capability + * AppApiRestV2InfoTypesCapability */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class Capability { +public class AppApiRestV2InfoTypesCapability { public static final String SERIALIZED_NAME_FUNCTION_NAME = "function_name"; @SerializedName(SERIALIZED_NAME_FUNCTION_NAME) @javax.annotation.Nonnull @@ -68,10 +68,10 @@ public class Capability { @javax.annotation.Nonnull private List capabilities = new ArrayList<>(); - public Capability() { + public AppApiRestV2InfoTypesCapability() { } - public Capability functionName(@javax.annotation.Nonnull String functionName) { + public AppApiRestV2InfoTypesCapability functionName(@javax.annotation.Nonnull String functionName) { this.functionName = functionName; return this; } @@ -90,7 +90,7 @@ public void setFunctionName(@javax.annotation.Nonnull String functionName) { } - public Capability functionVaddr(@javax.annotation.Nonnull Long functionVaddr) { + public AppApiRestV2InfoTypesCapability functionVaddr(@javax.annotation.Nonnull Long functionVaddr) { this.functionVaddr = functionVaddr; return this; } @@ -109,12 +109,12 @@ public void setFunctionVaddr(@javax.annotation.Nonnull Long functionVaddr) { } - public Capability capabilities(@javax.annotation.Nonnull List capabilities) { + public AppApiRestV2InfoTypesCapability capabilities(@javax.annotation.Nonnull List capabilities) { this.capabilities = capabilities; return this; } - public Capability addCapabilitiesItem(String capabilitiesItem) { + public AppApiRestV2InfoTypesCapability addCapabilitiesItem(String capabilitiesItem) { if (this.capabilities == null) { this.capabilities = new ArrayList<>(); } @@ -148,9 +148,9 @@ public void setCapabilities(@javax.annotation.Nonnull List capabilities) * * @param key name of the property * @param value value of the property - * @return the Capability instance itself + * @return the AppApiRestV2InfoTypesCapability instance itself */ - public Capability putAdditionalProperty(String key, Object value) { + public AppApiRestV2InfoTypesCapability putAdditionalProperty(String key, Object value) { if (this.additionalProperties == null) { this.additionalProperties = new HashMap(); } @@ -189,11 +189,11 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - Capability capability = (Capability) o; - return Objects.equals(this.functionName, capability.functionName) && - Objects.equals(this.functionVaddr, capability.functionVaddr) && - Objects.equals(this.capabilities, capability.capabilities)&& - Objects.equals(this.additionalProperties, capability.additionalProperties); + AppApiRestV2InfoTypesCapability appApiRestV2InfoTypesCapability = (AppApiRestV2InfoTypesCapability) o; + return Objects.equals(this.functionName, appApiRestV2InfoTypesCapability.functionName) && + Objects.equals(this.functionVaddr, appApiRestV2InfoTypesCapability.functionVaddr) && + Objects.equals(this.capabilities, appApiRestV2InfoTypesCapability.capabilities)&& + Objects.equals(this.additionalProperties, appApiRestV2InfoTypesCapability.additionalProperties); } @Override @@ -204,7 +204,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class Capability {\n"); + sb.append("class AppApiRestV2InfoTypesCapability {\n"); sb.append(" functionName: ").append(toIndentedString(functionName)).append("\n"); sb.append(" functionVaddr: ").append(toIndentedString(functionVaddr)).append("\n"); sb.append(" capabilities: ").append(toIndentedString(capabilities)).append("\n"); @@ -240,17 +240,17 @@ private String toIndentedString(Object o) { * Validates the JSON Element and throws an exception if issues found * * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to Capability + * @throws IOException if the JSON Element is invalid with respect to AppApiRestV2InfoTypesCapability */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { - if (!Capability.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in Capability is not found in the empty JSON string", Capability.openapiRequiredFields.toString())); + if (!AppApiRestV2InfoTypesCapability.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in AppApiRestV2InfoTypesCapability is not found in the empty JSON string", AppApiRestV2InfoTypesCapability.openapiRequiredFields.toString())); } } // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : Capability.openapiRequiredFields) { + for (String requiredField : AppApiRestV2InfoTypesCapability.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())); } @@ -271,16 +271,16 @@ public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!Capability.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Capability' and its subtypes + if (!AppApiRestV2InfoTypesCapability.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AppApiRestV2InfoTypesCapability' and its subtypes } final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Capability.class)); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AppApiRestV2InfoTypesCapability.class)); - return (TypeAdapter) new TypeAdapter() { + return (TypeAdapter) new TypeAdapter() { @Override - public void write(JsonWriter out, Capability value) throws IOException { + public void write(JsonWriter out, AppApiRestV2InfoTypesCapability value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); obj.remove("additionalProperties"); // serialize additional properties @@ -308,12 +308,12 @@ else if (entry.getValue() instanceof Character) } @Override - public Capability read(JsonReader in) throws IOException { + public AppApiRestV2InfoTypesCapability read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); JsonObject jsonObj = jsonElement.getAsJsonObject(); // store additional fields in the deserialized instance - Capability instance = thisAdapter.fromJsonTree(jsonObj); + AppApiRestV2InfoTypesCapability instance = thisAdapter.fromJsonTree(jsonObj); for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type @@ -340,18 +340,18 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } /** - * Create an instance of Capability given an JSON string + * Create an instance of AppApiRestV2InfoTypesCapability given an JSON string * * @param jsonString JSON string - * @return An instance of Capability - * @throws IOException if the JSON string is invalid with respect to Capability + * @return An instance of AppApiRestV2InfoTypesCapability + * @throws IOException if the JSON string is invalid with respect to AppApiRestV2InfoTypesCapability */ - public static Capability fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Capability.class); + public static AppApiRestV2InfoTypesCapability fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AppApiRestV2InfoTypesCapability.class); } /** - * Convert an instance of Capability to an JSON string + * Convert an instance of AppApiRestV2InfoTypesCapability to an JSON string * * @return JSON string */ diff --git a/src/main/java/ai/reveng/model/BaseResponseCapabilitiesAgentResponse.java b/src/main/java/ai/reveng/model/BaseResponseCapabilitiesAgentResponse.java new file mode 100644 index 0000000..1bbe818 --- /dev/null +++ b/src/main/java/ai/reveng/model/BaseResponseCapabilitiesAgentResponse.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.CapabilitiesAgentResponse; +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; + +/** + * BaseResponseCapabilitiesAgentResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class BaseResponseCapabilitiesAgentResponse { + 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 CapabilitiesAgentResponse 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 BaseResponseCapabilitiesAgentResponse() { + } + + public BaseResponseCapabilitiesAgentResponse 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 BaseResponseCapabilitiesAgentResponse data(@javax.annotation.Nullable CapabilitiesAgentResponse data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nullable + public CapabilitiesAgentResponse getData() { + return data; + } + + public void setData(@javax.annotation.Nullable CapabilitiesAgentResponse data) { + this.data = data; + } + + + public BaseResponseCapabilitiesAgentResponse 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 BaseResponseCapabilitiesAgentResponse errors(@javax.annotation.Nullable List errors) { + this.errors = errors; + return this; + } + + public BaseResponseCapabilitiesAgentResponse 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 BaseResponseCapabilitiesAgentResponse 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 BaseResponseCapabilitiesAgentResponse instance itself + */ + public BaseResponseCapabilitiesAgentResponse 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; + } + BaseResponseCapabilitiesAgentResponse baseResponseCapabilitiesAgentResponse = (BaseResponseCapabilitiesAgentResponse) o; + return Objects.equals(this.status, baseResponseCapabilitiesAgentResponse.status) && + Objects.equals(this.data, baseResponseCapabilitiesAgentResponse.data) && + Objects.equals(this.message, baseResponseCapabilitiesAgentResponse.message) && + Objects.equals(this.errors, baseResponseCapabilitiesAgentResponse.errors) && + Objects.equals(this.meta, baseResponseCapabilitiesAgentResponse.meta)&& + Objects.equals(this.additionalProperties, baseResponseCapabilitiesAgentResponse.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 BaseResponseCapabilitiesAgentResponse {\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 BaseResponseCapabilitiesAgentResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BaseResponseCapabilitiesAgentResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in BaseResponseCapabilitiesAgentResponse is not found in the empty JSON string", BaseResponseCapabilitiesAgentResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + CapabilitiesAgentResponse.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 (!BaseResponseCapabilitiesAgentResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BaseResponseCapabilitiesAgentResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BaseResponseCapabilitiesAgentResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BaseResponseCapabilitiesAgentResponse 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 BaseResponseCapabilitiesAgentResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + BaseResponseCapabilitiesAgentResponse 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 BaseResponseCapabilitiesAgentResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of BaseResponseCapabilitiesAgentResponse + * @throws IOException if the JSON string is invalid with respect to BaseResponseCapabilitiesAgentResponse + */ + public static BaseResponseCapabilitiesAgentResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BaseResponseCapabilitiesAgentResponse.class); + } + + /** + * Convert an instance of BaseResponseCapabilitiesAgentResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/BaseResponseQueuedWorkflowTaskResponse.java b/src/main/java/ai/reveng/model/BaseResponseQueuedWorkflowTaskResponse.java new file mode 100644 index 0000000..39fe43c --- /dev/null +++ b/src/main/java/ai/reveng/model/BaseResponseQueuedWorkflowTaskResponse.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.QueuedWorkflowTaskResponse; +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; + +/** + * BaseResponseQueuedWorkflowTaskResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class BaseResponseQueuedWorkflowTaskResponse { + 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 QueuedWorkflowTaskResponse 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 BaseResponseQueuedWorkflowTaskResponse() { + } + + public BaseResponseQueuedWorkflowTaskResponse 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 BaseResponseQueuedWorkflowTaskResponse data(@javax.annotation.Nullable QueuedWorkflowTaskResponse data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nullable + public QueuedWorkflowTaskResponse getData() { + return data; + } + + public void setData(@javax.annotation.Nullable QueuedWorkflowTaskResponse data) { + this.data = data; + } + + + public BaseResponseQueuedWorkflowTaskResponse 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 BaseResponseQueuedWorkflowTaskResponse errors(@javax.annotation.Nullable List errors) { + this.errors = errors; + return this; + } + + public BaseResponseQueuedWorkflowTaskResponse 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 BaseResponseQueuedWorkflowTaskResponse 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 BaseResponseQueuedWorkflowTaskResponse instance itself + */ + public BaseResponseQueuedWorkflowTaskResponse 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; + } + BaseResponseQueuedWorkflowTaskResponse baseResponseQueuedWorkflowTaskResponse = (BaseResponseQueuedWorkflowTaskResponse) o; + return Objects.equals(this.status, baseResponseQueuedWorkflowTaskResponse.status) && + Objects.equals(this.data, baseResponseQueuedWorkflowTaskResponse.data) && + Objects.equals(this.message, baseResponseQueuedWorkflowTaskResponse.message) && + Objects.equals(this.errors, baseResponseQueuedWorkflowTaskResponse.errors) && + Objects.equals(this.meta, baseResponseQueuedWorkflowTaskResponse.meta)&& + Objects.equals(this.additionalProperties, baseResponseQueuedWorkflowTaskResponse.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 BaseResponseQueuedWorkflowTaskResponse {\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 BaseResponseQueuedWorkflowTaskResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BaseResponseQueuedWorkflowTaskResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in BaseResponseQueuedWorkflowTaskResponse is not found in the empty JSON string", BaseResponseQueuedWorkflowTaskResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + QueuedWorkflowTaskResponse.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 (!BaseResponseQueuedWorkflowTaskResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BaseResponseQueuedWorkflowTaskResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BaseResponseQueuedWorkflowTaskResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BaseResponseQueuedWorkflowTaskResponse 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 BaseResponseQueuedWorkflowTaskResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + BaseResponseQueuedWorkflowTaskResponse 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 BaseResponseQueuedWorkflowTaskResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of BaseResponseQueuedWorkflowTaskResponse + * @throws IOException if the JSON string is invalid with respect to BaseResponseQueuedWorkflowTaskResponse + */ + public static BaseResponseQueuedWorkflowTaskResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BaseResponseQueuedWorkflowTaskResponse.class); + } + + /** + * Convert an instance of BaseResponseQueuedWorkflowTaskResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/BaseResponseReportAnalysisResponse.java b/src/main/java/ai/reveng/model/BaseResponseReportAnalysisResponse.java new file mode 100644 index 0000000..f20f6a1 --- /dev/null +++ b/src/main/java/ai/reveng/model/BaseResponseReportAnalysisResponse.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.ReportAnalysisResponse; +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; + +/** + * BaseResponseReportAnalysisResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class BaseResponseReportAnalysisResponse { + 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 ReportAnalysisResponse 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 BaseResponseReportAnalysisResponse() { + } + + public BaseResponseReportAnalysisResponse 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 BaseResponseReportAnalysisResponse data(@javax.annotation.Nullable ReportAnalysisResponse data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nullable + public ReportAnalysisResponse getData() { + return data; + } + + public void setData(@javax.annotation.Nullable ReportAnalysisResponse data) { + this.data = data; + } + + + public BaseResponseReportAnalysisResponse 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 BaseResponseReportAnalysisResponse errors(@javax.annotation.Nullable List errors) { + this.errors = errors; + return this; + } + + public BaseResponseReportAnalysisResponse 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 BaseResponseReportAnalysisResponse 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 BaseResponseReportAnalysisResponse instance itself + */ + public BaseResponseReportAnalysisResponse 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; + } + BaseResponseReportAnalysisResponse baseResponseReportAnalysisResponse = (BaseResponseReportAnalysisResponse) o; + return Objects.equals(this.status, baseResponseReportAnalysisResponse.status) && + Objects.equals(this.data, baseResponseReportAnalysisResponse.data) && + Objects.equals(this.message, baseResponseReportAnalysisResponse.message) && + Objects.equals(this.errors, baseResponseReportAnalysisResponse.errors) && + Objects.equals(this.meta, baseResponseReportAnalysisResponse.meta)&& + Objects.equals(this.additionalProperties, baseResponseReportAnalysisResponse.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 BaseResponseReportAnalysisResponse {\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 BaseResponseReportAnalysisResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BaseResponseReportAnalysisResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in BaseResponseReportAnalysisResponse is not found in the empty JSON string", BaseResponseReportAnalysisResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + ReportAnalysisResponse.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 (!BaseResponseReportAnalysisResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BaseResponseReportAnalysisResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BaseResponseReportAnalysisResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BaseResponseReportAnalysisResponse 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 BaseResponseReportAnalysisResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + BaseResponseReportAnalysisResponse 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 BaseResponseReportAnalysisResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of BaseResponseReportAnalysisResponse + * @throws IOException if the JSON string is invalid with respect to BaseResponseReportAnalysisResponse + */ + public static BaseResponseReportAnalysisResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BaseResponseReportAnalysisResponse.class); + } + + /** + * Convert an instance of BaseResponseReportAnalysisResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/BaseResponseTaskStatusResponse.java b/src/main/java/ai/reveng/model/BaseResponseTaskStatusResponse.java new file mode 100644 index 0000000..db9c40d --- /dev/null +++ b/src/main/java/ai/reveng/model/BaseResponseTaskStatusResponse.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.TaskStatusResponse; +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; + +/** + * BaseResponseTaskStatusResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class BaseResponseTaskStatusResponse { + 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 TaskStatusResponse 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 BaseResponseTaskStatusResponse() { + } + + public BaseResponseTaskStatusResponse 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 BaseResponseTaskStatusResponse data(@javax.annotation.Nullable TaskStatusResponse data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nullable + public TaskStatusResponse getData() { + return data; + } + + public void setData(@javax.annotation.Nullable TaskStatusResponse data) { + this.data = data; + } + + + public BaseResponseTaskStatusResponse 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 BaseResponseTaskStatusResponse errors(@javax.annotation.Nullable List errors) { + this.errors = errors; + return this; + } + + public BaseResponseTaskStatusResponse 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 BaseResponseTaskStatusResponse 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 BaseResponseTaskStatusResponse instance itself + */ + public BaseResponseTaskStatusResponse 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; + } + BaseResponseTaskStatusResponse baseResponseTaskStatusResponse = (BaseResponseTaskStatusResponse) o; + return Objects.equals(this.status, baseResponseTaskStatusResponse.status) && + Objects.equals(this.data, baseResponseTaskStatusResponse.data) && + Objects.equals(this.message, baseResponseTaskStatusResponse.message) && + Objects.equals(this.errors, baseResponseTaskStatusResponse.errors) && + Objects.equals(this.meta, baseResponseTaskStatusResponse.meta)&& + Objects.equals(this.additionalProperties, baseResponseTaskStatusResponse.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 BaseResponseTaskStatusResponse {\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 BaseResponseTaskStatusResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BaseResponseTaskStatusResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in BaseResponseTaskStatusResponse is not found in the empty JSON string", BaseResponseTaskStatusResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + TaskStatusResponse.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 (!BaseResponseTaskStatusResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BaseResponseTaskStatusResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BaseResponseTaskStatusResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BaseResponseTaskStatusResponse 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 BaseResponseTaskStatusResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + BaseResponseTaskStatusResponse 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 BaseResponseTaskStatusResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of BaseResponseTaskStatusResponse + * @throws IOException if the JSON string is invalid with respect to BaseResponseTaskStatusResponse + */ + public static BaseResponseTaskStatusResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BaseResponseTaskStatusResponse.class); + } + + /** + * Convert an instance of BaseResponseTaskStatusResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/BaseResponseTriageReportResponse.java b/src/main/java/ai/reveng/model/BaseResponseTriageReportResponse.java new file mode 100644 index 0000000..bfa894e --- /dev/null +++ b/src/main/java/ai/reveng/model/BaseResponseTriageReportResponse.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.TriageReportResponse; +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; + +/** + * BaseResponseTriageReportResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class BaseResponseTriageReportResponse { + 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 TriageReportResponse 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 BaseResponseTriageReportResponse() { + } + + public BaseResponseTriageReportResponse 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 BaseResponseTriageReportResponse data(@javax.annotation.Nullable TriageReportResponse data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nullable + public TriageReportResponse getData() { + return data; + } + + public void setData(@javax.annotation.Nullable TriageReportResponse data) { + this.data = data; + } + + + public BaseResponseTriageReportResponse 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 BaseResponseTriageReportResponse errors(@javax.annotation.Nullable List errors) { + this.errors = errors; + return this; + } + + public BaseResponseTriageReportResponse 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 BaseResponseTriageReportResponse 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 BaseResponseTriageReportResponse instance itself + */ + public BaseResponseTriageReportResponse 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; + } + BaseResponseTriageReportResponse baseResponseTriageReportResponse = (BaseResponseTriageReportResponse) o; + return Objects.equals(this.status, baseResponseTriageReportResponse.status) && + Objects.equals(this.data, baseResponseTriageReportResponse.data) && + Objects.equals(this.message, baseResponseTriageReportResponse.message) && + Objects.equals(this.errors, baseResponseTriageReportResponse.errors) && + Objects.equals(this.meta, baseResponseTriageReportResponse.meta)&& + Objects.equals(this.additionalProperties, baseResponseTriageReportResponse.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 BaseResponseTriageReportResponse {\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 BaseResponseTriageReportResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BaseResponseTriageReportResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in BaseResponseTriageReportResponse is not found in the empty JSON string", BaseResponseTriageReportResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + TriageReportResponse.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 (!BaseResponseTriageReportResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BaseResponseTriageReportResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BaseResponseTriageReportResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BaseResponseTriageReportResponse 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 BaseResponseTriageReportResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + BaseResponseTriageReportResponse 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 BaseResponseTriageReportResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of BaseResponseTriageReportResponse + * @throws IOException if the JSON string is invalid with respect to BaseResponseTriageReportResponse + */ + public static BaseResponseTriageReportResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BaseResponseTriageReportResponse.class); + } + + /** + * Convert an instance of BaseResponseTriageReportResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/BinaryTaskStatus.java b/src/main/java/ai/reveng/model/BinaryTaskStatus.java new file mode 100644 index 0000000..8fefadc --- /dev/null +++ b/src/main/java/ai/reveng/model/BinaryTaskStatus.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 BinaryTaskStatus + */ +@JsonAdapter(BinaryTaskStatus.Adapter.class) +public enum BinaryTaskStatus { + + UNINITIALISED("UNINITIALISED"), + + PENDING("PENDING"), + + RUNNING("RUNNING"), + + COMPLETED("COMPLETED"), + + FAILED("FAILED"); + + private String value; + + BinaryTaskStatus(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static BinaryTaskStatus fromValue(String value) { + for (BinaryTaskStatus b : BinaryTaskStatus.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 BinaryTaskStatus enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public BinaryTaskStatus read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return BinaryTaskStatus.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + BinaryTaskStatus.fromValue(value); + } +} + diff --git a/src/main/java/ai/reveng/model/Capabilities.java b/src/main/java/ai/reveng/model/Capabilities.java index bba024a..4486d02 100644 --- a/src/main/java/ai/reveng/model/Capabilities.java +++ b/src/main/java/ai/reveng/model/Capabilities.java @@ -14,7 +14,7 @@ import java.util.Objects; import java.util.Locale; -import ai.reveng.model.Capability; +import ai.reveng.model.AppApiRestV2InfoTypesCapability; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -57,17 +57,17 @@ public class Capabilities { public static final String SERIALIZED_NAME_CAPABILITIES = "capabilities"; @SerializedName(SERIALIZED_NAME_CAPABILITIES) @javax.annotation.Nonnull - private List capabilities = new ArrayList<>(); + private List capabilities = new ArrayList<>(); public Capabilities() { } - public Capabilities capabilities(@javax.annotation.Nonnull List capabilities) { + public Capabilities capabilities(@javax.annotation.Nonnull List capabilities) { this.capabilities = capabilities; return this; } - public Capabilities addCapabilitiesItem(Capability capabilitiesItem) { + public Capabilities addCapabilitiesItem(AppApiRestV2InfoTypesCapability capabilitiesItem) { if (this.capabilities == null) { this.capabilities = new ArrayList<>(); } @@ -80,11 +80,11 @@ public Capabilities addCapabilitiesItem(Capability capabilitiesItem) { * @return capabilities */ @javax.annotation.Nonnull - public List getCapabilities() { + public List getCapabilities() { return capabilities; } - public void setCapabilities(@javax.annotation.Nonnull List capabilities) { + public void setCapabilities(@javax.annotation.Nonnull List capabilities) { this.capabilities = capabilities; } @@ -213,7 +213,7 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti JsonArray jsonArraycapabilities = jsonObj.getAsJsonArray("capabilities"); // validate the required field `capabilities` (array) for (int i = 0; i < jsonArraycapabilities.size(); i++) { - Capability.validateJsonElement(jsonArraycapabilities.get(i)); + AppApiRestV2InfoTypesCapability.validateJsonElement(jsonArraycapabilities.get(i)); }; } diff --git a/src/main/java/ai/reveng/model/CapabilitiesAgentResponse.java b/src/main/java/ai/reveng/model/CapabilitiesAgentResponse.java new file mode 100644 index 0000000..8ce1577 --- /dev/null +++ b/src/main/java/ai/reveng/model/CapabilitiesAgentResponse.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.AppApiRestV2AgentSchemaCapability; +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; + +/** + * CapabilitiesAgentResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CapabilitiesAgentResponse { + public static final String SERIALIZED_NAME_CAPABILITIES = "capabilities"; + @SerializedName(SERIALIZED_NAME_CAPABILITIES) + @javax.annotation.Nonnull + private List capabilities = new ArrayList<>(); + + public CapabilitiesAgentResponse() { + } + + public CapabilitiesAgentResponse capabilities(@javax.annotation.Nonnull List capabilities) { + this.capabilities = capabilities; + return this; + } + + public CapabilitiesAgentResponse addCapabilitiesItem(AppApiRestV2AgentSchemaCapability capabilitiesItem) { + if (this.capabilities == null) { + this.capabilities = new ArrayList<>(); + } + this.capabilities.add(capabilitiesItem); + return this; + } + + /** + * List of enriched capability data + * @return capabilities + */ + @javax.annotation.Nonnull + public List getCapabilities() { + return capabilities; + } + + public void setCapabilities(@javax.annotation.Nonnull List capabilities) { + this.capabilities = capabilities; + } + + /** + * 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 CapabilitiesAgentResponse instance itself + */ + public CapabilitiesAgentResponse 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; + } + CapabilitiesAgentResponse capabilitiesAgentResponse = (CapabilitiesAgentResponse) o; + return Objects.equals(this.capabilities, capabilitiesAgentResponse.capabilities)&& + Objects.equals(this.additionalProperties, capabilitiesAgentResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(capabilities, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CapabilitiesAgentResponse {\n"); + sb.append(" capabilities: ").append(toIndentedString(capabilities)).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("capabilities")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("capabilities")); + } + + /** + * 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 CapabilitiesAgentResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CapabilitiesAgentResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in CapabilitiesAgentResponse is not found in the empty JSON string", CapabilitiesAgentResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CapabilitiesAgentResponse.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("capabilities").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `capabilities` to be an array in the JSON string but got `%s`", jsonObj.get("capabilities").toString())); + } + + JsonArray jsonArraycapabilities = jsonObj.getAsJsonArray("capabilities"); + // validate the required field `capabilities` (array) + for (int i = 0; i < jsonArraycapabilities.size(); i++) { + AppApiRestV2AgentSchemaCapability.validateJsonElement(jsonArraycapabilities.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CapabilitiesAgentResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CapabilitiesAgentResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CapabilitiesAgentResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CapabilitiesAgentResponse 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 CapabilitiesAgentResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CapabilitiesAgentResponse 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 CapabilitiesAgentResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of CapabilitiesAgentResponse + * @throws IOException if the JSON string is invalid with respect to CapabilitiesAgentResponse + */ + public static CapabilitiesAgentResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CapabilitiesAgentResponse.class); + } + + /** + * Convert an instance of CapabilitiesAgentResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/IOC.java b/src/main/java/ai/reveng/model/IOC.java new file mode 100644 index 0000000..99681d6 --- /dev/null +++ b/src/main/java/ai/reveng/model/IOC.java @@ -0,0 +1,544 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * IOC + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class IOC { + /** + * Type of the IOC + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + IP("ip"), + + DOMAIN("domain"), + + URL("url"), + + USERNAMES("usernames"), + + PASSWORDS("passwords"), + + FILE_HASH("file_hash"), + + MUTEX("mutex"), + + REGISTRY_KEY("registry_key"), + + FILENAME("filename"), + + EMAIL("email"), + + C2_ENDPOINT("c2_endpoint"), + + USER_AGENT("user_agent"), + + PEM_KEY("pem_key"), + + SSH_KEY("ssh_key"), + + NETWORK_PORT("network_port"), + + JA3("ja3"), + + SSL_CERT_FINGERPRINT("ssl_cert_fingerprint"), + + HTTP_HEADER("http_header"), + + SERVICE("service"), + + SCHEDULED_TASK("scheduled_task"), + + PE_HEADER("pe_header"), + + ENTROPY("entropy"), + + OTHER("other"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.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 TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private TypeEnum type; + + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nonnull + private String value; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nonnull + private String description; + + public static final String SERIALIZED_NAME_SOURCE = "source"; + @SerializedName(SERIALIZED_NAME_SOURCE) + @javax.annotation.Nullable + private String source; + + public static final String SERIALIZED_NAME_FUNCTION_ID = "function_id"; + @SerializedName(SERIALIZED_NAME_FUNCTION_ID) + @javax.annotation.Nullable + private Integer functionId; + + public static final String SERIALIZED_NAME_FUNCTION_NAME = "function_name"; + @SerializedName(SERIALIZED_NAME_FUNCTION_NAME) + @javax.annotation.Nullable + private String functionName; + + public IOC() { + } + + public IOC type(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + return this; + } + + /** + * Type of the IOC + * @return type + */ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + } + + + public IOC value(@javax.annotation.Nonnull String value) { + this.value = value; + return this; + } + + /** + * Value of the IOC + * @return value + */ + @javax.annotation.Nonnull + public String getValue() { + return value; + } + + public void setValue(@javax.annotation.Nonnull String value) { + this.value = value; + } + + + public IOC description(@javax.annotation.Nonnull String description) { + this.description = description; + return this; + } + + /** + * Description of the IOC + * @return description + */ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nonnull String description) { + this.description = description; + } + + + public IOC source(@javax.annotation.Nullable String source) { + this.source = source; + return this; + } + + /** + * Get source + * @return source + */ + @javax.annotation.Nullable + public String getSource() { + return source; + } + + public void setSource(@javax.annotation.Nullable String source) { + this.source = source; + } + + + public IOC functionId(@javax.annotation.Nullable Integer functionId) { + this.functionId = functionId; + return this; + } + + /** + * Get functionId + * @return functionId + */ + @javax.annotation.Nullable + public Integer getFunctionId() { + return functionId; + } + + public void setFunctionId(@javax.annotation.Nullable Integer functionId) { + this.functionId = functionId; + } + + + public IOC functionName(@javax.annotation.Nullable String functionName) { + this.functionName = functionName; + return this; + } + + /** + * Get functionName + * @return functionName + */ + @javax.annotation.Nullable + public String getFunctionName() { + return functionName; + } + + public void setFunctionName(@javax.annotation.Nullable String functionName) { + this.functionName = functionName; + } + + /** + * 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 IOC instance itself + */ + public IOC 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; + } + IOC IOC = (IOC) o; + return Objects.equals(this.type, IOC.type) && + Objects.equals(this.value, IOC.value) && + Objects.equals(this.description, IOC.description) && + Objects.equals(this.source, IOC.source) && + Objects.equals(this.functionId, IOC.functionId) && + Objects.equals(this.functionName, IOC.functionName)&& + Objects.equals(this.additionalProperties, IOC.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(type, value, description, source, functionId, functionName, 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 IOC {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" source: ").append(toIndentedString(source)).append("\n"); + sb.append(" functionId: ").append(toIndentedString(functionId)).append("\n"); + sb.append(" functionName: ").append(toIndentedString(functionName)).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("type", "value", "description", "source", "function_id", "function_name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("type", "value", "description")); + } + + /** + * 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 IOC + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!IOC.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in IOC is not found in the empty JSON string", IOC.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : IOC.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + if (!jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `value` to be a primitive type in the JSON string but got `%s`", jsonObj.get("value").toString())); + } + if (!jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if ((jsonObj.get("source") != null && !jsonObj.get("source").isJsonNull()) && !jsonObj.get("source").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `source` to be a primitive type in the JSON string but got `%s`", jsonObj.get("source").toString())); + } + if ((jsonObj.get("function_name") != null && !jsonObj.get("function_name").isJsonNull()) && !jsonObj.get("function_name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `function_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("function_name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!IOC.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'IOC' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(IOC.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, IOC 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 IOC read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + IOC 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 IOC given an JSON string + * + * @param jsonString JSON string + * @return An instance of IOC + * @throws IOException if the JSON string is invalid with respect to IOC + */ + public static IOC fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, IOC.class); + } + + /** + * Convert an instance of IOC to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/MITRETechnique.java b/src/main/java/ai/reveng/model/MITRETechnique.java new file mode 100644 index 0000000..8bb7fc7 --- /dev/null +++ b/src/main/java/ai/reveng/model/MITRETechnique.java @@ -0,0 +1,552 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import 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; + +/** + * MITRETechnique + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class MITRETechnique { + public static final String SERIALIZED_NAME_START_ADDR = "start_addr"; + @SerializedName(SERIALIZED_NAME_START_ADDR) + @javax.annotation.Nonnull + private String startAddr; + + public static final String SERIALIZED_NAME_END_ADDR = "end_addr"; + @SerializedName(SERIALIZED_NAME_END_ADDR) + @javax.annotation.Nonnull + private String endAddr; + + public static final String SERIALIZED_NAME_FUNCTION_ADDR = "function_addr"; + @SerializedName(SERIALIZED_NAME_FUNCTION_ADDR) + @javax.annotation.Nonnull + private String functionAddr; + + public static final String SERIALIZED_NAME_TECHNIQUE_ID = "technique_id"; + @SerializedName(SERIALIZED_NAME_TECHNIQUE_ID) + @javax.annotation.Nonnull + private String techniqueId; + + public static final String SERIALIZED_NAME_TECHNIQUE_NAME = "technique_name"; + @SerializedName(SERIALIZED_NAME_TECHNIQUE_NAME) + @javax.annotation.Nonnull + private String techniqueName; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nonnull + private String description; + + public static final String SERIALIZED_NAME_FUNCTION_ID = "function_id"; + @SerializedName(SERIALIZED_NAME_FUNCTION_ID) + @javax.annotation.Nonnull + private Integer functionId; + + public static final String SERIALIZED_NAME_FUNCTION_NAME = "function_name"; + @SerializedName(SERIALIZED_NAME_FUNCTION_NAME) + @javax.annotation.Nonnull + private String functionName; + + public static final String SERIALIZED_NAME_TECHNIQUE_URL = "technique_url"; + @SerializedName(SERIALIZED_NAME_TECHNIQUE_URL) + @javax.annotation.Nonnull + private String techniqueUrl; + + public static final String SERIALIZED_NAME_TECHNIQUE_DESCRIPTION = "technique_description"; + @SerializedName(SERIALIZED_NAME_TECHNIQUE_DESCRIPTION) + @javax.annotation.Nonnull + private String techniqueDescription; + + public MITRETechnique() { + } + + public MITRETechnique startAddr(@javax.annotation.Nonnull String startAddr) { + this.startAddr = startAddr; + return this; + } + + /** + * Starting address of the technique + * @return startAddr + */ + @javax.annotation.Nonnull + public String getStartAddr() { + return startAddr; + } + + public void setStartAddr(@javax.annotation.Nonnull String startAddr) { + this.startAddr = startAddr; + } + + + public MITRETechnique endAddr(@javax.annotation.Nonnull String endAddr) { + this.endAddr = endAddr; + return this; + } + + /** + * Ending address of the technique + * @return endAddr + */ + @javax.annotation.Nonnull + public String getEndAddr() { + return endAddr; + } + + public void setEndAddr(@javax.annotation.Nonnull String endAddr) { + this.endAddr = endAddr; + } + + + public MITRETechnique functionAddr(@javax.annotation.Nonnull String functionAddr) { + this.functionAddr = functionAddr; + return this; + } + + /** + * Function address where the technique is found + * @return functionAddr + */ + @javax.annotation.Nonnull + public String getFunctionAddr() { + return functionAddr; + } + + public void setFunctionAddr(@javax.annotation.Nonnull String functionAddr) { + this.functionAddr = functionAddr; + } + + + public MITRETechnique techniqueId(@javax.annotation.Nonnull String techniqueId) { + this.techniqueId = techniqueId; + return this; + } + + /** + * MITRE technique identifier + * @return techniqueId + */ + @javax.annotation.Nonnull + public String getTechniqueId() { + return techniqueId; + } + + public void setTechniqueId(@javax.annotation.Nonnull String techniqueId) { + this.techniqueId = techniqueId; + } + + + public MITRETechnique techniqueName(@javax.annotation.Nonnull String techniqueName) { + this.techniqueName = techniqueName; + return this; + } + + /** + * Name of the MITRE technique + * @return techniqueName + */ + @javax.annotation.Nonnull + public String getTechniqueName() { + return techniqueName; + } + + public void setTechniqueName(@javax.annotation.Nonnull String techniqueName) { + this.techniqueName = techniqueName; + } + + + public MITRETechnique description(@javax.annotation.Nonnull String description) { + this.description = description; + return this; + } + + /** + * Description of the technique + * @return description + */ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nonnull String description) { + this.description = description; + } + + + public MITRETechnique functionId(@javax.annotation.Nonnull Integer functionId) { + this.functionId = functionId; + return this; + } + + /** + * Unique identifier of the function containing the technique + * @return functionId + */ + @javax.annotation.Nonnull + public Integer getFunctionId() { + return functionId; + } + + public void setFunctionId(@javax.annotation.Nonnull Integer functionId) { + this.functionId = functionId; + } + + + public MITRETechnique functionName(@javax.annotation.Nonnull String functionName) { + this.functionName = functionName; + return this; + } + + /** + * Name of the function containing the technique + * @return functionName + */ + @javax.annotation.Nonnull + public String getFunctionName() { + return functionName; + } + + public void setFunctionName(@javax.annotation.Nonnull String functionName) { + this.functionName = functionName; + } + + + public MITRETechnique techniqueUrl(@javax.annotation.Nonnull String techniqueUrl) { + this.techniqueUrl = techniqueUrl; + return this; + } + + /** + * URL to the MITRE ATT&CK technique page + * @return techniqueUrl + */ + @javax.annotation.Nonnull + public String getTechniqueUrl() { + return techniqueUrl; + } + + public void setTechniqueUrl(@javax.annotation.Nonnull String techniqueUrl) { + this.techniqueUrl = techniqueUrl; + } + + + public MITRETechnique techniqueDescription(@javax.annotation.Nonnull String techniqueDescription) { + this.techniqueDescription = techniqueDescription; + return this; + } + + /** + * Full description of the MITRE technique from ATT&CK + * @return techniqueDescription + */ + @javax.annotation.Nonnull + public String getTechniqueDescription() { + return techniqueDescription; + } + + public void setTechniqueDescription(@javax.annotation.Nonnull String techniqueDescription) { + this.techniqueDescription = techniqueDescription; + } + + /** + * 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 MITRETechnique instance itself + */ + public MITRETechnique 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; + } + MITRETechnique miTRETechnique = (MITRETechnique) o; + return Objects.equals(this.startAddr, miTRETechnique.startAddr) && + Objects.equals(this.endAddr, miTRETechnique.endAddr) && + Objects.equals(this.functionAddr, miTRETechnique.functionAddr) && + Objects.equals(this.techniqueId, miTRETechnique.techniqueId) && + Objects.equals(this.techniqueName, miTRETechnique.techniqueName) && + Objects.equals(this.description, miTRETechnique.description) && + Objects.equals(this.functionId, miTRETechnique.functionId) && + Objects.equals(this.functionName, miTRETechnique.functionName) && + Objects.equals(this.techniqueUrl, miTRETechnique.techniqueUrl) && + Objects.equals(this.techniqueDescription, miTRETechnique.techniqueDescription)&& + Objects.equals(this.additionalProperties, miTRETechnique.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(startAddr, endAddr, functionAddr, techniqueId, techniqueName, description, functionId, functionName, techniqueUrl, techniqueDescription, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MITRETechnique {\n"); + sb.append(" startAddr: ").append(toIndentedString(startAddr)).append("\n"); + sb.append(" endAddr: ").append(toIndentedString(endAddr)).append("\n"); + sb.append(" functionAddr: ").append(toIndentedString(functionAddr)).append("\n"); + sb.append(" techniqueId: ").append(toIndentedString(techniqueId)).append("\n"); + sb.append(" techniqueName: ").append(toIndentedString(techniqueName)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" functionId: ").append(toIndentedString(functionId)).append("\n"); + sb.append(" functionName: ").append(toIndentedString(functionName)).append("\n"); + sb.append(" techniqueUrl: ").append(toIndentedString(techniqueUrl)).append("\n"); + sb.append(" techniqueDescription: ").append(toIndentedString(techniqueDescription)).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("start_addr", "end_addr", "function_addr", "technique_id", "technique_name", "description", "function_id", "function_name", "technique_url", "technique_description")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("start_addr", "end_addr", "function_addr", "technique_id", "technique_name", "description", "function_id", "function_name", "technique_url", "technique_description")); + } + + /** + * 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 MITRETechnique + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MITRETechnique.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in MITRETechnique is not found in the empty JSON string", MITRETechnique.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : MITRETechnique.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("start_addr").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `start_addr` to be a primitive type in the JSON string but got `%s`", jsonObj.get("start_addr").toString())); + } + if (!jsonObj.get("end_addr").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `end_addr` to be a primitive type in the JSON string but got `%s`", jsonObj.get("end_addr").toString())); + } + if (!jsonObj.get("function_addr").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `function_addr` to be a primitive type in the JSON string but got `%s`", jsonObj.get("function_addr").toString())); + } + if (!jsonObj.get("technique_id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `technique_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("technique_id").toString())); + } + if (!jsonObj.get("technique_name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `technique_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("technique_name").toString())); + } + if (!jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if (!jsonObj.get("function_name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `function_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("function_name").toString())); + } + if (!jsonObj.get("technique_url").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `technique_url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("technique_url").toString())); + } + if (!jsonObj.get("technique_description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `technique_description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("technique_description").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MITRETechnique.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MITRETechnique' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MITRETechnique.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MITRETechnique 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 MITRETechnique read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MITRETechnique 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 MITRETechnique given an JSON string + * + * @param jsonString JSON string + * @return An instance of MITRETechnique + * @throws IOException if the JSON string is invalid with respect to MITRETechnique + */ + public static MITRETechnique fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MITRETechnique.class); + } + + /** + * Convert an instance of MITRETechnique to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/QueuedWorkflowTaskResponse.java b/src/main/java/ai/reveng/model/QueuedWorkflowTaskResponse.java new file mode 100644 index 0000000..7486743 --- /dev/null +++ b/src/main/java/ai/reveng/model/QueuedWorkflowTaskResponse.java @@ -0,0 +1,294 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import 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; + +/** + * QueuedWorkflowTaskResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class QueuedWorkflowTaskResponse { + public static final String SERIALIZED_NAME_TASK_ID = "task_id"; + @SerializedName(SERIALIZED_NAME_TASK_ID) + @javax.annotation.Nonnull + private String taskId; + + public QueuedWorkflowTaskResponse() { + } + + public QueuedWorkflowTaskResponse taskId(@javax.annotation.Nonnull String taskId) { + this.taskId = taskId; + return this; + } + + /** + * Get taskId + * @return taskId + */ + @javax.annotation.Nonnull + public String getTaskId() { + return taskId; + } + + public void setTaskId(@javax.annotation.Nonnull String taskId) { + this.taskId = taskId; + } + + /** + * 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 QueuedWorkflowTaskResponse instance itself + */ + public QueuedWorkflowTaskResponse 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; + } + QueuedWorkflowTaskResponse queuedWorkflowTaskResponse = (QueuedWorkflowTaskResponse) o; + return Objects.equals(this.taskId, queuedWorkflowTaskResponse.taskId)&& + Objects.equals(this.additionalProperties, queuedWorkflowTaskResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(taskId, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class QueuedWorkflowTaskResponse {\n"); + sb.append(" taskId: ").append(toIndentedString(taskId)).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("task_id")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("task_id")); + } + + /** + * 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 QueuedWorkflowTaskResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!QueuedWorkflowTaskResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in QueuedWorkflowTaskResponse is not found in the empty JSON string", QueuedWorkflowTaskResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : QueuedWorkflowTaskResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("task_id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `task_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("task_id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!QueuedWorkflowTaskResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'QueuedWorkflowTaskResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(QueuedWorkflowTaskResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, QueuedWorkflowTaskResponse 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 QueuedWorkflowTaskResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + QueuedWorkflowTaskResponse 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 QueuedWorkflowTaskResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of QueuedWorkflowTaskResponse + * @throws IOException if the JSON string is invalid with respect to QueuedWorkflowTaskResponse + */ + public static QueuedWorkflowTaskResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, QueuedWorkflowTaskResponse.class); + } + + /** + * Convert an instance of QueuedWorkflowTaskResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/ReportAnalysisResponse.java b/src/main/java/ai/reveng/model/ReportAnalysisResponse.java new file mode 100644 index 0000000..1587e31 --- /dev/null +++ b/src/main/java/ai/reveng/model/ReportAnalysisResponse.java @@ -0,0 +1,585 @@ +/* + * 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.IOC; +import ai.reveng.model.MITRETechnique; +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; + +/** + * ReportAnalysisResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ReportAnalysisResponse { + public static final String SERIALIZED_NAME_SUMMARY = "summary"; + @SerializedName(SERIALIZED_NAME_SUMMARY) + @javax.annotation.Nonnull + private String summary; + + /** + * The type of software being analyzed + */ + @JsonAdapter(SoftwareTypeEnum.Adapter.class) + public enum SoftwareTypeEnum { + MALICIOUS("Malicious"), + + BENIGN("Benign"), + + POTENTIALLY_UNWANTED_APPLICATION_PUA_("Potentially Unwanted Application (PUA)"), + + LEGITIMATE("Legitimate"), + + BACKDOORED_LEGITIMATE_SOFTWARE("Backdoored Legitimate Software"); + + private String value; + + SoftwareTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SoftwareTypeEnum fromValue(String value) { + for (SoftwareTypeEnum b : SoftwareTypeEnum.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 SoftwareTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SoftwareTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SoftwareTypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + SoftwareTypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_SOFTWARE_TYPE = "software_type"; + @SerializedName(SERIALIZED_NAME_SOFTWARE_TYPE) + @javax.annotation.Nonnull + private SoftwareTypeEnum softwareType; + + public static final String SERIALIZED_NAME_TOTAL_NUMBER_OF_FUNCTIONS = "total_number_of_functions"; + @SerializedName(SERIALIZED_NAME_TOTAL_NUMBER_OF_FUNCTIONS) + @javax.annotation.Nonnull + private Integer totalNumberOfFunctions; + + public static final String SERIALIZED_NAME_NUMBER_OF_ANALYSED_FUNCTIONS = "number_of_analysed_functions"; + @SerializedName(SERIALIZED_NAME_NUMBER_OF_ANALYSED_FUNCTIONS) + @javax.annotation.Nonnull + private Integer numberOfAnalysedFunctions; + + public static final String SERIALIZED_NAME_ATTACK_FLOW_SUMMARY = "attack_flow_summary"; + @SerializedName(SERIALIZED_NAME_ATTACK_FLOW_SUMMARY) + @javax.annotation.Nonnull + private String attackFlowSummary; + + public static final String SERIALIZED_NAME_IO_CS = "IOCs"; + @SerializedName(SERIALIZED_NAME_IO_CS) + @javax.annotation.Nonnull + private List ioCs = new ArrayList<>(); + + public static final String SERIALIZED_NAME_EXECUTABLE_TECHNIQUES = "executable_techniques"; + @SerializedName(SERIALIZED_NAME_EXECUTABLE_TECHNIQUES) + @javax.annotation.Nonnull + private List executableTechniques = new ArrayList<>(); + + public static final String SERIALIZED_NAME_YARA_RULE = "yara_rule"; + @SerializedName(SERIALIZED_NAME_YARA_RULE) + @javax.annotation.Nonnull + private String yaraRule; + + public ReportAnalysisResponse() { + } + + public ReportAnalysisResponse summary(@javax.annotation.Nonnull String summary) { + this.summary = summary; + return this; + } + + /** + * A markdown summary of the report + * @return summary + */ + @javax.annotation.Nonnull + public String getSummary() { + return summary; + } + + public void setSummary(@javax.annotation.Nonnull String summary) { + this.summary = summary; + } + + + public ReportAnalysisResponse softwareType(@javax.annotation.Nonnull SoftwareTypeEnum softwareType) { + this.softwareType = softwareType; + return this; + } + + /** + * The type of software being analyzed + * @return softwareType + */ + @javax.annotation.Nonnull + public SoftwareTypeEnum getSoftwareType() { + return softwareType; + } + + public void setSoftwareType(@javax.annotation.Nonnull SoftwareTypeEnum softwareType) { + this.softwareType = softwareType; + } + + + public ReportAnalysisResponse totalNumberOfFunctions(@javax.annotation.Nonnull Integer totalNumberOfFunctions) { + this.totalNumberOfFunctions = totalNumberOfFunctions; + return this; + } + + /** + * The total number of functions identified in the binary + * @return totalNumberOfFunctions + */ + @javax.annotation.Nonnull + public Integer getTotalNumberOfFunctions() { + return totalNumberOfFunctions; + } + + public void setTotalNumberOfFunctions(@javax.annotation.Nonnull Integer totalNumberOfFunctions) { + this.totalNumberOfFunctions = totalNumberOfFunctions; + } + + + public ReportAnalysisResponse numberOfAnalysedFunctions(@javax.annotation.Nonnull Integer numberOfAnalysedFunctions) { + this.numberOfAnalysedFunctions = numberOfAnalysedFunctions; + return this; + } + + /** + * The number of functions that were analyzed in the binary + * @return numberOfAnalysedFunctions + */ + @javax.annotation.Nonnull + public Integer getNumberOfAnalysedFunctions() { + return numberOfAnalysedFunctions; + } + + public void setNumberOfAnalysedFunctions(@javax.annotation.Nonnull Integer numberOfAnalysedFunctions) { + this.numberOfAnalysedFunctions = numberOfAnalysedFunctions; + } + + + public ReportAnalysisResponse attackFlowSummary(@javax.annotation.Nonnull String attackFlowSummary) { + this.attackFlowSummary = attackFlowSummary; + return this; + } + + /** + * A summary in markdown format of the attack flow + * @return attackFlowSummary + */ + @javax.annotation.Nonnull + public String getAttackFlowSummary() { + return attackFlowSummary; + } + + public void setAttackFlowSummary(@javax.annotation.Nonnull String attackFlowSummary) { + this.attackFlowSummary = attackFlowSummary; + } + + + public ReportAnalysisResponse ioCs(@javax.annotation.Nonnull List ioCs) { + this.ioCs = ioCs; + return this; + } + + public ReportAnalysisResponse addIoCsItem(IOC ioCsItem) { + if (this.ioCs == null) { + this.ioCs = new ArrayList<>(); + } + this.ioCs.add(ioCsItem); + return this; + } + + /** + * A list of IOCs (Indicators of Compromise) found in the analysis + * @return ioCs + */ + @javax.annotation.Nonnull + public List getIoCs() { + return ioCs; + } + + public void setIoCs(@javax.annotation.Nonnull List ioCs) { + this.ioCs = ioCs; + } + + + public ReportAnalysisResponse executableTechniques(@javax.annotation.Nonnull List executableTechniques) { + this.executableTechniques = executableTechniques; + return this; + } + + public ReportAnalysisResponse addExecutableTechniquesItem(MITRETechnique executableTechniquesItem) { + if (this.executableTechniques == null) { + this.executableTechniques = new ArrayList<>(); + } + this.executableTechniques.add(executableTechniquesItem); + return this; + } + + /** + * A series of MITRE Techniques found + * @return executableTechniques + */ + @javax.annotation.Nonnull + public List getExecutableTechniques() { + return executableTechniques; + } + + public void setExecutableTechniques(@javax.annotation.Nonnull List executableTechniques) { + this.executableTechniques = executableTechniques; + } + + + public ReportAnalysisResponse yaraRule(@javax.annotation.Nonnull String yaraRule) { + this.yaraRule = yaraRule; + return this; + } + + /** + * The YARA rule generated for the binary + * @return yaraRule + */ + @javax.annotation.Nonnull + public String getYaraRule() { + return yaraRule; + } + + public void setYaraRule(@javax.annotation.Nonnull String yaraRule) { + this.yaraRule = yaraRule; + } + + /** + * 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 ReportAnalysisResponse instance itself + */ + public ReportAnalysisResponse 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; + } + ReportAnalysisResponse reportAnalysisResponse = (ReportAnalysisResponse) o; + return Objects.equals(this.summary, reportAnalysisResponse.summary) && + Objects.equals(this.softwareType, reportAnalysisResponse.softwareType) && + Objects.equals(this.totalNumberOfFunctions, reportAnalysisResponse.totalNumberOfFunctions) && + Objects.equals(this.numberOfAnalysedFunctions, reportAnalysisResponse.numberOfAnalysedFunctions) && + Objects.equals(this.attackFlowSummary, reportAnalysisResponse.attackFlowSummary) && + Objects.equals(this.ioCs, reportAnalysisResponse.ioCs) && + Objects.equals(this.executableTechniques, reportAnalysisResponse.executableTechniques) && + Objects.equals(this.yaraRule, reportAnalysisResponse.yaraRule)&& + Objects.equals(this.additionalProperties, reportAnalysisResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(summary, softwareType, totalNumberOfFunctions, numberOfAnalysedFunctions, attackFlowSummary, ioCs, executableTechniques, yaraRule, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReportAnalysisResponse {\n"); + sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); + sb.append(" softwareType: ").append(toIndentedString(softwareType)).append("\n"); + sb.append(" totalNumberOfFunctions: ").append(toIndentedString(totalNumberOfFunctions)).append("\n"); + sb.append(" numberOfAnalysedFunctions: ").append(toIndentedString(numberOfAnalysedFunctions)).append("\n"); + sb.append(" attackFlowSummary: ").append(toIndentedString(attackFlowSummary)).append("\n"); + sb.append(" ioCs: ").append(toIndentedString(ioCs)).append("\n"); + sb.append(" executableTechniques: ").append(toIndentedString(executableTechniques)).append("\n"); + sb.append(" yaraRule: ").append(toIndentedString(yaraRule)).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("summary", "software_type", "total_number_of_functions", "number_of_analysed_functions", "attack_flow_summary", "IOCs", "executable_techniques", "yara_rule")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("summary", "software_type", "total_number_of_functions", "number_of_analysed_functions", "attack_flow_summary", "IOCs", "executable_techniques", "yara_rule")); + } + + /** + * 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 ReportAnalysisResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReportAnalysisResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in ReportAnalysisResponse is not found in the empty JSON string", ReportAnalysisResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ReportAnalysisResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("summary").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `summary` to be a primitive type in the JSON string but got `%s`", jsonObj.get("summary").toString())); + } + if (!jsonObj.get("software_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `software_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("software_type").toString())); + } + // validate the required field `software_type` + SoftwareTypeEnum.validateJsonElement(jsonObj.get("software_type")); + if (!jsonObj.get("attack_flow_summary").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `attack_flow_summary` to be a primitive type in the JSON string but got `%s`", jsonObj.get("attack_flow_summary").toString())); + } + // ensure the json data is an array + if (!jsonObj.get("IOCs").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `IOCs` to be an array in the JSON string but got `%s`", jsonObj.get("IOCs").toString())); + } + + JsonArray jsonArrayioCs = jsonObj.getAsJsonArray("IOCs"); + // validate the required field `IOCs` (array) + for (int i = 0; i < jsonArrayioCs.size(); i++) { + IOC.validateJsonElement(jsonArrayioCs.get(i)); + }; + // ensure the json data is an array + if (!jsonObj.get("executable_techniques").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `executable_techniques` to be an array in the JSON string but got `%s`", jsonObj.get("executable_techniques").toString())); + } + + JsonArray jsonArrayexecutableTechniques = jsonObj.getAsJsonArray("executable_techniques"); + // validate the required field `executable_techniques` (array) + for (int i = 0; i < jsonArrayexecutableTechniques.size(); i++) { + MITRETechnique.validateJsonElement(jsonArrayexecutableTechniques.get(i)); + }; + if (!jsonObj.get("yara_rule").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `yara_rule` to be a primitive type in the JSON string but got `%s`", jsonObj.get("yara_rule").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReportAnalysisResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReportAnalysisResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReportAnalysisResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReportAnalysisResponse 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 ReportAnalysisResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ReportAnalysisResponse 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 ReportAnalysisResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReportAnalysisResponse + * @throws IOException if the JSON string is invalid with respect to ReportAnalysisResponse + */ + public static ReportAnalysisResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReportAnalysisResponse.class); + } + + /** + * Convert an instance of ReportAnalysisResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/TaskStatusResponse.java b/src/main/java/ai/reveng/model/TaskStatusResponse.java new file mode 100644 index 0000000..382281c --- /dev/null +++ b/src/main/java/ai/reveng/model/TaskStatusResponse.java @@ -0,0 +1,294 @@ +/* + * 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.BinaryTaskStatus; +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; + +/** + * TaskStatusResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class TaskStatusResponse { + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull + private BinaryTaskStatus status; + + public TaskStatusResponse() { + } + + public TaskStatusResponse status(@javax.annotation.Nonnull BinaryTaskStatus status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nonnull + public BinaryTaskStatus getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nonnull BinaryTaskStatus status) { + this.status = status; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TaskStatusResponse instance itself + */ + public TaskStatusResponse 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; + } + TaskStatusResponse taskStatusResponse = (TaskStatusResponse) o; + return Objects.equals(this.status, taskStatusResponse.status)&& + Objects.equals(this.additionalProperties, taskStatusResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(status, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TaskStatusResponse {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + 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")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("status")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TaskStatusResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TaskStatusResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in TaskStatusResponse is not found in the empty JSON string", TaskStatusResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : TaskStatusResponse.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 `status` + BinaryTaskStatus.validateJsonElement(jsonObj.get("status")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TaskStatusResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TaskStatusResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TaskStatusResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TaskStatusResponse 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 TaskStatusResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + TaskStatusResponse 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 TaskStatusResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of TaskStatusResponse + * @throws IOException if the JSON string is invalid with respect to TaskStatusResponse + */ + public static TaskStatusResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TaskStatusResponse.class); + } + + /** + * Convert an instance of TaskStatusResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/TriageFunctionResponse.java b/src/main/java/ai/reveng/model/TriageFunctionResponse.java new file mode 100644 index 0000000..e38eee7 --- /dev/null +++ b/src/main/java/ai/reveng/model/TriageFunctionResponse.java @@ -0,0 +1,487 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +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; + +/** + * TriageFunctionResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class TriageFunctionResponse { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private Integer id; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + @javax.annotation.Nonnull + private Integer address; + + public static final String SERIALIZED_NAME_SUMMARY = "summary"; + @SerializedName(SERIALIZED_NAME_SUMMARY) + @javax.annotation.Nonnull + private String summary; + + public static final String SERIALIZED_NAME_SCORE = "score"; + @SerializedName(SERIALIZED_NAME_SCORE) + @javax.annotation.Nonnull + private BigDecimal score; + + /** + * Gets or Sets capabilities + */ + @JsonAdapter(CapabilitiesEnum.Adapter.class) + public enum CapabilitiesEnum { + PACKING_AND_OBFUSCATION("packing_and_obfuscation"), + + DEFENSE_EVASION("defense_evasion"), + + PRIVILEGE_ESCALATION("privilege_escalation"), + + PERSISTENCE_MECHANISMS("persistence_mechanisms"), + + DISCOVERY_AND_RECONNAISSANCE("discovery_and_reconnaissance"), + + CREDENTIAL_AND_DATA_COLLECTION("credential_and_data_collection"), + + COMMUNICATION_AND_C2("communication_and_c2"), + + CRYPTOGRAPHIC_OPERATIONS("cryptographic_operations"), + + PROCESS_AND_MEMORY_MANIPULATION("process_and_memory_manipulation"), + + PROCESS_AND_COMMAND_EXECUTION("process_and_command_execution"), + + FILE_ACTIVITY("file_activity"); + + private String value; + + CapabilitiesEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static CapabilitiesEnum fromValue(String value) { + for (CapabilitiesEnum b : CapabilitiesEnum.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 CapabilitiesEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public CapabilitiesEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return CapabilitiesEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + CapabilitiesEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_CAPABILITIES = "capabilities"; + @SerializedName(SERIALIZED_NAME_CAPABILITIES) + @javax.annotation.Nonnull + private List capabilities = new ArrayList<>(); + + public TriageFunctionResponse() { + } + + public TriageFunctionResponse id(@javax.annotation.Nonnull Integer id) { + this.id = id; + return this; + } + + /** + * Unique identifier of the function + * @return id + */ + @javax.annotation.Nonnull + public Integer getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull Integer id) { + this.id = id; + } + + + public TriageFunctionResponse address(@javax.annotation.Nonnull Integer address) { + this.address = address; + return this; + } + + /** + * Address of the function in the binary + * @return address + */ + @javax.annotation.Nonnull + public Integer getAddress() { + return address; + } + + public void setAddress(@javax.annotation.Nonnull Integer address) { + this.address = address; + } + + + public TriageFunctionResponse summary(@javax.annotation.Nonnull String summary) { + this.summary = summary; + return this; + } + + /** + * Summary of the function's behaviour + * @return summary + */ + @javax.annotation.Nonnull + public String getSummary() { + return summary; + } + + public void setSummary(@javax.annotation.Nonnull String summary) { + this.summary = summary; + } + + + public TriageFunctionResponse score(@javax.annotation.Nonnull BigDecimal score) { + this.score = score; + return this; + } + + /** + * Score indicating the function's relevance + * minimum: 0 + * maximum: 1 + * @return score + */ + @javax.annotation.Nonnull + public BigDecimal getScore() { + return score; + } + + public void setScore(@javax.annotation.Nonnull BigDecimal score) { + this.score = score; + } + + + public TriageFunctionResponse capabilities(@javax.annotation.Nonnull List capabilities) { + this.capabilities = capabilities; + return this; + } + + public TriageFunctionResponse addCapabilitiesItem(CapabilitiesEnum capabilitiesItem) { + if (this.capabilities == null) { + this.capabilities = new ArrayList<>(); + } + this.capabilities.add(capabilitiesItem); + return this; + } + + /** + * List of capabilities exhibited by the function + * @return capabilities + */ + @javax.annotation.Nonnull + public List getCapabilities() { + return capabilities; + } + + public void setCapabilities(@javax.annotation.Nonnull List capabilities) { + this.capabilities = capabilities; + } + + /** + * 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 TriageFunctionResponse instance itself + */ + public TriageFunctionResponse 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; + } + TriageFunctionResponse triageFunctionResponse = (TriageFunctionResponse) o; + return Objects.equals(this.id, triageFunctionResponse.id) && + Objects.equals(this.address, triageFunctionResponse.address) && + Objects.equals(this.summary, triageFunctionResponse.summary) && + Objects.equals(this.score, triageFunctionResponse.score) && + Objects.equals(this.capabilities, triageFunctionResponse.capabilities)&& + Objects.equals(this.additionalProperties, triageFunctionResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, address, summary, score, capabilities, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TriageFunctionResponse {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); + sb.append(" score: ").append(toIndentedString(score)).append("\n"); + sb.append(" capabilities: ").append(toIndentedString(capabilities)).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("id", "address", "summary", "score", "capabilities")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("id", "address", "summary", "score", "capabilities")); + } + + /** + * 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 TriageFunctionResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TriageFunctionResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in TriageFunctionResponse is not found in the empty JSON string", TriageFunctionResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : TriageFunctionResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("summary").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `summary` to be a primitive type in the JSON string but got `%s`", jsonObj.get("summary").toString())); + } + // ensure the required json array is present + if (jsonObj.get("capabilities") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("capabilities").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `capabilities` to be an array in the JSON string but got `%s`", jsonObj.get("capabilities").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TriageFunctionResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TriageFunctionResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TriageFunctionResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TriageFunctionResponse 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 TriageFunctionResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + TriageFunctionResponse 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 TriageFunctionResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of TriageFunctionResponse + * @throws IOException if the JSON string is invalid with respect to TriageFunctionResponse + */ + public static TriageFunctionResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TriageFunctionResponse.class); + } + + /** + * Convert an instance of TriageFunctionResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/TriageReportResponse.java b/src/main/java/ai/reveng/model/TriageReportResponse.java new file mode 100644 index 0000000..c1a115d --- /dev/null +++ b/src/main/java/ai/reveng/model/TriageReportResponse.java @@ -0,0 +1,370 @@ +/* + * 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.TriageFunctionResponse; +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.math.BigDecimal; +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; + +/** + * TriageReportResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class TriageReportResponse { + public static final String SERIALIZED_NAME_SOFTWARE_SCORE = "software_score"; + @SerializedName(SERIALIZED_NAME_SOFTWARE_SCORE) + @javax.annotation.Nonnull + private BigDecimal softwareScore; + + public static final String SERIALIZED_NAME_SUMMARY = "summary"; + @SerializedName(SERIALIZED_NAME_SUMMARY) + @javax.annotation.Nonnull + private String summary; + + public static final String SERIALIZED_NAME_FUNCTIONS = "functions"; + @SerializedName(SERIALIZED_NAME_FUNCTIONS) + @javax.annotation.Nonnull + private List functions = new ArrayList<>(); + + public TriageReportResponse() { + } + + public TriageReportResponse softwareScore(@javax.annotation.Nonnull BigDecimal softwareScore) { + this.softwareScore = softwareScore; + return this; + } + + /** + * Overall triage score for the software + * minimum: 0 + * maximum: 1 + * @return softwareScore + */ + @javax.annotation.Nonnull + public BigDecimal getSoftwareScore() { + return softwareScore; + } + + public void setSoftwareScore(@javax.annotation.Nonnull BigDecimal softwareScore) { + this.softwareScore = softwareScore; + } + + + public TriageReportResponse summary(@javax.annotation.Nonnull String summary) { + this.summary = summary; + return this; + } + + /** + * Summary of the triage analysis + * @return summary + */ + @javax.annotation.Nonnull + public String getSummary() { + return summary; + } + + public void setSummary(@javax.annotation.Nonnull String summary) { + this.summary = summary; + } + + + public TriageReportResponse functions(@javax.annotation.Nonnull List functions) { + this.functions = functions; + return this; + } + + public TriageReportResponse addFunctionsItem(TriageFunctionResponse functionsItem) { + if (this.functions == null) { + this.functions = new ArrayList<>(); + } + this.functions.add(functionsItem); + return this; + } + + /** + * List of triaged functions + * @return functions + */ + @javax.annotation.Nonnull + public List getFunctions() { + return functions; + } + + public void setFunctions(@javax.annotation.Nonnull List functions) { + this.functions = functions; + } + + /** + * 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 TriageReportResponse instance itself + */ + public TriageReportResponse 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; + } + TriageReportResponse triageReportResponse = (TriageReportResponse) o; + return Objects.equals(this.softwareScore, triageReportResponse.softwareScore) && + Objects.equals(this.summary, triageReportResponse.summary) && + Objects.equals(this.functions, triageReportResponse.functions)&& + Objects.equals(this.additionalProperties, triageReportResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(softwareScore, summary, functions, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TriageReportResponse {\n"); + sb.append(" softwareScore: ").append(toIndentedString(softwareScore)).append("\n"); + sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); + sb.append(" functions: ").append(toIndentedString(functions)).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("software_score", "summary", "functions")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("software_score", "summary", "functions")); + } + + /** + * 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 TriageReportResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TriageReportResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in TriageReportResponse is not found in the empty JSON string", TriageReportResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : TriageReportResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("summary").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `summary` to be a primitive type in the JSON string but got `%s`", jsonObj.get("summary").toString())); + } + // ensure the json data is an array + if (!jsonObj.get("functions").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `functions` to be an array in the JSON string but got `%s`", jsonObj.get("functions").toString())); + } + + JsonArray jsonArrayfunctions = jsonObj.getAsJsonArray("functions"); + // validate the required field `functions` (array) + for (int i = 0; i < jsonArrayfunctions.size(); i++) { + TriageFunctionResponse.validateJsonElement(jsonArrayfunctions.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TriageReportResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TriageReportResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TriageReportResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TriageReportResponse 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 TriageReportResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + TriageReportResponse 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 TriageReportResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of TriageReportResponse + * @throws IOException if the JSON string is invalid with respect to TriageReportResponse + */ + public static TriageReportResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TriageReportResponse.class); + } + + /** + * Convert an instance of TriageReportResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} +